Field3D
|
#include <Field3DFileHDF5.h>
Classes | |
struct | LayerInfo |
Public Types | |
typedef std::map< std::string, std::string > | GroupMembershipMap |
Public Member Functions | |
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. | |
Constructors & destructor | |
Field3DFileHDF5Base () | |
virtual | ~Field3DFileHDF5Base ()=0 |
Pure virtual destructor to ensure we never instantiate this class. | |
Retreiving partition and layer names | |
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. | |
Convenience methods for partitionName | |
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. | |
Debug | |
void | printHierarchy () const |
Protected Types | |
typedef std::map< std::string, int > | PartitionCountMap |
typedef std::vector< FileHDF5::Partition::Ptr > | PartitionList |
Protected Member Functions | |
Convenience methods | |
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. | |
Protected Attributes | |
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. | |
Private Member Functions | |
Field3DFileHDF5Base (const Field3DFileHDF5Base &) | |
void | operator= (const Field3DFileHDF5Base &) |
Friends | |
class | Field3DInputFile |
class | Field3DOutputFile |
Provides some common functionality for Field3DInputFileHDF5 and Field3DOutputFileHDF5. It hold the partition->layer data structures, but knows nothing about how to actually get them to/from disk.
Definition at line 236 of file Field3DFileHDF5.h.
typedef std::map<std::string, std::string> Field3DFileHDF5Base::GroupMembershipMap |
Definition at line 257 of file Field3DFileHDF5.h.
|
protected |
Definition at line 346 of file Field3DFileHDF5.h.
|
protected |
Definition at line 347 of file Field3DFileHDF5.h.
Field3DFileHDF5Base::Field3DFileHDF5Base | ( | ) |
Definition at line 290 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, and g_hdf5Mutex.
|
pure virtual |
Pure virtual destructor to ensure we never instantiate this class.
Definition at line 308 of file Field3DFileHDF5.cpp.
References close().
|
private |
void Field3DFileHDF5Base::clear | ( | ) |
Clear the data structures and close the file.
Definition at line 487 of file Field3DFileHDF5.cpp.
References closeInternal(), m_groupMembership, and m_partitions.
Referenced by Field3DInputFileHDF5::open(), Field3DInputFileHDF5::readPartitionAndLayerInfo(), and Field3DInputFileHDF5::~Field3DInputFileHDF5().
bool Field3DFileHDF5Base::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.
Definition at line 496 of file Field3DFileHDF5.cpp.
References closeInternal().
Referenced by Field3DInputFileHDF5::open(), and ~Field3DFileHDF5Base().
void Field3DFileHDF5Base::getPartitionNames | ( | std::vector< std::string > & | names | ) | const |
Gets the names of all the partitions in the file.
Definition at line 386 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, m_partitions, and removeUniqueId().
Referenced by Field3DInputFileHDF5::readProxyScalarLayers(), and Field3DInputFileHDF5::readProxyVectorLayers().
void Field3DFileHDF5Base::getScalarLayerNames | ( | std::vector< std::string > & | names, |
const std::string & | partitionName ) const |
Gets the names of all the scalar layers in a given partition.
Definition at line 403 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, makeIntPartitionName(), numIntPartitions(), and partition().
Referenced by Field3DInputFileHDF5::readProxyScalarLayers().
void Field3DFileHDF5Base::getVectorLayerNames | ( | std::vector< std::string > & | names, |
const std::string & | partitionName ) const |
Gets the names of all the vector layers in a given partition.
Definition at line 421 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, makeIntPartitionName(), numIntPartitions(), and partition().
Referenced by Field3DInputFileHDF5::readProxyVectorLayers().
|
inline |
Returns a pointer to the given partition.
Definition at line 294 of file Field3DFileHDF5.h.
std::string Field3DFileHDF5Base::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.
Definition at line 316 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, m_partitionCount, m_partitions, makeIntPartitionName(), and removeUniqueId().
Referenced by getIntScalarLayerNames(), getIntVectorLayerNames(), Field3DInputFileHDF5::readLayer(), Field3DInputFileHDF5::readScalarLayer(), Field3DInputFileHDF5::readVectorLayer(), and Field3DOutputFileHDF5::writeLayer().
std::string Field3DFileHDF5Base::removeUniqueId | ( | const std::string & | partitionName | ) | const |
Strips any unique identifiers from the partition name and returns the original name.
Definition at line 373 of file Field3DFileHDF5.cpp.
Referenced by getPartitionNames(), Field3DOutputFileHDF5::incrementPartitionName(), intPartitionName(), Field3DInputFileHDF5::readGroupMembership(), Field3DInputFileHDF5::readLayer(), Field3DInputFileHDF5::readProxyLayer(), Field3DInputFileHDF5::readScalarLayers(), and Field3DInputFileHDF5::readVectorLayers().
void Field3DFileHDF5Base::addGroupMembership | ( | const GroupMembershipMap & | groupMembers | ) |
Add to the group membership.
Definition at line 551 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, and m_groupMembership.
|
inline |
accessor to the m_metadata class
Definition at line 321 of file Field3DFileHDF5.h.
Referenced by Field3DInputFileHDF5::readMetadata(), and Field3DOutputFileHDF5::writeMetadata().
|
inline |
This function should implemented by concrete classes to
get the callback when metadata changes.
Reimplemented from MetadataCallback.
Definition at line 330 of file Field3DFileHDF5.h.
void Field3DFileHDF5Base::printHierarchy | ( | ) | const |
Definition at line 1564 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, and m_partitions.
|
protected |
Closes the file if open.
Definition at line 505 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, g_hdf5Mutex, m_file, Msg::print(), and Msg::SevWarning.
Referenced by clear(), close(), and Field3DOutputFileHDF5::create().
|
protected |
Returns a pointer to the given partition.
Referenced by Field3DOutputFileHDF5::createNewPartition(), getIntScalarLayerNames(), getIntVectorLayerNames(), getScalarLayerNames(), getVectorLayerNames(), Field3DInputFileHDF5::readLayer(), Field3DInputFileHDF5::readPartitionAndLayerInfo(), Field3DInputFileHDF5::readProxyLayer(), and Field3DOutputFileHDF5::writeLayer().
|
protected |
Returns a pointer to the given partition.
|
protected |
Gets the names of all the -internal- partitions in the file.
Definition at line 439 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, and m_partitions.
Referenced by Field3DInputFileHDF5::readProxyLayer(), Field3DInputFileHDF5::readScalarLayers(), Field3DInputFileHDF5::readScalarLayers(), Field3DInputFileHDF5::readVectorLayers(), and Field3DInputFileHDF5::readVectorLayers().
|
protected |
Gets the names of all the scalar layers in a given partition, but assumes that partition name is the -internal- partition name.
Definition at line 452 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, intPartitionName(), partition(), and Msg::print().
Referenced by Field3DInputFileHDF5::readProxyLayer(), Field3DInputFileHDF5::readScalarLayers(), and Field3DInputFileHDF5::readScalarLayers().
|
protected |
Gets the names of all the vector layers in a given partition, but assumes that partition name is the -internal- partition name.
Definition at line 470 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, intPartitionName(), partition(), and Msg::print().
Referenced by Field3DInputFileHDF5::readProxyLayer(), Field3DInputFileHDF5::readVectorLayers(), and Field3DInputFileHDF5::readVectorLayers().
Returns the number of internal partitions for a given partition name.
Definition at line 521 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T, and m_partitions.
Referenced by getScalarLayerNames(), and getVectorLayerNames().
|
protected |
Makes an internal partition name given the external partition name. Effectively just tacks on .X to the name, where X is the number.
Definition at line 542 of file Field3DFileHDF5.cpp.
References FIELD3D_MTX_T.
Referenced by getScalarLayerNames(), getVectorLayerNames(), Field3DOutputFileHDF5::incrementPartitionName(), and intPartitionName().
|
private |
|
friend |
Definition at line 240 of file Field3DFileHDF5.h.
|
friend |
Definition at line 241 of file Field3DFileHDF5.h.
|
protected |
This stores layer info.
Definition at line 387 of file Field3DFileHDF5.h.
Referenced by Field3DInputFileHDF5::parseLayer(), and Field3DInputFileHDF5::readPartitionAndLayerInfo().
|
protected |
The hdf5 id of the current file. Will be -1 if no file is open.
Definition at line 390 of file Field3DFileHDF5.h.
Referenced by closeInternal(), Field3DOutputFileHDF5::create(), Field3DOutputFileHDF5::createNewPartition(), Field3DInputFileHDF5::open(), Field3DInputFileHDF5::readGroupMembership(), Field3DInputFileHDF5::readLayer(), Field3DInputFileHDF5::readPartitionAndLayerInfo(), Field3DInputFileHDF5::readProxyLayer(), Field3DOutputFileHDF5::writeGlobalMetadata(), Field3DOutputFileHDF5::writeGroupMembership(), and Field3DOutputFileHDF5::writeLayer().
|
protected |
Vector of partitions.
Definition at line 392 of file Field3DFileHDF5.h.
Referenced by clear(), Field3DOutputFileHDF5::createNewPartition(), getIntPartitionNames(), getPartitionNames(), intPartitionName(), numIntPartitions(), printHierarchy(), and Field3DInputFileHDF5::readPartitionAndLayerInfo().
|
protected |
This stores partition names.
Definition at line 394 of file Field3DFileHDF5.h.
Referenced by Field3DInputFileHDF5::parsePartition(), and Field3DInputFileHDF5::readPartitionAndLayerInfo().
|
protected |
Contains a counter for each partition name. This is used to keep multiple fields with the same name unique in the file.
Definition at line 398 of file Field3DFileHDF5.h.
Referenced by Field3DOutputFileHDF5::incrementPartitionName(), and intPartitionName().
|
protected |
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 ..."
Definition at line 403 of file Field3DFileHDF5.h.
Referenced by addGroupMembership(), clear(), Field3DInputFileHDF5::readGroupMembership(), and Field3DOutputFileHDF5::writeGroupMembership().
|
protected |
metadata
Definition at line 406 of file Field3DFileHDF5.h.