15 #include "../config/config.hpp" 16 #include "../general/array.hpp" 45 MFEM_ASSERT(1 <=
dim &&
dim <= 3,
"invalid dim: " <<
dim);
59 MFEM_ASSERT(1 <=
dim &&
dim <= 3,
"invalid dim: " <<
dim);
71 void Set(
const double x1,
const double x2,
const double x3,
const double w)
76 void Set3(
const double x1,
const double x2,
const double x3)
77 {
x = x1;
y = x2;
z = x3; }
81 void Set2w(
const double x1,
const double x2,
const double w)
86 void Set2(
const double x1,
const double x2) {
x = x1;
y = x2; }
90 void Set1w(
const double x1,
const double w) {
x = x1;
weight = w; }
106 void GrundmannMollerSimplexRule(
int s,
int n = 3);
108 void AddTriMidPoint(
const int off,
const double weight)
111 void AddTriPoints3(
const int off,
const double a,
const double b,
119 void AddTriPoints3(
const int off,
const double a,
const double weight)
120 { AddTriPoints3(off,
a, 1. - 2.*
a, weight); }
122 void AddTriPoints3b(
const int off,
const double b,
const double weight)
123 { AddTriPoints3(off, (1. -
b)/2.,
b, weight); }
125 void AddTriPoints3R(
const int off,
const double a,
const double b,
126 const double c,
const double weight)
133 void AddTriPoints3R(
const int off,
const double a,
const double b,
135 { AddTriPoints3R(off,
a,
b, 1. -
a -
b, weight); }
137 void AddTriPoints6(
const int off,
const double a,
const double b,
138 const double c,
const double weight)
148 void AddTriPoints6(
const int off,
const double a,
const double b,
150 { AddTriPoints6(off,
a,
b, 1. -
a -
b, weight); }
153 void AddTetPoints3(
const int off,
const double a,
const double b,
162 void AddTetPoints6(
const int off,
const double a,
const double b,
163 const double c,
const double weight)
173 void AddTetMidPoint(
const int off,
const double weight)
177 void AddTetPoints4(
const int off,
const double a,
const double weight)
180 AddTetPoints3(off + 1,
a, 1. - 3.*
a, weight);
184 void AddTetPoints4b(
const int off,
const double b,
const double weight)
186 const double a = (1. -
b)/3.;
188 AddTetPoints3(off + 1,
a,
b, weight);
192 void AddTetPoints6(
const int off,
const double a,
const double weight)
194 const double b = 0.5 -
a;
195 AddTetPoints3(off,
a,
b, weight);
196 AddTetPoints3(off + 3,
b,
a, weight);
200 void AddTetPoints12(
const int off,
const double a,
const double bc,
203 const double cb = 1. - 2*
a - bc;
204 AddTetPoints3(off,
a, bc, weight);
205 AddTetPoints3(off + 3,
a, cb, weight);
206 AddTetPoints6(off + 6,
a, bc, cb, weight);
210 void AddTetPoints12bc(
const int off,
const double b,
const double c,
213 const double a = (1. -
b - c)/2.;
214 AddTetPoints3(off,
a,
b, weight);
215 AddTetPoints3(off + 3,
a, c, weight);
216 AddTetPoints6(off + 6,
a,
b, c, weight);
227 for (
int i = 0; i < this->
Size(); i++)
280 patchRules1D(numPatches, dim_),
281 npatches(numPatches), dim(dim_) { }
287 bool & deleteRule)
const;
292 elementRule.push_back(ir_element);
293 return elementRule.size() - 1;
299 const std::size_t elementRuleIndex)
301 elementToRule[element] = elementRuleIndex;
307 std::vector<const IntegrationRule*> & ir1D);
333 return pointToElem[patch](i,j,k);
344 return patchRules1D_KnotSpan[patch][
dimension];
354 std::vector<IntegrationRule*> elementRule;
356 std::map<std::size_t, std::size_t> elementToRule;
358 std::vector<Array3D<int>> pointToElem;
359 std::vector<std::vector<Array<int>>> patchRules1D_KnotSpan;
386 static void CalculateUniformWeights(
IntegrationRule *ir,
const int type);
420 int own_rules, refined;
433 if (ir_array.
Size() <= Order)
435 ir_array.
SetSize(Order + 1, NULL);
440 return (ir_array.
Size() > Order && ir_array[Order] != NULL);
442 int GetSegmentRealOrder(
int Order)
const void Set(const double *p, const int dim)
int GetNPoints() const
Returns the number of the points in the integration rule.
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
static void ClosedUniform(const int np, IntegrationRule *ir)
void Set1w(const double *p)
static void GivePolyPoints(const int np, double *pts, const int type)
~IntegrationRules()
Destroys an IntegrationRules object.
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...
aka "open half" Newton-Cotes
Container class for integration rules.
void Set(const double x1, const double x2, const double x3, const double w)
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
static void OpenUniform(const int np, IntegrationRule *ir)
void Finalize(Mesh const &mesh)
Finalize() must be called before this class can be used for assembly. In particular, it defines data used by GetPointElement().
A class container for 1D quadrature type constants.
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...
IntegrationRule * ApplyToKnotIntervals(KnotVector const &kv) const
Return an integration rule for KnotVector kv, defined by applying this rule on each knot interval...
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
static void GaussLobatto(const int np, IntegrationRule *ir)
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...
void Set3(const double *p)
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
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< double > & GetWeights() const
Return the quadrature weights in a contiguous array.
int GetOrder() const
Returns the order of the integration rule.
void Get(double *p, const int dim) const
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 ...
~IntegrationRule()
Destroys an IntegrationRule object.
void Set3w(const double *p)
void Set2(const double x1, const double x2)
const IntegrationPoint & IntPoint(int i) const
Returns a const reference to the i-th integration point.
Dynamic 2D array using row-major layout.
void SetPointIndices()
Sets the indices of each quadrature point on initialization.
void Set3(const double x1, const double x2, const double x3)
NURBSMeshRules(const int numPatches, const int dim_)
Construct a rule for each patch, using SetPatchRules1D.
void Set2w(const double *p)
double p(const Vector &x, double t)
static int CheckClosed(int type)
If the Quadrature1D type is not closed return Invalid; otherwise return type.
static void OpenHalfUniform(const int np, IntegrationRule *ir)
static void ClosedGL(const int np, IntegrationRule *ir)
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
static int CheckOpen(int type)
If the Quadrature1D type is not open return Invalid; otherwise return type.
void SetOrder(const int order)
Sets the order of the integration rule. This is only for keeping order information, it does not alter any data in the IntegrationRule.
aka closed Gauss Legendre
IntegrationRules(int Ref=0, int type=Quadrature1D::GaussLegendre)
Class for integration point with weight.
std::size_t AddElementRule(IntegrationRule *ir_element)
Add a rule to be used for individual elements. Returns the rule index.
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...
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
int Size() const
Return the logical size of the array.
void Set2(const double *p)
void Set2w(const double x1, const double x2, const double w)
void pts(int iphi, int t, double x[])
IntegrationRule(int NP)
Construct an integration rule with given number of points.
IntegrationRule & GetElementRule(const int elem, const int patch, const int *ijk, Array< const KnotVector *> const &kv, bool &deleteRule) const
Returns a rule for the element.
void Set(int GeomType, int Order, IntegrationRule &IntRule)
A Class that defines 1-D numerical quadrature rules on [0,1].
void Set1w(const double x1, const double w)
static void GaussLegendre(const int np, IntegrationRule *ir)
Class for defining different integration rules on each NURBS patch.