SpECTRE  v2024.04.12
intrp::protocols::ComputeVarsToInterpolate Struct Reference

A protocol for the type alias compute_vars_to_interpolate that can potentially be found in an InterpolationTargetTag (potentially because an InterpolationTargetTag does not require this type alias). More...

#include <ComputeVarsToInterpolate.hpp>

Classes

struct  test
 

Detailed Description

A protocol for the type alias compute_vars_to_interpolate that can potentially be found in an InterpolationTargetTag (potentially because an InterpolationTargetTag does not require this type alias).

Details

A struct conforming to the ComputeVarsToInterpolate protocol must have

  • a type alias allowed_src_tags which is a tmpl::list of tags from the volume that can be used to compute quantities that will be interpolated onto the target.
  • a type alias required_src_tags which is a tmpl::list of tags from the volume that are necessary to compute quantities that will be interpolated onto the target. This list must be a subset of allowed_src_tags.
  • a type alias allowed_dest_tags<Frame> which is a tmpl::list of tags on the target that can be computed from the source tags.
  • a type alias required_dest_tags<Frame> which is a tmpl::list of tags on the target that must be computed from the source tags. This list must be a subset of allowed_dest_tags<Frame>
  • an apply function with at least one of the signatures in the example. This apply function fills the vars_to_interpolate_to_target type alias from the InterpolationTargetTag. Here Dim is Metavariables::volume_dim, SrcFrame is the frame of Metavariables::interpolator_source_vars and TargetFrame is the frame of vars_to_interpolate_to_target from the InterpolationTargetTag. The overload without Jacobians treats the case in which TargetFrame is the same as SrcFrame.

Here is an example of a class that conforms to this protocols:

struct ExampleComputeVarsToInterpolate
: tt::ConformsTo<intrp::protocols::ComputeVarsToInterpolate> {
template <typename SrcTagList, typename DestTagList, size_t Dim>
static void apply(
const gsl::not_null<Variables<DestTagList>*> /*target_vars*/,
const Variables<SrcTagList>& /*src_vars*/, const Mesh<Dim>& /*mesh*/) {
// Already in the same frame so no need to switch frames
// Do some GR calculations to get correct variables
// Then modify target_vars
return;
}
template <typename SrcTagList, typename DestTagList, size_t Dim,
typename TargetFrame>
static void apply(
const gsl::not_null<Variables<DestTagList>*> /*target_vars*/,
const Variables<SrcTagList>& /*src_vars*/, const Mesh<Dim>& /*mesh*/,
const Jacobian<DataVector, Dim, TargetFrame,
Frame::Inertial>& /*jacobian_target_to_inertial*/,
/*inverse_jacobian_target_to_inertial*/,
/*jac_logical_to_target*/,
/*invjac_logical_to_target*/,
const tnsr::I<DataVector, 3, Frame::Inertial>& /*inertial_mesh_velocity*/,
/*grid_to_target_frame_mesh_velocity*/) {
// Need to switch frames first
// Do some GR calculations to get correct variables
// Then modify target_vars
return;
}
// These need to exist but don't have to contain anything
using allowed_src_tags = tmpl::list<>;
using required_src_tags = tmpl::list<>;
template <typename Frame>
using allowed_dest_tags = tmpl::list<>;
template <typename Frame>
using required_dest_tags = tmpl::list<>;
};
Stores a collection of function values.
Definition: DataVector.hpp:48
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:50
Definition: ContractFirstNIndices.hpp:16
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
auto apply(F &&f, const ObservationBox< ComputeTagsList, DataBoxType > &observation_box, Args &&... args)
Apply the function object f using its nested argument_tags list of tags.
Definition: ObservationBox.hpp:238
Definition: IndexType.hpp:46
Indicate a class conforms to the Protocol.
Definition: ProtocolHelpers.hpp:22

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