Skip to content

Commit

Permalink
Add example 14_toml_template.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Aug 4, 2023
1 parent ee6a256 commit d07b6b1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/14_toml_template.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <openPMD/openPMD.hpp>

int main()
{
std::string config = R"(
{
"iteration_encoding": "variable_based",
"toml": {
"dataset": {"mode": "template"},
"attribute": {"mode": "short"}
}
}
)";

openPMD::Series writeTemplate(
"../samples/tomlTemplate.toml", openPMD::Access::CREATE, config);
auto iteration = writeTemplate.writeIterations()[0];

auto temperature =
iteration.meshes["temperature"][openPMD::RecordComponent::SCALAR];
temperature.resetDataset({openPMD::Datatype::FLOAT, {5, 5}});
}

0 comments on commit d07b6b1

Please sign in to comment.