fitpack
Modern Fortran library for curve and surface fitting with splines
Loading...
Searching...
No Matches
fpConvexCurve Class Reference

Standalone C++ RAII wrapper for Fortran fitpack_convex_curve. More...

#include <fpConvexCurve.hpp>

Inheritance diagram for fpConvexCurve:
Collaboration diagram for fpConvexCurve:

Public Member Functions

 fpConvexCurve ()
 Default constructor - allocates new fitpack_convex_curve.
 
 ~fpConvexCurve () override
 Destructor - deallocates if owned.
 
 fpConvexCurve (const fpConvexCurve &other)
 Copy constructor - deep copy.
 
fpConvexCurveoperator= (const fpConvexCurve &other)
 Copy assignment - deep copy.
 
 fpConvexCurve (fpConvexCurve &&other) noexcept
 Move constructor - transfer ownership.
 
fpConvexCurveoperator= (fpConvexCurve &&other) noexcept
 Move assignment - transfer ownership.
 
 fpConvexCurve (fitpack_convex_curve_c &c_wrapper, bool move=false)
 Construct from existing C wrapper (takes ownership if move=true)
 
 fpConvexCurve (fitpack_convex_curve_c &c_wrapper, ViewTag)
 Non-owning view ctor: bit-copy the C handle, mark is_pointer=true. Used by parent classes' polymorphic accessors to wrap a base-class handle as the correct concrete subtype.
 
bool is_allocated () const override
 Check if object is allocated.
 
bool is_pointer () const override
 Check if this is a non-owning pointer.
 
const char * c_type_name () const override
 Return the C wrapper struct name for this class (e.g. "fitpack_convex_curve_c").
 
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-trip through Fortran.
 
fitpack_convex_curve_c & c_handle ()
 Get underlying C wrapper (for interop)
 
const fitpack_convex_curve_c & c_handle () const
 Get underlying C wrapper (const, for interop)
 
fpCurveas_parent ()
 Upcast to parent type (reference, no copy)
 
const fpCurveas_parent () const
 
void new_points (std::vector< double > &x, std::vector< double > &y, double *w=nullptr) override
 new_points
 
int32_t fit (double *smoothing=nullptr, int32_t *order=nullptr, bool *keep_knots=nullptr) override
 
int32_t least_squares (double *smoothing=nullptr, bool *reset_knots=nullptr) override
 
virtual int32_t set_convexity (std::vector< double > &v)
 set_convexity
 
int32_t comm_size () const override
 
void comm_pack (std::vector< double > &buffer) const override
 comm_pack
 
void comm_expand (std::vector< double > &buffer) override
 comm_expand
 
double mse () const override
 
int32_t core_comm_size () const override
 
void core_comm_pack (std::vector< double > &buffer) const override
 core_comm_pack
 
void core_comm_expand (std::vector< double > &buffer) override
 core_comm_expand
 
void destroy_base () override
 
std::vector< double > v_vector () const
 Deep copy of component 'v' as a std::vector.
 
fxArray< double > v () const
 Zero-copy fxArray view of component 'v'.
 
std::vector< double > sx_vector () const
 Deep copy of component 'sx' as a std::vector.
 
fxArray< double > sx () const
 Zero-copy fxArray view of component 'sx'.
 
int32_t & maxtr ()
 
const int32_t & maxtr () const
 
int32_t & maxbin ()
 
const int32_t & maxbin () const
 
- Public Member Functions inherited from fpCurve
 fpCurve ()
 Default constructor - allocates new fitpack_curve.
 
 ~fpCurve () override
 Destructor - deallocates if owned.
 
 fpCurve (const fpCurve &other)
 Copy constructor - deep copy.
 
fpCurveoperator= (const fpCurve &other)
 Copy assignment - deep copy.
 
 fpCurve (fpCurve &&other) noexcept
 Move constructor - transfer ownership.
 
fpCurveoperator= (fpCurve &&other) noexcept
 Move assignment - transfer ownership.
 
 fpCurve (fitpack_curve_c &c_wrapper, bool move=false)
 Construct from existing C wrapper (takes ownership if move=true)
 
 fpCurve (fitpack_curve_c &c_wrapper, ViewTag)
 Non-owning view ctor: bit-copy the C handle, mark is_pointer=true. Used by parent classes' polymorphic accessors to wrap a base-class handle as the correct concrete subtype.
 
