Workspace 6.21.5
Public Types | Public Member Functions | Static Public Member Functions | List of all members
MeshModel Class Reference

Mesh model class to provide node and element lists.

#include <Mesh/DataStructures/meshmodel.h>

Inheritance diagram for MeshModel:
[legend]

Public Types

enum  ListType { Nodes , Elements }
 Used to choose betwee nodes or elements. Usually used in relation to states. More...
 
- Public Types inherited from NumberedObject
enum  {
  flag0 , flag1 , flag2 , flag3 ,
  flag4 , flag5 , flag6 , flag7 ,
  flag8 , flag9 , flag10 , flag11 ,
  flag12 , flag13 , flag14 , flag15
}
 

Public Member Functions

 MeshModel (const MeshModel &model)
 
 MeshModel (long modelID=1, long compID=1)
 
 ~MeshModel () override
 
void absorb (MeshModel &otherModel)
 
void addElementIntegerState (const QString &name, long defaultVal=0)
 
void addElementScalarState (const QString &name, double defaultVal=0)
 
void addElementVectorState (const QString &name, const Vector3d &defaultVal=Vector3d())
 
void addNodeIntegerState (const QString &name, long defaultVal=0)
 
void addNodeScalarState (const QString &name, double defaultVal=0)
 
void addNodeVectorState (const QString &name, const Vector3d &defaultVal=Vector3d())
 
bool checkModelIntegrity () const
 
void clearModel () override
 
MeshModelInterfacecreateInterfaceFromModel (bool takeOwnership=false)
 
void emptyTrashAll () override
 
MeshModelfastAssign (MeshModel &model)
 
unsigned getElementCount () const
 
NodeListgetNodes ()
 
const NodeListgetNodes () const
 
SegmentListgetSegments ()
 
const SegmentListgetSegments () const
 
ShellElementListgetShells ()
 
const ShellElementListgetShells () const
 
VolumeElementListgetVolumes ()
 
const VolumeElementListgetVolumes () const
 
void killFreeNodes ()
 
void killSegments ()
 
void killShellElements ()
 
void killVolumeElements ()
 
MeshModeloperator= (const MeshModel &model)
 
void removeAllStates ()
 
Deprecated functions
NodeListGetNodes ()
 
const NodeListGetNodes () const
 
SegmentListGetSegments ()
 
const SegmentListGetSegments () const
 
ShellElementListGetShells ()
 
const ShellElementListGetShells () const
 
VolumeElementListGetVolumes ()
 
const VolumeElementListGetVolumes () const
 
unsigned GetElementCount () const
 
- Public Member Functions inherited from BaseModel
virtual ~BaseModel ()=default
 
virtual void clearModel ()=0
 Erases everything from the model (eg nodes, elements, etc).
 
virtual void emptyTrashAll ()=0
 Garbage collects everything in the model (eg nodes, elements, etc.).
 
const QString & getName () const
 
bool operator== (const BaseModel &model) const
 
void setName (const QString &name)
 Set the name of the model to name.
 
void SetName (const QString &name)
 
const QString & GetName () const
 
void EmptyTrashAll ()
 
void ClearModel ()
 
- Public Member Functions inherited from Entity
long getCompID () const
 Get the ID of the component this entity belongs to.
 
void setCompID (long compID)
 
void SetCompID (long compID)
 
long GetCompID () const
 
- Public Member Functions inherited from NumberedObject
 NumberedObject (long ID)
 Create an object with the specified ID and all flags except isValid not set.
 
void clearFlag (unsigned flag)
 Clear flag. Do not use this to manipulate the isValid flag, since list managers are responsible for that.
 
void copyFlags (const NumberedObject &t)
 
long getID () const
 
long getIndex () const
 
bool isFlagSet (unsigned flag) const
 
bool isValid () const
 
void setFlag (unsigned flag, bool b=true)
 Set flag to b. Do not use this to manipulate the isValid flag, since list managers are responsible for that.
 
void setID (long ID)
 
void setIndex (long i)
 
void SetID (long ID)
 
long GetID () const
 
void SetIndex (long i)
 
long GetIndex () const
 
bool IsFlagSet (unsigned flag) const
 
void ClearFlag (unsigned flag)
 
void SetFlag (unsigned flag)
 
void setFlagTo (unsigned flag, bool b=true)
 
void SetFlagTo (unsigned flag, bool b=true)
 
bool IsValid () const
 
- Public Member Functions inherited from Observable
virtual ~Observable ()
 
void attachObserver (Observer &observer)
 
void destroy ()
 
void detachObserver (Observer &observer)
 
void notifyEvent (const ObservableEvent &event)
 

Static Public Member Functions

static const MeshModelaccessModelFromInterface (const MeshModelInterface &meshInterface)
 
static MeshModelaccessModelFromInterface (MeshModelInterface &meshInterface)
 
static bool refreshInterfaceAroundModel (MeshModelInterface &meshInterface)
 
static MeshModelsetInterfaceDataObjectToMeshModel (DataExecution::DataObject &dataObj)
 

