FemProcess
The GeMA Fem Process Plugin
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GmpFemVectorSet Class Reference

A convenience class that builds a GmVectorSet with the types given by GmpFemVectorTypes and also associates a global vector to each element vector stored in the set (it can also associate a single global vector, dissociated with vector types) More...

#include <gmpFemVectorSet.h>

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

Classes

struct  GmpFemVectorTypeData
 Aux structure storing the vectors associated with a vector type. More...
 

Public Types

enum  GmpFemVectorMode { VECTOR_MATCH_MODE, VECTOR_SINGLE_MODE, VECTOR_SINGLE_DEBUG_MODE }
 Control mode specifying if the vector set should have one global vector per local vector (MATCH_MODE), a single global vector independing of the number of local vectors (SINGLE_MODE) or both: a single global vector + one global vector per configured local vector. This last mode is usefull for debuging purposes only. More...
 

Public Member Functions

 GmpFemVectorSet ()
 Constructor.
 
 ~GmpFemVectorSet ()
 Destructor.
 
void clear ()
 Clears the set, restoring it to the state after construction.
 
bool initTypes (GmpFemVectorMode mode, int numVectors,...)
 Informs the vector set about the local vector types that will be stored on it. It also creates the set of global vectors tied to the element vectors in the set. The number of effectively stored global vectors follows the given mode. More...
 
bool adjustSizes (int globalNumDofs, int globalNumFixedDofs, int maxElemDofs)
 Adjusts the sizes of local and global vectors according to the given number of dofs. Can be called more than once to update vector sizes on model changes. More...
 
void addTransposedDofVector (GmpFemVectorTypes type)
 Informs the set that the given type requires an additional vector to store transposed values when reducing a matrix due to fixed dofs. More...
 
void addSavedDofVector (GmpFemVectorTypes type)
 Informs the set that the given type requires an auxiliar vector to store saved values for fixed dofs. More...
 
void clearGlobalVectors ()
 Clears all ACTIVE global vectors (or the single vector), filling them with zeros. This includes eventual transposed, saved and debug print vectors.
 
GmVectorglobalVector (GmpFemVectorTypes type) const
 Returns a global Vector identified by its type in the set. More...
 
GmVectorglobalVectorFromIndex (int index) const
 Returns a global Vector identified by its index in the set. Can NOT be used for "single" or "single debug" modes.
 
GmVectorglobalTransposedDofVector (GmpFemVectorTypes type) const
 Returns the registered vector, identified by its type in the set, for storing transposed values when reducing a matrix due to fixed dofs. Will be equal to the global vector unless addTransposedDofVector() has been called for this type. More...
 
GmVectorglobalTransposedDofVectorFromIndex (int index) const
 Returns the registered vector, identified by its index in the set, for storing transposed values when reducing a matrix due to fixed dofs. Will be equal to the global vector unless addTransposedDofVector() has been called for this type. Can NOT be used for "single" or "single debug" modes.
 
GmVectorglobalSavedDofVector (GmpFemVectorTypes type) const
 Returns the registered vector, identified by its type in the set, for storing saved values for fixed dofs. Will be an empty vector unless addSavedDofVector() has been called for this type. More...
 
GmVectorglobalSavedDofVectorFromIndex (int index) const
 Returns the registered vector, identified by its index in the set, for storing saved values for fixed dofs. Will be an empty vector unless addSavedDofVector() has been called for this type. Can NOT be used for "single" or "single debug" modes.
 
GmVectorglobalDebugPrintVector (GmpFemVectorTypes type) const
 Returns the auxiliar vector used for storing global vectors matching local ones for debug printing purposes when operating in "single debug" mode or the regular vector when operating in "match" mode. More...
 
GmVectorglobalDebugPrintVectorFromIndex (int index) const
 Returns the auxiliar vector used for storing global vectors matching local ones for debug printing purposes when operating in "single debug" mode or the regular vector when operating in "match" mode.
 
GmpFemVectorMode mode () const
 Returns the mode defining the global vectors stored by the set.
 
GmpFemVectorTypes femTypeFromIndex (int index) const
 Given a vector index, returns its type as a GmpFemVectorTypes. Equivalent to GmVectorSet::typeFromIndex()
 
- Public Member Functions inherited from GmVectorSet
 GmVectorSet (int maxVectorTypes, const QStringList &typeNames)
 
bool init (int maxNodes, int numVectors,...)
 
bool adjustSizes (int maxNodes)
 
void clear ()
 
void prepareSet (int nnodes)
 
bool containsType (int type) const
 
void setTypeEnabled (int type, bool enabled)
 
int numEnabledTypes () const
 
GmVectorvector (int type)
 
GmVectoruseVector (int type)
 
GmVectoruseVector (int type, bool fill)
 
void setFilled (int type, bool filled)
 
bool filled (int type) const
 
int index (int type) const
 
int typeFromIndex (int index) const
 
QString typeName (int type) const
 
int numVectors () const
 
const GmVectorvectorFromIndex (int index) const
 
bool filledFromIndex (int index) const
 

Protected Member Functions

int tindex (GmpFemVectorTypes type) const
 Returns the index in _globalVectors for the given type, accounting for the selected vector mode.
 
- Protected Member Functions inherited from GmVectorSet
bool initTypes (int numVectors, va_list typeList)
 

Protected Attributes

GmpFemVectorMode _mode
 The mode defining how many global vectors are stored.
 
