GemaCoreLib
The GeMA Core library
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
GmElementMesh Class Reference

Base interface for FEM (finite element) meshes. More...

#include <gmElementMesh.h>

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

Public Member Functions

 GmElementMesh (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Standard constructor for element meshes.
 
virtual ~GmElementMesh ()
 Destructor.
 
const GmIntegrationRuleelementIntegrationRule (GmCellType type, int ruleSet) const
 Returns the integration rule associated with the received element type / rule set.
 
const GmBorderIntegrationRuleborderIntegrationRule (GmCellType type, int ruleSet, int borderIndex) const
 Returns the integration rule associated with a border (face for 3D elements or edge for 2D elements) of the received element type / rule set. More...
 
const GmBorderIntegrationRulefaceIntegrationRule (GmCellType type, int ruleSet, int faceIndex) const
 Returns the integration rule associated with an element face of the received element type / rule set. This function is undefined for line or 2D elements. More...
 
const GmBorderIntegrationRuleedgeIntegrationRule (GmCellType type, int ruleSet) const
 Returns the integration rule associated with an element edge of the received element type / rule set. This function is undefined for line elements.
 
int maxNumIntPoints (int ruleSet) const
 Returns the maximum number of integration points used by a mesh element under the given rule set.
 
void addIntegrationRuleSet ()
 Adds a new integration rule set to the mesh. Values are (conceptually) initialized to the element default rule.
 
int numIntegrationRuleSets () const
 Returns the number of integration rule sets stored by this mesh.
 
bool setElementIntegrationRule (GmCellType type, GmIntegrationRule *rule, int ruleSet)
 Allows the user to exchange the default integration rule tied to an element type / rule set. More...
 
bool setFaceIntegrationRule (GmCellType type, GmBorderIntegrationRule *rule, int ruleSet, int faceType)
 Allows the user to exchange the default integration rule tied to a face of an element type. Please, see additional comments on setElementIntegrationRule() More...
 
bool setEdgeIntegrationRule (GmCellType type, GmBorderIntegrationRule *rule, int ruleSet)
 Allows the user to exchange the default integration rule tied to an edge of an element type. Please, see additional comments on setElementIntegrationRule()
 
GmMeshGaussIndexgaussIndex (int ruleSet) const
 Returns the index object associated with the given rule set. The index is created on the first call to this function for the given rule set. Returns NULL if the index could not be created. More...
 
bool usesGaussIndex (int ruleSet) const
 Returns true if the GaussIndex for the given rule set WAS already created by a call to gaussIndex(). Can only be called from the main thread since this question is not possible to answer in a multi-threaded scenario.
 
virtual QStringList gaussAttributeIds () const
 Returns a list with the id names for every gauss attribute associated with mesh elments. No special order is enforced.
 
virtual GmValueInfogaussAttributeInfo (QString id) const
 Returns the metadata describing the Gauss attribute named id. More...
 
virtual GmGaussAccessorgaussAttributeAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Creates an accessor object for the Gauss attribute named id. More...
 
virtual GmGaussAccessorgaussAttributeAccessor (QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
 Overloads gaussAttributeAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value. More...
 
virtual bool addGaussAttributeSet (GmValueInfo *info)
 Creates a new value set for storing data associated with the Gauss attribute whose metadata information was received as a parameter. More...
 
virtual void removeGaussAttributeSet (QString id)
 Removes gauss attribute set associated to the specified id. Do nothing if such gauss attribute set is not stored in the mesh.
 
virtual void clearGaussAttributeSets ()
 An auxilliary function used to remove every Gauss valueSet stored in the mesh. Handy for plugins to cleanup on errors.
 
virtual void clearGaussAttributeSetsData ()
 An auxilliary function used to remove all data from every Gauss valueSet stored in the mesh (the value sets themselves remain).
 
virtual bool saveState (GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Simmilar to saveNodeValueState() / saveCellAttributeState() saveGaussAttributeState(), saves the current state of all nodal and cell values that support state saving. See saveNodeValueState() / saveCellAttributeState() saveGaussAttributeState for more details.
 
virtual bool saveGaussAttributeState (QString id, GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Saves the current state for the requested id, creating a new current state. More...
 
virtual int numGaussAttributeStates (QString id) const
 Returns the number of existing states for the requested id or -1 if the id doesn't exists.
 
virtual QString gaussAttributeStateTag (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 gaussAttributeStateTime (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 setGaussAttributeStateTag (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 setGaussAttributeStateTime (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 hPOrder () const
 Returns the elements P order for hierarchical meshes, 0 for meshes with conventional elements.
 
virtual int hQOrder () const
 Returns the elements Q order for hierarchical meshes, 0 for meshes with conventional elements.
 
virtual void printParameters (const GmLogCategory &logger)
 Reimplements the standard CellMesh::printParameters() method to add information about element integration rules.
 
virtual void printValues (const GmLogCategory &logger, int options=GM_PRINT_DEFAULT)
 Reimplements the standard CellMesh::printValues() method to add information about gauss attributes.
 
const QList< GmGaussValueSet * > & gaussValueSets () const
 Returns a list with the mesh Gauss value sets. This is a very specialized function. Use only if you know what you are doing...
 
virtual size_t gaussIndicesMemory () const
 Returns the approximate memory used for storing Gauss indices.
 
- Public Member Functions inherited from GmCellMesh
 GmCellMesh (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmCellMesh ()
 Virtual destructor.
 
virtual int numCells () const =0
 Returns the number of cells in the mesh.
 
virtual int numActiveCells () const =0
 Returns the number of active cells in the mesh.
 
virtual const GmCellcell (int cellIndex) const =0
 Returns a cell of the mesh. More...
 
virtual GmCellcell (int cellIndex)=0
 Non const version of cell() const.
 
virtual const GmCellMeshTopologytopology (bool create=true) const
 If the mesh suppports the topology capability (hasCapability("topology") returns true), returns the mesh topology object that should be used for such queries. If there is no support, returns NULL. More...
 
virtual void clearTopology ()
 If the mesh suppports the topology capability (hasCapability("topology") returns true), suggests to the mesh that the topology information will not be needed anymore and so can be discarded (if at all possible depending on the plugin implementation).
 
virtual const int * numCellTypes () const =0
 Returns a const vector of size equal to GM_NUM_CELL_TYPES where each entry is the number of cells of that type present in the mesh. More...
 
virtual const int * numActiveCellTypes () const =0
 Returns a const vector of size equal to GM_NUM_CELL_TYPES where each entry is the number of active cells of that type present in the mesh. More...
 
virtual int maxNumCellNodes () const =0
 Returns the maximum number of nodes in a mesh cell (equivalent to calculating the maximum of the number of nodes of each type that has a non zero entry in the vector returned by numCellTypes())
 
virtual int maxNumCellGhostNodes () const
 Returns the maximum number of ghost nodes in a mesh cell. More...
 
virtual int maxTotalNumCellNodes () const
 Returns the maximum total number of nodes (normal + ghost) in a cell mesh. More...
 
virtual void ghostNodesUpdated (int nghost, int ntotal)
 Informs the mesh that the number of ghost nodes / total num nodes in a cell was updated to the given values, so that the mesh can update its statistics returned by maxNumCellGhostNodes() and maxTotalNumCellNodes(). More...
 
virtual void activeCellUpdated (GmCellType type, bool active)=0
 Informs the mesh that a cell had its active state changed, being made active / inactive. Called by GmCell::setactive() More...
 
virtual bool isValid (QList< int > *nonValidIds=NULL, double tol=1e-3) const
 Returns true if all the mesh cells are valid. Fill the non-valid cell ids if required.
 
virtual bool isQualityGT (double minQuality) const
 
virtual void qualityHistogram (QVector< int > &hist, int nbins=10) const
 
virtual double edgeMinLength ()
 
virtual double edgeMaxLength ()
 
virtual double cellBboxMinLength ()
 
virtual double cellBboxMaxLength ()
 
void clearCellStatistics ()
 Clears cell statistics returned by edgeMaxLength() function and friends forcing its recalculation on next usage.
 
void printQualityHistogram (bool activeOnly=true) const
 Prints cells quality histogram. If activeOnly is true, only the active cells will be scanned, all of them otherwise. Default = true.
 
virtual QStringList cellGroupIds () const
 Returns a list with the names of the available cell groups. More...
 
virtual int numCellsInGroup (int groupIndex) const
 Returns the number of cells present in the group referenced by groupIndex. More...
 
virtual const GmCellcellInGroup (int groupIndex, int cellIndex) const
 Returns a cell present in the group referenced by groupIndex. More...
 
virtual GmCellcellInGroup (int groupIndex, int cellIndex)
 Non const version of cellInGroup() const.
 
virtual const QMap< QString, GmCellBoundary * > & cellBoundaryGroups () const =0
 Returns a map of boundaries registered within the mesh. Each entry in the returned map contains a group of cell edges or a group of cell faces that together define a boundary, indexed by group name.
 
virtual const QList< GmPropertySet * > & propertySets () const =0
 Returns a reference to the list of property sets associated to this mesh. More...
 
virtual int propertySetIndex (QString id) const =0
 
virtual GmValueInfocellPropertyInfo (QString id) const
 Returns the metadata of the property named by id. More...
 
virtual GmCellAccessorcellPropertyAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Returns an accessor object for the property named by id. More...
 
virtual QStringList cellAttributeIds () const
 Returns a list with the id names for every attribute associated with mesh cells. No special order is enforced.
 
virtual GmValueInfocellAttributeInfo (QString id) const
 Returns the metadata describing the cell attribute named id. More...
 
virtual GmCellAccessorcellAttributeAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Creates an accessor object for the cell attribute named id. More...
 
virtual GmCellAccessorcellAttributeAccessor (QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
 Overloads cellAttributeAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value. More...
 
virtual int addCells (int *numCellTypes)
 Adds new cells to the mesh, WHITHOUT initializing their nodes or attributes. More...
 
virtual QList< int > addedCells () const
 If the mesh supports mesh edition (hasCapability("addCells") returns true), this function should return a list with cell identifiers added to the mesh by calls to addCells() since the mesh creation or since the last call to clearAddedCells()
 
virtual void clearAddedCells ()
 Method called by the assembler to clear the internal list used to track added cells. See comments on addedCells().
 
virtual int addCellGroup (QString groupName)
 Adds a new (empty) cell group to the mesh. More...
 
virtual bool addCellsToGroup (int groupId, const QVector< int > &cellIds)
 Adds the set of cells in the given list to the cell group. Assumes that the intersection of the given list with the current group cells is empty. More...
 
virtual bool addCellsToGroup (int groupId, const QVector< QPair< int, int >> &cellIds)
 Adds the set of cells in the given list to the cell group.. The set of added cells is given by a vector with cell ranges. Each pair entry contains the cell index for the first and last cell in the range. Assumes that there is no intersection among the ranges and that the intersection of the given ranges with the current group cells is empty. More...
 
virtual bool addCellAttributeSet (GmValueInfo *info)
 Creates a new value set for storing data associated with the attribute whose metadata information was received as a parameter. More...
 
virtual void removeCellAttributeSet (QString id)
 Removes cell attribute set associated to the specified id. Do nothing if such cell attribute set is not stored in the mesh.
 
virtual void clearCellAttributeSets ()
 An auxilliary function used to remove every valueSet stored in the mesh. Handy for plugins to cleanup on errors.
 
virtual void clearCellAttributeSetsData ()
 An auxilliary function used to remove all data from every valueSet stored in the mesh (the value sets themselves remain).
 
virtual bool saveCellAttributeState (QString id, GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Saves the current state for the requested id, creating a new current state. More...
 
virtual int numCellAttributeStates (QString id) const
 Returns the number of existing states for the requested id or -1 if the id doesn't exists.
 
virtual QString cellAttributeStateTag (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 cellAttributeStateTime (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 setCellAttributeStateTag (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 setCellAttributeStateTime (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 size_t cellMemory () const =0
 Returns the approximate memory used for storing mesh cells (does not include memory for attributes)
 
virtual size_t cellGroupsMemory () const =0
 Returns the approximate memory used for storing cell groups.
 
virtual size_t cellBoundariesMemory () const =0
 Returns the approximate memory used for storing cell boundaries.
 
const QList< GmValueSet * > & cellValueSets () const
 Returns a list with the mesh cell value sets. This is a very specialized function. Use only if you know what you are doing...
 
const GmCellGroupSetcellGroupSet (const QList< int > &groupIdList, bool disjoint)
 Auxiliar function used to manage cell group sets attached to the mesh. More...
 
void clearCellGroupSetsData (bool keepMeshSet)
 An auxilliary function used to remove all cell groups stored in the mesh.
 
- Public Member Functions inherited from GmMesh
 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 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 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.
 

Protected Member Functions

virtual GmGaussValueSetcreateGaussValueSet (GmValueInfo *info)
 Function responsible for creating a new GmGaussValueSet that will store data for the info attribute. Can be replaced in derived classes to allow for other implementations for the class. This is particulary important for the XFem plugin.
 
template<class T >
T * getIntegrationRuleWithDCL (QList< QAtomicPointer< T > * > &list, QMutex *mutex, T *(*instance)(GmCellType, int, int, int, GmIntegrationRuleType), GmCellType type, int ruleSet, int faceType) const
 Auxiliar function that uses the Double Checked Locking Pattern (DCLP) to grab an integration rule from the given list, creating it by calling instance() if the list doesn't already have an integration rule for the given type and rule set. More...
 
virtual bool addStateAccessorData (GmStateDump *state, int groupId)
 Adds to 'state' accessors for all the Gauss attributes associated with this mesh. This includes all histories. (also adds node attributhe through the base class). 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 GmMesh
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.
 
- 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

QMap< QString, int > _gaussAttributesMap
 Map translating ids from attributes into their position in _gaussAttributesData.
 
QList< GmGaussValueSet * > _gaussAttributesData
 List with set of values for element Gauss attributes.
 
- Protected Attributes inherited from GmMesh
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 Member Functions

QString toRuleStr (GmIntegrationRule *ir) const
 Returns a string containing the rule's cache key + its creation parameters.
 
bool fromRuleStr (QString r, int *key, GmIntegrationRuleType *type, int *rule1, int *rule2, int *rule3)
 Splits the rule string created by toRuleStr() into its components.
 
void clearRuleSetRules (int rule)
 Removes the vector and all integration rules from the given position on the rules lists.
 

Private Attributes

QList< QAtomicPointer< GmIntegrationRule > * > _elemIntegrationRulesList
 List with sets of per element type integration rules.
 
QList< QAtomicPointer< GmBorderIntegrationRule > * > _faceIntegrationRulesList
 List with sets of per element type face integration rules.
 
QList< QAtomicPointer< GmBorderIntegrationRule > * > _edgeIntegrationRulesList
 List with sets of per element type edge integration rules.
 
QMutex _elemIntegrationRulesMutex
 The mutex protecting _elemIntegrationRulesList.
 
QMutex _faceIntegrationRulesMutex
 The mutex protecting _faceIntegrationRulesList.
 
QMutex _edgeIntegrationRulesMutex
 The mutex protecting _edgeIntegrationRulesList.
 
QList< QAtomicPointer< GmMeshGaussIndex > > _gaussIndexList
 List of per integration rule Gauss index.
 
QMutex _gaussIndexMutex
 The mutex protecting _gaussIndexList.
 

Additional Inherited Members

- Signals inherited from GmMesh
void meshChanged ()
 Signal emmited by emitMeshChanged(). See comments on that function.
 
- Static Public Member Functions inherited from GmMesh
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)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Base interface for FEM (finite element) meshes.

This interface basically adds methods related to FEM models.

Member Function Documentation

◆ addGaussAttributeSet()

bool GmElementMesh::addGaussAttributeSet ( GmValueInfo info)
virtual

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

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

It should be noted that info MUST have kind equal to GM_GAUSS_ATTRIBUTE and that this function should be called AFTER the mesh already knows its number AND TYPE of cells (since both are needed while creating a ValueSet).

The function returns false in case of errors (memory could not be allocated, or the mesh already has a Gauss attribute with the requested id, for example).

In that case, info is NOT deallocated by addGaussAttributeSet().

This function calls createGaussValueSet() to actually instance the value set object, allowing for derived classes to work with other kinds of value sets derived from GmGaussValueSet. This is particulary important for the XFem plugin.

◆ borderIntegrationRule()

const GmBorderIntegrationRule * GmElementMesh::borderIntegrationRule ( GmCellType  type,
int  ruleSet,
int  borderIndex 
) const

Returns the integration rule associated with a border (face for 3D elements or edge for 2D elements) of the received element type / rule set.

For 2D elements it is equivalent to edgeIntegrationRule() and for 3D elements to faceIntegrationRule(). This function is undefined for line elements. It can be used for building generic code that works for both 2D and 3D elements.

The border index parameter is used only if type is a 3D element with more than one face type (like a wedge). In that case, it should be the face index for the integration face and will be used to choose the correct face rule to be used. Otherwise, any valid face / edge index can be used (like 0).

◆ faceIntegrationRule()

const GmBorderIntegrationRule * GmElementMesh::faceIntegrationRule ( GmCellType  type,
int  ruleSet,
int  faceIndex 
) const

Returns the integration rule associated with an element face of the received element type / rule set. This function is undefined for line or 2D elements.

The face index parameter is used only if type has more than one face type (like a wedge). In that case, it should be the face index for the integration face and will be used to choose the correct face rule to be used. Otherwise, any valid face index can be used (like 0).

◆ gaussAttributeAccessor() [1/2]

GmGaussAccessor * GmElementMesh::gaussAttributeAccessor ( QString  id,
Unit  desiredUnit,
const GmLogCategory logger 
) const
virtual

Creates an accessor object for the Gauss attribute named id.

If the id does not refer to a known attribute, returns NULL.

If desiredUnit is a known unit, different from the basic attribute 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 gaussAttributeAccessor(id, 0, true, desiredUnit, logger)

◆ gaussAttributeAccessor() [2/2]

GmGaussAccessor * GmElementMesh::gaussAttributeAccessor ( QString  id,
int  snum,
bool  locked,
Unit  desiredUnit,
const GmLogCategory logger 
) const
virtual

Overloads gaussAttributeAccessor(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 numGaussAttributeStates(). Remember that for a value accessor to support states, the history parameter must be set in its value info object.

The locked parameter controls 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 satte. 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.

◆ gaussAttributeInfo()

GmValueInfo * GmElementMesh::gaussAttributeInfo ( QString  id) const
virtual

Returns the metadata describing the Gauss attribute named id.

If the id does not refer to a known attribute, returns NULL.

◆ gaussIndex()

GmMeshGaussIndex * GmElementMesh::gaussIndex ( int  ruleSet) const

Returns the index object associated with the given rule set. The index is created on the first call to this function for the given rule set. Returns NULL if the index could not be created.

The implementation uses the DCL pattern. See comments on getIntegrationRuleWithDCL() for additional information.

◆ getIntegrationRuleWithDCL()

template<class T >
T * GmElementMesh::getIntegrationRuleWithDCL ( QList< QAtomicPointer< T > * > &  list,
QMutex mutex,
T *(*)(GmCellType, int, int, int, GmIntegrationRuleType instance,
GmCellType  type,
int  ruleSet,
int  faceType 
) const
protected

Auxiliar function that uses the Double Checked Locking Pattern (DCLP) to grab an integration rule from the given list, creating it by calling instance() if the list doesn't already have an integration rule for the given type and rule set.

Using DCLP guranteees that all accesses but the first one have minimum overhead.

See https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/ for an extensive documentation about the DCLP problem.

The faceType parameter should be passed as 0 for non face lists.

◆ saveGaussAttributeState()

bool GmElementMesh::saveGaussAttributeState ( 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 setGaussAttributeStateTime().

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

◆ setElementIntegrationRule()

bool GmElementMesh::setElementIntegrationRule ( GmCellType  type,
GmIntegrationRule rule,
int  ruleSet 
)

Allows the user to exchange the default integration rule tied to an element type / rule set.

Integration rules are tied to element types and not to elements in order to allow the element to be a lightweight object. Since in most scenarios all elements of a type will share an integration rule, we really don't need to store a pointer to an integration rule in each and every element.

Returns false if the rule is not compatible with the element type. Otherwise, returns true and takes the ownership of the integration rule that will be deleted by the mesh destructor.

Obs: If the per element type (and rule set) schema proves to be too stringent and we really need to have two elements of the same type, in the same rule set, with different integration rules a not so complicated solution would be to implement the concept of subtypes, associating rules with subtypes and not types anymore. Each type can have a (fixed) number of subtypes. This can be implemented rather efficiently if we use, for example 2 bits from element id numbers to store the subtype (which would give 4 subtypes and still let us have a mesh with 1G elements).

◆ setFaceIntegrationRule()

bool GmElementMesh::setFaceIntegrationRule ( GmCellType  type,
GmBorderIntegrationRule rule,
int  ruleSet,
int  faceType 
)

Allows the user to exchange the default integration rule tied to a face of an element type. Please, see additional comments on setElementIntegrationRule()

The faceType parameter is used when the element type has faces with different types (wedge, for example). In this case, one different rule should be stored for each face type. For elements with a single face type, this parameter must be filled with the element's face type or with -1 (the type will be inferred from the element type).


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