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

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

Inheritance diagram for dg::aRealTopology3d< 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 = RealGrid3d< 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 z0 () const
 left boundary in z More...
 
real_type z1 () const
 right boundary in z More...
 
real_type lx () const
 length in x More...
 
real_type ly () const
 length in y More...
 
real_type lz () const
 length in z More...
 
real_type hx () const
 cell size in x More...
 
real_type hy () const
 cell size in y More...
 
real_type hz () const
 cell size in z 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 nz () const
 number of polynomial coefficients in z More...
 
unsigned Nx () const
 number of points in x More...
 
unsigned Ny () const
 number of points in y More...
 
unsigned Nz () const
 number of points in z More...
 
bc bcx () const
 boundary conditions in x More...
 
bc bcy () const
 boundary conditions in y More...
 
bc bcz () const
 boundary conditions in z More...
 
const DLT< real_type > & dltx () const
 discrete legendre transformation in x More...
 
const DLT< real_type > & dlty () const
 discrete legendre transformation in y More...
 
const DLT< real_type > & dltz () const
 discrete legendre transformation in z More...
 
const RealGrid1d< real_type > & gx () const
 The x-axis grid. More...
 
const RealGrid1d< real_type > & gy () const
 The y-axis grid. More...
 
const RealGrid1d< real_type > & gz () const
 The z-axis grid. 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, real_type &z) 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, real_type &z, bc bcx, bc bcy, bc bcz) const
 Shift any point coordinate to a corresponding grid coordinate according to the boundary condition. More...
 
bool contains (real_type x, real_type y, real_type z) 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], x[2]) 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, unsigned new_Nz)
 Set the number of polynomials and cells. More...
 
void set (unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz)
 Set the number of polynomials and cells. More...
 

Protected Member Functions

 ~aRealTopology3d ()=default
 disallow deletion through base class pointer More...
 
 aRealTopology3d (RealGrid1d< real_type > gx, RealGrid1d< real_type > gy, RealGrid1d< real_type > gz)
 Construct a 3d topology as the product of three 1d grids. More...
 
 aRealTopology3d (const aRealTopology3d &src)=default
 
aRealTopology3doperator= (const aRealTopology3d &src)=default
 
virtual void do_set (unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz)=0
 

Detailed Description

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

An abstract base class for three-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::aRealTopology3d< real_type >::host_grid = RealGrid3d<real_type>

◆ host_vector

template<class real_type >
using dg::aRealTopology3d< 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::aRealTopology3d< real_type >::value_type = real_type

Constructor & Destructor Documentation

◆ ~aRealTopology3d()

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

disallow deletion through base class pointer

◆ aRealTopology3d() [1/2]

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

Construct a 3d topology as the product of three 1d grids.

The simplest implementation of aRealTopology3d.
Definition: grid.h:844
real_type y0() const
left boundary in y
Definition: grid.h:547
unsigned nz() const
number of polynomial coefficients in z
Definition: grid.h:616
bc bcz() const
boundary conditions in z
Definition: grid.h:652
unsigned Nx() const
number of points in x
Definition: grid.h:622
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:614
real_type x0() const
left boundary in x
Definition: grid.h:534
real_type y1() const
right boundary in y
Definition: grid.h:553
real_type z0() const
left boundary in z
Definition: grid.h:560
real_type x1() const
right boundary in x
Definition: grid.h:540
unsigned Ny() const
number of points in y
Definition: grid.h:628
bc bcy() const
boundary conditions in y
Definition: grid.h:646
bc bcx() const
boundary conditions in x
Definition: grid.h:640
real_type z1() const
right boundary in z
Definition: grid.h:566
unsigned Nz() const
number of points in z
Definition: grid.h:634
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:612
Parameters
gxa Grid1d in x - direction
gya Grid1d in y - direction
gza Grid1d in z - direction

◆ aRealTopology3d() [2/2]

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

explicit copy constructor (default)

Parameters
srcsource

Member Function Documentation

◆ bcx()

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

boundary conditions in x

Returns

◆ bcy()

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

boundary conditions in y