bool is_allocated () const override
 Check if object is allocated.
 
bool is_pointer () const override
 Check if this is a non-owning pointer.
 
const char * c_type_name () const override
 Return the C wrapper struct name for this class (e.g. "fitpack_curve_c").
 
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-trip through Fortran.
 
fitpack_curve_c & c_handle ()
 Get underlying C wrapper (for interop)
 
const fitpack_curve_c & c_handle () const
 Get underlying C wrapper (const, for interop)
 
fpFitteras_parent ()
 Upcast to parent type (reference, no copy)
 
const fpFitteras_parent () const
 
virtual int32_t new_fit (std::vector< double > &x, std::vector< double > &y, double *w=nullptr, double *smoothing=nullptr, int32_t *order=nullptr)
 new_fit
 
virtual int32_t interpolate (int32_t *order=nullptr, bool *reset_knots=nullptr)
 
virtual double eval (double x, int32_t &ierr)
 
virtual double eval (double x) const
 
virtual std::vector< double > eval (std::vector< double > &x, int32_t &ierr)
 eval
 
virtual std::vector< double > eval (std::vector< double > &x)
 eval
 
virtual double integral (double from, double to)
 
virtual void fourier_coefficients (std::vector< double > &alpha, std::vector< double > &a, std::vector< double > &b, int32_t *ierr=nullptr)
 fourier_coefficients
 
virtual std::vector< double > zeros (int32_t max_size, int32_t *ierr=nullptr)
 zeros
 
virtual double dfdx (double x, int32_t order, int32_t *ierr=nullptr)
 
virtual std::vector< double > dfdx (std::vector< double > &x, int32_t order, int32_t *ierr=nullptr)
 dfdx
 
virtual std::vector< double > dfdx_all (double x, int32_t &ierr, int32_t n_result)
 dfdx_all
 
virtual std::vector< double > dfdx_all (double x, int32_t n_result)
 dfdx_all
 
virtual void insert_knot (double x, int32_t *ierr=nullptr)
 
virtual void insert_knot (std::vector< double > &x, int32_t *ierr=nullptr)
 insert_knot
 
int32_t comm_size () const override
 
void comm_pack (std::vector< double > &buffer) const override
 comm_pack
 
void comm_expand (std::vector< double > &buffer) override
 comm_expand
 
double mse () const override
 
int32_t core_comm_size () const override
 
void core_comm_pack (std::vector< double > &buffer) const override
 core_comm_pack
 
void core_comm_expand (std::vector< double > &buffer) override
 core_comm_expand
 
void destroy_base () override
 
std::vector< double > x_vector () const
 Deep copy of component 'x' as a std::vector.
 
fxArray< double > x () const
 Zero-copy fxArray view of component 'x'.
 
std::vector< double > y_vector () const
 Deep copy of component 'y' as a std::vector.
 
fxArray< double > y () const
 Zero-copy fxArray view of component 'y'.
 
std::vector< double > sp_vector () const
 Deep copy of component 'sp' as a std::vector.
 
fxArray< double > sp () const
 Zero-copy fxArray view of component 'sp'.
 
std::vector< double > w_vector () const
 Deep copy of component 'w' as a std::vector.
 
fxArray< double > w () const
 Zero-copy fxArray view of component 'w'.
 
std::vector< double > wrk_fou_vector () const
 Deep copy of component 'wrk_fou' as a std::vector.
 
std::array< int64_t, 2 > wrk_fou_shape () const
 Extents of component 'wrk_fou', leading dimension first.
 
fxArray< double > wrk_fou () const
 Zero-copy fxArray view of component 'wrk_fou'.
 
std::vector< double > t_vector () const
 Deep copy of component 't' as a std::vector.
 
fxArray< double > t () const
 Zero-copy fxArray view of component 't'.
 
int32_t & m ()
 
const int32_t & m () const
 
int32_t & order ()
 
const int32_t & order () const
 
double & xleft ()
 
const double & xleft () const
 
double & xright ()
 
const double & xright () const
 
int32_t & nest ()
 
const int32_t & nest () const
 
int32_t & bc ()
 
const int32_t & bc () const
 
int32_t & knots ()
 
const int32_t & knots () const
 
