Dune Core Modules (2.4.1)

mapper.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GRID_COMMON_MAPPER_HH
4#define DUNE_GRID_COMMON_MAPPER_HH
5
6#include <iostream>
7
10
88namespace Dune
89{
107 template <typename G, typename MapperImp, typename IndexType=int>
108 class Mapper {
109 public:
110
112 typedef IndexType Index;
113
119 template<class EntityType>
120 Index DUNE_DEPRECATED_MSG("Will be removed after dune-grid-2.4. Use method 'index' instead!") map (const EntityType& e) const
121 {
122 CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e)));
123 return asImp().map(e);
124 }
125
126
132 template<class EntityType>
133 Index index (const EntityType& e) const
134 {
135 CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e)));
136 return asImp().index(e);
137 }
138
139
147 Index DUNE_DEPRECATED_MSG("Will be removed after dune-grid-2.4. Use method 'index' instead!") map (const typename G::Traits::template Codim<0>::Entity& e,
148 int i,
149 unsigned int codim) const
150 {
151 CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e,i,codim)));
152 return asImp().map(e,i,codim);
153 }
154
162 Index subIndex (const typename G::Traits::template Codim<0>::Entity& e,
163 int i,
164 unsigned int codim) const
165 {
166 CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e,i,codim)));
167 return asImp().subIndex(e,i,codim);
168 }
169
178 int size () const
179 {
180 CHECK_INTERFACE_IMPLEMENTATION((asImp().size()));
181 return asImp().size();
182 }
183
184
192 template<class EntityType>
193 bool contains (const EntityType& e, int& result) const
194 {
195 CHECK_INTERFACE_IMPLEMENTATION((asImp().contains(e,result )));
196 return asImp().contains(e,result );
197 }
198
199
209 bool contains (const typename G::Traits::template Codim<0>::Entity& e, int i, int cc, int& result) const
210 {
211 CHECK_INTERFACE_IMPLEMENTATION((asImp().contains(e,i,cc,result)))
212 return asImp().contains(e,i,cc,result);
213 }
214
217 void update ()
218 {
219 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().update()));
220 }
221
222 private:
224 MapperImp& asImp () {return static_cast<MapperImp &> (*this);}
226 const MapperImp& asImp () const {return static_cast<const MapperImp &>(*this);}
227 };
228
231#undef CHECK_INTERFACE_IMPLEMENTATION
232#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
233
234}
235#endif
Provides check for implementation of interface methods when using static polymorphism,...
#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)
Definition: bartonnackmanifcheck.hh:59
Wrapper class for entities.
Definition: entity.hh:62
Mapper interface.
Definition: mapper.hh:108
Index DUNE_DEPRECATED_MSG("Will be removed after dune-grid-2.4. Use method 'index' instead!") map(const EntityType &e) const
Map entity to array index.
Definition: mapper.hh:120
Index index(const EntityType &e) const
Map entity to array index.
Definition: mapper.hh:133
Index DUNE_DEPRECATED_MSG("Will be removed after dune-grid-2.4. Use method 'index' instead!") map(const typename G
Map subentity i of codim cc of a codim 0 entity to array index.
Definition: mapper.hh:147
IndexType Index
Number type used for indices.
Definition: mapper.hh:112
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
Dune namespace.
Definition: alignment.hh:10
Static tag representing a codimension.
Definition: dimension.hh:22
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)