Workspace 6.21.5
|
Helper class for writing a single Mesh::MeshModelInterface to a HDF5 format. More...
#include <HDF5/hdf5meshserializer.h>
Public Types | |
using | int_type = Mesh::MeshModelInterface::int_type |
typedef Mesh::MeshModelInterface::size_type | size_type |
using | StateTypeMap = QMap< QString, const DataExecution::DataFactory * > |
enum | UnsupportedStateControl : bool { AbortOnUnsupportedState = false , SkipUnsupportedState = true } |
Static Public Member Functions | |
static QStringList | readMeshNames (hid_t &file) |
Static Public Attributes | |
static const size_t | MAX_NAME_LENGTH = 1024 |
static const hid_t | STRING_DATATYPE = H5Tcopy(H5T_C_S1) |
static const int | STRING_DATATYPE_LENGTH = 50 |
static const Mesh::MeshModelInterface::size_type | VERSION = 1 |
The format is capable of storing multiple meshes in the same file, and multiple levels of detail for each mesh. The Hdf5MeshSerializer provides methods for serialising mesh data for each LOD associated with the mesh.
The Workspace Binary Hdf5 Mesh v1 Format is as follows:
a = attribute g = group d = dataset
g: root/ a: format_version (int) g: meshes/ g: mesh_name/ a: bounds_min (double[3]) a: bounds_max (double[3]) g: lods/ g: lod_num/ a: distance (double) a: node_count (uint32) d: positions (double) // for lods 1+, this will be a link to lods/0/positions if dataset is hierarchical g: node_states/ // for lods 1+, this will be a link to lods/0/node_states if dataset is hierarchical g: state_name/ a: type (int) d: state_data (double / int / double[3]) g: element_type/ d: indices (uint32) g: element_states/ g: state_name/ a: type (int) d: state_data (double / int / double[3]) g: instances/ (see Hdf5SceneSerializer) ...
using StateTypeMap = QMap<QString, const DataExecution::DataFactory*> |
enum UnsupportedStateControl : bool |
Hdf5MeshSerializer | ( | hid_t & | file, |
const QString & | meshName | ||
) |
file | The Hdf5 file to read from or write to. |
meshName | The name of the mesh to read / write. |
Constructs a new Hdf5MeshSerializer object for reading / writing to HDF5 mesh models.
bool readBounds | ( | Mesh::BoundingBoxMinimal & | bounds | ) | const |
bounds | (out) The bounds data to be read from the file. A succesful readBounds call will overwrite any data in the passed in bounds parameter. |
bool readElementIndices | ( | int | lod, |
Hdf5MeshElementsInterface & | elements | ||
) | const |
lod | The level of detail from which to read the distance data. |
elements | (out) MeshElementsInterface into which element index data will be read. |
bool readElementState | ( | int | lod, |
const QString & | stateName, | ||
Hdf5MeshElementsInterface & | elements | ||
) | const |
lod | The level of detail from which to read the distance data. |
stateName | The name of the state to read. |
elements | (out) MeshElementsInterface into which state data will be read. |
bool readElementStateNames | ( | int | lod, |
const Mesh::ElementType::Type & | type, | ||
QStringList & | stateNames | ||
) | const |
lod | The level of detail from which to read the distance data. |
type | The element type from which to retrieve state names. |
stateNames | (out) QStringList into which state names will be read. |
bool readElementStateTypes | ( | int | lod, |
const Mesh::ElementType::Type & | type, | ||
StateTypeMap & | states | ||
) | const |
lod | The level of detail from which to read the distance data. |
type | Element type for which state data will be read. |
states | (out) StateTypeMap into which state names and associated state types will be read. |
bool readElementTypes | ( | int | lod, |
QList< const Mesh::ElementType::Type * > & | types | ||
) | const |
lod | The level of detail from which to read the distance data. |
types | (out) QList of element types into which the list of element types available in this LOD will be read. |
bool readLodDistance | ( | int | lod, |
double & | dist | ||
) | const |
lod | The level of detail from which to read the distance data. |
dist | (out) The distance data will be stored here upon successful execution of the method. |
|
static |
file | File to read from |
bool readNodePositions | ( | int | lod, |
Hdf5MeshNodesInterface & | nodes | ||
) | const |
lod | The level of detail from which to read the distance data. |
nodes | (out) MeshNodesInterface into which position data will be read. |
bool readNodeState | ( | int | lod, |
const QString & | stateName, | ||
Hdf5MeshNodesInterface & | nodes | ||
) | const |
lod | The level of detail from which to read the distance data. |
stateName | The name of the state to read. |
nodes | (out) MeshNodesInterface into which state data will be read. |
bool readNodeStateNames | ( | int | lod, |
QStringList & | stateNames | ||
) | const |
lod | The level of detail from which to read the distance data. |
stateNames | (out) QStringList into which node state names will be read. |
bool readNodeStateTypes | ( | int | lod, |
StateTypeMap & | states | ||
) | const |
lod | The level of detail from which to read the distance data. |
states | (out) StateTypeMap into which state names and types will be read. |
bool readNumLods | ( | size_type & | n | ) | const |
n | (out) The number of LODs that exist in the file for this mesh. |
bool readNumNodes | ( | int | lod, |
size_type & | n | ||
) | const |
lod | The level of detail from which to read the distance data. |
n | (out) The number of nodes that exist for the specific LOD. |
bool readVersion | ( | size_type & | version | ) | const |
version | (out) Version data read from file. |
bool writeBounds | ( | const Mesh::BoundingBoxMinimal & | bounds | ) |
bounds | Bounding box of the mesh containing its min and max extents. |
bool writeCompleteMeshLod | ( | int | lod, |
const Mesh::MeshModelInterface & | meshModel, | ||
double | lodDistance, | ||
UnsupportedStateControl | control = AbortOnUnsupportedState |
||
) |
lod | The level of detail of the mesh to write to. |
meshModel | The mesh data to write to file. |
lodDistance | The distance to associate with this LOD. |
control | Skip or abort on the states that are not supported, i.e. cannot be written. |
Writes a complete mesh to a HDF5 file, storing its nodes, elements and state data as a specific level of detail (LOD) associated with the named mesh.
bool writeElementIndices | ( | int | lod, |
const Mesh::MeshElementsInterface & | elements | ||
) |
lod | The level of detail of the mesh to write to. |
elements | The elements to write to the specified level of detail. |
bool writeElementState | ( | int | lod, |
const Mesh::ElementStateHandle & | state, | ||
const Mesh::MeshElementsInterface & | elements, | ||
UnsupportedStateControl | control = AbortOnUnsupportedState |
||
) |
lod | The level of detail of the mesh to write to. |
state | The handle of the state to write. |
elements | The elements to write to the specified level of detail. |
control | Skip or abort on the states that are not supported, i.e. cannot be written. |
bool writeLodDistance | ( | int | lod, |
double | distance | ||
) |
lod | The level of detail of the mesh to write to. |
distance | The distance associated with the specified level of detail. |
bool writeNodePositions | ( | int | lod, |
const Mesh::HierarchicalReferenceMeshNodesInterface & | nodes | ||
) |
lod | The level of detail of the mesh to write to. |
nodes | The hierarchy of nodes to write to the specified level of detail. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload of the writeNodePositions method is to cater for hierarchical mesh model structures. In this case, the Hdf5MeshSerializer knows to avoid duplicating the node data for LODS 1+ and instead simply link to LOD 0's data, since it is essentially sorted hierarchically.
bool writeNodePositions | ( | int | lod, |
const Mesh::MeshNodesInterface & | nodes | ||
) |
lod | The level of detail of the mesh to write to. |
nodes | The nodes containing the position data to write to the HDF5 file. |
bool writeNodeState | ( | int | lod, |
const Mesh::NodeStateHandle & | state, | ||
const Mesh::MeshNodesInterface & | nodes, | ||
UnsupportedStateControl | control = AbortOnUnsupportedState |
||
) |
lod | The level of detail of the mesh to write to. |
state | The handle of the state to write. |
nodes | The nodes to write to the specified level of detail. |
control | Skip or abort on the states that are not supported, i.e. cannot be written. |
bool writeVersion | ( | ) |
|
static |
Maximum name length
|
static |
String datatype used to store state names and other string identifiers. Length is quite short so as to minimise the storage used.
|
static |
String datatype length
|
static |
Version number of the file. Should be incremented when significant changes are made.