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
4853ca19
Commit
4853ca19
authored
10 years ago
by
Oliver Sander
Committed by
sander
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
A mapper class for a global p1 space
[[Imported from SVN: r9932]]
parent
94bc14bc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gfe/parallel/globalp1mapper.hh
+98
-0
98 additions, 0 deletions
dune/gfe/parallel/globalp1mapper.hh
with
98 additions
and
0 deletions
dune/gfe/parallel/globalp1mapper.hh
0 → 100644
+
98
−
0
View file @
4853ca19
#ifndef DUNE_GFE_PARALLEL_GLOBALP1MAPPER_HH
#define DUNE_GFE_PARALLEL_GLOBALP1MAPPER_HH
/** \brief Include standard header files. */
#include
<vector>
#include
<iostream>
#include
<map>
#include
<utility>
/** include base class functionality for the communication interface */
#include
<dune/grid/common/datahandleif.hh>
#include
<dune/grid/common/mcmgmapper.hh>
// Include Dune header files
#include
<dune/common/version.hh>
/** include parallel capability */
#if HAVE_MPI
#include
<dune/common/parallel/mpihelper.hh>
#endif
namespace
Dune
{
template
<
class
GridView
>
class
GlobalP1Mapper
{
typedef
MultipleCodimMultipleGeomTypeMapper
<
GridView
,
MCMGVertexLayout
>
P1BasisMapper
;
public:
/** \brief The integer number type used for indices */
typedef
typename
GridView
::
IndexSet
::
IndexType
Index
;
typedef
std
::
map
<
Index
,
Index
>
IndexMap
;
GlobalP1Mapper
(
const
GridView
&
gridView
)
:
p1Mapper_
(
gridView
)
{
const
int
dim
=
GridView
::
dimension
;
GlobalIndexSet
<
GridView
>
globalVertexIndexSet
(
gridView
,
dim
);
// total number of degrees of freedom
nGlobalEntity_
=
globalVertexIndexSet
.
size
(
dim
);
// Determine
for
(
auto
it
=
gridView
.
template
begin
<
0
>();
it
!=
gridView
.
template
end
<
0
>();
++
it
)
{
// Loop over all vertices
#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
for
(
size_t
i
=
0
;
i
<
it
->
subEntities
(
dim
);
i
++
)
#else
for
(
size_t
i
=
0
;
i
<
it
->
template
count
<
dim
>();
i
++
)
#endif
{
int
localIndex
=
p1Mapper_
.
map
(
*
it
,
i
,
dim
);
int
globalIndex
=
globalVertexIndexSet
.
subIndex
(
*
it
,
i
,
dim
);
localGlobalMap_
[
localIndex
]
=
globalIndex
;
globalLocalMap_
[
globalIndex
]
=
localIndex
;
}
}
}
/** \brief Given a local index, retrieve its index globally unique over all processes. */
Index
index
(
const
int
&
localIndex
)
const
{
return
localGlobalMap_
.
find
(
localIndex
)
->
second
;
}
template
<
class
Entity
>
Index
subIndex
(
const
Entity
&
entity
,
uint
i
,
uint
codim
)
const
{
int
localIndex
=
p1Mapper_
.
map
(
entity
,
i
,
codim
);
return
localGlobalMap_
.
find
(
localIndex
)
->
second
;
}
Index
localIndex
(
const
int
&
globalIndex
)
const
{
return
globalLocalMap_
.
find
(
globalIndex
)
->
second
;
}
unsigned
int
nGlobalEntity
()
const
{
return
nGlobalEntity_
;
}
P1BasisMapper
p1Mapper_
;
IndexMap
localGlobalMap_
;
IndexMap
globalLocalMap_
;
size_t
nGlobalEntity_
;
};
}
#endif
/* GLOBALUNIQUEINDEX_HH_ */
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