visad.data
Class CachedFlatField

java.lang.Object
  extended by visad.ThingImpl
      extended by visad.DataImpl
          extended by visad.FunctionImpl
              extended by visad.FieldImpl
                  extended by visad.FlatField
                      extended by visad.data.CachedFlatField
All Implemented Interfaces:
Serializable, Cloneable, Data, Field, FlatFieldIface, Function, Thing

public class CachedFlatField
extends FlatField

This is a FloatField that caches to disk its float array.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class visad.DataImpl
DataImpl.Syncher
 
Field Summary
protected  Object MUTEX
          Mutex
 int mycnt
           
 
Fields inherited from class visad.FlatField
RangeCoordinateSystem, RangeCoordinateSystems, RangeUnits, TupleDimension
 
Fields inherited from interface visad.Data
ABS, ACOS, ACOS_DEGREES, ADD, ASIN, ASIN_DEGREES, ATAN, ATAN_DEGREES, ATAN2, ATAN2_DEGREES, CEIL, COS, COS_DEGREES, DEGREES_TO_RADIANS, DEPENDENT, DIVIDE, EXP, FLOOR, INDEPENDENT, INV_ATAN2, INV_ATAN2_DEGREES, INV_DIVIDE, INV_POW, INV_REMAINDER, INV_SUBTRACT, LOG, MAX, MIN, MULTIPLY, NEAREST_NEIGHBOR, NEGATE, NO_ERRORS, NOP, POW, RADIANS_TO_DEGREES, REMAINDER, RINT, ROUND, SIN, SIN_DEGREES, SQRT, SUBTRACT, TAN, TAN_DEGREES, WEIGHTED_AVERAGE
 
Constructor Summary
CachedFlatField(CachedFlatField that, boolean copy, FunctionType type, Set domainSet, CoordinateSystem rangeCoordSys, CoordinateSystem[] rangeCoordSysArray, Set[] rangeSets, Unit[] units)
          Copy constructor
CachedFlatField(FunctionType type, float[][] floats)
          Create a new CachedFlatField
CachedFlatField(FunctionType type, Set domainSet)
          Create a new CachedFlatField
CachedFlatField(FunctionType type, Set domainSet, CoordinateSystem rangeCoordSys, CoordinateSystem[] rangeCoordSyses, Set[] rangeSets, Unit[] units, float[][] floats)
          Create a new CachedFlatField
CachedFlatField(FunctionType type, Set domainSet, CoordinateSystem rangeCoordSys, Set[] rangeSets, Unit[] units, float[][] floats)
          Create a new CachedFlatField
CachedFlatField(FunctionType type, Set domainSet, float[][] floats)
          Create a new CachedFlatField
 
Method Summary
 void clearCachedRange()
          Clear the cached ranges
 Object clone()
          Override method so we clear the caches on the cloned object
 CachedFlatField cloneMe(boolean copy, FunctionType type, Set domainSet, CoordinateSystem rangeCoordSys, CoordinateSystem[] rangeCoordSysArray, Set[] rangeSets, Unit[] units)
          Clone this object
 void finalize()
           
 DataRange[] getRanges()
          Get the ranges
 DataRange[] getRanges(boolean force)
          Get the ranges
 DataRange[] getRanges(float[][] values)
          Get the ranges for the values
 Data getSample(int index)
          Get the range value at the index-th sample.
 boolean haveData()
           
protected  void initCache(float[][] data)
          init
 void msg(String s)
          Debug statment
 float[][] readData()
          Used to provide a hook to derived classes to dynamically read in the data
protected  void readValuesFromParent(CachedFlatField parent)
          This gets called to notify derived classes that we jus got the data from the parent ccf
 void setSampleRanges(DataRange[] sampleRanges)
          Set the sample ranges
 void setSamples(float[][] values, ErrorEstimate[] errors, boolean copy)
          Set the sample
 float[][] unpackFloats(boolean copy)
          get the float values
protected  float[] unpackFloats(int s_index)
          Unpack floats
protected  double[][] unpackValues(boolean copy)
          get the float values as doubles
 
