> setSamples() in FlatField only set float and double data.
> If my original data is long (64 bits), non of float and double
> will hold my data. If the original data is int (32 bits), double
> will hold the data, but it doubles the space than necessary.
The assumption is that FlatField range values are real
numbers from some finite sampling. You can specify that
by passing range Sets FlatField constructors. The various
Java primitive types implicitly define finite samplings of
the real numbers, although only FloatSet and DoubleSet are
currently defined in the system. Other finite samplings
are defined by various Gridded1DSets and Linear1DSet (the
latter are finite arithmetic progressions, as int and long
are). However, you could not use Linear1DSets to define
the full range of values for int or long. So for the time
being you'll have to settle for using range set = DoubleSet
for int values (the default range set is FloatSet, so you'll
have to explicitly use DoubleSet), and just suffer the loss
of precision or range with long values.
However, internally FlatFields have an unused option for
storing values as longs, and a sometimes used option for
storing as ints. It would be possible to add IntSet and
LongSet to the system, and add signatures for setSamples()
for passing ints and longs in, and new methods getInts()
and getLongs() (parallel to getValues() and getFloats()) for
getting ints and longs out.
> Why there is no setSamples(int, ...) and setSamples(long, ...)
> and other common types such as char, byte, short ?
VisAD's data abstraction is based on real numbers rather
than computer data. Hence the explicit specification of
finite samplings, which however have not been implemented
yet for int and long.
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738