12 int pe1,
int pe2,
int pe3)
26 if(pe1 >
pf2 || pe3 >
pf2) {
27 throw std::runtime_error(
"pe1 and pe3 must be <=pf2");
29 if(pe0 > pf1 ||
pe2 > pf1) {
30 throw std::runtime_error(
"pe0 and pe2 must be <=pf1");
68 case(1):
return 0.5 * (1 + u);
69 case(2):
return 0.5 * (1 - u);
70 case(3):
return 0.5 * (1 + v);
71 case(4):
return 0.5 * (1 - v);
72 default:
throw std::runtime_error(
"j must be : 1<=j<=4");
78 std::vector<double> &vertexBasis,
79 std::vector<double> &edgeBasis,
80 std::vector<double> &faceBasis,
81 std::vector<double> &bubbleBasis)
88 vertexBasis[0] = lambda2 * lambda4;
89 vertexBasis[1] = lambda1 * lambda4;
90 vertexBasis[2] = lambda1 * lambda3;
91 vertexBasis[3] = lambda2 * lambda3;
95 for(
int k = 2; k <= minpe0pe2; k++) {
97 double phie0 = lambda4 * lk;
98 double phie2 = lambda3 * lk;
100 edgeBasis[const2] = phie0;
101 edgeBasis[k + const1] = phie2;
102 int const3 =
_pf2 - 1;
104 while(iterator < const3) {
105 int nbr = const2 * const3 + iterator;
111 for(
int k = minpe0pe2 + 1; k <=
_pOrderEdge[0]; k++) {
113 double phie0 = lambda4 * lk;
115 edgeBasis[const2] = phie0;
116 int const3 =
_pf2 - 1;
118 while(iterator < const3) {
119 int nbr = const2 * const3 + iterator;
126 for(
int k = minpe0pe2 + 1; k <=
_pOrderEdge[2]; k++) {
128 double phie2 = lambda3 * lk;
129 edgeBasis[k + const1] = phie2;
131 int const3 =
_pf2 - 1;
132 while(iterator < const3) {
133 int nbr = (k - 2) * const3 + iterator;
140 for(
int k = maxpe0pe2 + 1; k <=
_pf1; k++) {
143 int const3 =
_pf2 - 1;
144 while(iterator < const3) {
145 int nbr = (k - 2) * const3 + iterator;
154 for(
int k = 2; k <= minpe1pe3; k++) {
156 double phie3 = lambda2 * lk;
157 double phie1 = lambda1 * lk;
158 edgeBasis[k + const3] = phie1;
159 edgeBasis[k + const4] = phie3;
162 while(iterator <=
_pf1 - 1) {
163 faceBasis[s] = faceBasis[s] * lk;
169 for(
int k = minpe1pe3 + 1; k <=
_pOrderEdge[1]; k++) {
171 double phie1 = lambda1 * lk;
172 edgeBasis[k + const3] = phie1;
175 while(iterator <=
_pf1 - 1) {
176 faceBasis[s] = faceBasis[s] * lk;
183 for(
int k = minpe1pe3 + 1; k <=
_pOrderEdge[3]; k++) {
185 double phie3 = lambda2 * lk;
186 edgeBasis[k + const4] = phie3;
189 while(iterator <=
_pf1 - 1) {
190 faceBasis[s] = faceBasis[s] * lk;
197 for(
int k = maxpe1pe3 + 1; k <=
_pf2; k++) {
201 while(iterator <=
_pf1 - 1) {
202 faceBasis[s] = faceBasis[s] * lk;
210 double const &u,
double const &v,
double const &w,
211 std::vector<std::vector<double> > &gradientVertex,
212 std::vector<std::vector<double> > &gradientEdge,
213 std::vector<std::vector<double> > &gradientFace,
214 std::vector<std::vector<double> > &gradientBubble)
216 double dlambda1 = 0.5;
217 double dlambda2 = -0.5;
218 double dlambda3 = 0.5;
219 double dlambda4 = -0.5;
225 gradientVertex[0][0] = dlambda2 * lambda4;
226 gradientVertex[0][1] = lambda2 * dlambda4;
227 gradientVertex[1][0] = dlambda1 * lambda4;
228 gradientVertex[1][1] = lambda1 * dlambda4;
229 gradientVertex[2][0] = dlambda1 * lambda3;
230 gradientVertex[2][1] = lambda1 * dlambda3;
231 gradientVertex[3][0] = dlambda2 * lambda3;
232 gradientVertex[3][1] = lambda2 * dlambda3;
237 for(
int k = 2; k <= minpe0pe2; k++) {
240 double dphie0U = lambda4 * dlk;
241 double dphie0V = dlambda4 * lk;
242 double dphie2U = lambda3 * dlk;
243 double dphie2V = dlambda3 * lk;
245 int const3 =
_pf2 - 1;
246 gradientEdge[const2][0] = dphie0U;
247 gradientEdge[const2][1] = dphie0V;
248 gradientEdge[k + const1][0] = dphie2U;
249 gradientEdge[k + const1][1] = dphie2V;
251 while(iterator < const3) {
252 int nbr = const2 * const3 + iterator;
253 gradientFace[nbr][0] = dlk;
254 gradientFace[nbr][1] = lk;
259 for(
int k = minpe0pe2 + 1; k <=
_pOrderEdge[0]; k++) {
262 double dphie0U = lambda4 * dlk;
263 double dphie0V = dlambda4 * lk;
265 int const3 =
_pf2 - 1;
266 gradientEdge[const2][0] = dphie0U;
267 gradientEdge[const2][1] = dphie0V;
269 while(iterator < const3) {
270 int nbr = const2 * const3 + iterator;
271 gradientFace[nbr][0] = dlk;
272 gradientFace[nbr][1] = lk;
278 for(
int k = minpe0pe2 + 1; k <=
_pOrderEdge[2]; k++) {
281 double dphie2U = lambda3 * dlk;
282 double dphie2V = dlambda3 * lk;
283 gradientEdge[k + const1][0] = dphie2U;
284 gradientEdge[k + const1][1] = dphie2V;
285 int const3 =
_pf2 - 1;
287 while(iterator < const3) {
288 int nbr = (k - 2) * (const3) + iterator;
289 gradientFace[nbr][0] = dlk;
290 gradientFace[nbr][1] = lk;
296 for(
int k = maxpe0pe2 + 1; k <=
_pf1; k++) {
300 while(iterator <
_pf2) {
301 int nbr = (k - 2) * (
_pf2 - 1) + iterator;
302 gradientFace[nbr][0] = dlk;
303 gradientFace[nbr][1] = lk;
312 for(
int k = 2; k <= minpe1pe3; k++) {
315 double dphie3U = dlambda2 * lk;
316 double dphie3V = lambda2 * dlk;
317 double dphie1U = dlambda1 * lk;
318 double dphie1V = lambda1 * dlk;
319 gradientEdge[k + const3][0] = dphie1U;
320 gradientEdge[k + const3][1] = dphie1V;
321 gradientEdge[k + const4][0] = dphie3U;
322 gradientEdge[k + const4][1] = dphie3V;
325 while(iterator <=
_pf1 - 1) {
326 gradientFace[s][0] = gradientFace[s][0] * lk;
327 gradientFace[s][1] = gradientFace[s][1] * dlk;
333 for(
int k = minpe1pe3 + 1; k <=
_pOrderEdge[1]; k++) {
336 double dphie1U = dlambda1 * lk;
337 double dphie1V = lambda1 * dlk;
338 gradientEdge[k + const3][0] = dphie1U;
339 gradientEdge[k + const3][1] = dphie1V;
342 while(iterator <=
_pf1 - 1) {
343 gradientFace[s][0] = gradientFace[s][0] * lk;
344 gradientFace[s][1] = gradientFace[s][1] * dlk;
351 for(
int k = minpe1pe3 + 1; k <=
_pOrderEdge[3]; k++) {
354 double dphie3U = dlambda2 * lk;
355 double dphie3V = lambda2 * dlk;
356 gradientEdge[k + const4][0] = dphie3U;
357 gradientEdge[k + const4][1] = dphie3V;
360 while(iterator <=
_pf1 - 1) {
361 gradientFace[s][0] = gradientFace[s][0] * lk;
362 gradientFace[s][1] = gradientFace[s][1] * dlk;
369 for(
int k = maxpe1pe3 + 1; k <=
_pf2; k++) {
374 while(iterator <=
_pf1 - 1) {
375 gradientFace[s][0] = gradientFace[s][0] * lk;
376 gradientFace[s][1] = gradientFace[s][1] * dlk;
384 int const &flagOrientation,
int const &edgeNumber,
385 std::vector<double> &edgeFunctions,
386 const std::vector<double> &eTablePositiveFlag,
387 const std::vector<double> &eTableNegativeFlag)
389 if(flagOrientation == -1) {
392 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
393 constant2 = constant2 - 1;
394 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
395 for(
int k = constant1; k <= constant2; k++) {
396 edgeFunctions[k] = eTableNegativeFlag[k];
402 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
403 constant2 = constant2 - 1;
404 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
405 for(
int k = constant1; k <= constant2; k++) {
406 edgeFunctions[k] = eTablePositiveFlag[k];
412 int const &flagOrientation,
int const &edgeNumber,
413 std::vector<std::vector<double> > &edgeFunctions,
414 const std::vector<std::vector<double> > &eTablePositiveFlag,
415 const std::vector<std::vector<double> > &eTableNegativeFlag)
417 if(flagOrientation == -1) {
420 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
421 constant2 = constant2 - 1;
422 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
423 for(
int k = constant1; k <= constant2; k++) {
424 edgeFunctions[k][0] = eTableNegativeFlag[k][0];
425 edgeFunctions[k][1] = eTableNegativeFlag[k][1];
431 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
432 constant2 = constant2 - 1;
433 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
434 for(
int k = constant1; k <= constant2; k++) {
435 edgeFunctions[k][0] = eTablePositiveFlag[k][0];
436 edgeFunctions[k][1] = eTablePositiveFlag[k][1];
442 std::vector<double> &edgeFunctions)
446 for(
int edgeNumber = 0; edgeNumber <
_nedge; edgeNumber++) {
449 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
450 constant2 = constant2 - 1;
451 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
452 for(
int k = constant1; k <= constant2; k++) {
453 if((k - constant1) % 2 != 0) {
454 edgeFunctions[k] = edgeFunctions[k] * (-1);
461 std::vector<std::vector<double> > &edgeFunctions)
465 for(
int edgeNumber = 0; edgeNumber <
_nedge; edgeNumber++) {
468 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
469 constant2 = constant2 - 1;
470 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
471 for(
int k = constant1; k <= constant2; k++) {
472 if((k - constant1) % 2 != 0) {
473 edgeFunctions[k][0] = edgeFunctions[k][0] * (-1);
474 edgeFunctions[k][1] = edgeFunctions[k][1] * (-1);
475 edgeFunctions[k][2] = edgeFunctions[k][2] * (-1);
481 double const &w,
int const &flag1,
482 int const &flag2,
int const &flag3,
483 int const &faceNumber,
484 std::vector<double> &faceBasis)
486 if(!(flag1 == 1 && flag2 == 1 && flag3 == 1)) {
489 for(
int it1 = 2; it1 <=
_pf1; it1++) {
490 for(
int it2 = 2; it2 <=
_pf2; it2++) {
493 if(flag1 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
494 if(flag2 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
495 faceBasis[iterator] = faceBasis[iterator] * impactFlag1 * impactFlag2;
501 std::vector<double> lkVector1(
_pf2 - 1);
502 std::vector<double> lkVector2(
_pf1 - 1);
503 for(
int it = 2; it <=
_pf1; it++) {
506 for(
int it = 2; it <=
_pf2; it++) {
510 for(
int it1 = 2; it1 <=
_pf2; it1++) {
511 for(
int it2 = 2; it2 <=
_pf1; it2++) {
514 if(flag2 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
515 if(flag1 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
516 faceBasis[iterator] =
517 lkVector1[it2 - 2] * lkVector2[it1 - 2] * impactFlag1 * impactFlag2;
526 double const &u,
double const &v,
double const &w,
int const &flag1,
527 int const &flag2,
int const &flag3,
int const &faceNumber,
528 std::vector<std::vector<double> > &gradientFace, std::string typeFunction)
530 if(!(flag1 == 1 && flag2 == 1 && flag3 == 1)) {
533 for(
int it1 = 2; it1 <=
_pf1; it1++) {
534 for(
int it2 = 2; it2 <=
_pf2; it2++) {
537 if(flag1 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
538 if(flag2 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
539 gradientFace[iterator][0] =
540 gradientFace[iterator][0] * impactFlag1 * impactFlag2;
541 gradientFace[iterator][1] =
542 gradientFace[iterator][1] * impactFlag1 * impactFlag2;
549 std::vector<double> lkVector1(
_pf1 - 1);
550 std::vector<double> lkVector2(
_pf2 - 1);
551 std::vector<double> dlkVector1(
_pf1 - 1);
552 std::vector<double> dlkVector2(
_pf2 - 1);
553 for(
int it = 2; it <=
_pf1; it++) {
557 for(
int it = 2; it <=
_pf2; it++) {
561 for(
int it1 = 2; it1 <=
_pf2; it1++) {
562 for(
int it2 = 2; it2 <=
_pf1; it2++) {
565 if(flag2 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
566 if(flag1 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
568 gradientFace[iterator][0] = dlkVector1[it2 - 2] * lkVector2[it1 - 2] *
569 impactFlag1 * impactFlag2;
570 gradientFace[iterator][1] = lkVector1[it2 - 2] * dlkVector2[it1 - 2] *
571 impactFlag1 * impactFlag2;
579 int const &flag1,
int const &flag2,
int const &flag3,
int const &faceNumber,
580 const std::vector<double> &quadFaceFunctionsAllOrientation,
581 const std::vector<double> &triFaceFunctionsAllOrientation,
582 std::vector<double> &fTableCopy)
587 fTableCopy[i] = quadFaceFunctionsAllOrientation[i + offset];
592 int const &flag1,
int const &flag2,
int const &flag3,
int const &faceNumber,
593 const std::vector<std::vector<double> > &quadFaceFunctionsAllOrientation,
594 const std::vector<std::vector<double> > &triFaceFunctionsAllOrientation,
595 std::vector<std::vector<double> > &fTableCopy)
600 fTableCopy[i][0] = quadFaceFunctionsAllOrientation[i + offset][0];
601 fTableCopy[i][1] = quadFaceFunctionsAllOrientation[i + offset][1];
602 fTableCopy[i][2] = quadFaceFunctionsAllOrientation[i + offset][2];
607 std::vector<int> &orderInfo)
609 functionTypeInfo[0] = 0;
610 functionTypeInfo[1] = 0;
611 functionTypeInfo[2] = 0;
612 functionTypeInfo[3] = 0;
618 for(
int numEdge = 0; numEdge < 4; numEdge++) {
620 functionTypeInfo[it] = 1;
625 for(
int n1 = 2; n1 <=
_pf1; n1++) {
626 for(
int n2 = 2; n2 <=
_pf2; n2++) {
627 functionTypeInfo[it] = 2;
628 orderInfo[it] = std::max(n1, n2);