Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::aRealTopology2d< real_type > Struct Template Referenceabstract

An abstract base class for two-dimensional grids. More...

Inheritance diagram for dg::aRealTopology2d< real_type >:
[legend]

Public Types

using value_type = real_type
 
using host_vector = thrust::host_vector< real_type >
 The host vector type used by host functions like evaluate. More...
 
using host_grid = RealGrid2d< real_type >
 

Public Member Functions

real_type x0 () const
 Left boundary in x. More...
 
real_type x1 () const
 Right boundary in x. More...
 
real_type y0 () const
 left boundary in y More...
 
real_type y1 () const
 Right boundary in y. More...
 
real_type lx () const
 length of x More...
 
real_type ly () const
 length of y More...
 
real_type hx () const
 cell size in x More...
 
real_type hy () const
 cell size in y More...
 
unsigned n () const
 number of polynomial coefficients in x More...
 
unsigned nx () const
 number of polynomial coefficients in x More...
 
unsigned ny () const
 number of polynomial coefficients in y More...
 
unsigned Nx () const
 number of cells in x More...
 
unsigned Ny () const
 number of cells in y More...
 
bc bcx () const
 boundary conditions in x More...
 
bc bcy () const
 boundary conditions in y More...
 
const DLT< real_type > & dltx () const
 discrete legendre trafo More...
 
const DLT< real_type > & dlty () const
 discrete legendre transformation in y More...
 
const RealGrid1d< real_type > & gx () const
 The x-axis grid. More...
 
const RealGrid1d< real_type > & gy () const
 The y-axis grid. More...
 
void multiplyCellNumbers (real_type fx, real_type fy)
 Multiply the number of cells with a given factor. More...
 
void set (unsigned new_n, unsigned new_Nx, unsigned new_Ny)
 Set the number of polynomials and cells. More...
 
void set (unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny)
 Set the number of polynomials and cells. More...
 
unsigned size () const
 The total number of points. More...
 
void display (std::ostream &os=std::cout) const
 Display. More...
 
void shift (bool &negative, real_type &x, real_type &y) const
 Shift any point coordinate to a corresponding grid coordinate according to the boundary condition. More...
 
void shift (bool &negative, real_type &x, real_type &y, bc bcx, bc bcy) const
 Shift any point coordinate to a corresponding grid coordinate according to the boundary condition. More...
 
bool contains (real_type x, real_type y) const
 Check if the grid contains a point. More...
 
template<class Vector >
bool contains (const Vector &x) const
 Shortcut for contains( x[0], x[1]) More...
 

Protected Member Functions

 ~aRealTopology2d ()=default
 disallow destruction through base class pointer More...
 
 aRealTopology2d (RealGrid1d< real_type > gx, RealGrid1d< real_type > gy)
 Construct a 2d grid as the product of two 1d grids. More...
 
 aRealTopology2d (const aRealTopology2d &src)=default
 
aRealTopology2doperator= (const aRealTopology2d &src)=default
 
virtual void do_set (unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny)=0
 

Detailed Description

template<class real_type>
struct dg::aRealTopology2d< real_type >

An abstract base class for two-dimensional grids.

Note
although it is abstract, objects are not meant to be hold on the heap via a base class pointer ( we protected the destructor)

Member Typedef Documentation

◆ host_grid

template<class real_type >
using dg::aRealTopology2d< real_type >::host_grid = RealGrid2d<real_type>

◆ host_vector

template<class real_type >
using dg::aRealTopology2d< real_type >::host_vector = thrust::host_vector<real_type>

The host vector type used by host functions like evaluate.

◆ value_type

template<class real_type >
using dg::aRealTopology2d< real_type >::value_type = real_type

Constructor & Destructor Documentation

◆ ~aRealTopology2d()

template<class real_type >
dg::aRealTopology2d< real_type >::~aRealTopology2d ( )
protecteddefault

disallow destruction through base class pointer

◆ aRealTopology2d() [1/2]

template<class real_type >
dg::aRealTopology2d< real_type >::aRealTopology2d ( RealGrid1d< real_type >  gx,
RealGrid1d< real_type >  gy 
)
inlineprotected

Construct a 2d grid as the product of two 1d grids.

