Nektar++
Expansion1D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Expansion1D.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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Header file for Expansion1D routines
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef EXPANSION1D_H
36 #define EXPANSION1D_H
37 
38 #include <LocalRegions/Expansion.h>
42 
43 namespace Nektar
44 {
45  namespace LocalRegions
46  {
47  class Expansion2D;
48  typedef std::shared_ptr<Expansion2D> Expansion2DSharedPtr;
49  typedef std::weak_ptr<Expansion2D> Expansion2DWeakPtr;
50 
51  class Expansion1D;
52  typedef std::shared_ptr<Expansion1D> Expansion1DSharedPtr;
53  typedef std::weak_ptr<Expansion1D> Expansion1DWeakPtr;
54  typedef std::vector< Expansion1DSharedPtr > Expansion1DVector;
55 
56  class Expansion1D: virtual public Expansion,
57  virtual public StdRegions::StdExpansion1D
58  {
59  public:
61  Geometry1DSharedPtr pGeom)
62  : Expansion(pGeom),
64  {
65  m_elementEdgeLeft = -1;
66  m_elementEdgeRight = -1;
67  }
68 
70 
72  const int dir,
74  Array<OneD,NekDouble> &outarray);
75 
76  inline Expansion2DSharedPtr GetLeftAdjacentElementExp() const;
77 
78  inline Expansion2DSharedPtr GetRightAdjacentElementExp() const;
79 
80  inline int GetLeftAdjacentElementEdge() const;
81 
82  inline int GetRightAdjacentElementEdge() const;
83 
84  inline void SetAdjacentElementExp(
85  int edge,
86  Expansion2DSharedPtr &e);
87 
89  const NekDouble tau,
90  const Array<OneD, const NekDouble> &inarray,
91  Array<OneD, NekDouble> &outarray);
92 
94 
95  protected:
96  std::map<int, bool> m_negatedNormals;
97 
99  const StdRegions::StdMatrixKey &mkey);
100 
101  virtual void v_AddRobinMassMatrix(
102  const int vert,
103  const Array<OneD, const NekDouble > &primCoeffs,
104  DNekMatSharedPtr &inoutmat);
105 
106  virtual void v_AddRobinEdgeContribution(
107  const int vert,
108  const Array<OneD, const NekDouble > &primCoeffs,
109  Array<OneD, NekDouble> &coeffs);
110 
111  virtual NekDouble v_VectorFlux(
112  const Array<OneD, Array<OneD, NekDouble> > &vec);
113 
114  virtual void v_NegateVertexNormal (const int vertex);
115 
116  virtual bool v_VertexNormalNegated(const int vertex);
117 
118  private:
119  Expansion2DWeakPtr m_elementLeft;
120  Expansion2DWeakPtr m_elementRight;
123 
124  };
125 
126  inline Expansion2DSharedPtr Expansion1D::
128  {
129  ASSERTL1(m_elementLeft.lock().get(),
130  "Left adjacent element not set.");
131  return m_elementLeft.lock();
132  }
133 
134  inline Expansion2DSharedPtr Expansion1D::
136  {
137  ASSERTL1(m_elementLeft.lock().get(),
138  "Right adjacent element not set.");
139 
140  return m_elementRight.lock();
141  }
142 
144  {
145  return m_elementEdgeLeft;
146  }
147 
149  {
150  return m_elementEdgeRight;
151  }
152 
154  int edge,
155  Expansion2DSharedPtr &e)
156  {
157  if (m_elementLeft.lock().get())
158  {
159  ASSERTL1(!m_elementRight.lock().get(),
160  "Both adjacent elements already set.");
161 
162  m_elementRight = e;
163  m_elementEdgeRight = edge;
164  }
165  else
166  {
167  m_elementLeft = e;
168  m_elementEdgeLeft = edge;
169  }
170  }
171 
174  {
175  return std::dynamic_pointer_cast<SpatialDomains
176  ::Geometry1D>(m_geom);
177  }
178  } //end of namespace
179 } //end of namespace
180 
181 #endif
182 
virtual void v_NegateVertexNormal(const int vertex)
Definition: Expansion1D.cpp:46
virtual NekDouble v_VectorFlux(const Array< OneD, Array< OneD, NekDouble > > &vec)
std::map< int, bool > m_negatedNormals
Definition: Expansion1D.h:96
virtual void v_AddRobinMassMatrix(const int vert, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
Definition: Expansion1D.cpp:61
Expansion2DWeakPtr m_elementRight
Definition: Expansion1D.h:120
std::vector< Expansion1DSharedPtr > Expansion1DVector
Definition: Expansion1D.h:54
Expansion2DWeakPtr m_elementLeft
Definition: Expansion1D.h:119
std::weak_ptr< Expansion1D > Expansion1DWeakPtr
Definition: Expansion1D.h:53
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:127
SpatialDomains::Geometry1DSharedPtr GetGeom1D() const
Definition: Expansion1D.h:173
void SetAdjacentElementExp(int edge, Expansion2DSharedPtr &e)
Definition: Expansion1D.h:153
double NekDouble
Expansion1D(SpatialDomains::Geometry1DSharedPtr pGeom)
Definition: Expansion1D.h:60
virtual bool v_VertexNormalNegated(const int vertex)
Definition: Expansion1D.cpp:56
void AddNormTraceInt(const int dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Expansion2DSharedPtr GetRightAdjacentElementExp() const
Definition: Expansion1D.h:135
std::weak_ptr< Expansion2D > Expansion2DWeakPtr
Definition: Expansion1D.h:49
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:47
virtual void v_AddRobinEdgeContribution(const int vert, const Array< OneD, const NekDouble > &primCoeffs, Array< OneD, NekDouble > &coeffs)
std::shared_ptr< Geometry1D > Geometry1DSharedPtr
Definition: Geometry.h:63
Expansion2DSharedPtr GetLeftAdjacentElementExp() const
Definition: Expansion1D.h:127
#define LOCAL_REGIONS_EXPORT
void AddHDGHelmholtzTraceTerms(const NekDouble tau, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
std::shared_ptr< Expansion1D > Expansion1DSharedPtr
Definition: Expansion1D.h:51