« GTable2D » : différence entre les versions

De GENIUS
Aller à la navigation Aller à la recherche
(Page créée avec « TBW ... Return to the introduction ↑ Go to the next page → »)
 
Aucun résumé des modifications
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
TBW ...
<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/table/GTable2D.html GTable2D] class to store data. Using it is relatively simple as shown ont the example below :
 
<syntaxhighlight lang="java">
// 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);
</syntaxhighlight>
 
And you will obtain this ...
 
 
[[File:GTable2D.jpg]]
 
 
To get the content of this table, we will have to use the <font color=#4169E1>getAbsValues()</font>, <font color=#4169E1>getOrdValues()</font> and <font color=#4169E1>getValues()</font> methods:
 
<syntaxhighlight lang="java">
double[] abs = volTable.getGTable().getAbsValues();
double[] ord = volTable.getGTable().getOrdValues();
double[][] val = volTable.getGTable().getValues();
</syntaxhighlight>
 


[[WELCOME_TO_THE_GENIUS_WIKI|Return to the introduction ↑]]  
[[WELCOME_TO_THE_GENIUS_WIKI|Return to the introduction ↑]]  
[[GComponentList|Go to the next page →]]
[[GComponentList|Go to the next page →]]

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 ...


GTable2D.jpg


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();


Return to the introduction ↑ Go to the next page →