Returns

◆ bcz()

template<class real_type >
bc dg::aRealTopology3d< real_type >::bcz ( ) const
inline

boundary conditions in z

Returns

◆ contains() [1/2]

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

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

◆ contains() [2/2]

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

Check if the grid contains a point.

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

◆ display()

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

Display.

Parameters
osoutput stream

◆ dltx()

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

discrete legendre transformation in x

◆ dlty()

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

discrete legendre transformation in y

◆ dltz()

template<class real_type >
const DLT< real_type > & dg::aRealTopology3d< real_type >::dltz ( ) const
inline

discrete legendre transformation in z

◆ do_set()

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

◆ gx()

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

The x-axis grid.

◆ gy()

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

The y-axis grid.

◆ gz()

template<class real_type >
const RealGrid1d< real_type > & dg::aRealTopology3d< real_type >::gz ( ) const
inline

The z-axis grid.

◆ hx()

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

cell size in x

Returns

◆ hy()

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

cell size in y

Returns

◆ hz()

template<class real_type >
real_type dg::aRealTopology3d< real_type >::hz ( ) const
inline

cell size in z

Returns

◆ lx()

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

length in x

Returns

◆ ly()

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

length in y

Returns

◆ lz()

template<class real_type >
real_type dg::aRealTopology3d< real_type >::lz ( ) const
inline

length in z

Returns

◆ multiplyCellNumbers()

template<class real_type >
void dg::aRealTopology3d< 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::aRealTopology3d< real_type >::n ( ) const
inline

number of polynomial coefficients in x

Returns

◆ nx()

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

number of polynomial coefficients in x

◆ Nx()

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

number of points in x

Returns

◆ ny()

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

number of polynomial coefficients in y

◆ Ny()

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

number of points in y

Returns

◆ nz()

template<class real_type >
unsigned dg::aRealTopology3d< real_type >::nz ( ) const
inline

number of polynomial coefficients in z

◆ Nz()

template<class real_type >
unsigned dg::aRealTopology3d< real_type >::Nz ( ) const
inline

number of points in z

Returns

◆ operator=()

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

explicit assignment operator (default)

Parameters
srcsource

◆ set() [1/2]

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

Set the number of polynomials and cells.

Set nz to 1 Same as set(new_n,new_Nx,new_n,new_Ny,1,new_Nz)

Parameters
new_nnew number of Gaussian nodes in x and y
new_Nxnew number of cells in x
new_Nynew number of cells in y
new_Nznew number of cells in z

◆ set() [2/2]

template<class real_type >
void dg::aRealTopology3d< real_type >::set ( unsigned  new_nx,
unsigned  new_Nx,
unsigned  new_ny,
unsigned  new_Ny,
unsigned  new_nz,
unsigned  new_Nz 
)
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
new_nznew number of Gaussian nodes in z
new_Nznew number of cells in z

◆ shift() [1/2]

template<class real_type >
void dg::aRealTopology3d< real_type >::shift ( bool &  negative,
real_type &  x,
real_type &  y,
real_type &  z 
) 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
zpoint (z) to shift (inout) the result is guaranteed to lie inside the grid

◆ shift() [2/2]

template<class real_type >
void dg::aRealTopology3d< real_type >::shift ( bool &  negative,
real_type &  x,
real_type &  y,
real_type &  z,
bc  bcx,
bc  bcy,
bc  bcz 
) 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
zpoint (z) 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
bczoverrule grid internal boundary condition with this value

◆ size()

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

The total number of points.

Returns
nx*ny*nz*Nx*Ny*Nz

◆ x0()

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

left boundary in x

Returns

◆ x1()

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

right boundary in x

Returns

◆ y0()

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

left boundary in y

Returns

◆ y1()

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

right boundary in y

Returns

◆ z0()

template<class real_type >
real_type dg::aRealTopology3d< real_type >::z0 ( ) const
inline

left boundary in z

Returns

◆ z1()

template<class real_type >
real_type dg::aRealTopology3d< real_type >::z1 ( ) const
inline

right boundary in z

Returns

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