G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsHBSplineBasis.h
Go to the documentation of this file.
1
14#pragma once
15
18
19namespace gismo
20{
34template<short_t d, class T>
36{
37public:
40
42
44
45 typedef typename
46 util::conditional<d==1, gsConstantBasis<T>, gsHBSplineBasis<static_cast<short_t>(d-1),T>
47 >::type BoundaryBasisType;
48
50 typedef memory::shared_ptr< gsHBSplineBasis > Ptr;
51
53 typedef memory::unique_ptr< gsHBSplineBasis > uPtr;
54
55public:
56
57 gsHBSplineBasis() { }
58
60 gsHBSplineBasis(gsBasis<T> const& tbasis, bool manualLevels=false )
61 : gsHTensorBasis<d,T>(tbasis, manualLevels)
62 {
63 // initialize(); // is done in the base constructor
64 }
65
67 std::vector<index_t> & boxes)
68 : gsHTensorBasis<d,T>(tbasis, boxes)
69 {
70 // initialize(); // is done in the base constructor
71 }
72
73 gsHBSplineBasis( gsTensorBSplineBasis<d,T> const& tbasis,
74 gsMatrix<T> const & boxes)
75 : gsHTensorBasis<d,T>(tbasis, boxes)
76 {
77 // initialize(); // is done in the base constructor
78 }
79
80#ifdef __DOXYGEN__
82 typename BoundaryBasisType::uPtr boundaryBasis(boxSide const & s);
83#endif
84 GISMO_UPTR_FUNCTION_DEF(BoundaryBasisType, boundaryBasis, boxSide const &)
85 {
86 return basisSlice(n1.direction(),n1.parameter());
87 }
88
89public:
91 BoundaryBasisType * basisSlice(index_t dir_fixed,T par ) const;
92
93 short_t domainDim() const { return d; }
94
95 void eval_into(const gsMatrix<T> & u, gsMatrix<T>& result) const;
96
97 void deriv_into(const gsMatrix<T> & u, gsMatrix<T>& result) const;
98
99 void deriv2_into(const gsMatrix<T> & u, gsMatrix<T>& result) const;
100
101 void evalSingle_into(index_t i, const gsMatrix<T> & u, gsMatrix<T>& result) const;
102
103 void derivSingle_into(index_t i, const gsMatrix<T> & u, gsMatrix<T>& result) const;
104
105 void deriv2Single_into(index_t i, const gsMatrix<T> & u, gsMatrix<T>& result) const;
106
107 GISMO_CLONE_FUNCTION(gsHBSplineBasis)
108
109
110 std::ostream &print(std::ostream &os) const;
112 void transferbyLvl(std::vector<gsSparseMatrix<T> >& result);
113
114 GISMO_MAKE_GEOMETRY_NEW
115
116private:
117
120 void initialize();
121
122 gsSparseMatrix<T> coarsening(const std::vector<gsSortedVector<index_t> >& old, const std::vector<gsSortedVector<index_t> >& n, const gsSparseMatrix<T,RowMajor> & transfer) const;
123 gsSparseMatrix<T> coarsening_direct( const std::vector<gsSortedVector<index_t> >& old, const std::vector<gsSortedVector<index_t> >& n, const std::vector<gsSparseMatrix<T,RowMajor> >& transfer) const;
124
125 gsSparseMatrix<T> coarsening_direct2( const std::vector<gsSortedVector<index_t> >& old, const std::vector<gsSortedVector<index_t> >& n, const std::vector<gsSparseMatrix<T,RowMajor> >& transfer) const;
126
127 using gsHTensorBasis<d,T>::m_bases;
128 using gsHTensorBasis<d,T>::m_xmatrix;
130 using gsHTensorBasis<d,T>::m_deg;
131
132}; // class gsHBSplineBasis
133
134#ifdef GISMO_WITH_PYBIND11
135
139 void pybind11_init_gsHBSplineBasis2(pybind11::module &m);
140 void pybind11_init_gsHBSplineBasis3(pybind11::module &m);
141 void pybind11_init_gsHBSplineBasis4(pybind11::module &m);
142
143#endif // GISMO_WITH_PYBIND11
144
145} // namespace gismo
146
147#ifndef GISMO_BUILD_LIB
148#include GISMO_HPP_HEADER(gsHBSplineBasis.hpp)
149#endif
Struct which represents a certain side of a box.
Definition gsBoundary.h:85
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
A hierarchical B-spline basis of parametric dimension d.
Definition gsHBSplineBasis.h:36
void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the second derivatives of all active basis function at points u.
Definition gsHBSplineBasis.hpp:155
memory::shared_ptr< gsHBSplineBasis > Ptr
Shared pointer for gsHBSplineBasis.
Definition gsHBSplineBasis.h:50
void initialize()
Initialize the characteristic and coefficient matrices and the internal bspline representations.
Definition gsHBSplineBasis.hpp:70
gsHBSpline< d, T > GeometryType
Associated geometry type.
Definition gsHBSplineBasis.h:39
gsSparseMatrix< T > coarsening(const std::vector< gsSortedVector< index_t > > &old, const std::vector< gsSortedVector< index_t > > &n, const gsSparseMatrix< T, RowMajor > &transfer) const
returns a transfer matrix using the characteristic matrix of the old and new basis
Definition gsHBSplineBasis.hpp:228
void evalSingle_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the i-th basis function at points u into result.
Definition gsHBSplineBasis.hpp:77
memory::unique_ptr< gsHBSplineBasis > uPtr
Unique pointer for gsHBSplineBasis.
Definition gsHBSplineBasis.h:53
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates nonzero basis functions at point u into result.
Definition gsHBSplineBasis.hpp:101
BoundaryBasisType::uPtr boundaryBasis(boxSide const &s)
Gives back the boundary basis at boxSide s.
void transferbyLvl(std::vector< gsSparseMatrix< T > > &result)
returns transfer matrices betweend the levels of the given hierarchical spline
Definition gsHBSplineBasis.hpp:188
short_t domainDim() const
Dimension of the (source) domain.
Definition gsHBSplineBasis.h:93
void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the first partial derivatives of the nonzero basis function.
Definition gsHBSplineBasis.hpp:128
gsHBSplineBasis(gsBasis< T > const &tbasis, bool manualLevels=false)
Constructor out of a tensor BSpline Basis.
Definition gsHBSplineBasis.h:60
BoundaryBasisType * basisSlice(index_t dir_fixed, T par) const
Gives back the basis at a slice in dir_fixed at par.
Definition gsHBSplineBasis.hpp:39
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsHBSplineBasis.hpp:60
void deriv2Single_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the (partial) derivatives of the i-th basis function at points u into result.
Definition gsHBSplineBasis.hpp:93
void derivSingle_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the (partial) derivatives of the i-th basis function at points u into result.
Definition gsHBSplineBasis.hpp:85
A hierarchical B-Spline function, in d dimensions.
Definition gsHBSpline.h:38
Class representing a (scalar) hierarchical tensor basis of functions .
Definition gsHTensorBasis.h:75
std::vector< index_t > m_xmatrix_offset
Stores the offsets of active functions for all levels.
Definition gsHTensorBasis.h:411
void transfer(const std::vector< gsSortedVector< index_t > > &old, gsSparseMatrix< T > &result)
Returns transfer matrix between the hirarchical spline given by the characteristic matrix "old" and t...
Definition gsHTensorBasis.hpp:1736
std::vector< tensorBasis * > m_bases
The list of nested spaces.
Definition gsHTensorBasis.h:361
std::vector< CMatrix > m_xmatrix
The characteristic matrices for each level.
Definition gsHTensorBasis.h:377
gsHTensorBasis()
Default empty constructor.
Definition gsHTensorBasis.h:113
bool manualLevels() const
Returns true if levels are assigned manually.
Definition gsHTensorBasis.h:332
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
This class is derived from std::vector, and adds sort tracking.
Definition gsSortedVector.h:110
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
A tensor product B-spline basis.
Definition gsTensorBSplineBasis.h:37
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
Provides declaration of THBSplineBasis class.
Provides definition of HTensorBasis abstract interface.
The G+Smo namespace, containing all definitions for the library.