35 #include <boost/core/ignore_unused.hpp> 48 namespace LocalRegions
52 void Expansion3D::AddHDGHelmholtzFaceTerms(
61 int nquad_f = FaceExp->GetNumPoints(0)*FaceExp->GetNumPoints(1);
62 int order_f = FaceExp->GetNcoeffs();
63 int coordim = GetCoordim();
64 int ncoeffs = GetNcoeffs();
73 = GetFaceNormal(face);
82 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
83 face, GetForient(face));
85 StdExpansion::GetIndexMap(ikey);
99 if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
101 GetPhysFaceVarCoeffsFromElement(face,FaceExp,x->second,varcoeff_work);
102 Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp->GetPhys(),1,FaceExp->UpdatePhys(),1);
109 FaceExp->IProductWRTBase(facePhys, outcoeff);
111 for(i = 0; i < order_f; ++i)
113 outarray[(*map)[i].index] += (*map)[i].sign*tau*outcoeff[i];
123 for(n = 0; n < coordim; ++n)
130 DetShapeType(), *
this,
134 invMass = *GetLocMatrix(invMasskey);
137 v_GetnFacecdotMF(n, face, FaceExp, normals, varcoeffs);
139 Vmath::Vmul(nquad_f, ncdotMF_f, 1, facePhys, 1, inval, 1);
142 Vmath::Vmul(nquad_f, normals[n], 1, facePhys, 1, inval, 1);
146 const NekDouble *data = invMass.GetRawPtr();
148 if (m_negatedNormals[face])
164 FaceExp->IProductWRTBase(inval, outcoeff);
167 for(i = 0; i < ncoeffs; ++i)
170 for(j = 0; j < order_f; ++j)
172 tmpcoeff[i] += scale*data[i+(*map)[j].index*ncoeffs]*(*map)[j].sign*outcoeff[j];
180 = v_GetMF(n,coordim,varcoeffs);
182 = v_GetMFDiv(n,varcoeffs);
185 DetShapeType(), *
this,
191 Coeffs = Coeffs + Dmat*Tmpcoeff;
196 Coeffs = Coeffs + Dmat*Tmpcoeff;
217 void Expansion3D::GetPhysFaceVarCoeffsFromElement(
227 FwdTrans(varcoeff, tmp);
233 GetFaceToElementMap(face, GetForient(face), emap, sign);
235 for (
unsigned int i = 0; i < FaceExp->GetNcoeffs(); ++i)
237 facetmp[i] = tmp[emap[i]];
241 FaceExp->BwdTrans(facetmp, outarray);
249 void Expansion3D::AddNormTraceInt(
258 int nfaces = GetNfaces();
261 for(f = 0; f < nfaces; ++f)
263 order_f = FaceExp[f]->GetNcoeffs();
264 nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
270 for(i = 0; i < order_f; ++i)
272 faceCoeffs[i] = inarray[i+cnt];
276 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
291 StdRegions::VarCoeffMap::const_iterator x;
296 v_GetnFacecdotMF(dir, f, FaceExp[f], normals,
310 if (m_negatedNormals[f])
315 AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray,
321 void Expansion3D::AddNormTraceInt(
328 int order_f, nquad_f;
329 int nfaces = GetNfaces();
332 for(f = 0; f < nfaces; ++f)
334 order_f = FaceExp[f]->GetNcoeffs();
335 nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
342 FaceExp[f]->BwdTrans(faceCoeffs[f], facePhys);
344 Vmath::Vmul(nquad_f, normals[dir], 1, facePhys, 1, facePhys, 1);
346 if (m_negatedNormals[f])
351 AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray);
358 void Expansion3D::AddFaceBoundaryInt(
365 boost::ignore_unused(varcoeffs);
368 int order_f = FaceExp->GetNcoeffs();
373 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
374 face, GetForient(face));
376 StdExpansion::GetIndexMap(ikey);
391 FaceExp->IProductWRTBase(facePhys, coeff);
394 for(i = 0; i < order_f; ++i)
396 outarray[(*map)[i].index] += (*map)[i].sign*coeff[i];
403 void Expansion3D::SetFaceToGeomOrientation(
407 int nface = GetFaceNcoeffs(face);
415 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
418 StdExpansion::GetIndexMap(ikey1);
421 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
422 face, GetForient(face));
424 StdExpansion::GetIndexMap(ikey2);
426 ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
427 "There is an error with the GetFaceToElementMap");
429 for(j = 0; j < (*map1).num_elements(); ++j)
432 for(k = 0; k < (*map2).num_elements(); ++k)
435 if((*map1)[j].index == (*map2)[k].index && k != j)
439 if((*map1)[j].sign != (*map2)[k].sign)
453 int nfaces = GetNfaces();
457 for(i = 0; i < nfaces; ++i)
459 SetFaceToGeomOrientation(i, f_tmp = inout + cnt);
460 cnt += GetFaceNcoeffs(i);
477 "Matrix construction is not implemented for variable " 478 "coefficients at the moment");
488 ASSERTL1(IsBoundaryInteriorExpansion(),
489 "HybridDGHelmholtz matrix not set up " 490 "for non boundary-interior expansions");
495 int ncoeffs = GetNcoeffs();
496 int nfaces = GetNfaces();
503 int order_f, coordim = GetCoordim();
516 StdRegions::VarCoeffMap::const_iterator x;
520 for(i = 0; i < coordim; ++i)
527 v_GetMF(i,coordim,varcoeffs);
529 v_GetMFDiv(i,varcoeffs);
532 DetShapeType(), *
this,
543 DetShapeType(), *
this,
549 Mat = Mat + Dmat*invMass*
Transpose(Dmat);
554 Mat = Mat + Dmat*invMass*
Transpose(Dmat);
579 Mat = Mat + lambdaval*Mass;
582 for(i = 0; i < nfaces; ++i)
584 FaceExp = GetFaceExp(i);
585 order_f = FaceExp->GetNcoeffs();
588 GetBasisNumModes(0), GetBasisNumModes(1),
589 GetBasisNumModes(2), i, GetForient(i));
591 StdExpansion::GetIndexMap(ikey);
611 for(j = 0; j < order_f; ++j)
613 for(k = 0; k < order_f; ++k)
615 Mat((*map)[j].index,(*map)[k].index) +=
616 tau*(*map)[j].sign*(*map)[k].sign*
eMass(j,k);
627 int nbndry = NumDGBndryCoeffs();
628 int ncoeffs = GetNcoeffs();
629 int nfaces = GetNfaces();
653 for(i = 0; i < nfaces; ++i)
655 FaceExp = GetFaceExp(i);
656 int nface = GetFaceNcoeffs(i);
662 for(j = 0; j < nface; ++j)
666 face_lambda[j] = 1.0;
668 SetFaceToGeomOrientation(i, face_lambda);
671 FaceExp->BwdTrans(face_lambda, tmp);
672 AddHDGHelmholtzFaceTerms(tau, i, tmp, mkey.
GetVarCoeffs(), f);
677 for(k = 0; k < ncoeffs; ++k)
679 Umat(k,bndry_cnt) = Ulam[k];
733 int nbndry = NumDGBndryCoeffs();
734 int coordim = GetCoordim();
735 int ncoeffs = GetNcoeffs();
736 int nfaces = GetNfaces();
758 for(i = 0; i < nfaces; ++i)
760 FaceExp[i] = GetFaceExp(i);
780 ASSERTL0(
false,
"Direction not known");
786 StdRegions::VarCoeffMap::const_iterator x;
794 v_GetMF(dir,coordim,varcoeffs);
796 v_GetMFDiv(dir,varcoeffs);
799 DetShapeType(), *
this,
803 Dmat = GetLocMatrix(Dmatkey);
810 DetShapeType(), *
this,
814 invMass = *GetLocMatrix(invMasskey);
825 for(j = 0; j < nbndry; ++j)
831 for(k = 0; k < ncoeffs; ++k)
833 Ulam[k] = lamToU(k,j);
840 SetTraceToGeomOrientation(lambda);
844 AddNormTraceInt(dir,lambda,FaceExp,f,mkey.
GetVarCoeffs());
850 Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
858 int order_f, nquad_f;
859 int nbndry = NumDGBndryCoeffs();
860 int nfaces = GetNfaces();
883 LamToQ[0] = GetLocMatrix(LamToQ0key);
887 LamToQ[1] = GetLocMatrix(LamToQ1key);
891 LamToQ[2] = GetLocMatrix(LamToQ2key);
895 for(i = 0; i < nfaces; ++i)
897 FaceExp[i] = GetFaceExp(i);
901 for(i = 0; i < nbndry; ++i)
907 SetTraceToGeomOrientation(lam);
909 for(f = 0; f < nfaces; ++f)
911 order_f = FaceExp[f]->GetNcoeffs();
912 nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
913 normals = GetFaceNormal(f);
920 GetBasisNumModes(0), GetBasisNumModes(1),
921 GetBasisNumModes(2), f, GetForient(f));
923 StdExpansion::GetIndexMap(ikey);
937 for(j = 0; j < order_f; ++j)
939 faceCoeffs[j] = (*map)[j].sign*(*LamToQ[0])((*map)[j].index,i);
942 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
958 v_GetnFacecdotMF(0, f, FaceExp[f],
973 for(j = 0; j < order_f; ++j)
975 faceCoeffs[j] = (*map)[j].sign*(*LamToQ[1])((*map)[j].index,i);
978 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
994 v_GetnFacecdotMF(1, f, FaceExp[f],
1011 for(j = 0; j < order_f; ++j)
1013 faceCoeffs[j] = (*map)[j].sign*(*LamToQ[2])((*map)[j].index,i);
1016 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
1032 v_GetnFacecdotMF(2, f, FaceExp[f],
1033 normals, varcoeffs);
1048 if (m_negatedNormals[f])
1055 for(j = 0; j < order_f; ++j)
1057 faceCoeffs[j] = (*map)[j].sign*LamToU((*map)[j].index,i) - lam[cnt+j];
1060 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
1076 FaceExp[f]->IProductWRTBase(work, faceCoeffs);
1078 SetFaceToGeomOrientation(f, faceCoeffs);
1080 for(j = 0; j < order_f; ++j)
1082 BndMat(cnt+j,i) = faceCoeffs[j];
1102 int nq = GetTotPoints();
1106 IProductWRTBase(tmp, outarray);
1109 &(lmat->GetPtr())[0],1);
1115 ASSERTL0(
false,
"This matrix type cannot be generated from this class");
1124 int nFaces = GetNfaces();
1125 ASSERTL1(face < nFaces,
"Face is out of range.");
1126 if (m_faceExp.size() < nFaces)
1128 m_faceExp.resize(nFaces);
1130 m_faceExp[face] = f;
1135 return m_faceExp[face].lock();
1138 void Expansion3D::v_AddFaceNormBoundaryInt(
1155 if (m_requireNeg.size() == 0)
1157 m_requireNeg.resize(GetNfaces());
1159 for (i = 0; i < GetNfaces(); ++i)
1161 m_requireNeg[i] =
false;
1162 if (m_negatedNormals[i])
1164 m_requireNeg[i] =
true;
1170 if (faceExp->GetRightAdjacentElementExp())
1172 if (faceExp->GetRightAdjacentElementExp()->GetGeom3D()
1173 ->GetGlobalID() == GetGeom3D()->GetGlobalID())
1175 m_requireNeg[i] =
true;
1183 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
1184 face, GetForient(face));
1186 StdExpansion::GetIndexMap(ikey);
1188 int order_e = (*map).num_elements();
1189 int n_coeffs = FaceExp->GetNcoeffs();
1193 if (n_coeffs != order_e)
1198 FaceExp->FwdTrans(Fn, faceCoeffs);
1200 int NumModesElementMax = FaceExp->GetBasis(0)->GetNumModes();
1201 int NumModesElementMin = m_base[0]->GetNumModes();
1203 FaceExp->ReduceOrderCoeffs(NumModesElementMin,
1208 FaceExp->DetShapeType(),
1210 FaceExp->MassMatrixOp(faceCoeffs, faceCoeffs, masskey);
1213 int offset1 = 0, offset2 = 0;
1217 for (i = 0; i < NumModesElementMin; ++i)
1219 for (j = 0; j < NumModesElementMin; ++j)
1221 faceCoeffs[offset1+j] =
1222 faceCoeffs[offset2+j];
1224 offset1 += NumModesElementMin;
1225 offset2 += NumModesElementMax;
1229 for (i = NumModesElementMin; i < NumModesElementMax; ++i)
1231 for (j = NumModesElementMin; j < NumModesElementMax; ++j)
1233 faceCoeffs[i*NumModesElementMax+j] = 0.0;
1242 int offset1 = 0, offset2 = 0;
1244 for (i = 0; i < NumModesElementMin; ++i)
1246 for (j = 0; j < NumModesElementMin-i; ++j)
1248 faceCoeffs[offset1+j] =
1249 faceCoeffs[offset2+j];
1251 offset1 += NumModesElementMin-i;
1252 offset2 += NumModesElementMax-i;
1259 FaceExp->IProductWRTBase(Fn, faceCoeffs);
1262 if (m_requireNeg[face])
1264 for (i = 0; i < order_e; ++i)
1266 outarray[(*map)[i].index] -= (*map)[i].sign * faceCoeffs[i];
1271 for (i = 0; i < order_e; ++i)
1273 outarray[(*map)[i].index] += (*map)[i].sign * faceCoeffs[i];
1284 void Expansion3D::v_DGDeriv(
1291 int ncoeffs = GetNcoeffs();
1297 DNekScalMat &Dmat = *GetLocMatrix(DerivType[dir]);
1307 AddNormTraceInt(dir, FaceExp, faceCoeffs, coeffs);
1311 Out_d = InvMass*Coeffs;
1314 void Expansion3D::v_AddRobinMassMatrix(
1319 ASSERTL1(IsBoundaryInteriorExpansion(),
1320 "Not set up for non boundary-interior expansions");
1321 ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
1322 "Assuming that input matrix was square");
1327 int order_f = faceExp->GetNcoeffs();
1336 faceExp->DetShapeType();
1344 DNekScalMat &facemat = *faceExp->GetLocMatrix(mkey);
1361 int rows = inoutmat->GetRows();
1363 if (rows == GetNcoeffs())
1365 GetFaceToElementMap(face,GetForient(face),map,sign);
1367 else if (rows == GetNverts())
1369 int nfvert = faceExp->GetNverts();
1376 GetLinStdExp()->GetFaceToElementMap(face,GetForient(face),linmap, linsign);
1384 for(i = 0; i < nfvert; ++i)
1386 fmap = faceExp->GetVertexMap(i,
true);
1390 map[fmap] = linmap[i];
1393 else if(rows == NumBndryCoeffs())
1395 int nbndry = NumBndryCoeffs();
1398 GetFaceToElementMap(face,GetForient(face),map,sign);
1399 GetBoundaryMap(bmap);
1401 for(i = 0; i < order_f; ++i)
1403 for(j = 0; j < nbndry; ++j)
1405 if(map[i] == bmap[j])
1411 ASSERTL1(j != nbndry,
"Did not find number in map");
1414 else if (rows == NumDGBndryCoeffs())
1423 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
1424 face, GetForient(face));
1426 StdExpansion::GetIndexMap(ikey1);
1430 GetBasisNumModes(0),
1431 GetBasisNumModes(1),
1432 GetBasisNumModes(2),
1436 StdExpansion::GetIndexMap(ikey2);
1438 ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
1439 "There is an error with the GetFaceToElementMap");
1441 for (i = 0; i < face; ++i)
1443 cnt += GetFaceNcoeffs(i);
1446 for(i = 0; i < (*map1).num_elements(); ++i)
1450 for(j = 0; j < (*map2).num_elements(); ++j)
1452 if((*map1)[i].index == (*map2)[j].index)
1459 ASSERTL2(idx >= 0,
"Index not found");
1460 map [i] = idx + cnt;
1461 sign[i] = (*map2)[idx].sign;
1466 ASSERTL0(
false,
"Could not identify matrix type from dimension");
1469 for(i = 0; i < order_f; ++i)
1472 for(j = 0; j < order_f; ++j)
1475 (*inoutmat)(id1,id2) += facemat(i,j)*sign[i]*sign[j];
1486 int nVerts, vid1, vid2, vMap1, vMap2;
1489 nVerts = GetNverts();
1493 nVerts, nVerts, 0.0, storage);
1494 DNekMat &VertexMat = (*vertexmatrix);
1496 for (vid1 = 0; vid1 < nVerts; ++vid1)
1498 vMap1 = GetVertexMap(vid1,
true);
1500 for (vid2 = 0; vid2 < nVerts; ++vid2)
1502 vMap2 = GetVertexMap(vid2,
true);
1503 VertexValue = (*r_bnd)(vMap1, vMap2);
1504 VertexMat.SetValue(vid1, vid2, VertexValue);
1508 return vertexmatrix;
1516 int eid, fid, vid, n, i;
1518 int nBndCoeffs = NumBndryCoeffs();
1523 nVerts = GetNverts();
1524 nEdges = GetNedges();
1549 int nConnectedEdges = 3;
1550 int nConnectedFaces = 3;
1554 MatEdgeLocation(nConnectedEdges);
1556 MatFaceLocation(nConnectedFaces);
1562 transformationmatrix =
1564 nBndCoeffs, nBndCoeffs, 0.0, storage);
1566 DNekMat &R = (*transformationmatrix);
1572 for (vid = 0; vid < nVerts; ++vid)
1576 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1577 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1578 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) +
1579 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1580 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1581 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2)) - 6;
1583 int nedgemodesconnected =
1584 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1585 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1586 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) - 6;
1589 int nfacemodesconnected =
1590 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1591 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1592 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2));
1598 for (eid = 0; eid < nConnectedEdges; ++eid)
1600 MatEdgeLocation[eid] = GetEdgeInverseBoundaryMap(
1601 geom->GetVertexEdgeMap(vid, eid));
1602 nmodes = MatEdgeLocation[eid].num_elements();
1607 1, &edgemodearray[offset], 1);
1616 for (fid = 0; fid < nConnectedFaces; ++fid)
1618 MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1619 geom->GetVertexFaceMap(vid, fid));
1620 nmodes = MatFaceLocation[fid].num_elements();
1625 1, &facemodearray[offset], 1);
1632 1, efRow, 0.0, storage);
1633 DNekMat &Sveft = (*vertexedgefacetransformmatrix);
1637 1, efRow, 0.0, storage);
1638 DNekMat &Svef = (*vertexedgefacecoupling);
1641 for (n = 0; n < nedgemodesconnected; ++n)
1644 VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1648 Svef.SetValue(0, n, VertexEdgeFaceValue);
1652 for (n = 0; n < nfacemodesconnected; ++n)
1655 VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1659 Svef.SetValue(0, n + nedgemodesconnected,
1660 VertexEdgeFaceValue);
1673 efRow, efRow, 0.0, storage);
1674 DNekMat &Sefef = (*edgefacecoupling);
1679 for (m = 0; m < nedgemodesconnected; ++m)
1681 for (n = 0; n < nedgemodesconnected; ++n)
1684 EdgeEdgeValue = (*r_bnd)(edgemodearray[n],
1688 Sefef.SetValue(n, m, EdgeEdgeValue);
1693 for (n = 0; n < nfacemodesconnected; ++n)
1695 for (m = 0; m < nfacemodesconnected; ++m)
1698 FaceFaceValue = (*r_bnd)(facemodearray[n],
1701 Sefef.SetValue(nedgemodesconnected + n,
1702 nedgemodesconnected + m, FaceFaceValue);
1707 for (n = 0; n < nedgemodesconnected; ++n)
1709 for (m = 0; m < nfacemodesconnected; ++m)
1712 FaceFaceValue = (*r_bnd)(edgemodearray[n],
1717 nedgemodesconnected + m,
1720 FaceFaceValue = (*r_bnd)(facemodearray[m],
1724 Sefef.SetValue(nedgemodesconnected + m,
1737 Sveft = -Svef * Sefef;
1741 for (n = 0; n < edgemodearray.num_elements(); ++n)
1743 R.SetValue(GetVertexMap(vid), edgemodearray[n],
1748 for (n = 0; n < facemodearray.num_elements(); ++n)
1750 R.SetValue(GetVertexMap(vid), facemodearray[n],
1751 Sveft(0, n + nedgemodesconnected));
1774 int efCol, efRow, nedgemodes;
1777 nConnectedFaces = 2;
1788 for (eid = 0; eid < nEdges; ++eid)
1791 efCol = GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1792 GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1793 efRow = GetEdgeNcoeffs(eid) - 2;
1798 efRow, efCol, 0.0, storage);
1799 DNekMat &Mef = (*efedgefacecoupling);
1804 efCol, efCol, 0.0, storage);
1805 DNekMat &Meff = (*effacefacecoupling);
1810 efRow, efCol, 0.0, storage);
1811 DNekMat &Meft = (*edgefacetransformmatrix);
1813 int nfacemodesconnected =
1814 GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1815 GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1817 facemodearray(nfacemodesconnected);
1821 = GetEdgeInverseBoundaryMap(eid);
1822 nedgemodes = GetEdgeNcoeffs(eid) - 2;
1828 1, &edgemodearray[0], 1);
1834 for (fid = 0; fid < nConnectedFaces; ++fid)
1836 MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1837 geom->GetEdgeFaceMap(eid, fid));
1838 nmodes = MatFaceLocation[fid].num_elements();
1843 1, &facemodearray[offset], 1);
1849 for (n = 0; n < nedgemodes; ++n)
1851 for (m = 0; m < nfacemodesconnected; ++m)
1854 EdgeFaceValue = (*r_bnd)(edgemodearray[n],
1858 Mef.SetValue(n, m, EdgeFaceValue);
1863 for (n = 0; n < nfacemodesconnected; ++n)
1865 for (m = 0; m < nfacemodesconnected; ++m)
1868 FaceFaceValue = (*r_bnd)(facemodearray[n],
1872 Meff.SetValue(n, m, FaceFaceValue);
1886 for (n = 0; n < Meft.GetRows(); ++n)
1888 for (m = 0; m < Meft.GetColumns(); ++m)
1890 R.SetValue(edgemodearray[n], facemodearray[m],
1896 for (i = 0; i < R.GetRows(); ++i)
1898 R.SetValue(i, i, 1.0);
1904 return transformationmatrix;
1908 NEKERROR(ErrorUtil::efatal,
"unkown matrix type" );
1925 int i, j, n, eid = 0, fid = 0;
1926 int nCoeffs = NumBndryCoeffs();
1936 nCoeffs, nCoeffs, 0.0, storage);
1937 DNekMat &InvR = (*inversetransformationmatrix);
1939 int nVerts = GetNverts();
1940 int nEdges = GetNedges();
1941 int nFaces = GetNfaces();
1945 int nedgemodestotal = 0;
1946 int nfacemodestotal = 0;
1948 for (eid = 0; eid < nEdges; ++eid)
1950 nedgemodes = GetEdgeNcoeffs(eid) - 2;
1951 nedgemodestotal += nedgemodes;
1954 for (fid = 0; fid < nFaces; ++fid)
1956 nfacemodes = GetFaceIntNcoeffs(fid);
1957 nfacemodestotal += nfacemodes;
1961 edgemodearray(nedgemodestotal);
1963 facemodearray(nfacemodestotal);
1968 for (eid = 0; eid < nEdges; ++eid)
1971 = GetEdgeInverseBoundaryMap(eid);
1972 nedgemodes = GetEdgeNcoeffs(eid) - 2;
1978 &edgemodearray[offset], 1);
1981 offset += nedgemodes;
1987 for (fid = 0; fid < nFaces; ++fid)
1990 = GetFaceInverseBoundaryMap(fid);
1991 nfacemodes = GetFaceIntNcoeffs(fid);
1997 &facemodearray[offset], 1);
2000 offset += nfacemodes;
2004 for (i = 0; i < nVerts; ++i)
2006 for (j = 0; j < nedgemodestotal; ++j)
2009 GetVertexMap(i), edgemodearray[j],
2010 -R(GetVertexMap(i), edgemodearray[j]));
2012 for (j = 0; j < nfacemodestotal; ++j)
2015 GetVertexMap(i), facemodearray[j],
2016 -R(GetVertexMap(i), facemodearray[j]));
2017 for (n = 0; n < nedgemodestotal; ++n)
2019 MatrixValue = InvR.GetValue(GetVertexMap(i),
2021 + R(GetVertexMap(i), edgemodearray[n])
2022 * R(edgemodearray[n], facemodearray[j]);
2023 InvR.SetValue(GetVertexMap(i),
2031 for (i = 0; i < nedgemodestotal; ++i)
2033 for (j = 0; j < nfacemodestotal; ++j)
2036 edgemodearray[i], facemodearray[j],
2037 -R(edgemodearray[i], facemodearray[j]));
2041 for (i = 0; i < nCoeffs; ++i)
2043 InvR.SetValue(i, i, 1.0);
2046 return inversetransformationmatrix;
2054 int nBndCoeffs = NumBndryCoeffs();
2057 GetBoundaryMap(bmap);
2061 map<int, int> invmap;
2062 for (j = 0; j < nBndCoeffs; ++j)
2064 invmap[bmap[j]] = j;
2068 nEdgeCoeffs = GetEdgeNcoeffs(eid) - 2;
2074 geom->GetEorient(eid);
2081 GetEdgeInteriorMap(eid, eOrient, maparray, signarray);
2083 for (n = 0; n < nEdgeCoeffs; ++n)
2085 edgemaparray[n] = invmap[maparray[n]];
2088 return edgemaparray;
2092 Expansion3D::v_GetFaceInverseBoundaryMap(
2101 int nBndCoeffs = NumBndryCoeffs();
2104 GetBoundaryMap(bmap);
2108 map<int, int> reversemap;
2109 for (j = 0; j < bmap.num_elements(); ++j)
2111 reversemap[bmap[j]] = j;
2115 nFaceCoeffs = GetFaceIntNcoeffs(fid);
2125 fOrient = GetForient(fid);
2129 fOrient = faceOrient;
2133 GetFaceInteriorMap(fid, fOrient, maparray, signarray);
2137 GetFaceNumModes(fid,fOrient,locP1,locP2);
2145 ASSERTL1(P1 <= locP1,
"Expect value of passed P1 to " 2146 "be lower or equal to face num modes");
2155 ASSERTL1(P2 <= locP2,
"Expect value of passed P2 to " 2156 "be lower or equal to face num modes");
2159 switch(GetGeom3D()->GetFace(fid)->GetShapeType())
2163 if(((P1-3)>0)&&((P2-3)>0))
2168 for(n = 0; n < P1-3; ++n)
2170 for(
int m = 0; m < P2-3-n; ++m, ++cnt)
2172 facemaparray[cnt] = reversemap[maparray[cnt1+m]];
2181 if(((P1-2)>0)&&((P2-2)>0))
2186 for(n = 0; n < P2-2; ++n)
2188 for(
int m = 0; m < P1-2; ++m, ++cnt)
2190 facemaparray[cnt] = reversemap[maparray[cnt1+m]];
2198 ASSERTL0(
false,
"Invalid shape type.");
2203 return facemaparray;
2206 void Expansion3D::v_GetInverseBoundaryMaps(
2215 int nBndCoeffs = NumBndryCoeffs();
2218 GetBoundaryMap(bmap);
2222 map<int, int> reversemap;
2223 for (j = 0; j < bmap.num_elements(); ++j)
2225 reversemap[bmap[j]] = j;
2228 int nverts = GetNverts();
2230 for (n = 0; n < nverts; ++n)
2232 int id = GetVertexMap(n);
2233 vmap[n] = reversemap[id];
2236 int nedges = GetNedges();
2239 for(
int eid = 0; eid < nedges; ++eid)
2242 nEdgeCoeffs = GetEdgeNcoeffs(eid) - 2;
2252 maparray, signarray);
2254 for (n = 0; n < nEdgeCoeffs; ++n)
2256 edgemaparray[n] = reversemap[maparray[n]];
2258 emap[eid] = edgemaparray;
2261 int nfaces = GetNfaces();
2264 for(
int fid = 0; fid < nfaces; ++fid)
2267 nFaceCoeffs = GetFaceIntNcoeffs(fid);
2277 maparray, signarray);
2279 for (n = 0; n < nFaceCoeffs; ++n)
2281 facemaparray[n] = reversemap[maparray[n]];
2284 fmap[fid] = facemaparray;
2291 return m_geom->GetForient(face);
2298 void Expansion3D::v_GetTracePhysVals(
2305 v_GetFacePhysVals(face,FaceExp,inarray,outarray,orient);
2308 void Expansion3D::v_GetFacePhysVals(
2318 orient = GetForient(face);
2321 int nq0 = FaceExp->GetNumPoints(0);
2322 int nq1 = FaceExp->GetNumPoints(1);
2324 int nfacepts = GetFaceNumPoints(face);
2325 int dir0 = GetGeom3D()->GetDir(face,0);
2326 int dir1 = GetGeom3D()->GetDir(face,1);
2333 GetFacePhysMap(face,faceids);
2334 Vmath::Gathr(faceids.num_elements(),inarray,faceids,o_tmp);
2352 m_base[dir1]->GetPointsKey(),
2354 FaceExp->GetBasis(to_id0)->GetPointsKey(),
2355 FaceExp->GetBasis(to_id1)->GetPointsKey(),
2359 ReOrientFacePhysMap(FaceExp->GetNverts(),orient,nq0,nq1,faceids);
2363 void Expansion3D::ReOrientFacePhysMap(
const int nvert,
2365 const int nq0,
const int nq1,
2370 ReOrientTriFacePhysMap(orient,nq0,nq1,idmap);
2374 ReOrientQuadFacePhysMap(orient,nq0,nq1,idmap);
2383 if(idmap.num_elements() != nq0*nq1)
2392 for(
int i = 0; i < nq0*nq1; ++i)
2399 for (
int j = 0; j < nq1; ++j)
2401 for(
int i = 0; i < nq0; ++i)
2403 idmap[j*nq0+i] = nq0-1-i +j*nq0;
2408 ASSERTL0(
false,
"Case not supposed to be used in this function");
2418 if(idmap.num_elements() != nq0*nq1)
2428 for(
int i = 0; i < nq0*nq1; ++i)
2436 for (
int j = 0; j < nq1; j++)
2438 for (
int i =0; i < nq0; ++i)
2440 idmap[j*nq0+i] = nq0-1-i + j*nq0;
2448 for (
int j = 0; j < nq1; j++)
2450 for (
int i =0; i < nq0; ++i)
2452 idmap[j*nq0+i] = nq0*(nq1-1-j)+i;
2460 for (
int j = 0; j < nq1; j++)
2462 for (
int i =0; i < nq0; ++i)
2464 idmap[j*nq0+i] = nq0*nq1-1-j*nq0 -i;
2472 for (
int i =0; i < nq0; ++i)
2474 for (
int j = 0; j < nq1; ++j)
2476 idmap[i*nq1+j] = i + j*nq0;
2484 for (
int i =0; i < nq0; ++i)
2486 for (
int j = 0; j < nq1; ++j)
2488 idmap[i*nq1+j] = nq0-1-i + j*nq0;
2496 for (
int i =0; i < nq0; ++i)
2498 for (
int j = 0; j < nq1; ++j)
2500 idmap[i*nq1+j] = i+nq0*(nq1-1)-j*nq0;
2508 for (
int i =0; i < nq0; ++i)
2510 for (
int j = 0; j < nq1; ++j)
2512 idmap[i*nq1+j] = nq0*nq1-1-i-j*nq0;
2518 ASSERTL0(
false,
"Unknow orientation");
2523 void Expansion3D::v_NormVectorIProductWRTBase(
2527 NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
2539 int nquad_f = FaceExp_f->GetNumPoints(0)*FaceExp_f->GetNumPoints(1);
2540 int coordim = GetCoordim();
2542 int nquad0 = m_base[0]->GetNumPoints();
2543 int nquad1 = m_base[1]->GetNumPoints();
2544 int nquad2 = m_base[2]->GetNumPoints();
2545 int nqtot = nquad0*nquad1*nquad2;
2563 StdRegions::VarCoeffMap::const_iterator MFdir;
2568 for (
int k=0; k<coordim; k++)
2570 MFdir = varcoeffs.find(MMFCoeffs[dir*5+k]);
2571 tmp = MFdir->second;
2573 GetPhysFaceVarCoeffsFromElement(face, FaceExp_f, tmp, tmp_f);
2578 &nFacecdotMF[0], 1);
const VarCoeffMap & GetVarCoeffs() const
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
std::shared_ptr< Geometry3D > Geometry3DSharedPtr
void Gathr(int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
#define sign(a, b)
return the sign(b)*a
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
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 Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
std::shared_ptr< DNekMat > DNekMatSharedPtr
MatrixType GetMatrixType() const
bool HasVarCoeff(const StdRegions::VarCoeffType &coeff) const
static DNekMatSharedPtr NullDNekMatSharedPtr
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis...
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
int getNumberOfCoefficients(int Na)
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
void Neg(int n, T *x, const int incx)
Negate x = -x.
NekDouble GetConstFactor(const ConstFactorType &factor) const
std::shared_ptr< Expansion > ExpansionSharedPtr
const ConstFactorMap & GetConstFactors() const
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
void Zero(int n, T *x, const int incx)
Zero vector.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.
static ConstFactorMap NullConstFactorMap