Methods inherited from class visad.FlatField
adjustSamplingError, binary, clearMissing, cloneDouble, cloneDouble, cloneFloat, cloneFloat, computeRanges, convertToField, derivative, derivative, derivative, derivative, derivative, equals, extract, extract, fillField, getDefaultRangeUnits, getFloats, getFloats, getRangeCoordinateSystem, getRangeCoordinateSystem, getRangeDimension, getRangeErrors, getRangeSets, getRangeUnits, getSample, getStringValues, getValues, getValues, getValues, grabBytes, isFlatField, isMissing, longString, main, makeField, makeField1, makeField2, makeRational, makeRational, nullRanges, pr, resample, resampleDouble, setRangeErrors, setSample, setSample, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples, setSamples, toString, unary, unpackFloats, unpackOneFloatRangeComp, unpackOneFloatRangeComp, unpackOneRangeComp, unpackOneRangeComp, unpackValues, unpackValues
 
Methods inherited from class visad.FieldImpl
__getitem__, __len__, __setitem__, __setitem__, combine, combine, combine, combine, combine, domainEnumeration, domainFactor, domainFactor, domainMultiply, domainMultiply, domainMultiply, domainMultiply, extract, extract, getDomainCoordinateSystem, getDomainSet, getDomainUnits, getLength, setSample, setSample, setSample, setSamples
 
Methods inherited from class visad.FunctionImpl
__getitem__, __getitem__, evaluate, evaluate, evaluate, evaluate, getDomainDimension, resample
 
Methods inherited from class visad.DataImpl
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __radd__, __rdiv__, __rmod__, __rmul__, __rpow__, __rsub__, __sub__, __sub__, abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
 
Methods inherited from class visad.ThingImpl
addReference, removeReference
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface visad.Field
domainEnumeration, domainFactor, domainMultiply, domainMultiply, getDomainSet, getLength, setSample, setSample
 
Methods inherited from interface visad.Function
evaluate, evaluate, evaluate, evaluate, getDomainCoordinateSystem, getDomainDimension, getDomainUnits, resample
 
Methods inherited from interface visad.Data
abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
 
Methods inherited from interface visad.Thing
addReference, removeReference
 

Field Detail

MUTEX

protected transient Object MUTEX
Mutex


mycnt

public final int mycnt
Constructor Detail

CachedFlatField

public CachedFlatField(FunctionType type,
                       Set domainSet)
                throws VisADException
Create a new CachedFlatField

Parameters:
type - Function type
domainSet - set for this
Throws:
VisADException - On badness

CachedFlatField

public CachedFlatField(FunctionType type,
                       float[][] floats)
                throws VisADException
Create a new CachedFlatField

Parameters:
floats - The values
type - Function type
Throws:
VisADException - On badness

CachedFlatField

public CachedFlatField(FunctionType type,
                       Set domainSet,
                       float[][] floats)
                throws VisADException
Create a new CachedFlatField

Parameters:
floats - The values
type - Function type
domainSet - Domain
Throws:
VisADException - On badness

CachedFlatField

public CachedFlatField(FunctionType type,
                       Set domainSet,
                       CoordinateSystem rangeCoordSys,
                       Set[] rangeSets,
                       Unit[] units,
                       float[][] floats)
                throws VisADException
Create a new CachedFlatField

Parameters:
type - Function type
domainSet - Domain
rangeCoordSys - range CoordSystem
rangeSets - range sets
units - units
floats - The values
Throws:
VisADException - On badness

CachedFlatField

public CachedFlatField(FunctionType type,
                       Set domainSet,
                       CoordinateSystem rangeCoordSys,
                       CoordinateSystem[] rangeCoordSyses,
                       Set[] rangeSets,
                       Unit[] units,
                       float[][] floats)
                throws VisADException
Create a new CachedFlatField

Parameters:
type - Function type
domainSet - Domain
rangeCoordSys - range CoordSystem
rangeCoordSyses - range CoordSystem's
rangeSets - range sets
units - units
floats - The values
Throws:
VisADException - On badness

CachedFlatField

public CachedFlatField(CachedFlatField that,
                       boolean copy,
                       FunctionType type,
                       Set domainSet,
                       CoordinateSystem rangeCoordSys,
                       CoordinateSystem[] rangeCoordSysArray,
                       Set[] rangeSets,
                       Unit[] units)
                throws VisADException
