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

Implementation of Mesh::MeshNodesInterface that delay-loads data stored in a specific Hdf5 file as it is needed. More...

#include <HDF5/hdf5meshnodesinterface.h>

Inheritance diagram for Hdf5MeshNodesInterface:
[legend]

Public Member Functions

 Hdf5MeshNodesInterface ()
 
 Hdf5MeshNodesInterface (const Hdf5MeshNodesInterface &)
 
Mesh::NodeHandle add (const Mesh::Vector3d &position) override
 
void clear () override
 
bool empty () const override
 
iterator erase (const iterator &position) override
 
const Mesh::BoundingBoxMinimalgetBounds () const
 
Mesh::Vector3d getPosition (const Mesh::NodeHandle &nodeHandle) const override
 
bool getState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, double &result) const override
 
bool getState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, int_type &result) const override
 
bool getState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, Mesh::Vector3d &result) const override
 
bool getState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, quint16 &result) const override
 
bool getState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, quint8 &result) const override
 
size_type highestNodeIndex () const override
 
bool initialize (hid_t &file, const QString &meshName, int lod)
 
bool isStateTypeSupported (const DataExecution::DataFactory &dataFactory) const override
 
bool loadPositions ()
 
void remove (const Mesh::NodeHandle &nodeHandle) override
 
void reserve (size_type n) override
 
void setPosition (const Mesh::NodeHandle &nodeHandle, const Mesh::Vector3d &position) override
 
bool setState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, const DataExecution::DataObject &value) override
 
bool setState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, const Mesh::Vector3d &value) override
 
bool setState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, double value) override
 
bool setState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, int_type value) override
 
bool setState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, quint16 value) override
 
bool setState (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, quint8 value) override
 
size_type size () const override
 
- Public Member Functions inherited from MeshNodesInterface
virtual NodeHandle add (const Vector3d &position)=0
 
const NodeStateHandleaddState (const QString &name, const DataExecution::DataObject &defaultValue)
 
template<typename T >
const NodeStateHandleaddState (const QString &name, const T &defaultValue)
 
iterator begin ()
 
const_iterator begin () const
 
virtual BoundingBoxMinimal calculateBoundingBox () const
 
virtual bool canAddState (const DataExecution::DataObject &defaultValue)
 
virtual bool canRemoveState (const NodeStateHandle &state)
 
virtual void clear ()=0
 
virtual bool digestContiguousFloatStateData (const NodeStateHandle &state, std::function< bool(size_type numNodes, size_type componentsPerNode, size_type stride, const double *data)> digestFunc) const
 
virtual bool digestContiguousIntegerStateData (const NodeStateHandle &state, std::function< bool(size_type numNodes, size_type componentsPerNode, size_type stride, const int_type *data)> digestFunc) const
 
virtual bool digestContiguousPositionData (std::function< bool(size_type numNodes, size_type stride, const double *data)> digestFunc) const
 
virtual bool digestContiguousUInt16StateData (const NodeStateHandle &state, std::function< bool(size_type numNodes, size_type componentsPerNode, size_type stride, const quint16 *data)> digestFunc) const
 
virtual bool digestContiguousUInt8StateData (const NodeStateHandle &state, std::function< bool(size_type numNodes, size_type componentsPerNode, size_type stride, const quint8 *data)> digestFunc) const
 
virtual bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool ensureAllStatesSupported (const NodeStateHandleList &states)
 
virtual iterator erase (const iterator &position)=0
 
NodeStateHandleList getAllStateHandles () const
 
virtual ContiguousDataAccessType getContiguousDataAccessType () const
 
virtual Vector3d getPosition (const NodeHandle &nodeHandle) const =0
 
bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, DataExecution::DataObject &result)
 
bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, DataExecution::DataObject &result) const
 
virtual bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, double &result) const
 
virtual bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, int_type &result) const
 
virtual bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, quint16 &result) const
 
virtual bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, quint8 &result) const
 
virtual bool getState (const NodeHandle &nodeHandle, const NodeStateHandle &state, Vector3d &result) const
 
const NodeStateHandlegetStateHandle (const QString &name) const
 
bool hasState (const QString &name) const
 
virtual size_t height () const
 
virtual size_type highestNodeIndex () const =0
 
virtual bool isDense () const
 
virtual bool isStateTypeSupported (const DataExecution::DataFactory &dataFactory) const =0
 
virtual bool load (MeshSerializer &serializer)
 
virtual void remove (const NodeHandle &nodeHandle)=0
 
bool removeAllStates ()
 
