IFEM  90A354
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
AlgEqSystem Class Reference

Class for storage of general algebraic system of equations. More...

#include <AlgEqSystem.h>

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

Classes

struct  SysMatrixPair
 Struct defining a coefficient matrix and an associated RHS-vector. More...
 

Public Member Functions

 AlgEqSystem (const SAM &s, const ProcessAdm *a=nullptr)
 The constructor sets its reference to SAM and ProcessAdm objects.
 
 AlgEqSystem (const AlgEqSystem &a)
 Copy constructor.
 
virtual ~AlgEqSystem ()
 The destructor frees the dynamically allocated objects.
 
AlgEqSystemoperator= (const AlgEqSystem &s)
 Assignment operator.
 
AlgEqSystemcopy (const AlgEqSystem &that)
 Makes *this a copy of that.
 
AlgEqSystemadd (const AlgEqSystem &that)
 Adds that to *this (assuming similar structure).
 
bool init (LinAlg::MatrixType mtype, const LinSolParams *spar=nullptr, size_t nmat=1, size_t nvec=1, size_t nscl=0, bool reactions=false, int num_threads_SLU=1, bool forcePreAss=false)
 Allocates the system matrices of the specified format. More...
 
void clear ()
 Erases the system matrices and frees dynamically allocated storage.
 
bool setAssociatedVector (size_t imat, size_t ivec)
 Associates a system vector to a system matrix. More...
 
virtual void initialize (char initLHS)
 Initializes the system matrices to zero. More...
 
virtual bool finalize (bool newLHS)
 Finalizes the system matrices after element assembly. More...
 
virtual bool assemble (const LocalIntegral *elmObj, int elmId)
 Adds a set of element matrices into the algebraic equation system. More...
 
size_t getNoRHS () const
 Returns the number of right-hand-side vectors allocated.
 
const SAMgetSAM () const
 Returns a const reference to the SAM object.
 
SystemMatrixgetMatrix (size_t i=0)
 Returns the i'th matrix of the equation system.
 
SystemVectorgetVector (size_t i=0)
 Returns the i'th right-hand-side vector of the equation system.
 
double getScalar (size_t i=0)
 Returns the i'th scalar quantity.
 
void addScalar (double s, size_t i=0)
 Adds the value s to the i'th scalar quantity.
 
const std::vector< double > & getScalars () const
 Returns a const reference to the assembled scalars.
 
const std::vector< double > * getReactions () const
 Returns a pointer to the nodal reaction forces, if any.
 
bool staticCondensation (Matrix &Ared, Vector &bred, const std::vector< int > &extNodes, size_t imat=0, const char *recmatFile=nullptr) const
 Performs static condensation of the indicated equation system. More...
 
bool recoverInternals (const Matrix &Rmat, const std::vector< int > &extNodes, const Vector &xe, Vector &xFull) const
 Performs recovery of internal DOF values from the external DOFs. More...
 
- Public Member Functions inherited from GlobalIntegral
 GlobalIntegral ()
 The default constructor.
 
virtual ~GlobalIntegral ()
 Empty destructor.
 
virtual bool threadSafe () const
 Returns true if all elements can be assembled in parallel.
 
virtual bool haveContributions (size_t, const std::vector< Property > &) const
 Returns false if no contributions from a specified patch.
 

Static Public Member Functions

static bool readRecoveryMatrix (Matrix &Rmat, const char *recmatFile)
 Reads the recovery matrix from file. More...
 

Private Attributes

std::vector< SysMatrixPairA
 The actual coefficient matrices.
 
std::vector< SystemVector * > b
 The actual right-hand-side vectors.
 
std::vector< double > c
 Global scalar quantities.
 
std::vector< double > * d
 Multithreading buffer for the scalar values.
 
std::vector< double > R
 Nodal reaction forces.
 
const SAMsam
 Data for FE assembly management.
 
const ProcessAdmadm
 Parallel process administrator.
 

Detailed Description

Class for storage of general algebraic system of equations.

Member Function Documentation

◆ assemble()

bool AlgEqSystem::assemble ( const LocalIntegral elmObj,
int  elmId 
)
virtual

Adds a set of element matrices into the algebraic equation system.

Parameters
[in]elmObjPointer to the element matrices to add into *this
[in]elmIdGlobal number of the element associated with *elmObj

Reimplemented from GlobalIntegral.

References A, ElmMats::A, SAM::assembleSystem(), b, ElmMats::b, c, ElmMats::c, d, ElmMats::empty(), ElmMats::getNewtonMatrix(), ElmMats::getRHSVector(), ElmMats::printMat(), ElmMats::printScl(), ElmMats::printVec(), R, ElmMats::rhsOnly, sam, and ElmMats::withLHS.

Referenced by SIMmodal::assembleModalSystem().

◆ finalize()

bool AlgEqSystem::finalize ( bool  newLHS)
virtual

Finalizes the system matrices after element assembly.

Parameters
[in]newLHSIf false, only right-hand-side vectors was assembled

Reimplemented from GlobalIntegral.

References A, b, c, d, SAM::expandSolution(), SAM::printVector(), and sam.

Referenced by SIMmodal::assembleModalSystem(), and SIMbase::assembleSystem().

◆ init()

bool AlgEqSystem::init ( LinAlg::MatrixType  mtype,
const LinSolParams spar = nullptr,
size_t  nmat = 1,
size_t  nvec = 1,
size_t  nscl = 0,
bool  reactions = false,
int  num_threads_SLU = 1,
bool  forcePreAss = false 
)

Allocates the system matrices of the specified format.

Parameters
[in]mtypeThe matrix format to use for all matrices
[in]sparInput parameters for the linear equation solver
[in]nmatNumber of system matrices to allocate
[in]nvecNumber of system vectors to allocate
[in]nsclNumber of scalar quantities to allocate
[in]reactionsIf false, no reaction forces will be computed
[in]num_threads_SLUNumber of threads for SuperLU_MT
[in]forcePreAssIf true, force preassembly for sparse matrices

References A, adm, b, c, SystemMatrix::create(), SystemVector::create(), SAM::getNoEquations(), SAM::getNoSpecifiedDOFs(), PROFILE, R, and sam.

Referenced by SIMmodal::assembleModalSystem(), and SIMbase::initSystem().

◆ initialize()

void AlgEqSystem::initialize ( char  initLHS)
virtual

Initializes the system matrices to zero.

Parameters
[in]initLHSIf false, only initialize right-hand-side vectors

Reimplemented from GlobalIntegral.

References A, b, c, d, and R.

Referenced by SIMmodal::assembleModalSystem(), and SIMbase::assembleSystem().

◆ readRecoveryMatrix()

bool AlgEqSystem::readRecoveryMatrix ( Matrix Rmat,
const char *  recmatFile 
)
static

Reads the recovery matrix from file.

Parameters
[out]RmatThe recovery matrix, xi = Rmat*xe
[in]recmatFileName of recovery matrix file

References c, utl::matrixBase< T >::ptr(), and utl::matrix< T >::resize().

◆ recoverInternals()

bool AlgEqSystem::recoverInternals ( const Matrix Rmat,
const std::vector< int > &  extNodes,
const Vector xe,
Vector xFull 
) const

Performs recovery of internal DOF values from the external DOFs.

Parameters
[in]RmatRecovery matrix
[in]extNodesList of external nodes whose DOFs were retained
[in]xeExternal DOF values
[out]xFullExpanded solution vector with all DOFs

References SAM::expandVector(), SAM::getNodeEqns(), SAM::getNoEquations(), utl::matrix< T >::multiply(), sam, and utl::vector< T >::size().

◆ setAssociatedVector()

bool AlgEqSystem::setAssociatedVector ( size_t  imat,
size_t  ivec 
)

Associates a system vector to a system matrix.

Parameters
[in]imatIndex of a coefficient matrix
[in]ivecIndex of the system vector to associate with the matrix

The purpose of this method is to define which right-hand-side vector (if any) should receive contributions when assembling a coefficient matrix, when the system to be assembled has explicit constraint equations for which the dependent DOFs have been eliminated.

References A, and b.

Referenced by SIMbase::setAssociatedRHS().

◆ staticCondensation()

bool AlgEqSystem::staticCondensation ( Matrix Ared,
Vector bred,
const std::vector< int > &  extNodes,
size_t  imat = 0,
const char *  recmatFile = nullptr 
) const

Performs static condensation of the indicated equation system.

Parameters
[out]AredReduced System matrix
[out]bredAssociated reduced right-hand-side vector
[in]extNodesList of external nodes whose DOFs to retain
[in]imatIndex of the system matrix-vector pair to condensate
[in]recmatFileName of recovery matrix file

References A, IFEM::cout, utl::matrix< T >::fillColumn(), SAM::getNodeEqns(), utl::vector< T >::ptr(), utl::matrix< T >::resize(), SparseMatrix::rows(), sam, eig::solve(), and SparseMatrix::split().


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