Nektar++
|
#include <FieldIOHdf5.h>
Classes | |
struct | OffsetHelper |
Public Member Functions | |
FieldIOHdf5 (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem) | |
Construct the FieldIO object for HDF5 output. More... | |
~FieldIOHdf5 () override | |
Public Member Functions inherited from Nektar::LibUtilities::FieldIO | |
FieldIO (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem) | |
Constructor for FieldIO base class. More... | |
virtual | ~FieldIO () |
void | Write (const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const bool backup=false) |
Write out the field information to the file outFile . More... | |
void | Import (const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata=NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const Array< OneD, int > &ElementIDs=NullInt1DArray) |
Read field information from the file infilename . More... | |
DataSourceSharedPtr | ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap) |
Import the metadata from a field file. More... | |
const std::string & | GetClassName () const |
std::string | GetFileEnding () const |
Helper function that determines default file extension. More... | |
Static Public Member Functions | |
static FieldIOSharedPtr | create (LibUtilities::CommSharedPtr pComm, bool sharedFilesystem) |
Creates an instance of this class. More... | |
Static Public Member Functions inherited from Nektar::LibUtilities::FieldIO | |
static const std::string | GetFileType (const std::string &filename, CommSharedPtr comm) |
Determine file type of given input file. More... | |
static std::shared_ptr< FieldIO > | CreateDefault (const LibUtilities::SessionReaderSharedPtr session) |
Returns an object for the default FieldIO method. More... | |
static std::shared_ptr< FieldIO > | CreateForFile (const LibUtilities::SessionReaderSharedPtr session, const std::string &filename) |
Construct a FieldIO object for a given input filename. More... | |
static void | AddInfoTag (TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap) |
Add provenance information to the field metadata map. More... | |
Static Public Attributes | |
static const unsigned int | FORMAT_VERSION = 1 |
Version of the Nektar++ HDF5 format, which is embedded into the main NEKTAR group as an attribute. More... | |
static const unsigned int | ELEM_DCMP_IDX = 0 |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of elements in decomposition (i.e. field definition). More... | |
static const unsigned int | VAL_DCMP_IDX = 1 |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of data points in decomposition (i.e. field definition). More... | |
static const unsigned int | ORDER_DCMP_IDX = 2 |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of elements multiplied by the dimension of the element, giving number of modes when variable polynomial order is defined. More... | |
static const unsigned int | HOMY_DCMP_IDX = 3 |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of the number of y-planes for homogeneous simulations. More... | |
static const unsigned int | HOMZ_DCMP_IDX = 4 |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of the number of z-planes for homogeneous simulations. More... | |
static const unsigned int | HOMS_DCMP_IDX = 5 |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of the number of strips for homogeneous simulations. More... | |
static const unsigned int | HASH_DCMP_IDX = 6 |
The hash of the field definition information, which defines the name of the attribute containing the field definition itself. More... | |
static const unsigned int | MAX_DCMPS = FieldIOHdf5::HASH_DCMP_IDX + 1 |
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the decomposition per field definition. More... | |
static const unsigned int | ELEM_CNT_IDX = 0 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of elements in the cnt array. More... | |
static const unsigned int | VAL_CNT_IDX = 1 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of data points in the cnt array. More... | |
static const unsigned int | ORDER_CNT_IDX = 2 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of order points in the cnt array. More... | |
static const unsigned int | HOMY_CNT_IDX = 3 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous y-planes in the cnt array. More... | |
static const unsigned int | HOMZ_CNT_IDX = 4 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous z-planes in the cnt array. More... | |
static const unsigned int | HOMS_CNT_IDX = 5 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips in the cnt array. More... | |
static const unsigned int | MAX_CNTS = FieldIOHdf5::HOMS_CNT_IDX + 1 |
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the cnt array per field definition. More... | |
static const unsigned int | IDS_IDX_IDX = 0 |
A helper for FieldIOHdf5::v_Write. Describes the position of the element IDs within the indexing set. More... | |
static const unsigned int | DATA_IDX_IDX = 1 |
A helper for FieldIOHdf5::v_Write. Describes the position of the data size within the indexing set. More... | |
static const unsigned int | ORDER_IDX_IDX = 2 |
A helper for FieldIOHdf5::v_Write. Describes the position of the element order within the indexing set. More... | |
static const unsigned int | HOMY_IDX_IDX = 3 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of y-planes within the indexing set. More... | |
static const unsigned int | HOMZ_IDX_IDX = 4 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of z-planes within the indexing set. More... | |
static const unsigned int | HOMS_IDX_IDX = 5 |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips within the indexing set. More... | |
static const unsigned int | MAX_IDXS = FieldIOHdf5::HOMS_IDX_IDX + 1 |
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the indexing set. More... | |
static std::string | className |
Name of class. More... | |
Protected Member Functions | |
void | v_Write (const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const bool backup=false) override |
Write a HDF5 file to outFile given the field definitions fielddefs , field data fielddata and metadata fieldmetadatamap . More... | |
void | v_Import (const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata=NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const Array< OneD, int > &ElementIDs=NullInt1DArray) override |
Import a HDF5 format file. More... | |
DataSourceSharedPtr | v_ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap) override |
Import field metadata from filename and return the data source which wraps filename . More... | |
const std::string & | v_GetClassName () const override |
Get class name. More... | |
Protected Member Functions inherited from Nektar::LibUtilities::FieldIO | |
int | CheckFieldDefinition (const FieldDefinitionsSharedPtr &fielddefs) |
Check field definitions for correctness and return storage size. More... | |
std::vector< unsigned int > | GetNumberOfCoeffsPerElement (const FieldDefinitionsSharedPtr &fielddefs) |
Compute number of data points needed to store expansion inside each element. More... | |
std::string | SetUpOutput (const std::string outname, bool perRank, bool backup=false) |
Set up the filesystem ready for output. More... | |
virtual void | v_Write (const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap, const bool backup=false)=0 |
Write out the field information to the file outFile . More... | |
virtual void | v_Import (const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata=NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const Array< OneD, int > &ElementIDs=NullInt1DArray)=0 |
Read field information from the file infilename . More... | |
virtual DataSourceSharedPtr | v_ImportFieldMetaData (const std::string &filename, FieldMetaDataMap &fieldmetadatamap)=0 |
Import the metadata from a field file. More... | |
virtual std::string | v_GetFileEnding () const |
virtual const std::string & | v_GetClassName () const =0 |
Private Member Functions | |
void | ImportHDF5FieldMetaData (DataSourceSharedPtr dataSource, FieldMetaDataMap &fieldmetadatamap) |
Import field metadata from dataSource . More... | |
void | ImportFieldDef (H5::PListSharedPtr readPL, H5::GroupSharedPtr root, std::vector< uint64_t > &decomps, uint64_t decomp, OffsetHelper offset, std::string group, FieldDefinitionsSharedPtr def) |
Import field definitions from a HDF5 document. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Nektar::LibUtilities::FieldIO | |
LibUtilities::CommSharedPtr | m_comm |
Communicator to use when writing parallel format. More... | |
bool | m_sharedFilesystem |
Boolean dictating whether we are on a shared filesystem. More... | |
Definition at line 173 of file FieldIOHdf5.h.
Nektar::LibUtilities::FieldIOHdf5::FieldIOHdf5 | ( | LibUtilities::CommSharedPtr | pComm, |
bool | sharedFilesystem | ||
) |
Construct the FieldIO object for HDF5 output.
pComm | Communicator object. |
sharedFilesystem | True if this system has a shared filesystem. |
Definition at line 143 of file FieldIOHdf5.cpp.
|
inlineoverride |
Definition at line 217 of file FieldIOHdf5.h.
|
inlinestatic |
Creates an instance of this class.
Definition at line 204 of file FieldIOHdf5.h.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
|
private |
Import field definitions from a HDF5 document.
readPL | Reading parameter list. |
root | Root group containing field definitions. |
group | Group name to process. |
def | On output contains field definitions. |
Definition at line 1191 of file FieldIOHdf5.cpp.
References ASSERTL0, ASSERTL1, FilterPython_Function::field, Nektar::ParseUtils::GenerateVector(), Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::homs, HOMS_DCMP_IDX, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::homy, HOMY_DCMP_IDX, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::homz, HOMZ_DCMP_IDX, Nektar::LibUtilities::kPointsTypeStr, CG_Iterations::loc, Nektar::LibUtilities::FieldIO::m_comm, MAX_DCMPS, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::order, ORDER_DCMP_IDX, Nektar::LibUtilities::ShapeTypeMap, Nektar::LibUtilities::SIZE_BasisType, Nektar::LibUtilities::SIZE_PointsType, and Nektar::LibUtilities::SIZE_ShapeType.
Referenced by v_Import().
|
private |
Import field metadata from dataSource
.
dataSource | Input datasource, which should be a H5DataSource. |
fieldmetadatamap | Resulting field metadata from dataSource . |
Definition at line 1410 of file FieldIOHdf5.cpp.
Referenced by v_Import(), and v_ImportFieldMetaData().
|
overrideprotectedvirtual |
Get class name.
Implements Nektar::LibUtilities::FieldIO.
Definition at line 1399 of file FieldIOHdf5.cpp.
References className.
|
overrideprotectedvirtual |
Import a HDF5 format file.
finfilename | Input filename |
fielddefs | Field definitions of resulting field |
fielddata | Field data of resulting field |
fieldinfomap | Field metadata of resulting field |
ElementIDs | If specified, contains the list of element IDs on this rank. The resulting field definitions will only contain data for the element IDs specified in this array. |
Implements Nektar::LibUtilities::FieldIO.
Definition at line 885 of file FieldIOHdf5.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ASSERTL1, Nektar::LibUtilities::FieldIO::CheckFieldDefinition(), Nektar::LibUtilities::H5DataSource::create(), Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::data, Nektar::LibUtilities::H5::PList::DatasetXfer(), Nektar::LibUtilities::H5::PList::Default(), ELEM_DCMP_IDX, Nektar::LibUtilities::H5::PList::FileAccess(), FORMAT_VERSION, Nektar::LibUtilities::FieldIO::GetNumberOfCoeffsPerElement(), HASH_DCMP_IDX, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::homs, HOMS_DCMP_IDX, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::homy, HOMY_DCMP_IDX, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::homz, HOMZ_DCMP_IDX, ImportFieldDef(), ImportHDF5FieldMetaData(), Nektar::LibUtilities::FieldIO::m_comm, MAX_DCMPS, Nektar::NullInt1DArray, Nektar::LibUtilities::NullVectorNekDoubleVector, Nektar::LibUtilities::FieldIOHdf5::OffsetHelper::order, ORDER_DCMP_IDX, and VAL_DCMP_IDX.
|
overrideprotectedvirtual |
Import field metadata from filename
and return the data source which wraps filename
.
filename | Input filename. |
fieldmetadatamap | Resulting field metadata from dataSource . |
Implements Nektar::LibUtilities::FieldIO.
Definition at line 1389 of file FieldIOHdf5.cpp.
References Nektar::LibUtilities::H5DataSource::create(), Nektar::LibUtilities::H5::PList::Default(), and ImportHDF5FieldMetaData().
|
overrideprotectedvirtual |
Write a HDF5 file to outFile
given the field definitions fielddefs
, field data fielddata
and metadata fieldmetadatamap
.
The writing strategy for HDF5 output is as follows:
outFile | Output filename. |
fielddefs | Input field definitions. |
fielddata | Input field data. |
fieldmetadatamap | Field metadata. |
Implements Nektar::LibUtilities::FieldIO.
Definition at line 171 of file FieldIOHdf5.cpp.
References Nektar::LibUtilities::FieldIO::AddInfoTag(), ASSERTL1, Nektar::LibUtilities::FieldIO::CheckFieldDefinition(), CellMLToNektar.pycml::copy(), Nektar::LibUtilities::H5::File::Create(), DATA_IDX_IDX, Nektar::LibUtilities::H5::PList::DatasetXfer(), Nektar::LibUtilities::H5::PList::Default(), ELEM_CNT_IDX, ELEM_DCMP_IDX, Nektar::LibUtilities::H5::PList::FileAccess(), FORMAT_VERSION, HASH_DCMP_IDX, HOMS_CNT_IDX, HOMS_DCMP_IDX, HOMS_IDX_IDX, HOMY_CNT_IDX, HOMY_DCMP_IDX, HOMY_IDX_IDX, HOMZ_CNT_IDX, HOMZ_DCMP_IDX, HOMZ_IDX_IDX, IDS_IDX_IDX, Nektar::LibUtilities::FieldIO::m_comm, MAX_CNTS, MAX_DCMPS, MAX_IDXS, Nektar::LibUtilities::H5::DataType::OfObject(), Nektar::LibUtilities::H5::DataSpace::OneD(), Nektar::LibUtilities::H5::File::Open(), ORDER_CNT_IDX, ORDER_DCMP_IDX, ORDER_IDX_IDX, Nektar::LibUtilities::ReduceMax, Nektar::LibUtilities::ReduceMin, Nektar::LibUtilities::FieldIO::SetUpOutput(), Nektar::LibUtilities::ShapeTypeMap, VAL_CNT_IDX, and VAL_DCMP_IDX.
|
static |
Name of class.
Definition at line 212 of file FieldIOHdf5.h.
Referenced by v_GetClassName().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the data size within the indexing set.
Definition at line 196 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of elements in the cnt array.
Definition at line 187 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of elements in decomposition (i.e. field definition).
Definition at line 178 of file FieldIOHdf5.h.
Referenced by v_Import(), and v_Write().
|
static |
Version of the Nektar++ HDF5 format, which is embedded into the main NEKTAR group as an attribute.
Definition at line 176 of file FieldIOHdf5.h.
Referenced by v_Import(), and v_Write().
|
static |
The hash of the field definition information, which defines the name of the attribute containing the field definition itself.
Definition at line 184 of file FieldIOHdf5.h.
Referenced by v_Import(), and v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips in the cnt array.
Definition at line 192 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of the number of strips for homogeneous simulations.
Definition at line 183 of file FieldIOHdf5.h.
Referenced by ImportFieldDef(), v_Import(), and v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips within the indexing set.
Definition at line 200 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous y-planes in the cnt array.
Definition at line 190 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of the number of y-planes for homogeneous simulations.
Definition at line 181 of file FieldIOHdf5.h.
Referenced by ImportFieldDef(), v_Import(), and v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of y-planes within the indexing set.
Definition at line 198 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous z-planes in the cnt array.
Definition at line 191 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of the number of z-planes for homogeneous simulations.
Definition at line 182 of file FieldIOHdf5.h.
Referenced by ImportFieldDef(), v_Import(), and v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of z-planes within the indexing set.
Definition at line 199 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the element IDs within the indexing set.
Definition at line 195 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the cnt array per field definition.
Definition at line 193 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the decomposition per field definition.
Definition at line 185 of file FieldIOHdf5.h.
Referenced by ImportFieldDef(), v_Import(), and v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the indexing set.
Definition at line 201 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of order points in the cnt array.
Definition at line 189 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of elements multiplied by the dimension of the element, giving number of modes when variable polynomial order is defined.
Definition at line 180 of file FieldIOHdf5.h.
Referenced by ImportFieldDef(), v_Import(), and v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the element order within the indexing set.
Definition at line 197 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write. Describes the position of the number of data points in the cnt array.
Definition at line 188 of file FieldIOHdf5.h.
Referenced by v_Write().
|
static |
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of data points in decomposition (i.e. field definition).
Definition at line 179 of file FieldIOHdf5.h.
Referenced by v_Import(), and v_Write().