e.g. when passing enums like direction or boundary_side to functions like fields::set_boundary, right now SWIG just does static_cast from an integer value (int), which performs no checks and could result in a crash if the user passes something invalid.
A simple solution would be to just add SWIG typemaps for these enum types that checks whether the value is in range and otherwise throws ValueError or something.
e.g. when passing enums like
directionorboundary_sideto functions likefields::set_boundary, right now SWIG just doesstatic_castfrom an integer value (int), which performs no checks and could result in a crash if the user passes something invalid.A simple solution would be to just add SWIG typemaps for these enum types that checks whether the value is in range and otherwise throws
ValueErroror something.