GhInterpolationStrategies.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
7 #include "Time/Tags.hpp"
9 
10 namespace Cce {
11 /// Contains utilities for collecting, interpolating, and providing worldtube
12 /// data for CCE that originates from other components in a running simulation.
13 namespace InterfaceManagers{
14 
15 /*!
16  * \brief Enumeration of possibilities for the collection of worldtube data that
17  * will be collected by the interpolator.
18  *
19  * \details The available strategies are:
20  * - `InterpolationStrategy::EveryStep` : interpolation data will be provided on
21  * each full step for the time-stepper, so the worldtube data represents
22  * physical values that can then be interpolated/extrapolated.
23  * - `InterpolationStrategy::EverySubstep` : interpolation data will be provided
24  * on each substep of the time-stepper, so the worldtube data represents
25  * intermediate substep quantities, and typically must be used in the same
26  * time-stepper to obtain physically meaningful quantites. This strategy is
27  * primarily useful if the CCE system takes identical timesteps using an
28  * identical stepper as the step and stepper used for generating the
29  * interpolation data.
30  */
31 enum class InterpolationStrategy { EveryStep, EverySubstep };
32 
33 /*!
34  * \brief Determines whether the element should interpolate for the current
35  * state of its `box`, depending on the
36  * `Cce::InterfaceManagers::InterpolationStrategy` used by the associated
37  * `Cce::InterfaceManagers::GhInterfaceManager`.
38  */
39 template <typename DbTagList>
41  const db::DataBox<DbTagList>& box,
42  const InterpolationStrategy strategy) noexcept {
43  if(strategy == InterpolationStrategy::EverySubstep) {
44  return true;
45  }
46  if(strategy == InterpolationStrategy::EveryStep) {
47  return db::get<::Tags::TimeStepId>(box).substep() == 0;
48  }
49  ERROR("Interpolation strategy not recognized");
50 }
51 } // namespace InterfaceManagers
52 } // namespace Cce
Error.hpp
ERROR
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:36
DataBox.hpp
Cce::InterfaceManagers::should_interpolate_for_strategy
bool should_interpolate_for_strategy(const db::DataBox< DbTagList > &box, const InterpolationStrategy strategy) noexcept
Determines whether the element should interpolate for the current state of its box,...
Definition: GhInterpolationStrategies.hpp:40
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: CharacteristicExtractFwd.hpp:6
Cce::InterfaceManagers::InterpolationStrategy
InterpolationStrategy
Enumeration of possibilities for the collection of worldtube data that will be collected by the inter...
Definition: GhInterpolationStrategies.hpp:31