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

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

#include <HDF5/hdf5meshelementsinterface.h>

Inheritance diagram for Hdf5MeshElementsInterface:
[legend]

Public Member Functions

 Hdf5MeshElementsInterface (const Hdf5MeshElementsInterface &)
 
 Hdf5MeshElementsInterface (const Mesh::ElementType::Type &type)
 
Mesh::ElementHandle add (const Mesh::NodeHandleList &nodes) override
 
void clear () override
 
iterator erase (const iterator &position) override
 
Mesh::NodeHandle getNode (const Mesh::ElementHandle &element, size_type index) const override
 
bool getNodes (const Mesh::ElementHandle &element, Mesh::NodeHandleList &nodes) const override
 
bool getState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, double &result) const override
 
bool getState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, int_type &result) const override
 
bool getState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, Mesh::Vector3d &result) const override
 
bool getState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, quint16 &result) const override
 
bool getState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, quint8 &result) const override
 
bool initialize (hid_t &file, const QString &meshName, int lod)
 
bool isStateTypeSupported (const DataExecution::DataFactory &dataFactory) const override
 
bool loadNodeIndices (const Mesh::ElementType::Type &type)
 
Hdf5MeshElementsInterfaceoperator= (const Hdf5MeshElementsInterface &)
 
void remove (const Mesh::ElementHandle &elementHandle) override
 
void reserve (size_type n) override
 
bool setNode (const Mesh::ElementHandle &element, const Mesh::NodeHandle &node, size_type index) override
 
bool setNodes (const Mesh::ElementHandle &element, const Mesh::NodeHandleList &nodes) override
 
bool setState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, const DataExecution::DataObject &value) override
 
bool setState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, const Mesh::Vector3d &value) override
 
bool setState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, double value) override
 
bool setState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, int_type value) override
 
bool setState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, quint16 value) override
 
bool setState (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, quint8 value) override
 
size_type size () const override
 
- Public Member Functions inherited from MeshElementsInterface
ElementHandle add (const NodeHandle &node0, const NodeHandle &node1)
 
ElementHandle add (const NodeHandle &node0, const NodeHandle &node1, const NodeHandle &node2)
 
ElementHandle add (const NodeHandle &node0, const NodeHandle &node1, const NodeHandle &node2, const NodeHandle &node3)
 
ElementHandle add (const NodeHandle &node0, const NodeHandle &node1, const NodeHandle &node2, const NodeHandle &node3, const NodeHandle &node4, const NodeHandle &node5, const NodeHandle &node6, const NodeHandle &node7)
 
virtual ElementHandle add (const NodeHandleList &nodes)=0
 
const ElementStateHandleaddState (const QString &name, const DataExecution::DataObject &defaultValue)
 
template<typename T >
const ElementStateHandleaddState (const QString &name, const T &defaultValue)
 
iterator begin ()
 
const_iterator begin () const
 
virtual bool canAddState (const DataExecution::DataObject &defaultValue)
 
virtual bool canRemoveState (const ElementStateHandle &state)
 
virtual void clear ()=0
 
virtual bool digestContiguousFloatStateData (const ElementStateHandle &state, std::function< bool(size_type numElems, size_type nodesPerElem, size_type stride, const double *data)> digestFunc) const
 
virtual bool digestContiguousIntegerStateData (const ElementStateHandle &state, std::function< bool(size_type numElems, size_type nodesPerElem, size_type stride, const int_type *data)> digestFunc) const
 
virtual bool digestContiguousNodeIndexData (std::function< bool(size_type numElems, size_type nodesPerElem, size_type stride, const ItemHandle::size_type *data)> digestFunc) const
 
virtual bool digestContiguousUInt16StateData (const ElementStateHandle &state, std::function< bool(size_type numElems, size_type nodesPerElem, size_type stride, const quint16 *data)> digestFunc) const
 
virtual bool digestContiguousUInt8StateData (const ElementStateHandle &state, std::function< bool(size_type numElems, size_type nodesPerElem, size_type stride, const quint8 *data)> digestFunc) const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool ensureAllStatesSupported (const ElementStateHandleList &states)
 
virtual iterator erase (const iterator &position)=0
 
ElementStateHandleList getAllStateHandles () const
 
virtual ContiguousDataAccessType getContiguousDataAccessType () const
 
const ElementType::TypegetElementType () const
 
virtual NodeHandle getNode (const ElementHandle &element, size_type index) const =0
 
virtual int getNodeIndex (const ElementHandle &element, const NodeHandle &node) const
 
virtual bool getNodes (const ElementHandle &element, NodeHandleList &nodes) const =0
 
bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, DataExecution::DataObject &result)
 
bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, DataExecution::DataObject &result) const
 
virtual bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, double &result) const
 
virtual bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, int_type &result) const
 
virtual bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, quint16 &result) const
 
virtual bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, quint8 &result) const
 
virtual bool getState (const ElementHandle &elementHandle, const ElementStateHandle &state, Vector3d &result) const
 
