meshi.util.mathTools
Class Spline1D

java.lang.Object
  extended by meshi.util.mathTools.Spline1D

public class Spline1D
extends java.lang.Object

The class creates a 1D cubic spline object from given parameters, and allows for the calculation of the spline value and derivative at any given point inside the spline intervals. After the method calc(x) is run, the public fields s and s_tag are updated: s - the spline value at x. s_tag - the spline first derivative at x. Note: 1) calc will not work for values outside the range [break 1 , break n]. 2) The class operates on any set of break points. However, if the break points are evenly spaced then the calculation of calc(x) will be faster. 3) See the constructor documention for more details on how to set up the class properly.


Field Summary
private  double breakInterval
           
private  double[] breaks
           
private  double[][] coefs
           
private  boolean evenBreaks
           
private  int n
           
 double s
           
 double s_tag
           
 
Constructor Summary
Spline1D(java.lang.String dataLine)
          The constructor can create a specific spline object from a string with the format: {break 1} {interval 1 X^3 coefficient} {interval 1 X^2 coef} {interval 1 X coef} {interval 1 constant coef} {break 2} {interval 2 X^3 coefficient} ...
Spline1D(java.util.StringTokenizer st)
           
 
Method Summary
 void calc(double x)
           
private  void calcEvenBreaks(double x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

breaks

private double[] breaks

coefs

private double[][] coefs

evenBreaks

private boolean evenBreaks

breakInterval

private double breakInterval

n

private int n

s

public double s

s_tag

public double s_tag
Constructor Detail

Spline1D

public Spline1D(java.lang.String dataLine)
The constructor can create a specific spline object from a string with the format: {break 1} {interval 1 X^3 coefficient} {interval 1 X^2 coef} {interval 1 X coef} {interval 1 constant coef} {break 2} {interval 2 X^3 coefficient} ... {break n} Note: 1) There is an alternative constructor that requires a tokenizer of a string with the above format. 2) The breaks must increase monotonicly. 3) The spline coefficients are not verified. Therefore, derivability is obtained only if the coefficients are of a derivable spline. 4) In order to have numerical stability, the relative precision of the values in the dataLine must be at least 1e-10.


Spline1D

public Spline1D(java.util.StringTokenizer st)
Method Detail

calc

public final void calc(double x)

calcEvenBreaks

private final void calcEvenBreaks(double x)