KASKADE 7 development version
|
A prolongation operator for P1 finite elements from a coarser grid level to the next finer level. More...
#include <prolongation.hh>
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... | |
Kaskade::MGProlongation::MGProlongation | ( | std::vector< ProlongationDetail::Node > const & | parents, |
std::vector< size_t > const & | indexInCoarse, | ||
size_t | nc, | ||
int | fineLevel | ||
) |
Constructor.
parents | a sequence of node information. The parent indices for fine grid nodes shall refer to the fine grid numbering. |
indexInCoarse | a vector of length of fine grid vertices. For each coarse grid node, it contains the index of that node in the coarse grid. |
nc | the number of coarse grid nodes (i.e. number of columns in P) |
fineLevel | the level of fine grid nodes |
|
inline |
Returns the prolongation in form of a sparse matrix.
Definition at line 283 of file prolongation.hh.
|
inline |
Galerkin projection of fine grid matrices. This computes \( P^T A P \).
Entry | the entry type of Galerkin matrix to be projected, in general a quadratic Dune::FieldMatrix type |
Index | the Index type of the matrix to be projected |
A | the quadratic fine level Galerkin matrix of size \( N\times N \) to be projected |
onlyLowerTriangle | if 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.
|
inline |
The number of columns.
Definition at line 274 of file prolongation.hh.
Referenced by asMatrix(), and galerkinProjection().
|
inline |
Transpose matrix vector multiplication.
This computes \( c \leftarrow P^T f \).
c | the coarse grid target vector. It is resized to contain the result. |
Definition at line 248 of file prolongation.hh.
|
inline |
Matrix vector multiplcation.
This computes \( f \leftarrow Pc \), and is faster than but equivalent to
f | the fine grid target vector. It has to have the correct size. |
Definition at line 228 of file prolongation.hh.
|
inline |
The number of rows.
Definition at line 266 of file prolongation.hh.
Referenced by asMatrix(), and galerkinProjection().
|
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.
|
inline |
Matrix vector multiplcation (update mode).
This computes \( f \leftarrow f + Pc \).
f | the fine grid target vector. It has to have the correct size. |
Definition at line 204 of file prolongation.hh.