SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticSolutions - Tags.hpp Hit Total Coverage
Commit: 2ae2b99409ac582030d56a4560a92a3e066a7e54 Lines: 9 27 33.3 %
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 <optional>
       7             : 
       8             : #include "DataStructures/DataBox/PrefixHelpers.hpp"
       9             : #include "DataStructures/DataBox/Tag.hpp"
      10             : #include "DataStructures/Variables.hpp"
      11             : #include "Options/Options.hpp"
      12             : #include "Parallel/Serialize.hpp"
      13             : #include "PointwiseFunctions/AnalyticData/Tags.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : namespace OptionTags {
      17             : /// \ingroup OptionGroupsGroup
      18             : /// Holds the `OptionTags::AnalyticSolution` option in the input file
      19           1 : struct AnalyticSolutionGroup {
      20           0 :   static std::string name() { return "AnalyticSolution"; }
      21           0 :   static constexpr Options::String help =
      22             :       "Analytic solution used for the initial data and errors";
      23             : };
      24             : 
      25             : /// \ingroup OptionTagsGroup
      26             : /// The analytic solution, with the type of the analytic solution set as the
      27             : /// template parameter
      28             : template <typename SolutionType>
      29           1 : struct AnalyticSolution {
      30           0 :   static std::string name() { return Options::name<SolutionType>(); }
      31           0 :   static constexpr Options::String help = "Options for the analytic solution";
      32           0 :   using type = SolutionType;
      33           0 :   using group = AnalyticSolutionGroup;
      34             : };
      35             : }  // namespace OptionTags
      36             : 
      37             : namespace Tags {
      38             : /// Can be used to retrieve the analytic solution from the cache without having
      39             : /// to know the template parameters of AnalyticSolution.
      40           1 : struct AnalyticSolutionBase : AnalyticSolutionOrData {};
      41             : 
      42             : /// \ingroup OptionTagsGroup
      43             : /// The analytic solution, with the type of the analytic solution set as the
      44             : /// template parameter
      45             : template <typename SolutionType>
      46           1 : struct AnalyticSolution : AnalyticSolutionBase, db::SimpleTag {
      47           0 :   using type = SolutionType;
      48           0 :   using option_tags = tmpl::list<::OptionTags::AnalyticSolution<SolutionType>>;
      49             : 
      50           0 :   static constexpr bool pass_metavariables = false;
      51           0 :   static SolutionType create_from_options(
      52             :       const SolutionType& analytic_solution) {
      53             :     return deserialize<type>(serialize<type>(analytic_solution).data());
      54             :   }
      55             : };
      56             : 
      57             : /// \ingroup DataBoxTagsGroup
      58             : /// \brief Prefix indicating the analytic solution value for a quantity
      59             : ///
      60             : /// \snippet AnalyticSolutions/Test_Tags.cpp analytic_name
      61             : template <typename Tag>
      62           1 : struct Analytic : db::PrefixTag, db::SimpleTag {
      63           0 :   using type = typename Tag::type;
      64           0 :   using tag = Tag;
      65             : };
      66             : 
      67             : /*!
      68             :  * \brief Prefix indicating the error of a value represented by `Tag`
      69             :  */
      70             : template <typename Tag>
      71           1 : struct Error : db::PrefixTag, db::SimpleTag {
      72           0 :   using type = typename Tag::type;
      73           0 :   using tag = Tag;
      74             : };
      75             : 
      76             : /// Base tag for the analytic solution tensors. Retrieved values can be either
      77             : /// `Variables` or `std::optional<Variables>`.
      78             : ///
      79             : /// \see ::Tags::AnalyticSolutions
      80           1 : struct AnalyticSolutionsBase : db::BaseTag {};
      81             : 
      82             : /// The analytic solutions for all `FieldTags`
      83             : template <typename FieldTags>
      84           1 : struct AnalyticSolutions : AnalyticSolutionsBase, db::SimpleTag {
      85           0 :   using type = ::Variables<db::wrap_tags_in<Analytic, FieldTags>>;
      86             : };
      87             : 
      88             : /// The analytic solutions for all `FieldTags`, or `std::nullopt` if no analytic
      89             : /// solutions are available
      90             : template <typename FieldTags>
      91           1 : struct AnalyticSolutionsOptional : AnalyticSolutionsBase, db::SimpleTag {
      92           0 :   static std::string name() { return "AnalyticSolutions"; }
      93           0 :   using type =
      94             :       std::optional<::Variables<db::wrap_tags_in<Analytic, FieldTags>>>;
      95             : };
      96             : }  // namespace Tags

Generated by: LCOV version 1.14