File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1+ #include < openPMD/auxiliary/TemplateFile.hpp>
12#include < openPMD/openPMD.hpp>
23
34std::string backendEnding ()
@@ -97,7 +98,23 @@ void read()
9798 " ../samples/tomlTemplate." + backendEnding (),
9899 openPMD::Access::READ_LINEAR);
99100 read.readIterations (); // @todo change to read.parseBase()
100- openPMD::helper::listSeries (read);
101+
102+ std::string jsonConfig = R"(
103+ {
104+ "iteration_encoding": "variable_based",
105+ "json": {
106+ "mode": "template"
107+ }
108+ }
109+ )" ;
110+ openPMD::Series cloned (
111+ " ../samples/jsonTemplate.json" , openPMD::Access::CREATE, jsonConfig);
112+ openPMD::auxiliary::initializeFromTemplate (cloned, read, 0 );
113+ // Have to define the dataset for E/z as it is not defined in the template
114+ // @todo check that the dataset is defined only upon destruction, not at
115+ // flushing already
116+ cloned.writeIterations ()[0 ].meshes [" E" ][" z" ].resetDataset (
117+ {openPMD::Datatype::INT});
101118}
102119
103120int main ()
You can’t perform that action at this time.
0 commit comments