A protocol for the type alias post_interpolation_callbacks found in an InterpolationTargetTag.
Details
A struct conforming to the PostInterpolationCallback protocol must have
- a function apply with one of the 3 signatures in the example. This apply function will be called once the interpolation is complete. DbTags includes everything in the vars_to_interpolate_to_target alias and the compute_items_on_target alias of the InterpolationTargetTag. The apply that returns a bool should return false only if it calls another intrp::Action that still needs the volume data at this temporal_id (such as another iteration of the horizon finder). These functions must be able to take any type for the TemporalId. If a specific temporal ID type is required, it should be static_asserted in the function itself.
A struct conforming to this protocol can also have an optional static
constexpr double fill_invalid_points_with. Any points outside the Domain will be filled with this value. If this variable is not defined, then the apply function must check for invalid points, and should typically exit with an error message if it finds any.
Here is an example of a class that conforms to this protocols:
: tt::ConformsTo<intrp::protocols::PostInterpolationCallback> {
static constexpr double fill_invalid_points_with = 0.0;
template <typename DbTags, typename Metavariables, typename TemporalId>
static bool apply(
const gsl::not_null<db::DataBox<DbTags>*> ,
const gsl::not_null<Parallel::GlobalCache<Metavariables>*> ,
const TemporalId& temporal_id) {
return intrp::InterpolationTarget_detail::get_temporal_id_value(
temporal_id) > 1.0;
}
template <typename DbTags, typename Metavariables, typename TemporalId>
static void apply(const db::DataBox<DbTags>& ,
const Parallel::GlobalCache<Metavariables>& ,
const TemporalId& ) {}
template <typename DbTags, typename Metavariables, typename TemporalId>
static void apply(const db::DataBox<DbTags>& ,
Parallel::GlobalCache<Metavariables>& ,
const TemporalId& ) {}
};