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


1 package sv.filters;
2 import java.util.*; import java.awt.*; import sv.kernel.*;
3 public class CAddXFilter extends Filter {
4 public CAddXFilter()// output data set's dimension is 1 and 1 arg needs
5 super(Filter.ONED, 1); label = "Enter the constant c: ";
6 }
7 public Object performFilter() {
8 TimeData1D onetimedata;
9 DataSet1D dataSet = (DataSet1D)sources.firstElement();
10 Vector timeDataVec = new Vector();
11 float[] xarr, yarr;
12 int points;
13 float c = args[0];
14 for (int i=0; i < dataSet.getnoOfTime(); i++) {
15 onetimedata = dataSet.getTimeData(i);
16 points = onetimedata.getnoOfPoints();
17 xarr = onetimedata.getxArr();
18 yarr = onetimedata.getyArr();
19 for (int j=0; j < points; j++)
20 xarr[j] =xarr[j] + c;
21 onetimedata = new TimeData1D(dataSet.getTimeArr[i], points, xarr, yarr);
22 timeDataVec.addElement(onetimedata);
23 }
24 return new DataSet1D("x=x+c : " + dataSet.getTitle(), timeDataVec);
25 }
26 }

in Table To:


© 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