diff --git a/source/simulator/introspection.cc b/source/simulator/introspection.cc index e7c0e0d220d..6675db64fe6 100644 --- a/source/simulator/introspection.cc +++ b/source/simulator/introspection.cc @@ -405,6 +405,8 @@ namespace aspect bool Introspection::composition_type_exists (const CompositionalFieldDescription::Type &type) const { + Assert(type < composition_indices_for_type.size(), ExcInternalError()); + return composition_indices_for_type[type].size() > 0; } @@ -414,6 +416,8 @@ namespace aspect unsigned int Introspection::find_composition_type (const typename CompositionalFieldDescription::Type &type) const { + Assert(type < composition_indices_for_type.size(), ExcInternalError()); + if (composition_indices_for_type[type].size() > 0) return composition_indices_for_type[type][0]; @@ -439,6 +443,7 @@ namespace aspect const std::vector & Introspection::get_indices_for_fields_of_type (const CompositionalFieldDescription::Type &type) const { + Assert(type < composition_indices_for_type.size(), ExcInternalError()); return composition_indices_for_type[type]; } @@ -448,6 +453,7 @@ namespace aspect const std::vector & Introspection::get_names_for_fields_of_type (const CompositionalFieldDescription::Type &type) const { + Assert(type < composition_names_for_type.size(), ExcInternalError()); return composition_names_for_type[type]; } @@ -457,6 +463,7 @@ namespace aspect unsigned int Introspection::get_number_of_fields_of_type (const CompositionalFieldDescription::Type &type) const { + Assert(type < composition_indices_for_type.size(), ExcInternalError()); return composition_indices_for_type[type].size(); }