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 
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 
64  LOCAL_REGIONS_EXPORT void SetTraceToGeomOrientation(Array<OneD, StdRegions::StdExpansionSharedPtr> &EdgeExp,
65  Array<OneD, NekDouble> &inout);
66 
67  ExpansionSharedPtr GetEdgeExp(int edge, bool SetUpNormal=true);
68 
69  void SetEdgeExp(const int edge, ExpansionSharedPtr &e);
70 
71  inline void AddNormTraceInt(
72  const int dir,
73  Array<OneD,StdRegions::StdExpansionSharedPtr> &EdgeExp,
74  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
75  Array<OneD,NekDouble> &outarray);
76 
77  inline void AddNormTraceInt(
78  const int dir,
79  Array<OneD, const NekDouble> &inarray,
80  Array<OneD, StdRegions::StdExpansionSharedPtr> &EdgeExp,
81  Array<OneD, NekDouble> &outarray,
82  const StdRegions::VarCoeffMap &varcoeffs);
83 
84  inline void AddEdgeBoundaryInt(
85  const int edge,
87  Array<OneD, NekDouble> &edgePhys,
88  Array<OneD, NekDouble> &outarray,
90 
91  inline void AddHDGHelmholtzEdgeTerms(
92  const NekDouble tau,
93  const int edge,
94  Array<OneD, StdRegions::StdExpansionSharedPtr> &EdgeExp,
95  Array<OneD, NekDouble> &edgePhys,
96  const StdRegions::VarCoeffMap &dirForcing,
97  Array<OneD, NekDouble> &outarray);
98 
99  inline void AddHDGHelmholtzTraceTerms(
100  const NekDouble tau,
101  const Array<OneD, const NekDouble> &inarray,
102  Array<OneD, StdRegions::StdExpansionSharedPtr> &EdgeExp,
103  const StdRegions::VarCoeffMap &dirForcing,
104  Array<OneD, NekDouble> &outarray);
105 
107 
109 
110  inline int GetLeftAdjacentElementFace() const;
111 
112  inline int GetRightAdjacentElementFace() const;
113 
114  inline void SetAdjacentElementExp(
115  int face,
117 
119 
120  protected:
121  std::vector<ExpansionWeakPtr> m_edgeExp;
122  std::vector<bool> m_requireNeg;
123  std::map<int, StdRegions::NormalVector> m_edgeNormals;
124  std::map<int, bool> m_negatedNormals;
129 
131 
132  // Hybridized DG routines
133  virtual void v_DGDeriv(
134  const int dir,
135  const Array<OneD, const NekDouble> &incoeffs,
136  Array<OneD,StdRegions::StdExpansionSharedPtr> &EdgeExp,
137  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
138  Array<OneD, NekDouble> &out_d);
139 
140  virtual void v_AddEdgeNormBoundaryInt(
141  const int edge,
143  const Array<OneD, const NekDouble> &Fx,
144  const Array<OneD, const NekDouble> &Fy,
145  Array<OneD, NekDouble> &outarray);
146 
147  virtual void v_AddEdgeNormBoundaryInt(
148  const int edge,
150  const Array<OneD, const NekDouble> &Fn,
151  Array<OneD, NekDouble> &outarray);
152 
153  virtual void v_AddRobinMassMatrix(const int edgeid, const Array<OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat);
154 
155  virtual void v_AddRobinEdgeContribution(const int edgeid, const Array<OneD, const NekDouble> &primCoeffs, Array<OneD, NekDouble> &coeffs);
156 
158  const DNekScalMatSharedPtr &r_bnd);
159 
161  const int edge,
163  const Array<OneD, const NekDouble> &varcoeff,
164  Array<OneD,NekDouble> &outarray);
165 
166  Array<OneD, unsigned int> v_GetEdgeInverseBoundaryMap(int eid);
167 
168  virtual void v_NegateEdgeNormal(const int edge);
169  virtual bool v_EdgeNormalNegated(const int edge);
170  virtual void v_SetUpPhysNormals(const int edge);
171  const StdRegions::NormalVector &v_GetEdgeNormal(const int edge) const;
172  const StdRegions::NormalVector &v_GetSurfaceNormal(const int id) const;
173  };
174 
175  inline ExpansionSharedPtr Expansion2D::GetEdgeExp(int edge, bool SetUpNormal)
176  {
177  ASSERTL1(edge < GetNedges(), "Edge out of range.");
178  return m_edgeExp[edge].lock();
179  }
180 
181  inline void Expansion2D::SetEdgeExp(const int edge, ExpansionSharedPtr &e)
182  {
183  unsigned int nEdges = GetNedges();
184  ASSERTL1(edge < nEdges, "Edge out of range.");
185  if (m_edgeExp.size() < nEdges)
186  {
187  m_edgeExp.resize(nEdges);
188  }
189  m_edgeExp[edge] = e;
190  }
191 
193  {
194  ASSERTL1(m_elementLeft.lock().get(), "Left adjacent element not set.");
195  return m_elementLeft.lock();
196  }
197 
199  {
200  ASSERTL1(m_elementLeft.lock().get(), "Right adjacent element not set.");
201  return m_elementRight.lock();
202  }
203 
205  {
206  return m_elementFaceLeft;
207  }
208 
210  {
211  return m_elementFaceRight;
212  }
213 
215  {
216  if (m_elementLeft.lock().get())
217  {
218  ASSERTL1(!m_elementRight.lock().get(),
219  "Both adjacent elements already set.");
220  m_elementRight = f;
221  m_elementFaceRight = face;
222  }
223  else
224  {
225  m_elementLeft = f;
226  m_elementFaceLeft = face;
227  }
228  }
229 
231  {
232  return boost::dynamic_pointer_cast<SpatialDomains::Geometry2D>(m_geom);
233  }
234  } //end of namespace
235 } //end of namespace
236 
237 #endif