|
|
|
Imagine you created a grid using the `Dumux::GridManager` class:
|
|
|
|
```c++
|
|
|
|
#include <iostream> // for command line output
|
|
|
|
#include <dune/grid/foamgrid.hh>
|
|
|
|
#include <dumux/io/grid/gridmanager.hh>
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
Dumux::GridManager<Dune::FoamGrid<1,3>> gridManager;
|
|
|
|
gridManager.init();
|
|
|
|
```
|
|
|
|
We can now obtain a grid view on all leaf elements (all elements are leaf elements on a non-refined grid).
|
|
|
|
```c++
|
|
|
|
const auto gridView = gridManager.grid().leafGridView();
|
|
|
|
```
|
|
|
|
Using the Dune grid interface, we can iterate over all elements of the grid and print the element's center position.
|
|
|
|
```c++
|
|
|
|
for (const auto& element : elements(gridView))
|
|
|
|
std::cout << element.geometry().center() << '\n';
|
|
|
|
``` |
|
|
|
\ No newline at end of file |