22#ifndef KASKADE_FOREACH_HH_
23#define KASKADE_FOREACH_HH_
32 template <
class Gr
idView,
class Functor>
35 for(
auto const& element : elements(gridView)) {
41 template <
class Gr
idView,
class Functor>
44 for(
auto const& vertex : vertices(gridView)) {
51 template <
class Gr
idView,
class Functor>
54 for(
auto const& element : elements(gridView)) {
55 for(
auto const& intersection : intersections(gridView,element)) {
56 functor(intersection);
62 template <
class Gr
idView,
class Functor>
65 for(
auto const& element : elements(gridView)) {
66 for(
auto const& intersection : intersections(gridView,element)) {
67 functor(element, intersection);
87 template <
class Gr
idView,
class Functor>
90 for(
auto const& element : elements(gridView))
91 if(element.hasBoundaryIntersections())
92 for(
auto const& intersection : intersections(gridView,element))
93 if(intersection.boundary())
94 functor(intersection);
98 template <
class Gr
idView,
class Functor>
101 forEachFace(gridView, [&](
typename GridView::Intersection
const& face)
103 if(!face.boundary()) functor(face);
109 template <
class Gr
idView,
class Functor>
112 for(
auto const& element : elements(gridView)) {
114 for(
auto const& intersection : intersections(gridView,element)) {
115 functor(intersection);
120 template <
class Gr
idManager,
class Functor>
123 forEachCell(gridManager.
grid().leafGridView(), [&](
typename GridManager::Grid::LeafGridView::template Codim<0>::Entity
const& cell)
126 size_t marked = 0, notMarked = 0;
130 mark = mark || functor(cell);
131 std::for_each(gridManager.grid().leafGridView().ibegin(cell), gridManager.grid().leafGridView().iend(cell), [&](typename GridManager::Grid::LeafGridView::Intersection const& face)
133 mark = mark || functor(face);
135 if(mark) gridManager.
mark(1,cell);
140 std::cout <<
"Marked " << marked <<
" cells of " << (marked+notMarked) <<
" cells." << std::endl;
Grid const & grid() const
Returns a const reference on the owned grid.
bool mark(int refCount, typename Grid::template Codim< 0 >::Entity const &cell)
Marks the given cell for refinement or coarsening.
Class that takes care of the transfer of data (of each FunctionSpaceElement) after modification of th...
void forEachBoundaryFace(GridView const &gridView, Functor functor)
iterates over each boundary face and applies functor to face. Each boundary face is visited exactly o...
void forEachCell(GridView const &gridView, Functor functor)
DEPRECATED: use range based for loops and Dune::elements() directly. iterates over each cell and appl...
void forEachCellAndEachFace(GridView const &gridView, Functor functor)
iterates over each cell and applies functor to cell and then iterates over each face of cell and appl...
void forEachVertex(GridView const &gridView, Functor functor)
DEPRECATED: use range based for loops and Dune::vertices() directly. iterates over each vertex and ap...
void forEachFace(GridView const &gridView, Functor functor)
void forEachFaceOfCell(GridView const &gridView, Functor functor)
same as forEachFace, but the functor is applied to the face and the cell from which the face is visit...
void markCells(GridManager &gridManager, Functor functor)
void forEachInnerFace(GridView const &gridView, Functor functor)
iterates over each inner face and applies functor to face. Each inner face is visited exactly twice (...