GmpFemVectorTypeData_globalVectors
 Vector storing data for global vectors. Will store one data set per included type in the vector set when _mode equals VECTOR_MATCH_MODE or a single entry otherwise (even in single debug mode).
 
GmVector_printVectors
 Vector with debug global vectors associated to element local vectors when _mode equals VECTOR_SINGLE_DEBUG_MODE.
 
- Protected Attributes inherited from GmVectorSet
int _nTypes
 
int * _typeIndex
 
int * _indexType
 
bool * _typeEnabled
 
int _nEnabled
 
QStringList _typeNames
 
int _nVectors
 
int _maxNodes
 
GmTLBuffer< double, true > _vectorMemory
 
GmTLBuffer< GmVector, true > _vectors
 
GmTLBuffer< bool, true > _filled
 

Detailed Description

A convenience class that builds a GmVectorSet with the types given by GmpFemVectorTypes and also associates a global vector to each element vector stored in the set (it can also associate a single global vector, dissociated with vector types)

Member Enumeration Documentation

◆ GmpFemVectorMode

Control mode specifying if the vector set should have one global vector per local vector (MATCH_MODE), a single global vector independing of the number of local vectors (SINGLE_MODE) or both: a single global vector + one global vector per configured local vector. This last mode is usefull for debuging purposes only.

Enumerator
VECTOR_MATCH_MODE 

Set stores one global vector per local vector.

VECTOR_SINGLE_MODE 

Set stores a single "equivalent" global vector.

VECTOR_SINGLE_DEBUG_MODE 

Set stores an "equivalent" global vector + another vector per local vector for debug purposes.

Member Function Documentation

◆ addSavedDofVector()

void GmpFemVectorSet::addSavedDofVector ( GmpFemVectorTypes  type)

Informs the set that the given type requires an auxiliar vector to store saved values for fixed dofs.

The vector will have a size equal to the number of fixed dofs informed in the call to adjustSizes().

This function should be called after initTypes() but before calling adjustSizes().

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.

◆ addTransposedDofVector()

void GmpFemVectorSet::addTransposedDofVector ( GmpFemVectorTypes  type)

Informs the set that the given type requires an additional vector to store transposed values when reducing a matrix due to fixed dofs.

The vector will have a size equal to the number of dofs informed in the call to adjustSizes().

This function should be called after initTypes() but before calling adjustSizes().

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.

◆ adjustSizes()

bool GmpFemVectorSet::adjustSizes ( int  globalNumDofs,
int  globalNumFixedDofs,
int  maxElemDofs 
)

Adjusts the sizes of local and global vectors according to the given number of dofs. Can be called more than once to update vector sizes on model changes.

Must be called at least once, after any calls to addTransposedDofVector() and/or addSavedDofVector().

Parameters
globalNumDofsThe number of free dofs in the system, defining the size of the global vectors.
globalNumFixedDofsThe number of fixed dofs in the system, defining the size of the saved dofs vectors (if any).
maxElemDofsThe maximum number of dofs needed by a model element.
Returns
Returns true when successfull, false on errors.

◆ globalDebugPrintVector()

GmVector& GmpFemVectorSet::globalDebugPrintVector ( GmpFemVectorTypes  type) const
inline

Returns the auxiliar vector used for storing global vectors matching local ones for debug printing purposes when operating in "single debug" mode or the regular vector when operating in "match" mode.

IMPORTANT: The type MUST belong to the set. Can be used only in "single debug" or "match" modes.

◆ globalSavedDofVector()

GmVector& GmpFemVectorSet::globalSavedDofVector ( GmpFemVectorTypes  type) const
inline

Returns the registered vector, identified by its type in the set, for storing saved values for fixed dofs. Will be an empty vector unless addSavedDofVector() has been called for this type.

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.

◆ globalTransposedDofVector()

GmVector& GmpFemVectorSet::globalTransposedDofVector ( GmpFemVectorTypes  type) const
inline

Returns the registered vector, identified by its type in the set, for storing transposed values when reducing a matrix due to fixed dofs. Will be equal to the global vector unless addTransposedDofVector() has been called for this type.

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.

◆ globalVector()

GmVector& GmpFemVectorSet::globalVector ( GmpFemVectorTypes  type) const
inline

Returns a global Vector 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 vector types added to the vector set. In single and single debug modes, type MUST be equal to GmpFemVector_Eq.

◆ initTypes()

bool GmpFemVectorSet::initTypes ( GmpFemVectorMode  mode,
int  numVectors,
  ... 
)

Informs the vector set about the local vector types that will be stored on it. It also creates the set of global vectors tied to the element vectors in the set. The number of effectively stored global vectors follows the given mode.

This function does NOT allocate memory for the vectors. It only prepares the global used structure. Memory allocation is deferred to the adjustSizes() call. Returns false on errors.

IMPORTANT: The vector set initialization must be followed, if needed, by optional calls to addTransposedDofVector() and / or addSavedDofVector() and by a required call to adjustSizes(). The order is important. Calls to the "add" functions MUST be made before adjusting the sizes.

Parameters
modeThe mode specifying which global vectors should be stored by the set in correspondence to the given set of local vectors.
numVectorsThe number of local vectors stored in the set
...The variable list of parameters should contain the types of the stored vectors. The number of parameters should be equal to numVectors. Each value should be a unique type number (between 0 and the maximum number of types given in the constructor)
Returns
Returns true when successfull, false on errors.

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