![]() |
FemProcess
The GeMA Fem Process Plugin
|
A convenience class that builds a GmMatrixSet with the types given by GmpFemMatrixTypes and also associates a global matrix to each element matrix stored in the set (it can also associate a single global matrix, dissociated with matrix types) More...
#include <gmpFemMatrixSet.h>
Classes | |
struct | GmpFemMatrixTypeData |
Aux structure storing the matrix associated with a matrix type. More... | |
Public Types | |
enum | GmpFemMatrixMode { MATRIX_MATCH_MODE, MATRIX_SINGLE_MODE, MATRIX_SINGLE_DEBUG_MODE } |
Control mode specifying if the matrix set should have one global matrix per local matrix (MATCH_MODE), a single global matrix independing of the number of local matrices (SINGLE_MODE) or both: a single global matrix + one global matrix per configured local matrix. This last mode is usefull for debuging purposes only. More... | |
Public Member Functions | |
GmpFemMatrixSet () | |
Constructor. | |
~GmpFemMatrixSet () | |
Destructor. | |
void | clear () |
Clears the set, restoring it to the state after construction. | |
bool | initTypes (const GmNumSolver *solver, GmpFemMatrixMode mode, int numMatrices,...) |
Informs the matrix set about the local matrix types that will be stored on it. It also creates the set of global matrices tied to the element matrices in the set. The number of effectively stored global matrices follows the given mode. More... | |
bool | adjustSizes (int globalNumDofs, int maxElemDofs, bool sparseLayoutChanged) |
Adjusts the sizes of local and global matrices according to the given number of dofs. Can be called more than once to update matrix sizes on model changes. More... | |
void | setNumThreads (int nthreads) |
Sets the number of threads used by sparse matrices in batch/layout operations. Default is the number of threads configured by the thread manager (-1). Should be called before calls to adjustSizes(). | |
void | setTransposedDofVector (GmpFemMatrixTypes type, GmpFemVectorTypes vectorType) |
Registers the vector type that should be used to store transposed values when reducing a matrix of the given matrix type, due to fixed dofs. More... | |
void | clearGlobalMatrices (bool keepSparseLayout) |
Clears global matrices (or the single matrix), filling them with zeros and marking them as symmetric. More... | |
bool | supportsBatchInsert () const |
Returns true if the matrix set supports batch inserts. | |
bool | beginBatchInsert (size_t expectedEntries=0) |
Initializes a batch insert process for all ACTIVE global matrices + the print matrices if necessary. More... | |
bool | endBatchInsert (bool discardData) |
Finalizes a batch insert process for all ACTIVE global matrices + the print matrices if necessary. More... | |
bool | supportsSparseLayouts () const |
Returns true if the matrix set supports sparse layouts. | |
GmSparseMatrixLayoutBuilder * | layoutBuilder () const |
If the matrices in this matrix set support sparse layouts, returns a layout builder object capable of filling the shared matrices layout. Otherwise, returns NULL. | |
bool | emptyLayout () const |
If the matrices in this matrix set support sparse layouts and the shared layout is empty, returns true. Otherwise, returns false. | |
bool | supportsParallelAdd () const |
Returns true if the solver matrices support parallel assembling (supportedParallelAddMode() != NO_SUPPORT) | |
bool | needsLocking () const |
Returns true if the solver matrices needs external locking for parallel assembling (supportedParallelAddMode() == REENTRANT_SUPPORT) | |
GmSolverMatrix * | globalMatrix (GmpFemMatrixTypes type) const |
Returns a global matrix identified by its type in the set. More... | |
GmSolverMatrix * | globalMatrixFromIndex (int index) const |
Returns a global matrix identified by its index in the set. Can NOT be used for "single" or "single debug" modes. | |
int | transposedDofVector (GmpFemMatrixTypes type) const |
Returns the registered vector type for storing transposed values when reducing a matrix due to fixed dofs for the given matrix type. Will be equal to the value given in the call to setTransposedDofVector() or -1 if that function was not called. More... | |
int | transposedDofVectorFromIndex (int index) const |
Returns the registered vector type for storing transposed values when reducing a matrix due to fixed dofs for the given matrix index. Will be equal to the value given in the call to setTransposedDofVector() or -1 if that function was not called. Can NOT be used for "single" or "single debug" modes. More... | |
GmSolverMatrix * | globalDebugPrintMatrix (GmpFemMatrixTypes type) const |
Returns the auxiliar matrix used for storing global matrices matching local ones for debug printing purposes when operating in "single debug" mode or the regular matrix when operating in "match" mode. More... | |
GmSolverMatrix * | globalDebugPrintMatrixFromIndex (int index) const |
Returns the auxiliar matrix used for storing global matrices matching local ones for debug printing purposes when operating in "single debug" mode or the regular matrix when operating in "match" mode. | |
GmpFemMatrixMode | mode () const |
Returns the mode defining the global matrices stored by the set. | |
GmpFemMatrixTypes | femTypeFromIndex (int index) const |
Given a matrix index, returns its type as a GmpFemMatrixTypes. Equivalent to GmMatrixSet::typeFromIndex() | |
![]() | |
GmMatrixSet (int maxMatrixTypes, const QStringList &typeNames) | |
bool | init (int maxNodes, int numMatrices,...) |
bool | adjustSizes (int maxNodes) |
void | clear () |
void | prepareSet (int nnodes) |
bool | containsType (int type) const |
void | setTypeEnabled (int type, bool enabled) |
int | numEnabledTypes () const |
GmMatrix & | matrix (int type) |
GmMatrix & | useMatrix (int type) |
GmMatrix & | useMatrix (int type, bool fill, bool sym) |
void | setSymmetric (int type, bool symmetric) |
void | setFilled (int type, bool filled) |
bool | symmetric (int type) const |
bool | filledSymmetric () const |
bool | filled (int type) const |
int | index (int type) const |
int | typeFromIndex (int index) const |
QString | typeName (int type) const |
int | numMatrices () const |
const GmMatrix & | matrixFromIndex (int index) const |
bool | symmetricFromIndex (int index) const |
bool | filledFromIndex (int index) const |
Protected Member Functions | |
int | tindex (GmpFemMatrixTypes type) const |
Returns the index in _globalMatrices for the given type, accounting for the selected matrix mode. | |
![]() | |
bool | initTypes (int numMatrices, va_list typeList) |
Protected Attributes | |
GmpFemMatrixMode | _mode |
The mode defining how many global matrices are stored. | |
const GmNumSolver * | _solver |
The solver used to create global matrices. | |
int | _nthreads |
The configured number of threads that should be used by sparse matrices in batch mode/layout operations. | |
bool | _parallelSupport |
Do solver matrices support parallel assembling ? | |
bool | _needsLock |
Do solver matrices needs external locking for parallel assembling ? | |
GmpFemMatrixTypeData * | _globalMatrices |
Vector storing data for global matrices. Will store one data set per included type in the matrix set when _mode equals MATRIX_MATCH_MODE or a single entry otherwise (even in single debug mode). | |
GmSolverMatrix ** | _printMatrices |
Vector with debug global matrices associated to element local matrices when _mode equals MATRIX_SINGLE_DEBUG_MODE. | |
![]() | |
int | _nTypes |
int * | _typeIndex |
int * | _indexType |
bool * | _typeEnabled |
int | _nEnabled |
QStringList | _typeNames |
int | _nMatrices |
int | _maxNodes |
GmTLBuffer< double, true > | _matrixMemory |
GmTLBuffer< GmMatrix, true > | _matrices |
GmTLBuffer< bool, true > | _symmetric |
GmTLBuffer< bool, true > | _filled |
A convenience class that builds a GmMatrixSet with the types given by GmpFemMatrixTypes and also associates a global matrix to each element matrix stored in the set (it can also associate a single global matrix, dissociated with matrix types)
If the type of global matrices returned by the numeric solver supports sparse layouts, they will be used and shared between all global matrices in the set.
Control mode specifying if the matrix set should have one global matrix per local matrix (MATCH_MODE), a single global matrix independing of the number of local matrices (SINGLE_MODE) or both: a single global matrix + one global matrix per configured local matrix. This last mode is usefull for debuging purposes only.
bool GmpFemMatrixSet::adjustSizes | ( | int | globalNumDofs, |
int | maxElemDofs, | ||
bool | sparseLayoutChanged | ||
) |
Adjusts the sizes of local and global matrices according to the given number of dofs. Can be called more than once to update matrix sizes on model changes.
Must be called at least once. If the number of dofs hasn't changed and the layout also hasn't changed, the matrix remains the same. Otherwise it will be cleared and layout data removed.
globalNumDofs | The number of free dofs in the system, defining the size of the global matrices. |
maxElemDofs | The maximum number of dofs needed by a model element. |
sparseLayoutChanged | If true means that the global sparse matrix layout (position of non zero entries) has changed |
bool GmpFemMatrixSet::beginBatchInsert | ( | size_t | expectedEntries = 0 | ) |
Initializes a batch insert process for all ACTIVE global matrices + the print matrices if necessary.
If the set does not support batch insert, does nothing (but returns true).
void GmpFemMatrixSet::clearGlobalMatrices | ( | bool | keepSparseLayout | ) |
Clears global matrices (or the single matrix), filling them with zeros and marking them as symmetric.
If keepSparseLayout is set to true or if the matrix type does not support layouts, only ACTIVE matrices will be cleared and sparse layout information will be kept (if any). Otherwise, all matrices will be cleared and layout information will be removed.
bool GmpFemMatrixSet::endBatchInsert | ( | bool | discardData | ) |
Finalizes a batch insert process for all ACTIVE global matrices + the print matrices if necessary.
If the set does not support batch insert, does nothing (but returns true). If discardData is set to true, the assembly process did not finished well and the current data is incomplete and should be discarded.
|
inline |
Returns the auxiliar matrix used for storing global matrices matching local ones for debug printing purposes when operating in "single debug" mode or the regular matrix when operating in "match" mode.
IMPORTANT: The type MUST belong to the set. Can be used only in "single debug" mode or "match" modes.
|
inline |
Returns a global matrix identified by its type in the set.
IMPORTANT: The type MUST belong to the set. In match mode, it can be any of the local matrix types added to the matrix set. In single and single debug modes, type MUST be equal to GmpFemMatrix_Eq.
bool GmpFemMatrixSet::initTypes | ( | const GmNumSolver * | solver, |
GmpFemMatrixMode | mode, | ||
int | numMatrices, | ||
... | |||
) |
Informs the matrix set about the local matrix types that will be stored on it. It also creates the set of global matrices tied to the element matrices in the set. The number of effectively stored global matrices follows the given mode.
This function does NOT allocate memory for the matrices. It only prepares the global used structure. Memory allocation is deferred to the adjustSizes() call. Returns false on errors.
IMPORTANT: The matrix set initialization must be followed by a call to adjustSizes().
mode | The mode specifying which global matrices should be stored by the set in correspondence to the given set of local matrices. |
numMatrices | The number of local matrices stored in the set |
... | The variable list of parameters should contain the types of the stored matrices. The number of parameters should be equal to numMatrices. Each value should be a unique type number (between 0 and the maximum number of types given in the constructor) |
void GmpFemMatrixSet::setTransposedDofVector | ( | GmpFemMatrixTypes | type, |
GmpFemVectorTypes | vectorType | ||
) |
Registers the vector type that should be used to store transposed values when reducing a matrix of the given matrix type, due to fixed dofs.
IMPORTANT: The type MUST belong to the set. In match mode, it can be any of the local vector types added to the vector set. In single and single debug modes, type MUST be equal to GmpFemVector_Eq.
|
inline |
Returns the registered vector type for storing transposed values when reducing a matrix due to fixed dofs for the given matrix type. Will be equal to the value given in the call to setTransposedDofVector() or -1 if that function was not called.
If the function result is different from -1, it can be safely casted to a GmpFemVectorTypes.
IMPORTANT: The type MUST belong to the set. In match mode, it can be any of the local matrix types added to the matrix set. In single and single debug modes, type MUST be equal to GmpFemMatrix_Eq.
|
inline |
Returns the registered vector type for storing transposed values when reducing a matrix due to fixed dofs for the given matrix index. Will be equal to the value given in the call to setTransposedDofVector() or -1 if that function was not called. Can NOT be used for "single" or "single debug" modes.
If the function result is different from -1, it can be safely casted to a GmpFemVectorTypes.