G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsTHBSpline.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsCore/gsLinearAlgebra.h>
19 
20 namespace gismo
21 {
22 
36 template<short_t d, class T>
37 class gsTHBSpline : public gsGeoTraits<d,T>::GeometryBase
38 {
39 public:
41 
42  typedef typename Basis::tensorBasis tensorBasis;
43 
44  typedef typename gsGeoTraits<d,T>::GeometryBase Base;
45 
47  typedef memory::shared_ptr< gsTHBSpline > Ptr;
48 
50  typedef memory::unique_ptr< gsTHBSpline > uPtr;
51 
52  typedef typename
53  util::conditional<d==1, gsConstantFunction<T>, gsTHBSpline<static_cast<short_t>(d-1),T>
54  >::type BoundaryGeometryType;
55 
56  typedef typename gsTHBSplineBasis<d,T>::BoundaryBasisType BoundaryBasisType;
57 
58 public:
59 
62 
64  gsTHBSpline( const Basis & basis, const gsMatrix<T> & coefs ) :
65  Base( basis, coefs )
66  { }
67 
70  Base( basis, coefs )
71  { }
72 
74  explicit gsTHBSpline( const gsTensorBSpline<d,T> & tbsp )
75  {
76  this->m_basis = new Basis( tbsp.basis() );
77  this->m_coefs = tbsp.coefs();
78  }
79 
80  GISMO_CLONE_FUNCTION(gsTHBSpline)
81 
82  GISMO_BASIS_ACCESSORS
83 
84 public:
85 
86 
87 // ************************************************
88 // Other member functions
89 // ************************************************
90 public:
97  void getBsplinePatches(gsMatrix<index_t>& b1, gsMatrix<index_t>& b2, gsVector<index_t>& level) const;
98  //\param[out] bpatches list of B-spline patches associated with the boxes
99  //void getBsplinePatches(gsMatrix<index_t>& b1, gsMatrix<index_t>& b2, gsVector<index_t>& level, std::vector< gsTensorBSpline<2> > & bpatches) const;
100 
102 // void convertToBSpline( gsTensorBSpline<d,T,gsCompactKnotVector<T> >& result );
103 
105  void convertToBSpline( gsTensorBSpline<d,T>& result );
106 
108  void increaseMultiplicity(index_t lvl, int dir, T knotValue, int mult = 1);
109 
110 
111 private:
112 
114  void getBsplinePatchGlobal(gsVector<index_t> b1, gsVector<index_t> b2, unsigned l, gsTensorBSpline<2> geo) const;
116  void globalRefinement(int level)const;
117 
119  void initialize_cmatrix(int col, int c_level) const;
120 
122  void return_cp_1D(const gsMatrix<T> & mat, int direction, gsMatrix<T>& cp)const;
123 
124 public:
125 
129  void slice(index_t dir_fixed,T par,BoundaryGeometryType & result) const;
130 
131 }; // class gsTHBSpline
132 
133 #ifdef GISMO_WITH_PYBIND11
134 
138  void pybind11_init_gsTHBSpline2(pybind11::module &m);
139  void pybind11_init_gsTHBSpline3(pybind11::module &m);
140  void pybind11_init_gsTHBSpline4(pybind11::module &m);
141 
142 #endif // GISMO_WITH_PYBIND11
143 
144 } // namespace gismo
145 
146 
147 #ifndef GISMO_BUILD_LIB
148 #include GISMO_HPP_HEADER(gsTHBSpline.hpp)
149 #endif
memory::unique_ptr< gsTHBSpline > uPtr
Unique pointer for gsTHBSpline.
Definition: gsTHBSpline.h:50
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
gsMatrix< T > m_coefs
Coefficient matrix of size coefsSize() x geoDim()
Definition: gsGeometry.h:624
A truncated hierarchical B-Spline function, in d dimensions.
Definition: gsTHBSpline.h:37
void slice(index_t dir_fixed, T par, BoundaryGeometryType &result) const
Definition: gsTHBSpline.hpp:338
gsBasis< T > * m_basis
Pointer to the basis of this geometry.
Definition: gsGeometry.h:627
gsTHBSpline(const Basis &basis, const gsMatrix< T > &coefs)
Construct THB-Spline by basis functions and coefficient matrix.
Definition: gsTHBSpline.h:64
A tensor product of d B-spline functions, with arbitrary target dimension.
Definition: gsTensorBSpline.h:44
util::conditional< d==1, gsConstantBasis< T >, gsTHBSplineBasis< static_cast< short_t >d-1), T > >::type BoundaryBasisType
Associated Boundary basis type.
Definition: gsTHBSplineBasis.h:57
void globalRefinement(int level) const
function for getBsplinePatchGlobal
#define index_t
Definition: gsConfig.h:32
A tensor product B-spline basis.
Definition: gsTensorBSplineBasis.h:36
void increaseMultiplicity(index_t lvl, int dir, T knotValue, int mult=1)
Increase multiplicity of knot-value knotValue in level lvl and direction dir by mult.
Definition: gsTHBSpline.hpp:57
Provides declaration of THBSplineBasis class.
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition: gsVector.h:35
GISMO_DEPRECATED index_t direction(index_t s)
Returns the parametric direction that corresponds to side s.
Definition: gsBoundary.h:1048
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
Provides forward declarations of types and structs.
void initialize_cmatrix(int col, int c_level) const
initialization of cmatrix
memory::shared_ptr< gsTHBSpline > Ptr
Shared pointer for gsTHBSpline.
Definition: gsTHBSpline.h:47
void convertToBSpline(gsTensorBSpline< d, T > &result)
Refines the whole domain to the finest level present in the mesh. Returns the refined geometry as res...
Definition: gsTHBSpline.hpp:29
void return_cp_1D(const gsMatrix< T > &mat, int direction, gsMatrix< T > &cp) const
convert the coefficient matrix mat in the given direction to a column of the control points matrix ...
gsTHBSpline(const Basis &basis, gsMatrix< T > &coefs)
Construct THB-Spline by basis functions and coefficient matrix.
Definition: gsTHBSpline.h:69
gsTHBSpline(const gsTensorBSpline< d, T > &tbsp)
Construct B-Spline from a Tensor B-Spline.
Definition: gsTHBSpline.h:74
This is the main header file that collects wrappers of Eigen for linear algebra.
void getBsplinePatchGlobal(gsVector< index_t > b1, gsVector< index_t > b2, unsigned l, gsTensorBSpline< 2 > geo) const
get B-spline control points on a given box of a certain level by refining eveywhere ...
Truncated hierarchical B-spline basis.
Definition: gsTHBSplineBasis.h:35
virtual const gsBasis< T > & basis() const =0
Returns a const reference to the basis of the geometry.
void getBsplinePatches(gsMatrix< index_t > &b1, gsMatrix< index_t > &b2, gsVector< index_t > &level) const
Return the list of B-spline patches to represent a THB-spline geometry.
Definition: gsTHBSpline.hpp:83
gsMatrix< T > & coefs()
Definition: gsGeometry.h:340
gsTHBSpline()
Default empty constructor.
Definition: gsTHBSpline.h:61