30 template<
class T,
class KnotVectorType,
class Mat>
32 KnotVectorType & knots,
36 bool update_knots =
true
41 template<
class T,
class KnotVectorType,
class Mat>
43 KnotVectorType & knots,
46 bool update_knots =
true
53 template<
class T,
class iter,
class Mat>
64 template<
class KnotVectorType,
class Mat,
class ValIt>
68 ValIt valBegin, ValIt valEnd,
69 bool update_knots =
true);
98 template<
typename T,
typename KnotVectorType,
typename Mat>
100 KnotVectorType& knots,
104 gsVector<unsigned> str,
106 bool update_knots =
true);
130 template <
typename KnotVectorType,
typename Mat,
typename ValIt>
132 KnotVectorType& knots,
135 gsVector<unsigned> str,
138 bool update_knots =
true);
158 template <
short_t d,
typename KnotVectorType,
typename Mat,
typename ValIt>
160 KnotVectorType& knots,
161 const unsigned index,
163 gsVector<index_t, d>& nmb_of_coefs,
164 const gsVector<index_t, d>& act_size_of_coefs,
165 const gsVector<index_t, d>& size_of_coefs,
169 const bool update_knots);
187 template <
short_t d,
typename T,
typename KnotVectorType,
typename Mat>
189 const KnotVectorType& knots,
191 const gsVector<index_t, d>& size_of_coefs,
194 gsVector<index_t, d>& start,
195 gsVector<index_t, d>& end);
223 "stide size is not equal to dimension of coefficients size");
226 unsigned n = stride.size();
228 for (
unsigned i = 0; i < n; ++i)
229 ind += static_cast<int>(stride[i]) * position[i];
242 for (
short_t i = 0; i < d; ++i)
243 ind += stride[i] * position[i];
260 template <
typename T,
typename KnotVectorType>
262 const KnotVectorType& knots,
270 for (
int j = 1; j <= r; ++j)
273 for (
int i = 0; i <= p - j - s; ++i)
275 T knot_i = knots[L + i];
276 alpha[j - 1][i] = (value - knot_i) / (knots[i + k + 1] - knot_i);
295 const unsigned number_of_points,
299 index_t stride_length = stride.size();
300 for (
index_t i = 0; i < stride_length; ++i)
302 if (i != stride_length - 1)
304 last_point[i] =
static_cast<int>(stride[i + 1] / stride[i]) - 1;
306 last_point[i] =
static_cast<int>(number_of_points / stride[i]) - 1;
324 template <
typename T,
typename KnotVectorType,
typename ValIt,
325 typename newKnotsType>
327 newKnotsType& nknots,
328 const KnotVectorType& knots,
333 const int a = knots.iFind(*valBegin) - knots.begin();
334 const int b = (knots.iFind(*(valEnd - 1)) - knots.begin()) + 1;
335 const int p = knots.degree();
337 const int nk = knots.size();
340 int k = b + p + nik - 1;
344 for (
int j = 0; j <= a; j++)
345 nknots[j] = knots[j];
347 for (
int j = b + p; j < nk; j++)
348 nknots[j + nik] = knots[j];
352 for (
int j = nik - 1; 0 <= j; --j)
354 const T newKnot = *(--valEnd);
357 while ((newKnot <= knots[i]) && (a < i))
359 nknots[k] = knots[i];
364 for (
int ell = 1; ell <= p; ell++)
366 T alfa = nknots[k + ell] - newKnot;
368 alfa /= nknots[k + ell] - knots[i - p + ell];
370 alpha[j][ell - 1] = alfa;
394 if (direction + 1 != str.size() )
396 new_str[direction + 1] += new_str[
direction] * r;
398 for (
index_t i = direction + 2; i < str.size(); ++i)
400 new_str[i] = new_str[i - 1] * (str[i] / str[i - 1]);
414 for (
short_t i = 0; i < d; ++i)
416 last_point[i] = size_of_coef[i] - 1;
432 for (
short_t dim = 1; dim < d; dim++)
433 strides(dim) = size_of_coefs(dim - 1) * strides(dim - 1);
450 unsigned nmb_of_iter = 1;
451 for (
index_t i = 0; i < nmb_of_coefs.size(); ++i)
453 if (static_cast<unsigned>(i) !=
direction)
454 nmb_of_iter *= nmb_of_coefs[i];
464 #ifndef GISMO_BUILD_LIB
465 #include GISMO_HPP_HEADER(gsBoehm.hpp)
void gsBoehm(KnotVectorType &knots, Mat &coefs, T val, int r=1, bool update_knots=true)
Performs insertion of multiple knot on "knots" and coefficients "coefs".
Definition: gsBoehm.hpp:29
void buildCoeffsStrides(const gsVector< index_t, d > &size_of_coefs, gsVector< index_t, d > &strides)
Definition: gsBoehm.h:428
T distance(gsMatrix< T > const &A, gsMatrix< T > const &B, index_t i=0, index_t j=0, bool cols=false)
compute a distance between the point number in the set and the point number <j> in the set ; by def...
#define short_t
Definition: gsConfig.h:35
void computeTensorAlpha(std::vector< std::vector< T > > &alpha, newKnotsType &nknots, const KnotVectorType &knots, ValIt valBegin, ValIt valEnd, bool sparse=false)
Definition: gsBoehm.h:326
void gsBoehmRefine(KnotVectorType &knots, Mat &coefs, int p, ValIt valBegin, ValIt valEnd, bool update_knots=true)
Definition: gsBoehm.hpp:163
void gsTensorBoehmRefineLocal(KnotVectorType &knots, const unsigned index, Mat &coefs, gsVector< index_t, d > &nmb_of_coefs, const gsVector< index_t, d > &act_size_of_coefs, const gsVector< index_t, d > &size_of_coefs, const unsigned direction, ValIt valBegin, ValIt valEnd, const bool update_knots)
Local refinement algorithm.
Definition: gsBoehm.hpp:501
void correctNewStride(gsVector< unsigned > &new_str, const gsVector< unsigned > &str, const int direction, const int r)
Definition: gsBoehm.h:389
#define index_t
Definition: gsConfig.h:32
void gsTensorBoehmRefine(KnotVectorType &knots, Mat &coefs, int direction, gsVector< unsigned > str, ValIt valBegin, ValIt valEnd, bool update_knots=true)
Definition: gsBoehm.hpp:372
void gsTensorInsertKnotDegreeTimes(const KnotVectorType &knots, Mat &coefs, const gsVector< index_t, d > &size_of_coefs, T val, const unsigned direction, gsVector< index_t, d > &start, gsVector< index_t, d > &end)
Inserts knot val such that multiplicity of a val in knot vector is equal degree.
Definition: gsBoehm.hpp:757
void getLastIndexLocal(const gsVector< index_t, d > &size_of_coef, gsVector< index_t, d > &last_point)
Definition: gsBoehm.h:411
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
void gsBoehmSingle(KnotVectorType &knots, Mat &coefs, T val, bool update_knots=true)
Performs knot insertion once on "knots" and coefficients "coefs".
Definition: gsBoehm.hpp:95
void getLastIndex(const gsVector< unsigned > &stride, const unsigned number_of_points, gsVector< int > &last_point)
Definition: gsBoehm.h:294
GISMO_DEPRECATED index_t direction(index_t s)
Returns the parametric direction that corresponds to side s.
Definition: gsBoundary.h:1048
unsigned numberOfIterations(const gsVector< index_t > &nmb_of_coefs, const unsigned direction)
Definition: gsBoehm.h:447
This is the main header file that collects wrappers of Eigen for linear algebra.
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition: gsExpressions.h:4488
void gsTensorBoehm(KnotVectorType &knots, Mat &coefs, T val, int direction, gsVector< unsigned > str, int r=1, bool update_knots=true)
Definition: gsBoehm.hpp:245
void computeAlpha(std::vector< std::vector< T > > &alpha, const KnotVectorType &knots, T value, int r, int k, int p, int s)
Definition: gsBoehm.h:261
int getIndex(const gsVector< unsigned > &stride, const gsVector< int > &position)
Definition: gsBoehm.h:218