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

two-dimensional Grid with Cartesian metric More...

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

Public Member Functions

 RealCartesianGrid2d (real_type x0, real_type x1, real_type y0, real_type y1, unsigned n, unsigned Nx, unsigned Ny, bc bcx=PER, bc bcy=PER)
 Equal polynomial coefficients. More...
 
 RealCartesianGrid2d (RealGrid1d< real_type > gx, RealGrid1d< real_type > gy)
 Construct a 2d grid as the product of two 1d grids. More...
 
 RealCartesianGrid2d (const dg::RealGrid2d< real_type > &g)
 Construct from existing topology. More...
 
virtual RealCartesianGrid2d< real_type > * clone () const override final
 Geometries are cloneable. More...
 
- Public Member Functions inherited from dg::aRealGeometry2d< real_type >
SparseTensor< thrust::host_vector< real_type > > jacobian () const
 The Jacobian of the coordinate transformation from physical to computational space. More...
 
SparseTensor< thrust::host_vector< real_type > > metric () const
 The (inverse) metric tensor of the coordinate system. More...
 
std::vector< thrust::host_vector< real_type > > map () const
 The coordinate map from computational to physical space. More...
 
virtual aRealGeometry2dclone () const =0
 Geometries are cloneable. More...
 
virtual ~aRealGeometry2d ()=default
 allow deletion through base class pointer More...
 
- Public Member Functions inherited from dg::aRealTopology2d< real_type >
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...
 

Additional Inherited Members

- Public Types inherited from dg::aRealTopology2d< real_type >
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 >
 
- Protected Member Functions inherited from dg::aRealGeometry2d< real_type >
 aRealGeometry2d (const aRealGeometry2d &src)=default
 
aRealGeometry2doperator= (const aRealGeometry2d &src)=default
 
- Protected Member Functions inherited from dg::aRealTopology2d< real_type >
 ~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::RealCartesianGrid2d< real_type >

two-dimensional Grid with Cartesian metric

// create a Cartesian grid on the domain [0,lx]x[0,ly]
const dg::CartesianGrid2d grid( 0, lx, 0, ly, n, Nx, Ny, bcx, bcy);
// evaluate left and right hand side on the grid
const dg::DVec lhs = dg::construct<dg::DVec>( dg::evaluate( left, grid));
const dg::DVec rhs = dg::construct<dg::DVec>( dg::evaluate( right, grid));
dg::DVec jac(lhs);
// create an Arakawa object
//apply arakawa scheme
arakawa( lhs, rhs, jac);
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
thrust::device_vector< double > DVec
Device Vector. The device can be an OpenMP parallelized cpu or a gpu. This depends on the value of th...
Definition: typedefs.h:23
Arakawa's scheme for Poisson bracket .
Definition: arakawa.h:36
two-dimensional Grid with Cartesian metric
Definition: base_geometry.h:215
unsigned n() const
number of polynomial coefficients in x
Definition: grid.h:336
real_type ly() const
length of y
Definition: grid.h:318
bc bcx() const
boundary conditions in x
Definition: grid.h:358
real_type lx() const
length of x
Definition: grid.h:312
unsigned Nx() const
number of cells in x
Definition: grid.h:346
bc bcy() const
boundary conditions in y
Definition: grid.h:364
unsigned Ny() const
number of cells in y
Definition: grid.h:352

Constructor & Destructor Documentation

◆ RealCartesianGrid2d() [1/3]

template<class real_type >
dg::RealCartesianGrid2d< real_type >::RealCartesianGrid2d ( real_type  x0,
real_type  x1,
real_type  y0,
real_type  y1,
unsigned  n,
unsigned  Nx,
unsigned  Ny,
bc  bcx = PER,
bc  bcy = PER 
)
inline

Equal polynomial coefficients.

Parameters
x0left boundary in x
x1right boundary in x
y0lower boundary in y
y1upper boundary in y
n# of polynomial coefficients for both x and y dimension (1<=n<=20)
Nx# of points in x
Ny# of points in y
bcxboundary condition in x
bcyboundary condition in y

◆ RealCartesianGrid2d() [2/3]

template<class real_type >
dg::RealCartesianGrid2d< real_type >::RealCartesianGrid2d ( RealGrid1d< real_type >  gx,
RealGrid1d< real_type >  gy 
)
inline

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
real_type y0() const
left boundary in y
Definition: grid.h:300
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
Parameters
gxa Grid in x - direction
gya Grid in y - direction

◆ RealCartesianGrid2d() [3/3]

template<class real_type >
dg::RealCartesianGrid2d< real_type >::RealCartesianGrid2d ( const dg::RealGrid2d< real_type > &  g)
inline

Construct from existing topology.

Parameters
gexisting grid class

Member Function Documentation

◆ clone()

template<class real_type >
virtual RealCartesianGrid2d< real_type > * dg::RealCartesianGrid2d< real_type >::clone ( ) const
inlinefinaloverridevirtual

Geometries are cloneable.

Implements dg::aRealGeometry2d< real_type >.


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