41 for (j = 0; j < ny; j++)
44 for (i = 0; i < nx; i++)
66 for (
int iz = 0; iz < nz; ++iz)
69 for (
int iy = 0; iy < ny; ++iy)
72 for (
int ix = 0; ix < nx; ++ix)
101 for (
int i = 0; i <
Size(); i++)
107void IntegrationRule::GrundmannMollerSimplexRule(
int s,
int n)
111 const int d = 2*
s + 1;
116 for (
int i = 1; i < fact.Size(); i++)
118 fact(i) = fact(i - 1)*i;
123 for (
int i = 0; i <= n; i++)
125 np *= (
s + i + 1),
f *= (i + 1);
133 for (
int i = 0; i <=
s; i++)
137 weight = pow(2., -2*
s)*pow(
static_cast<real_t>(d + n - 2*i),
138 d)/fact(i)/fact(d + n - i);
150 IntegrationPoint &ip =
IntPoint(pt++);
170 for (j--; j >= 0; j--)
184 const int ne = kv.
GetNE();
193 for (
int e=0; e<ne; ++e)
199 x1 = kv[kv.
Size() - 1];
204 while (
id < kv.
Size() - 1)
219 const real_t x = x0 + (
s * (*this)[j].x);
220 (*kvir)[(e * np) + j].Set1w(x, (*
this)[j].weight);
233 mpfr_t pi, z, pp, p1, p2, p3, dz, w, rtol;
236 static const mpfr_rnd_t rnd = GMP_RNDN;
237 static const int default_prec = 128;
240 HP_Quadrature1D(
const int prec = default_prec)
242 mpfr_inits2(prec, pi, z, pp, p1, p2, p3, dz, w, rtol, (mpfr_ptr) 0);
243 mpfr_const_pi(pi, rnd);
244 mpfr_set_si_2exp(rtol, 1, -32, rnd);
250 void SetRelTol(
const int exponent = -32)
252 mpfr_set_si_2exp(rtol, 1, exponent, rnd);
258 void ComputeGaussLegendrePoint(
const int n,
const int k)
260 MFEM_ASSERT(n > 0 && 0 <= k && k < n,
"invalid n = " << n
261 <<
" and/or k = " << k);
263 int i = (k < (n+1)/2) ? k+1 : n-k;
268 mpfr_set_si(z, n+1-2*i, rnd);
269 mpfr_div_si(z, z, 2*n+1, rnd);
270 mpfr_mul(z, z, pi, rnd);
276 mpfr_set_si(p2, 1, rnd);
277 mpfr_set(p1, z, rnd);
278 for (
int j = 2; j <= n; j++)
280 mpfr_set(p3, p2, rnd);
281 mpfr_set(p2, p1, rnd);
283 mpfr_mul_si(p1, z, 2*j-1, rnd);
284 mpfr_mul_si(p3, p3, j-1, rnd);
285 mpfr_fms(p1, p1, p2, p3, rnd);
286 mpfr_div_si(p1, p1, j, rnd);
292 mpfr_fms(pp, z, p1, p2, rnd);
293 mpfr_mul_si(pp, pp, n, rnd);
294 mpfr_sqr(p2, z, rnd);
295 mpfr_sub_si(p2, p2, 1, rnd);
296 mpfr_div(pp, pp, p2, rnd);
301 mpfr_div(dz, p1, pp, rnd);
304 mpfr_si_sub(atol, 1, z, rnd);
305 mpfr_mul(atol, atol, rtol, rnd);
306 if (mpfr_cmpabs(dz, atol) <= 0)
312 mpfr_sub(z, z, dz, rnd);
316 mpfr_si_sub(z, 1, z, rnd);
317 mpfr_div_2si(z, z, 1, rnd);
320 mpfr_sqr(w, pp, rnd);
321 mpfr_mul_2si(w, w, 2, rnd);
322 mpfr_mul(w, w, z, rnd);
323 mpfr_si_sub(p1, 1, z, rnd);
324 mpfr_mul(w, w, p1, rnd);
325 mpfr_si_div(w, 1, w, rnd);
327 if (k >= (n+1)/2) { mpfr_swap(z, p1); }
333 void ComputeGaussLobattoPoint(
const int n,
const int k)
335 MFEM_ASSERT(n > 1 && 0 <= k && k < n,
"invalid n = " << n
336 <<
" and/or k = " << k);
338 int i = (k < (n+1)/2) ? k : n-1-k;
342 mpfr_set_si(z, 0, rnd);
343 mpfr_set_si(p1, 1, rnd);
344 mpfr_set_si(w, n*(n-1), rnd);
345 mpfr_si_div(w, 1, w, rnd);
350 mpfr_set_si(z, 2*i-n+1, rnd);
351 mpfr_div_si(z, z, 2*(n-1), rnd);
352 mpfr_mul(z, pi, z, rnd);
355 for (
int iter = 0 ; true ; ++iter)
358 mpfr_set_si(p1, 1, rnd);
359 mpfr_set(p2, z, rnd);
361 for (
int l = 1 ; l < (n-1) ; ++l)
364 mpfr_mul_si(p1, p1, l, rnd);
365 mpfr_mul_si(p3, z, 2*l+1, rnd);
366 mpfr_fms(p3, p3, p2, p1, rnd);
367 mpfr_div_si(p3, p3, l+1, rnd);
369 mpfr_set(p1, p2, rnd);
370 mpfr_set(p2, p3, rnd);
374 mpfr_fms(dz, z, p2, p1, rnd);
375 mpfr_mul_si(p3, p2, n, rnd);
376 mpfr_div(dz, dz, p3, rnd);
378 mpfr_sub(z, z, dz, rnd);
381 mpfr_add_si(atol, z, 1, rnd);
382 mpfr_mul(atol, atol, rtol, rnd);
384 if (mpfr_cmpabs(dz, atol) <= 0)
390 MFEM_VERIFY(iter < 8,
"n = " << n <<
", i = " << i
391 <<
", dz = " << mpfr_get_d(dz, rnd));
394 mpfr_add_si(z, z, 1, rnd);
395 mpfr_div_2si(z, z, 1, rnd);
397 mpfr_si_sub(p1, 1, z, rnd);
399 mpfr_sqr(w, p2, rnd);
400 mpfr_mul_si(w, w, n*(n-1), rnd);
401 mpfr_si_div(w, 1, w, rnd);
403 if (k >= (n+1)/2) { mpfr_swap(z, p1); }
406 real_t GetPoint()
const {
return mpfr_get_d(z, rnd); }
407 real_t GetSymmPoint()
const {
return mpfr_get_d(p1, rnd); }
408 real_t GetWeight()
const {
return mpfr_get_d(w, rnd); }
410 const mpfr_t &GetHPPoint()
const {
return z; }
411 const mpfr_t &GetHPSymmPoint()
const {
return p1; }
412 const mpfr_t &GetHPWeight()
const {
return w; }
416 mpfr_clears(pi, z, pp, p1, p2, p3, dz, w, rtol, (mpfr_ptr) 0);
447 const int m = (n+1)/2;
451 for (
int i = 1; i <= m; i++)
453 real_t z = cos(M_PI * (i - 0.25) / (n + 0.5));
454 real_t pp, p1, dz, xi = 0.;
460 for (
int j = 2; j <= n; j++)
464 p1 = ((2 * j - 1) * z * p2 - (j - 1) * p3) / j;
468 pp = n * (z*p1-p2) / (z*z - 1);
472#ifdef MFEM_USE_SINGLE
473 if (std::abs(dz) < 1e-7)
474#elif defined MFEM_USE_DOUBLE
475 if (std::abs(dz) < 1e-16)
477 MFEM_ABORT(
"Floating point type undefined");
478 if (std::abs(dz) < 1e-16)
483 xi = ((1 - z) + dz)/2;
498 HP_Quadrature1D hp_quad;
499 for (
int i = 1; i <= m; i++)
501 hp_quad.ComputeGaussLegendrePoint(n, i-1);
503 ir->
IntPoint(i-1).
x = hp_quad.GetPoint();
504 ir->
IntPoint(n-i).
x = hp_quad.GetSymmPoint();
557 for (
int i = 1 ; i <= (np-1)/2 ; ++i)
561 real_t x_i = std::sin(M_PI * ((
real_t)(i)/(np-1) - 0.5));
564 for (
int iter = 0 ; true ; ++iter)
570 for (
int l = 1 ; l < (np-1) ; ++l)
575 real_t p_lp1 = ( (2*l + 1)*x_i*p_l - l*p_lm1)/(l + 1);
593 real_t dx = (x_i*p_l - p_lm1) / (np*p_l);
594#ifdef MFEM_USE_SINGLE
595 if (std::abs(dx) < 1e-7)
596#elif defined MFEM_USE_DOUBLE
597 if (std::abs(dx) < 1e-16)
599 MFEM_ABORT(
"Floating point type undefined");
600 if (std::abs(dx) < 1e-16)
605 z_i = ((1.0 + x_i) - dx)/2;
609 MFEM_VERIFY(iter < 8,
"np = " << np <<
", i = " << i
622 symm_ip.
x = 1.0 - z_i;
628 HP_Quadrature1D hp_quad;
630 for (
int i = 0 ; i <= (np-1)/2 ; ++i)
632 hp_quad.ComputeGaussLobattoPoint(np, i);
634 ir->
IntPoint(np-1-i).
x = hp_quad.GetSymmPoint();
652 for (
int i = 0; i < np ; ++i)
672 for (
int i = 0; i < np ; ++i)
687 for (
int i = 0; i < np ; ++i)
708 for (
int i = 1; i < np-1; ++i)
756 MFEM_ABORT(
"Asking for an unknown type of 1D Quadrature points, "
761 for (
int i = 0 ; i < np ; ++i)
767void QuadratureFunctions1D::CalculateUniformWeights(
IntegrationRule *ir,
778 const int n = ir->
Size();
796 for (
int j = 0; j < n; j++)
800 Poly_1D::Basis basis(n-1, xv.GetData());
804 for (
int i = 0; i < m; i++)
806 const IntegrationPoint &ip = glob_ir.IntPoint(i);
807 basis.Eval(ip.x, xv);
808 w.Add(ip.weight, xv);
810 for (
int j = 0; j < n; j++)
817 static const mpfr_rnd_t rnd = HP_Quadrature1D::rnd;
818 HP_Quadrature1D hp_quad;
819 mpfr_t l, lk, w0, wi, tmp, *weights;
820 mpfr_inits2(hp_quad.default_prec, l, lk, w0, wi, tmp, (mpfr_ptr) 0);
821 weights =
new mpfr_t[n];
822 for (
int i = 0; i < n; i++)
824 mpfr_init2(weights[i], hp_quad.default_prec);
825 mpfr_set_si(weights[i], 0, rnd);
827 hp_quad.SetRelTol(-48);
830 int hinv = 0, ihoffset = 0;
852 MFEM_ABORT(
"invalid Quadrature1D type: " << type);
855 mpfr_fac_ui(w0,
p, rnd);
856 mpfr_ui_pow_ui(tmp, hinv,
p, rnd);
857 mpfr_div(w0, w0, tmp, rnd);
858 if (
p%2) { mpfr_neg(w0, w0, rnd); }
860 for (
int j = 0; j < m; j++)
862 hp_quad.ComputeGaussLegendrePoint(m, j);
867 mpfr_mul_si(tmp, hp_quad.GetHPPoint(), hinv, rnd);
868 mpfr_sub_d(tmp, tmp, 0.5*ihoffset, rnd);
869 mpfr_round(tmp, tmp);
870 int k = min(max((
int)mpfr_get_si(tmp, rnd), 0),
p);
871 mpfr_set_si(lk, 1, rnd);
872 for (
int i = 0; i <=
p; i++)
874 mpfr_set_si(tmp, 2*i+ihoffset, rnd);
875 mpfr_div_si(tmp, tmp, 2*hinv, rnd);
876 mpfr_sub(tmp, hp_quad.GetHPPoint(), tmp, rnd);
879 mpfr_mul(lk, lk, tmp, rnd);
883 mpfr_set(l, tmp, rnd);
886 mpfr_mul(l, l, lk, rnd);
887 mpfr_set(wi, w0, rnd);
888 for (
int i = 0;
true; i++)
893 mpfr_set_si(tmp, 2*i+ihoffset, rnd);
894 mpfr_div_si(tmp, tmp, 2*hinv, rnd);
895 mpfr_sub(tmp, hp_quad.GetHPPoint(), tmp, rnd);
896 mpfr_mul(tmp, tmp, wi, rnd);
897 mpfr_div(tmp, l, tmp, rnd);
902 mpfr_div(tmp, lk, wi, rnd);
905 mpfr_mul(tmp, tmp, hp_quad.GetHPWeight(), rnd);
906 mpfr_add(weights[i], weights[i], tmp, rnd);
908 if (i ==
p) {
break; }
911 mpfr_mul_si(wi, wi, i+1, rnd);
912 mpfr_div_si(wi, wi, i-
p, rnd);
915 for (
int i = 0; i < n; i++)
918 mpfr_clear(weights[i]);
921 mpfr_clears(l, lk, w0, wi, tmp, (mpfr_ptr) 0);
966 if (refined < 0) { own_rules = 0;
return; }
971 PointIntRules.SetSize(2, h_mt);
972 PointIntRules = NULL;
974 SegmentIntRules.SetSize(32, h_mt);
975 SegmentIntRules = NULL;
978 TriangleIntRules.SetSize(32, h_mt);
979 TriangleIntRules = NULL;
981 SquareIntRules.SetSize(32, h_mt);
982 SquareIntRules = NULL;
985 TetrahedronIntRules.SetSize(32, h_mt);
986 TetrahedronIntRules = NULL;
988 PyramidIntRules.SetSize(32, h_mt);
989 PyramidIntRules = NULL;
991 PrismIntRules.SetSize(32, h_mt);
992 PrismIntRules = NULL;
994 CubeIntRules.SetSize(32, h_mt);
997#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
1001 omp_init_lock(&IntRuleLocks[i]);
1022 MFEM_ABORT(
"Unknown type of reference element!");
1030#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
1031 omp_set_lock(&IntRuleLocks[GeomType]);
1034 if (!HaveIntRule(*ir_array, Order))
1038 int RealOrder = Order;
1039 while (RealOrder+1 < ir_array->
Size() && (*ir_array)[RealOrder+1] == ir)
1043 MFEM_VERIFY(RealOrder == ir->
GetOrder(),
"internal error");
1045 MFEM_CONTRACT_VAR(ir);
1049#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
1050 omp_unset_lock(&IntRuleLocks[GeomType]);
1053 return *(*ir_array)[Order];
1072 MFEM_ABORT(
"Unknown type of reference element!");
1075#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
1076 omp_set_lock(&IntRuleLocks[GeomType]);
1079 if (HaveIntRule(*ir_array, Order))
1081 MFEM_ABORT(
"Overwriting set rules is not supported!");
1084 AllocIntRule(*ir_array, Order);
1086 (*ir_array)[Order] = &IntRule;
1088#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
1089 omp_unset_lock(&IntRuleLocks[GeomType]);
1093void IntegrationRules::DeleteIntRuleArray(
1099 for (
int i = 0; i < ir_array.
Size(); i++)
1101 if (ir_array[i] != NULL && ir_array[i] != ir)
1111#if defined(MFEM_THREAD_SAFE) && defined(MFEM_USE_OPENMP)
1114 omp_destroy_lock(&IntRuleLocks[i]);
1118 if (!own_rules) {
return; }
1120 DeleteIntRuleArray(PointIntRules);
1121 DeleteIntRuleArray(SegmentIntRules);
1122 DeleteIntRuleArray(TriangleIntRules);
1123 DeleteIntRuleArray(SquareIntRules);
1124 DeleteIntRuleArray(TetrahedronIntRules);
1125 DeleteIntRuleArray(CubeIntRules);
1126 DeleteIntRuleArray(PrismIntRules);
1127 DeleteIntRuleArray(PyramidIntRules);
1131IntegrationRule *IntegrationRules::GenerateIntegrationRule(
int GeomType,
1137 return PointIntegrationRule(Order);
1139 return SegmentIntegrationRule(Order);
1141 return TriangleIntegrationRule(Order);
1143 return SquareIntegrationRule(Order);
1145 return TetrahedronIntegrationRule(Order);
1147 return CubeIntegrationRule(Order);
1149 return PrismIntegrationRule(Order);
1151 return PyramidIntegrationRule(Order);
1154 MFEM_ABORT(
"Unknown type of reference element!");
1161IntegrationRule *IntegrationRules::PointIntegrationRule(
int Order)
1165 MFEM_ABORT(
"Point Integration Rule of Order > 1 not defined");
1169 IntegrationRule *ir =
new IntegrationRule(1);
1170 ir->IntPoint(0).x = .0;
1171 ir->IntPoint(0).weight = 1.;
1174 PointIntRules[1] = PointIntRules[0] = ir;
1180IntegrationRule *IntegrationRules::SegmentIntegrationRule(
int Order)
1182 int RealOrder = GetSegmentRealOrder(Order);
1184 AllocIntRule(SegmentIntRules, RealOrder);
1186 IntegrationRule *ir =
new IntegrationRule;
1230 MFEM_ABORT(
"unknown Quadrature1D type: " << quad_type);
1236 IntegrationRule *refined_ir =
new IntegrationRule(2*n);
1237 refined_ir->SetOrder(ir->GetOrder());
1238 for (
int j = 0; j < n; j++)
1240 refined_ir->IntPoint(j).x = ir->IntPoint(j).x/2.0;
1241 refined_ir->IntPoint(j).weight = ir->IntPoint(j).weight/2.0;
1242 refined_ir->IntPoint(j+n).x = 0.5 + ir->IntPoint(j).x/2.0;
1243 refined_ir->IntPoint(j+n).weight = ir->IntPoint(j).weight/2.0;
1248 SegmentIntRules[RealOrder-1] = SegmentIntRules[RealOrder] = ir;
1253IntegrationRule *IntegrationRules::TriangleIntegrationRule(
int Order)
1255 IntegrationRule *ir = NULL;
1264 ir =
new IntegrationRule(1);
1265 ir->AddTriMidPoint(0, 0.5);
1267 TriangleIntRules[0] = TriangleIntRules[1] = ir;
1271 ir =
new IntegrationRule(3);
1272 ir->AddTriPoints3(0, 1./6., 1./6.);
1274 TriangleIntRules[2] = ir;
1279 ir =
new IntegrationRule(4);
1280 ir->AddTriMidPoint(0, -0.28125);
1281 ir->AddTriPoints3(1, 0.2, 25./96.);
1283 TriangleIntRules[3] = ir;
1287 ir =
new IntegrationRule(6);
1288 ir->AddTriPoints3(0, 0.091576213509770743460, 0.054975871827660933819);
1289 ir->AddTriPoints3(3, 0.44594849091596488632, 0.11169079483900573285);
1291 TriangleIntRules[4] = ir;
1295 ir =
new IntegrationRule(7);
1296 ir->AddTriMidPoint(0, 0.1125);
1297 ir->AddTriPoints3(1, 0.10128650732345633880, 0.062969590272413576298);
1298 ir->AddTriPoints3(4, 0.47014206410511508977, 0.066197076394253090369);
1300 TriangleIntRules[5] = ir;
1304 ir =
new IntegrationRule(12);
1305 ir->AddTriPoints3(0, 0.063089014491502228340, 0.025422453185103408460);
1306 ir->AddTriPoints3(3, 0.24928674517091042129, 0.058393137863189683013);
1307 ir->AddTriPoints6(6, 0.053145049844816947353, 0.31035245103378440542,
1308 0.041425537809186787597);
1310 TriangleIntRules[6] = ir;
1314 ir =
new IntegrationRule(12);
1315 ir->AddTriPoints3R(0, 0.062382265094402118174, 0.067517867073916085443,
1316 0.026517028157436251429);
1317 ir->AddTriPoints3R(3, 0.055225456656926611737, 0.32150249385198182267,
1318 0.043881408714446055037);
1320 ir->AddTriPoints3R(6, 0.034324302945097146470, 0.66094919618673565761,
1321 0.30472650086816719592, 0.028775042784981585738);
1322 ir->AddTriPoints3R(9, 0.51584233435359177926, 0.27771616697639178257,
1323 0.20644149867001643817, 0.067493187009802774463);
1325 TriangleIntRules[7] = ir;
1329 ir =
new IntegrationRule(16);
1330 ir->AddTriMidPoint(0, 0.0721578038388935841255455552445323);
1331 ir->AddTriPoints3(1, 0.170569307751760206622293501491464,
1332 0.0516086852673591251408957751460645);
1333 ir->AddTriPoints3(4, 0.0505472283170309754584235505965989,
1334 0.0162292488115990401554629641708902);
1335 ir->AddTriPoints3(7, 0.459292588292723156028815514494169,
1336 0.0475458171336423123969480521942921);
1337 ir->AddTriPoints6(10, 0.008394777409957605337213834539296,
1338 0.263112829634638113421785786284643,
1339 0.0136151570872174971324223450369544);
1341 TriangleIntRules[8] = ir;
1345 ir =
new IntegrationRule(19);
1346 ir->AddTriMidPoint(0, 0.0485678981413994169096209912536443);
1347 ir->AddTriPoints3b(1, 0.020634961602524744433,
1348 0.0156673501135695352684274156436046);
1349 ir->AddTriPoints3b(4, 0.12582081701412672546,
1350 0.0389137705023871396583696781497019);
1351 ir->AddTriPoints3(7, 0.188203535619032730240961280467335,
1352 0.0398238694636051265164458871320226);
1353 ir->AddTriPoints3(10, 0.0447295133944527098651065899662763,
1354 0.0127888378293490156308393992794999);
1355 ir->AddTriPoints6(13, 0.0368384120547362836348175987833851,
1356 0.2219629891607656956751025276931919,
1357 0.0216417696886446886446886446886446);
1359 TriangleIntRules[9] = ir;
1363 ir =
new IntegrationRule(25);
1364 ir->AddTriMidPoint(0, 0.0454089951913767900476432975500142);
1365 ir->AddTriPoints3b(1, 0.028844733232685245264984935583748,
1366 0.0183629788782333523585030359456832);
1367 ir->AddTriPoints3(4, 0.109481575485037054795458631340522,
1368 0.0226605297177639673913028223692986);
1369 ir->AddTriPoints6(7, 0.141707219414879954756683250476361,
1370 0.307939838764120950165155022930631,
1371 0.0363789584227100543021575883096803);
1372 ir->AddTriPoints6(13, 0.025003534762686386073988481007746,
1373 0.246672560639902693917276465411176,
1374 0.0141636212655287424183685307910495);
1375 ir->AddTriPoints6(19, 0.0095408154002994575801528096228873,
1376 0.0668032510122002657735402127620247,
1377 4.71083348186641172996373548344341E-03);
1379 TriangleIntRules[10] = ir;
1383 ir =
new IntegrationRule(28);
1384 ir->AddTriPoints6(0, 0.0,
1385 0.141129718717363295960826061941652,
1386 3.68119189165027713212944752369032E-03);
1387 ir->AddTriMidPoint(6, 0.0439886505811161193990465846607278);
1388 ir->AddTriPoints3(7, 0.0259891409282873952600324854988407,
1389 4.37215577686801152475821439991262E-03);
1390 ir->AddTriPoints3(10, 0.0942875026479224956305697762754049,
1391 0.0190407859969674687575121697178070);
1392 ir->AddTriPoints3b(13, 0.010726449965572372516734795387128,
1393 9.42772402806564602923839129555767E-03);
1394 ir->AddTriPoints3(16, 0.207343382614511333452934024112966,
1395 0.0360798487723697630620149942932315);
1396 ir->AddTriPoints3b(19, 0.122184388599015809877869236727746,
1397 0.0346645693527679499208828254519072);
1398 ir->AddTriPoints6(22, 0.0448416775891304433090523914688007,
1399 0.2772206675282791551488214673424523,
1400 0.0205281577146442833208261574536469);
1402 TriangleIntRules[11] = ir;
1406 ir =
new IntegrationRule(33);
1407 ir->AddTriPoints3b(0, 2.35652204523900E-02, 1.28655332202275E-02);
1408 ir->AddTriPoints3b(3, 1.20551215411079E-01, 2.18462722690190E-02);
1409 ir->AddTriPoints3(6, 2.71210385012116E-01, 3.14291121089425E-02);
1410 ir->AddTriPoints3(9, 1.27576145541586E-01, 1.73980564653545E-02);
1411 ir->AddTriPoints3(12, 2.13173504532100E-02, 3.08313052577950E-03);
1412 ir->AddTriPoints6(15, 1.15343494534698E-01, 2.75713269685514E-01,
1413 2.01857788831905E-02);
1414 ir->AddTriPoints6(21, 2.28383322222570E-02, 2.81325580989940E-01,
1415 1.11783866011515E-02);
1416 ir->AddTriPoints6(27, 2.57340505483300E-02, 1.16251915907597E-01,
1417 8.65811555432950E-03);
1419 TriangleIntRules[12] = ir;
1423 ir =
new IntegrationRule(37);
1424 ir->AddTriPoints3b(0, 0.0,
1425 2.67845189554543044455908674650066E-03);
1426 ir->AddTriMidPoint(3, 0.0293480398063595158995969648597808);
1427 ir->AddTriPoints3(4, 0.0246071886432302181878499494124643,
1428 3.92538414805004016372590903990464E-03);
1429 ir->AddTriPoints3b(7, 0.159382493797610632566158925635800,
1430 0.0253344765879434817105476355306468);
1431 ir->AddTriPoints3(10, 0.227900255506160619646298948153592,
1432 0.0250401630452545330803738542916538);
1433 ir->AddTriPoints3(13, 0.116213058883517905247155321839271,
1434 0.0158235572961491595176634480481793);
1435 ir->AddTriPoints3b(16, 0.046794039901841694097491569577008,
1436 0.0157462815379843978450278590138683);
1437 ir->AddTriPoints6(19, 0.0227978945382486125477207592747430,
1438 0.1254265183163409177176192369310890,
1439 7.90126610763037567956187298486575E-03);
1440 ir->AddTriPoints6(25, 0.0162757709910885409437036075960413,
1441 0.2909269114422506044621801030055257,
1442 7.99081889046420266145965132482933E-03);
1443 ir->AddTriPoints6(31, 0.0897330604516053590796290561145196,
1444 0.2723110556841851025078181617634414,
1445 0.0182757511120486476280967518782978);
1447 TriangleIntRules[13] = ir;
1451 ir =
new IntegrationRule(42);
1452 ir->AddTriPoints3b(0, 2.20721792756430E-02, 1.09417906847145E-02);
1453 ir->AddTriPoints3b(3, 1.64710561319092E-01, 1.63941767720625E-02);
1454 ir->AddTriPoints3(6, 2.73477528308839E-01, 2.58870522536460E-02);
1455 ir->AddTriPoints3(9, 1.77205532412543E-01, 2.10812943684965E-02);
1456 ir->AddTriPoints3(12, 6.17998830908730E-02, 7.21684983488850E-03);
1457 ir->AddTriPoints3(15, 1.93909612487010E-02, 2.46170180120000E-03);
1458 ir->AddTriPoints6(18, 5.71247574036480E-02, 1.72266687821356E-01,
1459 1.23328766062820E-02);
1460 ir->AddTriPoints6(24, 9.29162493569720E-02, 3.36861459796345E-01,
1461 1.92857553935305E-02);
1462 ir->AddTriPoints6(30, 1.46469500556540E-02, 2.98372882136258E-01,
1463 7.21815405676700E-03);
1464 ir->AddTriPoints6(36, 1.26833093287200E-03, 1.18974497696957E-01,
1465 2.50511441925050E-03);
1467 TriangleIntRules[14] = ir;
1471 ir =
new IntegrationRule(54);
1472 ir->AddTriPoints3b(0, 0.0834384072617499333, 0.016330909424402645);
1473 ir->AddTriPoints3b(3, 0.192779070841738867, 0.01370640901568218);
1474 ir->AddTriPoints3(6, 0.293197167913025367, 0.01325501829935165);
1475 ir->AddTriPoints3(9, 0.146467786942772933, 0.014607981068243055);
1476 ir->AddTriPoints3(12, 0.0563628676656034333, 0.005292304033121995);
1477 ir->AddTriPoints3(15, 0.0165751268583703333, 0.0018073215320460175);
1478 ir->AddTriPoints6(18, 0.0099122033092248, 0.239534554154794445,
1479 0.004263874050854718);
1480 ir->AddTriPoints6(24, 0.015803770630228, 0.404878807318339958,
1481 0.006958088258345965);
1482 ir->AddTriPoints6(30, 0.00514360881697066667, 0.0950021131130448885,
1483 0.0021459664703674175);
1484 ir->AddTriPoints6(36, 0.0489223257529888, 0.149753107322273969,
1485 0.008117664640887445);
1486 ir->AddTriPoints6(42, 0.0687687486325192, 0.286919612441334979,
1487 0.012803670460631195);
1488 ir->AddTriPoints6(48, 0.1684044181246992, 0.281835668099084562,
1489 0.016544097765822835);
1491 TriangleIntRules[15] = ir;
1496 ir =
new IntegrationRule(61);
1497 ir->AddTriMidPoint(0, 1.67185996454015E-02);
1498 ir->AddTriPoints3b(1, 5.65891888645200E-03, 2.54670772025350E-03);
1499 ir->AddTriPoints3b(4, 3.56473547507510E-02, 7.33543226381900E-03);
1500 ir->AddTriPoints3b(7, 9.95200619584370E-02, 1.21754391768360E-02);
1501 ir->AddTriPoints3b(10, 1.99467521245206E-01, 1.55537754344845E-02);
1502 ir->AddTriPoints3 (13, 2.52141267970953E-01, 1.56285556093100E-02);
1503 ir->AddTriPoints3 (16, 1.62047004658461E-01, 1.24078271698325E-02);
1504 ir->AddTriPoints3 (19, 7.58758822607460E-02, 7.02803653527850E-03);
1505 ir->AddTriPoints3 (22, 1.56547269678220E-02, 1.59733808688950E-03);
1506 ir->AddTriPoints6 (25, 1.01869288269190E-02, 3.34319867363658E-01,
1507 4.05982765949650E-03);
1508 ir->AddTriPoints6 (31, 1.35440871671036E-01, 2.92221537796944E-01,
1509 1.34028711415815E-02);
1510 ir->AddTriPoints6 (37, 5.44239242905830E-02, 3.19574885423190E-01,
1511 9.22999660541100E-03);
1512 ir->AddTriPoints6 (43, 1.28685608336370E-02, 1.90704224192292E-01,
1513 4.23843426716400E-03);
1514 ir->AddTriPoints6 (49, 6.71657824135240E-02, 1.80483211648746E-01,
1515 9.14639838501250E-03);
1516 ir->AddTriPoints6 (55, 1.46631822248280E-02, 8.07113136795640E-02,
1517 3.33281600208250E-03);
1519 TriangleIntRules[16] = TriangleIntRules[17] = ir;
1524 ir =
new IntegrationRule(73);
1525 ir->AddTriMidPoint(0, 0.0164531656944595);
1526 ir->AddTriPoints3b(1, 0.020780025853987, 0.005165365945636);
1527 ir->AddTriPoints3b(4, 0.090926214604215, 0.011193623631508);
1528 ir->AddTriPoints3b(7, 0.197166638701138, 0.015133062934734);
1529 ir->AddTriPoints3 (10, 0.255551654403098, 0.015245483901099);
1530 ir->AddTriPoints3 (13, 0.17707794215213, 0.0120796063708205);
1531 ir->AddTriPoints3 (16, 0.110061053227952, 0.0080254017934005);
1532 ir->AddTriPoints3 (19, 0.05552862425184, 0.004042290130892);
1533 ir->AddTriPoints3 (22, 0.012621863777229, 0.0010396810137425);
1534 ir->AddTriPoints6 (25, 0.003611417848412, 0.395754787356943,
1535 0.0019424384524905);
1536 ir->AddTriPoints6 (31, 0.13446675453078, 0.307929983880436,
1538 ir->AddTriPoints6 (37, 0.014446025776115, 0.26456694840652,
1540 ir->AddTriPoints6 (43, 0.046933578838178, 0.358539352205951,
1541 0.0080622733808655);
1542 ir->AddTriPoints6 (49, 0.002861120350567, 0.157807405968595,
1543 0.0012459709087455);
1544 ir->AddTriPoints6 (55, 0.075050596975911, 0.223861424097916,
1545 0.0091214200594755);
1546 ir->AddTriPoints6 (61, 0.03464707481676, 0.142421601113383,
1547 0.0051292818680995);
1548 ir->AddTriPoints6 (67, 0.065494628082938, 0.010161119296278,
1551 TriangleIntRules[18] = TriangleIntRules[19] = ir;
1555 ir =
new IntegrationRule(85);
1556 ir->AddTriMidPoint(0, 0.01380521349884976);
1557 ir->AddTriPoints3b(1, 0.001500649324429, 0.00088951477366337);
1558 ir->AddTriPoints3b(4, 0.0941397519389508667, 0.010056199056980585);
1559 ir->AddTriPoints3b(7, 0.2044721240895264, 0.013408923629665785);
1560 ir->AddTriPoints3(10, 0.264500202532787333, 0.012261566900751005);
1561 ir->AddTriPoints3(13, 0.211018964092076767, 0.008197289205347695);
1562 ir->AddTriPoints3(16, 0.107735607171271333, 0.0073979536993248);
1563 ir->AddTriPoints3(19, 0.0390690878378026667, 0.0022896411388521255);
1564 ir->AddTriPoints3(22, 0.0111743797293296333, 0.0008259132577881085);
1565 ir->AddTriPoints6(25, 0.00534961818733726667, 0.0635496659083522206,
1566 0.001174585454287792);
1567 ir->AddTriPoints6(31, 0.00795481706619893333, 0.157106918940706982,
1568 0.0022329628770908965);
1569 ir->AddTriPoints6(37, 0.0104223982812638, 0.395642114364374018,
1570 0.003049783403953986);
1571 ir->AddTriPoints6(43, 0.0109644147961233333, 0.273167570712910522,
1572 0.0034455406635941015);
1573 ir->AddTriPoints6(49, 0.0385667120854623333, 0.101785382485017108,
1574 0.0039987375362390815);
1575 ir->AddTriPoints6(55, 0.0355805078172182, 0.446658549176413815,
1576 0.003693067142668012);
1577 ir->AddTriPoints6(61, 0.0496708163627641333, 0.199010794149503095,
1578 0.00639966593932413);
1579 ir->AddTriPoints6(67, 0.0585197250843317333, 0.3242611836922827,
1580 0.008629035587848275);
1581 ir->AddTriPoints6(73, 0.121497787004394267, 0.208531363210132855,
1582 0.009336472951467735);
1583 ir->AddTriPoints6(79, 0.140710844943938733, 0.323170566536257485,
1584 0.01140911202919763);
1586 TriangleIntRules[20] = ir;
1594 ir =
new IntegrationRule(126);
1595 ir->AddTriPoints3b(0, 0.0279464830731742, 0.0040027909400102085);
1596 ir->AddTriPoints3b(3, 0.131178601327651467, 0.00797353841619525);
1597 ir->AddTriPoints3b(6, 0.220221729512072267, 0.006554570615397765);
1598 ir->AddTriPoints3 (9, 0.298443234019804467, 0.00979150048281781);
1599 ir->AddTriPoints3(12, 0.2340441723373718, 0.008235442720768635);
1600 ir->AddTriPoints3(15, 0.151468334609017567, 0.00427363953704605);
1601 ir->AddTriPoints3(18, 0.112733893545993667, 0.004080942928613246);
1602 ir->AddTriPoints3(21, 0.0777156920915263, 0.0030605732699918895);
1603 ir->AddTriPoints3(24, 0.034893093614297, 0.0014542491324683325);
1604 ir->AddTriPoints3(27, 0.00725818462093236667, 0.00034613762283099815);
1605 ir->AddTriPoints6(30, 0.0012923527044422, 0.227214452153364077,
1606 0.0006241445996386985);
1607 ir->AddTriPoints6(36, 0.0053997012721162, 0.435010554853571706,
1608 0.001702376454401511);
1609 ir->AddTriPoints6(42, 0.006384003033975, 0.320309599272204437,
1610 0.0016798271630320255);
1611 ir->AddTriPoints6(48, 0.00502821150199306667, 0.0917503222800051889,
1612 0.000858078269748377);
1613 ir->AddTriPoints6(54, 0.00682675862178186667, 0.0380108358587243835,
1614 0.000740428158357803);
1615 ir->AddTriPoints6(60, 0.0100161996399295333, 0.157425218485311668,
1616 0.0017556563053643425);
1617 ir->AddTriPoints6(66, 0.02575781317339, 0.239889659778533193,
1618 0.003696775074853242);
1619 ir->AddTriPoints6(72, 0.0302278981199158, 0.361943118126060531,
1620 0.003991543738688279);
1621 ir->AddTriPoints6(78, 0.0305049901071620667, 0.0835519609548285602,
1622 0.0021779813065790205);
1623 ir->AddTriPoints6(84, 0.0459565473625693333, 0.148443220732418205,
1624 0.003682528350708916);
1625 ir->AddTriPoints6(90, 0.0674428005402775333, 0.283739708727534955,
1626 0.005481786423209775);
1627 ir->AddTriPoints6(96, 0.0700450914159106, 0.406899375118787573,
1628 0.00587498087177056);
1629 ir->AddTriPoints6(102, 0.0839115246401166, 0.194113987024892542,
1630 0.005007800356899285);
1631 ir->AddTriPoints6(108, 0.120375535677152667, 0.32413434700070316,
1632 0.00665482039381434);
1633 ir->AddTriPoints6(114, 0.148066899157366667, 0.229277483555980969,
1634 0.00707722325261307);
1635 ir->AddTriPoints6(120, 0.191771865867325067, 0.325618122595983752,
1636 0.007440689780584005);
1638 TriangleIntRules[21] =
1639 TriangleIntRules[22] =
1640 TriangleIntRules[23] =
1641 TriangleIntRules[24] =
1642 TriangleIntRules[25] = ir;
1647 int i = (Order / 2) * 2 + 1;
1648 AllocIntRule(TriangleIntRules, i);
1649 ir =
new IntegrationRule;
1650 ir->GrundmannMollerSimplexRule(i/2,2);
1651 TriangleIntRules[i-1] = TriangleIntRules[i] = ir;
1657IntegrationRule *IntegrationRules::SquareIntegrationRule(
int Order)
1659 int RealOrder = GetSegmentRealOrder(Order);
1661 if (!HaveIntRule(SegmentIntRules, RealOrder))
1663 SegmentIntegrationRule(RealOrder);
1665 AllocIntRule(SquareIntRules, RealOrder);
1666 SquareIntRules[RealOrder-1] =
1667 SquareIntRules[RealOrder] =
1668 new IntegrationRule(*SegmentIntRules[RealOrder],
1669 *SegmentIntRules[RealOrder]);
1670 return SquareIntRules[Order];
1675IntegrationRule *IntegrationRules::TetrahedronIntegrationRule(
int Order)
1677 IntegrationRule *ir;
1686 ir =
new IntegrationRule(1);
1687 ir->AddTetMidPoint(0, 1./6.);
1689 TetrahedronIntRules[0] = TetrahedronIntRules[1] = ir;
1693 ir =
new IntegrationRule(4);
1695 ir->AddTetPoints4b(0, 0.58541019662496845446, 1./24.);
1697 TetrahedronIntRules[2] = ir;
1701 ir =
new IntegrationRule(5);
1702 ir->AddTetMidPoint(0, -2./15.);
1703 ir->AddTetPoints4b(1, 0.5, 0.075);
1705 TetrahedronIntRules[3] = ir;
1709 ir =
new IntegrationRule(11);
1710 ir->AddTetPoints4(0, 1./14., 343./45000.);
1711 ir->AddTetMidPoint(4, -74./5625.);
1712 ir->AddTetPoints6(5, 0.10059642383320079500, 28./1125.);
1714 TetrahedronIntRules[4] = ir;
1718 ir =
new IntegrationRule(14);
1719 ir->AddTetPoints6(0, 0.045503704125649649492,
1720 7.0910034628469110730E-03);
1721 ir->AddTetPoints4(6, 0.092735250310891226402, 0.012248840519393658257);
1722 ir->AddTetPoints4b(10, 0.067342242210098170608,
1723 0.018781320953002641800);
1725 TetrahedronIntRules[5] = ir;
1729 ir =
new IntegrationRule(24);
1730 ir->AddTetPoints4(0, 0.21460287125915202929,
1731 6.6537917096945820166E-03);
1732 ir->AddTetPoints4(4, 0.040673958534611353116,
1733 1.6795351758867738247E-03);
1734 ir->AddTetPoints4b(8, 0.032986329573173468968,
1735 9.2261969239424536825E-03);
1736 ir->AddTetPoints12(12, 0.063661001875017525299, 0.26967233145831580803,
1737 8.0357142857142857143E-03);
1739 TetrahedronIntRules[6] = ir;
1743 ir =
new IntegrationRule(31);
1744 ir->AddTetPoints6(0, 0.0, 9.7001763668430335097E-04);
1745 ir->AddTetMidPoint(6, 0.018264223466108820291);
1746 ir->AddTetPoints4(7, 0.078213192330318064374, 0.010599941524413686916);
1747 ir->AddTetPoints4(11, 0.12184321666390517465,
1748 -0.062517740114331851691);
1749 ir->AddTetPoints4b(15, 2.3825066607381275412E-03,
1750 4.8914252630734993858E-03);
1751 ir->AddTetPoints12(19, 0.1, 0.2, 0.027557319223985890653);
1753 TetrahedronIntRules[7] = ir;
1757 ir =
new IntegrationRule(43);
1758 ir->AddTetPoints4(0, 5.7819505051979972532E-03,
1759 1.6983410909288737984E-04);
1760 ir->AddTetPoints4(4, 0.082103588310546723091,
1761 1.9670333131339009876E-03);
1762 ir->AddTetPoints12(8, 0.036607749553197423679, 0.19048604193463345570,
1763 2.1405191411620925965E-03);
1764 ir->AddTetPoints6(20, 0.050532740018894224426,
1765 4.5796838244672818007E-03);
1766 ir->AddTetPoints12(26, 0.22906653611681113960, 0.035639582788534043717,
1767 5.7044858086819185068E-03);
1768 ir->AddTetPoints4(38, 0.20682993161067320408, 0.014250305822866901248);
1769 ir->AddTetMidPoint(42, -0.020500188658639915841);
1771 TetrahedronIntRules[8] = ir;
1775 ir =
new IntegrationRule;
1776 ir->GrundmannMollerSimplexRule(4,3);
1777 TetrahedronIntRules[9] = ir;
1781 int i = (Order / 2) * 2 + 1;
1782 AllocIntRule(TetrahedronIntRules, i);
1783 ir =
new IntegrationRule;
1784 ir->GrundmannMollerSimplexRule(i/2,3);
1785 TetrahedronIntRules[i-1] = TetrahedronIntRules[i] = ir;
1791IntegrationRule *IntegrationRules::PyramidIntegrationRule(
int Order)
1798 int npts = irc.GetNPoints();
1799 AllocIntRule(PyramidIntRules, Order);
1800 PyramidIntRules[Order] =
new IntegrationRule(npts);
1801 PyramidIntRules[Order]->SetOrder(Order);
1803 for (
int k=0; k<npts; k++)
1805 const IntegrationPoint &ipc = irc.IntPoint(k);
1806 IntegrationPoint &ipp = PyramidIntRules[Order]->IntPoint(k);
1807 ipp.x = ipc.x * (1.0 - ipc.z);
1808 ipp.y = ipc.y * (1.0 - ipc.z);
1810 ipp.weight = ipc.weight / 3.0;
1812 return PyramidIntRules[Order];
1816IntegrationRule *IntegrationRules::PrismIntegrationRule(
int Order)
1820 int nt = irt.GetNPoints();
1821 int ns = irs.GetNPoints();
1822 AllocIntRule(PrismIntRules, Order);
1823 PrismIntRules[Order] =
new IntegrationRule(nt * ns);
1824 PrismIntRules[Order]->SetOrder(std::min(irt.GetOrder(), irs.GetOrder()));
1825 while (Order < std::min(irt.GetOrder(), irs.GetOrder()))
1827 AllocIntRule(PrismIntRules, ++Order);
1828 PrismIntRules[Order] = PrismIntRules[Order-1];
1831 for (
int ks=0; ks<ns; ks++)
1833 const IntegrationPoint &ips = irs.IntPoint(ks);
1834 for (
int kt=0; kt<nt; kt++)
1836 int kp = ks * nt + kt;
1837 const IntegrationPoint &ipt = irt.IntPoint(kt);
1838 IntegrationPoint &ipp = PrismIntRules[Order]->IntPoint(kp);
1842 ipp.weight = ipt.weight * ips.weight;
1845 return PrismIntRules[Order];
1849IntegrationRule *IntegrationRules::CubeIntegrationRule(
int Order)
1851 int RealOrder = GetSegmentRealOrder(Order);
1852 if (!HaveIntRule(SegmentIntRules, RealOrder))
1854 SegmentIntegrationRule(RealOrder);
1856 AllocIntRule(CubeIntRules, RealOrder);
1857 CubeIntRules[RealOrder-1] =
1858 CubeIntRules[RealOrder] =
1859 new IntegrationRule(*SegmentIntRules[RealOrder],
1860 *SegmentIntRules[RealOrder],
1861 *SegmentIntRules[RealOrder]);
1862 return CubeIntRules[Order];
1866 const int patch,
const int *ijk,
1868 bool & deleteRule)
const
1873 auto search = elementToRule.find(elem);
1874 if (search != elementToRule.end())
1876 return *elementRule[search->second];
1879 MFEM_VERIFY(patchRules1D.NumRows(),
1880 "Undefined rule in NURBSMeshRules::GetElementRule");
1883 MFEM_VERIFY(kv.
Size() == dim,
"");
1886 std::vector<std::vector<real_t>> el(dim);
1888 std::vector<int> npd;
1891 for (
int d=0; d<dim; ++d)
1893 const int order = kv[d]->GetOrder();
1895 const real_t kv0 = (*kv[d])[order + ijk[d]];
1896 const real_t kv1 = (*kv[d])[order + ijk[d] + 1];
1898 const bool rightEnd = (order + ijk[d] + 1) == (kv[d]->Size() - 1);
1900 for (
int i=0; i<patchRules1D(patch,d)->Size(); ++i)
1903 if (kv0 <= ip.
x && (ip.
x < kv1 || rightEnd))
1905 const real_t x = (ip.
x - kv0) / (kv1 - kv0);
1907 el[d].push_back(ip.
weight);
1911 npd[d] = el[d].size() / 2;
1921 MFEM_VERIFY(npd[0] > 0 && npd[1] > 0,
"Assuming 2D or 3D");
1923 for (
int i = 0; i < npd[0]; ++i)
1925 for (
int j = 0; j < npd[1]; ++j)
1927 for (
int k = 0; k < std::max(npd[2], 1); ++k)
1929 const int id = i + j*npd[0] + k*npd[0]*npd[1];
1930 (*irp)[id].x = el[0][2*i];
1931 (*irp)[id].y = el[1][2*j];
1933 (*irp)[id].weight = el[0][(2*i)+1];
1934 (*irp)[id].weight *= el[1][(2*j)+1];
1938 (*irp)[id].z = el[2][2*k];
1939 (*irp)[id].weight *= el[2][(2*k)+1];
1951 MFEM_VERIFY(patchRules1D.NumRows() > 0,
1952 "Assuming patchRules1D is set.");
1954 ip.
weight = (*patchRules1D(patch,0))[i].weight;
1955 ip.
x = (*patchRules1D(patch,0))[i].x;
1959 ip.
weight *= (*patchRules1D(patch,1))[j].weight;
1960 ip.
y = (*patchRules1D(patch,1))[j].x;
1965 ip.
weight *= (*patchRules1D(patch,2))[k].weight;
1966 ip.
z = (*patchRules1D(patch,2))[k].x;
1972 if ((
int) pointToElem.size() == npatches) {
return; }
1974 MFEM_VERIFY(elementToRule.empty() && patchRules1D.NumRows() > 0
1975 && npatches > 0,
"Assuming patchRules1D is set.");
1977 MFEM_VERIFY(mesh.
Dimension() == dim,
"");
1979 pointToElem.resize(npatches);
1980 patchRules1D_KnotSpan.resize(npatches);
1983 std::vector<std::vector<int>> patchElements(npatches);
1985 for (
int e=0; e<mesh.
GetNE(); ++e)
1997 for (
int p=0;
p<npatches; ++
p)
1999 patchRules1D_KnotSpan[
p].resize(dim);
2003 MFEM_VERIFY((
int) pkv.
Size() == dim,
"");
2007 for (
int d=0; d<dim; ++d)
2009 maxijk[d] = pkv[d]->GetNKS();
2010 np[d] = patchRules1D(
p,d)->Size();
2014 Array3D<int> ijk2elem(maxijk[0], maxijk[1], maxijk[2]);
2017 for (
auto elem : patchElements[
p])
2020 MFEM_VERIFY(ijk2elem(ijk[0], ijk[1], ijk[2]) == -1,
"");
2021 ijk2elem(ijk[0], ijk[1], ijk[2]) = elem;
2028 for (
int d=0; d<
dim; ++d)
2030 patchRules1D_KnotSpan[
p][d].SetSize(patchRules1D(
p,d)->Size());
2032 for (
int r=0; r<patchRules1D(
p,d)->Size(); ++r)
2036 const int order = pkv[d]->GetOrder();
2043 const real_t kv0 = (*pkv[d])[order + ijk_d];
2044 const real_t kv1 = (*pkv[d])[order + ijk_d + 1];
2046 const bool rightEnd = (order + ijk_d + 1) == (pkv[d]->Size() - 1);
2048 if (kv0 <= ip.
x && (ip.
x < kv1 || rightEnd))
2058 patchRules1D_KnotSpan[
p][d][r] = ijk_d;
2062 pointToElem[
p].SetSize(np[0], np[1], np[2]);
2063 for (
int i=0; i<np[0]; ++i)
2064 for (
int j=0; j<np[1]; ++j)
2065 for (
int k=0; k<np[2]; ++k)
2067 const int elem = ijk2elem(patchRules1D_KnotSpan[
p][0][i],
2068 patchRules1D_KnotSpan[
p][1][j],
2069 patchRules1D_KnotSpan[
p][2][k]);
2070 MFEM_VERIFY(elem >= 0,
"");
2071 pointToElem[
p](i,j,k) = elem;
2077 std::vector<const IntegrationRule*> & ir1D)
2079 MFEM_VERIFY((
int) ir1D.size() == dim,
"Wrong dimension");
2081 for (
int i=0; i<dim; ++i)
2083 patchRules1D(patch,i) = ir1D[i];
2089 for (
int i=0; i<patchRules1D.NumRows(); ++i)
2090 for (
int j=0; j<patchRules1D.NumCols(); ++j)
2092 delete patchRules1D(i, j);
int Size() const
Return the logical size of the array.
Class for integration point with weight.
void Set1w(const real_t x1, const real_t w)
Class for an integration rule - an Array of IntegrationPoint.
int GetOrder() const
Returns the order of the integration rule.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationRule * ApplyToKnotIntervals(KnotVector const &kv) const
Return an integration rule for KnotVector kv, defined by applying this rule on each knot interval.
const Array< real_t > & GetWeights() const
Return the quadrature weights in a contiguous array.
void SetOrder(const int order)
Sets the order of the integration rule. This is only for keeping order information,...
void SetPointIndices()
Sets the indices of each quadrature point on initialization.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Container class for integration rules.
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 Set(int GeomType, int Order, IntegrationRule &IntRule)
~IntegrationRules()
Destroys an IntegrationRules object.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
void GetElementIJK(int elem, Array< int > &ijk)
int GetElementPatch(int elem) const
Returns the index of the patch containing element elem.
void GetPatchKnotVectors(int p, Array< KnotVector * > &kv)
void Finalize(Mesh const &mesh)
Finalize() must be called before this class can be used for assembly. In particular,...
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 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....
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...
@ ClosedUniform
aka closed Newton-Cotes
@ ClosedGL
aka closed Gauss Legendre
@ OpenHalfUniform
aka "open half" Newton-Cotes
@ OpenUniform
aka open Newton-Cotes
static int CheckOpen(int type)
If the Quadrature1D type is not open return Invalid; otherwise return type.
static int CheckClosed(int type)
If the Quadrature1D type is not closed return Invalid; otherwise return type.
static void GaussLegendre(const int np, IntegrationRule *ir)
static void ClosedUniform(const int np, IntegrationRule *ir)
static void OpenUniform(const int np, IntegrationRule *ir)
static void ClosedGL(const int np, IntegrationRule *ir)
static void GivePolyPoints(const int np, real_t *pts, const int type)
static void OpenHalfUniform(const int np, IntegrationRule *ir)
static void GaussLobatto(const int np, IntegrationRule *ir)
MemoryType
Memory types supported by MFEM.
@ HOST
Host memory; using new[] and delete[].
std::function< real_t(const Vector &)> f(real_t mass_coeff)
IntegrationRules RefinedIntRules(1, Quadrature1D::GaussLegendre)
A global object with all refined integration rules.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)
void pts(int iphi, int t, real_t x[])