SpECTRE  v2023.05.16
control_system::protocols::Submeasurement Struct Reference

Definition of a portion of a measurement for the control systems. More...

#include <Submeasurement.hpp>

Classes

struct  test
 

Detailed Description

Definition of a portion of a measurement for the control systems.

These structs are referenced from structs conforming to the Measurement protocol. They define independent parts of a control system measurement, such as individual horizon-finds in a two-horizon measurement.

A conforming struct must provide an interpolation_target_tag type alias templated on the control systems using this submeasurement. (This template parameter must be used in the call to RunCallbacks discussed below.) This alias may be void if the submeasurement does not use an interpolation target tag. This is only used to collect the tags that must be registered in the metavariables.

A struct must also define an argument_tags type list and an apply function taking the corresponding arguments followed by

  • const LinkedMessageId<double>& measurement_id
  • Parallel::GlobalCache<Metavariables>& cache
  • const /*component-defined*‍/& array_index
  • const ParallelComponent* /*meta*‍/
  • ControlSystems /*meta*‍/

where the last two are generally template parameters to the function. This function will be called on every element, and these calls must collectively result in a single call on one chare (which need not be one of the element chares) to control_system::RunCallbacks<ConformingStructBeingDefinedHere, ControlSystems>::apply. This will almost always require performing a reduction.

The time the measurement occurs as is available as measurement_id.id.

Here's an example for a class conforming to this protocol:

struct ExampleSubmeasurement
: tt::ConformsTo<control_system::protocols::Submeasurement> {
// This submeasurement does not use an interpolation component.
template <typename ControlSystems>
using interpolation_target_tag = void;
using argument_tags = tmpl::list<SomeTagOnElement>;
template <typename Metavariables, typename ParallelComponent,
typename ControlSystems>
static void apply(const double data_from_element,
const LinkedMessageId<double>& measurement_id,
const int& /*array_index*/,
const ParallelComponent* /*meta*/,
ControlSystems /*meta*/) {
// In real cases, we would generally do a reduction to a single
// chare here and have the below code in the reduction action, but
// the action testing framework doesn't support reductions, so
// this example is for a control system running on a singleton and
// we just pass the data through.
const auto box =
db::create<db::AddSimpleTags<MeasurementResultTag>>(data_from_element);
box, cache, measurement_id);
}
};
A Charm++ chare that caches constant data once per Charm++ node or non-constant data once per Charm++...
Definition: GlobalCache.hpp:374
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:182
An identifier for an element in a sequence.
Definition: LinkedMessageId.hpp:23
Apply the process_measurement struct of each of the ControlSystems to the result of the Submeasuremen...
Definition: RunCallbacks.hpp:43
Indicate a class conforms to the Protocol.
Definition: ProtocolHelpers.hpp:22

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