//
// TestClusterOneJVM.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.cluster;
import visad.*;
import visad.java3d.*;
import visad.data.gif.GIFForm;
import java.rmi.*;
import java.awt.event.*;
import javax.swing.*;
/**
TestClusterOneJVM is the class for testing the visad.cluster package.
*/
public class TestClusterOneJVM extends Object {
public TestClusterOneJVM() {
}
public static void main(String[] args)
throws RemoteException, VisADException {
int node_divide = 2;
int number_of_nodes = node_divide * node_divide;
if (args == null || args.length < 1) {
System.out.println("usage: 'java visad.cluster.TestClusterOneJVM file.gif'");
return;
}
GIFForm gif_form = new GIFForm();
FlatField image = (FlatField) gif_form.open(args[0]);
if (image == null) {
System.out.println("cannot open " + args[0]);
return;
}
/*
new Integer2DSet(imageDomain, nelements, nlines));
MathType.stringToType("((ImageElement, ImageLine) -> ImageRadiance)");
*/
FunctionType image_type = (FunctionType) image.getType();
RealTupleType domain_type = image_type.getDomain();
Linear2DSet domain_set = (Linear2DSet) image.getDomainSet();
Linear1DSet x_set = domain_set.getX();
Linear1DSet y_set = domain_set.getY();
// getFirst, getLast, getStep, getLength
int x_len = x_set.getLength();
int y_len = y_set.getLength();
int len = domain_set.getLength();
Linear2DSet ps =
new Linear2DSet(domain_type,
x_set.getFirst(), x_set.getLast(), node_divide,
y_set.getFirst(), y_set.getLast(), node_divide,
domain_set.getCoordinateSystem(),
domain_set.getSetUnits(), null);
RemoteClientPartitionedFieldImpl client_image =
new RemoteClientPartitionedFieldImpl(image_type, domain_set);
Linear2DSet[] subsets = new Linear2DSet[number_of_nodes];
RemoteNodePartitionedFieldImpl[] node_images =
new RemoteNodePartitionedFieldImpl[number_of_nodes];
if (number_of_nodes == 1) {
subsets[0] = domain_set;
node_images[0] = new RemoteNodePartitionedFieldImpl(image);
}
else {
int[] indices = new int[len];
for (int i=0; i lasts[j][k]) lasts[j][k] = values[j][i];
if (index[j] < lows[j][k]) lows[j][k] = index[j];
if (index[j] > his[j][k]) his[j][k] = index[j];
}
}
for (int k=0; k
Ads help maintain this website.