GTable1D
GENIUS allows to display (and read/write !) one dimension tables (abscissa et ordinate). The idea is to be able to manage one or several tabulated functions yi = f(xi) as, for example Cx et Cz depending on the Angle of Attack …
To do it, we must use GEntryRealVector class (or GEntryIntVector, GEntryDateVector) to store data by columns.
GUnit[] unitAng = {new GMetricUnit("deg"), new GMetricUnit("rad")}; double[] incVal = {Math.toRadians(10.), Math.toRadians(15.), Math.toRadians(20.), Math.toRadians(25.), Math.toRadians(30.), Math.toRadians(35.), Math.toRadians(40.)}; double[] cxVal = {0.100, 0.150, 0.200, 0.250, 0.350, 0.450, 0.600}; double[] czVal = {0.250, 0.300, 0.350, 0.400, 0.500, 0.550, 0.600}; incTabIhm = new GEntryRealVector("Angle Of Attack", incVal, unitAng); incTabIhm.setNameInConfigFile("AOA"); CxTabIhm = new GEntryRealVector("Cx", cxVal); CzTabIhm = new GEntryRealVector("Cz", czVal); CzTabIhm.addGInterval(errInterval);
Then we will use GTable1D class to assembly them:
aeroTabIhm=new GTable1D("Cx/Cz = f(Mach)", TableOrientation.VERTICAL,incTabIhm, CxTabIhm, CzTabIhm); aeroTabIhm.setConstraint(new GConstraint(GConstraint.newline()));
At last, if we want to get the content of this table, we will have to use the getGVector() method then getValue() or getValueArray() methods. The following example gives us a method to recover a double table:
public double[] getData ( int rank ) { double[] tmp = new double[aeroTabIhm.getGVector(rank).size()]; for (int i = 0; i < tmp.length; i++) { tmp[i] = (Double)aeroTabIhm.getGVector(rank).getValue(i); } return tmp; }
Note that, it is mandatory to cast the data as, since the V1.2 version, it is possible to get objects as GEntryDateVector in GTable1D, so the getGVector() will return a table of Objects rather than a table of Number as previously.