bool removeState (const NodeStateHandle &state)
 
bool removeState (const QString &name)
 
bool renameState (const QString &from, const QString &to)
 
virtual void reserve (size_type n)
 
virtual bool save (MeshSerializer &serializer, NodeHandleIndexHash &nodeIds) const
 
virtual void setPosition (const NodeHandle &nodeHandle, const Vector3d &position)=0
 
virtual bool setState (const NodeHandle &nodeHandle, const NodeStateHandle &state, const DataExecution::DataObject &value)=0
 
virtual bool setState (const NodeHandle &nodeHandle, const NodeStateHandle &state, const Vector3d &value)
 
virtual bool setState (const NodeHandle &nodeHandle, const NodeStateHandle &state, double value)
 
virtual bool setState (const NodeHandle &nodeHandle, const NodeStateHandle &state, int_type value)
 
virtual bool setState (const NodeHandle &nodeHandle, const NodeStateHandle &state, quint16 value)
 
virtual bool setState (const NodeHandle &nodeHandle, const NodeStateHandle &state, quint8 value)
 
virtual size_type size () const =0
 
virtual size_t width () const
 

Protected Member Functions

Mesh::NodeStateHandleaddStateToImplementation (const QString &name, const DataExecution::DataObject &defaultValue) override
 
Mesh::NodeHandle advance (const Mesh::NodeHandle &nodeHandle, size_type n) const override
 
Mesh::NodeHandle beginHandle () const override
 
Mesh::BoundingBoxMinimal calculateBoundingBox () const override
 
Mesh::NodeHandle endHandle () const override
 
bool ensureDoubleStateLoaded (const Mesh::NodeStateHandle &state)
 
bool ensureIntStateLoaded (const Mesh::NodeStateHandle &state)
 
bool ensureUInt16StateLoaded (const Mesh::NodeStateHandle &state)
 
bool ensureUInt8StateLoaded (const Mesh::NodeStateHandle &state)
 
bool ensureVectorStateLoaded (const Mesh::NodeStateHandle &state)
 
bool getStateImpl (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, DataExecution::DataObject &result) const override
 
bool getStateImpl (const Mesh::NodeHandle &nodeHandle, const Mesh::NodeStateHandle &state, DataExecution::DataObject &result) override
 
bool removeStateFromImplementation (const Mesh::NodeStateHandle &state) override
 
- Protected Member Functions inherited from MeshNodesInterface
 MeshNodesInterface ()
 
 MeshNodesInterface (const MeshNodesInterface &)
 
virtual ~MeshNodesInterface ()
 
virtual NodeStateHandleaddStateToImplementation (const QString &name, const DataExecution::DataObject &defaultValue)=0
 
virtual NodeHandle advance (const NodeHandle &nodeHandle, size_type n) const =0
 
virtual NodeHandle beginHandle () const
 
iterator createIterator (const NodeHandle &handle) const
 
virtual NodeHandle endHandle () const
 
virtual bool getStateImpl (const NodeHandle &nodeHandle, const NodeStateHandle &state, DataExecution::DataObject &result) const =0
 
virtual bool getStateImpl (const NodeHandle &nodeHandle, const NodeStateHandle &state, DataExecution::DataObject &result)=0
 
MeshNodesInterfaceoperator= (const MeshNodesInterface &)
 
bool registerExistingState (MeshModelInterface::size_type index, const QString &name, const DataExecution::DataObject &defaultValue)
 
virtual bool removeStateFromImplementation (const NodeStateHandle &state)=0
 
virtual bool stateBeingRenamed (const NodeStateHandle &state, const QString &to)
 

Additional Inherited Members

- Public Types inherited from MeshNodesInterface
enum  ContiguousDataAccessType { DirectBufferAccess , CopiedBufferAccess }
 The type of access that a particular implementation provides to contiguous data. More...
 
using int_type = MeshModelInterface::int_type
 
using ItemHandleListType = NodeHandleList
 
using ItemHandleType = NodeHandle
 
using size_type = MeshModelInterface::size_type
 
using StateHandleListType = NodeStateHandleList
 
using StateHandleType = NodeStateHandle
 

Detailed Description

See also
Hdf5MeshModelInterface
Hdf5MeshElementsInterface
Hdf5StateStorage

Constructor & Destructor Documentation

◆ Hdf5MeshNodesInterface() [1/2]

◆ Hdf5MeshNodesInterface() [2/2]

Member Function Documentation

◆ add()

