54 #include "utilitaires.h" 81 const int nchar = 100 ;
83 size_t ret = fread(tmp_c,
sizeof(
char), nchar, fich) ;
84 if (
int(ret) == nchar)
92 getline(fich,
name,
'\n') ;
126 assert(p_poly !=
nullptr) ;
139 assert(p_tabul !=
nullptr) ;
140 string eos_name = p_tabul->
get_name() ;
141 resu =
new Dyn_eos_tab(eos_name, p_tabul->get_tablename(),
false) ;
147 assert(p_compose !=
nullptr) ;
148 string eos_name = p_compose->
get_name() ;
149 resu =
new Dyn_eos_tab(eos_name, p_compose->get_tablename(),
150 p_compose->get_format()) ;
156 assert(p_consistent !=
nullptr) ;
157 string eos_name = p_consistent->
get_name() ;
158 resu =
new Dyn_eos_cons(eos_name, p_consistent->get_tablename(),
159 p_consistent->get_format()) ;
163 cerr <<
"Dyn_eos::convert_from_Eos : " ;
164 cerr <<
"Unknown input Eos!" << endl ;
181 fwrite_be(&ident,
sizeof(
int), 1, fich) ;
182 fwrite(
name.c_str(),
sizeof(char), 100, fich) ;
185 ostream& operator<<(ostream& ost,
const Dyn_eos& eqetat)
200 assert(nbar.
get_etat() != ETATNONDEF) ;
208 assert(nbar.
get_etat() == ETATQCQ) ;
212 const Mg3d* mg = mp.get_mg() ;
222 for (
int l = l_min; l< l_min + nzet; l++)
227 Tbl* tnbar = vnbar.c->
t[l] ;
228 Tbl* tresu = vresu.
c->
t[l] ;
236 assert( tnbar->
get_etat() == ETATQCQ ) ;
240 tresu->
t[i] = (this->*fait)( tnbar->
t[i], par ) ;
250 if (l_min + nzet < nz)
252 resu.
annule(l_min + nzet, nz - 1) ;
301 int l_min,
Param* par)
const {
329 fread_be(&identificator,
sizeof(
int), 1, fich) ;
331 switch(identificator) {
349 cout <<
"Dyn_eos::eos_from_file : unknown type of EOS !" << endl ;
350 cout <<
" identificator = " << identificator << endl ;
367 fich >> identificator ; fich.ignore(1000,
'\n') ;
371 switch(identificator) {
388 cout <<
"Dyn_eos::eos_from_file : unknown type of EOS !" << endl ;
389 cout <<
" identificator = " << identificator << endl ;
void calcule(const Scalar &thermo, int nzet, int l_min, double(Dyn_eos::*fait)(double, const Param *) const, Param *par, Scalar &resu) const
General computational method for Scalar 's.
void set_name(const string &)
Sets the EOS name.
Scalar csound_square_nbar(const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
Computes the sound speed squared from the baryon density with extra parameters.
virtual int identify() const
Returns a number to identify the sub-classe of Dyn_eos the object belongs to.
virtual void sauve(FILE *) const
Save in a file.
virtual int identify() const =0
Returns a number to identify the sub-classe of Dyn_eos the object belongs to.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
const char * get_name() const
Returns the EOS name.
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
virtual double ent_nbar_p(double nbar, const Param *par=0x0) const =0
Computes the log-enthalpy from the baryon density and extra parameters (virtual function implemented ...
virtual double csound_square_nbar_p(double nbar, const Param *par=0x0) const =0
Computes the sound speed squared from the baryon density with extra parameters (virtual function imp...
Equation of state base class.
virtual int identify() const =0
Returns a number to identify the sub-classe of Eos the object belongs to.
Tensor field of valence 0 (or component of a tensorial field).
void coef_i() const
Computes the physical value of *this.
Base class for coordinate mappings.
const string & get_name() const
Returns the EOS name.
virtual ~Dyn_eos()
Destructor.
Polytropic equation of state (relativistic case) for use in dynamical code.
Values and coefficients of a (real-value) function.
int get_etat() const
Gives the logical state.
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Scalar press_nbar(const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
Computes the pressure from the baryon density and extra parameters.
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
virtual int identify() const
Returns a number to identify the sub-classe of Dyn_eos the object belongs to.
double get_gam() const
Returns the adiabatic index (cf. Eq. (3))
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Equation of state for use in dynamical code base class.
virtual double press_nbar_p(double nbar, const Param *par=0x0) const =0
Computes the pressure from the baryon density and extra parameters (virtual function implemented in t...
Class for tabulated equations of state for use in dynamical code.
double get_kap() const
Returns the pressure coefficient (cf.
double get_m_0() const
Return the individual particule mass (cf.
virtual double ener_nbar_p(double nbar, const Param *par=0x0) const =0
Computes the total energy density from the baryon density and extra parameters (virtual function impl...
Equation of state for the CompOSE database with a consistent computation of the log-enthalpy (deriv...
double * t
The array of double.
static Dyn_eos * convert_from_Eos(const Eos &)
Conversion operator from Eos to Dyn_eos.
Mtbl * c
Values of the function at the points of the multi-grid.
Polytropic equation of state (relativistic case).
int get_nzone() const
Returns the number of domains.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Base class for tabulated equations of state.
double get_mu_0() const
Return the relativistic chemical potential at zero pressure [unit: , with ].
Scalar ener_nbar(const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
Computes the total energy density from the baryon density and extra parameters.
Dyn_eos()
Standard constructor.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
static Dyn_eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
virtual int identify() const
Returns a number to identify the sub-classe of Dyn_eos the object belongs to.
int get_taille() const
Gives the total size (ie dim.taille)
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Valeur & set_spectral_va()
Returns va (read/write version)
Equation of state for the CompOSE database with a consistent computation of the baryon density...
Scalar ent_nbar(const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
Computes the log-enthalpy field from the baryon density field and extra parameters.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
const Map & get_mp() const
Returns the mapping.
Equation of state for the CompOSE database.
const Valeur & get_spectral_va() const
Returns va (read only version)