#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#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 (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-iterate-over-grid.cc:55
IteratorRange<... > vertices(const GV &gv)
Iterates over all vertices (entities with dimension 0) of a GridView.
IteratorRange<... > elements(const GV &gv)
Iterates over all elements / cells (entities with codimension 0) of a GridView.
IteratorRange<... > entities(const GV &gv, Codim< codim > cd)
Iterates over all entities of a GridView with the given codimension.
IteratorRange<... > facets(const GV &gv)
Iterates over all facets (entities with codimension 1) of a GridView.
IteratorRange<... > edges(const GV &gv)
Iterates over all edges (entities with dimension 1) of a GridView.
[ provides Dune::Grid ]
Definition: yaspgrid.hh:163