|
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. | |
| bool | readGroupMembership (GroupMembershipMap &gpMembershipMap) |
| Read the group membership for the partitions. | |
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. | |
| 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< 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< 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 >::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. | |
Public Member Functions inherited from Field3DFileBase | |
| 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 File object goes out of scope. | |
| FieldMetadata< Field3DFileBase > & | metadata () |
| accessor to the m_metadata class | |
| const FieldMetadata < Field3DFileBase > & | 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. | |
| Field3DFileBase () | |
| virtual | ~Field3DFileBase ()=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. | |
| File::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, FieldBase::Ptr field) const |
| Read metadata for this layer. | |
| bool | readMetadata (hid_t metadata_id) |
| Read global metadata for this file. | |
| 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(). | |
Additional Inherited Members | |
Public Types inherited from Field3DFileBase | |
| typedef std::map< std::string, std::string > | GroupMembershipMap |
Protected Types inherited from Field3DFileBase | |
| typedef std::map< std::string, int > | PartitionCountMap |
| typedef std::vector < File::Partition::Ptr > | PartitionList |
Protected Member Functions inherited from Field3DFileBase | |
| void | closeInternal () |
| Closes the file if open. | |
| File::Partition::Ptr | partition (const std::string &partitionName) |
| Returns a pointer to the given partition. | |
| File::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. | |
Protected Attributes inherited from Field3DFileBase | |
| 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< Field3DFileBase > | 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 431 of file Field3DFile.h.
| Field3DInputFile::Field3DInputFile | ( | ) |
Definition at line 561 of file Field3DFile.cpp.
|
virtual |
| 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 769 of file Field3DFile.h.
References Field3DFileBase::getIntPartitionNames(), and Field3DFileBase::getIntScalarLayerNames().
| 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 801 of file Field3DFile.h.
References Field3DFileBase::getIntPartitionNames(), Field3DFileBase::getIntScalarLayerNames(), and Field3DFileBase::removeUniqueId().
| 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 840 of file Field3DFile.h.
References Field3DFileBase::getIntPartitionNames(), and Field3DFileBase::getIntVectorLayerNames().
| 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 872 of file Field3DFile.h.
References Field3DFileBase::getIntPartitionNames(), Field3DFileBase::getIntVectorLayerNames(), and Field3DFileBase::removeUniqueId().
| Field_T< Data_T >::Vec Field3DInputFile::readScalarLayersAs | ( | const std::string & | layerName = std::string("") | ) | const |
Retrieves all layers for all partitions. Converts it to the given template type if needed.
Definition at line 990 of file Field3DFile.h.
References field_dynamic_cast().
| Field_T< Data_T >::Vec Field3DInputFile::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.
Definition at line 1024 of file Field3DFile.h.
References field_dynamic_cast().
| Field_T< Data_T >::Vec Field3DInputFile::readVectorLayersAs | ( | const std::string & | layerName = std::string("") | ) | const |
Retrieves a layers for all partitions. Converts it to the given template type if needed.
Definition at line 1059 of file Field3DFile.h.
References field_dynamic_cast().
| Field_T< Data_T >::Vec Field3DInputFile::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.
Definition at line 1093 of file Field3DFile.h.
References field_dynamic_cast().
| 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 1128 of file Field3DFile.h.
References FieldBase::attribute, Field3DFileBase::getIntPartitionNames(), Field3DFileBase::getIntScalarLayerNames(), Field3DFileBase::getIntVectorLayerNames(), Field3DFileBase::m_file, File::Layer::name, FieldBase::name, File::Layer::parent, Field3DFileBase::partition(), Msg::print(), Hdf5Util::readAttribute(), readMetadata(), Field3DFileBase::removeUniqueId(), FieldRes::setMapping(), ResizableField< Data_T >::setSize(), and Msg::SevWarning.
| 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 1225 of file Field3DFile.h.
References Field3DFileBase::getPartitionNames(), and Field3DFileBase::getScalarLayerNames().
| 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 1260 of file Field3DFile.h.
References Field3DFileBase::getPartitionNames(), and Field3DFileBase::getVectorLayerNames().
| bool Field3DInputFile::open | ( | const std::string & | filename | ) |
Opens the given file.
Definition at line 575 of file Field3DFile.cpp.
References Field3DFileBase::clear(), Field3DFileBase::close(), Hdf5Util::H5Base::id(), Field3DFileBase::m_file, m_filename, Msg::print(), Hdf5Util::readAttribute(), readMetadata(), readPartitionAndLayerInfo(), Msg::SevWarning, and Exc::Exception::what().
| 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 784 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 798 of file Field3DFile.cpp.
References Field3DFileBase::m_layerInfo, Msg::print(), Hdf5Util::readAttribute(), and Msg::SevWarning.
Referenced by InputFile::parseLayers().
| bool Field3DInputFile::readGroupMembership | ( | GroupMembershipMap & | gpMembershipMap | ) |
Read the group membership for the partitions.
Definition at line 1039 of file Field3DFile.cpp.
References Hdf5Util::H5Base::id(), Field3DFileBase::m_file, Field3DFileBase::m_groupMembership, Msg::print(), Hdf5Util::readAttribute(), Field3DFileBase::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 1295 of file Field3DFile.h.
References Field3DFileBase::intPartitionName().
|
private |
Retrieves a single layer given its and its parent partition's name. Maintains the on-disk data types.
Definition at line 1305 of file Field3DFile.h.
References Field3DFileBase::intPartitionName().
|
private |
This call does the actual reading of a layer. Notice that it expects a unique -internal- partition name.
Definition at line 911 of file Field3DFile.h.
References Field3DFileBase::m_file, m_filename, Field3DFileBase::partition(), Msg::print(), Hdf5Util::readAttribute(), readMetadata(), Field3DFileBase::removeUniqueId(), and Msg::SevWarning.
|
private |
Sets up all the partitions and layers, but does not load any data.
Definition at line 692 of file Field3DFile.cpp.
References InputFile::ParseLayersInfo::file, 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.
Referenced by open().
|
private |
Read metadata for this layer.
Definition at line 821 of file Field3DFile.cpp.
References 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 930 of file Field3DFile.cpp.
References Hdf5Util::H5Base::id(), Field3DFileBase::metadata(), Msg::print(), Hdf5Util::readAttribute(), 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 603 of file Field3DFile.h.
Referenced by open(), and readLayer().