SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/RayTracer/BackgroundSpacetimes - NumericData.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 13.5 % 37 5
Test Date: 2026-10-22 17:29:42
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 <array>
       7              : #include <cstddef>
       8              : #include <memory>
       9              : #include <optional>
      10              : #include <pup.h>
      11              : #include <string>
      12              : #include <variant>
      13              : #include <vector>
      14              : 
      15              : #include "DataStructures/TaggedTuple.hpp"
      16              : #include "DataStructures/Tensor/TypeAliases.hpp"
      17              : #include "IO/Exporter/PointwiseInterpolator.hpp"
      18              : #include "IO/Exporter/SpacetimeInterpolator.hpp"
      19              : #include "IO/Logging/Verbosity.hpp"
      20              : #include "Options/Auto.hpp"
      21              : #include "Options/String.hpp"
      22              : #include "ParallelAlgorithms/RayTracer/BackgroundSpacetimes/BackgroundSpacetime.hpp"
      23              : #include "Utilities/Gsl.hpp"
      24              : #include "Utilities/Serialization/CharmPupable.hpp"
      25              : #include "Utilities/TMPL.hpp"
      26              : 
      27              : namespace ray_tracing {
      28              : 
      29              : /// Numeric data from volume data files.
      30            1 : class NumericData : public BackgroundSpacetime {
      31              :  public:
      32            0 :   NumericData() = default;
      33            0 :   NumericData(const NumericData& /*rhs*/);
      34            0 :   NumericData& operator=(const NumericData& /*rhs*/);
      35            0 :   NumericData(NumericData&& /*rhs*/) = default;
      36            0 :   NumericData& operator=(NumericData&& /*rhs*/) = default;
      37            0 :   ~NumericData() override = default;
      38              : 
      39            0 :   static constexpr Options::String help = "Numeric data from volume data files";
      40              : 
      41            0 :   struct FileGlob {
      42            0 :     using type = std::string;
      43            0 :     static constexpr Options::String help =
      44              :         "Volume data files. Can be a glob pattern.";
      45              :   };
      46              : 
      47            0 :   struct SubfileName {
      48            0 :     using type = std::string;
      49            0 :     static constexpr Options::String help = "Subfile name in the volume files";
      50              :   };
      51              : 
      52            0 :   struct ObservationStep {
      53            0 :     using type = Options::Auto<int>;
      54            0 :     static constexpr Options::String help =
      55              :         "Either a single observation step to load, or 'Auto' to load the full "
      56              :         "spacetime. "
      57              :         "When a single observation is loaded, then rays are traced "
      58              :         "only through that single time slice (fast light approximation). "
      59              :         "When 'Auto' is selected, then all time slices are loaded that cover "
      60              :         "the required time range and the data is interpolated in both space "
      61              :         "and time (slow light).";
      62              :   };
      63              : 
      64            0 :   struct Verbosity {
      65            0 :     using type = ::Verbosity;
      66            0 :     static constexpr Options::String help = "Verbosity of output.";
      67              :   };
      68              : 
      69            0 :   using options = tmpl::list<FileGlob, SubfileName, ObservationStep, Verbosity>;
      70              : 
      71            0 :   NumericData(std::string file_glob, std::string subfile_name,
      72              :               std::optional<int> observation_step,
      73              :               ::Verbosity verbosity = ::Verbosity::Silent);
      74              : 
      75            1 :   auto get_clone() const -> std::unique_ptr<BackgroundSpacetime> override {
      76              :     return std::make_unique<NumericData>(*this);
      77              :   }
      78              : 
      79              :   /// \cond
      80              :   explicit NumericData(CkMigrateMessage* msg) : BackgroundSpacetime(msg) {}
      81              :   using PUP::able::register_constructor;
      82              :   WRAPPED_PUPable_decl_template(NumericData);
      83              :   /// \endcond
      84              : 
      85            1 :   void initialize(std::array<double, 2> new_time_bounds) override;
      86              : 
      87            1 :   std::array<double, 2> time_bounds() const override;
      88              : 
      89            1 :   tuples::tagged_tuple_from_typelist<tags> variables(
      90              :       const tnsr::I<DataType, Dim, Frame>& x, double t,
      91              :       std::optional<gsl::not_null<std::vector<size_t>*>> block_order =
      92              :           std::nullopt) const override;
      93              : 
      94              :   // NOLINTNEXTLINE(google-runtime-references)
      95            0 :   void pup(PUP::er& p) override;
      96              : 
      97            0 :   friend bool operator==(const NumericData& lhs, const NumericData& rhs);
      98              : 
      99              :  private:
     100            0 :   using PointwiseInterpolator =
     101              :       spectre::Exporter::PointwiseInterpolator<Dim, Frame>;
     102            0 :   using SpacetimeInterpolator =
     103              :       spectre::Exporter::SpacetimeInterpolator<Dim, Frame>;
     104              : 
     105            0 :   std::string file_glob_;
     106            0 :   std::string subfile_name_;
     107            0 :   std::optional<int> observation_step_;
     108            0 :   ::Verbosity verbosity_ = ::Verbosity::Silent;
     109              :   // Cache that holds tensor data in memory. This isn't copied and must be
     110              :   // reinitialized after a copy.
     111            0 :   std::variant<PointwiseInterpolator, SpacetimeInterpolator> interpolator_;
     112              : };
     113              : 
     114            0 : bool operator!=(const NumericData& lhs, const NumericData& rhs);
     115              : 
     116              : }  // namespace ray_tracing
        

Generated by: LCOV version 2.0-1