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 
65  Array<OneD, ExpansionSharedPtr> &EdgeExp,
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,
74  Array<OneD, ExpansionSharedPtr> &EdgeExp,
75  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
76  Array<OneD, NekDouble> &outarray);
77 
78  inline void AddNormTraceInt(
79  const int dir,
80  Array<OneD, const NekDouble> &inarray,
81  Array<OneD, ExpansionSharedPtr> &EdgeExp,
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,
95  Array<OneD, ExpansionSharedPtr> &EdgeExp,
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,
103  Array<OneD, ExpansionSharedPtr> &EdgeExp,
104  const StdRegions::VarCoeffMap &dirForcing,
105  Array<OneD, NekDouble> &outarray);
106 
108 
110 
111  inline int GetLeftAdjacentElementFace() const;
112 
113  inline int GetRightAdjacentElementFace() const;
114 
115  inline void SetAdjacentElementExp(
116  int face,
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;
130 
132 
133  // Hybridized DG routines
134  virtual void v_DGDeriv(
135  const int dir,
136  const Array<OneD, const NekDouble> &incoeffs,
137  Array<OneD, ExpansionSharedPtr> &EdgeExp,
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,
144  const Array<OneD, const NekDouble> &Fx,
145  const Array<OneD, const NekDouble> &Fy,
146  Array<OneD, NekDouble> &outarray);
147 
148  virtual void v_AddEdgeNormBoundaryInt(
149  const int edge,
150  const ExpansionSharedPtr &EdgeExp,
151  const Array<OneD, const NekDouble> &Fn,
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 
167  Array<OneD, unsigned int> v_GetEdgeInverseBoundaryMap(int eid);
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 
194  {
195  ASSERTL1(m_elementLeft.lock().get(), "Left adjacent element not set.");
196  return m_elementLeft.lock();
197  }
198 
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 
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