Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::GeneralHelmholtz< Matrix, Container > Struct Template Reference

A general Helmholtz-type operator \( (\chi-\alpha F) \). More...

Public Types

using matrix_type = Matrix
 
using container_type = Container
 
using value_type = get_value_type< Container >
 

Public Member Functions

 GeneralHelmholtz ()=default
 empty object ( no memory allocation) More...
 
 GeneralHelmholtz (value_type alpha, Matrix matrix)
 Construct from given Matrix object. More...
 
template<class ... Params>
void construct (Params &&...ps)
 Perfect forward parameters to one of the constructors. More...
 
const Container & weights () const
 Call weights() of Matrix class. More...
 
const Container & precond () const
 Call precond() of Matrix class. More...
 
template<class ContainerType0 , class ContainerType1 >
void symv (const ContainerType0 &x, ContainerType1 &y)
 Compute. More...
 
Matrix & matrix ()
 Write access to Matrix object. More...
 
const Matrix & matrix () const
 Read access to Matrix object. More...
 
value_typealpha ()
 Change alpha. More...
 
value_type alpha () const
 Access alpha. More...
 
template<class ContainerType0 >
void set_chi (const ContainerType0 &chi)
 Set Chi in the above formula. More...
 
const Container & chi () const
 Access chi. More...
 

Detailed Description

template<class Matrix, class Container>
struct dg::GeneralHelmholtz< Matrix, Container >

A general Helmholtz-type operator \( (\chi-\alpha F) \).

where \( \chi\) is a vector and \(\alpha\) a scalar and \(F\) is an operator.

Attention
If \( F\) is the Elliptic operator then the Laplacian in this formula becomes positive as opposed to the negative sign in the Elliptic operator

Can be used by the dg::PCG class. The following example shows how the class can be used to act as a Helmholtz2 operator:

std::cout << "Alternative test with two Helmholtz operators\n";
gamma1inv.set_chi( chi);
dg::PCG<dg::DVec> pcgO( x, grid2d.size());
dg::PCG<dg::DVec> pcgOO( x, grid2d.size());
t.tic();
unsigned number1 = pcgO.solve( gamma1inv, phi, rholap, 1., w2d, eps/100);
unsigned number2 = pcgOO.solve( gamma1inv, x, phi, 1., w2d, eps/100);
t.toc();
//Evaluation
dg::blas1::axpby( 1., sol, -1., x);
Preconditioned conjugate gradient method to solve .
Definition: pcg.h:57
void axpby(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:231
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
@ centered
centered derivative (cell to the left and right and current cell)
Definition: enums.h:100
A general Helmholtz-type operator .
Definition: helmholtz.h:34
value_type & alpha()
Change alpha.
Definition: helmholtz.h:95
const Container & chi() const
Access chi.
Definition: helmholtz.h:116
void set_chi(const ContainerType0 &chi)
Set Chi in the above formula.
Definition: helmholtz.h:109
Template Parameters
GeometryA type that is or derives from one of the abstract geometry base classes ( aGeometry2d, aGeometry3d, aMPIGeometry2d, ...). Geometry determines which Matrix and Container types can be used:
MatrixA class for which the dg::blas2::symv functions are callable in connection with the Container class and to which the return type of dg::create::dx() can be converted using dg::blas2::transfer. The Matrix type can be one of:
ContainerA data container class for which the blas1 functionality is overloaded and to which the return type of blas1::subroutine() can be converted using dg::assign. We assume that Container is copyable/assignable and has a swap member function. In connection with Geometry this is one of
Note
The intention is for Matrix to be one of the Elliptic classes with the weights() and precond() methods defined. If Matrix is to be an arbitrary functor then it is more convenient to simply directly use a lambda function to achieve the computation of \( y = (\chi - \alpha F)x\)

Member Typedef Documentation

◆ container_type

template<class Matrix , class Container >
using dg::GeneralHelmholtz< Matrix, Container >::container_type = Container

◆ matrix_type

template<class Matrix , class Container >
using dg::GeneralHelmholtz< Matrix, Container >::matrix_type = Matrix

◆ value_type

template<class Matrix , class Container >
using dg::GeneralHelmholtz< Matrix, Container >::value_type = get_value_type<Container>

Constructor & Destructor Documentation

◆ GeneralHelmholtz() [1/2]

template<class Matrix , class Container >
dg::GeneralHelmholtz< Matrix, Container >::GeneralHelmholtz ( )
default

empty object ( no memory allocation)

◆ GeneralHelmholtz() [2/2]

template<class Matrix , class Container >
dg::GeneralHelmholtz< Matrix, Container >::GeneralHelmholtz ( value_type  alpha,
Matrix  matrix 
)
inline

Construct from given Matrix object.

Parameters
alphaScalar in the above formula
matrixan existing elliptic operator

Member Function Documentation

◆ alpha() [1/2]

template<class Matrix , class Container >
value_type & dg::GeneralHelmholtz< Matrix, Container >::alpha ( )
inline

Change alpha.

Returns
reference to alpha

◆ alpha() [2/2]

template<class Matrix , class Container >
value_type dg::GeneralHelmholtz< Matrix, Container >::alpha ( ) const
inline

Access alpha.

Returns
alpha

◆ chi()

template<class Matrix , class Container >
const Container & dg::GeneralHelmholtz< Matrix, Container >::chi ( ) const
inline

Access chi.

Returns
chi

◆ construct()

template<class Matrix , class Container >
template<class ... Params>
void dg::GeneralHelmholtz< Matrix, Container >::construct ( Params &&...  ps)
inline

Perfect forward parameters to one of the constructors.

Template Parameters
Paramsdeduced by the compiler
Parameters
psparameters forwarded to constructors

◆ matrix() [1/2]

template<class Matrix , class Container >
Matrix & dg::GeneralHelmholtz< Matrix, Container >::matrix ( )
inline

Write access to Matrix object.

◆ matrix() [2/2]

template<class Matrix , class Container >
const Matrix & dg::GeneralHelmholtz< Matrix, Container >::matrix ( ) const
inline

Read access to Matrix object.

◆ precond()

template<class Matrix , class Container >
const Container & dg::GeneralHelmholtz< Matrix, Container >::precond ( ) const
inline

Call precond() of Matrix class.

◆ set_chi()

template<class Matrix , class Container >
template<class ContainerType0 >
void dg::GeneralHelmholtz< Matrix, Container >::set_chi ( const ContainerType0 &  chi)
inline

Set Chi in the above formula.

Parameters
chinew Container
Template Parameters
ContainerTypesmust be usable with Container in The dg dispatch system

◆ symv()

template<class Matrix , class Container >
template<class ContainerType0 , class ContainerType1 >
void dg::GeneralHelmholtz< Matrix, Container >::symv ( const ContainerType0 &  x,
ContainerType1 &  y 
)
inline

Compute.

\[ y = ( \chi - \alpha M) x \]

Parameters
xlhs
yrhs contains solution
Template Parameters
ContainerTypesmust be usable with Container_type in The dg dispatch system

◆ weights()

template<class Matrix , class Container >
const Container & dg::GeneralHelmholtz< Matrix, Container >::weights ( ) const
inline

Call weights() of Matrix class.


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