1#ifndef DUNE_FEM_POINTPROVIDER_HH
2#define DUNE_FEM_POINTPROVIDER_HH
7#include <unordered_map>
12#include <dune/fem/storage/singleton.hh>
15#include "pointmapper.hh"
23 template<
class ct,
int dim,
int codim >
26 static_assert( (codim >= 0) && (codim <= 1),
27 "PointProvider exists only for codimension 0 and 1." );
30 template <
class ct,
int dim>
31 class PointProvider<ct, dim, 0>
33 typedef PointProvider<ct, dim, 0> ThisType;
35 typedef CachingTraits<ct, dim> Traits;
38 typedef typename Traits::QuadratureType QuadratureType;
39 typedef typename Traits::PointVectorType GlobalPointVectorType;
40 typedef typename Traits::QuadratureKeyType QuadratureKeyType;
44 static void registerQuadrature(
const QuadratureType& quad)
46 instance().registerQuadratureImpl( quad );
50 static const GlobalPointVectorType& getPoints(
const size_t id,
51 const GeometryType& elementGeo)
53 return instance().getPointsImpl(
id, elementGeo );
56 PointProvider() : threadPool_( MPIManager::threadPool() ), points_() {}
59 PointProvider(
const PointProvider& ) =
delete;
61 inline void registerQuadratureImpl(
const QuadratureType& quad);
63 inline const GlobalPointVectorType& getPointsImpl(
const size_t id,
64 const GeometryType& elementGeo);
66 typedef std::unordered_map<QuadratureKeyType, GlobalPointVectorType> PointContainerType;
67 typedef typename PointContainerType::iterator PointIteratorType;
70 const typename MPIManager::ThreadPoolType& threadPool_;
71 PointContainerType points_;
73 static ThisType& instance()
80 template <
class ct,
int dim>
81 class PointProvider<ct, dim, 1>
83 typedef PointProvider<ct, dim, 1> ThisType;
86 typedef CachingTraits<ct, dim-codim> Traits;
89 typedef typename Traits::QuadratureType QuadratureType;
90 typedef typename Traits::PointType LocalPointType;
91 typedef typename Traits::PointVectorType LocalPointVectorType;
92 typedef typename Traits::MapperType MapperType;
93 typedef typename Traits::MapperVectorType MapperVectorType;
94 typedef FieldVector<ct, dim> GlobalPointType;
95 typedef std::vector<GlobalPointType> GlobalPointVectorType;
96 typedef typename Traits::QuadratureKeyType QuadratureKeyType;
97 typedef std::pair< MapperVectorType, MapperVectorType > MapperVectorPairType;
100 typedef std::map<const QuadratureKeyType, GlobalPointVectorType> PointContainerType;
101 typedef std::map<const QuadratureKeyType, MapperVectorPairType > MapperContainerType;
103 typedef typename PointContainerType::iterator PointIteratorType;
104 typedef typename MapperContainerType::iterator MapperIteratorType;
108 static const MapperVectorPairType& getMappers(
const QuadratureType& quad,
109 const GeometryType& elementGeo)
111 return instance().getMappersImpl( quad, elementGeo );
116 static const MapperVectorPairType& getMappers(
const QuadratureType& quad,
117 const LocalPointVectorType& pts,
118 const GeometryType& elementGeo)
120 return instance().getMappersImpl( quad, pts, elementGeo );
124 static const GlobalPointVectorType& getPoints(
const size_t id,
125 const GeometryType& elementGeo)
127 return instance().getPointsImpl(
id, elementGeo );
131 const GlobalPointVectorType& getPointsImpl(
const size_t id,
132 const GeometryType& elementGeo);
134 inline const MapperVectorPairType& getMappersImpl(
const QuadratureType& quad,
139 const MapperVectorPairType& getMappersImpl(
const QuadratureType& quad,
140 const LocalPointVectorType& pts,
141 const GeometryType& elementGeo);
145 static MapperIteratorType addEntry(
const QuadratureType& quad,
146 const LocalPointVectorType& pts,
147 GeometryType elementGeo)
149 instance().addEntryImpl(quad, pts, elementGeo);
153 MapperIteratorType addEntryImpl(
const QuadratureType& quad,
154 const LocalPointVectorType& pts,
155 GeometryType elementGeo);
158 const typename MPIManager::ThreadPoolType& threadPool_;
160 PointContainerType points_;
162 MapperContainerType mappers_;
164 PointProvider(
const PointProvider& ) =
delete;
167 PointProvider() : threadPool_( MPIManager::threadPool() ), points_(), mappers_() {}
169 static ThisType& instance()
179#include "pointprovider.cc"
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