AnalyticSolution.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
10 #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
11 #include "Utilities/FakeVirtual.hpp"
12 #include "Utilities/Registration.hpp"
13 #include "Utilities/TMPL.hpp"
14 #include "Utilities/TaggedTuple.hpp"
15 
16 namespace Xcts {
17 /// Analytic solutions of the \ref Xcts "XCTS" equations
18 namespace Solutions {
19 
20 /*!
21  * \brief Base class for analytic solutions of the \ref Xcts "XCTS" equations
22  *
23  * This abstract base class allows factory-creating derived classes from
24  * input-file options (see `Registration`). The list of `Registrars` may also
25  * contain classes that aren't analytic solutions but only derive off
26  * `::AnalyticData`. This allows factory-creating any choice of analytic
27  * solution _or_ analytic data from input-file options, but you must use the
28  * `::AnalyticData` class for the factory-creation. Note that analytic solutions
29  * provide more variables than analytic data classes, so to request variables
30  * that only analytic solutions provide you must perform a cast to
31  * `AnalyticSolution`.
32  */
33 template <typename Registrars>
34 class AnalyticSolution : public ::AnalyticData<3, Registrars> {
35  private:
37 
38  protected:
39  /// \cond
40  AnalyticSolution() = default;
41  AnalyticSolution(const AnalyticSolution&) = default;
43  AnalyticSolution& operator=(const AnalyticSolution&) = default;
44  AnalyticSolution& operator=(AnalyticSolution&&) = default;
45  /// \endcond
46 
47  public:
48  ~AnalyticSolution() override = default;
49 
50  using registrars = Registrars;
51  using creatable_classes = Registration::registrants<registrars>;
52 
53  /// \cond
54  explicit AnalyticSolution(CkMigrateMessage* m) noexcept : Base(m) {}
56  /// \endcond
57 
58  template <typename DataType, typename... RequestedTags>
59  tuples::TaggedTuple<RequestedTags...> variables(
60  const tnsr::I<DataType, 3, Frame::Inertial>& x,
61  tmpl::list<RequestedTags...> /*meta*/) const noexcept {
63  tuples::TaggedTuple<RequestedTags...>,
64  tmpl::filter<creatable_classes,
66  this, [&x](auto* const derived) noexcept {
67  return derived->variables(x, tmpl::list<RequestedTags...>{});
68  });
69  }
70 };
71 
72 } // namespace Solutions
73 } // namespace Xcts
Xcts
Items related to solving the Extended Conformal Thin Sandwich (XCTS) equations.
Definition: Tags.hpp:17
CharmPupable.hpp
call_with_dynamic_type
Result call_with_dynamic_type(Base *const obj, Callable &&f) noexcept
Call a functor with the derived type of a base class pointer.
Definition: FakeVirtual.hpp:103
cstddef
WRAPPED_PUPable_abstract
#define WRAPPED_PUPable_abstract(className)
Wraps the Charm++ macro, see the Charm++ documentation.
Definition: CharmPupable.hpp:41
Xcts::Solutions::AnalyticSolution
Base class for analytic solutions of the XCTS equations.
Definition: AnalyticSolution.hpp:34
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
AnalyticData
Provides analytic tensor data as a function of the spatial coordinates.
Definition: AnalyticData.hpp:30
Tensor.hpp
Registration::registrants
tmpl::transform< tmpl::remove_duplicates< RegistrarList >, detail::registrant< tmpl::pin< tmpl::remove_duplicates< RegistrarList > >, tmpl::_1 > > registrants
Transform a list of registrars into the list of associated registrants. This is usually used to defin...
Definition: Registration.hpp:65
TMPL.hpp
std::is_base_of