BS3DR

This function evaluates the derivative of a three-dimensional tensor-product spline, given its tensor-product B-spline representation.

Function Return Value

BS3DR — Value of the (IXDER, IYDER, IZDER) derivative of the spline at (XY, Z). (Output)

Required Arguments

IXDER — Order of the X-derivative. (Input)

IYDER — Order of the Y-derivative. (Input)

IZDER — Order of the Z-derivative. (Input)

XX-coordinate of the point at which the spline is to be evaluated. (Input)

YY-coordinate of the point at which the spline is to be evaluated. (Input)

ZZ-coordinate of the point at which the spline is to be evaluated. (Input)

KXORD — Order of the spline in the X-direction. (Input)

KYORD — Order of the spline in the Y-direction. (Input)

KZORD — Order of the spline in the Z-direction. (Input)

XKNOT — Array of length NXCOEF + KXORD containing the knot sequence in the X-direction. (Input)
KNOT must be nondecreasing.

YKNOT — Array of length NYCOEF + KYORD containing the knot sequence in the Y-direction. (Input)
YKNOT must be nondecreasing.

ZKNOT — Array of length NZCOEF + KZORD containing the knot sequence in the Z-direction. (Input)
ZKNOT must be nondecreasing.

NXCOEF — Number of B-spline coefficients in the X-direction. (Input)

NYCOEF — Number of B-spline coefficients in the Y-direction. (Input)

NZCOEF — Number of B-spline coefficients in the Z-direction. (Input)

BSCOEF — Array of length NXCOEF * NYCOEF * NZCOEF containing the tensor-product B-spline coefficients. (Input)
BSCOEF is treated internally as a matrix of size NXCOEF by NYCOEF by NZCOEF.

FORTRAN 90 Interface

Generic: BS3DR (IXDER, IYDER, IZDER, X, Y, Z, KXORD, KYORD, KZORD, XKNOT, YKNOT, ZKNOT, NXCOEF, NYCOEF, NZCOEF, BSCOEF)

Specific: The specific interface names are S_BS3DR and D_BS3DR.

FORTRAN 77 Interface

Single: BS3DR (IXDER, IYDER, IZDER, X, Y, Z, KXORD, KYORD, KZORD, XKNOT, YKNOT, ZKNOT, NXCOEF, NYCOEF, NZCOEF, BSCOEF)

Double: The double precision function name is DBS3DR.

Description

The function BS3DR evaluates a partial derivative of a trivariate tensor-product spline (represented as a linear combination of tensor-product B-splines) at a given point. For more information, see de Boor (1978, pages 351 353).

This routine returns the value of the function s(p,q,r) at a point (xyz) given the coefficients c by computing

 

where kx, ky, and kz are the orders of the splines. (These numbers are passed to the subroutine in KXORD, KYORD, and KZORD, respectively.) Likewise, tx, ty, and tz are the corresponding knot sequences (XKNOT, YKNOT, and ZKNOT).

Comments

1. Workspace may be explicitly provided, if desired, by use of B23DR/DB23DR. The reference is:

CALL B23DR(IXDER, IYDER, IZDER, X, Y, Z, KXORD, KYORD, KZORD, XKNOT, YKNOT, ZKNOT, NXCOEF, NYCOEF, NZCOEF, BSCOEF, WK)

The additional argument is:

WK — Work array of length 3 * MAX0(KXORD, KYORD, KZORD) + KYORD * KZORD + KZORD.

2. Informational errors

 

Type

Code

Description

3

1

The point X does not satisfy XKNOT(KXORD) .LEX .LEXKNOT(NXCOEF + 1).

3

2

The point Y does not satisfy YKNOT(KYORD) .LEY .LEYKNOT(NYCOEF + 1).

3

3

The point Z does not satisfy ZKNOT(KZORD) .LEZ .LEZKNOT(NZCOEF + 1).

Example

In this example, a spline interpolant s to a function f(x, y, z) = x4 + y(xz)3 is constructed using BS3IN. Next, BS3DR is used to compute s(2,0,1)(x, y, z). The values of this partial derivative and the error are computed on a 4 × 4 × 2 grid and then displayed.

 

USE BS3DR_INT

USE BS3IN_INT

USE BSNAK_INT

USE UMACH_INT

 

IMPLICIT NONE

! SPECIFICATIONS FOR PARAMETERS

INTEGER KXORD, KYORD, KZORD, LDF, MDF, NXDATA, NXKNOT,&

NYDATA, NYKNOT, NZDATA, NZKNOT

PARAMETER (KXORD=5, KYORD=2, KZORD=3, NXDATA=21, NYDATA=6,&

NZDATA=8, LDF=NXDATA, MDF=NYDATA,&

NXKNOT=NXDATA+KXORD, NYKNOT=NYDATA+KYORD,&

NZKNOT=NZDATA+KZORD)

!

INTEGER I, J, K, L, NOUT, NXCOEF, NYCOEF, NZCOEF

REAL BSCOEF(NXDATA,NYDATA,NZDATA), F, F201,&

FDATA(LDF,MDF,NZDATA), FLOAT, S201, X, XDATA(NXDATA),&

