24#ifndef DUMUX_ADAPTIVE_MARKELEMENTS_HH
25#define DUMUX_ADAPTIVE_MARKELEMENTS_HH
27#include <dune/grid/common/rangegenerators.hh>
39template<
class Gr
id,
class Indicator>
40bool markElements(Grid& grid,
const Indicator& indicator,
bool verbose =
true)
43 std::size_t refine = 0;
44 std::size_t coarsen = 0;
45 for (
const auto& element : elements(grid.leafGridView(), Dune::Partitions::interior))
47 const auto mark = indicator(element);
50 grid.mark(1, element);
55 grid.mark(-1, element);
61 const std::size_t sumRefine = grid.comm().sum(refine);
62 const std::size_t sumCoarsen = grid.comm().sum(coarsen);
64 if (grid.comm().rank() == 0 && verbose)
65 std::cout << sumRefine <<
" cells have been marked to be refined, "
66 << sumCoarsen <<
" to be coarsened." << std::endl;
69 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:40
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29