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 "ParallelAlgorithms/Amr/Criteria/Criterion.hpp" 12 : #include "ParallelAlgorithms/Amr/Criteria/Type.hpp" 13 : #include "Utilities/MakeArray.hpp" 14 : #include "Utilities/TMPL.hpp" 15 : 16 : namespace amr::Criteria { 17 : /*! 18 : * \brief Uniformly increases the number of grid points by one 19 : * 20 : * Useful to do uniform p-refinement, possibly alongside a nontrivial 21 : * h-refinement criterion. 22 : */ 23 : template <size_t Dim> 24 1 : class IncreaseResolution : public Criterion { 25 : public: 26 0 : using options = tmpl::list<>; 27 : 28 0 : static constexpr Options::String help = { 29 : "Uniformly increases the number of grid points by one."}; 30 : 31 0 : IncreaseResolution() = default; 32 : 33 : /// \cond 34 : explicit IncreaseResolution(CkMigrateMessage* msg); 35 : using PUP::able::register_constructor; 36 : WRAPPED_PUPable_decl_template(IncreaseResolution); // NOLINT 37 : /// \endcond 38 : 39 0 : Type type() override { return Type::p; } 40 : 41 0 : std::string observation_name() override { return "IncreaseResolution"; } 42 : 43 0 : using compute_tags_for_observation_box = tmpl::list<>; 44 0 : using argument_tags = tmpl::list<>; 45 : 46 : template <typename Metavariables> 47 0 : std::array<Flag, Dim> operator()( 48 : Parallel::GlobalCache<Metavariables>& /*cache*/, 49 : const ElementId<Dim>& /*element_id*/) const { 50 : return make_array<Dim>(Flag::IncreaseResolution); 51 : } 52 : }; 53 : 54 : /// \cond 55 : template <size_t Dim> 56 : PUP::able::PUP_ID IncreaseResolution<Dim>::my_PUP_ID = 0; // NOLINT 57 : /// \endcond 58 : 59 : } // namespace amr::Criteria