12#ifndef DUMUX_ADAPTIVE_MARKELEMENTS_HH
13#define DUMUX_ADAPTIVE_MARKELEMENTS_HH
15#include <dune/grid/common/rangegenerators.hh>
27template<
class Gr
id,
class Indicator>
28bool markElements(Grid& grid,
const Indicator& indicator,
bool verbose =
true)
31 std::size_t refine = 0;
32 std::size_t coarsen = 0;
33 for (
const auto& element : elements(grid.leafGridView(), Dune::Partitions::interior))
35 const auto mark = indicator(element);
38 grid.mark(1, element);
43 grid.mark(-1, element);
49 const std::size_t sumRefine = grid.comm().sum(refine);
50 const std::size_t sumCoarsen = grid.comm().sum(coarsen);
52 if (grid.comm().rank() == 0 && verbose)
53 std::cout << sumRefine <<
" cells have been marked to be refined, "
54 << sumCoarsen <<
" to be coarsened." << std::endl;
57 return sumRefine != 0 || sumCoarsen != 0;
bool markElements(Grid &grid, const Indicator &indicator, bool verbose=true)
A function to mark element for refinement or coarsening.
Definition: markelements.hh:28