dune-fem 2.12-git
Loading...
Searching...
No Matches
pointprovider.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_POINTPROVIDER_HH
2#define DUNE_FEM_POINTPROVIDER_HH
3
4//- System includes
5#include <vector>
6#include <map>
7#include <unordered_map>
8
9//- Dune includes
10#include <dune/common/math.hh>
11
13
14//- Local includes
15#include "pointmapper.hh"
16
17namespace Dune
18{
19
20 namespace Fem
21 {
22
23 template< class ct, int dim, int codim >
25 {
26 static_assert( (codim >= 0) && (codim <= 1),
27 "PointProvider exists only for codimension 0 and 1." );
28 };
29
30 template <class ct, int dim>
31 class PointProvider<ct, dim, 0>
32 {
34
36
37 public:
41
42 public:
43 inline
44 static void registerQuadrature(const QuadratureType& quad)
45 {
46 instance().registerQuadratureImpl( quad );
47 }
48
49 inline
50 static const GlobalPointVectorType& getPoints(const size_t id,
51 const GeometryType& elementGeo)
52 {
53 return instance().getPointsImpl( id, elementGeo );
54 }
55
56 PointProvider() : threadPool_( MPIManager::threadPool() ), points_() {}
57
58 private:
59 PointProvider( const PointProvider& ) = delete;
60
61 inline void registerQuadratureImpl(const QuadratureType& quad);
62
63 inline const GlobalPointVectorType& getPointsImpl(const size_t id,
64 const GeometryType& elementGeo);
65
67 typedef typename PointContainerType::iterator PointIteratorType;
68
69 // points container holding quadrature points
70 const typename MPIManager::ThreadPoolType& threadPool_;
71 PointContainerType points_;
72
73 static ThisType& instance()
74 {
76 }
77 };
78
79 // * Add elemGeo later
80 template <class ct, int dim>
81 class PointProvider<ct, dim, 1>
82 {
84
85 enum { codim = 1 };
86 typedef CachingTraits<ct, dim-codim> Traits;
87
88 public:
98
99 private:
102
103 typedef typename PointContainerType::iterator PointIteratorType;
104 typedef typename MapperContainerType::iterator MapperIteratorType;
105
106 public:
107 inline
109 const GeometryType& elementGeo)
110 {
111 return instance().getMappersImpl( quad, elementGeo );
112 }
113
114 // Access for non-symmetric quadratures
115 inline
117 const LocalPointVectorType& pts,
118 const GeometryType& elementGeo)
119 {
120 return instance().getMappersImpl( quad, pts, elementGeo );
121 }
122
123 inline
124 static const GlobalPointVectorType& getPoints(const size_t id,
125 const GeometryType& elementGeo)
126 {
127 return instance().getPointsImpl( id, elementGeo );
128 }
129
130 inline
131 const GlobalPointVectorType& getPointsImpl(const size_t id,
132 const GeometryType& elementGeo);
133
134 inline const MapperVectorPairType& getMappersImpl(const QuadratureType& quad,
135 const GeometryType&
136 elementGeo);
137
138 inline
139 const MapperVectorPairType& getMappersImpl(const QuadratureType& quad,
140 const LocalPointVectorType& pts,
141 const GeometryType& elementGeo);
142
143 private:
144 inline
145 static MapperIteratorType addEntry(const QuadratureType& quad,
146 const LocalPointVectorType& pts,
147 GeometryType elementGeo)
148 {
149 instance().addEntryImpl(quad, pts, elementGeo);
150 }
151
152 inline
153 MapperIteratorType addEntryImpl(const QuadratureType& quad,
154 const LocalPointVectorType& pts,
155 GeometryType elementGeo);
156
157 private:
158 const typename MPIManager::ThreadPoolType& threadPool_;
159 // points container holding quadrature points
160 PointContainerType points_;
161 // mapper container holding mapping info
162 MapperContainerType mappers_;
163
164 PointProvider( const PointProvider& ) = delete;
165 public:
166 // this should only be called from the Singleton class
167 PointProvider() : threadPool_( MPIManager::threadPool() ), points_(), mappers_() {}
168
170 {
172 }
173 };
174
175 } // namespace Fem
176
177} // namespace Dune
178
179#include "pointprovider.cc"
180
181#endif // #ifndef DUNE_FEM_POINTPROVIDER_HH
size_type dim() const
Definition mpimanager.hh:353
detail::ThreadPool ThreadPoolType
Definition mpimanager.hh:357
Definition pointmapper.hh:19
Definition pointmapper.hh:65
QuadratureType::CoordinateType PointType
extracted types from integration point list
Definition pointmapper.hh:69
Definition pointprovider.hh:25
Definition pointprovider.hh:32
Traits::PointVectorType GlobalPointVectorType
Definition pointprovider.hh:39
Traits::QuadratureType QuadratureType
Definition pointprovider.hh:38
static void registerQuadrature(const QuadratureType &quad)
Definition pointprovider.hh:44
Traits::QuadratureKeyType QuadratureKeyType
Definition pointprovider.hh:40
static const GlobalPointVectorType & getPoints(const size_t id, const GeometryType &elementGeo)
Definition pointprovider.hh:50
PointProvider()
Definition pointprovider.hh:56
Definition pointprovider.hh:82
std::pair< MapperVectorType, MapperVectorType > MapperVectorPairType
Definition pointprovider.hh:97
static ThisType & instance()
Definition pointprovider.hh:169
static const MapperVectorPairType & getMappers(const QuadratureType &quad, const LocalPointVectorType &pts, const GeometryType &elementGeo)
Definition pointprovider.hh:116
FieldVector< ct, dim > GlobalPointType
Definition pointprovider.hh:94
Traits::QuadratureKeyType QuadratureKeyType
Definition pointprovider.hh:96
Traits::PointType LocalPointType
Definition pointprovider.hh:90
static const GlobalPointVectorType & getPoints(const size_t id, const GeometryType &elementGeo)
Definition pointprovider.hh:124
Traits::QuadratureType QuadratureType
Definition pointprovider.hh:89
static const MapperVectorPairType & getMappers(const QuadratureType &quad, const GeometryType &elementGeo)
Definition pointprovider.hh:108
Traits::MapperType MapperType
Definition pointprovider.hh:92
Traits::PointVectorType LocalPointVectorType
Definition pointprovider.hh:91
PointProvider()
Definition pointprovider.hh:167
Traits::MapperVectorType MapperVectorType
Definition pointprovider.hh:93
std::vector< GlobalPointType > GlobalPointVectorType
Definition pointprovider.hh:95
return singleton instance of given Object type.
Definition singleton.hh:93