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

#include <HDF5/hdf5statestorage.h>

Public Member Functions

 Hdf5StateStorage ()
 
 Hdf5StateStorage (const Hdf5StateStorage &other)
 
size_type addItem ()
 
size_type addState (const Mesh::Vector3d &defaultValue)
 
size_type addState (double defaultValue)
 
size_type addState (int_type defaultValue)
 
size_type addState (quint16 defaultValue)
 
size_type addState (quint8 defaultValue)
 
void clear ()
 
void emptyTrash ()
 
double getDoubleState (size_type stateIndex, size_type itemIndex) const
 
std::vector< int_type > & getIntegerStateData (size_type stateIndex)
 
int getIntState (size_type stateIndex, size_type itemIndex) const
 
std::vector< double > & getScalarStateData (size_type stateIndex)
 
quint16 getUInt16State (size_type stateIndex, size_type itemIndex) const
 
std::vector< quint16 > & getUInt16StateData (size_type stateIndex)
 
quint8 getUInt8State (size_type stateIndex, size_type itemIndex) const
 
std::vector< quint8 > & getUInt8StateData (size_type stateIndex)
 
Mesh::Vector3dgetVectorState (size_type stateIndex, size_type itemIndex) const
 
std::vector< Mesh::Vector3d > & getVectorStateData (size_type stateIndex)
 
bool isDoubleStateLoaded (const Mesh::StateHandle &state) const
 
bool isIntStateLoaded (const Mesh::StateHandle &state) const
 
bool isItemValid (size_type index) const
 
bool isUInt16StateLoaded (const Mesh::StateHandle &state) const
 
bool isUInt8StateLoaded (const Mesh::StateHandle &state) const
 
bool isVectorStateLoaded (const Mesh::StateHandle &state) const
 
void logText (const QString &msg) const
 
size_type numValidAndInvalidItems () const
 
size_type numValidItems () const
 
Hdf5StateStorageoperator= (const Hdf5StateStorage &other)
 
void removeAllItems ()
 
void removeDoubleState (size_type index)
 
void removeIntState (size_type index)
 
void removeItem (size_type index)
 
void removeUInt16State (size_type index)
 
void removeUInt8State (size_type index)
 
void removeVector3dState (size_type index)
 
void reserve (size_type numItems)
 
bool resetToSize (size_type numItems)
 
void setState (size_type stateIndex, size_type itemIndex, const Mesh::Vector3d &value)
 
void setState (size_type stateIndex, size_type itemIndex, double value)
 
void setState (size_type stateIndex, size_type itemIndex, int_type value)
 
void setState (size_type stateIndex, size_type itemIndex, quint16 value)
 
void setState (size_type stateIndex, size_type itemIndex, quint8 value)
 

Constructor & Destructor Documentation

◆ Hdf5StateStorage() [1/2]

◆ Hdf5StateStorage() [2/2]

Hdf5StateStorage ( const Hdf5StateStorage other)
default

Member Function Documentation

◆ addItem()

size_type addItem ( )
Returns
The index of the newly added item item.

◆ addState() [1/5]

size_type addState ( const Mesh::Vector3d defaultValue)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ addState() [2/5]

size_type addState ( double  defaultValue)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ addState() [3/5]

size_type addState ( int_type  defaultValue)
Parameters
defaultValueThe default value to assign to new items for this state.
Returns
The index of the new state

◆ addState() [4/5]

size_type addState ( quint16  defaultValue)
Parameters
defaultValueThe default value to assign to new items for this state.
Returns
The index of the new state

◆ addState() [5/5]

size_type addState ( quint8  defaultValue)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ clear()

void clear ( )

◆ emptyTrash()

void emptyTrash ( )

Cleans up the state data, removing invalid items (i.e. state data for nodes or elements that no longer exist in the associated mesh) from the structure. Invoke this at the conclusion of an algorithm that significantly modifies the underlying mesh structure.

◆ getDoubleState()

double getDoubleState ( size_type  stateIndex,
size_type  itemIndex 
) const
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
Returns
The value of the specified stateIndex at this itemIndex

Retrieves a specific state value from a specific item.

◆ getIntegerStateData()

std::vector< int_type > & getIntegerStateData ( size_type  stateIndex)
Parameters
stateIndexThe index of the state to retrieve as a contiguous array of integers.
Returns
A contiguous vector of integers containing the data associated with the state with the specified stateIndex.

◆ getIntState()

int getIntState ( size_type  stateIndex,
size_type  itemIndex 
) const
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
Returns
The value of the specified stateIndex at this itemIndex

Retrieves a specific state value from a specific item.

◆ getScalarStateData()

std::vector< double > & getScalarStateData ( size_type  stateIndex)
Parameters
stateIndexThe index of the state to retrieve as a contiguous array of doubles.
Returns
A contiguous vector of doubles (scalar data) containing the data associated with the state with the specified stateIndex.

◆ getUInt16State()

quint16 getUInt16State ( size_type  stateIndex,
size_type  itemIndex 
) const
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
Returns
The value of the specified stateIndex at this itemIndex

Retrieves a specific state value from a specific item.

◆ getUInt16StateData()

std::vector< quint16 > & getUInt16StateData ( size_type  stateIndex)
Parameters
stateIndexThe index of the state to retrieve as a contiguous array of integers.
Returns
A contiguous vector of integers containing the data associated with the state with the specified stateIndex.

◆ getUInt8State()

quint8 getUInt8State ( size_type  stateIndex,
size_type  itemIndex 
) const
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
Returns
The value of the specified stateIndex at this itemIndex

Retrieves a specific state value from a specific item.

◆ getUInt8StateData()