NodeHandle add ( const Mesh::Vector3d position)
overridevirtual
Parameters
positionThe position of the new node being added
Returns
A NodeHandle to the newly added node or an invalid NodeHandle if a new node could not be added. Subclass implementations can return an invalid handle simply by returning a default-constructed NodeHandle.

Implements MeshNodesInterface.

◆ addStateToImplementation()

NodeStateHandle * addStateToImplementation ( const QString &  name,
const DataExecution::DataObject defaultValue 
)
overrideprotectedvirtual
Parameters
nameName of the state
defaultValueA default value of for this state

Derived classes must implement this method, returning a NodeStateHandle with the index they will use to refer to this state along with the name and default value passed as parameters.

Returns
A NodeStateHandle with the index the implementation has associated with this state. The caller will take ownership of this newed object. The indices assigned to states by the derived class do not have to be unique across all states but must be unique amongst all states of a given type. Hence the DataFactory and handle together form the unique ID. If the state could not be added a NULL pointer should be returned.
See also
isStateTypeSupported

Implements MeshNodesInterface.

◆ advance()

NodeHandle advance ( const Mesh::NodeHandle nodeHandle,
size_type  n 
) const
overrideprotectedvirtual
Returns
A NodeHandle n nodes past nodeHandle or endHandle() if it's past the last node.
See also
endHandle

Implements MeshNodesInterface.

◆ beginHandle()

NodeHandle beginHandle ( ) const
overrideprotectedvirtual
Returns
A handle that represents the first node or endHandle() if there are no nodes.
See also
begin

Reimplemented from MeshNodesInterface.

◆ calculateBoundingBox()

BoundingBoxMinimal calculateBoundingBox ( ) const
overrideprotectedvirtual
Returns
The bounding box (min and max extent) of this mesh nodes interface.

Overridden version of this method which attempts to read bounding box data from the HDF5 file.

Reimplemented from MeshNodesInterface.

◆ clear()

void clear ( )
overridevirtual

Clears all node data. Defined states must be removed separately via removeAllStates.

See also
removeAllStates

Implements MeshNodesInterface.

◆ empty()

bool empty ( ) const
overridevirtual

Default implmentation simply checks size(), derived classes should override if something more efficient is possible.

Reimplemented from MeshNodesInterface.

◆ endHandle()

CSIRO::Mesh::NodeHandle endHandle ( ) const
overrideprotectedvirtual
Returns
A handle that represents the node "one past the end". Ie. An index analogous to std::container::end()
See also
end

Reimplemented from MeshNodesInterface.

◆ ensureDoubleStateLoaded()

bool ensureDoubleStateLoaded ( const Mesh::NodeStateHandle state)
protected
Parameters
state
Returns

◆ ensureIntStateLoaded()

bool ensureIntStateLoaded ( const Mesh::NodeStateHandle state)
protected
Parameters
state
Returns

◆ ensureUInt16StateLoaded()

bool ensureUInt16StateLoaded ( const Mesh::NodeStateHandle state)
protected
Parameters
state
Returns

◆ ensureUInt8StateLoaded()

bool ensureUInt8StateLoaded ( const Mesh::NodeStateHandle state)
protected
Parameters
state
Returns

◆ ensureVectorStateLoaded()

bool ensureVectorStateLoaded ( const Mesh::NodeStateHandle state)
protected
Parameters
state
Returns

◆ erase()

Hdf5MeshNodesInterface::iterator erase ( const iterator position)
overridevirtual
Returns
An iterator for the next node or end() if the erased node was at the end.
Postcondition
Erasing a node may invalidate any existing NodeHandles currently held by something outside of the class. Removing a node does not guarantee any associated elements are updated, calling code is responsible for this if required.
See also
MeshModelInterface::emptyTrash

Implements MeshNodesInterface.

◆ getBounds()

const BoundingBoxMinimal & getBounds ( ) const
Returns
The bounding box (min and max extent) of the nodes.

Reads the bounding box info from the HDF5 file and stores it internally.

◆ getPosition()

Vector3d getPosition ( const Mesh::NodeHandle nodeHandle) const
overridevirtual
Parameters
nodeHandleThe node we're requesting the position of
Precondition
nodeHandle must be a valid handle or the result is undefined

Implements MeshNodesInterface.

◆ getState() [1/5]

bool getState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
double &  result 
) const
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ getState() [2/5]

bool getState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
int_type result 
) const
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ getState() [3/5]

bool getState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
Mesh::Vector3d result 
) const
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ getState() [4/5]

bool getState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
quint16 &  result 
) const
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ getState() [5/5]