real_type x0() const
Left boundary in x.
Definition: grid.h:288
real_type y1() const
Right boundary in y.
Definition: grid.h:306
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:340
bc bcx() const
boundary conditions in x
Definition: grid.h:358
real_type y0() const
left boundary in y
Definition: grid.h:300
unsigned Nx() const
number of cells in x
Definition: grid.h:346
bc bcy() const
boundary conditions in y
Definition: grid.h:364
real_type x1() const
Right boundary in x.
Definition: grid.h:294
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:338
unsigned Ny() const
number of cells in y
Definition: grid.h:352
Parameters
gxa Grid in x - direction
gya Grid in y - direction

◆ aRealTopology2d() [2/2]

template<class real_type >
dg::aRealTopology2d< real_type >::aRealTopology2d ( const aRealTopology2d< real_type > &  src)
protecteddefault

explicit copy constructor (default)

Parameters
srcsource

Member Function Documentation

◆ bcx()

template<class real_type >
bc dg::aRealTopology2d< real_type >::bcx ( ) const
inline

boundary conditions in x

Returns

◆ bcy()

template<class real_type >
bc dg::aRealTopology2d< real_type >::bcy ( ) const
inline

boundary conditions in y

Returns

◆ contains() [1/2]

template<class real_type >
template<class Vector >
bool dg::aRealTopology2d< real_type >::contains ( const Vector &  x) const
inline

Shortcut for contains( x[0], x[1])

◆ contains() [2/2]

template<class real_type >
bool dg::aRealTopology2d< real_type >::contains ( real_type  x,
real_type  y 
) const
inline

Check if the grid contains a point.

Note
doesn't check periodicity!!
Parameters
xx-coordinate to check
yy-coordinate to check
Returns
true if x0()<=x<=x1() and y0()<=y<=y1(), false else

◆ display()

template<class real_type >
void dg::aRealTopology2d< real_type >::display ( std::ostream &  os = std::cout) const
inline

Display.

Parameters
osoutput stream

◆ dltx()

template<class real_type >
const DLT< real_type > & dg::aRealTopology2d< real_type >::dltx ( ) const
inline

discrete legendre trafo

Returns
discrete legendre transformation in x

◆ dlty()

template<class real_type >
const DLT< real_type > & dg::aRealTopology2d< real_type >::dlty ( ) const
inline

discrete legendre transformation in y

◆ do_set()

template<class real_type >
virtual void dg::aRealTopology2d< real_type >::do_set ( unsigned  new_nx,
unsigned  new_Nx,
unsigned  new_ny,
unsigned  new_Ny 
)
protectedpure virtual

◆ gx()

template<class real_type >
const RealGrid1d< real_type > & dg::aRealTopology2d< real_type >::gx ( ) const
inline

The x-axis grid.

◆ gy()

template<class real_type >
const RealGrid1d< real_type > & dg::aRealTopology2d< real_type >::gy ( ) const
inline

The y-axis grid.

◆ hx()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::hx ( ) const
inline

cell size in x

Returns

◆ hy()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::hy ( ) const
inline

cell size in y

Returns

◆ lx()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::lx ( ) const
inline

length of x

Returns

◆ ly()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::ly ( ) const
inline

length of y

Returns

◆ multiplyCellNumbers()

template<class real_type >
void dg::aRealTopology2d< real_type >::multiplyCellNumbers ( real_type  fx,
real_type  fy 
)
inline

Multiply the number of cells with a given factor.

With this function you can resize the grid ignorantly of its current size the number of polynomial coefficients is left as is

Parameters
fxnew number of cells is the nearest integer to fx*Nx()
fynew number of cells is the nearest integer to fy*Ny()

◆ n()

template<class real_type >
unsigned dg::aRealTopology2d< real_type >::n ( ) const
inline

number of polynomial coefficients in x

Returns

◆ nx()

template<class real_type >
unsigned dg::aRealTopology2d< real_type >::nx ( ) const
inline

number of polynomial coefficients in x

◆ Nx()

template<class real_type >
unsigned dg::aRealTopology2d< real_type >::Nx ( ) const
inline

number of cells in x

Returns

◆ ny()

template<class real_type >
unsigned dg::aRealTopology2d< real_type >::ny ( ) const
inline

number of polynomial coefficients in y

