107 #include "utilitaires.h" 144 fread(
name,
sizeof(
char), 100, fich) ;
152 fich.getline(
name, 100) ;
175 strncpy(
name, name_i, 100) ;
192 fwrite_be(&ident,
sizeof(
int), 1, fich) ;
194 fwrite(
name,
sizeof(
char), 100, fich) ;
201 ostream& operator<<(ostream& ost,
const Eos& eqetat) {
214 double (
Eos::*fait)(
double,
const Param*)
const,
Param* par,
Cmp& resu)
const {
216 assert(ent.
get_etat() != ETATNONDEF) ;
227 const MEos* tryMEos =
dynamic_cast<const MEos*
>(
this) ;
228 bool isMEos = (tryMEos != 0x0) ;
235 const Mg3d* mg = mp->get_mg() ;
246 for (
int l = l_min; l< l_min + nzet; l++) {
253 Tbl* tent = vent.
c->
t[l] ;
254 Tbl* tresu = vresu.
c->
t[l] ;
260 assert( tent->
get_etat() == ETATQCQ ) ;
265 tresu->
t[i] = (this->*fait)( tent->
t[i], par ) ;
278 if (l_min + nzet < nz) {
279 resu.
annule(l_min + nzet, nz - 1) ;
288 assert(ent.
get_etat() != ETATNONDEF) ;
299 const MEos* tryMEos =
dynamic_cast<const MEos*
>(
this) ;
300 bool isMEos = (tryMEos != 0x0) ;
307 const Mg3d* mg = mp->get_mg() ;
318 for (
int l = l_min; l< l_min + nzet; l++) {
325 Tbl* tent = vent.
c->
t[l] ;
326 Tbl* tresu = vresu.
c->
t[l] ;
332 assert( tent->
get_etat() == ETATQCQ ) ;
337 tresu->
t[i] = (this->*fait)( tent->
t[i], par ) ;
350 if (l_min + nzet < nz) {
351 resu.
annule(l_min + nzet, nz - 1) ;
500 int l_min,
Param* par)
const {
const Map * get_mp() const
Returns the mapping.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Cmp ener_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the total energy density from the log-enthalpy and extra parameters.
virtual double der_press_ent_p(double ent, const Param *par=0x0) const =0
Computes the logarithmic derivative from the log-enthalpy and extra parameters (virtual function imp...
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const =0
Computes the logarithmic derivative from the log-enthalpy and extra parameters (virtual function imp...
Cmp der_nbar_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy and extra parameters.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
const char * get_name() const
Returns the EOS name.
void annule(int l)
Sets the Cmp to zero in a given domain.
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Equation of state base class.
int get_etat() const
Returns the logical state.
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).
Scalar csound_square_ent(const Scalar &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the sound speed squared from the enthalpy with extra parameters.
void coef_i() const
Computes the physical value of *this.
Base class for coordinate mappings.
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).
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
virtual double press_ent_p(double ent, const Param *par=0x0) const =0
Computes the pressure from the log-enthalpy and extra parameters (virtual function implemented in the...
EOS with domain dependency.
virtual void sauve(FILE *) const
Save in a file.
Eos()
Standard constructor.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
virtual double ener_ent_p(double ent, const Param *par=0x0) const =0
Computes the total energy density from the log-enthalpy and extra parameters (virtual function implem...
Cmp nbar_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the baryon density field from the log-enthalpy field and extra parameters.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual double nbar_ent_p(double ent, const Param *par=0x0) const =0
Computes the baryon density from the log-enthalpy and extra parameters (virtual function implemented ...
double * t
The array of double.
Mtbl * c
Values of the function at the points of the multi-grid.
int get_nzone() const
Returns the number of domains.
virtual double csound_square_ent_p(double ent, const Param *par=0x0) const =0
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
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.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual ~Eos()
Destructor.
void set_name(const char *name_i)
Sets the EOS name.
int get_taille() const
Gives the total size (ie dim.taille)
Cmp der_ener_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy and extra parameters.
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)
Cmp der_press_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy and extra parameters.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
const Map & get_mp() const
Returns the mapping.
void calcule(const Cmp &thermo, int nzet, int l_min, double(Eos::*fait)(double, const Param *) const, Param *par, Cmp &resu) const
General computational method for Cmp 's.
Valeur va
The numerical value of the Cmp.
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const =0
Computes the logarithmic derivative from the log-enthalpy with extra parameters (virtual function im...
Cmp press_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the pressure from the log-enthalpy and extra parameters.
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
const Valeur & get_spectral_va() const
Returns va (read only version)