visad
Class Set

java.lang.Object
  |
  +--visad.ThingImpl
        |
        +--visad.DataImpl
              |
              +--visad.Set
Direct Known Subclasses:
SimpleSet

public abstract class Set
extends DataImpl
implements SetIface

Set is the abstract superclass of the VisAD hierarchy of sets.

Set-s are subsets of R^n for n>0. For the most part, Set objects are immutable (but see SampledSet.getSamples(boolean)).

See Also:
Serialized Form

Inner classes inherited from class visad.DataImpl
DataImpl.Syncher
 
Inner classes inherited from class visad.ThingImpl
ThingImpl.RemotePair
 
Field Summary
(package private)  CoordinateSystem DomainCoordinateSystem
           
(package private)  int DomainDimension
           
(package private)  int hashCode
           
(package private)  boolean hashCodeSet
           
(package private)  int Length
           
(package private)  ErrorEstimate[] SetErrors
           
(package private)  Unit[] SetUnits
           
 
Fields inherited from class visad.DataImpl
Type
 
Constructor Summary
Set(MathType type)
          construct a Set object
Set(MathType type, CoordinateSystem coord_sys)
          Constructs a Set object with a non-default CoordinateSystem.
Set(MathType type, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors)
          Constructs a Set object with a non-default CoordinateSystem, non-default Unit-s, and non-default errors.
 
Method Summary
 Data __getitem__(int index)
          for JPython
 int __len__()
          A wrapper around getLength for JPython.
 void addEqualsCache(Set set)
          add set to a cache of Set-s equal to this
 void addNotEqualsCache(Set set)
          add set to a cache of Set-s not equal to this
(package private) static MathType adjustType(MathType type)
           
 Object clone()
          Clones this instance.
abstract  Object cloneButType(MathType type)
          copy this Set, but give it a new MathType; this is safe, since constructor checks consistency of DomainCoordinateSystem and SetUnits with Type
 DataShadow computeRanges(ShadowType type, DataShadow shadow)
           
 DataShadow computeRanges(ShadowType type, DataShadow shadow, double[][] ranges, boolean domain)
          this default does not set ranges - it is used by FloatSet and DoubleSet
static double[][] copyDoubles(double[][] samples)
           
static float[][] copyFloats(float[][] samples)
           
 void cram_missing(boolean[] range_select)
           
static float[][] doubleToFloat(double[][] value)
           
 int[] doubleToIndex(double[][] value)
           
abstract  boolean equals(Object set)
          test for equality
 boolean equalUnitAndCS(Set set)
          test equality of SetUnits and DomainCoordinateSystem between this and set
static double[][] floatToDouble(float[][] value)
           
 CoordinateSystem getCoordinateSystem()
          Gets the coordinate system of this domain set (DomainCoordinateSystem).
 int getDimension()
          get DomainDimension (i.e., this is a subset of R^DomainDimension)
(package private) static int getDimension(MathType type)
          get DomainDimension (i.e., this is a subset of R^DomainDimension)
 double[][] getDoubles()
           
 double[][] getDoubles(boolean copy)
           
 int getLength()
          get the number of samples
 int getManifoldDimension()
          for non-SimpleSet, ManifoldDimension = DomainDimension
 int[][] getNeighbors(int dimension)
          Returns the indexes of the neighboring points along a manifold dimesion for every point in the set.
 void getNeighbors(int[][] neighbors)
          Returns the indexes of the neighboring points for every point in the set.
 void getNeighbors(int[][] neighbors, float[][] weights)
           
 float[][] getSamples()
          return an enumeration of sample values in index order (i.e., not in getWedge order); the return array is organized as float[domain_dimension][number_of_samples]
 float[][] getSamples(boolean copy)
           
 ErrorEstimate[] getSetErrors()
          Returns the error estimates of the values in the set.
 Unit[] getSetUnits()
          Returns the units of the values in the set.
 int[] getWedge()
          return an enumeration of sample indices in a spatially coherent order; this is useful for efficiency
 double[][] indexToDouble(int[] index)
          Returns an array of sample-point values corresponding to an array of sample-point indicies.
abstract  float[][] indexToValue(int[] index)
          return Set values corresponding to Set indices
 String longString()
           
 String longString(String pre)
           
