SpECTRE Documentation Coverage Report
Current view: top level - Domain/Creators/TimeDependence - UniformRotationAboutZAxis.hpp Hit Total Coverage
Commit: 2ae2b99409ac582030d56a4560a92a3e066a7e54 Lines: 7 32 21.9 %
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/Identity.hpp"
      17             : #include "Domain/CoordinateMaps/TimeDependent/Rotation.hpp"
      18             : #include "Domain/Creators/TimeDependence/GenerateCoordinateMap.hpp"
      19             : #include "Domain/Creators/TimeDependence/TimeDependence.hpp"
      20             : #include "Options/Auto.hpp"
      21             : #include "Options/Options.hpp"
      22             : #include "Utilities/ErrorHandling/Assert.hpp"
      23             : #include "Utilities/PrettyType.hpp"
      24             : #include "Utilities/TMPL.hpp"
      25             : 
      26             : /// \cond
      27             : namespace domain {
      28             : namespace FunctionsOfTime {
      29             : class FunctionOfTime;
      30             : }  // namespace FunctionsOfTime
      31             : namespace CoordinateMaps {
      32             : namespace TimeDependent {
      33             : template <typename Map1, typename Map2>
      34             : class ProductOf2Maps;
      35             : }  // namespace TimeDependent
      36             : }  // namespace CoordinateMaps
      37             : 
      38             : template <typename SourceFrame, typename TargetFrame, typename... Maps>
      39             : class CoordinateMap;
      40             : }  // namespace domain
      41             : 
      42             : namespace Frame {
      43             : struct Grid;
      44             : struct Inertial;
      45             : }  // namespace Frame
      46             : /// \endcond
      47             : 
      48             : namespace domain {
      49             : namespace creators {
      50             : namespace time_dependence {
      51             : /*!
      52             :  * \brief A uniform rotation about the \f$z\f$ axis:
      53             :  * \f{eqnarray*}
      54             :  * x &\to& x \cos \alpha(t) - y \sin \alpha(t)\text{,} \\
      55             :  * y &\to& x \sin \alpha(t) + y \cos \alpha(t)\text{,}
      56             :  * \f}
      57             :  * where \f$\alpha(t)\f$ is a `domain::FunctionsOfTime::FunctionOfTime`. For 3
      58             :  * spatial dimensions, \f$z \to z\f$, and the rotation is implemented as a
      59             :  * product of the 2D rotation and an identity map. The rotation is undefined
      60             :  * (and therefore unimplemented here) for 1 spatial dimension.
      61             :  */
      62             : template <size_t MeshDim>
      63           1 : class UniformRotationAboutZAxis final : public TimeDependence<MeshDim> {
      64             :   static_assert(
      65             :       MeshDim > 1,
      66             :       "UniformRotationAboutZAxis<MeshDim> undefined for MeshDim == 1");
      67             : 
      68             :  private:
      69           0 :   using Identity = domain::CoordinateMaps::Identity<1>;
      70           0 :   using Rotation = domain::CoordinateMaps::TimeDependent::Rotation<2>;
      71             : 
      72             :  public:
      73           0 :   using maps_list = tmpl::list<
      74             :       domain::CoordinateMap<Frame::Grid, Frame::Inertial, Rotation>,
      75             :       domain::CoordinateMap<
      76             :           Frame::Grid, Frame::Inertial,
      77             :           CoordinateMaps::TimeDependent::ProductOf2Maps<Rotation, Identity>>>;
      78             : 
      79           0 :   static constexpr size_t mesh_dim = MeshDim;
      80             : 
      81             :   /// \brief The initial time of the function of time.
      82           1 :   struct InitialTime {
      83           0 :     using type = double;
      84           0 :     static constexpr Options::String help = {
      85             :         "The initial time of the function of time"};
      86             :   };
      87             :   /// \brief The \f$x\f$-, \f$y\f$-, and \f$z\f$-velocity.
      88           1 :   struct AngularVelocity {
      89           0 :     using type = double;
      90           0 :     static constexpr Options::String help = {
      91             :         "The angular velocity of the map."};
      92             :   };
      93             : 
      94           0 :   using MapForComposition = detail::generate_coordinate_map_t<
      95             :       tmpl::list<tmpl::conditional_t<MeshDim == 2, Rotation,
      96             :                                      domain::CoordinateMaps::TimeDependent::
      97             :                                          ProductOf2Maps<Rotation, Identity>>>>;
      98             : 
      99           0 :   using options = tmpl::list<InitialTime, AngularVelocity>;
     100             : 
     101           0 :   static constexpr Options::String help = {
     102             :       "A spatially uniform rotation about the z axis initialized with a "
     103             :       "constant angular velocity."};
     104             : 
     105           0 :   UniformRotationAboutZAxis() = default;
     106           0 :   ~UniformRotationAboutZAxis() override = default;
     107           0 :   UniformRotationAboutZAxis(const UniformRotationAboutZAxis&) = delete;
     108           0 :   UniformRotationAboutZAxis(UniformRotationAboutZAxis&&) = default;
     109           0 :   UniformRotationAboutZAxis& operator=(const UniformRotationAboutZAxis&) =
     110             :       delete;
     111           0 :   UniformRotationAboutZAxis& operator=(UniformRotationAboutZAxis&&) = default;
     112             : 
     113           0 :   UniformRotationAboutZAxis(double initial_time, double angular_velocity);
     114             : 
     115           1 :   auto get_clone() const -> std::unique_ptr<TimeDependence<MeshDim>> override;
     116             : 
     117           1 :   auto block_maps(size_t number_of_blocks) const
     118             :       -> std::vector<std::unique_ptr<domain::CoordinateMapBase<
     119             :           Frame::Grid, Frame::Inertial, MeshDim>>> override;
     120             : 
     121           1 :   auto functions_of_time(const std::unordered_map<std::string, double>&
     122             :                              initial_expiration_times = {}) const
     123             :       -> std::unordered_map<
     124             :           std::string,
     125             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>> override;
     126             : 
     127             :   /// Returns the map for each block to be used in a composition of
     128             :   /// `TimeDependence`s.
     129           1 :   MapForComposition map_for_composition() const;
     130             : 
     131             :  private:
     132             :   template <size_t LocalDim>
     133             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     134           0 :   friend bool operator==(const UniformRotationAboutZAxis<LocalDim>& lhs,
     135             :                          const UniformRotationAboutZAxis<LocalDim>& rhs);
     136             : 
     137           0 :   double initial_time_{std::numeric_limits<double>::signaling_NaN()};
     138           0 :   double angular_velocity_{std::numeric_limits<double>::signaling_NaN()};
     139           0 :   inline static const std::string function_of_time_name_{"Rotation"};
     140             : };
     141             : 
     142             : template <size_t Dim>
     143           0 : bool operator==(const UniformRotationAboutZAxis<Dim>& lhs,
     144             :                 const UniformRotationAboutZAxis<Dim>& rhs);
     145             : 
     146             : template <size_t Dim>
     147           0 : bool operator!=(const UniformRotationAboutZAxis<Dim>& lhs,
     148             :                 const UniformRotationAboutZAxis<Dim>& rhs);
     149             : }  // namespace time_dependence
     150             : }  // namespace creators
     151             : }  // namespace domain

Generated by: LCOV version 1.14