24#ifndef _GEMA_PLUGIN_FEM_MATRIX_SET_H_
25#define _GEMA_PLUGIN_FEM_MATRIX_SET_H_
79 bool adjustSizes(
int globalNumDofs,
int maxElemDofs,
bool sparseLayoutChanged);
85 void setNumThreads(
int nthreads) { assert(_nthreads >= -1); _nthreads = nthreads; }
89 void clearGlobalMatrices(
bool keepSparseLayout);
91 bool supportsBatchInsert()
const;
92 bool beginBatchInsert(
size_t expectedEntries = 0);
93 bool endBatchInsert(
bool discardData);
95 bool supportsSparseLayouts()
const;
97 bool emptyLayout()
const;
113 assert((_mode == MATRIX_MATCH_MODE &&
index(type) >= 0) || (_mode != MATRIX_MATCH_MODE && type ==
GmpFemMatrix_Eq));
114 return _globalMatrices[tindex(type)]._data;
120 assert(_mode == MATRIX_MATCH_MODE && index >= 0 && index < _nMatrices);
121 return _globalMatrices[
index]._data;
136 assert((_mode == MATRIX_MATCH_MODE &&
index(type) >= 0) || (_mode != MATRIX_MATCH_MODE && type ==
GmpFemMatrix_Eq));
137 return _globalMatrices[tindex(type)]._transposed;
149 assert(_mode == MATRIX_MATCH_MODE && index >= 0 && index < _nMatrices);
150 return _globalMatrices[
index]._transposed;
160 assert(_mode != MATRIX_SINGLE_MODE &&
index(type) >= 0);
161 return (_mode == MATRIX_MATCH_MODE) ? _globalMatrices[
index(type)]._data : _printMatrices[
index(type)];
169 assert(_mode != MATRIX_SINGLE_MODE && index >= 0 && index < _nMatrices);
170 return (_mode == MATRIX_MATCH_MODE) ? _globalMatrices[
index]._data : _printMatrices[
index];
bool initTypes(int numMatrices, va_list typeList)
int typeFromIndex(int index) const
bool adjustSizes(int maxNodes)
int index(int type) const
A convenience class that builds a GmMatrixSet with the types given by GmpFemMatrixTypes and also asso...
Definition gmpFemMatrixSet.h:59
int tindex(GmpFemMatrixTypes type) const
Returns the index in _globalMatrices for the given type, accounting for the selected matrix mode.
Definition gmpFemMatrixSet.h:183
bool _parallelSupport
Do solver matrices support parallel assembling ?
Definition gmpFemMatrixSet.h:189
GmpFemMatrixMode _mode
The mode defining how many global matrices are stored.
Definition gmpFemMatrixSet.h:185
int transposedDofVectorFromIndex(int index) const
Returns the registered vector type for storing transposed values when reducing a matrix due to fixed ...
Definition gmpFemMatrixSet.h:147
void setNumThreads(int nthreads)
Sets the number of threads used by sparse matrices in batch/layout operations. Default is the number ...
Definition gmpFemMatrixSet.h:85
int transposedDofVector(GmpFemMatrixTypes type) const
Returns the registered vector type for storing transposed values when reducing a matrix due to fixed ...
Definition gmpFemMatrixSet.h:134
GmSolverMatrix * globalDebugPrintMatrix(GmpFemMatrixTypes type) const
Returns the auxiliar matrix used for storing global matrices matching local ones for debug printing p...
Definition gmpFemMatrixSet.h:158
GmpFemMatrixMode mode() const
Returns the mode defining the global matrices stored by the set.
Definition gmpFemMatrixSet.h:174
GmpFemMatrixTypeData * _globalMatrices
Vector storing data for global matrices. Will store one data set per included type in the matrix set ...
Definition gmpFemMatrixSet.h:209
GmSolverMatrix * globalDebugPrintMatrixFromIndex(int index) const
Returns the auxiliar matrix used for storing global matrices matching local ones for debug printing p...
Definition gmpFemMatrixSet.h:167
GmSolverMatrix ** _printMatrices
Vector with debug global matrices associated to element local matrices when _mode equals MATRIX_SINGL...
Definition gmpFemMatrixSet.h:214
GmSolverMatrix * globalMatrix(GmpFemMatrixTypes type) const
Returns a global matrix identified by its type in the set.
Definition gmpFemMatrixSet.h:111
GmSolverMatrix * globalMatrixFromIndex(int index) const
Returns a global matrix identified by its index in the set. Can NOT be used for "single" or "single d...
Definition gmpFemMatrixSet.h:118
bool supportsParallelAdd() const
Returns true if the solver matrices support parallel assembling (supportedParallelAddMode() !...
Definition gmpFemMatrixSet.h:100
bool _needsLock
Do solver matrices needs external locking for parallel assembling ?
Definition gmpFemMatrixSet.h:190
GmpFemMatrixTypes femTypeFromIndex(int index) const
Given a matrix index, returns its type as a GmpFemMatrixTypes. Equivalent to GmMatrixSet::typeFromInd...
Definition gmpFemMatrixSet.h:177
GmpFemMatrixMode
Control mode specifying if the matrix set should have one global matrix per local matrix (MATCH_MODE)...
Definition gmpFemMatrixSet.h:70
@ MATRIX_SINGLE_MODE
Set stores a single "equivalent" global matrix.
Definition gmpFemMatrixSet.h:72
@ MATRIX_SINGLE_DEBUG_MODE
Set stores an "equivalent" global matrix + another matrix per local matrix for debug purposes.
Definition gmpFemMatrixSet.h:73
@ MATRIX_MATCH_MODE
Set stores one global matrix per local matrix.
Definition gmpFemMatrixSet.h:71
const GmNumSolver * _solver
The solver used to create global matrices.
Definition gmpFemMatrixSet.h:186
bool needsLocking() const
Returns true if the solver matrices needs external locking for parallel assembling (supportedParallel...
Definition gmpFemMatrixSet.h:103
int _nthreads
The configured number of threads that should be used by sparse matrices in batch mode/layout operatio...
Definition gmpFemMatrixSet.h:187
GmpFemMatrixTypes
Predefined names for matrices used in finite element solvers together with control procedures.
Definition gmpFemMatrixSet.h:40
@ GmpFemMatrix_Eq
The equivalent matrix when merging values into a single global matrix.
Definition gmpFemMatrixSet.h:41
@ GmpFemMatrix_C
The C matrix in the general equation M u" + C u' + K u = f (u" = d2u/dt2)
Definition gmpFemMatrixSet.h:43
@ GmpFemMatrix_K
The K matrix in the general equation M u" + C u' + K u = f (u' = du/dt)
Definition gmpFemMatrixSet.h:42
@ GmpFemMatrix_Keq
The Keq matrix is the equivalent stifness matrix (left hand side matrix)
Definition gmpFemMatrixSet.h:44
Declaration of useful configuration definitions for the plugin library.
Declaration of the GmpFemVectorSet class.
GmpFemVectorTypes
Predefined names for vectors used in finite element solvers together with control procedures.
Definition gmpFemVectorSet.h:33
Aux structure storing the matrix associated with a matrix type.
Definition gmpFemMatrixSet.h:194
~GmpFemMatrixTypeData()
Destructor.
Definition gmpFemMatrixSet.h:202
GmSolverMatrix * _data
The data matrix.
Definition gmpFemMatrixSet.h:195
GmpFemMatrixTypeData()
Constructor.
Definition gmpFemMatrixSet.h:199
int _transposed
The type of the associated transposed dofs vector or -1 if no vector was associated with this type.
Definition gmpFemMatrixSet.h:196