Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sander, Oliver
dune-gfe
Commits
baf1f9fd
Commit
baf1f9fd
authored
4 years ago
by
Sander, Oliver
Browse files
Options
Downloads
Patches
Plain Diff
Implement GlobalP2Mapper for 1d grids
Otherwise the Cosserat rod code will not compile without dune-parmg.
parent
7d22b79b
Branches
Branches containing commit
No related tags found
1 merge request
!67
Modernize rod code
Pipeline
#5484
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gfe/parallel/globalp2mapper.hh
+75
-33
75 additions, 33 deletions
dune/gfe/parallel/globalp2mapper.hh
with
75 additions
and
33 deletions
dune/gfe/parallel/globalp2mapper.hh
+
75
−
33
View file @
baf1f9fd
...
@@ -26,54 +26,96 @@ namespace Dune {
...
@@ -26,54 +26,96 @@ namespace Dune {
p2Mapper_
(
gridView
)
p2Mapper_
(
gridView
)
{
{
#if !HAVE_DUNE_PARMG
#if !HAVE_DUNE_PARMG
static_assert
(
GridView
::
dimension
=
=
2
,
"Only implemented for two-dimensional grids"
);
static_assert
(
GridView
::
dimension
<
=
2
,
"Only implemented for
one- and
two-dimensional grids"
);
if
(
gridView
.
size
(
GeometryTypes
::
triangle
)
>
1
)
if
(
gridView
.
size
(
GeometryTypes
::
triangle
)
>
1
)
DUNE_THROW
(
NotImplemented
,
"GlobalP2Mapper only works for quad grids!"
);
DUNE_THROW
(
NotImplemented
,
"GlobalP2Mapper only works for quad grids!"
);
GlobalIndexSet
<
GridView
>
globalVertexIndex
(
gridView
,
2
);
GlobalIndexSet
<
GridView
>
globalVertexIndex
(
gridView
,
GridView
::
dimension
);
GlobalIndexSet
<
GridView
>
globalEdgeIndex
(
gridView
,
1
);
GlobalIndexSet
<
GridView
>
globalElementIndex
(
gridView
,
0
);
GlobalIndexSet
<
GridView
>
globalElementIndex
(
gridView
,
0
);
// total number of degrees of freedom
this
->
size_
=
globalVertexIndex
.
size
(
2
)
+
globalEdgeIndex
.
size
(
1
)
+
globalElementIndex
.
size
(
0
);
auto
localView
=
p2Mapper_
.
localView
();
auto
localView
=
p2Mapper_
.
localView
();
// Determine
if
(
GridView
::
dimension
==
1
)
for
(
const
auto
&
element
:
elements
(
gridView
))
{
{
localView
.
bind
(
element
);
// total number of degrees of freedom
this
->
size_
=
globalVertexIndex
.
size
(
GridView
::
dimension
)
+
globalElementIndex
.
size
(
0
);
//
Loop over all local degrees of freedom
//
Determine
for
(
size_t
i
=
0
;
i
<
localView
.
size
();
i
++
)
for
(
const
auto
&
element
:
elements
(
gridView
)
)
{
{
int
codim
=
localView
.
tree
().
finiteElement
().
localCoefficients
().
localKey
(
i
).
codim
();
localView
.
bind
(
element
);
int
entity
=
localView
.
tree
().
finiteElement
().
localCoefficients
().
localKey
(
i
).
subEntity
();
auto
localIndex
=
localView
.
index
(
i
);
// Loop over all local degrees of freedom
int
globalIndex
;
for
(
size_t
i
=
0
;
i
<
localView
.
size
();
i
++
)
switch
(
codim
)
{
{
case
2
:
// vertex dofs
int
codim
=
localView
.
tree
().
finiteElement
().
localCoefficients
().
localKey
(
i
).
codim
();
globalIndex
=
globalVertexIndex
.
index
(
element
.
template
subEntity
<
2
>(
entity
));
int
entity
=
localView
.
tree
().
finiteElement
().
localCoefficients
().
localKey
(
i
).
subEntity
();
break
;
auto
localIndex
=
localView
.
index
(
i
);
case
1
:
// edge dofs
int
globalIndex
;
globalIndex
=
globalEdgeIndex
.
index
(
element
.
template
subEntity
<
1
>(
entity
))
+
globalVertexIndex
.
size
(
2
);
switch
(
codim
)
break
;
{
case
1
:
// vertex dofs
case
0
:
// element dofs
globalIndex
=
globalVertexIndex
.
index
(
element
.
template
subEntity
<
1
>(
entity
));
globalIndex
=
globalElementIndex
.
index
(
element
.
template
subEntity
<
0
>(
entity
))
break
;
+
globalEdgeIndex
.
size
(
1
)
+
globalVertexIndex
.
size
(
2
);
case
0
:
// element dofs
break
;
globalIndex
=
globalElementIndex
.
index
(
element
.
template
subEntity
<
0
>(
entity
))
+
globalVertexIndex
.
size
(
2
);
default:
break
;
DUNE_THROW
(
Dune
::
Exception
,
"Impossible codimension!"
);
default:
DUNE_THROW
(
Dune
::
Exception
,
"Impossible codimension!"
);
}
localGlobalMap_
[
localIndex
]
=
globalIndex
;
}
}
}
}
else
{
GlobalIndexSet
<
GridView
>
globalEdgeIndex
(
gridView
,
1
);
localGlobalMap_
[
localIndex
]
=
globalIndex
;
// total number of degrees of freedom
this
->
size_
=
globalVertexIndex
.
size
(
2
)
+
globalEdgeIndex
.
size
(
1
)
+
globalElementIndex
.
size
(
0
);
// Determine
for
(
const
auto
&
element
:
elements
(
gridView
))
{
localView
.
bind
(
element
);
// Loop over all local degrees of freedom
for
(
size_t
i
=
0
;
i
<
localView
.
size
();
i
++
)
{
int
codim
=
localView
.
tree
().
finiteElement
().
localCoefficients
().
localKey
(
i
).
codim
();
int
entity
=
localView
.
tree
().
finiteElement
().
localCoefficients
().
localKey
(
i
).
subEntity
();
auto
localIndex
=
localView
.
index
(
i
);
int
globalIndex
;
switch
(
codim
)
{
case
2
:
// vertex dofs
globalIndex
=
globalVertexIndex
.
index
(
element
.
template
subEntity
<
GridView
::
dimension
>(
entity
));
break
;
case
1
:
// edge dofs
globalIndex
=
globalEdgeIndex
.
index
(
element
.
template
subEntity
<
1
>(
entity
))
+
globalVertexIndex
.
size
(
2
);
break
;
case
0
:
// element dofs
globalIndex
=
globalElementIndex
.
index
(
element
.
template
subEntity
<
0
>(
entity
))
+
globalEdgeIndex
.
size
(
1
)
+
globalVertexIndex
.
size
(
2
);
break
;
default:
DUNE_THROW
(
Dune
::
Exception
,
"Impossible codimension!"
);
}
localGlobalMap_
[
localIndex
]
=
globalIndex
;
}
}
}
}
}
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment