14 #ifndef _DIAG_MATRIX_H
15 #define _DIAG_MATRIX_H
121 virtual bool add(
Real sigma,
int ieq);
136 virtual std::ostream&
write(std::ostream& os)
const {
return os <<
myMat; }
std::vector< int > IntVec
General integer vector.
Definition: ASMbase.h:25
#define Real
The floating point type to use.
Definition: ImmersedBoundaries.h:18
std::vector< Real > RealArray
A real-valued array without algebraic operations.
Definition: ImmersedBoundaries.h:29
General representation of system matrices and vectors.
Class for representing a diagonal system matrix.
Definition: DiagMatrix.h:25
virtual void mult(Real alpha)
Multiplication with a scalar.
Definition: DiagMatrix.h:113
virtual bool assemble(const Matrix &eM, const SAM &sam, int e)
Adds an element matrix into the associated system matrix.
Definition: DiagMatrix.C:63
DiagMatrix(const DiagMatrix &A)
Copy constructor.
Definition: DiagMatrix.h:30
Vector & getMat()
Access to the matrix itself.
Definition: DiagMatrix.h:50
virtual bool multiply(const SystemVector &B, SystemVector &C) const
Performs the matrix-vector multiplication C = *this * B.
Definition: DiagMatrix.C:187
virtual ~DiagMatrix()
Empty destructor.
Definition: DiagMatrix.h:34
virtual void initAssembly(const SAM &sam, char)
Initializes the element assembly process.
Definition: DiagMatrix.C:27
bool redim(size_t r)
Resizes the matrix to dimension .
Definition: DiagMatrix.h:44
DiagMatrix(size_t m=0)
Default constructor.
Definition: DiagMatrix.h:28
virtual void init()
Initializes the matrix to zero assuming it is properly dimensioned.
Definition: DiagMatrix.h:65
virtual size_t dim(int) const
Returns the dimension of the system matrix.
Definition: DiagMatrix.h:47
virtual bool solve(SystemVector &b, Real *rc=nullptr)=0
Solves the linear system of equations for a given right-hand-side.
const Real & operator()(size_t r) const
Index-1 based element reference.
Definition: DiagMatrix.h:54
virtual void dump(std::ostream &os, LinAlg::StorageFormat format, const char *label)
Dumps the system matrix on a specified format.
Definition: DiagMatrix.C:33
virtual bool add(const SystemMatrix &B, Real alpha)
Adds a matrix with similar dimension to the current matrix.
Definition: DiagMatrix.C:159
virtual std::ostream & write(std::ostream &os) const
Writes the system matrix to the given output stream.
Definition: DiagMatrix.h:136
virtual SystemMatrix * copy() const
Creates a copy of the system matrix and returns a pointer to it.
Definition: DiagMatrix.h:40
virtual LinAlg::MatrixType getType() const
Returns the matrix type.
Definition: DiagMatrix.h:37
Real & operator()(size_t r)
Index-1 based element access.
Definition: DiagMatrix.h:52
Vector myMat
The actual diagonal matrix.
Definition: DiagMatrix.h:139
bool assembleStruct(int val, const SAM &sam, const IntVec &meq)
Assembles a validation matrix assuming unit element contributions.
Definition: DiagMatrix.C:114
virtual Real Linfnorm() const
Returns the L-infinity norm of the matrix.
Definition: DiagMatrix.h:132
This class contains data and functions for the assembly of FE matrices.
Definition: SAM.h:39
Base class for representing a system matrix on different formats.
Definition: SystemMatrix.h:220
virtual bool solve(SystemVector &b, Real *rc=nullptr)=0
Solves the linear system of equations for a given right-hand-side.
Base class for representing a system vector on different formats.
Definition: SystemMatrix.h:32
A vector class with some added algebraic operations.
Definition: matrix.h:64
void fill(T s)
Fill the vector with a scalar value.
Definition: matrix.h:137
bool resize(size_t n, char forceClear=0)
Resize the vector to length n.
Definition: matrix.h:277
size_t size() const
Size of the vector.
Definition: matrix.h:88
T normInf(size_t &off, int inc=1, bool sign=false) const
Return the infinite norm of the vector, or signed max value.
Definition: matrix.h:1526
MatrixType
The available system matrix formats and associated solvers.
Definition: LinAlgenums.h:22
@ DIAG
Diagonal matrices / Trivial solver.
Definition: LinAlgenums.h:30
StorageFormat
Enumeration of matrix storage formats.
Definition: LinAlgenums.h:43
const char RETAIN
Flag for vector::resize() method telling it to retain its content.
Definition: matrix.h:55