48 :
StdExpansion(Ba.GetNumModes() * Bb.GetNumModes() * Bc.GetNumModes(), 3,
50 StdExpansion3D(Ba.GetNumModes() * Bb.GetNumModes() * Bc.GetNumModes(), Ba,
112 ASSERTL1(
false,
"input dir is out of range");
158 "Basis[1] is not a general tensor type");
162 "Basis[2] is not a general tensor type");
164 if (
m_base[0]->Collocation() &&
m_base[1]->Collocation() &&
169 inarray, 1, outarray, 1);
188 m_base[2]->GetBdata(), inarray, outarray, wsp,
true,
211 bool doCheckCollDir0,
bool doCheckCollDir1,
bool doCheckCollDir2)
213 int nquad0 =
m_base[0]->GetNumPoints();
214 int nquad1 =
m_base[1]->GetNumPoints();
215 int nquad2 =
m_base[2]->GetNumPoints();
216 int nmodes0 =
m_base[0]->GetNumModes();
217 int nmodes1 =
m_base[1]->GetNumModes();
218 int nmodes2 =
m_base[2]->GetNumModes();
221 bool colldir0 = doCheckCollDir0 ? (
m_base[0]->Collocation()) :
false;
222 bool colldir1 = doCheckCollDir1 ? (
m_base[1]->Collocation()) :
false;
223 bool colldir2 = doCheckCollDir2 ? (
m_base[2]->Collocation()) :
false;
227 if (colldir0 && colldir1 && colldir2)
234 ASSERTL1(wsp.size() >= nquad0 * nmodes2 * (nmodes1 + nquad1),
235 "Workspace size is not sufficient");
241 Blas::Dgemm(
'T',
'T', nmodes1 * nmodes2, nquad0, nmodes0, 1.0,
242 &inarray[0], nmodes0, base0.get(), nquad0, 0.0, &wsp[0],
244 Blas::Dgemm(
'T',
'T', nquad0 * nmodes2, nquad1, nmodes1, 1.0, &wsp[0],
245 nmodes1, base1.get(), nquad1, 0.0, &wsp2[0],
247 Blas::Dgemm(
'T',
'T', nquad0 * nquad1, nquad2, nmodes2, 1.0, &wsp2[0],
248 nmodes2, base2.get(), nquad2, 0.0, &outarray[0],
267 if ((
m_base[0]->Collocation()) && (
m_base[1]->Collocation()) &&
268 (
m_base[2]->Collocation()))
286 out = (*matsys) * in;
323 if (
m_base[0]->Collocation() &&
m_base[1]->Collocation() &&
341 int nquad0 =
m_base[0]->GetNumPoints();
342 int nquad1 =
m_base[1]->GetNumPoints();
343 int nquad2 =
m_base[2]->GetNumPoints();
344 int order0 =
m_base[0]->GetNumModes();
345 int order1 =
m_base[1]->GetNumModes();
348 order0 * order1 * nquad2);
350 if (multiplybyweights)
357 tmp, outarray, wsp,
true,
true,
true);
363 inarray, outarray, wsp,
true,
true,
true);
377 bool doCheckCollDir0,
bool doCheckCollDir1,
bool doCheckCollDir2)
379 int nquad0 =
m_base[0]->GetNumPoints();
380 int nquad1 =
m_base[1]->GetNumPoints();
381 int nquad2 =
m_base[2]->GetNumPoints();
382 int nmodes0 =
m_base[0]->GetNumModes();
383 int nmodes1 =
m_base[1]->GetNumModes();
384 int nmodes2 =
m_base[2]->GetNumModes();
386 bool colldir0 = doCheckCollDir0 ? (
m_base[0]->Collocation()) :
false;
387 bool colldir1 = doCheckCollDir1 ? (
m_base[1]->Collocation()) :
false;
388 bool colldir2 = doCheckCollDir2 ? (
m_base[2]->Collocation()) :
false;
390 if (colldir0 && colldir1 && colldir2)
396 ASSERTL1(wsp.size() >= nmodes0 * nquad2 * (nquad1 + nmodes1),
397 "Insufficient workspace size");
405 for (
int n = 0; n < nmodes0; ++n)
407 Vmath::Vcopy(nquad1 * nquad2, inarray.get() + n, nquad0,
408 tmp0.get() + nquad1 * nquad2 * n, 1);
413 Blas::Dgemm(
'T',
'N', nquad1 * nquad2, nmodes0, nquad0, 1.0,
414 inarray.get(), nquad0, base0.get(), nquad0, 0.0,
415 tmp0.get(), nquad1 * nquad2);
421 for (
int n = 0; n < nmodes1; ++n)
424 tmp1.get() + nquad2 * nmodes0 * n, 1);
429 Blas::Dgemm(
'T',
'N', nquad2 * nmodes0, nmodes1, nquad1, 1.0,
430 tmp0.get(), nquad1, base1.get(), nquad1, 0.0,
431 tmp1.get(), nquad2 * nmodes0);
437 for (
int n = 0; n < nmodes2; ++n)
440 outarray.get() + nmodes0 * nmodes1 * n, 1);
445 Blas::Dgemm(
'T',
'N', nmodes0 * nmodes1, nmodes2, nquad2, 1.0,
446 tmp1.get(), nquad2, base2.get(), nquad2, 0.0,
447 outarray.get(), nmodes0 * nmodes1);
463 ASSERTL0((dir == 0) || (dir == 1) || (dir == 2),
464 "input dir is out of range");
466 int nquad1 =
m_base[1]->GetNumPoints();
467 int nquad2 =
m_base[2]->GetNumPoints();
468 int order0 =
m_base[0]->GetNumModes();
469 int order1 =
m_base[1]->GetNumModes();
473 if (outarray.size() < inarray.size())
490 m_base[2]->GetBdata(), tmp, outarray, wsp,
false,
true,
true);
495 m_base[2]->GetBdata(), tmp, outarray, wsp,
true,
false,
true);
500 m_base[2]->GetDbdata(), tmp, outarray, wsp,
true,
true,
false);
526 int nquad0 =
m_base[0]->GetNumPoints();
527 int nquad1 =
m_base[1]->GetNumPoints();
528 int nquad2 =
m_base[2]->GetNumPoints();
534 int btmp0 =
m_base[0]->GetNumModes();
535 int btmp1 =
m_base[1]->GetNumModes();
536 int mode2 = mode / (btmp0 * btmp1);
537 int mode1 = (mode - mode2 * btmp0 * btmp1) / btmp0;
538 int mode0 = (mode - mode2 * btmp0 * btmp1) % btmp0;
540 ASSERTL2(mode == mode2 * btmp0 * btmp1 + mode1 * btmp0 + mode0,
541 "Mode lookup failed.");
543 "Calling argument mode is larger than total expansion "
546 for (
int i = 0; i < nquad1 * nquad2; ++i)
549 &outarray[0] + i * nquad0, 1);
552 for (
int j = 0; j < nquad2; ++j)
554 for (
int i = 0; i < nquad0; ++i)
557 &outarray[0] + i + j * nquad0 * nquad1, nquad0,
558 &outarray[0] + i + j * nquad0 * nquad1, nquad0);
562 for (
int i = 0; i < nquad2; i++)
564 Blas::Dscal(nquad0 * nquad1, base2[mode2 * nquad2 + i],
565 &outarray[0] + i * nquad0 * nquad1, 1);
579 const int nm0 =
m_base[0]->GetNumModes();
580 const int nm1 =
m_base[1]->GetNumModes();
581 const int mode2 = mode / (nm0 * nm1);
582 const int mode1 = (mode - mode2 * nm0 * nm1) / nm0;
583 const int mode0 = (mode - mode2 * nm0 * nm1) % nm0;
585 return StdExpansion::BaryEvaluateBasis<0>(coords[0], mode0) *
586 StdExpansion::BaryEvaluateBasis<1>(coords[1], mode1) *
587 StdExpansion::BaryEvaluateBasis<2>(coords[2], mode2);
614 "BasisType is not a boundary interior form");
617 "BasisType is not a boundary interior form");
620 "BasisType is not a boundary interior form");
622 int nmodes0 =
m_base[0]->GetNumModes();
623 int nmodes1 =
m_base[1]->GetNumModes();
624 int nmodes2 =
m_base[2]->GetNumModes();
626 return (2 * (nmodes0 * nmodes1 + nmodes0 * nmodes2 + nmodes1 * nmodes2) -
627 4 * (nmodes0 + nmodes1 + nmodes2) + 8);
634 "BasisType is not a boundary interior form");
637 "BasisType is not a boundary interior form");
640 "BasisType is not a boundary interior form");
642 int nmodes0 =
m_base[0]->GetNumModes();
643 int nmodes1 =
m_base[1]->GetNumModes();
644 int nmodes2 =
m_base[2]->GetNumModes();
646 return 2 * (nmodes0 * nmodes1 + nmodes0 * nmodes2 + nmodes1 * nmodes2);
651 ASSERTL2((i >= 0) && (i <= 5),
"face id is out of range");
652 if ((i == 0) || (i == 5))
656 else if ((i == 1) || (i == 3))
668 ASSERTL2((i >= 0) && (i <= 5),
"face id is out of range");
669 if ((i == 0) || (i == 5))
673 else if ((i == 1) || (i == 3))
685 ASSERTL2(i >= 0 && i <= 5,
"face id is out of range");
687 if (i == 0 || i == 5)
689 return m_base[0]->GetNumPoints() *
m_base[1]->GetNumPoints();
691 else if (i == 1 || i == 3)
693 return m_base[0]->GetNumPoints() *
m_base[2]->GetNumPoints();
697 return m_base[1]->GetNumPoints() *
m_base[2]->GetNumPoints();
704 ASSERTL2(i >= 0 && i <= 5,
"face id is out of range");
705 ASSERTL2(j == 0 || j == 1,
"face direction is out of range");
707 if (i == 0 || i == 5)
709 return m_base[j]->GetPointsKey();
711 else if (i == 1 || i == 3)
713 return m_base[2 * j]->GetPointsKey();
717 return m_base[j + 1]->GetPointsKey();
722 const std::vector<unsigned int> &nummodes,
int &modes_offset)
724 int nmodes = nummodes[modes_offset] * nummodes[modes_offset + 1] *
725 nummodes[modes_offset + 2];
734 ASSERTL2(i >= 0 && i <= 5,
"face id is out of range");
735 ASSERTL2(k >= 0 && k <= 1,
"basis key id is out of range");
756 m_base[dir]->GetNumModes());
772 for (
int k = 0; k < Qz; ++k)
774 for (
int j = 0; j < Qy; ++j)
776 for (
int i = 0; i < Qx; ++i)
778 int s = i + Qx * (j + Qy * k);
790 int nummodes[3] = {
m_base[0]->GetNumModes(),
m_base[1]->GetNumModes(),
791 m_base[2]->GetNumModes()};
797 numModes0 = nummodes[0];
798 numModes1 = nummodes[1];
804 numModes0 = nummodes[0];
805 numModes1 = nummodes[2];
811 numModes0 = nummodes[1];
812 numModes1 = nummodes[2];
817 ASSERTL0(
false,
"fid out of range");
824 std::swap(numModes0, numModes1);
839 "BasisType is not a boundary interior form");
842 "BasisType is not a boundary interior form");
845 "BasisType is not a boundary interior form");
847 ASSERTL1((localVertexId >= 0) && (localVertexId < 8),
848 "local vertex id must be between 0 and 7");
855 int nummodes[3] = {
m_base[0]->GetNumModes(),
m_base[1]->GetNumModes(),
856 m_base[2]->GetNumModes()};
858 if (useCoeffPacking ==
true)
860 if (localVertexId > 3)
872 switch (localVertexId % 4)
919 if ((localVertexId % 4) % 3 > 0)
931 if (localVertexId % 4 > 1)
944 if (localVertexId > 3)
957 return r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
967 "BasisType is not a boundary interior form");
970 "BasisType is not a boundary interior form");
973 "BasisType is not a boundary interior form");
976 int nummodes[3] = {
m_base[0]->GetNumModes(),
m_base[1]->GetNumModes(),
977 m_base[2]->GetNumModes()};
981 if (outarray.size() != nIntCoeffs)
994 for (i = 0; i < 3; i++)
999 IntIdx[i][1] = nummodes[i];
1004 IntIdx[i][1] = nummodes[i] - 1;
1008 for (r = IntIdx[2][0]; r < IntIdx[2][1]; r++)
1010 for (
q = IntIdx[1][0];
q < IntIdx[1][1];
q++)
1012 for (
p = IntIdx[0][0];
p < IntIdx[0][1];
p++)
1015 r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
1028 "BasisType is not a boundary interior form");
1031 "BasisType is not a boundary interior form");
1034 "BasisType is not a boundary interior form");
1037 int nummodes[3] = {
m_base[0]->GetNumModes(),
m_base[1]->GetNumModes(),
1038 m_base[2]->GetNumModes()};
1042 if (outarray.size() != nBndCoeffs)
1056 for (i = 0; i < 3; i++)
1064 IntIdx[i][1] = nummodes[i];
1068 BndIdx[i][1] = nummodes[i] - 1;
1070 IntIdx[i][1] = nummodes[i] - 1;
1074 for (i = 0; i < 2; i++)
1077 for (
q = 0;
q < nummodes[1];
q++)
1079 for (
p = 0;
p < nummodes[0];
p++)
1082 r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
1087 for (r = IntIdx[2][0]; r < IntIdx[2][1]; r++)
1089 for (i = 0; i < 2; i++)
1092 for (
p = 0;
p < nummodes[0];
p++)
1095 r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
1099 for (
q = IntIdx[1][0];
q < IntIdx[1][1];
q++)
1101 for (i = 0; i < 2; i++)
1105 r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
1110 sort(outarray.get(), outarray.get() + nBndCoeffs);
1115 std::array<NekDouble, 3> &firstOrderDerivs)
1127 int nummodesA = 0, nummodesB = 0;
1131 "Method only implemented if BasisType is indentical in "
1135 "Method only implemented for Modified_A or "
1136 "GLL_Lagrange BasisType");
1138 const int nummodes0 =
m_base[0]->GetNumModes();
1139 const int nummodes1 =
m_base[1]->GetNumModes();
1140 const int nummodes2 =
m_base[2]->GetNumModes();
1146 nummodesA = nummodes0;
1147 nummodesB = nummodes1;
1151 nummodesA = nummodes0;
1152 nummodesB = nummodes2;
1156 nummodesA = nummodes1;
1157 nummodesB = nummodes2;
1160 ASSERTL0(
false,
"fid must be between 0 and 5");
1163 int nFaceCoeffs = nummodesA * nummodesB;
1165 if (maparray.size() != nFaceCoeffs)
1182 offset = nummodes0 * nummodes1;
1186 offset = (nummodes2 - 1) * nummodes0 * nummodes1;
1204 offset = nummodes0 * (nummodes1 - 1);
1205 jump1 = nummodes0 * nummodes1;
1211 jump1 = nummodes0 * nummodes1;
1222 offset = nummodes0 - 1;
1223 jump1 = nummodes0 * nummodes1;
1230 jump1 = nummodes0 * nummodes1;
1235 ASSERTL0(
false,
"fid must be between 0 and 5");
1238 for (i = 0; i < nummodesB; i++)
1240 for (j = 0; j < nummodesA; j++)
1242 maparray[i * nummodesA + j] = i * jump1 + j * jump2 + offset;
1253 int nummodesA = 0, nummodesB = 0;
1257 "Method only implemented if BasisType is indentical in "
1261 "Method only implemented for Modified_A or "
1262 "GLL_Lagrange BasisType");
1264 const int nummodes0 =
m_base[0]->GetNumModes();
1265 const int nummodes1 =
m_base[1]->GetNumModes();
1266 const int nummodes2 =
m_base[2]->GetNumModes();
1272 nummodesA = nummodes0;
1273 nummodesB = nummodes1;
1277 nummodesA = nummodes0;
1278 nummodesB = nummodes2;
1282 nummodesA = nummodes1;
1283 nummodesB = nummodes2;
1286 ASSERTL0(
false,
"fid must be between 0 and 5");
1298 if (modified ==
false)
1300 ASSERTL1((
P == nummodesA) || (Q == nummodesB),
1301 "Different trace space face dimention "
1302 "and element face dimention not possible for "
1303 "GLL-Lagrange bases");
1306 int nFaceCoeffs =
P * Q;
1308 if (maparray.size() != nFaceCoeffs)
1314 for (i = 0; i < nFaceCoeffs; ++i)
1319 if (signarray.size() != nFaceCoeffs)
1325 fill(signarray.get(), signarray.get() + nFaceCoeffs, 1);
1330 for (i = 0; i < Q; i++)
1332 for (j = 0; j <
P; j++)
1336 arrayindx[i *
P + j] = i *
P + j;
1340 arrayindx[i *
P + j] = j * Q + i;
1347 for (i = 0; i < nummodesB; i++)
1349 for (j = nummodesA; j <
P; j++)
1351 signarray[arrayindx[i *
P + j]] = 0.0;
1352 maparray[arrayindx[i *
P + j]] = maparray[0];
1356 for (i = nummodesB; i < Q; i++)
1358 for (j = 0; j <
P; j++)
1360 signarray[arrayindx[i *
P + j]] = 0.0;
1361 maparray[arrayindx[i *
P + j]] = maparray[0];
1367 for (i = 0; i < Q; i++)
1371 for (j = 0; j <
P; j++)
1373 maparray[arrayindx[i *
P + j]] = i * nummodesA + j;
1377 for (j = nummodesA; j <
P; j++)
1379 signarray[arrayindx[i *
P + j]] = 0.0;
1380 maparray[arrayindx[i *
P + j]] = maparray[0];
1385 for (i = nummodesB; i < Q; i++)
1387 for (j = 0; j <
P; j++)
1389 signarray[arrayindx[i *
P + j]] = 0.0;
1390 maparray[arrayindx[i *
P + j]] = maparray[0];
1404 for (i = 3; i < Q; i += 2)
1406 for (j = 0; j <
P; j++)
1408 signarray[arrayindx[i *
P + j]] *= -1;
1412 for (i = 0; i <
P; i++)
1414 swap(maparray[i], maparray[i +
P]);
1415 swap(signarray[i], signarray[i +
P]);
1420 for (i = 0; i <
P; i++)
1422 for (j = 0; j < Q / 2; j++)
1424 swap(maparray[i + j *
P],
1425 maparray[i +
P * Q -
P - j *
P]);
1426 swap(signarray[i + j *
P],
1427 signarray[i +
P * Q -
P - j *
P]);
1436 for (i = 0; i < Q; i++)
1438 for (j = 3; j <
P; j += 2)
1440 signarray[arrayindx[i *
P + j]] *= -1;
1444 for (i = 0; i < Q; i++)
1446 swap(maparray[i], maparray[i + Q]);
1447 swap(signarray[i], signarray[i + Q]);
1452 for (i = 0; i <
P; i++)
1454 for (j = 0; j < Q / 2; j++)
1456 swap(maparray[i * Q + j], maparray[i * Q + Q - 1 - j]);
1457 swap(signarray[i * Q + j],
1458 signarray[i * Q + Q - 1 - j]);
1474 for (i = 0; i < Q; i++)
1476 for (j = 3; j <
P; j += 2)
1478 signarray[arrayindx[i *
P + j]] *= -1;
1482 for (i = 0; i < Q; i++)
1484 swap(maparray[i *
P], maparray[i *
P + 1]);
1485 swap(signarray[i *
P], signarray[i *
P + 1]);
1490 for (i = 0; i < Q; i++)
1492 for (j = 0; j <
P / 2; j++)
1494 swap(maparray[i *
P + j], maparray[i *
P +
P - 1 - j]);
1495 swap(signarray[i *
P + j],
1496 signarray[i *
P +
P - 1 - j]);
1505 for (i = 3; i < Q; i += 2)
1507 for (j = 0; j <
P; j++)
1509 signarray[arrayindx[i *
P + j]] *= -1;
1513 for (i = 0; i <
P; i++)
1515 swap(maparray[i * Q], maparray[i * Q + 1]);
1516 swap(signarray[i * Q], signarray[i * Q + 1]);
1521 for (i = 0; i < Q; i++)
1523 for (j = 0; j <
P / 2; j++)
1525 swap(maparray[i + j * Q],
1526 maparray[i +
P * Q - Q - j * Q]);
1527 swap(signarray[i + j * Q],
1528 signarray[i +
P * Q - Q - j * Q]);
1548 "BasisType is not a boundary interior form");
1551 "BasisType is not a boundary interior form");
1554 "BasisType is not a boundary interior form");
1557 "local edge id must be between 0 and 11");
1561 if (maparray.size() != nEdgeIntCoeffs)
1566 if (signarray.size() != nEdgeIntCoeffs)
1572 fill(signarray.get(), signarray.get() + nEdgeIntCoeffs, 1);
1575 int nummodes[3] = {
m_base[0]->GetNumModes(),
m_base[1]->GetNumModes(),
1576 m_base[2]->GetNumModes()};
1581 bool reverseOrdering =
false;
1582 bool signChange =
false;
1584 int IdxRange[3][2] = {{0, 0}, {0, 0}, {0, 0}};
1604 IdxRange[2][0] = nummodes[2] - 1;
1605 IdxRange[2][1] = nummodes[2];
1622 IdxRange[2][1] = nummodes[2] - 1;
1626 reverseOrdering =
true;
1632 IdxRange[2][1] = nummodes[2];
1661 IdxRange[1][0] = nummodes[1] - 1;
1662 IdxRange[1][1] = nummodes[1];
1677 IdxRange[1][1] = nummodes[1] - 1;
1681 reverseOrdering =
true;
1687 IdxRange[1][1] = nummodes[1];
1702 IdxRange[1][1] = nummodes[1] - 1;
1706 reverseOrdering =
true;
1712 IdxRange[1][1] = nummodes[1];
1741 IdxRange[0][0] = nummodes[0] - 1;
1742 IdxRange[0][1] = nummodes[0];
1757 IdxRange[0][1] = nummodes[0] - 1;
1761 reverseOrdering =
true;
1767 IdxRange[0][1] = nummodes[0];
1782 IdxRange[0][1] = nummodes[0] - 1;
1786 reverseOrdering =
true;
1792 IdxRange[0][1] = nummodes[0];
1805 for (
int r = IdxRange[2][0]; r < IdxRange[2][1]; r++)
1807 for (
int q = IdxRange[1][0];
q < IdxRange[1][1];
q++)
1809 for (
int p = IdxRange[0][0];
p < IdxRange[0][1];
p++)
1812 r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
1817 if (reverseOrdering)
1819 reverse(maparray.get(), maparray.get() + nEdgeIntCoeffs);
1824 for (
int p = 1;
p < nEdgeIntCoeffs;
p += 2)
1841 "BasisType is not a boundary interior form");
1844 "BasisType is not a boundary interior form");
1847 "BasisType is not a boundary interior form");
1849 ASSERTL1((fid >= 0) && (fid < 6),
"local face id must be between 0 and 5");
1853 if (maparray.size() != nFaceIntCoeffs)
1858 if (signarray.size() != nFaceIntCoeffs)
1864 fill(signarray.get(), signarray.get() + nFaceIntCoeffs, 1);
1867 int nummodes[3] = {
m_base[0]->GetNumModes(),
m_base[1]->GetNumModes(),
1868 m_base[2]->GetNumModes()};
1883 nummodesA = nummodes[0];
1884 nummodesB = nummodes[1];
1890 nummodesA = nummodes[0];
1891 nummodesB = nummodes[2];
1897 nummodesA = nummodes[1];
1898 nummodesB = nummodes[2];
1906 for (
int i = 0; i < (nummodesB - 2); i++)
1908 for (
int j = 0; j < (nummodesA - 2); j++)
1912 arrayindx[i * (nummodesA - 2) + j] = i * (nummodesA - 2) + j;
1916 arrayindx[i * (nummodesA - 2) + j] = j * (nummodesB - 2) + i;
1943 IdxRange[2][0] = nummodes[2] - 1;
1944 IdxRange[2][1] = nummodes[2];
1961 IdxRange[2][0] = nummodes[2] - 2;
1968 IdxRange[2][1] = nummodes[2] - 1;
1975 IdxRange[2][1] = nummodes[2];
1980 for (
int i = 3; i < nummodes[2]; i += 2)
2004 IdxRange[1][0] = nummodes[1] - 1;
2005 IdxRange[1][1] = nummodes[1];
2023 IdxRange[1][0] = nummodes[1] - 2;
2030 IdxRange[1][1] = nummodes[1] - 1;
2037 IdxRange[1][1] = nummodes[1];
2042 for (
int i = 3; i < nummodes[1]; i += 2)
2056 IdxRange[1][0] = nummodes[1] - 2;
2063 IdxRange[1][1] = nummodes[1] - 1;
2070 IdxRange[1][1] = nummodes[1];
2075 for (
int i = 3; i < nummodes[1]; i += 2)
2097 IdxRange[0][0] = nummodes[0] - 1;
2098 IdxRange[0][1] = nummodes[0];
2115 IdxRange[0][0] = nummodes[0] - 2;
2122 IdxRange[0][1] = nummodes[0] - 1;
2129 IdxRange[0][1] = nummodes[0];
2134 for (
int i = 3; i < nummodes[0]; i += 2)
2145 for (
int r = IdxRange[2][0]; r != IdxRange[2][1]; r += Incr[2])
2147 for (
int q = IdxRange[1][0];
q != IdxRange[1][1];
q += Incr[1])
2149 for (
int p = IdxRange[0][0];
p != IdxRange[0][1];
p += Incr[0])
2151 maparray[arrayindx[cnt]] =
2152 r * nummodes[0] * nummodes[1] +
q * nummodes[0] +
p;
2153 signarray[arrayindx[cnt++]] = sign0[
p] * sign1[
q] * sign2[r];
2161 ASSERTL2((i >= 0) && (i <= 11),
"edge id is out of range");
2163 if ((i == 0) || (i == 2) || (i == 8) || (i == 10))
2167 else if ((i == 1) || (i == 3) || (i == 9) || (i == 11))
2188 int nq0 =
m_base[0]->GetNumPoints();
2189 int nq1 =
m_base[1]->GetNumPoints();
2190 int nq2 =
m_base[2]->GetNumPoints();
2200 nq = max(nq0, max(nq1, nq2));
2214 for (
int i = 0; i < nq; ++i)
2216 for (
int j = 0; j < nq; ++j)
2218 for (
int k = 0; k < nq; ++k, ++cnt)
2221 coords[cnt][0] = -1.0 + 2 * k / (
NekDouble)(nq - 1);
2222 coords[cnt][1] = -1.0 + 2 * j / (
NekDouble)(nq - 1);
2223 coords[cnt][2] = -1.0 + 2 * i / (
NekDouble)(nq - 1);
2228 for (
int i = 0; i < neq; ++i)
2232 I[0] =
m_base[0]->GetI(coll);
2233 I[1] =
m_base[1]->GetI(coll + 1);
2234 I[2] =
m_base[2]->GetI(coll + 2);
2238 for (
int k = 0; k < nq2; ++k)
2240 for (
int j = 0; j < nq1; ++j)
2243 fac = (I[1]->GetPtr())[j] * (I[2]->GetPtr())[k];
2247 Mat->GetRawPtr() + k * nq0 * nq1 * neq +
2311 int nquad0 =
m_base[0]->GetNumPoints();
2312 int nquad1 =
m_base[1]->GetNumPoints();
2313 int nquad2 =
m_base[2]->GetNumPoints();
2314 int nq01 = nquad0 * nquad1;
2315 int nq12 = nquad1 * nquad2;
2321 for (
int i = 0; i < nq12; ++i)
2323 Vmath::Vmul(nquad0, inarray.get() + i * nquad0, 1, w0.get(), 1,
2324 outarray.get() + i * nquad0, 1);
2327 for (
int i = 0; i < nq12; ++i)
2329 Vmath::Smul(nquad0, w1[i % nquad1], outarray.get() + i * nquad0, 1,
2330 outarray.get() + i * nquad0, 1);
2333 for (
int i = 0; i < nquad2; ++i)
2335 Vmath::Smul(nq01, w2[i], outarray.get() + i * nq01, 1,
2336 outarray.get() + i * nq01, 1);
2344 int qa =
m_base[0]->GetNumPoints();
2345 int qb =
m_base[1]->GetNumPoints();
2346 int qc =
m_base[2]->GetNumPoints();
2347 int nmodes_a =
m_base[0]->GetNumModes();
2348 int nmodes_b =
m_base[1]->GetNumModes();
2349 int nmodes_c =
m_base[2]->GetNumModes();
2364 OrthoExp.
FwdTrans(array, orthocoeffs);
2374 for (
int i = 0; i < nmodes_a; ++i)
2376 for (
int j = 0; j < nmodes_b; ++j)
2379 pow((1.0 * i) / (nmodes_a - 1), cutoff * nmodes_a),
2380 pow((1.0 * j) / (nmodes_b - 1), cutoff * nmodes_b));
2382 for (
int k = 0; k < nmodes_c; ++k)
2385 std::max(fac1, pow((1.0 * k) / (nmodes_c - 1),
2386 cutoff * nmodes_c));
2388 orthocoeffs[cnt] *= SvvDiffCoeff * fac;
2404 max_abc = max(max_abc, 0);
2407 for (
int i = 0; i < nmodes_a; ++i)
2409 for (
int j = 0; j < nmodes_b; ++j)
2411 int maxij = max(i, j);
2413 for (
int k = 0; k < nmodes_c; ++k)
2415 int maxijk = max(maxij, k);
2429 min(nmodes_a, nmodes_b));
2432 int nmodes = max(nmodes_a, nmodes_b);
2433 nmodes = max(nmodes, nmodes_c);
2436 for (
int j = cutoff; j < nmodes; ++j)
2438 fac[j] = fabs((j - nmodes) / ((
NekDouble)(j - cutoff + 1.0)));
2442 for (
int i = 0; i < nmodes_a; ++i)
2444 for (
int j = 0; j < nmodes_b; ++j)
2446 for (
int k = 0; k < nmodes_c; ++k)
2448 if ((i >= cutoff) || (j >= cutoff) || (k >= cutoff))
2450 orthocoeffs[i * nmodes_a * nmodes_b + j * nmodes_c +
2452 (SvvDiffCoeff * exp(-(fac[i] + fac[j] + fac[k])));
2456 orthocoeffs[i * nmodes_a * nmodes_b + j * nmodes_c +
2465 OrthoExp.
BwdTrans(orthocoeffs, array);
2474 int qa =
m_base[0]->GetNumPoints();
2475 int qb =
m_base[1]->GetNumPoints();
2476 int qc =
m_base[2]->GetNumPoints();
2477 int nmodesA =
m_base[0]->GetNumModes();
2478 int nmodesB =
m_base[1]->GetNumModes();
2479 int nmodesC =
m_base[2]->GetNumModes();
2480 int P = nmodesA - 1;
2481 int Q = nmodesB - 1;
2482 int R = nmodesC - 1;
2495 int Pcut = cutoff *
P;
2496 int Qcut = cutoff * Q;
2497 int Rcut = cutoff * R;
2501 OrthoExp.
FwdTrans(array, orthocoeffs);
2506 for (
int i = 0; i < nmodesA; ++i)
2508 for (
int j = 0; j < nmodesB; ++j)
2510 for (
int k = 0; k < nmodesC; ++k, ++index)
2513 if (i > Pcut || j > Qcut || k > Rcut)
2518 fac = max(max(fac1, fac2), fac3);
2519 fac = pow(fac, exponent);
2520 orthocoeffs[index] *= exp(-alpha * fac);
2527 OrthoExp.
BwdTrans(orthocoeffs, array);
2533 int np0 =
m_base[0]->GetNumPoints();
2534 int np1 =
m_base[1]->GetNumPoints();
2535 int np2 =
m_base[2]->GetNumPoints();
2536 int np = max(np0, max(np1, np2));
2544 for (
int i = 0; i < np - 1; ++i)
2546 for (
int j = 0; j < np - 1; ++j)
2549 for (
int k = 0; k < np - 1; ++k)
2551 conn[cnt++] = plane + row + k;
2552 conn[cnt++] = plane + row + k + 1;
2553 conn[cnt++] = plane + rowp1 + k;
2555 conn[cnt++] = plane + rowp1 + k + 1;
2556 conn[cnt++] = plane + rowp1 + k;
2557 conn[cnt++] = plane + row + k + 1;
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Describes the specification for a Basis.
Defines a specification for a set of points.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
void IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
void v_HelmholtzMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
NekDouble BaryTensorDeriv(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs)
void v_LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d1, Array< OneD, NekDouble > &outarray_d2, Array< OneD, NekDouble > &outarray_d3)
Calculate the 3D derivative in the local tensor/collapsed coordinate at the physical points.
The base class for all shapes.
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
void WeakDerivMatrixOp_MatFree(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
int NumBndryCoeffs(void) const
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
void LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
Convert local cartesian coordinate xi into local collapsed coordinates eta.
void BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
DNekMatSharedPtr CreateGeneralMatrix(const StdMatrixKey &mkey)
this function generates the mass matrix
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
this function calculates the inner product of a given function f with the different modes of the expa...
void LaplacianMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Forward transformation from physical space to coefficient space.
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
void MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Array< OneD, LibUtilities::BasisSharedPtr > m_base
void MassMatrixOp_MatFree(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
Class representing a hexehedral element in reference space.
int v_NumDGBndryCoeffs() const override
void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey) override
void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2) override
Differentiation Methods.
void v_ExponentialFilter(Array< OneD, NekDouble > &array, const NekDouble alpha, const NekDouble exponent, const NekDouble cutoff) override
int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false) override
void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta) override
int v_CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset) override
LibUtilities::PointsKey v_GetTracePointsKey(const int i, const int j) const override
NekDouble v_PhysEvaluateBasis(const Array< OneD, const NekDouble > &coords, int mode) final
void v_GetTraceInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2) override
void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey) override
NekDouble v_PhysEvaluate(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs) override
int v_GetEdgeNcoeffs(const int i) const override
void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multbyweights=true) override
StdHexExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc)
int v_GetTraceNumPoints(const int i) const override
const LibUtilities::BasisKey v_GetTraceBasisKey(const int i, const int k) const override
void v_GetTraceCoeffMap(const unsigned int fid, Array< OneD, unsigned int > &maparray) override
LibUtilities::ShapeType v_DetShapeType() const override
void v_GetTraceNumModes(const int fid, int &numModes0, int &numModes1, Orientation faceOrient=eDir1FwdDir1_Dir2FwdDir2) override
void v_LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi) override
void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey) override
int v_NumBndryCoeffs() const override
int v_GetNedges() const override
void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
int v_GetNtraces() const override
void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey) override
int v_GetNverts() const override
bool v_IsBoundaryInteriorExpansion() const override
void v_GetInteriorMap(Array< OneD, unsigned int > &outarray) override
void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray) override
void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray) override
void v_GetSimplexEquiSpacedConnectivity(Array< OneD, int > &conn, bool standard=true) override
void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey) override
int v_GetTraceIntNcoeffs(const int i) const override
void v_StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2) override
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_GetElmtTraceToTraceMap(const unsigned int fid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation faceOrient, int P, int Q) override
void v_BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2) override
void v_GetEdgeInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2) override
void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey) override
void v_GetCoords(Array< OneD, NekDouble > &coords_x, Array< OneD, NekDouble > &coords_y, Array< OneD, NekDouble > &coords_z) override
DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey) override
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2) override
int v_GetTraceNcoeffs(const int i) const override
void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
MatrixType GetMatrixType() const
NekDouble GetConstFactor(const ConstFactorType &factor) const
bool ConstFactorExists(const ConstFactorType &factor) const
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
int getNumberOfCoefficients(int Na, int Nb, int Nc)
@ eModified_B
Principle Modified Functions .
@ P
Monomial polynomials .
@ eOrtho_A
Principle Orthogonal Functions .
@ eModified_C
Principle Modified Functions .
@ eGLL_Lagrange
Lagrange for SEM basis .
@ eOrtho_C
Principle Orthogonal Functions .
@ eOrtho_B
Principle Orthogonal Functions .
@ eModified_A
Principle Modified Functions .
static const NekDouble kNekZeroTol
@ eFactorSVVDGKerDiffCoeff
@ eFactorSVVPowerKerDiffCoeff
const int kSVVDGFiltermodesmin
const int kSVVDGFiltermodesmax
LibUtilities::BasisKey EvaluateQuadFaceBasisKey(const int facedir, const LibUtilities::BasisType faceDirBasisType, const int numpoints, const int nummodes)
const NekDouble kSVVDGFilter[9][11]
@ ePhysInterpToEquiSpaced
@ eDir1BwdDir2_Dir2BwdDir1
@ eDir1FwdDir1_Dir2FwdDir2
@ eDir1BwdDir1_Dir2BwdDir2
@ eDir1BwdDir2_Dir2FwdDir1
@ eDir1FwdDir1_Dir2BwdDir2
@ eDir1BwdDir1_Dir2FwdDir2
@ eDir1FwdDir2_Dir2FwdDir1
@ eDir1FwdDir2_Dir2BwdDir1
std::vector< double > q(NPUPPER *NPUPPER)
static Array< OneD, NekDouble > NullNekDouble1DArray
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)