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

A type of element supported by a MeshModelInterface. More...

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

Inheritance diagram for Type:
[legend]

Public Member Functions

unsigned getMaxNodes () const
 
unsigned getMinNodes () const
 
const QString & getName () const
 
unsigned getNumFaces () const
 
unsigned getNumPrimitivesPerFace () const
 
template<typename T >
bool isType () const
 
bool isValidNodeCount (unsigned count) const
 
bool isVolumeType () const
 
bool operator!= (const Type &other) const
 
bool operator== (const Type &other) const
 

Detailed Description

To create the concept of a new MeshModelInterface element type do the following:

In myelementtype.h

// In the global namespace
// MyElement consists of exactly 5 nodes
DECLARE_WORKSPACE_MESHMODEL_ELEMENT_TYPE(MyElement, 5, 5, CSIRO_MYPLUGIN_API)
#define DECLARE_WORKSPACE_MESHMODEL_ELEMENT_TYPE(T, NUM_NODES, WORKSPACE_EXPORT_SYMBOL)
Definition: elementtype.h:232

or, for a volume-type element

// In the global namespace
// MyElement consists of exactly 5 nodes
DECLARE_WORKSPACE_MESHMODEL_VOLUME_ELEMENT_TYPE(MyElement, 5, 5, 10, 2, CSIRO_MYPLUGIN_API)
#define DECLARE_WORKSPACE_MESHMODEL_VOLUME_ELEMENT_TYPE(T, NUM_NODES, NUM_FACES, NUM_PRIMITIVES_PER_FACE, WORKSPACE_EXPORT_SYMBOL)
Definition: elementtype.h:308

In myelementtype.cpp

DEFINE_WORKSPACE_MESHMODEL_ELEMENT_TYPE(CSIRO::Mesh::ElementType::MyElement, CSIRO_MYPLUGIN_API)
#define DEFINE_WORKSPACE_MESHMODEL_ELEMENT_TYPE(T, WORKSPACE_EXPORT_SYMBOL)
Definition: elementtype.h:283

In mymeshmodelinterface.cpp

bool MyMeshModelInterface::isElementTypeSupported( const ElementType::Type& type ) const
{
return &type == &ElementType::MyElement::getInstance();
}
bool MyMeshModelInterface::addElement( const ElementType::Type& type, const NodeHandleList& nodes ) const
{
if ( &type == &ElementType::MyElement::getInstance() )
{
// store the nodes for your element type
}
}
A type of element supported by a MeshModelInterface.
Definition: elementtype.h:89
const MeshNodesInterface * nodes
Definition: nodetexturemapper.cpp:73

In myplugin.cpp

CSIRO::Mesh::ElementType::TypeRegistry::getInstance().registerType(&Mesh::ElementType::MyElement::getInstance());
static TypeRegistry & getInstance()
Definition: elementtype.cpp:35
void registerType(const Type *t)
Definition: elementtype.cpp:41

Member Function Documentation

◆ getMaxNodes()

unsigned getMaxNodes ( ) const
inline
Returns
The maximum number of nodes this element type can have

◆ getMinNodes()

unsigned getMinNodes ( ) const
inline
Returns
The minimum number of nodes this element type can have

◆ getName()

const QString & getName ( ) const
inline
Returns
The name of this type for debugging

◆ getNumFaces()

unsigned getNumFaces ( ) const
inline
Returns
The number of faces this element type has (only useful for volume-type element types - e.g. tetrahedron, which will have 4 faces)

◆ getNumPrimitivesPerFace()

unsigned getNumPrimitivesPerFace ( ) const
inline
Returns
The number of primitives per face this element type has (only useful for volume-type element types - e.g. tetrahedron, which will have one (triangle) per face)

◆ isType()

bool isType ( ) const
inline

◆ isValidNodeCount()

bool isValidNodeCount ( unsigned  count) const
inline
Returns
true if count is a valid number of nodes for this element type

◆ isVolumeType()

bool isVolumeType ( ) const
inline
Returns
True if the element type represents something that is a volume (e.g. a tetrahedron). If true, then getNumFaces() and getNumPrimitivesPerFace() are useful.

◆ operator!=()

bool operator!= ( const Type other) const
inline

◆ operator==()

bool operator== ( const Type other) const
inline