Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PointExp.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File PointExp.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: Definition of a Point expansion
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef POINTEXP_H
37 #define POINTEXP_H
38 
39 #include <StdRegions/StdPointExp.h>
43 
44 namespace Nektar
45 {
46  namespace LocalRegions
47  {
48  class PointExp: virtual public StdRegions::StdPointExp, virtual public Expansion0D
49  {
50  public:
53 
54  inline const Array<OneD, const NekDouble>& GetCoeffs(void) const
55  {
56  return m_coeffs;
57  }
58 
59  inline NekDouble GetCoeffs(int i) const
60  {
61  ASSERTL1(i == 0,"index out of range");
62 
63  return m_coeffs[i];
64  }
65 
66  inline NekDouble GetPhys(int i) const
67  {
68  ASSERTL1(i == 0,"index out of range");
69 
70  return m_phys[i];
71  }
72 
73  inline NekDouble GetCoeff(int i) const
74  {
75  ASSERTL1(i == 0,"index out of range");
76 
77  return m_coeffs[i];
78  }
79 
80  inline Array<OneD, NekDouble>& UpdateCoeffs(void)
81  {
82  return(m_coeffs);
83  }
84 
85  inline void SetCoeff(const NekDouble value)
86  {
87  m_coeffs[0] = value;
88  }
89 
90  inline const Array<OneD, const NekDouble>& GetPhys(void) const
91  {
92  return m_phys;
93  }
94 
95  inline Array<OneD, NekDouble>& UpdatePhys(void)
96  {
97  return(m_phys);
98  }
99 
100  inline void SetPhys(const NekDouble value)
101  {
102  m_phys[0] = value;
103  }
104 
105  inline void GetCoords(NekDouble &x, NekDouble &y, NekDouble &z)
106  {
107  SpatialDomains::PointGeomSharedPtr v = boost::dynamic_pointer_cast<SpatialDomains::PointGeom>(m_geom);
108  v->GetCoords(x,y,z);
109  }
110 
112  {
113  return boost::dynamic_pointer_cast<SpatialDomains::PointGeom>(m_geom);
114  }
115 
116  protected:
117  Array<OneD, NekDouble > m_coeffs; //!< Array containing expansion coefficients
118  Array<OneD, NekDouble > m_phys; //!< Array containing physical point which is likely to be the same as the coefficient but is defined for consistency (It is also used in Robin boundary conditions)
119 
120  virtual void v_GetCoords(
121  Array<OneD, NekDouble> &coords_0,
122  Array<OneD, NekDouble> &coords_1,
123  Array<OneD, NekDouble> &coords_2);
124  };
125 
126  // type defines for use of PointExp in a boost vector
127  typedef boost::shared_ptr<PointExp> PointExpSharedPtr;
128  typedef std::vector<PointExpSharedPtr> PointExpVector;
130 
131  const static Array<OneD, PointExpSharedPtr> NullPointExpSharedPtrArray;
132  } //end of namespace
133 } //end of namespace
134 
135 #endif // POINTEXP_H