38 #include "GaussianQuadratureRule.hpp"
42 template<
unsigned ELEMENT_DIM>
45 assert(index < mNumQuadPoints);
46 return mPoints[index];
49 template<
unsigned ELEMENT_DIM>
52 assert(index < mNumQuadPoints);
53 return mWeights[index];
56 template<
unsigned ELEMENT_DIM>
59 return mNumQuadPoints;
71 mWeights.push_back(1);
83 switch (quadratureOrder)
97 double sqrt_one_third = sqrt(1.0/3.0);
110 double sqrt_three_fifths = sqrt(3.0/5.0);
117 EXCEPTION(
"Gauss quadrature order not supported.");
132 double one_third = 1.0/3.0;
133 double one_sixth = 1.0/6.0;
134 double two_thirds = 2.0/3.0;
135 switch (quadratureOrder)
140 mWeights.push_back(0.5);
146 mWeights.push_back(one_sixth);
147 mWeights.push_back(one_sixth);
148 mWeights.push_back(one_sixth);
160 mWeights.push_back(w);
161 mWeights.push_back(w);
162 mWeights.push_back(w);
163 mWeights.push_back(w);
164 mWeights.push_back(w);
165 mWeights.push_back(w);
167 double inverse_tan = atan(0.75);
168 double cos_third = cos(inverse_tan/3.0);
169 double sin_third = sin(inverse_tan/3.0);
171 double a = sin_third/(2*sqrt(3.0)) - cos_third/6.0 + 1.0/3.0;
173 double b = - sin_third/(2*sqrt(3.0)) - cos_third/6.0 + 1.0/3.0;
175 double c = cos_third/3.0 + 1.0/3.0;
186 EXCEPTION(
"Gauss quadrature order not supported.");
188 assert(mPoints.size() == mWeights.size());
189 mNumQuadPoints = mPoints.size();
200 switch (quadratureOrder)
205 mWeights.push_back(1.0/6.0);
212 double sqrt_fifth = 1.0/sqrt(5.0);
213 double a = (1.0 + 3.0*sqrt_fifth)/4.0;
214 double b = (1.0 - sqrt_fifth)/4.0;
217 mWeights.push_back(w);
218 mWeights.push_back(w);
219 mWeights.push_back(w);
220 mWeights.push_back(w);
239 double root_seventeen = sqrt(17.0);
240 double root_term = sqrt(1022.0-134.0*root_seventeen);
241 double b = (55.0 - 3.0*root_seventeen + root_term)/196;
242 double d = (55.0 - 3.0*root_seventeen - root_term)/196;
244 double a = 1.0 - 3.0*b;
245 double c = 1.0 - 3.0*d;
248 double w1 = (20.0*d*d - 10.0*d + 1.0)/(240.0*(2.0*d*d - d - 2.0*b*b + b));
249 double w2 = 1.0/24.0 - w1;
251 mWeights.push_back(w1);
252 mWeights.push_back(w1);
253 mWeights.push_back(w1);
254 mWeights.push_back(w1);
256 mWeights.push_back(w2);
257 mWeights.push_back(w2);
258 mWeights.push_back(w2);
259 mWeights.push_back(w2);
275 EXCEPTION(
"Gauss quadrature order not supported.");
277 assert(mPoints.size() == mWeights.size());
278 mNumQuadPoints = mPoints.size();
281 template<
unsigned ELEMENT_DIM>
284 EXCEPTION(
"Gauss quadrature rule not available for this dimension.");
GaussianQuadratureRule(unsigned quadratureOrder)
std::vector< double > mWeights
#define EXCEPTION(message)
unsigned GetNumQuadPoints() const
double GetWeight(unsigned index) const
std::vector< ChastePoint< ELEMENT_DIM > > mPoints
const ChastePoint< ELEMENT_DIM > & rGetQuadPoint(unsigned index) const