64 static std::vector<std::pair<Real*,Real*>> data_;
90 void scaled_nodes_and_weights (
int points, Complex x1, Complex x2, Complex* xs, Complex* ws)
const;
115 template <
class Functor,
class... Data> Complex quad
117 Functor f,
Bspline const & bspline,
118 int points,
int iknot, Complex x1, Complex x2,
123 if (x1.real() < bspline.
t(iknot).real() or bspline.
t(iknot+1).real() < x1.real() or
124 x2.real() < bspline.
t(iknot).real() or bspline.
t(iknot+1).real() < x2.real())
126 HexException(
"[quad] Error: boundaries not for this iknot!");
130 std::vector<Complex> xs(points), ws(points), fs(points);
131 scaled_nodes_and_weights(points, x1, x2, xs.data(), ws.data());
134 f(points, xs.data(), fs.data(), data...);
138 for (
int ipt = 0; ipt < points; ipt++)
139 result += ws[ipt] * fs[ipt];
155 template <
class ClassPtr,
class Functor,
class... Data> Complex quadMFP
157 ClassPtr ptr, Functor f,
Bspline const & bspline,
158 int points,
int iknot, Complex x1, Complex x2,
163 if (x1.real() < bspline.
t(iknot).real() or bspline.
t(iknot+1).real() < x1.real() or
164 x2.real() < bspline.
t(iknot).real() or bspline.
t(iknot+1).real() < x2.real())
166 HexException(
"[quad] Error: boundaries not for this iknot!");
170 std::vector<Complex> xs(points), ws(points), fs(points);
171 scaled_nodes_and_weights(points, x1, x2, xs.data(), ws.data());
174 (ptr->*f)(points, xs.data(), fs.data(), data...);
178 for (
int ipt = 0; ipt < points; ipt++)
179 result += ws[ipt] * fs[ipt];
static void precompute_nodes_and_weights(int points)
Precalculate nodes and weights so that the retrieval is fast and thread-safe.
Definition: gauss.cpp:49
B-spline environment.
Definition: bspline.h:57
Gauss-Legendre quadrature.
Definition: gauss.h:79
static void gauss_nodes_and_weights(int points, const Real *&vx, const Real *&vw)
Retrieve Gauss-Legendre data.
Definition: gauss.cpp:80
cArrayView t() const
B-spline knot sequence.
Definition: bspline.h:266