None.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <memory>
7 #include <pup.h>
8 
9 #include "Domain/BoundaryConditions/BoundaryCondition.hpp"
10 #include "Options/Options.hpp"
12 #include "Utilities/TMPL.hpp"
13 
15 namespace detail {
16 class MarkAsNone {
17  public:
18  MarkAsNone() = default;
19  MarkAsNone(MarkAsNone&&) noexcept = default;
20  MarkAsNone& operator=(MarkAsNone&&) noexcept = default;
21  MarkAsNone(const MarkAsNone&) = default;
22  MarkAsNone& operator=(const MarkAsNone&) = default;
23  virtual ~MarkAsNone() = 0;
24 };
25 } // namespace detail
26 
27 /*!
28  * \brief None boundary conditions.
29  *
30  * This boundary condition doesn't actually do anything, and gets pretty much
31  * completely ignored by everything but the domain creator internals. The domain
32  * creator internals can use `None` as a way of specifying "boundary conditions"
33  * without a system. It can also be used in cases like the BinaryCompactObject
34  * domain where there may be no excision boundaries, and so the excision
35  * boundary condition must be `None` in that case so the domain creator can be
36  * sure the domain is set in a consistent state.
37  *
38  * To use with a specific system add:
39  *
40  * \code
41  * domain::BoundaryConditions::None<your::system::BoundaryConditionBase>
42  * \endcode
43  *
44  * to the list of creatable classes.
45  *
46  * \warning if you want an outflow boundary condition, you must implement one,
47  * not use `None.
48  */
49 template <typename SystemBoundaryConditionBaseClass>
50 struct None final : public SystemBoundaryConditionBaseClass,
51  public detail::MarkAsNone {
52  public:
53  using options = tmpl::list<>;
54  static constexpr Options::String help{
55  "None boundary condition. Used only during domain creation to ensure a "
56  "consistent state to the domain."};
57  static std::string name() noexcept { return "None"; }
58 
59  None() = default;
60  None(None&&) noexcept = default;
61  None& operator=(None&&) noexcept = default;
62  None(const None&) = default;
63  None& operator=(const None&) = default;
64  ~None() override = default;
65 
66  explicit None(CkMigrateMessage* msg) noexcept;
67 
70 
71  auto get_clone() const noexcept -> std::unique_ptr<
73 
74  void pup(PUP::er& p) override;
75 };
76 
77 template <typename SystemBoundaryConditionBaseClass>
79  CkMigrateMessage* const msg) noexcept
80  : SystemBoundaryConditionBaseClass(msg) {}
81 
82 template <typename SystemBoundaryConditionBaseClass>
84 None<SystemBoundaryConditionBaseClass>::get_clone() const noexcept {
85  return std::make_unique<None>(*this);
86 }
87 
88 template <typename SystemBoundaryConditionBaseClass>
89 void None<SystemBoundaryConditionBaseClass>::pup(PUP::er& p) {
90  BoundaryCondition::pup(p);
91 }
92 
93 /// \cond
94 template <typename SystemBoundaryConditionBaseClass>
95 // NOLINTNEXTLINE
96 PUP::able::PUP_ID None<SystemBoundaryConditionBaseClass>::my_PUP_ID = 0;
97 /// \endcond
98 
99 /// Check if a boundary condition inherits from `MarkAsNone`, which
100 /// constitutes as it being marked as a none boundary condition.
101 bool is_none(
102  const std::unique_ptr<BoundaryCondition>& boundary_condition) noexcept;
103 } // namespace domain::BoundaryConditions
std::string
CharmPupable.hpp
domain::BoundaryConditions::BoundaryCondition
Base class from which all system-specific base classes must inherit.
Definition: BoundaryCondition.hpp:18
Options.hpp
WRAPPED_PUPable_decl_base_template
#define WRAPPED_PUPable_decl_base_template(baseClassName, className)
Mark derived template classes as serializable.
Definition: CharmPupable.hpp:32
domain::BoundaryConditions
Domain support for applying boundary conditions
Definition: BoundaryCondition.hpp:14
domain::BoundaryConditions::None
None boundary conditions.
Definition: None.hpp:50
memory
domain::BoundaryConditions::is_none
bool is_none(const std::unique_ptr< BoundaryCondition > &boundary_condition) noexcept
Check if a boundary condition inherits from MarkAsNone, which constitutes as it being marked as a non...
Definition: None.cpp:11
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
std::unique_ptr
TMPL.hpp