Skip to content

Raise Warning if the Capacity Array is Not Set But mapc2p is - #752

Merged
mandli merged 9 commits into
clawpack:masterfrom
NDM14:feature/614/raise-warning-capacity
Feb 2, 2026
Merged

Raise Warning if the Capacity Array is Not Set But mapc2p is#752
mandli merged 9 commits into
clawpack:masterfrom
NDM14:feature/614/raise-warning-capacity

Conversation

@NDM14

@NDM14 NDM14 commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Changes:

  • added method is_mapped_state_valid to state class to check whether the capacity array and its index is set when mapc2p is also set.
  • added method is_mapped_solution_valid to check whether every state has a valid mapping at runtime.
  • added test class and test to check whether the updated is_valid method works as intended

The names of the methods are debatable. I tried to I adapt to the existing structure.
Also the ValueError can be exchanged to Warnings or bools. Depending on want you all want.
Raising an ValueError seemed more logical, because the program should break, when the mapping isn't valid, but can go through when no mapping isn't present. That's why I used the boolean there.
To give out logging with a boolean value seems a little bit outdated. I can also introduce errorhandling somewhere, but I'm not sure where it should be. Maybe that should be done when a simulation is created.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants