LORENE
eos_fitting.h
1 /*
2  * Definition of Lorene class Eos_fitting
3  * Eos_fit_SLy4
4  * Eos_fit_FPS
5  * Eos_fit_AkmalPR
6  *
7  */
8 
9 /*
10  * Copyright (c) 2004 Keisuke Taniguchi
11  *
12  * This file is part of LORENE.
13  *
14  * LORENE is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2
16  * as published by the Free Software Foundation.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 #ifndef __EOS_FITTING_H_
30 #define __EOS_FITTING_H_
31 
32 /*
33  * $Id: eos_fitting.h,v 1.5 2021/05/14 15:39:22 g_servignat Exp $
34  * $Log: eos_fitting.h,v $
35  * Revision 1.5 2021/05/14 15:39:22 g_servignat
36  * Added sound speed computation from enthalpy to Eos class and tabulated+polytropic derived classes
37  *
38  * Revision 1.4 2014/10/13 08:52:33 j_novak
39  * Lorene classes and functions now belong to the namespace Lorene.
40  *
41  * Revision 1.3 2014/10/06 15:09:39 j_novak
42  * Modified #include directives to use c++ syntax.
43  *
44  * Revision 1.2 2005/05/22 20:50:39 k_taniguchi
45  * Introduction of a new class Eos_fit_AkmalPR.
46  *
47  * Revision 1.1 2004/09/26 18:50:00 k_taniguchi
48  * Initial revision
49  *
50  *
51  *
52  * $Header: /cvsroot/Lorene/C++/Include/eos_fitting.h,v 1.5 2021/05/14 15:39:22 g_servignat Exp $
53  *
54  */
55 
56 // Standard C++
57 #include "headcpp.h"
58 
59 // Headers C
60 #include <cstdio>
61 #include <cassert>
62 
63 // Lorene classes
64 #include "eos.h"
65 #include "param.h"
66 
67 // External classes which appear in the declaration of class Eos_fitting:
68 namespace Lorene {
69 class Tbl ;
70 class Cmp ;
71 class Param ;
72 class Eos ;
73 
74 //-----------------------------------------------------------------------//
75 // class Eos_fitting for the analytical fitting of realistic EOS //
76 //-----------------------------------------------------------------------//
77 
83 class Eos_fitting : public Eos {
84 
85  // Data :
86  // -----
87  protected:
89  char dataname[160] ;
90 
92  double* pp ;
93 
94  // Constructors - Destructor
95  // -------------------------
96  protected:
97 
104  Eos_fitting(const char* name_i, const char* data, const char* path) ;
105 
106  // Eos_fitting(const Eos_fitting& ) ; ///< Copy constructor
107 
108  protected:
115  Eos_fitting(FILE* ) ;
116 
125  Eos_fitting(ifstream& ist, const char* data) ;
126 
128  friend Eos* Eos::eos_from_file(FILE* ) ;
129  friend Eos* Eos::eos_from_file(ifstream& ) ;
130 
131  public:
132  virtual ~Eos_fitting() ;
133 
134  // Outputs
135  // -------
136  public:
137  virtual void sauve(FILE *) const ;
138 
139  // Miscellaneous
140  // -------------
141  protected:
145  void read_coef() ;
146 
147  // Computational functions
148  // -----------------------
149  public:
159  virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
160 
169  virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
170 
179  virtual double press_ent_p(double ent, const Param* par=0x0) const ;
180 
189  virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
190 
199  virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
200 
209  virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
210 
211  virtual double csound_square_ent_p(double, const Param*) const {
212  c_est_pas_fait(__FILE__) ;
213  return 0 ;
214  } ;
215 };
216 
217 
218  //--------------------------------------//
219  // class Eos_fit_SLy4 //
220  //--------------------------------------//
221 
226 class Eos_fit_SLy4 : public Eos_fitting {
227 
228  // Constructors - Destructor
229  // -------------------------
230  public:
231 
236  Eos_fit_SLy4(const char* path) ;
237 
238  protected:
245  Eos_fit_SLy4(FILE* ) ;
246 
255  Eos_fit_SLy4(ifstream& ) ;
256 
258  friend Eos* Eos::eos_from_file(FILE* ) ;
259  friend Eos* Eos::eos_from_file(ifstream& ) ;
260 
261  public:
262  virtual ~Eos_fit_SLy4() ;
263 
264  // Outputs
265  // -------
266  protected:
267  virtual ostream& operator>>(ostream &) const ;
268 
269  // Miscellaneous
270  // -------------
271  public :
273  virtual bool operator==(const Eos& ) const ;
274 
276  virtual bool operator!=(const Eos& ) const ;
277 
281  virtual int identify() const ;
282 
283  virtual double csound_square_ent_p(double, const Param*) const {
284  c_est_pas_fait(__FILE__) ;
285  return 0 ;
286  } ;
287 };
288 
289 
290  //-------------------------------------//
291  // class Eos_fit_FPS //
292  //-------------------------------------//
293 
298 class Eos_fit_FPS : public Eos_fitting {
299 
300  // Constructors - Destructor
301  // -------------------------
302  public:
303 
308  Eos_fit_FPS(const char* path) ;
309 
310  protected:
317  Eos_fit_FPS(FILE* ) ;
318 
327  Eos_fit_FPS(ifstream& ) ;
328 
330  friend Eos* Eos::eos_from_file(FILE* ) ;
331  friend Eos* Eos::eos_from_file(ifstream& ) ;
332 
333  public:
334  virtual ~Eos_fit_FPS() ;
335 
336  // Outputs
337  // -------
338  protected:
339  virtual ostream& operator>>(ostream &) const ;
340 
341  // Miscellaneous
342  // -------------
343  public :
345  virtual bool operator==(const Eos& ) const ;
346 
348  virtual bool operator!=(const Eos& ) const ;
349 
353  virtual int identify() const ;
354 
355  virtual double csound_square_ent_p(double, const Param*) const {
356  c_est_pas_fait(__FILE__) ;
357  return 0;
358  } ;
359 };
360 
361 
362  //-----------------------------------------//
363  // class Eos_fit_AkmalPR //
364  //-----------------------------------------//
365 
370 class Eos_fit_AkmalPR : public Eos_fitting {
371 
372  // Constructors - Destructor
373  // -------------------------
374  public:
375 
380  Eos_fit_AkmalPR(const char* path) ;
381 
382  protected:
389  Eos_fit_AkmalPR(FILE* ) ;
390 
399  Eos_fit_AkmalPR(ifstream& ) ;
400 
402  friend Eos* Eos::eos_from_file(FILE* ) ;
403  friend Eos* Eos::eos_from_file(ifstream& ) ;
404 
405  public:
406  virtual ~Eos_fit_AkmalPR() ;
407 
408  // Outputs
409  // -------
410  protected:
411  virtual ostream& operator>>(ostream &) const ;
412 
413  // Miscellaneous
414  // -------------
415  public :
417  virtual bool operator==(const Eos& ) const ;
418 
420  virtual bool operator!=(const Eos& ) const ;
421 
425  virtual int identify() const ;
426 
437  virtual double csound_square_ent_p(double, const Param*) const {
438  c_est_pas_fait(__FILE__) ;
439  return 0;
440  } ;
441 };
442 
443 }
444 #endif
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_fit_fps.C:103
Fitted equation of state of AkmalPR.
Definition: eos_fitting.h:370
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
Definition: eos_fitting.h:211
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
Definition: eos_fitting.h:437
Fitted equation of state of SLy4.
Definition: eos_fitting.h:226
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_fit_sly4.C:87
virtual bool operator==(const Eos &) const
Comparison operator (egality)
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_fit_fps.C:90
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
Definition: eos_fitting.C:243
Eos_fitting(const char *name_i, const char *data, const char *path)
Standard constructor.
Definition: eos_fitting.C:81
virtual ~Eos_fit_FPS()
Destructor.
Definition: eos_fit_fps.C:80
Lorene prototypes.
Definition: app_hor.h:67
Equation of state base class.
Definition: eos.h:209
virtual ostream & operator>>(ostream &) const
Operator >>
Fitted equation of state of FPS.
Definition: eos_fitting.h:298
Eos_fit_FPS(const char *path)
Standard constructor.
Definition: eos_fit_fps.C:62
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_fit_sly4.C:110
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual ~Eos_fit_SLy4()
Destructor.
Definition: eos_fit_sly4.C:77
virtual ~Eos_fit_AkmalPR()
Destructor.
virtual void sauve(FILE *) const
Save in a file.
Definition: eos_fitting.C:130
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
Definition: eos_fitting.C:287
double * pp
Array of the coefficients of the fitting data.
Definition: eos_fitting.h:92
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_fitting.C:396
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_fit_sly4.C:100
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
Definition: eos_fitting.C:176
void read_coef()
Reading coefficients of the fitting equation for the energy density, the pressure, and the enthalpy.
Definition: eos_fitting.C:141
Parameter storage.
Definition: param.h:125
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_fitting.C:337
Eos_fit_SLy4(const char *path)
Standard constructor.
Definition: eos_fit_sly4.C:59
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
Definition: eos_fitting.h:355
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
char dataname[160]
Name of the file containing the fitting data.
Definition: eos_fitting.h:89
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_fit_fps.C:113
Eos_fit_AkmalPR(const char *path)
Standard constructor.
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
Definition: eos_fitting.h:283
virtual ~Eos_fitting()
Destructor.
Definition: eos_fitting.C:119
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_fitting.C:450
Base class for the analytically fitted equation of state.
Definition: eos_fitting.h:83
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.