Skip to content

Commit

Permalink
Check component and derive names for canDerive and get (AMReX-Cod…
Browse files Browse the repository at this point in the history
…es#3109)

`canDerive` and `get` in the `DeriveList` class only check the derive
name but not the variable component names. This code adds a check on the
variable names. @esclapez did this internally for PeleLMeX and we need
it for PeleC as well so I thought this should just belong in AMReX.
  • Loading branch information
marchdf authored Jan 24, 2023
1 parent e472c10 commit 1c18d00
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Src/Amr/AMReX_Derive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ DeriveList::canDerive (const std::string& name) const
li != End;
++li)
{
// Can be either a component name ...
for (int i = 0; i < li->numDerive(); i++) {
if (li->variableName(i) == name)
return true;
}
// ... or a derive name
if (li->derive_name == name)
return true;
}
Expand All @@ -443,6 +449,12 @@ DeriveList::get (const std::string& name) const
li != End;
++li)
{
// Can be either a component name ...
for (int i = 0; i < li->numDerive(); i++) {
if (li->variableName(i) == name)
return &(*li);
}
// ... or a derive name
if (li->derive_name == name)
return &(*li);
}
Expand Down

0 comments on commit 1c18d00

Please sign in to comment.