static void main(String[] args)
           
 VisADGeometryArray make1DGeometry(byte[][] color_values)
           
 VisADGeometryArray make2DGeometry(byte[][] color_values, boolean indexed)
           
 VisADGeometryArray[] make3DGeometry(byte[][] color_values)
           
 VisADGeometryArray[][] makeIsoLines(float[] intervals, float lowlimit, float highlimit, float base, float[] fieldValues, byte[][] color_values, boolean[] swap, boolean dash, boolean fill, ScalarMap[] smap, double scale_ratio, double label_size, float[][][] f_array)
          return basic lines in array[0], fill-ins in array[1] and labels in array[2]
 VisADGeometryArray makeIsoSurface(float isolevel, float[] fieldValues, byte[][] color_values, boolean indexed)
           
 VisADGeometryArray makePointGeometry(byte[][] color_values)
           
 Set makeSpatial(SetType type, float[][] samples)
           
 Set merge1DSets(Set set)
          merge 1D sets; used for default animation set
(package private)  void setAnimationSampling(ShadowType type, DataShadow shadow, boolean domain)
          domain == true is this is the domain of a Field
 boolean testEqualsCache(Set set)
          test set against a cache of Set-s equal to this
 boolean testNotEqualsCache(Set set)
          test set against a cache of Set-s not equal to this
 Data unary(int op, MathType new_type, int sampling_mode, int error_mode)
           
 int unitAndCSHashCode()
          Returns the hash code of the units and coordinate-system.
abstract  int[] valueToIndex(float[][] value)
          return Set indices of Set values closest to value elements (return -1 for any value outside Set range)
 
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, adjustSamplingError, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, computeReferenceRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, invertOp, local, log, log, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, setParent, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, toString, unary
 
Methods inherited from class visad.ThingImpl
adaptedAddReference, adaptedRemoveReference, addReference, removeReference
 
Methods inherited from class java.lang.Object
, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DomainDimension

int DomainDimension

Length

int Length

DomainCoordinateSystem

CoordinateSystem DomainCoordinateSystem

hashCodeSet

transient boolean hashCodeSet

hashCode

transient int hashCode

SetUnits

Unit[] SetUnits

SetErrors

ErrorEstimate[] SetErrors
Constructor Detail

Set

public Set(MathType type)
    throws VisADException
construct a Set object

Set

public Set(MathType type,
           CoordinateSystem coord_sys)
    throws VisADException
Constructs a Set object with a non-default CoordinateSystem.

Parameters:
type - The type of the Set.
coord_sys - The CoordinateSystem associated with this Set.

Set

public Set(MathType type,
           CoordinateSystem coord_sys,
           Unit[] units,
           ErrorEstimate[] errors)
    throws VisADException
Constructs a Set object with a non-default CoordinateSystem, non-default Unit-s, and non-default errors. This is the most general constructor.

Parameters:
type - The MathType of the set. May be a RealType, a RealTupleType, or a SetType.
coord_sys - Optional coordinate system for the domain of the set. May be null, in which case the default coordinate system of the domain is used.
units - Optional units for the values. May be null, in which case the default units of the domain are used. If the ith element is non-null and the RealType of the corresponding domain component is an interval, then the unit that is actually used is units[i].getAbsoluteUnit().
errors - Error estimates. May be null. errors[i] is the error estimate for the i-th component and may be null.
Method Detail

getDimension

static int getDimension(MathType type)
                 throws VisADException
get DomainDimension (i.e., this is a subset of R^DomainDimension)

adjustType

static MathType adjustType(MathType type)
                    throws VisADException

getSetUnits

public Unit[] getSetUnits()
Returns the units of the values in the set. The units may differ from the default units of the underlying MathType but will be convertible with them.
Specified by:
getSetUnits in interface SetIface
Returns:
The units of the values in the set. Will not be null. RETURN_VALUE[i] is the unit of the i-th component and may be null.

getSetErrors

public ErrorEstimate[] getSetErrors()
Returns the error estimates of the values in the set.
Specified by:
getSetErrors in interface SetIface
Returns:
Error estimates for the set. Will not be null. RETURN_VALUE[i] is the error estimate for the i-th component and may be null.

getCoordinateSystem

public CoordinateSystem getCoordinateSystem()
Gets the coordinate system of this domain set (DomainCoordinateSystem).
Specified by:
getCoordinateSystem in interface SetIface
Returns:
The coordinate system of this domain set. This will be the coordinate system passed to the constructor if non-null; otherwise, the (default) coordinate system of the underlying RealTupleType (which may be null).

getDimension

