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

The Multigrid hierarchy including meshes, vectors and matrices, prolongations is stored. More...

#include <jacsolve.h>

Public Member Functions

 Multigrid (Mesh const &cmesh, int nlevel)
 
 Multigrid (Multigrid const &)=delete
 
Multigridoperator= (Multigrid const &)=delete
 
 ~Multigrid ()
 
size_t Nlevels () const
 
int Ndofs () const
 
Mesh const & GetMesh (int lev) const
 
std::vector< double > const & GetSolution (int lev) const
 
void DefineOperators ()
 
void DefineOperator (size_t lev)
 
void JacobiSolve (size_t lev)
 
void MG_Step (size_t lev, int pre_smooth=1, bool const bzero=false, int nu=1)
 
void MG_Solve (int pre_smooth=1, double eps=1e-6, int nu=1)
 

Private Attributes

gMesh_Hierarchy _meshes
 mesh hierarchy from coarse (level 0) to fine. More...
 
std::vector< FEM_Matrix_SK
 Sparse matrix on each level. More...
 
std::vector< std::vector< double > > _u
 Solution vector on each level. More...
 
std::vector< std::vector< double > > _f
 Right hand side vector on each level. More...
 
std::vector< std::vector< double > > _d
 Defect vector on each level. More...
 
std::vector< std::vector< double > > _w
 Correction vector on each level. More...
 
std::vector< BisectIntDirichlet_Pc2f
 Interpolation to level from next coarser level. More...
 

Detailed Description

The Multigrid hierarchy including meshes, vectors and matrices, prolongations is stored.

Definition at line 57 of file jacsolve.h.

Constructor & Destructor Documentation

◆ Multigrid() [1/2]

Multigrid::Multigrid ( Mesh const &  cmesh,
int  nlevel 
)
    Generates the mesh hierachy with @p nlevel meshes starting from coarse mesh @p cmesg .

The refined meshes are generated by edge bisection. All memory is allocated but stiffness matrices are yet not calculated

    @param[in] cmesh          initial coarse mesh
    @param[in] nlevel  number of meshes in hierarchy, including the initial coarse mesh

Definition at line 104 of file jacsolve.cpp.

◆ Multigrid() [2/2]

Multigrid::Multigrid ( Multigrid const &  )
delete

◆ ~Multigrid()

Multigrid::~Multigrid ( )

Definition at line 134 of file jacsolve.cpp.

Member Function Documentation

◆ DefineOperator()

void Multigrid::DefineOperator ( size_t  lev)
    Calculates PDE matrix for level @p lev.
Parameters
[in]levlevel in hierachy

Definition at line 146 of file jacsolve.cpp.

◆ DefineOperators()

void Multigrid::DefineOperators ( )

Calculates PDE matrices for all levels.

Definition at line 137 of file jacsolve.cpp.

◆ GetMesh()

Mesh const& Multigrid::GetMesh ( int  lev) const
inline
Returns
Meshes number lev .

Definition at line 92 of file jacsolve.h.

◆ GetSolution()

std::vector<double> const& Multigrid::GetSolution ( int  lev) const
inline
Returns
Solution vector at level lev .

Definition at line 98 of file jacsolve.h.

◆ JacobiSolve()

void Multigrid::JacobiSolve ( size_t  lev)
    Solves the system of equations at level @p lev via Jacobi iterations
Parameters
[in]levlevel in hierachy

Definition at line 164 of file jacsolve.cpp.

◆ MG_Solve()

void Multigrid::MG_Solve ( int  pre_smooth = 1,
double  eps = 1e-6,
int  nu = 1 
)
    Solves the system of equations at finest level via multigrid
Parameters
[in]pre_smoothnumber of pre/post-smoothing sweeps
[in]epsstopping criteria (relative error)
[in]nudefines the multigrid cycle (1/2 = V/W)

Definition at line 207 of file jacsolve.cpp.

◆ MG_Step()

void Multigrid::MG_Step ( size_t  lev,
int  pre_smooth = 1,
bool const  bzero = false,
int  nu = 1 
)
    Peformes one multigrid step at level @p lev .
Parameters
[in]levlevel in hierachy
[in]pre_smoothnumber of pre/post-smoothing sweeps
[in]bzerostart with zero-vector as solution
[in]nudefines the multigrid cycle (1/2 = V/W)

Definition at line 170 of file jacsolve.cpp.

◆ Ndofs()

int Multigrid::Ndofs ( ) const
inline
Returns
Number of Unknowns.

Definition at line 86 of file jacsolve.h.

◆ Nlevels()

size_t Multigrid::Nlevels ( ) const
inline
Returns
Number of meshes in hierarchy.

Definition at line 80 of file jacsolve.h.

◆ operator=()

Multigrid& Multigrid::operator= ( Multigrid const &  )
delete

Member Data Documentation

◆ _d

std::vector<std::vector<double> > Multigrid::_d
private

Defect vector on each level.

Definition at line 145 of file jacsolve.h.

◆ _f

std::vector<std::vector<double> > Multigrid::_f
private

Right hand side vector on each level.

Definition at line 144 of file jacsolve.h.

◆ _meshes

gMesh_Hierarchy Multigrid::_meshes
private

mesh hierarchy from coarse (level 0) to fine.

Definition at line 141 of file jacsolve.h.

◆ _Pc2f

std::vector<BisectIntDirichlet> Multigrid::_Pc2f
private

Interpolation to level from next coarser level.

Definition at line 147 of file jacsolve.h.

◆ _SK

std::vector<FEM_Matrix> Multigrid::_SK
private

Sparse matrix on each level.

Definition at line 142 of file jacsolve.h.

◆ _u

std::vector<std::vector<double> > Multigrid::_u
private

Solution vector on each level.

Definition at line 143 of file jacsolve.h.

◆ _w

std::vector<std::vector<double> > Multigrid::_w
private

Correction vector on each level.

Definition at line 146 of file jacsolve.h.


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