Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Nektar::LocalRegions::Expansion3D Class Reference

#include <Expansion3D.h>

Inheritance diagram for Nektar::LocalRegions::Expansion3D:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LocalRegions::Expansion3D:
Collaboration graph
[legend]

Public Member Functions

 Expansion3D (SpatialDomains::Geometry3DSharedPtr pGeom)
 
virtual ~Expansion3D ()
 
void SetFaceExp (const int face, Expansion2DSharedPtr &f)
 
Expansion2DSharedPtr GetFaceExp (const int face)
 
void SetTraceToGeomOrientation (Array< OneD, NekDouble > &inout)
 Align trace orientation with the geometry orientation. More...
 
void SetFaceToGeomOrientation (const int face, Array< OneD, NekDouble > &inout)
 Align face orientation with the geometry orientation. More...
 
void AddHDGHelmholtzFaceTerms (const NekDouble tau, const int edge, Array< OneD, NekDouble > &facePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
 
void AddNormTraceInt (const int dir, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &outarray)
 
void AddNormTraceInt (const int dir, Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs)
 
void AddFaceBoundaryInt (const int face, ExpansionSharedPtr &FaceExp, Array< OneD, NekDouble > &facePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
 
SpatialDomains::Geometry3DSharedPtr GetGeom3D () const
 
void ReOrientFacePhysMap (const int nvert, const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
 
void v_NormVectorIProductWRTBase (const Array< OneD, const Array< OneD, NekDouble > > &Fvec, Array< OneD, NekDouble > &outarray)
 
- Public Member Functions inherited from Nektar::LocalRegions::Expansion
 Expansion (SpatialDomains::GeometrySharedPtr pGeom)
 
 Expansion (const Expansion &pSrc)
 
virtual ~Expansion ()
 
DNekScalMatSharedPtr GetLocMatrix (const LocalRegions::MatrixKey &mkey)
 
DNekScalMatSharedPtr GetLocMatrix (const StdRegions::MatrixType mtype, const StdRegions::ConstFactorMap &factors=StdRegions::NullConstFactorMap, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
 
SpatialDomains::GeometrySharedPtr GetGeom () const
 
void Reset ()
 
virtual const
SpatialDomains::GeomFactorsSharedPtr
v_GetMetricInfo () const
 
DNekMatSharedPtr BuildTransformationMatrix (const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
 
DNekMatSharedPtr BuildVertexMatrix (const DNekScalMatSharedPtr &r_bnd)
 
void ExtractDataToCoeffs (const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
 
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)
 
void AddEdgeNormBoundaryInt (const int edge, const boost::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
void AddFaceNormBoundaryInt (const int face, const boost::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)
 
- Public Member Functions inherited from Nektar::StdRegions::StdExpansion
 StdExpansion ()
 Default Constructor. More...
 
 StdExpansion (const int numcoeffs, const int numbases, const LibUtilities::BasisKey &Ba=LibUtilities::NullBasisKey, const LibUtilities::BasisKey &Bb=LibUtilities::NullBasisKey, const LibUtilities::BasisKey &Bc=LibUtilities::NullBasisKey)
 Constructor. More...
 
 StdExpansion (const StdExpansion &T)
 Copy Constructor. More...
 
virtual ~StdExpansion ()
 Destructor. More...
 
int GetNumBases () const
 This function returns the number of 1D bases used in the expansion. More...
 
const Array< OneD, const
LibUtilities::BasisSharedPtr > & 
GetBase () const
 This function gets the shared point to basis. More...
 
const
LibUtilities::BasisSharedPtr
GetBasis (int dir) const
 This function gets the shared point to basis in the dir direction. More...
 
int GetNcoeffs (void) const
 This function returns the total number of coefficients used in the expansion. More...
 
int GetTotPoints () const
 This function returns the total number of quadrature points used in the element. More...
 
LibUtilities::BasisType GetBasisType (const int dir) const
 This function returns the type of basis used in the dir direction. More...
 
int GetBasisNumModes (const int dir) const
 This function returns the number of expansion modes in the dir direction. More...
 
int EvalBasisNumModesMax (void) const
 This function returns the maximum number of expansion modes over all local directions. More...
 
LibUtilities::PointsType GetPointsType (const int dir) const
 This function returns the type of quadrature points used in the dir direction. More...
 
int GetNumPoints (const int dir) const
 This function returns the number of quadrature points in the dir direction. More...
 
const Array< OneD, const
NekDouble > & 
GetPoints (const int dir) const
 This function returns a pointer to the array containing the quadrature points in dir direction. More...
 
int GetNverts () const
 This function returns the number of vertices of the expansion domain. More...
 
int GetNedges () const
 This function returns the number of edges of the expansion domain. More...
 
int GetEdgeNcoeffs (const int i) const
 This function returns the number of expansion coefficients belonging to the i-th edge. More...
 
int GetTotalEdgeIntNcoeffs () const
 
int GetEdgeNumPoints (const int i) const
 This function returns the number of quadrature points belonging to the i-th edge. More...
 
int DetCartesianDirOfEdge (const int edge)
 
const LibUtilities::BasisKey DetEdgeBasisKey (const int i) const
 
const LibUtilities::BasisKey DetFaceBasisKey (const int i, const int k) const
 
int GetFaceNumPoints (const int i) const
 This function returns the number of quadrature points belonging to the i-th face. More...
 
int GetFaceNcoeffs (const int i) const
 This function returns the number of expansion coefficients belonging to the i-th face. More...
 
int GetFaceIntNcoeffs (const int i) const
 
int GetTotalFaceIntNcoeffs () const
 
int GetTraceNcoeffs (const int i) const
 This function returns the number of expansion coefficients belonging to the i-th edge/face. More...
 
LibUtilities::PointsKey GetFacePointsKey (const int i, const int j) const
 
int NumBndryCoeffs (void) const
 
int NumDGBndryCoeffs (void) const
 
LibUtilities::BasisType GetEdgeBasisType (const int i) const
 This function returns the type of expansion basis on the i-th edge. More...
 
const LibUtilities::PointsKey GetNodalPointsKey () const
 This function returns the type of expansion Nodal point type if defined. More...
 
int GetNfaces () const
 This function returns the number of faces of the expansion domain. More...
 
int GetNtrace () const
 Returns the number of trace elements connected to this element. More...
 
LibUtilities::ShapeType DetShapeType () const
 This function returns the shape of the expansion domain. More...
 
boost::shared_ptr< StdExpansionGetStdExp (void) const
 
boost::shared_ptr< StdExpansionGetLinStdExp (void) const
 
int GetShapeDimension () const
 
bool IsBoundaryInteriorExpansion ()
 
bool IsNodalNonTensorialExp ()
 
void BwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function performs the Backward transformation from coefficient space to physical space. More...
 
void FwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function performs the Forward transformation from physical space to coefficient space. More...
 
void FwdTrans_BndConstrained (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
NekDouble Integral (const Array< OneD, const NekDouble > &inarray)
 This function integrates the specified function over the domain. More...
 
void FillMode (const int mode, Array< OneD, NekDouble > &outarray)
 This function fills the array outarray with the mode-th mode of the expansion. More...
 
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 expansion More...
 
void IProductWRTBase (const Array< OneD, const NekDouble > &base, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int coll_check)
 
void IProductWRTDerivBase (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
int GetElmtId ()
 Get the element id of this expansion when used in a list by returning value of m_elmt_id. More...
 
void SetElmtId (const int id)
 Set the element id of this expansion when used in a list by returning value of m_elmt_id. More...
 
void GetCoords (Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
 this function returns the physical coordinates of the quadrature points of the expansion More...
 
void GetCoord (const Array< OneD, const NekDouble > &Lcoord, Array< OneD, NekDouble > &coord)
 given the coordinates of a point of the element in the local collapsed coordinate system, this function calculates the physical coordinates of the point More...
 
DNekMatSharedPtr GetStdMatrix (const StdMatrixKey &mkey)
 
DNekBlkMatSharedPtr GetStdStaticCondMatrix (const StdMatrixKey &mkey)
 
IndexMapValuesSharedPtr GetIndexMap (const IndexMapKey &ikey)
 
const Array< OneD, const
NekDouble > & 
GetPhysNormals (void)
 
void SetPhysNormals (Array< OneD, const NekDouble > &normal)
 
virtual void SetUpPhysNormals (const int edge)
 
void NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
 
void NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
void NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray)
 
void NormVectorIProductWRTBase (const Array< OneD, const Array< OneD, NekDouble > > &Fvec, Array< OneD, NekDouble > &outarray)
 
DNekScalBlkMatSharedPtr GetLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
void DropLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
StdRegions::Orientation GetForient (int face)
 
StdRegions::Orientation GetEorient (int edge)
 
StdRegions::Orientation GetPorient (int point)
 
StdRegions::Orientation GetCartesianEorient (int edge)
 
void SetCoeffsToOrientation (Array< OneD, NekDouble > &coeffs, StdRegions::Orientation dir)
 
void SetCoeffsToOrientation (StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
int CalcNumberOfCoefficients (const std::vector< unsigned int > &nummodes, int &modes_offset)
 
NekDouble StdPhysEvaluate (const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
 
int GetCoordim ()
 
void GetBoundaryMap (Array< OneD, unsigned int > &outarray)
 
void GetInteriorMap (Array< OneD, unsigned int > &outarray)
 
int GetVertexMap (const int localVertexId, bool useCoeffPacking=false)
 
void GetEdgeInteriorMap (const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
 
void GetFaceNumModes (const int fid, const Orientation faceOrient, int &numModes0, int &numModes1)
 
void GetFaceInteriorMap (const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
 
void GetEdgeToElementMap (const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int P=-1)
 
void GetFaceToElementMap (const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int nummodesA=-1, int nummodesB=-1)
 
void GetEdgePhysVals (const int edge, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 Extract the physical values along edge edge from inarray into outarray following the local edge orientation and point distribution defined by defined in EdgeExp. More...
 
void GetEdgePhysVals (const int edge, const boost::shared_ptr< StdExpansion > &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GetTracePhysVals (const int edge, const boost::shared_ptr< StdExpansion > &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GetVertexPhysVals (const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray)
 
void GetEdgeInterpVals (const int edge, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GetEdgeQFactors (const int edge, Array< OneD, NekDouble > &outarray)
 Extract the metric factors to compute the contravariant fluxes along edge edge and stores them into outarray following the local edge orientation (i.e. anticlockwise convention). More...
 
void GetFacePhysVals (const int face, const boost::shared_ptr< StdExpansion > &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient=eNoOrientation)
 
void GetEdgePhysMap (const int edge, Array< OneD, int > &outarray)
 
void GetFacePhysMap (const int face, Array< OneD, int > &outarray)
 
void MultiplyByQuadratureMetric (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void MultiplyByStdQuadratureMetric (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
DNekMatSharedPtr CreateGeneralMatrix (const StdMatrixKey &mkey)
 this function generates the mass matrix $\mathbf{M}[i][j] = \int \phi_i(\mathbf{x}) \phi_j(\mathbf{x}) d\mathbf{x}$ More...
 
void GeneralMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void ReduceOrderCoeffs (int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void SVVLaplacianFilter (Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp (const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDerivMatrixOp (const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDirectionalDerivMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassLevelCurvatureMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LinearAdvectionDiffusionReactionMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
 
void HelmholtzMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
DNekMatSharedPtr GenMatrix (const StdMatrixKey &mkey)
 
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)
 
void PhysDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void PhysDeriv_s (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds)
 
void PhysDeriv_n (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn)
 
void PhysDirectionalDeriv (const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &outarray)
 
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)
 
void StdPhysDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void AddRobinMassMatrix (const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
 
void AddRobinEdgeContribution (const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, Array< OneD, NekDouble > &coeffs)
 
NekDouble PhysEvaluate (const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
 This function evaluates the expansion at a single (arbitrary) point of the domain. More...
 
NekDouble PhysEvaluate (const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
 This function evaluates the expansion at a single (arbitrary) point of the domain. More...
 
void LocCoordToLocCollapsed (const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
 Convert local cartesian coordinate xi into local collapsed coordinates eta. More...
 
const boost::shared_ptr
< SpatialDomains::GeomFactors > & 
GetMetricInfo (void) const
 
virtual int v_GetElmtId ()
 Get the element id of this expansion when used in a list by returning value of m_elmt_id. More...
 
virtual const Array< OneD,
const NekDouble > & 
v_GetPhysNormals (void)
 
virtual void v_SetPhysNormals (Array< OneD, const NekDouble > &normal)
 
virtual void v_SetUpPhysNormals (const int edge)
 
virtual int v_CalcNumberOfCoefficients (const std::vector< unsigned int > &nummodes, int &modes_offset)
 
virtual void v_NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
 
virtual void v_NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
virtual void v_NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray)
 
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
virtual void v_DropLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
virtual StdRegions::Orientation v_GetEorient (int edge)
 
virtual StdRegions::Orientation v_GetCartesianEorient (int edge)
 
virtual StdRegions::Orientation v_GetPorient (int point)
 
NekDouble Linf (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
 Function to evaluate the discrete $ L_\infty$ error $ |\epsilon|_\infty = \max |u - u_{exact}|$ where $ u_{exact}$ is given by the array sol. More...
 
NekDouble L2 (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
 Function to evaluate the discrete $ L_2$ error, $ | \epsilon |_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2 dx \right]^{1/2} d\xi_1 $ where $ u_{exact}$ is given by the array sol. More...
 
NekDouble H1 (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
 Function to evaluate the discrete $ H^1$ error, $ | \epsilon |^1_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2 + \nabla(u - u_{exact})\cdot\nabla(u - u_{exact})\cdot dx \right]^{1/2} d\xi_1 $ where $ u_{exact}$ is given by the array sol. More...
 
const NormalVectorGetEdgeNormal (const int edge) const
 
void ComputeEdgeNormal (const int edge)
 
void NegateEdgeNormal (const int edge)
 
bool EdgeNormalNegated (const int edge)
 
void ComputeFaceNormal (const int face)
 
void NegateFaceNormal (const int face)
 
bool FaceNormalNegated (const int face)
 
void ComputeVertexNormal (const int vertex)
 
const NormalVectorGetFaceNormal (const int face) const
 
const NormalVectorGetVertexNormal (const int vertex) const
 
const NormalVectorGetSurfaceNormal (const int id) const
 
const LibUtilities::PointsKeyVector GetPointsKeys () const
 
Array< OneD, unsigned int > GetEdgeInverseBoundaryMap (int eid)
 
Array< OneD, unsigned int > GetFaceInverseBoundaryMap (int fid, StdRegions::Orientation faceOrient=eNoOrientation)
 
DNekMatSharedPtr BuildInverseTransformationMatrix (const DNekScalMatSharedPtr &m_transformationmatrix)
 
void PhysInterpToSimplexEquiSpaced (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset=-1)
 This function performs an interpolation from the physical space points provided at input into an array of equispaced points which are not the collapsed coordinate. So for a tetrahedron you will only get a tetrahedral number of values. More...
 
void GetSimplexEquiSpacedConnectivity (Array< OneD, int > &conn, bool standard=true)
 This function provides the connectivity of local simplices (triangles or tets) to connect the equispaced data points provided by PhysInterpToSimplexEquiSpaced. More...
 
void EquiSpacedToCoeffs (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function performs a projection/interpolation from the equispaced points sometimes used in post-processing onto the coefficient space. More...
 
template<class T >
boost::shared_ptr< T > as ()
 
void IProductWRTBase_SumFac (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
 
- Public Member Functions inherited from Nektar::StdRegions::StdExpansion3D
 StdExpansion3D ()
 
 StdExpansion3D (int numcoeffs, const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc)
 
 StdExpansion3D (const StdExpansion3D &T)
 
virtual ~StdExpansion3D ()
 
void PhysTensorDeriv (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d1, Array< OneD, NekDouble > &outarray_d2, Array< OneD, NekDouble > &outarray_d3)
 Calculate the 3D derivative in the local tensor/collapsed coordinate at the physical points. More...
 
void BwdTrans_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
 
void IProductWRTBase_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
 

Protected Member Functions

virtual void v_DGDeriv (const int dir, const Array< OneD, const NekDouble > &incoeffs, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &out_d)
 Evaluate coefficients of weak deriviative in the direction dir given the input coefficicents incoeffs and the imposed boundary values in EdgeExp (which will have its phys space updated). More...
 
virtual DNekMatSharedPtr v_GenMatrix (const StdRegions::StdMatrixKey &mkey)
 
virtual void v_AddFaceNormBoundaryInt (const int face, const ExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddRobinMassMatrix (const int face, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
 
virtual StdRegions::Orientation v_GetForient (int face)
 
virtual void v_GetTracePhysVals (const int face, const StdRegions::StdExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
 Returns the physical values at the quadrature points of a face Wrapper function to v_GetFacePhysVals. More...
 
virtual void v_GetFacePhysVals (const int face, const StdRegions::StdExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
 
virtual Array< OneD, unsigned int > v_GetEdgeInverseBoundaryMap (int eid)
 
virtual Array< OneD, unsigned int > v_GetFaceInverseBoundaryMap (int fid, StdRegions::Orientation faceOrient=StdRegions::eNoOrientation)
 
virtual DNekMatSharedPtr v_BuildTransformationMatrix (const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
 
virtual DNekMatSharedPtr v_BuildInverseTransformationMatrix (const DNekScalMatSharedPtr &m_transformationmatrix)
 Build inverse and inverse transposed transformation matrix: $\mathbf{R^{-1}}$ and $\mathbf{R^{-T}}$. More...
 
virtual DNekMatSharedPtr v_BuildVertexMatrix (const DNekScalMatSharedPtr &r_bnd)
 
void ReOrientTriFacePhysMap (const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
 
void ReOrientQuadFacePhysMap (const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
 
- Protected Member Functions inherited from Nektar::LocalRegions::Expansion
void ComputeLaplacianMetric ()
 
void ComputeQuadratureMetric ()
 
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 DNekScalMatSharedPtr v_GetLocMatrix (const LocalRegions::MatrixKey &mkey)
 
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 boost::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddEdgeNormBoundaryInt (const int edge, const boost::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddFaceNormBoundaryInt (const int face, const boost::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
- Protected Member Functions inherited from Nektar::StdRegions::StdExpansion
DNekMatSharedPtr CreateStdMatrix (const StdMatrixKey &mkey)
 
DNekBlkMatSharedPtr CreateStdStaticCondMatrix (const StdMatrixKey &mkey)
 Create the static condensation of a matrix when using a boundary interior decomposition. More...
 
IndexMapValuesSharedPtr CreateIndexMap (const IndexMapKey &ikey)
 Create an IndexMap which contains mapping information linking any specific element shape with either its boundaries, edges, faces, verteces, etc. More...
 
void BwdTrans_MatOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void BwdTrans_SumFac (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void IProductWRTDerivBase_SumFac (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GeneralMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp_MatFree_Kernel (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp)
 
void LaplacianMatrixOp_MatFree_GenericImpl (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp_MatFree (const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDerivMatrixOp_MatFree (const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDirectionalDerivMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassLevelCurvatureMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LinearAdvectionDiffusionReactionMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
 
void HelmholtzMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void HelmholtzMatrixOp_MatFree_GenericImpl (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
virtual void v_SetCoeffsToOrientation (StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_SetCoeffsToOrientation (Array< OneD, NekDouble > &coeffs, StdRegions::Orientation dir)
 
virtual NekDouble v_StdPhysEvaluate (const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
 
- Protected Member Functions inherited from Nektar::StdRegions::StdExpansion3D
virtual NekDouble v_PhysEvaluate (const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
 This function evaluates the expansion at a single (arbitrary) point of the domain. More...
 
virtual NekDouble v_PhysEvaluate (const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
 
virtual void v_BwdTrans_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)=0
 
virtual void v_IProductWRTBase_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)=0
 
virtual void v_LaplacianMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
 
virtual void v_HelmholtzMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
 
virtual NekDouble v_Integral (const Array< OneD, const NekDouble > &inarray)
 Integrates the specified function over the domain. More...
 
virtual void v_NegateFaceNormal (const int face)
 
virtual bool v_FaceNormalNegated (const int face)
 
virtual int v_GetTraceNcoeffs (const int i) const
 

Private Attributes

std::vector< Expansion2DWeakPtrm_faceExp
 
std::vector< bool > m_requireNeg
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::LocalRegions::Expansion
SpatialDomains::GeometrySharedPtr m_geom
 
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
 
MetricMap m_metrics
 
- Protected Attributes inherited from Nektar::StdRegions::StdExpansion
Array< OneD,
LibUtilities::BasisSharedPtr
m_base
 
int m_elmt_id
 
int m_ncoeffs
 
LibUtilities::NekManager
< StdMatrixKey, DNekMat,
StdMatrixKey::opLess
m_stdMatrixManager
 
LibUtilities::NekManager
< StdMatrixKey, DNekBlkMat,
StdMatrixKey::opLess
m_stdStaticCondMatrixManager
 
LibUtilities::NekManager
< IndexMapKey, IndexMapValues,
IndexMapKey::opLess
m_IndexMapManager
 
- Protected Attributes inherited from Nektar::StdRegions::StdExpansion3D
std::map< int, NormalVectorm_faceNormals
 
std::map< int, bool > m_negatedNormals
 

Detailed Description

Definition at line 59 of file Expansion3D.h.

Constructor & Destructor Documentation

Nektar::LocalRegions::Expansion3D::Expansion3D ( SpatialDomains::Geometry3DSharedPtr  pGeom)
inline

Definition at line 63 of file Expansion3D.h.

63 : Expansion(pGeom), StdExpansion3D(), m_requireNeg() {}
std::vector< bool > m_requireNeg
Definition: Expansion3D.h:177
Expansion(SpatialDomains::GeometrySharedPtr pGeom)
Definition: Expansion.cpp:48
virtual Nektar::LocalRegions::Expansion3D::~Expansion3D ( )
inlinevirtual

Definition at line 64 of file Expansion3D.h.

64 {}

Member Function Documentation

void Nektar::LocalRegions::Expansion3D::AddFaceBoundaryInt ( const int  face,
ExpansionSharedPtr FaceExp,
Array< OneD, NekDouble > &  facePhys,
Array< OneD, NekDouble > &  outarray,
const StdRegions::VarCoeffMap varcoeffs = StdRegions::NullVarCoeffMap 
)
inline

For a given face add the {F}_1j contributions

Definition at line 270 of file Expansion3D.cpp.

References Nektar::StdRegions::eFaceToElement.

276  {
277  int i;
278  int order_f = FaceExp->GetNcoeffs();
279  Array<OneD, NekDouble> coeff(order_f);
280 
281  StdRegions::IndexMapKey ikey(
284  face, GetForient(face));
286  StdExpansion::GetIndexMap(ikey);
287 
288 // StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
289 // StdRegions::eVarCoeffD11,
290 // StdRegions::eVarCoeffD22};
291 // StdRegions::VarCoeffMap::const_iterator x;
292 // Array<OneD, NekDouble> varcoeff_work(nquad_e);
293 //
294 ///// @TODO Variable coeffs
295 // if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
296 // {
297 // GetPhysEdgeVarCoeffsFromElement(edge,EdgeExp,x->second,varcoeff_work);
298 // Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp->GetPhys(),1,EdgeExp->UpdatePhys(),1);
299 // }
300 
301  FaceExp->IProductWRTBase(facePhys, coeff);
302 
303  // add data to out array
304  for(i = 0; i < order_f; ++i)
305  {
306  outarray[(*map)[i].index] += (*map)[i].sign*coeff[i];
307  }
308  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:470
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:178
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
void Nektar::LocalRegions::Expansion3D::AddHDGHelmholtzFaceTerms ( const NekDouble  tau,
const int  edge,
Array< OneD, NekDouble > &  facePhys,
const StdRegions::VarCoeffMap dirForcing,
Array< OneD, NekDouble > &  outarray 
)
inline

Definition at line 51 of file Expansion3D.cpp.

References Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eInvMass, Nektar::StdRegions::eWeakDeriv0, Nektar::StdRegions::eWeakDeriv1, Nektar::StdRegions::eWeakDeriv2, Nektar::eWrapper, Vmath::Neg(), and Vmath::Vmul().

57  {
58  ExpansionSharedPtr FaceExp = GetFaceExp(face);
59  int i,j,n;
60  int nquad_f = FaceExp->GetNumPoints(0)*FaceExp->GetNumPoints(1);
61  int order_f = FaceExp->GetNcoeffs();
62  int coordim = GetCoordim();
63  int ncoeffs = GetNcoeffs();
64 
65  Array<OneD, NekDouble> inval (nquad_f);
66  Array<OneD, NekDouble> outcoeff(order_f);
67  Array<OneD, NekDouble> tmpcoeff(ncoeffs);
68 
69  const Array<OneD, const Array<OneD, NekDouble> > &normals
70  = GetFaceNormal(face);
71 
73 
74  DNekVec Coeffs(ncoeffs,outarray,eWrapper);
75  DNekVec Tmpcoeff(ncoeffs,tmpcoeff,eWrapper);
76 
77  StdRegions::IndexMapKey ikey(
80  face, GetForient(face));
82  StdExpansion::GetIndexMap(ikey);
83 
87 
88  // @TODO Variable coefficients
89  /*
90  StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
91  StdRegions::eVarCoeffD11,
92  StdRegions::eVarCoeffD22};
93  Array<OneD, NekDouble> varcoeff_work(nquad_f);
94  StdRegions::VarCoeffMap::const_iterator x;
95  ///// @TODO: What direction to use here??
96  if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
97  {
98  GetPhysFaceVarCoeffsFromElement(face,FaceExp,x->second,varcoeff_work);
99  Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp->GetPhys(),1,FaceExp->UpdatePhys(),1);
100  }
101  */
102 
103  //================================================================
104  // Add F = \tau <phi_i,in_phys>
105  // Fill face and take inner product
106  FaceExp->IProductWRTBase(facePhys, outcoeff);
107 
108  for(i = 0; i < order_f; ++i)
109  {
110  outarray[(*map)[i].index] += (*map)[i].sign*tau*outcoeff[i];
111  }
112  //================================================================
113 
114  NekDouble scale = invMass.Scale();
115  const NekDouble *data = invMass.GetRawPtr();
116 
117  //===============================================================
118  // Add -\sum_i D_i^T M^{-1} G_i + E_i M^{-1} G_i =
119  // \sum_i D_i M^{-1} G_i term
120 
121  // Three independent direction
122  for(n = 0; n < coordim; ++n)
123  {
124  Vmath::Vmul(nquad_f, normals[n], 1, facePhys, 1, inval, 1);
125 
126  if (m_negatedNormals[face])
127  {
128  Vmath::Neg(nquad_f, inval, 1);
129  }
130 
131  // @TODO Multiply by variable coefficients
132  // @TODO: Document this (probably not needed)
133  /*
134  StdRegions::VarCoeffMap::const_iterator x;
135  if ((x = varcoeffs.find(VarCoeff[n])) != varcoeffs.end())
136  {
137  GetPhysEdgeVarCoeffsFromElement(edge,FaceExp,x->second,varcoeff_work);
138  Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp->GetPhys(),1,FaceExp->UpdatePhys(),1);
139  }
140  */
141 
142  FaceExp->IProductWRTBase(inval, outcoeff);
143 
144  // M^{-1} G
145  for(i = 0; i < ncoeffs; ++i)
146  {
147  tmpcoeff[i] = 0;
148  for(j = 0; j < order_f; ++j)
149  {
150  tmpcoeff[i] += scale*data[i+(*map)[j].index*ncoeffs]*(*map)[j].sign*outcoeff[j];
151  }
152  }
153 
154  DNekScalMat &Dmat = *GetLocMatrix(DerivType[n]);
155  Coeffs = Coeffs + Dmat*Tmpcoeff;
156 
157  /*
158  if(varcoeffs.find(VarCoeff[n]) != varcoeffs.end())
159  {
160  MatrixKey mkey(DerivType[n], DetExpansionType(), *this, StdRegions::NullConstFactorMap, varcoeffs);
161  DNekScalMat &Dmat = *GetLocMatrix(mkey);
162  Coeffs = Coeffs + Dmat*Tmpcoeff;
163  }
164 
165  else
166  {
167  DNekScalMat &Dmat = *GetLocMatrix(DerivType[n]);
168  Coeffs = Coeffs + Dmat*Tmpcoeff;
169  }
170  */
171  }
172  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:470
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:178
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
const NormalVector & GetFaceNormal(const int face) const
std::map< int, bool > m_negatedNormals
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:396
double NekDouble
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:85
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:49
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:131
Expansion2DSharedPtr GetFaceExp(const int face)
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
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.
Definition: Vmath.cpp:183
void Nektar::LocalRegions::Expansion3D::AddNormTraceInt ( const int  dir,
Array< OneD, ExpansionSharedPtr > &  FaceExp,
Array< OneD, Array< OneD, NekDouble > > &  faceCoeffs,
Array< OneD, NekDouble > &  outarray 
)
inline

Definition at line 233 of file Expansion3D.cpp.

References Vmath::Neg(), and Vmath::Vmul().

238  {
239  int f, cnt;
240  int order_f, nquad_f;
241  int nfaces = GetNfaces();
242 
243  cnt = 0;
244  for(f = 0; f < nfaces; ++f)
245  {
246  order_f = FaceExp[f]->GetNcoeffs();
247  nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
248 
249  const Array<OneD, const Array<OneD, NekDouble> > &normals = GetFaceNormal(f);
250  Array<OneD, NekDouble> facePhys(nquad_f);
251 
252  cnt += order_f;
253 
254  FaceExp[f]->BwdTrans(faceCoeffs[f], facePhys);
255 
256  Vmath::Vmul(nquad_f, normals[dir], 1, facePhys, 1, facePhys, 1);
257 
258  if (m_negatedNormals[f])
259  {
260  Vmath::Neg(nquad_f, facePhys, 1);
261  }
262 
263  AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray);
264  }
265  }
void AddFaceBoundaryInt(const int face, ExpansionSharedPtr &FaceExp, Array< OneD, NekDouble > &facePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
const NormalVector & GetFaceNormal(const int face) const
std::map< int, bool > m_negatedNormals
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:396
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.
Definition: Vmath.cpp:183
void Nektar::LocalRegions::Expansion3D::AddNormTraceInt ( const int  dir,
Array< OneD, const NekDouble > &  inarray,
Array< OneD, ExpansionSharedPtr > &  FaceExp,
Array< OneD, NekDouble > &  outarray,
const StdRegions::VarCoeffMap varcoeffs 
)
inline

Computes the C matrix entries due to the presence of the identity matrix in Eqn. 32.

: Document this

Definition at line 178 of file Expansion3D.cpp.

References Vmath::Neg(), and Vmath::Vmul().

184  {
185  int i,f,cnt;
186  int order_f,nquad_f;
187  int nfaces = GetNfaces();
188 
189  cnt = 0;
190  for(f = 0; f < nfaces; ++f)
191  {
192  order_f = FaceExp[f]->GetNcoeffs();
193  nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
194 
195  const Array<OneD, const Array<OneD, NekDouble> > &normals = GetFaceNormal(f);
196  Array<OneD, NekDouble> faceCoeffs(order_f);
197  Array<OneD, NekDouble> facePhys (nquad_f);
198 
199  for(i = 0; i < order_f; ++i)
200  {
201  faceCoeffs[i] = inarray[i+cnt];
202  }
203  cnt += order_f;
204 
205  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
206 
207  // Multiply by variable coefficient
208  /// @TODO: Document this
209 // StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
210 // StdRegions::eVarCoeffD11,
211 // StdRegions::eVarCoeffD22};
212 // StdRegions::VarCoeffMap::const_iterator x;
213 // Array<OneD, NekDouble> varcoeff_work(nquad_e);
214 
215 // if ((x = varcoeffs.find(VarCoeff[dir])) != varcoeffs.end())
216 // {
217 // GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
218 // Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
219 // }
220 
221  Vmath::Vmul(nquad_f, normals[dir], 1, facePhys, 1, facePhys, 1);
222 
223  if (m_negatedNormals[f])
224  {
225  Vmath::Neg(nquad_f, facePhys, 1);
226  }
227 
228  AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray, varcoeffs);
229  }
230  }
void AddFaceBoundaryInt(const int face, ExpansionSharedPtr &FaceExp, Array< OneD, NekDouble > &facePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
const NormalVector & GetFaceNormal(const int face) const
std::map< int, bool > m_negatedNormals
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:396
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.
Definition: Vmath.cpp:183
Expansion2DSharedPtr Nektar::LocalRegions::Expansion3D::GetFaceExp ( const int  face)

Definition at line 916 of file Expansion3D.cpp.

917  {
918  return m_faceExp[face].lock();
919  }
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:176
SpatialDomains::Geometry3DSharedPtr Nektar::LocalRegions::Expansion3D::GetGeom3D ( ) const
inline

Definition at line 180 of file Expansion3D.h.

References Nektar::LocalRegions::Expansion::m_geom.

Referenced by Nektar::MultiRegions::ExpList2D::ExpList2D(), Nektar::MultiRegions::DisContField3D::SetUpDG(), and Nektar::LocalRegions::HexExp::v_GetFaceDGForwards().

181  {
182  return boost::dynamic_pointer_cast<SpatialDomains::Geometry3D>(m_geom);
183  }
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:130
void Nektar::LocalRegions::Expansion3D::ReOrientFacePhysMap ( const int  nvert,
const StdRegions::Orientation  orient,
const int  nq0,
const int  nq1,
Array< OneD, int > &  idmap 
)

Definition at line 2013 of file Expansion3D.cpp.

2017  {
2018  if(nvert == 3)
2019  {
2020  ReOrientTriFacePhysMap(orient,nq0,nq1,idmap);
2021  }
2022  else
2023  {
2024  ReOrientQuadFacePhysMap(orient,nq0,nq1,idmap);
2025  }
2026  }
void ReOrientQuadFacePhysMap(const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
void ReOrientTriFacePhysMap(const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
void Nektar::LocalRegions::Expansion3D::ReOrientQuadFacePhysMap ( const StdRegions::Orientation  orient,
const int  nq0,
const int  nq1,
Array< OneD, int > &  idmap 
)
protected

Definition at line 2063 of file Expansion3D.cpp.

References ASSERTL0, Nektar::StdRegions::eDir1BwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1BwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1BwdDir2_Dir2FwdDir1, Nektar::StdRegions::eDir1FwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1FwdDir2_Dir2BwdDir1, and Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1.

2067  {
2068  if(idmap.num_elements() != nq0*nq1)
2069  {
2070  idmap = Array<OneD,int>(nq0*nq1);
2071  }
2072 
2073 
2074  switch(orient)
2075  {
2077  // eseentially straight copy
2078  for(int i = 0; i < nq0*nq1; ++i)
2079  {
2080  idmap[i] = i;
2081  }
2082  break;
2084  {
2085  //Direction A negative and B positive
2086  for (int j = 0; j < nq1; j++)
2087  {
2088  for (int i =0; i < nq0; ++i)
2089  {
2090  idmap[j*nq0+i] = nq0-1-i + j*nq0;
2091  }
2092  }
2093  }
2094  break;
2096  {
2097  //Direction A positive and B negative
2098  for (int j = 0; j < nq1; j++)
2099  {
2100  for (int i =0; i < nq0; ++i)
2101  {
2102  idmap[j*nq0+i] = nq0*(nq1-1-j)+i;
2103  }
2104  }
2105  }
2107  {
2108  //Direction A negative and B negative
2109  for (int j = 0; j < nq1; j++)
2110  {
2111  for (int i =0; i < nq0; ++i)
2112  {
2113  idmap[j*nq0+i] = nq0*nq1-1-j*nq0 -i;
2114  }
2115  }
2116  }
2118  {
2119  //Transposed, Direction A and B positive
2120  for (int i =0; i < nq0; ++i)
2121  {
2122  for (int j = 0; j < nq1; ++j)
2123  {
2124  idmap[i*nq1+j] = i + j*nq0;
2125  }
2126  }
2127  }
2128  break;
2130  {
2131  //Transposed, Direction A positive and B negative
2132  for (int i =0; i < nq0; ++i)
2133  {
2134  for (int j = 0; j < nq1; ++j)
2135  {
2136  idmap[i*nq1+j] = nq0-1-i + j*nq0;
2137  }
2138  }
2139  }
2140  break;
2142  {
2143  //Transposed, Direction A negative and B positive
2144  for (int i =0; i < nq0; ++i)
2145  {
2146  for (int j = 0; j < nq1; ++j)
2147  {
2148  idmap[i*nq1+j] = i+nq0*(nq1-1)-j*nq0;
2149  }
2150  }
2151  break;
2152  }
2154  {
2155  //Transposed, Direction A and B negative
2156  for (int i =0; i < nq0; ++i)
2157  {
2158  for (int j = 0; j < nq1; ++j)
2159  {
2160  idmap[i*nq1+j] = nq0*nq1-1-i-j*nq0;
2161  }
2162  }
2163  }
2164  break;
2165  default:
2166  ASSERTL0(false,"Unknow orientation");
2167  break;
2168  }
2169  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
void Nektar::LocalRegions::Expansion3D::ReOrientTriFacePhysMap ( const StdRegions::Orientation  orient,
const int  nq0,
const int  nq1,
Array< OneD, int > &  idmap 
)
protected

Definition at line 2028 of file Expansion3D.cpp.

References ASSERTL0, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, and Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2.

2032  {
2033  if(idmap.num_elements() != nq0*nq1)
2034  {
2035  idmap = Array<OneD,int>(nq0*nq1);
2036  }
2037 
2038  switch(orient)
2039  {
2041  // eseentially straight copy
2042  for(int i = 0; i < nq0*nq1; ++i)
2043  {
2044  idmap[i] = i;
2045  }
2046  break;
2048  // reverse
2049  for (int j = 0; j < nq1; ++j)
2050  {
2051  for(int i = 0; i < nq0; ++i)
2052  {
2053  idmap[j*nq0+i] = nq0-1-i +j*nq0;
2054  }
2055  }
2056  break;
2057  default:
2058  ASSERTL0(false,"Case not supposed to be used in this function");
2059  }
2060  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
void Nektar::LocalRegions::Expansion3D::SetFaceExp ( const int  face,
Expansion2DSharedPtr f 
)

Definition at line 905 of file Expansion3D.cpp.

References ASSERTL1.

906  {
907  int nFaces = GetNfaces();
908  ASSERTL1(face < nFaces, "Face is out of range.");
909  if (m_faceExp.size() < nFaces)
910  {
911  m_faceExp.resize(nFaces);
912  }
913  m_faceExp[face] = f;
914  }
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:176
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Nektar::LocalRegions::Expansion3D::SetFaceToGeomOrientation ( const int  face,
Array< OneD, NekDouble > &  inout 
)

Align face orientation with the geometry orientation.

Definition at line 313 of file Expansion3D.cpp.

References ASSERTL1, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eFaceToElement, and Vmath::Vcopy().

315  {
316  int j,k;
317  int nface = GetFaceNcoeffs(face);
318  Array<OneD, NekDouble> f_in(nface);
319  Vmath::Vcopy(nface,&inout[0],1,&f_in[0],1);
320 
321  // retreiving face to element map for standard face orientation and
322  // for actual face orientation
323  StdRegions::IndexMapKey ikey1(
328  StdExpansion::GetIndexMap(ikey1);
329  StdRegions::IndexMapKey ikey2(
332  face, GetForient(face));
334  StdExpansion::GetIndexMap(ikey2);
335 
336  ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
337  "There is an error with the GetFaceToElementMap");
338 
339  for(j = 0; j < (*map1).num_elements(); ++j)
340  {
341  // j = index in the standard orientation
342  for(k = 0; k < (*map2).num_elements(); ++k)
343  {
344  // k = index in the actual orientation
345  if((*map1)[j].index == (*map2)[k].index && k != j)
346  {
347  inout[k] = f_in[j];
348  //checking if sign is changing
349  if((*map1)[j].sign != (*map2)[k].sign)
350  inout[k] *= -1.0;
351  break;
352  }
353  }
354  }
355  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:470
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:178
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:354
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
void Nektar::LocalRegions::Expansion3D::SetTraceToGeomOrientation ( Array< OneD, NekDouble > &  inout)

Align trace orientation with the geometry orientation.

Definition at line 360 of file Expansion3D.cpp.

361  {
362  int i,cnt = 0;
363  int nfaces = GetNfaces();
364 
365  Array<OneD, NekDouble> f_tmp;
366 
367  for(i = 0; i < nfaces; ++i)
368  {
369  SetFaceToGeomOrientation(i, f_tmp = inout + cnt);
370  cnt += GetFaceNcoeffs(i);
371  }
372  }
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
void SetFaceToGeomOrientation(const int face, Array< OneD, NekDouble > &inout)
Align face orientation with the geometry orientation.
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:354
void Nektar::LocalRegions::Expansion3D::v_AddFaceNormBoundaryInt ( const int  face,
const ExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  Fn,
Array< OneD, NekDouble > &  outarray 
)
protectedvirtual

Definition at line 921 of file Expansion3D.cpp.

References Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eMass, Nektar::LibUtilities::eQuadrilateral, and Nektar::LibUtilities::eTriangle.

926  {
927  int i, j;
928 
929  /*
930  * Coming into this routine, the velocity V will have been
931  * multiplied by the trace normals to give the input vector Vn. By
932  * convention, these normals are inwards facing for elements which
933  * have FaceExp as their right-adjacent face. This conditional
934  * statement therefore determines whether the normals must be
935  * negated, since the integral being performed here requires an
936  * outwards facing normal.
937  */
938  if (m_requireNeg.size() == 0)
939  {
940  m_requireNeg.resize(GetNfaces());
941 
942  for (i = 0; i < GetNfaces(); ++i)
943  {
944  m_requireNeg[i] = false;
945  if (m_negatedNormals[i])
946  {
947  m_requireNeg[i] = true;
948  continue;
949  }
950 
951  Expansion2DSharedPtr faceExp = m_faceExp[i].lock();
952 
953  if (faceExp->GetRightAdjacentElementExp())
954  {
955  if (faceExp->GetRightAdjacentElementExp()->GetGeom3D()
956  ->GetGlobalID() == GetGeom3D()->GetGlobalID())
957  {
958  m_requireNeg[i] = true;
959  }
960  }
961  }
962  }
963 
964  StdRegions::IndexMapKey ikey(
967  face, GetForient(face));
969  StdExpansion::GetIndexMap(ikey);
970 
971  int order_e = (*map).num_elements(); // Order of the element
972  int n_coeffs = FaceExp->GetNcoeffs();
973 
974  Array<OneD, NekDouble> faceCoeffs(n_coeffs);
975 
976  if (n_coeffs != order_e) // Going to orthogonal space
977  {
978  Array<OneD, NekDouble> coeff(n_coeffs);
979  Array<OneD, NekDouble> array(n_coeffs);
980 
981  FaceExp->FwdTrans(Fn, faceCoeffs);
982 
983  int NumModesElementMax = FaceExp->GetBasis(0)->GetNumModes();
984  int NumModesElementMin = m_base[0]->GetNumModes();
985 
986  FaceExp->ReduceOrderCoeffs(NumModesElementMin,
987  faceCoeffs,
988  faceCoeffs);
989 
990  StdRegions::StdMatrixKey masskey(StdRegions::eMass,
991  FaceExp->DetShapeType(),
992  *FaceExp);
993  FaceExp->MassMatrixOp(faceCoeffs, faceCoeffs, masskey);
994 
995  // Reorder coefficients for the lower degree face.
996  int offset1 = 0, offset2 = 0;
997 
998  if (FaceExp->DetShapeType() == LibUtilities::eQuadrilateral)
999  {
1000  for (i = 0; i < NumModesElementMin; ++i)
1001  {
1002  for (j = 0; j < NumModesElementMin; ++j)
1003  {
1004  faceCoeffs[offset1+j] =
1005  faceCoeffs[offset2+j];
1006  }
1007  offset1 += NumModesElementMin;
1008  offset2 += NumModesElementMax;
1009  }
1010 
1011  // Extract lower degree modes. TODO: Check this is correct.
1012  for (i = NumModesElementMin; i < NumModesElementMax; ++i)
1013  {
1014  for (j = NumModesElementMin; j < NumModesElementMax; ++j)
1015  {
1016  faceCoeffs[i*NumModesElementMax+j] = 0.0;
1017  }
1018  }
1019  }
1020 
1021  if (FaceExp->DetShapeType() == LibUtilities::eTriangle)
1022  {
1023 
1024  // Reorder coefficients for the lower degree face.
1025  int offset1 = 0, offset2 = 0;
1026 
1027  for (i = 0; i < NumModesElementMin; ++i)
1028  {
1029  for (j = 0; j < NumModesElementMin-i; ++j)
1030  {
1031  faceCoeffs[offset1+j] =
1032  faceCoeffs[offset2+j];
1033  }
1034  offset1 += NumModesElementMin-i;
1035  offset2 += NumModesElementMax-i;
1036  }
1037  }
1038 
1039  }
1040  else
1041  {
1042  FaceExp->IProductWRTBase(Fn, faceCoeffs);
1043  }
1044 
1045  if (m_requireNeg[face])
1046  {
1047  for (i = 0; i < order_e; ++i)
1048  {
1049  outarray[(*map)[i].index] -= (*map)[i].sign * faceCoeffs[i];
1050  }
1051  }
1052  else
1053  {
1054  for (i = 0; i < order_e; ++i)
1055  {
1056  outarray[(*map)[i].index] += (*map)[i].sign * faceCoeffs[i];
1057  }
1058  }
1059  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:470
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:178
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:180
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
std::vector< bool > m_requireNeg
Definition: Expansion3D.h:177
std::map< int, bool > m_negatedNormals
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:176
Array< OneD, LibUtilities::BasisSharedPtr > m_base
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
void Nektar::LocalRegions::Expansion3D::v_AddRobinMassMatrix ( const int  face,
const Array< OneD, const NekDouble > &  primCoeffs,
DNekMatSharedPtr inoutmat 
)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1097 of file Expansion3D.cpp.

References ASSERTL0, ASSERTL1, ASSERTL2, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eMass, Nektar::LibUtilities::eModified_A, Nektar::StdRegions::eVarCoeffMass, Nektar::StdRegions::NullConstFactorMap, and sign.

1101  {
1103  "Not set up for non boundary-interior expansions");
1104  ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
1105  "Assuming that input matrix was square");
1107  "Method set up only for modified modal bases curretly");
1108 
1109  int i,j;
1110  int id1,id2;
1111  Expansion2DSharedPtr faceExp = m_faceExp[face].lock();
1112  int order_f = faceExp->GetNcoeffs();
1113 
1114  Array<OneD, unsigned int> map;
1115  Array<OneD, int> sign;
1116 
1117  StdRegions::VarCoeffMap varcoeffs;
1118  varcoeffs[StdRegions::eVarCoeffMass] = primCoeffs;
1119 
1120  LibUtilities::ShapeType shapeType =
1121  faceExp->DetShapeType();
1122 
1123  LocalRegions::MatrixKey mkey(StdRegions::eMass,
1124  shapeType,
1125  *faceExp,
1127  varcoeffs);
1128 
1129  DNekScalMat &facemat = *faceExp->GetLocMatrix(mkey);
1130 
1131  // Now need to identify a map which takes the local face
1132  // mass matrix to the matrix stored in inoutmat;
1133  // This can currently be deduced from the size of the matrix
1134 
1135  // - if inoutmat.m_rows() == v_NCoeffs() it is a full
1136  // matrix system
1137 
1138  // - if inoutmat.m_rows() == v_GetNverts() it is a vertex space
1139  // preconditioner.
1140 
1141  // - if inoutmat.m_rows() == v_NumBndCoeffs() it is a
1142  // boundary CG system
1143 
1144  // - if inoutmat.m_rows() == v_NumDGBndCoeffs() it is a
1145  // trace DG system; still needs implementing.
1146  int rows = inoutmat->GetRows();
1147 
1148  if (rows == GetNcoeffs())
1149  {
1150  GetFaceToElementMap(face,GetForient(face),map,sign);
1151  }
1152  else if (rows == GetNverts())
1153  {
1154  int nfvert = faceExp->GetNverts();
1155 
1156  // Need to find where linear vertices are in facemat
1157  Array<OneD, unsigned int> linmap;
1158  Array<OneD, int> linsign;
1159 
1160  // Use a linear expansion to get correct mapping
1161  GetLinStdExp()->GetFaceToElementMap(face,GetForient(face),linmap, linsign);
1162 
1163  // zero out sign map to remove all other modes
1164  sign = Array<OneD, int> (order_f,0);
1165  map = Array<OneD, unsigned int>(order_f,(unsigned int)0);
1166 
1167  int fmap;
1168  // Reset sign map to only have contribution from vertices
1169  for(i = 0; i < nfvert; ++i)
1170  {
1171  fmap = faceExp->GetVertexMap(i,true);
1172  sign[fmap] = 1;
1173 
1174  // need to reset map
1175  map[fmap] = linmap[i];
1176  }
1177  }
1178  else if(rows == NumBndryCoeffs())
1179  {
1180  int nbndry = NumBndryCoeffs();
1181  Array<OneD,unsigned int> bmap(nbndry);
1182 
1183  GetFaceToElementMap(face,GetForient(face),map,sign);
1184  GetBoundaryMap(bmap);
1185 
1186  for(i = 0; i < order_f; ++i)
1187  {
1188  for(j = 0; j < nbndry; ++j)
1189  {
1190  if(map[i] == bmap[j])
1191  {
1192  map[i] = j;
1193  break;
1194  }
1195  }
1196  ASSERTL1(j != nbndry,"Did not find number in map");
1197  }
1198  }
1199  else if (rows == NumDGBndryCoeffs())
1200  {
1201  // possibly this should be a separate method
1202  int cnt = 0;
1203  map = Array<OneD, unsigned int> (order_f);
1204  sign = Array<OneD, int> (order_f,1);
1205 
1206  StdRegions::IndexMapKey ikey1(
1209  face, GetForient(face));
1211  StdExpansion::GetIndexMap(ikey1);
1212  StdRegions::IndexMapKey ikey2(
1214  DetShapeType(),
1215  GetBasisNumModes(0),
1216  GetBasisNumModes(1),
1217  GetBasisNumModes(2),
1218  face,
1221  StdExpansion::GetIndexMap(ikey2);
1222 
1223  ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
1224  "There is an error with the GetFaceToElementMap");
1225 
1226  for (i = 0; i < face; ++i)
1227  {
1228  cnt += GetFaceNcoeffs(i);
1229  }
1230 
1231  for(i = 0; i < (*map1).num_elements(); ++i)
1232  {
1233  int idx = -1;
1234 
1235  for(j = 0; j < (*map2).num_elements(); ++j)
1236  {
1237  if((*map1)[i].index == (*map2)[j].index)
1238  {
1239  idx = j;
1240  break;
1241  }
1242  }
1243 
1244  ASSERTL2(idx >= 0, "Index not found");
1245  map [i] = idx + cnt;
1246  sign[i] = (*map2)[idx].sign;
1247  }
1248  }
1249  else
1250  {
1251  ASSERTL0(false,"Could not identify matrix type from dimension");
1252  }
1253 
1254  for(i = 0; i < order_f; ++i)
1255  {
1256  id1 = map[i];
1257  for(j = 0; j < order_f; ++j)
1258  {
1259  id2 = map[j];
1260  (*inoutmat)(id1,id2) += facemat(i,j)*sign[i]*sign[j];
1261  }
1262  }
1263  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:470
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:178
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:27
Principle Modified Functions .
Definition: BasisType.h:49
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
void GetFaceToElementMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int nummodesA=-1, int nummodesB=-1)
Definition: StdExpansion.h:860
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:227
boost::shared_ptr< StdExpansion > GetLinStdExp(void) const
Definition: StdExpansion.h:481
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
Definition: StdExpansion.h:165
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:259
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:354
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:176
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:131
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:814
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:253
DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_BuildInverseTransformationMatrix ( const DNekScalMatSharedPtr m_transformationmatrix)
protectedvirtual

Build inverse and inverse transposed transformation matrix: $\mathbf{R^{-1}}$ and $\mathbf{R^{-T}}$.

{R^{-T}}=[[{array}{ccc} {I} & -{R}_{ef} & -{R}_{ve}+{R}_{ve}{R}_{vf} \ 0 & {I} & {R}_{ef} \ 0 & 0 & {I}} {array}]]

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1719 of file Expansion3D.cpp.

References Nektar::eFULL, and Vmath::Vcopy().

1721  {
1722  int i, j, n, eid = 0, fid = 0;
1723  int nCoeffs = NumBndryCoeffs();
1724  NekDouble MatrixValue;
1725  DNekScalMat &R = (*m_transformationmatrix);
1726 
1727  // Define storage for vertex transpose matrix and zero all entries
1728  MatrixStorage storage = eFULL;
1729 
1730  // Inverse transformation matrix
1731  DNekMatSharedPtr m_inversetransformationmatrix =
1733  nCoeffs, nCoeffs, 0.0, storage);
1734  DNekMat &InvR = (*m_inversetransformationmatrix);
1735 
1736  int nVerts = GetNverts();
1737  int nEdges = GetNedges();
1738  int nFaces = GetNfaces();
1739 
1740  int nedgemodes = 0;
1741  int nfacemodes = 0;
1742  int nedgemodestotal = 0;
1743  int nfacemodestotal = 0;
1744 
1745  for (eid = 0; eid < nEdges; ++eid)
1746  {
1747  nedgemodes = GetEdgeNcoeffs(eid) - 2;
1748  nedgemodestotal += nedgemodes;
1749  }
1750 
1751  for (fid = 0; fid < nFaces; ++fid)
1752  {
1753  nfacemodes = GetFaceIntNcoeffs(fid);
1754  nfacemodestotal += nfacemodes;
1755  }
1756 
1757  Array<OneD, unsigned int>
1758  edgemodearray(nedgemodestotal);
1759  Array<OneD, unsigned int>
1760  facemodearray(nfacemodestotal);
1761 
1762  int offset = 0;
1763 
1764  // Create array of edge modes
1765  for (eid = 0; eid < nEdges; ++eid)
1766  {
1767  Array<OneD, unsigned int> edgearray
1769  nedgemodes = GetEdgeNcoeffs(eid) - 2;
1770 
1771  // Only copy if there are edge modes
1772  if (nedgemodes)
1773  {
1774  Vmath::Vcopy(nedgemodes, &edgearray[0], 1,
1775  &edgemodearray[offset], 1);
1776  }
1777 
1778  offset += nedgemodes;
1779  }
1780 
1781  offset = 0;
1782 
1783  // Create array of face modes
1784  for (fid = 0; fid < nFaces; ++fid)
1785  {
1786  Array<OneD, unsigned int> facearray
1788  nfacemodes = GetFaceIntNcoeffs(fid);
1789 
1790  // Only copy if there are face modes
1791  if (nfacemodes)
1792  {
1793  Vmath::Vcopy(nfacemodes, &facearray[0], 1,
1794  &facemodearray[offset], 1);
1795  }
1796 
1797  offset += nfacemodes;
1798  }
1799 
1800  // Vertex-edge/face
1801  for (i = 0; i < nVerts; ++i)
1802  {
1803  for (j = 0; j < nedgemodestotal; ++j)
1804  {
1805  InvR.SetValue(
1806  GetVertexMap(i), edgemodearray[j],
1807  -R(GetVertexMap(i), edgemodearray[j]));
1808  }
1809  for (j = 0; j < nfacemodestotal; ++j)
1810  {
1811  InvR.SetValue(
1812  GetVertexMap(i), facemodearray[j],
1813  -R(GetVertexMap(i), facemodearray[j]));
1814  for (n = 0; n < nedgemodestotal; ++n)
1815  {
1816  MatrixValue = InvR.GetValue(GetVertexMap(i),
1817  facemodearray[j])
1818  + R(GetVertexMap(i), edgemodearray[n])
1819  * R(edgemodearray[n], facemodearray[j]);
1820  InvR.SetValue(GetVertexMap(i),
1821  facemodearray[j],
1822  MatrixValue);
1823  }
1824  }
1825  }
1826 
1827  // Edge-face contributions
1828  for (i = 0; i < nedgemodestotal; ++i)
1829  {
1830  for (j = 0; j < nfacemodestotal; ++j)
1831  {
1832  InvR.SetValue(
1833  edgemodearray[i], facemodearray[j],
1834  -R(edgemodearray[i], facemodearray[j]));
1835  }
1836  }
1837 
1838  for (i = 0; i < nCoeffs; ++i)
1839  {
1840  InvR.SetValue(i, i, 1.0);
1841  }
1842 
1843  return m_inversetransformationmatrix;
1844  }
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, unsigned int > GetFaceInverseBoundaryMap(int fid, StdRegions::Orientation faceOrient=eNoOrientation)
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:287
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
Array< OneD, unsigned int > GetEdgeInverseBoundaryMap(int eid)
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:824
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:359
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:52
double NekDouble
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:259
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:272
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_BuildTransformationMatrix ( const DNekScalMatSharedPtr r_bnd,
const StdRegions::MatrixType  matrixType 
)
protectedvirtual

The matrix component of $\mathbf{R}$ is given by

\[ \mathbf{R^{T}_{v}}= -\mathbf{S}^{-1}_{ef,ef}\mathbf{S}^{T}_{v,ef}\]

For every vertex mode we extract the submatrices from statically condensed matrix $\mathbf{S}$ corresponding to the coupling between the attached edges and faces of a vertex ( $\mathbf{S_{ef,ef}}$). This matrix is then inverted and multiplied by the submatrix representing the coupling between a vertex and the attached edges and faces ( $\mathbf{S_{v,ef}}$).

Reimplemented from Nektar::LocalRegions::Expansion.

Definition at line 1296 of file Expansion3D.cpp.

References ErrorUtil::efatal, Nektar::eFULL, Nektar::StdRegions::ePreconR, Nektar::StdRegions::ePreconRMass, Nektar::StdRegions::ePreconRT, Nektar::StdRegions::ePreconRTMass, NEKERROR, Nektar::NullDNekMatSharedPtr, and Vmath::Vcopy().

1299  {
1300  int nVerts, nEdges;
1301  int eid, fid, vid, n, i;
1302 
1303  int nBndCoeffs = NumBndryCoeffs();
1304 
1306 
1307  // Get geometric information about this element
1308  nVerts = GetNverts();
1309  nEdges = GetNedges();
1310 
1311  /*************************************/
1312  /* Vetex-edge & vertex-face matrices */
1313  /*************************************/
1314 
1315  /**
1316  * The matrix component of \f$\mathbf{R}\f$ is given by \f[
1317  * \mathbf{R^{T}_{v}}=
1318  * -\mathbf{S}^{-1}_{ef,ef}\mathbf{S}^{T}_{v,ef}\f]
1319  *
1320  * For every vertex mode we extract the submatrices from statically
1321  * condensed matrix \f$\mathbf{S}\f$ corresponding to the coupling
1322  * between the attached edges and faces of a vertex
1323  * (\f$\mathbf{S_{ef,ef}}\f$). This matrix is then inverted and
1324  * multiplied by the submatrix representing the coupling between a
1325  * vertex and the attached edges and faces
1326  * (\f$\mathbf{S_{v,ef}}\f$).
1327  */
1328 
1329  int nmodes;
1330  int m;
1331  NekDouble VertexEdgeFaceValue;
1332 
1333  // The number of connected edges/faces is 3 (for all elements)
1334  int nConnectedEdges = 3;
1335  int nConnectedFaces = 3;
1336 
1337  // Location in the matrix
1338  Array<OneD, Array<OneD, unsigned int> >
1339  MatEdgeLocation(nConnectedEdges);
1340  Array<OneD, Array<OneD, unsigned int> >
1341  MatFaceLocation(nConnectedFaces);
1342 
1343  // Define storage for vertex transpose matrix and zero all entries
1344  MatrixStorage storage = eFULL;
1345  DNekMatSharedPtr m_transformationmatrix;
1346  DNekMatSharedPtr m_transposedtransformationmatrix;
1347 
1348  m_transformationmatrix =
1350  nBndCoeffs, nBndCoeffs, 0.0, storage);
1351  m_transposedtransformationmatrix =
1353  nBndCoeffs, nBndCoeffs, 0.0, storage);
1354 
1355  DNekMat &R = (*m_transformationmatrix);
1356  DNekMat &RT = (*m_transposedtransformationmatrix);
1357 
1358  // Build the vertex-edge/face transform matrix: This matrix is
1359  // constructed from the submatrices corresponding to the couping
1360  // between each vertex and the attached edges/faces
1361  for (vid = 0; vid < nVerts; ++vid)
1362  {
1363  // Row and column size of the vertex-edge/face matrix
1364  int efRow =
1365  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1366  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1367  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) +
1368  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1369  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1370  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2)) - 6;
1371 
1372  int nedgemodesconnected =
1373  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1374  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1375  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) - 6;
1376  Array<OneD, unsigned int> edgemodearray(nedgemodesconnected);
1377 
1378  int nfacemodesconnected =
1379  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1380  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1381  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2));
1382  Array<OneD, unsigned int> facemodearray(nfacemodesconnected);
1383 
1384  int offset = 0;
1385 
1386  // Create array of edge modes
1387  for (eid = 0; eid < nConnectedEdges; ++eid)
1388  {
1389  MatEdgeLocation[eid] = GetEdgeInverseBoundaryMap(
1390  geom->GetVertexEdgeMap(vid, eid));
1391  nmodes = MatEdgeLocation[eid].num_elements();
1392 
1393  if (nmodes)
1394  {
1395  Vmath::Vcopy(nmodes, &MatEdgeLocation[eid][0],
1396  1, &edgemodearray[offset], 1);
1397  }
1398 
1399  offset += nmodes;
1400  }
1401 
1402  offset = 0;
1403 
1404  // Create array of face modes
1405  for (fid = 0; fid < nConnectedFaces; ++fid)
1406  {
1407  MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1408  geom->GetVertexFaceMap(vid, fid));
1409  nmodes = MatFaceLocation[fid].num_elements();
1410 
1411  if (nmodes)
1412  {
1413  Vmath::Vcopy(nmodes, &MatFaceLocation[fid][0],
1414  1, &facemodearray[offset], 1);
1415  }
1416  offset += nmodes;
1417  }
1418 
1419  DNekMatSharedPtr m_vertexedgefacetransformmatrix =
1421  1, efRow, 0.0, storage);
1422  DNekMat &Sveft = (*m_vertexedgefacetransformmatrix);
1423 
1424  DNekMatSharedPtr m_vertexedgefacecoupling =
1426  1, efRow, 0.0, storage);
1427  DNekMat &Svef = (*m_vertexedgefacecoupling);
1428 
1429  // Vertex-edge coupling
1430  for (n = 0; n < nedgemodesconnected; ++n)
1431  {
1432  // Matrix value for each coefficient location
1433  VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1434  edgemodearray[n]);
1435 
1436  // Set the value in the vertex edge/face matrix
1437  Svef.SetValue(0, n, VertexEdgeFaceValue);
1438  }
1439 
1440  // Vertex-face coupling
1441  for (n = 0; n < nfacemodesconnected; ++n)
1442  {
1443  // Matrix value for each coefficient location
1444  VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1445  facemodearray[n]);
1446 
1447  // Set the value in the vertex edge/face matrix
1448  Svef.SetValue(0, n + nedgemodesconnected, VertexEdgeFaceValue);
1449  }
1450 
1451  /*
1452  * Build the edge-face transform matrix: This matrix is
1453  * constructed from the submatrices corresponding to the couping
1454  * between the edges and faces on the attached faces/edges of a
1455  * vertex.
1456  */
1457 
1458  // Allocation of matrix to store edge/face-edge/face coupling
1459  DNekMatSharedPtr m_edgefacecoupling =
1461  efRow, efRow, 0.0, storage);
1462  DNekMat &Sefef = (*m_edgefacecoupling);
1463 
1464  NekDouble EdgeEdgeValue, FaceFaceValue;
1465 
1466  // Edge-edge coupling (S_{ee})
1467  for (m = 0; m < nedgemodesconnected; ++m)
1468  {
1469  for (n = 0; n < nedgemodesconnected; ++n)
1470  {
1471  // Matrix value for each coefficient location
1472  EdgeEdgeValue = (*r_bnd)(edgemodearray[n],
1473  edgemodearray[m]);
1474 
1475  // Set the value in the vertex edge/face matrix
1476  Sefef.SetValue(n, m, EdgeEdgeValue);
1477  }
1478  }
1479 
1480  // Face-face coupling (S_{ff})
1481  for (n = 0; n < nfacemodesconnected; ++n)
1482  {
1483  for (m = 0; m < nfacemodesconnected; ++m)
1484  {
1485  // Matrix value for each coefficient location
1486  FaceFaceValue = (*r_bnd)(facemodearray[n],
1487  facemodearray[m]);
1488  // Set the value in the vertex edge/face matrix
1489  Sefef.SetValue(nedgemodesconnected + n,
1490  nedgemodesconnected + m, FaceFaceValue);
1491  }
1492  }
1493 
1494  // Edge-face coupling (S_{ef} and trans(S_{ef}))
1495  for (n = 0; n < nedgemodesconnected; ++n)
1496  {
1497  for (m = 0; m < nfacemodesconnected; ++m)
1498  {
1499  // Matrix value for each coefficient location
1500  FaceFaceValue = (*r_bnd)(edgemodearray[n],
1501  facemodearray[m]);
1502 
1503  // Set the value in the vertex edge/face matrix
1504  Sefef.SetValue(n,
1505  nedgemodesconnected + m,
1506  FaceFaceValue);
1507 
1508  // and transpose
1509  Sefef.SetValue(nedgemodesconnected + m,
1510  n,
1511  FaceFaceValue);
1512  }
1513  }
1514 
1515 
1516  // Invert edge-face coupling matrix
1517  if (efRow)
1518  {
1519  Sefef.Invert();
1520 
1521  //R_{v}=-S_{v,ef}inv(S_{ef,ef})
1522  Sveft = -Svef * Sefef;
1523  }
1524 
1525  // Populate R with R_{ve} components
1526  for (n = 0; n < edgemodearray.num_elements(); ++n)
1527  {
1528  RT.SetValue(edgemodearray[n], GetVertexMap(vid),
1529  Sveft(0, n));
1530  R.SetValue(GetVertexMap(vid), edgemodearray[n],
1531  Sveft(0, n));
1532  }
1533 
1534  // Populate R with R_{vf} components
1535  for (n = 0; n < facemodearray.num_elements(); ++n)
1536  {
1537  RT.SetValue(facemodearray[n], GetVertexMap(vid),
1538  Sveft(0, n + nedgemodesconnected));
1539  R.SetValue(GetVertexMap(vid), facemodearray[n],
1540  Sveft(0, n + nedgemodesconnected));
1541  }
1542  }
1543 
1544  /********************/
1545  /* edge-face matrix */
1546  /********************/
1547 
1548  /*
1549  * The matrix component of \f$\mathbf{R}\f$ is given by \f[
1550  * \mathbf{R^{T}_{ef}}=-\mathbf{S}^{-1}_{ff}\mathbf{S}^{T}_{ef}\f]
1551  *
1552  * For each edge extract the submatrices from statically condensed
1553  * matrix \f$\mathbf{S}\f$ corresponding to inner products of modes
1554  * on the two attached faces within themselves as well as the
1555  * coupling matrix between the two faces
1556  * (\f$\mathbf{S}_{ff}\f$). This matrix of face coupling is then
1557  * inverted and multiplied by the submatrices of corresponding to
1558  * the coupling between the edge and attached faces
1559  * (\f$\mathbf{S}_{ef}\f$).
1560  */
1561 
1562  NekDouble EdgeFaceValue, FaceFaceValue;
1563  int efCol, efRow, nedgemodes;
1564 
1565  // Number of attached faces is always 2
1566  nConnectedFaces = 2;
1567 
1568  // Location in the matrix
1569  MatEdgeLocation = Array<OneD, Array<OneD, unsigned int> >
1570  (nEdges);
1571  MatFaceLocation = Array<OneD, Array<OneD, unsigned int> >
1572  (nConnectedFaces);
1573 
1574  // Build the edge/face transform matrix: This matrix is constructed
1575  // from the submatrices corresponding to the couping between a
1576  // specific edge and the two attached faces.
1577  for (eid = 0; eid < nEdges; ++eid)
1578  {
1579  // Row and column size of the vertex-edge/face matrix
1580  efCol = GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1581  GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1582  efRow = GetEdgeNcoeffs(eid) - 2;
1583 
1584  // Edge-face coupling matrix
1585  DNekMatSharedPtr m_efedgefacecoupling =
1587  efRow, efCol, 0.0, storage);
1588  DNekMat &Mef = (*m_efedgefacecoupling);
1589 
1590  // Face-face coupling matrix
1591  DNekMatSharedPtr m_effacefacecoupling =
1593  efCol, efCol, 0.0, storage);
1594  DNekMat &Meff = (*m_effacefacecoupling);
1595 
1596  // Edge-face transformation matrix
1597  DNekMatSharedPtr m_edgefacetransformmatrix =
1599  efRow, efCol, 0.0, storage);
1600  DNekMat &Meft = (*m_edgefacetransformmatrix);
1601 
1602  int nfacemodesconnected =
1603  GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1604  GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1605  Array<OneD, unsigned int>
1606  facemodearray(nfacemodesconnected);
1607 
1608  // Create array of edge modes
1609  Array<OneD, unsigned int> inedgearray
1611  nedgemodes = GetEdgeNcoeffs(eid) - 2;
1612  Array<OneD, unsigned int> edgemodearray(nedgemodes);
1613 
1614  if (nedgemodes)
1615  {
1616  Vmath::Vcopy(nedgemodes, &inedgearray[0],
1617  1, &edgemodearray[0], 1);
1618  }
1619 
1620  int offset = 0;
1621 
1622  // Create array of face modes
1623  for (fid = 0; fid < nConnectedFaces; ++fid)
1624  {
1625  MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1626  geom->GetEdgeFaceMap(eid, fid));
1627  nmodes = MatFaceLocation[fid].num_elements();
1628 
1629  if (nmodes)
1630  {
1631  Vmath::Vcopy(nmodes, &MatFaceLocation[fid][0],
1632  1, &facemodearray[offset], 1);
1633  }
1634  offset += nmodes;
1635  }
1636 
1637  // Edge-face coupling
1638  for (n = 0; n < nedgemodes; ++n)
1639  {
1640  for (m = 0; m < nfacemodesconnected; ++m)
1641  {
1642  // Matrix value for each coefficient location
1643  EdgeFaceValue = (*r_bnd)(edgemodearray[n],
1644  facemodearray[m]);
1645 
1646  // Set the value in the edge/face matrix
1647  Mef.SetValue(n, m, EdgeFaceValue);
1648  }
1649  }
1650 
1651  // Face-face coupling
1652  for (n = 0; n < nfacemodesconnected; ++n)
1653  {
1654  for (m = 0; m < nfacemodesconnected; ++m)
1655  {
1656  // Matrix value for each coefficient location
1657  FaceFaceValue = (*r_bnd)(facemodearray[n],
1658  facemodearray[m]);
1659 
1660  // Set the value in the vertex edge/face matrix
1661  Meff.SetValue(n, m, FaceFaceValue);
1662  }
1663  }
1664 
1665  if (efCol)
1666  {
1667  // Invert edge-face coupling matrix
1668  Meff.Invert();
1669 
1670  // trans(R_{ef})=-S_{ef}*(inv(S_{ff})
1671  Meft = -Mef * Meff;
1672  }
1673 
1674  //Populate transformation matrix with Meft
1675  for (n = 0; n < Meft.GetRows(); ++n)
1676  {
1677  for (m = 0; m < Meft.GetColumns(); ++m)
1678  {
1679  R.SetValue(edgemodearray[n], facemodearray[m],
1680  Meft(n, m));
1681  RT.SetValue(facemodearray[m], edgemodearray[n],
1682  Meft(n, m));
1683  }
1684  }
1685  }
1686 
1687  for (i = 0; i < R.GetRows(); ++i)
1688  {
1689  R.SetValue(i, i, 1.0);
1690  RT.SetValue(i, i, 1.0);
1691  }
1692 
1693  if ((matrixType == StdRegions::ePreconR)||
1694  (matrixType == StdRegions::ePreconRMass))
1695  {
1696  return m_transformationmatrix;
1697  }
1698  else if ((matrixType == StdRegions::ePreconRT)||
1699  (matrixType == StdRegions::ePreconRTMass))
1700  {
1701  return m_transposedtransformationmatrix;
1702  }
1703  else
1704  {
1705  NEKERROR(ErrorUtil::efatal, "unkown matrix type" );
1706  return NullDNekMatSharedPtr;
1707  }
1708  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:191
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, unsigned int > GetFaceInverseBoundaryMap(int fid, StdRegions::Orientation faceOrient=eNoOrientation)
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:180
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:287
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
static DNekMatSharedPtr NullDNekMatSharedPtr
Definition: NekTypeDefs.hpp:79
Array< OneD, unsigned int > GetEdgeInverseBoundaryMap(int eid)
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:824
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:359
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:52
double NekDouble
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:259
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:272
boost::shared_ptr< Geometry3D > Geometry3DSharedPtr
Definition: Geometry3D.h:52
DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_BuildVertexMatrix ( const DNekScalMatSharedPtr r_bnd)
protectedvirtual

Reimplemented from Nektar::LocalRegions::Expansion.

Definition at line 1265 of file Expansion3D.cpp.

References Nektar::eFULL.

1267  {
1268  MatrixStorage storage = eFULL;
1269  DNekMatSharedPtr m_vertexmatrix;
1270 
1271  int nVerts, vid1, vid2, vMap1, vMap2;
1272  NekDouble VertexValue;
1273 
1274  nVerts = GetNverts();
1275 
1276  m_vertexmatrix =
1278  nVerts, nVerts, 0.0, storage);
1279  DNekMat &VertexMat = (*m_vertexmatrix);
1280 
1281  for (vid1 = 0; vid1 < nVerts; ++vid1)
1282  {
1283  vMap1 = GetVertexMap(vid1,true);
1284 
1285  for (vid2 = 0; vid2 < nVerts; ++vid2)
1286  {
1287  vMap2 = GetVertexMap(vid2,true);
1288  VertexValue = (*r_bnd)(vMap1, vMap2);
1289  VertexMat.SetValue(vid1, vid2, VertexValue);
1290  }
1291  }
1292 
1293  return m_vertexmatrix;
1294  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:824
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:52
double NekDouble
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:259
void Nektar::LocalRegions::Expansion3D::v_DGDeriv ( const int  dir,
const Array< OneD, const NekDouble > &  incoeffs,
Array< OneD, ExpansionSharedPtr > &  FaceExp,
Array< OneD, Array< OneD, NekDouble > > &  faceCoeffs,
Array< OneD, NekDouble > &  out_d 
)
protectedvirtual

Evaluate coefficients of weak deriviative in the direction dir given the input coefficicents incoeffs and the imposed boundary values in EdgeExp (which will have its phys space updated).

Reimplemented from Nektar::LocalRegions::Expansion.

Definition at line 1067 of file Expansion3D.cpp.

References Nektar::StdRegions::eInvMass, Nektar::StdRegions::eWeakDeriv0, Nektar::StdRegions::eWeakDeriv1, Nektar::StdRegions::eWeakDeriv2, Nektar::eWrapper, Vmath::Neg(), and Nektar::Transpose().

1073  {
1074  int ncoeffs = GetNcoeffs();
1078 
1080  DNekScalMat &Dmat = *GetLocMatrix(DerivType[dir]);
1081 
1082  Array<OneD, NekDouble> coeffs = incoeffs;
1083  DNekVec Coeffs (ncoeffs,coeffs, eWrapper);
1084 
1085  Coeffs = Transpose(Dmat)*Coeffs;
1086  Vmath::Neg(ncoeffs, coeffs,1);
1087 
1088  // Add the boundary integral including the relevant part of
1089  // the normal
1090  AddNormTraceInt(dir, FaceExp, faceCoeffs, coeffs);
1091 
1092  DNekVec Out_d (ncoeffs,out_d,eWrapper);
1093 
1094  Out_d = InvMass*Coeffs;
1095  }
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:396
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &outarray)
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:85
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:49
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:131
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_GenMatrix ( const StdRegions::StdMatrixKey mkey)
protectedvirtual

Computes matrices needed for the HDG formulation. References to equations relate to the following paper (with a suitable changes in formulation to adapt to 3D): R. M. Kirby, S. J. Sherwin, B. Cockburn, To CG or to HDG: A Comparative Study, J. Sci. Comp P1-30 DOI 10.1007/s10915-011-9501-7 NOTE: VARIABLE COEFFICIENTS CASE IS NOT IMPLEMENTED

Reimplemented from Nektar::StdRegions::StdExpansion.

Reimplemented in Nektar::LocalRegions::HexExp, Nektar::LocalRegions::PrismExp, Nektar::LocalRegions::TetExp, and Nektar::LocalRegions::PyrExp.

Definition at line 383 of file Expansion3D.cpp.

References ASSERTL0, ASSERTL1, Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eFactorLambda, Nektar::StdRegions::eFactorTau, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::StdRegions::eHybridDGHelmholtz, Nektar::StdRegions::eHybridDGLamToQ0, Nektar::StdRegions::eHybridDGLamToQ1, Nektar::StdRegions::eHybridDGLamToQ2, Nektar::StdRegions::eHybridDGLamToU, Nektar::StdRegions::eInvHybridDGHelmholtz, Nektar::StdRegions::eInvLaplacianWithUnityMean, Nektar::StdRegions::eInvMass, Nektar::StdRegions::eLaplacian, Nektar::StdRegions::eMass, Nektar::StdRegions::eVarCoeffD00, Nektar::StdRegions::eWeakDeriv0, Nektar::StdRegions::eWeakDeriv1, Nektar::StdRegions::eWeakDeriv2, Nektar::eWrapper, Vmath::Fill(), Nektar::StdRegions::StdMatrixKey::GetConstFactor(), Nektar::StdRegions::StdMatrixKey::GetConstFactors(), Nektar::StdRegions::StdMatrixKey::GetMatrixType(), Nektar::StdRegions::StdMatrixKey::GetVarCoeffs(), Nektar::StdRegions::StdMatrixKey::HasVarCoeff(), Vmath::Neg(), sign, Vmath::Svtvp(), Nektar::Transpose(), Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by Nektar::LocalRegions::PyrExp::v_GenMatrix(), Nektar::LocalRegions::TetExp::v_GenMatrix(), Nektar::LocalRegions::PrismExp::v_GenMatrix(), and Nektar::LocalRegions::HexExp::v_GenMatrix().

384  {
385  //Variable coefficients are not implemented/////////
386  ASSERTL1(!mkey.HasVarCoeff(StdRegions::eVarCoeffD00),
387  "Matrix construction is not implemented for variable "
388  "coefficients at the moment");
389  ////////////////////////////////////////////////////
390 
391  DNekMatSharedPtr returnval;
392 
393  switch(mkey.GetMatrixType())
394  {
395  // (Z^e)^{-1} (Eqn. 33, P22)
397  {
399  "HybridDGHelmholtz matrix not set up "
400  "for non boundary-interior expansions");
401 
402  int i,j,k;
403  NekDouble lambdaval = mkey.GetConstFactor(StdRegions::eFactorLambda);
404  NekDouble tau = mkey.GetConstFactor(StdRegions::eFactorTau);
405  int ncoeffs = GetNcoeffs();
406  int nfaces = GetNfaces();
407 
408  Array<OneD,unsigned int> fmap;
409  Array<OneD,int> sign;
410  ExpansionSharedPtr FaceExp;
411  ExpansionSharedPtr FaceExp2;
412 
413  int order_f, coordim = GetCoordim();
418 
419  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(ncoeffs,ncoeffs);
420  DNekMat &Mat = *returnval;
421  Vmath::Zero(ncoeffs*ncoeffs,Mat.GetPtr(),1);
422 
423  // StdRegions::VarCoeffType Coeffs[3] = {StdRegions::eVarCoeffD00,
424  // StdRegions::eVarCoeffD11,
425  // StdRegions::eVarCoeffD22};
426 
427  for(i=0; i < coordim; ++i)
428  {
429  DNekScalMat &Dmat = *GetLocMatrix(DerivType[i]);
430  Mat = Mat + Dmat*invMass*Transpose(Dmat);
431 
432  /*
433  if(mkey.HasVarCoeff(Coeffs[i]))
434  {
435  MatrixKey DmatkeyL(DerivType[i], DetExpansionType(), *this,
436  StdRegions::NullConstFactorMap,
437  mkey.GetVarCoeffAsMap(Coeffs[i]));
438  MatrixKey DmatkeyR(DerivType[i], DetExpansionType(), *this);
439 
440  DNekScalMat &DmatL = *GetLocMatrix(DmatkeyL);
441  DNekScalMat &DmatR = *GetLocMatrix(DmatkeyR);
442  Mat = Mat + DmatL*invMass*Transpose(DmatR);
443  }
444  else
445  {
446  DNekScalMat &Dmat = *GetLocMatrix(DerivType[i]);
447  Mat = Mat + Dmat*invMass*Transpose(Dmat);
448  }
449  */
450  }
451 
452  // Add Mass Matrix Contribution for Helmholtz problem
454  Mat = Mat + lambdaval*Mass;
455 
456  // Add tau*E_l using elemental mass matrices on each edge
457  for(i = 0; i < nfaces; ++i)
458  {
459  FaceExp = GetFaceExp(i);
460  order_f = FaceExp->GetNcoeffs();
461  StdRegions::IndexMapKey ikey(
464  GetBasisNumModes(2), i, GetForient(i));
466  StdExpansion::GetIndexMap(ikey);
467 
468  // @TODO: Document
469  /*
470  StdRegions::VarCoeffMap edgeVarCoeffs;
471  if (mkey.HasVarCoeff(StdRegions::eVarCoeffD00))
472  {
473  Array<OneD, NekDouble> mu(nq);
474  GetPhysEdgeVarCoeffsFromElement(
475  i, EdgeExp2,
476  mkey.GetVarCoeff(StdRegions::eVarCoeffD00), mu);
477  edgeVarCoeffs[StdRegions::eVarCoeffMass] = mu;
478  }
479  DNekScalMat &eMass = *EdgeExp->GetLocMatrix(
480  StdRegions::eMass,
481  StdRegions::NullConstFactorMap, edgeVarCoeffs);
482  */
483 
484  DNekScalMat &eMass = *FaceExp->GetLocMatrix(StdRegions::eMass);
485 
486  for(j = 0; j < order_f; ++j)
487  {
488  for(k = 0; k < order_f; ++k)
489  {
490  Mat((*map)[j].index,(*map)[k].index) +=
491  tau*(*map)[j].sign*(*map)[k].sign*eMass(j,k);
492  }
493  }
494  }
495  break;
496  }
497 
498  // U^e (P22)
500  {
501  int i,j,k;
502  int nbndry = NumDGBndryCoeffs();
503  int ncoeffs = GetNcoeffs();
504  int nfaces = GetNfaces();
505  NekDouble tau = mkey.GetConstFactor(StdRegions::eFactorTau);
506 
507  Array<OneD,NekDouble> lambda(nbndry);
508  DNekVec Lambda(nbndry,lambda,eWrapper);
509  Array<OneD,NekDouble> ulam(ncoeffs);
510  DNekVec Ulam(ncoeffs,ulam,eWrapper);
511  Array<OneD,NekDouble> f(ncoeffs);
512  DNekVec F(ncoeffs,f,eWrapper);
513 
514  ExpansionSharedPtr FaceExp;
515  // declare matrix space
516  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(ncoeffs,nbndry);
517  DNekMat &Umat = *returnval;
518 
519  // Z^e matrix
520  MatrixKey newkey(StdRegions::eInvHybridDGHelmholtz, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
521  DNekScalMat &invHmat = *GetLocMatrix(newkey);
522 
523  Array<OneD,unsigned int> fmap;
524  Array<OneD,int> sign;
525 
526  //alternative way to add boundary terms contribution
527  int bndry_cnt = 0;
528  for(i = 0; i < nfaces; ++i)
529  {
530  FaceExp = GetFaceExp(i);//temporary, need to rewrite AddHDGHelmholtzFaceTerms
531  int nface = GetFaceNcoeffs(i);
532  Array<OneD, NekDouble> face_lambda(nface);
533 
534  const Array<OneD, const Array<OneD, NekDouble> > normals
535  = GetFaceNormal(i);
536 
537  for(j = 0; j < nface; ++j)
538  {
539  Vmath::Zero(nface,&face_lambda[0],1);
540  Vmath::Zero(ncoeffs,&f[0],1);
541  face_lambda[j] = 1.0;
542 
543  SetFaceToGeomOrientation(i, face_lambda);
544 
545  Array<OneD, NekDouble> tmp(FaceExp->GetTotPoints());
546  FaceExp->BwdTrans(face_lambda, tmp);
547  AddHDGHelmholtzFaceTerms(tau, i, tmp, mkey.GetVarCoeffs(), f);
548 
549  Ulam = invHmat*F; // generate Ulam from lambda
550 
551  // fill column of matrix
552  for(k = 0; k < ncoeffs; ++k)
553  {
554  Umat(k,bndry_cnt) = Ulam[k];
555  }
556 
557  ++bndry_cnt;
558  }
559  }
560 
561  //// Set up face expansions from local geom info
562  //for(i = 0; i < nfaces; ++i)
563  //{
564  // FaceExp[i] = GetFaceExp(i);
565  //}
566  //
567  //// for each degree of freedom of the lambda space
568  //// calculate Umat entry
569  //// Generate Lambda to U_lambda matrix
570  //for(j = 0; j < nbndry; ++j)
571  //{
572  // // standard basis vectors e_j
573  // Vmath::Zero(nbndry,&lambda[0],1);
574  // Vmath::Zero(ncoeffs,&f[0],1);
575  // lambda[j] = 1.0;
576  //
577  // //cout << Lambda;
578  // SetTraceToGeomOrientation(lambda);
579  // //cout << Lambda << endl;
580  //
581  // // Compute F = [I D_1 M^{-1} D_2 M^{-1}] C e_j
582  // AddHDGHelmholtzTraceTerms(tau, lambda, FaceExp, mkey.GetVarCoeffs(), f);
583  //
584  // // Compute U^e_j
585  // Ulam = invHmat*F; // generate Ulam from lambda
586  //
587  // // fill column of matrix
588  // for(k = 0; k < ncoeffs; ++k)
589  // {
590  // Umat(k,j) = Ulam[k];
591  // }
592  //}
593  }
594  break;
595  // Q_0, Q_1, Q_2 matrices (P23)
596  // Each are a product of a row of Eqn 32 with the C matrix.
597  // Rather than explicitly computing all of Eqn 32, we note each
598  // row is almost a multiple of U^e, so use that as our starting
599  // point.
603  {
604  int i,j,k,dir;
605  int nbndry = NumDGBndryCoeffs();
606  //int nquad = GetNumPoints(0);
607  int ncoeffs = GetNcoeffs();
608  int nfaces = GetNfaces();
609 
610  Array<OneD,NekDouble> lambda(nbndry);
611  DNekVec Lambda(nbndry,lambda,eWrapper);
612  Array<OneD, ExpansionSharedPtr> FaceExp(nfaces);
613 
614  Array<OneD,NekDouble> ulam(ncoeffs);
615  DNekVec Ulam(ncoeffs,ulam,eWrapper);
616  Array<OneD,NekDouble> f(ncoeffs);
617  DNekVec F(ncoeffs,f,eWrapper);
618 
619  // declare matrix space
620  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(ncoeffs,nbndry);
621  DNekMat &Qmat = *returnval;
622 
623  // Lambda to U matrix
624  MatrixKey lamToUkey(StdRegions::eHybridDGLamToU, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
625  DNekScalMat &lamToU = *GetLocMatrix(lamToUkey);
626 
627  // Inverse mass matrix
629 
630  for(i = 0; i < nfaces; ++i)
631  {
632  FaceExp[i] = GetFaceExp(i);
633  }
634 
635  //Weak Derivative matrix
637  switch(mkey.GetMatrixType())
638  {
640  dir = 0;
642  break;
644  dir = 1;
646  break;
648  dir = 2;
650  break;
651  default:
652  ASSERTL0(false,"Direction not known");
653  break;
654  }
655 
656  // for each degree of freedom of the lambda space
657  // calculate Qmat entry
658  // Generate Lambda to Q_lambda matrix
659  for(j = 0; j < nbndry; ++j)
660  {
661  Vmath::Zero(nbndry,&lambda[0],1);
662  lambda[j] = 1.0;
663 
664  // for lambda[j] = 1 this is the solution to ulam
665  for(k = 0; k < ncoeffs; ++k)
666  {
667  Ulam[k] = lamToU(k,j);
668  }
669 
670  // -D^T ulam
671  Vmath::Neg(ncoeffs,&ulam[0],1);
672  F = Transpose(*Dmat)*Ulam;
673 
675 
676  // Add the C terms resulting from the I's on the
677  // diagonals of Eqn 32
678  AddNormTraceInt(dir,lambda,FaceExp,f,mkey.GetVarCoeffs());
679 
680  // finally multiply by inverse mass matrix
681  Ulam = invMass*F;
682 
683  // fill column of matrix (Qmat is in column major format)
684  Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
685  }
686  }
687  break;
688  // Matrix K (P23)
690  {
691  int i,j,f,cnt;
692  int order_f, nquad_f;
693  int nbndry = NumDGBndryCoeffs();
694  int nfaces = GetNfaces();
695  NekDouble tau = mkey.GetConstFactor(StdRegions::eFactorTau);
696 
697  Array<OneD,NekDouble> work, varcoeff_work;
698  Array<OneD,const Array<OneD, NekDouble> > normals;
699  Array<OneD, ExpansionSharedPtr> FaceExp(nfaces);
700  Array<OneD, NekDouble> lam(nbndry);
701 
702  Array<OneD,unsigned int> fmap;
703  Array<OneD, int> sign;
704 
705  // declare matrix space
706  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(nbndry, nbndry);
707  DNekMat &BndMat = *returnval;
708 
709  DNekScalMatSharedPtr LamToQ[3];
710 
711  // Matrix to map Lambda to U
712  MatrixKey LamToUkey(StdRegions::eHybridDGLamToU, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
713  DNekScalMat &LamToU = *GetLocMatrix(LamToUkey);
714 
715  // Matrix to map Lambda to Q0
716  MatrixKey LamToQ0key(StdRegions::eHybridDGLamToQ0, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
717  LamToQ[0] = GetLocMatrix(LamToQ0key);
718 
719  // Matrix to map Lambda to Q1
720  MatrixKey LamToQ1key(StdRegions::eHybridDGLamToQ1, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
721  LamToQ[1] = GetLocMatrix(LamToQ1key);
722 
723  // Matrix to map Lambda to Q2
724  MatrixKey LamToQ2key(StdRegions::eHybridDGLamToQ2, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
725  LamToQ[2] = GetLocMatrix(LamToQ2key);
726 
727  // Set up edge segment expansions from local geom info
728  for(i = 0; i < nfaces; ++i)
729  {
730  FaceExp[i] = GetFaceExp(i);
731  }
732 
733  // Set up matrix derived from <mu, Q_lam.n - \tau (U_lam - Lam) >
734  for(i = 0; i < nbndry; ++i)
735  {
736  cnt = 0;
737 
738  Vmath::Zero(nbndry,lam,1);
739  lam[i] = 1.0;
741 
742  for(f = 0; f < nfaces; ++f)
743  {
744  order_f = FaceExp[f]->GetNcoeffs();
745  nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
746  normals = GetFaceNormal(f);
747 
748  work = Array<OneD,NekDouble>(nquad_f);
749  varcoeff_work = Array<OneD, NekDouble>(nquad_f);
750 
751  StdRegions::IndexMapKey ikey(
754  GetBasisNumModes(2), f, GetForient(f));
756  StdExpansion::GetIndexMap(ikey);
757 
758  // @TODO Variable coefficients
759  /*
760  StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
761  StdRegions::eVarCoeffD11,
762  StdRegions::eVarCoeffD22};
763  const StdRegions::VarCoeffMap &varcoeffs = mkey.GetVarCoeffs();
764  StdRegions::VarCoeffMap::const_iterator x;
765  */
766 
767  // Q0 * n0 (BQ_0 terms)
768  Array<OneD, NekDouble> faceCoeffs(order_f);
769  Array<OneD, NekDouble> facePhys (nquad_f);
770  for(j = 0; j < order_f; ++j)
771  {
772  faceCoeffs[j] = (*map)[j].sign*(*LamToQ[0])((*map)[j].index,i);
773  }
774 
775  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
776 
777  // @TODO Variable coefficients
778  // Multiply by variable coefficient
779  /*
780  if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
781  {
782  GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
783  Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
784  }
785  */
786 
787  Vmath::Vmul(nquad_f, normals[0], 1, facePhys, 1, work, 1);
788 
789  // Q1 * n1 (BQ_1 terms)
790  for(j = 0; j < order_f; ++j)
791  {
792  faceCoeffs[j] = (*map)[j].sign*(*LamToQ[1])((*map)[j].index,i);
793  }
794 
795  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
796 
797  // @TODO Variable coefficients
798  // Multiply by variable coefficients
799  /*
800  if ((x = varcoeffs.find(VarCoeff[1])) != varcoeffs.end())
801  {
802  GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
803  Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
804  }
805  */
806 
807  Vmath::Vvtvp(nquad_f, normals[1], 1, facePhys, 1, work, 1, work, 1);
808 
809  // Q2 * n2 (BQ_2 terms)
810  for(j = 0; j < order_f; ++j)
811  {
812  faceCoeffs[j] = (*map)[j].sign*(*LamToQ[2])((*map)[j].index,i);
813  }
814 
815  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
816 
817  // @TODO Variable coefficients
818  // Multiply by variable coefficients
819  /*
820  if ((x = varcoeffs.find(VarCoeff[2])) != varcoeffs.end())
821  {
822  GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
823  Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
824  }
825  */
826 
827  Vmath::Vvtvp(nquad_f, normals[2], 1, facePhys, 1,
828  work, 1, work, 1);
829 
830  if (m_negatedNormals[f])
831  {
832  Vmath::Neg(nquad_f, work, 1);
833  }
834 
835  // - tau (ulam - lam)
836  // Corresponds to the G and BU terms.
837  for(j = 0; j < order_f; ++j)
838  {
839  faceCoeffs[j] = (*map)[j].sign*LamToU((*map)[j].index,i) - lam[cnt+j];
840  }
841 
842  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
843 
844  // @TODO Variable coefficients
845  // Multiply by variable coefficients
846  /*
847  if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
848  {
849  GetPhysEdgeVarCoeffsFromElement(e,FaceExp[f],x->second,varcoeff_work);
850  Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp[f]->GetPhys(),1,FaceExp[f]->UpdatePhys(),1);
851  }
852  */
853 
854  Vmath::Svtvp(nquad_f, -tau, facePhys, 1,
855  work, 1, work, 1);
856 
857  // @TODO Add variable coefficients
858  FaceExp[f]->IProductWRTBase(work, faceCoeffs);
859 
860  SetFaceToGeomOrientation(f, faceCoeffs);
861 
862  for(j = 0; j < order_f; ++j)
863  {
864  BndMat(cnt+j,i) = faceCoeffs[j];
865  }
866 
867  cnt += order_f;
868  }
869  }
870  }
871  break;
872  //HDG postprocessing
874  {
875  MatrixKey lapkey(StdRegions::eLaplacian, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
876  DNekScalMat &LapMat = *GetLocMatrix(lapkey);
877 
878  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(LapMat.GetRows(),LapMat.GetColumns());
879  DNekMatSharedPtr lmat = returnval;
880 
881  (*lmat) = LapMat;
882 
883  // replace first column with inner product wrt 1
884  int nq = GetTotPoints();
885  Array<OneD, NekDouble> tmp(nq);
886  Array<OneD, NekDouble> outarray(m_ncoeffs);
887  Vmath::Fill(nq,1.0,tmp,1);
888  IProductWRTBase(tmp, outarray);
889 
890  Vmath::Vcopy(m_ncoeffs,&outarray[0],1,
891  &(lmat->GetPtr())[0],1);
892 
893  //cout << endl << *lmat << endl;
894  lmat->Invert();
895  }
896  break;
897  default:
898  ASSERTL0(false,"This matrix type cannot be generated from this class");
899  break;
900  }
901 
902  return returnval;
903  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:470
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
boost::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:126
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:438
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.
Definition: StdExpansion.h:178
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:27
void SetFaceToGeomOrientation(const int face, Array< OneD, NekDouble > &inout)
Align face orientation with the geometry orientation.
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...
Definition: StdExpansion.h:635
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:46
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
Definition: Vmath.cpp:485
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
Definition: Vmath.cpp:442
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
const NormalVector & GetFaceNormal(const int face) const
void SetTraceToGeomOrientation(Array< OneD, NekDouble > &inout)
Align trace orientation with the geometry orientation.
std::map< int, bool > m_negatedNormals
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:141
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:52
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:396
double NekDouble
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &outarray)
void AddHDGHelmholtzFaceTerms(const NekDouble tau, const int edge, Array< OneD, NekDouble > &facePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
Definition: Expansion3D.cpp:51
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:354
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:85
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:49
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:131
Expansion2DSharedPtr GetFaceExp(const int face)
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
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.
Definition: Vmath.cpp:183
Array< OneD, unsigned int > Nektar::LocalRegions::Expansion3D::v_GetEdgeInverseBoundaryMap ( int  eid)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1846 of file Expansion3D.cpp.

1848  {
1849  int n, j;
1850  int nEdgeCoeffs;
1851  int nBndCoeffs = NumBndryCoeffs();
1852 
1853  Array<OneD, unsigned int> bmap(nBndCoeffs);
1854  GetBoundaryMap(bmap);
1855 
1856  // Map from full system to statically condensed system (i.e reverse
1857  // GetBoundaryMap)
1858  map<int, int> invmap;
1859  for (j = 0; j < nBndCoeffs; ++j)
1860  {
1861  invmap[bmap[j]] = j;
1862  }
1863 
1864  // Number of interior edge coefficients
1865  nEdgeCoeffs = GetEdgeNcoeffs(eid) - 2;
1866 
1868 
1869  Array<OneD, unsigned int> edgemaparray(nEdgeCoeffs);
1870  StdRegions::Orientation eOrient =
1871  geom->GetEorient(eid);
1872  Array<OneD, unsigned int> maparray =
1873  Array<OneD, unsigned int>(nEdgeCoeffs);
1874  Array<OneD, int> signarray =
1875  Array<OneD, int>(nEdgeCoeffs, 1);
1876 
1877  // maparray is the location of the edge within the matrix
1878  GetEdgeInteriorMap(eid, eOrient, maparray, signarray);
1879 
1880  for (n = 0; n < nEdgeCoeffs; ++n)
1881  {
1882  edgemaparray[n] = invmap[maparray[n]];
1883  }
1884 
1885  return edgemaparray;
1886  }
void GetEdgeInteriorMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdExpansion.h:830
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:180
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:287
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:814
boost::shared_ptr< Geometry3D > Geometry3DSharedPtr
Definition: Geometry3D.h:52
Array< OneD, unsigned int > Nektar::LocalRegions::Expansion3D::v_GetFaceInverseBoundaryMap ( int  fid,
StdRegions::Orientation  faceOrient = StdRegions::eNoOrientation 
)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1889 of file Expansion3D.cpp.

References Nektar::StdRegions::eNoOrientation.

1892  {
1893  int n, j;
1894  int nFaceCoeffs;
1895 
1896  int nBndCoeffs = NumBndryCoeffs();
1897 
1898  Array<OneD, unsigned int> bmap(nBndCoeffs);
1899  GetBoundaryMap(bmap);
1900 
1901  // Map from full system to statically condensed system (i.e reverse
1902  // GetBoundaryMap)
1903  map<int, int> reversemap;
1904  for (j = 0; j < bmap.num_elements(); ++j)
1905  {
1906  reversemap[bmap[j]] = j;
1907  }
1908 
1909  // Number of interior face coefficients
1910  nFaceCoeffs = GetFaceIntNcoeffs(fid);
1911 
1912  Array<OneD, unsigned int> facemaparray(nFaceCoeffs);
1913  StdRegions::Orientation fOrient;
1914  Array<OneD, unsigned int> maparray =
1915  Array<OneD, unsigned int>(nFaceCoeffs);
1916  Array<OneD, int> signarray =
1917  Array<OneD, int>(nFaceCoeffs, 1);
1918 
1919  if(faceOrient == StdRegions::eNoOrientation)
1920  {
1921  fOrient = GetForient(fid);
1922  }
1923  else
1924  {
1925  fOrient = faceOrient;
1926  }
1927 
1928  // maparray is the location of the face within the matrix
1929  GetFaceInteriorMap(fid, fOrient, maparray, signarray);
1930 
1931  for (n = 0; n < nFaceCoeffs; ++n)
1932  {
1933  facemaparray[n] = reversemap[maparray[n]];
1934  }
1935 
1936  return facemaparray;
1937  }
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:359
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:814
void GetFaceInteriorMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdExpansion.h:844
void Nektar::LocalRegions::Expansion3D::v_GetFacePhysVals ( const int  face,
const StdRegions::StdExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
StdRegions::Orientation  orient 
)
protectedvirtual

Definition at line 1958 of file Expansion3D.cpp.

References Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, Nektar::StdRegions::eNoOrientation, Vmath::Gathr(), Nektar::LibUtilities::Interp2D(), and Vmath::Scatr().

1964  {
1965 
1966  if (orient == StdRegions::eNoOrientation)
1967  {
1968  orient = GetForient(face);
1969  }
1970 
1971  int nq0 = FaceExp->GetNumPoints(0);
1972  int nq1 = FaceExp->GetNumPoints(1);
1973 
1974  int nfacepts = GetFaceNumPoints(face);
1975  int dir0 = GetGeom3D()->GetDir(face,0);
1976  int dir1 = GetGeom3D()->GetDir(face,1);
1977 
1978  Array<OneD,NekDouble> o_tmp (nfacepts);
1979  Array<OneD,NekDouble> o_tmp2(FaceExp->GetTotPoints());
1980  Array<OneD, int> faceids;
1981 
1982  // Get local face pts and put into o_tmp
1983  GetFacePhysMap(face,faceids);
1984  Vmath::Gathr(faceids.num_elements(),inarray,faceids,o_tmp);
1985 
1986 
1987  int to_id0,to_id1;
1988 
1990  {
1991  to_id0 = 0;
1992  to_id1 = 1;
1993  }
1994  else // transpose points key evaluation
1995  {
1996  to_id0 = 1;
1997  to_id1 = 0;
1998  }
1999 
2000  // interpolate to points distrbution given in FaceExp
2001  LibUtilities::Interp2D(m_base[dir0]->GetPointsKey(),
2002  m_base[dir1]->GetPointsKey(),
2003  o_tmp.get(),
2004  FaceExp->GetBasis(to_id0)->GetPointsKey(),
2005  FaceExp->GetBasis(to_id1)->GetPointsKey(),
2006  o_tmp2.get());
2007 
2008  // Reshuffule points as required and put into outarray.
2009  ReOrientFacePhysMap(FaceExp->GetNverts(),orient,nq0,nq1,faceids);
2010  Vmath::Scatr(nq0*nq1,o_tmp2,faceids,outarray);
2011  }
int GetFaceNumPoints(const int i) const
This function returns the number of quadrature points belonging to the i-th face. ...
Definition: StdExpansion.h:339
void Gathr(int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
Definition: Vmath.cpp:644
void GetFacePhysMap(const int face, Array< OneD, int > &outarray)
Definition: StdExpansion.h:940
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:180
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:763
void ReOrientFacePhysMap(const int nvert, const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
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...
Definition: Interp.cpp:116
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
Definition: Vmath.cpp:673
Array< OneD, LibUtilities::BasisSharedPtr > m_base
StdRegions::Orientation Nektar::LocalRegions::Expansion3D::v_GetForient ( int  face)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1939 of file Expansion3D.cpp.

1940  {
1941  return m_geom->GetForient(face);
1942  }
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:130
void Nektar::LocalRegions::Expansion3D::v_GetTracePhysVals ( const int  face,
const StdRegions::StdExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
StdRegions::Orientation  orient 
)
protectedvirtual

Returns the physical values at the quadrature points of a face Wrapper function to v_GetFacePhysVals.

Definition at line 1948 of file Expansion3D.cpp.

1954  {
1955  v_GetFacePhysVals(face,FaceExp,inarray,outarray,orient);
1956  }
virtual void v_GetFacePhysVals(const int face, const StdRegions::StdExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
void Nektar::LocalRegions::Expansion3D::v_NormVectorIProductWRTBase ( const Array< OneD, const Array< OneD, NekDouble > > &  Fvec,
Array< OneD, NekDouble > &  outarray 
)
virtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 2171 of file Expansion3D.cpp.

2174  {
2175  NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
2176  }
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:733

Member Data Documentation

std::vector<Expansion2DWeakPtr> Nektar::LocalRegions::Expansion3D::m_faceExp
private

Definition at line 176 of file Expansion3D.h.

std::vector<bool> Nektar::LocalRegions::Expansion3D::m_requireNeg
private

Definition at line 177 of file Expansion3D.h.