fitpack
Modern Fortran library for curve and surface fitting with splines
Loading...
Searching...
No Matches
fpSurface.hpp
Go to the documentation of this file.
1/***************************************************************************************************
2! ____________________ ___ ________ __
3! / ____/ _/_ __/ __ \/ | / ____/ //_/
4! / /_ / / / / / /_/ / /| |/ / / ,<
5! / __/ _/ / / / / ____/ ___ / /___/ /| |
6! /_/ /___/ /_/ /_/ /_/ |_\____/_/ |_|
7!
8! A Curve Fitting Package
9!
10! fpSurface.hpp (class fpSurface)
11!> @brief Standalone C++ wrapper for fitpack_surface (no fortran-arrays dependency)
12!
13! @author Federico Perini
14! @date 2026-08-27
15!
16! References :
17! - C. De Boor, "On calculating with b-splines", J Approx Theory 6 (1972) 50-62
18! - M. G. Cox, "The numerical evaluation of b-splines", J Inst Maths Applics 10 (1972) 134-149
19! - P. Dierckx, "Curve and surface fitting with splines", Monographs on numerical analysis,
20! Oxford university press, 1993.
21!
22! **************************************************************************************************/
23
24#ifndef FPSURFACE_HPP_INCLUDED
25#define FPSURFACE_HPP_INCLUDED
26
27#include "fitpack_config.h"
28
29#if HAVE_FXARRAY
30#include "fxArrays.hpp"
31#endif
32
33#include "fitpack_surface_c.h"
34#include "fpFitter.hpp"
35#include "fpCurve.hpp"
36#include <string>
37#include <vector>
38#include <cstdint>
39#include <memory>
40#include <stdexcept>
41#include <variant>
42#include <optional>
43#include <array>
44
45static_assert(sizeof(fitpack_surface_c) == sizeof(fitpack_fitter_c),
46 "C descriptor layout mismatch: fitpack_surface_c vs fitpack_fitter_c");
47
56class fpSurface : public fpFitter {
57public:
58 // ===========================================================================================
59 // Constructors and Destructor
60 // ===========================================================================================
61
66 fitpack_surface_c_allocate(as<fitpack_surface_c>(), nullptr);
67 }
68
72 ~fpSurface() override {
73 fitpack_surface_c_destroy(as<fitpack_surface_c>(), nullptr);
74 }
75
79 fpSurface(const fpSurface& other) : fpFitter(NoAlloc{}) {
80 *as<fitpack_surface_c>() = fitpack_surface_c_null;
81 fitpack_surface_c_copy(as<fitpack_surface_c>(), other.as<fitpack_surface_c>(), false, nullptr);
82 }
83
87 fpSurface& operator=(const fpSurface& other) {
88 if (this != &other) {
89 fitpack_surface_c_destroy(as<fitpack_surface_c>(), nullptr);
90 fitpack_surface_c_copy(as<fitpack_surface_c>(), other.as<fitpack_surface_c>(), false, nullptr);
91 }
92 return *this;
93 }
94
98 fpSurface(fpSurface&& other) noexcept : fpFitter(NoAlloc{}) {
99 *as<fitpack_surface_c>() = fitpack_surface_c_null;
100 fitpack_surface_c_move_alloc(as<fitpack_surface_c>(), other.as<fitpack_surface_c>(), nullptr);
101 }
102
106 fpSurface& operator=(fpSurface&& other) noexcept {
107 if (this != &other) {
108 fitpack_surface_c_destroy(as<fitpack_surface_c>(), nullptr);
109 fitpack_surface_c_move_alloc(as<fitpack_surface_c>(), other.as<fitpack_surface_c>(), nullptr);
110 }
111 return *this;
112 }
113
117 explicit fpSurface(fitpack_surface_c& c_wrapper, bool move = false) : fpFitter(NoAlloc{}) {
118 if (move) {
119 fitpack_surface_c_move_alloc(as<fitpack_surface_c>(), &c_wrapper, nullptr);
120 } else {
121 *as<fitpack_surface_c>() = fitpack_surface_c_null;
122 fitpack_surface_c_copy(as<fitpack_surface_c>(), &c_wrapper, false, nullptr);
123 }
124 }
125
131 explicit fpSurface(fitpack_surface_c& c_wrapper, ViewTag) : fpFitter(NoAlloc{}) {
132 *as<fitpack_surface_c>() = c_wrapper;
133 as<fitpack_surface_c>()->is_pointer = true;
134 }
135
136 // ===========================================================================================
137 // Utility Methods
138 // ===========================================================================================
139
143 bool is_allocated() const override {
144 return as<fitpack_surface_c>()->cptr != nullptr;
145 }
146
150 bool is_pointer() const override {
151 return as<fitpack_surface_c>()->is_pointer;
152 }
153
157 const char* c_type_name() const override {
158 return fitpack_surface_c_c_type_name(*as<fitpack_surface_c>());
159 }
160
165 const char* cpp_type_name() const override {
166 return "fpSurface";
167 }
168
172 fitpack_surface_c& c_handle() {
173 return *as<fitpack_surface_c>();
174 }
175
179 const fitpack_surface_c& c_handle() const {
180 return *as<fitpack_surface_c>();
181 }
182
192 return fpSurface(NoAlloc{});
193 }
194
199 return static_cast<fpFitter&>(*this);
200 }
201 const fpFitter& as_parent() const {
202 return static_cast<const fpFitter&>(*this);
203 }
204
205 // ===========================================================================================
206 // Method Wrappers (standalone — no fxArray dependency)
207 // ===========================================================================================
208
212 virtual void new_points(std::vector<double>& x, std::vector<double>& y, std::vector<double>& z, double* w = nullptr) {
213 int32_t n = static_cast<int32_t>(x.size());
214 fitpack_surface_c_new_points(as<fitpack_surface_c>(), n, x.data(), y.data(), z.data(), w);
215 }
216
217
221 virtual int32_t new_fit(std::vector<double>& x, std::vector<double>& y, std::vector<double>& z, double* w = nullptr, double* smoothing = nullptr, int32_t* order = nullptr) {
222 int32_t n = static_cast<int32_t>(x.size());
223 return fitpack_surface_c_new_fit(as<fitpack_surface_c>(), n, x.data(), y.data(), z.data(), w, smoothing, order);
224 }
225
226
227 virtual int32_t fit(double* smoothing = nullptr, int32_t* order = nullptr, bool* keep_knots = nullptr) {
228 return fitpack_surface_c_fit(as<fitpack_surface_c>(), smoothing, order, keep_knots);
229 }
230
231 virtual int32_t interpolate(bool* reset_knots = nullptr) {
232 return fitpack_surface_c_interpolate(as<fitpack_surface_c>(), reset_knots);
233 }
234
235 virtual int32_t least_squares(double* smoothing = nullptr, bool* reset_knots = nullptr) {
236 return fitpack_surface_c_least_squares(as<fitpack_surface_c>(), smoothing, reset_knots);
237 }
238
239 virtual double eval(double x, double y, int32_t* ierr = nullptr) {
240 return fitpack_surface_c_surface_eval_one(as<fitpack_surface_c>(), x, y, ierr);
241 }
242
246 virtual std::vector<double> eval(std::vector<double>& x, std::vector<double>& y, int32_t* ierr = nullptr) {
247 int32_t n = static_cast<int32_t>(x.size());
248 std::vector<double> result(n);
249 int32_t n_result = 0;
250 fitpack_surface_c_surface_eval_many(as<fitpack_surface_c>(), n, x.data(), y.data(), ierr, result.data(), &n_result, n);
251 result.resize(n_result);
252 return result;
253 }
254
255
259 virtual std::vector<double> eval_ongrid(std::vector<double>& x, std::vector<double>& y, int32_t* ierr = nullptr) {
260 int32_t n = static_cast<int32_t>(x.size());
261 std::vector<double> result(n * n);
262 int32_t n_result = 0;
263 fitpack_surface_c_surface_eval_gridded(as<fitpack_surface_c>(), n, x.data(), y.data(), ierr, result.data(), &n_result, n * n);
264 result.resize(n_result);
265 return result;
266 }
267
268
269 virtual double dfdx(double x, double y, int32_t dx, int32_t dy, int32_t* ierr = nullptr) {
270 return fitpack_surface_c_surface_derivatives_one(as<fitpack_surface_c>(), x, y, dx, dy, ierr);
271 }
272
276 virtual std::vector<double> dfdx(std::vector<double>& x, std::vector<double>& y, int32_t dx, int32_t dy, int32_t* ierr = nullptr) {
277 int32_t n = static_cast<int32_t>(x.size());
278 std::vector<double> result(n);
279 int32_t n_result = 0;
280 fitpack_surface_c_surface_derivatives_many(as<fitpack_surface_c>(), n, x.data(), y.data(), dx, dy, ierr, result.data(), &n_result, n);
281 result.resize(n_result);
282 return result;
283 }
284
285
289 virtual std::vector<double> dfdx_ongrid(std::vector<double>& x, std::vector<double>& y, int32_t dx, int32_t dy, int32_t* ierr = nullptr) {
290 int32_t n = static_cast<int32_t>(x.size());
291 std::vector<double> result(n * n);
292 int32_t n_result = 0;
293 fitpack_surface_c_surface_derivatives_gridded(as<fitpack_surface_c>(), n, x.data(), y.data(), dx, dy, ierr, result.data(), &n_result, n * n);
294 result.resize(n_result);
295 return result;
296 }
297
298
302 virtual double integral(std::vector<double>& lower, std::vector<double>& upper) const {
303 int32_t n = static_cast<int32_t>(lower.size());
304 return fitpack_surface_c_integral(as<fitpack_surface_c>(), n, lower.data(), upper.data());
305 }
306
307
308 virtual fpCurve cross_section(double u, bool along_y, int32_t* ierr = nullptr) {
309 fitpack_curve_c result_c;
310 fitpack_surface_c_cross_section(as<fitpack_surface_c>(), u, along_y, ierr, &result_c);
311 return fpCurve(result_c, true);
312 }
313
314 virtual fpSurface derivative_spline(int32_t nux, int32_t nuy, int32_t* ierr = nullptr) {
315 fitpack_surface_c result_c;
316 fitpack_surface_c_derivative_spline(as<fitpack_surface_c>(), nux, nuy, ierr, &result_c);
317 return fpSurface(result_c, true);
318 }
319
320 int32_t comm_size() const override {
321 return fitpack_surface_c_comm_size(as<fitpack_surface_c>());
322 }
323
327 void comm_pack(std::vector<double>& buffer) const override {
328 int32_t n = static_cast<int32_t>(buffer.size());
329 fitpack_surface_c_comm_pack(as<fitpack_surface_c>(), n, buffer.data());
330 }
331
332
336 void comm_expand(std::vector<double>& buffer) override {
337 int32_t n = static_cast<int32_t>(buffer.size());
338 fitpack_surface_c_comm_expand(as<fitpack_surface_c>(), n, buffer.data());
339 }
340
341
342 double mse() const override {
343 return fitpack_surface_c_mse(as<fitpack_surface_c>());
344 }
345
346 int32_t core_comm_size() const override {
347 return fitpack_surface_c_core_comm_size(as<fitpack_surface_c>());
348 }
349
353 void core_comm_pack(std::vector<double>& buffer) const override {
354 int32_t n = static_cast<int32_t>(buffer.size());
355 fitpack_surface_c_core_comm_pack(as<fitpack_surface_c>(), n, buffer.data());
356 }
357
358
362 void core_comm_expand(std::vector<double>& buffer) override {
363 int32_t n = static_cast<int32_t>(buffer.size());
364 fitpack_surface_c_core_comm_expand(as<fitpack_surface_c>(), n, buffer.data());
365 }
366
367
368 void destroy_base() override {
369 fitpack_surface_c_destroy_base(as<fitpack_surface_c>());
370 }
371
372 // ===========================================================================================
373 // Component Array Accessors
374 // ===========================================================================================
375
380 std::vector<double> x_vector() const {
381 double* raw = nullptr;
382 int64_t extents[1] = {0};
383 fitpack_surface_c_getcomp_x(as<fitpack_surface_c>(), &raw, extents);
384 const int64_t total = extents[0];
385 if (raw == nullptr || total <= 0) return {};
386 const double* first = reinterpret_cast<const double*>(raw);
387 return std::vector<double>(first, first + total);
388 }
389
390#if HAVE_FXARRAY
403 fxArray<double> x() const {
404 double* raw = nullptr;
405 int64_t extents[1] = {0};
406 fitpack_surface_c_getcomp_x(as<fitpack_surface_c>(), &raw, extents);
407 FX_SIZE bounds[2]; // (lower, upper) per dimension, Fortran lbound 1
408 for (int k = 0; k < 1; ++k) {
409 bounds[2 * k] = 1;
410 bounds[2 * k + 1] = static_cast<FX_SIZE>(extents[k]);
411 }
412 array_c descr = array_c_null;
413 array_c_from_ptr(&descr, "x", static_cast<void*>(raw),
414 getCFITypeFlag<double>(),
415 static_cast<FX_SIZE>(sizeof(double)),
416 static_cast<FX_RANK>(1), bounds);
417 return fxArray<double>(descr);
418 }
419#endif // HAVE_FXARRAY
420
425 std::vector<double> y_vector() const {
426 double* raw = nullptr;
427 int64_t extents[1] = {0};
428 fitpack_surface_c_getcomp_y(as<fitpack_surface_c>(), &raw, extents);
429 const int64_t total = extents[0];
430 if (raw == nullptr || total <= 0) return {};
431 const double* first = reinterpret_cast<const double*>(raw);
432 return std::vector<double>(first, first + total);
433 }
434
435#if HAVE_FXARRAY
448 fxArray<double> y() const {
449 double* raw = nullptr;
450 int64_t extents[1] = {0};
451 fitpack_surface_c_getcomp_y(as<fitpack_surface_c>(), &raw, extents);
452 FX_SIZE bounds[2]; // (lower, upper) per dimension, Fortran lbound 1
453 for (int k = 0; k < 1; ++k) {
454 bounds[2 * k] = 1;
455 bounds[2 * k + 1] = static_cast<FX_SIZE>(extents[k]);
456 }
457 array_c descr = array_c_null;
458 array_c_from_ptr(&descr, "y", static_cast<void*>(raw),
459 getCFITypeFlag<double>(),
460 static_cast<FX_SIZE>(sizeof(double)),
461 static_cast<FX_RANK>(1), bounds);
462 return fxArray<double>(descr);
463 }
464#endif // HAVE_FXARRAY
465
470 std::vector<double> z_vector() const {
471 double* raw = nullptr;
472 int64_t extents[1] = {0};
473 fitpack_surface_c_getcomp_z(as<fitpack_surface_c>(), &raw, extents);
474 const int64_t total = extents[0];
475 if (raw == nullptr || total <= 0) return {};
476 const double* first = reinterpret_cast<const double*>(raw);
477 return std::vector<double>(first, first + total);
478 }
479
480#if HAVE_FXARRAY
493 fxArray<double> z() const {
494 double* raw = nullptr;
495 int64_t extents[1] = {0};
496 fitpack_surface_c_getcomp_z(as<fitpack_surface_c>(), &raw, extents);
497 FX_SIZE bounds[2]; // (lower, upper) per dimension, Fortran lbound 1
498 for (int k = 0; k < 1; ++k) {
499 bounds[2 * k] = 1;
500 bounds[2 * k + 1] = static_cast<FX_SIZE>(extents[k]);
501 }
502 array_c descr = array_c_null;
503 array_c_from_ptr(&descr, "z", static_cast<void*>(raw),
504 getCFITypeFlag<double>(),
505 static_cast<FX_SIZE>(sizeof(double)),
506 static_cast<FX_RANK>(1), bounds);
507 return fxArray<double>(descr);
508 }
509#endif // HAVE_FXARRAY
510
515 std::vector<double> w_vector() const {
516 double* raw = nullptr;
517 int64_t extents[1] = {0};
518 fitpack_surface_c_getcomp_w(as<fitpack_surface_c>(), &raw, extents);
519 const int64_t total = extents[0];
520 if (raw == nullptr || total <= 0) return {};
521 const double* first = reinterpret_cast<const double*>(raw);
522 return std::vector<double>(first, first + total);
523 }
524
525#if HAVE_FXARRAY
538 fxArray<double> w() const {
539 double* raw = nullptr;
540 int64_t extents[1] = {0};
541 fitpack_surface_c_getcomp_w(as<fitpack_surface_c>(), &raw, extents);
542 FX_SIZE bounds[2]; // (lower, upper) per dimension, Fortran lbound 1
543 for (int k = 0; k < 1; ++k) {
544 bounds[2 * k] = 1;
545 bounds[2 * k + 1] = static_cast<FX_SIZE>(extents[k]);
546 }
547 array_c descr = array_c_null;
548 array_c_from_ptr(&descr, "w", static_cast<void*>(raw),
549 getCFITypeFlag<double>(),
550 static_cast<FX_SIZE>(sizeof(double)),
551 static_cast<FX_RANK>(1), bounds);
552 return fxArray<double>(descr);
553 }
554#endif // HAVE_FXARRAY
555
560 std::vector<double> wrk2_vector() const {
561 double* raw = nullptr;
562 int64_t extents[1] = {0};
563 fitpack_surface_c_getcomp_wrk2(as<fitpack_surface_c>(), &raw, extents);
564 const int64_t total = extents[0];
565 if (raw == nullptr || total <= 0) return {};
566 const double* first = reinterpret_cast<const double*>(raw);
567 return std::vector<double>(first, first + total);
568 }
569
570#if HAVE_FXARRAY
583 fxArray<double> wrk2() const {
584 double* raw = nullptr;
585 int64_t extents[1] = {0};
586 fitpack_surface_c_getcomp_wrk2(as<fitpack_surface_c>(), &raw, extents);
587 FX_SIZE bounds[2]; // (lower, upper) per dimension, Fortran lbound 1
588 for (int k = 0; k < 1; ++k) {
589 bounds[2 * k] = 1;
590 bounds[2 * k + 1] = static_cast<FX_SIZE>(extents[k]);
591 }
592 array_c descr = array_c_null;
593 array_c_from_ptr(&descr, "wrk2", static_cast<void*>(raw),
594 getCFITypeFlag<double>(),
595 static_cast<FX_SIZE>(sizeof(double)),
596 static_cast<FX_RANK>(1), bounds);
597 return fxArray<double>(descr);
598 }
599#endif // HAVE_FXARRAY
600
609 std::vector<double> t_vector() const {
610 double* raw = nullptr;
611 int64_t extents[2] = {0, 0};
612 fitpack_surface_c_getcomp_t(as<fitpack_surface_c>(), &raw, extents);
613 const int64_t total = extents[0] * extents[1];
614 if (raw == nullptr || total <= 0) return {};
615 const double* first = reinterpret_cast<const double*>(raw);
616 return std::vector<double>(first, first + total);
617 }
618
623 std::array<int64_t, 2> t_shape() const {
624 double* raw = nullptr;
625 int64_t extents[2] = {0, 0};
626 fitpack_surface_c_getcomp_t(as<fitpack_surface_c>(), &raw, extents);
627 return { extents[0], extents[1] };
628 }
629
630#if HAVE_FXARRAY
643 fxArray<double> t() const {
644 double* raw = nullptr;
645 int64_t extents[2] = {0, 0};
646 fitpack_surface_c_getcomp_t(as<fitpack_surface_c>(), &raw, extents);
647 FX_SIZE bounds[4]; // (lower, upper) per dimension, Fortran lbound 1
648 for (int k = 0; k < 2; ++k) {
649 bounds[2 * k] = 1;
650 bounds[2 * k + 1] = static_cast<FX_SIZE>(extents[k]);
651 }
652 array_c descr = array_c_null;
653 array_c_from_ptr(&descr, "t", static_cast<void*>(raw),
654 getCFITypeFlag<double>(),
655 static_cast<FX_SIZE>(sizeof(double)),
656 static_cast<FX_RANK>(2), bounds);
657 return fxArray<double>(descr);
658 }
659#endif // HAVE_FXARRAY
660
661 // ===========================================================================================
662 // Scalar Property Accessors
663 // ===========================================================================================
664
665 int32_t& m() {
666 return *fitpack_surface_c_ref_m(as<fitpack_surface_c>());
667 }
668 const int32_t& m() const {
669 return *fitpack_surface_c_ref_m(as<fitpack_surface_c>());
670 }
671
672 int32_t& nmax() {
673 return *fitpack_surface_c_ref_nmax(as<fitpack_surface_c>());
674 }
675 const int32_t& nmax() const {
676 return *fitpack_surface_c_ref_nmax(as<fitpack_surface_c>());
677 }
678
679 int32_t& lwrk2() {
680 return *fitpack_surface_c_ref_lwrk2(as<fitpack_surface_c>());
681 }
682 const int32_t& lwrk2() const {
683 return *fitpack_surface_c_ref_lwrk2(as<fitpack_surface_c>());
684 }
685
686 int32_t& bc() {
687 return *fitpack_surface_c_ref_bc(as<fitpack_surface_c>());
688 }
689 const int32_t& bc() const {
690 return *fitpack_surface_c_ref_bc(as<fitpack_surface_c>());
691 }
692
693protected:
694 explicit fpSurface(NoAlloc tag) : fpFitter(tag) {}
695
696};
697
698#endif /* FPSURFACE_HPP_INCLUDED */
Standalone C++ RAII wrapper for Fortran fitpack_curve.
Definition fpCurve.hpp:56
double & smoothing()
Definition fpFitter.hpp:317
fpFitter(NoAlloc)
Protected constructor for derived classes (does not allocate)
Definition fpFitter.hpp:354
T * as()
Definition fpFitter.hpp:360
fxArray< double > t() const
Zero-copy fxArray view of component 't'.
Definition fpSurface.hpp:643
std::vector< double > y_vector() const
Deep copy of component 'y' as a std::vector.
Definition fpSurface.hpp:425
int32_t & nmax()
Definition fpSurface.hpp:672
void core_comm_expand(std::vector< double > &buffer) override
core_comm_expand
Definition fpSurface.hpp:362
int32_t & bc()
Definition fpSurface.hpp:686
virtual fpSurface derivative_spline(int32_t nux, int32_t nuy, int32_t *ierr=nullptr)
Definition fpSurface.hpp:314
~fpSurface() override
Destructor - deallocates if owned.
Definition fpSurface.hpp:72
fpSurface(const fpSurface &other)
Copy constructor - deep copy.
Definition fpSurface.hpp:79
const int32_t & nmax() const
Definition fpSurface.hpp:675
fpSurface()
Default constructor - allocates new fitpack_surface.
Definition fpSurface.hpp:65
virtual double integral(std::vector< double > &lower, std::vector< double > &upper) const
integral
Definition fpSurface.hpp:302
void comm_expand(std::vector< double > &buffer) override
comm_expand
Definition fpSurface.hpp:336
fpSurface(NoAlloc tag)
Definition fpSurface.hpp:694
virtual void new_points(std::vector< double > &x, std::vector< double > &y, std::vector< double > &z, double *w=nullptr)
new_points
Definition fpSurface.hpp:212
int32_t comm_size() const override
Definition fpSurface.hpp:320
const int32_t & lwrk2() const
Definition fpSurface.hpp:682
fpSurface(fitpack_surface_c &c_wrapper, ViewTag)
Non-owning view ctor: bit-copy the C handle, mark is_pointer=true. Used by parent classes' polymorphi...
Definition fpSurface.hpp:131
void comm_pack(std::vector< double > &buffer) const override
comm_pack
Definition fpSurface.hpp:327
const fpFitter & as_parent() const
Definition fpSurface.hpp:201
virtual int32_t interpolate(bool *reset_knots=nullptr)
Definition fpSurface.hpp:231
std::array< int64_t, 2 > t_shape() const
Extents of component 't', leading dimension first.
Definition fpSurface.hpp:623
virtual int32_t fit(double *smoothing=nullptr, int32_t *order=nullptr, bool *keep_knots=nullptr)
Definition fpSurface.hpp:227
bool is_pointer() const override
Check if this is a non-owning pointer.
Definition fpSurface.hpp:150
virtual std::vector< double > dfdx_ongrid(std::vector< double > &x, std::vector< double > &y, int32_t dx, int32_t dy, int32_t *ierr=nullptr)
dfdx_ongrid
Definition fpSurface.hpp:289
virtual double dfdx(double x, double y, int32_t dx, int32_t dy, int32_t *ierr=nullptr)
Definition fpSurface.hpp:269
virtual std::vector< double > eval(std::vector< double > &x, std::vector< double > &y, int32_t *ierr=nullptr)
eval
Definition fpSurface.hpp:246
std::vector< double > w_vector() const
Deep copy of component 'w' as a std::vector.
Definition fpSurface.hpp:515
fxArray< double > x() const
Zero-copy fxArray view of component 'x'.
Definition fpSurface.hpp:403
virtual std::vector< double > eval_ongrid(std::vector< double > &x, std::vector< double > &y, int32_t *ierr=nullptr)
eval_ongrid
Definition fpSurface.hpp:259
double mse() const override
Definition fpSurface.hpp:342
fpSurface & operator=(const fpSurface &other)
Copy assignment - deep copy.
Definition fpSurface.hpp:87
fxArray< double > wrk2() const
Zero-copy fxArray view of component 'wrk2'.
Definition fpSurface.hpp:583
fpFitter & as_parent()
Upcast to parent type (reference, no copy)
Definition fpSurface.hpp:198
int32_t & lwrk2()
Definition fpSurface.hpp:679
const int32_t & m() const
Definition fpSurface.hpp:668
void destroy_base() override
Definition fpSurface.hpp:368
const char * c_type_name() const override
Return the C wrapper struct name for this class (e.g. "fitpack_surface_c").
Definition fpSurface.hpp:157
virtual int32_t new_fit(std::vector< double > &x, std::vector< double > &y, std::vector< double > &z, double *w=nullptr, double *smoothing=nullptr, int32_t *order=nullptr)
new_fit
Definition fpSurface.hpp:221
fitpack_surface_c & c_handle()
Get underlying C wrapper (for interop)
Definition fpSurface.hpp:172
virtual fpCurve cross_section(double u, bool along_y, int32_t *ierr=nullptr)
Definition fpSurface.hpp:308
std::vector< double > x_vector() const
Deep copy of component 'x' as a std::vector.
Definition fpSurface.hpp:380
std::vector< double > wrk2_vector() const
Deep copy of component 'wrk2' as a std::vector.
Definition fpSurface.hpp:560
static fpSurface make_view()
Construct an empty (non-owning) wrapper, for use as a view target.
Definition fpSurface.hpp:191
void core_comm_pack(std::vector< double > &buffer) const override
core_comm_pack
Definition fpSurface.hpp:353
const int32_t & bc() const
Definition fpSurface.hpp:689
int32_t & m()
Definition fpSurface.hpp:665
virtual int32_t least_squares(double *smoothing=nullptr, bool *reset_knots=nullptr)
Definition fpSurface.hpp:235
std::vector< double > t_vector() const
Deep copy of component 't' as a std::vector.
Definition fpSurface.hpp:609
fpSurface(fpSurface &&other) noexcept
Move constructor - transfer ownership.
Definition fpSurface.hpp:98
const fitpack_surface_c & c_handle() const
Get underlying C wrapper (const, for interop)
Definition fpSurface.hpp:179
std::vector< double > z_vector() const
Deep copy of component 'z' as a std::vector.
Definition fpSurface.hpp:470
int32_t core_comm_size() const override
Definition fpSurface.hpp:346
fpSurface & operator=(fpSurface &&other) noexcept
Move assignment - transfer ownership.
Definition fpSurface.hpp:106
fpSurface(fitpack_surface_c &c_wrapper, bool move=false)
Construct from existing C wrapper (takes ownership if move=true)
Definition fpSurface.hpp:117
bool is_allocated() const override
Check if object is allocated.
Definition fpSurface.hpp:143
fxArray< double > y() const
Zero-copy fxArray view of component 'y'.
Definition fpSurface.hpp:448
virtual double eval(double x, double y, int32_t *ierr=nullptr)
Definition fpSurface.hpp:239
virtual std::vector< double > dfdx(std::vector< double > &x, std::vector< double > &y, int32_t dx, int32_t dy, int32_t *ierr=nullptr)
dfdx
Definition fpSurface.hpp:276
const char * cpp_type_name() const override
Return the fully-qualified C++ class name for this class. Owned by the C++ layer — does not round-tri...
Definition fpSurface.hpp:165
fxArray< double > z() const
Zero-copy fxArray view of component 'z'.
Definition fpSurface.hpp:493
fxArray< double > w() const
Zero-copy fxArray view of component 'w'.
Definition fpSurface.hpp:538
Tag type for derived class constructors (no allocation)
Definition fpFitter.hpp:349
Tag type for non-owning view constructors of polymorphic concrete subtypes. Declared on roots and abs...
Definition fpFitter.hpp:103