MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
intrules.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2026, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_INTRULES
13#define MFEM_INTRULES
14
15#include "../config/config.hpp"
16#include "../general/array.hpp"
17#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
18#include <omp.h>
19#endif
20
21#include <vector>
22#include <map>
23
24namespace mfem
25{
26
27class KnotVector;
28class Mesh;
29
30/* Classes for IntegrationPoint, IntegrationRule, and container class
31 IntegrationRules. Declares the global variable IntRules */
32
33/// Class for integration point with weight
35{
36public:
38 int index;
39
40 void Init(int const i)
41 {
42 x = y = z = weight = 0.0;
43 index = i;
44 }
45
46 void Set3w(const real_t x1, const real_t x2, const real_t x3, const real_t w)
47 { x = x1; y = x2; z = x3; weight = w; }
48 void Set2w(const real_t x1, const real_t x2, const real_t w)
49 { x = x1; y = x2; weight = w; }
50 void Set1w(const real_t x1, const real_t w)
51 { x = x1; weight = w; }
52
53 void Set3w(const real_t *p) { Set3w(p[0], p[1], p[2], p[3]); }
54 void Set2w(const real_t *p) { Set2w(p[0], p[1], p[2]); }
55 void Set1w(const real_t *p) { Set1w(p[0], p[1]); }
56
57 void Set3(const real_t x1, const real_t x2, const real_t x3)
58 { x = x1; y = x2; z = x3; }
59 void Set2(const real_t x1, const real_t x2)
60 { x = x1; y = x2; }
61 void Set1(const real_t x1)
62 { x = x1; }
63
64 void Set3(const real_t *p) { Set3(p[0], p[1], p[2]); }
65 void Set2(const real_t *p) { Set2(p[0], p[1]); }
66 void Set1(const real_t *p) { Set1(p[0]); }
67
68 void Set(const real_t x1, const real_t x2, const real_t x3, const real_t w)
69 { Set3w(x1, x2, x3, w); }
70
71 void Set(const real_t *p, const int dim)
72 {
73 MFEM_ASSERT(1 <= dim && dim <= 3, "invalid dim: " << dim);
74 switch (dim)
75 {
76 case 3: Set3(p); break;
77 case 2: Set2(p); break;
78 case 1: Set1(p); break;
79 }
80 }
81
82 void Get(real_t *p, const int dim) const
83 {
84 MFEM_ASSERT(1 <= dim && dim <= 3, "invalid dim: " << dim);
85 switch (dim)
86 {
87 case 3: p[2] = z;
88 case 2: p[1] = y;
89 case 1: p[0] = x;
90 }
91 }
92};
93
94/// Class for an integration rule - an Array of IntegrationPoint.
95class IntegrationRule : public Array<IntegrationPoint>
96{
97private:
98 friend class IntegrationRules;
99 int Order = 0;
100 /** @brief The quadrature weights gathered as a contiguous array. Created
101 by request with the method GetWeights(). */
102 mutable Array<real_t> weights;
103
104 /// Define n-simplex rule (triangle/tetrahedron for n=2/3) of order (2s+1)
105 void GrundmannMollerSimplexRule(int s, int n = 3);
106
107 void AddTriMidPoint(const int off, const real_t weight)
108 { IntPoint(off).Set2w(1./3., 1./3., weight); }
109
110 void AddTriPoints3(const int off, const real_t a, const real_t b,
111 const real_t weight)
112 {
113 IntPoint(off + 0).Set2w(a, a, weight);
114 IntPoint(off + 1).Set2w(a, b, weight);
115 IntPoint(off + 2).Set2w(b, a, weight);
116 }
117
118 void AddTriPoints3(const int off, const real_t a, const real_t weight)
119 { AddTriPoints3(off, a, 1. - 2.*a, weight); }
120
121 void AddTriPoints3b(const int off, const real_t b, const real_t weight)
122 { AddTriPoints3(off, (1. - b)/2., b, weight); }
123
124 void AddTriPoints6(const int off, const real_t a, const real_t b,
125 const real_t c, const real_t weight)
126 {
127 IntPoint(off + 0).Set2w(a, b, weight);
128 IntPoint(off + 1).Set2w(b, a, weight);
129 IntPoint(off + 2).Set2w(a, c, weight);
130 IntPoint(off + 3).Set2w(c, a, weight);
131 IntPoint(off + 4).Set2w(b, c, weight);
132 IntPoint(off + 5).Set2w(c, b, weight);
133 }
134
135 void AddTriPoints6(const int off, const real_t a, const real_t b,
136 const real_t weight)
137 { AddTriPoints6(off, a, b, 1. - a - b, weight); }
138
139 // add the permutations of (a,a,b)
140 void AddTetPoints3(const int off, const real_t a, const real_t b,
141 const real_t weight)
142 {
143 IntPoint(off + 0).Set(a, a, b, weight);
144 IntPoint(off + 1).Set(a, b, a, weight);
145 IntPoint(off + 2).Set(b, a, a, weight);
146 }
147
148 // add the permutations of (a,b,c)
149 void AddTetPoints6(const int off, const real_t a, const real_t b,
150 const real_t c, const real_t weight)
151 {
152 IntPoint(off + 0).Set(a, b, c, weight);
153 IntPoint(off + 1).Set(a, c, b, weight);
154 IntPoint(off + 2).Set(b, c, a, weight);
155 IntPoint(off + 3).Set(b, a, c, weight);
156 IntPoint(off + 4).Set(c, a, b, weight);
157 IntPoint(off + 5).Set(c, b, a, weight);
158 }
159
160 void AddTetMidPoint(const int off, const real_t weight)
161 { IntPoint(off).Set(0.25, 0.25, 0.25, weight); }
162
163 // given a, add the permutations of (a,a,a,b), where 3*a + b = 1
164 void AddTetPoints4(const int off, const real_t a, const real_t weight)
165 {
166 IntPoint(off).Set(a, a, a, weight);
167 AddTetPoints3(off + 1, a, 1. - 3.*a, weight);
168 }
169
170 // add the permutations of (a,a,b,b), 2*(a + b) = 1
171 void AddTetPoints6(const int off, const real_t a, const real_t weight)
172 {
173 const real_t b = 0.5 - a;
174 AddTetPoints3(off, a, b, weight);
175 AddTetPoints3(off + 3, b, a, weight);
176 }
177
178 // given (a,b) or (a,c), add the permutations of (a,a,b,c), 2*a + b + c = 1
179 void AddTetPoints12(const int off, const real_t a, const real_t bc,
180 const real_t weight)
181 {
182 const real_t cb = 1. - 2*a - bc;
183 AddTetPoints3(off, a, bc, weight);
184 AddTetPoints3(off + 3, a, cb, weight);
185 AddTetPoints6(off + 6, a, bc, cb, weight);
186 }
187
188 // add all 24 permutations of (a,b,c,d) where a+b+c+d = 1, all distinct
189 void AddTetPoints24(const int off, const real_t a, const real_t b,
190 const real_t c, const real_t weight)
191 {
192 const real_t d = 1. - a - b - c;
193 // all 24 permutations of 4 distinct barycentric coordinates
194 // permuting which coordinate goes to x, y, z (4th is 1-x-y-z)
195 IntPoint(off + 0).Set(a, b, c, weight);
196 IntPoint(off + 1).Set(a, b, d, weight);
197 IntPoint(off + 2).Set(a, c, b, weight);
198 IntPoint(off + 3).Set(a, c, d, weight);
199 IntPoint(off + 4).Set(a, d, b, weight);
200 IntPoint(off + 5).Set(a, d, c, weight);
201 IntPoint(off + 6).Set(b, a, c, weight);
202 IntPoint(off + 7).Set(b, a, d, weight);
203 IntPoint(off + 8).Set(b, c, a, weight);
204 IntPoint(off + 9).Set(b, c, d, weight);
205 IntPoint(off + 10).Set(b, d, a, weight);
206 IntPoint(off + 11).Set(b, d, c, weight);
207 IntPoint(off + 12).Set(c, a, b, weight);
208 IntPoint(off + 13).Set(c, a, d, weight);
209 IntPoint(off + 14).Set(c, b, a, weight);
210 IntPoint(off + 15).Set(c, b, d, weight);
211 IntPoint(off + 16).Set(c, d, a, weight);
212 IntPoint(off + 17).Set(c, d, b, weight);
213 IntPoint(off + 18).Set(d, a, b, weight);
214 IntPoint(off + 19).Set(d, a, c, weight);
215 IntPoint(off + 20).Set(d, b, a, weight);
216 IntPoint(off + 21).Set(d, b, c, weight);
217 IntPoint(off + 22).Set(d, c, a, weight);
218 IntPoint(off + 23).Set(d, c, b, weight);
219 }
220
221public:
224
225 /// Construct an integration rule with given number of points
226 explicit IntegrationRule(int NP) :
228 {
229 for (int i = 0; i < this->Size(); i++)
230 {
231 (*this)[i].Init(i);
232 }
233 }
234
235 /// Sets the indices of each quadrature point on initialization.
236 /** Note that most calls to IntegrationRule::SetSize should be paired with a
237 call to SetPointIndices in order for the indices to be set correctly. */
238 void SetPointIndices();
239
240 /// Tensor product of two 1D integration rules
242
243 /// Tensor product of three 1D integration rules
245 IntegrationRule &irz);
246
247 /// Returns the order of the integration rule
248 int GetOrder() const { return Order; }
249
250 /** @brief Sets the order of the integration rule. This is only for keeping
251 order information, it does not alter any data in the IntegrationRule. */
252 void SetOrder(const int order) { Order = order; }
253
254 /// Returns the number of the points in the integration rule
255 int GetNPoints() const { return Size(); }
256
257 /// Returns a reference to the i-th integration point
258 IntegrationPoint &IntPoint(int i) { return (*this)[i]; }
259
260 /// Returns a const reference to the i-th integration point
261 const IntegrationPoint &IntPoint(int i) const { return (*this)[i]; }
262
263 /// Return the quadrature weights in a contiguous array.
264 /** If a contiguous array is not required, the weights can be accessed with
265 a call like this: `IntPoint(i).weight`. */
266 const Array<real_t> &GetWeights() const;
267
268 /// @brief Return an integration rule for KnotVector @a kv, defined by
269 /// applying this rule on each knot interval.
271
272 /** @brief Returns an integration rule such that the new IntegrationPoints
273 * are re-ordered based on @a ordering.
274 *
275 * @details In the new integration rule, ip_new[i] = ip_old[ordering[i]]
276 */
277 IntegrationRule Reorder(const Array<int> &ordering) const;
278
279 /// Destroys an IntegrationRule object
281};
282
283/// Class for defining different integration rules on each NURBS patch.
285{
286public:
287 /// Construct a rule for each patch, using SetPatchRules1D.
288 NURBSMeshRules(const int numPatches, const int dim_) :
289 patchRules1D(numPatches, dim_),
290 npatches(numPatches), dim(dim_) { }
291
292 /// Returns a rule for the element.
293 IntegrationRule &GetElementRule(const int elem, const int patch,
294 const int *ijk,
295 Array<const KnotVector*> const& kv) const;
296
297 /// Add a rule to be used for individual elements. Returns the rule index.
298 std::size_t AddElementRule(IntegrationRule *ir_element)
299 {
300 elementRule.push_back(ir_element);
301 return elementRule.size() - 1;
302 }
303
304 /// @brief Set the integration rule for the element of the given index. This
305 /// rule is used instead of the rule for the patch containing the element.
306 void SetElementRule(const std::size_t element,
307 const std::size_t elementRuleIndex)
308 {
309 elementToRule[element] = elementRuleIndex;
310 }
311
312 /// @brief Set 1D integration rules to be used as a tensor product rule on
313 /// the patch with index @a patch. This class takes ownership of these rules.
314 void SetPatchRules1D(const int patch,
315 std::vector<const IntegrationRule*> & ir1D);
316
317 /// @brief For tensor product rules defined on each patch by
318 /// SetPatchRules1D(), return a pointer to the 1D rule in the specified
319 /// @a dimension.
320 const IntegrationRule* GetPatchRule1D(const int patch,
321 const int dimension) const
322 {
323 return patchRules1D(patch, dimension);
324 }
325
326 /// @brief For tensor product rules defined on each patch by
327 /// SetPatchRules1D(), return the integration point with index (i,j,k).
328 void GetIntegrationPointFrom1D(const int patch, int i, int j, int k,
329 IntegrationPoint & ip);
330
331 /// @brief Finalize() must be called before this class can be used for
332 /// assembly. In particular, it defines data used by GetPointElement().
333 void Finalize(Mesh const& mesh);
334
335 /// @brief For tensor product rules defined on each patch by
336 /// SetPatchRules1D(), returns the index of the element containing
337 /// integration point (i,j,k) for patch index @a patch. Finalize() must be
338 /// called first.
339 int GetPointElement(int patch, int i, int j, int k) const
340 {
341 return pointToElem[patch](i,j,k);
342 }
343
344 int GetDim() const { return dim; }
345
346 /// @brief For tensor product rules defined on each patch by
347 /// SetPatchRules1D(), returns an array of knot span indices for each
348 /// integration point in the specified @a dimension.
349 const Array<int>& GetPatchRule1D_KnotSpan(const int patch,
350 const int dimension) const
351 {
352 return patchRules1D_KnotSpan[patch][dimension];
353 }
354
356
357private:
358 /// Tensor-product rules defined on all patches independently.
360
361 /// Integration rules defined on elements.
362 std::vector<IntegrationRule*> elementRule;
363
364 std::map<std::size_t, std::size_t> elementToRule;
365
366 std::vector<Array3D<int>> pointToElem;
367 std::vector<std::vector<Array<int>>> patchRules1D_KnotSpan;
368
369#ifndef MFEM_THREAD_SAFE
370 // This is a temporary quadrature rule for integrating over the
371 // current element in an assembly loop. It may be modified when
372 // moving to a new element, and is therefore not thread-safe.
373 mutable IntegrationRule temporaryElementRule;
374#endif
375
376 const int npatches;
377 const int dim;
378};
379
380/// A Class that defines 1-D numerical quadrature rules on [0,1].
382{
383public:
384 /** @name Methods for calculating quadrature rules.
385 These methods calculate the actual points and weights for the different
386 types of quadrature rules. */
387 ///@{
388 static void GaussJacobi(const int np, const real_t alpha, const real_t beta,
389 IntegrationRule* ir);
390 static void GaussLegendre(const int np, IntegrationRule* ir);
391 static void GaussLobatto(const int np, IntegrationRule *ir);
392 static void OpenUniform(const int np, IntegrationRule *ir);
393 static void ClosedUniform(const int np, IntegrationRule *ir);
394 static void OpenHalfUniform(const int np, IntegrationRule *ir);
395 static void ClosedGL(const int np, IntegrationRule *ir);
396 ///@}
397
398 /// A helper function that will play nice with Poly_1D::OpenPoints and
399 /// Poly_1D::ClosedPoints
400 static void GivePolyPoints(const int np, real_t *pts, const int type);
401
402private:
403 static void CalculateUniformWeights(IntegrationRule *ir, const int type);
404};
405
406/// A class container for 1D quadrature type constants.
408{
409public:
410 enum
411 {
415 OpenUniform = 2, ///< aka open Newton-Cotes
416 ClosedUniform = 3, ///< aka closed Newton-Cotes
417 OpenHalfUniform = 4, ///< aka "open half" Newton-Cotes
418 ClosedGL = 5 ///< aka closed Gauss Legendre
419 };
420 /** @brief If the Quadrature1D type is not closed return Invalid; otherwise
421 return type. */
422 static int CheckClosed(int type);
423 /** @brief If the Quadrature1D type is not open return Invalid; otherwise
424 return type. */
425 static int CheckOpen(int type);
426};
427
428/// Container class for integration rules
430{
431private:
432 /// Taken from the Quadrature1D class anonymous enum
433 /// Determines the type of numerical quadrature used for
434 /// segment, square, and cube geometries
435 const int quad_type;
436
437 int own_rules, refined;
438
439 Array<IntegrationRule *> PointIntRules;
440 Array<IntegrationRule *> SegmentIntRules;
441 Array<IntegrationRule *> TriangleIntRules;
442 Array<IntegrationRule *> SquareIntRules;
443 Array<IntegrationRule *> TetrahedronIntRules;
444 Array<IntegrationRule *> PyramidIntRules;
445 Array<IntegrationRule *> PrismIntRules;
446 Array<IntegrationRule *> CubeIntRules;
447
448#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
449 Array<omp_lock_t> IntRuleLocks;
450#endif
451
452 void AllocIntRule(Array<IntegrationRule *> &ir_array, int Order) const
453 {
454 if (ir_array.Size() <= Order)
455 {
456 ir_array.SetSize(Order + 1, NULL);
457 }
458 }
459 bool HaveIntRule(Array<IntegrationRule *> &ir_array, int Order) const
460 {
461 return (ir_array.Size() > Order && ir_array[Order] != NULL);
462 }
463 int GetSegmentRealOrder(int Order) const
464 {
465 return Order | 1; // valid for all quad_type's
466 }
467 void DeleteIntRuleArray(Array<IntegrationRule *> &ir_array) const;
468
469 /// The following methods allocate new IntegrationRule objects without
470 /// checking if they already exist. To avoid memory leaks use
471 /// IntegrationRules::Get(int GeomType, int Order) instead.
472 IntegrationRule *GenerateIntegrationRule(int GeomType, int Order);
473 IntegrationRule *PointIntegrationRule(int Order);
474 IntegrationRule *SegmentIntegrationRule(int Order);
475 IntegrationRule *TriangleIntegrationRule(int Order);
476 IntegrationRule *SquareIntegrationRule(int Order);
477 IntegrationRule *TetrahedronIntegrationRule(int Order);
478 IntegrationRule *PyramidIntegrationRule(int Order);
479 IntegrationRule *PrismIntegrationRule(int Order);
480 IntegrationRule *CubeIntegrationRule(int Order);
481
482public:
483 /// Sets initial sizes for the integration rule arrays, but rules
484 /// are defined the first time they are requested with the Get method.
485 explicit IntegrationRules(int ref = 0,
486 int type = Quadrature1D::GaussLegendre);
487
488 /// Returns an integration rule for given GeomType and Order.
489 const IntegrationRule &Get(int GeomType, int Order);
490
491 void Set(int GeomType, int Order, IntegrationRule &IntRule);
492
493 void SetOwnRules(int o) { own_rules = o; }
494
495 /// Destroys an IntegrationRules object
497};
498
499/// Container class for integration rules
501{
502private:
503 Array<IntegrationRule *> SquareStroudIntRules;
504 Array<IntegrationRule *> TriangleStroudIntRules;
505 Array<IntegrationRule *> CubeStroudIntRules;
506 Array<IntegrationRule *> TetrahedronStroudIntRules;
507
508#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
509 Array<omp_lock_t> IntRuleLocks;
510#endif
511
512 void AllocIntRule(Array<IntegrationRule *> &ir_array, int Order) const
513 {
514 if (ir_array.Size() <= Order)
515 {
516 ir_array.SetSize(Order + 1, NULL);
517 }
518 }
519 bool HaveIntRule(Array<IntegrationRule *> &ir_array, int Order) const
520 {
521 return (ir_array.Size() > Order && ir_array[Order] != NULL);
522 }
523 int GetSegmentRealOrder(int Order) const
524 {
525 return Order | 1; // valid for all quad_type's
526 }
527 void DeleteIntRuleArray(Array<IntegrationRule *> &ir_array) const;
528
529 /// The following methods allocate new IntegrationRule objects without
530 /// checking if they already exist. To avoid memory leaks use
531 /// IntegrationRules::Get(int GeomType, int Order) instead.
532 IntegrationRule *GenerateIntegrationRule(int GeomType, int Order);
533 IntegrationRule *TriangleStroudIntegrationRule(int Order);
534 IntegrationRule *TetrahedronStroudIntegrationRule(int Order);
535
536public:
537 /// Sets initial sizes for the integration rule arrays, but rules
538 /// are defined the first time they are requested with the Get method.
539 explicit StroudIntegrationRules();
540
541 /// Returns a Stroud integration rule for given GeomType and Order.
542 const IntegrationRule &Get(int GeomType, int Order);
543
544 /// Destroys an StroudIntegrationRules object
546};
547
548/// A global object with all integration rules (defined in intrules.cpp)
549extern MFEM_EXPORT IntegrationRules IntRules;
550
551/// A global object with all refined integration rules
553
554/// A global object with all Stroud integration rules (defined in intrules.cpp)
555extern MFEM_EXPORT StroudIntegrationRules StroudIntRules;
556
557/// Duffy Transformation of 2D and 3D tensor product rules of the form
558/// $X(t) = \sum_{i=1}^{d+1} \lambda_i(t) * x_i$, where $x_i$ are the vertices
559/// of the simplex and $\lambda_i = t_i * (1-\lambda_1-...-\lambda_{i-1})$, with
560/// $t$ being the coordinates in the unit square/cube. This function is used only
561/// in the partial assembly of Bernstein elements on simplices and does NOT
562/// modify the quadrature weights.
564}
565
566#endif
Dynamic 2D array using row-major layout.
Definition array.hpp:459
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition array.hpp:869
Class for integration point with weight.
Definition intrules.hpp:35
void Set1(const real_t x1)
Definition intrules.hpp:61
void Get(real_t *p, const int dim) const
Definition intrules.hpp:82
void Set(const real_t *p, const int dim)
Definition intrules.hpp:71
void Set2w(const real_t *p)
Definition intrules.hpp:54
void Init(int const i)
Definition intrules.hpp:40
void Set2w(const real_t x1, const real_t x2, const real_t w)
Definition intrules.hpp:48
void Set2(const real_t *p)
Definition intrules.hpp:65
void Set3(const real_t *p)
Definition intrules.hpp:64
void Set1w(const real_t x1, const real_t w)
Definition intrules.hpp:50
void Set3w(const real_t *p)
Definition intrules.hpp:53
void Set1(const real_t *p)
Definition intrules.hpp:66
void Set2(const real_t x1, const real_t x2)
Definition intrules.hpp:59
void Set1w(const real_t *p)
Definition intrules.hpp:55
void Set3w(const real_t x1, const real_t x2, const real_t x3, const real_t w)
Definition intrules.hpp:46
void Set(const real_t x1, const real_t x2, const real_t x3, const real_t w)
Definition intrules.hpp:68
void Set3(const real_t x1, const real_t x2, const real_t x3)
Definition intrules.hpp:57
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:96
IntegrationRule Reorder(const Array< int > &ordering) const
Returns an integration rule such that the new IntegrationPoints are re-ordered based on ordering.
Definition intrules.cpp:239
~IntegrationRule()
Destroys an IntegrationRule object.
Definition intrules.hpp:280
IntegrationRule(int NP)
Construct an integration rule with given number of points.
Definition intrules.hpp:226
int GetOrder() const
Returns the order of the integration rule.
Definition intrules.hpp:248
const IntegrationPoint & IntPoint(int i) const
Returns a const reference to the i-th integration point.
Definition intrules.hpp:261
int GetNPoints() const
Returns the number of the points in the integration rule.
Definition intrules.hpp:255
IntegrationRule * ApplyToKnotIntervals(KnotVector const &kv) const
Return an integration rule for KnotVector kv, defined by applying this rule on each knot interval.
Definition intrules.cpp:193
const Array< real_t > & GetWeights() const
Return the quadrature weights in a contiguous array.
Definition intrules.cpp:98
void SetOrder(const int order)
Sets the order of the integration rule. This is only for keeping order information,...
Definition intrules.hpp:252
void SetPointIndices()
Sets the indices of each quadrature point on initialization.
Definition intrules.cpp:111
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Definition intrules.hpp:258
Container class for integration rules.
Definition intrules.hpp:430
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
IntegrationRules(int ref=0, int type=Quadrature1D::GaussLegendre)
void SetOwnRules(int o)
Definition intrules.hpp:493
void Set(int GeomType, int Order, IntegrationRule &IntRule)
~IntegrationRules()
Destroys an IntegrationRules object.
A vector of knots in one dimension, with B-spline basis functions of a prescribed order.
Definition nurbs.hpp:38
Mesh data type.
Definition mesh.hpp:67
Class for defining different integration rules on each NURBS patch.
Definition intrules.hpp:285
const IntegrationRule * GetPatchRule1D(const int patch, const int dimension) const
For tensor product rules defined on each patch by SetPatchRules1D(), return a pointer to the 1D rule ...
Definition intrules.hpp:320
void Finalize(Mesh const &mesh)
Finalize() must be called before this class can be used for assembly. In particular,...
NURBSMeshRules(const int numPatches, const int dim_)
Construct a rule for each patch, using SetPatchRules1D.
Definition intrules.hpp:288
int GetPointElement(int patch, int i, int j, int k) const
For tensor product rules defined on each patch by SetPatchRules1D(), returns the index of the element...
Definition intrules.hpp:339
void SetPatchRules1D(const int patch, std::vector< const IntegrationRule * > &ir1D)
Set 1D integration rules to be used as a tensor product rule on the patch with index patch....
const Array< int > & GetPatchRule1D_KnotSpan(const int patch, const int dimension) const
For tensor product rules defined on each patch by SetPatchRules1D(), returns an array of knot span in...
Definition intrules.hpp:349
void GetIntegrationPointFrom1D(const int patch, int i, int j, int k, IntegrationPoint &ip)
For tensor product rules defined on each patch by SetPatchRules1D(), return the integration point wit...
void SetElementRule(const std::size_t element, const std::size_t elementRuleIndex)
Set the integration rule for the element of the given index. This rule is used instead of the rule fo...
Definition intrules.hpp:306
IntegrationRule & GetElementRule(const int elem, const int patch, const int *ijk, Array< const KnotVector * > const &kv) const
Returns a rule for the element.
std::size_t AddElementRule(IntegrationRule *ir_element)
Add a rule to be used for individual elements. Returns the rule index.
Definition intrules.hpp:298
A class container for 1D quadrature type constants.
Definition intrules.hpp:408
static int CheckOpen(int type)
If the Quadrature1D type is not open return Invalid; otherwise return type.
@ ClosedUniform
aka closed Newton-Cotes
Definition intrules.hpp:416
@ ClosedGL
aka closed Gauss Legendre
Definition intrules.hpp:418
@ OpenHalfUniform
aka "open half" Newton-Cotes
Definition intrules.hpp:417
@ OpenUniform
aka open Newton-Cotes
Definition intrules.hpp:415
static int CheckClosed(int type)
If the Quadrature1D type is not closed return Invalid; otherwise return type.
A Class that defines 1-D numerical quadrature rules on [0,1].
Definition intrules.hpp:382
static void GaussLegendre(const int np, IntegrationRule *ir)
Definition intrules.cpp:620
static void ClosedUniform(const int np, IntegrationRule *ir)
Definition intrules.cpp:856
static void OpenUniform(const int np, IntegrationRule *ir)
Definition intrules.cpp:840
static void ClosedGL(const int np, IntegrationRule *ir)
Definition intrules.cpp:891
static void GaussJacobi(const int np, const real_t alpha, const real_t beta, IntegrationRule *ir)
Definition intrules.cpp:488
static void GivePolyPoints(const int np, real_t *pts, const int type)
Definition intrules.cpp:913
static void OpenHalfUniform(const int np, IntegrationRule *ir)
Definition intrules.cpp:876
static void GaussLobatto(const int np, IntegrationRule *ir)
Definition intrules.cpp:708
Container class for integration rules.
Definition intrules.hpp:501
~StroudIntegrationRules()
Destroys an StroudIntegrationRules object.
const IntegrationRule & Get(int GeomType, int Order)
Returns a Stroud integration rule for given GeomType and Order.
const real_t alpha
Definition ex15.cpp:369
int dim
Definition ex24.cpp:53
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
Definition hooke.cpp:45
real_t b
Definition lissajous.cpp:42
real_t a
Definition lissajous.cpp:41
real_t weight(const Vector &x)
mfem::real_t real_t
StroudIntegrationRules StroudIntRules
A global object with all Stroud integration rules (defined in intrules.cpp)
IntegrationRule DuffyTrans(const IntegrationRule &ir, int dim)
Definition intrules.cpp:256
float real_t
Definition config.hpp:46
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
Definition intrules.hpp:552
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
Definition intrules.hpp:549
real_t p(const Vector &x, real_t t)
void pts(int iphi, int t, real_t x[])