ru.sscc.spline.polynomial
Class PSplineBody

java.lang.Object
  |
  +--ru.sscc.spline.polynomial.PSplineBody

public class PSplineBody
extends java.lang.Object
implements SplineBody

The implementation of spline body interface for 1D polynomial spline having full polynomial representation in mesh nodes.

See Also:
Serialized Form

Field Summary
 int extraCount
          A number of coefficients used for extrapolation.
 int interCount
          A number of coefficients used for interpolation.
protected  SimpleMesh mesh
          Mesh used for calculations.
 
Fields inherited from interface ru.sscc.spline.SplineBody
DERIVATIVE_OUT_OF_RANGE, ONE_D_NONSUPPORTED, POINT_OUT_OF_RANGE
 
Constructor Summary
PSplineBody(SimpleMesh mesh, int interDegree, int extraDegree)
          Constructor.
 
Method Summary
 double calculate(SplineWorkspace workspace)
          Calculates a spline or derivative value at a required point.
 void calculateDefect(int i, RealPointer data, RealPointer defect)
          Calculate defect of polynomial spline at i-th mesh node.
 SplineWorkspace createWorkspace(RealPointer data)
          Creates a workspace required for a spline value and derivatives calculation.
 int dimension()
          Returns a spline dimension (1 in this case).
 SimpleMesh getMesh()
          Returns the mesh.
 int getVectorLength()
          Returns a full number of coefficients in the spline representation.
 int maxQuote()
          Returns a maximal number of spline coefficients simultaneously needed in a spline value or its partial derivatives calculation (interCount in this case).
 void prepareWorkspace(SplineWorkspace workspace, double point, int index, int count)
          Prepares a workspace for an 1D spline derivative calculation at a point required.
 void prepareWorkspace(SplineWorkspace workspace, RealPointer point, int count)
          Prepares a workspace for a spline calculation at a point required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interCount

public final int interCount
A number of coefficients used for interpolation.

extraCount

public final int extraCount
A number of coefficients used for extrapolation.

mesh

protected SimpleMesh mesh
Mesh used for calculations.
Constructor Detail

PSplineBody

public PSplineBody(SimpleMesh mesh,
                   int interDegree,
                   int extraDegree)
Constructor.
Parameters:
mesh - a mesh of nodes
interDegree - a degree of polynomials between mesh nodes
extraDegree - a degree of polynomials outside mesh interval
Method Detail

dimension

public int dimension()
Returns a spline dimension (1 in this case).
Specified by:
dimension in interface SplineBody

getVectorLength

public int getVectorLength()
Returns a full number of coefficients in the spline representation.
Specified by:
getVectorLength in interface SplineBody

maxQuote

public int maxQuote()
Returns a maximal number of spline coefficients simultaneously needed in a spline value or its partial derivatives calculation (interCount in this case).
Specified by:
maxQuote in interface SplineBody

createWorkspace

public SplineWorkspace createWorkspace(RealPointer data)
Creates a workspace required for a spline value and derivatives calculation.
Specified by:
createWorkspace in interface SplineBody
Parameters:
data - a pointer to associated data vector

prepareWorkspace

public void prepareWorkspace(SplineWorkspace workspace,
                             RealPointer point,
                             int count)
Prepares a workspace for a spline calculation at a point required.
Specified by:
prepareWorkspace in interface SplineBody
Parameters:
workspace - a spline workspace
point - a pointer to the point on the real axis
count - a number of splines will be calculated later

prepareWorkspace

public void prepareWorkspace(SplineWorkspace workspace,
                             double point,
                             int index,
                             int count)
Prepares a workspace for an 1D spline derivative calculation at a point required.
Specified by:
prepareWorkspace in interface SplineBody
Parameters:
workspace - a spline workspace
point - a point on the real axis
index - a derivative index
count - a number of splines will be calculated later

calculate

public double calculate(SplineWorkspace workspace)
Calculates a spline or derivative value at a required point. All information on the derivative and the point should be prepared before by one of the prepareWorkspace methods.
Specified by:
calculate in interface SplineBody
Parameters:
workspace - a spline workspace
Returns:
the spline or derivative value

calculateDefect

public void calculateDefect(int i,
                            RealPointer data,
                            RealPointer defect)
Calculate defect of polynomial spline at i-th mesh node. The defect is the polynomial of (extraCount-1) degree that equals to the difference between the right and left polynomial representations at required mesh node.
Parameters:
i - a node number in the range of [0..mesh.size-1]
data - a pointer to the spline coefficients vector
defect - a pointer to vector for storing the result (the vector must contain at least extraCount entries)

getMesh

public SimpleMesh getMesh()
Returns the mesh.