1 #ifndef DUNE_FEM_CACHEPROVIDER_HH 2 #define DUNE_FEM_CACHEPROVIDER_HH 8 #include <dune/common/math.hh> 9 #include <dune/common/version.hh> 24 template <
class ct,
int dim,
bool hasTwists>
32 template <
class ct,
int dim>
45 for (MapperIteratorType it = mappers_.begin();
46 it != mappers_.end(); ++it) {
47 it->resize(maxTwist + Traits::twistOffset_);
52 mappers_(other.mappers_)
56 const MapperType& twistMapper,
57 int faceIndex,
int faceTwist)
59 assert(twistMapper.size() == faceMapper.size());
62 mappers_[faceIndex][faceTwist + Traits::twistOffset_];
63 mapper.resize(twistMapper.size());
65 for (
size_t i = 0; i < mapper.size(); ++i) {
66 mapper[i] = faceMapper[twistMapper[i]];
71 const MapperType&
getMapper(
int faceIndex,
int faceTwist)
const 73 assert( faceTwist + Traits::twistOffset_ >= 0 );
74 return mappers_[faceIndex][faceTwist + Traits::twistOffset_];
78 typedef std::vector<std::vector<MapperType> > MapperContainerType;
79 typedef typename MapperContainerType::iterator MapperIteratorType;
82 MapperContainerType mappers_;
90 template <
class ct,
int dim>
101 : mappers_( numFaces )
105 : mappers_( other.mappers_ )
108 void addMapper (
const MapperType &mapper,
int faceIndex )
110 assert( (faceIndex >= 0) && (faceIndex < (
int)mappers_.size()) );
111 mappers_[ faceIndex ] = mapper;
114 const MapperType &
getMapper (
int faceIndex,
int faceTwist )
const 117 if( faceIndex >= (
int)mappers_.size() )
118 std::cerr <<
"Error: faceIndex = " << faceIndex <<
" >= " << mappers_.size() <<
" = mappers_.size()" << std::endl;
120 assert( (faceIndex >= 0) && (faceIndex < (
int)mappers_.size()) );
121 return mappers_[ faceIndex ];
125 typedef typename std::vector<MapperType> MapperContainerType;
128 MapperContainerType mappers_;
135 template<
class Gr
idPart,
int codim >
138 template <
class Gr
idPart>
143 enum { dim = GridPart::dimension };
144 typedef typename GridPart::ctype ct;
151 template <
class QuadratureImpl>
158 template <
class Gr
idPart>
162 enum { dim = GridPart::dimension };
163 typedef typename GridPart::ctype ct;
174 template <
class QuadratureImpl>
175 static const MapperType&
getMapper(
const QuadratureImpl& quadImpl,
176 GeometryType elementGeometry,
181 const QuadratureType& quad = quadImpl.ipList();
184 const QuadratureKeyType key (elementGeometry, quad.
id() );
186 MapperIteratorType it = mappers_.find( key );
188 if( it == mappers_.end() )
190 std::integral_constant< bool, hasTwists > i2t;
194 return it->second.getMapper(faceIndex, faceTwist);
201 typedef std::map<const QuadratureKeyType, CacheStorageType> MapperContainerType;
202 typedef typename MapperContainerType::iterator MapperIteratorType;
205 static MapperIteratorType
206 createMapper (
const QuadratureType &quad, GeometryType elementGeometry, std::integral_constant< bool, true > );
208 static MapperIteratorType
209 createMapper (
const QuadratureType &quad, GeometryType elementGeometry, std::integral_constant< bool, false > );
212 static MapperContainerType mappers_;
221 #endif // #ifndef DUNE_FEM_CACHEPROVIDER_HH CacheStorage(int numFaces, int maxTwist)
Definition: cacheprovider.hh:42
CacheStorage(const CacheStorage &other)
Definition: cacheprovider.hh:51
std::vector< size_t > MapperType
Definition: pointmapper.hh:58
const MapperType & getMapper(int faceIndex, int faceTwist) const
Definition: cacheprovider.hh:114
Traits::QuadratureType QuadratureType
Definition: cacheprovider.hh:169
Traits::QuadratureKeyType QuadratureKeyType
Definition: cacheprovider.hh:171
static const MapperType & getMapper(const QuadratureImpl &quadImpl, GeometryType elementGeometry, int faceIndex, int faceTwist)
Definition: cacheprovider.hh:175
CacheStorage(int numFaces)
Definition: cacheprovider.hh:100
const MapperType & getMapper(int faceIndex, int faceTwist) const
Definition: cacheprovider.hh:71
Definition: pointmapper.hh:52
Traits::MapperType MapperType
Definition: cacheprovider.hh:97
Traits::QuadratureType QuadratureType
Definition: cacheprovider.hh:148
Definition: pointmapper.hh:17
static void registerQuadrature(const QuadratureImpl &quad)
Definition: cacheprovider.hh:152
Traits::MapperType MapperType
Definition: cacheprovider.hh:39
Definition: coordinate.hh:4
Definition: cacheprovider.hh:136
size_t id() const
obtain the identifier of the integration point list
Definition: quadratureimp.hh:124
specialize with 'true' if the grid part is cartesian (default=false)
Definition: gridpart/common/capabilities.hh:39
CacheStorage(const CacheStorage &other)
Definition: cacheprovider.hh:104
Traits::MapperType MapperType
Definition: cacheprovider.hh:170
void addMapper(const MapperType &mapper, int faceIndex)
Definition: cacheprovider.hh:108
Storage class for mappers.
Definition: cacheprovider.hh:25
Definition: pointprovider.hh:21
std::vector< MapperType > MapperVectorType
Definition: pointmapper.hh:59
void addMapper(const MapperType &faceMapper, const MapperType &twistMapper, int faceIndex, int faceTwist)
Definition: cacheprovider.hh:55