Copy constructor

Parameters:
that - What we clone from
copy - copy the values
type - Function type
domainSet - Domain
rangeCoordSys - range CoordSystem
rangeCoordSysArray - rangeCoordSysArray
rangeSets - range sets
units - units
Throws:
VisADException - On badness
Method Detail

cloneMe

public CachedFlatField cloneMe(boolean copy,
                               FunctionType type,
                               Set domainSet,
                               CoordinateSystem rangeCoordSys,
                               CoordinateSystem[] rangeCoordSysArray,
                               Set[] rangeSets,
                               Unit[] units)
                        throws VisADException
Clone this object

Parameters:
copy - copy the values
type - Function type
domainSet - Domain set
rangeCoordSys - range CoordSystem
rangeCoordSysArray - rangeCoordSysArray
rangeSets - range sets
units - units
Returns:
New field
Throws:
VisADException - On badness

finalize

public void finalize()
              throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

setSamples

public void setSamples(float[][] values,
                       ErrorEstimate[] errors,
                       boolean copy)
                throws VisADException,
                       RemoteException
Set the sample

Specified by:
setSamples in interface FlatFieldIface
Overrides:
setSamples in class FlatField
Parameters:
values - the samples
errors - errors
copy - tru to copy
Throws:
RemoteException - Java RMI Exception
VisADException - Problem in VisAD land

clone

public Object clone()
Override method so we clear the caches on the cloned object

Overrides:
clone in class FlatField
Returns:
the clone

initCache

protected void initCache(float[][] data)
                  throws VisADException
init

Parameters:
data - data
Throws:
VisADException - initializing field

setSampleRanges

public void setSampleRanges(DataRange[] sampleRanges)
Set the sample ranges

Parameters:
sampleRanges - the sample ranges

clearCachedRange

public void clearCachedRange()
Clear the cached ranges


getRanges

public DataRange[] getRanges()
                      throws VisADException
Get the ranges

Returns:
ranges
Throws:
VisADException - problem getting ranges

getRanges

public DataRange[] getRanges(boolean force)
                      throws VisADException
Get the ranges

Parameters:
force - force a recalc
Returns:
ranges the ranges
Throws:
VisADException - problem getting ranges

getRanges

public DataRange[] getRanges(float[][] values)
                      throws VisADException
Get the ranges for the values

Parameters:
values - the values
Returns:
the ranges
Throws:
VisADException - Problem in VisAD land

readData

public float[][] readData()
Used to provide a hook to derived classes to dynamically read in the data

Returns:
data

msg

public void msg(String s)
Debug statment

Parameters:
s - message to print

haveData

public boolean haveData()

readValuesFromParent

protected void readValuesFromParent(CachedFlatField parent)
                             throws VisADException
This gets called to notify derived classes that we jus got the data from the parent ccf

Parameters:
parent - The parent CCF we read data from
Throws:
VisADException

getSample

public Data getSample(int index)
               throws VisADException,
                      RemoteException
Get the range value at the index-th sample.

Specified by:
getSample in interface Field
Overrides:
getSample in class FlatField
Parameters:
index - index of the sample
Returns:
Data object (Real, RealTuple, or Tuple) corresponding to the range at the index-th sample.
Throws:
VisADException - problem getting data
RemoteException - problem getting data from remote object

unpackValues

protected double[][] unpackValues(boolean copy)
                           throws VisADException
get the float values as doubles

Overrides:
unpackValues in class FlatField
Parameters:
copy - copy the values
Returns:
The values
Throws:
VisADException - On badness

unpackFloats

public float[][] unpackFloats(boolean copy)
                       throws VisADException
get the float values

Overrides:
unpackFloats in class FlatField
Parameters:
copy - copy the values
Returns:
The values
Throws:
VisADException - On badness

unpackFloats

protected float[] unpackFloats(int s_index)
                        throws VisADException
Unpack floats

Overrides:
unpackFloats in class FlatField
Parameters:
s_index - the sample index
Returns:
the floats for that index
Throws:
VisADException - Problem in VisAD land