|
IFEM
90A354
|
Class for representing the system matrix on the SPR-format. More...
#include <SPRMatrix.h>


Public Member Functions | |
| SPRMatrix () | |
| Default constructor. | |
| SPRMatrix (const SPRMatrix &A) | |
| Copy constructor. | |
| virtual | ~SPRMatrix () |
| The destructor frees the dynamically allocated arrays. | |
| 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. | |
| SPRMatrix & | operator= (const SPRMatrix &)=delete |
| This class is not copyable. | |
| virtual size_t | dim (int idim) const |
| Returns the dimension of the system matrix. | |
| 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... | |
| virtual void | mult (Real alpha) |
| Multiplication with a scalar. | |
| virtual bool | add (const SystemMatrix &B, Real alpha) |
| Adds a matrix with similar sparsity pattern to the current matrix. More... | |
| virtual bool | add (Real sigma, int ieq) |
| Adds the constant σ to the diagonal of this 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... | |
| bool | solveEig (SPRMatrix &B, RealArray &val, Matrix &vec, int nev, Real shift=0.0, int iop=1) |
| Solves a generalized symmetric-definite eigenproblem. More... | |
| virtual Real | Linfnorm () const |
| Returns the L-infinity norm of the matrix. | |
| bool | convert (Matrix &fullMat) const |
| Converts to a dense matrix. | |
| virtual void | dump (std::ostream &os, LinAlg::StorageFormat fmt, const char *) |
| Dumps the system matrix on a specified format. | |
| virtual bool | load (const char *fileName, bool binary) |
| Loads the system matrix from specified file. | |
| 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 | 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. | |
| StdVector | operator* (const SystemVector &b) const |
| Calculates a matrix-vector product. | |
| StdVector | operator/ (const SystemVector &b) |
| Solves a linear equation system. | |
Protected Member Functions | |
| bool | assemble (int e, const Matrix &eM, const SAM &sam, Real *B=nullptr) |
| Adds an element matrix into the associated system matrix. More... | |
| bool | multiply (size_t n, const Real *b, Real *c) |
| Performs the matrix-vector multiplication c = *this * b. | |
| 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 Types | |
| using | SAM64 = SAM |
| Convenience alias when using 32-bit int version. | |
Private Attributes | |
| Int_ | ierr |
| Internal error flag. | |
| Int_ | mpar [NS] |
| Matrix of sparse PARameters. | |
| Int_ * | msica |
| Matrix of Storage Information for CA. | |
| Int_ * | msifa |
| Matrix of Storage Information for FA. | |
| Int_ * | mtrees |
| Matrix of elimination assembly TREES. | |
| Int_ * | mvarnc |
| Matrix of VARiable to Node Correspondence. | |
| Real * | values |
| The actual matrix VALUES. | |
| std::vector< Int_ > | iWork |
| Integer work array. | |
| std::vector< Int_ > * | jWork |
| Integer work arrays for multi-threaded assembly. | |
| std::vector< Real > | rWork |
| Real work array. | |
| SAM64 * | mySam |
| Possibly 64-bit integer version of SAM arrays. | |
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 the system matrix on the SPR-format.
It is an interface to a Fortran module for assembling and solving linear systems of equations.
|
virtual |
Adds a matrix with similar sparsity pattern to the current matrix.
| [in] | B | The matrix to be added |
| [in] | alpha | Scale factor for matrix B |
Reimplemented from SystemMatrix.
References SystemMatrix::flagNonZeroEqs(), SystemMatrix::isZero(), mpar, and values.
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.
| virtual bool SystemMatrix::assemble |
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
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 assemble().
| virtual bool SystemMatrix::assemble |
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 |
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.
| virtual bool SystemMatrix::assemble |
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.
|
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(), LinAlg::DENSE, SystemVector::getPtr(), and SystemVector::getType().
| virtual bool SystemMatrix::assemble |
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.
|
protected |
Adds an element matrix into the associated system matrix.
| [in] | eM | The element matrix |
| [in] | sam | Auxiliary data for FE assembly management |
| B | Pointer to the system right-hand-side vector | |
| [in] | e | Identifier for the element that eM belongs to |
References SystemMatrix::flagNonZeroEqs(), ierr, jWork, SAM::madof, SAM::meqn, SAM::mmceq, SAM::mmnpc, SAM::mpar, mpar, SAM::mpmceq, SAM::mpmnpc, msica, msifa, mtrees, mvarnc, mySam, utl::matrixBase< T >::ptr(), utl::matrix< T >::rows(), rWork, spradm_(), SAM::ttcc, and values.
|
virtual |
Initializes the element assembly process.
| [in] | sam | Auxiliary data describing the FE model topology, etc. |
Must be called once before the element assembly loop. The SPR data structures are initialized and the all symbolic operations that are need before the actual assembly can start are performed.
Implements SystemMatrix.
References ierr, iWork, SAM::madof, SAM::meqn, SAM::minex, SAM::mmceq, SAM::mmnpc, SAM::mpar, mpar, SAM::mpmceq, SAM::mpmnpc, SAM::msc, msica, msifa, mtrees, mvarnc, mySam, SAM::ndof, SAM::neq, SAM::nnod, Real, sprpmp_(), sprprp_(), sprrnm_(), sprsas_(), sprsmb_(), sprtrs_(), and values.
|
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 LinAlg::DENSE, SystemVector::dim(), SAM::getNodeAndLocalDof(), SystemVector::getPtr(), SystemVector::getType(), ierr, iWork, mpar, msifa, mtrees, mySam, Real, rWork, sprsol_(), and values.
| 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) |
| bool SPRMatrix::solveEig | ( | SPRMatrix & | B, |
| RealArray & | val, | ||
| Matrix & | vec, | ||
| int | nev, | ||
| Real | shift = 0.0, |
||
| int | iop = 1 |
||
| ) |
Solves a generalized symmetric-definite eigenproblem.
| B | Symmetric and positive definite mass matrix. | |
| [out] | val | Computed eigenvalues |
| [out] | vec | Computed eigenvectors stored column by column |
| [in] | nev | The number of eigenvalues and eigenvectors to compute |
| [in] | shift | Eigenvalue shift |
| [in] | iop | Option telling whether to factorize matrix A or B. |
The eigenproblem is assumed to be on the form A x = λ B x where A ( = *this ) and B both are assumed to be symmetric and B also to be positive definite. The eigenproblem is solved by the SAM library subroutine SPRLAN.
References ierr, iWork, mpar, msifa, mtrees, utl::matrixBase< T >::ptr(), Real, utl::matrix< T >::resize(), rWork, sprlax_(), and values.
Referenced by eig::solve().