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.4 2014/10/13 08:52:33 j_novak Exp $
34  * $Log: eos_fitting.h,v $
35  * Revision 1.4 2014/10/13 08:52:33 j_novak
36  * Lorene classes and functions now belong to the namespace Lorene.
37  *
38  * Revision 1.3 2014/10/06 15:09:39 j_novak
39  * Modified #include directives to use c++ syntax.
40  *
41  * Revision 1.2 2005/05/22 20:50:39 k_taniguchi
42  * Introduction of a new class Eos_fit_AkmalPR.
43  *
44  * Revision 1.1 2004/09/26 18:50:00 k_taniguchi
45  * Initial revision
46  *
47  *
48  *
49  * $Header: /cvsroot/Lorene/C++/Include/eos_fitting.h,v 1.4 2014/10/13 08:52:33 j_novak Exp $
50  *
51  */
52 
53 // Standard C++
54 #include "headcpp.h"
55 
56 // Headers C
57 #include <cstdio>
58 #include <cassert>
59 
60 // Lorene classes
61 #include "eos.h"
62 #include "param.h"
63 
64 // External classes which appear in the declaration of class Eos_fitting:
65 namespace Lorene {
66 class Tbl ;
67 class Cmp ;
68 class Param ;
69 class Eos ;
70 
71 //-----------------------------------------------------------------------//
72 // class Eos_fitting for the analytical fitting of realistic EOS //
73 //-----------------------------------------------------------------------//
74 
80 class Eos_fitting : public Eos {
81 
82  // Data :
83  // -----
84  protected:
86  char dataname[160] ;
87 
89  double* pp ;
90 
91  // Constructors - Destructor
92  // -------------------------
93  protected:
94 
101  Eos_fitting(const char* name_i, const char* data, const char* path) ;
102 
103  // Eos_fitting(const Eos_fitting& ) ; ///< Copy constructor
104 
105  protected:
112  Eos_fitting(FILE* ) ;
113 
122  Eos_fitting(ifstream& ist, const char* data) ;
123 
125  friend Eos* Eos::eos_from_file(FILE* ) ;
126  friend Eos* Eos::eos_from_file(ifstream& ) ;
127 
128  public:
129  virtual ~Eos_fitting() ;
130 
131  // Outputs
132  // -------
133  public:
134  virtual void sauve(FILE *) const ;
135 
136  // Miscellaneous
137  // -------------
138  protected:
142  void read_coef() ;
143 
144  // Computational functions
145  // -----------------------
146  public:
156  virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
157 
166  virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
167 
176  virtual double press_ent_p(double ent, const Param* par=0x0) const ;
177 
186  virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
187 
196  virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
197 
206  virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
207 
208 };
209 
210 
211  //--------------------------------------//
212  // class Eos_fit_SLy4 //
213  //--------------------------------------//
214 
219 class Eos_fit_SLy4 : public Eos_fitting {
220 
221  // Constructors - Destructor
222  // -------------------------
223  public:
224 
229  Eos_fit_SLy4(const char* path) ;
230 
231  protected:
238  Eos_fit_SLy4(FILE* ) ;
239 
248  Eos_fit_SLy4(ifstream& ) ;
249 
251  friend Eos* Eos::eos_from_file(FILE* ) ;
252  friend Eos* Eos::eos_from_file(ifstream& ) ;
253 
254  public:
255  virtual ~Eos_fit_SLy4() ;
256 
257  // Outputs
258  // -------
259  protected:
260  virtual ostream& operator>>(ostream &) const ;
261 
262  // Miscellaneous
263  // -------------
264  public :
266  virtual bool operator==(const Eos& ) const ;
267 
269  virtual bool operator!=(const Eos& ) const ;
270 
274  virtual int identify() const ;
275 
276 };
277 
278 
279  //-------------------------------------//
280  // class Eos_fit_FPS //
281  //-------------------------------------//
282 
287 class Eos_fit_FPS : public Eos_fitting {
288 
289  // Constructors - Destructor
290  // -------------------------
291  public:
292 
297  Eos_fit_FPS(const char* path) ;
298 
299  protected:
306  Eos_fit_FPS(FILE* ) ;
307 
316  Eos_fit_FPS(ifstream& ) ;
317 
319  friend Eos* Eos::eos_from_file(FILE* ) ;
320  friend Eos* Eos::eos_from_file(ifstream& ) ;
321 
322  public:
323  virtual ~Eos_fit_FPS() ;
324 
325  // Outputs
326  // -------
327  protected:
328  virtual ostream& operator>>(ostream &) const ;
329 
330  // Miscellaneous
331  // -------------
332  public :
334  virtual bool operator==(const Eos& ) const ;
335 
337  virtual bool operator!=(const Eos& ) const ;
338 
342  virtual int identify() const ;
343 
344 };
345 
346 
347  //-----------------------------------------//
348  // class Eos_fit_AkmalPR //
349  //-----------------------------------------//
350 
355 class Eos_fit_AkmalPR : public Eos_fitting {
356 
357  // Constructors - Destructor
358  // -------------------------
359  public:
360 
365  Eos_fit_AkmalPR(const char* path) ;
366 
367  protected:
374  Eos_fit_AkmalPR(FILE* ) ;
375 
384  Eos_fit_AkmalPR(ifstream& ) ;
385 
387  friend Eos* Eos::eos_from_file(FILE* ) ;
388  friend Eos* Eos::eos_from_file(ifstream& ) ;
389 
390  public:
391  virtual ~Eos_fit_AkmalPR() ;
392 
393  // Outputs
394  // -------
395  protected:
396  virtual ostream& operator>>(ostream &) const ;
397 
398  // Miscellaneous
399  // -------------
400  public :
402  virtual bool operator==(const Eos& ) const ;
403 
405  virtual bool operator!=(const Eos& ) const ;
406 
410  virtual int identify() const ;
411 
412 };
413 
414 }
415 #endif
Lorene::Eos_fit_FPS::operator!=
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_fit_fps.C:100
Lorene::Eos_fit_FPS::identify
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Definition: eos_from_file.C:169
Lorene::Eos_fitting::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition: eos_fitting.C:127
Lorene::Eos_fit_SLy4::Eos_fit_SLy4
Eos_fit_SLy4(const char *path)
Standard constructor.
Definition: eos_fit_sly4.C:56
Lorene::Eos_fitting::der_press_ent_p
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:447
Lorene::Eos_fit_AkmalPR::~Eos_fit_AkmalPR
virtual ~Eos_fit_AkmalPR()
Destructor.
Definition: eos_fit_akmalpr.C:75
Lorene::Eos_fit_SLy4::operator==
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_fit_sly4.C:84
Lorene
Lorene prototypes.
Definition: app_hor.h:64
Lorene::Eos::eos_from_file
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Definition: eos_from_file.C:177
Lorene::Eos_fit_SLy4::operator>>
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_fit_sly4.C:107
Lorene::Eos_fitting::read_coef
void read_coef()
Reading coefficients of the fitting equation for the energy density, the pressure,...
Definition: eos_fitting.C:138
Lorene::Eos
Equation of state base class.
Definition: eos.h:190
Lorene::Eos_fitting::der_nbar_ent_p
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:334
Lorene::Eos_fit_FPS::~Eos_fit_FPS
virtual ~Eos_fit_FPS()
Destructor.
Definition: eos_fit_fps.C:77
Lorene::Eos_fitting::nbar_ent_p
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
Definition: eos_fitting.C:173
Lorene::Eos_fit_FPS::operator==
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_fit_fps.C:87
Lorene::Eos_fit_AkmalPR::identify
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Definition: eos_from_file.C:171
Lorene::Eos_fit_SLy4::operator!=
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_fit_sly4.C:97
Lorene::Eos_fit_SLy4
Fitted equation of state of SLy4.
Definition: eos_fitting.h:219
Lorene::Eos_fit_AkmalPR::operator==
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_fit_akmalpr.C:85
Lorene::Eos_fitting::dataname
char dataname[160]
Name of the file containing the fitting data.
Definition: eos_fitting.h:86
Lorene::Eos_fitting::~Eos_fitting
virtual ~Eos_fitting()
Destructor.
Definition: eos_fitting.C:116
Lorene::Eos_fit_FPS::Eos_fit_FPS
Eos_fit_FPS(const char *path)
Standard constructor.
Definition: eos_fit_fps.C:59
Lorene::Eos_fitting::ener_ent_p
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:240
Lorene::Eos_fitting::Eos_fitting
Eos_fitting(const char *name_i, const char *data, const char *path)
Standard constructor.
Definition: eos_fitting.C:78
Lorene::Eos_fit_SLy4::identify
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Definition: eos_from_file.C:167
Lorene::Eos_fit_SLy4::~Eos_fit_SLy4
virtual ~Eos_fit_SLy4()
Destructor.
Definition: eos_fit_sly4.C:74
Lorene::Eos_fit_AkmalPR::operator!=
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_fit_akmalpr.C:98
Lorene::Eos_fitting::pp
double * pp
Array of the coefficients of the fitting data.
Definition: eos_fitting.h:89
Lorene::Param
Parameter storage.
Definition: param.h:125
Lorene::Eos_fit_FPS
Fitted equation of state of FPS.
Definition: eos_fitting.h:287
Lorene::Eos_fitting
Base class for the analytically fitted equation of state.
Definition: eos_fitting.h:80
Lorene::Eos_fit_AkmalPR
Fitted equation of state of AkmalPR.
Definition: eos_fitting.h:355
Lorene::Eos_fit_FPS::operator>>
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_fit_fps.C:110
Lorene::Eos_fitting::der_ener_ent_p
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:393
Lorene::Eos_fit_AkmalPR::Eos_fit_AkmalPR
Eos_fit_AkmalPR(const char *path)
Standard constructor.
Definition: eos_fit_akmalpr.C:57
Lorene::Eos_fit_AkmalPR::operator>>
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_fit_akmalpr.C:108
Lorene::Eos_fitting::press_ent_p
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
Definition: eos_fitting.C:284