libMesh
quadrature_test.C
Go to the documentation of this file.
1 #include <libmesh/quadrature.h>
2 #include <libmesh/string_to_enum.h>
3 #include <libmesh/utility.h>
4 #include <libmesh/enum_quadrature_type.h>
5 
6 #include <iomanip>
7 #include <numeric> // std::iota
8 
9 #include "libmesh_cppunit.h"
10 
11 
12 using namespace libMesh;
13 
14 #define MACROCOMMA ,
15 
16 #if LIBMESH_DIM > 2
17 #define TEST_ONE_ORDER(qtype, order, maxorder) \
18  CPPUNIT_TEST( testBuild<qtype MACROCOMMA order> ); \
19  CPPUNIT_TEST( test1DWeights<qtype MACROCOMMA order MACROCOMMA maxorder> ); \
20  CPPUNIT_TEST( test2DWeights<qtype MACROCOMMA order MACROCOMMA maxorder> ); \
21  CPPUNIT_TEST( test3DWeights<qtype MACROCOMMA order MACROCOMMA maxorder> );
22 #elif LIBMESH_DIM > 1
23 #define TEST_ONE_ORDER(qtype, order, maxorder) \
24  CPPUNIT_TEST( testBuild<qtype MACROCOMMA order> ); \
25  CPPUNIT_TEST( test1DWeights<qtype MACROCOMMA order MACROCOMMA maxorder> ); \
26  CPPUNIT_TEST( test2DWeights<qtype MACROCOMMA order MACROCOMMA maxorder> );
27 #else
28 #define TEST_ONE_ORDER(qtype, order, maxorder) \
29  CPPUNIT_TEST( testBuild<qtype MACROCOMMA order> ); \
30  CPPUNIT_TEST( test1DWeights<qtype MACROCOMMA order MACROCOMMA maxorder> );
31 #endif
32 
33 // std::min isn't constexpr, and C++03 lacks constexpr anyway
34 #define mymin(a, b) (a < b ? a : b)
35 
36 #define TEST_ALL_ORDERS(qtype, maxorder) \
37  TEST_ONE_ORDER(qtype, FIRST, mymin(1,maxorder)); \
38  TEST_ONE_ORDER(qtype, SECOND, mymin(2,maxorder)); \
39  TEST_ONE_ORDER(qtype, THIRD, mymin(3,maxorder)); \
40  TEST_ONE_ORDER(qtype, FOURTH, mymin(4,maxorder)); \
41  TEST_ONE_ORDER(qtype, FIFTH, mymin(5,maxorder)); \
42  TEST_ONE_ORDER(qtype, SIXTH, mymin(6,maxorder)); \
43  TEST_ONE_ORDER(qtype, SEVENTH, mymin(7,maxorder)); \
44  TEST_ONE_ORDER(qtype, EIGHTH, mymin(8,maxorder)); \
45  TEST_ONE_ORDER(qtype, NINTH, mymin(9,maxorder));
46 
47 #define LIBMESH_ASSERT_REALS_EQUAL(first, second, tolerance) \
48  if (std::abs(first-second) >= tolerance) \
49  { \
50  std::cerr << "first = " << first << std::endl; \
51  std::cerr << "second = " << second << std::endl; \
52  std::cerr << "error = " << std::abs(first-second) << std::endl; \
53  std::cerr << "tolerance = " << tolerance << std::endl; \
54  } \
55  CPPUNIT_ASSERT (std::abs(first-second) < tolerance)
56 
57 class QuadratureTest : public CppUnit::TestCase {
58 public:
59  CPPUNIT_TEST_SUITE( QuadratureTest );
60 
61  TEST_ALL_ORDERS(QGAUSS, 9999);
62  TEST_ONE_ORDER(QSIMPSON, FIRST, 3);
63  TEST_ONE_ORDER(QSIMPSON, SECOND, 3);
64  TEST_ONE_ORDER(QSIMPSON, THIRD, 3);
65  TEST_ONE_ORDER(QTRAP, FIRST, 1);
66  TEST_ALL_ORDERS(QGRID, 1);
67 
68  // In general, QNodal rules (e.g. QTRAP) are only exact for linears.
69  // QSIMPSON is a special case of a nodal quadrature which obtains
70  // higher accuracy.
71  TEST_ONE_ORDER(QNODAL, /*ignored*/FIRST, /*max order=*/1);
72 
73  // The TEST_ALL_ORDERS macro only goes up to 9th-order
74  TEST_ALL_ORDERS(QGAUSS_LOBATTO, 9);
75 
76  // The Gauss-Lobatto quadrature rules passed all these tests during
77  // development, but we don't run them with every 'make check'
78  // because it takes too long.
79  // TEST_ONE_ORDER(QGAUSS_LOBATTO, ELEVENTH, 11);
80  // TEST_ONE_ORDER(QGAUSS_LOBATTO, THIRTEENTH, 13);
81  // TEST_ONE_ORDER(QGAUSS_LOBATTO, FIFTEENTH, 15);
82  // TEST_ONE_ORDER(QGAUSS_LOBATTO, SEVENTEENTH, 17);
83  // TEST_ONE_ORDER(QGAUSS_LOBATTO, NINETEENTH, 19);
84  // TEST_ONE_ORDER(QGAUSS_LOBATTO, TWENTYFIRST, 21);
85  // TEST_ONE_ORDER(QGAUSS_LOBATTO, TWENTYTHIRD, 23);
86  // TEST_ONE_ORDER(QGAUSS_LOBATTO, TWENTYFIFTH, 25);
87  // TEST_ONE_ORDER(QGAUSS_LOBATTO, TWENTYSEVENTH, 27);
88  // TEST_ONE_ORDER(QGAUSS_LOBATTO, TWENTYNINTH, 29);
89  // TEST_ONE_ORDER(QGAUSS_LOBATTO, THIRTYFIRST, 31);
90  // TEST_ONE_ORDER(QGAUSS_LOBATTO, THIRTYTHIRD, 33);
91  // TEST_ONE_ORDER(QGAUSS_LOBATTO, THIRTYFIFTH, 35);
92  // TEST_ONE_ORDER(QGAUSS_LOBATTO, THIRTYSEVENTH, 37);
93  // TEST_ONE_ORDER(QGAUSS_LOBATTO, THIRTYNINTH, 39);
94  // TEST_ONE_ORDER(QGAUSS_LOBATTO, FORTYFIRST, 41);
95  // TEST_ONE_ORDER(QGAUSS_LOBATTO, FORTYTHIRD, 43);
96 
97  // Test monomial quadrature rules on quads and hexes
98  CPPUNIT_TEST( testMonomialQuadrature );
99 
100  // Test quadrature rules on Triangles
101 #if LIBMESH_DIM > 1
102  CPPUNIT_TEST( testTriQuadrature );
103 #endif
104 
105  // Test quadrature rules on Tetrahedra
106 #if LIBMESH_DIM > 2
107  CPPUNIT_TEST( testTetQuadrature );
108 #endif
109 
110  // Test Jacobi quadrature rules with special weighting function
111  CPPUNIT_TEST( testJacobi );
112 
113  CPPUNIT_TEST_SUITE_END();
114 
115 private:
116 
118 
119 
120 public:
121  void setUp ()
122  { quadrature_tolerance = TOLERANCE * std::sqrt(TOLERANCE); }
123 
124  void tearDown ()
125  {}
126 
128  {
129  ElemType elem_type[2] = {QUAD4, HEX8};
130  int dims[2] = {2, 3};
131 
132  for (int i=0; i<(LIBMESH_DIM-1); ++i)
133  {
134  // std::cout << "\nChecking monomial quadrature on element type " << elem_type[i] << std::endl;
135 
136  for (int order=0; order<7; ++order)
137  {
138  std::unique_ptr<QBase> qrule = QBase::build(QMONOMIAL,
139  dims[i],
140  static_cast<Order>(order));
141  qrule->init(elem_type[i]);
142 
143  // In 3D, max(z_power)==order, in 2D max(z_power)==0
144  int max_z_power = dims[i]==2 ? 0 : order;
145 
146  int xyz_power[3];
147  for (xyz_power[0]=0; xyz_power[0]<=order; ++xyz_power[0])
148  for (xyz_power[1]=0; xyz_power[1]<=order; ++xyz_power[1])
149  for (xyz_power[2]=0; xyz_power[2]<=max_z_power; ++xyz_power[2])
150  {
151  // Only try to integrate polynomials we can integrate exactly
152  if (xyz_power[0] + xyz_power[1] + xyz_power[2] > order)
153  continue;
154 
155  // Compute the integral via quadrature. Note that
156  // std::pow(0,0) returns 1 in the 2D case.
157  Real sumq = 0.;
158  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
159  {
160  Real term = qrule->w(qp);
161  for (unsigned int d=0; d != LIBMESH_DIM; ++d)
162  term *= std::pow(qrule->qp(qp)(d), xyz_power[d]);
163  sumq += term;
164  }
165 
166  // std::cout << "Quadrature of x^" << xyz_power[0]
167  // << " y^" << xyz_power[1]
168  // << " z^" << xyz_power[2]
169  // << " = " << sumq << std::endl;
170 
171  // Copy-pasted code from test3DWeights()
172  Real exact_x = (xyz_power[0] % 2) ? 0 : (Real(2.0) / (xyz_power[0]+1));
173  Real exact_y = (xyz_power[1] % 2) ? 0 : (Real(2.0) / (xyz_power[1]+1));
174  Real exact_z = (xyz_power[2] % 2) ? 0 : (Real(2.0) / (xyz_power[2]+1));
175 
176  // Handle 2D
177  if (dims[i]==2)
178  exact_z = 1.0;
179 
180  Real exact = exact_x*exact_y*exact_z;
181 
182  // Make sure that the quadrature solution matches the exact solution
183  LIBMESH_ASSERT_REALS_EQUAL(exact, sumq, quadrature_tolerance);
184  }
185  } // end for (order)
186  } // end for (i)
187  }
188 
190  {
191  // There are 3 different families of quadrature rules for tetrahedra
193 
194  int end_order = 7;
195  // Our higher order tet rules were only computed to double precision
196  if (quadrature_tolerance < 1e-16)
197  end_order = 2;
198 
199  for (int qt=0; qt<3; ++qt)
200  for (int order=0; order<end_order; ++order)
201  {
202  std::unique_ptr<QBase> qrule = QBase::build(qtype[qt],
203  /*dim=*/3,
204  static_cast<Order>(order));
205 
206  // Initialize on a TET element
207  qrule->init (TET4);
208 
209  // Test the sum of the weights for this order
210  Real sumw = 0.;
211  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
212  sumw += qrule->w(qp);
213 
214  // Make sure that the weights add up to the value we expect
215  LIBMESH_ASSERT_REALS_EQUAL(1/Real(6), sumw, quadrature_tolerance);
216 
217  // Test integrating different polynomial powers
218  for (int x_power=0; x_power<=order; ++x_power)
219  for (int y_power=0; y_power<=order; ++y_power)
220  for (int z_power=0; z_power<=order; ++z_power)
221  {
222  // Only try to integrate polynomials we can integrate exactly
223  if (x_power + y_power + z_power > order)
224  continue;
225 
226  // Compute the integral via quadrature
227  Real sumq = 0.;
228  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
229  sumq += qrule->w(qp)
230  * std::pow(qrule->qp(qp)(0), x_power)
231  * std::pow(qrule->qp(qp)(1), y_power)
232  * std::pow(qrule->qp(qp)(2), z_power);
233 
234  // std::cout << "sumq = " << sumq << std::endl;
235 
236  // Compute the true integral, a! b! c! / (a + b + c + 3)!
237  Real analytical = 1.0;
238  {
239  // Sort the a, b, c values
240  int sorted_powers[3] = {x_power, y_power, z_power};
241  std::sort(sorted_powers, sorted_powers+3);
242 
243  // Cancel the largest power with the denominator, fill in the
244  // entries for the remaining numerator terms and the denominator.
245  std::vector<int>
246  numerator_1(sorted_powers[0] > 1 ? sorted_powers[0]-1 : 0),
247  numerator_2(sorted_powers[1] > 1 ? sorted_powers[1]-1 : 0),
248  denominator(3 + sorted_powers[0] + sorted_powers[1]);
249 
250  // Fill up the vectors with sequences starting at the right values.
251  std::iota(numerator_1.begin(), numerator_1.end(), 2);
252  std::iota(numerator_2.begin(), numerator_2.end(), 2);
253  std::iota(denominator.begin(), denominator.end(), sorted_powers[2]+1);
254 
255  // The denominator is guaranteed to have the most terms...
256  for (std::size_t i=0; i<denominator.size(); ++i)
257  {
258  if (i < numerator_1.size())
259  analytical *= numerator_1[i];
260 
261  if (i < numerator_2.size())
262  analytical *= numerator_2[i];
263 
264  analytical /= denominator[i];
265  }
266  }
267 
268  // std::cout << "analytical = " << analytical << std::endl;
269 
270  // Make sure that the computed integral agrees with the "true" value
271  LIBMESH_ASSERT_REALS_EQUAL(analytical, sumq, quadrature_tolerance);
272  } // end for(testpower)
273  } // end for(order)
274  }
275 
277  {
279 
280  for (int qt=0; qt<4; ++qt)
281  for (int order=0; order<10; ++order)
282  {
283  std::unique_ptr<QBase> qrule = QBase::build(qtype[qt],
284  /*dim=*/2,
285  static_cast<Order>(order));
286 
287  // Initialize on a TRI element
288  qrule->init (TRI3);
289 
290  // Test the sum of the weights for this order
291  Real sumw = 0.;
292  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
293  sumw += qrule->w(qp);
294 
295  // Make sure that the weights add up to the value we expect
296  LIBMESH_ASSERT_REALS_EQUAL(0.5, sumw, quadrature_tolerance);
297 
298  // Test integrating different polynomial powers
299  for (int x_power=0; x_power<=order; ++x_power)
300  for (int y_power=0; y_power<=order; ++y_power)
301  {
302  // Only try to integrate polynomials we can integrate exactly
303  if (x_power + y_power > order)
304  continue;
305 
306  // Compute the integral via quadrature
307  Real sumq = 0.;
308  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
309  sumq += qrule->w(qp)
310  * std::pow(qrule->qp(qp)(0), x_power)
311  * std::pow(qrule->qp(qp)(1), y_power);
312 
313  // std::cout << "sumq = " << sumq << std::endl;
314 
315  // Compute the true integral, a! b! / (a + b + 2)!
316  Real analytical = 1.0;
317  {
318  unsigned
319  larger_power = std::max(x_power, y_power),
320  smaller_power = std::min(x_power, y_power);
321 
322  // Cancel the larger of the two numerator terms with the
323  // denominator, and fill in the remaining entries.
324  std::vector<unsigned>
325  numerator(smaller_power > 1 ? smaller_power-1 : 0),
326  denominator(2+smaller_power);
327 
328  // Fill up the vectors with sequences starting at the right values.
329  std::iota(numerator.begin(), numerator.end(), 2);
330  std::iota(denominator.begin(), denominator.end(), larger_power+1);
331 
332  // The denominator is guaranteed to have more terms...
333  for (std::size_t i=0; i<denominator.size(); ++i)
334  {
335  if (i < numerator.size())
336  analytical *= numerator[i];
337  analytical /= denominator[i];
338  }
339  }
340 
341  // std::cout << "analytical = " << analytical << std::endl;
342 
343  // Make sure that the computed integral agrees with the "true" value
344  LIBMESH_ASSERT_REALS_EQUAL(analytical, sumq, quadrature_tolerance);
345  } // end for(testpower)
346  } // end for(order)
347  }
348 
349  void testJacobi ()
350  {
351  // LibMesh supports two different types of Jacobi quadrature
352  QuadratureType qtype[2] = {QJACOBI_1_0, QJACOBI_2_0};
353 
354  // The weights of the Jacobi quadrature rules in libmesh have been
355  // scaled based on their intended use:
356  // (alpha=1, beta=0) rule weights sum to 1/2.
357  // (alpha=2, beta=0) rule weights sum to 1/3.
358  Real initial_sum_weights[2] = {.5, 1./3.};
359 
360  // The points of the Jacobi rules in LibMesh are also defined on
361  // [0,1]... this has to be taken into account when computing the
362  // exact integral values in Maple! Also note: if you scale the
363  // points to a different interval, you need to also compute what
364  // the sum of the weights should be for that interval, it will not
365  // simply be the element length for weighted quadrature rules like
366  // Jacobi. For general alpha and beta=0, the sum of the weights
367  // on the interval [-1,1] is 2^(alpha+1) / (alpha+1).
368  std::vector<std::vector<Real>> true_integrals(2);
369 
370  // alpha=1 integral values
371  // int((1-x)*x^p, x=0..1) = 1 / (p^2 + 3p + 2)
372  true_integrals[0].resize(10);
373  for (std::size_t p=0; p<true_integrals[0].size(); ++p)
374  true_integrals[0][p] = 1. / (p*p + 3.*p + 2.);
375 
376  // alpha=2 integral values
377  // int((1-x)^2*x^p, x=0..1) = 2 / (p^3 + 6*p^2 + 11*p + 6)
378  true_integrals[1].resize(10);
379  for (std::size_t p=0; p<true_integrals[1].size(); ++p)
380  true_integrals[1][p] = 2. / (p*p*p + 6.*p*p + 11.*p + 6.);
381 
382  // Test both types of Jacobi quadrature rules
383  for (int qt=0; qt<2; ++qt)
384  {
385  for (int order=0; order<10; ++order)
386  {
387  std::unique_ptr<QBase> qrule = QBase::build(qtype[qt],
388  /*dim=*/1,
389  static_cast<Order>(order));
390 
391  // Initialize on a 1D element, EDGE2/3/4 should not matter...
392  qrule->init (EDGE2);
393 
394  // Test the sum of the weights for this order
395  Real sumw = 0.;
396  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
397  sumw += qrule->w(qp);
398 
399  // Make sure that the weights add up to the value we expect
400  LIBMESH_ASSERT_REALS_EQUAL(initial_sum_weights[qt], sumw, quadrature_tolerance);
401 
402  // Test integrating different polynomial powers
403  for (int testpower=0; testpower<=order; ++testpower)
404  {
405  // Note that the weighting function, (1-x)^alpha *
406  // (1+x)^beta, is built into these quadrature rules;
407  // the polynomials we actually integrate are just the
408  // usual monomials.
409  Real sumq = 0.;
410  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
411  sumq += qrule->w(qp) * std::pow(qrule->qp(qp)(0), testpower);
412 
413  // Make sure that the computed integral agrees with the "true" value
414  LIBMESH_ASSERT_REALS_EQUAL(true_integrals[qt][testpower], sumq, quadrature_tolerance);
415  } // end for(testpower)
416  } // end for(order)
417  } // end for(qt)
418  } // testJacobi
419 
420 
421 
422  template <QuadratureType qtype, Order order>
423  void testBuild ()
424  {
425  std::unique_ptr<QBase> qrule1D = QBase::build (qtype, 1, order);
426  std::unique_ptr<QBase> qrule2D = QBase::build (qtype, 2, order);
427  std::unique_ptr<QBase> qrule3D = QBase::build (qtype, 3, order);
428 
429  CPPUNIT_ASSERT_EQUAL ( static_cast<unsigned int>(1) , qrule1D->get_dim() );
430  CPPUNIT_ASSERT_EQUAL ( static_cast<unsigned int>(2) , qrule2D->get_dim() );
431  CPPUNIT_ASSERT_EQUAL ( static_cast<unsigned int>(3) , qrule3D->get_dim() );
432 
433  // Test the enum-to-string conversion for this qtype is
434  // implemented, but not what the actual value is.
436  }
437 
438 
439 
440  //-------------------------------------------------------
441  // 1D Quadrature Rule Test
442  template <QuadratureType qtype, Order order, unsigned int exactorder>
444  {
445  std::unique_ptr<QBase> qrule = QBase::build(qtype , 1, order);
446  qrule->init (EDGE3);
447 
448  for (unsigned int mode=0; mode <= exactorder; ++mode)
449  {
450  Real sum = 0;
451 
452  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
453  sum += qrule->w(qp) * std::pow(qrule->qp(qp)(0), static_cast<Real>(mode));
454 
455  const Real exact = (mode % 2) ?
456  0 : (Real(2.0) / (mode+1));
457 
458  if (std::abs(exact - sum) >= quadrature_tolerance)
459  {
460  std::cout << "qtype = " << qtype << std::endl;
461  std::cout << "order = " << order << std::endl;
462  std::cout << "exactorder = " << exactorder << std::endl;
463  std::cout << "mode = " << mode << std::endl;
464  std::cout << "exact = " << exact << std::endl;
465  std::cout << "sum = " << sum << std::endl << std::endl;
466  }
467 
468  LIBMESH_ASSERT_REALS_EQUAL( exact , sum , quadrature_tolerance );
469  }
470  }
471 
472 
473 
474  //-------------------------------------------------------
475  // 2D Quadrature Rule Test
476  template <QuadratureType qtype, Order order, unsigned int exactorder>
478  {
479  std::unique_ptr<QBase> qrule = QBase::build(qtype, 2, order);
480  qrule->init (QUAD8);
481 
482  for (unsigned int modex=0; modex <= exactorder; ++modex)
483  for (unsigned int modey=0; modey <= exactorder; ++modey)
484  {
485  Real sum = 0;
486 
487  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
488  sum += qrule->w(qp)
489  * std::pow(qrule->qp(qp)(0), static_cast<Real>(modex))
490  * std::pow(qrule->qp(qp)(1), static_cast<Real>(modey));
491 
492  const Real exactx = (modex % 2) ?
493  0 : (Real(2.0) / (modex+1));
494 
495  const Real exacty = (modey % 2) ?
496  0 : (Real(2.0) / (modey+1));
497 
498  const Real exact = exactx*exacty;
499 
500  LIBMESH_ASSERT_REALS_EQUAL( exact , sum , quadrature_tolerance );
501  }
502 
503  // We may eventually support Gauss-Lobatto type quadrature on triangles...
504  if (qtype != QGAUSS_LOBATTO)
505  {
506  qrule->init (TRI6);
507 
508  Real sum = 0;
509 
510  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
511  sum += qrule->w(qp);
512 
513  LIBMESH_ASSERT_REALS_EQUAL( 0.5 , sum , quadrature_tolerance );
514  }
515  }
516 
517 
518 
519  //-------------------------------------------------------
520  // 3D Gauss Rule Test
521  template <QuadratureType qtype, Order order, unsigned int exactorder>
523  {
524  std::unique_ptr<QBase> qrule = QBase::build(qtype, 3, order);
525  qrule->init (HEX20);
526 
527  for (unsigned int modex=0; modex <= exactorder; ++modex)
528  for (unsigned int modey=0; modey <= exactorder; ++modey)
529  for (unsigned int modez=0; modez <= exactorder; ++modez)
530  {
531  Real sum = 0;
532 
533  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
534  sum += qrule->w(qp)
535  * std::pow(qrule->qp(qp)(0), static_cast<Real>(modex))
536  * std::pow(qrule->qp(qp)(1), static_cast<Real>(modey))
537  * std::pow(qrule->qp(qp)(2), static_cast<Real>(modez));
538 
539  const Real exactx = (modex % 2) ?
540  0 : (Real(2.0) / (modex+1));
541 
542  const Real exacty = (modey % 2) ?
543  0 : (Real(2.0) / (modey+1));
544 
545  const Real exactz = (modez % 2) ?
546  0 : (Real(2.0) / (modez+1));
547 
548  const Real exact = exactx*exacty*exactz;
549 
550  LIBMESH_ASSERT_REALS_EQUAL( exact , sum , quadrature_tolerance );
551  }
552 
553  // We may eventually support Gauss-Lobatto type quadrature on tets and prisms...
554  if (qtype != QGAUSS_LOBATTO)
555  {
556  qrule->init (TET10);
557 
558  Real sum = 0;
559 
560  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
561  sum += qrule->w(qp);
562 
563  LIBMESH_ASSERT_REALS_EQUAL( 1/Real(6), sum , quadrature_tolerance );
564 
565  qrule->init (PRISM15);
566 
567  sum = 0;
568 
569  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
570  sum += qrule->w(qp);
571 
572  LIBMESH_ASSERT_REALS_EQUAL( 1., sum , quadrature_tolerance );
573  }
574  }
575 };
576 
libMesh::HEX20
Definition: enum_elem_type.h:48
QuadratureTest::test3DWeights
void test3DWeights()
Definition: quadrature_test.C:522
libMesh::QMONOMIAL
Definition: enum_quadrature_type.h:41
QuadratureTest::tearDown
void tearDown()
Definition: quadrature_test.C:124
QuadratureTest::test2DWeights
void test2DWeights()
Definition: quadrature_test.C:477
libMesh::QCLOUGH
Definition: enum_quadrature_type.h:44
QuadratureTest::setUp
void setUp()
Definition: quadrature_test.C:121
libMesh::HEX8
Definition: enum_elem_type.h:47
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TET10
Definition: enum_elem_type.h:46
QuadratureTest::testJacobi
void testJacobi()
Definition: quadrature_test.C:349
libMesh::QuadratureType
QuadratureType
Defines an enum for currently available quadrature rules.
Definition: enum_quadrature_type.h:33
std::sqrt
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
QuadratureTest::quadrature_tolerance
Real quadrature_tolerance
Definition: quadrature_test.C:117
libMesh::SECOND
Definition: enum_order.h:43
libMesh::QGAUSS
Definition: enum_quadrature_type.h:34
libMesh::QBase::build
static std::unique_ptr< QBase > build(const std::string &name, const unsigned int dim, const Order order=INVALID_ORDER)
Builds a specific quadrature rule based on the name string.
Definition: quadrature_build.C:41
libMesh::TET4
Definition: enum_elem_type.h:45
libMesh::QSIMPSON
Definition: enum_quadrature_type.h:37
libMesh::PRISM15
Definition: enum_elem_type.h:51
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
QuadratureTest::testBuild
void testBuild()
Definition: quadrature_test.C:423
libMesh::QTRAP
Definition: enum_quadrature_type.h:38
libMesh::QNODAL
Definition: enum_quadrature_type.h:46
libMesh::Utility::iota
void iota(ForwardIter first, ForwardIter last, T value)
Utility::iota is a duplication of the SGI STL extension std::iota.
Definition: utility.h:105
libMesh::QUAD4
Definition: enum_elem_type.h:41
libMesh::TRI3
Definition: enum_elem_type.h:39
QuadratureTest
Definition: quadrature_test.C:57
std::pow
double pow(double a, int b)
Definition: libmesh_augment_std_namespace.h:58
libMesh::Utility::enum_to_string
std::string enum_to_string(const T e)
QuadratureTest::testTriQuadrature
void testTriQuadrature()
Definition: quadrature_test.C:276
libMesh::TRI6
Definition: enum_elem_type.h:40
libMesh::QGAUSS_LOBATTO
Definition: enum_quadrature_type.h:43
libMesh::QJACOBI_1_0
Definition: enum_quadrature_type.h:35
QuadratureTest::test1DWeights
void test1DWeights()
Definition: quadrature_test.C:443
libmesh_cppunit.h
libMesh::EDGE3
Definition: enum_elem_type.h:36
libMesh::QJACOBI_2_0
Definition: enum_quadrature_type.h:36
QuadratureTest::testTetQuadrature
void testTetQuadrature()
Definition: quadrature_test.C:189
libMesh::THIRD
Definition: enum_order.h:44
CPPUNIT_TEST_SUITE_REGISTRATION
CPPUNIT_TEST_SUITE_REGISTRATION(QuadratureTest)
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
QuadratureTest::testMonomialQuadrature
void testMonomialQuadrature()
Definition: quadrature_test.C:127
libMesh::QCONICAL
Definition: enum_quadrature_type.h:42
libMesh::FIRST
Definition: enum_order.h:42
libMesh::EDGE2
Definition: enum_elem_type.h:35
libMesh::QUAD8
Definition: enum_elem_type.h:42
libMesh::ElemType
ElemType
Defines an enum for geometric element types.
Definition: enum_elem_type.h:33
libMesh::QGRUNDMANN_MOLLER
Definition: enum_quadrature_type.h:40
libMesh::QGRID
Definition: enum_quadrature_type.h:39