Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CADCurveOCE.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_OCE_CADCURVEOCE
37 #define NEKMESHUTILS_CADSYSTEM_OCE_CADCURVEOCE
38 
41 
42 namespace Nektar
43 {
44 namespace NekMeshUtils
45 {
46 
47 class CADCurveOCE : public CADCurve
48 {
49 public:
50 
52  {
54  }
55 
56  static std::string key;
57 
59  {
60  }
61 
63  {
64  }
65 
67  virtual NekDouble Length(NekDouble ti, NekDouble tf);
70  virtual NekDouble tAtArcLength(NekDouble s);
73  virtual NekDouble Curvature(NekDouble t);
74  virtual Array<OneD, NekDouble> NormalWRT(NekDouble t, int surf);
76 
77  void Initialise(int i, TopoDS_Shape in)
78  {
79  gp_Trsf transform;
80  gp_Pnt ori(0.0, 0.0, 0.0);
81  transform.SetScale(ori, 1.0 / 1000.0);
82  TopLoc_Location mv(transform);
83  TopoDS_Shape cp = in;
84  in.Move(mv);
85 
86  m_occEdge = TopoDS::Edge(in);
87  m_occCurve = BRepAdaptor_Curve(m_occEdge);
88 
89  GProp_GProps System;
90  BRepGProp::LinearProperties(m_occEdge, System);
91  m_length = System.Mass();
92 
94  m_c = BRep_Tool::Curve(TopoDS::Edge(cp), b[0], b[1]);
95 
96  m_id = i;
97  }
98 
99 private:
100  /// OpenCascade object of the curve.
101  BRepAdaptor_Curve m_occCurve;
102  /// OpenCascade edge
103  TopoDS_Edge m_occEdge;
104  /// Alternate object used for reverse lookups
105  Handle(Geom_Curve) m_c;
106 };
107 
108 }
109 }
110 
111 #endif
base class for CAD curves.
Definition: CADCurve.h:52
Handle(Geom_Curve) m_c
Alternate object used for reverse lookups.
virtual Array< OneD, NekDouble > GetMinMax()
Gets the start and end of the curve.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual Array< OneD, NekDouble > P(NekDouble t)
Gets the location (x,y,z) in an array out of the curve at point t.
Definition: CADCurveOCE.cpp:99
void Initialise(int i, TopoDS_Shape in)
Definition: CADCurveOCE.h:77
BRepAdaptor_Curve m_occCurve
OpenCascade object of the curve.
Definition: CADCurveOCE.h:101
virtual NekDouble tAtArcLength(NekDouble s)
Calculates the parametric coordinate and arclength location defined by s.
Definition: CADCurveOCE.cpp:48
virtual NekDouble Curvature(NekDouble t)
virtual Array< OneD, NekDouble > N(NekDouble t)
virtual Array< OneD, NekDouble > D2(NekDouble t)
Gets the second derivatives at t.
virtual Array< OneD, NekDouble > GetBounds()
Returns the minimum and maximum parametric coords t of the curve.
double NekDouble
virtual NekDouble Length(NekDouble ti, NekDouble tf)
Calculates the arclength between the two paremetric points ti and tf. ti must be less than tf...
Definition: CADCurveOCE.cpp:71
int m_id
ID of the vert.
Definition: CADObject.h:105
static CADCurveSharedPtr create()
Definition: CADCurveOCE.h:51
TopoDS_Edge m_occEdge
OpenCascade edge.
Definition: CADCurveOCE.h:103
virtual Array< OneD, NekDouble > NormalWRT(NekDouble t, int surf)
NekDouble m_length
Length of edge.
Definition: CADCurve.h:187
virtual NekDouble loct(Array< OneD, NekDouble > xyz)
Definition: CADCurveOCE.cpp:81
boost::shared_ptr< CADCurve > CADCurveSharedPtr
Definition: CADCurve.h:194