Field3D
|
Provides reading of .f3d (internally, hdf5) files.Refer to using_files for examples of how to use this in your code. More...
#include <Field3DFile.h>
Public Member Functions | |
bool | open (const std::string &filename) |
Opens the given file. More... | |
bool | readGroupMembership (GroupMembershipMap &gpMembershipMap) |
Read the group membership for the partitions. More... | |
Constructors & destructor | |
Field3DInputFile () | |
virtual | ~Field3DInputFile () |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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 . More... | |
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. More... | |
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. More... | |
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. More... | |
Internal utility methods | |
herr_t | parsePartition (hid_t loc_id, const std::string partitionName) |
Gets called from parsePartitions. Not intended for any other use. More... | |
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. More... | |
![]() | |
void | clear () |
Clear the data structures and close the file. More... | |
bool | close () |
Closes the file. No need to call this unless you specifically want to close the file early. It will close once the File object goes out of scope. More... | |
FieldMetadata< Field3DFileBase > & | metadata () |
accessor to the m_metadata class More... | |
const FieldMetadata< Field3DFileBase > & | metadata () const |
Read only access to the m_metadata class. More... | |
virtual void | metadataHasChanged (const std::string &) |
This function should implemented by concrete classes to get the callback when metadata changes. More... | |
Field3DFileBase () | |
virtual | ~Field3DFileBase ()=0 |
Pure virtual destructor to ensure we never instantiate this class. More... | |
void | getPartitionNames (std::vector< std::string > &names) const |
Gets the names of all the partitions in the file. More... | |
void | getScalarLayerNames (std::vector< std::string > &names, const std::string &partitionName) const |
Gets the names of all the scalar layers in a given partition. More... | |
void | getVectorLayerNames (std::vector< std::string > &names, const std::string &partitionName) const |
Gets the names of all the vector layers in a given partition. More... | |
File::Partition::Ptr | getPartition (const std::string &partitionName) const |
Returns a pointer to the given partition. More... | |
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. More... | |
std::string | removeUniqueId (const std::string &partitionName) const |
Strips any unique identifiers from the partition name and returns the original name. More... | |
void | addGroupMembership (const GroupMembershipMap &groupMembers) |
Add to the group membership. More... | |
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. More... | |
bool | readMetadata (hid_t metadata_id, FieldBase::Ptr field) const |
Read metadata for this layer. More... | |
bool | readMetadata (hid_t metadata_id) |
Read global metadata for this file. More... | |
bool | readPartitionAndLayerInfo () |
Sets up all the partitions and layers, but does not load any data. More... | |
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. More... | |
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. More... | |
Private Attributes | |
std::string | m_filename |
Filename, only to be set by open(). More... | |
Additional Inherited Members | |
![]() | |
typedef std::map< std::string, std::string > | GroupMembershipMap |
![]() | |
typedef std::map< std::string, int > | PartitionCountMap |
typedef std::vector< File::Partition::Ptr > | PartitionList |
![]() | |
void | closeInternal () |
Closes the file if open. More... | |
File::Partition::Ptr | partition (const std::string &partitionName) |
Returns a pointer to the given partition. More... | |
File::Partition::Ptr | partition (const std::string &partitionName) const |
Returns a pointer to the given partition. More... | |
void | getIntPartitionNames (std::vector< std::string > &names) const |
Gets the names of all the -internal- partitions in the file. More... | |
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. More... | |
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. More... | |
int | numIntPartitions (const std::string &partitionName) const |
Returns the number of internal partitions for a given partition name. More... | |
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. More... | |
![]() | |
hid_t | m_file |
The hdf5 id of the current file. Will be -1 if no file is open. More... | |
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 ...". More... | |
std::vector< LayerInfo > | m_layerInfo |
This stores layer info. More... | |
FieldMetadata< Field3DFileBase > | m_metadata |
metadata More... | |
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. More... | |
std::vector< std::string > | m_partitionNames |
This stores partition names. More... | |
PartitionList | m_partitions |
Vector of partitions. More... | |
Provides reading of .f3d (internally, hdf5) files.
Refer to using_files for examples of how to use this in your code.
Definition at line 434 of file Field3DFile.h.
Field3DInputFile::Field3DInputFile | ( | ) |
Definition at line 556 of file Field3DFile.cpp.
|
virtual |
Definition at line 563 of file Field3DFile.cpp.
References Field3DFileBase::clear().
Field< Data_T >::Vec Field3DInputFile::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 907 of file Field3DFile.h.
Field< Data_T >::Vec Field3DInputFile::readScalarLayers | ( | const std::string & | partitionName, |
const std::string & | layerName | ||
) | const |
This one allows the allows the partitionName to be passed in.
Definition at line 939 of file Field3DFile.h.
Field< FIELD3D_VEC3_T< Data_T > >::Vec Field3DInputFile::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 978 of file Field3DFile.h.
Field< FIELD3D_VEC3_T< Data_T > >::Vec Field3DInputFile::readVectorLayers | ( | const std::string & | partitionName, |
const std::string & | layerName | ||
) | const |
This version allows you to pass in the partition name.
Definition at line 1010 of file Field3DFile.h.
|
inline |
Retrieves all layers for all partitions. Converts it to the given template type if needed.
Definition at line 485 of file Field3DFile.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 519 of file Field3DFile.h.
References field_dynamic_cast().
|
inline |
Retrieves a layers for all partitions. Converts it to the given template type if needed.
Definition at line 554 of file Field3DFile.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 589 of file Field3DFile.h.
References field_dynamic_cast(), and File::Layer::name.
EmptyField< Data_T >::Vec Field3DInputFile::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 1154 of file Field3DFile.h.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), FieldBase::metadata(), File::Layer::name, File::Layer::parent, Msg::print(), Hdf5Util::readAttribute(), FieldMetadata< CallBack_T >::setIntMetadata(), and Msg::SevWarning.
EmptyField< Data_T >::Ptr Field3DInputFile::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 1242 of file Field3DFile.h.
References FieldBase::attribute, g_hdf5Mutex, Hdf5Util::H5Base::id(), File::Layer::name, FieldBase::name, Hdf5Util::readAttribute(), FieldRes::setMapping(), and ResizableField< Data_T >::setSize().
EmptyField< Data_T >::Vec Field3DInputFile::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 1286 of file Field3DFile.h.
EmptyField< Data_T >::Vec Field3DInputFile::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 1321 of file Field3DFile.h.
bool Field3DInputFile::open | ( | const std::string & | filename | ) |
Opens the given file.
Definition at line 570 of file Field3DFile.cpp.
References Field3DFileBase::clear(), Field3DFileBase::close(), g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileBase::m_file, Msg::print(), Hdf5Util::readAttribute(), Msg::SevWarning, and Exc::Exception::what().
Referenced by FieldGroup< BaseTypeList_T, Dims_T >::load().
herr_t Field3DInputFile::parsePartition | ( | hid_t | loc_id, |
const std::string | partitionName | ||
) |
Gets called from parsePartitions. Not intended for any other use.
Definition at line 783 of file Field3DFile.cpp.
References Field3DFileBase::m_partitionNames.
Referenced by InputFile::parsePartitions().
herr_t Field3DInputFile::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 797 of file Field3DFile.cpp.
References Field3DFileBase::m_layerInfo, Msg::print(), Hdf5Util::readAttribute(), readMetadata(), and Msg::SevWarning.
Referenced by InputFile::parseLayers().
bool Field3DInputFile::readGroupMembership | ( | GroupMembershipMap & | gpMembershipMap | ) |
Read the group membership for the partitions.
Definition at line 1040 of file Field3DFile.cpp.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileBase::m_file, Field3DFileBase::m_groupMembership, Msg::print(), Hdf5Util::readAttribute(), Field3DFileBase::removeUniqueId(), and Msg::SevWarning.
Referenced by readMetadata().
|
private |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types.
Definition at line 1356 of file Field3DFile.h.
|
private |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types.
Definition at line 1366 of file Field3DFile.h.
|
private |
This call does the actual reading of a layer. Notice that it expects a unique -internal- partition name.
Definition at line 1049 of file Field3DFile.h.
References FieldBase::attribute, FieldCache< Data_T >::cacheField(), g_hdf5Mutex, FieldCache< Data_T >::getCachedField(), File::Layer::name, FieldBase::name, File::Layer::parent, Msg::print(), Hdf5Util::readAttribute(), FieldRes::setMapping(), Msg::SevWarning, and FieldCache< Data_T >::singleton().
|
private |
Sets up all the partitions and layers, but does not load any data.
Definition at line 689 of file Field3DFile.cpp.
References InputFile::ParseLayersInfo::file, g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileBase::m_file, Field3DFileBase::m_layerInfo, Field3DFileBase::m_partitionNames, Field3DFileBase::m_partitions, File::Layer::name, File::Layer::parent, InputFile::parseLayers(), InputFile::parsePartitions(), Field3DFileBase::partition(), InputFile::ParseLayersInfo::partitionName, Msg::print(), readFieldMapping(), and Msg::SevWarning.
|
private |
Read metadata for this layer.
Definition at line 820 of file Field3DFile.cpp.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), Msg::print(), Hdf5Util::readAttribute(), and Msg::SevWarning.
Referenced by parseLayer().
|
private |
Read global metadata for this file.
Definition at line 930 of file Field3DFile.cpp.
References g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DFileBase::metadata(), Msg::print(), Hdf5Util::readAttribute(), readGroupMembership(), FieldMetadata< CallBack_T >::setFloatMetadata(), FieldMetadata< CallBack_T >::setIntMetadata(), FieldMetadata< CallBack_T >::setStrMetadata(), FieldMetadata< CallBack_T >::setVecFloatMetadata(), FieldMetadata< CallBack_T >::setVecIntMetadata(), and Msg::SevWarning.
|
private |
Filename, only to be set by open().
Definition at line 730 of file Field3DFile.h.