Class TricubicInterpolatingFunction
java.lang.Object
org.apache.commons.math3.analysis.interpolation.TricubicInterpolatingFunction
- All Implemented Interfaces:
TrivariateFunction
Function that implements the
tricubic spline interpolation, as proposed in
Tricubic interpolation in three dimensions, F. Lekien and J. Marsden, Int. J. Numer. Meth. Eng 2005; 63:455-471
- Since:
- 3.4.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double[][]Matrix to compute the spline coefficients from the function values and function derivatives valuesprivate final TricubicFunction[][][]Set of cubic splines patching the whole data gridprivate final double[]Samples x-coordinatesprivate final double[]Samples y-coordinatesprivate final double[]Samples z-coordinates -
Constructor Summary
ConstructorsConstructorDescriptionTricubicInterpolatingFunction(double[] x, double[] y, double[] z, double[][][] f, double[][][] dFdX, double[][][] dFdY, double[][][] dFdZ, double[][][] d2FdXdY, double[][][] d2FdXdZ, double[][][] d2FdYdZ, double[][][] d3FdXdYdZ) -
Method Summary
Modifier and TypeMethodDescriptionprivate double[]computeCoefficients(double[] beta) Compute the spline coefficients from the list of function values and function partial derivatives values at the four corners of a grid element.booleanisValidPoint(double x, double y, double z) Indicates whether a point is within the interpolation range.private intsearchIndex(double c, double[] val) doublevalue(double x, double y, double z) Compute the value for the function.
-
Field Details
-
AINV
private static final double[][] AINVMatrix to compute the spline coefficients from the function values and function derivatives values -
xval
private final double[] xvalSamples x-coordinates -
yval
private final double[] yvalSamples y-coordinates -
zval
private final double[] zvalSamples z-coordinates -
splines
Set of cubic splines patching the whole data grid
-
-
Constructor Details
-
TricubicInterpolatingFunction
public TricubicInterpolatingFunction(double[] x, double[] y, double[] z, double[][][] f, double[][][] dFdX, double[][][] dFdY, double[][][] dFdZ, double[][][] d2FdXdY, double[][][] d2FdXdZ, double[][][] d2FdYdZ, double[][][] d3FdXdYdZ) throws NoDataException, DimensionMismatchException, NonMonotonicSequenceException - Parameters:
x- Sample values of the x-coordinate, in increasing order.y- Sample values of the y-coordinate, in increasing order.z- Sample values of the y-coordinate, in increasing order.f- Values of the function on every grid point.dFdX- Values of the partial derivative of function with respect to x on every grid point.dFdY- Values of the partial derivative of function with respect to y on every grid point.dFdZ- Values of the partial derivative of function with respect to z on every grid point.d2FdXdY- Values of the cross partial derivative of function on every grid point.d2FdXdZ- Values of the cross partial derivative of function on every grid point.d2FdYdZ- Values of the cross partial derivative of function on every grid point.d3FdXdYdZ- Values of the cross partial derivative of function on every grid point.- Throws:
NoDataException- if any of the arrays has zero length.DimensionMismatchException- if the various arrays do not contain the expected number of elements.NonMonotonicSequenceException- ifx,yorzare not strictly increasing.
-
-
Method Details
-
value
Compute the value for the function.- Specified by:
valuein interfaceTrivariateFunction- Parameters:
x- x-coordinate for which the function value should be computed.y- y-coordinate for which the function value should be computed.z- z-coordinate for which the function value should be computed.- Returns:
- the value.
- Throws:
OutOfRangeException- if any of the variables is outside its interpolation range.
-
isValidPoint
public boolean isValidPoint(double x, double y, double z) Indicates whether a point is within the interpolation range.- Parameters:
x- First coordinate.y- Second coordinate.z- Third coordinate.- Returns:
trueif (x, y, z) is a valid point.
-
searchIndex
private int searchIndex(double c, double[] val) - Parameters:
c- Coordinate.val- Coordinate samples.- Returns:
- the index in
valcorresponding to the interval containingc, or-1ifcis out of the range defined by the end values ofval.
-
computeCoefficients
private double[] computeCoefficients(double[] beta) Compute the spline coefficients from the list of function values and function partial derivatives values at the four corners of a grid element. They must be specified in the following order:- f(0,0,0)
- f(1,0,0)
- f(0,1,0)
- f(1,1,0)
- f(0,0,1)
- f(1,0,1)
- f(0,1,1)
- f(1,1,1)
- fx(0,0,0)
- ... (same order as above)
- fx(1,1,1)
- fy(0,0,0)
- ... (same order as above)
- fy(1,1,1)
- fz(0,0,0)
- ... (same order as above)
- fz(1,1,1)
- fxy(0,0,0)
- ... (same order as above)
- fxy(1,1,1)
- fxz(0,0,0)
- ... (same order as above)
- fxz(1,1,1)
- fyz(0,0,0)
- ... (same order as above)
- fyz(1,1,1)
- fxyz(0,0,0)
- ... (same order as above)
- fxyz(1,1,1)
- Parameters:
beta- List of function values and function partial derivatives values.- Returns:
- the spline coefficients.
-