|
IFEM
90A354
|
Base class for representing a system matrix on different formats. More...
#include <SystemMatrix.h>


Public Member Functions | |
| virtual | ~SystemMatrix () |
| Empty destructor. | |
| virtual LinAlg::MatrixType | getType () const =0 |
| Returns the matrix type. | |
| virtual SystemMatrix * | copy () const =0 |
| Creates a copy of the system matrix and returns a pointer to it. | |
| virtual bool | lockPattern (bool) |
| Locks or unlocks the sparsity pattern. | |
| virtual bool | empty () const |
| Checks if the matrix is empty. | |
| bool | isZero () const |
| Checks if the matrix have no non-zero contributions. | |
| virtual size_t | dim (int idim=1) const =0 |
| Returns the dimension of the system matrix. | |
| virtual void | initAssembly (const SAM &sam, char=0)=0 |
| Initializes the element assembly process. More... | |
| virtual void | preAssemble (const std::vector< IntVec > &, size_t=0) |
| Initializes the element sparsity pattern based on node connections. | |
| virtual void | compressPattern () |
| Compresses the sparsity pattern. | |
| virtual void | init ()=0 |
| Initializes the matrix to zero assuming it is properly dimensioned. | |
| void | initNonZeroEqs () |
| Initializes the nonZeroEqs flags. | |
| bool | flagNonZeroEqs (const IntVec &meq={}) |
| Flags the equations meq as pivots with non-zero contributions. | |
| bool | flagNonZeroEqs (const SystemMatrix &B) |
| Flags the non-zero equations from B as non-zero pivots in this. | |
| virtual bool | endAssembly () |
| Finalizes the system matrix assembly. More... | |
| virtual bool | assemble (const Matrix &eM, const SAM &sam, int e)=0 |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | assemble (const Matrix &eM, const SAM &sam, SystemVector &B, int e)=0 |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | assemble (const Matrix &eM, const SAM &sam, SystemVector &B, const IntVec &meq)=0 |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | assemble (const Matrix &eM, const IntVec &meq)=0 |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | augment (const SystemMatrix &, size_t, size_t) |
| Augments a similar matrix symmetrically to the current matrix. | |
| virtual bool | truncate (Real=Real(1.0e-16)) |
| Truncates all small matrix elements to zero. | |
| virtual void | mult (Real alpha)=0 |
| Multiplication with a scalar. | |
| virtual bool | add (const SystemMatrix &, Real=Real(1)) |
| Adds a matrix with similar structure to the current matrix. | |
| virtual bool | add (Real, int=0) |
| Adds a constant to the diagonal of current matrix. | |
| virtual bool | multiply (const SystemVector &, SystemVector &) const |
| Performs a matrix-vector multiplication. | |
| virtual bool | solve (SystemVector &b, Real *rc=nullptr)=0 |
| Solves the linear system of equations for a given right-hand-side. More... | |
| virtual bool | solve (const SystemVector &b, SystemVector &x) |
| Solves the linear system of equations for a given right-hand-side. More... | |
| virtual Real | Linfnorm () const =0 |
| Returns the L-infinity norm of the matrix. | |
| virtual void | dump (std::ostream &, LinAlg::StorageFormat, const char *=nullptr) |
| Dumps the system matrix on a specified format. | |
| virtual void | dump (const char *fileName, std::streamsize precision=0, LinAlg::StorageFormat format=LinAlg::FLAT) |
| Dumps the system matrix to specified file. | |
| virtual bool | load (const char *, bool=false) |
| Loads the system matrix from specified file. | |
| StdVector | operator* (const SystemVector &b) const |
| Calculates a matrix-vector product. | |
| StdVector | operator/ (const SystemVector &b) |
| Solves a linear equation system. | |
Static Public Member Functions | |
| static SystemMatrix * | create (const ProcessAdm *adm, LinAlg::MatrixType mType, int num_thread_SLU=1) |
| Static method creating a matrix of the given type. | |
| static SystemMatrix * | create (const ProcessAdm *adm, LinAlg::MatrixType mType, const LinSolParams &spar) |
| Static method creating a matrix of the given type. | |
Protected Member Functions | |
| SystemMatrix () | |
| Default constructor. | |
| SystemMatrix (const SystemMatrix &a) | |
| Copy constructor. | |
| virtual std::ostream & | write (std::ostream &os) const |
| Writes the system matrix to the given output stream. | |
Private Attributes | |
| std::vector< bool > | nonZeroEqs |
| Flags equations with non-zero contributions. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const SystemMatrix &A) |
| Global stream operator printing the matrix contents. | |
Base class for representing a system matrix on different formats.
The purpose of this class is to define a clean interface for the system matrix and underlying equation solvers, such that the finite element implementation can be performed without paying attention to the actual solver being used.
Adds an element matrix into the associated system matrix.
| [in] | eM | The element matrix |
| [in] | meq | Matrix of element equation numbers (0 based) |
To be used when there is no underlying SAM
Implemented in PETScMatrix, SPRMatrix, SparseMatrix, DiagMatrix, and DenseMatrix.
Adds an element matrix into the associated system matrix.
| [in] | eM | The element matrix |
| [in] | sam | Auxiliary data for FE assembly management |
| [in] | e | Identifier for the element that eM belongs to |
Implemented in PETScMatrix, SPRMatrix, SparseMatrix, DiagMatrix, and DenseMatrix.
Referenced by ASMs1D::assembleL2matrices(), ASMs2DLag::assembleL2matrices(), ASMs3DLag::assembleL2matrices(), ASMu2D::assembleL2matrices(), ASMu3D::assembleL2matrices(), SAM::assembleSystem(), ASMs2DmxLag::evalSolution(), and ASMs3DmxLag::evalSolution().
|
pure virtual |
Adds an element matrix into the associated system matrix.
| [in] | eM | The element matrix |
| [in] | sam | Auxiliary data for FE assembly management |
| B | The system right-hand-side vector | |
| [in] | meq | Matrix of element equation numbers |
When multi-point constraints are present, contributions from these are also added into the system right-hand-side vector, B.
Implemented in DenseMatrix, PETScMatrix, SPRMatrix, SparseMatrix, and DiagMatrix.
|
pure virtual |
Adds an element matrix into the associated system matrix.
| [in] | eM | The element matrix |
| [in] | sam | Auxiliary data for FE assembly management |
| B | The system right-hand-side vector | |
| [in] | e | Identifier for the element that eM belongs to |
When multi-point constraints are present, contributions from these are also added into the system right-hand-side vector, B.
Implemented in PETScMatrix, SPRMatrix, SparseMatrix, DiagMatrix, and DenseMatrix.
|
virtual |
Finalizes the system matrix assembly.
This method will insert 1.0e9 on the diagonal, for all equations without contributions, such that the remaining equations can be solved for, if the method initNonZeroEqs() was invoked before the assembly started.
Reimplemented in PETScMatrix, and ISTLMatrix.
References add(), and nonZeroEqs.
Referenced by ISTLMatrix::endAssembly(), and ASMbase::globalL2projection().
|
pure virtual |
Initializes the element assembly process.
| [in] | sam | Auxiliary data describing the FE model topology, etc. |
This method must be called once before the element assembly loop.
Implemented in PETScMatrix, ISTLMatrix, SPRMatrix, DiagMatrix, DenseMatrix, and SparseMatrix.
|
inlinevirtual |
Solves the linear system of equations for a given right-hand-side.
| [in] | b | Right-hand-side vector |
| [out] | x | Solution vector |
Reimplemented in PETScMatrix, and ISTLMatrix.
References SystemVector::copy(), and solve().
|
pure virtual |
Solves the linear system of equations for a given right-hand-side.
| b | Right-hand-side vector on input, solution vector on output | |
| [out] | rc | Reciprocal condition number of the LHS-matrix (optional) |
Implemented in SparseMatrix, DenseMatrix, PETScMatrix, ISTLMatrix, SPRMatrix, and DiagMatrix.
Referenced by eig_sol_(), ASMbase::globalL2projection(), operator/(), operator/(), solve(), and SIMbase::solveEqSystem().