Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CADCurve.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: CADCurve.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 curve.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKMESHUTILS_CADSYSTEM_CADCURVE
37 #define NEKMESHUTILS_CADSYSTEM_CADCURVE
38 
39 #include <boost/shared_ptr.hpp>
40 
43 
45 
49 
50 namespace Nektar
51 {
52 namespace NekMeshUtils
53 {
54 
55 /**
56  * @brief class for CAD curves.
57  *
58  * This class wraps the OpenCascade BRepAdaptor_Curve class for use with
59  * Nektar++.
60  */
61 class CADCurve : public CADObj
62 {
63 public:
64  friend class MemoryManager<CADCurve>;
65 
66  /**
67  * @brief Default constructor.
68  */
69  CADCurve(int i, TopoDS_Shape in);
70 
71  ~CADCurve(){};
72 
73  /**
74  * @brief Returns the minimum and maximum parametric coords t of the curve.
75  *
76  * @return Array of two entries, min and max parametric coordinate.
77  */
79 
80  /**
81  * @brief Calculates the arclength between the two paremetric points \p ti
82  * and \p tf. \p ti must be less than \p tf.
83  *
84  * @param ti First parametric coordinate.
85  * @param tf Second parametric coordinate.
86  * @return Arc length between \p ti and \p tf.
87  */
89 
90  /**
91  * @brief Gets the location (x,y,z) in an array out of the curve at
92  * point \p t.
93  *
94  * @param t Parametric coordinate
95  * @return Array of x,y,z
96  */
98 
99  /**
100  * @brief Gets the second derivatives at t
101  */
103 
104  /**
105  * @brief Calculates the parametric coordinate and arclength location
106  * defined by \p s.
107  *
108  * @param s Arclength location.
109  * @return Calculated parametric coordinate.
110  *
111  * @todo This really needs improving for accuracy.
112  */
114 
115  /**
116  * @brief Gets the start and end of the curve.
117  *
118  * @return Array with 6 entries of endpoints x1,y1,z1,x2,y2,z2.
119  */
121 
122  /// set the ids of the surfaces either side of the curve
123  void SetAdjSurf(std::vector<CADSurfSharedPtr> i)
124  {
125  m_adjSurfs = i;
126  }
127 
128  /// returns the ids of neigbouring surfaces
129  std::vector<CADSurfSharedPtr> GetAdjSurf()
130  {
131  return m_adjSurfs;
132  }
133 
134  /// returns lenght of the curve
136  {
137  return m_length;
138  }
139 
140  /*
141  * @brief assign ids of end vertices in main cad
142  */
143  void SetVert(std::vector<CADVertSharedPtr> &falVert)
144  {
145  m_mainVerts = falVert;
146  }
147 
148  /// get the ids of the vertices that are the ends of the curve,
149  /// which are in the main cad list
150  std::vector<CADVertSharedPtr> GetVertex()
151  {
152  return m_mainVerts;
153  }
154 
155 private:
156  /// OpenCascade object of the curve.
157  BRepAdaptor_Curve m_occCurve;
158  /// OpenCascade edge
159  TopoDS_Edge m_occEdge;
160  /// Length of edge
162  /// List of surfaces which this curve belongs to.
163  std::vector<CADSurfSharedPtr> m_adjSurfs;
164  /// list of end vertices
165  std::vector<CADVertSharedPtr> m_mainVerts;
166 };
167 
168 typedef boost::shared_ptr<CADCurve> CADCurveSharedPtr;
169 }
170 }
171 
172 #endif
NekDouble GetTotLength()
returns lenght of the curve
Definition: CADCurve.h:135
class for CAD curves.
Definition: CADCurve.h:61
class for CAD curves.
Definition: CADObj.h:62
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
CADCurve(int i, TopoDS_Shape in)
Default constructor.
Definition: CADCurve.cpp:45
Array< OneD, NekDouble > D2(NekDouble t)
Gets the second derivatives at t.
Definition: CADCurve.cpp:110
Array< OneD, NekDouble > GetMinMax()
Gets the start and end of the curve.
Definition: CADCurve.cpp:139
std::vector< CADVertSharedPtr > m_mainVerts
list of end vertices
Definition: CADCurve.h:165
void SetVert(std::vector< CADVertSharedPtr > &falVert)
Definition: CADCurve.h:143
std::vector< CADSurfSharedPtr > GetAdjSurf()
returns the ids of neigbouring surfaces
Definition: CADCurve.h:129
NekDouble Length(NekDouble ti, NekDouble tf)
Calculates the arclength between the two paremetric points ti and tf. ti must be less than tf...
Definition: CADCurve.cpp:87
Array< OneD, NekDouble > P(NekDouble t)
Gets the location (x,y,z) in an array out of the curve at point t.
Definition: CADCurve.cpp:98
double NekDouble
NekDouble tAtArcLength(NekDouble s)
Calculates the parametric coordinate and arclength location defined by s.
Definition: CADCurve.cpp:64
NekDouble m_length
Length of edge.
Definition: CADCurve.h:161
TopoDS_Edge m_occEdge
OpenCascade edge.
Definition: CADCurve.h:159
Array< OneD, NekDouble > Bounds()
Returns the minimum and maximum parametric coords t of the curve.
Definition: CADCurve.cpp:130
std::vector< CADVertSharedPtr > GetVertex()
get the ids of the vertices that are the ends of the curve, which are in the main cad list ...
Definition: CADCurve.h:150
void SetAdjSurf(std::vector< CADSurfSharedPtr > i)
set the ids of the surfaces either side of the curve
Definition: CADCurve.h:123
BRepAdaptor_Curve m_occCurve
OpenCascade object of the curve.
Definition: CADCurve.h:157
std::vector< CADSurfSharedPtr > m_adjSurfs
List of surfaces which this curve belongs to.
Definition: CADCurve.h:163
boost::shared_ptr< CADCurve > CADCurveSharedPtr
Definition: CADCurve.h:168