G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsQuasiInterpolate.h
Go to the documentation of this file.
1 
16 #pragma once
17 
19 
20 namespace gismo {
21 
35 template <class T>
37 {
38 
39  /*
40  enum method
41  {
42  Taylor = 1, ///< Taylor
43  Schoenberg = 2, ///< Schoenberg
44  EvalBased = 3
45  };
46 
47  switch(type)
48  {
49  case(1): gsQuasiInterpolate<T>::Schoenberg(*basis, fun, coefs); expConvRate = 2.0; break;
50  case(2): gsQuasiInterpolate<T>::Taylor(*basis, fun, deg, coefs); expConvRate = (deg+1); break;
51  case(3): gsQuasiInterpolate<T>::EvalBased(*basis, fun, true, coefs); expConvRate = (deg+1); break;
52  case(0): gsQuasiInterpolate<T>::EvalBased(*basis, fun, false, coefs); expConvRate = (deg+1); break;
53  default: GISMO_ERROR("invalid option");
54  }
55  */
56 
57  static gsMatrix<T> localIntpl(const gsBasis<T> &b,
58  const gsFunction<T> &fun,
59  index_t i,
60  const gsMatrix<T> &ab);
61 
62  static gsMatrix<T> localIntpl(const gsBasis<T> &b,
63  const gsFunction<T> &fun,
64  index_t i);
65 
66  template<short_t d>
67  static gsMatrix<T> localIntpl(const gsHTensorBasis<d,T> &b,
68  const gsFunction<T> &fun,
69  index_t i);
70 
71 
72  static void localIntpl(const gsBasis<T> &b,
73  const gsFunction<T> &fun,
74  gsMatrix<T> &result);
75 
76 
96  static void Taylor(const gsBasis<T> &bb, const gsFunction<T> &fun, const int &r, gsMatrix<T> &result);
97 
98 
106  static void Schoenberg(const gsBasis<T> &b, const gsFunction<T> &fun,
107  gsMatrix<T> &result);
108 
109  static gsMatrix<T> Schoenberg(const gsBasis<T> &b, const gsFunction<T> &fun, index_t i);
110 
111 
163  static void EvalBased(const gsBasis<T> &bb, const gsFunction<T> &fun, const bool specialCase, gsMatrix<T> &result);
164 
165 
166  /*
167  static void qiCwiseData(const gsTensorBSplineBasis<T,2> & tbsp,
168  const gsVector<index_t> & ind,
169  std::vector<gsMatrix<T> > & qiNodes,
170  std::vector<gsMatrix<T> > & qiWeights);
171 
172  static void compute(const gsTensorBSplineBasis<T,2> & tbsp,
173  const gsFunction<T> & fun,
174  gsTensorBSpline<T> & res);
175  */
176 
177 protected:
178 
187  static T derivProd(const std::vector<T> &zeros, const int &order, const T &x);
188 
189 
198  static void distributePoints(T a, T b, int n, gsMatrix<T> &points);
199 
200 
212  static void computeWeights(const gsMatrix<T> &points, const gsKnotVector<T> &knots, const int &pos, gsMatrix<T> &weights);
213 
214 
224  static gsMatrix<T> computeControlPoints(const gsMatrix<T> &weights, const gsFunction<T> &fun, const gsMatrix<T> &xik);
225 
233  static int greatestSubInterval(const gsKnotVector<T> &knots, const int &posStart, const int &posEnd);
234 
235 
236 }; //struct
237 
238 } // gismo
239 
240 #ifndef GISMO_BUILD_LIB
241 #include GISMO_HPP_HEADER(gsQuasiInterpolate.hpp)
242 #endif
static int greatestSubInterval(const gsKnotVector< T > &knots, const int &posStart, const int &posEnd)
This function finds the greatest knot interval in a given range in a knot vector. ...
Definition: gsQuasiInterpolate.hpp:376
static void Taylor(const gsBasis< T > &bb, const gsFunction< T > &fun, const int &r, gsMatrix< T > &result)
A quasi-interpolation scheme based on the tayor expansion of the function to approximate. See Theorem 8.5 of &quot;Spline methods (Lyche Morken)&quot; Theorem: (Lyche, Morken: Thm 8.5, page 178) Let and be the degree and knotvector of the quasi-interpolant, respectively. Futhermore let be an integer with and let be a number in for . Consider the quasi-interpolant and . Then reproduces all polynomials of degree and reproduces all splines in .
Definition: gsQuasiInterpolate.hpp:103
static void computeWeights(const gsMatrix< T > &points, const gsKnotVector< T > &knots, const int &pos, gsMatrix< T > &weights)
To compute the control points of the quasi-interpolant one uses the function computeControlPoints. The weights can be computed as , for , where for a polynomial , where is the set of all permutations of the intergers .
Definition: gsQuasiInterpolate.hpp:320
static void distributePoints(T a, T b, int n, gsMatrix< T > &points)
Compute a number of equally distributed points in a given interval . You get a list of points ...
Definition: gsQuasiInterpolate.hpp:311
static gsMatrix< T > computeControlPoints(const gsMatrix< T > &weights, const gsFunction< T > &fun, const gsMatrix< T > &xik)
The quasi-interpolant is a spline function, in particular a linear combination of some controlpoints ...
Definition: gsQuasiInterpolate.hpp:367
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
static void EvalBased(const gsBasis< T > &bb, const gsFunction< T > &fun, const bool specialCase, gsMatrix< T > &result)
A quasi-interpolation scheme based on the evaluation of the function at certain points. See sections 8.2.1, 8.2.2, 8.2.3 and Theorem 8.7 or Lemma 9.7 of &quot;Spline methods (Lyche Morken)&quot;. The formulas for the special cases (degrees 1, 2 and 3) look like this: where the coefficients for are given as: for degree 1, where .
Definition: gsQuasiInterpolate.hpp:156
Class representing a (scalar) hierarchical tensor basis of functions .
Definition: gsHTensorBasis.h:74
static void Schoenberg(const gsBasis< T > &b, const gsFunction< T > &fun, gsMatrix< T > &result)
A quasi-interpolation scheme based on Schoenberg Variation Diminishing Spline Approximation. See Exercise 9.1 of &quot;Spline methods (Lyche Morken)&quot;.
Definition: gsQuasiInterpolate.hpp:414
Quasi-interpolation operators.
Definition: gsQuasiInterpolate.h:36
Provides forward declarations of types and structs.
static T derivProd(const std::vector< T > &zeros, const int &order, const T &x)
Compute the derivative of a certain order of a normalized polynomial (leading coefficient is 1) defin...
Definition: gsQuasiInterpolate.hpp:276
Class for representing a knot vector.
Definition: gsKnotVector.h:79
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78