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