Commit d8b987ef authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Update README.md

parent 0f98530c
......@@ -34,25 +34,26 @@ DecGrid<GridBase> grid(*gridBase);
This grid adapter provides iterators for incidence relations, like edges of a vertex or faces of an edge.
Example: Iterate over all edges of the grid and store the coefficients of a Grad-Div laplacian
Example: Iterate over all edges of the grid (grid-view) and store the coefficients of a Grad-Div laplacian
in a sparse matrix:
```c++
DOFMatrix<double> A(grid.size(1), grid.size(1)); // sparse matrix with num_rows=#edges
auto gv = grid.leafGridView();
DOFMatrix<double> A(gv.size(1), gv.size(1)); // sparse matrix with num_rows=#edges
auto const& I = grid.indexSet();
auto const& I = gv.indexSet();
{ auto ins = A.inserter();
// iterator over all edges in the grid
for (auto const& e : edges(grid.gridView())) {
for (auto const& e : edges(gv)) {
// iterate over all vertices incident to edge e
for (auto const& v : vertices(e)) {
auto factor1 = v.sign(e) * grid.dual_volume(v);
auto factor1 = v.sign(e) * gv.dual_volume(v);
// iterate over all edges incident to vertex v
for (auto const& e_ : edges(v)) {
auto factor2 = v.sign(e_) * grid.dual_volume(e_) / grid.volume(e_);
auto factor2 = v.sign(e_) * gv.dual_volume(e_) / gv.volume(e_);
ins(I.index(e), I.index(e_)) << factor1 * factor2;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment