dune-grid
2.11
Toggle main menu visibility
Loading...
Searching...
No Matches
dune
grid
common
mapper.hh
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4
// vi: set et ts=4 sw=2 sts=2:
5
#ifndef DUNE_GRID_COMMON_MAPPER_HH
6
#define DUNE_GRID_COMMON_MAPPER_HH
7
8
#include <utility>
9
10
#include <dune/common/bartonnackmanifcheck.hh>
11
17
87
88
89
namespace
Dune
90
{
96
97
108
template
<
typename
G,
typename
MapperImp,
typename
IndexType=
int
>
109
class
Mapper
110
{
111
public
:
112
114
using
Index
= IndexType;
115
121
template
<
class
EntityType>
122
Index
index
(
const
EntityType& e)
const
123
{
124
CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e)));
125
return
asImp().index(e);
126
}
127
128
136
Index
subIndex
(
const
typename
G::Traits::template Codim<0>::Entity& e,
137
int
i,
138
unsigned
int
codim)
const
139
{
140
CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e,i,codim)));
141
return
asImp().subIndex(e,i,codim);
142
}
143
152
auto
size
()
const
153
{
154
CHECK_INTERFACE_IMPLEMENTATION((asImp().
size
()));
155
return
asImp().size();
156
}
157
158
166
template
<
class
EntityType>
167
bool
contains
(
const
EntityType& e, IndexType& result)
const
168
{
169
CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains
(e,result )));
170
return
asImp().contains(e,result );
171
}
172
173
183
bool
contains
(
const
typename
G::Traits::template Codim<0>::Entity& e,
int
i,
int
cc, IndexType& result)
const
184
{
185
CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains
(e,i,cc,result)))
186
return
asImp().contains(e,i,cc,result);
187
}
188
191
template
<
class
Gr
id
View>
192
void
update
(
GridView
&& gridView)
193
{
194
CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().
update
(std::forward<GridView>(gridView))));
195
}
196
197
private
:
199
MapperImp& asImp () {
return
static_cast<
MapperImp &
>
(*this);}
201
const
MapperImp& asImp ()
const
{
return
static_cast<
const
MapperImp &
>
(*this);}
202
};
203
205
206
#undef CHECK_INTERFACE_IMPLEMENTATION
207
#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
208
209
}
210
#endif
Dune
Include standard header files.
Definition
agrid.hh:60
Dune::GridView
Grid view abstract base class.
Definition
common/gridview.hh:66
Dune::Mapper
Mapper interface.
Definition
mapper.hh:110
Dune::Mapper::size
auto size() const
Return total number of entities in the entity set managed by the mapper.
Definition
mapper.hh:152
Dune::Mapper::update
void update(GridView &&gridView)
Reinitialize mapper after grid has been modified.
Definition
mapper.hh:192
Dune::Mapper::index
Index index(const EntityType &e) const
Map entity to array index.
Definition
mapper.hh:122
Dune::Mapper::Index
IndexType Index
Number type used for indices.
Definition
mapper.hh:114
Dune::Mapper::subIndex
Index subIndex(const typename G::Traits::template Codim< 0 >::Entity &e, int i, unsigned int codim) const
Map subentity i of codim cc of a codim 0 entity to array index.
Definition
mapper.hh:136
Dune::Mapper::contains
bool contains(const typename G::Traits::template Codim< 0 >::Entity &e, int i, int cc, IndexType &result) const
Returns true if the subentity is contained in the index set and at the same time the array index is r...
Definition
mapper.hh:183
Dune::Mapper::contains
bool contains(const EntityType &e, IndexType &result) const
Returns true if the entity is contained in the index set and at the same time the array index is retu...
Definition
mapper.hh:167
Generated by
1.17.0