Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CADVert.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_CADVERT
37 #define NEKMESHUTILS_CADSYSTEM_CADVERT
38 
39 #include <boost/shared_ptr.hpp>
40 
43 
47 
48 namespace Nektar
49 {
50 namespace NekMeshUtils
51 {
52 
53 /**
54  * @brief class for CAD curves.
55  *
56  * This class wraps the OpenCascade BRepAdaptor_Curve class for use with
57  * Nektar++.
58  */
59 class CADVert : public CADObj
60 {
61 public:
62  friend class MemoryManager<CADVert>;
63 
64  /**
65  * @brief Default constructor.
66  */
67  CADVert(int i, TopoDS_Shape in)
68  {
69  gp_Trsf transform;
70  gp_Pnt ori(0.0, 0.0, 0.0);
71  transform.SetScale(ori, 1.0 / 1000.0);
72  TopLoc_Location mv(transform);
73  in.Move(mv);
74 
75  m_id = i;
76  m_occVert = BRep_Tool::Pnt(TopoDS::Vertex(in));
77 
78  m_node = boost::shared_ptr<Node>(
79  new Node(i - 1, m_occVert.X(), m_occVert.Y(), m_occVert.Z()));
80  degen = false;
81 
82  m_type = vert;
83  }
84 
85  ~CADVert(){};
86 
87  /**
88  * @brief Get x,y,z location of the vertex
89  */
91  {
93  out[0] = m_occVert.X();
94  out[1] = m_occVert.Y();
95  out[2] = m_occVert.Z();
96  return out;
97  }
98 
99  /**
100  * @brief returns a node object of the cad vertex
101  */
103  {
104  return m_node;
105  }
106 
107  /**
108  * @brief if the vertex is degenerate manually set uv for that surface
109  */
111  {
112  degen = true;
113  degensurf = s;
115  uv[0] = u;
116  uv[1] = v;
117  m_node->SetCADSurf(s, su, uv);
118  }
119 
120  /**
121  * @brief query is degenerate
122  */
123  int IsDegen()
124  {
125  if (degen)
126  {
127  return degensurf;
128  }
129  else
130  {
131  return -1;
132  }
133  }
134 
135 private:
136  /// OpenCascade object of the curve.
137  gp_Pnt m_occVert;
138  /// mesh convert object of vert
140  /// degen marker
141  bool degen;
142  // degen surface
144 };
145 
146 typedef boost::shared_ptr<CADVert> CADVertSharedPtr;
147 }
148 }
149 
150 #endif
class for CAD curves.
Definition: CADObj.h:62
NodeSharedPtr m_node
mesh convert object of vert
Definition: CADVert.h:139
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
Represents a point in the domain.
Definition: Node.h:60
CADVert(int i, TopoDS_Shape in)
Default constructor.
Definition: CADVert.h:67
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
double NekDouble
int IsDegen()
query is degenerate
Definition: CADVert.h:123
Array< OneD, NekDouble > GetLoc()
Get x,y,z location of the vertex.
Definition: CADVert.h:90
int m_id
ID of the vert.
Definition: CADObj.h:91
class for CAD curves.
Definition: CADVert.h:59
boost::shared_ptr< CADSurf > CADSurfSharedPtr
Definition: CADSurf.h:217
gp_Pnt m_occVert
OpenCascade object of the curve.
Definition: CADVert.h:137
NodeSharedPtr GetNode()
returns a node object of the cad vertex
Definition: CADVert.h:102
cadType m_type
type of the cad object
Definition: CADObj.h:93
boost::shared_ptr< CADVert > CADVertSharedPtr
Definition: CADSystem.h:51
bool degen
degen marker
Definition: CADVert.h:141
void SetDegen(int s, CADSurfSharedPtr su, NekDouble u, NekDouble v)
if the vertex is degenerate manually set uv for that surface
Definition: CADVert.h:110