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)
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.");
200 switch (quadratureOrder)
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;
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;
275 EXCEPTION(
"Gauss quadrature order not supported.");
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