Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Service Desk
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
Timo Koch
dune-common
Commits
c6a5a8a3
Commit
c6a5a8a3
authored
19 years ago
by
Peter Bastian
Browse files
Options
Downloads
Patches
Plain Diff
The first mapper based on the new index sets
[[Imported from SVN: r2795]]
parent
6a1f88cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
grid/common/mapper.hh
+101
-0
101 additions, 0 deletions
grid/common/mapper.hh
with
101 additions
and
0 deletions
grid/common/mapper.hh
+
101
−
0
View file @
c6a5a8a3
...
...
@@ -6,7 +6,9 @@
#define __DUNE_MAPPER2_HH__
#include
<iostream>
#include
<dune/common/exceptions.hh>
#include
"dune/common/helpertemplates.hh"
/**
* @file
* @brief Mapper classes are used to attach data to a grid
...
...
@@ -32,7 +34,106 @@ namespace Dune
*
*/
/** @brief A mapper.
*
* In this implementation of a mapper the entity set used as domain for the map consists
* of the entities of a given codimension c for all entities in the given index set. The index
* set may only contain entities of a single geometry type, otherwise an exception is thrown. This
* version is usually not used directly but is used to implement versions for leafwise and levelwise
* entity sets.
*
* Template parameters are:
*
* \par G
* A Dune grid type.
* \par IS
* LeafIndexSet or LevelIndexSet type of the given grid.
* \par c
* A valid codimension.
*/
template
<
typename
G
,
typename
IS
,
int
c
>
class
SingleCodimSingleGeomTypeMapper
{
public:
/** @brief Construct mapper from grid and one fo its index sets.
\param grid A Dune grid object.
\param indexset IndexSet object returned by grid.
*/
SingleCodimSingleGeomTypeMapper
(
const
G
&
grid
,
const
IS
&
indexset
);
/** @brief Map entity to array index.
\param e Reference to codim cc entity, where cc is the template parameter of the function.
\return An index in the range 0 ... Max number of entities in set - 1.
*/
template
<
int
cc
>
// this is necessary for multiple codim mappers
int
map
(
const
typename
G
::
Traits
::
template
Codim
<
cc
>
::
Entity
&
e
)
const
;
/** @brief Map subentity of codim 0 entity to array index.
\param e Reference to codim 0 entity.
\param i Number of codim cc subentity of e, where cc is the template parameter of the function.
\return An index in the range 0 ... Max number of entities in set - 1.
*/
template
<
int
cc
>
// this is now the subentity's codim
int
submap
(
const
typename
G
::
Traits
::
template
Codim
<
0
>
::
Entity
&
e
,
int
i
)
const
;
/** @brief Return total number of entities in the entity set managed by the mapper.
This number can be used to allocate a vector of data elements associated with the
entities of the set. In the parallel case this number is per process (i.e. it
may be different in different processes).
\return Size of the entity set.
*/
int
size
()
const
;
private:
const
G
&
g
;
const
IS
&
is
;
};
template
<
typename
G
,
typename
IS
,
int
c
>
SingleCodimSingleGeomTypeMapper
<
G
,
IS
,
c
>::
SingleCodimSingleGeomTypeMapper
(
const
G
&
grid
,
const
IS
&
indexset
)
:
g
(
grid
),
is
(
indexset
)
{
// check that grid has only a single geometry type
if
(
is
.
geomtypes
().
size
()
!=
1
)
DUNE_THROW
(
GridError
,
"mapper treats only a single codim and a single geometry type"
);
}
template
<
typename
G
,
typename
IS
,
int
c
>
template
<
int
cc
>
int
SingleCodimSingleGeomTypeMapper
<
G
,
IS
,
c
>::
map
(
const
typename
G
::
Traits
::
template
Codim
<
cc
>
::
Entity
&
e
)
const
{
IsTrue
<
cc
==
c
>::
yes
();
return
is
.
template
index
<
cc
>(
e
);
}
template
<
typename
G
,
typename
IS
,
int
c
>
template
<
int
cc
>
int
SingleCodimSingleGeomTypeMapper
<
G
,
IS
,
c
>::
submap
(
const
typename
G
::
Traits
::
template
Codim
<
0
>
::
Entity
&
e
,
int
i
)
const
{
IsTrue
<
cc
==
c
>::
yes
();
return
is
.
template
subindex
<
cc
>(
e
,
i
);
}
template
<
typename
G
,
typename
IS
,
int
c
>
int
SingleCodimSingleGeomTypeMapper
<
G
,
IS
,
c
>::
size
()
const
{
return
is
.
size
(
c
,
is
.
geomtypes
()[
0
]);
}
template
<
typename
G
,
int
c
>
class
LeafSingleCodimSingleGeomTypeMapper
:
public
SingleCodimSingleGeomTypeMapper
<
G
,
typename
G
::
LeafIndexSet
,
c
>
{
public:
LeafSingleCodimSingleGeomTypeMapper
(
const
G
&
grid
)
:
SingleCodimSingleGeomTypeMapper
<
G
,
typename
G
::
LeafIndexSet
,
c
>
(
grid
,
grid
.
leafindexset
())
{}
};
/** @} */
}
...
...
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