Skip to content

Instantly share code, notes, and snippets.

@C0nsultant
Created August 29, 2017 13:23
Show Gist options
  • Save C0nsultant/b309c2061c3fb5d2bdb35a2f735e45f6 to your computer and use it in GitHub Desktop.
Save C0nsultant/b309c2061c3fb5d2bdb35a2f735e45f6 to your computer and use it in GitHub Desktop.
Writing scalar openPMD recrod
#include "include/Output.hpp"
int main(int argc, char *argv[])
{
Output o("./working/directory/",
"file_name",
Output::IterationEncoding::fileBased,
Format::HDF5,
AccessType::CREAT);
Mesh& m = o.iterations[1].meshes["mesh_name"];
auto& scalar = m[RecordComponent::SCALAR];
double *d;
Dataset dset = Dataset(d, {1000, 1000, 1000});
scalar.resetDataset(dset);
std::shared_ptr< double > data(d);
scalar.storeChunk({0, 0, 0}, {1000, 1000, 1000}, data);
o.flush();
return 0
}
@C0nsultant
Copy link
Author

As little of a readable boilerplate as possible for writing a single scalar mesh record. @s0vereign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment