00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 char eos_from_file_C[] = "$Header: /cvsroot/Lorene/C++/Source/Eos/eos_from_file.C,v 1.10 2011/06/16 10:49:18 j_novak Exp $" ;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 #include <stdlib.h>
00097
00098
00099 #include "headcpp.h"
00100 #include "eos.h"
00101 #include "eos_multi_poly.h"
00102 #include "eos_fitting.h"
00103 #include "utilitaires.h"
00104
00105
00106
00107
00108
00109
00110 int Eos_poly::identify() const { return 1; }
00111
00112 int Eos_poly_newt::identify() const { return 2; }
00113
00114 int Eos_incomp::identify() const { return 3; }
00115
00116 int Eos_incomp_newt::identify() const { return 4; }
00117
00118 int Eos_strange::identify() const { return 5; }
00119
00120 int Eos_strange_cr::identify() const { return 6; }
00121
00122 int Eos_SLy4::identify() const { return 10; }
00123
00124 int Eos_FPS::identify() const { return 11; }
00125
00126 int Eos_BPAL12::identify() const { return 12; }
00127
00128 int Eos_AkmalPR::identify() const { return 13; }
00129
00130 int Eos_BBB2::identify() const { return 14; }
00131
00132 int Eos_BalbN1H1::identify() const { return 15; }
00133
00134 int Eos_GlendNH3::identify() const { return 16; }
00135
00136 int Eos_Compstar::identify() const { return 17; }
00137
00138 int Eos_mag::identify() const { return 18; }
00139
00140 int MEos::identify() const { return 100; }
00141
00142 int Eos_multi_poly::identify() const { return 110; }
00143
00144 int Eos_fit_SLy4::identify() const { return 120; }
00145
00146 int Eos_fit_FPS::identify() const { return 121; }
00147
00148 int Eos_fit_AkmalPR::identify() const { return 122; }
00149
00150
00151
00152
00153
00154 Eos* Eos::eos_from_file(FILE* fich) {
00155
00156 Eos* p_eos ;
00157
00158
00159 int identificator ;
00160 fread_be(&identificator, sizeof(int), 1, fich) ;
00161
00162 switch(identificator) {
00163
00164 case 1 : {
00165 p_eos = new Eos_poly(fich) ;
00166 break ;
00167 }
00168
00169 case 2 : {
00170 p_eos = new Eos_poly_newt(fich) ;
00171 break ;
00172 }
00173
00174 case 3 : {
00175 p_eos = new Eos_incomp(fich) ;
00176 break ;
00177 }
00178
00179 case 4 : {
00180 p_eos = new Eos_incomp_newt(fich) ;
00181 break ;
00182 }
00183
00184 case 5 : {
00185 p_eos = new Eos_strange(fich) ;
00186 break ;
00187 }
00188
00189 case 6 : {
00190 p_eos = new Eos_strange_cr(fich) ;
00191 break ;
00192 }
00193
00194 case 10 : {
00195 p_eos = new Eos_SLy4(fich) ;
00196 break ;
00197 }
00198
00199 case 11 : {
00200 p_eos = new Eos_FPS(fich) ;
00201 break ;
00202 }
00203
00204 case 12 : {
00205 p_eos = new Eos_BPAL12(fich) ;
00206 break ;
00207 }
00208
00209 case 13 : {
00210 p_eos = new Eos_AkmalPR(fich) ;
00211 break ;
00212 }
00213
00214 case 14 : {
00215 p_eos = new Eos_BBB2(fich) ;
00216 break ;
00217 }
00218
00219 case 15 : {
00220 p_eos = new Eos_BalbN1H1(fich) ;
00221 break ;
00222 }
00223
00224 case 16 : {
00225 p_eos = new Eos_GlendNH3(fich) ;
00226 break ;
00227 }
00228
00229 case 17 : {
00230 p_eos = new Eos_Compstar(fich) ;
00231 break ;
00232 }
00233
00234 case 18 : {
00235 p_eos = new Eos_mag(fich) ;
00236 break ;
00237 }
00238
00239 case 100 : {
00240 p_eos = new MEos(fich) ;
00241 break ;
00242 }
00243
00244 case 110 : {
00245 p_eos = new Eos_multi_poly(fich) ;
00246 break ;
00247 }
00248
00249 case 120 : {
00250 p_eos = new Eos_fit_SLy4(fich) ;
00251 break ;
00252 }
00253
00254 case 121 : {
00255 p_eos = new Eos_fit_FPS(fich) ;
00256 break ;
00257 }
00258
00259 case 122 : {
00260 p_eos = new Eos_fit_AkmalPR(fich) ;
00261 break ;
00262 }
00263
00264 default : {
00265 cout << "Eos::eos_from_file : unknown type of EOS !" << endl ;
00266 cout << " identificator = " << identificator << endl ;
00267 abort() ;
00268 break ;
00269 }
00270
00271 }
00272
00273 return p_eos ;
00274
00275 }
00276
00277
00278
00279
00280
00281 Eos* Eos::eos_from_file(ifstream& fich) {
00282
00283 int identificator ;
00284 char blabla[80] ;
00285
00286
00287 fich >> identificator ; fich.getline(blabla, 80) ;
00288
00289 Eos* p_eos ;
00290
00291 switch(identificator) {
00292
00293 case 1 : {
00294 p_eos = new Eos_poly(fich) ;
00295 break ;
00296 }
00297
00298 case 2 : {
00299 p_eos = new Eos_poly_newt(fich) ;
00300 break ;
00301 }
00302
00303 case 3 : {
00304 p_eos = new Eos_incomp(fich) ;
00305 break ;
00306 }
00307
00308 case 4 : {
00309 p_eos = new Eos_incomp_newt(fich) ;
00310 break ;
00311 }
00312
00313 case 5 : {
00314 p_eos = new Eos_strange(fich) ;
00315 break ;
00316 }
00317
00318 case 6 : {
00319 p_eos = new Eos_strange_cr(fich) ;
00320 break ;
00321 }
00322
00323 case 10 : {
00324 p_eos = new Eos_SLy4(fich) ;
00325 break ;
00326 }
00327
00328 case 11 : {
00329 p_eos = new Eos_FPS(fich) ;
00330 break ;
00331 }
00332
00333 case 12 : {
00334 p_eos = new Eos_BPAL12(fich) ;
00335 break ;
00336 }
00337
00338 case 13 : {
00339 p_eos = new Eos_AkmalPR(fich) ;
00340 break ;
00341 }
00342
00343 case 14 : {
00344 p_eos = new Eos_BBB2(fich) ;
00345 break ;
00346 }
00347
00348 case 15 : {
00349 p_eos = new Eos_BalbN1H1(fich) ;
00350 break ;
00351 }
00352
00353 case 16 : {
00354 p_eos = new Eos_GlendNH3(fich) ;
00355 break ;
00356 }
00357
00358 case 17 : {
00359 p_eos = new Eos_Compstar(fich) ;
00360 break ;
00361 }
00362
00363 case 18 : {
00364 p_eos = new Eos_mag(fich) ;
00365 break ;
00366 }
00367
00368 case 100 : {
00369 p_eos = new MEos(fich) ;
00370 break ;
00371 }
00372
00373 case 110 : {
00374 p_eos = new Eos_multi_poly(fich) ;
00375 break ;
00376 }
00377
00378 case 120 : {
00379 p_eos = new Eos_fit_SLy4(fich) ;
00380 break ;
00381 }
00382
00383 case 121 : {
00384 p_eos = new Eos_fit_FPS(fich) ;
00385 break ;
00386 }
00387
00388 case 122 : {
00389 p_eos = new Eos_fit_AkmalPR(fich) ;
00390 break ;
00391 }
00392
00393 default : {
00394 cout << "Eos::eos_from_file : unknown type of EOS !" << endl ;
00395 cout << " identificator = " << identificator << endl ;
00396 abort() ;
00397 break ;
00398 }
00399
00400 }
00401
00402 return p_eos ;
00403
00404 }
00405
00406
00407
00408
00409
00410