Re: FloatSet(MathType type)

> I tried the way as you said. It did not work.

I'd be interested to see the code that didn't work, and
whatever compile errors or Exceptions or bad behavior it
produced.

> Assume I want to create a flatfield to hold my n-dimension
> double dataset. Could you write some example code to do that ?
> I believe it is just a few lines of code.

If the domain of your FlatField is n-dimensional and its
samples lie on an integer lattice (i.e., with size
N1 x N2 x ... Nn), and if the values in the FlatField are
tuples (i.e., records) with m fields, then the code might
look like this:

  RealType[] domain_types = {domain1, domain2, ..., domainn};
  RealTupleType domain_type = new RealTupleType(domain_types);
  RealType[] range_types = {range1, range2, ..., rangem};
  RealTupleType range_type  = new RealTupleType(range_types);
  FunctionType field_type = new FunctionType(domain_type, range_type);
  int[] lengths = {N1, N2, ..., Nn};
  IntegerNDSet domain_set = new IntegerNDSet(domain_type, lenghts);
  FlatField field = new FlatField(field_type, domain_set);
  int N = N1 * N2 * ... * Nn;
  float[][] values = new float[m][N];
  values = ... // set values
  field.setSamples(values, false); // don't copy

This will use FloatSets for the range values.  If you want
range values to be doubles, then after 'domain_set = ...'
if should be:

  DoubleSet[] range_sets = new DoubleSet[m];
  for (int i=0; i<m; i++) range_sets[i] = new DoubleSet();
  FlatField field = new FlatField(field_type, domain_set, null,
                                  null, range_sets, null);
  int N = N1 * N2 * ... * Nn;
  double[][] values = new double[m][N];
  values = ... // set values
  field.setSamples(values, false); // don't copy

Please let me mnow if this is still a problem.

By the way, Dave Glowacki said:
> It'll be in the next update of VisAD (I put it in on Monday).

I meant to do a source update this week, but was really
swamped and didn't have time to run the tests.  Hopefully
early next week.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html