To handle tridiagonal matrices. More...
Public Member Functions  
TrMatrix ()  
Default constructor. More...  
TrMatrix (size_t size)  
Constructor for a tridiagonal matrix with size rows.  
TrMatrix (const TrMatrix &m)  
Copy Constructor.  
~TrMatrix ()  
Destructor.  
void  Identity () 
Define matrix as identity matrix.  
void  Diagonal () 
Define matrix as a diagonal one.  
void  Diagonal (const T_ &a) 
Define matrix as a diagonal one with diagonal entries equal to a  
void  Laplace1D (real_t h) 
Sets the matrix as the one for the Laplace equation in 1D. More...  
void  setSize (size_t size) 
Set size (number of rows) of matrix. More...  
void  MultAdd (const Vect< T_ > &x, Vect< T_ > &y) const 
Multiply matrix by vector x and add result to y .  
void  MultAdd (T_ a, const Vect< T_ > &x, Vect< T_ > &y) const 
Multiply matrix by vector a*x and add result to y .  
void  Mult (const Vect< T_ > &x, Vect< T_ > &y) const 
Multiply matrix by vector x and save result in y .  
void  TMult (const Vect< T_ > &x, Vect< T_ > &y) const 
Multiply transpose of matrix by vector x and save result in y .  
void  Axpy (T_ a, const TrMatrix< T_ > &m) 
Add to matrix the product of a matrix by a scalar. More...  
void  Axpy (T_ a, const Matrix< T_ > *m) 
Add to matrix the product of a matrix by a scalar. More...  
void  set (size_t i, size_t j, const T_ &val) 
Assign constant val to an entry (i,j) of the matrix.  
void  add (size_t i, size_t j, const T_ &val) 
Add constant val value to an entry (i,j) of the matrix.  
T_  operator() (size_t i, size_t j) const 
Operator () (Constant version). More...  
T_ &  operator() (size_t i, size_t j) 
Operator () (Non constant version). More...  
TrMatrix< T_ > &  operator= (const TrMatrix< T_ > &m) 
Operator =. More...  
TrMatrix< T_ > &  operator= (const T_ &x) 
Operator = Assign matrix to identity times x .  
TrMatrix< T_ > &  operator*= (const T_ &x) 
Operator *=. More...  
int  solve (Vect< T_ > &b) 
Solve a linear system with current matrix (forward and back substitution). More...  
int  solve (const Vect< T_ > &b, Vect< T_ > &x) 
Solve a linear system with current matrix (forward and back substitution). More...  
T_ *  get () const 
Return CArray.  
T_  get (size_t i, size_t j) const 
Return entry (i,j) of matrix.  
size_t  getNbRows () const 
Return number of rows.  
size_t  getNbColumns () const 
Return number of columns.  
void  setPenal (real_t p) 
Set Penalty Parameter (For boundary condition prescription).  
void  setDiagonal () 
Set the matrix as diagonal.  
void  setDiagonal (Mesh &mesh) 
Initialize matrix storage in the case where only diagonal terms are stored. More...  
T_  getDiag (size_t k) const 
Return k th diagonal entry of matrix. More...  
size_t  size () const 
Return matrix dimension (Number of rows and columns).  
void  Assembly (const Element &el, T_ *a) 
Assembly of element matrix into global matrix. More...  
void  Assembly (const Element &el, const DMatrix< T_ > &a) 
Assembly of element matrix into global matrix. More...  
void  Assembly (const Side &sd, T_ *a) 
Assembly of side matrix into global matrix. More...  
void  Assembly (const Side &sd, const DMatrix< T_ > &a) 
Assembly of side matrix into global matrix. More...  
void  Prescribe (Vect< T_ > &b, const Vect< T_ > &u, int flag=0) 
Impose by a penalty method an essential boundary condition, using the Mesh instance provided by the constructor. More...  
void  Prescribe (int dof, int code, Vect< T_ > &b, const Vect< T_ > &u, int flag=0) 
Impose by a penalty method an essential boundary condition to a given degree of freedom for a given code. More...  
void  Prescribe (Vect< T_ > &b, int flag=0) 
Impose by a penalty method a homegeneous (=0) essential boundary condition. More...  
void  Prescribe (size_t dof, Vect< T_ > &b, const Vect< T_ > &u, int flag=0) 
Impose by a penalty method an essential boundary condition when only one DOF is treated. More...  
void  PrescribeSide () 
Impose by a penalty method an essential boundary condition when DOFs are supported by sides. More...  
virtual int  Factor ()=0 
Factorize matrix. Available only if the storage class enables it.  
int  FactorAndSolve (Vect< T_ > &b) 
Factorize matrix and solve the linear system. More...  
int  FactorAndSolve (const Vect< T_ > &b, Vect< T_ > &x) 
Factorize matrix and solve the linear system. More...  
size_t  getLength () const 
Return number of stored terms in matrix.  
int  isDiagonal () const 
Say if matrix is diagonal or not.  
int  isFactorized () const 
Say if matrix is factorized or not. More...  
virtual size_t  getColInd (size_t i) const 
Return Column index for column i (See the description for class SpMatrix).  
virtual size_t  getRowPtr (size_t i) const 
Return Row pointer for row i (See the description for class SpMatrix).  
T_  operator() (size_t i) const 
Operator () with one argument (Constant version). More...  
T_ &  operator() (size_t i) 
Operator () with one argument (Non Constant version). More...  
T_ &  operator[] (size_t k) 
Operator [] (Non constant version). More...  
T_  operator[] (size_t k) const 
Operator [] (Constant version). More...  
Matrix &  operator+= (const Matrix< T_ > &m) 
Operator +=. More...  
Matrix &  operator+= (const T_ &x) 
Operator +=. More...  
Matrix &  operator= (const Matrix< T_ > &m) 
Operator =. More...  
Matrix &  operator= (const T_ &x) 
Operator =. More...  
Detailed Description
template<class T_>
class OFELI::TrMatrix< T_ >
To handle tridiagonal matrices.
This class enables storing and manipulating tridiagonal matrices. The template parameter is the type of matrix entries
 Template Parameters

