SpECTRE Documentation Coverage Report
Current view: top level - Domain/Creators/TimeDependentOptions - FromVolumeFile.hpp Hit Total Coverage
Commit: a8efe75339f4781ca06d43fed14c40144d5e8a08 Lines: 2 27 7.4 %
Date: 2024-10-17 21:19:21
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 <string>
       8             : 
       9             : #include "DataStructures/DataVector.hpp"
      10             : #include "Domain/Structure/ObjectLabel.hpp"
      11             : #include "Options/Auto.hpp"
      12             : #include "Options/Context.hpp"
      13             : #include "Options/String.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : namespace domain::creators::time_dependent_options {
      17             : /*!
      18             :  * \brief Structs meant to be used as template parameters for the
      19             :  * `domain::creators::time_dependent_options::FromVolumeFile` classes.
      20             :  */
      21           1 : namespace names {
      22           0 : struct Translation {};
      23           0 : struct Rotation {};
      24           0 : struct Expansion {};
      25             : template <domain::ObjectLabel Object>
      26           0 : struct ShapeSize {};
      27             : }  // namespace names
      28             : 
      29             : namespace detail {
      30             : struct FromVolumeFileBase {
      31             :   struct H5Filename {
      32             :     using type = std::string;
      33             :     static constexpr Options::String help{
      34             :         "Name of H5 file to read functions of time from."};
      35             :   };
      36             : 
      37             :   struct SubfileName {
      38             :     using type = std::string;
      39             :     static constexpr Options::String help{
      40             :         "Subfile that holds the volume data. Must be an h5::VolumeData "
      41             :         "subfile."};
      42             :   };
      43             : 
      44             :   struct Time {
      45             :     using type = double;
      46             :     static constexpr Options::String help =
      47             :         "Time in the H5File to get the coefficients at. Will likely be the "
      48             :         "same as the initial time";
      49             :   };
      50             : 
      51             :   using options = tmpl::list<H5Filename, SubfileName, Time>;
      52             :   static constexpr Options::String help =
      53             :       "Read function of time coefficients from a volume subfile of an H5 file.";
      54             : 
      55             :   FromVolumeFileBase() = default;
      56             : };
      57             : }  // namespace detail
      58             : 
      59             : /// @{
      60             : /*!
      61             :  * \brief Read in FunctionOfTime coefficients from an H5 file and volume
      62             :  * subfile.
      63             :  *
      64             :  * \details To use, template the class on one of the structs in
      65             :  * `domain::creators::time_dependent_options::names`. The general struct will
      66             :  * have one member, `values` that will hold the function of time and its first
      67             :  * two derivatives.
      68             :  *
      69             :  * There are specializations for
      70             :  *
      71             :  * - `domain::creators::time_dependent_options::names::Rotation` because of
      72             :  * quaternions
      73             :  * - `domain::creators::time_dependent_options::name::Expansion` because it also
      74             :  * has outer boundary values (a second function of time)
      75             :  * - `domain::creators::time_dependent_options::names::ShapeSize` because it
      76             :  * handles both the Shape and Size function of time.
      77             :  */
      78             : template <typename FoTName>
      79           1 : struct FromVolumeFile : public detail::FromVolumeFileBase {
      80           0 :   FromVolumeFile() = default;
      81           0 :   FromVolumeFile(const std::string& h5_filename,
      82             :                  const std::string& subfile_name, double time,
      83             :                  const Options::Context& context = {});
      84             : 
      85           0 :   std::array<DataVector, 3> values{};
      86             : };
      87             : 
      88             : template <>
      89           0 : struct FromVolumeFile<names::Expansion> : public detail::FromVolumeFileBase {
      90           0 :   FromVolumeFile() = default;
      91           0 :   FromVolumeFile(const std::string& h5_filename,
      92             :                  const std::string& subfile_name, double time,
      93             :                  const Options::Context& context = {});
      94             : 
      95           0 :   std::array<DataVector, 3> expansion_values{};
      96           0 :   std::array<DataVector, 3> expansion_values_outer_boundary{};
      97           0 :   double velocity_outer_boundary{};
      98           0 :   double decay_timescale_outer_boundary{};
      99             : };
     100             : 
     101             : template <>
     102           0 : struct FromVolumeFile<names::Rotation> : public detail::FromVolumeFileBase {
     103           0 :   FromVolumeFile() = default;
     104           0 :   FromVolumeFile(const std::string& h5_filename,
     105             :                  const std::string& subfile_name, double time,
     106             :                  const Options::Context& context = {});
     107             : 
     108           0 :   std::array<DataVector, 3> quaternions{};
     109           0 :   std::array<DataVector, 4> angle_values{};
     110             : };
     111             : 
     112             : template <ObjectLabel Object>
     113           0 : struct FromVolumeFile<names::ShapeSize<Object>>
     114             :     : public detail::FromVolumeFileBase {
     115           0 :   FromVolumeFile() = default;
     116           0 :   FromVolumeFile(const std::string& h5_filename,
     117             :                  const std::string& subfile_name, double time,
     118             :                  const Options::Context& context = {});
     119             : 
     120           0 :   std::array<DataVector, 3> shape_values{};
     121           0 :   std::array<DataVector, 4> size_values{};
     122             : };
     123             : /// @}
     124             : }  // namespace domain::creators::time_dependent_options

Generated by: LCOV version 1.14