From: Wolfgang Bangerth Date: Thu, 26 Oct 2023 19:58:10 +0000 (-0600) Subject: Introduce RefinementCase::all_refinement_cases(). X-Git-Tag: relicensing~344^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e6730263b233d2ae757a43ebdf5cc22e061eabb;p=dealii.git Introduce RefinementCase::all_refinement_cases(). --- diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index 185a188fa0..211009c88b 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -789,6 +789,11 @@ template class RefinementCase : public RefinementPossibilities { public: + /** + * A variable indicating the number of possible refinement cases. + */ + static constexpr unsigned int n_refinement_cases = (1 << dim); + /** * Default constructor. Initialize the refinement case with no_refinement. */ @@ -854,6 +859,17 @@ public: static RefinementCase cut_axis(const unsigned int i); + /** + * Return an array that lists all possible refinement cases possible in + * the given space dimension. For example, for `dim==1`, it returns an + * array that only contains `{ RefinementCase<1>::no_refinement, + * RefinementCase<1>::cut_x }`. In `dim==2`, it returns + * `{ RefinementCase<1>::no_refinement, RefinementCase<2>::cut_x, + * RefinementCase<2>::cut_y, RefinementCase<2>::cut_xy }`. + */ + static std::array, n_refinement_cases> + all_refinement_cases(); + /** * Return the amount of memory occupied by an object of this type. */ @@ -888,6 +904,7 @@ private: }; + namespace internal { /** @@ -2774,6 +2791,44 @@ RefinementCase<3>::cut_axis(const unsigned int i) +template <> +inline std::array, 2> +RefinementCase<1>::all_refinement_cases() +{ + return {{RefinementPossibilities<1>::no_refinement, + RefinementPossibilities<1>::cut_x}}; +} + + + +template <> +inline std::array, 4> +RefinementCase<2>::all_refinement_cases() +{ + return {{RefinementPossibilities<2>::no_refinement, + RefinementPossibilities<2>::cut_x, + RefinementPossibilities<2>::cut_y, + RefinementPossibilities<2>::cut_xy}}; +} + + + +template <> +inline std::array, 8> +RefinementCase<3>::all_refinement_cases() +{ + return {{RefinementPossibilities<3>::no_refinement, + RefinementPossibilities<3>::cut_x, + RefinementPossibilities<3>::cut_y, + RefinementPossibilities<3>::cut_xy, + RefinementPossibilities<3>::cut_z, + RefinementPossibilities<3>::cut_xz, + RefinementPossibilities<3>::cut_yz, + RefinementPossibilities<3>::cut_xyz}}; +} + + + template inline RefinementCase::RefinementCase() : value(RefinementPossibilities::no_refinement)