bool getState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
quint8 &  result 
) const
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ getStateImpl() [1/2]

bool getStateImpl ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
DataExecution::DataObject result 
) const
overrideprotectedvirtual
Parameters
nodeHandleThe node we're requesting the state of
stateThe state we're requesting
resultA DataObject to store the result in (must be of type state.getDataObject() unless the implementation can convert)

This method is free to return shared data in result as it is only ever called by the public const getState method which will clone any shared data. As this is the case derived class should be able to implement the non-const getState() pure virtual as a simple call to this method as long as the only non-const thing this method does is return shared data.

See also
getState

Implements MeshNodesInterface.

◆ getStateImpl() [2/2]

bool getStateImpl ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
DataExecution::DataObject result 
)
overrideprotectedvirtual
Parameters
nodeHandleThe node we're requesting the state of
stateThe state we're requesting
resultA DataObject to store the result in (must be of type state.getDataObject() unless the implementation can convert)
See also
getState

Implements MeshNodesInterface.

◆ highestNodeIndex()

Mesh::MeshNodesInterface::size_type highestNodeIndex ( ) const
overridevirtual
Returns
highest index used by a valid NodeHandle (may be higher than size() if implementation is sparse or has invalid nodes internally)

Implements MeshNodesInterface.

◆ initialize()

bool initialize ( hid_t &  file,
const QString &  meshName,
int  lod 
)
Parameters
fileThe HDF5 file to initialise the interface from.
meshNameThe name of the mesh that this interface references.
lodThe LOD of the mesh meshName that this interface references.
Returns
true if initialization was successful, false if a HDF5 error occurs, such as the mesh not existing, the LOD not existing, or the file being unreadable.

◆ isStateTypeSupported()

bool isStateTypeSupported ( const DataExecution::DataFactory dataFactory) const
overridevirtual
Parameters
dataFactoryThe DataFactory for the type of state we're checking support for
Returns
Whether the implementation supports node states of this type
See also
addState(const QString& name, const T& defaultValue)

Implements MeshNodesInterface.

◆ loadPositions()

bool loadPositions ( )
Returns
true if the position data was able to be loaded successfully.

Loads position data from the HDF5 file and stores it internally.

◆ remove()

void remove ( const Mesh::NodeHandle nodeHandle)
overridevirtual
Postcondition
Removing a node may invalidate any existing NodeHandles currently held by something outside of the class. Removing a node does not guarantee any associated elements are updated, calling code is responsible for this if required. nodeHandle param is const and remains unmodified.
See also
MeshModelInterface::emptyTrash

Implements MeshNodesInterface.

◆ removeStateFromImplementation()

bool removeStateFromImplementation ( const Mesh::NodeStateHandle state)
overrideprotectedvirtual

Derived classes must implement this method, deleting the state.

Returns
true if the state was removed or false if there was an error.

Implements MeshNodesInterface.

◆ reserve()

void reserve ( size_type  n)
overridevirtual

Default implementation does nothing

Reimplemented from MeshNodesInterface.

◆ setPosition()

void setPosition ( const Mesh::NodeHandle nodeHandle,
const Mesh::Vector3d position 
)
overridevirtual
Parameters
nodeHandleThe node we're setting the position of
positionThe position to set on the node
Precondition
nodeHandle must be a valid handle or the result is undefined

Implements MeshNodesInterface.

◆ setState() [1/6]

bool setState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
const DataExecution::DataObject value 
)
overridevirtual
Parameters
nodeHandleThe node we're setting the state of
stateThe state we're setting
valueA DataObject containing the data to set (must be of type state.getDataObject() unless the implementation can convert)

Implements MeshNodesInterface.

◆ setState() [2/6]

bool setState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
const Mesh::Vector3d value 
)
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ setState() [3/6]

bool setState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
double  value 
)
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ setState() [4/6]

bool setState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
int_type  value 
)
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ setState() [5/6]

bool setState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
quint16  value 
)
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ setState() [6/6]

bool setState ( const Mesh::NodeHandle nodeHandle,
const Mesh::NodeStateHandle state,
quint8  value 
)
overridevirtual

Convenience function for common type that avoids client needing to use a DataObject. This method still uses an internal TypedObject to call the implementations corresponding method unless the implementation overrides this virtual method and handles this type directly.

Reimplemented from MeshNodesInterface.

◆ size()

MeshNodesInterface::size_type size ( ) const
overridevirtual
Returns
total number of valid nodes

Implements MeshNodesInterface.