core.dflic
Class Streamline

java.lang.Object
  extended bycore.dflic.Streamline

public class Streamline
extends java.lang.Object

Computes sample points along streamlines. This class is used by FLIC in order to trace streamlines and compute equispaced sample points along them. Though it is publicly declared, it probably isn't very useful for anything else.

Version:
1.0
Author:
Andreas Sundquist

Field Summary
private  Vec2 A
           
private  Vec2 B
           
private  Vec2 C
           
private  Vec2 cdx
           
private  Vec2 cx
           
private  Vec2 cx2
           
private  Vec2 cx3
           
private  Vec2 D
           
private  double ds
           
private  Vec2 dx
           
private  Vec2Field field
           
private  double l
           
private  double l1
           
private  double l2
           
private  double length
           
private  double lengthstep
           
private  double maxstep
           
private  double minstep
           
private  int num
           
private  Vec2 nx
           
private  Vec2 odx
           
private  boolean reverse
           
private  double safety
           
private  java.util.Vector singularities
           
private  double singularitylimit
           
private  double step
           
private  double stepsize
           
private  double tolerance
           
private  Vec2 tx
           
private  Vec2 v
           
private  Vec2 x
           
 
Constructor Summary
Streamline(Vec2Field field)
          Constructs a new Streamline object that stores the parameters for successive streamline computations.
Streamline(Vec2Field field, double stepsize)
          Constructs a new Streamline object that stores the parameters for successive streamline computations.
Streamline(Vec2Field field, double stepsize, double minstep, double maxstep, double tolerance)
          Constructs a new Streamline object that stores the parameters for successive streamline computations.
 
Method Summary
private  double abs(double x)
           
 void AddSingularity(Vec2 v)
          Adds a singularity where streamlines are terminated when they come within the singularity limit.
private  boolean ComputeNext()
           
private  void ComputeStart(Vec2 x0)
           
 Vec2 Next()
          Returns the next point along the streamline.
 void SetDefaultMaxStep()
          Sets the default maximum RK4 step size, which is 10
 void SetDefaultMinStep()
          Sets the default minimum RK4 step size, which is 10^-1
 void SetDefaultSingularityLimit()
          Sets the default singularity limit to the step size.
 void SetDefaultStepSize()
          Sets the default sample spacing, which is 0.5
 void SetDefaultTolerance()
          Sets the default error tolerance, which is 5*10^-2
 void SetField(Vec2Field field)
          Sets the vector field that is traced to "field"
 void SetLength(double length)
          Sets the distance that the streamline traced to "length".
 void SetMaxStep(double maxstep)
          Sets the maximum RK4 step size to "maxstep"
 void SetMinStep(double minstep)
          Sets the minimum RK4 step size before terminating to "minstep"
 void SetSingularityLimit(double limit)
          Sets the radius around a singularity at which a streamline will be terminated to "limit".
 void SetStepSize(double stepsize)
          Sets the spacing between sample points on the streamline to "stepsize"
 void SetTolerance(double tolerance)
          Sets the RK4 integrator error tolerance to "tolerance".
 void Start(Vec2 p)
          Begins the streamline computation at point "p" with the default length.
 void Start(Vec2 p, double length)
          Begins the streamline computation at point "p" with a length "length".
 void Stop()
          Terminates the streamline immediately.
 boolean stopped()
          Returns whether or not the streamline has reached its end.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

private Vec2Field field

length

private double length

stepsize

private double stepsize

reverse

private boolean reverse

minstep

private double minstep

maxstep

private double maxstep

tolerance

private double tolerance

lengthstep

private double lengthstep

safety

private double safety

singularities

private java.util.Vector singularities

singularitylimit

private double singularitylimit

x

private Vec2 x

v

private Vec2 v

dx

private Vec2 dx

odx

private Vec2 odx

nx

private Vec2 nx

tx

private Vec2 tx

A

private Vec2 A

B

private Vec2 B

C

private Vec2 C

D

private Vec2 D

cx

private Vec2 cx

cx2

private Vec2 cx2

cx3

private Vec2 cx3

cdx

private Vec2 cdx

ds

private double ds

step

private double step

l

private double l

l1

private double l1

l2

private double l2

num

private int num
Constructor Detail

Streamline

public Streamline(Vec2Field field)
Constructs a new Streamline object that stores the parameters for successive streamline computations. The field that is traced is set to "field". All the remaining parameters are set to their default values.


Streamline

public Streamline(Vec2Field field,
                  double stepsize)
Constructs a new Streamline object that stores the parameters for successive streamline computations. The field that is traced is set to "field", and the sample step size along the field lines is set to "stepsize". All other parameters are set to their deafult values.


Streamline

public Streamline(Vec2Field field,
                  double stepsize,
                  double minstep,
                  double maxstep,
                  double tolerance)
Constructs a new Streamline object that stores the parameters for successive streamline computations. The field that is traced is set to "field", the sample step size along the lines is set to "stepsize", the minimum and maximum RK4 step sizes are se to "minstep" and "maxstep", and the integration error tolerance is set to "tolerance".

Method Detail

SetField

public void SetField(Vec2Field field)
Sets the vector field that is traced to "field"


SetLength

public void SetLength(double length)
Sets the distance that the streamline traced to "length". If length is positive, the streamline goes along the direction of the vector field, while if it is negative, it goes in the opposite direction.


SetStepSize

public void SetStepSize(double stepsize)
Sets the spacing between sample points on the streamline to "stepsize"


SetDefaultStepSize

public void SetDefaultStepSize()
Sets the default sample spacing, which is 0.5


SetMinStep

public void SetMinStep(double minstep)
Sets the minimum RK4 step size before terminating to "minstep"


SetDefaultMinStep

public void SetDefaultMinStep()
Sets the default minimum RK4 step size, which is 10^-1


SetMaxStep

public void SetMaxStep(double maxstep)
Sets the maximum RK4 step size to "maxstep"


SetDefaultMaxStep

public void SetDefaultMaxStep()
Sets the default maximum RK4 step size, which is 10


SetTolerance

public void SetTolerance(double tolerance)
Sets the RK4 integrator error tolerance to "tolerance". If the error during a single step is every larger, the step size is reduced.


SetDefaultTolerance

public void SetDefaultTolerance()
Sets the default error tolerance, which is 5*10^-2


SetSingularityLimit

public void SetSingularityLimit(double limit)
Sets the radius around a singularity at which a streamline will be terminated to "limit".


SetDefaultSingularityLimit

public void SetDefaultSingularityLimit()
Sets the default singularity limit to the step size.


AddSingularity

public void AddSingularity(Vec2 v)
Adds a singularity where streamlines are terminated when they come within the singularity limit. The point "v" is given in the coordinate system of the vector field.


abs

private double abs(double x)

Start

public void Start(Vec2 p)
Begins the streamline computation at point "p" with the default length.


Start

public void Start(Vec2 p,
                  double length)
Begins the streamline computation at point "p" with a length "length". If "length" is positive, it goes along the direction of the vector field, and if it is negative it goe sin the opposite direction.


Next

public Vec2 Next()
Returns the next point along the streamline. If there are no more points, it returns null. The point returned may be modified.


Stop

public void Stop()
Terminates the streamline immediately. Further calls to Next() will return null until a new streamline is started.


stopped

public boolean stopped()
Returns whether or not the streamline has reached its end.


ComputeStart

private void ComputeStart(Vec2 x0)

ComputeNext

private boolean ComputeNext()