FP_SIZE degree () const
 Spline degree k of the current fit.
 
FP_FLAG new_fit (const std::vector< FP_REAL > &x, const std::vector< FP_REAL > &y, FP_REAL smoothing=1000.0)
 Fit a new curve through (x, y).
 
FP_FLAG new_fit (const std::vector< FP_REAL > &x, const std::vector< FP_REAL > &y, const std::vector< FP_REAL > &w, FP_REAL smoothing=1000.0)
 Fit a new curve through (x, y) with per-point weights w.
 
FP_FLAG fit (FP_SIZE order)
 Refit the current points with a new spline order.
 
FP_FLAG fit (FP_REAL smoothing)
 Refit the current points with a new smoothing.
 
FP_FLAG fit (FP_REAL smoothing, FP_SIZE order)
 Refit the current points with a new smoothing and spline order.
 
FP_FLAG interpolate (FP_SIZE order)
 Interpolating fit of the given spline order.
 
FP_REAL eval (FP_REAL x, FP_FLAG *ierr)
 Evaluate the curve at x, reporting the status through ierr.
 
std::vector< FP_REAL > eval (const std::vector< FP_REAL > &x, FP_FLAG *ierr)
 Evaluate the curve at every x, reporting the status through ierr.
 
std::vector< fpPoint< 2 > > eval (FP_REAL xmin, FP_REAL xmax, FP_SIZE npts, FP_FLAG *ierr=nullptr)
 Evaluate the curve at npts points evenly spaced over [xmin, xmax].
 
FP_REAL ddx (FP_REAL x, FP_SIZE order, FP_FLAG *ierr=nullptr)
 Derivative of the given order at x.
 
std::vector< FP_REAL > ddx (FP_REAL x, FP_FLAG *ierr=nullptr)
 All derivatives (orders 0..k) at x.
 
void set_bc (FP_FLAG value)
 Spline behaviour outside the support (one of the OUTSIDE_* flags).
 
FP_FLAG get_bc () const
 
FP_FLAG fourier (const std::vector< FP_REAL > &alpha, std::vector< FP_REAL > &A, std::vector< FP_REAL > &B)
 Fourier coefficients A, B of the curve at the given angular frequencies.
 
- Public Member Functions inherited from fpFitter
virtual ~fpFitter ()=default
 
const char * fortran_type_name () const
 Return the dynamic Fortran type name of the underlying object.
 
fitpack_fitter_c & c_handle ()
 Get underlying C wrapper (for interop)
 
const fitpack_fitter_c & c_handle () const
 Get underlying C wrapper (const, for interop)
 
std::vector< double > c_vector () const
 Deep copy of component 'c' as a std::vector.
 
fxArray< double > c () const
 Zero-copy fxArray view of component 'c'.
 
std::vector< double > wrk_vector () const
 Deep copy of component 'wrk' as a std::vector.
 
fxArray< double > wrk () const
 Zero-copy fxArray view of component 'wrk'.
 
std::vector< int32_t > iwrk_vector () const
 Deep copy of component 'iwrk' as a std::vector.
 
fxArray< int32_t > iwrk () const
 Zero-copy fxArray view of component 'iwrk'.
 
int32_t & iopt ()
 
const int32_t & iopt () const
 
double & smoothing ()
 
const double & smoothing () const
 
double & fp ()
 
const double & fp () const
 
int32_t & lwrk ()
 
const int32_t & lwrk () const
 
int32_t & liwrk ()
 
const int32_t & liwrk () const
 

Static Public Member Functions

static fpConvexCurve make_view ()
 Construct an empty (non-owning) wrapper, for use as a view target.
 
- Static Public Member Functions inherited from fpCurve
static fpCurve make_view ()
 Construct an empty (non-owning) wrapper, for use as a view target.
 

Protected Member Functions

 fpConvexCurve (NoAlloc tag)
 
- Protected Member Functions inherited from fpCurve
 fpCurve (NoAlloc tag)
 
- Protected Member Functions inherited from fpFitter
 fpFitter (NoAlloc)
 Protected constructor for derived classes (does not allocate)
 
template<typename T>
T * as ()
 
template<typename T>
const T * as () const
 

Additional Inherited Members

- Protected Attributes inherited from fpFitter
fitpack_fitter_c cobj = fitpack_fitter_c_null
 

