//
// ProductSet.java
//
/*
VisAD system for interactive analysis and visualization of numerical
data. Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
package visad;
//
// TO_DO
// getWedge
//
/**
ProductSet is the cross-product of an array of SampledSets.
*/
public class ProductSet extends SampledSet {
SampledSet[] Sets;
/** construct a ProductSet with an array of SampledSets */
public ProductSet(SampledSet[] sets) throws VisADException {
this(makeType(sets), sets, null, null, null, true);
}
/** create the product of the sets array, with null errors,
CoordinateSystem and Units are defaults from type */
public ProductSet(MathType type, SampledSet[] sets) throws VisADException {
this(type, sets, null, null, null, true);
}
/** create the product of the sets array; coordinate_system
and units must be compatible with defaults for type,
or may be null; errors may be null */
public ProductSet(MathType type, SampledSet[] sets,
CoordinateSystem coord_sys, Unit[] units,
ErrorEstimate[] errors) throws VisADException {
this(type, sets, coord_sys, units, errors, true);
}
ProductSet(MathType type, SampledSet[] sets, CoordinateSystem coord_sys,
Unit[] units, ErrorEstimate[] errors, boolean copy)
throws VisADException {
super(type, find_manifold_dim(sets, units), coord_sys, units, errors);
int dim = 0;
for (int i=0; i units.length) {
throw new SetException("ProductSet: Sets exceed ManifoldDimension " +
units.length);
}
Unit[] su = sets[i].getSetUnits();
if (su == null) {
throw new SetException("ProductSet: Set#" + i + " is null");
}
for (int j=0; j=0; i--) {
if (ptr[i+1] >= temp_inds[i+1][j].length) {
ptr[i+1] = 0;
ptr[i]++;
}
else i = 0;
}
}
}
}
/**
* Clones this instance.
*
* @return A clone of this instance.
*/
public Object clone() {
ProductSet clone = (ProductSet)super.clone();
/*
* The array of sampled sets is cloned because getSamples(false) allows
* clients to modify the values and the clone() general contract forbids
* cross-clone effects.
*/
if (Sets != null) {
clone.Sets = new SampledSet[Sets.length];
for (int i = 0; i < Sets.length; i++)
clone.Sets[i] = (SampledSet)Sets[i].clone();
}
return clone;
}
public Object cloneButType(MathType type) throws VisADException {
return new ProductSet(type, Sets, DomainCoordinateSystem,
SetUnits, SetErrors);
}
public boolean equals(Object set) {
if (!(set instanceof ProductSet) || set == null) return false;
if (this == set) return true;
ProductSet pset = (ProductSet) set;
if (pset.DomainDimension != DomainDimension
|| pset.ManifoldDimension != ManifoldDimension) return false;
for (int i=0; i ("+value1[0][i]);
for (int j=1; j index "+index2[i]);
}
System.out.println("------------------");
System.out.println("valueToInterp test:");
float[][] value3 = { { 15f, 50f, 80f, 25f,
50f, 100f, 30f, 70f},
{ 45f, 40f, 70f, 35f,
70f, 75f, 36f, 65f},
{-800f, -750f, -810f, 300f,
245f, 200f, -150f, -120f} };
int[][] indexI = new int[value3[0].length][];
float[][] weightI = new float[value3[0].length][];
pSet.valueToInterp(value3, indexI, weightI);
for (int l=0; l indices ["+indexI[l][0]);
for (int k=1; k
Ads help maintain this website.