Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SourcePoint.hpp
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: SourcePoint.hpp
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: class and methods of curvature sampling point
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKMESHUTILS_OCTREE_SOURCEPOINT_H
37 #define NEKMESHUTILS_OCTREE_SOURCEPOINT_H
38 
41 
42 namespace Nektar
43 {
44 namespace NekMeshUtils
45 {
46 
47 enum SPType
48 {
49  eCBoundary, // on a curved boundary
50  ePBoundary, // on a planar boundary (R=inf)
51  eSrcPoint // source point
52 };
53 
54 /**
55  * @brief base class of sizing point for octree construction
56  * these carry information the octree needs and have various types
57  */
58 class SPBase
59 {
60 public:
61  friend class MemoryManager<SPBase>;
62 
64  {
65  m_loc = l;
66  }
67 
68  virtual ~SPBase(){}
69 
71  {
72  return m_type;
73  }
74 
76  {
77  return m_loc;
78  }
79 
80  virtual NekDouble GetDelta()
81  {
82  return 0.0;
83  }
84 
85  virtual void SetDelta(NekDouble i){}
86 
87  virtual void GetCAD(int &surf, Array<OneD, NekDouble> &uv){}
88 
89  bool HasDelta()
90  {
91  bool ret;
92  if(m_type == eCBoundary || m_type == eSrcPoint)
93  {
94  ret = true;
95  }
96  else
97  {
98  ret = false;
99  }
100  return ret;
101  }
102 
103  bool Isboundary()
104  {
105  bool ret;
106  if(m_type == eCBoundary || m_type == ePBoundary)
107  {
108  ret = true;
109  }
110  else
111  {
112  ret = false;
113  }
114  return ret;
115  }
116 
117 protected:
118  /// type
120  /// x,y,z location
122 };
123 
124 typedef boost::shared_ptr<SPBase> SPBaseSharedPtr;
125 
126 /**
127  * @brief class for a curvature based samlping Point
128  */
129 class CPoint : public SPBase
130 {
131 public:
132  friend class MemoryManager<CPoint>;
133 
134  /**
135  * @brief constructor for a valid point (has radius of curvature)
136  */
138  NekDouble d)
139  : SPBase(l), sid(i), m_uv(uv), m_delta(d)
140  {
141  m_type = eCBoundary;
142  }
143 
144  ~CPoint(){};
145 
146  /**
147  * @brief get mesh spacing paramter
148  */
150  {
151  return m_delta;
152  }
153 
154  /**
155  * @brief gets the corresponding cad information for the point
156  */
157  void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
158  {
159  surf = sid;
160  uv = m_uv;
161  }
162 
164  {
165  m_delta = i;
166  }
167 
168 private:
169  /// surf id
170  int sid;
171  /// uv coord on surf
174  /// delta parameter
176 };
177 typedef boost::shared_ptr<CPoint> CPointSharedPtr;
178 
179 /**
180  * @brief class for a planar boundary based samlping Point
181  */
182 class BPoint : public SPBase
183 {
184 public:
185  friend class MemoryManager<BPoint>;
186 
187  /**
188  * @brief constructor for a boundary point without delta
189  */
191  : SPBase(l), sid(i), m_uv(uv)
192  {
193  m_type = ePBoundary;
194  }
195 
196  ~BPoint(){};
197 
199  {
200  ASSERTL0(false,"Cannot retrieve delta from this type");
201  return 0.0;
202  }
203 
205  {
206  ASSERTL0(false,"Cannot retrieve delta from this type");
207  }
208 
209  /**
210  * @brief gets the corresponding cad information for the point
211  */
212  void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
213  {
214  surf = sid;
215  uv = m_uv;
216  }
217 
218  CPointSharedPtr ChangeType()
219  {
220  CPointSharedPtr ret = MemoryManager<CPoint>::
222  return ret;
223  }
224 
225 private:
226  /// surf id
227  int sid;
228  /// uv coord on surf
231 };
232 typedef boost::shared_ptr<BPoint> BPointSharedPtr;
233 
234 /**
235  * @brief class for a general source point
236  */
237 class SrcPoint : public SPBase
238 {
239 public:
240  friend class MemoryManager<SrcPoint>;
241 
242  /**
243  * @brief constructor for a boundary point without delta
244  */
246  : SPBase(l), m_delta(d)
247  {
248  m_type = eSrcPoint;
249  }
250 
252 
253  /**
254  * @brief get mesh spacing paramter
255  */
257  {
258  return m_delta;
259  }
260 
262  {
263  m_delta = i;
264  }
265 
266  void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
267  {
268  ASSERTL0(false,"Cannot retrieve CAD from this type")
269  }
270 
271 private:
273 };
274 typedef boost::shared_ptr<SrcPoint> SrcPointSharedPtr;
275 
276 }
277 }
278 
279 #endif
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
CPointSharedPtr ChangeType()
Array< OneD, NekDouble > m_loc
x,y,z location
boost::shared_ptr< SrcPoint > SrcPointSharedPtr
void SetDelta(NekDouble i)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void SetDelta(NekDouble i)
void GetCAD(int &surf, Array< OneD, NekDouble > &uv)
Array< OneD, NekDouble > GetLoc()
Definition: SourcePoint.hpp:75
SrcPoint(Array< OneD, NekDouble > l, NekDouble d)
constructor for a boundary point without delta
NekDouble m_delta
delta parameter
BPoint(int i, Array< OneD, NekDouble > uv, Array< OneD, NekDouble > l)
constructor for a boundary point without delta
NekDouble GetDelta()
get mesh spacing paramter
Array< OneD, NekDouble > m_uv
uv coord on surf
Array< OneD, NekDouble > m_uv
uv coord on surf
virtual NekDouble GetDelta()
Definition: SourcePoint.hpp:80
NekDouble GetDelta()
get mesh spacing paramter
class for a general source point
boost::shared_ptr< SPBase > SPBaseSharedPtr
double NekDouble
class for a curvature based samlping Point
base class of sizing point for octree construction these carry information the octree needs and have ...
Definition: SourcePoint.hpp:58
virtual void GetCAD(int &surf, Array< OneD, NekDouble > &uv)
Definition: SourcePoint.hpp:87
class for a planar boundary based samlping Point
void GetCAD(int &surf, Array< OneD, NekDouble > &uv)
gets the corresponding cad information for the point
boost::shared_ptr< BPoint > BPointSharedPtr
virtual void SetDelta(NekDouble i)
Definition: SourcePoint.hpp:85
boost::shared_ptr< CPoint > CPointSharedPtr
SPBase(Array< OneD, NekDouble > l)
Definition: SourcePoint.hpp:63
CPoint(int i, Array< OneD, NekDouble > uv, Array< OneD, NekDouble > l, NekDouble d)
constructor for a valid point (has radius of curvature)
void GetCAD(int &surf, Array< OneD, NekDouble > &uv)
gets the corresponding cad information for the point