|
fitpack
Modern Fortran library for curve and surface fitting with splines
|
Bicubic spline fitter for data scattered on the sphere. More...


Public Member Functions | |
| procedure | destroy (this) |
| Clean memory. | |
| procedure | new_points (this, theta, phi, r, w) |
| Set new points. | |
| procedure | new_fit (this, theta, phi, r, w, smoothing) |
| Generate new fit. | |
| procedure | fit (this, smoothing, keep_knots) |
| Generate/update fitting curve, with optional smoothing. | |
| procedure | least_squares (this, smoothing, reset_knots) |
| Fit a least-squares spherical surface with fixed knots. | |
| procedure | interpolate (this, reset_knots) |
| Fit an interpolating spherical surface ( \( s = 0 \)). | |
| generic | eval (this, theta, phi, ierr) |
| Evaluate polar domain at given x,y coordinates. | |
| generic | eval (this, theta, phi, ierr) |
| Evaluate the spherical spline on a grid of colatitude and longitude values. | |
| procedure | comm_size (this) |
| Parallel communication interface. | |
| procedure | comm_pack (this, buffer) |
| Pack the sphere fitter state into a communication buffer. | |
| procedure | comm_expand (this, buffer) |
| Restore the sphere fitter state from a communication buffer. | |
| type(fitpack_sphere) function | sphere_new_from_points (theta, phi, r, w, ierr) |
| Construct a fitpack_sphere from scattered data and perform an initial fit. | |
Public Member Functions inherited from fitpack_fitters::fitpack_fitter | |
| procedure, non_overridable | mse (this) |
| MSE accessor (shared by all types) | |
| procedure, non_overridable | core_comm_size (this) |
| Base field helpers for comm (non-overridable, called by subtypes) | |
| procedure, non_overridable | core_comm_pack (this, buffer) |
| Pack base fields into communication buffer. | |
| procedure, non_overridable | core_comm_expand (this, buffer) |
| Expand base fields from communication buffer. | |
| procedure, non_overridable | destroy_base (this) |
| Base field reset (called by subtype destroy methods) | |
| procedure(comm_size_if), deferred | comm_size (this) |
| Deferred communication interface. | |
| procedure(comm_pack_if), deferred | comm_pack (this, buffer) |
| procedure(comm_expand_if), deferred | comm_expand (this, buffer) |
Public Attributes | |
| integer | m = 0 |
| Scattered data points. | |
| real(fp_real), dimension(:), allocatable | theta |
| real(fp_real), dimension(:), allocatable | phi |
| real(fp_real), dimension(:), allocatable | r |
| Function values at the points. | |
| real(fp_real), dimension(:), allocatable | w |
| integer | lwrk2 = 0 |
| real(fp_real), dimension(:), allocatable | wrk2 |
| integer, dimension(2) | nest = 0 |
| integer | nmax = 0 |
| integer, dimension(2) | knots = 0 |
| real(fp_real), dimension(:,:), allocatable | t |
Public Attributes inherited from fitpack_fitters::fitpack_fitter | |
| integer(fp_flag) | iopt = IOPT_NEW_SMOOTHING |
| Fitting state flag. | |
| real(fp_real) | smoothing = 1000.0_FP_REAL |
| Smoothing parameter. | |
| real(fp_real) | fp = zero |
| Weighted sum of squared residuals. | |
| real(fp_real), dimension(:), allocatable | c |
| B-spline coefficients. | |
| integer(fp_size) | lwrk = 0 |
| Real workspace and its size. | |
| real(fp_real), dimension(:), allocatable | wrk |
| integer(fp_size) | liwrk = 0 |
| Integer workspace and its size. | |
| integer(fp_size), dimension(:), allocatable | iwrk |
Private Member Functions | |
| procedure, private | sphere_eval_one (this, theta, phi, ierr) |
| Evaluate polar domain at given x,y coordinates. | |
| procedure, private | sphere_eval_many (this, theta, phi, ierr) |
| Evaluate the spherical spline on a grid of colatitude and longitude values. | |
Bicubic spline fitter for data scattered on the sphere.
Stores the scattered spherical data \( (\theta_i, \phi_i, r_i) \), optional weights, and the fitted B-spline representation. The smoothing parameter controls closeness of fit versus smoothness. Pole constraints ensure regularity at \( \theta = 0 \) (north pole) and \( \theta = \pi \) (south pole).
| procedure fitpack_sphere_domains::fitpack_sphere::comm_expand | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_comm), dimension(:), intent(in) | buffer ) |
Restore the sphere fitter state from a communication buffer.

| procedure fitpack_sphere_domains::fitpack_sphere::comm_pack | ( | class(fitpack_sphere), intent(in) | this, |
| real(fp_comm), dimension(:), intent(out) | buffer ) |
Pack the sphere fitter state into a communication buffer.
| procedure fitpack_sphere_domains::fitpack_sphere::comm_size | ( | class(fitpack_sphere), intent(in) | this | ) |
Parallel communication interface.
| procedure fitpack_sphere_domains::fitpack_sphere::destroy | ( | class(fitpack_sphere), intent(inout) | this | ) |
Clean memory.
| generic fitpack_sphere_domains::fitpack_sphere::eval | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_real), intent(in) | theta, | ||
| real(fp_real), intent(in) | phi, | ||
| integer, intent(out), optional | ierr ) |
Evaluate polar domain at given x,y coordinates.
| [in] | theta | Colatitude \( \theta \in [0, \pi] \). |
| [in] | phi | Longitude \( \phi \in [0, 2\pi] \). |
| [out] | ierr | Optional error flag. |

