68 const vector<bool> &LeftAdjacents)
70 const std::shared_ptr<LocalRegions::ExpansionVector> exp = locExp.
GetExp();
72 m_expdim = (*exp)[0]->GetShapeDimension();
96 int cnt, n, e, phys_offset;
98 int nexp = exp->size();
110 for (cnt = n = 0; n < nexp; ++n)
114 for (
int i = 0; i < elmt->GetNtraces(); ++i, ++cnt)
116 int nLocPts = elmt->GetTraceNumPoints(i);
120 if (LeftAdjacents[cnt])
122 nFwdPts += elmtToTrace[n][i]->GetTotPoints();
123 nFwdCoeffs += elmtToTrace[n][i]->GetNcoeffs();
128 nBwdPts += elmtToTrace[n][i]->GetTotPoints();
129 nBwdCoeffs += elmtToTrace[n][i]->GetNcoeffs();
163 map<TraceInterpPoints, vector<pair<int, int>>,
cmpop> TraceInterpMap;
165 vector<vector<int>> TraceOrder;
166 TraceOrder.resize(nexp);
167 vector<vector<int>> ElmtPhysTraceOffset;
168 ElmtPhysTraceOffset.resize(nexp);
176 for (cnt = n = 0; n < nexp; ++n)
179 ntrace = elmt->GetNtraces();
180 TraceOrder[n].resize(ntrace);
181 ElmtPhysTraceOffset[n].resize(ntrace);
189 for (e = 0; e < ntrace; ++e, ++cnt)
202 fromPointsKey0 = elmt->GetBasis(0)->GetPointsKey();
215 int dir0 = elmt->GetGeom()->GetDir(e, 0);
217 fromPointsKey0 = elmt->GetBasis(dir0)->GetPointsKey();
221 toPointsKey0 = elmttrace->GetBasis(0)->GetPointsKey();
225 P[0] = elmttrace->GetBasisNumModes(0);
230 int dir0 = elmt->GetGeom()->GetDir(e, 0);
231 int dir1 = elmt->GetGeom()->GetDir(e, 1);
233 fromPointsKey0 = elmt->GetBasis(dir0)->GetPointsKey();
234 fromPointsKey1 = elmt->GetBasis(dir1)->GetPointsKey();
238 toPointsKey0 = elmttrace->GetBasis(0)->GetPointsKey();
239 toPointsKey1 = elmttrace->GetBasis(1)->GetPointsKey();
240 P[0] = elmttrace->GetBasisNumModes(0);
241 P[1] = elmttrace->GetBasisNumModes(1);
245 toPointsKey0 = elmttrace->GetBasis(1)->GetPointsKey();
246 toPointsKey1 = elmttrace->GetBasis(0)->GetPointsKey();
247 P[0] = elmttrace->GetBasisNumModes(1);
248 P[1] = elmttrace->GetBasisNumModes(0);
255 toPointsKey0, toPointsKey1);
257 pair<int, int> epf(n, e);
258 TraceInterpMap[fpoint].push_back(epf);
259 TraceOrder[n][e] = cnt;
261 ElmtPhysTraceOffset[n][e] = neoffset;
262 neoffset += elmt->GetTraceNumPoints(e);
271 elmt->GetTraceToElementMap(e, map,
sign, orient,
P[0],
P[1]);
273 int order_t = elmttrace->GetNcoeffs();
274 int t_offset = trace->GetCoeff_Offset(elmttrace->GetElmtId());
278 if (elmt->GetTraceExp(e)->GetRightAdjacentElementExp())
280 if (elmttrace->GetRightAdjacentElementExp()
282 ->GetGlobalID() == elmt->GetGeom()->GetGlobalID())
288 if (LeftAdjacents[cnt])
291 for (
int i = 0; i < order_t; ++i)
301 for (
int i = 0; i < order_t; ++i)
311 trace->GetPhys_Offset(elmttrace->GetElmtId());
328 int nInterpType = TraceInterpMap.size();
331 for (
int i = 0; i < 2; ++i)
343 for (
int i = 0; i < 2; ++i)
352 int ntracepts, ntracepts1;
364 for (
auto it = TraceInterpMap.begin(); it != TraceInterpMap.end();
375 for (
int f = 0; f < it->second.size(); ++f, ++cnt2)
377 n = it->second[f].first;
378 e = it->second[f].second;
387 elmt->GetTracePhysMap(e, traceids);
389 ntracepts = elmt->GetTraceNumPoints(e);
390 ntracepts1 = elmttrace->GetTotPoints();
398 elmt->ReOrientTracePhysMap(orient, locTraceToTraceMap,
404 elmt->ReOrientTracePhysMap(orient, locTraceToTraceMap,
409 int offset = trace->GetPhys_Offset(elmtToTrace[n][e]->GetElmtId());
411 if (LeftAdjacents[TraceOrder[n][e]])
414 for (
int i = 0; i < ntracepts; ++i)
417 phys_offset + traceids[i];
420 for (
int i = 0; i < ntracepts; ++i)
423 ElmtPhysTraceOffset[n][e] + i;
427 for (
int i = 0; i < ntracepts1; ++i)
430 offset + locTraceToTraceMap[i];
434 cntFwd1 += ntracepts1;
440 for (
int i = 0; i < ntracepts; ++i)
443 phys_offset + traceids[i];
446 for (
int i = 0; i < ntracepts; ++i)
449 ElmtPhysTraceOffset[n][e] + i;
454 for (
int i = 0; i < ntracepts1; ++i)
457 offset + locTraceToTraceMap[i];
461 cntBwd1 += ntracepts1;
469 if ((fwdSet ==
false && set == 0) || (bwdSet ==
false && set == 1))
483 if (fromPointsKey0 == toPointsKey0)
492 ->GetI(toPointsKey0);
495 ->GetI(fromPointsKey0);
502 LibUtilities::eGaussRadauMAlpha1Beta0) &&
533 if (fromPointsKey0 == toPointsKey0)
535 if (fromPointsKey1 == toPointsKey1)
545 ->GetI(toPointsKey1);
548 ->GetI(fromPointsKey1);
557 eGaussRadauMAlpha1Beta0) &&
587 if (fromPointsKey1 == toPointsKey1)
593 ->GetI(toPointsKey0);
596 ->GetI(fromPointsKey0);
605 eGaussRadauMAlpha1Beta0) &&
638 ->GetI(toPointsKey0);
641 ->GetI(fromPointsKey0);
645 ->GetI(toPointsKey1);
648 ->GetI(fromPointsKey1);
657 eGaussRadauMAlpha1Beta0) &&
709 for (
int cid = 1; cid < collections.size(); ++cid)
712 collections[cid - 1].GetExpVector().size();
719 std::map<std::tuple<int, int, int, int>,
int> map_locTraceToTrace;
722 std::vector<Array<OneD, int>> orientationMaps;
726 for (
int cid = 0; cid < collections.size(); ++cid)
728 auto pCollExp = collections[cid].GetExpVector();
729 auto pGeomData = collections[cid].GetGeomSharedPtr();
732 std::dynamic_pointer_cast<LocalRegions::Expansion>(pCollExp[0]);
746 for (
int dir = 0; dir < 2; ++dir)
761 int tmp = std::max(fnp0 * fnp1, tnp0 * tnp1);
771 int tmp = std::max(fnp0, tnp0);
782 for (
int e = 0; e < exp->GetNtraces(); e++)
792 for (
int e = 0; e < exp->GetNtraces(); e++)
794 exp->GetTracePhysMap(
801 for (
int e = 0; e < exp->GetNtraces(); e++)
810 for (
int e = 0; e < exp->GetNtraces(); e++)
818 orientationMaps.clear();
819 map_locTraceToTrace.clear();
821 int cntCollLocTrace = 0;
822 for (
int n = 0; n < pCollExp.size(); n++, elmtId++)
825 std::dynamic_pointer_cast<LocalRegions::Expansion>(pCollExp[n]);
826 for (
int e = 0; e < locExp->GetNtraces(); e++, cntCollLocTrace++)
829 if (!LeftAdjacents[cntLocTrace + cntCollLocTrace])
834 int orient =
static_cast<int>(locExp->GetTraceOrient(e));
842 shape =
static_cast<int>(
843 locExp->GetGeom()->GetEdge(e)->GetShapeType());
846 shape =
static_cast<int>(
847 locExp->GetGeom()->GetFace(e)->GetShapeType());
851 std::tuple<int, int, int, int>{shape, orient, dir, typid};
852 if (map_locTraceToTrace.find(thisKey) ==
853 map_locTraceToTrace.end())
861 exp->ReOrientTracePhysMap(locExp->GetTraceOrient(e),
862 thisMapArray, tnp0, tnp1);
863 orientationMaps.push_back(thisMapArray);
865 orientationMaps.size() - 1;
866 map_locTraceToTrace[thisKey] = orientationMaps.size() - 1;
871 map_locTraceToTrace[thisKey];
874 std::array<LibUtilities::BasisKey, 3> thisExpKeys{
881 elmtToTrace[elmtId][e]->GetElmtId();
889 for (
int i = 0; i < orientationMaps.size(); ++i)
898 for (
int e = 0; e < exp->GetNtraces(); e++)
902 for (
int n = 0; n < pCollExp.size(); n++)
905 LeftAdjacents[cntLocTrace + n * exp->GetNtraces() + e];
913 for (
int e = 0; e < exp->GetNtraces(); e++)
917 for (
int n = 0; n < pCollExp.size(); n++)
926 cntLocTrace += cntCollLocTrace;
955 "CalcLocTracePhysToTraceIDMap not coded");
962 std::shared_ptr<LocalRegions::ExpansionVector> traceExp =
964 int ntotTrace = (*traceExp).size();
973 for (
int nt = 0; nt < ntotTrace; nt++)
975 ntPnts = tracelist->GetTotPoints(nt);
976 noffset = tracelist->GetPhys_Offset(nt);
977 for (
int i = 0; i < ntPnts; i++)
988 for (
int dir = 0; dir < 2; dir++)
1011 for (
int ne = 0; ne < nedges; ne++)
1013 Vmath::Fill(fnp, tmp[cnt1], &loctracePntsLR[dir][cnt], 1);
1022 for (
int nlr = 0; nlr < 2; nlr++)
1024 for (
int i = 0; i < loctracePntsLR[nlr].size(); i++)
1027 std::round(loctracePntsLR[nlr][i]);
1028 error +=
abs(loctracePntsLR[nlr][i] -
1034 "m_LocTracephysToTraceIDMap may not be integer !!");
1040 std::shared_ptr<LocalRegions::ExpansionVector> traceExp =
1041 tracelist->GetExp();
1042 int ntotTrace = (*traceExp).size();
1043 int ntPnts, noffset;
1051 for (
int nt = 0; nt < ntotTrace; nt++)
1053 ntPnts = tracelist->GetTotPoints(nt);
1054 noffset = tracelist->GetPhys_Offset(nt);
1055 for (
int i = 0; i < ntPnts; i++)
1066 for (
int dir = 0; dir < 2; dir++)
1095 int nfttl = fnp0 * fnp1;
1099 Vmath::Fill(nfttl, tmp[cnt1], &loctracePntsLR[dir][cnt], 1);
1101 cnt1 += tnp0 * tnp1;
1108 for (
int nlr = 0; nlr < 2; nlr++)
1110 for (
int i = 0; i < loctracePntsLR[nlr].size(); i++)
1113 std::round(loctracePntsLR[nlr][i]);
1114 error +=
abs(loctracePntsLR[nlr][i] -
1120 "m_LocTracephysToTraceIDMap may not be integer !!");
1132 const std::shared_ptr<LocalRegions::ExpansionVector> exptrac =
1134 size_t ntrace = exptrac->size();
1142 for (
int lr = 0; lr < 2; ++lr)
1148 for (
int i = 0; i < ntrace; ++i)
1150 size_t ncoeff = trace->GetNcoeffs(i);
1159 trace->GetCoeffsToElmt();
1161 for (
int lr = 0; lr < 2; ++lr)
1164 for (
int i = 0; i < ntotcoeffs; ++i)
1170 int ntraceelmt = trace_coeffToElmt[ncoeffTrace].first;
1171 int ntracelocN = trace_coeffToElmt[ncoeffTrace].second;
1173 int nfieldelmt = field_coeffToElmt[ncoeffField].first;
1174 int nfieldlocN = field_coeffToElmt[ncoeffField].second;
1176 LRAdjflag[lr][ntraceelmt] =
true;
1177 LRAdjExpid[lr][ntraceelmt] = nfieldelmt;
1179 elmtLRMap[lr][ntraceelmt][ntracelocN] = nfieldlocN;
1180 elmtLRSign[lr][ntraceelmt][ntracelocN] =
sign;
1192 const std::shared_ptr<LocalRegions::ExpansionVector> exptrac =
1194 int ntrace = exptrac->size();
1196 const std::shared_ptr<LocalRegions::ExpansionVector> exp = locExp.
GetExp();
1197 int nexp = exp->size();
1204 std::set<std::pair<int, int>> neighborSet;
1206 for (
int nt = 0; nt < ntrace; nt++)
1208 if (LRAdjflag[0][nt] && LRAdjflag[1][nt])
1210 ntmp0 = LRAdjExpid[0][nt];
1211 ntmp1 = LRAdjExpid[1][nt];
1214 " ntmp0==ntmp1, trace inside a element?? ");
1216 std::set<std::pair<int, int>>::iterator it = neighborSet.begin();
1217 neighborSet.insert(it, std::make_pair(ntmp0, ntmp1));
1218 neighborSet.insert(it, std::make_pair(ntmp1, ntmp0));
1223 for (std::set<std::pair<int, int>>::iterator it = neighborSet.begin();
1224 it != neighborSet.end(); ++it)
1226 int ncurrent = it->first;
1227 ElemIndex[ncurrent]++;
1234 for (
int ne = 0; ne < nexp; ne++)
1236 int neighb = ElemNeighbsNumb[ne];
1241 for (
int ne = 0; ne < nexp; ne++)
1245 for (std::set<std::pair<int, int>>::iterator it = neighborSet.begin();
1246 it != neighborSet.end(); ++it)
1248 int ncurrent = it->first;
1249 int neighbor = it->second;
1250 ElemNeighbsId[ncurrent][ElemIndex[ncurrent]] = neighbor;
1251 ElemIndex[ncurrent]++;
1255 for (
int ne = 0; ne < nexp; ne++)
1258 for (
int nb = 0; nb < ElemNeighbsNumb[ne]; nb++)
1260 int neighbId = ElemNeighbsId[ne][nb];
1262 for (
int nc = 0; nc < ElemIndex[ne]; nc++)
1264 if (ElemNeighbsId[ne][nb] == tmpId[ne][nc])
1271 tmpId[ne][ElemIndex[ne]] = neighbId;
1276 ElemNeighbsNumb = ElemIndex;
1277 for (
int ne = 0; ne < nexp; ne++)
1279 int neighb = ElemNeighbsNumb[ne];
1283 Vmath::Vcopy(neighb, tmpId[ne], 1, ElemNeighbsId[ne], 1);
1288 for (
int ne = 0; ne < nexp; ne++)
1290 for (
int nb = 0; nb < ElemNeighbsNumb[ne]; nb++)
1292 ASSERTL0((ElemNeighbsId[ne][nb] >= 0) &&
1293 (ElemNeighbsId[ne][nb] <= nexp),
1294 "Element id <0 or >number of total elements")
1331 size_t nfield = field.size();
1363 ASSERTL1(dir < 2,
"option dir out of range, "
1364 " dir=0 is fwd, dir=1 is bwd");
1381 ASSERTL1(dir < 2,
"option dir out of range, "
1382 " dir=0 is fwd, dir=1 is bwd");
1426 ASSERTL1(dir < 2,
"option dir out of range, "
1427 " dir=0 is fwd, dir=1 is bwd");
1458 tmp.data() + cnt1, 1);
1462 int fbegin, fend, fsize;
1463 int tbegin, tend, tsize;
1468 fsize = fend - fbegin;
1469 tsize = tend - tbegin;
1472 "Quad ranges mismatch in InterpLocEdgesToTrace!");
1473 for (
int k = 0; k < nedges; ++k)
1476 fsize, locedges.data() + cnt + fnp * k + fbegin,
1477 1, tmp.data() + cnt1 + tnp * k + tbegin, 1);
1480 tmp.data() + cnt1 + tnp * k, 1);
1483 tmp[cnt1 + tnp * k + tend - 1],
1484 tmp.data() + cnt1 + tnp * k + tend, 1);
1493 I0->GetPtr().data(), tnp, locedges.data() + cnt,
1494 fnp, 0.0, tmp.data() + cnt1, tnp);
1501 for (
int k = 0; k < nedges; ++k)
1504 &tmp[cnt1 + k * tnp], 1);
1507 fnp, locedges.data() + cnt + k * fnp, 1, &I0[0], 1);
1513 "Invalid interpolation type for 2D elements");
1517 cnt += nedges * fnp;
1518 cnt1 += nedges * tnp;
1538 ASSERTL1(dir < 2,
"option dir out of range, "
1539 " dir=0 is fwd, dir=1 is bwd");
1567 int nfromfacepts = fnp0 * fnp1;
1568 int ntofacepts = tnp0 * tnp1;
1575 if (fnp0 == tnp0 && fnp1 == tnp1)
1578 locfaces.data() + cnt, 1,
1579 tmp.data() + cnt1, 1);
1583 int fbegin0, fend0, fbegin1, fend1;
1584 int tbegin0, tend0, tbegin1, tend1;
1594 fend0 - fbegin0 == tend0 - tbegin0 &&
1595 fend1 - fbegin1 == tend1 - tbegin1,
1596 "Quad ranges mismatch in InterpLocFacesToTrace!");
1597 for (
int j = 0; j < nfaces; ++j)
1599 for (
int k = fbegin1, l = tbegin1; k < fend1;
1604 locfaces.data() + cnt + j * nfromfacepts +
1607 tmp.data() + cnt1 + j * ntofacepts +
1618 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
1619 I0->GetPtr().data(), tnp0,
1620 locfaces.data() + cnt, fnp0, 0.0,
1621 tmp.data() + cnt1, tnp0);
1627 for (
int k = 0; k < fnp0; ++k)
1630 fnp0, tmp.data() + cnt1 + k, tnp0);
1635 tmp.data() + cnt1, tnp0, I0.data(), 1, 0.0,
1636 tmp.data() + cnt1 + tnp0 - 1, tnp0);
1642 for (
int j = 0; j < nfaces; ++j)
1645 locfaces.data() + cnt + j * fnp0 * fnp1,
1646 tnp0, I1->GetPtr().data(), tnp1, 0.0,
1647 tmp.data() + cnt1 + j * tnp0 * tnp1, tnp0);
1654 for (
int j = 0; j < nfaces; ++j)
1658 locfaces.data() + cnt + j * fnp0 * fnp1, 1,
1659 tmp.data() + cnt1 + j * tnp0 * tnp1, 1);
1662 for (
int k = 0; k < tnp0; ++k)
1664 tmp[cnt1 + k + (j + 1) * tnp0 * tnp1 - tnp0] =
1666 locfaces.data() + cnt +
1667 j * fnp0 * fnp1 + k,
1679 for (
int j = 0; j < nfaces; ++j)
1682 locfaces.data() + cnt + j * fnp0 * fnp1,
1683 fnp0, I1->GetPtr().data(), tnp1, 0.0,
1684 wsp.data() + j * fnp0 * tnp1, fnp0);
1686 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
1687 I0->GetPtr().data(), tnp0, wsp.data(), fnp0,
1688 0.0, tmp.data() + cnt1, tnp0);
1696 for (
int j = 0; j < nfaces; ++j)
1699 locfaces.data() + cnt + j * fnp0 * fnp1,
1700 fnp0, I1->GetPtr().data(), tnp1, 0.0,
1701 tmp.data() + cnt1 + j * tnp0 * tnp1, tnp0);
1705 tmp.data() + cnt1, tnp0, I0.data(), 1, 0.0,
1706 tmp.data() + cnt1 + tnp0 - 1, tnp0);
1710 ASSERTL0(
false,
"Interplation case needs implementing");
1713 cnt += nfaces * nfromfacepts;
1714 cnt1 += nfaces * ntofacepts;
1751 ASSERTL1(dir < 2,
"option dir out of range, "
1752 " dir=0 is fwd, dir=1 is bwd");
1788 fsize = fsize - fbegin;
1789 tsize = tsize - tbegin;
1790 ASSERTL0(fsize == tsize,
"Quad ranges mismatch in "
1791 "InterpLocEdgesToTraceTranspose!");
1792 for (
int k = 0; k < nedges; ++k)
1794 Vmath::Zero(fnp, locedges.data() + cnt + fnp * k, 1);
1796 fsize, tmp.data() + cnt1 + tnp * k + tbegin, 1,
1797 locedges.data() + cnt + fnp * k + fbegin, 1);
1805 I0->GetPtr().data(), tnp, tmp.data() + cnt1,
1806 tnp, 0.0, locedges.data() + cnt, fnp);
1813 for (
int k = 0; k < nedges; ++k)
1816 &locedges[cnt + k * fnp], 1);
1818 Vmath::Svtvp(fnp, tmp[cnt1 + k * tnp + tnp - 1], &I0[0],
1819 1, locedges.data() + cnt + k * fnp, 1,
1820 locedges.data() + cnt + k * fnp, 1);
1826 "Invalid interpolation type for 2D elements");
1830 cnt += nedges * fnp;
1831 cnt1 += nedges * tnp;
1847 ASSERTL1(dir < 2,
"option dir out of range, "
1848 " dir=0 is fwd, dir=1 is bwd");
1883 int nfromfacepts = fnp0 * fnp1;
1884 int ntofacepts = tnp0 * tnp1;
1891 int fbegin0, fend0, fbegin1, fend1;
1892 int tbegin0, tend0, tbegin1, tend1;
1902 fend0 = fend0 - fbegin0;
1903 tend0 = tend0 - tbegin0;
1905 fend1 - fbegin1 == tend1 - tbegin1,
1906 "Quad ranges mismatch in "
1907 "InterpLocFacesToTraceTranspose!");
1908 for (
int j = 0; j < nfaces; ++j)
1910 for (
int k = fbegin1, l = tbegin1; k < fend1; ++k, ++l)
1913 tmp.data() + cnt1 + j * ntofacepts +
1916 loctraces.data() + cnt +
1917 j * nfromfacepts + k * fnp0 +
1928 I0->GetPtr().data(), tnp0, tmp.data() + cnt1,
1929 tnp0, 0.0, loctraces.data() + cnt, fnp0);
1934 for (
int k = 0; k < fnp0; ++k)
1936 Vmath::Vcopy(nfaces * fnp1, tmp.data() + cnt1 + k, tnp0,
1937 loctraces.data() + cnt + k, fnp0);
1941 for (
int k = 0; k < tnp1 * nfaces; k++)
1945 loctraces.data() + cnt + k * fnp0, 1,
1946 loctraces.data() + cnt + k * fnp0, 1);
1957 tmp.data() + cnt1 + j * tnp0 * tnp1, tnp0,
1958 I1->GetPtr().data(), tnp1, 0.0,
1959 loctraces.data() + cnt + j * fnp0 * fnp1,
1970 fnp0 * fnp1, tmp.data() + cnt1 + j * tnp0 * tnp1, 1,
1971 loctraces.data() + cnt + j * fnp0 * fnp1, 1);
1973 for (
int k = 0; k < fnp1; k++)
1977 &tmp[cnt1 + (j + 1) * tnp0 * tnp1 - tnp0], 1,
1978 &loctraces[cnt + j * fnp0 * fnp1 + k * fnp0], 1,
1979 &loctraces[cnt + j * fnp0 * fnp1 + k * fnp0],
1994 tnp0, 1.0, I0->GetPtr().data(), tnp0,
1995 tmp.data() + cnt1, tnp0, 0.0, wsp.data(), fnp0);
2000 wsp.data() + j * fnp0 * tnp1, fnp0,
2001 I1->GetPtr().data(), tnp1, 0.0,
2002 loctraces.data() + cnt + j * fnp0 * fnp1,
2018 &I0[0], 1, tmp.data() + cnt1 + k * tnp0, 1,
2019 wsp.data() + k * fnp0, 1);
2025 wsp.data() + j * fnp0 * tnp1, fnp0,
2026 I1->GetPtr().data(), tnp1, 0.0,
2027 loctraces.data() + cnt + j * fnp0 * fnp1,
2033 cnt += nfaces * nfromfacepts;
2034 cnt1 += nfaces * ntofacepts;
2075 ASSERTL1(dir < 2,
"option dir out of range, "
2076 " dir=0 is fwd, dir=1 is bwd");
2115 fend = fend - fbegin;
2116 tend = tend - tbegin;
2118 "Quad ranges mismatch in InterpTraceToLocEdges!");
2119 for (
int k = 0; k < nedges; ++k)
2121 Vmath::Zero(tnp, locedges.data() + cnt1 + tnp * k, 1);
2123 fend, tmp.data() + cnt + fnp * k + fbegin, 1,
2124 locedges.data() + cnt1 + tnp * k + tbegin, 1);
2132 I0->GetPtr().data(), tnp, tmp.data() + cnt, fnp,
2133 0.0, locedges.data() + cnt1, tnp);
2139 for (
int k = 0; k < nedges; ++k)
2143 &locedges[cnt1 + k * tnp], 1);
2149 "Invalid interpolation type for 2D elements");
2153 cnt += nedges * fnp;
2154 cnt1 += nedges * tnp;
2171 ASSERTL1(dir < 2,
"option dir out of range, "
2172 " dir=0 is fwd, dir=1 is bwd");
2204 int nfromfacepts = fnp0 * fnp1;
2205 int ntofacepts = tnp0 * tnp1;
2212 int fbegin0, fend0, fbegin1, fend1;
2213 int tbegin0, tend0, tbegin1, tend1;
2223 fend0 = fend0 - fbegin0;
2224 tend0 = tend0 - tbegin0;
2226 fend1 - fbegin1 == tend1 - tbegin1,
2227 "Quad ranges mismatch in InterpTraceToLocFaces!");
2228 for (
int j = 0; j < nfaces; ++j)
2231 locfaces.data() + cnt1 + ntofacepts * j, 1);
2232 for (
int k = fbegin1, l = tbegin1; k < fend1; ++k, ++l)
2235 tmp.data() + cnt + j * nfromfacepts +
2238 locfaces.data() + cnt1 +
2239 ntofacepts * j + l * tnp0 +
2249 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
2250 I0->GetPtr().data(), tnp0, tmp.data() + cnt,
2251 fnp0, 0.0, locfaces.data() + cnt1, tnp0);
2257 for (
int j = 0; j < nfaces; ++j)
2260 tmp.data() + cnt + j * fnp0 * fnp1, tnp0,
2261 I1->GetPtr().data(), tnp1, 0.0,
2262 locfaces.data() + cnt1 + j * tnp0 * tnp1,
2269 for (
int j = 0; j < nfaces * tnp1; ++j)
2272 locfaces.data() + cnt1 + j * tnp0, 1);
2278 for (
int j = 0; j < nfaces; ++j)
2282 tnp0 * tnp1, tmp.data() + cnt + j * fnp0 * fnp1, 1,
2283 locfaces.data() + cnt1 + j * tnp0 * tnp1, 1);
2293 for (
int j = 0; j < nfaces; ++j)
2296 tmp.data() + cnt + j * fnp0 * fnp1, fnp0,
2297 I1->GetPtr().data(), tnp1, 0.0,
2298 wsp.data() + j * fnp0 * tnp1, fnp0);
2301 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
2302 I0->GetPtr().data(), tnp0, wsp.data(), fnp0,
2303 0.0, locfaces.data() + cnt1, tnp0);
2309 for (
int j = 0; j < nfaces; ++j)
2312 tmp.data() + cnt + j * fnp0 * fnp1, fnp0,
2313 I1->GetPtr().data(), tnp1, 0.0,
2314 locfaces.data() + cnt1 + j * tnp0 * tnp1,
2320 ASSERTL0(
false,
"Interpolation case not implemneted (yet)");
2323 cnt += nfaces * nfromfacepts;
2324 cnt1 += nfaces * ntofacepts;
2340 for (
int i = 0; i < nvals; ++i)
2361 for (
int i = 0; i < nvals; ++i)
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define sign(a, b)
return the sign(b)*a
Defines a specification for a set of points.
PointsType GetPointsType() const
size_t GetNumPoints() const
Base class for all multi-elemental spectral/hp expansions.
const Collections::CollectionVector & GetCollections() const
This function returns collections.
const Array< OneD, const std::pair< int, int > > & GetCoeffsToElmt() const
Get m_coeffs to elemental value map.
int GetCoeff_Offset(int n) const
Get the start offset position for a local contiguous list of coeffs correspoinding to element n.
int GetShapeDimension()
This function returns the dimension of the shape of the element eid.
const std::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
int GetPhys_Offset(int n) const
Get the start offset position for a local contiguous list of quadrature points in a full array corres...
Array< OneD, Array< OneD, Array< OneD, int > > > m_traceCoeffToLeftRightExpCoeffMap
The map of every coeff from current trace to the left & right adjacent expasion coeffs.
Array< OneD, Array< OneD, int > > m_traceCoeffsToElmtSign
Sign array for mapping from forwards/backwards trace coefficients to local trace storage.
Array< OneD, Array< OneD, int > > m_interpNtraces
Number of edges/faces on a 2D/3D element that require interpolation.
Array< OneD, Array< OneD, int > > m_locTraceToElmtTraceMap
A mapping from the local elemental trace points, arranged as all forwards traces followed by backward...
void InterpLocEdgesToTraceTranspose(const int dir, const Array< OneD, const NekDouble > &edges, Array< OneD, NekDouble > &locedges)
Transpose of interp local edges to Trace methods.
void InterpLocTracesToTraceTranspose(const int dir, const Array< OneD, const NekDouble > &traces, Array< OneD, NekDouble > &loctraces)
Array< OneD, Array< OneD, int > > m_traceCoeffsToElmtTrace
Mapping from forwards/backwards trace coefficients to the position of the trace element in global sto...
Array< OneD, Array< OneD, int > > m_leftRightAdjacentExpId
The expansion ID that are the left & right adjacent to current trace.
LocTraceToTraceMap(const ExpList &locExp, const ExpListSharedPtr &trace, const Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > &elmtToTrace, const std::vector< bool > &LeftAdjacents)
Set up trace to trace mapping components.
Array< OneD, Array< OneD, DNekMatSharedPtr > > m_interpFromTraceI1
Interpolation matrices for either 2D edges or first coordinate of 3D face using going "from' to 'to' ...
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_interpEndPtI0
Mapping to hold first coordinate direction endpoint interpolation, which can be more optimal if using...
void LocTracesFromField(const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > faces)
Gather the local elemental traces in physical space from field using m_locTraceToFieldMap....
void CalcLocTracePhysToTraceIDMap_3D(const ExpListSharedPtr &tracelist)
int m_nLocTracePts
The number of local trace points.
void InterpLocEdgesToTrace(const int dir, const Array< OneD, const NekDouble > &locfaces, Array< OneD, NekDouble > &edges)
Interpolate local trace edges to global trace edge point distributions where required.
int m_nTracePts
The number of global trace points.
void UnshuffleLocTraces(const int dir, const Array< OneD, const NekDouble > &loctraces, Array< OneD, NekDouble > unshuffle)
Unshuffle local elemental traces in physical space from similar faces points are blocked together to ...
void InterpLocTracesToTrace(const int dir, const Array< OneD, const NekDouble > &loctraces, Array< OneD, NekDouble > &traces)
Array< OneD, Array< OneD, bool > > m_leftRightAdjacentExpFlag
Flag indicates whether the expansion that are the left & right adjacent to current trace exists.
void CalcLocTracePhysToTraceIDMap(const ExpListSharedPtr &tracelist, const int ndim)
void AddLocTracesToField(const Array< OneD, const NekDouble > &faces, Array< OneD, NekDouble > &field)
Reverse process of LocTracesFromField() Add the local traces in physical space to field using m_locTr...
int m_nTraceCoeffs[2]
Number of forwards/backwards trace coefficients.
int m_nFwdLocTracePts
The number of forward trace points. A local trace element is ‘forward’ if it is the side selected for...
Array< OneD, TraceFieldMapEssential > m_traceFieldMap
Array< OneD, Array< OneD, Array< OneD, int > > > m_traceCoeffToLeftRightExpCoeffSign
The sign of every coeff from current trace to the left & right adjacent expasion coeffs.
void InterpTraceToLocFaces(const int dir, const Array< OneD, const NekDouble > &faces, Array< OneD, NekDouble > &locfaces)
Interpolate global trace edge to local trace edges point distributions where required.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_interpEndPtI1
Mapping to hold second coordinate direction endpoint interpolation, which can be more optimal if usin...
void TraceLocToElmtLocCoeffMap(const ExpList &locExp, const ExpListSharedPtr &trace)
Set up maps between coefficients on trace and in cells.
Array< OneD, Array< OneD, int > > m_traceCoeffsToElmtMap
Mapping from forwards/backwards trace coefficients to elemental coefficient storage.
int m_expdim
Expansion Dimension we have setup for trace mapping.
Array< OneD, Array< OneD, InterpLocTraceToTrace > > m_interpTrace
A mapping holding the type of interpolation needed for each local trace. Dimension 0 holds forward tr...
Array< OneD, int > m_locToTracePhysOffset
void FwdLocTracesFromField(const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > faces)
Gather the forwards-oriented local traces in physical space from field using m_locTraceToFieldMap.
Array< OneD, Array< OneD, int > > m_locInterpTraceToTraceMap
A mapping from local trace points to the global trace. Dimension 0 holds forward traces,...
void InterpTraceToLocEdges(const int dir, const Array< OneD, const NekDouble > &edges, Array< OneD, NekDouble > &locedges)
Interpolate global trace edge to local trace edges point distributions where required.
Array< OneD, Array< OneD, int > > m_ElemNeighbsId
Array< OneD, Array< OneD, TraceInterpPoints > > m_interpPoints
Interpolation points key distributions to each of the local to global mappings.
Array< OneD, int > m_locTraceToFieldMap
A mapping from the local elemental trace points, arranged as all forwards traces followed by backward...
Array< OneD, int > m_collExpOffset
Array< OneD, Array< OneD, int > > m_interpTracePtsEntry
start entry of each global trace in m_locInterpTraceToTraceMap, referenced by element and trace id
Array< OneD, Array< OneD, DNekMatSharedPtr > > m_interpFromTraceI0
Interpolation matrices for either 2D edges or first coordinate of 3D face using going "from' to 'to' ...
Array< OneD, TraceInterpEssential > m_traceInterp
void AddTraceCoeffsToFieldCoeffs(const Array< OneD, const NekDouble > &trace, Array< OneD, NekDouble > &field)
Add contributions from trace coefficients to the elemental field storage.
void InterpLocFacesToTraceTranspose(const int dir, const Array< OneD, const NekDouble > &traces, Array< OneD, NekDouble > &loctraces)
Transpose of interp local faces to Trace methods.
Array< OneD, Array< OneD, int > > m_locTracePtsEntry
start entry of each local trace in m_locTraceToFieldMap, referenced by element and trace id
Array< OneD, Array< OneD, DNekMatSharedPtr > > m_interpTraceI1
Interpolation matrices for the second coordinate of 3D face, not used in 2D.
Array< OneD, Array< OneD, DNekMatSharedPtr > > m_interpTraceI0
Interpolation matrices for either 2D edges or first coordinate of 3D face.
Array< OneD, Array< OneD, int > > m_traceCoeffsEntry
start entry of each global trace in m_traceCoeffsToElmtMap, referenced by element and trace id
const TraceFieldMapEssential & GetTraceFieldMapEssential(const int cid)
void FindElmtNeighbors(const ExpList &locExp, const ExpListSharedPtr &trace)
void InterpTraceToLocTrace(const int dir, const Array< OneD, NekDouble > &traces, Array< OneD, NekDouble > &loctraces)
Array< OneD, int > m_ElemNeighbsNumb
Array< OneD, Array< OneD, int > > m_interpTraceIndex
subscript of m_interpTrace, referenced by element and trace id
void ReshuffleLocTracesForInterp(const int dir, const Array< OneD, const NekDouble > &loctraces, Array< OneD, NekDouble > reshuffle)
Reshuffle local elemental traces in physical space so that similar faces points are blocked together ...
void CalcLocTracePhysToTraceIDMap_2D(const ExpListSharedPtr &tracelist)
virtual ~LocTraceToTraceMap()
Array< OneD, Array< OneD, int > > m_LocTracephysToTraceIDMap
void InterpLocFacesToTrace(const int dir, const Array< OneD, const NekDouble > &locfaces, Array< OneD, NekDouble > faces)
Interpolate local faces to trace face point distributions where required.
const TraceInterpEssential & GetTraceInterpEssential(const int cid)
static void Dgemv(const char &trans, const int &m, const int &n, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n].
static double Ddot(const int &n, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: output = .
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...
void GetEffectiveQuadRange(const LibUtilities::PointsKey &pkey, int &q_begin, int &q_end)
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
PointsManagerT & PointsManager(void)
@ eGaussLegendreWithMP
1D Gauss-Legendre quadrature points with additional x=-1 and x=1 end points
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
@ eGaussLegendreWithM
1D Gauss-Legendre quadrature points with additional x=-1 point
@ P
Monomial polynomials .
std::shared_ptr< Expansion > ExpansionSharedPtr
@ eInterpEndPtDir0InterpDir1
std::tuple< LibUtilities::PointsKey, LibUtilities::PointsKey, LibUtilities::PointsKey, LibUtilities::PointsKey > TraceInterpPoints
Map holding points distributions required for interpolation of local traces onto global trace in two ...
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static const NekDouble kNekZeroTol
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
@ eDir1FwdDir2_Dir2FwdDir1
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Gathr(I n, const T *x, const I *y, T *z)
Gather vector z[i] = x[y[i]].
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
void Assmb(int n, const T *x, const int *y, T *z)
Assemble z[y[i]] += x[i]; z should be zero'd first.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Zero(int n, T *x, const int incx)
Zero vector.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
scalarT< T > abs(scalarT< T > in)