public int getDimension()
get DomainDimension (i.e., this is a subset of R^DomainDimension)
Specified by:
getDimension in interface SetIface

getManifoldDimension

public int getManifoldDimension()
for non-SimpleSet, ManifoldDimension = DomainDimension
Specified by:
getManifoldDimension in interface SetIface

getLength

public int getLength()
              throws VisADException
get the number of samples
Specified by:
getLength in interface SetIface

__len__

public int __len__()
            throws VisADException
A wrapper around getLength for JPython.
Returns:
The number of elements in the Set

getWedge

public int[] getWedge()
return an enumeration of sample indices in a spatially coherent order; this is useful for efficiency
Specified by:
getWedge in interface SetIface

getSamples

public float[][] getSamples()
                     throws VisADException
return an enumeration of sample values in index order (i.e., not in getWedge order); the return array is organized as float[domain_dimension][number_of_samples]
Specified by:
getSamples in interface SetIface

getSamples

public float[][] getSamples(boolean copy)
                     throws VisADException
Specified by:
getSamples in interface SetIface

getDoubles

public double[][] getDoubles()
                      throws VisADException
Specified by:
getDoubles in interface SetIface

getDoubles

public double[][] getDoubles(boolean copy)
                      throws VisADException
Specified by:
getDoubles in interface SetIface

cram_missing

public void cram_missing(boolean[] range_select)
Specified by:
cram_missing in interface SetIface

indexToValue

public abstract float[][] indexToValue(int[] index)
                                throws VisADException
return Set values corresponding to Set indices
Specified by:
indexToValue in interface SetIface
Parameters:
index - array of integer indices
Returns:
float[domain_dimension][indices.length] array of Set values
Throws:
VisADException - a VisAD error occurred

valueToIndex

public abstract int[] valueToIndex(float[][] value)
                            throws VisADException
return Set indices of Set values closest to value elements (return -1 for any value outside Set range)
Specified by:
valueToIndex in interface SetIface
Parameters:
value - float[domain_dimension][number_of_values] array of Set values
Returns:
array of integer indices
Throws:
VisADException - a VisAD error occurred

computeRanges

public DataShadow computeRanges(ShadowType type,
                                DataShadow shadow)
                         throws VisADException

computeRanges

public DataShadow computeRanges(ShadowType type,
                                DataShadow shadow,
                                double[][] ranges,
                                boolean domain)
                         throws VisADException
this default does not set ranges - it is used by FloatSet and DoubleSet

setAnimationSampling

void setAnimationSampling(ShadowType type,
                          DataShadow shadow,
                          boolean domain)
                    throws VisADException
domain == true is this is the domain of a Field

merge1DSets

public Set merge1DSets(Set set)
                throws VisADException
merge 1D sets; used for default animation set
Specified by:
merge1DSets in interface SetIface

makeSpatial

public Set makeSpatial(SetType type,
                       float[][] samples)
                throws VisADException
Specified by:
makeSpatial in interface SetIface

make1DGeometry

public VisADGeometryArray make1DGeometry(byte[][] color_values)
                                  throws VisADException
Specified by:
make1DGeometry in interface SetIface

make2DGeometry

public VisADGeometryArray make2DGeometry(byte[][] color_values,
                                         boolean indexed)
                                  throws VisADException
Specified by:
make2DGeometry in interface SetIface

make3DGeometry

public VisADGeometryArray[] make3DGeometry(byte[][] color_values)
                                    throws VisADException
Specified by:
make3DGeometry in interface SetIface

makePointGeometry

public VisADGeometryArray makePointGeometry(byte[][] color_values)
                                     throws VisADException
Specified by:
makePointGeometry in interface SetIface

makeIsoLines

public VisADGeometryArray[][] makeIsoLines(float[] intervals,
                                           float lowlimit,
                                           float highlimit,
                                           float base,
                                           float[] fieldValues,
                                           byte[][] color_values,
                                           boolean[] swap,
                                           boolean dash,
                                           boolean fill,
                                           ScalarMap[] smap,
                                           double scale_ratio,
                                           double label_size,
                                           float[][][] f_array)
                                    throws VisADException
return basic lines in array[0], fill-ins in array[1] and labels in array[2]
Specified by:
makeIsoLines in interface SetIface

makeIsoSurface

public VisADGeometryArray makeIsoSurface(float isolevel,
                                         float[] fieldValues,
                                         byte[][] color_values,
                                         boolean indexed)
                                  throws VisADException