Detailed Description

Standalone C++ RAII wrapper for Fortran fitpack_convex_curve.

This class provides automatic memory management (RAII) and a natural C++ API for the underlying Fortran fitpack_convex_curve, without requiring the fortran-arrays library. Array arguments use std::vector<T> for standalone operation. Extends fpCurve (Fortran: extends(fitpack_curve))

Constructor & Destructor Documentation

◆ fpConvexCurve() [1/6]

fpConvexCurve::fpConvexCurve ( )
inline

Default constructor - allocates new fitpack_convex_curve.

Here is the call graph for this function:

◆ ~fpConvexCurve()

fpConvexCurve::~fpConvexCurve ( )
inlineoverride

Destructor - deallocates if owned.

Here is the call graph for this function:

◆ fpConvexCurve() [2/6]

fpConvexCurve::fpConvexCurve ( const fpConvexCurve & other)
inline

Copy constructor - deep copy.

Here is the call graph for this function:

◆ fpConvexCurve() [3/6]

fpConvexCurve::fpConvexCurve ( fpConvexCurve && other)
inlinenoexcept

Move constructor - transfer ownership.

Here is the call graph for this function:

◆ fpConvexCurve() [4/6]

fpConvexCurve::fpConvexCurve ( fitpack_convex_curve_c & c_wrapper,
bool move = false )
inlineexplicit

Construct from existing C wrapper (takes ownership if move=true)

Here is the call graph for this function:

◆ fpConvexCurve() [5/6]

fpConvexCurve::fpConvexCurve ( fitpack_convex_curve_c & c_wrapper,
ViewTag  )
inlineexplicit

Non-owning view ctor: bit-copy the C handle, mark is_pointer=true. Used by parent classes' polymorphic accessors to wrap a base-class handle as the correct concrete subtype.

Here is the call graph for this function:

◆ fpConvexCurve() [6/6]

fpConvexCurve::fpConvexCurve ( NoAlloc tag)
inlineexplicitprotected
Here is the call graph for this function:

Member Function Documentation

◆ as_parent() [1/2]

fpCurve & fpConvexCurve::as_parent ( )
inline

Upcast to parent type (reference, no copy)

Here is the call graph for this function:

◆ as_parent() [2/2]

const fpCurve & fpConvexCurve::as_parent ( ) const
inline
Here is the call graph for this function:

◆ c_handle() [1/2]

fitpack_convex_curve_c & fpConvexCurve::c_handle ( )
inline

Get underlying C wrapper (for interop)

Here is the call graph for this function:

◆ c_handle() [2/2]

const fitpack_convex_curve_c & fpConvexCurve::c_handle ( ) const
inline

Get underlying C wrapper (const, for interop)

Here is the call graph for this function:

◆ c_type_name()

const char * fpConvexCurve::c_type_name ( ) const
inlineoverridevirtual

Return the C wrapper struct name for this class (e.g. "fitpack_convex_curve_c").

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ comm_expand()

void fpConvexCurve::comm_expand ( std::vector< double > & buffer)
inlineoverridevirtual

comm_expand

Implements fpFitter.

Here is the call graph for this function:

◆ comm_pack()

void fpConvexCurve::comm_pack ( std::vector< double > & buffer) const
inlineoverridevirtual

comm_pack

Implements fpFitter.

Here is the call graph for this function:

◆ comm_size()

int32_t fpConvexCurve::comm_size ( ) const
inlineoverridevirtual

Implements fpFitter.

Here is the call graph for this function:

◆ core_comm_expand()

void fpConvexCurve::core_comm_expand ( std::vector< double > & buffer)
inlineoverridevirtual

core_comm_expand

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ core_comm_pack()

void fpConvexCurve::core_comm_pack ( std::vector< double > & buffer) const
inlineoverridevirtual

core_comm_pack

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ core_comm_size()

int32_t fpConvexCurve::core_comm_size ( ) const
inlineoverridevirtual

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ cpp_type_name()

const char * fpConvexCurve::cpp_type_name ( ) const
inlineoverridevirtual

Return the fully-qualified C++ class name for this class. Owned by the C++ layer — does not round-trip through Fortran.

Reimplemented from fpFitter.

◆ destroy_base()

void fpConvexCurve::destroy_base ( )
inlineoverridevirtual

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ fit()

