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