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();
394 elmt->ReOrientTracePhysMap(orient, locTraceToTraceMap,
398 int offset = trace->GetPhys_Offset(elmtToTrace[n][e]->GetElmtId());
400 if (LeftAdjacents[TraceOrder[n][e]])
403 for (
int i = 0; i < ntracepts; ++i)
406 phys_offset + traceids[i];
409 for (
int i = 0; i < ntracepts; ++i)
412 ElmtPhysTraceOffset[n][e] + i;
416 for (
int i = 0; i < ntracepts1; ++i)
419 offset + locTraceToTraceMap[i];
423 cntFwd1 += ntracepts1;
429 for (
int i = 0; i < ntracepts; ++i)
432 phys_offset + traceids[i];
435 for (
int i = 0; i < ntracepts; ++i)
438 ElmtPhysTraceOffset[n][e] + i;
443 for (
int i = 0; i < ntracepts1; ++i)
446 offset + locTraceToTraceMap[i];
450 cntBwd1 += ntracepts1;
458 if ((fwdSet ==
false && set == 0) || (bwdSet ==
false && set == 1))
472 if (fromPointsKey0 == toPointsKey0)
481 ->GetI(toPointsKey0);
484 ->GetI(fromPointsKey0);
491 LibUtilities::eGaussRadauMAlpha1Beta0) &&
522 if (fromPointsKey0 == toPointsKey0)
524 if (fromPointsKey1 == toPointsKey1)
534 ->GetI(toPointsKey1);
537 ->GetI(fromPointsKey1);
546 eGaussRadauMAlpha1Beta0) &&
576 if (fromPointsKey1 == toPointsKey1)
582 ->GetI(toPointsKey0);
585 ->GetI(fromPointsKey0);
594 eGaussRadauMAlpha1Beta0) &&
627 ->GetI(toPointsKey0);
630 ->GetI(fromPointsKey0);
634 ->GetI(toPointsKey1);
637 ->GetI(fromPointsKey1);
646 eGaussRadauMAlpha1Beta0) &&
698 for (
int cid = 1; cid < collections.size(); ++cid)
701 collections[cid - 1].GetExpVector().size();
708 std::map<std::tuple<int, int, int, int>,
int> map_locTraceToTrace;
711 std::vector<Array<OneD, int>> orientationMaps;
715 for (
int cid = 0; cid < collections.size(); ++cid)
717 auto pCollExp = collections[cid].GetExpVector();
718 auto pGeomData = collections[cid].GetGeomSharedPtr();
721 std::dynamic_pointer_cast<LocalRegions::Expansion>(pCollExp[0]);
735 for (
int dir = 0; dir < 2; ++dir)
750 int tmp = std::max(fnp0 * fnp1, tnp0 * tnp1);
760 int tmp = std::max(fnp0, tnp0);
771 for (
int e = 0; e < exp->GetNtraces(); e++)
781 for (
int e = 0; e < exp->GetNtraces(); e++)
783 exp->GetTracePhysMap(
790 for (
int e = 0; e < exp->GetNtraces(); e++)
799 for (
int e = 0; e < exp->GetNtraces(); e++)
807 orientationMaps.clear();
808 map_locTraceToTrace.clear();
810 int cntCollLocTrace = 0;
811 for (
int n = 0; n < pCollExp.size(); n++, elmtId++)
814 std::dynamic_pointer_cast<LocalRegions::Expansion>(pCollExp[n]);
815 for (
int e = 0; e < locExp->GetNtraces(); e++, cntCollLocTrace++)
818 if (!LeftAdjacents[cntLocTrace + cntCollLocTrace])
823 int orient =
static_cast<int>(locExp->GetTraceOrient(e));
831 shape =
static_cast<int>(
832 locExp->GetGeom()->GetEdge(e)->GetShapeType());
835 shape =
static_cast<int>(
836 locExp->GetGeom()->GetFace(e)->GetShapeType());
840 std::tuple<int, int, int, int>{shape, orient, dir, typid};
841 if (map_locTraceToTrace.find(thisKey) ==
842 map_locTraceToTrace.end())
850 exp->ReOrientTracePhysMap(locExp->GetTraceOrient(e),
851 thisMapArray, tnp0, tnp1,
false);
852 orientationMaps.push_back(thisMapArray);
854 orientationMaps.size() - 1;
855 map_locTraceToTrace[thisKey] = orientationMaps.size() - 1;
860 map_locTraceToTrace[thisKey];
863 std::array<LibUtilities::BasisKey, 3> thisExpKeys{
870 elmtToTrace[elmtId][e]->GetElmtId();
878 for (
int i = 0; i < orientationMaps.size(); ++i)
887 for (
int e = 0; e < exp->GetNtraces(); e++)
891 for (
int n = 0; n < pCollExp.size(); n++)
894 LeftAdjacents[cntLocTrace + n * exp->GetNtraces() + e];
902 for (
int e = 0; e < exp->GetNtraces(); e++)
906 for (
int n = 0; n < pCollExp.size(); n++)
915 cntLocTrace += cntCollLocTrace;
944 "CalcLocTracePhysToTraceIDMap not coded");
951 std::shared_ptr<LocalRegions::ExpansionVector> traceExp =
953 int ntotTrace = (*traceExp).size();
962 for (
int nt = 0; nt < ntotTrace; nt++)
964 ntPnts = tracelist->GetTotPoints(nt);
965 noffset = tracelist->GetPhys_Offset(nt);
966 for (
int i = 0; i < ntPnts; i++)
977 for (
int dir = 0; dir < 2; dir++)
1000 for (
int ne = 0; ne < nedges; ne++)
1002 Vmath::Fill(fnp, tmp[cnt1], &loctracePntsLR[dir][cnt], 1);
1011 for (
int nlr = 0; nlr < 2; nlr++)
1013 for (
int i = 0; i < loctracePntsLR[nlr].size(); i++)
1016 std::round(loctracePntsLR[nlr][i]);
1017 error +=
abs(loctracePntsLR[nlr][i] -
1023 "m_LocTracephysToTraceIDMap may not be integer !!");
1029 std::shared_ptr<LocalRegions::ExpansionVector> traceExp =
1030 tracelist->GetExp();
1031 int ntotTrace = (*traceExp).size();
1032 int ntPnts, noffset;
1040 for (
int nt = 0; nt < ntotTrace; nt++)
1042 ntPnts = tracelist->GetTotPoints(nt);
1043 noffset = tracelist->GetPhys_Offset(nt);
1044 for (
int i = 0; i < ntPnts; i++)
1055 for (
int dir = 0; dir < 2; dir++)
1084 int nfttl = fnp0 * fnp1;
1088 Vmath::Fill(nfttl, tmp[cnt1], &loctracePntsLR[dir][cnt], 1);
1090 cnt1 += tnp0 * tnp1;
1097 for (
int nlr = 0; nlr < 2; nlr++)
1099 for (
int i = 0; i < loctracePntsLR[nlr].size(); i++)
1102 std::round(loctracePntsLR[nlr][i]);
1103 error +=
abs(loctracePntsLR[nlr][i] -
1109 "m_LocTracephysToTraceIDMap may not be integer !!");
1121 const std::shared_ptr<LocalRegions::ExpansionVector> exptrac =
1123 size_t ntrace = exptrac->size();
1131 for (
int lr = 0; lr < 2; ++lr)
1137 for (
int i = 0; i < ntrace; ++i)
1139 size_t ncoeff = trace->GetNcoeffs(i);
1148 trace->GetCoeffsToElmt();
1150 for (
int lr = 0; lr < 2; ++lr)
1153 for (
int i = 0; i < ntotcoeffs; ++i)
1159 int ntraceelmt = trace_coeffToElmt[ncoeffTrace].first;
1160 int ntracelocN = trace_coeffToElmt[ncoeffTrace].second;
1162 int nfieldelmt = field_coeffToElmt[ncoeffField].first;
1163 int nfieldlocN = field_coeffToElmt[ncoeffField].second;
1165 LRAdjflag[lr][ntraceelmt] =
true;
1166 LRAdjExpid[lr][ntraceelmt] = nfieldelmt;
1168 elmtLRMap[lr][ntraceelmt][ntracelocN] = nfieldlocN;
1169 elmtLRSign[lr][ntraceelmt][ntracelocN] =
sign;
1181 const std::shared_ptr<LocalRegions::ExpansionVector> exptrac =
1183 int ntrace = exptrac->size();
1185 const std::shared_ptr<LocalRegions::ExpansionVector> exp = locExp.
GetExp();
1186 int nexp = exp->size();
1193 std::set<std::pair<int, int>> neighborSet;
1195 for (
int nt = 0; nt < ntrace; nt++)
1197 if (LRAdjflag[0][nt] && LRAdjflag[1][nt])
1199 ntmp0 = LRAdjExpid[0][nt];
1200 ntmp1 = LRAdjExpid[1][nt];
1203 " ntmp0==ntmp1, trace inside a element?? ");
1205 std::set<std::pair<int, int>>::iterator it = neighborSet.begin();
1206 neighborSet.insert(it, std::make_pair(ntmp0, ntmp1));
1207 neighborSet.insert(it, std::make_pair(ntmp1, ntmp0));
1212 for (std::set<std::pair<int, int>>::iterator it = neighborSet.begin();
1213 it != neighborSet.end(); ++it)
1215 int ncurrent = it->first;
1216 ElemIndex[ncurrent]++;
1223 for (
int ne = 0; ne < nexp; ne++)
1225 int neighb = ElemNeighbsNumb[ne];
1230 for (
int ne = 0; ne < nexp; ne++)
1234 for (std::set<std::pair<int, int>>::iterator it = neighborSet.begin();
1235 it != neighborSet.end(); ++it)
1237 int ncurrent = it->first;
1238 int neighbor = it->second;
1239 ElemNeighbsId[ncurrent][ElemIndex[ncurrent]] = neighbor;
1240 ElemIndex[ncurrent]++;
1244 for (
int ne = 0; ne < nexp; ne++)
1247 for (
int nb = 0; nb < ElemNeighbsNumb[ne]; nb++)
1249 int neighbId = ElemNeighbsId[ne][nb];
1251 for (
int nc = 0; nc < ElemIndex[ne]; nc++)
1253 if (ElemNeighbsId[ne][nb] == tmpId[ne][nc])
1260 tmpId[ne][ElemIndex[ne]] = neighbId;
1265 ElemNeighbsNumb = ElemIndex;
1266 for (
int ne = 0; ne < nexp; ne++)
1268 int neighb = ElemNeighbsNumb[ne];
1272 Vmath::Vcopy(neighb, tmpId[ne], 1, ElemNeighbsId[ne], 1);
1277 for (
int ne = 0; ne < nexp; ne++)
1279 for (
int nb = 0; nb < ElemNeighbsNumb[ne]; nb++)
1281 ASSERTL0((ElemNeighbsId[ne][nb] >= 0) &&
1282 (ElemNeighbsId[ne][nb] <= nexp),
1283 "Element id <0 or >number of total elements")
1320 size_t nfield = field.size();
1352 ASSERTL1(dir < 2,
"option dir out of range, "
1353 " dir=0 is fwd, dir=1 is bwd");
1370 ASSERTL1(dir < 2,
"option dir out of range, "
1371 " dir=0 is fwd, dir=1 is bwd");
1415 ASSERTL1(dir < 2,
"option dir out of range, "
1416 " dir=0 is fwd, dir=1 is bwd");
1447 tmp.data() + cnt1, 1);
1451 int fbegin, fend, fsize;
1452 int tbegin, tend, tsize;
1454 fromPointsKey0, fbegin, fend);
1456 toPointsKey0, tbegin, tend);
1457 fsize = fend - fbegin;
1458 tsize = tend - tbegin;
1461 "Quad ranges mismatch in InterpLocEdgesToTrace!");
1462 for (
int k = 0; k < nedges; ++k)
1465 fsize, locedges.data() + cnt + fnp * k + fbegin,
1466 1, tmp.data() + cnt1 + tnp * k + tbegin, 1);
1469 tmp.data() + cnt1 + tnp * k, 1);
1472 tmp[cnt1 + tnp * k + tend - 1],
1473 tmp.data() + cnt1 + tnp * k + tend, 1);
1482 I0->GetPtr().data(), tnp, locedges.data() + cnt,
1483 fnp, 0.0, tmp.data() + cnt1, tnp);
1490 for (
int k = 0; k < nedges; ++k)
1493 &tmp[cnt1 + k * tnp], 1);
1496 fnp, locedges.data() + cnt + k * fnp, 1, &I0[0], 1);
1502 "Invalid interpolation type for 2D elements");
1506 cnt += nedges * fnp;
1507 cnt1 += nedges * tnp;
1527 ASSERTL1(dir < 2,
"option dir out of range, "
1528 " dir=0 is fwd, dir=1 is bwd");
1556 int nfromfacepts = fnp0 * fnp1;
1557 int ntofacepts = tnp0 * tnp1;
1564 if (fnp0 == tnp0 && fnp1 == tnp1)
1567 locfaces.data() + cnt, 1,
1568 tmp.data() + cnt1, 1);
1572 int fbegin0, fend0, fbegin1, fend1;
1573 int tbegin0, tend0, tbegin1, tend1;
1575 fromPointsKey0, fbegin0, fend0);
1577 toPointsKey0, tbegin0, tend0);
1579 fromPointsKey1, fbegin1, fend1);
1581 toPointsKey1, tbegin1, tend1);
1583 fend0 - fbegin0 == tend0 - tbegin0 &&
1584 fend1 - fbegin1 == tend1 - tbegin1,
1585 "Quad ranges mismatch in InterpLocFacesToTrace!");
1586 for (
int j = 0; j < nfaces; ++j)
1588 for (
int k = fbegin1, l = tbegin1; k < fend1;
1593 locfaces.data() + cnt + j * nfromfacepts +
1596 tmp.data() + cnt1 + j * ntofacepts +
1607 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
1608 I0->GetPtr().data(), tnp0,
1609 locfaces.data() + cnt, fnp0, 0.0,
1610 tmp.data() + cnt1, tnp0);
1616 for (
int k = 0; k < fnp0; ++k)
1619 fnp0, tmp.data() + cnt1 + k, tnp0);
1624 tmp.data() + cnt1, tnp0, I0.data(), 1, 0.0,
1625 tmp.data() + cnt1 + tnp0 - 1, tnp0);
1631 for (
int j = 0; j < nfaces; ++j)
1634 locfaces.data() + cnt + j * fnp0 * fnp1,
1635 tnp0, I1->GetPtr().data(), tnp1, 0.0,
1636 tmp.data() + cnt1 + j * tnp0 * tnp1, tnp0);
1643 for (
int j = 0; j < nfaces; ++j)
1647 locfaces.data() + cnt + j * fnp0 * fnp1, 1,
1648 tmp.data() + cnt1 + j * tnp0 * tnp1, 1);
1651 for (
int k = 0; k < tnp0; ++k)
1653 tmp[cnt1 + k + (j + 1) * tnp0 * tnp1 - tnp0] =
1655 locfaces.data() + cnt +
1656 j * fnp0 * fnp1 + k,
1668 for (
int j = 0; j < nfaces; ++j)
1671 locfaces.data() + cnt + j * fnp0 * fnp1,
1672 fnp0, I1->GetPtr().data(), tnp1, 0.0,
1673 wsp.data() + j * fnp0 * tnp1, fnp0);
1675 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
1676 I0->GetPtr().data(), tnp0, wsp.data(), fnp0,
1677 0.0, tmp.data() + cnt1, tnp0);
1685 for (
int j = 0; j < nfaces; ++j)
1688 locfaces.data() + cnt + j * fnp0 * fnp1,
1689 fnp0, I1->GetPtr().data(), tnp1, 0.0,
1690 tmp.data() + cnt1 + j * tnp0 * tnp1, tnp0);
1694 tmp.data() + cnt1, tnp0, I0.data(), 1, 0.0,
1695 tmp.data() + cnt1 + tnp0 - 1, tnp0);
1699 ASSERTL0(
false,
"Interplation case needs implementing");
1702 cnt += nfaces * nfromfacepts;
1703 cnt1 += nfaces * ntofacepts;
1740 ASSERTL1(dir < 2,
"option dir out of range, "
1741 " dir=0 is fwd, dir=1 is bwd");
1774 fromPointsKey0, fbegin, fsize);
1776 toPointsKey0, tbegin, tsize);
1777 fsize = fsize - fbegin;
1778 tsize = tsize - tbegin;
1779 ASSERTL0(fsize == tsize,
"Quad ranges mismatch in "
1780 "InterpLocEdgesToTraceTranspose!");
1781 for (
int k = 0; k < nedges; ++k)
1783 Vmath::Zero(fnp, locedges.data() + cnt + fnp * k, 1);
1785 fsize, tmp.data() + cnt1 + tnp * k + tbegin, 1,
1786 locedges.data() + cnt + fnp * k + fbegin, 1);
1794 I0->GetPtr().data(), tnp, tmp.data() + cnt1,
1795 tnp, 0.0, locedges.data() + cnt, fnp);
1802 for (
int k = 0; k < nedges; ++k)
1805 &locedges[cnt + k * fnp], 1);
1807 Vmath::Svtvp(fnp, tmp[cnt1 + k * tnp + tnp - 1], &I0[0],
1808 1, locedges.data() + cnt + k * fnp, 1,
1809 locedges.data() + cnt + k * fnp, 1);
1815 "Invalid interpolation type for 2D elements");
1819 cnt += nedges * fnp;
1820 cnt1 += nedges * tnp;
1836 ASSERTL1(dir < 2,
"option dir out of range, "
1837 " dir=0 is fwd, dir=1 is bwd");
1872 int nfromfacepts = fnp0 * fnp1;
1873 int ntofacepts = tnp0 * tnp1;
1880 int fbegin0, fend0, fbegin1, fend1;
1881 int tbegin0, tend0, tbegin1, tend1;
1883 fromPointsKey0, fbegin0, fend0);
1885 toPointsKey0, tbegin0, tend0);
1887 fromPointsKey1, fbegin1, fend1);
1889 toPointsKey1, tbegin1, tend1);
1891 fend0 = fend0 - fbegin0;
1892 tend0 = tend0 - tbegin0;
1894 fend1 - fbegin1 == tend1 - tbegin1,
1895 "Quad ranges mismatch in "
1896 "InterpLocFacesToTraceTranspose!");
1897 for (
int j = 0; j < nfaces; ++j)
1899 for (
int k = fbegin1, l = tbegin1; k < fend1; ++k, ++l)
1902 tmp.data() + cnt1 + j * ntofacepts +
1905 loctraces.data() + cnt +
1906 j * nfromfacepts + k * fnp0 +
1917 I0->GetPtr().data(), tnp0, tmp.data() + cnt1,
1918 tnp0, 0.0, loctraces.data() + cnt, fnp0);
1923 for (
int k = 0; k < fnp0; ++k)
1925 Vmath::Vcopy(nfaces * fnp1, tmp.data() + cnt1 + k, tnp0,
1926 loctraces.data() + cnt + k, fnp0);
1930 for (
int k = 0; k < tnp1 * nfaces; k++)
1934 loctraces.data() + cnt + k * fnp0, 1,
1935 loctraces.data() + cnt + k * fnp0, 1);
1946 tmp.data() + cnt1 + j * tnp0 * tnp1, tnp0,
1947 I1->GetPtr().data(), tnp1, 0.0,
1948 loctraces.data() + cnt + j * fnp0 * fnp1,
1959 fnp0 * fnp1, tmp.data() + cnt1 + j * tnp0 * tnp1, 1,
1960 loctraces.data() + cnt + j * fnp0 * fnp1, 1);
1962 for (
int k = 0; k < fnp1; k++)
1966 &tmp[cnt1 + (j + 1) * tnp0 * tnp1 - tnp0], 1,
1967 &loctraces[cnt + j * fnp0 * fnp1 + k * fnp0], 1,
1968 &loctraces[cnt + j * fnp0 * fnp1 + k * fnp0],
1983 tnp0, 1.0, I0->GetPtr().data(), tnp0,
1984 tmp.data() + cnt1, tnp0, 0.0, wsp.data(), fnp0);
1989 wsp.data() + j * fnp0 * tnp1, fnp0,
1990 I1->GetPtr().data(), tnp1, 0.0,
1991 loctraces.data() + cnt + j * fnp0 * fnp1,
2007 &I0[0], 1, tmp.data() + cnt1 + k * tnp0, 1,
2008 wsp.data() + k * fnp0, 1);
2014 wsp.data() + j * fnp0 * tnp1, fnp0,
2015 I1->GetPtr().data(), tnp1, 0.0,
2016 loctraces.data() + cnt + j * fnp0 * fnp1,
2022 cnt += nfaces * nfromfacepts;
2023 cnt1 += nfaces * ntofacepts;
2064 ASSERTL1(dir < 2,
"option dir out of range, "
2065 " dir=0 is fwd, dir=1 is bwd");
2100 fromPointsKey0, fbegin, fend);
2102 toPointsKey0, tbegin, tend);
2104 fend = fend - fbegin;
2105 tend = tend - tbegin;
2107 "Quad ranges mismatch in InterpTraceToLocEdges!");
2108 for (
int k = 0; k < nedges; ++k)
2110 Vmath::Zero(tnp, locedges.data() + cnt1 + tnp * k, 1);
2112 fend, tmp.data() + cnt + fnp * k + fbegin, 1,
2113 locedges.data() + cnt1 + tnp * k + tbegin, 1);
2121 I0->GetPtr().data(), tnp, tmp.data() + cnt, fnp,
2122 0.0, locedges.data() + cnt1, tnp);
2128 for (
int k = 0; k < nedges; ++k)
2132 &locedges[cnt1 + k * tnp], 1);
2138 "Invalid interpolation type for 2D elements");
2142 cnt += nedges * fnp;
2143 cnt1 += nedges * tnp;
2160 ASSERTL1(dir < 2,
"option dir out of range, "
2161 " dir=0 is fwd, dir=1 is bwd");
2193 int nfromfacepts = fnp0 * fnp1;
2194 int ntofacepts = tnp0 * tnp1;
2201 int fbegin0, fend0, fbegin1, fend1;
2202 int tbegin0, tend0, tbegin1, tend1;
2204 fromPointsKey0, fbegin0, fend0);
2206 toPointsKey0, tbegin0, tend0);
2208 fromPointsKey1, fbegin1, fend1);
2210 toPointsKey1, tbegin1, tend1);
2212 fend0 = fend0 - fbegin0;
2213 tend0 = tend0 - tbegin0;
2215 fend1 - fbegin1 == tend1 - tbegin1,
2216 "Quad ranges mismatch in InterpTraceToLocFaces!");
2217 for (
int j = 0; j < nfaces; ++j)
2220 locfaces.data() + cnt1 + ntofacepts * j, 1);
2221 for (
int k = fbegin1, l = tbegin1; k < fend1; ++k, ++l)
2224 tmp.data() + cnt + j * nfromfacepts +
2227 locfaces.data() + cnt1 +
2228 ntofacepts * j + l * tnp0 +
2238 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
2239 I0->GetPtr().data(), tnp0, tmp.data() + cnt,
2240 fnp0, 0.0, locfaces.data() + cnt1, tnp0);
2246 for (
int j = 0; j < nfaces; ++j)
2249 tmp.data() + cnt + j * fnp0 * fnp1, tnp0,
2250 I1->GetPtr().data(), tnp1, 0.0,
2251 locfaces.data() + cnt1 + j * tnp0 * tnp1,
2258 for (
int j = 0; j < nfaces * tnp1; ++j)
2261 locfaces.data() + cnt1 + j * tnp0, 1);
2267 for (
int j = 0; j < nfaces; ++j)
2271 tnp0 * tnp1, tmp.data() + cnt + j * fnp0 * fnp1, 1,
2272 locfaces.data() + cnt1 + j * tnp0 * tnp1, 1);
2282 for (
int j = 0; j < nfaces; ++j)
2285 tmp.data() + cnt + j * fnp0 * fnp1, fnp0,
2286 I1->GetPtr().data(), tnp1, 0.0,
2287 wsp.data() + j * fnp0 * tnp1, fnp0);
2290 Blas::Dgemm(
'N',
'N', tnp0, tnp1 * nfaces, fnp0, 1.0,
2291 I0->GetPtr().data(), tnp0, wsp.data(), fnp0,
2292 0.0, locfaces.data() + cnt1, tnp0);
2298 for (
int j = 0; j < nfaces; ++j)
2301 tmp.data() + cnt + j * fnp0 * fnp1, fnp0,
2302 I1->GetPtr().data(), tnp1, 0.0,
2303 locfaces.data() + cnt1 + j * tnp0 * tnp1,
2309 ASSERTL0(
false,
"Interpolation case not implemneted (yet)");
2312 cnt += nfaces * nfromfacepts;
2313 cnt1 += nfaces * ntofacepts;
2329 for (
int i = 0; i < nvals; ++i)
2350 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.
static void GetEffectiveQuadRange(const LibUtilities::PointsKey &pkey, int &q_begin, int &q_end)
offset the m_nq_begin and m_nq_end according to the points type
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 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...
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
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].
T Dot(int n, const T *w, const T *x)
dot product
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)