SpECTRE Documentation Coverage Report
Current view: top level - Domain/Creators/TimeDependence - SphericalCompression.hpp Hit Total Coverage
Commit: 2ae2b99409ac582030d56a4560a92a3e066a7e54 Lines: 12 50 24.0 %
Date: 2022-01-15 08:40:38
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 <limits>
       9             : #include <memory>
      10             : #include <optional>
      11             : #include <string>
      12             : #include <unordered_map>
      13             : #include <vector>
      14             : 
      15             : #include "Domain/CoordinateMaps/CoordinateMap.hpp"
      16             : #include "Domain/CoordinateMaps/TimeDependent/SphericalCompression.hpp"
      17             : #include "Domain/Creators/TimeDependence/GenerateCoordinateMap.hpp"
      18             : #include "Domain/Creators/TimeDependence/TimeDependence.hpp"
      19             : #include "Options/Auto.hpp"
      20             : #include "Options/Options.hpp"
      21             : #include "Utilities/ErrorHandling/Assert.hpp"
      22             : #include "Utilities/TMPL.hpp"
      23             : 
      24             : /// \cond
      25             : namespace domain {
      26             : namespace FunctionsOfTime {
      27             : class FunctionOfTime;
      28             : }  // namespace FunctionsOfTime
      29             : namespace CoordinateMaps::TimeDependent {
      30             : template <bool InertiorMap>
      31             : class SphericalCompression;
      32             : }  // namespace CoordinateMaps::TimeDependent
      33             : template <typename SourceFrame, typename TargetFrame, typename... Maps>
      34             : class CoordinateMap;
      35             : }  // namespace domain
      36             : 
      37             : namespace Frame {
      38             : struct Grid;
      39             : struct Inertial;
      40             : }  // namespace Frame
      41             : /// \endcond
      42             : 
      43             : namespace domain::creators::time_dependence {
      44             : /*!
      45             :  * \brief A spherical compression about some center, as given by
      46             :  * domain::CoordinateMaps::TimeDependent::SphericalCompression<false>.
      47             :  *
      48             :  * \details This TimeDependence is suitable for use on a spherical shell,
      49             :  * where MinRadius and MaxRadius are the inner and outer radii of the shell,
      50             :  * respectively.
      51             :  */
      52           1 : class SphericalCompression final : public TimeDependence<3> {
      53             :  private:
      54           0 :   using SphericalCompressionMap =
      55             :       domain::CoordinateMaps::TimeDependent::SphericalCompression<false>;
      56             : 
      57             :  public:
      58           0 :   using maps_list =
      59             :       tmpl::list<domain::CoordinateMap<Frame::Grid, Frame::Inertial,
      60             :                                        SphericalCompressionMap>>;
      61             : 
      62           0 :   static constexpr size_t mesh_dim = 3;
      63             : 
      64             :   /// \brief The initial time of the function of time.
      65           1 :   struct InitialTime {
      66           0 :     using type = double;
      67           0 :     static constexpr Options::String help = {
      68             :         "The initial time of the function of time"};
      69             :   };
      70             :   /// \brief Minimum radius for the SphericalCompression map
      71           1 :   struct MinRadius {
      72           0 :     using type = double;
      73           0 :     static constexpr Options::String help = {
      74             :         "Min radius for SphericalCompression map."};
      75             :   };
      76             :   /// \brief Maximum radius for the SphericalCompression map
      77           1 :   struct MaxRadius {
      78           0 :     using type = double;
      79           0 :     static constexpr Options::String help = {
      80             :         "Max radius for SphericalCompression map."};
      81             :   };
      82             :   /// \brief Center for the SphericalCompression map
      83           1 :   struct Center {
      84           0 :     using type = std::array<double, 3>;
      85           0 :     static constexpr Options::String help = {
      86             :         "Center for the SphericalCompression map."};
      87             :   };
      88             :   /// \brief Initial value for function of time for the spherical compression
      89           1 :   struct InitialValue {
      90           0 :     using type = double;
      91           0 :     static constexpr Options::String help = {
      92             :         "Spherical compression value at initial time."};
      93             :   };
      94             :   /// \brief Initial radial velocity for the function of time for the spherical
      95             :   /// compression
      96           1 :   struct InitialVelocity {
      97           0 :     using type = double;
      98           0 :     static constexpr Options::String help = {
      99             :         "Spherical compression initial radial velocity."};
     100             :   };
     101             :   /// \brief Initial radial acceleration for the function of time for the
     102             :   /// spherical compression
     103           1 :   struct InitialAcceleration {
     104           0 :     using type = double;
     105           0 :     static constexpr Options::String help = {
     106             :         "Spherical compression initial radial acceleration."};
     107             :   };
     108             : 
     109           0 :   using MapForComposition =
     110             :       detail::generate_coordinate_map_t<tmpl::list<SphericalCompressionMap>>;
     111             : 
     112           0 :   using options =
     113             :       tmpl::list<InitialTime, MinRadius, MaxRadius, Center, InitialValue,
     114             :                  InitialVelocity, InitialAcceleration>;
     115             : 
     116           0 :   static constexpr Options::String help = {"A spherical compression."};
     117             : 
     118           0 :   SphericalCompression() = default;
     119           0 :   ~SphericalCompression() override = default;
     120           0 :   SphericalCompression(const SphericalCompression&) = delete;
     121           0 :   SphericalCompression(SphericalCompression&&) = default;
     122           0 :   SphericalCompression& operator=(const SphericalCompression&) = delete;
     123           0 :   SphericalCompression& operator=(SphericalCompression&&) = default;
     124             : 
     125           0 :   SphericalCompression(double initial_time, double min_radius,
     126             :                        double max_radius, std::array<double, 3> center,
     127             :                        double initial_value, double initial_velocity,
     128             :                        double initial_acceleration,
     129             :                        const Options::Context& context = {});
     130             : 
     131           1 :   auto get_clone() const -> std::unique_ptr<TimeDependence<mesh_dim>> override;
     132             : 
     133           1 :   auto block_maps(size_t number_of_blocks) const
     134             :       -> std::vector<std::unique_ptr<domain::CoordinateMapBase<
     135             :           Frame::Grid, Frame::Inertial, mesh_dim>>> override;
     136             : 
     137           1 :   auto functions_of_time(const std::unordered_map<std::string, double>&
     138             :                              initial_expiration_times = {}) const
     139             :       -> std::unordered_map<
     140             :           std::string,
     141             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>> override;
     142             : 
     143             :   /// Returns the map for each block to be used in a composition of
     144             :   /// `TimeDependence`s.
     145           1 :   MapForComposition map_for_composition() const;
     146             : 
     147             :  private:
     148             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     149           0 :   friend bool operator==(const SphericalCompression& lhs,
     150             :                          const SphericalCompression& rhs);
     151             : 
     152           0 :   double initial_time_{std::numeric_limits<double>::signaling_NaN()};
     153           0 :   double min_radius_{std::numeric_limits<double>::signaling_NaN()};
     154           0 :   double max_radius_{std::numeric_limits<double>::signaling_NaN()};
     155           0 :   std::array<double, 3> center_{};
     156           0 :   double initial_value_{std::numeric_limits<double>::signaling_NaN()};
     157           0 :   double initial_velocity_{std::numeric_limits<double>::signaling_NaN()};
     158           0 :   double initial_acceleration_{std::numeric_limits<double>::signaling_NaN()};
     159           0 :   inline static const std::string function_of_time_name_{"Size"};
     160             : };
     161             : 
     162           0 : bool operator!=(const SphericalCompression& lhs,
     163             :                 const SphericalCompression& rhs);
     164             : }  // namespace domain::creators::time_dependence

Generated by: LCOV version 1.14