BoundaryCondition.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <pup.h>
7 
8 #include "Domain/BoundaryConditions/BoundaryCondition.hpp"
9 #include "Domain/BoundaryConditions/None.hpp"
10 #include "Domain/BoundaryConditions/Periodic.hpp"
11 #include "Evolution/Systems/GeneralizedHarmonic/BoundaryConditions/BoundaryCondition.hpp"
12 #include "Evolution/Systems/GeneralizedHarmonic/BoundaryConditions/Factory.hpp"
13 #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/BoundaryCondition.hpp"
14 #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Factory.hpp"
15 #include "Utilities/TMPL.hpp"
16 
17 /// \brief Boundary conditions for the combined Generalized Harmonic and
18 /// Valencia GRMHD systems
20 /// \cond
21 template <typename DerivedGhCondition, typename DerivedValenciaCondition>
23 /// \endcond
24 
25 namespace detail {
26 template <typename DerivedGhCondition, typename DerivedValenciaCondition>
27 using ProductOfConditionsIfConsistent = tmpl::conditional_t<
28  DerivedGhCondition::bc_type == DerivedValenciaCondition::bc_type,
30  tmpl::list<>>;
31 
32 template <typename GhList, typename ValenciaList>
33 struct AllProductConditions;
34 
35 template <typename GhList, typename... ValenciaConditions>
36 struct AllProductConditions<GhList, tmpl::list<ValenciaConditions...>> {
37  using type = tmpl::flatten<tmpl::list<tmpl::transform<
38  GhList, tmpl::bind<ProductOfConditionsIfConsistent, tmpl::_1,
39  tmpl::pin<ValenciaConditions>>>...>>;
40 };
41 
42 template <typename ClassList>
43 struct remove_periodic_and_none_conditions {
44  using type = tmpl::remove_if<
45  ClassList,
46  tmpl::or_<
48  std::is_base_of<domain::BoundaryConditions::detail::MarkAsNone,
49  tmpl::_1>>>;
50 };
51 
52 template <typename ClassList>
53 using remove_periodic_and_none_conditions_t =
54  typename remove_periodic_and_none_conditions<ClassList>::type;
55 } // namespace detail
56 
57 /// \brief The base class for Generalized Harmonic and Valencia combined
58 /// boundary conditions; all boundary conditions for this system must inherit
59 /// from this base class.
61  public:
62  // remove the periodic and none BCs from the creatable classes of the
63  // individual systems; for the remaining conditions, include a
64  // `ProductOfConditions` for each pair with compatible `bc_type`s.
65  using creatable_classes = tmpl::push_back<
66  typename detail::AllProductConditions<
67  detail::remove_periodic_and_none_conditions_t<
68  typename GeneralizedHarmonic::BoundaryConditions::
69  BoundaryCondition<3_st>::creatable_classes>,
70  detail::remove_periodic_and_none_conditions_t<
71  typename grmhd::ValenciaDivClean::BoundaryConditions::
72  BoundaryCondition::creatable_classes>>::type,
74 
75  BoundaryCondition() = default;
76  BoundaryCondition(BoundaryCondition&&) noexcept = default;
77  BoundaryCondition& operator=(BoundaryCondition&&) noexcept = default;
78  BoundaryCondition(const BoundaryCondition&) = default;
79  BoundaryCondition& operator=(const BoundaryCondition&) = default;
80  ~BoundaryCondition() override = default;
81  explicit BoundaryCondition(CkMigrateMessage* msg) noexcept;
82 
83  void pup(PUP::er& p) override;
84 };
85 } // namespace grmhd::GhValenciaDivClean::BoundaryConditions
domain::BoundaryConditions::BoundaryCondition
Base class from which all system-specific base classes must inherit.
Definition: BoundaryCondition.hpp:18
domain::BoundaryConditions::Periodic
Periodic boundary conditions.
Definition: Periodic.hpp:47
grmhd::GhValenciaDivClean::BoundaryConditions::BoundaryCondition
The base class for Generalized Harmonic and Valencia combined boundary conditions; all boundary condi...
Definition: BoundaryCondition.hpp:60
domain::push_back
CoordinateMap< SourceFrame, TargetFrame, Maps..., NewMap > push_back(CoordinateMap< SourceFrame, TargetFrame, Maps... > old_map, NewMap new_map) noexcept
Creates a CoordinateMap by appending the new map to the end of the old maps.
grmhd::GhValenciaDivClean::BoundaryConditions::ProductOfConditions
Apply a boundary condition to the combined Generalized Harmonic (GH) and Valencia GRMHD system using ...
Definition: ProductOfConditions.hpp:316
grmhd::GhValenciaDivClean::BoundaryConditions
Boundary conditions for the combined Generalized Harmonic and Valencia GRMHD systems.
Definition: BoundaryCondition.hpp:19
TMPL.hpp
std::is_base_of