fitpack
Modern Fortran library for curve and surface fitting with splines
Loading...
Searching...
No Matches
fitpack_sphere_domains::fitpack_sphere Interface Reference

Bicubic spline fitter for data scattered on the sphere. More...

Inheritance diagram for fitpack_sphere_domains::fitpack_sphere:
Collaboration diagram for fitpack_sphere_domains::fitpack_sphere:

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_flagiopt = IOPT_NEW_SMOOTHING
 Fitting state flag.
 
real(fp_realsmoothing = 1000.0_FP_REAL
 Smoothing parameter.
 
real(fp_realfp = zero
 Weighted sum of squared residuals.
 
real(fp_real), dimension(:), allocatable c
 B-spline coefficients.
 
integer(fp_sizelwrk = 0
 Real workspace and its size.
 
real(fp_real), dimension(:), allocatable wrk
 
integer(fp_sizeliwrk = 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.
 

Detailed Description

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).

See also
Dierckx, Ch. 11, §11.2 (pp. 263–269)

Member Function/Subroutine Documentation

◆ comm_expand()

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.

Here is the call graph for this function:

◆ comm_pack()

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.

◆ comm_size()

procedure fitpack_sphere_domains::fitpack_sphere::comm_size ( class(fitpack_sphere), intent(in) this)

Parallel communication interface.

◆ destroy()

procedure fitpack_sphere_domains::fitpack_sphere::destroy ( class(fitpack_sphere), intent(inout) this)

Clean memory.

◆ eval() [1/2]

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.

Parameters
[in]thetaColatitude \( \theta \in [0, \pi] \).
[in]phiLongitude \( \phi \in [0, 2\pi] \).
[out]ierrOptional error flag.
Returns
Spline value \( s(\theta, \phi) \).
See also
bispev
Here is the call graph for this function:

◆ eval() [2/2]

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).

Parameters
[in]thetaColatitude evaluation points.
[in]phiLongitude evaluation points.
[out]ierrOptional error flag.
Returns
Grid of spline values, dimensioned (size(phi), size(theta)).
See also
bispev

◆ fit()

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.

Parameters
[in]smoothingSmoothing factor ( \( s \ge 0 \)); default uses stored value.
[in]keep_knotsIf .true., reuse the current knot set.
Returns
Error flag.
See also
sphere

◆ interpolate()

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 \)).

Parameters
[in]reset_knotsIf .true. (default), start with fresh knot placement.
Returns
Error flag.
See also
sphere

◆ least_squares()

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.

See also
sphere

◆ new_fit()

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.

Parameters
[in]thetaColatitude coordinates.
[in]phiLongitude coordinates.
[in]rFunction values.
[in]wOptional weights.
[in]smoothingOptional smoothing factor.
Returns
Error flag.
See also
sphere

◆ new_points()

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 \).

Parameters
[in]thetaColatitude coordinates.
[in]phiLongitude coordinates (same size as theta).
[in]rFunction values at each point.
[in]wOptional weights (default: uniform).

◆ sphere_eval_many()

procedure, private fitpack_sphere_domains::fitpack_sphere::sphere_eval_many ( 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 )
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).

Parameters
[in]thetaColatitude evaluation points.
[in]phiLongitude evaluation points.
[out]ierrOptional error flag.
Returns
Grid of spline values, dimensioned (size(phi), size(theta)).
See also
bispev

◆ sphere_eval_one()

procedure, private fitpack_sphere_domains::fitpack_sphere::sphere_eval_one ( class(fitpack_sphere), intent(inout) this,
real(fp_real), intent(in) theta,
real(fp_real), intent(in) phi,
integer, intent(out), optional ierr )
private

Evaluate polar domain at given x,y coordinates.

Parameters
[in]thetaColatitude \( \theta \in [0, \pi] \).
[in]phiLongitude \( \phi \in [0, 2\pi] \).
[out]ierrOptional error flag.
Returns
Spline value \( s(\theta, \phi) \).
See also
bispev

◆ sphere_new_from_points()

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.

Parameters
[in]thetaColatitude coordinates \( \theta_i \in [0, \pi] \).
[in]phiLongitude coordinates \( \phi_i \in [0, 2\pi] \).
[in]rFunction values at each point.
[in]wOptional weights.
[out]ierrOptional error flag; if absent, halts on error.
See also
sphere
Here is the call graph for this function:

Member Data Documentation

◆ knots

integer, dimension(2) fitpack_sphere_domains::fitpack_sphere::knots = 0

◆ lwrk2

integer fitpack_sphere_domains::fitpack_sphere::lwrk2 = 0

◆ m

integer fitpack_sphere_domains::fitpack_sphere::m = 0

Scattered data points.

◆ nest

integer, dimension(2) fitpack_sphere_domains::fitpack_sphere::nest = 0

◆ nmax

integer fitpack_sphere_domains::fitpack_sphere::nmax = 0

◆ phi

real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::phi

◆ r

real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::r

Function values at the points.

◆ t

real(fp_real), dimension(:,:), allocatable fitpack_sphere_domains::fitpack_sphere::t

◆ theta

real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::theta

◆ w

real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::w

◆ wrk2

real(fp_real), dimension(:), allocatable fitpack_sphere_domains::fitpack_sphere::wrk2

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