SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Events - ObserveTimeStepVolume.hpp Hit Total Coverage
Commit: ecb8a275e1aebab77dcce48a5e098ed4e486ab4b Lines: 2 13 15.4 %
Date: 2026-08-22 01:05:40
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 <memory>
       8             : #include <string>
       9             : #include <unordered_map>
      10             : #include <vector>
      11             : 
      12             : #include "IO/H5/TensorData.hpp"
      13             : #include "Options/String.hpp"
      14             : #include "ParallelAlgorithms/Events/ObserveConstantsPerElement.hpp"
      15             : #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
      16             : #include "Utilities/Serialization/CharmPupable.hpp"
      17             : #include "Utilities/TMPL.hpp"
      18             : #include "Utilities/TypeTraits/IsA.hpp"
      19             : 
      20             : /// \cond
      21             : enum class FloatingPointType;
      22             : template <size_t VolumeDim>
      23             : class Domain;
      24             : template <size_t VolumeDim>
      25             : class ElementId;
      26             : class TimeDelta;
      27             : namespace domain {
      28             : namespace FunctionsOfTime {
      29             : class FunctionOfTime;
      30             : }  // namespace FunctionsOfTime
      31             : namespace Tags {
      32             : template <size_t VolumeDim>
      33             : struct Domain;
      34             : struct FunctionsOfTime;
      35             : template <size_t VolumeDim, typename Frame>
      36             : struct MinimumGridSpacing;
      37             : }  // namespace Tags
      38             : }  // namespace domain
      39             : namespace Frame {
      40             : struct Inertial;
      41             : }  // namespace Frame
      42             : namespace Parallel {
      43             : template <typename Metavariables>
      44             : class GlobalCache;
      45             : }  // namespace Parallel
      46             : namespace Tags {
      47             : template <typename Tag>
      48             : struct HistoryEvolvedVariables;
      49             : struct Time;
      50             : struct TimeStep;
      51             : }  // namespace Tags
      52             : namespace TimeSteppers {
      53             : template <typename Vars>
      54             : class History;
      55             : }  // namespace TimeSteppers
      56             : /// \endcond
      57             : 
      58             : namespace dg::Events {
      59             : /*!
      60             :  * \brief %Observe the time step in the volume.
      61             :  *
      62             :  * Observe the time step size in each element.  Each element is output
      63             :  * as a single cell with two points per dimension and the observation
      64             :  * constant on all those points.
      65             :  *
      66             :  * Writes volume quantities:
      67             :  * - InertialCoordinates (only element corners)
      68             :  * - Time step
      69             :  * - Slab fraction
      70             :  * - Minimum grid spacing
      71             :  * - Integration order
      72             :  */
      73             : template <typename System>
      74           1 : class ObserveTimeStepVolume
      75             :     : public ObserveConstantsPerElement<System::volume_dim> {
      76             :  public:
      77           0 :   static constexpr size_t volume_dim = System::volume_dim;
      78             :   // The variables are only used to get the integration order, which
      79             :   // should be the same for all of them in a split-variables system.
      80           0 :   using variables_tag = tmpl::conditional_t<
      81             :       tt::is_a_v<tmpl::list, typename System::variables_tag>,
      82             :       tmpl::front<typename System::variables_tag>,
      83             :       typename System::variables_tag>;
      84             : 
      85             :   /// \cond
      86             :   explicit ObserveTimeStepVolume(CkMigrateMessage* m);
      87             :   using PUP::able::register_constructor;
      88             :   WRAPPED_PUPable_decl_template(ObserveTimeStepVolume);  // NOLINT
      89             :   /// \endcond
      90             : 
      91           0 :   static constexpr Options::String help =
      92             :       "Observe the time step and integration order in the volume.";
      93             : 
      94           0 :   ObserveTimeStepVolume();
      95             : 
      96           0 :   ObserveTimeStepVolume(const std::string& subfile_name,
      97             :                         ::FloatingPointType coordinates_floating_point_type,
      98             :                         ::FloatingPointType floating_point_type);
      99             : 
     100           0 :   using compute_tags_for_observation_box = tmpl::list<>;
     101             : 
     102           0 :   using return_tags = tmpl::list<>;
     103           0 :   using argument_tags =
     104             :       tmpl::list<::Tags::Time, ::domain::Tags::FunctionsOfTime,
     105             :                  ::domain::Tags::Domain<volume_dim>, ::Tags::TimeStep,
     106             :                  domain::Tags::MinimumGridSpacing<volume_dim, Frame::Inertial>,
     107             :                  ::Tags::HistoryEvolvedVariables<variables_tag>>;
     108             : 
     109             :   template <typename Metavariables, typename ParallelComponent>
     110           0 :   void operator()(
     111             :       const double time,
     112             :       const std::unordered_map<
     113             :           std::string,
     114             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
     115             :           functions_of_time,
     116             :       const Domain<volume_dim>& domain, const TimeDelta& time_step,
     117             :       const double minimum_grid_spacing,
     118             :       const TimeSteppers::History<typename variables_tag::type>& history,
     119             :       Parallel::GlobalCache<Metavariables>& cache,
     120             :       const ElementId<volume_dim>& element_id,
     121             :       const ParallelComponent* const component,
     122             :       const Event::ObservationValue& observation_value) const {
     123             :     std::vector<TensorComponent> components =
     124             :         assemble_data(time, functions_of_time, domain, element_id, time_step,
     125             :                       minimum_grid_spacing, history);
     126             : 
     127             :     this->observe(components, cache, element_id, component, observation_value);
     128             :   }
     129             : 
     130           1 :   bool needs_evolved_variables() const override;
     131             : 
     132             :  private:
     133           0 :   std::vector<TensorComponent> assemble_data(
     134             :       double time,
     135             :       const std::unordered_map<
     136             :           std::string,
     137             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
     138             :           functions_of_time,
     139             :       const Domain<volume_dim>& domain, const ElementId<volume_dim>& element_id,
     140             :       const TimeDelta& time_step, double minimum_grid_spacing,
     141             :       const TimeSteppers::History<typename variables_tag::type>& history) const;
     142             : };
     143             : }  // namespace dg::Events

Generated by: LCOV version 1.14