See explanation at Iterating over a grid
#include<math.h>
#include<iostream>
#include<dune/common/parallel/mpihelper.hh>
#include<dune/common/parametertreeparser.hh>
#include<dune/common/timer.hh>
int main(
int argc,
char** argv)
{
[[maybe_unused]] Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv);
const int dim = 4;
Dune::FieldVector<double,dim> len; for (auto& l : len) l=1.0;
std::array<int,dim> cells; for (auto& c : cells) c=4;
Grid grid(len,cells);
auto gv = grid.leafGridView();
const int codim = 2;
for (const auto& e : entities(gv,Dune::Codim<codim>{}))
if (!e.type().isCube()) std::cout << "not a cube" << std::endl;
for ([[maybe_unused]] const auto& e : elements(gv))
;
for ([[maybe_unused]] const auto& e : vertices(gv))
;
for ([[maybe_unused]] const auto& e : edges(gv))
;
for ([[maybe_unused]] const auto& e : facets(gv))
;
const int mycodim = 2;
for (const auto& e : elements(gv))
for (unsigned int i=0; i<e.subEntities(mycodim); ++i)
[[maybe_unused]] auto v = e.template subEntity<codim>(i);
}
int main(int argc, char **argv)
Definition recipe-integration.cc:65
[ provides Dune::Grid ]
Definition yaspgrid.hh:166