G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsNurbsCreator.h
Go to the documentation of this file.
1 
15 // Note:
16 // will provide functions to make bsplines, nurbs etc
17 // like the identity, ruled, l spapes, rings, etc
18 // linear extrude .....
19 // sweep ( eg. half-cylinder by sweeping half-circle
20 // revolve operation
21 
22 #pragma once
23 
25 
26 namespace gismo
27 {
28 
35 template<class T>
37 {
38  typedef memory::unique_ptr<gsGeometry<T> > GeometryPtr;
39  typedef typename gsBSpline<T>::uPtr BSplinePtr;
40  typedef typename gsNurbs<T>::uPtr NurbsPtr;
41  typedef typename gsTensorBSpline<2,T>::uPtr TensorBSpline2Ptr;
42  typedef typename gsTensorBSpline<3,T>::uPtr TensorBSpline3Ptr;
43  typedef typename gsTensorBSpline<4,T>::uPtr TensorBSpline4Ptr;
44  typedef typename gsTensorNurbs<2,T>::uPtr TensorNurbs2Ptr;
45  typedef typename gsTensorNurbs<3,T>::uPtr TensorNurbs3Ptr;
46  typedef typename gsTensorNurbs<4,T>::uPtr TensorNurbs4Ptr;
47 
48 public:
49 
50  static TensorBSpline2Ptr rotate2D(gsTensorBSpline<2,T> const & geo, const T turndeg = 0, const T Tx = 0, const T Ty = 0);
51 
52  static void rotate2D(gsGeometry<T> & geo, const T turndeg = 0, const T Tx = 0, const T Ty = 0);
53 
54  static TensorBSpline2Ptr shift2D(gsTensorBSpline<2,T> const & geo, const T dx = 0, const T dy = 0, const T dz = 0);
55 
56  static void shift2D(gsGeometry<T> & geo, const T dx = 0, const T dy = 0, const T dz = 0);
57 
58  static void shift2D(gsMultiPatch<T> & mp, const T dx = 0, const T dy = 0, const T dz = 0);
59 
60  static TensorBSpline2Ptr mirror2D(gsTensorBSpline<2,T> & geo, bool axis);
61 
62  static void mirror2D(gsGeometry<T> & geo, bool axis);
63 
64  static void mirror2D(gsMultiPatch<T> & mp, bool axis);
65 
66  static TensorBSpline2Ptr scale2D(gsTensorBSpline<2,T> const & geo, T factor = 1.0);
67 
68  static TensorBSpline2Ptr scale2D(gsTensorBSpline<2,T> const & geo, std::vector<T> factors);
69 
70  static void scale2D(gsGeometry<T> & geo, T factor = 1.0);
71 
72  static void scale2D(gsGeometry<T> & geo, std::vector<T> factors);
73 
74  static void scale2D(gsMultiPatch<T> & mp, T factor = 1.0);
75 
76  static void scale2D(gsMultiPatch<T> & mp, std::vector<T> factors);
77 
78  static void makeGrid(gsMultiPatch<T> & mp, const index_t M=0, const index_t N=0);
79 
80  static gsMultiPatch<T> makeGrid(std::vector<gsMultiPatch<T>> & mps, const index_t M=0, const index_t N=0);
81 
82  static TensorBSpline3Ptr lift3D( gsTensorBSpline<2,T> const & geo, T z = 1);
83 
84  static TensorBSpline4Ptr lift4D( gsTensorBSpline<3,T> const & geo, T z = 1);
85 
86  static TensorNurbs3Ptr lift3D( gsTensorNurbs<2,T> const & geo, T z = 1);
87 
88  static TensorNurbs4Ptr lift4D( gsTensorNurbs<3,T> const & geo, T z = 1);
89 
90  /* Computes a set of control points, weights, and knots that define an order-3 circular arc centered at the origin
91  \param X Defines the X axis of the plane containing the arc
92  \param Y Defines the Y axis of the plane containing the arc
93  \param StartAngle Start angle of the arc in radians
94  \param EndAngle End angle of the arc in radians
95  \param Segments The number of NURBS segments in the resulting arc
96  \param Knots Output container for the resulting arc knot vector
97  \param Weights Output container for the resulting arc control point weights
98  \param ControlPoints Output container for the resulting arc control point positions
99 
100  static gsTensorNurbs<3,T> * circularArc(const vector3& X, const vector3& Y,
101  const T StartAngle, const T EndAngle,
102  const unsinged Segments = 1);
103 */
104 
105  static BSplinePtr BSplineUnitInterval(short_t deg);
106 
108  static TensorBSpline2Ptr BSplineRectangle( T const & low_x = 0,
109  T const & low_y = 0,
110  T const & upp_x = 1,
111  T const & upp_y = 1, T const & turndeg = 0);
112 
114 
116  static TensorBSpline2Ptr BSplineTrapezium( T const & Lbot = 1,
117  T const & Ltop = 0.5,
118  T const & H = 1,
119  T const & d = 0, T const & turndeg = 0);
120 
122  static TensorBSpline2Ptr BSplineTrapezium( T const & Ax, T const & Ay,
123  T const & Bx, T const & By,
124  T const & Cx, T const & Cy,
125  T const & Dx, T const & Dy, T const & turndeg = 0);
126 
128  static TensorNurbs2Ptr NurbsArcTrapezium( T const & Lbot = 1,
129  T const & Ltop = 0.5,
130  T const & H = 1,
131  T const & d = 0, T const & turndeg = 0);
132 
134  static TensorNurbs2Ptr NurbsArcTrapezium( T const & Ax, T const & Ay,
135  T const & Bx, T const & By,
136  T const & Cx, T const & Cy,
137  T const & Dx, T const & Dy, T const & turndeg = 0);
138 
139  // Rectangle described by the identity mapping over the given parameter domain, using tensor product B-splines.
140  static TensorBSpline2Ptr BSplineRectangleWithPara( T low_x = 0, T low_y = 0, T upp_x = 1, T upp_y = 1);
141 
155  static gsMultiPatch<T> BSplineSquareGrid(int n, int m, T const & r = 1,
156  T const & lx = 0, T const & ly = 0);
157 
158  static TensorBSpline2Ptr BSplineSquare( gsMatrix<T> const & Box);
159 
160  // Note: this can probably be removed once we have degree elevation for tensor B-splines.
161  //
163  static TensorBSpline2Ptr BSplineSquareDeg(short_t deg, T scale = (T)(1));
164 
166  static TensorBSpline2Ptr BSplineSquare( T const & r = 1, T const & x = 0, T const & y = 0 );
167 
169  static TensorBSpline3Ptr BSplineCube( T const & r = 1, T const & x = 0,
170  T const & y = 0, T const & z = 0 );
171 
172  // Note: this can probably be removed once we have degree elevation for tensor B-splines.
173  //
175  static TensorBSpline3Ptr BSplineCube(short_t deg);
176 
177  static gsMultiPatch<T> BSplineCubeGrid(int n, int m,int p, T const & r = 1,
178  T const & lx = 0, T const & ly = 0, T const & lz = 0);
179 
180  static TensorBSpline3Ptr BSplineHalfCube( T const & r = 1, T const & x = 0,
181  T const & y = 0, T const & z = 0 );
182 
184  static TensorNurbs3Ptr NurbsCube( T const & r = 1, T const & x = 0,
185  T const & y = 0, T const & z = 0 );
186 
188  static TensorNurbs2Ptr NurbsQuarterAnnulus( T const & r0 = 1, T const & r1 = 2);
190  static TensorNurbs2Ptr NurbsAnnulus( T const & r0 =1, T const & r1 =2);
191 
192  static TensorNurbs3Ptr BSplineSaddle();
194  static GeometryPtr BSplineQuarterAnnulus(const short_t & deg = 2);
195 
196  //static TensorNurbs2Ptr NurbsQuarterAnnulusMixedWithLShape();
197  //static GeometryPtr BSplineQuarterAnnulusMixedWithLShape(const short_t & deg = 2);
198 
202  static TensorBSpline2Ptr BSplineFatQuarterAnnulus( T const & r0 = 1, T const & r1 = 2);
203 
205  static TensorNurbs2Ptr NurbsSphere( T const & r = 1, T const & x = 0, T const & y = 0, T const & z = 0);
207  static NurbsPtr NurbsCircle( T const & r = (T)(1), T const & x = 0, T const & y = 0);
209  static BSplinePtr BSplineFatCircle( T const & r = (T)(1), T const & x = 0, T const & y = 0);
211  static TensorBSpline2Ptr BSplineFatDisk (T const & r = 1, T const & x = 0, T const & y = 0);
212 
213  static NurbsPtr NurbsCurve1 (T const & r = 1, T const & x = 0, T const & y = 0);
214 
215  static NurbsPtr NurbsCurve2 (T const & r = 1, T const & x = 0, T const & y = 0);
216 
217  static NurbsPtr NurbsBean(T const & r = 1, T const & x = 0, T const & y = 0);
218 
219  static BSplinePtr BSplineE (T const & r = 1, T const & x = 0, T const & y = 0);
220 
221  static NurbsPtr NurbsAmoebaFull(T const & r = 1, T const & x = 0, T const & y = 0);
222 
223  static BSplinePtr BSplineLineSegment(gsMatrix<T> const & p0, gsMatrix<T> const & p1 );
224 
225  static BSplinePtr BSplineSegment(T const u0 = 0, T const u1 = 1);
226 
228  static TensorBSpline2Ptr BSplineLShape_p1(T r = (T)(1));
229 
232  static TensorBSpline2Ptr BSplineLShape_p2C0();
233 
236  static TensorBSpline2Ptr BSplineLShape_p2C1();
237 
241 
242  static BSplinePtr BSplineAmoeba(T const & r=1, T const & x=0, T const & y = 0);
243 
244  static BSplinePtr BSplineAmoebaBig(T const & r=1, T const & x=0, T const & y = 0);
245 
246  static BSplinePtr BSplineAustria(T const & r=1, T const & x=0, T const & y = 0);
247 
248  static BSplinePtr BSplineFish(T const & r=1, T const & x=0, T const & y = 0);
249 
250  static BSplinePtr BSplineAmoeba3degree(T const & r=1, T const & x=0, T const & y = 0);
251 
252  static TensorNurbs2Ptr NurbsDisk(T const & r=1, T const & x=0, T const & y = 0);
253 
254  static TensorBSpline2Ptr NurbsQrtPlateWHoleC0();
255 
257  static TensorBSpline2Ptr BSplineTriangle(T const & H = 1, T const & W = 1);
258 
260  static gsMultiPatch<T> BSplineStar(index_t const & N = 3, T const & R0 = 1, T const & R1 = 0.5 );
261 
262 }; // struct
263 
264 #ifdef GISMO_WITH_PYBIND11
265 
269  void pybind11_init_gsNurbsCreator(pybind11::module &m);
270 
271 #endif
272 
273 } // namespace gismo
274 
275 #ifndef GISMO_BUILD_LIB
276 #include GISMO_HPP_HEADER(gsNurbsCreator.hpp)
277 #endif
Class gsNurbsCreator provides some simple examples of Nurbs Geometries.
Definition: gsNurbsCreator.h:36
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
static TensorNurbs2Ptr NurbsAnnulus(T const &r0=1, T const &r1=2)
Exact full annulus using NURBS with inner radius r0 and outer radius r1.
Definition: gsNurbsCreator.hpp:851
static TensorNurbs3Ptr NurbsCube(T const &r=1, T const &x=0, T const &y=0, T const &z=0)
Cube of side r, with lower left corner at (x,y,z) using NURBS.
Definition: gsNurbsCreator.hpp:814
static TensorNurbs2Ptr NurbsQuarterAnnulus(T const &r0=1, T const &r1=2)
Exact annulus using NURBS with inner radius r0 and outer radius r1.
Definition: gsNurbsCreator.hpp:832
static gsMultiPatch< T > BSplineStar(index_t const &N=3, T const &R0=1, T const &R1=0.5)
Makes a star with N patches, outer radius R0 and inner radius R1.
Definition: gsNurbsCreator.hpp:1650
static TensorBSpline2Ptr BSplineFatDisk(T const &r=1, T const &x=0, T const &y=0)
Inexact disk using B-splines.
Definition: gsNurbsCreator.hpp:1056
memory::unique_ptr< gsTensorBSpline > uPtr
Unique pointer for gsTensorBSpline.
Definition: gsTensorBSpline.h:62
#define short_t
Definition: gsConfig.h:35
A tensor product of d B-spline functions, with arbitrary target dimension.
Definition: gsTensorBSpline.h:44
A tensor product Non-Uniform Rational B-spline function (NURBS) of parametric dimension d...
Definition: gsTensorNurbs.h:40
memory::unique_ptr< gsTensorNurbs > uPtr
Unique pointer for gsTensorNurbs.
Definition: gsTensorNurbs.h:69
static TensorBSpline2Ptr BSplineLShape_p1(T r=(T)(1))
L-Shaped domain represented as a tensor B-spline of degree 1.
Definition: gsNurbsCreator.hpp:1262
memory::unique_ptr< gsBSpline > uPtr
Unique pointer for gsBSpline.
Definition: gsBSpline.h:63
static gsMultiPatch< T > BSplineSquareGrid(int n, int m, T const &r=1, T const &lx=0, T const &ly=0)
Definition: gsNurbsCreator.hpp:691
#define index_t
Definition: gsConfig.h:32
static BSplinePtr BSplineFatCircle(T const &r=(T)(1), T const &x=0, T const &y=0)
Inexact circle using B-splines.
Definition: gsNurbsCreator.hpp:1034
static TensorBSpline2Ptr BSplineRectangle(T const &low_x=0, T const &low_y=0, T const &upp_x=1, T const &upp_y=1, T const &turndeg=0)
2d-rectange [low_x,upp_x] x [low_y,upp_y], rotated by turndeg degrees.
Definition: gsNurbsCreator.hpp:449
static TensorBSpline3Ptr BSplineCube(T const &r=1, T const &x=0, T const &y=0, T const &z=0)
Cube of side r, with lower left corner at (x,y,z)
Definition: gsNurbsCreator.hpp:731
static GeometryPtr BSplineQuarterAnnulus(const short_t &deg=2)
Inexact annulus using B-splines.
Definition: gsNurbsCreator.hpp:888
Provides forward declarations of types and structs.
static TensorBSpline2Ptr BSplineFatQuarterAnnulus(T const &r0=1, T const &r1=2)
Definition: gsNurbsCreator.hpp:949
static NurbsPtr NurbsCircle(T const &r=(T)(1), T const &x=0, T const &y=0)
Circle using NURBS.
Definition: gsNurbsCreator.hpp:1009
static gsMultiPatch< T > BSplineLShapeMultiPatch_p2()
Definition: gsNurbsCreator.hpp:1357
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
static TensorBSpline2Ptr BSplineSquareDeg(short_t deg, T scale=(T)(1))
The unit square represented as a tensor B-spline of degree deg.
Definition: gsNurbsCreator.hpp:721
static TensorNurbs2Ptr NurbsArcTrapezium(T const &Lbot=1, T const &Ltop=0.5, T const &H=1, T const &d=0, T const &turndeg=0)
2d-trapezium
Definition: gsNurbsCreator.hpp:640
static TensorBSpline2Ptr BSplineTriangle(T const &H=1, T const &W=1)
Makes a Isosceles triangle with height H and width W.
Definition: gsNurbsCreator.hpp:1636
static TensorBSpline2Ptr BSplineLShape_p2C1()
Definition: gsNurbsCreator.hpp:1319
static TensorNurbs2Ptr NurbsSphere(T const &r=1, T const &x=0, T const &y=0, T const &z=0)
Sphere using NURBS.
Definition: gsNurbsCreator.hpp:970
static TensorBSpline2Ptr BSplineTrapezium(T const &Lbot=1, T const &Ltop=0.5, T const &H=1, T const &d=0, T const &turndeg=0)
Rectangle described by the identity mapping over the given parameter domain, using tensor product B-s...
Definition: gsNurbsCreator.hpp:539
static TensorBSpline2Ptr BSplineLShape_p2C0()
Definition: gsNurbsCreator.hpp:1287
memory::unique_ptr< gsNurbs > uPtr
Unique pointer for gsNurbs.
Definition: gsNurbs.h:57