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:
68namespace Lorene {
69class Tbl ;
70class Cmp ;
71class Param ;
72class Eos ;
73
74//-----------------------------------------------------------------------//
75// class Eos_fitting for the analytical fitting of realistic EOS //
76//-----------------------------------------------------------------------//
77
83class 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
226class 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
298class 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
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
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
virtual bool operator!=(const Eos &) const
Comparison operator (difference).
virtual ~Eos_fit_AkmalPR()
Destructor.
virtual ostream & operator>>(ostream &) const
Operator >>.
Eos_fit_AkmalPR(const char *path)
Standard constructor.
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual bool operator==(const Eos &) const
Comparison operator (egality).
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
virtual ostream & operator>>(ostream &) const
Operator >>.
virtual ~Eos_fit_FPS()
Destructor.
Definition eos_fit_fps.C:80
virtual bool operator!=(const Eos &) const
Comparison operator (difference).
Eos_fit_FPS(const char *path)
Standard constructor.
Definition eos_fit_fps.C:62
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual bool operator==(const Eos &) const
Comparison operator (egality).
Definition eos_fit_fps.C:90
Eos_fit_SLy4(const char *path)
Standard constructor.
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual ~Eos_fit_SLy4()
Destructor.
virtual bool operator==(const Eos &) const
Comparison operator (egality).
virtual bool operator!=(const Eos &) const
Comparison operator (difference).
virtual ostream & operator>>(ostream &) const
Operator >>.
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual ~Eos_fitting()
Destructor.
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
void read_coef()
Reading coefficients of the fitting equation for the energy density, the pressure,...
char dataname[160]
Name of the file containing the fitting data.
Definition eos_fitting.h:89
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
double * pp
Array of the coefficients of the fitting data.
Definition eos_fitting.h:92
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
virtual void sauve(FILE *) const
Save in a file.
Eos_fitting(const char *name_i, const char *data, const char *path)
Standard constructor.
Definition eos_fitting.C:81
Equation of state base class.
Definition eos.h:206
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Eos()
Standard constructor.
Definition eos.C:118
Parameter storage.
Definition param.h:125
Basic array class.
Definition tbl.h:161
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
Lorene prototypes.
Definition app_hor.h:67