int32_t fpConvexCurve::fit ( double * smoothing = nullptr,
int32_t * order = nullptr,
bool * keep_knots = nullptr )
inlineoverridevirtual

Reimplemented from fpCurve.

Here is the call graph for this function:

◆ is_allocated()

bool fpConvexCurve::is_allocated ( ) const
inlineoverridevirtual

Check if object is allocated.

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ is_pointer()

bool fpConvexCurve::is_pointer ( ) const
inlineoverridevirtual

Check if this is a non-owning pointer.

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ least_squares()

int32_t fpConvexCurve::least_squares ( double * smoothing = nullptr,
bool * reset_knots = nullptr )
inlineoverridevirtual

Reimplemented from fpCurve.

Here is the call graph for this function:

◆ make_view()

static fpConvexCurve fpConvexCurve::make_view ( )
inlinestatic

Construct an empty (non-owning) wrapper, for use as a view target.

The returned object has a null handle (cptr==nullptr, is_pointer==false) and does NOT allocate a Fortran object. Intended as a fill target for member-view accessors emitted on parent types — the parent populates the handle with c_loc() into its own storage and sets is_pointer=true.

Here is the call graph for this function:

◆ maxbin() [1/2]

int32_t & fpConvexCurve::maxbin ( )
inline
Here is the call graph for this function:

◆ maxbin() [2/2]

const int32_t & fpConvexCurve::maxbin ( ) const
inline
Here is the call graph for this function:

◆ maxtr() [1/2]

int32_t & fpConvexCurve::maxtr ( )
inline
Here is the call graph for this function:

◆ maxtr() [2/2]

const int32_t & fpConvexCurve::maxtr ( ) const
inline
Here is the call graph for this function:

◆ mse()

double fpConvexCurve::mse ( ) const
inlineoverridevirtual

Reimplemented from fpFitter.

Here is the call graph for this function:

◆ new_points()

void fpConvexCurve::new_points ( std::vector< double > & x,
std::vector< double > & y,
double * w = nullptr )
inlineoverridevirtual

new_points

Reimplemented from fpCurve.

Here is the call graph for this function:

◆ operator=() [1/2]

fpConvexCurve & fpConvexCurve::operator= ( const fpConvexCurve & other)
inline

Copy assignment - deep copy.

Here is the call graph for this function:

◆ operator=() [2/2]

fpConvexCurve & fpConvexCurve::operator= ( fpConvexCurve && other)
inlinenoexcept

Move assignment - transfer ownership.

Here is the call graph for this function:

◆ set_convexity()

virtual int32_t fpConvexCurve::set_convexity ( std::vector< double > & v)
inlinevirtual

set_convexity

Here is the call graph for this function:

◆ sx()

fxArray< double > fpConvexCurve::sx ( ) const
inline

Zero-copy fxArray view of component 'sx'.

array_c_from_ptr builds the descriptor from the borrowed pointer and bounds, so the view aliases the Fortran storage directly — nothing is copied and writes through sx()(i) land in the object.

Note
Only available when the Fortran-Arrays library is present and enabled (HAVE_FXARRAY).
Warning
The view is invalidated by any refit, assignment or destroy call on this object; re-read it rather than retaining it.
Here is the call graph for this function:

◆ sx_vector()

std::vector< double > fpConvexCurve::sx_vector ( ) const
inline

Deep copy of component 'sx' as a std::vector.

Returns
An owning copy, empty when the component is unallocated.
Here is the call graph for this function:

◆ v()

fxArray< double > fpConvexCurve::v ( ) const
inline

Zero-copy fxArray view of component 'v'.

array_c_from_ptr builds the descriptor from the borrowed pointer and bounds, so the view aliases the Fortran storage directly — nothing is copied and writes through v()(i) land in the object.

Note
Only available when the Fortran-Arrays library is present and enabled (HAVE_FXARRAY).
Warning
The view is invalidated by any refit, assignment or destroy call on this object; re-read it rather than retaining it.
Here is the call graph for this function:

◆ v_vector()

std::vector< double > fpConvexCurve::v_vector ( ) const
inline

Deep copy of component 'v' as a std::vector.

Returns
An owning copy, empty when the component is unallocated.
Here is the call graph for this function:

The documentation for this class was generated from the following file: