Workspace 6.21.5
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
MeshModelInterface Class Referenceabstract

A base class for an interface to a mesh model. More...

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

Inheritance diagram for MeshModelInterface:
[legend]

Public Types

using int_type = qint32
 
using MetaData = DataExecution::ObjectDictionary
 
typedef ItemHandle::size_type size_type
 

Public Member Functions

 ~MeshModelInterface () override
 
bool assignFrom (const MeshModelInterface &other, bool allowPartialAssign=false)
 
virtual ElementType::List attachmentInfoExistsFor () const =0
 
virtual bool attachmentInfoExistsFor (const ElementType::Type &elementType) const =0
 
virtual void clear (bool removeAllStates=true)
 
MeshModelInterfaceclone () const override=0
 
virtual DataExecution::DataObjectcreateDownCastTypedObject ()=0
 
void discardAllAttachmentInfo ()
 
virtual void discardAttachmentInfo (const ElementType::Type &elementType)=0
 
virtual void emptyTrash ()=0
 
virtual bool generateAttachmentInfo (const ElementType::Type &elementType)=0
 
virtual ElementHandleList getAttachedElements (const ElementType::Type &elementType, const NodeHandle &node) const =0
 
virtual NodeHandleList getAttachedNodes (const ElementType::Type &elementType, const NodeHandle &node) const
 
template<typename T >
MeshElementsInterfacegetElements ()
 
template<typename T >
const MeshElementsInterfacegetElements () const
 
virtual const MeshElementsInterfacegetElements (const ElementType::Type &type) const =0
 
virtual MeshElementsInterfacegetElements (const ElementType::Type &type)=0
 
virtual ElementType::List getElementTypesPresentInModel () const =0
 
ElementType::List getElementTypesPresentOrWithStates () const
 
virtual ElementType::List getElementTypesWithStatesDefined () const =0
 
virtual const DataExecution::DataFactorygetFactory () const =0
 
MetaDatagetMetaData ()
 
const MetaDatagetMetaData () const
 
virtual const MeshNodesInterfacegetNodes () const =0
 
virtual MeshNodesInterfacegetNodes ()=0
 
virtual bool isElementTypeSupported (const ElementType::Type &type) const =0
 
virtual bool isOrganised () const
 
virtual bool load (MeshSerializer &serializer)
 
virtual bool makeUnorganised ()
 
virtual bool save (MeshSerializer &serializer) const
 
void setMetaData (const MetaData &val)
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 

Static Public Member Functions

static MeshModelInterfacecreateDefault ()
 

Protected Member Functions

virtual bool fastAssignFrom (const MeshModelInterface &other)=0
 

Detailed Description

Classes should be derived from TypedMeshModelInterface<DerivedClass> rather than from this class directly.

SimpleOutput<MeshModelInterface> meshOut_; // Operation output (but can be used directly see allocateEfficientMeshModelInterface())
meshOut_->clear(true); // good idea to clear all data first in the execute()
meshOut_->emptyTrash();
// Add some nodes
MeshNodesInterface& nodes = meshOut_->getNodes();
NodeHandle n0 = nodes.add(Vector3d(0,0,0));
NodeHandle n1 = nodes.add(Vector3d(0,1,0));
NodeHandle n2 = nodes.add(Vector3d(1,1,0));
// Could use std::vector<NodeHandle> to push_back each result of nodes.add() instead for real use cases
// Add a node state
const NodeStateHandle& distState = nodes.addState<double>("distState", 0.0);
// Set the state for each node
nodes.setState(n0, distState, 0.1);
nodes.setState(n1, distState, 0.04);
nodes.setState(n2, distState, 0.2);
// Add a segment element from these nodes
MeshElementsInterface& segments = meshOut_->getElements<ElementType::Segment>();
ElementHandle s0 = segments.add(n0, n1);
// Add a triangle from these nodes
MeshElementsInterface& tris = meshOut_->getElements<ElementType::Triangle>();
ElementHandle t0 = tris.add(n0, n1, n2);
// Element states work the same way
const ElementStateHandle fooTriState = tris.addState<Vector3d>("foo", Vector3d(0,0,0));
tris.setState(t0, fooTriState, Vector3d(0,0,1));
Definition: simpleoperationio.h:230
A handle to an element in a MeshModelInterface.
Definition: meshitemhandle.h:224
A handle to an element state.
Definition: meshelementsinterface.h:53
Definition: elementtype.h:331
Definition: elementtype.h:332
An interface to the elements stored behind a MeshModelInterface.
Definition: meshelementsinterface.h:80
const ElementStateHandle & addState(const QString &name, const T &defaultValue)
Definition: meshelementsinterface.h:832
virtual ElementHandle add(const NodeHandleList &nodes)=0
virtual bool setState(const ElementHandle &elementHandle, const ElementStateHandle &state, const DataExecution::DataObject &value)=0
An interface to the nodes stored behind a MeshModelInterface.
Definition: meshnodesinterface.h:81
A handle to a node in a MeshModelInterface.
Definition: meshitemhandle.h:151
A handle to a node state.
Definition: meshnodesinterface.h:60
A vector or 3D point in space with useful operation support.
Definition: vector3d.h:66
const MeshNodesInterface * nodes
Definition: nodetexturemapper.cpp:73

A MeshModelInterface can also contain meta-data. This can be used to store information about the model that is not directly related to its geometry - e.g. source of the model, units used, etc.

Member Typedef Documentation

◆ int_type

using int_type = qint32

◆ MetaData

◆ size_type

Constructor & Destructor Documentation

◆ ~MeshModelInterface()

~MeshModelInterface ( )
overridedefault

Member Function Documentation

◆ assignFrom()

bool assignFrom ( const MeshModelInterface other,
bool  allowPartialAssign = false 
)
Parameters
otherThe interface to assign from
allowPartialAssignAllow as much assignment as possible if the destination type doesn't support all state or element types that the source contains.

Perform assignment from another MeshModelInterface. This method first calls fastAssignFrom() to allow the derived class to check other.getFactory() to see if the other object is the same type as themselves or some other known MeshModelInterface implementation that they can cast to for faster assignment (via the derived class assignment operator for example). If the derived class can not offer a fast assignment then it will return false and an assignment will be performed using just the base class interface.

Returns
true if assignment from other was successful
See also
fastAssignFrom

◆ attachmentInfoExistsFor() [1/2]

virtual ElementType::List attachmentInfoExistsFor ( ) const
pure virtual

◆ attachmentInfoExistsFor() [2/2]

virtual bool attachmentInfoExistsFor ( const ElementType::Type elementType) const
pure virtual

◆ clear()

void clear ( bool  removeAllStates = true)
virtual
Parameters
removeAllStatesWhether or not all states should be removed in addition to the actual node and element data.

◆ clone()

MeshModelInterface * clone ( ) const
overridepure virtual

◆ createDefault()

MeshModelInterface * createDefault ( )
static

Create a default concrete object of type StreamlinedMeshModelInterface

See also
allocateEfficientMeshModelInterface()

◆ createDownCastTypedObject()

virtual DataExecution::DataObject * createDownCastTypedObject ( )
pure virtual

Client code can use this method to down cast the object to polymorphically downcast the mesh model interface to a data object containing a type-specific reference to the derived class type.

Returns
A typed object containing the actual derived type of interface.

Implemented in TypedMeshModelInterface< Derived >, TypedMeshModelInterface< Hdf5MeshModelInterface >, TypedMeshModelInterface< FilteredMeshModelInterface >, TypedMeshModelInterface< HierarchicalReferenceMeshModelInterface >, TypedMeshModelInterface< LargeStreamlinedMeshModelInterface >, TypedMeshModelInterface< LodMeshModelInterface >, TypedMeshModelInterface< PrimevalMeshModelInterface >, and TypedMeshModelInterface< StreamlinedMeshModelInterface >.

◆ discardAllAttachmentInfo()

void discardAllAttachmentInfo ( )

◆ discardAttachmentInfo()

virtual void discardAttachmentInfo ( const ElementType::Type elementType)
pure virtual

◆ emptyTrash()

virtual void emptyTrash ( )
pure virtual

Depending on the implementation, removing nodes or elements may just mark their index as invalid rather than completely removing it from internal lists/storage. It should also be noted that removing a node does not guarantee any bookkeeping to update any attached elements, calling code is responsible for this if needed. Specific implementations of MeshModelInterface can use emptyTrash to completely remove any stored nodes and elements (e.g. in a single more efficient way after multiple remove operations) and can optionally use this to remove elements now referencing invalid nodes. This behaviour is implementation specific and calling code should check specific implementation class documentation.

Implemented in Hdf5MeshModelInterface, FilteredMeshModelInterface, HierarchicalReferenceMeshModelInterface, LargeStreamlinedMeshModelInterface, LodMeshModelInterface, PrimevalMeshModelInterface, and StreamlinedMeshModelInterface.

◆ fastAssignFrom()

virtual bool fastAssignFrom ( const MeshModelInterface other)
protectedpure virtual

Perform assignment from another MeshModelInterface. This method is called by operator=() allowing the derived class to check other.getFactory() to see if the other object is the same type as themselves or some other known MeshModelInterface implementation that they can cast for faster assignment (via the derived class assignment operator for example). If the derived class can not offer a fast assignment then it must return false signaling that an assignment should be performed using just the base class interface.

Returns
true if a fast assignment has been performed or false if it couldn't.
See also
operator=()

Implemented in Hdf5MeshModelInterface, FilteredMeshModelInterface, HierarchicalReferenceMeshModelInterface, LargeStreamlinedMeshModelInterface, LodMeshModelInterface, PrimevalMeshModelInterface, and StreamlinedMeshModelInterface.

