Line data Source code
1 : /*
2 : * Copyright (c) 2011-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__GAUSS_QUAD__GAUSS_QUAD__
34 : #define __H__UG__LIB_DISC__QUADRATURE__GAUSS_QUAD__GAUSS_QUAD__
35 :
36 : #include "common/common.h"
37 : #include "../quadrature.h"
38 : #include "lib_disc/reference_element/reference_element.h"
39 :
40 : namespace ug{
41 :
42 : /// fixed order gauss quadrature
43 : template <typename TRefElem, int order>
44 : class GaussQuadrature;
45 :
46 : /// wrapper to ease implementation
47 : template <typename TImpl, int TDim, int TOrder, int TNip>
48 : class GaussQuadBase
49 : {
50 : public:
51 : /// Dimension of integration domain
52 : static const size_t dim = TDim;
53 :
54 : /// Position Type in Reference Element Space
55 : typedef MathVector<dim> position_type;
56 :
57 : /// Type of weights
58 : typedef number weight_type;
59 :
60 : /// Order of quadrature rule
61 : static const size_t p = TOrder;
62 :
63 : /// Number of integration points
64 : static const size_t nip = TNip;
65 :
66 : public:
67 : /// number of integration points
68 : static size_t size() {return nip;}
69 :
70 : /// returns i'th integration point
71 : static const MathVector<dim>& point(size_t i)
72 0 : {UG_ASSERT(i < size(), "Wrong index"); return m_vPoint[i];}
73 :
74 : /// returns all positions in an array of size()
75 : static const MathVector<dim>* points() {return m_vPoint;}
76 :
77 : /// return the i'th weight
78 : static number weight(size_t i)
79 0 : {UG_ASSERT(i < size(), "Wrong index"); return m_vWeight[i];}
80 :
81 : /// returns all weights in an array of size()
82 : static const number* weights() {return m_vWeight;}
83 :
84 : /// returns the order
85 : static size_t order() {return p;}
86 :
87 : protected:
88 : /// integration points
89 : static MathVector<dim> m_vPoint[nip];
90 :
91 : /// weights
92 : static number m_vWeight[nip];
93 : };
94 :
95 : /// flexible order gauss quadrature
96 : /**
97 : * Providing gauss quadrature for an reference element. This class wrapps a
98 : * static GaussQuadrature into the Quadrature interface.
99 : *
100 : * \tparam TRefElem Reference Element Type
101 : */
102 : template <typename TRefElem>
103 : class FlexGaussQuadrature
104 : : public QuadratureRule<TRefElem::dim>
105 : {
106 : public:
107 : /// Constructor
108 : FlexGaussQuadrature(int order);
109 :
110 : /// Destructor
111 0 : ~FlexGaussQuadrature() {}
112 : };
113 :
114 : } // namespace ug
115 :
116 : // include implementation
117 : #include "gauss_quad_vertex.h"
118 : #include "gauss_quad_edge.h"
119 : #include "gauss_quad_triangle.h"
120 : #include "gauss_quad_quadrilateral.h"
121 : #include "gauss_quad_tetrahedron.h"
122 : #include "gauss_quad_pyramid.h"
123 : #include "gauss_quad_prism.h"
124 : #include "gauss_quad_hexahedron.h"
125 : #include "gauss_quad_octahedron.h"
126 :
127 :
128 : #endif /* __H__UG__LIB_DISC__QUADRATURE__GAUSS_QUAD__GAUSS_QUAD__ */
|