Specified by:
makeIsoSurface in interface SetIface

indexToDouble

public double[][] indexToDouble(int[] index)
                         throws VisADException
Returns an array of sample-point values corresponding to an array of sample-point indicies.
Specified by:
indexToDouble in interface SetIface
Parameters:
index - The indicies of the sample points.
Returns:
A corresponding array of sample-point values. RETURN_VALUE[i][j] is the jth component of sample-point i.
Throws:
VisADException - if a VisAD failure occurs.

doubleToIndex

public int[] doubleToIndex(double[][] value)
                    throws VisADException
Specified by:
doubleToIndex in interface SetIface

floatToDouble

public static double[][] floatToDouble(float[][] value)

doubleToFloat

public static float[][] doubleToFloat(double[][] value)

copyFloats

public static float[][] copyFloats(float[][] samples)

copyDoubles

public static double[][] copyDoubles(double[][] samples)

getNeighbors

public void getNeighbors(int[][] neighbors)
                  throws VisADException

Returns the indexes of the neighboring points for every point in the set. neighbors.length should be at least getLength(). On return, neighbors[i][j] will be the index of the j -th neighboring point of point i. This method will allocate and set the array neighbors[i] for all i.

This implementation always throws an UnimplementedException.

Specified by:
getNeighbors in interface SetIface
Parameters:
neighbors - The array to contain the indexes of the neighboring points.
Throws:
NullPointerException - if the array is null.
ArrayIndexOutOfBoundsException - if neighbors.length < getLength() .
VisADException - if a VisAD failure occurs.

getNeighbors

public void getNeighbors(int[][] neighbors,
                         float[][] weights)
                  throws VisADException
Specified by:
getNeighbors in interface SetIface

getNeighbors

public int[][] getNeighbors(int dimension)
                     throws VisADException

Returns the indexes of the neighboring points along a manifold dimesion for every point in the set. Elements [i][0] and [i][1] of the returned array are the indexes of the neighboring sample points in the direction of decreasing and increasing manifold index, respectively, for sample point i. If a sample point doesn't have a neighboring point (because it is an exterior point, for example) then the value of the corresponding index will be -1.

This implementation always throws an UnimplementedException.

Specified by:
getNeighbors in interface SetIface
Parameters:
manifoldIndex - The index of the manifold dimension along which to return the neighboring points.
Throws:
ArrayIndexOutOfBoundsException - if manifoldIndex < 0 || manifoldIndex >= getManifoldDimension() .
VisADException - if a VisAD failure occurs.
See Also:
getManifoldDimension()

testNotEqualsCache

public boolean testNotEqualsCache(Set set)
test set against a cache of Set-s not equal to this

addNotEqualsCache

public void addNotEqualsCache(Set set)
add set to a cache of Set-s not equal to this

testEqualsCache

public boolean testEqualsCache(Set set)
test set against a cache of Set-s equal to this

addEqualsCache

public void addEqualsCache(Set set)
add set to a cache of Set-s equal to this

equalUnitAndCS

public boolean equalUnitAndCS(Set set)
test equality of SetUnits and DomainCoordinateSystem between this and set
Specified by:
equalUnitAndCS in interface SetIface

unitAndCSHashCode

public int unitAndCSHashCode()
Returns the hash code of the units and coordinate-system. This is the hash code analogue of equalUnitAndCS(Set).
Returns:
The hash code of the units and coordinate system.

__getitem__

public Data __getitem__(int index)
                 throws VisADException,
                        RemoteException
for JPython

equals

public abstract boolean equals(Object set)
test for equality
Specified by:
equals in interface SetIface
Overrides:
equals in class Object

clone

public Object clone()
Clones this instance.
Returns:
A clone of this instance.
Overrides:
clone in class DataImpl

unary

public Data unary(int op,
                  MathType new_type,
                  int sampling_mode,
                  int error_mode)
           throws VisADException,
                  RemoteException
Overrides:
unary in class DataImpl

cloneButType

public abstract Object cloneButType(MathType type)
                             throws VisADException
copy this Set, but give it a new MathType; this is safe, since constructor checks consistency of DomainCoordinateSystem and SetUnits with Type
Specified by:
cloneButType in interface SetIface

longString

public String longString()
                  throws VisADException
Overrides:
longString in class DataImpl

longString

public String longString(String pre)
                  throws VisADException
Overrides:
longString in class DataImpl

main

public static void main(String[] args)
                 throws VisADException