◆ generateAttachmentInfo()

virtual bool generateAttachmentInfo ( const ElementType::Type elementType)
pure virtual
Parameters
elementTypeThe type of element we want attachment info to be generated for
Returns
true if attachment info was generated or already exists for this element type.

Implementations are able to postpone generation of attachment information until it's required if they wish. This can mean in applications where attachment information isn't needed or is only needed temporarily that data does not need to exist for the entire lifetime of the interface.

See also
discardAttachmentInfo, attachmentInfoExistsFor, attachmentInfoExistsFor, getAttached, isAttached

Implemented in FilteredMeshModelInterface, HierarchicalReferenceMeshModelInterface, LargeStreamlinedMeshModelInterface, LodMeshModelInterface, PrimevalMeshModelInterface, StreamlinedMeshModelInterface, and Hdf5MeshModelInterface.

◆ getAttachedElements()

virtual ElementHandleList getAttachedElements ( const ElementType::Type elementType,
const NodeHandle node 
) const
pure virtual
Precondition
generateAttachmentInfo must have already been called successfully for elementType.
Parameters
elementTypeThe type of attached element
nodeThe node we're querying the attachments of
See also
generateAttachmentInfo, discardAttachmentInfo, attachmentInfoExistsFor, isAttached

Implemented in FilteredMeshModelInterface, HierarchicalReferenceMeshModelInterface, LargeStreamlinedMeshModelInterface, LodMeshModelInterface, PrimevalMeshModelInterface, StreamlinedMeshModelInterface, and Hdf5MeshModelInterface.

◆ getAttachedNodes()

NodeHandleList getAttachedNodes ( const ElementType::Type elementType,
const NodeHandle node 
) const
virtual
Precondition
generateAttachmentInfo must have already been called successfully for elementType.
Parameters
elementTypeThe type of element resulting in the attachment
nodeThe node we're querying the attachments of
See also
generateAttachmentInfo, discardAttachmentInfo, attachmentInfoExistsFor, isAttached

◆ getElements() [1/4]

MeshElementsInterface & getElements ( )
inline

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

◆ getElements() [2/4]

const MeshElementsInterface & getElements ( ) const
inline

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

◆ getElements() [3/4]

virtual const MeshElementsInterface & getElements ( const ElementType::Type type) const
pure virtual

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

Implemented in FilteredMeshModelInterface, HierarchicalReferenceMeshModelInterface, LargeStreamlinedMeshModelInterface, LodMeshModelInterface, PrimevalMeshModelInterface, StreamlinedMeshModelInterface, and Hdf5MeshModelInterface.

◆ getElements() [4/4]

virtual MeshElementsInterface & getElements ( const ElementType::Type type)
pure virtual

◆ getElementTypesPresentInModel()

virtual ElementType::List getElementTypesPresentInModel ( ) const
pure virtual

◆ getElementTypesPresentOrWithStates()

ElementType::List getElementTypesPresentOrWithStates ( ) const
Returns
A list of element types that have >0 elements defined or have states defined.

Combined results from getElementTypesPresentInModel and getElementTypesWithStatesDefined

See also
getElementTypesPresentInModel getElementTypesWithStatesDefined

◆ getElementTypesWithStatesDefined()

virtual ElementType::List getElementTypesWithStatesDefined ( ) const
pure virtual

◆ getFactory()

virtual const DataExecution::DataFactory & getFactory ( ) const
pure virtual

◆ getMetaData() [1/2]

MeshModelInterface::MetaData & getMetaData ( )

◆ getMetaData() [2/2]

const MeshModelInterface::MetaData & getMetaData ( ) const

◆ getNodes() [1/2]

virtual const MeshNodesInterface & getNodes ( ) const
pure virtual

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

Implemented in Hdf5MeshModelInterface, FilteredMeshModelInterface, HierarchicalReferenceMeshModelInterface, LargeStreamlinedMeshModelInterface, LodMeshModelInterface, PrimevalMeshModelInterface, and StreamlinedMeshModelInterface.

◆ getNodes() [2/2]

virtual MeshNodesInterface & getNodes ( )
pure virtual

◆ isElementTypeSupported()

virtual bool isElementTypeSupported ( const ElementType::Type type) const
pure virtual

◆ isOrganised()

bool isOrganised ( ) const
virtual
Returns
true if the points in the dataset are organised on a grid; false otherwise.

◆ load()

bool load ( MeshSerializer serializer)
virtual

◆ makeUnorganised()

bool makeUnorganised ( )
virtual

◆ save()

bool save ( MeshSerializer serializer) const
virtual
Precondition
emptyTrash() must have been called if any nodes or elements have been deleted. The save will fail otherwise as invalid nodes/elements are not serialized.

◆ setMetaData()

void setMetaData ( const MetaData val)