Nektar++
Loading...
Searching...
No Matches
CADVert.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: CADVert.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// 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:
32//
33////////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SPATIALDOMAINS_CADSYSTEM_CADVERT
36#define NEKTAR_SPATIALDOMAINS_CADSYSTEM_CADVERT
37
40
42
45
47{
48
49// forward decleration
50class Node;
51typedef std::shared_ptr<Node> NodeSharedPtr;
52class CADSurf;
53typedef std::shared_ptr<CADSurf> CADSurfSharedPtr;
54class CADCurve;
55typedef std::shared_ptr<CADCurve> CADCurveSharedPtr;
56
57/**
58 * @brief base class for CAD verticies.
59 *
60 */
61class CADVert : public CADObject
62{
63public:
64 friend class MemoryManager<CADVert>;
65
66 /**
67 * @brief Default constructor.
68 */
70 {
72 }
73
74 ~CADVert() override {};
75
76 /**
77 * @brief Get x,y,z location of the vertex
78 */
79 SPATIAL_DOMAINS_EXPORT std::array<NekDouble, 3> GetLoc();
80
81 /**
82 * @brief returns a node object of the cad vertex
83 */
84 // NodeSharedPtr GetNode()
85 // {
86 // return m_node;
87 // }
88
89 /**
90 * @brief if the vertex is degenerate manually set uv for that surface
91 */
92 void SetDegen(int s, CADSurfSharedPtr su, NekDouble u, NekDouble v);
93
94 /**
95 * @brief parametric location on the degenerate surface, as recorded by
96 * SetDegen. Only meaningful when IsDegen() is not -1.
97 */
98 std::array<NekDouble, 2> GetDegenUV()
99 {
100 return m_degenUV;
101 }
102
103 /**
104 * @brief query is degenerate
105 */
107 {
108 if (degen)
109 {
110 return degensurf;
111 }
112 else
113 {
114 return -1;
115 }
116 }
117
118 /**
119 * @brief Calcuate the distance to a vertex from a point l(x,y,z)
120 */
121 virtual NekDouble DistanceTo(std::array<NekDouble, 3> l) = 0;
122
124 {
125 curves.push_back(c);
126 }
127
128 /**
129 * @brief Get list of CAD curves which are bound by this vertex
130 */
131 std::vector<std::weak_ptr<CADCurve>> GetAdjCurves()
132 {
133 return curves;
134 }
135
136protected:
137 /// mesh convert object of vert
138 std::array<NekDouble, 3> m_loc{{0, 0, 0}};
139 /// degen marker
140 bool degen;
141 /// degen surface
143 /// parametric location on the degen surface
144 std::array<NekDouble, 2> m_degenUV{{0.0, 0.0}};
145 /// adjacent curves
146 std::vector<std::weak_ptr<CADCurve>> curves;
147};
148
149typedef std::shared_ptr<CADVert> CADVertSharedPtr;
150
152
154
155} // namespace Nektar::SpatialDomains
156
157#endif
#define SPATIAL_DOMAINS_EXPORT
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
base class for CAD curves.
Definition CADCurve.h:58
CADType::cadType m_type
type of the cad object
Definition CADObject.h:148
base class for a cad surface
Definition CADSurf.h:70
base class for CAD verticies.
Definition CADVert.h:62
int IsDegen()
query is degenerate
Definition CADVert.h:106
std::array< NekDouble, 2 > m_degenUV
parametric location on the degen surface
Definition CADVert.h:144
virtual NekDouble DistanceTo(std::array< NekDouble, 3 > l)=0
Calcuate the distance to a vertex from a point l(x,y,z)
Definition CADVert.cpp:59
std::vector< std::weak_ptr< CADCurve > > curves
adjacent curves
Definition CADVert.h:146
std::array< NekDouble, 3 > m_loc
mesh convert object of vert
Definition CADVert.h:138
std::array< NekDouble, 3 > GetLoc()
Get x,y,z location of the vertex.
Definition CADVert.cpp:54
std::array< NekDouble, 2 > GetDegenUV()
parametric location on the degenerate surface, as recorded by SetDegen. Only meaningful when IsDegen(...
Definition CADVert.h:98
CADVert()
Default constructor.
Definition CADVert.h:69
void AddAdjCurve(CADCurveSharedPtr c)
Definition CADVert.h:123
void SetDegen(int s, CADSurfSharedPtr su, NekDouble u, NekDouble v)
returns a node object of the cad vertex
Definition CADVert.cpp:41
std::vector< std::weak_ptr< CADCurve > > GetAdjCurves()
Get list of CAD curves which are bound by this vertex.
Definition CADVert.h:131
int degensurf
degen surface
Definition CADVert.h:142
std::shared_ptr< CADCurve > CADCurveSharedPtr
Definition CADCurve.h:247
std::shared_ptr< CADVert > CADVertSharedPtr
Definition CADCurve.h:49
std::shared_ptr< Node > NodeSharedPtr
Definition CADVert.h:51
LibUtilities::NekFactory< std::string, CADVert > CADVertFactory
Definition CADVert.h:151
std::shared_ptr< CADSurf > CADSurfSharedPtr
Definition CADCurve.h:51
CADVertFactory & GetCADVertFactory()
Definition CADSystem.cpp:48