AlgebraicMultigrid 0.1
C++ algebraic multigrid.
Loading...
Searching...
No Matches
AMG::Grid< EleType > Class Template Reference

Static functions for constructing A and b, the components of a linear system Au = b. More...

#include <grid.hpp>

Static Public Member Functions

static EleType grid_spacing_h (size_t n)
 Compute the gridspacing h of a domain given n points in a direction.
 
static size_t points_n_from_grid_spacing_h (EleType h=1./50)
 Compute the number of points in a direction given gridspacing h.
 
static Eigen::SparseMatrix< EleType > second_order_central_difference (size_t n)
 Return second order central difference as linear operator on 1D function.
 
static Eigen::SparseMatrix< EleType > laplacian (size_t n)
 Return coefficients matrix A for laplacian as linear operator on u(x,y) assuming homogenous dirichlet BCs.
 
static Eigen::Matrix< EleType, -1, 1 > rhs (size_t n, std::function< EleType(EleType, EleType)> f=[](EleType x, EleType y) { return 5 *exp(-10 *(x *x+y *y));})
 Return right hand side vector b by evaluating f on a mesh grid in [-1, 1]^2.
 

Static Private Attributes

static const size_t n_boundary_points = 2
 

Detailed Description

template<class EleType>
class AMG::Grid< EleType >

Static functions for constructing A and b, the components of a linear system Au = b.

Template Parameters
EleType

Member Function Documentation

◆ grid_spacing_h()

template<class EleType >
static EleType AMG::Grid< EleType >::grid_spacing_h ( size_t n)
inlinestatic

Compute the gridspacing h of a domain given n points in a direction.

Parameters
n
Returns
EleType

◆ laplacian()

template<class EleType >
static Eigen::SparseMatrix< EleType > AMG::Grid< EleType >::laplacian ( size_t n)
inlinestatic

Return coefficients matrix A for laplacian as linear operator on u(x,y) assuming homogenous dirichlet BCs.

References:

[1] : MIT Intro Linear PDEs

Parameters
nNumber of grid points in the x or y direction.
Returns
Eigen::SparseMatrix<EleType>

◆ points_n_from_grid_spacing_h()

template<class EleType >
static size_t AMG::Grid< EleType >::points_n_from_grid_spacing_h ( EleType h = 1. / 50)
inlinestatic

Compute the number of points in a direction given gridspacing h.

Parameters
h
Returns
size_t

◆ rhs()

template<class EleType >
static Eigen::Matrix< EleType, -1, 1 > AMG::Grid< EleType >::rhs ( size_t n,
std::function< EleType(EleType, EleType)> f = [](EleType x, EleType y) { return 5 * exp(-10 * (x * x + y * y)); } )
inlinestatic

Return right hand side vector b by evaluating f on a mesh grid in [-1, 1]^2.

Parameters
nNumber of interior grid points in the x or y direction.
fFunction to be evaluated at each mesh grid point.
Returns
Eigen::Matrix<EleType, -1, 1>

◆ second_order_central_difference()

template<class EleType >
static Eigen::SparseMatrix< EleType > AMG::Grid< EleType >::second_order_central_difference ( size_t n)
inlinestatic

Return second order central difference as linear operator on 1D function.

Parameters
nNumber of grid points in the x or y direction.
Returns
Eigen::SparseMatrix<EleType>

Member Data Documentation

◆ n_boundary_points

template<class EleType >
const size_t AMG::Grid< EleType >::n_boundary_points = 2
staticprivate

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