Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
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;
58 
59  class Expansion2D: virtual public Expansion,
60  virtual public StdRegions::StdExpansion2D
61  {
62  public:
63  LOCAL_REGIONS_EXPORT Expansion2D(SpatialDomains::
64  Geometry2DSharedPtr pGeom);
65 
67 
70  Array<OneD, NekDouble> &inout);
71 
72  LOCAL_REGIONS_EXPORT Expansion1DSharedPtr GetEdgeExp(int edge, bool SetUpNormal = true);
73 
74  void SetEdgeExp(const int edge, Expansion1DSharedPtr &e);
75 
76  inline void AddNormTraceInt(
77  const int dir,
79  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
80  Array<OneD, NekDouble> &outarray);
81 
82  inline void AddNormTraceInt(
83  const int dir,
86  Array<OneD, NekDouble> &outarray,
87  const StdRegions::VarCoeffMap &varcoeffs);
88 
89  inline void AddEdgeBoundaryInt(
90  const int edge,
91  ExpansionSharedPtr &EdgeExp,
92  Array<OneD, NekDouble> &edgePhys,
93  Array<OneD, NekDouble> &outarray,
94  const StdRegions::VarCoeffMap &varcoeffs = StdRegions::
96 
97  inline void AddHDGHelmholtzEdgeTerms(
98  const NekDouble tau,
99  const int edge,
101  Array<OneD, NekDouble> &edgePhys,
102  const StdRegions::VarCoeffMap &dirForcing,
103  Array<OneD, NekDouble> &outarray);
104 
105  inline void AddHDGHelmholtzTraceTerms(
106  const NekDouble tau,
107  const Array<OneD, const NekDouble> &inarray,
109  const StdRegions::VarCoeffMap &dirForcing,
110  Array<OneD, NekDouble> &outarray);
111 
112  inline Expansion3DSharedPtr GetLeftAdjacentElementExp() const;
113 
114  inline Expansion3DSharedPtr GetRightAdjacentElementExp() const;
115 
116  inline int GetLeftAdjacentElementFace() const;
117 
118  inline int GetRightAdjacentElementFace() const;
119 
120  inline void SetAdjacentElementExp(
121  int face,
122  Expansion3DSharedPtr &f);
123 
125 
127  const int nvert,
128  const StdRegions::Orientation orient,
129  const int nq0,
130  Array<OneD, int> &idmap);
131 
132  protected:
133  std::vector<Expansion1DWeakPtr> m_edgeExp;
134  std::vector<bool> m_requireNeg;
135  std::map<int, StdRegions::NormalVector> m_edgeNormals;
136  std::map<int, bool> m_negatedNormals;
137  Expansion3DWeakPtr m_elementLeft;
138  Expansion3DWeakPtr m_elementRight;
141 
143  const StdRegions::StdMatrixKey &mkey);
144 
145  // Hybridized DG routines
146  virtual void v_DGDeriv(
147  const int dir,
148  const Array<OneD, const NekDouble> &incoeffs,
150  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
151  Array<OneD, NekDouble> &out_d);
152 
153  virtual void v_AddEdgeNormBoundaryInt(
154  const int edge,
155  const ExpansionSharedPtr &EdgeExp,
158  Array<OneD, NekDouble> &outarray);
159 
160  virtual void v_AddEdgeNormBoundaryInt(
161  const int edge,
162  const ExpansionSharedPtr &EdgeExp,
164  Array<OneD, NekDouble> &outarray);
165 
166  virtual void v_AddRobinMassMatrix(
167  const int edgeid,
168  const Array<OneD, const NekDouble > &primCoeffs,
169  DNekMatSharedPtr &inoutmat);
170 
171  virtual void v_AddRobinEdgeContribution(
172  const int edgeid,
173  const Array<OneD, const NekDouble> &primCoeffs,
174  Array<OneD, NekDouble> &coeffs);
175 
177  const DNekScalMatSharedPtr &r_bnd);
178 
180  const int edge,
181  ExpansionSharedPtr &EdgeExp,
182  const Array<OneD, const NekDouble> &varcoeff,
183  Array<OneD,NekDouble> &outarray);
184 
186  const StdRegions::Orientation orient,
187  const int nq0,
188  Array<OneD, int> &idmap);
189 
191 
192  virtual void v_NegateEdgeNormal (const int edge);
193  virtual bool v_EdgeNormalNegated(const int edge);
194  virtual void v_SetUpPhysNormals (const int edge);
196  const int edge) const;
198  const int id) const;
199  };
200 
202  int edge,
203  bool SetUpNormal)
204  {
205  ASSERTL1(edge < GetNedges(), "Edge out of range.");
206  return m_edgeExp[edge].lock();
207  }
208 
210  const int edge,
212  {
213  unsigned int nEdges = GetNedges();
214  ASSERTL1(edge < nEdges, "Edge out of range.");
215  if (m_edgeExp.size() < nEdges)
216  {
217  m_edgeExp.resize(nEdges);
218  }
219  m_edgeExp[edge] = e;
220  }
221 
222  inline Expansion3DSharedPtr Expansion2D::
224  {
225  ASSERTL1(m_elementLeft.lock().get(),
226  "Left adjacent element not set.");
227  return m_elementLeft.lock();
228  }
229 
230  inline Expansion3DSharedPtr Expansion2D::
232  {
233  ASSERTL1(m_elementLeft.lock().get(),
234  "Right adjacent element not set.");
235 
236  return m_elementRight.lock();
237  }
238 
240  {
241  return m_elementFaceLeft;
242  }
243 
245  {
246  return m_elementFaceRight;
247  }
248 
250  int face,
251  Expansion3DSharedPtr &f)
252  {
253  if (m_elementLeft.lock().get())
254  {
255  ASSERTL1(!m_elementRight.lock().get(),
256  "Both adjacent elements already set.");
257 
258  m_elementRight = f;
259  m_elementFaceRight = face;
260  }
261  else
262  {
263  m_elementLeft = f;
264  m_elementFaceLeft = face;
265  }
266  }
267 
270  {
271  return boost::dynamic_pointer_cast<SpatialDomains::
273  }
274  } //end of namespace
275 } //end of namespace
276 
277 #endif
const StdRegions::NormalVector & v_GetEdgeNormal(const int edge) const
Expansion3DWeakPtr m_elementRight
Definition: Expansion2D.h:138
void SetAdjacentElementExp(int face, Expansion3DSharedPtr &f)
Definition: Expansion2D.h:249
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:136
std::map< int, StdRegions::NormalVector > m_edgeNormals
Definition: Expansion2D.h:135
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
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:134
SpatialDomains::Geometry2DSharedPtr GetGeom2D() const
Definition: Expansion2D.h:269
Expansion3DWeakPtr m_elementLeft
Definition: Expansion2D.h:137
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:226
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
Expansion1DSharedPtr GetEdgeExp(int edge, bool SetUpNormal=true)
Definition: Expansion2D.h:201
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:56
double NekDouble
Expansion3DSharedPtr GetLeftAdjacentElementExp() const
Definition: Expansion2D.h:223
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
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:49
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
void ReOrientQuadEdgePhysMap(const StdRegions::Orientation orient, const int nq0, Array< OneD, int > &idmap)
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)
std::vector< Expansion1DWeakPtr > m_edgeExp
Definition: Expansion2D.h:133
void SetEdgeExp(const int edge, Expansion1DSharedPtr &e)
Definition: Expansion2D.h:209
boost::weak_ptr< Expansion2D > Expansion2DWeakPtr
Definition: Expansion1D.h:51
virtual void v_SetUpPhysNormals(const int edge)
Expansion3DSharedPtr GetRightAdjacentElementExp() const
Definition: Expansion2D.h:231
#define LOCAL_REGIONS_EXPORT
std::vector< Expansion2DSharedPtr >::iterator Expansion2DVectorIter
Definition: Expansion2D.h:57
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
boost::shared_ptr< Expansion1D > Expansion1DSharedPtr
Definition: Expansion1D.h:53
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)
void ReOrientEdgePhysMap(const int nvert, const StdRegions::Orientation orient, const int nq0, Array< OneD, int > &idmap)
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:227