Additional Inherited Members

- Protected Member Functions inherited from BaseModel
 BaseModel (long modelID=1, long compID=1)
 
- Protected Member Functions inherited from Entity
 Entity (long id, long compID)
 
- Protected Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 

Member Enumeration Documentation

◆ ListType

enum ListType
Enumerator
Nodes 

Refers to nodes.

Elements 

Refers to elements, whether they be segments, shells or volumes.

Constructor & Destructor Documentation

◆ MeshModel() [1/2]

MeshModel ( long  modelID = 1,
long  compID = 1 
)
Parameters
modelIDTo support collections of models, each individual model has its own ID associated with it.
compIDThe collection itself also has an ID.

◆ MeshModel() [2/2]

MeshModel ( const MeshModel model)
Parameters
modelThe source model to copy.
Precondition
Note that this constructor assumes that the nodes in model are correctly indexed. This should always be the case unless you have transferred a node out of the node list and not called Reindex() at some point after doing so. This special case is explicitly documented in the relevant member functions of NodeList and its base classes.

◆ ~MeshModel()

~MeshModel ( )
override

Member Function Documentation

◆ absorb()

void absorb ( MeshModel otherModel)
Parameters
otherModelThe model to absorb into this one.
Postcondition
When the function returns, otherModel will be completely empty. The node and element lists will possibly have had their states re-ordered.

This function is equivalent to calling absorb() on each of the various lists the model maintains (ie nodes and elements). It is advisable to call the MeshModel class' absorb() function in preference to manually calling each of the lists' own absorb() functions separately.

◆ accessModelFromInterface() [1/2]

const MeshModel * accessModelFromInterface ( const MeshModelInterface meshInterface)
static
Returns
If the supplied interface is a wrapper around a MeshModel then the underlying MeshModel is returned, otherwise NULL is returned.

WARNING: Any further changes made directly to the MeshModel may not be reflected through the interface until a call to refreshInterfaceAroundModel()

See also
refreshInterfaceAroundModel

◆ accessModelFromInterface() [2/2]

MeshModel * accessModelFromInterface ( MeshModelInterface meshInterface)
static
Returns
If the supplied interface is a wrapper around a MeshModel then the underlying MeshModel is returned, otherwise NULL is returned.

WARNING: Any further changes made directly to the MeshModel may not be reflected through the interface until a call to refreshInterfaceAroundModel()

See also
refreshInterfaceAroundModel

◆ addElementIntegerState()

void addElementIntegerState ( const QString &  name,
long  defaultVal = 0 
)
Parameters
nameThe name of the state to add or modify.
defaultValThe value to assign to this part of the state for any new stateful object.

This function adds the specified state to all element lists, i.e. segments, shells and volume elements with exactly the same functionality.

See also
StateControl::addScalarState(), StateControl::addVectorState(), StateControl::addIntegerState().

◆ addElementScalarState()

void addElementScalarState ( const QString &  name,
double  defaultVal = 0 
)
Parameters
nameThe name of the state to add or modify.
defaultValThe value to assign to this part of the state for any new stateful object.

This function adds the specified state to all element lists, i.e. segments, shells and volume elements with exactly the same functionality.

See also
StateControl::addScalarState(), StateControl::addVectorState(), StateControl::addIntegerState().

◆ addElementVectorState()

void addElementVectorState ( const QString &  name,
const Vector3d defaultVal = Vector3d() 
)
Parameters
nameThe name of the state to add or modify.
defaultValThe value to assign to this part of the state for any new stateful object.

This function adds the specified state to all element lists, i.e. segments, shells and volume elements with exactly the same functionality.

See also
StateControl::addScalarState(), StateControl::addVectorState(), StateControl::addIntegerState().

◆ addNodeIntegerState()

void addNodeIntegerState ( const QString &  name,
long  defaultVal = 0 
)
Parameters
nameThe name of the state to add or modify.
defaultValThe value to assign to this part of the state for any new stateful object.

Equivalent to the corresponding add state operation on getNodes().

◆ addNodeScalarState()

void addNodeScalarState ( const QString &  name,
double  defaultVal = 0 
)
Parameters
nameThe name of the state to add or modify.
defaultValThe value to assign to this part of the state for any new stateful object.

Equivalent to the corresponding add state operation on getNodes().

◆ addNodeVectorState()

void addNodeVectorState ( const QString &  name,
const Vector3d defaultVal = Vector3d() 
)
Parameters
nameThe name of the state to add or modify.
defaultValThe value to assign to this part of the state for any new stateful object.

Equivalent to the corresponding add state operation on getNodes().

◆ checkModelIntegrity()

bool checkModelIntegrity ( ) const

This function should only be used during debugging, as it is relatively expensive. It performs a number of integrity checks on the model, covering things like node and element attachment lists, duplicate elements and so on. Nodes marked for deletion will not be checked, so it is not necessary to call emptyTrashAll() before calling this function.

