Basic HTML version of Foils prepared Nov 29 97

Foil 6 Filter Example (x = x + c)

From Overview of SciVis Scientific Visualization System :Visit of Team from ARL to NPAC -- Oct 29 97. by Byeongseob Ki, Scott Klasky


package sv.filters;
import java.util.*; import java.awt.*; import sv.kernel.*;
public class CAddXFilter extends Filter {
public CAddXFilter()// output data set's dimension is 1 and 1 arg needs
super(Filter.ONED, 1); label = "Enter the constant c: ";
}
public Object performFilter() {
TimeData1D onetimedata;
DataSet1D dataSet = (DataSet1D)sources.firstElement();
Vector timeDataVec = new Vector();
float[] xarr, yarr;
int points;
float c = args[0];
for (int i=0; i < dataSet.getnoOfTime(); i++) {
onetimedata = dataSet.getTimeData(i);
points = onetimedata.getnoOfPoints();
xarr = onetimedata.getxArr();
yarr = onetimedata.getyArr();
for (int j=0; j < points; j++)
xarr[j] =xarr[j] + c;
onetimedata = new TimeData1D(dataSet.getTimeArr[i], points, xarr, yarr);
timeDataVec.addElement(onetimedata);
}
return new DataSet1D("x=x+c : " + dataSet.getTitle(), timeDataVec);
}
}



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 29 1997