ru.sscc.spline.mesh
Class NonuniformMesh

java.lang.Object
  |
  +--ru.sscc.spline.mesh.SimpleMesh
        |
        +--ru.sscc.spline.mesh.NonuniformMesh

public class NonuniformMesh
extends SimpleMesh

The implementation of 1D ordered nonuniform mesh.

See Also:
Serialized Form

Field Summary
protected  float[] points
          Points container.
 
Fields inherited from class ru.sscc.spline.mesh.SimpleMesh
origin, scale, size
 
Constructor Summary
NonuniformMesh(RealVector data)
          Constructs a mesh having the float[] type internal representation via a real data vector.
 
Method Summary
 double averageStep()
          Returns an average mesh step.
 double distance(int i, int j)
          Returns a distance between i-th and j-th nodes of transformed mesh, e.g.
 void findCell(SimpleMeshWorkspace workspace, double x)
          Finds a mesh cell to which a point belongs.
 double get(int i)
          Returns a value of i-th mesh node in the original coordinate system.
 boolean isUniform()
          Returns a mesh uniformness tag.
 
Methods inherited from class ru.sscc.spline.mesh.SimpleMesh
extendedMeshDistance, findCell, findCell, origin, scale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

points

protected float[] points
Points container.
Constructor Detail

NonuniformMesh

public NonuniformMesh(RealVector data)
Constructs a mesh having the float[] type internal representation via a real data vector. The affine transform of the original mesh is applied in such a way to convert the first and the last mesh nodes to 0 and n-1 correspondingly (here n is a nodes number). Throws IllegalArgumentException if the original mesh isn't ordered.
Method Detail

averageStep

public double averageStep()
Returns an average mesh step.
Overrides:
averageStep in class SimpleMesh

findCell

public void findCell(SimpleMeshWorkspace workspace,
                     double x)
Finds a mesh cell to which a point belongs. Writes the cell index and a position within the cell (a distance in new coordinates from the left cell bound) into workspace's attributes cellIndex and cellPoint. The algorithm is adaptive (at first it tests cells neighbouring to the cell found before).
Overrides:
findCell in class SimpleMesh
Parameters:
workspace - a mesh workspace
x - a point (in original coordinates) to search

get

public final double get(int i)
Returns a value of i-th mesh node in the original coordinate system.
Overrides:
get in class SimpleMesh

isUniform

public final boolean isUniform()
Returns a mesh uniformness tag.
Overrides:
isUniform in class SimpleMesh

distance

public final double distance(int i,
                             int j)
Returns a distance between i-th and j-th nodes of transformed mesh, e.g. the value ti-tj.
Overrides:
distance in class SimpleMesh