ug4
local_finite_element_provider.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_DISC__LOCAL_FINITE_ELEMENT__LOCAL_FINITE_ELEMENT_PROVIDER__
34 #define __H__UG__LIB_DISC__LOCAL_FINITE_ELEMENT__LOCAL_FINITE_ELEMENT_PROVIDER__
35 
36 // extern libraries
37 #include <cassert>
38 #include <map>
39 
40 // other ug4 modules
41 #include "common/math/ugmath.h"
42 
43 // library intern headers
47 
48 namespace ug {
49 
51 // Provider for local finite element infos
53 
54 // LocalFiniteElementProvider
61  private:
62  // disallow private constructor
64 
65  // disallow copy and assignment (intentionally left unimplemented)
68 
69  // private destructor
71 
72  // Singleton provider
74  {
75  static LocalFiniteElementProvider myInst;
76  return myInst;
77  };
78 
79  private:
82  template <typename TRefElem>
83  static void create_lagrange_set(const LFEID& id);
84  static void create_lagrange_set(ReferenceObjectID roid, const LFEID& id);
86 
89  template <typename TRefElem>
90  static void create_mini_bubble_set(const LFEID& id);
91  static void create_mini_bubble_set(ReferenceObjectID roid, const LFEID& id);
93 
96  template <typename TRefElem>
97  static void create_nedelec_set(const LFEID& id);
98  static void create_nedelec_set(ReferenceObjectID roid, const LFEID& id);
100 
103  template <typename TRefElem>
104  static void create_piecewise_constant_set(const LFEID& id);
105  static void create_piecewise_constant_set(ReferenceObjectID roid, const LFEID& id);
107 
110  template <typename TRefElem>
111  static void create_crouxeiz_raviart_set(const LFEID& id);
112  static void create_crouxeiz_raviart_set(ReferenceObjectID roid, const LFEID& id);
114 
116  static void create_set(ReferenceObjectID roid, const LFEID& id);
117 
119  static void create_set(const LFEID& id);
120 
122  template <int rdim, int dim>
123  static void create_sub_dof_set(ReferenceObjectID roid, const LFEID& id);
124  static void create_dof_set(ReferenceObjectID roid, const LFEID& id);
125 
126  private:
127  template <int dim, typename TShape, typename TGrad>
132  };
133 
134  // return a map of element_trial_spaces
135  template <int dim, typename TShape, typename TGrad>
136  static std::map<LFEID, LocalShapeFunctionSets<dim, TShape, TGrad> >&
137  lsfs_map();
138 
139  // returns the continuous information
140  static std::map<LFEID, bool> m_mContSpace;
141 
142  private:
143  struct LocalDoFSets{
144  ConstSmartPtr<LocalDoFSet>& operator[](size_t i) {return ptr[i];}
145  const ConstSmartPtr<LocalDoFSet>& operator[](size_t i) const {return ptr[i];}
147  };
148 
149  template <int dim>
152  const ConstSmartPtr<DimLocalDoFSet<dim> >& operator[](size_t i) const {return ptr[i];}
154  };
155 
156 
157  // map holding common dof set for roid of same dimension
158  static std::map<LFEID, CommonLocalDoFSet> m_mCommonDoFSet;
159 
160  // map holding dof sets for a reference object id
161  static std::map<LFEID, LocalDoFSets> m_mLocalDoFSets;
162 
163  // returns map for dof set with local pos
164  template <int dim>
165  static std::map<LFEID, DimLocalDoFSets<dim> >& lds_map();
166 
167  public:
169 
177  template <int dim, typename TShape, typename TGrad>
178  static void register_set(const LFEID& id,
180 
188  template <int dim>
189  static void register_set(const LFEID& id, ConstSmartPtr<DimLocalDoFSet<dim> > set);
190 
198  static void register_set(const LFEID& id, ConstSmartPtr<LocalDoFSet> set);
199 
201 
211  template <int dim, typename TShape, typename TGrad>
213  get(ReferenceObjectID roid, const LFEID& id, bool bCreate = true);
214 
215  template <int dim>
216  static const LocalShapeFunctionSet<dim>&
217  get(ReferenceObjectID roid, const LFEID& id, bool bCreate = true)
218  {return get<dim,number,MathVector<dim> >(roid, id, bCreate);}
219 
220  template <int dim, typename TShape, typename TGrad>
222  getptr(ReferenceObjectID roid, const LFEID& id, bool bCreate = true);
223 
224  template <int dim>
226  getptr(ReferenceObjectID roid, const LFEID& id, bool bCreate = true)
227  {return getptr<dim,number,MathVector<dim> >(roid, id, bCreate);}
229 
230 
232  static const CommonLocalDoFSet& get_dofs(const LFEID& id, bool bCreate = true);
233 
235  static const LocalDoFSet& get_dofs(ReferenceObjectID roid, const LFEID& id, bool bCreate = true);
236 
239  template <int dim>
240  static const DimLocalDoFSet<dim>&
241  get_dofs(ReferenceObjectID roid, const LFEID& id, bool bCreate = true);
242 
243  template <int dim>
245  get_dof_ptr(ReferenceObjectID roid, const LFEID& id, bool bCreate = true);
247 
249  static bool continuous(const LFEID& id, bool bCreate = true);
250 };
251 
252 } // namespace ug
253 
255 
256 #endif /* __H__UG__LIB_DISC__LOCAL_FINITE_ELEMENT__LOCAL_SHAPE_FUCNTION_SET__ */
Definition: smart_pointer.h:296
Definition: local_dof_set.h:195
Definition: local_dof_set.h:158
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
Definition: local_dof_set.h:120
Definition: local_finite_element_provider.h:60
static std::map< LFEID, LocalShapeFunctionSets< dim, TShape, TGrad > > & lsfs_map()
Definition: local_finite_element_provider_impl.h:47
static void create_lagrange_set(const LFEID &id)
Definition: local_finite_element_provider.cpp:332
static std::map< LFEID, LocalDoFSets > m_mLocalDoFSets
Definition: local_finite_element_provider.h:161
LocalFiniteElementProvider & operator=(const LocalFiniteElementProvider &)
static bool continuous(const LFEID &id, bool bCreate=true)
returns if a Local Shape Function Set is continuous
Definition: local_finite_element_provider.cpp:749
static void create_mini_bubble_set(const LFEID &id)
Definition: local_finite_element_provider.cpp:424
static void create_dof_set(ReferenceObjectID roid, const LFEID &id)
Definition: local_finite_element_provider.cpp:663
static void create_crouxeiz_raviart_set(const LFEID &id)
Definition: local_finite_element_provider.cpp:527
static std::map< LFEID, DimLocalDoFSets< dim > > & lds_map()
Definition: local_finite_element_provider_impl.h:56
~LocalFiniteElementProvider()
Definition: local_finite_element_provider.cpp:705
static void create_piecewise_constant_set(const LFEID &id)
Definition: local_finite_element_provider.cpp:500
static const LocalShapeFunctionSet< dim, TShape, TGrad > & get(ReferenceObjectID roid, const LFEID &id, bool bCreate=true)
returns the Local Shape Function Set
Definition: local_finite_element_provider_impl.h:148
static ConstSmartPtr< LocalShapeFunctionSet< dim > > getptr(ReferenceObjectID roid, const LFEID &id, bool bCreate=true)
returns the Local Shape Function Set
Definition: local_finite_element_provider.h:226
LocalFiniteElementProvider()
Definition: local_finite_element_provider.cpp:701
LocalFiniteElementProvider(const LocalFiniteElementProvider &)
static const LocalShapeFunctionSet< dim > & get(ReferenceObjectID roid, const LFEID &id, bool bCreate=true)
returns the Local Shape Function Set
Definition: local_finite_element_provider.h:217
static void create_set(ReferenceObjectID roid, const LFEID &id)
creates new set at runtime if available
Definition: local_finite_element_provider.cpp:552
static std::map< LFEID, CommonLocalDoFSet > m_mCommonDoFSet
Definition: local_finite_element_provider.h:158
static const CommonLocalDoFSet & get_dofs(const LFEID &id, bool bCreate=true)
returns the common dof set for all reference objects of a dimension
Definition: local_finite_element_provider.cpp:730
static void register_set(const LFEID &id, ConstSmartPtr< LocalShapeFunctionSet< dim, TShape, TGrad > > set)
register a local shape function set for a given reference element type
Definition: local_finite_element_provider_impl.h:65
static LocalFiniteElementProvider & inst()
Definition: local_finite_element_provider.h:73
static ConstSmartPtr< DimLocalDoFSet< dim > > get_dof_ptr(ReferenceObjectID roid, const LFEID &id, bool bCreate=true)
Definition: local_finite_element_provider_impl.h:167
static ConstSmartPtr< LocalShapeFunctionSet< dim, TShape, TGrad > > getptr(ReferenceObjectID roid, const LFEID &id, bool bCreate=true)
returns the Local Shape Function Set
Definition: local_finite_element_provider_impl.h:123
static std::map< LFEID, bool > m_mContSpace
Definition: local_finite_element_provider.h:140
static void create_nedelec_set(const LFEID &id)
Definition: local_finite_element_provider.cpp:480
static void create_sub_dof_set(ReferenceObjectID roid, const LFEID &id)
creates dof set on sub elements
Definition: local_finite_element_provider.cpp:607
virtual base class for local shape function sets
Definition: local_shape_function_set.h:70
the ug namespace
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ NUM_REFERENCE_OBJECTS
Definition: grid_base_objects.h:85
Definition: local_finite_element_provider.h:150
ConstSmartPtr< DimLocalDoFSet< dim > > ptr[NUM_REFERENCE_OBJECTS]
Definition: local_finite_element_provider.h:153
const ConstSmartPtr< DimLocalDoFSet< dim > > & operator[](size_t i) const
Definition: local_finite_element_provider.h:152
ConstSmartPtr< DimLocalDoFSet< dim > > & operator[](size_t i)
Definition: local_finite_element_provider.h:151
Definition: local_finite_element_provider.h:143
ConstSmartPtr< LocalDoFSet > & operator[](size_t i)
Definition: local_finite_element_provider.h:144
const ConstSmartPtr< LocalDoFSet > & operator[](size_t i) const
Definition: local_finite_element_provider.h:145
ConstSmartPtr< LocalDoFSet > ptr[NUM_REFERENCE_OBJECTS]
Definition: local_finite_element_provider.h:146
Definition: local_finite_element_provider.h:128
ConstSmartPtr< LocalShapeFunctionSet< dim, TShape, TGrad > > ptr[NUM_REFERENCE_OBJECTS]
Definition: local_finite_element_provider.h:131
const ConstSmartPtr< LocalShapeFunctionSet< dim, TShape, TGrad > > & operator[](size_t i) const
Definition: local_finite_element_provider.h:130
ConstSmartPtr< LocalShapeFunctionSet< dim, TShape, TGrad > > & operator[](size_t i)
Definition: local_finite_element_provider.h:129