Field3D
|
Provides reading of .f3d (internally, hdf5 or Ogawa) files. More...
#include <Field3DFile.h>
Public Member Functions | |
const std::string & | encoding () const |
Returns an encoding descriptor of the given file. More... | |
bool | open (const std::string &filename) |
Opens the given file. More... | |
Constructors & destructor | |
Field3DInputFile () | |
virtual | ~Field3DInputFile () |
Reading layers from disk | |
template<class Data_T > | |
Field< Data_T >::Vec | readLayers (const std::string &layerName=std::string("")) const |
template<class Data_T > | |
Field< Data_T >::Vec | readLayers (const std::string &partitionName, const std::string &layerName) const |
Backward compatibility | |
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... | |
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 >::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... | |
![]() | |
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 & | metadata () |
accessor to the m_metadata class More... | |
const FieldMetadata & | 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... | |
void | addGroupMembership (const GroupMembershipMap &groupMembers) |
Add to the group membership. More... | |
void | printHierarchy () const |
Private Member Functions | |
void | cleanup () |
virtual void | closeInternal () |
Closes the file if open. More... | |
template<class Data_T > | |
Field< Data_T >::Ptr | readLayer (const std::string &intPartitionName, const std::string &layerName) const |
This call does the actual reading of a layer. Notice that it expects a unique -internal- partition name. More... | |
bool | readMetadata (const OgIGroup &metadataGroup) |
Read global metadata for this file. More... | |
bool | readMetadata (const OgIGroup &metadataGroup, FieldBase::Ptr field) const |
Read metadata for this layer. More... | |
bool | readPartitionAndLayerInfo () |
Sets up all the partitions and layers, but does not load any data. More... | |
template<class Data_T > | |
EmptyField< Data_T >::Ptr | readProxyLayer (OgIGroup &location, const std::string &name, const std::string &attribute, FieldMapping::Ptr mapping) const |
Retrieves a proxy version (EmptyField) from a given Ogawa location. More... | |
Private Attributes | |
boost::shared_ptr< Alembic::Ogawa::IArchive > | m_archive |
Pointer to the Ogawa archive. More... | |
std::string | m_filename |
Filename, only to be set by open(). More... | |
boost::shared_ptr< Field3DInputFileHDF5 > | m_hdf5 |
HDF5 fallback. More... | |
boost::shared_ptr< OgIGroup > | m_root |
Pointer to root group. 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 |
![]() | |
File::Partition::Ptr | getPartition (const std::string &partitionName) const |
Returns a pointer to the given partition. 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... | |
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... | |
![]() | |
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... | |
boost::shared_ptr< Field3DFileHDF5Base > | m_hdf5Base |
HDF5 fallback. More... | |
std::vector< LayerInfo > | m_layerInfo |
This stores layer info. More... | |
FieldMetadata | 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 or Ogawa) files.
Refer to using_files for examples of how to use this in your code.
Definition at line 413 of file Field3DFile.h.
Field3DInputFile::Field3DInputFile | ( | ) |
Definition at line 700 of file Field3DFile.cpp.
|
virtual |
bool Field3DInputFile::open | ( | const std::string & | filename | ) |
Opens the given file.
Definition at line 714 of file Field3DFile.cpp.
References Field3DFileBase::clear(), Field3DFileBase::close(), m_archive, m_filename, m_hdf5, Field3DFileBase::m_hdf5Base, m_root, Msg::print(), readMetadata(), readPartitionAndLayerInfo(), Msg::SevWarning, and Exc::Exception::what().
Referenced by FieldGroup< BaseTypeList_T, Dims_T >::load().
|
inline |
Field< Data_T >::Vec Field3DInputFile::readLayers | ( | const std::string & | layerName = std::string("") | ) | const |
Definition at line 1595 of file Field3DFile.cpp.
References Field3DFileBase::getIntPartitionNames(), and Field3DFileBase::getIntScalarLayerNames().
Field< Data_T >::Vec Field3DInputFile::readLayers | ( | const std::string & | partitionName, |
const std::string & | layerName | ||
) | const |
Definition at line 1628 of file Field3DFile.cpp.
References Field3DFileBase::getIntPartitionNames(), Field3DFileBase::getIntScalarLayerNames(), and Field3DFileBase::removeUniqueId().
|
inline |
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 461 of file Field3DFile.h.
|
inline |
This one allows the allows the partitionName to be passed in.
Definition at line 472 of file Field3DFile.h.
|
inline |
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 487 of file Field3DFile.h.
|
inline |
This version allows you to pass in the partition name.
Definition at line 498 of file Field3DFile.h.
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 1742 of file Field3DFile.cpp.
References Field3DFileBase::getIntPartitionNames(), Field3DFileBase::getIntScalarLayerNames(), Field3DFileBase::getIntVectorLayerNames(), Field3DOutputFile::m_hdf5, Field3DOutputFile::m_root, FieldBase::metadata(), File::Layer::name, File::Layer::parent, Field3DFileBase::partition(), Msg::print(), Field3DFileBase::removeUniqueId(), FieldMetadata::setIntMetadata(), 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 1845 of file Field3DFile.cpp.
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 1880 of file Field3DFile.cpp.
References Field3DFileBase::getPartitionNames(), and Field3DFileBase::getVectorLayerNames().
|
inlineprivatevirtual |
|
inlineprivate |
|
private |
This call does the actual reading of a layer. Notice that it expects a unique -internal- partition name.
Definition at line 1503 of file Field3DFile.cpp.
References FieldBase::attribute, FieldCache< Data_T >::cacheField(), FieldCache< Data_T >::getCachedField(), Field3DFileBase::intPartitionName(), Field3DOutputFile::m_root, File::Layer::name, FieldBase::name, File::Layer::parent, Field3DFileBase::partition(), Msg::print(), Field3DFileBase::removeUniqueId(), FieldRes::setMapping(), Msg::SevWarning, and FieldCache< Data_T >::singleton().
|
private |
Retrieves a proxy version (EmptyField) from a given Ogawa location.
Definition at line 1667 of file Field3DFile.cpp.
References FieldBase::attribute, FieldBase::name, FieldRes::setMapping(), and ResizableField< Data_T >::setSize().
|
private |
Sets up all the partitions and layers, but does not load any data.
Definition at line 844 of file Field3DFile.cpp.
References Field3DFileBase::m_partitions, m_root, File::Layer::name, File::Layer::parent, Field3DFileBase::partition(), Msg::print(), readFieldMapping(), and Msg::SevWarning.
Referenced by open().
|
private |
|
private |
Read global metadata for this file.
Definition at line 937 of file Field3DFile.cpp.
References Field3DFileBase::metadata().
|
private |
Filename, only to be set by open().
Definition at line 600 of file Field3DFile.h.
Referenced by open().
|
private |
|
private |
Pointer to root group.
Definition at line 604 of file Field3DFile.h.
Referenced by open(), and readPartitionAndLayerInfo().
|
private |