Nektar++
Expansion2D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Expansion2D.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Header file for Expansion2D routines
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef EXPANSION2D_H
37 #define EXPANSION2D_H
38 
39 #include <LocalRegions/Expansion.h>
43 
44 namespace Nektar
45 {
46  namespace LocalRegions
47  {
48  class Expansion3D;
49  typedef boost::shared_ptr<Expansion3D> Expansion3DSharedPtr;
50  typedef boost::weak_ptr<Expansion3D> Expansion3DWeakPtr;
51 
52  class Expansion2D;
53  typedef boost::shared_ptr<Expansion2D> Expansion2DSharedPtr;
54  typedef boost::weak_ptr<Expansion2D> Expansion2DWeakPtr;
55  typedef std::vector< Expansion2DSharedPtr > Expansion2DVector;
57 
58  class Expansion2D: virtual public Expansion, virtual public StdRegions::StdExpansion2D
59  {
60  public:
63 
66  Array<OneD, NekDouble> &inout);
67 
68  ExpansionSharedPtr GetEdgeExp(int edge, bool SetUpNormal=true);
69 
70  void SetEdgeExp(const int edge, ExpansionSharedPtr &e);
71 
72  inline void AddNormTraceInt(
73  const int dir,
75  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
76  Array<OneD, NekDouble> &outarray);
77 
78  inline void AddNormTraceInt(
79  const int dir,
82  Array<OneD, NekDouble> &outarray,
83  const StdRegions::VarCoeffMap &varcoeffs);
84 
85  inline void AddEdgeBoundaryInt(
86  const int edge,
87  ExpansionSharedPtr &EdgeExp,
88  Array<OneD, NekDouble> &edgePhys,
89  Array<OneD, NekDouble> &outarray,
91 
92  inline void AddHDGHelmholtzEdgeTerms(
93  const NekDouble tau,
94  const int edge,
96  Array<OneD, NekDouble> &edgePhys,
97  const StdRegions::VarCoeffMap &dirForcing,
98  Array<OneD, NekDouble> &outarray);
99 
100  inline void AddHDGHelmholtzTraceTerms(
101  const NekDouble tau,
102  const Array<OneD, const NekDouble> &inarray,
104  const StdRegions::VarCoeffMap &dirForcing,
105  Array<OneD, NekDouble> &outarray);
106 
107  inline Expansion3DSharedPtr GetLeftAdjacentElementExp() const;
108 
109  inline Expansion3DSharedPtr GetRightAdjacentElementExp() const;
110 
111  inline int GetLeftAdjacentElementFace() const;
112 
113  inline int GetRightAdjacentElementFace() const;
114 
115  inline void SetAdjacentElementExp(
116  int face,
117  Expansion3DSharedPtr &f);
118 
120 
121  protected:
122  std::vector<ExpansionWeakPtr> m_edgeExp;
123  std::vector<bool> m_requireNeg;
124  std::map<int, StdRegions::NormalVector> m_edgeNormals;
125  std::map<int, bool> m_negatedNormals;
126  Expansion3DWeakPtr m_elementLeft;
127  Expansion3DWeakPtr m_elementRight;
130 
132 
133  // Hybridized DG routines
134  virtual void v_DGDeriv(
135  const int dir,
136  const Array<OneD, const NekDouble> &incoeffs,
138  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
139  Array<OneD, NekDouble> &out_d);
140 
141  virtual void v_AddEdgeNormBoundaryInt(
142  const int edge,
143  const ExpansionSharedPtr &EdgeExp,
146  Array<OneD, NekDouble> &outarray);
147 
148  virtual void v_AddEdgeNormBoundaryInt(
149  const int edge,
150  const ExpansionSharedPtr &EdgeExp,
152  Array<OneD, NekDouble> &outarray);
153 
154  virtual void v_AddRobinMassMatrix(const int edgeid, const Array<OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat);
155 
156  virtual void v_AddRobinEdgeContribution(const int edgeid, const Array<OneD, const NekDouble> &primCoeffs, Array<OneD, NekDouble> &coeffs);
157 
159  const DNekScalMatSharedPtr &r_bnd);
160 
162  const int edge,
163  ExpansionSharedPtr &EdgeExp,
164  const Array<OneD, const NekDouble> &varcoeff,
165  Array<OneD,NekDouble> &outarray);
166 
168 
169  virtual void v_NegateEdgeNormal(const int edge);
170  virtual bool v_EdgeNormalNegated(const int edge);
171  virtual void v_SetUpPhysNormals(const int edge);
172  const StdRegions::NormalVector &v_GetEdgeNormal(const int edge) const;
173  const StdRegions::NormalVector &v_GetSurfaceNormal(const int id) const;
174  };
175 
176  inline ExpansionSharedPtr Expansion2D::GetEdgeExp(int edge, bool SetUpNormal)
177  {
178  ASSERTL1(edge < GetNedges(), "Edge out of range.");
179  return m_edgeExp[edge].lock();
180  }
181 
182  inline void Expansion2D::SetEdgeExp(const int edge, ExpansionSharedPtr &e)
183  {
184  unsigned int nEdges = GetNedges();
185  ASSERTL1(edge < nEdges, "Edge out of range.");
186  if (m_edgeExp.size() < nEdges)
187  {
188  m_edgeExp.resize(nEdges);
189  }
190  m_edgeExp[edge] = e;
191  }
192 
193  inline Expansion3DSharedPtr Expansion2D::GetLeftAdjacentElementExp() const
194  {
195  ASSERTL1(m_elementLeft.lock().get(), "Left adjacent element not set.");
196  return m_elementLeft.lock();
197  }
198 
199  inline Expansion3DSharedPtr Expansion2D::GetRightAdjacentElementExp() const
200  {
201  ASSERTL1(m_elementLeft.lock().get(), "Right adjacent element not set.");
202  return m_elementRight.lock();
203  }
204 
206  {
207  return m_elementFaceLeft;
208  }
209 
211  {
212  return m_elementFaceRight;
213  }
214 
215  inline void Expansion2D::SetAdjacentElementExp(int face, Expansion3DSharedPtr &f)
216  {
217  if (m_elementLeft.lock().get())
218  {
219  ASSERTL1(!m_elementRight.lock().get(),
220  "Both adjacent elements already set.");
221  m_elementRight = f;
222  m_elementFaceRight = face;
223  }
224  else
225  {
226  m_elementLeft = f;
227  m_elementFaceLeft = face;
228  }
229  }
230 
232  {
233  return boost::dynamic_pointer_cast<SpatialDomains::Geometry2D>(m_geom);
234  }
235  } //end of namespace
236 } //end of namespace
237 
238 #endif
const StdRegions::NormalVector & v_GetEdgeNormal(const int edge) const
Expansion3DWeakPtr m_elementRight
Definition: Expansion2D.h:127
void SetAdjacentElementExp(int face, Expansion3DSharedPtr &f)
Definition: Expansion2D.h:215
void GetPhysEdgeVarCoeffsFromElement(const int edge, ExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &varcoeff, Array< OneD, NekDouble > &outarray)
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &edgeCoeffs, Array< OneD, NekDouble > &outarray)
const StdRegions::NormalVector & v_GetSurfaceNormal(const int id) const
std::map< int, bool > m_negatedNormals
Definition: Expansion2D.h:125
std::map< int, StdRegions::NormalVector > m_edgeNormals
Definition: Expansion2D.h:124
void SetTraceToGeomOrientation(Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, NekDouble > &inout)
virtual void v_AddRobinEdgeContribution(const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, Array< OneD, NekDouble > &coeffs)
virtual DNekMatSharedPtr v_BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:125
virtual void v_AddRobinMassMatrix(const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
std::vector< ExpansionWeakPtr > m_edgeExp
Definition: Expansion2D.h:122
void AddEdgeBoundaryInt(const int edge, ExpansionSharedPtr &EdgeExp, Array< OneD, NekDouble > &edgePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
virtual void v_NegateEdgeNormal(const int edge)
std::vector< Expansion2DSharedPtr > Expansion2DVector
Definition: Expansion2D.h:55
std::vector< bool > m_requireNeg
Definition: Expansion2D.h:123
SpatialDomains::Geometry2DSharedPtr GetGeom2D() const
Definition: Expansion2D.h:231
Expansion3DWeakPtr m_elementLeft
Definition: Expansion2D.h:126
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:225
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
virtual void v_AddEdgeNormBoundaryInt(const int edge, const ExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Definition: Expansion2D.cpp:54
void SetEdgeExp(const int edge, ExpansionSharedPtr &e)
Definition: Expansion2D.h:182
double NekDouble
Expansion3DSharedPtr GetLeftAdjacentElementExp() const
Definition: Expansion2D.h:193
void AddHDGHelmholtzEdgeTerms(const NekDouble tau, const int edge, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, NekDouble > &edgePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
Expansion2D(SpatialDomains::Geometry2DSharedPtr pGeom)
Definition: Expansion2D.cpp:47
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
virtual bool v_EdgeNormalNegated(const int edge)
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry2D.h:59
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
void AddHDGHelmholtzTraceTerms(const NekDouble tau, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
boost::weak_ptr< Expansion3D > Expansion3DWeakPtr
Definition: Expansion2D.h:50
2D geometry information
Definition: Geometry2D.h:65
virtual void v_DGDeriv(const int dir, const Array< OneD, const NekDouble > &incoeffs, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &edgeCoeffs, Array< OneD, NekDouble > &out_d)
ExpansionSharedPtr GetEdgeExp(int edge, bool SetUpNormal=true)
Definition: Expansion2D.h:176
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
boost::weak_ptr< Expansion2D > Expansion2DWeakPtr
Definition: Expansion1D.h:51
virtual void v_SetUpPhysNormals(const int edge)
Expansion3DSharedPtr GetRightAdjacentElementExp() const
Definition: Expansion2D.h:199
#define LOCAL_REGIONS_EXPORT
std::vector< Expansion2DSharedPtr >::iterator Expansion2DVectorIter
Definition: Expansion2D.h:56
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:272
Array< OneD, unsigned int > v_GetEdgeInverseBoundaryMap(int eid)
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:226