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);
104 void setPartitions(
int npart);
107 int numDof()
const {
return _nMatrixDof; }
116 int numFixedDof()
const {
return _nTotalDof - _nMatrixDof; }
118 int numElementDof(
const GmElement* e,
int physicsIndex)
const;
123 int dofIndex (
int node,
int dof)
const;
127 double dofFixedValue(
int index) { assert(index < 0);
return _fixedValues[abs(index+1)]; }
130 int svGroupId(
int globalIndex);
138 bool beginAssembly();
139 bool endAssembly(
bool discardData =
false);
140 const int* addElementData(
const GmElement* e,
int physicsIndex,
147 void saveResultData(
const GmVector& data,
double lambda = 1.0);
151 void loadResultData(
GmVector& data);
155 void remapData(
GmVector& data,
double newValue = 0.0)
const;
156 void remapData(
const GmVector& oldData,
GmVector& newData,
double newValue = 0.0)
const;
161 #ifdef TRACK_ASSEMBLER_TIME 162 void resetTimeData() { _elapsedTime = 0; }
163 void printTimeData(
const GmLogCategory& logger) { gmTimeMsg(logger,
QObject::tr(
" *** Assembler merge total time: %1 s").arg(_elapsedTime/1.0e9)); }
200 bool addMappedMatrixData(
int ndof,
const int* indexMap,
const GmDofMap* dofMap,
207 bool initTranslationStructures(
bool enableFastUpdate,
bool createReverseMapping,
QString& err);
209 void initDofToNodeIndex(
int firstNode);
210 void initUpdateDofPhysicsList();
216 bool saveNonConstantPhysics,
QString& err);
219 int fecthDofStatevar (
int dof);
220 void fillFixedData(
double* data,
int size);
222 bool updateFixedBcValues(
QString& err);
224 bool nodesAdded,
int updateFixedMode,
bool updateUnits,
QString& err);
230 bool useOldFixedDofMap,
int* nFreeAdded,
int* nFixedAdded,
QString& err);
232 int extendedDofIndex(
int node,
int dof)
const;
241 int tgi(
int node)
const {
return _mesh->toLinearGhostIndex(node); }
244 int nodeIndex(
int node)
const {
return _nodeIndex[tgi(node)]; }
247 void setNodeIndex(
int node,
int baseIndex) { _nodeIndex[tgi(node)] = baseIndex; }
250 void incNodeIndex(
int node,
int offset) { _nodeIndex[tgi(node)] += offset; }
338 #ifdef TRACK_ASSEMBLER_TIME 342 #if defined ENABLE_TESTS || defined ENABLE_ASSEMBLER_TESTS 343 void validateInternalStructure()
const;
QMap< int, int > _dofToSvCache
A map keyed by dof number storing the corresponding entry in _stateVars. This map holds values outsid...
Definition: gmpFemAssembler.h:316
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:185
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:250
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:294
int numTotalDof() const
Returns the total number of the system degrees of freedom, including fixed ones. This value will be e...
Definition: gmpFemAssembler.h:113
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:281
GmpFemMatrixSet * _matSet
The matrix set used together with the assembler.
Definition: gmpFemAssembler.h:264
int _nTotalDof
The total number of degrees of freedom of the system, including fixed ones.
Definition: gmpFemAssembler.h:279
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:241
The assembler will support dofs in ghost nodes.
Definition: gmpFemAssembler.h:74
Unit timeUnit() const
Returns the unit in which time is handled by the physics.
Definition: gmpFemAssembler.h:136
QVector< double > _oldFixedValues
A vector storing the values in _fixedValues before the last call to update()
Definition: gmpFemAssembler.h:287
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:259
A convenience class that builds a GmVectorSet with the types given by GmpFemVectorTypes and also asso...
Definition: gmpFemVectorSet.h:47
QString tr(const char *sourceText, const char *disambiguation, int n)
A convenience class that builds a GmMatrixSet with the types given by GmpFemMatrixTypes and also asso...
Definition: gmpFemMatrixSet.h:56
QVector< TemplateData > _templateList
A list with node metadata information for every node template type.
Definition: gmpFemAssembler.h:289
QList< GmpFemPhysics * > _nonConstantDofPhysics
A list with the set of physics that should be queried when updating dofs if _updateDofMode == FAST_UP...
Definition: gmpFemAssembler.h:305
GmpFemAssemblerMatrixAdder * _debugMatAdder
The configured adder object used to assemble matrices in "single debug" mode.
Definition: gmpFemAssembler.h:272
No fixed dof handling. The full matrix will be generated.
Definition: gmpFemAssembler.h:68
bool fastUpdate() const
Returns whether the assembler was initialized with the fast update option turned on or off.
Definition: gmpFemAssembler.h:159
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:253
GhostDofMode
Definition: gmpFemAssembler.h:72
int _nNodes
The number of nodes in _nodeIndex & _nodeTemplateIndex. Will be equal to _mesh->numNodes() or _mesh->...
Definition: gmpFemAssembler.h:282
GmpFemVectorSet * _vecSet
The vector set used together with the assembler.
Definition: gmpFemAssembler.h:265
Basic interface for defining the rules used to combine information from multiple matrices into a sing...
Definition: gmpFemAssemblerCombiner.h:33
bool _hasRemapInfo
Is remap info available (The last call to update included the SAVE_MAPPING_INFO flag)?...
Definition: gmpFemAssembler.h:329
QVector< int > _dofNode
A reverse vector mapping, storing for each dof in the assembled matrix the node it belongs to,...
Definition: gmpFemAssembler.h:284
Fixed dofs are removed from the matrix.
Definition: gmpFemAssembler.h:69
int _nMatrixDof
The number of degrees of freedom of the assembled matrix.
Definition: gmpFemAssembler.h:278
QVector< int > _svOffset
Vector with size equal to _sv, storing the offset of this degree of freedom inside the state variable...
Definition: gmpFemAssembler.h:197
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:256
Struct storing node metadata information.
Definition: gmpFemAssembler.h:170
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:247
GmTLBuffer< int, true > _elemIndexMap
An auxiliar vector used by addElementMatrix, with size equal to the biggest local matrix number of do...
Definition: gmpFemAssembler.h:299
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:133
unsigned char * _nodeTemplateIndex
A vector storing for each mesh node its dof template index.
Definition: gmpFemAssembler.h:285
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:311
QVector< double > _fixedValues
A vector storing the values of the fixed dofs with size equal to _nTotalDof - _nMatrixDof.
Definition: gmpFemAssembler.h:286
FixedDofMode _fixedDofMode
How does the assembler treats fixed degrees of freedom.
Definition: gmpFemAssembler.h:263
int _nt
The number of threads that should be used by the assembler in OMP operations.
Definition: gmpFemAssembler.h:276
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:280
Interface for an object responsible for assemblying local matrices into global matrices....
Definition: gmpFemAssemblerAdder.h:42
int _nFreeDof
The number of "free" degrees of freedom in _dofMap (values >= 0 && < MAX_DOF)
Definition: gmpFemAssembler.h:178
A lock manager to be used by GmpFemAssemblerMatrixAdder and GmpFemAssemblerVectorAdder objects when w...
Definition: gmpFemLocker.h:38
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:244
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:127
UpdateMode
Definition: gmpFemAssembler.h:79
int numDof() const
Returns the number of degrees of freedom of the global assembled matrix.
Definition: gmpFemAssembler.h:107
GmpFemAssemblerVectorAdder * _debugVecAdder
The configured adder object used to assemble vectors in "single debug" mode.
Definition: gmpFemAssembler.h:273
Basic interface for defining the rules used to combine information from multiple vectors into a singl...
Definition: gmpFemAssemblerCombiner.h:102
A class responsible for assembling the global stiffness matrix, handling multiple physics with possib...
Definition: gmpFemAssembler.h:62
GmpFemAssemblerMatrixAdder * _matAdder
The configured adder object used to assemble matrices.
Definition: gmpFemAssembler.h:269
int maxElementDof() const
Returns the maximum number of degrees of freedom used by a physics/element type.
Definition: gmpFemAssembler.h:121
bool _ghostEnabled
Should the assembler handle ghost nodes?
Definition: gmpFemAssembler.h:277
QVector< int > _remapInfo
The remap vector storing information on how to translate values from a vector prior to an update() ca...
Definition: gmpFemAssembler.h:336
int * _nodeIndex
A vector storing for each mesh node its base index in the matrix.
Definition: gmpFemAssembler.h:283
const QList< GmpFemPhysics * > & _physicsList
List of physics that will cooperate to generate the global matrix.
Definition: gmpFemAssembler.h:262
FixedDofMode
Definition: gmpFemAssembler.h:66
QHash< int, int > _fixedNodeIndex
Map determining the base index of a node in the _fixedValues vector.
Definition: gmpFemAssembler.h:288
GmpFemAssemblerVectorAdder * _vecAdder
The configured adder object used to assemble vectors.
Definition: gmpFemAssembler.h:270
Base interface class for FEM Physics type plugins.
Definition: gmpFemPhysics.h:44
QList< GmpFemPhysics * > _nonConstantFixedValuesPhysics
A list with the set of physics whose fixed boundary condition values are not constant.
Definition: gmpFemAssembler.h:302
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
Declaration of usefull configuration definitions for the plugin library.
int _nthreads
The number of threads configured for the assembler. Can be any value >= -1.
Definition: gmpFemAssembler.h:275
The assembler will not support dofs in ghost nodes.
Definition: gmpFemAssembler.h:75
Interface for an object responsible for assemblying local vectors into global vectors....
Definition: gmpFemAssemblerAdder.h:64
GmElementMesh * _mesh
The mesh.
Definition: gmpFemAssembler.h:261
Unit _timeUnit
The time unit used by all the physics.
Definition: gmpFemAssembler.h:324
GmpFemLocker * _locker
The locker object used when adding values to the global matrices/vectors in multiple threads.
Definition: gmpFemAssembler.h:267
Unit * _dofUnitList
A vector keyed by dof number, with size equal to GM_MAX_DOF, storing the corresponding dof unit....
Definition: gmpFemAssembler.h:321