| generic fitpack_sphere_domains::fitpack_sphere::eval | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_real), dimension(:), intent(in) | theta, | ||
| real(fp_real), dimension(:), intent(in) | phi, | ||
| integer, intent(out), optional | ierr ) |
Evaluate the spherical spline on a grid of colatitude and longitude values.
Returns \( r(j,i) = s(\theta_i, \phi_j) \) for all combinations of the input theta and phi vectors (tensor-product evaluation).
| [in] | theta | Colatitude evaluation points. |
| [in] | phi | Longitude evaluation points. |
| [out] | ierr | Optional error flag. |
(size(phi), size(theta)).| procedure fitpack_sphere_domains::fitpack_sphere::fit | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_real), intent(in), optional | smoothing, | ||
| logical, intent(in), optional | keep_knots ) |
Generate/update fitting curve, with optional smoothing.
Iterates over the smoothing schedule, calling the sphere core routine to fit a bicubic spline \( r = s(\theta, \phi) \) to scattered data on the unit sphere.
| [in] | smoothing | Smoothing factor ( \( s \ge 0 \)); default uses stored value. |
| [in] | keep_knots | If .true., reuse the current knot set. |
| procedure fitpack_sphere_domains::fitpack_sphere::interpolate | ( | class(fitpack_sphere), intent(inout) | this, |
| logical, intent(in), optional | reset_knots ) |
Fit an interpolating spherical surface ( \( s = 0 \)).
| [in] | reset_knots | If .true. (default), start with fresh knot placement. |
| procedure fitpack_sphere_domains::fitpack_sphere::least_squares | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_real), intent(in), optional | smoothing, | ||
| logical, intent(in), optional | reset_knots ) |
Fit a least-squares spherical surface with fixed knots.
| procedure fitpack_sphere_domains::fitpack_sphere::new_fit | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_real), dimension(:), intent(in) | theta, | ||
| real(fp_real), dimension(size(theta)), intent(in) | phi, | ||
| real(fp_real), dimension(size(theta)), intent(in) | r, | ||
| real(fp_real), dimension(size(theta)), intent(in), optional | w, | ||
| real(fp_real), intent(in), optional | smoothing ) |
Generate new fit.
| [in] | theta | Colatitude coordinates. |
| [in] | phi | Longitude coordinates. |
| [in] | r | Function values. |
| [in] | w | Optional weights. |
| [in] | smoothing | Optional smoothing factor. |
| procedure fitpack_sphere_domains::fitpack_sphere::new_points | ( | class(fitpack_sphere), intent(inout) | this, |
| real(fp_real), dimension(:), intent(in) | theta, | ||
| real(fp_real), dimension(size(theta)), intent(in) | phi, | ||
| real(fp_real), dimension(size(theta)), intent(in) | r, | ||
| real(fp_real), dimension(size(theta)), intent(in), optional | w ) |
Set new points.
Replaces any previous data with the given colatitude \( \theta_i \in [0, \pi] \), longitude \( \phi_i \in [0, 2\pi] \), and radial values \( r_i \).
| [in] | theta | Colatitude coordinates. |
| [in] | phi | Longitude coordinates (same size as theta). |
| [in] | r | Function values at each point. |
| [in] | w | Optional weights (default: uniform). |
|
private |
Evaluate the spherical spline on a grid of colatitude and longitude values.
Returns \( r(j,i) = s(\theta_i, \phi_j) \) for all combinations of the input theta and phi vectors (tensor-product evaluation).
| [in] | theta | Colatitude evaluation points. |
| [in] | phi | Longitude evaluation points. |
| [out] | ierr | Optional error flag. |
(size(phi), size(theta)).
|
private |
Evaluate polar domain at given x,y coordinates.
| [in] | theta | Colatitude \( \theta \in [0, \pi] \). |
| [in] | phi | Longitude \( \phi \in [0, 2\pi] \). |
| [out] | ierr | Optional error flag. |
| type(fitpack_sphere) function fitpack_sphere_domains::fitpack_sphere::sphere_new_from_points | ( | real(fp_real), dimension(:), intent(in) | theta, |
| real(fp_real), dimension(size(theta)), intent(in) | phi, | ||
| real(fp_real), dimension(size(theta)), intent(in) | r, | ||
| real(fp_real), dimension(size(theta)), intent(in), optional | w, | ||
| integer, intent(out), optional | ierr ) |
Construct a fitpack_sphere from scattered data and perform an initial fit.
| [in] | theta | Colatitude coordinates \( \theta_i \in [0, \pi] \). |
| [in] | phi | Longitude coordinates \( \phi_i \in [0, 2\pi] \). |
| [in] | r | Function values at each point. |
| [in] | w | Optional weights. |
| [out] | ierr | Optional error flag; if absent, halts on error. |

| integer, dimension(2) fitpack_sphere_domains::fitpack_sphere::knots = 0 |
| integer fitpack_sphere_domains::fitpack_sphere::lwrk2 = 0 |
| integer fitpack_sphere_domains::fitpack_sphere::m = 0 |
Scattered data points.
| integer, dimension(2) fitpack_sphere_domains::fitpack_sphere::nest = 0 |
| integer fitpack_sphere_domains::fitpack_sphere::nmax = 0 |
| real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::phi |
| real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::r |
Function values at the points.
| real(fp_real), dimension(:,:), allocatable fitpack_sphere_domains::fitpack_sphere::t |
| real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::theta |
| real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::w |
| real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::wrk2 |