Discontinuous Galerkin Library
#include "dg/algorithm.h"
Loading...
Searching...
No Matches

1D grid for X-point topology More...

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.
 
using host_grid = RealGridX1d<real_type>
 

Public Member Functions

 RealGridX1d ()=default
 
 RealGridX1d (real_type x0, real_type x1, real_type f, unsigned n, unsigned N, bc bcx=NEU)
 1D X-point grid
 
host_vector abscissas (unsigned u=0) const
 
host_vector weights (unsigned u=0) const
 
unsigned shape (unsigned u=0) const
 
auto get_shape () const
 
real_type x0 () const
 left boundary
 
real_type x1 () const
 right boundary
 
real_type f () const
 Factor.
 
real_type lx () const
 total length of interval
 
real_type h () const
 cell size
 
unsigned N () const
 number of cells
 
unsigned outer_N () const
 number of cells in one of the outer regions
 
unsigned inner_N () const
 number of cells in the inner region
 
unsigned n () const
 number of polynomial coefficients
 
bc bcx () const
 boundary conditions
 
unsigned size () const
 the total number of points
 
void display (std::ostream &os=std::cout) const
 Display.
 
RealGrid< real_type, 1 > grid () const
 
void shift_topologic (real_type x0, real_type &x1) const
 Shifts a point coordinate due to topology.
 
bool contains (real_type x) const
 Check if the grid contains a point.
 

Static Public Member Functions

static constexpr unsigned ndim ()
 number of dimensions : 1
 

Detailed Description

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

1D grid for X-point topology

The grid looks like

|------x----------x------|
@ x
x direction

, where the x indicates the periodicity and - the number of points The left boundary is x0 and the right x1, the inner boundaries lie at x0 + f*Lx and x1-f*Lx therefore f must be smaller than 0.5

Member Typedef Documentation

◆ host_grid

template<class real_type >
using dg::RealGridX1d< real_type >::host_grid = RealGridX1d<real_type>

◆ host_vector

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

Constructor & Destructor Documentation

◆ RealGridX1d() [1/2]

template<class real_type >
dg::RealGridX1d< real_type >::RealGridX1d ( )
default

◆ RealGridX1d() [2/2]

template<class real_type >
dg::RealGridX1d< real_type >::RealGridX1d ( real_type x0,
real_type x1,
real_type f,
unsigned n,
unsigned N,
bc bcx = NEU )
inline

1D X-point grid

Parameters
x0left boundary
x1right boundary
ffactor 0<f<0.5 divides the domain
n# of polynomial coefficients
N# of cells
bcxboundary conditions

Member Function Documentation

◆ abscissas()

template<class real_type >
host_vector dg::RealGridX1d< real_type >::abscissas ( unsigned u = 0) const
inline

◆ bcx()

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

boundary conditions

Returns

◆ contains()

template<class real_type >
bool dg::RealGridX1d< real_type >::contains ( real_type x) const
inline

Check if the grid contains a point.

Note
doesn't check periodicity!!
Parameters
xpoint to check
Returns
true if x0()<=x<=x1(), false else

◆ display()

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

Display.

Parameters
osoutput stream

◆ f()

template<class real_type >
real_type dg::RealGridX1d< real_type >::f ( ) const
inline

Factor.

Returns

◆ get_shape()

template<class real_type >
auto dg::RealGridX1d< real_type >::get_shape ( ) const
inline

◆ grid()

template<class real_type >
RealGrid< real_type, 1 > dg::RealGridX1d< real_type >::grid ( ) const
inline

◆ h()

template<class real_type >
real_type dg::RealGridX1d< real_type >::h ( ) const
inline

cell size

Returns

◆ inner_N()

template<class real_type >
unsigned dg::RealGridX1d< real_type >::inner_N ( ) const
inline

number of cells in the inner region

Returns

◆ lx()

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

total length of interval

Returns

◆ N()

template<class real_type >
unsigned dg::RealGridX1d< real_type >::N ( ) const
inline

number of cells

Returns

◆ n()

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

number of polynomial coefficients

Returns

◆ ndim()

template<class real_type >
static constexpr unsigned dg::RealGridX1d< real_type >::ndim ( )
inlinestaticconstexpr

number of dimensions : 1

◆ outer_N()

template<class real_type >
unsigned dg::RealGridX1d< real_type >::outer_N ( ) const
inline

number of cells in one of the outer regions

Returns

◆ shape()

template<class real_type >
unsigned dg::RealGridX1d< real_type >::shape ( unsigned u = 0) const
inline

◆ shift_topologic()

template<class real_type >
void dg::RealGridX1d< real_type >::shift_topologic ( real_type x0,
real_type & x1 ) const
inline

Shifts a point coordinate due to topology.

If you want to construct a point by adding delta X to a given point x0 then the resulting coordinate x1 might be incorrect due to topologic reasons (periodic boundaries). This function corrects this coordinate

Parameters
x0starting point (must lie inside of the grid)
x1end point (inout)

◆ size()

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

the total number of points

Returns
n*Nx

◆ weights()

template<class real_type >
host_vector dg::RealGridX1d< real_type >::weights ( unsigned u = 0) const
inline

◆ x0()

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

left boundary

Returns

◆ x1()

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

right boundary

Returns

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