XKNOT(NXKNOT), Y, YDATA(NYDATA), YKNOT(NYKNOT), Z,&

ZDATA(NZDATA), ZKNOT(NZKNOT)

INTRINSIC FLOAT

! Define function and (2,0,1)

! derivative

F(X,Y,Z) = X*X*X*X + X*X*X*Y*Z*Z*Z

F201(X,Y,Z) = 18.0*X*Y*Z

! Set up X-interpolation points

DO 10 I=1, NXDATA

XDATA(I) = FLOAT(I-11)/10.0

10 CONTINUE

! Set up Y-interpolation points

DO 20 I=1, NYDATA

YDATA(I) = FLOAT(I-1)/FLOAT(NYDATA-1)

20 CONTINUE

! Set up Z-interpolation points

DO 30 I=1, NZDATA

ZDATA(I) = FLOAT(I-1)/FLOAT(NZDATA-1)

30 CONTINUE

! Generate knots

CALL BSNAK (NXDATA, XDATA, KXORD, XKNOT)

CALL BSNAK (NYDATA, YDATA, KYORD, YKNOT)

CALL BSNAK (NZDATA, ZDATA, KZORD, ZKNOT)

! Generate FDATA

DO 50 K=1, NZDATA

DO 40 I=1, NYDATA

DO 40 J=1, NXDATA

FDATA(J,I,K) = F(XDATA(J),YDATA(I),ZDATA(K))

40 CONTINUE

50 CONTINUE

! Get output unit number

CALL UMACH (2, NOUT)

! Interpolate&

CALL BS3IN (XDATA, YDATA, ZDATA, FDATA, KXORD, KYORD, KZORD, XKNOT, &

YKNOT, ZKNOT, BSCOEF)

!

NXCOEF = NXDATA

NYCOEF = NYDATA

NZCOEF = NZDATA

! Write heading

WRITE (NOUT,99999)

! Print over a grid of

! [-1.0,1.0] x [0.0,1.0] x [0.0,1.0]

! at 32 points.

DO 80 I=1, 4

DO 70 J=1, 4

DO 60 L=1, 2

X = 2.0*(FLOAT(I-1)/3.0) - 1.0

Y = FLOAT(J-1)/3.0

Z = FLOAT(L-1)

! Evaluate spline

S201 = BS3DR(2,0,1,X,Y,Z,KXORD,KYORD,KZORD,XKNOT,YKNOT,&

ZKNOT,NXCOEF,NYCOEF,NZCOEF,BSCOEF)

WRITE (NOUT,'(3F12.4,2F12.6)') X, Y, Z, S201,&

F201(X,Y,Z) - S201

60 CONTINUE

70 CONTINUE

80 CONTINUE

99999 FORMAT (38X, '(2,0,1)', /, 9X, 'X', 11X,&

'Y', 11X, 'Z', 4X, 'S (X,Y,Z) Error')

END

Output

 

(2,0,1)

X Y Z S (X,Y,Z) Error

-1.0000 0.0000 0.0000 -0.000107 0.000107

-1.0000 0.0000 1.0000 0.000053 -0.000053

-1.0000 0.3333 0.0000 0.064051 -0.064051

-1.0000 0.3333 1.0000 -5.935941 -0.064059

-1.0000 0.6667 0.0000 0.127542 -0.127542

-1.0000 0.6667 1.0000 -11.873034 -0.126966

-1.0000 1.0000 0.0000 0.191166 -0.191166

-1.0000 1.0000 1.0000 -17.808527 -0.191473

-0.3333 0.0000 0.0000 -0.000002 0.000002

-0.3333 0.0000 1.0000 0.000000 0.000000

-0.3333 0.3333 0.0000 0.021228 -0.021228

-0.3333 0.3333 1.0000 -1.978768 -0.021232

-0.3333 0.6667 0.0000 0.042464 -0.042464

-0.3333 0.6667 1.0000 -3.957536 -0.042464

-0.3333 1.0000 0.0000 0.063700 -0.063700

-0.3333 1.0000 1.0000 -5.936305 -0.063694

0.3333 0.0000 0.0000 -0.000003 0.000003

0.3333 0.0000 1.0000 0.000000 0.000000

0.3333 0.3333 0.0000 -0.021229 0.021229

0.3333 0.3333 1.0000 1.978763 0.021238

0.3333 0.6667 0.0000 -0.042465 0.042465

0.3333 0.6667 1.0000 3.957539 0.042462

0.3333 1.0000 0.0000 -0.063700 0.063700

0.3333 1.0000 1.0000 5.936304 0.063697

1.0000 0.0000 0.0000 -0.000098 0.000098

1.0000 0.0000 1.0000 0.000053 -0.000053

1.0000 0.3333 0.0000 -0.063855 0.063855

1.0000 0.3333 1.0000 5.936146 0.063854

1.0000 0.6667 0.0000 -0.127631 0.127631

1.0000 0.6667 1.0000 11.873067 0.126933

1.0000 1.0000 0.0000 -0.191442 0.191442

1.0000 1.0000 1.0000 17.807940 0.192060