-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openPMD: Add ADIOS2 Engine Parameter Control #2872
Merged
ax3l
merged 6 commits into
ECP-WarpX:development
from
kshitij-v-mehta:adios_engine_support
Feb 18, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d2a7c4e
Adds support for ADIOS engines #2866
7e71edc
Docs for ADIOS engine type and parameters #2866
956a7e5
Aesthetic edit in adios2 engine documentation #2866
86eb18f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0ebb55f
Removed debug print statement #2866
b516b53
Style Updates
ax3l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,9 +122,18 @@ namespace detail | |
*/ | ||
inline std::string | ||
getSeriesOptions (std::string const & operator_type, | ||
std::map< std::string, std::string > const & operator_parameters) | ||
std::map< std::string, std::string > const & operator_parameters, | ||
std::string const & engine_type, | ||
std::map< std::string, std::string > const & engine_parameters) | ||
{ | ||
if (operator_type.empty() && engine_type.empty()) | ||
return "{}"; | ||
|
||
std::string options; | ||
std::string top_block; | ||
std::string end_block; | ||
std::string op_block; | ||
std::string en_block; | ||
|
||
std::string op_parameters; | ||
for (const auto& kv : operator_parameters) { | ||
|
@@ -133,31 +142,68 @@ namespace detail | |
.append("\"").append(kv.first).append("\": ") /* key */ | ||
.append("\"").append(kv.second).append("\""); /* value (as string) */ | ||
} | ||
if (!operator_type.empty()) { | ||
options = R"END( | ||
|
||
std::string en_parameters; | ||
for (const auto& kv : engine_parameters) { | ||
if (!en_parameters.empty()) en_parameters.append(",\n"); | ||
en_parameters.append(std::string(12, ' ')) /* just pretty alignment */ | ||
.append("\"").append(kv.first).append("\": ") /* key */ | ||
.append("\"").append(kv.second).append("\""); /* value (as string) */ | ||
} | ||
|
||
// create the outer-level blocks | ||
top_block = R"END( | ||
{ | ||
"adios2": { | ||
"adios2": {)END"; | ||
|
||
end_block = R"END( | ||
} | ||
})END"; | ||
|
||
// add the operator string block | ||
if (!operator_type.empty()) { | ||
op_block = R"END( | ||
"dataset": { | ||
"operators": [ | ||
{ | ||
"type": ")END"; | ||
options += operator_type + "\""; | ||
} | ||
if (!operator_type.empty() && !op_parameters.empty()) { | ||
options += R"END( | ||
,"parameters": { | ||
op_block += operator_type + "\""; | ||
|
||
if (!op_parameters.empty()) { | ||
op_block += R"END(, | ||
"parameters": { | ||
)END"; | ||
options += op_parameters + "}"; | ||
op_block += op_parameters + "}"; | ||
} | ||
if (!operator_type.empty()) | ||
options += R"END( | ||
op_block += R"END( | ||
} | ||
] | ||
} | ||
} | ||
} | ||
})END"; | ||
if (!engine_type.empty()) | ||
op_block += ","; | ||
|
||
} // end operator string block | ||
|
||
// add the engine string block | ||
if (!engine_type.empty()) { | ||
Comment on lines
+182
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, these blocks are only added if a user explicitly specifies an engine. Maybe we should add a default here? |
||
en_block = R"END( | ||
"engine": { | ||
"type": ")END"; | ||
en_block += engine_type + "\""; | ||
|
||
if (!en_parameters.empty()) { | ||
en_block += R"END(, | ||
"parameters": { | ||
)END"; | ||
if (options.empty()) options = "{}"; | ||
en_block += en_parameters + "}"; | ||
} | ||
|
||
en_block += R"END( | ||
})END"; | ||
|
||
} // end engine string block | ||
|
||
options = top_block + op_block + en_block + end_block; | ||
return options; | ||
} | ||
|
||
|
@@ -337,6 +383,8 @@ WarpXOpenPMDPlot::WarpXOpenPMDPlot ( | |
std::string openPMDFileType, | ||
std::string operator_type, | ||
std::map< std::string, std::string > operator_parameters, | ||
std::string engine_type, | ||
std::map< std::string, std::string > engine_parameters, | ||
std::vector<bool> fieldPMLdirections) | ||
:m_Series(nullptr), | ||
m_Encoding(ie), | ||
|
@@ -355,7 +403,8 @@ WarpXOpenPMDPlot::WarpXOpenPMDPlot ( | |
m_OpenPMDFileType = "json"; | ||
#endif | ||
|
||
m_OpenPMDoptions = detail::getSeriesOptions(operator_type, operator_parameters); | ||
m_OpenPMDoptions = detail::getSeriesOptions(operator_type, operator_parameters, | ||
engine_type, engine_parameters); | ||
} | ||
|
||
WarpXOpenPMDPlot::~WarpXOpenPMDPlot () | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little typo fixed in #3002