Debian Codegraph @

C++/Source/Star/star_bin_global_xcts.C

raw
1 /*
2 * Methods for computing global quantities within the class Star_bin_xcts
3 * (see file star.h for documentation)
4 */
5
6 /*
7 * Copyright (c) 2010 Michal Bejger
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 char star_bin_global_xcts_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global_xcts.C,v 1.2 2014/10/13 08:53:38 j_novak Exp $" ;
27
28 /*
29 * $Id: star_bin_global_xcts.C,v 1.2 2014/10/13 08:53:38 j_novak Exp $
30 * $Log: star_bin_global_xcts.C,v $
31 * Revision 1.2 2014/10/13 08:53:38 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.1 2010/05/04 07:51:05 m_bejger
35 * Initial version
36 *
37 * $Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global_xcts.C,v 1.2 2014/10/13 08:53:38 j_novak Exp $
38 *
39 */
40
41 // Headers Lorene
42 #include "star.h"
43 #include "utilitaires.h"
44
45 //--------------------------//
46 // Baryon mass //
47 //--------------------------//
48
49 namespace Lorene {
50 double Star_bin_xcts::mass_b() const {
51
52 if (p_mass_b == 0x0) { // a new computation is required
53
54 Scalar det_gamma = gamma.determinant() ;
55
56 Scalar dens = sqrt(det_gamma) * gam_euler * nbar ;
57
58 dens.std_spectral_base() ;
59
60 p_mass_b = new double( dens.integrale() ) ;
61
62 }
63
64 return *p_mass_b ;
65
66 }
67
68
69
70 //----------------------------//
71 // Gravitational mass //
72 //----------------------------//
73
74 double Star_bin_xcts::mass_g() const {
75
76 if (p_mass_g == 0x0) { // a new computation is required
77
78 Scalar det_gamma = gamma.determinant() ;
79
80 Scalar dens = sqrt(det_gamma) * nn
81 * ( ener_euler + s_euler ) ;
82
83 dens.std_spectral_base() ;
84
85 p_mass_g = new double( dens.integrale() ) ;
86
87 }
88
89 return *p_mass_g ;
90
91 }
92
93
94 //----------------------------------//
95 // X coordinate of the barycenter //
96 //----------------------------------//
97
98
99 double Star_bin_xcts::xa_barycenter() const {
100
101 if (p_xa_barycenter == 0x0) { // a new computation is required
102
103 Scalar xxa(mp) ;
104 xxa = mp.xa ; // Absolute X coordinate
105 xxa.std_spectral_base() ;
106
107 Scalar det_gamma = gamma.determinant() ;
108
109 Scalar dens = sqrt(det_gamma) * gam_euler * nbar * xxa ;
110
111 int nzone = mp.get_mg()->get_nzone() ;
112 dens.annule_domain(nzone - 1) ;
113
114 dens.std_spectral_base() ;
115
116 p_xa_barycenter = new double( dens.integrale() / mass_b() ) ;
117
118 }
119
120 return *p_xa_barycenter ;
121
122 }
123 }