35 #include <boost/core/ignore_unused.hpp>
45 namespace LocalRegions
49 std::bind(&
Expansion::CreateIndexMap, this, std::placeholders::_1),
50 std::string(
"ExpansionIndexMap")),
51 m_geom(pGeom), m_metricinfo(m_geom->GetGeomFactors()),
52 m_elementTraceLeft(-1), m_elementTraceRight(-1)
62 string type =
"regular";
69 err << nDim <<
"D " << type <<
" Jacobian not positive "
70 <<
"(element ID = " <<
m_geom->GetGlobalID() <<
") "
71 <<
"(first vertex ID = " <<
m_geom->GetVid(0) <<
")";
79 : StdExpansion(pSrc), m_indexMapManager(pSrc.m_indexMapManager),
80 m_geom(pSrc.m_geom), m_metricinfo(pSrc.m_metricinfo)
106 const NekDouble *data,
const std::vector<unsigned int> &nummodes,
107 const int nmodes_offset,
NekDouble *coeffs,
108 std::vector<LibUtilities::BasisType> &fromType)
114 const int edge,
const std::shared_ptr<Expansion> &EdgeExp,
122 const int edge,
const std::shared_ptr<Expansion> &EdgeExp,
129 const int face,
const std::shared_ptr<Expansion> &FaceExp,
141 v_DGDeriv(dir, inarray, EdgeExp, coeffs, outarray);
207 ASSERTL0(
false,
"Boundary Index Map not implemented yet.");
213 ASSERTL0(
false,
"Boundary Index Map not implemented yet.");
219 ASSERTL0(
false,
"Boundary Index Map not implemented yet.");
224 ASSERTL0(
false,
"Vertex Index Map not implemented yet.");
229 ASSERTL0(
false,
"The Index Map you are requiring "
230 "is not between the possible options.");
236 for (
int i = 0; i < map.size(); i++)
238 (*returnval)[i].index = map[i];
239 (*returnval)[i].sign =
sign[i];
252 std::map<int, NormalVector>::const_iterator x;
267 boost::ignore_unused(mkey);
277 "Geometric information is not set up");
281 unsigned int nint = (
unsigned int)(
m_ncoeffs - nbdry);
282 unsigned int exp_size[] = {nbdry, nint};
283 unsigned int nblks = 2;
285 nblks, nblks, exp_size, exp_size);
298 goto UseLocRegionsMatrix;
303 goto UseStdRegionsMatrix;
309 goto UseLocRegionsMatrix;
322 factor, Asubmat = mat->GetBlock(0, 0)));
326 one, Asubmat = mat->GetBlock(0, 1)));
330 factor, Asubmat = mat->GetBlock(1, 0)));
334 invfactor, Asubmat = mat->GetBlock(1, 1)));
357 for (i = 0; i < nbdry; ++i)
359 for (j = 0; j < nbdry; ++j)
361 (*A)(i, j) = mat(bmap[i], bmap[j]);
364 for (j = 0; j < nint; ++j)
366 (*B)(i, j) = mat(bmap[i], imap[j]);
370 for (i = 0; i < nint; ++i)
372 for (j = 0; j < nbdry; ++j)
374 (*C)(i, j) = mat(imap[i], bmap[j]);
377 for (j = 0; j < nint; ++j)
379 (*D)(i, j) = mat(imap[i], imap[j]);
388 (*A) = (*A) - (*B) * (*C);
480 for (
int i = 0; i < ntraces; ++i)
492 for (
int i = 0; i < ndir; ++i)
509 for (
int j = 0; j < ntraces; ++j)
512 for (
int k = 0; k < nTracePts; ++k)
514 for (
int d = 0; d < ndir; ++d)
516 (*DerivMat[d])(i, cnt + k) = Deriv[d][traceids[j][k]];
533 const int expDim =
m_base.size();
540 for (
int i = 0; i < expDim; ++i)
542 CBasis[i] =
m_geom->GetXmap()->GetBasis(i);
543 nqGeom *= CBasis[i]->GetNumPoints();
545 m_base[i]->GetBasisKey().SamePoints(CBasis[i]->GetBasisKey());
554 for (
int i = 0; i <
m_geom->GetCoordim(); ++i)
556 m_geom->GetXmap()->BwdTrans(
m_geom->GetCoeffs(i), tmp[i]);
561 for (
int i = 0; i <
m_geom->GetCoordim(); ++i)
564 m_geom->GetXmap()->BwdTrans(
m_geom->GetCoeffs(i), tmpGeom);
571 CBasis[0]->GetPointsKey(), &tmpGeom[0],
572 m_base[0]->GetPointsKey(), &tmp[i][0]);
578 CBasis[0]->GetPointsKey(), CBasis[1]->GetPointsKey(),
579 &tmpGeom[0],
m_base[0]->GetPointsKey(),
580 m_base[1]->GetPointsKey(), &tmp[i][0]);
586 CBasis[0]->GetPointsKey(), CBasis[1]->GetPointsKey(),
587 CBasis[2]->GetPointsKey(), &tmpGeom[0],
589 m_base[2]->GetPointsKey(), &tmp[i][0]);
601 int shapedim = dfdir.size();
603 int nqtot = direction.size() / coordim;
605 for (
int j = 0; j < shapedim; j++)
608 for (
int k = 0; k < coordim; k++)
613 &direction[k * nqtot], 1, &dfdir[j][0], 1,
619 &direction[k * nqtot], 1, &dfdir[j][0], 1,
632 int nquad0, nquad1, nquad2;
638 nquad0 =
m_base[0]->GetNumPoints();
639 nquad1 =
m_base[1]->GetNumPoints();
640 nqtot = nquad0 * nquad1;
645 nquad0 =
m_base[0]->GetNumPoints();
646 nquad1 =
m_base[1]->GetNumPoints();
647 nquad2 =
m_base[2]->GetNumPoints();
648 nqtot = nquad0 * nquad1 * nquad2;
667 for (
int k = 0; k < coordim; k++)
669 StdRegions::VarCoeffMap::const_iterator MFdir =
670 varcoeffs.find(MMFCoeffs[5 * dir + k]);
695 StdRegions::VarCoeffMap::const_iterator MFdir =
696 varcoeffs.find(MMFCoeffs[5 * dir + indxDiv]);
718 StdRegions::VarCoeffMap::const_iterator MFdir =
719 varcoeffs.find(MMFCoeffs[5 * dir + indxMag]);
728 boost::ignore_unused(r_bnd, matrixType);
736 boost::ignore_unused(r_bnd);
742 const NekDouble *data,
const std::vector<unsigned int> &nummodes,
743 const int nmodes_offset,
NekDouble *coeffs,
744 std::vector<LibUtilities::BasisType> &fromType)
746 boost::ignore_unused(data, nummodes, nmodes_offset, coeffs, fromType);
751 const int edge,
const std::shared_ptr<Expansion> &EdgeExp,
755 boost::ignore_unused(edge, EdgeExp, Fx, Fy, outarray);
760 const int edge,
const std::shared_ptr<Expansion> &EdgeExp,
763 boost::ignore_unused(edge, EdgeExp, Fn, outarray);
768 const int face,
const std::shared_ptr<Expansion> &FaceExp,
771 boost::ignore_unused(face, FaceExp, Fn, outarray);
781 boost::ignore_unused(dir, inarray, EdgeExp, coeffs, outarray);
788 boost::ignore_unused(vec);
790 "This function is only valid for "
791 "shape expansion in LocalRegions, not parant class");
800 boost::ignore_unused(factors, d0factors, d1factors);
802 "This function is only valid for "
803 "shape expansion in LocalRegions, not parant class");
808 boost::ignore_unused(trace);
816 boost::ignore_unused(dir, inarray, outarray);
823 boost::ignore_unused(trace, outarray);
825 "Method does not exist for this shape or library");
833 boost::ignore_unused(trace, TraceExp, inarray, outarray, orient);
835 "Method does not exist for this shape or library");
840 boost::ignore_unused(edge, outarray);
842 "Method does not exist for this shape or library");
849 boost::ignore_unused(orient, idmap, nq0, nq1);
851 "Method does not exist for this shape or library");
856 boost::ignore_unused(traceid, exp);
858 "Method does not exist for this shape or library");
863 boost::ignore_unused(
id);
864 ASSERTL0(
false,
"Cannot compute trace normal for this expansion.");
875 boost::ignore_unused(normal);
881 boost::ignore_unused(edge);
889 boost::ignore_unused(trace, primCoeffs, inoutmat);
897 boost::ignore_unused(traceid, primCoeffs, incoeffs, coeffs);
903 boost::ignore_unused(traceid, h,
p);
908 const int nbnd)
const
912 "m_elmtBndNormDirElmtLen normal not computed.");
920 boost::ignore_unused(dir, inarray, outarray);
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
#define sign(a, b)
return the sign(b)*a
std::map< int, NormalVector > m_traceNormals
std::map< int, Array< OneD, NekDouble > > m_elmtBndNormDirElmtLen
the element length in each element boundary(Vertex, edge or face) normal direction calculated based o...
virtual void v_SetPhysNormals(Array< OneD, const NekDouble > &normal)
SpatialDomains::GeometrySharedPtr GetGeom() const
virtual void v_TraceNormLen(const int traceid, NekDouble &h, NekDouble &p)
IndexMapValuesSharedPtr CreateIndexMap(const IndexMapKey &ikey)
SpatialDomains::GeometrySharedPtr m_geom
Array< OneD, NekDouble > v_GetMF(const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
void GetTracePhysMap(const int edge, Array< OneD, int > &outarray)
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
DNekMatSharedPtr BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
void ComputeGmatcdotMF(const Array< TwoD, const NekDouble > &df, const Array< OneD, const NekDouble > &direction, Array< OneD, Array< OneD, NekDouble >> &dfdir)
virtual void v_DivideByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_GenTraceExp(const int traceid, ExpansionSharedPtr &exp)
NekDouble VectorFlux(const Array< OneD, Array< OneD, NekDouble >> &vec)
void ComputeLaplacianMetric()
virtual void v_AddRobinTraceContribution(const int traceid, const Array< OneD, const NekDouble > &primCoeffs, const Array< OneD, NekDouble > &incoeffs, Array< OneD, NekDouble > &coeffs)
virtual void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
virtual void v_GetTraceQFactors(const int trace, Array< OneD, NekDouble > &outarray)
virtual void v_ComputeTraceNormal(const int id)
DNekScalBlkMatSharedPtr CreateStaticCondMatrix(const MatrixKey &mkey)
virtual void v_DGDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble >> &coeffs, Array< OneD, NekDouble > &outarray)
virtual DNekMatSharedPtr v_BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual DNekScalMatSharedPtr v_GetLocMatrix(const LocalRegions::MatrixKey &mkey)
virtual void v_AddFaceNormBoundaryInt(const int face, const std::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
void NormalTraceDerivFactors(Array< OneD, Array< OneD, NekDouble >> &factors, Array< OneD, Array< OneD, NekDouble >> &d0factors, Array< OneD, Array< OneD, NekDouble >> &d1factors)
Array< OneD, NekDouble > v_GetMFMag(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
virtual DNekMatSharedPtr v_BuildTransformationMatrix(const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
const Array< OneD, const NekDouble > & GetElmtBndNormDirElmtLen(const int nbnd) const
virtual void v_AddRobinMassMatrix(const int face, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
std::map< int, ExpansionWeakPtr > m_traceExp
Array< OneD, NekDouble > v_GetMFDiv(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
void ComputeQuadratureMetric()
void AddEdgeNormBoundaryInt(const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
virtual NekDouble v_VectorFlux(const Array< OneD, Array< OneD, NekDouble >> &vec)
void AddFaceNormBoundaryInt(const int face, const std::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
void DGDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble >> &coeffs, Array< OneD, NekDouble > &outarray)
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals(void)
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
virtual StdRegions::Orientation v_GetTraceOrient(int trace)
void StdDerivBaseOnTraceMat(Array< OneD, DNekMatSharedPtr > &DerivMat)
void ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
virtual void v_ReOrientTracePhysMap(const StdRegions::Orientation orient, Array< OneD, int > &idmap, const int nq0, const int nq1=-1)
virtual void v_MultiplyByQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_ComputeLaplacianMetric()
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3)
virtual void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
virtual void v_AddEdgeNormBoundaryInt(const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
virtual void v_SetUpPhysNormals(const int id)
virtual void v_GetTracePhysMap(const int edge, Array< OneD, int > &outarray)
const NormalVector & GetTraceNormal(const int id)
virtual void v_NormalTraceDerivFactors(Array< OneD, Array< OneD, NekDouble >> &factors, Array< OneD, Array< OneD, NekDouble >> &d0factors, Array< OneD, Array< OneD, NekDouble >> &d1factors)
virtual void v_GetTracePhysVals(const int trace, const StdRegions::StdExpansionSharedPtr &TraceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
Expansion(SpatialDomains::GeometrySharedPtr pGeom)
DNekMatSharedPtr BuildTransformationMatrix(const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
StdRegions::Orientation GetIndexOrientation() const
IndexMapType GetIndexMapType() const
int GetIndexEntity() const
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
int GetTraceNumPoints(const int i) const
This function returns the number of quadrature points belonging to the i-th trace.
int NumBndryCoeffs(void) const
const LibUtilities::PointsKeyVector GetPointsKeys() const
DNekBlkMatSharedPtr GetStdStaticCondMatrix(const StdMatrixKey &mkey)
int GetNtraces() const
Returns the number of trace elements connected to this element.
virtual void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void GetTraceToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation traceOrient=eForwards, int P=-1, int Q=-1)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
void GetInteriorMap(Array< OneD, unsigned int > &outarray)
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Backward transformation from coefficient space to physical space.
void StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Array< OneD, LibUtilities::BasisSharedPtr > m_base
MatrixType GetMatrixType() const
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 ...
void Interp3D(const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, const BasisKey &tbasis2, Array< OneD, NekDouble > &to)
this function interpolates a 3D function evaluated at the quadrature points of the 3D basis,...
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::vector< PointsKey > PointsKeyVector
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eNoGeomType
No type defined.
@ eMovingRegular
Currently unused.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< Geometry > GeometrySharedPtr
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
std::map< ConstFactorType, NekDouble > ConstFactorMap
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
static DNekMatSharedPtr NullDNekMatSharedPtr
static Array< OneD, NekDouble > NullNekDouble1DArray
static DNekScalMatSharedPtr NullDNekScalMatSharedPtr
std::shared_ptr< DNekMat > DNekMatSharedPtr
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.
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
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.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)