Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys > Class Template Reference

Interpolate_1stOrder does a 1st order interpolation of scalars. More...

#include <interpolate_1st_order.h>

Public Member Functions

 Interpolate_1stOrder (SourceMeshType const &source_mesh, TargetMeshType const &target_mesh, SourceStateType const &source_state, NumericTolerances_t num_tols)
 Constructor without interface reconstructor. More...
 
 ~Interpolate_1stOrder ()=default
 Copy constructor (disabled) More...
 
void set_material (int m)
 Set the material we are operating on. More...
 
void set_interpolation_variable (std::string const &interp_var_name, Portage::vector< Wonton::Vector< D >> *gradients=nullptr)
 Set the variable name to be interpolated. More...
 
operator() (int const targetEntityId, std::vector< Weights_t > const &sources_and_weights) const
 Functor to do the actual interpolation. More...
 

Static Public Attributes

static constexpr int order = 1
 

Detailed Description

template<int D, Entity_kind on_what, typename SourceMeshType, typename TargetMeshType, typename SourceStateType, typename TargetStateType, typename T, template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
class Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >

Interpolate_1stOrder does a 1st order interpolation of scalars.

Template Parameters
Dspatial dimension of problem
on_whatThe type of entity-based data we wish to interpolate; e.g. does it live on nodes, cells, edges, etc.
SourceMeshTypeMesh wrapper class used to access source mesh info
TargetMeshTypeMesh wrapper class used to access target mesh info
SourceStateTypeState manager used to access source data.
InterfaceReconstructorTypeClass for reconstructing material interfaces
MatPoly_SplitterClass used for splitting material polygons
MatPoly_ClipperClass used for clipping material polygons
CoordSysWhat coordinate system are we operating in?

Viewed simply, the value at target cell is the weighted average of values on from source entities and therefore, this can work for cell-cell, particle-cell, cell-particle and particle-particle remap.

In the context of remapping from one cell-based mesh to another (as opposed to particles to cells), it is assumed that scalars are provided at cell centers. A piecewise constant "reconstruction" of the quantity is assumed over cells which means that the integral value over the cell or any piece of the cell is just the average multiplied by the volume of the cell or its piece. Then the integral value over a target cell is the sum of the integral values of some source cells (or their pieces) and the weights to be specified in the call are the areas/volumes of the donor cells (pieces). If an exact intersection is performed between the target cell and the source mesh, these weights are the area/volumes of the intersection pieces. So, in this sense, this is the Cell-Intersection-Based Donor-Cell (CIB/DC) remap referred to in the Shashkov, Margolin paper [1]. This interpolation is 1st order accurate and positivity preserving (target cell values will be positive if the field is positive on the source mesh).

[1] Margolin, L.G. and Shashkov, M.J. "Second-order sign-preserving conservative interpolation (remapping) on general grids." Journal of Computational Physics, v 184, n 1, pp. 266-298, 2003.

[2] Dukowicz, J.K. and Kodis, J.W. "Accurate Conservative Remapping (Rezoning) for Arbitrary Lagrangian-Eulerian Computations," SIAM Journal on Scientific and Statistical Computing, Vol. 8, No. 3, pp. 305-321, 1987.

Type T must support +, += operators. It must also support * operators with a scalar operand. Finally, it must support initialization to null values using the syntax T(0.0)

We could enforce these requirements using SFINAE

Constructor & Destructor Documentation

◆ Interpolate_1stOrder()

template<int D, Entity_kind on_what, typename SourceMeshType , typename TargetMeshType , typename SourceStateType , typename TargetStateType , typename T , template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >::Interpolate_1stOrder ( SourceMeshType const &  source_mesh,
TargetMeshType const &  target_mesh,
SourceStateType const &  source_state,
NumericTolerances_t  num_tols 
)
inline

Constructor without interface reconstructor.

Parameters
[in]source_meshThe input mesh.
[in]target_meshThe output mesh.
[in]source_stateThe state manager for data on the input mesh.
[in]on_whatThe location where the data lives; e.g. on cells, nodes, edges, etc.
[in]interp_var_nameThe string name of the variable to interpolate.
[in]sources_and_weightsVector of source entities and their weights for each target entity

◆ ~Interpolate_1stOrder()

template<int D, Entity_kind on_what, typename SourceMeshType , typename TargetMeshType , typename SourceStateType , typename TargetStateType , typename T , template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >::~Interpolate_1stOrder ( )
default

Copy constructor (disabled)

Assignment operator (disabled) Destructor

Member Function Documentation

◆ operator()()

template<int D, Entity_kind on_what, typename SourceMeshType , typename TargetMeshType , typename SourceStateType , typename TargetStateType , typename T , template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
T Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >::operator() ( int const  targetEntityId,
std::vector< Weights_t > const &  sources_and_weights 
) const
inline

Functor to do the actual interpolation.

Parameters
[in]sources_and_weightsA pair of two vectors. sources_and_weights.first() is the vector of source entity indices in the source mesh that will contribute to the current target mesh entity. sources_and_weights.second() is the vector of vector weights for each of the source mesh entities in sources_and_weights.first(). Each element of the weights vector is a moment of the source data over the target entity; for first order interpolation, only the first element (or zero'th moment) of the weights vector (i.e. the volume of intersection) is used. Source entities may be repeated in the list if the intersection of a target entity and a source entity consists of two or more disjoint pieces
[in]targetCellIdThe index of the target cell.

◆ set_interpolation_variable()

template<int D, Entity_kind on_what, typename SourceMeshType , typename TargetMeshType , typename SourceStateType , typename TargetStateType , typename T , template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
void Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >::set_interpolation_variable ( std::string const &  interp_var_name,
Portage::vector< Wonton::Vector< D >> *  gradients = nullptr 
)
inline

Set the variable name to be interpolated.

◆ set_material()

template<int D, Entity_kind on_what, typename SourceMeshType , typename TargetMeshType , typename SourceStateType , typename TargetStateType , typename T , template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
void Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >::set_material ( int  m)
inline

Set the material we are operating on.

Member Data Documentation

◆ order

template<int D, Entity_kind on_what, typename SourceMeshType , typename TargetMeshType , typename SourceStateType , typename TargetStateType , typename T , template< class, int, class, class > class InterfaceReconstructorType = DummyInterfaceReconstructor, class Matpoly_Splitter = void, class Matpoly_Clipper = void, class CoordSys = Wonton::DefaultCoordSys>
constexpr int Portage::Interpolate_1stOrder< D, on_what, SourceMeshType, TargetMeshType, SourceStateType, TargetStateType, T, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys >::order = 1
static

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