|
IFEM
90A354
|
Class for representing a diagonal system matrix. More...
#include <DiagMatrix.h>


Public Member Functions | |
| DiagMatrix (size_t m=0) | |
| Default constructor. | |
| DiagMatrix (const DiagMatrix &A) | |
| Copy constructor. | |
| DiagMatrix (const RealArray &data, size_t nrows=0) | |
| Special constructor taking data from a one-dimensional array. | |
| virtual | ~DiagMatrix () |
| Empty destructor. | |
| virtual LinAlg::MatrixType | getType () const |
| Returns the matrix type. | |
| virtual SystemMatrix * | copy () const |
| Creates a copy of the system matrix and returns a pointer to it. | |
| bool | redim (size_t r) |
| Resizes the matrix to dimension \(r \times r\). More... | |
| virtual size_t | dim (int) const |
| Returns the dimension of the system matrix. | |
| Vector & | getMat () |
| Access to the matrix itself. | |
| Real & | operator() (size_t r) |
| Index-1 based element access. | |
| const Real & | operator() (size_t r) const |
| Index-1 based element reference. | |
| virtual void | dump (std::ostream &os, LinAlg::StorageFormat format, const char *label) |
| Dumps the system matrix on a specified format. | |
| virtual void | initAssembly (const SAM &sam, char) |
| Initializes the element assembly process. More... | |
| virtual void | init () |
| Initializes the matrix to zero assuming it is properly dimensioned. | |
| virtual bool | assemble (const Matrix &eM, const SAM &sam, int e) |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | assemble (const Matrix &eM, const SAM &sam, SystemVector &B, int e) |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | assemble (const Matrix &eM, const SAM &sam, SystemVector &B, const IntVec &meq) |
| Adds an element matrix into the associated system matrix. More... | |
| virtual bool | assemble (const Matrix &eM, const IntVec &meq) |
| Adds an element matrix into the associated system matrix. More... | |
| bool | assembleStruct (int val, const SAM &sam, const IntVec &meq) |
| Assembles a validation matrix assuming unit element contributions. More... | |
| virtual void | mult (Real alpha) |
| Multiplication with a scalar. | |
| virtual bool | add (const SystemMatrix &B, Real alpha) |
| Adds a matrix with similar dimension to the current matrix. More... | |
| virtual bool | add (Real sigma, int ieq) |
| Adds the constant σ to the diagonal matrix. | |
| virtual bool | multiply (const SystemVector &B, SystemVector &C) const |
| Performs the matrix-vector multiplication C = *this * B. | |
| virtual bool | solve (SystemVector &B, Real *) |
| Solves the linear system of equations for a given right-hand-side. More... | |
| virtual Real | Linfnorm () const |
| Returns the L-infinity norm of the matrix. | |
| 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... | |
Public Member Functions inherited from SystemMatrix | |
| virtual | ~SystemMatrix () |
| Empty destructor. | |
| 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 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. | |
| 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 | 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 bool | solve (const SystemVector &b, SystemVector &x) |
| Solves the linear system of equations for a given right-hand-side. More... | |
| 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. | |
Protected Member Functions | |
| virtual std::ostream & | write (std::ostream &os) const |
| Writes the system matrix to the given output stream. | |
Protected Member Functions inherited from SystemMatrix | |
| SystemMatrix () | |
| Default constructor. | |
| SystemMatrix (const SystemMatrix &a) | |
| Copy constructor. | |
Private Attributes | |
| Vector | myMat |
| The actual diagonal matrix. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SystemMatrix | |
| 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. | |
Class for representing a diagonal system matrix.
|
virtual |
Adds a matrix with similar dimension to the current matrix.
| [in] | B | The matrix to be added |
| [in] | alpha | Scale factor for matrix B |
Reimplemented from SystemMatrix.
References utl::vector< T >::add(), SystemMatrix::flagNonZeroEqs(), myMat, and utl::vector< T >::size().
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
Implements SystemMatrix.
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 |
Implements SystemMatrix.
References SAM::getElmEqns(), myMat, SAM::neq, utl::matrix< T >::rows(), and utl::vector< T >::size().
Referenced by assemble().
|
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.
Implements SystemMatrix.
References utl::matrix< T >::cols(), SystemMatrix::flagNonZeroEqs(), SAM::meqn, SAM::mmceq, SAM::mpmceq, myMat, utl::matrix< T >::rows(), and SAM::ttcc.
|
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.
Implements SystemMatrix.
References assemble().
Assembles a validation matrix assuming unit element contributions.
| [in] | val | Value identifying current threading group |
| [in] | sam | Auxiliary data for FE assembly management |
| [in] | meq | Matrix of element equation numbers |
For validation of threading groups.
This method is doing the same as the above assemble() method, but where all element matrices are assumed identity matrices. The purpose is to verify that each equation only gets a single contribution within each threading group.
References SystemMatrix::flagNonZeroEqs(), SAM::meqn, SAM::mmceq, SAM::mpmceq, and myMat.
Referenced by ASMs2D::validateThreadGroups().
|
virtual |
Initializes the element assembly process.
| [in] | sam | Auxiliary data describing the FE model topology, etc. |
Implements SystemMatrix.
References myMat, SAM::neq, and utl::vector< T >::resize().
|
inline |
Resizes the matrix to dimension \(r \times r\).
Will preserve existing matrix content within the new dimension.
References myMat, utl::vector< T >::resize(), and utl::RETAIN.
|
inline |
Solves the linear system of equations for a given right-hand-side.
| [in] | b | Right-hand-side vector |
| [out] | x | Solution vector |
|
virtual |
Solves the linear system of equations for a given right-hand-side.
| B | Right-hand-side vector on input, solution vector on output |
Implements SystemMatrix.
References utl::vector< T >::empty(), SystemVector::getPtr(), myMat, and Real.
| virtual bool SystemMatrix::solve |
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) |