Dune Core Modules (2.8.0)
recipe-iterate-over-grid.cc
See explanation at Iterating over a grid
// always include the config file
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
// C++ includes
#include<math.h>
#include<iostream>
// dune-common includes
#include<dune/common/parallel/mpihelper.hh>
#include<dune/common/parametertreeparser.hh>
#include<dune/common/timer.hh>
// dune-grid includes
#include <dune/grid/yaspgrid.hh>
int main(int argc, char** argv)
{
// Maybe initialize Mpi
[[maybe_unused]] Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv);
// [set up grid]
const int dim = 4;
std::array<int,dim> cells; for (auto& c : cells) c=4;
Grid grid(len,cells);
// [extract gridview]
auto gv = grid.leafGridView();
// [iterate over codim]
const int codim = 2;
if (!e.type().isCube()) std::cout << "not a cube" << std::endl;
// [iterate over grid view]
// [access to subentities]
const int mycodim = 2;
for (unsigned int i=0; i<e.subEntities(mycodim); ++i)
[[maybe_unused]] auto v = e.template subEntity<codim>(i);
}
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.
Helpers for dealing with MPI.
Various parser methods to get data into a ParameterTree object.
A simple timing class.
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Nov 12, 23:30, 2024)