Go to the documentation of this file.00001 #ifndef VIENNAFEM_QUADRATURE_HEXAHEDRON_HPP
00002 #define VIENNAFEM_QUADRATURE_HEXAHEDRON_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "viennafem/forwards.h"
00018 #include "viennafem/cell_quan.hpp"
00019
00020 #include "viennamath/forwards.h"
00021 #include "viennamath/expression.hpp"
00022 #include "viennamath/manipulation/substitute.hpp"
00023 #include "viennamath/manipulation/diff.hpp"
00024 #include "viennamath/manipulation/eval.hpp"
00025 #include "viennamath/runtime/numerical_quadrature.hpp"
00026
00027 #include "viennagrid/topology/triangle.hpp"
00028 #include "viennagrid/topology/tetrahedron.hpp"
00029
00034 namespace viennafem
00035 {
00036
00037
00038
00039
00040
00041
00043 template <typename InterfaceType>
00044 class rt_gauss_quad_element <viennafem::unit_cube, 1, InterfaceType> : public viennamath::numerical_quadrature_interface<InterfaceType>
00045 {
00046 typedef typename InterfaceType::numeric_type NumericT;
00047 typedef rt_gauss_quad_element <viennafem::unit_cube, 1, InterfaceType> self_type;
00048 typedef viennamath::numerical_quadrature_interface<InterfaceType> BaseType;
00049 public:
00050 explicit rt_gauss_quad_element() : p_(3)
00051 {
00052 p_[0] = 1.0/2.0;
00053 p_[1] = 1.0/2.0;
00054 p_[2] = 1.0/2.0;
00055 }
00056
00057 BaseType * clone() const { return new self_type(); }
00058
00059 NumericT eval(viennamath::rt_interval<InterfaceType> const & interv,
00060 viennamath::rt_expr<InterfaceType> const & e,
00061 viennamath::rt_variable<InterfaceType> const & var) const
00062 {
00063 return viennamath::eval(e, p_);
00064 }
00065
00066 private:
00067 std::vector<NumericT> p_;
00068 };
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00088 template <typename InterfaceType>
00089 class rt_gauss_quad_element <viennafem::unit_cube, 3, InterfaceType> : public viennamath::numerical_quadrature_interface<InterfaceType>
00090 {
00091 typedef typename InterfaceType::numeric_type NumericT;
00092 typedef rt_gauss_quad_element <viennafem::unit_cube, 3, InterfaceType> self_type;
00093 typedef viennamath::numerical_quadrature_interface<InterfaceType> BaseType;
00094 public:
00095 enum { num_points = 8 };
00096
00097 explicit rt_gauss_quad_element() : abscissas_(num_points, std::vector<numeric_type>(3))
00098 {
00099 abscissas_[0][0] = 0.7886751345948125; abscissas_[0][1] = 0.7886751345948125; abscissas_[0][2] = 0.7886751345948125;
00100 abscissas_[1][0] = 0.7886751345948125; abscissas_[1][1] = 0.7886751345948125; abscissas_[1][2] = 0.2113248654051875;
00101 abscissas_[2][0] = 0.7886751345948125; abscissas_[2][1] = 0.2113248654051875; abscissas_[2][2] = 0.7886751345948125;
00102 abscissas_[3][0] = 0.7886751345948125; abscissas_[3][1] = 0.2113248654051875; abscissas_[3][2] = 0.2113248654051875;
00103 abscissas_[4][0] = 0.2113248654051875; abscissas_[4][1] = 0.7886751345948125; abscissas_[4][2] = 0.7886751345948125;
00104 abscissas_[5][0] = 0.2113248654051875; abscissas_[5][1] = 0.7886751345948125; abscissas_[5][2] = 0.2113248654051875;
00105 abscissas_[6][0] = 0.2113248654051875; abscissas_[6][1] = 0.2113248654051875; abscissas_[6][2] = 0.7886751345948125;
00106 abscissas_[7][0] = 0.2113248654051875; abscissas_[7][1] = 0.2113248654051875; abscissas_[7][2] = 0.2113248654051875;
00107 }
00108
00109 BaseType * clone() const { return new self_type(); }
00110
00111 NumericT eval(viennamath::rt_interval<InterfaceType> const & interv,
00112 viennamath::rt_expr<InterfaceType> const & e,
00113 viennamath::rt_variable<InterfaceType> const & var) const
00114 {
00115 NumericT result = 0;
00116 for (std::size_t i=0; i<num_points; ++i)
00117 result += viennamath::eval(e, abscissas_[i]);
00118 return result / 8.0;
00119 }
00120
00121 private:
00122 std::vector<std::vector<NumericT> > abscissas_;
00123 };
00124
00125
00126
00127
00128
00129
00130
00132 template <typename InterfaceType>
00133 class rt_gauss_quad_element <viennafem::unit_cube, 5, InterfaceType> : public viennamath::numerical_quadrature_interface<InterfaceType>
00134 {
00135 typedef typename InterfaceType::numeric_type NumericT;
00136 typedef rt_gauss_quad_element <viennafem::unit_cube, 5, InterfaceType> self_type;
00137 typedef viennamath::numerical_quadrature_interface<InterfaceType> BaseType;
00138 public:
00139 enum { num_points = 27 };
00140
00141 explicit rt_gauss_quad_element() : abscissas_(num_points, std::vector<numeric_type>(3)), weights_(num_points)
00142 {
00143 abscissas_[0][0] = 0.11270166537925829786; abscissas_[0][1] = 0.11270166537925829786; abscissas_[0][2] = 0.11270166537925829786;
00144 abscissas_[1][0] = 0.11270166537925829786; abscissas_[1][1] = 0.11270166537925829786; abscissas_[1][2] = 0.5;
00145 abscissas_[2][0] = 0.11270166537925829786; abscissas_[2][1] = 0.11270166537925829786; abscissas_[2][2] = 0.88729833462074170214;
00146 abscissas_[3][0] = 0.11270166537925829786; abscissas_[3][1] = 0.5; abscissas_[3][2] = 0.11270166537925829786;
00147 abscissas_[4][0] = 0.11270166537925829786; abscissas_[4][1] = 0.5; abscissas_[4][2] = 0.5;
00148 abscissas_[5][0] = 0.11270166537925829786; abscissas_[5][1] = 0.5; abscissas_[5][2] = 0.88729833462074170214;
00149 abscissas_[6][0] = 0.11270166537925829786; abscissas_[6][1] = 0.88729833462074170214; abscissas_[6][2] = 0.11270166537925829786;
00150 abscissas_[7][0] = 0.11270166537925829786; abscissas_[7][1] = 0.88729833462074170214; abscissas_[7][2] = 0.5;
00151 abscissas_[8][0] = 0.11270166537925829786; abscissas_[8][1] = 0.88729833462074170214; abscissas_[8][2] = 0.88729833462074170214;
00152
00153 abscissas_[ 9][0] = 0.5; abscissas_[ 9][1] = 0.11270166537925829786; abscissas_[ 9][2] = 0.11270166537925829786;
00154 abscissas_[10][0] = 0.5; abscissas_[10][1] = 0.11270166537925829786; abscissas_[10][2] = 0.5;
00155 abscissas_[11][0] = 0.5; abscissas_[11][1] = 0.11270166537925829786; abscissas_[11][2] = 0.88729833462074170214;
00156 abscissas_[12][0] = 0.5; abscissas_[12][1] = 0.5; abscissas_[12][2] = 0.11270166537925829786;
00157 abscissas_[13][0] = 0.5; abscissas_[13][1] = 0.5; abscissas_[13][2] = 0.5;
00158 abscissas_[14][0] = 0.5; abscissas_[14][1] = 0.5; abscissas_[14][2] = 0.88729833462074170214;
00159 abscissas_[15][0] = 0.5; abscissas_[15][1] = 0.88729833462074170214; abscissas_[15][2] = 0.11270166537925829786;
00160 abscissas_[16][0] = 0.5; abscissas_[16][1] = 0.88729833462074170214; abscissas_[16][2] = 0.5;
00161 abscissas_[17][0] = 0.5; abscissas_[17][1] = 0.88729833462074170214; abscissas_[17][2] = 0.88729833462074170214;
00162
00163 abscissas_[18][0] = 0.88729833462074170214; abscissas_[18][1] = 0.11270166537925829786; abscissas_[18][2] = 0.11270166537925829786;
00164 abscissas_[19][0] = 0.88729833462074170214; abscissas_[19][1] = 0.11270166537925829786; abscissas_[19][2] = 0.5;
00165 abscissas_[20][0] = 0.88729833462074170214; abscissas_[20][1] = 0.11270166537925829786; abscissas_[20][2] = 0.88729833462074170214;
00166 abscissas_[21][0] = 0.88729833462074170214; abscissas_[21][1] = 0.5; abscissas_[21][2] = 0.11270166537925829786;
00167 abscissas_[22][0] = 0.88729833462074170214; abscissas_[22][1] = 0.5; abscissas_[22][2] = 0.5;
00168 abscissas_[23][0] = 0.88729833462074170214; abscissas_[23][1] = 0.5; abscissas_[23][2] = 0.88729833462074170214;
00169 abscissas_[24][0] = 0.88729833462074170214; abscissas_[24][1] = 0.88729833462074170214; abscissas_[24][2] = 0.11270166537925829786;
00170 abscissas_[25][0] = 0.88729833462074170214; abscissas_[25][1] = 0.88729833462074170214; abscissas_[25][2] = 0.5;
00171 abscissas_[26][0] = 0.88729833462074170214; abscissas_[26][1] = 0.88729833462074170214; abscissas_[26][2] = 0.88729833462074170214;
00172
00173
00174 double denominator = 18.0 * 18.0 * 18.0;
00175 weights_[0] = (5.0 * 5.0 * 5.0) / denominator;
00176 weights_[1] = (5.0 * 5.0 * 8.0) / denominator;
00177 weights_[2] = (5.0 * 5.0 * 5.0) / denominator;
00178 weights_[3] = (5.0 * 8.0 * 5.0) / denominator;
00179 weights_[4] = (5.0 * 8.0 * 8.0) / denominator;
00180 weights_[5] = (5.0 * 8.0 * 5.0) / denominator;
00181 weights_[6] = (5.0 * 5.0 * 5.0) / denominator;
00182 weights_[7] = (5.0 * 5.0 * 8.0) / denominator;
00183 weights_[8] = (5.0 * 5.0 * 5.0) / denominator;
00184
00185 weights_[ 9] = (8.0 * 5.0 * 5.0) / denominator;
00186 weights_[10] = (8.0 * 5.0 * 8.0) / denominator;
00187 weights_[11] = (8.0 * 5.0 * 5.0) / denominator;
00188 weights_[12] = (8.0 * 8.0 * 5.0) / denominator;
00189 weights_[13] = (8.0 * 8.0 * 8.0) / denominator;
00190 weights_[14] = (8.0 * 8.0 * 5.0) / denominator;
00191 weights_[15] = (8.0 * 5.0 * 5.0) / denominator;
00192 weights_[16] = (8.0 * 5.0 * 8.0) / denominator;
00193 weights_[17] = (8.0 * 5.0 * 5.0) / denominator;
00194
00195 weights_[18] = (5.0 * 5.0 * 5.0) / denominator;
00196 weights_[19] = (5.0 * 5.0 * 8.0) / denominator;
00197 weights_[20] = (5.0 * 5.0 * 5.0) / denominator;
00198 weights_[21] = (5.0 * 8.0 * 5.0) / denominator;
00199 weights_[22] = (5.0 * 8.0 * 8.0) / denominator;
00200 weights_[23] = (5.0 * 8.0 * 5.0) / denominator;
00201 weights_[24] = (5.0 * 5.0 * 5.0) / denominator;
00202 weights_[25] = (5.0 * 5.0 * 8.0) / denominator;
00203 weights_[26] = (5.0 * 5.0 * 5.0) / denominator;
00204 }
00205
00206 BaseType * clone() const { return new self_type(); }
00207
00208 NumericT eval(viennamath::rt_interval<InterfaceType> const & interv,
00209 viennamath::rt_expr<InterfaceType> const & e,
00210 viennamath::rt_variable<InterfaceType> const & var) const
00211 {
00212 NumericT result = 0;
00213 for (std::size_t i=0; i<num_points; ++i)
00214 result += weights_[i] * viennamath::eval(e, abscissas_[i]);
00215 return result;
00216 }
00217
00218 private:
00219 std::vector<std::vector<NumericT> > abscissas_;
00220 std::vector<NumericT> weights_;
00221 };
00222
00223
00224 }
00225 #endif