jacobi.template
Public Member Functions | Private Attributes | List of all members
FEM_Matrix Class Reference

#include <getmatrix.h>

Inheritance diagram for FEM_Matrix:
CRS_Matrix Matrix

Public Member Functions

 FEM_Matrix (Mesh const &mesh)
 
 FEM_Matrix (FEM_Matrix const &)=default
 
 ~FEM_Matrix () override
 
void Derive_Matrix_Pattern ()
 
void Derive_Matrix_Pattern_fast ()
 
void Derive_Matrix_Pattern_slow ()
 
void CalculateLaplace (std::vector< double > &f)
 
void ApplyDirichletBC (std::vector< double > const &u, std::vector< double > &f)
 
void AddElem_3 (int const ial[3], double const ske[3][3], double const fe[3], std::vector< double > &f)
 ‍** More...
 
- Public Member Functions inherited from CRS_Matrix
 CRS_Matrix ()
 
 CRS_Matrix (CRS_Matrix const &)=default
 
virtual ~CRS_Matrix () override
 
void GetDiag (std::vector< double > &d) const override
 
void Mult (std::vector< double > &w, std::vector< double > const &u) const override
 ‍** More...
 
void Defect (std::vector< double > &w, std::vector< double > const &f, std::vector< double > const &u) const override
 
void Debug () const override
 
int fetch (int row, int col) const override
 
bool Compare2Old (int nnode, int const id[], int const ik[], double const sk[]) const
 
- Public Member Functions inherited from Matrix
 Matrix (int nrows, int ncols)
 
 Matrix (Matrix const &)=default
 
virtual ~Matrix ()
 
bool isSquare () const
 
int Nrows () const
 
int Ncols () const
 
const std::vector< double > & GetDiag () const
 

Private Attributes

const Mesh_mesh
 reference to discretization More...
 

Additional Inherited Members

- Protected Attributes inherited from CRS_Matrix
int _nnz
 number of non-zero entries More...
 
std::vector< int > _id
 start indices of matrix rows More...
 
std::vector< int > _ik
 column indices More...
 
std::vector< double > _sk
 non-zero values More...
 
- Protected Attributes inherited from Matrix
int _nrows
 number of rows in matrix More...
 
int _ncols
 number of columns in matrix More...
 
std::vector< double > _dd
 diagonal matrix elements More...
 

Detailed Description

FEM Matrix in CRS format (compressed row storage; also named CSR), see an introduction.

Definition at line 235 of file getmatrix.h.

Constructor & Destructor Documentation

◆ FEM_Matrix() [1/2]

FEM_Matrix::FEM_Matrix ( Mesh const &  mesh)
explicit

Initializes the CRS matrix structure from the given discretization in mesh.

The sparse matrix pattern is generated but the values are 0.

Parameters
[in]meshgiven discretization
Warning
A reference to the discretization mesh is stored inside this class. Therefore, changing mesh outside requires also to call method Derive_Matrix_Pattern explicitly.
See also
Derive_Matrix_Pattern

Definition at line 184 of file getmatrix.cpp.

◆ FEM_Matrix() [2/2]

FEM_Matrix::FEM_Matrix ( FEM_Matrix const &  )
default

◆ ~FEM_Matrix()

FEM_Matrix::~FEM_Matrix ( )
override

Destructor.

Definition at line 191 of file getmatrix.cpp.

Member Function Documentation

◆ AddElem_3()

void FEM_Matrix::AddElem_3 ( int const  ial[3],
double const  ske[3][3],
double const  fe[3],
std::vector< double > &  f 
)

‍**

Adds the element stiffness matrix ske and the element load vector fe of one triangular element with linear shape functions to the appropriate positions in the stiffness matrix, stored as CSR matrix K(sk,id, ik).

Parameters
[in]ialnode indices of the three element vertices
[in]skeelement stiffness matrix
[in]feelement load vector
[in,out]fdistributed local vector storing the right hand side
Warning
Algorithm assumes linear triangular elements (ndof_e==3).

Definition at line 398 of file getmatrix.cpp.

◆ ApplyDirichletBC()

void FEM_Matrix::ApplyDirichletBC ( std::vector< double > const &  u,
std::vector< double > &  f 
)

Applies Dirichlet boundary conditions to stiffness matrix and to load vector f. The penalty method is used for incorporating the given values u.

Parameters
[in]u(global) vector with Dirichlet data
[in,out]fload vector

Definition at line 366 of file getmatrix.cpp.

◆ CalculateLaplace()

void FEM_Matrix::CalculateLaplace ( std::vector< double > &  f)

Calculates the entries of f.e. stiffness matrix and load/rhs vector f for the Laplace operator in 2D. No memory is allocated.

Parameters
[in,out]f(preallocated) rhs/load vector

Definition at line 308 of file getmatrix.cpp.

◆ Derive_Matrix_Pattern()

void FEM_Matrix::Derive_Matrix_Pattern ( )
inline

Generates the sparse matrix pattern and overwrites the existing pattern.

The sparse matrix pattern is generated but the values are 0.

Definition at line 265 of file getmatrix.h.

◆ Derive_Matrix_Pattern_fast()

void FEM_Matrix::Derive_Matrix_Pattern_fast ( )

Definition at line 194 of file getmatrix.cpp.

◆ Derive_Matrix_Pattern_slow()

void FEM_Matrix::Derive_Matrix_Pattern_slow ( )

Definition at line 244 of file getmatrix.cpp.

Member Data Documentation

◆ _mesh

const Mesh& FEM_Matrix::_mesh
private

reference to discretization

Definition at line 316 of file getmatrix.h.


The documentation for this class was generated from the following files: