SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticSolutions/Poisson - Zero.hpp Hit Total Coverage
Commit: 3c072f0ce967e2e56649d3fa12aa2a0e4fe2a42e Lines: 1 14 7.1 %
Date: 2024-04-23 20:50:18
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 <pup.h>
       8             : 
       9             : #include "DataStructures/DataBox/Prefixes.hpp"
      10             : #include "DataStructures/Tensor/Tensor.hpp"
      11             : #include "Elliptic/Systems/Poisson/Tags.hpp"
      12             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      13             : #include "Options/String.hpp"
      14             : #include "PointwiseFunctions/InitialDataUtilities/AnalyticSolution.hpp"
      15             : #include "Utilities/MakeWithValue.hpp"
      16             : #include "Utilities/Serialization/CharmPupable.hpp"
      17             : #include "Utilities/TMPL.hpp"
      18             : #include "Utilities/TaggedTuple.hpp"
      19             : 
      20             : namespace Poisson::Solutions {
      21             : 
      22             : /// The trivial solution \f$u=0\f$ of a Poisson equation. Useful as initial
      23             : /// guess.
      24             : template <size_t Dim>
      25           1 : class Zero : public elliptic::analytic_data::AnalyticSolution {
      26             :  public:
      27           0 :   using options = tmpl::list<>;
      28           0 :   static constexpr Options::String help{
      29             :       "The trivial solution, useful as initial guess."};
      30             : 
      31           0 :   Zero() = default;
      32           0 :   Zero(const Zero&) = default;
      33           0 :   Zero& operator=(const Zero&) = default;
      34           0 :   Zero(Zero&&) = default;
      35           0 :   Zero& operator=(Zero&&) = default;
      36           0 :   ~Zero() override = default;
      37           0 :   std::unique_ptr<elliptic::analytic_data::AnalyticSolution> get_clone()
      38             :       const override {
      39             :     return std::make_unique<Zero>(*this);
      40             :   }
      41             : 
      42             :   /// \cond
      43             :   explicit Zero(CkMigrateMessage* m)
      44             :       : elliptic::analytic_data::AnalyticSolution(m) {}
      45             :   using PUP::able::register_constructor;
      46             :   WRAPPED_PUPable_decl_template(Zero);  // NOLINT
      47             :   /// \endcond
      48             : 
      49             :   template <typename DataType, typename... RequestedTags>
      50           0 :   tuples::TaggedTuple<RequestedTags...> variables(
      51             :       const tnsr::I<DataType, Dim>& x,
      52             :       tmpl::list<RequestedTags...> /*meta*/) const {
      53             :     using supported_tags = tmpl::list<
      54             :         Tags::Field,
      55             :         ::Tags::deriv<Tags::Field, tmpl::size_t<Dim>, Frame::Inertial>,
      56             :         ::Tags::Flux<Tags::Field, tmpl::size_t<Dim>, Frame::Inertial>,
      57             :         ::Tags::FixedSource<Tags::Field>>;
      58             :     static_assert(tmpl::size<tmpl::list_difference<tmpl::list<RequestedTags...>,
      59             :                                                    supported_tags>>::value == 0,
      60             :                   "The requested tag is not supported");
      61             :     return {make_with_value<typename RequestedTags::type>(x, 0.)...};
      62             :   }
      63             : };
      64             : 
      65             : /// \cond
      66             : template <size_t Dim>
      67             : PUP::able::PUP_ID Zero<Dim>::my_PUP_ID = 0;  // NOLINT
      68             : /// \endcond
      69             : 
      70             : template <size_t Dim>
      71           0 : bool operator==(const Zero<Dim>& /*lhs*/, const Zero<Dim>& /*rhs*/) {
      72             :   return true;
      73             : }
      74             : 
      75             : template <size_t Dim>
      76           0 : bool operator!=(const Zero<Dim>& lhs, const Zero<Dim>& rhs) {
      77             :   return not(lhs == rhs);
      78             : }
      79             : 
      80             : }  // namespace Poisson::Solutions

Generated by: LCOV version 1.14