DUNE-FEM (unstable)

pointprovider.hh
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
12#include <dune/fem/storage/singleton.hh>
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 >
24 class PointProvider
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 {
33 typedef PointProvider<ct, dim, 0> ThisType;
34
35 typedef CachingTraits<ct, dim> Traits;
36
37 public:
38 typedef typename Traits::QuadratureType QuadratureType;
39 typedef typename Traits::PointVectorType GlobalPointVectorType;
40 typedef typename Traits::QuadratureKeyType QuadratureKeyType;
41
42 public:
43 inline
44 static void registerQuadrature(const QuadratureType& quad);
45
46 inline
47 static const GlobalPointVectorType& getPoints(const size_t id,
48 const GeometryType& elementGeo);
49
50 private:
51 typedef std::unordered_map<QuadratureKeyType, GlobalPointVectorType> PointContainerType;
52 typedef typename PointContainerType::iterator PointIteratorType;
53
54 // points container holding quadrature points
55 PointContainerType points_;
56
57 static PointContainerType& points()
58 {
59 return instance().points_;
60 }
61
62 static ThisType& instance()
63 {
65 }
66 };
67
68 // * Add elemGeo later
69 template <class ct, int dim>
70 class PointProvider<ct, dim, 1>
71 {
72 typedef PointProvider<ct, dim, 1> ThisType;
73
74 enum { codim = 1 };
75 typedef CachingTraits<ct, dim-codim> Traits;
76
77 public:
78 typedef typename Traits::QuadratureType QuadratureType;
79 typedef typename Traits::PointType LocalPointType;
80 typedef typename Traits::PointVectorType LocalPointVectorType;
81 typedef typename Traits::MapperType MapperType;
82 typedef typename Traits::MapperVectorType MapperVectorType;
83 typedef FieldVector<ct, dim> GlobalPointType;
84 typedef std::vector<GlobalPointType> GlobalPointVectorType;
85 typedef typename Traits::QuadratureKeyType QuadratureKeyType;
86 typedef std::pair< MapperVectorType, MapperVectorType > MapperVectorPairType;
87
88 public:
89 inline
90 static const MapperVectorPairType& getMappers(const QuadratureType& quad,
91 const GeometryType& elementGeo);
92 // Access for non-symmetric quadratures
93 inline
94 static const MapperVectorPairType& getMappers(const QuadratureType& quad,
95 const LocalPointVectorType& pts,
96 const GeometryType& elementGeo);
97 inline
98 static const GlobalPointVectorType& getPoints(const size_t id,
99 const GeometryType& elementGeo);
100
101 private:
102 typedef std::map<const QuadratureKeyType, GlobalPointVectorType> PointContainerType;
103 typedef std::map<const QuadratureKeyType, MapperVectorPairType > MapperContainerType;
104
105 typedef typename PointContainerType::iterator PointIteratorType;
106 typedef typename MapperContainerType::iterator MapperIteratorType;
107
108 private:
109 inline
110 static MapperIteratorType addEntry(const QuadratureType& quad,
111 const LocalPointVectorType& pts,
112 GeometryType elementGeo);
113
114 private:
115 // points container holding quadrature points
116 PointContainerType points_;
117 // mapper container holding mapping info
118 MapperContainerType mappers_;
119
120 static PointContainerType& points() { return instance().points_; }
121 static MapperContainerType& mappers() { return instance().mappers_; }
122
123 static ThisType& instance()
124 {
126 }
127 };
128
129 } // namespace Fem
130
131} // namespace Dune
132
133#include "pointprovider.cc"
134
135#endif // #ifndef DUNE_FEM_POINTPROVIDER_HH
static DUNE_EXPORT Object & instance(Args &&... args)
return singleton instance of given Object type.
Definition: singleton.hh:123
Some useful basic math stuff.
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)