Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CADSurf.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: CADSurf.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: CAD object surface.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NekMeshUtils_CADSYSTEM_CADSURF
37 #define NekMeshUtils_CADSYSTEM_CADSURF
38 
42 
43 namespace Nektar
44 {
45 namespace NekMeshUtils
46 {
47 
48 class CADCurve;
49 typedef boost::shared_ptr<CADCurve> CADCurveSharedPtr;
50 
51 /**
52  * @brief base class for a cad surface
53  */
54 
55 class CADSurf : public CADObject
56 {
57 public:
58  friend class MemoryManager<CADSurf>;
59 
60  /**
61  * @brief Default constructor.
62  */
64  {
67  }
68 
70  {
71  }
72 
73  static void OrientateEdges(
74  CADSurfSharedPtr surf, std::vector<CADSystem::EdgeLoopSharedPtr> &ein);
75 
76  /**
77  * @brief Get the loop structures which bound the cad surface
78  */
79  std::vector<CADSystem::EdgeLoopSharedPtr> GetEdges()
80  {
81  return m_edges;
82  }
83 
84  void SetEdges(std::vector<CADSystem::EdgeLoopSharedPtr> ein)
85  {
86  m_edges = ein;
87  }
88 
89  /**
90  * @brief Get the limits of the parametric space for the surface.
91  *
92  * @return Array of 4 entries with parametric umin,umax,vmin,vmax.
93  */
94  virtual Array<OneD, NekDouble> GetBounds() = 0;
95 
96  /**
97  * @brief Get the normal vector at parametric point u,v.
98  *
99  * @param uv Array of u and v parametric coords.
100  * @return Array of xyz components of normal vector.
101  */
103 
104  /**
105  * @brief Get the set of first derivatives at parametric point u,v
106  *
107  * @param uv Array of u and v parametric coords.
108  * @return Array of xyz copmonents of first derivatives.
109  */
111 
112  /**
113  * @brief Get the set of second derivatives at parametric point u,v
114  *
115  * @param uv array of u and v parametric coords
116  * @return array of xyz copmonents of second derivatives
117  */
119 
120  /**
121  * @brief Get the x,y,z at parametric point u,v.
122  *
123  * @param uv Array of u and v parametric coords.
124  * @return Array of xyz location.
125  */
127 
128  /**
129  * @brief Performs a reverse look up to find u,v and x,y,z.
130  *
131  * @param p Array of xyz location
132  * @return The parametric location of xyz on this surface
133  */
135 
136  /**
137  * @brief does unconstrained locuv to project point from anywhere
138  * and calculate the distance between the orthonormal projection to the
139  * surface
140  * and the point
141  */
143 
144  /**
145  * @brief takes a point from anywhere find the nearest surface point and its
146  * uv
147  */
148  virtual void ProjectTo(Array<OneD, NekDouble> &tp,
149  Array<OneD, NekDouble> &uv) = 0;
150 
151  /**
152  * @brief returns curvature at point uv
153  */
155 
156  /**
157  * @brief query reversed normal
158  */
160  {
161  return m_orientation;
162  }
163 
164 protected:
165  /// List of bounding edges in loops with orientation.
166  std::vector<CADSystem::EdgeLoopSharedPtr> m_edges;
167 
168  /// Function which tests the the value of uv used is within the surface
169  virtual void Test(Array<OneD, NekDouble> uv) = 0;
170 };
171 
172 typedef boost::shared_ptr<CADSurf> CADSurfSharedPtr;
173 
175 
176 CADSurfFactory &GetCADSurfFactory();
177 }
178 }
179 
180 #endif
std::vector< CADSystem::EdgeLoopSharedPtr > m_edges
List of bounding edges in loops with orientation.
Definition: CADSurf.h:166
virtual Array< OneD, NekDouble > N(Array< OneD, NekDouble > uv)=0
Get the normal vector at parametric point u,v.
CADType::cadType m_type
type of the cad object
Definition: CADObject.h:107
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
CADOrientation::Orientation Orientation()
query reversed normal
Definition: CADSurf.h:159
std::vector< CADSystem::EdgeLoopSharedPtr > GetEdges()
Get the loop structures which bound the cad surface.
Definition: CADSurf.h:79
virtual NekDouble DistanceTo(Array< OneD, NekDouble > p)=0
does unconstrained locuv to project point from anywhere and calculate the distance between the orthon...
CADSurfFactory & GetCADSurfFactory()
Definition: CADSystem.cpp:72
CADOrientation::Orientation m_orientation
orientation of the CADObject
Definition: CADObject.h:109
virtual Array< OneD, NekDouble > P(Array< OneD, NekDouble > uv)=0
Get the x,y,z at parametric point u,v.
virtual NekDouble Curvature(Array< OneD, NekDouble > uv)=0
returns curvature at point uv
base class for a cad surface
Definition: CADSurf.h:55
double NekDouble
virtual void ProjectTo(Array< OneD, NekDouble > &tp, Array< OneD, NekDouble > &uv)=0
takes a point from anywhere find the nearest surface point and its uv
CADSurf()
Default constructor.
Definition: CADSurf.h:63
boost::shared_ptr< CADSurf > CADSurfSharedPtr
Definition: CADSurf.h:172
virtual Array< OneD, NekDouble > locuv(Array< OneD, NekDouble > p)=0
Performs a reverse look up to find u,v and x,y,z.
static void OrientateEdges(CADSurfSharedPtr surf, std::vector< CADSystem::EdgeLoopSharedPtr > &ein)
Definition: CADSurf.cpp:54
virtual void Test(Array< OneD, NekDouble > uv)=0
Function which tests the the value of uv used is within the surface.
virtual Array< OneD, NekDouble > D2(Array< OneD, NekDouble > uv)=0
Get the set of second derivatives at parametric point u,v.
virtual Array< OneD, NekDouble > GetBounds()=0
Get the limits of the parametric space for the surface.
void SetEdges(std::vector< CADSystem::EdgeLoopSharedPtr > ein)
Definition: CADSurf.h:84
boost::shared_ptr< CADCurve > CADCurveSharedPtr
Definition: CADCurve.h:194
LibUtilities::NekFactory< std::string, CADSurf > CADSurfFactory
Definition: CADSurf.h:174
Provides a generic Factory class.
Definition: NekFactory.hpp:116
virtual Array< OneD, NekDouble > D1(Array< OneD, NekDouble > uv)=0
Get the set of first derivatives at parametric point u,v.