T_ Data type (double, float, complex<double>, ...)
Member Function Documentation
void Laplace1D  (  real_t  h  ) 
Sets the matrix as the one for the Laplace equation in 1D.
The matrix is initialized as the one resulting from P_{1} finite element discretization of the classical elliptic operator u'' = f with homogeneous Dirichlet boundary conditions
 Remarks
 This function is available for real valued matrices only.
 Parameters

[in] h Mesh size (assumed constant)

inherited 
Initialize matrix storage in the case where only diagonal terms are stored.
This member function is to be used for explicit time integration schemes

inherited 
Return k
th diagonal entry of matrix.
First entry is given by getDiag(1).

inherited 
Assembly of element matrix into global matrix.
Case where element matrix is given by a Carray.
 Parameters

[in] el Pointer to element instance [in] a Element matrix as a Carray

inherited 
Assembly of side matrix into global matrix.
Case where side matrix is given by a Carray.
 Parameters

[in] sd Pointer to side instance [in] a Side matrix as a Carray instance
Impose by a penalty method an essential boundary condition, using the Mesh instance provided by the constructor.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
Impose by a penalty method an essential boundary condition to a given degree of freedom for a given code.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
 Parameters

[in] dof Degree of freedom for which a boundary condition is to be enforced [in] code Code for which a boundary condition is to be enforced [in,out] b Vect instance that contains righthand side. [in] u Vect instance that contains imposed valued at DOFs where they are to be imposed. [in] flag Parameter to determine whether only the righthand side is to be modified
(dof>0
) or both matrix and righthand side (dof=0
, default value).

inherited 
Impose by a penalty method a homegeneous (=0) essential boundary condition.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
 Parameters

[in,out] b Vect instance that contains righthand side. [in] flag Parameter to determine whether only the righthand side is to be modified ( dof>0
)
or both matrix and righthand side (dof=0
, default value).
Impose by a penalty method an essential boundary condition when only one DOF is treated.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. This gunction is to be used if only one DOF per node is treated in the linear system. The penalty parameter is by default equal to 1.e20. It can be modified by member function setPenal.
 Parameters

[in] dof Label of the concerned degree of freedom (DOF). [in,out] b Vect instance that contains righthand side. [in] u Vect instance that conatins imposed valued at DOFs where they are to be imposed. [in] flag Parameter to determine whether only the righthand side is to be modified ( dof>0
)
or both matrix and righthand side (dof=0
, default value).

inherited 
Impose by a penalty method an essential boundary condition when DOFs are supported by sides.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).

inherited 
Factorize matrix and solve the linear system.
This is available only if the storage cass enables it.
 Parameters

[in,out] b Vect instance that contains righthand side on input and solution on output

inherited 
Say if matrix is factorized or not.
If the matrix was not factorized, the class does not allow solving by a direct solver.

inherited 
Operator () with one argument (Constant version).
Returns i
th position in the array storing matrix entries. The first entry is at location 1. Entries are stored row by row.
 Parameters

[in] i entry index

inherited 
Operator () with one argument (Non Constant version).
Returns i
th position in the array storing matrix entries. The first entry is at location 1. Entries are stored row by row.
 Parameters

[in] i entry index

inherited 
Operator [] (Non constant version).
Returns k
th stored element in matrix Index k
starts at 0
.

inherited 
Operator [] (Constant version).
Returns k
th stored element in matrix Index k
starts at 0
.
Operator +=.
Add matrix m
to current matrix instance.

inherited 
Operator +=.
Add constant value x
to all matrix entries.
Operator =.
Subtract matrix m
from current matrix instance.

inherited 
Operator =.
Subtract constant value x
from all matrix entries.