1#ifndef DUNE_COPASI_GRID_MARK_STRIPES_HH
2#define DUNE_COPASI_GRID_MARK_STRIPES_HH
4#include <dune-copasi-config.hh>
6#include <dune/grid/uggrid.hh>
28 using RuleType =
typename UG_NS<dim>::RefinementRule;
30 auto grid_view = grid.leafGridView();
31 std::list<int> non_cube_side;
34 for (
auto&& entity : Dune::elements(grid_view))
36 if (entity.type().isCube())
39 non_cube_side.clear();
40 for (
auto&& ig : Dune::intersections(grid_view,entity))
42 if (not ig.outside().type().isCube())
43 non_cube_side.push_back(ig.indexInInside());
45 bool is_stripe =
false;
48 if (non_cube_side.size() == 2)
49 is_stripe = !(non_cube_side.front()/2 - non_cube_side.back()/2);
54 [[maybe_unused]]
int orientation = *(non_cube_side.begin())/2;
56 if constexpr (dim == 2)
59 grid.mark(entity,RuleType::BLUE,!(
bool)orientation);
61 else if constexpr (dim == 3)
63 DUNE_THROW(NotImplemented,
"\tStripes on 3D is not available yet!");
74 DUNE_THROW(NotImplemented,
75 "\tStripe refinement not known for grids of dimension '"
Definition: axis_names.hh:7
void mark_stripes(UGGrid< dim > &grid, bool mark_others=true)
Mark stripes for refinement.
Definition: mark_stripes.hh:26