Skip to content

Commit

Permalink
openPMD Engines: Allow Params w/o Type (ECP-WarpX#3460)
Browse files Browse the repository at this point in the history
The current implementation only accepted parameters for ADIOS2
engines if the engine type was also specified. That is not
necessary, the default (bp4) will usually be taken and thus
the documentation did not work.

This fixes it, keeping the engine type optional in the inputs.
  • Loading branch information
ax3l authored and dpgrote committed Nov 22, 2022
1 parent 2065b23 commit 0e3760a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions Source/Diagnostics/WarpXOpenPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,34 +181,44 @@ namespace detail
op_block += R"END(,
"parameters": {
)END";
op_block += op_parameters + "}";
op_block += op_parameters +
"\n }";
}
op_block += R"END(
}
]
})END";
if (!engine_type.empty())
op_block += ",";

if (!engine_type.empty() || !en_parameters.empty())
op_block += ",";
} // end operator string block

// add the engine string block
if (!engine_type.empty()) {
if (!engine_type.empty() || !en_parameters.empty())
{
en_block = R"END(
"engine": {
"engine": {)END";

// non-default engine type
if (!engine_type.empty()) {
en_block += R"END(
"type": ")END";
en_block += engine_type + "\"";
en_block += engine_type + "\"";

if(!en_parameters.empty())
en_block += ",";
}

// non-default engine parameters
if (!en_parameters.empty()) {
en_block += R"END(,
en_block += R"END(
"parameters": {
)END";
en_block += en_parameters + "}";
en_block += en_parameters +
"\n }";
}

en_block += R"END(
})END";

} // end engine string block

options = top_block + op_block + en_block + end_block;
Expand Down

0 comments on commit 0e3760a

Please sign in to comment.