dune-fem 2.12-git
Loading...
Searching...
No Matches
cacheprovider.cc
Go to the documentation of this file.
1namespace Dune
2{
3 namespace Fem
4 {
5
6 template <class GridPart>
7 typename CacheProvider<GridPart, 1>::MapperIteratorType
8 CacheProvider<GridPart, 1>::createMapper(const QuadratureType& quad,
9 GeometryType elementGeometry,
11 MapperContainerType& mappers )
12 {
13 // make sure we work in single thread mode
14 if( ! Fem :: MPIManager :: singleThreadMode() )
15 {
16 DUNE_THROW(SingleThreadModeError, "CacheProvider::createMapper: only call in single thread mode!");
17 }
18
19 typedef TwistProvider<ct, dim-codim> TwistProviderType;
20 typedef typename TwistProviderType::TwistStorageType TwistStorageType;
21
22 const TwistStorageType& twistMappers =
23 TwistProviderType::getTwistStorage(quad);
24 const auto pointMappers =
25 PointProvider<ct, dim, codim>::getMappers(quad,
26 twistMappers.getPoints(),
27 elementGeometry);
28
29 const int numFaces = pointMappers.first.size();
30 const int maxTwist = twistMappers.maxTwist();
31 const int minTwist = twistMappers.minTwist();
32
33 QuadratureKeyType key ( elementGeometry, quad.id() );
34
35 MapperContainerType& mappers_ = mappers;
36
37 MapperIteratorType it = mappers_.insert
38 (std::make_pair( key,
39 CacheStorageType(numFaces, maxTwist))).first;
40
41 for (int face = 0; face < numFaces; ++face)
42 {
43 for (int twist = minTwist; twist < maxTwist; ++twist)
44 {
45 it->second.addMapper(pointMappers.first[face],
46 pointMappers.second[face],
47 twistMappers.getMapper(twist),
48 face, twist);
49 }
50 }
51
52 return it;
53 }
54
55
56
57 template <class GridPart>
58 typename CacheProvider<GridPart, 1>::MapperIteratorType
59 CacheProvider<GridPart, 1>::createMapper(const QuadratureType& quad,
60 GeometryType elementGeometry,
62 MapperContainerType& mappers )
63 {
64 // make sure we work in single thread mode
65 if( ! Fem :: MPIManager :: singleThreadMode() )
66 {
67 DUNE_THROW(SingleThreadModeError, "CacheProvider::createMapper: only call in single thread mode!");
68 }
69
70 const auto pointMappers =
71 PointProvider<ct, dim, codim>::getMappers(quad, elementGeometry);
72
73 const int numFaces = pointMappers.first.size();
74
75 QuadratureKeyType key ( elementGeometry, quad.id() );
76
77 MapperContainerType& mappers_ = mappers;
78
79 MapperIteratorType it
80 = mappers_.insert(std::make_pair(key, CacheStorageType(numFaces))).first;
81
82 for (int face = 0; face < numFaces; ++face)
83 it->second.addMapper(pointMappers.first[face],
84 pointMappers.second[face],
85 face);
86
87 return it;
88 }
89
90 } // namespace Fem
91
92} // namespace Dune
size_type dim() const
#define DUNE_THROW(E,...)
T make_pair(T... args)