◆ Ny()

template<class real_type >
unsigned dg::aRealTopology2d< real_type >::Ny ( ) const
inline

number of cells in y

Returns

◆ operator=()

template<class real_type >
aRealTopology2d & dg::aRealTopology2d< real_type >::operator= ( const aRealTopology2d< real_type > &  src)
protecteddefault

explicit assignment operator (default)

Parameters
srcsource

◆ set() [1/2]

template<class real_type >
void dg::aRealTopology2d< real_type >::set ( unsigned  new_n,
unsigned  new_Nx,
unsigned  new_Ny 
)
inline

Set the number of polynomials and cells.

Same as set(new_n,new_Nx,new_n,new_Ny)

Parameters
new_nnew number of Gaussian nodes for both x and y
new_Nxnew number of cells in x
new_Nynew number of cells in y

◆ set() [2/2]

template<class real_type >
void dg::aRealTopology2d< real_type >::set ( unsigned  new_nx,
unsigned  new_Nx,
unsigned  new_ny,
unsigned  new_Ny 
)
inline

Set the number of polynomials and cells.

Parameters
new_nxnew number of Gaussian nodes in x
new_Nxnew number of cells in x
new_nynew number of Gaussian nodes in y
new_Nynew number of cells in y

◆ shift() [1/2]

template<class real_type >
void dg::aRealTopology2d< real_type >::shift ( bool &  negative,
real_type &  x,
real_type &  y 
) const
inline

Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.

If the given point is already inside the grid, the function does nothing, else along each dimension the following happens: check the boundary condition. If dg::PER, the point will be shifted topologically back onto the domain (modulo operation). Else the point will be mirrored at the closest boundary. If the boundary is a Dirichlet boundary (happens for dg::DIR, dg::DIR_NEU and dg::NEU_DIR; the latter two apply dg::DIR to the respective left or right boundary ) an additional sign flag is swapped. This process is repeated until the result lies inside the grid. This function forms the basis for extending/periodifying a function discretized on the grid beyond the grid boundaries.

See also
interpolate
Note
For periodic boundaries the right boundary point is considered outside the grid and is shifted to the left boundary point.
Parameters
negativeswap value if there was a sign swap (happens when a point is mirrored along a Dirichlet boundary)
xpoint to shift (inout) the result is guaranteed to lie inside the grid
ypoint (y) to shift (inout) the result is guaranteed to lie inside the grid

◆ shift() [2/2]

template<class real_type >
void dg::aRealTopology2d< real_type >::shift ( bool &  negative,
real_type &  x,
real_type &  y,
bc  bcx,
bc  bcy 
) const
inline

Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.

If the given point is already inside the grid, the function does nothing, else along each dimension the following happens: check the boundary condition. If dg::PER, the point will be shifted topologically back onto the domain (modulo operation). Else the point will be mirrored at the closest boundary. If the boundary is a Dirichlet boundary (happens for dg::DIR, dg::DIR_NEU and dg::NEU_DIR; the latter two apply dg::DIR to the respective left or right boundary ) an additional sign flag is swapped. This process is repeated until the result lies inside the grid. This function forms the basis for extending/periodifying a function discretized on the grid beyond the grid boundaries.

See also
interpolate
Note
For periodic boundaries the right boundary point is considered outside the grid and is shifted to the left boundary point.
Parameters
negativeswap value if there was a sign swap (happens when a point is mirrored along a Dirichlet boundary)
xpoint to shift (inout) the result is guaranteed to lie inside the grid
ypoint (y) to shift (inout) the result is guaranteed to lie inside the grid
bcxoverrule grid internal boundary condition with this value
bcyoverrule grid internal boundary condition with this value

◆ size()

template<class real_type >
unsigned dg::aRealTopology2d< real_type >::size ( ) const
inline

The total number of points.

Returns
nx*ny*Nx*Ny

◆ x0()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::x0 ( ) const
inline

Left boundary in x.

Returns

◆ x1()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::x1 ( ) const
inline

Right boundary in x.

Returns

◆ y0()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::y0 ( ) const
inline

left boundary in y

Returns

◆ y1()

template<class real_type >
real_type dg::aRealTopology2d< real_type >::y1 ( ) const
inline

Right boundary in y.

Returns

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