const ElementStateHandlegetStateHandle (const QString &name) const
 
bool hasState (const QString &name) const
 
virtual bool isAttached (const ElementHandle &element, const NodeHandle &node) const
 
virtual bool isStateTypeSupported (const DataExecution::DataFactory &dataFactory) const =0
 
virtual bool isValid () const
 
virtual bool load (MeshSerializer &serializer)
 
virtual void remove (const ElementHandle &elementHandle)=0
 
bool removeAllStates ()
 
bool removeState (const ElementStateHandle &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, const NodeHandleIndexHash &nodeIds) const
 
virtual bool setNode (const ElementHandle &element, const NodeHandle &node, size_type index)=0
 
virtual bool setNodes (const ElementHandle &element, const NodeHandleList &nodes)=0
 
virtual bool setState (const ElementHandle &elementHandle, const ElementStateHandle &state, const DataExecution::DataObject &value)=0
 
virtual bool setState (const ElementHandle &elementHandle, const ElementStateHandle &state, const Vector3d &value)
 
virtual bool setState (const ElementHandle &elementHandle, const ElementStateHandle &state, double value)
 
virtual bool setState (const ElementHandle &elementHandle, const ElementStateHandle &state, int_type value)
 
virtual bool setState (const ElementHandle &elementHandle, const ElementStateHandle &state, quint16 value)
 
virtual bool setState (const ElementHandle &elementHandle, const ElementStateHandle &state, quint8 value)
 
virtual size_type size () const =0
 

Protected Member Functions

Mesh::ElementStateHandleaddStateToImplementation (const QString &name, const DataExecution::DataObject &defaultValue) override
 
Mesh::ElementHandle advance (const Mesh::ElementHandle &elementHandle, size_type n) const override
 
Mesh::ElementHandle beginHandle () const override
 
Mesh::ElementHandle endHandle () const override
 
bool ensureDoubleStateLoaded (const Mesh::ElementStateHandle &state)
 
bool ensureIntStateLoaded (const Mesh::ElementStateHandle &state)
 
bool ensureUInt16StateLoaded (const Mesh::ElementStateHandle &state)
 
bool ensureUInt8StateLoaded (const Mesh::ElementStateHandle &state)
 
bool ensureVectorStateLoaded (const Mesh::ElementStateHandle &state)
 
bool getStateImpl (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, DataExecution::DataObject &result) const override
 
bool getStateImpl (const Mesh::ElementHandle &elementHandle, const Mesh::ElementStateHandle &state, DataExecution::DataObject &result) override
 
bool removeStateFromImplementation (const Mesh::ElementStateHandle &state) override
 
- Protected Member Functions inherited from MeshElementsInterface
 MeshElementsInterface (const ElementType::Type &type)
 
 MeshElementsInterface (const MeshElementsInterface &)
 
virtual ~MeshElementsInterface ()
 
virtual ElementStateHandleaddStateToImplementation (const QString &name, const DataExecution::DataObject &defaultValue)=0
 
virtual ElementHandle advance (const ElementHandle &elementHandle, size_type n) const =0
 
virtual ElementHandle beginHandle () const
 
iterator createIterator (const ElementHandle &handle) const
 
virtual ElementHandle endHandle () const
 
virtual bool getStateImpl (const ElementHandle &elementHandle, const ElementStateHandle &state, DataExecution::DataObject &result) const =0
 
virtual bool getStateImpl (const ElementHandle &elementHandle, const ElementStateHandle &state, DataExecution::DataObject &result)=0
 
MeshElementsInterfaceoperator= (const MeshElementsInterface &)
 
bool registerExistingState (MeshModelInterface::size_type index, const QString &name, const DataExecution::DataObject &defaultValue)
 
virtual bool removeStateFromImplementation (const ElementStateHandle &state)=0
 
virtual bool stateBeingRenamed (const ElementStateHandle &state, const QString &to)
 

Additional Inherited Members

- Public Types inherited from MeshElementsInterface
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 = ElementHandleList
 
using ItemHandleType = ElementHandle
 
using size_type = MeshModelInterface::size_type
 
using StateHandleListType = ElementStateHandleList
 
using StateHandleType = ElementStateHandle
 
- Static Public Member Functions inherited from MeshElementsInterface
static MeshElementsInterfacegetNullMeshElementsInterface ()
 

Detailed Description

See also
Hdf5MeshModelInterface
Hdf5MeshElementsInterface
Hdf5StateStorage

Constructor & Destructor Documentation

◆ Hdf5MeshElementsInterface() [1/2]

◆ Hdf5MeshElementsInterface() [2/2]

Member Function Documentation

◆ add()

ElementHandle add ( const Mesh::NodeHandleList &  nodes)
override

◆ addStateToImplementation()

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

Derived classes must implement this method, returning the handle they will use to refer to this state. name and defaultValue are only passed to the derived class in case it also wants to do something with these parameters. The base class already stores these so most implementations will probably ignore them and simply worry about the handle.

