1#ifndef DUNE_FEM_CACHEPROVIDER_HH
2#define DUNE_FEM_CACHEPROVIDER_HH
8#include <dune/common/math.hh>
24 template <
class ct,
int dim,
bool hasTwists>
32 template <
class ct,
int dim>
46 for (MapperIteratorType it = mappers_.begin();
47 it != mappers_.end(); ++it)
49 it->resize(maxTwist + Traits::twistOffset_);
54 mappers_(other.mappers_)
60 int faceIndex,
int faceTwist)
62 assert(twistMapper.size() == faceMapper.size());
65 mappers_[faceIndex][faceTwist + Traits::twistOffset_];
66 const size_t size = twistMapper.size();
67 mapper.first.resize( size );
68 for (
size_t i = 0; i < size; ++i)
70 mapper.first[i] = faceMapper[twistMapper[i]];
73 if( !interpolMapper.empty() )
75 assert(twistMapper.size() == interpolMapper.size());
76 mapper.second.resize( twistMapper.size() );
78 for (
size_t i = 0; i < size; ++i) {
79 mapper.second[i] = interpolMapper[twistMapper[i]];
86 assert( faceTwist + Traits::twistOffset_ >= 0 );
87 return mappers_[faceIndex][faceTwist + Traits::twistOffset_];
91 typedef std::vector< std::vector< MapperPairType > > MapperContainerType;
92 typedef typename MapperContainerType::iterator MapperIteratorType;
95 MapperContainerType mappers_;
103 template <
class ct,
int dim>
115 : mappers_( numFaces )
119 : mappers_( other.mappers_ )
126 assert( (faceIndex >= 0) && (faceIndex < (
int)mappers_.size()) );
127 mappers_[ faceIndex ].first = mapper;
128 if( !interpolMapper.empty() )
130 assert( interpolMapper.size() == mapper.size() );
131 mappers_[ faceIndex ].second = interpolMapper;
138 if( faceIndex >= (
int)mappers_.size() )
139 std::cerr <<
"Error: faceIndex = " << faceIndex <<
" >= " << mappers_.size() <<
" = mappers_.size()" << std::endl;
141 assert( (faceIndex >= 0) && (faceIndex < (
int)mappers_.size()) );
142 return mappers_[ faceIndex ];
146 typedef typename std::vector< MapperPairType > MapperContainerType;
149 MapperContainerType mappers_;
156 template<
class Gr
idPart,
int codim >
159 template <
class Gr
idPart>
163 static const int codim = 0;
164 static const int dim = GridPart::dimension;
165 typedef typename GridPart::ctype ct;
172 template <
class QuadratureImpl>
179 template <
class Gr
idPart>
184 static const int codim = 1;
185 static const int dim = GridPart::dimension;
186 typedef typename GridPart::ctype ct;
199 template <
class QuadratureImpl>
201 GeometryType elementGeometry,
211 MapperContainerType& mappers_ = mappers();
212 MapperIteratorType it = mappers_.find( key );
214 if( it == mappers_.end() )
216 std::integral_constant< bool, hasTwists > i2t;
220 return it->second.getMapper(faceIndex, faceTwist);
224 typedef CacheStorage< ct, dim-codim, hasTwists> CacheStorageType;
225 typedef typename Traits::MapperVectorType MapperVectorType;
227 typedef std::map<const QuadratureKeyType, CacheStorageType> MapperContainerType;
228 typedef typename MapperContainerType::iterator MapperIteratorType;
231 static MapperIteratorType
232 createMapper (
const QuadratureType &quad, GeometryType elementGeometry, std::integral_constant< bool, true > );
234 static MapperIteratorType
235 createMapper (
const QuadratureType &quad, GeometryType elementGeometry, std::integral_constant< bool, false > );
238 MapperContainerType mappers_;
241 static MapperContainerType& mappers()
243 return instance().mappers_;
246 static ThisType& instance()
Definition: bindguard.hh:11
specialize with 'true' if the grid part is cartesian (default=false)
Definition: gridpart/common/capabilities.hh:40
Storage class for mappers.
Definition: cacheprovider.hh:25
CacheStorage(const CacheStorage &other)
Definition: cacheprovider.hh:53
Traits::MapperType MapperType
Definition: cacheprovider.hh:39
CacheStorage(int numFaces, int maxTwist)
Definition: cacheprovider.hh:43
Traits::MapperPairType MapperPairType
Definition: cacheprovider.hh:40
void addMapper(const MapperType &faceMapper, const MapperType &interpolMapper, const MapperType &twistMapper, int faceIndex, int faceTwist)
Definition: cacheprovider.hh:57
const MapperPairType & getMapper(int faceIndex, int faceTwist) const
Definition: cacheprovider.hh:84
Traits::MapperType MapperType
Definition: cacheprovider.hh:110
Traits::MapperPairType MapperPairType
Definition: cacheprovider.hh:111
CacheStorage(const CacheStorage &other)
Definition: cacheprovider.hh:118
const MapperPairType & getMapper(int faceIndex, int faceTwist) const
Definition: cacheprovider.hh:135
CacheStorage(int numFaces)
Definition: cacheprovider.hh:114
void addMapper(const MapperType &mapper, const MapperType &interpolMapper, int faceIndex)
Definition: cacheprovider.hh:122
Definition: cacheprovider.hh:157
static void registerQuadrature(const QuadratureImpl &quad)
Definition: cacheprovider.hh:173
Traits::QuadratureType QuadratureType
Definition: cacheprovider.hh:169
Definition: cacheprovider.hh:181
std::pair< MapperType, MapperType > MapperPairType
Definition: cacheprovider.hh:196
static const MapperPairType & getMapper(const QuadratureImpl &quadImpl, GeometryType elementGeometry, int faceIndex, int faceTwist)
Definition: cacheprovider.hh:200
Traits::QuadratureType QuadratureType
Definition: cacheprovider.hh:192
Traits::QuadratureKeyType QuadratureKeyType
Definition: cacheprovider.hh:194
Traits::MapperType MapperType
Definition: cacheprovider.hh:193
Definition: pointmapper.hh:18
Definition: pointmapper.hh:52
std::pair< MapperType, MapperType > MapperPairType
Definition: pointmapper.hh:59
std::vector< size_t > MapperType
Definition: pointmapper.hh:58
Definition: pointprovider.hh:24
size_t id() const
obtain the identifier of the integration point list
Definition: quadratureimp.hh:122
static DUNE_EXPORT Object & instance(Args &&... args)
return singleton instance of given Object type.
Definition: singleton.hh:118