20 for(
int i = 0; i < 12; i++) {
_pOrderEdge[i] = order; }
21 for(
int j = 0; j < 6; j++) {
49 case(1):
return 0.5 * (1 + u);
50 case(2):
return 0.5 * (1 - u);
51 case(3):
return 0.5 * (1 + v);
52 case(4):
return 0.5 * (1 - v);
53 case(5):
return 0.5 * (1 + w);
54 case(6):
return 0.5 * (1 - w);
55 default:
throw std::runtime_error(
"j must be : 1<=j<=6");
61 std::vector<double> &product,
62 std::vector<double> &lambda)
70 product[0] = lambda[3] * lambda[5];
71 product[1] = lambda[1] * lambda[5];
72 product[2] = lambda[1] * lambda[3];
73 product[3] = lambda[0] * lambda[5];
74 product[4] = lambda[3] * lambda[0];
75 product[5] = lambda[2] * lambda[5];
76 product[6] = lambda[2] * lambda[0];
77 product[7] = lambda[2] * lambda[1];
78 product[8] = lambda[3] * lambda[4];
79 product[9] = lambda[4] * lambda[1];
80 product[10] = lambda[4] * lambda[0];
81 product[11] = lambda[4] * lambda[2];
85 std::vector<double> &vertexBasis,
86 std::vector<double> &edgeBasis,
87 std::vector<double> &faceBasis,
88 std::vector<double> &bubbleBasis)
90 std::vector<double> product(12, 0);
91 std::vector<double> lambda(6, 0);
94 vertexBasis[0] = lambda[1] * product[0];
95 vertexBasis[1] = lambda[0] * product[0];
96 vertexBasis[2] = lambda[0] * product[5];
97 vertexBasis[3] = lambda[1] * product[5];
98 vertexBasis[4] = lambda[1] * product[8];
99 vertexBasis[5] = lambda[0] * product[8];
100 vertexBasis[6] = lambda[0] * product[11];
101 vertexBasis[7] = lambda[1] * product[11];
102 std::vector<double> lkVectorU(
_pb1 - 1);
103 std::vector<double> lkVectorV(
_pb2 - 1);
104 std::vector<double> lkVectorW(
_pb3 - 1);
105 for(
int it = 2; it <=
_pb1; it++) {
108 for(
int it = 2; it <=
_pb2; it++) {
111 for(
int it = 2; it <=
_pb3; it++) {
115 int indexEdgeBasis = 0;
116 std::vector<double> *vectorTarget1(
nullptr);
117 for(
int iEdge = 0; iEdge <
_nedge; iEdge++) {
122 case(11): vectorTarget1 = &lkVectorU;
break;
126 case(10): vectorTarget1 = &lkVectorV;
break;
130 case(7): vectorTarget1 = &lkVectorW;
break;
132 for(
int indexEdgeFunc = 0; indexEdgeFunc <
_pOrderEdge[iEdge] - 1;
134 edgeBasis[indexEdgeBasis] =
135 (*vectorTarget1)[indexEdgeFunc] * product[iEdge];
140 int indexFaceFunction = 0;
141 std::vector<double> *vectorTarget2(
nullptr);
142 for(
int iFace = 0; iFace <
_nfaceQuad; iFace++) {
147 vectorTarget1 = &lkVectorU;
148 vectorTarget2 = &lkVectorV;
152 vectorTarget1 = &lkVectorU;
153 vectorTarget2 = &lkVectorW;
157 vectorTarget1 = &lkVectorV;
158 vectorTarget2 = &lkVectorW;
162 vectorTarget1 = &lkVectorV;
163 vectorTarget2 = &lkVectorW;
167 vectorTarget1 = &lkVectorU;
168 vectorTarget2 = &lkVectorW;
172 vectorTarget1 = &lkVectorU;
173 vectorTarget2 = &lkVectorV;
176 for(
int index1 = 0; index1 <
_pOrderFace1[iFace] - 1; index1++) {
177 for(
int index2 = 0; index2 <
_pOrderFace2[iFace] - 1; index2++) {
178 faceBasis[indexFaceFunction] = lambda[indexLambda] *
179 (*vectorTarget1)[index1] *
180 (*vectorTarget2)[index2];
186 int indexBubbleBasis = 0;
187 for(
int ipb1 = 0; ipb1 <
_pb1 - 1; ipb1++) {
188 for(
int ipb2 = 0; ipb2 <
_pb2 - 1; ipb2++) {
189 for(
int ipb3 = 0; ipb3 <
_pb3 - 1; ipb3++) {
190 bubbleBasis[indexBubbleBasis] =
191 lkVectorU[ipb1] * lkVectorV[ipb2] * lkVectorW[ipb3];
199 double const &u,
double const &v,
double const &w,
200 std::vector<double> &product,
201 std::vector<std::vector<double> > &gradientProduct,
202 std::vector<double> &lambda,
203 std::vector<std::vector<double> > &gradientLambda)
211 gradientLambda[0][0] = 0.5;
212 gradientLambda[1][0] = -0.5;
213 gradientLambda[2][1] = 0.5;
214 gradientLambda[3][1] = -0.5;
215 gradientLambda[4][2] = 0.5;
216 gradientLambda[5][2] = -0.5;
217 product[0] = lambda[3] * lambda[5];
218 product[1] = lambda[1] * lambda[5];
219 product[2] = lambda[1] * lambda[3];
220 product[3] = lambda[0] * lambda[5];
221 product[4] = lambda[3] * lambda[0];
222 product[5] = lambda[2] * lambda[5];
223 product[6] = lambda[2] * lambda[0];
224 product[7] = lambda[2] * lambda[1];
225 product[8] = lambda[3] * lambda[4];
226 product[9] = lambda[4] * lambda[1];
227 product[10] = lambda[4] * lambda[0];
228 product[11] = lambda[4] * lambda[2];
229 gradientProduct[0][1] = -0.5 * lambda[5];
230 gradientProduct[0][2] = -0.5 * lambda[3];
231 gradientProduct[1][0] = -0.5 * lambda[5];
232 gradientProduct[1][2] = -0.5 * lambda[1];
233 gradientProduct[2][0] = -0.5 * lambda[3];
234 gradientProduct[2][1] = -0.5 * lambda[1];
235 gradientProduct[3][0] = 0.5 * lambda[5];
236 gradientProduct[3][2] = -0.5 * lambda[0];
237 gradientProduct[4][0] = 0.5 * lambda[3];
238 gradientProduct[4][1] = -0.5 * lambda[0];
239 gradientProduct[5][1] = 0.5 * lambda[5];
240 gradientProduct[5][2] = -0.5 * lambda[2];
241 gradientProduct[6][0] = 0.5 * lambda[2];
242 gradientProduct[6][1] = 0.5 * lambda[0];
243 gradientProduct[7][0] = -0.5 * lambda[2];
244 gradientProduct[7][1] = 0.5 * lambda[1];
245 gradientProduct[8][1] = -0.5 * lambda[4];
246 gradientProduct[8][2] = 0.5 * lambda[3];
247 gradientProduct[9][0] = -0.5 * lambda[4];
248 gradientProduct[9][2] = 0.5 * lambda[1];
249 gradientProduct[10][0] = 0.5 * lambda[4];
250 gradientProduct[10][2] = 0.5 * lambda[0];
251 gradientProduct[11][1] = 0.5 * lambda[4];
252 gradientProduct[11][2] = 0.5 * lambda[2];
256 double const &u,
double const &v,
double const &w,
257 std::vector<std::vector<double> > &gradientVertex,
258 std::vector<std::vector<double> > &gradientEdge,
259 std::vector<std::vector<double> > &gradientFace,
260 std::vector<std::vector<double> > &gradientBubble)
262 std::vector<double> product(12, 0);
263 std::vector<std::vector<double> > gradientProduct(12,
264 std::vector<double>(3, 0));
265 std::vector<double> lambda(6, 0);
266 std::vector<std::vector<double> > gradientLambda(6,
267 std::vector<double>(3, 0));
269 lambda, gradientLambda);
271 for(
int it = 0; it < 3; it++) {
272 gradientVertex[0][it] =
273 gradientLambda[1][it] * product[0] + gradientProduct[0][it] * lambda[1];
274 gradientVertex[1][it] =
275 gradientLambda[0][it] * product[0] + gradientProduct[0][it] * lambda[0];
276 gradientVertex[2][it] =
277 gradientLambda[0][it] * product[5] + gradientProduct[5][it] * lambda[0];
278 gradientVertex[3][it] =
279 gradientLambda[1][it] * product[5] + gradientProduct[5][it] * lambda[1];
280 gradientVertex[4][it] =
281 gradientLambda[1][it] * product[8] + gradientProduct[8][it] * lambda[1];
282 gradientVertex[5][it] =
283 gradientLambda[0][it] * product[8] + gradientProduct[8][it] * lambda[0];
284 gradientVertex[6][it] =
285 gradientLambda[0][it] * product[11] + gradientProduct[11][it] * lambda[0];
286 gradientVertex[7][it] =
287 gradientLambda[1][it] * product[11] + gradientProduct[11][it] * lambda[1];
289 std::vector<double> lkVectorU(
_pb1 - 1);
290 std::vector<double> lkVectorV(
_pb2 - 1);
291 std::vector<double> lkVectorW(
_pb3 - 1);
292 std::vector<std::vector<double> > dlkVectorU(
_pb1 - 1,
293 std::vector<double>(3, 0.));
294 std::vector<std::vector<double> > dlkVectorV(
_pb2 - 1,
295 std::vector<double>(3, 0.));
296 std::vector<std::vector<double> > dlkVectorW(
_pb3 - 1,
297 std::vector<double>(3, 0.));
298 for(
int it = 2; it <=
_pb1; it++) {
302 for(
int it = 2; it <=
_pb2; it++) {
306 for(
int it = 2; it <=
_pb3; it++) {
311 int indexEdgeBasis = 0;
312 std::vector<double> *vectorTarget1(
nullptr);
313 std::vector<std::vector<double> > *dvectorTarget1(
nullptr);
314 for(
int iEdge = 0; iEdge <
_nedge; iEdge++) {
320 vectorTarget1 = &lkVectorU;
321 dvectorTarget1 = &dlkVectorU;
327 vectorTarget1 = &lkVectorV;
328 dvectorTarget1 = &dlkVectorV;
334 vectorTarget1 = &lkVectorW;
335 dvectorTarget1 = &dlkVectorW;
338 for(
int indexEdgeFunc = 0; indexEdgeFunc <
_pOrderEdge[iEdge] - 1;
340 for(
int it = 0; it < 3; it++) {
341 gradientEdge[indexEdgeBasis][it] =
342 (*dvectorTarget1)[indexEdgeFunc][it] * product[iEdge] +
343 (*vectorTarget1)[indexEdgeFunc] * gradientProduct[iEdge][it];
349 int indexFaceFunction = 0;
350 std::vector<double> *vectorTarget2(
nullptr);
351 std::vector<std::vector<double> > *dvectorTarget2(
nullptr);
352 for(
int iFace = 0; iFace <
_nfaceQuad; iFace++) {
357 vectorTarget1 = &lkVectorU;
358 vectorTarget2 = &lkVectorV;
359 dvectorTarget1 = &dlkVectorU;
360 dvectorTarget2 = &dlkVectorV;
364 vectorTarget1 = &lkVectorU;
365 vectorTarget2 = &lkVectorW;
366 dvectorTarget1 = &dlkVectorU;
367 dvectorTarget2 = &dlkVectorW;
371 vectorTarget1 = &lkVectorV;
372 vectorTarget2 = &lkVectorW;
373 dvectorTarget1 = &dlkVectorV;
374 dvectorTarget2 = &dlkVectorW;
378 vectorTarget1 = &lkVectorV;
379 vectorTarget2 = &lkVectorW;
380 dvectorTarget1 = &dlkVectorV;
381 dvectorTarget2 = &dlkVectorW;
385 vectorTarget1 = &lkVectorU;
386 vectorTarget2 = &lkVectorW;
387 dvectorTarget1 = &dlkVectorU;
388 dvectorTarget2 = &dlkVectorW;
392 vectorTarget1 = &lkVectorU;
393 vectorTarget2 = &lkVectorV;
394 dvectorTarget1 = &dlkVectorU;
395 dvectorTarget2 = &dlkVectorV;
398 for(
int index1 = 0; index1 <
_pOrderFace1[iFace] - 1; index1++) {
399 for(
int index2 = 0; index2 <
_pOrderFace2[iFace] - 1; index2++) {
400 for(
int it = 0; it < 3; it++) {
401 gradientFace[indexFaceFunction][it] =
402 gradientLambda[indexLambda][it] * (*vectorTarget1)[index1] *
403 (*vectorTarget2)[index2] +
404 lambda[indexLambda] * (*dvectorTarget1)[index1][it] *
405 (*vectorTarget2)[index2] +
406 lambda[indexLambda] * (*vectorTarget1)[index1] *
407 (*dvectorTarget2)[index2][it];
414 int indexBubbleBasis = 0;
415 for(
int ipb1 = 0; ipb1 <
_pb1 - 1; ipb1++) {
416 for(
int ipb2 = 0; ipb2 <
_pb2 - 1; ipb2++) {
417 for(
int ipb3 = 0; ipb3 <
_pb3 - 1; ipb3++) {
418 gradientBubble[indexBubbleBasis][0] =
419 dlkVectorU[ipb1][0] * lkVectorV[ipb2] * lkVectorW[ipb3];
420 gradientBubble[indexBubbleBasis][1] =
421 lkVectorU[ipb1] * dlkVectorV[ipb2][1] * lkVectorW[ipb3];
422 gradientBubble[indexBubbleBasis][2] =
423 lkVectorU[ipb1] * lkVectorV[ipb2] * dlkVectorW[ipb3][2];
431 int const &flagOrientation,
int const &edgeNumber,
432 std::vector<double> &edgeFunctions,
433 const std::vector<double> &eTablePositiveFlag,
434 const std::vector<double> &eTableNegativeFlag)
436 if(flagOrientation == -1) {
439 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
440 constant2 = constant2 - 1;
441 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
442 for(
int k = constant1; k <= constant2; k++) {
443 edgeFunctions[k] = eTableNegativeFlag[k];
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 edgeFunctions[k] = eTablePositiveFlag[k];
459 int const &flagOrientation,
int const &edgeNumber,
460 std::vector<std::vector<double> > &edgeFunctions,
461 const std::vector<std::vector<double> > &eTablePositiveFlag,
462 const std::vector<std::vector<double> > &eTableNegativeFlag)
464 if(flagOrientation == -1) {
467 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
468 constant2 = constant2 - 1;
469 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
470 for(
int k = constant1; k <= constant2; k++) {
471 edgeFunctions[k][0] = eTableNegativeFlag[k][0];
472 edgeFunctions[k][1] = eTableNegativeFlag[k][1];
473 edgeFunctions[k][2] = eTableNegativeFlag[k][2];
479 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
480 constant2 = constant2 - 1;
481 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
482 for(
int k = constant1; k <= constant2; k++) {
483 edgeFunctions[k][0] = eTablePositiveFlag[k][0];
484 edgeFunctions[k][1] = eTablePositiveFlag[k][1];
485 edgeFunctions[k][2] = eTablePositiveFlag[k][2];
491 std::vector<double> &edgeFunctions)
495 for(
int edgeNumber = 0; edgeNumber <
_nedge; edgeNumber++) {
498 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
499 constant2 = constant2 - 1;
500 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
501 for(
int k = constant1; k <= constant2; k++) {
502 if((k - constant1) % 2 != 0) {
503 edgeFunctions[k] = edgeFunctions[k] * (-1);
510 std::vector<std::vector<double> > &edgeFunctions)
514 for(
int edgeNumber = 0; edgeNumber <
_nedge; edgeNumber++) {
517 for(
int i = 0; i <= edgeNumber; i++) { constant2 +=
_pOrderEdge[i] - 1; }
518 constant2 = constant2 - 1;
519 constant1 = constant2 -
_pOrderEdge[edgeNumber] + 2;
520 for(
int k = constant1; k <= constant2; k++) {
521 if((k - constant1) % 2 != 0) {
522 edgeFunctions[k][0] = edgeFunctions[k][0] * (-1);
523 edgeFunctions[k][1] = edgeFunctions[k][1] * (-1);
524 edgeFunctions[k][2] = edgeFunctions[k][2] * (-1);
531 double const &w,
int const &flag1,
532 int const &flag2,
int const &flag3,
533 int const &faceNumber,
534 std::vector<double> &faceBasis)
536 if(!(flag1 == 1 && flag2 == 1 && flag3 == 1)) {
538 for(
int i = 0; i < faceNumber; i++) {
542 for(
int it1 = 2; it1 <=
_pOrderFace1[faceNumber]; it1++) {
543 for(
int it2 = 2; it2 <=
_pOrderFace2[faceNumber]; it2++) {
546 if(flag1 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
547 if(flag2 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
548 faceBasis[iterator] = faceBasis[iterator] * impactFlag1 * impactFlag2;
589 std::vector<double> lkVector1(
_pOrderFace1[faceNumber] - 1);
590 std::vector<double> lkVector2(
_pOrderFace2[faceNumber] - 1);
598 for(
int it1 = 2; it1 <=
_pOrderFace2[faceNumber]; it1++) {
599 for(
int it2 = 2; it2 <=
_pOrderFace1[faceNumber]; it2++) {
602 if(flag2 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
603 if(flag1 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
604 faceBasis[iterator] = lambda * lkVector1[it2 - 2] *
605 lkVector2[it1 - 2] * impactFlag1 * impactFlag2;
613 double const &u,
double const &v,
double const &w,
int const &flag1,
614 int const &flag2,
int const &flag3,
int const &faceNumber,
615 std::vector<std::vector<double> > &gradientFace, std::string typeFunction)
617 if(!(flag1 == 1 && flag2 == 1 && flag3 == 1)) {
619 for(
int i = 0; i < faceNumber; i++) {
623 for(
int it1 = 2; it1 <=
_pOrderFace1[faceNumber]; it1++) {
624 for(
int it2 = 2; it2 <=
_pOrderFace2[faceNumber]; it2++) {
627 if(flag1 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
628 if(flag2 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
629 gradientFace[iterator][0] =
630 gradientFace[iterator][0] * impactFlag1 * impactFlag2;
631 gradientFace[iterator][1] =
632 gradientFace[iterator][1] * impactFlag1 * impactFlag2;
633 gradientFace[iterator][2] =
634 gradientFace[iterator][2] * impactFlag1 * impactFlag2;
640 std::vector<double> uvw(3);
647 std::vector<double> gradientLambda(3, 0);
653 gradientLambda[2] = -0.5;
659 gradientLambda[1] = -0.5;
665 gradientLambda[0] = -0.5;
671 gradientLambda[0] = 0.5;
677 gradientLambda[1] = 0.5;
683 gradientLambda[2] = 0.5;
686 std::vector<double> lkVector1(
_pOrderFace1[faceNumber] - 1);
687 std::vector<double> lkVector2(
_pOrderFace2[faceNumber] - 1);
688 std::vector<std::vector<double> > dlkVector1(
_pOrderFace1[faceNumber] - 1,
689 std::vector<double>(3, 0.));
690 std::vector<std::vector<double> > dlkVector2(
_pOrderFace2[faceNumber] - 1,
691 std::vector<double>(3, 0.));
700 for(
int it1 = 2; it1 <=
_pOrderFace2[faceNumber]; it1++) {
701 for(
int it2 = 2; it2 <=
_pOrderFace1[faceNumber]; it2++) {
704 if(flag2 == -1 && it1 % 2 != 0) { impactFlag1 = -1; }
705 if(flag1 == -1 && it2 % 2 != 0) { impactFlag2 = -1; }
706 for(
int itVector = 0; itVector < 3; itVector++) {
707 gradientFace[iterator][itVector] =
708 (gradientLambda[itVector] * lkVector1[it2 - 2] *
710 lambda * dlkVector1[it2 - 2][itVector] * lkVector2[it1 - 2] +
711 lambda * lkVector1[it2 - 2] * dlkVector2[it1 - 2][itVector]) *
712 impactFlag1 * impactFlag2;
722 int const &flag1,
int const &flag2,
int const &flag3,
int const &faceNumber,
723 const std::vector<double> &quadFaceFunctionsAllOrientation,
724 const std::vector<double> &triFaceFunctionsAllOrientation,
725 std::vector<double> &fTableCopy)
728 for(
int i = 0; i < faceNumber; i++) {
731 int numFaceFunctions =
735 int offset2 = iterator + numFaceFunctions;
736 for(
int i = iterator; i < offset2; i++) {
737 fTableCopy[i] = quadFaceFunctionsAllOrientation[i + offset];
741 int const &flag1,
int const &flag2,
int const &flag3,
int const &faceNumber,
742 const std::vector<std::vector<double> > &quadFaceFunctionsAllOrientation,
743 const std::vector<std::vector<double> > &triFaceFunctionsAllOrientation,
744 std::vector<std::vector<double> > &fTableCopy)
747 for(
int i = 0; i < faceNumber; i++) {
750 int numFaceFunctions =
754 int offset2 = iterator + numFaceFunctions;
755 for(
int i = iterator; i < offset2; i++) {
756 fTableCopy[i][0] = quadFaceFunctionsAllOrientation[i + offset][0];
757 fTableCopy[i][1] = quadFaceFunctionsAllOrientation[i + offset][1];
758 fTableCopy[i][2] = quadFaceFunctionsAllOrientation[i + offset][2];
763 std::vector<int> &orderInfo)
765 for(
int i = 0; i < 8; i++) {
766 functionTypeInfo[i] = 0;
770 for(
int numEdge = 0; numEdge < 12; numEdge++) {
772 functionTypeInfo[it] = 1;
777 for(
int numFace = 0; numFace < 6; numFace++) {
780 functionTypeInfo[it] = 2;
781 orderInfo[it] = std::max(n1, n2);
786 for(
int ipb1 = 2; ipb1 <=
_pb1; ipb1++) {
787 for(
int ipb2 = 2; ipb2 <=
_pb2; ipb2++) {
788 for(
int ipb3 = 2; ipb3 <=
_pb3; ipb3++) {
789 functionTypeInfo[it] = 3;
790 orderInfo[it] = std::max(std::max(ipb1, ipb2), ipb3);