Field3D
|
Provides reading of .f3d (internally, hdf5) files. More...
#include <Field3DFileHDF5.h>
Public Member Functions | |
bool | open (const std::string &filename) |
Opens the given file. | |
bool | readGroupMembership (GroupMembershipMap &gpMembershipMap) |
Read the group membership for the partitions. | |
Constructors & destructor | |
Field3DInputFileHDF5 () | |
virtual | ~Field3DInputFileHDF5 () |
Reading layers from disk | |
template<class Data_T > | |
Field< Data_T >::Vec | readScalarLayers (const std::string &layerName=std::string("")) const |
Retrieves all the layers of scalar type and maintains their on-disk data types. | |
template<class Data_T > | |
Field< Data_T >::Vec | readScalarLayers (const std::string &partitionName, const std::string &layerName) const |
This one allows the allows the partitionName to be passed in. | |
template<class Data_T > | |
Field< FIELD3D_VEC3_T< Data_T > >::Vec | readVectorLayers (const std::string &layerName=std::string("")) const |
Retrieves all the layers of vector type and maintains their on-disk data types. | |
template<class Data_T > | |
Field< FIELD3D_VEC3_T< Data_T > >::Vec | readVectorLayers (const std::string &partitionName, const std::string &layerName) const |
This version allows you to pass in the partition name. | |
template<template< typename T > class Field_T, class Data_T > | |
Field_T< Data_T >::Vec | readScalarLayersAs (const std::string &layerName=std::string("")) const |
Retrieves all layers for all partitions. Converts it to the given template type if needed. | |
template<template< typename T > class Field_T, class Data_T > | |
Field_T< Data_T >::Vec | readScalarLayersAs (const std::string &partitionName, const std::string &layerName) const |
Retrieves a layers given their and its parent partition's name. Converts it to the given template type if needed. | |
template<template< typename T > class Field_T, class Data_T > | |
Field_T< FIELD3D_VEC3_T< Data_T > >::Vec | readVectorLayersAs (const std::string &layerName=std::string("")) const |
Retrieves a layers for all partitions. Converts it to the given template type if needed. | |
template<template< typename T > class Field_T, class Data_T > | |
Field_T< FIELD3D_VEC3_T< Data_T > >::Vec | readVectorLayersAs (const std::string &partitionName, const std::string &layerName) const |
Retrieves a layers given their and its parent partition's name. Converts it to the given template type if needed. | |
Reading proxy data from disk | |
template<class Data_T > | |
EmptyField< Data_T >::Vec | readProxyLayer (const std::string &partitionName, const std::string &layerName, bool isVectorLayer) const |
Retrieves a proxy version (EmptyField) of each layer . | |
template<class Data_T > | |
EmptyField< Data_T >::Ptr | readProxyLayer (hid_t location, const std::string &name, const std::string &attribute, FieldMapping::Ptr mapping) const |
Retrieves a proxy version (EmptyField) from a given HDF5 location. | |
template<class Data_T > | |
EmptyField< Data_T >::Vec | readProxyScalarLayers (const std::string &name=std::string("")) const |
Retrieves a proxy version (EmptyField) of each scalar layer. | |
template<class Data_T > | |
EmptyField< Data_T >::Vec | readProxyVectorLayers (const std::string &name=std::string("")) const |
Retrieves a proxy version (EmptyField) of each vector layer. | |
Internal utility methods | |
herr_t | parsePartition (hid_t loc_id, const std::string partitionName) |
Gets called from parsePartitions. Not intended for any other use. | |
herr_t | parseLayer (hid_t loc_id, const std::string &partitionName, const std::string &layerName) |
Gets called from parsePartitions. Not intended for any other use. | |
![]() | |
void | clear () |
Clear the data structures and close the file. | |
bool | close () |
Closes the file. No need to call this unless you specifically want to close the file early. It will close once the FileHDF5 object goes out of scope. | |
FieldMetadata & | metadata () |
accessor to the m_metadata class | |
const FieldMetadata & | metadata () const |
Read only access to the m_metadata class. | |
virtual void | metadataHasChanged (const std::string &) |
This function should implemented by concrete classes to get the callback when metadata changes. | |
Field3DFileHDF5Base () | |
virtual | ~Field3DFileHDF5Base ()=0 |
Pure virtual destructor to ensure we never instantiate this class. | |
void | getPartitionNames (std::vector< std::string > &names) const |
Gets the names of all the partitions in the file. | |
void | getScalarLayerNames (std::vector< std::string > &names, const std::string &partitionName) const |
Gets the names of all the scalar layers in a given partition. | |
void | getVectorLayerNames (std::vector< std::string > &names, const std::string &partitionName) const |
Gets the names of all the vector layers in a given partition. | |
FileHDF5::Partition::Ptr | getPartition (const std::string &partitionName) const |
Returns a pointer to the given partition. | |
std::string | intPartitionName (const std::string &partitionName, const std::string &layerName, FieldRes::Ptr field) |
Returns a unique partition name given the requested name. This ensures that partitions with matching mappings get the same name but each subsequent differing mapping gets a new, separate name. | |
std::string | removeUniqueId (const std::string &partitionName) const |
Strips any unique identifiers from the partition name and returns the original name. | |
void | addGroupMembership (const GroupMembershipMap &groupMembers) |
Add to the group membership. | |
void | printHierarchy () const |
![]() |
Private Member Functions | |
template<class Data_T > | |
Field< Data_T >::Ptr | readLayer (const std::string &intPartitionName, const std::string &layerName, bool isVectorLayer) const |
This call does the actual reading of a layer. Notice that it expects a unique -internal- partition name. | |
bool | readMetadata (hid_t metadata_id) |
Read global metadata for this file. | |
bool | readMetadata (hid_t metadata_id, FieldBase::Ptr field) const |
Read metadata for this layer. | |
bool | readPartitionAndLayerInfo () |
Sets up all the partitions and layers, but does not load any data. | |
template<class Data_T > | |
Field< Data_T >::Ptr | readScalarLayer (const std::string &intPartitionName, const std::string &layerName) const |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types. | |
template<class Data_T > | |
Field< FIELD3D_VEC3_T< Data_T > >::Ptr | readVectorLayer (const std::string &intPartitionName, const std::string &layerName) const |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types. | |
Private Attributes | |
std::string | m_filename |
Filename, only to be set by open(). | |
Friends | |
class | Field3DInputFile |
class | Field3DOutputFile |
Additional Inherited Members | |
![]() | |
typedef std::map< std::string, std::string > | GroupMembershipMap |
![]() | |
typedef std::map< std::string, int > | PartitionCountMap |
typedef std::vector< FileHDF5::Partition::Ptr > | PartitionList |
![]() | |
void | closeInternal () |
Closes the file if open. | |
FileHDF5::Partition::Ptr | partition (const std::string &partitionName) |
Returns a pointer to the given partition. | |
FileHDF5::Partition::Ptr | partition (const std::string &partitionName) const |
Returns a pointer to the given partition. | |
void | getIntPartitionNames (std::vector< std::string > &names) const |
Gets the names of all the -internal- partitions in the file. | |
void | getIntScalarLayerNames (std::vector< std::string > &names, const std::string &intPartitionName) const |
Gets the names of all the scalar layers in a given partition, but assumes that partition name is the -internal- partition name. | |
void | getIntVectorLayerNames (std::vector< std::string > &names, const std::string &intPartitionName) const |
Gets the names of all the vector layers in a given partition, but assumes that partition name is the -internal- partition name. | |
int | numIntPartitions (const std::string &partitionName) const |
Returns the number of internal partitions for a given partition name. | |
std::string | makeIntPartitionName (const std::string &partitionsName, int i) const |
Makes an internal partition name given the external partition name. Effectively just tacks on .X to the name, where X is the number. | |
![]() | |
hid_t | m_file |
The hdf5 id of the current file. Will be -1 if no file is open. | |
GroupMembershipMap | m_groupMembership |
Keeps track of group membership for each layer of partition name. The key is the "group" and the value is a space separated list of "partitionName.0:Layer1 partitionName.1:Layer0 ..." | |
std::vector< LayerInfo > | m_layerInfo |
This stores layer info. | |
FieldMetadata | m_metadata |
metadata | |
PartitionCountMap | m_partitionCount |
Contains a counter for each partition name. This is used to keep multiple fields with the same name unique in the file. | |
std::vector< std::string > | m_partitionNames |
This stores partition names. | |
PartitionList | m_partitions |
Vector of partitions. | |
Provides reading of .f3d (internally, hdf5) files.
Refer to using_files for examples of how to use this in your code.
Definition at line 437 of file Field3DFileHDF5.h.
Field3DInputFileHDF5::Field3DInputFileHDF5 | ( | ) |
Definition at line 572 of file Field3DFileHDF5.cpp.
|
virtual |
Definition at line 579 of file Field3DFileHDF5.cpp.
References Field3DFileHDF5Base::clear().
Field< Data_T >::Vec Field3DInputFileHDF5::readScalarLayers | ( | const std::string & | layerName = std::string("") | ) | const |
Retrieves all the layers of scalar type and maintains their on-disk data types.
layerName | If a string is passed in, only layers of that name will be read from disk. |
Definition at line 910 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::getIntPartitionNames(), Field3DFileHDF5Base::getIntScalarLayerNames(), and readScalarLayer().
Field< Data_T >::Vec Field3DInputFileHDF5::readScalarLayers | ( | const std::string & | partitionName, |
const std::string & | layerName ) const |
This one allows the allows the partitionName to be passed in.
Definition at line 942 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::getIntPartitionNames(), Field3DFileHDF5Base::getIntScalarLayerNames(), readScalarLayer(), and Field3DFileHDF5Base::removeUniqueId().
Field< FIELD3D_VEC3_T< Data_T > >::Vec Field3DInputFileHDF5::readVectorLayers | ( | const std::string & | layerName = std::string("") | ) | const |
Retrieves all the layers of vector type and maintains their on-disk data types.
layerName | If a string is passed in, only layers of that name will be read from disk. |
Definition at line 981 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::getIntPartitionNames(), Field3DFileHDF5Base::getIntVectorLayerNames(), and readVectorLayer().
Field< FIELD3D_VEC3_T< Data_T > >::Vec Field3DInputFileHDF5::readVectorLayers | ( | const std::string & | partitionName, |
const std::string & | layerName ) const |
This version allows you to pass in the partition name.
Definition at line 1013 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::getIntPartitionNames(), Field3DFileHDF5Base::getIntVectorLayerNames(), readVectorLayer(), and Field3DFileHDF5Base::removeUniqueId().
|
inline |
Retrieves all layers for all partitions. Converts it to the given template type if needed.
Definition at line 491 of file Field3DFileHDF5.h.
References field_dynamic_cast().
|
inline |
Retrieves a layers given their and its parent partition's name. Converts it to the given template type if needed.
Definition at line 525 of file Field3DFileHDF5.h.
References field_dynamic_cast().
|
inline |
Retrieves a layers for all partitions. Converts it to the given template type if needed.
Definition at line 560 of file Field3DFileHDF5.h.
References field_dynamic_cast().
|
inline |
Retrieves a layers given their and its parent partition's name. Converts it to the given template type if needed.
Definition at line 595 of file Field3DFileHDF5.h.
References field_dynamic_cast().
EmptyField< Data_T >::Vec Field3DInputFileHDF5::readProxyLayer | ( | const std::string & | partitionName, |
const std::string & | layerName, | ||
bool | isVectorLayer ) const |
Retrieves a proxy version (EmptyField) of each layer .
name | If a string is passed in, only layers of that name will be read from disk. |
Definition at line 1157 of file Field3DFileHDF5.h.
References g_hdf5Mutex, Field3DFileHDF5Base::getIntPartitionNames(), Field3DFileHDF5Base::getIntScalarLayerNames(), Field3DFileHDF5Base::getIntVectorLayerNames(), Hdf5Util::H5Base::id(), Field3DFileHDF5Base::m_file, FieldBase::metadata(), FileHDF5::Layer::name, FileHDF5::Layer::parent, Field3DFileHDF5Base::partition(), Msg::print(), readProxyLayer(), Field3DFileHDF5Base::removeUniqueId(), FieldMetadata::setIntMetadata(), and Msg::SevWarning.
Referenced by readProxyLayer(), readProxyScalarLayers(), and readProxyVectorLayers().
EmptyField< Data_T >::Ptr Field3DInputFileHDF5::readProxyLayer | ( | hid_t | location, |
const std::string & | name, | ||
const std::string & | attribute, | ||
FieldMapping::Ptr | mapping ) const |
Retrieves a proxy version (EmptyField) from a given HDF5 location.
location | HDF5 file location |
Definition at line 1245 of file Field3DFileHDF5.h.
References FieldBase::attribute, g_hdf5Mutex, Hdf5Util::H5Base::id(), FieldBase::name, readMetadata(), FieldRes::setMapping(), and ResizableField< Data_T >::setSize().
EmptyField< Data_T >::Vec Field3DInputFileHDF5::readProxyScalarLayers | ( | const std::string & | name = std::string("") | ) | const |
Retrieves a proxy version (EmptyField) of each scalar layer.
name | If a string is passed in, only layers of that name will be read from disk. |
Definition at line 1289 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::getPartitionNames(), Field3DFileHDF5Base::getScalarLayerNames(), and readProxyLayer().
EmptyField< Data_T >::Vec Field3DInputFileHDF5::readProxyVectorLayers | ( | const std::string & | name = std::string("") | ) | const |
Retrieves a proxy version (EmptyField) of each vector layer.
name | If a string is passed in, only layers of that name will be read from disk. |
Definition at line 1324 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::getPartitionNames(), Field3DFileHDF5Base::getVectorLayerNames(), and readProxyLayer().
bool Field3DInputFileHDF5::open | ( | const std::string & | filename | ) |
Opens the given file.
Definition at line 586 of file Field3DFileHDF5.cpp.
References Field3DFileHDF5Base::clear(), Field3DFileHDF5Base::close(), g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileHDF5Base::m_file, m_filename, Msg::print(), Hdf5Util::readAttribute(), readMetadata(), readPartitionAndLayerInfo(), and Msg::SevWarning.
herr_t Field3DInputFileHDF5::parsePartition | ( | hid_t | loc_id, |
const std::string | partitionName ) |
Gets called from parsePartitions. Not intended for any other use.
Definition at line 800 of file Field3DFileHDF5.cpp.
References Field3DFileHDF5Base::m_partitionNames.
Referenced by InputFileHDF5::parsePartitions().
herr_t Field3DInputFileHDF5::parseLayer | ( | hid_t | layerGroup, |
const std::string & | partitionName, | ||
const std::string & | layerName ) |
Gets called from parsePartitions. Not intended for any other use.
Definition at line 814 of file Field3DFileHDF5.cpp.
References Field3DFileHDF5Base::m_layerInfo, Msg::print(), Hdf5Util::readAttribute(), and Msg::SevWarning.
Referenced by InputFileHDF5::parseLayers().
bool Field3DInputFileHDF5::readGroupMembership | ( | GroupMembershipMap & | gpMembershipMap | ) |
Read the group membership for the partitions.
Definition at line 1056 of file Field3DFileHDF5.cpp.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileHDF5Base::m_file, Field3DFileHDF5Base::m_groupMembership, Msg::print(), Hdf5Util::readAttribute(), Field3DFileHDF5Base::removeUniqueId(), and Msg::SevWarning.
|
private |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types.
Definition at line 1359 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::intPartitionName(), and readLayer().
Referenced by readScalarLayers(), and readScalarLayers().
|
private |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types.
Definition at line 1369 of file Field3DFileHDF5.h.
References Field3DFileHDF5Base::intPartitionName(), and readLayer().
Referenced by readVectorLayers(), and readVectorLayers().
|
private |
This call does the actual reading of a layer. Notice that it expects a unique -internal- partition name.
Definition at line 1052 of file Field3DFileHDF5.h.
References FieldBase::attribute, FieldCache< Data_T >::cacheField(), g_hdf5Mutex, FieldCache< Data_T >::getCachedField(), Hdf5Util::H5Base::id(), Field3DFileHDF5Base::intPartitionName(), Field3DFileHDF5Base::m_file, m_filename, FieldBase::name, FileHDF5::Layer::name, FileHDF5::Layer::parent, Field3DFileHDF5Base::partition(), Msg::print(), readField(), readMetadata(), Field3DFileHDF5Base::removeUniqueId(), FieldRes::setMapping(), Msg::SevWarning, and FieldCache< Data_T >::singleton().
Referenced by readScalarLayer(), and readVectorLayer().
|
private |
Sets up all the partitions and layers, but does not load any data.
Definition at line 706 of file Field3DFileHDF5.cpp.
References InputFileHDF5::ParseLayersInfo::file, g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileHDF5Base::m_file, Field3DFileHDF5Base::m_layerInfo, Field3DFileHDF5Base::m_partitionNames, Field3DFileHDF5Base::m_partitions, FileHDF5::Layer::name, FileHDF5::Layer::parent, Field3DFileHDF5Base::partition(), InputFileHDF5::ParseLayersInfo::partitionName, Msg::print(), readFieldMapping(), and Msg::SevWarning.
Referenced by open().
|
private |
Read metadata for this layer.
Definition at line 836 of file Field3DFileHDF5.cpp.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), Msg::print(), Hdf5Util::readAttribute(), and Msg::SevWarning.
Referenced by open(), readLayer(), and readProxyLayer().
|
private |
Read global metadata for this file.
Definition at line 947 of file Field3DFileHDF5.cpp.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileHDF5Base::metadata(), Msg::print(), Hdf5Util::readAttribute(), FieldMetadata::setFloatMetadata(), FieldMetadata::setIntMetadata(), FieldMetadata::setStrMetadata(), FieldMetadata::setVecFloatMetadata(), FieldMetadata::setVecIntMetadata(), and Msg::SevWarning.
|
friend |
Definition at line 441 of file Field3DFileHDF5.h.
|
friend |
Definition at line 442 of file Field3DFileHDF5.h.
|
private |
Filename, only to be set by open().
Definition at line 736 of file Field3DFileHDF5.h.
Referenced by open(), and readLayer().