GemaCoreLib
The GeMA Core library
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
GmMesh Class Referenceabstract

Base interface class for Mesh type plugins. More...

#include <gmMesh.h>

Inheritance diagram for GmMesh:
Inheritance graph
[legend]
Collaboration diagram for GmMesh:
Collaboration graph
[legend]

Signals

void meshChanged ()
 Signal emmited by emitMeshChanged(). See comments on that function.
 

Public Member Functions

 GmMesh (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmMesh ()
 Virtual destructor.
 
virtual const char * pluginCategory () const
 Returns the plugin category.
 
virtual bool hasCapability (QString capabilityName) const =0
 This function should return true or false to indicate whether the mesh implementation supports the requested capability or not. Capabilities are refered by string names in order to enable derived interfaces to extend the available capabilities that can be queried. More...
 
virtual void pushProxy (lua_State *L, const GmLogCategory &logger)=0
 Pushes a proxy object for the current mesh onto the Lua stack. More...
 
virtual GmValueInfonodeCoordInfo () const =0
 Returns metadata with information about node coordinates.
 
virtual GmValueAccessornodeCoordAccessor (Unit desiredUnit, const GmLogCategory &logger) const =0
 Returns an accessor object used to access node coordinates. More...
 
virtual int numNodes () const =0
 Returns the number of nodes in the mesh.
 
virtual int numGhostNodes () const
 Returns the number of ghost nodes in the mesh.
 
int totalNumNodes () const
 Returns the total number of nodes in the mesh, including normal nodes & ghost nodes.
 
int toLinearGhostIndex (int nodeIndex) const
 If nodeIndex is a value with its high bit set, returns the index (high bit cleared) More...
 
int toLocalGhostIndex (int nodeIndex) const
 Given a global ghost index (a value >= numNodes() and < totalNumNodes()), returns a zero based version of the index. If index is a 'geometry index' (nodeIndex < numNodes()), returns a negative value.
 
virtual const QMap< QString, GmNodeSet * > & nodeSets () const =0
 Returns a map of node sets registered within the mesh. Each entry in the returned map contains a group of nodes, indexed by group name.
 
virtual QStringList nodeAttributeIds () const
 Returns a list with the id names for every attribute associated with mesh nodes. No special order is enforced.
 
virtual QStringList nodeStateVarIds () const
 Returns a list with the id names for every state variable associated with mesh nodes. No special order is enforced.
 
virtual GmValueInfonodeValueInfo (QString id, int filter=-1) const
 Returns the metadata describing the values (attribute / state var) associated with the value id. More...
 
virtual GmValueAccessornodeValueAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Creates an accessor object for the values (attribute / state var) associated with the value id. More...
 
virtual GmValueAccessornodeValueAccessor (QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
 Overloads nodeValueAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value. More...
 
virtual GmValueAccessorstateVarAccessorFromDof (int dof, Unit desiredUnit, GmStateVar **stateVar) const
 Creates an accessor object for the state var associated with the requested degree of freedom number. Returns NULL if the dof number is invalid or if that state var is not associated with this mesh. More...
 
virtual bool addNodeValueSet (GmValueInfo *info, int nNodes=-1, int nGhostNodes=-1)
 Creates a new value set for storing data associated with the metadata information received as a parameter. More...
 
virtual void removeNodeValueSet (QString id)
 Removes node value set associated to the specified id. Do nothing if such node value set is not stored in the mesh.
 
virtual void clearNodeValueSets ()
 Removes every valueSet stored in the mesh (attributes and state variables). Handy for plugins to cleanup on errors.
 
virtual void clearNodeValueSetsData ()
 An auxilliary function used to remove all data from every valueSet stored in the mesh (the value sets themselves remain).
 
virtual bool saveState (GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Simmilar to saveNodeValueState(), saves the current state of all values that support state saving. See saveNodeValueState() for more details.
 
virtual bool saveNodeValueState (QString id, GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Saves the current state for the requested id, creating a new current state. More...
 
virtual int numNodeValueStates (QString id) const
 Returns the number of existing states for the requested id or -1 if the id doesn't exists.
 
virtual QString nodeValueStateTag (QString id, int snum) const
 Returns the state tag attached to the requested state of the named value or "" if the id doesn't exists.
 
virtual double nodeValueStateTime (QString id, int snum) const
 Returns the time tag attached to the requested state of the named value or -1 if the id doesn't exists.
 
virtual void setNodeValueStateTag (QString id, int snum, QString tag)
 Sets a tag name for the requested state of the named value. Does nothing if the id doesn't exists.
 
virtual void setNodeValueStateTime (QString id, int snum, double time)
 Sets a time tag for the requested state of the named value. Does nothing if the id doesn't exists.
 
virtual int addNodes (int numNodes)
 Adds numNodes to the mesh, WHITHOUT initializing their coordinates or attributes. More...
 
virtual int addGhostNodes (int numNodes)
 Similar to addNodes, this function adds ghost nodes to the mesh, WHITHOUT initializing their coordinates or attributes. This function should be reimplemented by mesh implementations that support ghost nodes (hasCapability("ghostNodes") returns true). More...
 
virtual void clear ()
 Clears mesh nodes (and cells + other mesh related information depending on the concrete mesh type) if the mesh supports this operation (hasCapability("clear") returns true). More...
 
QMap< QString, GmPhysicsUserFunctions * > & userFunctionsObjMap () const
 Returns the mesh map storing physics user function objects.
 
virtual void printParameters (const GmLogCategory &logger)
 Asks the mesh to print all of its parameters using the provided logger. More...
 
virtual void printValues (const GmLogCategory &logger, int options=GM_PRINT_DEFAULT)
 Asks the mesh to print all of its node and cell data using the provided logger and requested options. More...
 
virtual size_t nodeMemory () const =0
 Returns the approximate memory used for storing mesh nodes (does not include memory for s.v./attributes)
 
virtual size_t nodeSetsMemory () const =0
 Returns the approximate memory used for storing node sets.
 
const QList< GmValueSet * > & nodeValueSets () const
 Returns a list with the mesh node value sets. This is a very specialized function. Use only if you know what you are doing... More...
 
const QList< GmValueSet * > & ghostNodeValueSets () const
 Returns a list with the mesh ghost node value sets. This is a very specialized function. Use only if you know what you are doing... More...
 
virtual void emitMeshChanged ()
 Emmits the signal meshChanged to signal other objects that the mesh has changed. Should be called by other processes after editions to the mesh like adding new nodes / cells or changing cell geometry.
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
virtual void * qt_metacast (const char *)
 
virtual int qt_metacall (QMetaObject::Call, int, void **)
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectList & children () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
- Public Member Functions inherited from GmPluginObject
 GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmPluginObject ()
 Destructor.
 
QString id () const
 Returns the object id.
 
QString description () const
 Returns the object description.
 
QString pluginTypeName () const
 Returns the hierarchical type name for the plugin object type. See also pluginName() and pluginType().
 
virtual const char * pluginName () const =0
 Returns a string identifying the plugin which implements this object. Should return the SAME string as the one read from the plugin information file in the pluginName field.
 
virtual const char * pluginType () const =0
 Returns the string identifying the plugin object type. Should return the SAME string as the one read from the plugin information file in the objectTypes table. More...
 
virtual bool loadPrivateData (LuaTable &table)=0
 Function called by the model loader to give the object acess to it's private parameters. Should return false only if the received parameter set makes the use of this object impossible.
 
- Public Member Functions inherited from GmGroupDumpItem
virtual ~GmGroupDumpItem ()
 Virtual destructor.
 
virtual bool stateAboutToBeSaved (GmStateDump *state)
 Virtual method called just before starting a save operation on the given state. Returning false aborts the operation.
 
virtual bool stateSaved (GmStateDump *state)
 Virtual method called just after succesfully completing a save operation on the given state. Returning false aborts the operation.
 
virtual bool stateAboutToBeLoaded (GmStateDump *state)
 Virtual method called just before starting a load operation on the given state. Returning false aborts the operation.
 
virtual bool stateLoaded (GmStateDump *state)
 Virtual method called just after succesfully completing a load operation on the given state. Returning false aborts the operation.
 

Static Public Member Functions

static bool isGhostNode (int nodeIndex)
 Returns true if the given index is a ghost node index, false if not. More...
 
static int setGhostFlag (int nodeIndex)
 Returns the given index with the ghost node bit set.
 
static int clearGhostFlag (int nodeIndex)
 Returns the given index with the ghost node bit cleared.
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 

Protected Member Functions

void printValueInfo (const GmLogCategory &logger, QString title, const QStringList &idList)
 Auxiliary function to print information about state variables or attributes.
 
virtual bool addStateItemsToGroup (GmStateDump *state, int groupId)
 Adds to 'state' a data item storing a control map, followed by geometry data filled by addStateGeometryData(), followed by mesh attribute data filled by addStateAccessorData(). All the items are added to the given group. Returns true on success or false on error. More...
 
virtual int controlMapStateItemType ()
 Virtual function that needs to be implemented by concrete implementation classes supporting the stateDump capability. It should return a dump type that identifies the mesh implementation.
 
virtual bool addStateGeometryData (GmStateDump *state, int groupId)
 Virtual function that needs to be implemented by concrete implementation classes supporting the stateDump capability. It should add the needed additional items to the state. Keep in mind that some of the needed control data can be added/loaded from the control map, already added to the state by the standard implementation of addStateItemsToGroup(), through the fillDumpControlMapData() / dumpControlMapDataLoaded() pair of functions.
 
virtual bool addStateAccessorData (GmStateDump *state, int groupId)
 Adds to 'state' accessors for all the data stored on state variables or node attributes associated with this mesh. This includes all histories. Returns true on success or false on error.
 
virtual bool fillDumpControlMapData (QVariantMap *map, const GmLogCategory &logger)
 Fills the dump control data map with mesh data prior to a save operation On errors, should return false and report the error through the provided state dump logger.
 
virtual bool dumpControlMapDataLoaded (QVariantMap *map, const GmLogCategory &logger)
 Sanity checks + processing of the dump control data map after a load operation.
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Protected Member Functions inherited from GmPluginObject
virtual const GmLogCategorylogger () const
 Returns the internal logger used by the plugin to emmit messages.
 
GmSimulationDatasimulationData () const
 Returns a reference to the simulation data object keeping global simulation information.
 

Protected Attributes

int _stateDumpControlMapItem
 The dump item index for the control map. Used to make sure that there are no mesh data accessors prior to the map on the state.
 

Private Attributes

QMap< QString, int > _nodeValuesMap
 Map translating ids from attributes / state vars into their position in _nodeValuesData/_ghostNodeValuesData.
 
QList< GmValueSet * > _nodeValuesData
 List with set of values for attributes / state vars. Might have NULL entries. Size equal to _ghostNodeValuesData.
 
QList< GmValueSet * > _ghostNodeValuesData
 List with set of values for attributes / state vars ghost nodes. Might have NULL entries. Size equal to _nodeValuesData.
 
QMap< QString, GmPhysicsUserFunctions * > _cUserFuncObjMap
 A map storing physics user function objects indexed by the name of the plugin implementing the object. More...
 
QVariantMap _stateDumpControlMap
 Variant map used for state dumping.
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 

Detailed Description

Base interface class for Mesh type plugins.

This Mesh interface is a simple one that supports handling of nodes and its associated attributes and/or state variables. It must be implemented by every physical mesh object exported by mesh type plugins.

The use of abstract interfaces allow for the concrete implementations to have complete control of how the node data is stored in memory (by node data we mean coordinates, attributes and state variables).

Altough this is true, most implementations will store attribute and state variable data as continuous arrays. Also, the mesh must be able to add storage space for new attributes / state variables even if the underlying mesh implementation, done by the plugin, does not support this (the mesh can obtain its data from a pre-existing read-only structure, for example).

Considering this scenario, the Mesh interface is not a pure virtual one. The default implementation manages to store a map of attributes and state variables, which are generalised in the concept of a node value, each implemented as a GmValueSet. A new attribute / state var can be added by a call to addNodeValueSet(), and that method can be used by a physics who wants to add a new attribute to a mesh or by the concrete mesh implementation to add its original attributes and state variables. Values should be later filled with the use of an accessor, as published by the mesh interface.

By using this infrastructure, the underlying concrete mesh implementation can easily handle attributes that can be scalar, vector or matrices, with their values given by constants or by functions, as implemented by GmValueSet. The only prerequisite is that attributes should be added after the number of nodes is known.

If, on the other hand, the mesh wants to have full control of how attributes are stored in memory, they can override the full set of virtual functions handling attributes. In that case, just keep in mind that support for adding new attributes / state variables is required, even if that cannot be handled by the plugin mesh itself (which can easily be handle by using the original basic functions in that case)

Node coordinates are also accessed by means of a specialized value accessor that returns node coordinates for each node as a vector. Meta data describing the number of dimensions and representation unit for each coordinate can be obtained by means of an GmValueInfo object bound to the coordinates.

Constructor & Destructor Documentation

◆ GmMesh()

GmMesh::GmMesh ( GmSimulationData simulation,
QString  id,
QString  description,
const GmLogCategory logger 
)

Constructor.

Parameters
simulationReference to the simulation object.
idMesh id.
descriptionMesh description.
loggerPlugin logger object used to emmit messages

Member Function Documentation

◆ addGhostNodes()

virtual int GmMesh::addGhostNodes ( int  numNodes)
inlinevirtual

Similar to addNodes, this function adds ghost nodes to the mesh, WHITHOUT initializing their coordinates or attributes. This function should be reimplemented by mesh implementations that support ghost nodes (hasCapability("ghostNodes") returns true).

On error, this function should leave the mesh unchanged and return -1. On success, it should return the index of the first new node. The returned index is a value that varies from 0 to numGhostNodes() - 1 (This function does NOT returns indices with the highest bit set since that would conflict with the -1 value used on error).

Please read the documentation of addNodes() for aditional details.

◆ addNodes()

virtual int GmMesh::addNodes ( int  numNodes)
inlinevirtual

Adds numNodes to the mesh, WHITHOUT initializing their coordinates or attributes.

This function should be reimplemented by mesh implementations that support mesh edition (hasCapability("addNodes") returns true). It should increase the space for nodes by 'numNodes' new entries. Node coordinates will be later filled by the USER with a node coordinate accessor. If the mesh has attributes and state vars, this function should also make sure that those value sets are redimensioned and the new values initialised with value defaults.

On error, this function should leave the mesh unchanged and return -1. On success, it should return the index of the first new node.

IMPORTANT: This function might invalidate any data pointer returned by previous accessors. The accessor themselves remain valid, but any pointers returned by calls to value() / other functions might become invalid.

IMPORTANT 2: Users of this function should call emitMeshChanged() after changes to the mesh are completed. That allows for other objects that depend on mesh number of nodes and cell geometry to respond to the changes. The FEM assembler is an example of such object.

◆ addNodeValueSet()

bool GmMesh::addNodeValueSet ( GmValueInfo info,
int  nNodes = -1,
int  nGhostNodes = -1 
)
virtual

Creates a new value set for storing data associated with the metadata information received as a parameter.

The new value set takes ownership of the info object. After this function returns, values can be added to the new value set through an accessor.

It should be noted that info MUST have kind equal to GM_NODE_ATTRIBUTE or GM_NODE_STATEVAR. Since the number of nodes in the mesh is needed for the creation of a value set, in general, this function should be called AFTER the mesh already knows its number of nodes and -1 should be passed to the num nodes parameters (which prompts the function to call numNodes() /numGhostNodes() to figure out the size of the new value set).

In rare ocasions, most notabilly when loading a mesh, it might be necessary to call this function before numNodes() / numGhostNodes() is able to report the correct mesh size. On those situations, the second and third parameters should be filled with the desired number of nodes / ghost nodes. This values must be the same values that will be reported later by numNodes() and numGhostNodes().

The function returns false in case of errors (memory could not be allocated, or the mesh already has a value with the requested id, for example). In that case, info is NOT deallocated by addNodeValueSet().

◆ addStateItemsToGroup()

bool GmMesh::addStateItemsToGroup ( GmStateDump state,
int  groupId 
)
protectedvirtual

Adds to 'state' a data item storing a control map, followed by geometry data filled by addStateGeometryData(), followed by mesh attribute data filled by addStateAccessorData(). All the items are added to the given group. Returns true on success or false on error.

This ordering ensures that the control data is loaded first, followed by the geometry data and only then by mesh data stored through accessors. Keep in mind that when restoring value sets it is necessary that the mesh geometry is already loaded.

Auxiliar variant map dump item that notifies the mesh for loading and saving data to the map

< Our "father" mesh object

Implements GmGroupDumpItem.

◆ clear()

virtual void GmMesh::clear ( )
inlinevirtual

Clears mesh nodes (and cells + other mesh related information depending on the concrete mesh type) if the mesh supports this operation (hasCapability("clear") returns true).

Keep in mind that this function does not remove the set of state vars or attributes added to the mesh, although it clears its stored values.

◆ ghostNodeValueSets()

const QList<GmValueSet*>& GmMesh::ghostNodeValueSets ( ) const
inline

Returns a list with the mesh ghost node value sets. This is a very specialized function. Use only if you know what you are doing...

The returned list will contain value sets for state vars and attributes with node data storage equal to GM_GHOST_NODE or GM_BOTH. It does NOT include GM_GEOMETRY_NODE value sets. Also keep in mind that the value sets with GM_BOTH type returned by this function are different from the ones returned by nodeValueSets(), storing data only for the ghost nodes part.

IMPORTANT: The returned list might contain NULL entries.

IMPORTANT 2: The returned list contains the value sets stored by the base mesh implementation. Concrete mesh classes are free not to use this mechanism to store all of their data, so implementations that can be handling with any kind of mesh plugins should refrain from using this function.

◆ hasCapability()

virtual bool GmMesh::hasCapability ( QString  capabilityName) const
pure virtual

This function should return true or false to indicate whether the mesh implementation supports the requested capability or not. Capabilities are refered by string names in order to enable derived interfaces to extend the available capabilities that can be queried.

Standard capability names: addNodes - Does the mesh support adding new nodes? addCells - Does the mesh support adding new cells? topology - Does the mesh support topological queries? ghostNodes - Does the mesh support adding/removing ghost nodes? editGroups - Does the mesh support adding cell groups and adding cells to groups? clear - Does the mesh support clearing (removing) all nodes and cells and later addition of new ones? stateDump - Does the mesh support state dumping and restoring for restart operations?

◆ isGhostNode()

static bool GmMesh::isGhostNode ( int  nodeIndex)
inlinestatic

Returns true if the given index is a ghost node index, false if not.

Ghost node indices are values that vary from 0 to numGhostNodes() - 1 WITH their high bit SET in order to make a distinction between common indices and ghost node indices.

That means that, for example, the first two ghost nodes have, respectively, an index equal to 0x80000000 and 0x80000001 if node indexes are stored in 32 bit integers.

◆ nodeCoordAccessor()

virtual GmValueAccessor* GmMesh::nodeCoordAccessor ( Unit  desiredUnit,
const GmLogCategory logger 
) const
pure virtual

Returns an accessor object used to access node coordinates.

The logger parameter exists to allow for the accessor to use a different logger than the mesh one to report errors. For example, in an analysis context it might be interesting to report errors through the physics plugin logger instead of by the mesh logger.

◆ nodeValueAccessor() [1/2]

GmValueAccessor * GmMesh::nodeValueAccessor ( QString  id,
Unit  desiredUnit,
const GmLogCategory logger 
) const
virtual

Creates an accessor object for the values (attribute / state var) associated with the value id.

Remember that node attributes and state vars should have unique ids among themselves. If the id does not refer to a known attribute / state var, returns NULL.

If desiredUnit is a known unit, different from the basic node value unit, the value will be automatically converted to the desired unit. If no conversion is possible, the function returns NULL. To avoid conversions, just pass Unit() as the desiredUnit.

The logger parameter exists to allow for the accessor to use a different logger than the mesh one to report errors. For example, in an analysis context it might be interesting to report errors through the physics plugin logger instead of by the mesh logger.

IMPORTANT: The returned accessor should be deallocated by the caller.

Obs: This is equivalent to calling nodeValueAccessor(id, 0, true, desiredUnit, logger)

◆ nodeValueAccessor() [2/2]

GmValueAccessor * GmMesh::nodeValueAccessor ( QString  id,
int  snum,
bool  locked,
Unit  desiredUnit,
const GmLogCategory logger 
) const
virtual

Overloads nodeValueAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value.

The snum parameter contains the requested state. A value of zero means the current state, 1 the previous one, 2 the one before that and so on. Valid values range from zero to the oldest state for the requested variable, which can be queried with a call to numNodeValueStates(). Remember that for a value accessor to support states, the history parameter must be set in its value info object.

The locked parameter control the behaviour of the accessor once a new state is created for the value. The 'lock' refers to the state number, so if locked is false and a new state is created, the accessor doesn't change and continues to point to the same data. If locked is true, the accessor will be locked to that state number so when a new state is created, the accessor changes the data its looking upon to reflect the new state. For example, an accessor locked on the state 0 will always point to the current state and one locked to the state 1 will always point to the previous saved value.

See the overloaded function for the remaining parameters.

◆ nodeValueInfo()

GmValueInfo * GmMesh::nodeValueInfo ( QString  id,
int  filter = -1 
) const
virtual

Returns the metadata describing the values (attribute / state var) associated with the value id.

Remember that node attributes and state vars should have unique ids among themselves. If the id does not refer to a known attribute / state var, returns NULL.

If filter != -1, it should be one of GM_NODE_ATTRIBUTE or GM_NODE_STATEVAR and defines that the return value should be NULL if a matching value does not have the specified type.

◆ nodeValueSets()

const QList<GmValueSet*>& GmMesh::nodeValueSets ( ) const
inline

Returns a list with the mesh node value sets. This is a very specialized function. Use only if you know what you are doing...

The returned list will contain value sets for state vars and attributes with node data storage equal to GM_GEOMETRY_NODE or GM_BOTH. It does NOT include GM_GHOST_NODE value sets. Also keep in mind that the value sets with GM_BOTH type returned by this function are different from the ones returned by ghostNodeValueSets(), storing data only for the common nodes part.

IMPORTANT: The returned list might contain NULL entries. Although strange, allowing this makes the GmMesh implementation easier and allows us to return the internal used list without creating a copy without NULL values.

IMPORTANT 2: The returned list contains the value sets stored by the base mesh implementation. Concrete mesh classes are free not to use this mechanism to store all of their data, so implementations that can be handling with any kind of mesh plugins should refrain from using this function.

◆ printParameters()

void GmMesh::printParameters ( const GmLogCategory logger)
virtual

Asks the mesh to print all of its parameters using the provided logger.

The default implementation logs the data, as seen through the access interface. Restricting ourselfs to the published interface allows this function to work well even if the concrete mesh plugin reimplements completely the attribute / state vars system

Implements GmPluginObject.

Reimplemented in GmCellMesh, and GmElementMesh.

◆ printValues()

void GmMesh::printValues ( const GmLogCategory logger,
int  options = GM_PRINT_DEFAULT 
)
virtual

Asks the mesh to print all of its node and cell data using the provided logger and requested options.

The default implementation logs the node data, as seen through the access interface. The options parameter should be an 'or' of GmPrintUtilsFlags entries.

Reimplemented in GmCellMesh, and GmElementMesh.

◆ pushProxy()

virtual void GmMesh::pushProxy ( lua_State *  L,
const GmLogCategory logger 
)
pure virtual

Pushes a proxy object for the current mesh onto the Lua stack.

The proxy object should be a sub class of GmLuaMesh and can include specific functions not in the standard mesh interfaces. This interface is based on pushing the object on the Lua stack and not by returning a GmLuaMesh object since the later option would create a circular dependency between the GemaCore library and the GemaLuaCore library.

◆ saveNodeValueState()

bool GmMesh::saveNodeValueState ( QString  id,
GmValueSet::SaveStateMode  mode,
const GmLogCategory logger 
)
virtual

Saves the current state for the requested id, creating a new current state.

If the value does not supports history values, does nothing, returning false. The mode parameter defines how the new state will be initialized (with a copy of the old one, with the value default or uninitialized).

The time associated with the new current state is initialized to the value of the current time as seen from the simulation data object. This can later be changed by a call to setNodeValueStateTime().

Returns true if the state was created successfully, false otherwise.

◆ stateVarAccessorFromDof()

GmValueAccessor * GmMesh::stateVarAccessorFromDof ( int  dof,
Unit  desiredUnit,
GmStateVar **  stateVar 
) const
virtual

Creates an accessor object for the state var associated with the requested degree of freedom number. Returns NULL if the dof number is invalid or if that state var is not associated with this mesh.

For state vars that store vector values, the state var can be recognized by any value in the range covered by its base dof and the next 'n-1' values where 'n' is the vector size.

If stateVar is different from NULL, returns the state var.

IMPORTANT: To recover an accessor for a state var with known id, it's much better to call nodeValueAccessor(). This is not a fast function since there are no special indices to find a state var from its dof number (but that really should not be a problem unless you have hundreds of state vars or if you need to call this in a thight lopp, which you shouldn't any way).

If desiredUnit is a known unit, different from the basic node value unit, the value will be automatically converted to the desired unit. If no conversion is possible, the function returns NULL. To avoid conversions, just pass Unit() as the desiredUnit.

IMPORTANT 2: The returned accessor should be deallocated by the caller.

◆ toLinearGhostIndex()

int GmMesh::toLinearGhostIndex ( int  nodeIndex) const
inline

If nodeIndex is a value with its high bit set, returns the index (high bit cleared)

  • the number of regular mesh nodes. Otherwise, returns nodeIndex

Member Data Documentation

◆ _cUserFuncObjMap

QMap<QString, GmPhysicsUserFunctions*> GmMesh::_cUserFuncObjMap
mutableprivate

A map storing physics user function objects indexed by the name of the plugin implementing the object.

When a C user function is attached to the mesh (by a node/cell attribute or property) an object created by the plugin that implements the c function is instanced and associated to the mesh. If a plugin exports more than one function attached to the same mesh, the same object is shared between the functions.

The map owns the physics objects that will be deleted when the mesh is destroyed. Marked as mutable since the map is filled in a lazy way when evaluating user functions that have a reference to a const mesh.


The documentation for this class was generated from the following files: