Workspace 6.21.5
Public Types | Public Member Functions | List of all members
MeshSerializer Class Reference

Helper class for writing MeshModelInterface data to Workspace Binary Mesh (.wbm) format. More...

#include <Mesh/DataStructures/MeshModelInterface/meshserializer.h>

Public Types

enum  {
  FormatVersion = 3 , MaxTagSize = 64 , IntStateId = 1 , DoubleStateId = 2 ,
  VectorStateId = 3 , Uint8StateId = 4 , Uint16StateId = 5 , SegmentElementId = 1 ,
  TriElementId = 2 , QuadElementId = 3 , TetraElementId = 4 , HexaElementId = 5
}
 
using int_type = MeshModelInterface::int_type
 
typedef MeshModelInterface::size_type size_type
 

Public Member Functions

 MeshSerializer (QIODevice &file)
 
bool atEnd () const
 
bool checkSimpleTag (const char *expectedTag)
 
bool isUsingSinglePrecisionFloats () const
 
bool read (char *data, qint64 size)
 
double readDouble ()
 
bool readDoubleArray (double *array, size_type numDoubles)
 
bool readHeader ()
 
int_type readInt ()
 
bool readIntArray (int_type *array, size_type numInts)
 
size_type readSize ()
 
QString readString ()
 
quint16 readUint16 ()
 
bool readUint16Array (quint16 *array, size_type count)
 
quint8 readUint8 ()
 
bool readUint8Array (quint8 *array, size_type count)
 
Vector3d readVector ()
 
void useSinglePrecisionFloats (bool single)
 
bool write (const char *data, qint64 size)
 
bool writeDataObject (const DataExecution::DataObject &obj)
 
void writeDouble (double value)
 
bool writeDoubleArray (const double *array, size_type numDoubles)
 
bool writeHeader ()
 
void writeInt (int_type value)
 
bool writeIntArray (const int_type *array, size_type numInts)
 
bool writeSimpleTag (const char *tag)
 
void writeSize (size_type value)
 
void writeString (const QString &str)
 
void writeUint16 (quint16 value)
 
bool writeUint16Array (const quint16 *array, size_type count)
 
void writeUint8 (quint8 value)
 
bool writeUint8Array (const quint8 *array, size_type count)
 
void writeVector (const Vector3d &value)
 

Detailed Description

Workspace Binary Mesh (.wbm) v1 Format

<variableName:variableSize(bytes)>


workspace_binary_mesh - header string format_version<version:4> - format version of this file max_tag_size<tagSize:4> - max size of fixed-sized 'tag' strings single_floats<useSinglePrecisionFloats:4> - 0 for double floating point precision, 1 for single

num_nodes<numNodes:4> - number of nodes <nodePositions:numNodes*sizeof(Vector3d)> - the node positions

num_states<numNodeStates:4> - number of node states

-for each numNodeStates- - all state definitions first state_def<stateType:4> - 1=int32, 2=floating-point, 3=vector3d state <stateNameSize:4> <stateNameChars:stateNameSize> <stateDefaultValue:sizeof(stateType)> <stateData:numItems*sizeof(stateType)> - the actual state data

num_element_types<numElementTypes:4> - number of element types -for each numElementTypes- element_type<elementType:4> - 1=segment, 2=tri, 3=quad, 4=tetra num_elements<numElements:4> - number of elements of this type <elementData:numElements*nodesPerElement*4> - nodeIds that make up this element num_states<numElementStates:4> - number of states for this element type

-for each numElementStates- - all state definitions first for this element type state_def<stateType:4> - 1=int32, 2=floating-point, 3=vector3d state <stateNameSize:4> <stateNameChars:stateNameSize> <stateDefaultValue:sizeof(stateType)> <stateData:numItems*sizeof(stateType)> - the actual state data

end_model

Member Typedef Documentation

◆ int_type

◆ size_type

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FormatVersion 
MaxTagSize 
IntStateId 
DoubleStateId 
VectorStateId 
Uint8StateId 
Uint16StateId 
SegmentElementId 
TriElementId 
QuadElementId 
TetraElementId 
HexaElementId 

Constructor & Destructor Documentation

◆ MeshSerializer()

MeshSerializer ( QIODevice &  file)

Member Function Documentation

◆ atEnd()

bool atEnd ( ) const

◆ checkSimpleTag()

bool checkSimpleTag ( const char *  expectedTag)

◆ isUsingSinglePrecisionFloats()

bool isUsingSinglePrecisionFloats ( ) const

◆ read()

bool read ( char *  data,
qint64  size 
)

◆ readDouble()

double readDouble ( )

◆ readDoubleArray()

bool readDoubleArray ( double *  array,
size_type  numDoubles 
)

◆ readHeader()

bool readHeader ( )

◆ readInt()

◆ readIntArray()

bool readIntArray ( int_type array,
size_type  numInts 
)

◆ readSize()

◆ readString()

QString readString ( )

◆ readUint16()

quint16 readUint16 ( )

◆ readUint16Array()

bool readUint16Array ( quint16 *  array,
size_type  count 
)

◆ readUint8()

quint8 readUint8 ( )

◆ readUint8Array()

bool readUint8Array ( quint8 *  array,
size_type  count 
)

◆ readVector()

Vector3d readVector ( )

◆ useSinglePrecisionFloats()

void useSinglePrecisionFloats ( bool  single)

◆ write()

bool write ( const char *  data,
qint64  size 
)

◆ writeDataObject()

bool writeDataObject ( const DataExecution::DataObject obj)

MSVC was happy to do this inline but g++ didn't seem to like this call to a templated method from within another template so I've split it out to a function in the cpp.

◆ writeDouble()

void writeDouble ( double  value)

◆ writeDoubleArray()

bool writeDoubleArray ( const double *  array,
size_type  numDoubles 
)

◆ writeHeader()

bool writeHeader ( )

◆ writeInt()

void writeInt ( int_type  value)

◆ writeIntArray()

bool writeIntArray ( const int_type array,
size_type  numInts 
)

◆ writeSimpleTag()

bool writeSimpleTag ( const char *  tag)

◆ writeSize()

void writeSize ( size_type  value)

◆ writeString()

void writeString ( const QString &  str)

◆ writeUint16()

void writeUint16 ( quint16  value)

◆ writeUint16Array()

bool writeUint16Array ( const quint16 *  array,
size_type  count 
)

◆ writeUint8()

void writeUint8 ( quint8  value)

◆ writeUint8Array()

bool writeUint8Array ( const quint8 *  array,
size_type  count 
)

◆ writeVector()

void writeVector ( const Vector3d value)