43 namespace LocalRegions
59 StdExpansion(Ba.GetNumModes(), 1, Ba),
60 StdExpansion1D(Ba.GetNumModes(), Ba),
61 StdRegions::StdSegExp(Ba),
65 boost::bind(&
SegExp::CreateMatrix, this, _1),
66 std::string(
"SegExpMatrix")),
67 m_staticCondMatrixManager(
68 boost::bind(&
SegExp::CreateStaticCondMatrix, this, _1),
69 std::string(
"SegExpStaticCondMatrix"))
81 StdRegions::StdSegExp(S),
84 m_matrixManager(S.m_matrixManager),
85 m_staticCondMatrixManager(S.m_staticCondMatrixManager)
119 int nquad0 =
m_base[0]->GetNumPoints();
135 ival = StdSegExp::v_Integral(tmp);
170 int nquad0 =
m_base[0]->GetNumPoints();
179 if(out_d0.num_elements())
185 if(out_d1.num_elements())
191 if(out_d2.num_elements())
199 if(out_d0.num_elements())
205 if(out_d1.num_elements())
211 if(out_d2.num_elements())
231 int nquad0 =
m_base[0]->GetNumPoints();
232 int coordim =
m_geom->GetCoordim();
271 int nquad0 =
m_base[0]->GetNumPoints();
274 int coordim =
m_geom->GetCoordim();
287 for(
int k=0; k<coordim; ++k)
294 for(
int i=0; i<nquad0; i++)
296 cout<<
"nx= "<<normals[0][i]<<
" ny="<<normals[1][i]<<endl;
299 "normal vectors do not exist: check if a"
300 "boundary region is defined as I ");
302 Vmath::Vmul(nquad0,normals[0],1,inarray_d0,1,out_dn_tmp,1);
303 Vmath::Vadd(nquad0,out_dn_tmp,1,out_dn,1,out_dn,1);
305 Vmath::Vmul(nquad0,normals[1],1,inarray_d1,1,out_dn_tmp,1);
306 Vmath::Vadd(nquad0,out_dn_tmp,1,out_dn,1,out_dn,1);
308 for(
int i=0; i<nquad0; i++)
310 cout<<
"deps/dx ="<<inarray_d0[i]<<
" deps/dy="<<inarray_d1[i]<<endl;
343 ASSERTL1(
false,
"input dir is out of range");
379 if (
m_base[0]->Collocation())
403 if(
m_base[0]->Collocation())
433 ASSERTL0(
false,
"This type of FwdTrans is not defined"
434 "for this expansion type");
437 fill(outarray.get(), outarray.get()+
m_ncoeffs, 0.0 );
444 inarray[
m_base[0]->GetNumPoints()-1];
467 Blas::Dgemv(
'N',nInteriorDofs,nInteriorDofs,
469 &((matsys->GetOwnedMatrix())->GetPtr())[0],
470 nInteriorDofs,tmp1.get()+offset,1,0.0,
471 outarray.get()+offset,1);
543 int nquad0 =
m_base[0]->GetNumPoints();
557 StdSegExp::v_IProductWRTBase(base,tmp,outarray,coll_check);
566 int nquad =
m_base[0]->GetNumPoints();
582 Vmath::Smul(nquad, gmat[0][0], inarray, 1, tmp1, 1);
594 Vmath::Smul(nquad, gmat[1][0], inarray, 1, tmp1, 1);
607 Vmath::Smul(nquad, gmat[2][0], inarray, 1, tmp1, 1);
613 ASSERTL1(
false,
"input dir is out of range");
625 int nq =
m_base[0]->GetNumPoints();
634 Vmath::Vmul (nq, &Fx[0], 1, &normals[0][0], 1, &Fn[0], 1);
635 Vmath::Vvtvp(nq, &Fy[0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
662 return StdSegExp::v_PhysEvaluate(Lcoord,physvals);
672 m_geom->GetLocCoords(coord,Lcoord);
674 return StdSegExp::v_PhysEvaluate(Lcoord, physvals);
684 ASSERTL1(Lcoords[0] >= -1.0&& Lcoords[0] <= 1.0,
685 "Local coordinates are not in region [-1,1]");
688 for(i = 0; i <
m_geom->GetCoordim(); ++i)
690 coords[i] =
m_geom->GetCoord(i,Lcoords);
708 int nquad =
m_base[0]->GetNumPoints();
715 outarray = inarray[0];
718 outarray = inarray[nquad - 1];
733 outarray =
Blas::Ddot(nquad, mat_gauss->GetOwnedMatrix()
734 ->GetPtr().get(), 1, &inarray[0], 1);
748 outarray[0] = result;
770 if (&inarray[0] != &outarray[0])
784 return m_geom->GetPorient(point);
796 return m_geom->GetCoordim();
842 const std::vector<unsigned int > &nummodes,
843 const int mode_offset,
850 int fillorder = min((
int) nummodes[mode_offset],
m_ncoeffs);
861 nummodes[mode_offset],
864 p0,data,
m_base[0]->GetPointsKey(), coeffs);
872 nummodes[mode_offset],
875 p0,data,
m_base[0]->GetPointsKey(), coeffs);
880 "basis is either not set up or not hierarchicial");
899 for (i = 0; i < vCoordDim; ++i)
913 for(i = 0; i < vCoordDim; ++i)
919 for(i = 0; i < vCoordDim; ++i)
926 "point is out of range (point < 2)");
931 for (i =0 ; i < vCoordDim; ++i)
933 vert += normal[i][0]*normal[i][0];
935 vert = 1.0/sqrt(vert);
936 for (i = 0; i < vCoordDim; ++i)
938 Vmath::Smul(nqe, vert, normal[i], 1, normal[i], 1);
953 int nquad =
m_base[0]->GetNumPoints();
963 switch (
m_geom->GetCoordim())
973 &gmat[0][0],1,dPhysValuesdx.get(),1,
974 dPhysValuesdx.get(),1);
979 gmat[0][0], dPhysValuesdx.get(), 1);
987 PhysDeriv(physValues,dPhysValuesdx,dPhysValuesdy);
993 &gmat[0][0],1,dPhysValuesdx.get(),1,
994 dPhysValuesdx.get(),1);
996 &gmat[1][0],1,dPhysValuesdy.get(),1,
997 dPhysValuesdx.get(),1,
998 dPhysValuesdx.get(),1);
1003 gmat[0][0], dPhysValuesdx.get(), 1);
1005 gmat[1][0], dPhysValuesdy.get(), 1,
1006 dPhysValuesdx.get(), 1);
1016 dPhysValuesdy,dPhysValuesdz);
1022 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1023 dPhysValuesdx.get(),1);
1025 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1026 dPhysValuesdx.get(),1,
1027 dPhysValuesdx.get(),1);
1029 &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1030 dPhysValuesdx.get(),1,
1031 dPhysValuesdx.get(),1);
1035 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1037 gmat[1][0], dPhysValuesdy.get(), 1,
1038 dPhysValuesdx.get(), 1);
1040 gmat[2][0], dPhysValuesdz.get(), 1,
1041 dPhysValuesdx.get(), 1);
1046 ASSERTL0(
false,
"Wrong number of dimensions");
1059 int nquad =
m_base[0]->GetNumPoints();
1075 switch (
m_geom->GetCoordim())
1085 &gmat[0][0],1,dPhysValuesdx.get(),1,
1086 dPhysValuesdx.get(),1);
1090 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1098 PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy);
1104 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1105 dPhysValuesdx.get(), 1);
1107 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1108 dPhysValuesdx.get(), 1,
1109 dPhysValuesdx.get(), 1);
1113 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1115 gmat[1][0], dPhysValuesdy.get(), 1,
1116 dPhysValuesdx.get(), 1);
1126 dPhysValuesdy, dPhysValuesdz);
1132 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1133 dPhysValuesdx.get(), 1);
1135 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1136 dPhysValuesdx.get(), 1,
1137 dPhysValuesdx.get(), 1);
1139 &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1140 dPhysValuesdx.get(), 1,
1141 dPhysValuesdx.get(), 1);
1145 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1147 gmat[1][0], dPhysValuesdy.get(), 1,
1148 dPhysValuesdx.get(), 1);
1150 gmat[2][0], dPhysValuesdz.get(),
1151 1, dPhysValuesdx.get(), 1);
1156 ASSERTL0(
false,
"Wrong number of dimensions");
1161 Blas::Daxpy(
m_ncoeffs, lambda, wsp.get(), 1, outarray.get(), 1);
1193 return tmp->GetStdMatrix(mkey);
1205 "Geometric information is not set up");
1215 goto UseLocRegionsMatrix;
1220 goto UseStdRegionsMatrix;
1241 goto UseStdRegionsMatrix;
1253 goto UseLocRegionsMatrix;
1265 "Cannot call eWeakDeriv2 in a "
1266 "coordinate system which is not at "
1267 "least two-dimensional");
1272 "Cannot call eWeakDeriv2 in a "
1273 "coordinate system which is not "
1274 "three-dimensional");
1298 goto UseLocRegionsMatrix;
1302 int coordim =
m_geom->GetCoordim();
1304 for (
int i = 0; i < coordim; ++i)
1310 goto UseStdRegionsMatrix;
1326 int rows = LapMat.GetRows();
1327 int cols = LapMat.GetColumns();
1333 (*helm) = LapMat + factor*MassMat;
1377 coords[0] = (vertex == 0) ? -1.0 : 1.0;
1379 m_Ix =
m_base[0]->GetI(coords);
1385 UseLocRegionsMatrix:
1392 UseStdRegionsMatrix:
1423 returnval = StdSegExp::v_GenMatrix(mkey);
1438 "Geometric information is not set up");
1444 exp_size[0] = nbdry;
1460 goto UseLocRegionsMatrix;
1466 goto UseLocRegionsMatrix;
1471 factor = mat->Scale();
1472 goto UseStdRegionsMatrix;
1475 UseStdRegionsMatrix:
1483 returnval->SetBlock(0,0,Atmp =
1485 factor,Asubmat = mat->GetBlock(0,0)));
1486 returnval->SetBlock(0,1,Atmp =
1488 one,Asubmat = mat->GetBlock(0,1)));
1489 returnval->SetBlock(1,0,Atmp =
1491 factor,Asubmat = mat->GetBlock(1,0)));
1492 returnval->SetBlock(1,1,Atmp =
1494 invfactor,Asubmat = mat->GetBlock(1,1)));
1497 UseLocRegionsMatrix:
1517 for (i = 0; i < nbdry; ++i)
1519 for (j = 0; j < nbdry; ++j)
1521 (*A)(i,j) = mat(bmap[i],bmap[j]);
1524 for (j = 0; j < nint; ++j)
1526 (*B)(i,j) = mat(bmap[i],imap[j]);
1530 for (i = 0; i < nint; ++i)
1532 for (j = 0; j < nbdry; ++j)
1534 (*C)(i,j) = mat(imap[i],bmap[j]);
1537 for (j = 0; j < nint; ++j)
1539 (*D)(i,j) = mat(imap[i],imap[j]);
1548 (*A) = (*A) - (*B)*(*C);
1554 AllocateSharedPtr(factor,A));
1556 AllocateSharedPtr(one,B));
1558 AllocateSharedPtr(factor,C));
1560 AllocateSharedPtr(invfactor,D));
1586 ASSERTL1(&inarray[0] != &outarray[0],
1587 "inarray and outarray can not be the same");
1592 outarray[0] = inarray[1];
1593 outarray[1] = inarray[0];
1597 outarray[m] = sgn*inarray[m];
1605 outarray[m_ncoeffs-1-m] = inarray[m];
1609 ASSERTL0(
false,
"This basis is not allowed in this method");
const LibUtilities::PointsKeyVector GetPointsKeys() const
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
NekDouble GetConstFactor(const ConstFactorType &factor) const
DNekMatSharedPtr GenMatrix(const StdMatrixKey &mkey)
#define ASSERTL0(condition, msg)
const NormalVector & GetEdgeNormal(const int edge) const
const LibUtilities::BasisSharedPtr & GetBasis(int dir) const
This function gets the shared point to basis in the dir direction.
const ConstFactorMap & GetConstFactors() const
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
virtual const LibUtilities::BasisSharedPtr & v_GetBasis(int dir) const
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords)
const VarCoeffMap & GetVarCoeffs() const
std::vector< PointsKey > PointsKeyVector
MatrixType GetMatrixType() const
void v_DropLocStaticCondMatrix(const MatrixKey &mkey)
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
static Array< OneD, NekDouble > NullNekDouble1DArray
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
std::map< int, NormalVector > m_vertexNormals
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
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.
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
virtual void v_PhysDeriv_n(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn)
Evaluate the derivative normal to a line: . The derivative is calculated performing the product ...
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 .
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
virtual void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int mode_offset, NekDouble *coeffs)
Unpack data from input file assuming it comes from.
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
Lagrange Polynomials using the Gauss points .
virtual void v_GetTracePhysVals(const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
LibUtilities::ShapeType GetShapeType() const
std::map< ConstFactorType, NekDouble > ConstFactorMap
virtual int v_GetNcoeffs(void) const
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
SpatialDomains::GeometrySharedPtr m_geom
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Inner product of inarray over region with respect to the expansion basis (this)->_Base[0] and return ...
virtual void v_PhysDeriv_s(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds)
Evaluate the derivative along a line: . The derivative is calculated performing the product ...
boost::shared_ptr< StdSegExp > StdSegExpSharedPtr
boost::shared_ptr< DNekMat > DNekMatSharedPtr
virtual int v_GetNumPoints(const int dir) const
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
1D Gauss-Gauss-Legendre quadrature points
Expansion2DSharedPtr GetLeftAdjacentElementExp() const
int NumBndryCoeffs(void) const
DNekBlkMatSharedPtr GetStdStaticCondMatrix(const StdMatrixKey &mkey)
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
void ReverseCoeffsAndSign(const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Reverse the coefficients in a boundary interior expansion this routine is of use when we need the seg...
virtual SpatialDomains::GeomType v_MetricInfoType()
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
virtual StdRegions::Orientation v_GetPorient(int point)
Principle Modified Functions .
virtual void v_ComputeVertexNormal(const int vertex)
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3)
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
void GetInteriorMap(Array< OneD, unsigned int > &outarray)
Defines a specification for a set of points.
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals(void)
DNekScalBlkMatSharedPtr CreateStaticCondMatrix(const MatrixKey &mkey)
virtual void v_FwdTrans_BndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
T Ddot(int n, const Array< OneD, const T > &w, const int incw, const Array< OneD, const T > &x, const int incx, const Array< OneD, const int > &y, const int incy)
DNekScalMatSharedPtr CreateMatrix(const MatrixKey &mkey)
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey)
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray)
boost::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3)
SpatialDomains::GeometrySharedPtr GetGeom() const
virtual void v_SetCoeffsToOrientation(Array< OneD, NekDouble > &coeffs, StdRegions::Orientation dir)
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
virtual int v_NumDGBndryCoeffs() const
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Evaluate the derivative at the physical quadrature points given by inarray and return in outarray...
void MultiplyByElmtInvMass(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Geometry is straight-sided with constant geometric factors.
void Interp1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
this function interpolates a 1D function evaluated at the quadrature points of the basis fbasis0 to ...
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Evaluate the derivative at the physical quadrature points given by inarray and return in outarray...
boost::shared_ptr< Geometry1D > Geometry1DSharedPtr
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space...
int GetLeftAdjacentElementEdge() const
virtual int v_GetCoordim()
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray)
Integrate the physical point list inarray over region and return the value.
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey)
GeomType
Indicates the type of element geometry.
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayofArray
boost::shared_ptr< Basis > BasisSharedPtr
void Zero(int n, T *x, const int incx)
Zero vector.
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
LibUtilities::PointsType GetPointsType(const int dir) const
This function returns the type of quadrature points used in the dir direction.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Array< OneD, LibUtilities::BasisSharedPtr > m_base
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Geometry is curved or has non-constant factors.
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Describes the specification for a Basis.
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals)
virtual int v_NumBndryCoeffs() const
1D Gauss-Lobatto-Legendre quadrature points
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 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.
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager