24#ifndef _GEMA_PLUGIN_FEM_ASSEMBLER_H_
25#define _GEMA_PLUGIN_FEM_ASSEMBLER_H_
84 ELEMENTS_ADDED = 0x008,
85 ELEMENTS_REMOVED = 0x010,
87 FIXED_BCS_UPDATE = 0x020,
88 FIXED_BCS_CHANGED = 0x040,
89 FIXED_BCS_ALL = 0x080,
90 FIXED_BCS_KEEPOLD = 0x100,
93 SAVE_MAPPING_INFO = 0x8000,
100 GhostDofMode ghostMode,
bool enableFastUpdate,
bool createReverseMapping,
102 bool update(
int mode,
QString& err);
109 _warnOnFixedInvalidDof = warnOnFixedInvalidDof;
110 _warnOnFixedDofConflict = warnOnFixedDofConflict;
113 void setPartitions(
int npart);
116 int numDof()
const {
return _nMatrixDof; }
125 int numFixedDof()
const {
return _nTotalDof - _nMatrixDof; }
127 int numElementDof(
const GmElement* e,
int physicsIndex)
const;
132 int dofIndex (
int node,
int dof)
const;
136 double dofFixedValue(
int index) { assert(index < 0);
return _fixedValues[abs(index+1)]; }
139 int svGroupId(
int globalIndex);
147 bool beginAssembly();
148 bool endAssembly(
bool discardData =
false);
149 const int* addElementData(
const GmElement* e,
int physicsIndex,
156 void saveResultData(
const GmVector& data,
double lambda = 1.0);
160 void loadResultData(
GmVector& data);
164 void remapData(
GmVector& data,
double newValue = 0.0)
const;
165 void remapData(
const GmVector& oldData,
GmVector& newData,
double newValue = 0.0)
const;
204 bool addMappedMatrixData(
int ndof,
const int* indexMap,
const GmDofMap* dofMap,
211 bool initTranslationStructures(
bool enableFastUpdate,
bool createReverseMapping,
QString& err);
213 void initDofToNodeIndex(
int firstNode);
214 void initUpdateDofPhysicsList();
220 bool saveNonConstantPhysics,
QString& err);
223 int fecthDofStatevar (
int dof);
224 void fillFixedData(
double* data,
int size);
226 bool updateFixedBcValues(
QString& err);
228 bool nodesAdded,
int updateFixedMode,
bool updateUnits,
QString& err);
234 bool useOldFixedDofMap,
int* nFreeAdded,
int* nFixedAdded,
QString& err);
236 int extendedDofIndex(
int node,
int dof)
const;
245 int tgi(
int node)
const {
return _mesh->toLinearGhostIndex(node); }
248 int nodeIndex(
int node)
const {
return _nodeIndex[tgi(node)]; }
251 void setNodeIndex(
int node,
int baseIndex) { _nodeIndex[tgi(node)] = baseIndex; }
254 void incNodeIndex(
int node,
int offset) { _nodeIndex[tgi(node)] += offset; }
344#if defined ENABLE_TESTS || defined ENABLE_ASSEMBLER_TESTS
345 void validateInternalStructure()
const;
A class responsible for assembling the global stiffness matrix, handling multiple physics with possib...
Definition gmpFemAssembler.h:63
int _maxNodeDofs
The maximum number of dofs for a node. Might over estimate if number of node dofs are reduced over ti...
Definition gmpFemAssembler.h:286
QVector< GmpFemPhysics * > _nonConstantDofPhysics
A list with the set of physics that should be queried when updating dofs if _updateDofMode == FAST_UP...
Definition gmpFemAssembler.h:311
unsigned char * _nodeTemplateIndex
A vector storing for each mesh node its dof template index.
Definition gmpFemAssembler.h:291
GmpFemMatrixSet * _matSet
The matrix set used together with the assembler
Definition gmpFemAssembler.h:270
int * _nodeIndex
A vector storing for each mesh node its base index in the matrix.
Definition gmpFemAssembler.h:289
QVector< double > _oldFixedValues
A vector storing the values in _fixedValues before the last call to update()
Definition gmpFemAssembler.h:293
bool _hasRemapInfo
Is remap info available (The last call to update included the SAVE_MAPPING_INFO flag)?...
Definition gmpFemAssembler.h:335
UpdateMode
Definition gmpFemAssembler.h:80
GmTLBuffer< int, true > _elemIndexMap
An auxiliar vector used by addElementMatrix, with size equal to the biggest local matrix number of do...
Definition gmpFemAssembler.h:305
QMap< QPair< GmElementDofMap, GmElementDofMap >, int > _templateCache
A map keyed by both the node dof mapping and the fixed dof mapping, storing the equivalent template i...
Definition gmpFemAssembler.h:317
QMap< int, int > _dofToSvCache
A map keyed by dof number storing the corresponding entry in _stateVars. This map holds values outsid...
Definition gmpFemAssembler.h:322
int numDof() const
Returns the number of degrees of freedom of the global assembled matrix.
Definition gmpFemAssembler.h:116
QVector< QPair< GmStateVar *, GmValueAccessor * > > _stateVars
A list storing pairs of state vars and accessors to them for every different state var that provides ...
Definition gmpFemAssembler.h:300
bool _warnOnFixedDofConflict
Should the assembler emmit a warning for conflicting fixed BC values?
Definition gmpFemAssembler.h:269
int nodeIndex(int node) const
Returns the base node index of the given node. Node can be a ghost node index if ghost support is ena...
Definition gmpFemAssembler.h:248
GmpFemAssemblerVectorAdder * _debugVecAdder
The configured adder object used to assemble vectors in "single debug" mode.
Definition gmpFemAssembler.h:279
Unit _timeUnit
The time unit used by all the physics.
Definition gmpFemAssembler.h:330
FixedDofMode
Definition gmpFemAssembler.h:67
@ NO_DOF_HANDLING
No fixed dof handling. The full matrix will be generated.
Definition gmpFemAssembler.h:68
@ REMOVE_DOF
Fixed dofs are removed from the matrix.
Definition gmpFemAssembler.h:69
const QVector< GmpFemPhysics * > & _physicsList
List of physics that will cooperate to generate the global matrix.
Definition gmpFemAssembler.h:266
FixedDofMode _fixedDofMode
How does the assembler treats fixed degrees of freedom.
Definition gmpFemAssembler.h:267
QVector< double > _fixedValues
A vector storing the values of the fixed dofs with size equal to _nTotalDof - _nMatrixDof.
Definition gmpFemAssembler.h:292
QVector< GmpFemPhysics * > _nonConstantFixedValuesPhysics
A list with the set of physics whose fixed boundary condition values are not constant.
Definition gmpFemAssembler.h:308
GmpFemLocker * _locker
The locker object used when adding values to the global matrices/vectors in multiple threads.
Definition gmpFemAssembler.h:273
size_t _elemDofsSum
A sum of the number of local matrix entries for the whole set of elements. When update() is called,...
Definition gmpFemAssembler.h:287
double dofFixedValue(int index)
Returns the fixed dof value associated to a negative index in an entry in the vector returned by fill...
Definition gmpFemAssembler.h:136
Unit * _dofUnitList
A vector keyed by dof number, with size equal to GM_MAX_DOF, storing the corresponding dof unit....
Definition gmpFemAssembler.h:327
QVector< int > _remapInfo
The remap vector storing information on how to translate values from a vector prior to an update() ca...
Definition gmpFemAssembler.h:342
const TemplateData & nodeTemplate(int node) const
Returns the node template. Node can be a ghost node index if ghost support is enabled.
Definition gmpFemAssembler.h:263
GmElementMesh * _mesh
The mesh.
Definition gmpFemAssembler.h:265
GmpFemAssemblerMatrixAdder * _debugMatAdder
The configured adder object used to assemble matrices in "single debug" mode.
Definition gmpFemAssembler.h:278
GmpFemAssemblerVectorAdder * _vecAdder
The configured adder object used to assemble vectors.
Definition gmpFemAssembler.h:276
QHash< int, int > _fixedNodeIndex
Map determining the base index of a node in the _fixedValues vector.
Definition gmpFemAssembler.h:294
int nodeTemplateIndex(int node) const
Returns the node template index. Node can be a ghost node index if ghost support is enabled.
Definition gmpFemAssembler.h:257
int _nTotalDof
The total number of degrees of freedom of the system, including fixed ones.
Definition gmpFemAssembler.h:285
void incNodeIndex(int node, int offset)
Updates the base node index of the given node by adding the given value. Node can be a ghost node ind...
Definition gmpFemAssembler.h:254
const QVector< QPair< GmStateVar *, GmValueAccessor * > > & stateVars() const
Returns the vector storing the set of state variables/accesors to them in use by the assembler.
Definition gmpFemAssembler.h:142
int _nMatrixDof
The number of degrees of freedom of the assembled matrix.
Definition gmpFemAssembler.h:284
QVector< int > _dofNode
A reverse vector mapping, storing for each dof in the assembled matrix the node it belongs to,...
Definition gmpFemAssembler.h:290
int _nthreads
The number of threads configured for the assembler. Can be any value >= -1.
Definition gmpFemAssembler.h:281
Unit timeUnit() const
Returns the unit in which time is handled by the physics.
Definition gmpFemAssembler.h:145
int _nt
The number of threads that should be used by the assembler in OMP operations.
Definition gmpFemAssembler.h:282
int _nNodes
The number of nodes in _nodeIndex & _nodeTemplateIndex. Will be equal to _mesh->numNodes() or _mesh->...
Definition gmpFemAssembler.h:288
bool _warnOnFixedInvalidDof
Should the assembler emmit a warning fixed BCs for invalid dofs?
Definition gmpFemAssembler.h:268
void setBcWarningMode(bool warnOnFixedInvalidDof, bool warnOnFixedDofConflict)
Updates the flags controlling wheter warnings should be emmited or not when invalid fixed dofs are fo...
Definition gmpFemAssembler.h:107
QVector< TemplateData > _templateList
A list with node metadata information for every node template type.
Definition gmpFemAssembler.h:295
GmpFemVectorSet * _vecSet
The vector set used together with the assembler.
Definition gmpFemAssembler.h:271
int numTotalDof() const
Returns the total number of the system degrees of freedom, including fixed ones. This value will be e...
Definition gmpFemAssembler.h:122
GhostDofMode
Definition gmpFemAssembler.h:73
@ AUTO_GHOST_SUPPORT
Equal to GHOST_SUPPORT if there is ANY state var in the mesh with ghost support. Equal to NO_GHOST_SU...
Definition gmpFemAssembler.h:76
@ GHOST_SUPPORT
The assembler will support dofs in ghost nodes.
Definition gmpFemAssembler.h:74
@ NO_GHOST_SUPPORT
The assembler will not support dofs in ghost nodes.
Definition gmpFemAssembler.h:75
bool _ghostEnabled
Should the assembler handle ghost nodes?
Definition gmpFemAssembler.h:283
bool fastUpdate() const
Returns whether the assembler was initialized with the fast update option turned on or off.
Definition gmpFemAssembler.h:168
void setNodeTemplateIndex(int node, int templateIndex)
Updates the template index of the given node. Node can be a ghost node index if ghost support is enab...
Definition gmpFemAssembler.h:260
void setNodeIndex(int node, int baseIndex)
Updates the base node index of the given node. Node can be a ghost node index if ghost support is ena...
Definition gmpFemAssembler.h:251
GmpFemAssemblerMatrixAdder * _matAdder
The configured adder object used to assemble matrices.
Definition gmpFemAssembler.h:275
int maxElementDof() const
Returns the maximum number of degrees of freedom used by a physics/element type.
Definition gmpFemAssembler.h:130
int tgi(int node) const
Translate Ghost Index - An auxiliary function that given a mesh node index, whose value might be a gh...
Definition gmpFemAssembler.h:245
Interface for an object responsible for assemblying local matrices into global matrices....
Definition gmpFemAssemblerAdder.h:43
Basic interface for defining the rules used to combine information from multiple matrices into a sing...
Definition gmpFemAssemblerCombiner.h:34
Interface for an object responsible for assemblying local vectors into global vectors....
Definition gmpFemAssemblerAdder.h:65
Basic interface for defining the rules used to combine information from multiple vectors into a singl...
Definition gmpFemAssemblerCombiner.h:103
A lock manager to be used by GmpFemAssemblerMatrixAdder and GmpFemAssemblerVectorAdder objects when w...
Definition gmpFemLocker.h:39
A convenience class that builds a GmMatrixSet with the types given by GmpFemMatrixTypes and also asso...
Definition gmpFemMatrixSet.h:59
Base interface class for FEM Physics type plugins.
Definition gmpFemPhysics.h:45
A convenience class that builds a GmVectorSet with the types given by GmpFemVectorTypes and also asso...
Definition gmpFemVectorSet.h:50
Declaration of useful configuration definitions for the plugin library.
Struct storing node metadata information.
Definition gmpFemAssembler.h:175
int _nFreeDof
The number of "free" degrees of freedom in _dofMap (values >= 0 && < MAX_DOF)
Definition gmpFemAssembler.h:182
QVector< int > _sv
List of indices in _stateVars for every non -1 value in _dofMap, organized so that the _ndof "free" d...
Definition gmpFemAssembler.h:189
QVector< int > _svOffset
Vector with size equal to _sv, storing the offset of this degree of freedom inside the state variable...
Definition gmpFemAssembler.h:201