Skip to content
2 changes: 0 additions & 2 deletions src/pyclaw/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ def is_valid(self):
- (bool) - True if valid, false otherwise
"""
return all([state.is_valid() for state in self.states])


def __str__(self):
output = "states:\n"
# This is information about each of the states
Expand Down
10 changes: 10 additions & 0 deletions src/pyclaw/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ def is_valid(self):
if not self.aux.flags['F_CONTIGUOUS']:
logger.debug('aux array is not Fortran contiguous.')
valid = False
if self.grid.mapc2p is not None and self.aux is None:
raise ValueError("Mapped grid requires capacity array to be set. " \
"Please set state.aux.")
Comment thread
NDM14 marked this conversation as resolved.
Outdated
elif self.grid.mapc2p is not None and self.aux is not None:
if self.index_capa == -1:
raise ValueError("Capacity function index is not set. " \
"Please set state.index_capa to the appropriate index in the aux array.")
elif self.index_capa < 0 or self.index_capa > self.num_aux -1:
raise ValueError("Capacity function index out of range. " \
"Please set state.index_capa to the appropriate index in the aux array.")
return valid

def set_cparam(self,fortran_module):
Expand Down