ug4
quadrature_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__QUADRATURE_PROVIDER__
34 #define __H__UG__LIB_DISC__QUADRATURE_PROVIDER__
35 
37 #include "quadrature.h"
38 
39 
41 enum QuadType {
42  BEST = 0,
46  NUM_QUADRATURE_TYPES // always last
47 };
48 
49 namespace ug{
50 
52 
58 template <int TDim>
60 {
61  public:
63  static const int dim = TDim;
64 
65  private:
68 
69  // disallow copy
72 
75  {
76  static QuadratureRuleProvider<dim> inst;
77  return inst;
78  }
79 
80  public:
83 
84  protected:
86  static std::vector<const QuadratureRule<TDim>*> m_vRule[NUM_QUADRATURE_TYPES][NUM_REFERENCE_OBJECTS];
87 
89  static const QuadratureRule<TDim>&
90  get_quad_rule(ReferenceObjectID roid, size_t order, QuadType type);
91 
93  static void create_rule(ReferenceObjectID roid, size_t order, QuadType type);
94 
97  static const QuadratureRule<TDim>* create_gauss_rule(ReferenceObjectID roid, size_t order);
98  static const QuadratureRule<TDim>* create_newton_cotes_rule(ReferenceObjectID roid, size_t order);
101 
102  public:
104 
112  template <typename TRefElem>
113  static const QuadratureRule<TDim>&
114  get(size_t order, QuadType type = BEST);
115 
117 
125  static const QuadratureRule<TDim>&
126  get(ReferenceObjectID roid, size_t order, QuadType type = BEST);
127 };
128 
129 // Init static member
130 template <int dim>
132 
134 std::ostream& operator<<(std::ostream& out, const QuadType& v);
135 
137 QuadType GetQuadratureType(const std::string& name);
138 
140 
141 } // namespace ug
142 
144 
145 #endif /* __H__UG__LIB_DISC__QUADRATURE_PROVIDER__ */
location name
Definition: checkpoint_util.lua:128
provides quadrature rule for a Reference Dimension
Definition: quadrature.h:70
provides quadrature rules for a reference dimension
Definition: quadrature_provider.h:60
static const int dim
dimension of reference element
Definition: quadrature_provider.h:63
static std::vector< const QuadratureRule< TDim > * > m_vRule[NUM_QUADRATURE_TYPES][NUM_REFERENCE_OBJECTS]
Vector, holding all registered rules.
Definition: quadrature_provider.h:86
static const QuadratureRule< TDim > * create_gauss_legendre_rule(ReferenceObjectID roid, size_t order)
static const QuadratureRule< TDim > & get_quad_rule(ReferenceObjectID roid, size_t order, QuadType type)
provide rule, try to create it if not already present
Definition: quadrature_provider.cpp:220
~QuadratureRuleProvider()
destructor
Definition: quadrature_provider.cpp:209
QuadratureRuleProvider()
private constructor performing standard registering
Definition: quadrature_provider.cpp:201
static QuadratureRuleProvider< dim > & instance()
singleton provider
Definition: quadrature_provider.h:74
static const QuadratureRule< TDim > * create_gauss_rule(ReferenceObjectID roid, size_t order)
QuadratureRuleProvider(const QuadratureRuleProvider &)
static const QuadratureRule< TDim > & get(size_t order, QuadType type=BEST)
gets quadrature rule of requested order
Definition: quadrature_provider_impl.h:40
static const QuadratureRule< TDim > * create_newton_cotes_rule(ReferenceObjectID roid, size_t order)
Definition: quadrature_provider.cpp:191
QuadratureRuleProvider & operator=(const QuadratureRuleProvider &)
static void create_rule(ReferenceObjectID roid, size_t order, QuadType type)
creates rule at this provider
Definition: quadrature_provider.cpp:235
std::ostream & operator<<(std::ostream &outStream, const ug::MathMatrix< 2, 2 > &m)
Definition: math_matrix.cpp:38
the ug namespace
QuadType GetQuadratureType(const std::string &name)
returns Identifier from string
Definition: quadrature_provider.cpp:299
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
QuadType
types of quadratures
Definition: quadrature_provider.h:41
@ BEST
Definition: quadrature_provider.h:42
@ GAUSS
Definition: quadrature_provider.h:43
@ NUM_QUADRATURE_TYPES
Definition: quadrature_provider.h:46
@ NEWTON_COTES
Definition: quadrature_provider.h:45
@ GAUSS_LEGENDRE
Definition: quadrature_provider.h:44