Skip to content

Commit

Permalink
Check that composition type is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller committed May 30, 2024
1 parent ee12034 commit dc9f2d4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/simulator/introspection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ namespace aspect
bool
Introspection<dim>::composition_type_exists (const CompositionalFieldDescription::Type &type) const
{
Assert(type < CompositionalFieldDescription::n_types, ExcInternalError());

return composition_indices_for_type[type].size() > 0;
}

Expand All @@ -414,6 +416,8 @@ namespace aspect
unsigned int
Introspection<dim>::find_composition_type (const typename CompositionalFieldDescription::Type &type) const
{
Assert(type < CompositionalFieldDescription::n_types, ExcInternalError());

if (composition_indices_for_type[type].size() > 0)
return composition_indices_for_type[type][0];

Expand All @@ -439,6 +443,7 @@ namespace aspect
const std::vector<unsigned int> &
Introspection<dim>::get_indices_for_fields_of_type (const CompositionalFieldDescription::Type &type) const
{
Assert(type < CompositionalFieldDescription::n_types, ExcInternalError());
return composition_indices_for_type[type];
}

Expand All @@ -448,6 +453,7 @@ namespace aspect
const std::vector<std::string> &
Introspection<dim>::get_names_for_fields_of_type (const CompositionalFieldDescription::Type &type) const
{
Assert(type < CompositionalFieldDescription::n_types, ExcInternalError());
return composition_names_for_type[type];
}

Expand All @@ -457,6 +463,7 @@ namespace aspect
unsigned int
Introspection<dim>::get_number_of_fields_of_type (const CompositionalFieldDescription::Type &type) const
{
Assert(type < CompositionalFieldDescription::n_types, ExcInternalError());
return composition_indices_for_type[type].size();
}

Expand Down

0 comments on commit dc9f2d4

Please sign in to comment.