Public Member Functions | List of all members
Mesh< Dim > Class Template Reference

Holds the number of grid points, basis, and quadrature in each direction of the computational grid. More...

#include <Mesh.hpp>

Public Member Functions

 Mesh (const size_t isotropic_extents, const Spectral::Basis basis, const Spectral::Quadrature quadrature) noexcept
 Construct a computational grid with the same number of collocation points in each dimension. More...
 
 Mesh (std::array< size_t, Dim > extents, const Spectral::Basis basis, const Spectral::Quadrature quadrature) noexcept
 Construct a computational grid where each dimension can have a different number of collocation points. More...
 
 Mesh (std::array< size_t, Dim > extents, std::array< Spectral::Basis, Dim > bases, std::array< Spectral::Quadrature, Dim > quadratures) noexcept
 Construct a computational grid where each dimension can have both a different number and placement of collocation points. More...
 
const Index< Dim > & extents () const noexcept
 The number of grid points in each dimension of the grid.
 
size_t extents (const size_t d) const noexcept
 The number of grid points in dimension d of the grid (zero-indexed).
 
size_t number_of_grid_points () const noexcept
 The total number of grid points in all dimensions. More...
 
const std::array< Spectral::Basis, Dim > & basis () const noexcept
 The basis chosen in each dimension of the grid.
 
Spectral::Basis basis (const size_t d) const noexcept
 The basis chosen in dimension d of the grid (zero-indexed).
 
const std::array< Spectral::Quadrature, Dim > & quadrature () const noexcept
 The quadrature chosen in each dimension of the grid.
 
Spectral::Quadrature quadrature (const size_t d) const noexcept
 The quadrature chosen in dimension d of the grid (zero-indexed).
 
template<size_t N = Dim, Requires<(N > 0 and N = = Dim>
Mesh< Dim - 1 > slice_away (size_t d) const noexcept
 Returns a Mesh with dimension d removed (zero-indexed). More...
 
template<typename... D>
Mesh< sizeof...(D)> slice_through (D... d) const noexcept
 Returns a Mesh with the dimensions d, ... present (zero-indexed). More...
 
template<size_t SliceDim>
Mesh< SliceDim > slice_through (const std::array< size_t, SliceDim > &dims) const noexcept
 Returns a Mesh with the dimensions dims present (zero-indexed). More...
 
std::array< Mesh< 1 >, Dim > slices () const noexcept
 Returns the Meshes representing 1D slices of this Mesh. More...
 
void pup (PUP::er &p) noexcept
 

Detailed Description

template<size_t Dim>
class Mesh< Dim >

Holds the number of grid points, basis, and quadrature in each direction of the computational grid.

Details

A mesh encapsulates all information necessary to construct the placement of grid points in the computational domain. It does so through a choice of basis functions, quadrature and number of points \(N\) in each dimension. The grid points are the associated collocation points and can be obtained from Spectral::collocation_points(const Mesh<1>&):

const Mesh<2> mesh2d{
{{3, 4}},
{{Spectral::Basis::Legendre, Spectral::Basis::Legendre}},
{{Spectral::Quadrature::Gauss, Spectral::Quadrature::GaussLobatto}}};
const auto collocation_points_in_first_dim =
Spectral::collocation_points(mesh2d.slice_through(0));

A simulated physical field can be represented by a DataVector of length number_of_grid_points() that holds the field value on each point of the computational grid. These values are identical to the field's nodal expansion coefficients. They approximate the field by a polynomial of degree \(p=N-1\) through a linear combination of Lagrange polynomials.

Template Parameters
Dimthe number of dimensions of the computational grid.

Constructor & Destructor Documentation

◆ Mesh() [1/3]

template<size_t Dim>
Mesh< Dim >::Mesh ( const size_t  isotropic_extents,
const Spectral::Basis  basis,
const Spectral::Quadrature  quadrature 
)
inlinenoexcept

Construct a computational grid with the same number of collocation points in each dimension.

Parameters
isotropic_extentsThe number of collocation points in each dimension.
basisThe choice of spectral basis to compute the collocation points
quadratureThe choice of quadrature to compute the collocation points

◆ Mesh() [2/3]

template<size_t Dim>
Mesh< Dim >::Mesh ( std::array< size_t, Dim >  extents,
const Spectral::Basis  basis,
const Spectral::Quadrature  quadrature 
)
inlinenoexcept

Construct a computational grid where each dimension can have a different number of collocation points.

Parameters
extentsThe number of collocation points per dimension
basisThe choice of spectral basis to compute the collocation points
quadratureThe choice of quadrature to compute the collocation points

◆ Mesh() [3/3]

template<size_t Dim>
Mesh< Dim >::Mesh ( std::array< size_t, Dim >  extents,
std::array< Spectral::Basis, Dim >  bases,
std::array< Spectral::Quadrature, Dim >  quadratures 
)
inlinenoexcept

Construct a computational grid where each dimension can have both a different number and placement of collocation points.

Parameters
extentsThe number of collocation points per dimension
basesThe choice of spectral bases to compute the collocation points per dimension
quadraturesThe choice of quadratures to compute the collocation points per dimension

Member Function Documentation

◆ number_of_grid_points()

template<size_t Dim>
size_t Mesh< Dim >::number_of_grid_points ( ) const
inlinenoexcept

The total number of grid points in all dimensions.

Details

DataVectors that represent field values on the grid have this many entries.

Note
A zero-dimensional mesh has one grid point, since it is the slice through a one-dimensional mesh (a line).

◆ slice_away()

template<size_t Dim>
template<size_t N, Requires<(N > 0 and N = = Dim>
Mesh< Dim - 1 > Mesh< Dim >::slice_away ( size_t  d) const
noexcept

Returns a Mesh with dimension d removed (zero-indexed).

See also
slice_through()

◆ slice_through() [1/2]

template<size_t Dim>
template<typename... D>
Mesh<sizeof...(D)> Mesh< Dim >::slice_through ( D...  d) const
inlinenoexcept

Returns a Mesh with the dimensions d, ... present (zero-indexed).

Details

Generally you use this method to obtain a lower-dimensional Mesh by slicing through a subset of the dimensions. However, you can also reorder dimensions using this method by slicing through the dimensions in an order you choose.

See also
slice_away()

◆ slice_through() [2/2]

template<size_t Dim>
template<size_t SliceDim>
Mesh< SliceDim > Mesh< Dim >::slice_through ( const std::array< size_t, SliceDim > &  dims) const
noexcept

Returns a Mesh with the dimensions dims present (zero-indexed).

See also
slice_through() The templated overload of this function

◆ slices()

template<size_t Dim>
std::array< Mesh< 1 >, Dim > Mesh< Dim >::slices ( ) const
noexcept

Returns the Meshes representing 1D slices of this Mesh.

The is the same as the array filled with slice_through(d) for d from 0 to Dim - 1 except in dimension 0 where slice_through(d) is not defined.


The documentation for this class was generated from the following files: