diff --git a/examples/14_toml_template.cpp b/examples/14_toml_template.cpp index 284db9ee84..366323ee21 100644 --- a/examples/14_toml_template.cpp +++ b/examples/14_toml_template.cpp @@ -1,3 +1,4 @@ +#include #include std::string backendEnding() @@ -97,7 +98,23 @@ void read() "../samples/tomlTemplate." + backendEnding(), openPMD::Access::READ_LINEAR); read.readIterations(); // @todo change to read.parseBase() - openPMD::helper::listSeries(read); + + std::string jsonConfig = R"( +{ + "iteration_encoding": "variable_based", + "json": { + "mode": "template" + } +} +)"; + openPMD::Series cloned( + "../samples/jsonTemplate.json", openPMD::Access::CREATE, jsonConfig); + openPMD::auxiliary::initializeFromTemplate(cloned, read, 0); + // Have to define the dataset for E/z as it is not defined in the template + // @todo check that the dataset is defined only upon destruction, not at + // flushing already + cloned.writeIterations()[0].meshes["E"]["z"].resetDataset( + {openPMD::Datatype::INT}); } int main()