45 namespace LocalRegions
48 StdExpansion(),
Expansion(pGeom), StdExpansion2D()
62 "Routine only set up for two-dimensions");
83 if (edgeExp->GetRightAdjacentElementExp())
85 if (edgeExp->GetRightAdjacentElementExp()->GetGeom2D()
86 ->GetGlobalID() ==
GetGeom2D()->GetGlobalID())
98 int nquad_e = min(EdgeExp->GetNumPoints(0),
99 int(normals[0].num_elements()));
101 int nEdgePts = EdgeExp->GetTotPoints();
103 Vmath::Vmul (nquad_e, normals[0], 1, Fx, 1, edgePhys, 1);
104 Vmath::Vvtvp(nquad_e, normals[1], 1, Fy, 1, edgePhys, 1,
113 else if (locExp->GetRightAdjacentElementEdge() != -1)
115 if (locExp->GetRightAdjacentElementExp()->GetGeom2D()->GetGlobalID()
149 if (edgeExp->GetRightAdjacentElementExp())
151 if (edgeExp->GetRightAdjacentElementExp()->GetGeom2D()
152 ->GetGlobalID() ==
GetGeom2D()->GetGlobalID())
165 StdExpansion::GetIndexMap(ikey);
168 int order_e = map->num_elements();
170 int n_coeffs = EdgeExp->GetNcoeffs();
173 if(n_coeffs!=order_e)
175 EdgeExp->FwdTrans(Fn, edgeCoeffs);
185 LibUtilities::BasisKey bkey_ortho(btype,EdgeExp->GetBasis(0)->GetNumModes(),EdgeExp->GetBasis(0)->GetPointsKey());
186 LibUtilities::BasisKey bkey(EdgeExp->GetBasis(0)->GetBasisType(),EdgeExp->GetBasis(0)->GetNumModes(),EdgeExp->GetBasis(0)->GetPointsKey());
190 for(i = order_e; i < n_coeffs; i++)
198 EdgeExp->MassMatrixOp(edgeCoeffs, edgeCoeffs, masskey);
202 EdgeExp->IProductWRTBase(Fn, edgeCoeffs);
213 if(EdgeExp->GetBasis(0)->GetBasisType() !=
217 for(i = 0; i < order_e; ++i)
219 outarray[(*map)[i].index] +=
220 (*map)[i].sign * edgeCoeffs[i];
225 int nCoeffs0, nCoeffs1;
239 nCoeffs1 =
m_base[1]->GetNumModes();
241 for(i = 0; i < order_e; ++i)
243 for(j = 0; j < nCoeffs1; j++)
245 outarray[(*map)[i].index + j*order_e] +=
246 mat_gauss->GetPtr()[j]*
247 (*map)[i].sign*edgeCoeffs[i];
254 nCoeffs0 =
m_base[0]->GetNumModes();
256 for(i = 0; i < order_e; ++i)
258 for(j = 0; j < nCoeffs0; j++)
260 outarray[(*map)[i].index - j] +=
261 mat_gauss->GetPtr()[order_e - 1 -j]*
262 (*map)[i].sign*edgeCoeffs[i];
269 nCoeffs1 =
m_base[1]->GetNumModes();
271 for(i = 0; i < order_e; ++i)
273 for(j = 0; j < nCoeffs1; j++)
275 outarray[(*map)[i].index - j*order_e] +=
276 mat_gauss->GetPtr()[order_e - 1 - j]*
277 (*map)[i].sign*edgeCoeffs[i];
284 nCoeffs0 =
m_base[0]->GetNumModes();
286 for(i = 0; i < order_e; ++i)
288 for(j = 0; j < nCoeffs0; j++)
290 outarray[(*map)[i].index + j] +=
291 mat_gauss->GetPtr()[j]*
292 (*map)[i].sign*edgeCoeffs[i];
298 ASSERTL0(
false,
"edge value (< 3) is out of range");
312 for(i = 0; i < nedges; ++i)
314 EdgeExp[i]->SetCoeffsToOrientation(
GetEorient(i),
316 e_tmp = inout + cnt);
337 for(e = 0; e < nedges; ++e)
339 order_e = EdgeExp[e]->GetNcoeffs();
340 nquad_e = EdgeExp[e]->GetNumPoints(0);
347 for(i = 0; i < order_e; ++i)
349 edgeCoeffs[i] = inarray[i+cnt];
353 EdgeExp[e]->BwdTrans(edgeCoeffs, edgePhys);
369 Vmath::Vmul(nquad_e, normals[dir], 1, edgePhys, 1, edgePhys, 1);
390 for(e = 0; e < nedges; ++e)
392 nquad_e = EdgeExp[e]->GetNumPoints(0);
398 EdgeExp[e]->BwdTrans(edgeCoeffs[e], edgePhys);
400 Vmath::Vmul(nquad_e, normals[dir], 1, edgePhys, 1, edgePhys, 1);
423 int order_e = EdgeExp->GetNcoeffs();
424 int nquad_e = EdgeExp->GetNumPoints(0);
434 StdRegions::VarCoeffMap::const_iterator x;
437 if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
441 edge, EdgeExp, x->second, work);
442 Vmath::Vmul(nquad_e, work, 1, edgePhys, 1, edgePhys, 1);
445 EdgeExp->IProductWRTBase(edgePhys, coeff);
448 for(i = 0; i < order_e; ++i)
450 outarray[map[i]] += sign[i]*coeff[i];
464 ASSERTL0(&inarray[0] != &outarray[0],
465 "Input and output arrays use the same memory");
467 int e, cnt, order_e, nedges =
GetNedges();
472 for(e = 0; e < nedges; ++e)
474 order_e = EdgeExp[e]->GetNcoeffs();
478 Vmath::Vcopy(order_e, tmp = inarray + cnt, 1, edgeCoeffs, 1);
479 EdgeExp[e]->BwdTrans(edgeCoeffs, edgePhys);
481 tau, e, EdgeExp, edgePhys, dirForcing, outarray);
498 int nquad_e = EdgeExp[edge]->GetNumPoints(0);
499 int order_e = EdgeExp[edge]->GetNcoeffs();
530 StdRegions::VarCoeffMap::const_iterator x;
532 if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
536 edge, EdgeExp[edge], x->second, work);
537 Vmath::Vmul(nquad_e, work, 1, edgePhys, 1, edgePhys, 1);
543 EdgeExp[edge]->IProductWRTBase(edgePhys, outcoeff);
545 for(i = 0; i < order_e; ++i)
547 outarray[emap[i]] += sign[i] * tau * outcoeff[i];
556 for(n = 0; n < coordim; ++n)
558 Vmath::Vmul(nquad_e, normals[n], 1, edgePhys, 1, inval, 1);
574 EdgeExp[edge]->IProductWRTBase(inval, outcoeff);
577 for(i = 0; i < ncoeffs; ++i)
580 for(j = 0; j < order_e; ++j)
582 tmpcoeff[i] += invMass(i,emap[j])*sign[j]*outcoeff[j];
586 if(varcoeffs.find(VarCoeff[n]) != varcoeffs.end())
590 Coeffs = Coeffs + Dmat*Tmpcoeff;
596 Coeffs = Coeffs + Dmat*Tmpcoeff;
622 for (
unsigned int i = 0; i < EdgeExp->GetNcoeffs(); ++i)
624 edgetmp[i] = tmp[emap[i]];
628 EdgeExp->BwdTrans(edgetmp, outarray);
649 "HybridDGHelmholtz matrix not set up "
650 "for non boundary-interior expansions");
669 DNekMat LocMat(ncoeffs,ncoeffs);
679 for(i=0; i < coordim; ++i)
688 Mat = Mat + DmatL*invMass*
Transpose(DmatR);
693 Mat = Mat + Dmat*invMass*
Transpose(Dmat);
700 Mat = Mat + lambdaval*Mass;
703 for(i = 0; i < nedges; ++i)
707 order_e = EdgeExp->GetNcoeffs();
708 int nq = EdgeExp->GetNumPoints(0);
722 for(j = 0; j < order_e; ++j)
724 for(k = 0; k < order_e; ++k)
726 Mat(emap[j],emap[k]) = Mat(emap[j],emap[k]) + tau*sign[j]*sign[k]*
eMass(j,k);
760 for(i = 0; i < nedges; ++i)
768 for(j = 0; j < nbndry; ++j)
785 for(k = 0; k < ncoeffs; ++k)
826 for(i = 0; i < nedges; ++i)
848 ASSERTL0(
false,
"Direction not known");
855 for(j = 0; j < nbndry; ++j)
861 for(k = 0; k < ncoeffs; ++k)
863 Ulam[k] = lamToU(k,j);
880 Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
888 int order_e, nquad_e;
929 for(i = 0; i < nedges; ++i)
935 for(i = 0; i < nbndry; ++i)
943 for(e = 0; e < nedges; ++e)
945 order_e = EdgeExp[e]->GetNcoeffs();
946 nquad_e = EdgeExp[e]->GetNumPoints(0);
961 StdRegions::VarCoeffMap::const_iterator x;
966 for(j = 0; j < order_e; ++j)
968 edgeCoeffs[j] = sign[j]*(*LamToQ[0])(emap[j],i);
971 EdgeExp[e]->BwdTrans(edgeCoeffs, edgePhys);
980 Vmath::Vmul(nquad_e, normals[0], 1, edgePhys, 1, work, 1);
983 for(j = 0; j < order_e; ++j)
985 edgeCoeffs[j] = sign[j]*(*LamToQ[1])(emap[j],i);
988 EdgeExp[e]->BwdTrans(edgeCoeffs, edgePhys);
1004 for(j = 0; j < order_e; ++j)
1006 edgeCoeffs[j] = sign[j]*(*LamToQ[2])(emap[j],i);
1009 EdgeExp[e]->BwdTrans(edgeCoeffs, edgePhys);
1029 for(j = 0; j < order_e; ++j)
1031 edgeCoeffs[j] = sign[j]*LamToU(emap[j],i) - lam[cnt+j];
1034 EdgeExp[e]->BwdTrans(edgeCoeffs, edgePhys);
1037 if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
1040 Vmath::Vmul(nquad_e,varcoeff_work,1,edgePhys,1,edgePhys,1);
1046 EdgeExp[e]->IProductWRTBase(work, edgeCoeffs);
1048 EdgeExp[e]->SetCoeffsToOrientation(edgeCoeffs, edgedir);
1050 for(j = 0; j < order_e; ++j)
1052 BndMat(cnt+j,i) = edgeCoeffs[j];
1079 &(lmat->GetPtr())[0],1);
1085 ASSERTL0(
false,
"This matrix type cannot be generated from this class");
1123 Out_d = InvMass*Coeffs;
1136 "Not set up for non boundary-interior expansions");
1137 ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
1138 "Assuming that input matrix was square");
1142 int order_e = edgeExp->GetNcoeffs();
1151 DNekScalMat &edgemat = *edgeExp->GetLocMatrix(mkey);
1165 int rows = inoutmat->GetRows();
1180 for(i = 0; i < order_e; ++i)
1182 for(j = 0; j < nbndry; ++j)
1184 if(map[i] == bmap[j])
1190 ASSERTL1(j != nbndry,
"Did not find number in map");
1200 for(i = 0; i < edge; ++i)
1205 for(i = 0; i < order_e; ++i)
1212 switch(edgeExp->GetBasis(0)->GetBasisType())
1215 reverse( map.get() , map.get()+order_e);
1218 reverse( map.get() , map.get()+order_e);
1222 swap(map[0],map[1]);
1223 for(i = 3; i < order_e; i+=2)
1230 ASSERTL0(
false,
"Edge boundary type not valid for this method");
1236 ASSERTL0(
false,
"Could not identify matrix type from dimension");
1239 for(i = 0; i < order_e; ++i)
1242 for(j = 0; j < order_e; ++j)
1245 (*inoutmat)(id1,id2) += edgemat(i,j)*sign[i]*sign[j];
1261 "Not set up for non boundary-interior expansions");
1264 int order_e = edgeExp->GetNcoeffs();
1273 DNekScalMat &edgemat = *edgeExp->GetLocMatrix(mkey);
1279 for (i = 0; i < order_e; ++i)
1281 vEdgeCoeffs[i] = coeffs[map[i]]*sign[i];
1285 vEdgeCoeffs = edgemat * vEdgeCoeffs;
1287 for (i = 0; i < order_e; ++i)
1289 coeffs[map[i]] = vEdgeCoeffs[i]*sign[i];
1299 int nVerts, vid1, vid2, vMap1, vMap2;
1306 nVerts, nVerts, 0.0, storage);
1307 DNekMat &VertexMat = (*m_vertexmatrix);
1309 for (vid1 = 0; vid1 < nVerts; ++vid1)
1313 for (vid2 = 0; vid2 < nVerts; ++vid2)
1316 VertexValue = (*r_bnd)(vMap1, vMap2);
1317 VertexMat.SetValue(vid1, vid2, VertexValue);
1321 return m_vertexmatrix;
1336 map<int, int> invmap;
1337 for (j = 0; j < nBndCoeffs; ++j)
1339 invmap[bmap[j]] = j;
1355 for (n = 0; n < nEdgeCoeffs; ++n)
1357 edgemaparray[n] = invmap[maparray[n]];
1360 return edgemaparray;
1370 std::map<int, StdRegions::NormalVector>::const_iterator x;
1373 "Edge normal not computed.");
1404 if (idmap.num_elements() != nq0)
1412 for (
int i = 0; i < nq0; ++i)
1420 for (
int i = 0; i < nq0; ++i)
1427 ASSERTL0(
false,
"Unknown orientation");
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
NekDouble GetConstFactor(const ConstFactorType &factor) const
#define ASSERTL0(condition, msg)
const NormalVector & GetEdgeNormal(const int edge) const
const StdRegions::NormalVector & v_GetEdgeNormal(const int edge) const
const ConstFactorMap & GetConstFactors() const
const VarCoeffMap & GetVarCoeffs() const
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
MatrixType GetMatrixType() const
const VarCoeffMap GetVarCoeffAsMap(const VarCoeffType &coeff) const
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
bool HasVarCoeff(const StdRegions::VarCoeffType &coeff) const
#define sign(a, b)
return the sign(b)*a
void GetPhysEdgeVarCoeffsFromElement(const int edge, ExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &varcoeff, Array< OneD, NekDouble > &outarray)
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &edgeCoeffs, Array< OneD, NekDouble > &outarray)
void GetEdgeInteriorMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
void InterpCoeff1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
this function calculates the inner product of a given function f with the different modes of the expa...
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
const StdRegions::NormalVector & v_GetSurfaceNormal(const int id) const
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
std::map< int, bool > m_negatedNormals
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 .
std::map< int, StdRegions::NormalVector > m_edgeNormals
Lagrange Polynomials using the Gauss points .
StdRegions::Orientation GetEorient(int edge)
void SetTraceToGeomOrientation(Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, NekDouble > &inout)
virtual void v_AddRobinEdgeContribution(const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, Array< OneD, NekDouble > &coeffs)
std::map< ConstFactorType, NekDouble > ConstFactorMap
virtual DNekMatSharedPtr v_BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
virtual void v_AddRobinMassMatrix(const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
boost::shared_ptr< DNekMat > DNekMatSharedPtr
void AddEdgeBoundaryInt(const int edge, ExpansionSharedPtr &EdgeExp, Array< OneD, NekDouble > &edgePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
int NumBndryCoeffs(void) const
virtual void v_NegateEdgeNormal(const int edge)
bool IsBoundaryInteriorExpansion()
std::vector< bool > m_requireNeg
SpatialDomains::Geometry2DSharedPtr GetGeom2D() const
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Expansion1DSharedPtr GetEdgeExp(int edge, bool SetUpNormal=true)
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
virtual void v_AddEdgeNormBoundaryInt(const int edge, const ExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
void Neg(int n, T *x, const int incx)
Negate x = -x.
boost::shared_ptr< Expansion > ExpansionSharedPtr
void AddHDGHelmholtzEdgeTerms(const NekDouble tau, const int edge, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, NekDouble > &edgePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
Expansion2D(SpatialDomains::Geometry2DSharedPtr pGeom)
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
virtual bool v_EdgeNormalNegated(const int edge)
int GetNverts() const
This function returns the number of vertices of the expansion domain.
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
void AddHDGHelmholtzTraceTerms(const NekDouble tau, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
void GetEdgeToElementMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int P=-1)
virtual void v_DGDeriv(const int dir, const Array< OneD, const NekDouble > &incoeffs, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &edgeCoeffs, Array< OneD, NekDouble > &out_d)
std::vector< Expansion1DWeakPtr > m_edgeExp
virtual StdRegions::Orientation v_GetEorient(int edge)
virtual void v_SetUpPhysNormals(const int edge)
int NumDGBndryCoeffs(void) const
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
LibUtilities::NekManager< StdMatrixKey, DNekMat, StdMatrixKey::opLess > m_stdMatrixManager
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...
Array< OneD, LibUtilities::BasisSharedPtr > m_base
boost::shared_ptr< Expansion1D > Expansion1DSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void AddEdgeNormBoundaryInt(const int edge, const boost::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
int GetNedges() const
This function returns the number of edges of the expansion domain.
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Describes the specification for a Basis.
Array< OneD, unsigned int > v_GetEdgeInverseBoundaryMap(int eid)
void ReOrientEdgePhysMap(const int nvert, const StdRegions::Orientation orient, const int nq0, Array< OneD, int > &idmap)
void ComputeEdgeNormal(const int edge)
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
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Forward transformation from physical space to coefficient space...