1D grid
More...
|
| RealGrid1d ()=default |
| construct an empty grid this leaves the access functions undefined More...
|
|
| RealGrid1d (real_type x0, real_type x1, unsigned n, unsigned N, bc bcx=PER) |
| 1D grid More...
|
|
real_type | x0 () const |
| left boundary More...
|
|
real_type | x1 () const |
| right boundary More...
|
|
real_type | lx () const |
| total length of interval More...
|
|
real_type | h () const |
| cell size More...
|
|
unsigned | N () const |
| number of cells More...
|
|
unsigned | n () const |
| number of polynomial coefficients More...
|
|
bc | bcx () const |
| boundary conditions More...
|
|
void | set (real_type x0, real_type x1, bc bcx) |
| reset the boundaries of the grid More...
|
|
void | set (unsigned n, unsigned N) |
| reset the cell numbers in the grid More...
|
|
void | set (real_type x0, real_type x1, unsigned n, unsigned N, bc bcx) |
| Reset all values of the grid. More...
|
|
unsigned | size () const |
| n()*N() (Total number of grid points) More...
|
|
const DLT< real_type > & | dlt () const |
| the discrete legendre transformation More...
|
|
void | display (std::ostream &os=std::cout) const |
|
void | shift (bool &negative, real_type &x) const |
| Shift any point coordinate to a corresponding grid coordinate according to the boundary condition. More...
|
|
void | shift (bool &negative, real_type &x, bc bcx) const |
| Shift any point coordinate to a corresponding grid coordinate according to the boundary condition. More...
|
|
bool | contains (real_type x) const |
| Check if the grid contains a point. More...
|
|
template<class real_type>
struct dg::RealGrid1d< real_type >
1D grid
This code snippet demonstrates how to discretize and integrate a function
get_value_type< ContainerType1 > dot(const ContainerType1 &x, const ContainerType2 &y)
Binary reproducible Euclidean dot product between two vectors
Definition: blas1.h:87
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
MPI_Vector< thrust::host_vector< real_type > > weights(const aRealMPITopology2d< real_type > &g)
Nodal weight coefficients.
Definition: mpi_weights.h:22
thrust::host_vector< double > HVec
Host Vector.
Definition: typedefs.h:19
◆ host_grid
template<class real_type >
◆ host_vector
template<class real_type >
using dg::RealGrid1d< 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 >
◆ RealGrid1d() [1/2]
template<class real_type >
construct an empty grid this leaves the access functions undefined
◆ RealGrid1d() [2/2]
template<class real_type >
dg::RealGrid1d< real_type >::RealGrid1d |
( |
real_type |
x0, |
|
|
real_type |
x1, |
|
|
unsigned |
n, |
|
|
unsigned |
N, |
|
|
bc |
bcx = PER |
|
) |
| |
|
inline |
1D grid
- Parameters
-
x0 | left boundary |
x1 | right boundary |
n | # of polynomial coefficients (1<=n<=20, note that the library is optimized for n=3 ) |
N | # of cells |
bcx | boundary conditions |
◆ bcx()
template<class real_type >
boundary conditions
- Returns
◆ contains()
template<class real_type >
Check if the grid contains a point.
- Note
- Does not consider periodicity!!
- Parameters
-
- Returns
- true if x0()<=x<=x1(), false else
- Attention
- returns false if x is NaN or INF
◆ display()
template<class real_type >
void dg::RealGrid1d< real_type >::display |
( |
std::ostream & |
os = std::cout | ) |
const |
|
inline |
◆ dlt()
template<class real_type >
the discrete legendre transformation
- Returns
◆ h()
template<class real_type >
◆ lx()
template<class real_type >
total length of interval
- Returns
◆ N()
template<class real_type >
◆ n()
template<class real_type >
number of polynomial coefficients
- Returns
◆ set() [1/3]
template<class real_type >
reset the boundaries of the grid
- Parameters
-
x0 | new left boundary |
x1 | new right boundary ( > x0) |
bcx | new boundary condition |
◆ set() [2/3]
template<class real_type >
void dg::RealGrid1d< real_type >::set |
( |
real_type |
x0, |
|
|
real_type |
x1, |
|
|
unsigned |
n, |
|
|
unsigned |
N, |
|
|
bc |
bcx |
|
) |
| |
|
inline |
Reset all values of the grid.
- Parameters
-
x0 | new left boundary |
x1 | new right boundary |
n | new # of polynomial coefficients |
N | new # of cells |
bcx | new boundary condition |
◆ set() [3/3]
template<class real_type >
reset the cell numbers in the grid
- Parameters
-
n | new # of polynomial coefficients (0<n<21) |
N | new # of cells (>0) |
◆ shift() [1/2]
template<class real_type >
void dg::RealGrid1d< real_type >::shift |
( |
bool & |
negative, |
|
|
real_type & |
x |
|
) |
| 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
-
negative | swap value if there was a sign swap (happens when a point is mirrored along a Dirichlet boundary) |
x | point to shift (inout) the result is guaranteed to lie inside the grid |
◆ shift() [2/2]
template<class real_type >
void dg::RealGrid1d< real_type >::shift |
( |
bool & |
negative, |
|
|
real_type & |
x, |
|
|
bc |
bcx |
|
) |
| 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
-
negative | swap value if there was a sign swap (happens when a point is mirrored along a Dirichlet boundary) |
x | point to shift (inout) the result is guaranteed to lie inside the grid |
bcx | overrule grid internal boundary condition with this value |
◆ size()
template<class real_type >
n()*N()
(Total number of grid points)
◆ x0()
template<class real_type >
◆ x1()
template<class real_type >
The documentation for this struct was generated from the following file: