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())
432 ASSERTL0(
false,
"This type of FwdTrans is not defined"
433 "for this expansion type");
436 fill(outarray.get(), outarray.get()+
m_ncoeffs, 0.0 );
443 inarray[
m_base[0]->GetNumPoints()-1];
466 Blas::Dgemv(
'N',nInteriorDofs,nInteriorDofs,
468 &((matsys->GetOwnedMatrix())->GetPtr())[0],
469 nInteriorDofs,tmp1.get()+offset,1,0.0,
470 outarray.get()+offset,1);
542 int nquad0 =
m_base[0]->GetNumPoints();
556 StdSegExp::v_IProductWRTBase(base,tmp,outarray,coll_check);
565 int nquad =
m_base[0]->GetNumPoints();
581 Vmath::Smul(nquad, gmat[0][0], inarray, 1, tmp1, 1);
593 Vmath::Smul(nquad, gmat[1][0], inarray, 1, tmp1, 1);
606 Vmath::Smul(nquad, gmat[2][0], inarray, 1, tmp1, 1);
612 ASSERTL1(
false,
"input dir is out of range");
624 int nq =
m_base[0]->GetNumPoints();
633 Vmath::Vmul (nq, &Fx[0], 1, &normals[0][0], 1, &Fn[0], 1);
634 Vmath::Vvtvp(nq, &Fy[0], 1, &normals[1][0], 1, &Fn[0], 1, &Fn[0], 1);
654 return StdSegExp::v_PhysEvaluate(Lcoord,physvals);
664 m_geom->GetLocCoords(coord,Lcoord);
666 return StdSegExp::v_PhysEvaluate(Lcoord, physvals);
676 ASSERTL1(Lcoords[0] >= -1.0&& Lcoords[0] <= 1.0,
677 "Local coordinates are not in region [-1,1]");
680 for(i = 0; i <
m_geom->GetCoordim(); ++i)
682 coords[i] =
m_geom->GetCoord(i,Lcoords);
700 int nquad =
m_base[0]->GetNumPoints();
707 outarray = inarray[0];
710 outarray = inarray[nquad - 1];
725 outarray =
Blas::Ddot(nquad, mat_gauss->GetOwnedMatrix()
726 ->GetPtr().get(), 1, &inarray[0], 1);
750 if (&inarray[0] != &outarray[0])
764 return m_geom->GetPorient(point);
776 return m_geom->GetCoordim();
822 const std::vector<unsigned int > &nummodes,
823 const int mode_offset,
830 int fillorder = min((
int) nummodes[mode_offset],
m_ncoeffs);
841 nummodes[mode_offset],
844 p0,data,
m_base[0]->GetPointsKey(), coeffs);
852 nummodes[mode_offset],
855 p0,data,
m_base[0]->GetPointsKey(), coeffs);
860 "basis is either not set up or not hierarchicial");
872 int nqe =
m_base[0]->GetNumPoints();
879 for (i = 0; i < vCoordDim; ++i)
893 for(i = 0; i < vCoordDim; ++i)
899 for(i = 0; i < vCoordDim; ++i)
906 "point is out of range (point < 2)");
911 for (i =0 ; i < vCoordDim; ++i)
913 vert += normal[i][0]*normal[i][0];
915 vert = 1.0/sqrt(vert);
916 for (i = 0; i < vCoordDim; ++i)
918 Vmath::Smul(nqe, vert, normal[i], 1, normal[i], 1);
933 int nquad =
m_base[0]->GetNumPoints();
943 switch (
m_geom->GetCoordim())
953 &gmat[0][0],1,dPhysValuesdx.get(),1,
954 dPhysValuesdx.get(),1);
959 gmat[0][0], dPhysValuesdx.get(), 1);
967 PhysDeriv(physValues,dPhysValuesdx,dPhysValuesdy);
973 &gmat[0][0],1,dPhysValuesdx.get(),1,
974 dPhysValuesdx.get(),1);
976 &gmat[1][0],1,dPhysValuesdy.get(),1,
977 dPhysValuesdx.get(),1,
978 dPhysValuesdx.get(),1);
983 gmat[0][0], dPhysValuesdx.get(), 1);
985 gmat[1][0], dPhysValuesdy.get(), 1,
986 dPhysValuesdx.get(), 1);
996 dPhysValuesdy,dPhysValuesdz);
1002 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1003 dPhysValuesdx.get(),1);
1005 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1006 dPhysValuesdx.get(),1,
1007 dPhysValuesdx.get(),1);
1009 &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1010 dPhysValuesdx.get(),1,
1011 dPhysValuesdx.get(),1);
1015 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1017 gmat[1][0], dPhysValuesdy.get(), 1,
1018 dPhysValuesdx.get(), 1);
1020 gmat[2][0], dPhysValuesdz.get(), 1,
1021 dPhysValuesdx.get(), 1);
1026 ASSERTL0(
false,
"Wrong number of dimensions");
1039 int nquad =
m_base[0]->GetNumPoints();
1055 switch (
m_geom->GetCoordim())
1065 &gmat[0][0],1,dPhysValuesdx.get(),1,
1066 dPhysValuesdx.get(),1);
1070 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1078 PhysDeriv(physValues, dPhysValuesdx, dPhysValuesdy);
1084 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1085 dPhysValuesdx.get(), 1);
1087 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1088 dPhysValuesdx.get(), 1,
1089 dPhysValuesdx.get(), 1);
1093 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1095 gmat[1][0], dPhysValuesdy.get(), 1,
1096 dPhysValuesdx.get(), 1);
1106 dPhysValuesdy, dPhysValuesdz);
1112 &gmat[0][0], 1, dPhysValuesdx.get(), 1,
1113 dPhysValuesdx.get(), 1);
1115 &gmat[1][0], 1, dPhysValuesdy.get(), 1,
1116 dPhysValuesdx.get(), 1,
1117 dPhysValuesdx.get(), 1);
1119 &gmat[2][0], 1, dPhysValuesdz.get(), 1,
1120 dPhysValuesdx.get(), 1,
1121 dPhysValuesdx.get(), 1);
1125 Blas::Dscal(nquad, gmat[0][0], dPhysValuesdx.get(), 1);
1127 gmat[1][0], dPhysValuesdy.get(), 1,
1128 dPhysValuesdx.get(), 1);
1130 gmat[2][0], dPhysValuesdz.get(),
1131 1, dPhysValuesdx.get(), 1);
1136 ASSERTL0(
false,
"Wrong number of dimensions");
1141 Blas::Daxpy(
m_ncoeffs, lambda, wsp.get(), 1, outarray.get(), 1);
1173 return tmp->GetStdMatrix(mkey);
1185 "Geometric information is not set up");
1195 goto UseLocRegionsMatrix;
1200 goto UseStdRegionsMatrix;
1221 goto UseStdRegionsMatrix;
1233 goto UseLocRegionsMatrix;
1245 "Cannot call eWeakDeriv2 in a "
1246 "coordinate system which is not at "
1247 "least two-dimensional");
1252 "Cannot call eWeakDeriv2 in a "
1253 "coordinate system which is not "
1254 "three-dimensional");
1278 goto UseLocRegionsMatrix;
1282 int coordim =
m_geom->GetCoordim();
1284 for (
int i = 0; i < coordim; ++i)
1290 goto UseStdRegionsMatrix;
1306 int rows = LapMat.GetRows();
1307 int cols = LapMat.GetColumns();
1313 (*helm) = LapMat + factor*MassMat;
1357 coords[0] = (vertex == 0) ? -1.0 : 1.0;
1359 m_Ix =
m_base[0]->GetI(coords);
1365 UseLocRegionsMatrix:
1372 UseStdRegionsMatrix:
1403 returnval = StdSegExp::v_GenMatrix(mkey);
1418 "Geometric information is not set up");
1424 exp_size[0] = nbdry;
1440 goto UseLocRegionsMatrix;
1446 goto UseLocRegionsMatrix;
1451 factor = mat->Scale();
1452 goto UseStdRegionsMatrix;
1455 UseStdRegionsMatrix:
1463 returnval->SetBlock(0,0,Atmp =
1465 factor,Asubmat = mat->GetBlock(0,0)));
1466 returnval->SetBlock(0,1,Atmp =
1468 one,Asubmat = mat->GetBlock(0,1)));
1469 returnval->SetBlock(1,0,Atmp =
1471 factor,Asubmat = mat->GetBlock(1,0)));
1472 returnval->SetBlock(1,1,Atmp =
1474 invfactor,Asubmat = mat->GetBlock(1,1)));
1477 UseLocRegionsMatrix:
1497 for (i = 0; i < nbdry; ++i)
1499 for (j = 0; j < nbdry; ++j)
1501 (*A)(i,j) = mat(bmap[i],bmap[j]);
1504 for (j = 0; j < nint; ++j)
1506 (*B)(i,j) = mat(bmap[i],imap[j]);
1510 for (i = 0; i < nint; ++i)
1512 for (j = 0; j < nbdry; ++j)
1514 (*C)(i,j) = mat(imap[i],bmap[j]);
1517 for (j = 0; j < nint; ++j)
1519 (*D)(i,j) = mat(imap[i],imap[j]);
1528 (*A) = (*A) - (*B)*(*C);
1534 AllocateSharedPtr(factor,A));
1536 AllocateSharedPtr(one,B));
1538 AllocateSharedPtr(factor,C));
1540 AllocateSharedPtr(invfactor,D));
1566 ASSERTL1(&inarray[0] != &outarray[0],
1567 "inarray and outarray can not be the same");
1572 outarray[0] = inarray[1];
1573 outarray[1] = inarray[0];
1577 outarray[m] = sgn*inarray[m];
1585 outarray[m_ncoeffs-1-m] = inarray[m];
1589 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 .
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 .
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