33 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__DISC_UTIL__GEOM_PROVIDER__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__DISC_UTIL__GEOM_PROVIDER__
50 template <
typename TGeom>
93 typedef std::map<LFEIDandQuadOrder, TGeom*>
MapType;
101 typedef std::pair<typename MapType::iterator,bool> ret_type;
102 ret_type ret =
m_mLFEIDandOrder.insert(std::pair<LFEIDandQuadOrder,TGeom*>(key,NULL));
105 if(ret.second ==
true){
106 if(ret.first->second != NULL){
107 UG_THROW(
"Newly inserted element must have Pointer = NULL");
110 ret.first->second =
new TGeom();
114 return *ret.first->second;
119 typedef typename std::map<LFEIDandQuadOrder, TGeom*>::iterator MapIter;
132 static inline TGeom&
get(
const LFEID lfeID,
const int quadOrder){
137 return inst().get_class(lfeID, quadOrder);
141 static inline TGeom&
get(){
144 UG_THROW(
"GeomProvider: accessing geometry without keys, but"
145 " geometry may change local data. Use access by keys instead.");
151 inst().clear_geoms();
155 template <
typename TGeom>
157 = std::map<typename GeomProvider<TGeom>::LFEIDandQuadOrder, TGeom*>();
Geom Provider, holding a single instance of a geometry.
Definition: geom_provider.h:52
GeomProvider()
private constructor
Definition: geom_provider.h:65
static TGeom & get_class(const LFEID lfeID, const int quadOrder)
returns class based on identifier
Definition: geom_provider.h:97
static TGeom & get(const LFEID lfeID, const int quadOrder)
returns a singleton based on the identifier
Definition: geom_provider.h:132
static void clear_geoms()
clears all instances
Definition: geom_provider.h:118
TGeom Type
type of provided object
Definition: geom_provider.h:129
static const bool staticLocalData
flag indicating if local data may change
Definition: geom_provider.h:61
~GeomProvider()
destructor
Definition: geom_provider.h:68
static GeomProvider< TGeom > & inst()
singleton provider
Definition: geom_provider.h:71
static TGeom & get()
returns a singleton based on the identifier
Definition: geom_provider.h:141
static void clear()
clears all singletons
Definition: geom_provider.h:150
static MapType m_mLFEIDandOrder
Definition: geom_provider.h:94
std::map< LFEIDandQuadOrder, TGeom * > MapType
vector holding instances
Definition: geom_provider.h:93
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
#define UG_THROW(msg)
Definition: error.h:57
struct to sort keys
Definition: geom_provider.h:77
const LFEID m_lfeID
Definition: geom_provider.h:88
const int m_order
Definition: geom_provider.h:89
bool operator<(const LFEIDandQuadOrder &v) const
operator <
Definition: geom_provider.h:82
LFEIDandQuadOrder(const LFEID lfeID, const int order)
Definition: geom_provider.h:78