File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1+ #include " openPMD/Dataset.hpp"
2+ #include < openPMD/auxiliary/TemplateFile.hpp>
13#include < openPMD/openPMD.hpp>
24
35std::string backendEnding ()
@@ -101,7 +103,23 @@ void read()
101103 " ../samples/tomlTemplate." + backendEnding (),
102104 openPMD::Access::READ_LINEAR);
103105 read.parseBase ();
104- openPMD::helper::listSeries (read);
106+
107+ std::string jsonConfig = R"(
108+ {
109+ "iteration_encoding": "variable_based",
110+ "json": {
111+ "mode": "template"
112+ }
113+ }
114+ )" ;
115+ openPMD::Series cloned (
116+ " ../samples/jsonTemplate.json" , openPMD::Access::CREATE, jsonConfig);
117+ openPMD::auxiliary::initializeFromTemplate (cloned, read, 0 );
118+ // Have to define the dataset for E/z as it is not defined in the template
119+ // @todo check that the dataset is defined only upon destruction, not at
120+ // flushing already
121+ cloned.writeIterations ()[0 ].meshes [" E" ][" z" ].resetDataset (
122+ {openPMD::Datatype::INT, {openPMD::Dataset::UNDEFINED_EXTENT}});
105123}
106124
107125int main ()
You can’t perform that action at this time.
0 commit comments