SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/ApparentHorizonFinder/Criteria - Criterion.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 2 8 25.0 %
Date: 2025-12-05 05:03:31
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : #include <pup.h>
       8             : 
       9             : #include "DataStructures/DataBox/DataBox.hpp"
      10             : #include "DataStructures/DataBox/ObservationBox.hpp"
      11             : #include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp"
      12             : #include "Parallel/GlobalCache.hpp"
      13             : #include "ParallelAlgorithms/ApparentHorizonFinder/FastFlow.hpp"
      14             : #include "Utilities/CallWithDynamicType.hpp"
      15             : #include "Utilities/Serialization/CharmPupable.hpp"
      16             : 
      17             : namespace ah {
      18             : /*!
      19             :  * \ingroup SurfacesGroup
      20             :  * \brief Base class for criteria that determine how the resolution of an
      21             :  * apparent horizon should be changed
      22             :  *
      23             :  * \details Each class derived from this class should
      24             :  * - Be option-creatable
      25             :  * - Be serializable
      26             :  * - Define the type aliases `argument_tags` and
      27             :  *   `compute_tags_for_observation_box` that are type lists of tags used in the
      28             :  *   call operator
      29             :  * - Define a call operator that returns a `size_t` that is the recommended
      30             :  *   resolution $L$ for the Strahlkorper representing the apparent horizon
      31             :  *
      32             :  * The call operator should take the following arguments, in order:
      33             :  * - An argument for each tag in `argument_tags`
      34             :  * - The Parallel::GlobalCache
      35             :  * - The Strahlkorper representing the apparent horizon
      36             :  * - A FastFlow::IterInfo corresponding to the horizon find that found the
      37             :  *   Strahlkorper
      38             :  */
      39           1 : class Criterion : public PUP::able {
      40             :  protected:
      41             :   /// \cond
      42             :   Criterion() = default;
      43             :   Criterion(const Criterion&) = default;
      44             :   Criterion(Criterion&&) = default;
      45             :   Criterion& operator=(const Criterion&) = default;
      46             :   Criterion& operator=(Criterion&&) = default;
      47             :   /// \endcond
      48             :  public:
      49           0 :   ~Criterion() override = default;
      50           0 :   explicit Criterion(CkMigrateMessage* msg) : PUP::able(msg) {}
      51             : 
      52           0 :   WRAPPED_PUPable_abstract(Criterion);
      53             : 
      54           0 :   virtual std::string observation_name() = 0;
      55             : 
      56           0 :   virtual bool is_equal(const Criterion& other) const = 0;
      57             : 
      58             :   /// Evaluates the apparent horizon criteria by selecting the appropriate
      59             :   /// derived class and forwarding its `argument_tags` from the ObservationBox
      60             :   /// (along with the GlobalCache) to the call operator of the
      61             :   /// derived class
      62             :   ///
      63             :   /// \note In order to be available, a derived Criterion must be listed in
      64             :   /// the entry for Criterion in
      65             :   /// Metavarialbes::factory_creation::factory_classes
      66             :   ///
      67             :   /// \note The ComputeTagsList of the ObservationBox should contain the union
      68             :   /// of the tags listed in `compute_tags_for_observation_box` for each derived
      69             :   /// Criterion listed in the `factory_classes`.
      70             :   template <typename ComputeTagsList, typename DataBoxType,
      71             :             typename Metavariables, typename Frame>
      72           1 :   auto evaluate(const ObservationBox<ComputeTagsList, DataBoxType>& box,
      73             :                 Parallel::GlobalCache<Metavariables>& cache,
      74             :                 const ylm::Strahlkorper<Frame>& strahlkorper,
      75             :                 const FastFlow::IterInfo& info) const {
      76             :     using factory_classes =
      77             :         typename std::decay_t<Metavariables>::factory_creation::factory_classes;
      78             :     return call_with_dynamic_type<size_t, tmpl::at<factory_classes, Criterion>>(
      79             :         this, [&box, &cache, &strahlkorper, &info](auto* const criterion) {
      80             :           return apply(*criterion, box, cache, strahlkorper, info);
      81             :         });
      82             :   }
      83             : };
      84             : }  // namespace ah

Generated by: LCOV version 1.14