std::vector< quint8 > & getUInt8StateData ( size_type  stateIndex)
Parameters
stateIndexThe index of the state to retrieve as a contiguous array of integers.
Returns
A contiguous vector of integers containing the data associated with the state with the specified stateIndex.

◆ getVectorState()

Vector3d & getVectorState ( size_type  stateIndex,
size_type  itemIndex 
) const
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
Returns
The value of the specified stateIndex at this itemIndex

Retrieves a specific state value from a specific item.

Postcondition
While this call is const as far as the compiler is concerned it's not logically const as the returned reference isn't const. So constness is all dependent on what you do with the return value. This is done so as to maximise efficiency.

◆ getVectorStateData()

std::vector< Vector3d > & getVectorStateData ( size_type  stateIndex)
Parameters
stateIndexThe index of the state to retrieve as a contiguous array of vectors.
Returns
A contiguous vector of Vector3d (vector data) containing the data associated with the state with the specified stateIndex.

◆ isDoubleStateLoaded()

bool isDoubleStateLoaded ( const Mesh::StateHandle state) const
Parameters
stateThe handle of the state to inspect.
Returns
true if the specified state is loaded from file, false otherwise.

◆ isIntStateLoaded()

bool isIntStateLoaded ( const Mesh::StateHandle state) const
Parameters
stateThe handle of the state to inspect.
Returns
true if the specified state is loaded from file, false otherwise.

◆ isItemValid()

bool isItemValid ( size_type  index) const
Parameters
indexThe index of the item for which to assess validity.
Returns
true if the item at index index is valid, false otherwise.

◆ isUInt16StateLoaded()

bool isUInt16StateLoaded ( const Mesh::StateHandle state) const
Parameters
stateThe handle of the state to inspect.
Returns
true if the specified state is loaded from file, false otherwise.

◆ isUInt8StateLoaded()

bool isUInt8StateLoaded ( const Mesh::StateHandle state) const
Parameters
stateThe handle of the state to inspect.
Returns
true if the specified state is loaded from file, false otherwise.

◆ isVectorStateLoaded()

bool isVectorStateLoaded ( const Mesh::StateHandle state) const
Parameters
stateThe handle of the state to inspect.
Returns
true if the specified state is loaded from file, false otherwise.

◆ logText()

void logText ( const QString &  msg) const
Parameters
msgThe message to write to the log.

◆ numValidAndInvalidItems()

size_type numValidAndInvalidItems ( ) const
Returns
The number of valid items stored. If used to store node states, this will correspond to the number of nodes with valid state data. Likewise for elements.

Note that items only become invalid once they have been 'removed' in some way but emptyTrash() has not yet been called to clean up the structure.

See also
emptyTrash

◆ numValidItems()

size_type numValidItems ( ) const
Returns
The number of valid items stored. If used to store node states, this will correspond to the number of nodes with valid state data. Likewise for elements.

Note that items only become invalid once they have been 'removed' in some way but emptyTrash() has not yet been called to clean up the structure.

See also
emptyTrash

◆ operator=()

Hdf5StateStorage & operator= ( const Hdf5StateStorage other)
default

◆ removeAllItems()

void removeAllItems ( )

Removes all integer, double and vector data from state storage. Note that space is not de-allocated - it remains reserved for reallocation.

◆ removeDoubleState()

void removeDoubleState ( size_type  index)
Parameters
indexThe index of the double state to remove.

◆ removeIntState()

void removeIntState ( size_type  index)
Parameters
indexThe index of the integer state to remove.

◆ removeItem()

void removeItem ( size_type  index)
Parameters
indexThe index of the item to remove from storage.

◆ removeUInt16State()

void removeUInt16State ( size_type  index)
Parameters
indexThe index of the integer state to remove.

◆ removeUInt8State()

void removeUInt8State ( size_type  index)
Parameters
indexThe index of the uint8 state to remove.

◆ removeVector3dState()

void removeVector3dState ( size_type  index)
Parameters
indexThe index of the vector state to remove.

◆ reserve()

void reserve ( size_type  numItems)
Parameters
numItemsThe number of nodes (or elements) to reserve storage space for.
Note
This will reserve integer, double and vector state data for numItems.

◆ resetToSize()

bool resetToSize ( size_type  numItems)
Parameters
numItemsThe desired number of items (nodes or elements) for which state data is to be stored.
Returns
true if the reset operation was successful, false otherwise.

Resets the size variables to the specific number of items. Does not clear existing state data, however. If this is needed, users should manually invoke clear().

◆ setState() [1/5]

void setState ( size_type  stateIndex,
size_type  itemIndex,
const Mesh::Vector3d value 
)
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
valueThe state value to assign to the item.

Sets the value of the specified state for a specific item.

◆ setState() [2/5]

void setState ( size_type  stateIndex,
size_type  itemIndex,
double  value 
)
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
valueThe state value to assign to the item.

Sets the value of the specified state for a specific item.

◆ setState() [3/5]

void setState ( size_type  stateIndex,
size_type  itemIndex,
int_type  value 
)
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
valueThe state value to assign to the item.

Sets the value of the specified state for a specific item.

◆ setState() [4/5]

void setState ( size_type  stateIndex,
size_type  itemIndex,
quint16  value 
)
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
valueThe state value to assign to the item.

Sets the value of the specified state for a specific item.

◆ setState() [5/5]

void setState ( size_type  stateIndex,
size_type  itemIndex,
quint8  value 
)
Parameters
stateIndexThe index of the state being set.
itemIndexThe index of the item for which the state value is being set.
valueThe state value to assign to the item.

Sets the value of the specified state for a specific item.