35 #include <boost/core/ignore_unused.hpp> 44 namespace LocalRegions
46 void Expansion1D::v_NegateVertexNormal(
const int vertex)
48 m_negatedNormals[vertex] =
true;
49 for (
int i = 0; i < GetCoordim(); ++i)
51 Vmath::Neg(m_vertexNormals[vertex][i].num_elements(),
52 m_vertexNormals[vertex][i], 1);
56 bool Expansion1D::v_VertexNormalNegated(
const int vertex)
58 return m_negatedNormals[vertex];
69 ASSERTL1(IsBoundaryInteriorExpansion(),
70 "HybridDGHelmholtz matrix not set up " 71 "for non boundary-interior expansions");
75 int ncoeffs = GetNcoeffs();
77 int coordim = GetCoordim();
83 DNekMat LocMat(ncoeffs,ncoeffs);
90 for(i=0; i < coordim; ++i)
99 Mat = Mat + lambdaval*Mass;
102 GetBoundaryMap(bmap);
105 for(i = 0; i < 2; ++i)
107 Mat(bmap[i],bmap[i]) = Mat(bmap[i],bmap[i]) + tau;
114 int nbndry = NumDGBndryCoeffs();
115 int ncoeffs = GetNcoeffs();
137 for(j = 0; j < nbndry; ++j)
148 for(k = 0; k < ncoeffs; ++k)
162 int nbndry = NumDGBndryCoeffs();
163 int ncoeffs = GetNcoeffs();
203 ASSERTL0(
false,
"Direction not known");
210 for(j = 0; j < nbndry; ++j)
216 for(k = 0; k < ncoeffs; ++k)
218 Ulam[k] = lamToU(k,j);
227 AddNormTraceInt(dir,lambda,f);
233 Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
240 int nbndry = NumBndryCoeffs();
248 GetBoundaryMap(bmap);
260 lam[0] = 1.0; lam[1] = 0.0;
261 for(j = 0; j < nbndry; ++j)
266 lam[0] = 0.0; lam[1] = 1.0;
267 for(j = 0; j < nbndry; ++j)
274 ASSERTL0(
false,
"This matrix type cannot be generated from this class");
281 void Expansion1D::AddNormTraceInt(
const int dir,
285 boost::ignore_unused(dir);
288 int nbndry = NumBndryCoeffs();
289 int nquad = GetNumPoints(0);
293 GetBoundaryMap(vmap);
297 for(k = 0; k < nbndry; ++k)
299 outarray[vmap[k]] += (Basis[(vmap[k]+1)*nquad-1]*Basis[(vmap[k]+1)*nquad-1] - Basis[vmap[k]*nquad]*Basis[vmap[k]*nquad])*inarray[vmap[k]];
303 void Expansion1D::AddHDGHelmholtzTraceTerms(
const NekDouble tau,
307 int nbndry = NumBndryCoeffs();
308 int nquad = GetNumPoints(0);
309 int ncoeffs = GetNcoeffs();
310 int coordim = GetCoordim();
313 ASSERTL0(&inarray[0] != &outarray[0],
"Input and output arrays use the same memory");
319 GetBoundaryMap(vmap);
322 for(i = 0; i < nbndry; ++i)
324 outarray[vmap[i]] += tau*Basis[(vmap[i]+1)*nquad-1]*Basis[(vmap[i]+1)*nquad-1]*inarray[vmap[i]];
325 outarray[vmap[i]] += tau*Basis[vmap[i]*nquad]*Basis[vmap[i]*nquad]*inarray[vmap[i]];
340 for(n = 0; n < coordim; ++n)
343 for(i = 0; i < ncoeffs; ++i)
346 tmpcoeff[i] -= invMass(i,vmap[0])*Basis[vmap[0]*nquad]*Basis[vmap[0]*nquad]*inarray[vmap[0]];
349 tmpcoeff[i] += invMass(i,vmap[1])*Basis[(vmap[1]+1)*nquad-1]*Basis[(vmap[1]+1)*nquad-1]*inarray[vmap[1]];
354 Coeffs = Coeffs + Dmat*Tmpcoeff;
360 ASSERTL0(IsBoundaryInteriorExpansion(),
"Robin boundary conditions are only implemented for boundary-interior expanisons");
361 ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
362 "Assuming that input matrix was square");
365 int map = GetVertexMap(vert);
375 int rows = inoutmat->GetRows();
377 if (rows == GetNcoeffs())
381 else if(rows == NumBndryCoeffs())
385 GetBoundaryMap(bmap);
387 for(i = 0; i < 2; ++i)
395 ASSERTL1(i != 2,
"Did not find number in map");
399 (*inoutmat)(map,map) += primCoeffs[0];
413 ASSERTL1(IsBoundaryInteriorExpansion(),
414 "Not set up for non boundary-interior expansions");
416 int map = GetVertexMap(vert);
418 coeffs[map] = primCoeffs[0];
425 &normals = GetLeftAdjacentElementExp()->
426 GetEdgeNormal(GetLeftAdjacentElementEdge());
428 int nq = m_base[0]->GetNumPoints();
430 Vmath::Vmul (nq, &vec[0][0], 1, &normals[0][0], 1, &Fn[0], 1);
431 Vmath::Vvtvp(nq, &vec[1][0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
#define ASSERTL0(condition, msg)
Represents a basis of a given type.
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
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::map< ConstFactorType, NekDouble > ConstFactorMap
std::shared_ptr< DNekMat > DNekMatSharedPtr
MatrixType GetMatrixType() const
const Array< OneD, const NekDouble > & GetBdata() const
Return basis definition array m_bdata.
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
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.