Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Praetorius, Simon
dune-dec
Commits
d8b987ef
Commit
d8b987ef
authored
Apr 21, 2017
by
Praetorius, Simon
Browse files
Update README.md
parent
0f98530c
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d8b987ef
...
...
@@ -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
=
g
rid
.
indexSet
();
auto
const
&
I
=
g
v
.
indexSet
();
{
auto
ins
=
A
.
inserter
();
// iterator over all edges in the grid
for
(
auto
const
&
e
:
edges
(
g
rid
.
gridView
()
))
{
for
(
auto
const
&
e
:
edges
(
g
v
))
{
// iterate over all vertices incident to edge e
for
(
auto
const
&
v
:
vertices
(
e
))
{
auto
factor1
=
v
.
sign
(
e
)
*
g
rid
.
dual_volume
(
v
);
auto
factor1
=
v
.
sign
(
e
)
*
g
v
.
dual_volume
(
v
);
// iterate over all edges incident to vertex v
for
(
auto
const
&
e_
:
edges
(
v
))
{
auto
factor2
=
v
.
sign
(
e_
)
*
g
rid
.
dual_volume
(
e_
)
/
g
rid
.
volume
(
e_
);
auto
factor2
=
v
.
sign
(
e_
)
*
g
v
.
dual_volume
(
e_
)
/
g
v
.
volume
(
e_
);
ins
(
I
.
index
(
e
),
I
.
index
(
e_
))
<<
factor1
*
factor2
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment