47 namespace LocalRegions
51 void Expansion3D::AddHDGHelmholtzFaceTerms(
60 int nquad_f = FaceExp->GetNumPoints(0)*FaceExp->GetNumPoints(1);
61 int order_f = FaceExp->GetNcoeffs();
62 int coordim = GetCoordim();
63 int ncoeffs = GetNcoeffs();
70 = GetFaceNormal(face);
79 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
80 face, GetForient(face));
82 StdExpansion::GetIndexMap(ikey);
96 if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
98 GetPhysFaceVarCoeffsFromElement(face,FaceExp,x->second,varcoeff_work);
99 Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp->GetPhys(),1,FaceExp->UpdatePhys(),1);
106 FaceExp->IProductWRTBase(facePhys, outcoeff);
108 for(i = 0; i < order_f; ++i)
110 outarray[(*map)[i].index] += (*map)[i].sign*tau*outcoeff[i];
115 const NekDouble *data = invMass.GetRawPtr();
122 for(n = 0; n < coordim; ++n)
124 Vmath::Vmul(nquad_f, normals[n], 1, facePhys, 1, inval, 1);
126 if (m_negatedNormals[face])
142 FaceExp->IProductWRTBase(inval, outcoeff);
145 for(i = 0; i < ncoeffs; ++i)
148 for(j = 0; j < order_f; ++j)
150 tmpcoeff[i] += scale*data[i+(*map)[j].index*ncoeffs]*(*map)[j].sign*outcoeff[j];
155 Coeffs = Coeffs + Dmat*Tmpcoeff;
178 void Expansion3D::AddNormTraceInt(
187 int nfaces = GetNfaces();
190 for(f = 0; f < nfaces; ++f)
192 order_f = FaceExp[f]->GetNcoeffs();
193 nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
199 for(i = 0; i < order_f; ++i)
201 faceCoeffs[i] = inarray[i+cnt];
205 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
221 Vmath::Vmul(nquad_f, normals[dir], 1, facePhys, 1, facePhys, 1);
223 if (m_negatedNormals[f])
228 AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray, varcoeffs);
233 void Expansion3D::AddNormTraceInt(
240 int order_f, nquad_f;
241 int nfaces = GetNfaces();
244 for(f = 0; f < nfaces; ++f)
246 order_f = FaceExp[f]->GetNcoeffs();
247 nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
254 FaceExp[f]->BwdTrans(faceCoeffs[f], facePhys);
256 Vmath::Vmul(nquad_f, normals[dir], 1, facePhys, 1, facePhys, 1);
258 if (m_negatedNormals[f])
263 AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray);
270 void Expansion3D::AddFaceBoundaryInt(
278 int order_f = FaceExp->GetNcoeffs();
283 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
284 face, GetForient(face));
286 StdExpansion::GetIndexMap(ikey);
301 FaceExp->IProductWRTBase(facePhys, coeff);
304 for(i = 0; i < order_f; ++i)
306 outarray[(*map)[i].index] += (*map)[i].sign*coeff[i];
313 void Expansion3D::SetFaceToGeomOrientation(
317 int nface = GetFaceNcoeffs(face);
325 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
328 StdExpansion::GetIndexMap(ikey1);
331 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
332 face, GetForient(face));
334 StdExpansion::GetIndexMap(ikey2);
336 ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
337 "There is an error with the GetFaceToElementMap");
339 for(j = 0; j < (*map1).num_elements(); ++j)
342 for(k = 0; k < (*map2).num_elements(); ++k)
345 if((*map1)[j].index == (*map2)[k].index && k != j)
349 if((*map1)[j].sign != (*map2)[k].sign)
363 int nfaces = GetNfaces();
367 for(i = 0; i < nfaces; ++i)
369 SetFaceToGeomOrientation(i, f_tmp = inout + cnt);
370 cnt += GetFaceNcoeffs(i);
387 "Matrix construction is not implemented for variable "
388 "coefficients at the moment");
398 ASSERTL1(IsBoundaryInteriorExpansion(),
399 "HybridDGHelmholtz matrix not set up "
400 "for non boundary-interior expansions");
405 int ncoeffs = GetNcoeffs();
406 int nfaces = GetNfaces();
413 int order_f, coordim = GetCoordim();
427 for(i=0; i < coordim; ++i)
430 Mat = Mat + Dmat*invMass*
Transpose(Dmat);
454 Mat = Mat + lambdaval*Mass;
457 for(i = 0; i < nfaces; ++i)
459 FaceExp = GetFaceExp(i);
460 order_f = FaceExp->GetNcoeffs();
463 GetBasisNumModes(0), GetBasisNumModes(1),
464 GetBasisNumModes(2), i, GetForient(i));
466 StdExpansion::GetIndexMap(ikey);
486 for(j = 0; j < order_f; ++j)
488 for(k = 0; k < order_f; ++k)
490 Mat((*map)[j].index,(*map)[k].index) +=
491 tau*(*map)[j].sign*(*map)[k].sign*
eMass(j,k);
502 int nbndry = NumDGBndryCoeffs();
503 int ncoeffs = GetNcoeffs();
504 int nfaces = GetNfaces();
528 for(i = 0; i < nfaces; ++i)
530 FaceExp = GetFaceExp(i);
531 int nface = GetFaceNcoeffs(i);
537 for(j = 0; j < nface; ++j)
541 face_lambda[j] = 1.0;
543 SetFaceToGeomOrientation(i, face_lambda);
546 FaceExp->BwdTrans(face_lambda, tmp);
547 AddHDGHelmholtzFaceTerms(tau, i, tmp, mkey.
GetVarCoeffs(), f);
552 for(k = 0; k < ncoeffs; ++k)
554 Umat(k,bndry_cnt) = Ulam[k];
605 int nbndry = NumDGBndryCoeffs();
607 int ncoeffs = GetNcoeffs();
608 int nfaces = GetNfaces();
630 for(i = 0; i < nfaces; ++i)
632 FaceExp[i] = GetFaceExp(i);
652 ASSERTL0(
false,
"Direction not known");
659 for(j = 0; j < nbndry; ++j)
665 for(k = 0; k < ncoeffs; ++k)
667 Ulam[k] = lamToU(k,j);
674 SetTraceToGeomOrientation(lambda);
678 AddNormTraceInt(dir,lambda,FaceExp,f,mkey.
GetVarCoeffs());
684 Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
692 int order_f, nquad_f;
693 int nbndry = NumDGBndryCoeffs();
694 int nfaces = GetNfaces();
717 LamToQ[0] = GetLocMatrix(LamToQ0key);
721 LamToQ[1] = GetLocMatrix(LamToQ1key);
725 LamToQ[2] = GetLocMatrix(LamToQ2key);
728 for(i = 0; i < nfaces; ++i)
730 FaceExp[i] = GetFaceExp(i);
734 for(i = 0; i < nbndry; ++i)
740 SetTraceToGeomOrientation(lam);
742 for(f = 0; f < nfaces; ++f)
744 order_f = FaceExp[f]->GetNcoeffs();
745 nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
746 normals = GetFaceNormal(f);
753 GetBasisNumModes(0), GetBasisNumModes(1),
754 GetBasisNumModes(2), f, GetForient(f));
756 StdExpansion::GetIndexMap(ikey);
770 for(j = 0; j < order_f; ++j)
772 faceCoeffs[j] = (*map)[j].sign*(*LamToQ[0])((*map)[j].index,i);
775 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
787 Vmath::Vmul(nquad_f, normals[0], 1, facePhys, 1, work, 1);
790 for(j = 0; j < order_f; ++j)
792 faceCoeffs[j] = (*map)[j].sign*(*LamToQ[1])((*map)[j].index,i);
795 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
807 Vmath::Vvtvp(nquad_f, normals[1], 1, facePhys, 1, work, 1, work, 1);
810 for(j = 0; j < order_f; ++j)
812 faceCoeffs[j] = (*map)[j].sign*(*LamToQ[2])((*map)[j].index,i);
815 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
830 if (m_negatedNormals[f])
837 for(j = 0; j < order_f; ++j)
839 faceCoeffs[j] = (*map)[j].sign*LamToU((*map)[j].index,i) - lam[cnt+j];
842 FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
858 FaceExp[f]->IProductWRTBase(work, faceCoeffs);
860 SetFaceToGeomOrientation(f, faceCoeffs);
862 for(j = 0; j < order_f; ++j)
864 BndMat(cnt+j,i) = faceCoeffs[j];
884 int nq = GetTotPoints();
888 IProductWRTBase(tmp, outarray);
891 &(lmat->GetPtr())[0],1);
898 ASSERTL0(
false,
"This matrix type cannot be generated from this class");
907 int nFaces = GetNfaces();
908 ASSERTL1(face < nFaces,
"Face is out of range.");
909 if (m_faceExp.size() < nFaces)
911 m_faceExp.resize(nFaces);
918 return m_faceExp[face].lock();
921 void Expansion3D::v_AddFaceNormBoundaryInt(
938 if (m_requireNeg.size() == 0)
940 m_requireNeg.resize(GetNfaces());
942 for (i = 0; i < GetNfaces(); ++i)
944 m_requireNeg[i] =
false;
945 if (m_negatedNormals[i])
947 m_requireNeg[i] =
true;
953 if (faceExp->GetRightAdjacentElementExp())
955 if (faceExp->GetRightAdjacentElementExp()->GetGeom3D()
956 ->GetGlobalID() == GetGeom3D()->GetGlobalID())
958 m_requireNeg[i] =
true;
966 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
967 face, GetForient(face));
969 StdExpansion::GetIndexMap(ikey);
971 int order_e = (*map).num_elements();
972 int n_coeffs = FaceExp->GetNcoeffs();
976 if (n_coeffs != order_e)
981 FaceExp->FwdTrans(Fn, faceCoeffs);
983 int NumModesElementMax = FaceExp->GetBasis(0)->GetNumModes();
984 int NumModesElementMin = m_base[0]->GetNumModes();
986 FaceExp->ReduceOrderCoeffs(NumModesElementMin,
991 FaceExp->DetShapeType(),
993 FaceExp->MassMatrixOp(faceCoeffs, faceCoeffs, masskey);
996 int offset1 = 0, offset2 = 0;
1000 for (i = 0; i < NumModesElementMin; ++i)
1002 for (j = 0; j < NumModesElementMin; ++j)
1004 faceCoeffs[offset1+j] =
1005 faceCoeffs[offset2+j];
1007 offset1 += NumModesElementMin;
1008 offset2 += NumModesElementMax;
1012 for (i = NumModesElementMin; i < NumModesElementMax; ++i)
1014 for (j = NumModesElementMin; j < NumModesElementMax; ++j)
1016 faceCoeffs[i*NumModesElementMax+j] = 0.0;
1025 int offset1 = 0, offset2 = 0;
1027 for (i = 0; i < NumModesElementMin; ++i)
1029 for (j = 0; j < NumModesElementMin-i; ++j)
1031 faceCoeffs[offset1+j] =
1032 faceCoeffs[offset2+j];
1034 offset1 += NumModesElementMin-i;
1035 offset2 += NumModesElementMax-i;
1042 FaceExp->IProductWRTBase(Fn, faceCoeffs);
1045 if (m_requireNeg[face])
1047 for (i = 0; i < order_e; ++i)
1049 outarray[(*map)[i].index] -= (*map)[i].sign * faceCoeffs[i];
1054 for (i = 0; i < order_e; ++i)
1056 outarray[(*map)[i].index] += (*map)[i].sign * faceCoeffs[i];
1067 void Expansion3D::v_DGDeriv(
1074 int ncoeffs = GetNcoeffs();
1080 DNekScalMat &Dmat = *GetLocMatrix(DerivType[dir]);
1090 AddNormTraceInt(dir, FaceExp, faceCoeffs, coeffs);
1094 Out_d = InvMass*Coeffs;
1097 void Expansion3D::v_AddRobinMassMatrix(
1102 ASSERTL1(IsBoundaryInteriorExpansion(),
1103 "Not set up for non boundary-interior expansions");
1104 ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
1105 "Assuming that input matrix was square");
1107 "Method set up only for modified modal bases curretly");
1112 int order_f = faceExp->GetNcoeffs();
1121 faceExp->DetShapeType();
1129 DNekScalMat &facemat = *faceExp->GetLocMatrix(mkey);
1146 int rows = inoutmat->GetRows();
1148 if (rows == GetNcoeffs())
1150 GetFaceToElementMap(face,GetForient(face),map,sign);
1152 else if (rows == GetNverts())
1154 int nfvert = faceExp->GetNverts();
1161 GetLinStdExp()->GetFaceToElementMap(face,GetForient(face),linmap, linsign);
1169 for(i = 0; i < nfvert; ++i)
1171 fmap = faceExp->GetVertexMap(i,
true);
1175 map[fmap] = linmap[i];
1178 else if(rows == NumBndryCoeffs())
1180 int nbndry = NumBndryCoeffs();
1183 GetFaceToElementMap(face,GetForient(face),map,sign);
1184 GetBoundaryMap(bmap);
1186 for(i = 0; i < order_f; ++i)
1188 for(j = 0; j < nbndry; ++j)
1190 if(map[i] == bmap[j])
1196 ASSERTL1(j != nbndry,
"Did not find number in map");
1199 else if (rows == NumDGBndryCoeffs())
1208 GetBasisNumModes(0), GetBasisNumModes(1), GetBasisNumModes(2),
1209 face, GetForient(face));
1211 StdExpansion::GetIndexMap(ikey1);
1215 GetBasisNumModes(0),
1216 GetBasisNumModes(1),
1217 GetBasisNumModes(2),
1221 StdExpansion::GetIndexMap(ikey2);
1223 ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
1224 "There is an error with the GetFaceToElementMap");
1226 for (i = 0; i < face; ++i)
1228 cnt += GetFaceNcoeffs(i);
1231 for(i = 0; i < (*map1).num_elements(); ++i)
1235 for(j = 0; j < (*map2).num_elements(); ++j)
1237 if((*map1)[i].index == (*map2)[j].index)
1244 ASSERTL2(idx >= 0,
"Index not found");
1245 map [i] = idx + cnt;
1246 sign[i] = (*map2)[idx].sign;
1251 ASSERTL0(
false,
"Could not identify matrix type from dimension");
1254 for(i = 0; i < order_f; ++i)
1257 for(j = 0; j < order_f; ++j)
1260 (*inoutmat)(id1,id2) += facemat(i,j)*sign[i]*sign[j];
1271 int nVerts, vid1, vid2, vMap1, vMap2;
1274 nVerts = GetNverts();
1278 nVerts, nVerts, 0.0, storage);
1279 DNekMat &VertexMat = (*m_vertexmatrix);
1281 for (vid1 = 0; vid1 < nVerts; ++vid1)
1283 vMap1 = GetVertexMap(vid1,
true);
1285 for (vid2 = 0; vid2 < nVerts; ++vid2)
1287 vMap2 = GetVertexMap(vid2,
true);
1288 VertexValue = (*r_bnd)(vMap1, vMap2);
1289 VertexMat.SetValue(vid1, vid2, VertexValue);
1293 return m_vertexmatrix;
1301 int eid, fid, vid, n, i;
1303 int nBndCoeffs = NumBndryCoeffs();
1308 nVerts = GetNverts();
1309 nEdges = GetNedges();
1334 int nConnectedEdges = 3;
1335 int nConnectedFaces = 3;
1339 MatEdgeLocation(nConnectedEdges);
1341 MatFaceLocation(nConnectedFaces);
1348 m_transformationmatrix =
1350 nBndCoeffs, nBndCoeffs, 0.0, storage);
1351 m_transposedtransformationmatrix =
1353 nBndCoeffs, nBndCoeffs, 0.0, storage);
1355 DNekMat &R = (*m_transformationmatrix);
1356 DNekMat &RT = (*m_transposedtransformationmatrix);
1361 for (vid = 0; vid < nVerts; ++vid)
1365 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1366 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1367 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) +
1368 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1369 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1370 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2)) - 6;
1372 int nedgemodesconnected =
1373 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1374 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1375 GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) - 6;
1378 int nfacemodesconnected =
1379 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1380 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1381 GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2));
1387 for (eid = 0; eid < nConnectedEdges; ++eid)
1389 MatEdgeLocation[eid] = GetEdgeInverseBoundaryMap(
1390 geom->GetVertexEdgeMap(vid, eid));
1391 nmodes = MatEdgeLocation[eid].num_elements();
1396 1, &edgemodearray[offset], 1);
1405 for (fid = 0; fid < nConnectedFaces; ++fid)
1407 MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1408 geom->GetVertexFaceMap(vid, fid));
1409 nmodes = MatFaceLocation[fid].num_elements();
1414 1, &facemodearray[offset], 1);
1421 1, efRow, 0.0, storage);
1422 DNekMat &Sveft = (*m_vertexedgefacetransformmatrix);
1426 1, efRow, 0.0, storage);
1427 DNekMat &Svef = (*m_vertexedgefacecoupling);
1430 for (n = 0; n < nedgemodesconnected; ++n)
1433 VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1437 Svef.SetValue(0, n, VertexEdgeFaceValue);
1441 for (n = 0; n < nfacemodesconnected; ++n)
1444 VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1448 Svef.SetValue(0, n + nedgemodesconnected, VertexEdgeFaceValue);
1461 efRow, efRow, 0.0, storage);
1462 DNekMat &Sefef = (*m_edgefacecoupling);
1467 for (m = 0; m < nedgemodesconnected; ++m)
1469 for (n = 0; n < nedgemodesconnected; ++n)
1472 EdgeEdgeValue = (*r_bnd)(edgemodearray[n],
1476 Sefef.SetValue(n, m, EdgeEdgeValue);
1481 for (n = 0; n < nfacemodesconnected; ++n)
1483 for (m = 0; m < nfacemodesconnected; ++m)
1486 FaceFaceValue = (*r_bnd)(facemodearray[n],
1489 Sefef.SetValue(nedgemodesconnected + n,
1490 nedgemodesconnected + m, FaceFaceValue);
1495 for (n = 0; n < nedgemodesconnected; ++n)
1497 for (m = 0; m < nfacemodesconnected; ++m)
1500 FaceFaceValue = (*r_bnd)(edgemodearray[n],
1505 nedgemodesconnected + m,
1509 Sefef.SetValue(nedgemodesconnected + m,
1522 Sveft = -Svef * Sefef;
1526 for (n = 0; n < edgemodearray.num_elements(); ++n)
1528 RT.SetValue(edgemodearray[n], GetVertexMap(vid),
1530 R.SetValue(GetVertexMap(vid), edgemodearray[n],
1535 for (n = 0; n < facemodearray.num_elements(); ++n)
1537 RT.SetValue(facemodearray[n], GetVertexMap(vid),
1538 Sveft(0, n + nedgemodesconnected));
1539 R.SetValue(GetVertexMap(vid), facemodearray[n],
1540 Sveft(0, n + nedgemodesconnected));
1563 int efCol, efRow, nedgemodes;
1566 nConnectedFaces = 2;
1577 for (eid = 0; eid < nEdges; ++eid)
1580 efCol = GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1581 GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1582 efRow = GetEdgeNcoeffs(eid) - 2;
1587 efRow, efCol, 0.0, storage);
1588 DNekMat &Mef = (*m_efedgefacecoupling);
1593 efCol, efCol, 0.0, storage);
1594 DNekMat &Meff = (*m_effacefacecoupling);
1599 efRow, efCol, 0.0, storage);
1600 DNekMat &Meft = (*m_edgefacetransformmatrix);
1602 int nfacemodesconnected =
1603 GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1604 GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1606 facemodearray(nfacemodesconnected);
1610 = GetEdgeInverseBoundaryMap(eid);
1611 nedgemodes = GetEdgeNcoeffs(eid) - 2;
1617 1, &edgemodearray[0], 1);
1623 for (fid = 0; fid < nConnectedFaces; ++fid)
1625 MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1626 geom->GetEdgeFaceMap(eid, fid));
1627 nmodes = MatFaceLocation[fid].num_elements();
1632 1, &facemodearray[offset], 1);
1638 for (n = 0; n < nedgemodes; ++n)
1640 for (m = 0; m < nfacemodesconnected; ++m)
1643 EdgeFaceValue = (*r_bnd)(edgemodearray[n],
1647 Mef.SetValue(n, m, EdgeFaceValue);
1652 for (n = 0; n < nfacemodesconnected; ++n)
1654 for (m = 0; m < nfacemodesconnected; ++m)
1657 FaceFaceValue = (*r_bnd)(facemodearray[n],
1661 Meff.SetValue(n, m, FaceFaceValue);
1675 for (n = 0; n < Meft.GetRows(); ++n)
1677 for (m = 0; m < Meft.GetColumns(); ++m)
1679 R.SetValue(edgemodearray[n], facemodearray[m],
1681 RT.SetValue(facemodearray[m], edgemodearray[n],
1687 for (i = 0; i < R.GetRows(); ++i)
1689 R.SetValue(i, i, 1.0);
1690 RT.SetValue(i, i, 1.0);
1696 return m_transformationmatrix;
1701 return m_transposedtransformationmatrix;
1722 int i, j, n, eid = 0, fid = 0;
1723 int nCoeffs = NumBndryCoeffs();
1733 nCoeffs, nCoeffs, 0.0, storage);
1734 DNekMat &InvR = (*m_inversetransformationmatrix);
1736 int nVerts = GetNverts();
1737 int nEdges = GetNedges();
1738 int nFaces = GetNfaces();
1742 int nedgemodestotal = 0;
1743 int nfacemodestotal = 0;
1745 for (eid = 0; eid < nEdges; ++eid)
1747 nedgemodes = GetEdgeNcoeffs(eid) - 2;
1748 nedgemodestotal += nedgemodes;
1751 for (fid = 0; fid < nFaces; ++fid)
1753 nfacemodes = GetFaceIntNcoeffs(fid);
1754 nfacemodestotal += nfacemodes;
1758 edgemodearray(nedgemodestotal);
1760 facemodearray(nfacemodestotal);
1765 for (eid = 0; eid < nEdges; ++eid)
1768 = GetEdgeInverseBoundaryMap(eid);
1769 nedgemodes = GetEdgeNcoeffs(eid) - 2;
1775 &edgemodearray[offset], 1);
1778 offset += nedgemodes;
1784 for (fid = 0; fid < nFaces; ++fid)
1787 = GetFaceInverseBoundaryMap(fid);
1788 nfacemodes = GetFaceIntNcoeffs(fid);
1794 &facemodearray[offset], 1);
1797 offset += nfacemodes;
1801 for (i = 0; i < nVerts; ++i)
1803 for (j = 0; j < nedgemodestotal; ++j)
1806 GetVertexMap(i), edgemodearray[j],
1807 -R(GetVertexMap(i), edgemodearray[j]));
1809 for (j = 0; j < nfacemodestotal; ++j)
1812 GetVertexMap(i), facemodearray[j],
1813 -R(GetVertexMap(i), facemodearray[j]));
1814 for (n = 0; n < nedgemodestotal; ++n)
1816 MatrixValue = InvR.GetValue(GetVertexMap(i),
1818 + R(GetVertexMap(i), edgemodearray[n])
1819 * R(edgemodearray[n], facemodearray[j]);
1820 InvR.SetValue(GetVertexMap(i),
1828 for (i = 0; i < nedgemodestotal; ++i)
1830 for (j = 0; j < nfacemodestotal; ++j)
1833 edgemodearray[i], facemodearray[j],
1834 -R(edgemodearray[i], facemodearray[j]));
1838 for (i = 0; i < nCoeffs; ++i)
1840 InvR.SetValue(i, i, 1.0);
1843 return m_inversetransformationmatrix;
1851 int nBndCoeffs = NumBndryCoeffs();
1854 GetBoundaryMap(bmap);
1858 map<int, int> invmap;
1859 for (j = 0; j < nBndCoeffs; ++j)
1861 invmap[bmap[j]] = j;
1865 nEdgeCoeffs = GetEdgeNcoeffs(eid) - 2;
1871 geom->GetEorient(eid);
1878 GetEdgeInteriorMap(eid, eOrient, maparray, signarray);
1880 for (n = 0; n < nEdgeCoeffs; ++n)
1882 edgemaparray[n] = invmap[maparray[n]];
1885 return edgemaparray;
1889 Expansion3D::v_GetFaceInverseBoundaryMap(
1896 int nBndCoeffs = NumBndryCoeffs();
1899 GetBoundaryMap(bmap);
1903 map<int, int> reversemap;
1904 for (j = 0; j < bmap.num_elements(); ++j)
1906 reversemap[bmap[j]] = j;
1910 nFaceCoeffs = GetFaceIntNcoeffs(fid);
1921 fOrient = GetForient(fid);
1925 fOrient = faceOrient;
1929 GetFaceInteriorMap(fid, fOrient, maparray, signarray);
1931 for (n = 0; n < nFaceCoeffs; ++n)
1933 facemaparray[n] = reversemap[maparray[n]];
1936 return facemaparray;
1941 return m_geom->GetForient(face);
1948 void Expansion3D::v_GetTracePhysVals(
1955 v_GetFacePhysVals(face,FaceExp,inarray,outarray,orient);
1958 void Expansion3D::v_GetFacePhysVals(
1968 orient = GetForient(face);
1971 int nq0 = FaceExp->GetNumPoints(0);
1972 int nq1 = FaceExp->GetNumPoints(1);
1974 int nfacepts = GetFaceNumPoints(face);
1975 int dir0 = GetGeom3D()->GetDir(face,0);
1976 int dir1 = GetGeom3D()->GetDir(face,1);
1983 GetFacePhysMap(face,faceids);
1984 Vmath::Gathr(faceids.num_elements(),inarray,faceids,o_tmp);
2002 m_base[dir1]->GetPointsKey(),
2004 FaceExp->GetBasis(to_id0)->GetPointsKey(),
2005 FaceExp->GetBasis(to_id1)->GetPointsKey(),
2009 ReOrientFacePhysMap(FaceExp->GetNverts(),orient,nq0,nq1,faceids);
2013 void Expansion3D::ReOrientFacePhysMap(
const int nvert,
2015 const int nq0,
const int nq1,
2020 ReOrientTriFacePhysMap(orient,nq0,nq1,idmap);
2024 ReOrientQuadFacePhysMap(orient,nq0,nq1,idmap);
2033 if(idmap.num_elements() != nq0*nq1)
2042 for(
int i = 0; i < nq0*nq1; ++i)
2049 for (
int j = 0; j < nq1; ++j)
2051 for(
int i = 0; i < nq0; ++i)
2053 idmap[j*nq0+i] = nq0-1-i +j*nq0;
2058 ASSERTL0(
false,
"Case not supposed to be used in this function");
2068 if(idmap.num_elements() != nq0*nq1)
2078 for(
int i = 0; i < nq0*nq1; ++i)
2086 for (
int j = 0; j < nq1; j++)
2088 for (
int i =0; i < nq0; ++i)
2090 idmap[j*nq0+i] = nq0-1-i + j*nq0;
2098 for (
int j = 0; j < nq1; j++)
2100 for (
int i =0; i < nq0; ++i)
2102 idmap[j*nq0+i] = nq0*(nq1-1-j)+i;
2109 for (
int j = 0; j < nq1; j++)
2111 for (
int i =0; i < nq0; ++i)
2113 idmap[j*nq0+i] = nq0*nq1-1-j*nq0 -i;
2120 for (
int i =0; i < nq0; ++i)
2122 for (
int j = 0; j < nq1; ++j)
2124 idmap[i*nq1+j] = i + j*nq0;
2132 for (
int i =0; i < nq0; ++i)
2134 for (
int j = 0; j < nq1; ++j)
2136 idmap[i*nq1+j] = nq0-1-i + j*nq0;
2144 for (
int i =0; i < nq0; ++i)
2146 for (
int j = 0; j < nq1; ++j)
2148 idmap[i*nq1+j] = i+nq0*(nq1-1)-j*nq0;
2156 for (
int i =0; i < nq0; ++i)
2158 for (
int j = 0; j < nq1; ++j)
2160 idmap[i*nq1+j] = nq0*nq1-1-i-j*nq0;
2166 ASSERTL0(
false,
"Unknow orientation");
2171 void Expansion3D::v_NormVectorIProductWRTBase(
2175 NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
NekDouble GetConstFactor(const ConstFactorType &factor) const
#define ASSERTL0(condition, msg)
const ConstFactorMap & GetConstFactors() const
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
const VarCoeffMap & GetVarCoeffs() const
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
MatrixType GetMatrixType() const
void Gathr(int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
bool HasVarCoeff(const StdRegions::VarCoeffType &coeff) const
#define sign(a, b)
return the sign(b)*a
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
Principle Modified Functions .
boost::shared_ptr< DNekMat > DNekMatSharedPtr
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
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::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.
boost::shared_ptr< Expansion > ExpansionSharedPtr
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
void Zero(int n, T *x, const int incx)
Zero vector.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
#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.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
static ConstFactorMap NullConstFactorMap
boost::shared_ptr< Geometry3D > Geometry3DSharedPtr