SpECTRE Documentation Coverage Report
Current view: top level - Domain/Creators/TimeDependence - TimeDependence.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 7 19 36.8 %
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 <memory>
       8             : #include <string>
       9             : #include <unordered_map>
      10             : #include <vector>
      11             : 
      12             : #include "Domain/CoordinateMaps/CoordinateMap.hpp"
      13             : #include "Domain/Structure/ObjectLabel.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : /// \cond
      17             : namespace domain {
      18             : namespace FunctionsOfTime {
      19             : class FunctionOfTime;
      20             : }  // namespace FunctionsOfTime
      21             : }  // namespace domain
      22             : namespace Frame {
      23             : struct Distorted;
      24             : struct Grid;
      25             : struct Inertial;
      26             : }  // namespace Frame
      27             : 
      28             : namespace domain::creators::time_dependence {
      29             : template <size_t MeshDim>
      30             : class CubicScale;
      31             : template <size_t MeshDim>
      32             : class None;
      33             : template <size_t MeshDim>
      34             : class ScalingAndZRotation;
      35             : template <domain::ObjectLabel Label>
      36             : class Shape;
      37             : class SphericalCompression;
      38             : template <size_t MeshDim>
      39             : class RotationAboutZAxis;
      40             : template <size_t MeshDim, size_t Index = 0>
      41             : class UniformTranslation;
      42             : }  // namespace domain::creators::time_dependence
      43             : /// \endcond
      44             : 
      45             : namespace domain::creators {
      46             : /// \ingroup ComputationalDomainGroup
      47             : /// \brief Classes and functions for adding time dependence to a domain.
      48             : namespace time_dependence {
      49             : /// \brief The abstract base class off of which specific classes for adding
      50             : /// time dependence into a domain creator must inherit off of.
      51             : ///
      52             : /// The simplest examples of a `TimeDependence` are `None` and
      53             : /// `UniformTranslation`. The `None` class is treated in a special manner to
      54             : /// communicate to the code that the domain is time-independent. The
      55             : /// `UniformTranslation` takes an extra template parameter `Index` so that its
      56             : /// name is unique from other `UniformTranslation`s.
      57             : template <size_t MeshDim>
      58           1 : struct TimeDependence {
      59             :  private:
      60           0 :   using creatable_classes_1d = tmpl::list<>;
      61           0 :   using creatable_classes_2d =
      62             :       tmpl::list<RotationAboutZAxis<2>, ScalingAndZRotation<2>>;
      63           0 :   using creatable_classes_3d =
      64             :       tmpl::list<Shape<domain::ObjectLabel::A>, Shape<domain::ObjectLabel::B>,
      65             :                  Shape<domain::ObjectLabel::None>, SphericalCompression,
      66             :                  RotationAboutZAxis<3>, ScalingAndZRotation<3>>;
      67           0 :   using creatable_classes_any_dim =
      68             :       tmpl::list<CubicScale<MeshDim>, None<MeshDim>,
      69             :                  UniformTranslation<MeshDim>>;
      70             : 
      71             :  public:
      72           0 :   using creatable_classes =
      73             :       tmpl::append<creatable_classes_any_dim,
      74             :                    tmpl::conditional_t<
      75             :                        MeshDim == 1, creatable_classes_1d,
      76             :                        tmpl::conditional_t<MeshDim == 2, creatable_classes_2d,
      77             :                                            creatable_classes_3d>>>;
      78             : 
      79           0 :   TimeDependence() = default;
      80           0 :   virtual ~TimeDependence() = 0;
      81           0 :   TimeDependence(const TimeDependence&) = default;
      82           0 :   TimeDependence& operator=(const TimeDependence&) = default;
      83           0 :   TimeDependence(TimeDependence&&) = default;
      84           0 :   TimeDependence& operator=(TimeDependence&&) = default;
      85             : 
      86             :   /// Returns a `std::unique_ptr` pointing to a copy of the `TimeDependence`.
      87           1 :   virtual auto get_clone() const -> std::unique_ptr<TimeDependence> = 0;
      88             : 
      89             :   /// Returns the coordinate maps from the `Frame::Grid` to the
      90             :   /// `Frame::Inertial` frame for each block.
      91           1 :   virtual auto block_maps_grid_to_inertial(size_t number_of_blocks) const
      92             :       -> std::vector<std::unique_ptr<domain::CoordinateMapBase<
      93             :           Frame::Grid, Frame::Inertial, MeshDim>>> = 0;
      94             : 
      95             :   /// Returns the coordinate maps from the `Frame::Grid` to the
      96             :   /// `Frame::Distorted` frame for each block.
      97             :   /// Returns vector of nullptr if there is no distorted frame.
      98           1 :   virtual auto block_maps_grid_to_distorted(size_t number_of_blocks) const
      99             :       -> std::vector<std::unique_ptr<domain::CoordinateMapBase<
     100             :           Frame::Grid, Frame::Distorted, MeshDim>>> = 0;
     101             : 
     102             :   /// Returns the coordinate maps from the `Frame::Distorted` to the
     103             :   /// `Frame::Inertial` frame for each block.
     104             :   /// Returns vector of nullptr if is no distorted frame.
     105           1 :   virtual auto block_maps_distorted_to_inertial(size_t number_of_blocks) const
     106             :       -> std::vector<std::unique_ptr<domain::CoordinateMapBase<
     107             :           Frame::Distorted, Frame::Inertial, MeshDim>>> = 0;
     108             : 
     109             :   /// Returns the functions of time for the domain.
     110           1 :   virtual auto functions_of_time(const std::unordered_map<std::string, double>&
     111             :                                      initial_expiration_times = {}) const
     112             :       -> std::unordered_map<
     113             :           std::string,
     114             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>> = 0;
     115             : 
     116             :   /// Returns `true` if the instance is `None`, meaning no time dependence.
     117           1 :   bool is_none() const {
     118             :     return dynamic_cast<const None<MeshDim>*>(this) != nullptr;
     119             :   }
     120             : };
     121             : 
     122             : template <size_t MeshDim>
     123             : TimeDependence<MeshDim>::~TimeDependence() = default;
     124             : }  // namespace time_dependence
     125             : }  // namespace domain::creators
     126             : 
     127             : #include "Domain/Creators/TimeDependence/CubicScale.hpp"
     128             : #include "Domain/Creators/TimeDependence/None.hpp"
     129             : #include "Domain/Creators/TimeDependence/RotationAboutZAxis.hpp"
     130             : #include "Domain/Creators/TimeDependence/ScalingAndZRotation.hpp"
     131             : #include "Domain/Creators/TimeDependence/Shape.hpp"
     132             : #include "Domain/Creators/TimeDependence/SphericalCompression.hpp"
     133             : #include "Domain/Creators/TimeDependence/UniformTranslation.hpp"

Generated by: LCOV version 1.14