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

OOP wrapper for bivariate spline fitting on the sphere to scattered data. More...

Data Types

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

Functions/Subroutines

integer function surface_fit_least_squares (this, smoothing, reset_knots)
 Fit a least-squares spherical surface with fixed knots.
 
integer function surface_fit_interpolating (this, reset_knots)
 Fit an interpolating spherical surface ( \( s = 0 \)).
 
integer function surface_fit_automatic_knots (this, smoothing, keep_knots)
 Fit a smoothing spherical surface with automatic knot placement.
 
elemental subroutine sphere_destroy (this)
 Release all allocated memory and reset the sphere fitter to its default state.
 
subroutine sphere_new_points (this, theta, phi, r, w)
 Load new scattered spherical data and allocate working storage.
 
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.
 
real(fp_real) function, dimension(size(phi), size(theta)) sphere_eval_many (this, theta, phi, ierr)
 Evaluate the spherical spline on a grid of colatitude and longitude values.
 
real(fp_real) function sphere_eval_one (this, theta, phi, ierr)
 Evaluate the spherical spline at a single point.
 
integer function sphere_new_fit (this, theta, phi, r, w, smoothing)
 Load new scattered data and fit a smoothing spherical spline in one call.
 
elemental integer(fp_size) function sphere_comm_size (this)
 Return the communication buffer size for parallel pack/expand.
 
pure subroutine sphere_comm_pack (this, buffer)
 Pack the sphere fitter state into a communication buffer.
 
pure subroutine sphere_comm_expand (this, buffer)
 Restore the sphere fitter state from a communication buffer.
 

Detailed Description

OOP wrapper for bivariate spline fitting on the sphere to scattered data.

Provides fitpack_sphere, a derived type for fitting bicubic splines to data scattered over the unit sphere, parameterized by colatitude \( \theta \in [0, \pi] \) and longitude \( \phi \in [0, 2\pi] \). The fitted surface \( r = s(\theta, \phi) \) satisfies appropriate pole constraints to ensure smoothness at \( \theta = 0 \) and \( \theta = \pi \). Uses the sphere core routine.

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

Function/Subroutine Documentation

◆ sphere_comm_expand()

pure subroutine fitpack_sphere_domains::sphere_comm_expand ( class(fitpack_sphere), intent(inout) this,
real(fp_comm), dimension(:), intent(in) buffer )
private

Restore the sphere fitter state from a communication buffer.

◆ sphere_comm_pack()

pure subroutine fitpack_sphere_domains::sphere_comm_pack ( class(fitpack_sphere), intent(in) this,
real(fp_comm), dimension(:), intent(out) buffer )
private

Pack the sphere fitter state into a communication buffer.

◆ sphere_comm_size()

elemental integer(fp_size) function fitpack_sphere_domains::sphere_comm_size ( class(fitpack_sphere), intent(in) this)
private

Return the communication buffer size for parallel pack/expand.

Here is the call graph for this function:

◆ sphere_destroy()

elemental subroutine fitpack_sphere_domains::sphere_destroy ( class(fitpack_sphere), intent(inout) this)
private

Release all allocated memory and reset the sphere fitter to its default state.

◆ sphere_eval_many()

real(fp_real) function, dimension(size(phi),size(theta)) fitpack_sphere_domains::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()

real(fp_real) function fitpack_sphere_domains::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 the spherical spline at a single point.

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:

◆ sphere_new_fit()

integer function fitpack_sphere_domains::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 )
private

Load new scattered data and fit a smoothing spherical spline in one call.

Parameters
[in]thetaColatitude coordinates.
[in]phiLongitude coordinates.
[in]rFunction values.
[in]wOptional weights.
[in]smoothingOptional smoothing factor.
Returns
Error flag.
See also
sphere
Here is the call graph for this function:

◆ sphere_new_from_points()

type(fitpack_sphere) function fitpack_sphere_domains::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 )
private

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

◆ sphere_new_points()

subroutine fitpack_sphere_domains::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 )
private

Load new scattered spherical data and allocate working storage.

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

◆ surface_fit_automatic_knots()

integer function fitpack_sphere_domains::surface_fit_automatic_knots ( class(fitpack_sphere), intent(inout) this,
real(fp_real), intent(in), optional smoothing,
logical, intent(in), optional keep_knots )
private

Fit a smoothing spherical surface with automatic knot placement.

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

Ensure we start with new knots (unless caller wants to keep them)

Here is the call graph for this function:

◆ surface_fit_interpolating()

integer function fitpack_sphere_domains::surface_fit_interpolating ( class(fitpack_sphere), intent(inout) this,
logical, intent(in), optional reset_knots )
private

Fit an interpolating spherical surface ( \( s = 0 \)).

Parameters
[in]reset_knotsIf .true. (default), start with fresh knot placement.
Returns
Error flag.
See also
sphere
Here is the call graph for this function:

◆ surface_fit_least_squares()

integer function fitpack_sphere_domains::surface_fit_least_squares ( class(fitpack_sphere), intent(inout) this,
real(fp_real), intent(in), optional smoothing,
logical, intent(in), optional reset_knots )
private

Fit a least-squares spherical surface with fixed knots.

See also
sphere
Here is the call graph for this function: