KASKADE 7 development version
Public Member Functions | List of all members
Kaskade::MGProlongation Class Reference

A prolongation operator for P1 finite elements from a coarser grid level to the next finer level. More...

#include <prolongation.hh>

Detailed Description

A prolongation operator for P1 finite elements from a coarser grid level to the next finer level.

For P1 finite elements on simplicial grids, the prolongation from a coarser level to the next finer is a matrix \( P \) in which each row contains either one entry of value 1 (if the vertex is already contained in the coarser level grid) or two entries that sum up to 1 (if the vertex is created on the finer level by bisecting the edge between two parent nodes). In the latter case, the two entries default to 0.5 each.

Storing this as a sparse matrix data structure is quite inefficient. This class is a specialized implementation of such prolongation matrices.

Definition at line 171 of file prolongation.hh.

Public Member Functions

 MGProlongation (std::vector< ProlongationDetail::Node > const &parents, std::vector< size_t > const &indexInCoarse, size_t nc, int fineLevel)
 Constructor. More...
 
std::array< size_t, 2 > const & parents (size_t i) const
 Returns the parent nodes indices. More...
 
template<class Vector >
void umv (Vector const &c, Vector &f) const
 Matrix vector multiplcation (update mode). More...
 
template<class Vector >
void mv (Vector const &c, Vector &f) const
 Matrix vector multiplcation. More...
 
template<class Vector >
void mtv (Vector const &f, Vector &c) const
 Transpose matrix vector multiplication. More...
 
size_t N () const
 The number of rows. More...
 
size_t M () const
 The number of columns. More...
 
template<class Real >
NumaBCRSMatrix< Dune::FieldMatrix< Real, 1, 1 > > asMatrix () const
 Returns the prolongation in form of a sparse matrix. More...
 
template<class Entry , class Index >
NumaBCRSMatrix< Entry, Index > galerkinProjection (NumaBCRSMatrix< Entry, Index > const &A, bool onlyLowerTriangle=false) const
 Galerkin projection of fine grid matrices. This computes \( P^T A P \). More...
 

Constructor & Destructor Documentation

◆ MGProlongation()

Kaskade::MGProlongation::MGProlongation ( std::vector< ProlongationDetail::Node > const &  parents,
std::vector< size_t > const &  indexInCoarse,
size_t  nc,
int  fineLevel 
)

Constructor.

Parameters
parentsa sequence of node information. The parent indices for fine grid nodes shall refer to the fine grid numbering.
indexInCoarsea vector of length of fine grid vertices. For each coarse grid node, it contains the index of that node in the coarse grid.
ncthe number of coarse grid nodes (i.e. number of columns in P)
fineLevelthe level of fine grid nodes

Member Function Documentation

◆ asMatrix()

template<class Real >
NumaBCRSMatrix< Dune::FieldMatrix< Real, 1, 1 > > Kaskade::MGProlongation::asMatrix ( ) const
inline

Returns the prolongation in form of a sparse matrix.

Definition at line 283 of file prolongation.hh.

◆ galerkinProjection()

template<class Entry , class Index >
NumaBCRSMatrix< Entry, Index > Kaskade::MGProlongation::galerkinProjection ( NumaBCRSMatrix< Entry, Index > const &  A,
bool  onlyLowerTriangle = false 
) const
inline

Galerkin projection of fine grid matrices. This computes \( P^T A P \).

Template Parameters
Entrythe entry type of Galerkin matrix to be projected, in general a quadratic Dune::FieldMatrix type
Indexthe Index type of the matrix to be projected
Parameters
Athe quadratic fine level Galerkin matrix of size \( N\times N \) to be projected
onlyLowerTriangleif true, only the lower triangular part of symmetric A is touched, and only the lower triangular part of \( P^T A P\) is created

Definition at line 309 of file prolongation.hh.

◆ M()

size_t Kaskade::MGProlongation::M ( ) const
inline

The number of columns.

Definition at line 274 of file prolongation.hh.

Referenced by asMatrix(), and galerkinProjection().

◆ mtv()

template<class Vector >
void Kaskade::MGProlongation::mtv ( Vector const &  f,
Vector &  c 
) const
inline

Transpose matrix vector multiplication.

This computes \( c \leftarrow P^T f \).

Parameters
cthe coarse grid target vector. It is resized to contain the result.

Definition at line 248 of file prolongation.hh.

◆ mv()

template<class Vector >
void Kaskade::MGProlongation::mv ( Vector const &  c,
Vector &  f 
) const
inline

Matrix vector multiplcation.

This computes \( f \leftarrow Pc \), and is faster than but equivalent to

f = 0;
umv(c,f);
void umv(Vector const &c, Vector &f) const
Matrix vector multiplcation (update mode).
Parameters
fthe fine grid target vector. It has to have the correct size.

Definition at line 228 of file prolongation.hh.

◆ N()

size_t Kaskade::MGProlongation::N ( ) const
inline

The number of rows.

Definition at line 266 of file prolongation.hh.

Referenced by asMatrix(), and galerkinProjection().

◆ parents()

std::array< size_t, 2 > const & Kaskade::MGProlongation::parents ( size_t  i) const
inline

Returns the parent nodes indices.

For a fine grid node, this returns the parent node indices in the coarse grid. For a coarse grid node, the "parent indices" coincide and refer to the node index in the coarse grid.

Definition at line 191 of file prolongation.hh.

◆ umv()

template<class Vector >
void Kaskade::MGProlongation::umv ( Vector const &  c,
Vector &  f 
) const
inline

Matrix vector multiplcation (update mode).

This computes \( f \leftarrow f + Pc \).

Parameters
fthe fine grid target vector. It has to have the correct size.

Definition at line 204 of file prolongation.hh.


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