Skip to content

Commit 3b5f539

Browse files
authored
ParmParse: Remove two Aborts (#4576)
ParmParse now supports names containing special characters such as `/`, `(`, `)`, and `,` except for white space and `=` (e.g., `dAx_x/dx(x,y,t,zeval) = 12`). In fact, even before this PR, such names were already supported as long as they are not the first entry, due to the way input parsing was implemented. With this PR, these names are now allowed as the first entry as well.
1 parent a7776f1 commit 3b5f539

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

Src/Base/AMReX_ParmParse.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,6 @@ bldTable (const char*& str, ParmParse::Table& tab)
616616
}
617617
case pEQ_sign:
618618
{
619-
if ( cur_name.empty() )
620-
{
621-
amrex::Abort("ParmParse::bldTable() EQ with no current defn");
622-
}
623619
if ( !cur_list.empty() )
624620
{
625621
//
@@ -658,12 +654,6 @@ bldTable (const char*& str, ParmParse::Table& tab)
658654
}
659655
case pValue:
660656
{
661-
if ( cur_name.empty() )
662-
{
663-
std::string msg("ParmParse::bldTable(): value with no defn: ");
664-
msg += tokname;
665-
amrex::Abort(msg.c_str());
666-
}
667657
cur_list.push_back(std::move(tokname));
668658
cur_linefeeds.push_back(num_linefeeds);
669659
break;

Tests/ParmParse/inputs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dAx_x/dx(x,y,t,zeval) = 12
12

23
amrex.signal_handling = 0
34
amrex.throw_exception = 1

Tests/ParmParse/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ int main(int argc, char* argv[])
2222
pp.add("c", 299792458.);
2323
pp.add("pi", 3.14159265358979323846);
2424
}
25+
{
26+
ParmParse pp;
27+
int val;
28+
pp.query("dAx_x/dx(x,y,t,zeval)", val);
29+
AMREX_ALWAYS_ASSERT(val == 12);
30+
}
2531
{
2632
ParmParse pp;
2733

0 commit comments

Comments
 (0)