SpECTRE  v2024.04.12
intrp::RegularGrid< Dim > Class Template Reference

Interpolate data from a Mesh onto a regular grid of points. More...

#include <RegularGridInterpolant.hpp>

Public Member Functions

 RegularGrid (const Mesh< Dim > &source_mesh, const Mesh< Dim > &target_mesh, const std::array< DataVector, Dim > &override_target_mesh_with_1d_logical_coords={})
 An interpolator between two regular grids. More...
 
void pup (PUP::er &p)
 
const std::array< Matrix, Dim > & interpolation_matrices () const
 Return the internally-stored matrices that interpolate from the source grid to the target grid. More...
 
template<typename TagsList >
void interpolate (const gsl::not_null< Variables< TagsList > * > result, const Variables< TagsList > &vars) const
 
template<typename TagsList >
void interpolate (gsl::not_null< Variables< TagsList > * > result, const Variables< TagsList > &vars) const
 Interpolate a Variables onto the target points.
 
template<typename TagsList >
Variables< TagsList > interpolate (const Variables< TagsList > &vars) const
 Interpolate a Variables onto the target points.
 
void interpolate (gsl::not_null< DataVector * > result, const DataVector &input) const
 Interpolate a DataVector onto the target points. More...
 
DataVector interpolate (const DataVector &input) const
 Interpolate a DataVector onto the target points. More...
 

Friends

template<size_t LocalDim>
bool operator== (const RegularGrid< LocalDim > &lhs, const RegularGrid< LocalDim > &rhs)
 

Detailed Description

template<size_t Dim>
class intrp::RegularGrid< Dim >

Interpolate data from a Mesh onto a regular grid of points.

The target points must lie on a tensor-product grid that is aligned with the source Mesh. In any direction where the source and target points share an identical Mesh (i.e., where the underlying 1-dimensional meshes share the same extent, basis, and quadrature), the code is optimized to avoid performing identity interpolations.

Note, however, that in each dimension of the target grid, the points can be freely distributed; in particular, the grid points need not be the collocation points corresponding to a particular basis and quadrature. Note also that the target grid need not overlap the source grid. In this case, polynomial extrapolation is performed, with order set by the order of the basis in the source grid. The extrapolation will be correct but may suffer from reduced accuracy, especially for higher-order polynomials.

Constructor & Destructor Documentation

◆ RegularGrid()

template<size_t Dim>
intrp::RegularGrid< Dim >::RegularGrid ( const Mesh< Dim > &  source_mesh,
const Mesh< Dim > &  target_mesh,
const std::array< DataVector, Dim > &  override_target_mesh_with_1d_logical_coords = {} 
)

An interpolator between two regular grids.

When the optional third argument is NOT passed, creates an interpolator between two regular meshes.

The optional third argument allows the caller to override the distribution of grid points in any dimension(s) of the target grid. Each non-empty element of override_target_mesh_with_1d_logical_coords gives the logical coordinates which will override the default coordinates of target_mesh.

Member Function Documentation

◆ interpolate() [1/2]

template<size_t Dim>
DataVector intrp::RegularGrid< Dim >::interpolate ( const DataVector input) const

Interpolate a DataVector onto the target points.

Note
When interpolating multiple tensors, the Variables interface is more efficient. However, this DataVector interface is useful for applications where only some components of a Tensor or Variables need to be interpolated.

◆ interpolate() [2/2]

template<size_t Dim>
void intrp::RegularGrid< Dim >::interpolate ( gsl::not_null< DataVector * >  result,
const DataVector input 
) const

Interpolate a DataVector onto the target points.

Note
When interpolating multiple tensors, the Variables interface is more efficient. However, this DataVector interface is useful for applications where only some components of a Tensor or Variables need to be interpolated.

◆ interpolation_matrices()

template<size_t Dim>
const std::array< Matrix, Dim > & intrp::RegularGrid< Dim >::interpolation_matrices ( ) const

Return the internally-stored matrices that interpolate from the source grid to the target grid.

Each matrix interpolates in one logical direction, and can be empty if the interpolation in that direction is the identity (i.e., if the source and target grids have the same logical coordinates in this direction).


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