G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsNurbsBasis.hpp
Go to the documentation of this file.
1
14#pragma once
15
16#include <gsNurbs/gsNurbs.h>
18#include <gsIO/gsXml.h>
20
21namespace gismo
22{
23
24template <class T>
25gsNurbsBasis<T>::~gsNurbsBasis() { }
26
27template <class T>
28typename gsNurbsBasis<T>::gsGeoPtr
30{ return gsGeoPtr(new GeometryType(*this, give(coefs))); }
31
32template <class T>
33typename gsNurbsBasis<T>::gsBasisPtr
34gsNurbsBasis<T>::create(std::vector<KnotVectorType> cKV, gsMatrix<T> weights)
35{
36 const index_t dd = cKV.size();
37 switch (dd)
38 {
39 case 1:
40 return gsBasisPtr(new gsNurbsBasis<T>(give(cKV.front()), give(weights)));
41 break;
42 case 2:
43 return gsBasisPtr(new gsTensorNurbsBasis<2,T>(give(cKV), give(weights)));
44 break;
45 case 3:
46 return gsBasisPtr(new gsTensorNurbsBasis<3,T>(give(cKV), give(weights)));
47 break;
48 case 4:
49 return gsBasisPtr(new gsTensorNurbsBasis<4,T>(give(cKV), give(weights)));
50 break;
51 }
52 GISMO_ERROR("Dimension should be between 1 and 4.");
53}
54
55namespace internal {
57template<class T>
58class gsXml< gsNurbsBasis<T> >
59{
60private:
61 gsXml() { }
62public:
63 GSXML_COMMON_FUNCTIONS(gsNurbsBasis<T>);
64 static std::string tag () { return "Basis"; }
65 static std::string type () { return "NurbsBasis"; }
66
67 static gsNurbsBasis<T> * get (gsXmlNode * node)
68 {
69 return getRationalBasisFromXml<gsNurbsBasis<T> >(node);
70 }
71
72 static gsXmlNode * put (const gsNurbsBasis<T> & obj,
73 gsXmlTree & data )
74 {
75 return putRationalBasisToXml(obj,data);
76 }
77};
78
79}
80
81} // namespace gismo
virtual gsBasis::uPtr create() const
Create an empty basis of the derived type and return a pointer to it.
Definition gsBasis.hpp:532
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A univariate NURBS basis.
Definition gsNurbsBasis.h:40
gsGeoPtr makeGeometry(gsMatrix< T >coefs) const
Clone function. Used to make a copy of a derived basis.
Definition gsNurbsBasis.hpp:29
A NURBS function of one argument, with arbitrary target dimension.
Definition gsNurbs.h:40
A tensor product Non-Uniform Rational B-spline (NURBS) basis.
Definition gsTensorNurbsBasis.h:38
#define index_t
Definition gsConfig.h:32
#define GISMO_ERROR(message)
Definition gsDebug.h:118
Represents a NURBS curve/function with one parameter.
Represents a tensor-product NURBS patch.
Provides implementation of generic XML functions.
Provides declaration of input/output XML utilities struct.
The G+Smo namespace, containing all definitions for the library.
S give(S &x)
Definition gsMemory.h:266