« GTable2D » : différence entre les versions
Aller à la navigation
Aller à la recherche
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 1 : | Ligne 1 : | ||
<font color=#556B2F>'''GENIUS'''</font> allows also to display (and read/write !) two dimension tables. The idea is to be able to manage one tabulated function depending on two parameters : f(x<sub>i</sub>, y<sub>i</sub>) as, for example a volume depending on pressure (P) and temperature (T) => V = ''f''(P,T) | <font color=#556B2F>'''GENIUS'''</font> allows also to display (and read/write !) two dimension tables. The idea is to be able to manage one tabulated function depending on two parameters : f(x<sub>i</sub>, y<sub>i</sub>) as, for example a volume depending on pressure (P) and temperature (T) => V = ''f''(P,T) | ||
To do it, we must use [{{PathCurrentJavaDoc}}/fr/cnes/genius/ | To do it, we must use [{{PathCurrentJavaDoc}}/fr/cnes/genius/table/GTable2D.html GTable2D] class to store data. Using it is relatively simple as shown ont the example below : | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> |
Dernière version du 13 décembre 2017 à 14:40
GENIUS allows also to display (and read/write !) two dimension tables. The idea is to be able to manage one tabulated function depending on two parameters : f(xi, yi) as, for example a volume depending on pressure (P) and temperature (T) => V = f(P,T)
To do it, we must use GTable2D class to store data. Using it is relatively simple as shown ont the example below :
// Unit lists
GUnit[] unitVolume = {new GMetricUnit("m^3"), new GMetricUnit("dm^3")};
GUnit[] unitPressure = {new GMetricUnit("Pa"), new GMetricUnit("mPa")};
GUnit[] unitTemperature = {new GTemperatureUnit("K"), new GTemperatureUnit("°C")};
double[][] vol = { {50. , 100.0, 150.0},
{60. , 110.0, 120.0},
{75. , 125.0, 175.0} };
double[] pres = { 1., 10.0, 20.0 };
double[] temp = { 250.0, 300.0, 350.0 };
GTable2D volTable = new GTable2D (vol, pres, temp,
"Volume", "Pressure", "Temperature",
unitVolume, unitPressure, unitTemperature);
And you will obtain this ...
To get the content of this table, we will have to use the getAbsValues(), getOrdValues() and getValues() methods:
double[] abs = volTable.getGTable().getAbsValues();
double[] ord = volTable.getGTable().getOrdValues();
double[][] val = volTable.getGTable().getValues();