If any test fails, a message is logged to standard output and the function returns immediately. Thus, only the first error encountered will be reported. The message will generally include an index of a node involved in the failed test to allow you to find the failed region of the model.

Returns
True if the model passes all integrity checks.

◆ clearModel()

void clearModel ( )
overridevirtual

This function simply calls the node and element lists' KillList() functions. At exit, this model will have no nodes or elements, but the states supported by the node and element lists remains unchanged.

Implements BaseModel.

◆ createInterfaceFromModel()

MeshModelInterface * createInterfaceFromModel ( bool  takeOwnership = false)

Create a new MeshModelInterface for this model. Calling code is responsible for deleting the new object.

Parameters
takeOwnershipif true the MeshModelInterface will call delete on this MeshModel when the MeshModelInterface is destroyed.

WARNING: Any further changes made directly to the MeshModel may not be reflected through the interface until a call to refreshInterfaceAroundModel()

See also
refreshInterfaceAroundModel

◆ emptyTrashAll()

void emptyTrashAll ( )
overridevirtual

This function simply calls the node and element lists' EmptyTrash() functions.

Implements BaseModel.

◆ fastAssign()

MeshModel & fastAssign ( MeshModel model)
Parameters
modelThe source model to assign from.

Make this model become a copy of model. New nodes and elements will be created and any old nodes or elements will be discarded. State info is also copied. The only change made to model during this process is a reindexing of its nodes.

See also
operator=()

◆ getElementCount()

unsigned getElementCount ( ) const
Returns
The total number of segments, shells and volume elements in the model. This is entirely equivalent to:
VolumeElementList & getVolumes()
Definition: meshmodel.cpp:528
ShellElementList & getShells()
Definition: meshmodel.cpp:510
SegmentList & getSegments()
Definition: meshmodel.cpp:492
size_type size() const
STL container function.
Definition: numberedobjectlist.h:97

◆ GetElementCount()

unsigned GetElementCount ( ) const
inline

◆ getNodes() [1/2]

NodeList & getNodes ( )
Returns
The model's nodes.

◆ GetNodes() [1/2]

NodeList & GetNodes ( )
inline

◆ getNodes() [2/2]

const NodeList & getNodes ( ) const

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

◆ GetNodes() [2/2]

const NodeList & GetNodes ( ) const
inline

◆ getSegments() [1/2]

SegmentList & getSegments ( )
Returns
The model's segments.

◆ GetSegments() [1/2]

SegmentList & GetSegments ( )
inline

◆ getSegments() [2/2]

const SegmentList & getSegments ( ) const

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

◆ GetSegments() [2/2]

const SegmentList & GetSegments ( ) const
inline

◆ getShells() [1/2]

ShellElementList & getShells ( )
Returns
The model's shell elements.

◆ GetShells() [1/2]

ShellElementList & GetShells ( )
inline

◆ getShells() [2/2]

const ShellElementList & getShells ( ) const

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

◆ GetShells() [2/2]

const ShellElementList & GetShells ( ) const
inline

◆ getVolumes() [1/2]

VolumeElementList & getVolumes ( )
Returns
The model's volume elements.

◆ GetVolumes() [1/2]

VolumeElementList & GetVolumes ( )
inline

◆ getVolumes() [2/2]

const VolumeElementList & getVolumes ( ) const

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

◆ GetVolumes() [2/2]

const VolumeElementList & GetVolumes ( ) const
inline

◆ killFreeNodes()

void killFreeNodes ( )

◆ killSegments()

void killSegments ( )

◆ killShellElements()

void killShellElements ( )

◆ killVolumeElements()

void killVolumeElements ( )

◆ operator=()

MeshModel & operator= ( const MeshModel model)
Parameters
modelThe source model to assign from.

Make this model become a copy of model. New nodes and elements will be created and any old nodes or elements will be discarded. State info is also copied.

This assignment operator takes a const model, which means its nodes are not allowed to be re-indexed and we cannot assume that they already are correctly indexed. Therefore, a different method is used for node lookups compared to fastAssign(), but this is considerably slower than what fastAssign() does since the lookup has logarithmic complexity instead of constant time.

See also
fastAssign()

◆ refreshInterfaceAroundModel()

bool refreshInterfaceAroundModel ( MeshModelInterface meshInterface)
static

If the supplied interface is a wrapper around a MeshModel then the MeshModelInterface is updated to ensure it reflects any changes made directly to the MeshModel.

◆ removeAllStates()

void removeAllStates ( )

Discard all state information in the model and reset all node and element lists to supporting no states.

◆ setInterfaceDataObjectToMeshModel()

MeshModel * setInterfaceDataObjectToMeshModel ( DataExecution::DataObject dataObj)
static

Populates a MeshModelInterface data object with a wrapped MeshModel and returns that internal MeshModel This allows legacy code still using MeshModel to work with a MeshModelInterface DataObjects.

Precondition
dataObj must be of type MeshModelInterface

WARNING: Any further changes made directly to the MeshModel may not be reflected through the interface until a call to refreshInterfaceAroundModel()

See also
refreshInterfaceAroundModel