Returns
An new ElementStateHandle with the index the implementation has associated with this state and the dataFactory of defaultValue.getDataFactory(). 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 or even all states for a particular a\ elementType but must be unquie amongst all states of a given DataFactory of a given ElementType::Type. Hence the dataFactory and ElementType together form the unique ID. If the state could not be added a NULL pointer should be returned.
See also
isStateTypeSupported

Implements MeshElementsInterface.

◆ advance()

ElementHandle advance ( const Mesh::ElementHandle elementHandle,
size_type  n 
) const
overrideprotectedvirtual
Returns
An ElementHandle n elements past elementHandle or endHandle() if it's past the last element.
See also
endHandle

Implements MeshElementsInterface.

◆ beginHandle()

ElementHandle beginHandle ( ) const
overrideprotectedvirtual
Returns
A handle that represents the first element or endHandle() if there are no elements.
See also
begin()

Reimplemented from MeshElementsInterface.

◆ clear()

void clear ( )
overridevirtual

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

See also
removeAllStates

Implements MeshElementsInterface.

◆ endHandle()

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

Reimplemented from MeshElementsInterface.

◆ ensureDoubleStateLoaded()

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

◆ ensureIntStateLoaded()

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

◆ ensureUInt16StateLoaded()

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

◆ ensureUInt8StateLoaded()

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

◆ ensureVectorStateLoaded()

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

◆ erase()

MeshElementsInterface::iterator erase ( const iterator position)
overridevirtual
Returns
An iterator for the next element or end() if the erased element was at the end.

Implements MeshElementsInterface.

◆ getNode()

NodeHandle getNode ( const Mesh::ElementHandle element,
size_type  index 
) const
overridevirtual
Parameters
elementThe element handle we're requesting the nodes for
indexWhich node of the given element is being requested

Implements MeshElementsInterface.

◆ getNodes()

bool getNodes ( const Mesh::ElementHandle element,
Mesh::NodeHandleList &  nodes 
) const
override

◆ getState() [1/5]

bool getState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ getState() [2/5]

bool getState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ getState() [3/5]

bool getState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ getState() [4/5]

bool getState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ getState() [5/5]

bool getState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ getStateImpl() [1/2]

bool getStateImpl ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle state,
DataExecution::DataObject result 
) const
overrideprotectedvirtual
Parameters
elementHandleThe element 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)

Should be implmented as the const equivalent to getState()

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 MeshElementsInterface.

◆ getStateImpl() [2/2]

bool getStateImpl ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle state,
DataExecution::DataObject result 
)
overrideprotectedvirtual
Parameters
elementHandleThe element 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 MeshElementsInterface.

◆ initialize()

bool initialize ( hid_t &  file,
const QString &  meshName,
int  lod 
)
Parameters
fileThe HDF5 that data will be read from as needed.
meshNameThe name of the mesh in the file that we are going to read from.
lodThe LOD of the mesh that we are reading from.
Returns
true if the initialisation was successful, false otherwise.

◆ 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 element states of this type for this element type.
See also
addState(const QString& name, const T& defaultValue)

Implements MeshElementsInterface.

◆ loadNodeIndices()

bool loadNodeIndices ( const Mesh::ElementType::Type type)
Parameters
typeThe type of elements that we're loading.
Returns
true if the indices were able to be loaded from the HDF5 file successfully, false otherwise.

Loads the node indices from the underlying HDF5 file for the elements of the specified type.

◆ operator=()

Hdf5MeshElementsInterface & operator= ( const Hdf5MeshElementsInterface other)

◆ remove()

void remove ( const Mesh::ElementHandle elementHandle)
overridevirtual

Implements MeshElementsInterface.

◆ removeStateFromImplementation()

bool removeStateFromImplementation ( const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ reserve()

void reserve ( size_type  n)
overridevirtual

Default implementation does nothing

Reimplemented from MeshElementsInterface.

◆ setNode()

bool setNode ( const Mesh::ElementHandle element,
const Mesh::NodeHandle node,
size_type  index 
)
overridevirtual
Parameters
elementThe element handle we're setting the nodes for
nodeThe node to set
indexThe index to set the node for this element
Returns
Whether the requested nodes were set

Implements MeshElementsInterface.

◆ setNodes()

bool setNodes ( const Mesh::ElementHandle element,
const Mesh::NodeHandleList &  nodes 
)
override

◆ setState() [1/6]

bool setState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle state,
const DataExecution::DataObject value 
)
overridevirtual
Parameters
elementHandleThe element 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 MeshElementsInterface.

◆ setState() [2/6]

bool setState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ setState() [3/6]

bool setState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ setState() [4/6]

bool setState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ setState() [5/6]

bool setState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ setState() [6/6]

bool setState ( const Mesh::ElementHandle elementHandle,
const Mesh::ElementStateHandle 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 MeshElementsInterface.

◆ size()

MeshElementsInterface::size_type size ( ) const
overridevirtual

Implements MeshElementsInterface.