Discontinuous Galerkin Library
#include "dg/algorithm.h"
Loading...
Searching...
No Matches
Level 99: Miscellaneous additions
Collaboration diagram for Level 99: Miscellaneous additions:

Topics

 Timer class
 t.tic(); t.toc(); t.diff();
 
 Functions and functors
 
 MPI utility functions
 
 Lowlevel helper functions and classes
 

Classes

class  dg::Message
 small class holding a stringstream More...
 
class  dg::Error
 class intended for the use in throw statements More...
 
struct  dg::Fail
 Indicate failure to converge. More...
 
class  dg::NoRoot1d
 Exception class, that stores boundaries for 1D root finding. More...
 

Functions

void dg::abort_program (int code=-1)
 Abort program (both MPI and non-MPI)
 
template<class UnaryOp >
dg::SquareMatrix< std::invoke_result_t< UnaryOp, unsigned > > dg::create::modal_filter (UnaryOp op, unsigned n)
 Create a modal filter block \( V D V^{-1}\).
 

Detailed Description

Function Documentation

◆ abort_program()

void dg::abort_program ( int code = -1)
inline

Abort program (both MPI and non-MPI)

#ifdef MPI_VERSION
MPI_Abort(MPI_COMM_WORLD, code);
#endif //WITH_MPI
exit( code);
Parameters
codeThe abortion code that will be signalled to the caller (of the program)

◆ modal_filter()

template<class UnaryOp >
dg::SquareMatrix< std::invoke_result_t< UnaryOp, unsigned > > dg::create::modal_filter ( UnaryOp op,
unsigned n )

Create a modal filter block \( V D V^{-1}\).

where \( V\) is the Vandermonde matrix (the backward transformation matrix) and \( D \) is a diagonal matrix with \( D_{ii} = \sigma(i)\)

See also
A discussion of the effects of the modal filter on advection schemes can be found here https://mwiesenberger.github.io/advection
Note
basically the result is that it is usually not advantageous to use a modal filter
Template Parameters
UnaryOpModel of Unary Function real_type sigma(unsigned) The input will be the modal number i where \( i=0,...,n-1\) and n is the number of polynomial coefficients in use. The output is the filter strength for the given mode number
Parameters
opthe unary function
nnumber of polynomial coefficients for forward and backward transformation
Returns
The product \( V D V^{-1}\)
Note
The idea is to use the result in connection with dg::create::fast_transform() to create a matrix that applies the filter to vectors. For example to create a modal filter that acts in two dimensions:
// create filter:
dg::create::modal_filter( op, grid.nx()),
dg::create::modal_filter( op, grid.ny()), grid);
//apply filter:
dg::blas2::symv( filter, x, y);
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition blas2.h:325
@ y
y direction
EllSparseBlockMat< real_type, thrust::host_vector > fast_transform(unsigned coord, const dg::SquareMatrix< real_type > &opx, const aRealTopology< real_type, Nd > &t)
Create a block-diagonal matrix.
Definition fast_interpolation.h:326
dg::SquareMatrix< std::invoke_result_t< UnaryOp, unsigned > > modal_filter(UnaryOp op, unsigned n)
Create a modal filter block .
Definition filter.h:40