IO¶
FieldAOS.h¶
-
template<typename
Field
, typenameBuffer
>
voidCubism::IO
::
Field2AOS
(const Field &f, const typename Field::IndexRangeType &r, Buffer *buf, const size_t dface = 0) Write field data into AoS buffer.
Copy the data from a structure of arrays (SoA) field into an array of structures (AoS) buffer for I/O operation. This is a low-level function which can be used in high-level I/O interfaces. The index range
r
may describe a sub-region of the index range spanned by the fieldf
. The size of the output bufferbuf
is determined by the index ranger
andField::NComponents
.- Template Parameters
Field
: Field typeBuffer
: Data type of AoS buffer
- Parameters
f
: Input fieldr
: Index space for the copy (describes the memory region of buf)buf
: Output bufferdface
: Face direction (relevant forCubism::EntityType::Face
)
-
template<typename
Field
, typenameBuffer
>
voidCubism::IO
::
AOS2Field
(const Buffer *buf, const typename Field::IndexRangeType &r, Field &f, const size_t dface = 0) Read AoS buffer into field data.
Copy the data from an array of structures (AoS) buffer into a structure of arrays field. This is a low-level function which can be used in high-level I/O interfaces. The index range
r
may describe a sub-region of the index range spanned by the fieldf
. The size of the input bufferbuf
is determined by the index ranger
andField::NComponents
.- Template Parameters
Field
: Field typeBuffer
: Data type of AoS buffer
- Parameters
buf
: Input bufferr
: Index space for the read (describes the memory region of buf)f
: Output fielddface
: Face direction (relevant forCubism::EntityType::Face
)
FieldHDF.h¶
-
template<typename
FileDataType
, typenameField
, typenameMesh
, typenameDir
= size_t>
voidCubism::IO
::
FieldWriteHDF
(const std::string &fname, const std::string &aname, const Field &field, const Mesh &mesh, const double time, const Dir face_dir = 0, const bool create_xdmf = true) Write field data to HDF file.
Write the data carried by
field
to an HDF5 container file. The data that is written to the file is specified by the index space described inmesh
.Note
The variables
field
andmesh
are only related by the index space they span. If there is no common intersection, no data will be written to the file. If the mesh spans a larger index space and full or partially contains the index space spanned byfield
then the index space spanned bymesh
is clipped to that spanned byfield
.Example:
#include "Cubism/Block/Field.h" #include "Cubism/Core/Index.h" #include "Cubism/Mesh/StructuredUniform.h" #include "Cubism/IO/FieldHDF.h" using Mesh = Cubism::Mesh::StructuredUniform<double, 3>; using MeshIntegrity = typename Mesh::MeshIntegrity; using PointType = typename Mesh::PointType; using IRange = typename Mesh::IndexRangeType; using MIndex = typename Mesh::MultiIndex; using CellField = Cubism::Block::CellField<double, Mesh::Dim>; int main(void) { // mesh in [0,1]^3 with 16^3 cells const PointType end(1); const MIndex cells(16); Mesh m(end, cells, MeshIntegrity::FullMesh); // cell field spans an index space [6,10)^3 const IRange cell_range(6, 10); CellField cf(cell_range); // write field to file (since the mesh fully contains cell_range, the // file contains 64 doubles at the coordinates defined in m using the // indices in cell_range Cubism::IO::FieldWriteHDF<double>( "filename", "attributename", cf, m, 0.0); return 0; }
- Template Parameters
FileDataType
: HDF file data typeField
: Field typeMesh
: Mesh typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Output full filename without file extensionaname
: Name of quantity infield
field
: Input fieldmesh
: Input meshtime
: Current timeface_dir
: Face direction (relevant forCubism::EntityType::Face
)create_xdmf
: Flag for XDMF wrapper
-
template<typename
FileDataType
, typenameField
, typenameMesh
, typenameDir
= size_t>
voidCubism::IO
::
FieldReadHDF
(const std::string &fname, Field &field, const Mesh &mesh, const Dir face_dir = 0) Read field data from HDF file.
Read the data of an HDF5 container file into
field
. The data that is read from the file is specified by the index space described inmesh
.- Template Parameters
FileDataType
: HDF file data typeField
: Field typeMesh
: Mesh typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Input full filename without file extensionfield
: Field populated with file datamesh
: Field (sub)meshface_dir
: Face direction (relevant forCubism::EntityType::Face
)
CartesianHDF.h¶
-
template<typename
FileDataType
, typenameGrid
, typenameMesh
, typenameDir
= size_t>
voidCubism::IO
::
CartesianWriteHDF
(const std::string &fname, const std::string &aname, const Grid &grid, const Mesh &mesh, const double time, const Dir face_dir = 0, const bool create_xdmf = true) Write Cartesian grid data to HDF file.
Write the data carried by
grid
to an HDF5 container file. The data that is written to the file is specified by the index space described inmesh
.- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeMesh
: Mesh typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Output full filename without file extensionaname
: Name of quantity ingrid
grid
: Input gridmesh
: Input mesh corresponding to the extracted datatime
: Current timeface_dir
: Face direction (relevant forCubism::EntityType::Face
)create_xdmf
: Flag for XDMF wrapper
-
template<typename
FileDataType
, typenameGrid
, typenameDir
= size_t>
voidCubism::IO
::
CartesianWriteHDF
(const std::string &fname, const std::string &aname, const Grid &grid, const double time, const Dir face_dir = 0, const bool create_xdmf = true) Write Cartesian grid data to HDF file.
Convenience wrapper to dump a full grid to an HDF container file.
- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Output full filename without file extensionaname
: Name of quantity ingrid
grid
: Input gridtime
: Current timeface_dir
: Face direction (relevant forCubism::EntityType::Face
)create_xdmf
: Flag for XDMF wrapper
-
template<typename
FileDataType
, typenameGrid
, typenameMesh
, typenameDir
= size_t>
voidCubism::IO
::
CartesianReadHDF
(const std::string &fname, Grid &grid, const Mesh &mesh, const Dir face_dir = 0) Read Cartesian grid data from HDF file.
Read the data of an HDF5 container file into
grid
. The data that is read from the file is specified by the index space described inmesh
.- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeMesh
: Mesh typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Input full filename without file extensiongrid
: Grid populated with file datamesh
: Grid (sub)meshface_dir
: Face direction (relevant forCubism::EntityType::Face
)
-
template<typename
FileDataType
, typenameGrid
, typenameDir
= size_t>
voidCubism::IO
::
CartesianReadHDF
(const std::string &fname, Grid &grid, const Dir face_dir = 0) Read Cartesian grid data from HDF file.
Convenience wrapper to read a full grid from an HDF container file.
- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Input full filename without file extensiongrid
: Grid populated with file dataface_dir
: Face direction (relevant forCubism::EntityType::Face
)
CartesianMPIHDF.h¶
-
template<typename
FileDataType
, typenameGrid
, typenameMesh
, typenameDir
= size_t>
voidCubism::IO
::
CartesianMPIWriteHDF
(const std::string &fname, const std::string &aname, const Grid &grid, const Mesh &mesh, const double time, const Dir face_dir = 0, const bool create_xdmf = true) Write Cartesian MPI grid data to HDF file.
Write the data carried by the MPI
grid
to an HDF5 container file. The data that is written to the file is specified by the index space described inmesh
.- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeMesh
: Mesh typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Output full filename without file extensionaname
: Name of quantity ingrid
grid
: Input gridmesh
: Input mesh corresponding to the extracted datatime
: Current timeface_dir
: Face direction (relevant forCubism::EntityType::Face
)create_xdmf
: Flag for XDMF wrapper
-
template<typename
FileDataType
, typenameGrid
, typenameDir
= size_t>
voidCubism::IO
::
CartesianMPIWriteHDF
(const std::string &fname, const std::string &aname, const Grid &grid, const double time, const Dir face_dir = 0, const bool create_xdmf = true) Write Cartesian MPI grid data to HDF file.
Convenience wrapper to dump a full MPI grid to an HDF container file.
- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Output full filename without file extensionaname
: Name of quantity ingrid
grid
: Input gridtime
: Current timeface_dir
: Face direction (relevant forCubism::EntityType::Face
)create_xdmf
: Flag for XDMF wrapper
-
template<typename
FileDataType
, typenameGrid
, typenameMesh
, typenameDir
= size_t>
voidCubism::IO
::
CartesianMPIReadHDF
(const std::string &fname, Grid &grid, const Mesh &mesh, const Dir face_dir = 0) Read Cartesian MPI grid data from HDF file.
Read the data of an HDF5 container file into the MPI
grid
. The data that is read from the file is specified by the index space described inmesh
.- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeMesh
: Mesh typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Input full filename without file extensiongrid
: Grid populated with file datamesh
: Grid (sub)meshface_dir
: Face direction (relevant forCubism::EntityType::Face
)
-
template<typename
FileDataType
, typenameGrid
, typenameDir
= size_t>
voidCubism::IO
::
CartesianMPIReadHDF
(const std::string &fname, Grid &grid, const Dir face_dir = 0) Read Cartesian grid data from HDF file.
Convenience wrapper to read a full MPI grid from an HDF container file.
- Template Parameters
FileDataType
: HDF file data typeGrid
: Grid typeDir
: Special type that defines a cast tosize_t
- Parameters
fname
: Input full filename without file extensiongrid
: Grid populated with file dataface_dir
: Face direction (relevant forCubism::EntityType::Face
)