Nektar++
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 // 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: class and methods of curvature sampling point
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKMESHUTILS_OCTREE_SOURCEPOINT_H
36 #define NEKMESHUTILS_OCTREE_SOURCEPOINT_H
37 
38 #include <boost/core/ignore_unused.hpp>
39 
42 
43 namespace Nektar
44 {
45 namespace NekMeshUtils
46 {
47 
48 enum SPType
49 {
50  eCBoundary, // on a curved boundary
51  ePBoundary, // on a planar boundary (R=inf)
52  eSrcPoint // source point
53 };
54 
55 /**
56  * @brief base class of sizing point for octree construction
57  * these carry information the octree needs and have various types
58  */
59 class SPBase
60 {
61 public:
62  friend class MemoryManager<SPBase>;
63 
65  {
66  m_loc = l;
67  }
68 
69  virtual ~SPBase(){}
70 
72  {
73  return m_type;
74  }
75 
77  {
78  return m_loc;
79  }
80 
81  virtual NekDouble GetDelta()
82  {
83  return 0.0;
84  }
85 
86  virtual void SetDelta(NekDouble i)
87  {
88  boost::ignore_unused(i);
89  }
90 
91  virtual void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
92  {
93  boost::ignore_unused(surf, uv);
94  }
95 
96  bool HasDelta()
97  {
98  bool ret;
99  if(m_type == eCBoundary || m_type == eSrcPoint)
100  {
101  ret = true;
102  }
103  else
104  {
105  ret = false;
106  }
107  return ret;
108  }
109 
110  bool Isboundary()
111  {
112  bool ret;
113  if(m_type == eCBoundary || m_type == ePBoundary)
114  {
115  ret = true;
116  }
117  else
118  {
119  ret = false;
120  }
121  return ret;
122  }
123 
124 protected:
125  /// type
127  /// x,y,z location
129 };
130 
131 typedef std::shared_ptr<SPBase> SPBaseSharedPtr;
132 
133 /**
134  * @brief class for a curvature based samlping Point
135  */
136 class CPoint : public SPBase
137 {
138 public:
139  friend class MemoryManager<CPoint>;
140 
141  /**
142  * @brief constructor for a valid point (has radius of curvature)
143  */
145  NekDouble d)
146  : SPBase(l), sid(i), m_uv(uv), m_delta(d)
147  {
148  m_type = eCBoundary;
149  }
150 
151  ~CPoint(){};
152 
153  /**
154  * @brief get mesh spacing paramter
155  */
157  {
158  return m_delta;
159  }
160 
161  /**
162  * @brief gets the corresponding cad information for the point
163  */
164  void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
165  {
166  surf = sid;
167  uv = m_uv;
168  }
169 
171  {
172  m_delta = i;
173  }
174 
175 private:
176  /// surf id
177  int sid;
178  /// uv coord on surf
181  /// delta parameter
183 };
184 typedef std::shared_ptr<CPoint> CPointSharedPtr;
185 
186 /**
187  * @brief class for a planar boundary based samlping Point
188  */
189 class BPoint : public SPBase
190 {
191 public:
192  friend class MemoryManager<BPoint>;
193 
194  /**
195  * @brief constructor for a boundary point without delta
196  */
198  : SPBase(l), sid(i), m_uv(uv)
199  {
200  m_type = ePBoundary;
201  }
202 
203  ~BPoint(){};
204 
206  {
207  NEKERROR(ErrorUtil::efatal, "Cannot retrieve delta from this type");
208  return 0.0;
209  }
210 
212  {
213  boost::ignore_unused(i);
214  NEKERROR(ErrorUtil::efatal, "Cannot retrieve delta from this type");
215  }
216 
217  /**
218  * @brief gets the corresponding cad information for the point
219  */
220  void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
221  {
222  surf = sid;
223  uv = m_uv;
224  }
225 
226  CPointSharedPtr ChangeType()
227  {
228  CPointSharedPtr ret = MemoryManager<CPoint>::
229  AllocateSharedPtr(sid, m_uv, m_loc, -1.0);
230  return ret;
231  }
232 
233 private:
234  /// surf id
235  int sid;
236  /// uv coord on surf
239 };
240 typedef std::shared_ptr<BPoint> BPointSharedPtr;
241 
242 /**
243  * @brief class for a general source point
244  */
245 class SrcPoint : public SPBase
246 {
247 public:
248  friend class MemoryManager<SrcPoint>;
249 
250  /**
251  * @brief constructor for a boundary point without delta
252  */
254  : SPBase(l), m_delta(d)
255  {
256  m_type = eSrcPoint;
257  }
258 
260 
261  /**
262  * @brief get mesh spacing paramter
263  */
265  {
266  return m_delta;
267  }
268 
270  {
271  m_delta = i;
272  }
273 
274  void GetCAD(int &surf, Array<OneD, NekDouble> &uv)
275  {
276  boost::ignore_unused(surf, uv);
277  NEKERROR(ErrorUtil::efatal, "Cannot retrieve CAD from this type")
278  }
279 
280 private:
282 };
283 typedef std::shared_ptr<SrcPoint> SrcPointSharedPtr;
284 
285 }
286 }
287 
288 #endif
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
CPointSharedPtr ChangeType()
std::shared_ptr< BPoint > BPointSharedPtr
Array< OneD, NekDouble > m_loc
x,y,z location
void SetDelta(NekDouble i)
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:76
SrcPoint(Array< OneD, NekDouble > l, NekDouble d)
constructor for a boundary point without delta
std::shared_ptr< SrcPoint > SrcPointSharedPtr
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:81
NekDouble GetDelta()
get mesh spacing paramter
class for a general source point
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< CPoint > CPointSharedPtr
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:59
virtual void GetCAD(int &surf, Array< OneD, NekDouble > &uv)
Definition: SourcePoint.hpp:91
class for a planar boundary based samlping Point
void GetCAD(int &surf, Array< OneD, NekDouble > &uv)
gets the corresponding cad information for the point
virtual void SetDelta(NekDouble i)
Definition: SourcePoint.hpp:86
SPBase(Array< OneD, NekDouble > l)
Definition: SourcePoint.hpp:64
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
std::shared_ptr< SPBase > SPBaseSharedPtr