Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <cstddef>
8 : #include <pup.h>
9 :
10 : #include "Domain/Amr/Flag.hpp"
11 : #include "Domain/Creators/Tags/Domain.hpp"
12 : #include "Domain/Domain.hpp"
13 : #include "Domain/Structure/ElementId.hpp"
14 : #include "Domain/Tags.hpp"
15 : #include "Elliptic/Tags.hpp"
16 : #include "Options/String.hpp"
17 : #include "Parallel/GlobalCache.hpp"
18 : #include "ParallelAlgorithms/Amr/Criteria/Criterion.hpp"
19 : #include "ParallelAlgorithms/Amr/Criteria/Type.hpp"
20 : #include "PointwiseFunctions/InitialDataUtilities/Background.hpp"
21 : #include "Utilities/Serialization/CharmPupable.hpp"
22 : #include "Utilities/TMPL.hpp"
23 :
24 0 : namespace Punctures::AmrCriteria {
25 :
26 : /*!
27 : * \brief h-refine (split) elements containing a puncture
28 : *
29 : * This refinement scheme is expected to yield exponential convergence, despite
30 : * the presence of the C^2 punctures.
31 : */
32 1 : class RefineAtPunctures : public amr::Criterion {
33 : public:
34 0 : using options = tmpl::list<>;
35 :
36 0 : static constexpr Options::String help = {
37 : "h-refine (split) elements containing a puncture."};
38 :
39 0 : RefineAtPunctures() = default;
40 :
41 : /// \cond
42 : explicit RefineAtPunctures(CkMigrateMessage* msg) : Criterion(msg) {}
43 : using PUP::able::register_constructor;
44 : WRAPPED_PUPable_decl_template(RefineAtPunctures); // NOLINT
45 : /// \endcond
46 :
47 0 : amr::Criteria::Type type() override { return amr::Criteria::Type::h; }
48 :
49 0 : std::string observation_name() override { return "RefineAtPunctures"; }
50 :
51 0 : using argument_tags = tmpl::list<
52 : elliptic::Tags::Background<elliptic::analytic_data::Background>,
53 : domain::Tags::Domain<3>>;
54 0 : using compute_tags_for_observation_box = tmpl::list<>;
55 :
56 : template <typename Metavariables>
57 0 : std::array<amr::Flag, 3> operator()(
58 : const elliptic::analytic_data::Background& background,
59 : const Domain<3>& domain, Parallel::GlobalCache<Metavariables>& /*cache*/,
60 : const ElementId<3>& element_id) const {
61 : return impl(background, domain, element_id);
62 : }
63 :
64 : private:
65 0 : static std::array<amr::Flag, 3> impl(
66 : const elliptic::analytic_data::Background& background,
67 : const Domain<3>& domain, const ElementId<3>& element_id);
68 : };
69 :
70 : } // namespace Punctures::AmrCriteria
|