Debian Codegraph @

Codes/Test/Etoile/test_et_bin_ncp.C

raw
1 /*
2 * Test code for class Et_bin_ncp
3 *
4 */
5
6 /*
7 * Copyright (c) 2002 Francois Limousin
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 test_et_bin_ncp_C[] = "$Header: /cvsroot/Lorene/Codes/Test/Etoile/test_et_bin_ncp.C,v 1.3 2014/10/13 08:54:00 j_novak Exp $" ;
27
28 /*
29 * $Id: test_et_bin_ncp.C,v 1.3 2014/10/13 08:54:00 j_novak Exp $
30 * $Log: test_et_bin_ncp.C,v $
31 * Revision 1.3 2014/10/13 08:54:00 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.2 2014/10/06 15:12:52 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.1 2002/12/09 10:29:38 f_limousin
38 * Test code for class Et_bin_ncp
39 *
40 *
41 *
42 * $Header: /cvsroot/Lorene/Codes/Test/Etoile/test_et_bin_ncp.C,v 1.3 2014/10/13 08:54:00 j_novak Exp $
43 *
44 */
45
46 // C++ headers
47 #include "headcpp.h"
48
49 // C headers
50 #include <cstdlib>
51
52 // Lorene headers
53 #include "et_bin_ncp.h"
54 #include "nbr_spx.h"
55 #include "eos.h"
56
57 using namespace Lorene ;
58
59 int main() {
60
61 { // Main block
62
63 // Identification of all the subroutines called by the code :
64
65 // system("ident test_etoile > identification.d") ;
66
67 //-----------------------------------------------------------------------
68 // Input data : number of points, types of sampling, etc...
69 //-----------------------------------------------------------------------
70
71 int nz = 3 ; // Number of domains
72 int nr = 17 ; // Number of points in theta
73 int nt = 7 ; // Number of points in theta
74 int np = 4 ; // Number of points in phi
75
76 double* bornes = new double[nz+1];
77
78 bornes[0] = 0. ;
79 bornes[1] = 2. ;
80 bornes[2] = 3. ;
81 bornes[3] = __infinity ;
82
83 int typ_t = SYM ;
84
85 int typ_p = NONSYM ;
86
87
88 //-----------------------------------------------------------------------
89 // Construction of a multi-grid
90 //-----------------------------------------------------------------------
91
92 Mg3d mg(nz, nr, nt, np, typ_t, typ_p, true) ;
93
94 cout << endl << "Grid mg : " << mg << endl ;
95
96 //-------------------------------------------
97 // Construction of a mapping of class Map_et
98 //-------------------------------------------
99
100 Map_et mp(mg, bornes) ;
101
102 // Cleaning
103 // --------
104
105 delete [] bornes ;
106
107 cout << mp << endl ;
108
109 //-----------------------------------------------------------------------
110 // Construction of an EOS
111 //-----------------------------------------------------------------------
112
113 double gamma = 2. ;
114 double kappa = 0.0332 ;
115
116 Eos_poly eos0(gamma, kappa) ;
117
118
119 //-----------------------------------------------------------------------
120 // Construction of a flat metric
121 //-----------------------------------------------------------------------
122
123 Tenseur_sym plat(mp, 2, COV, mp.get_bvect_cart() ) ;
124 plat.set_etat_qcq() ;
125 for (int i=0; i<3; i++) {
126 for (int j=0; j<i; j++) {
127 plat.set(i,j) = 0 ;
128 }
129 plat.set(i,i) = 1 ;
130 }
131 plat.set_std_base() ;
132
133 Metrique flat(plat, true) ;
134
135 //-----------------------------------------------------------------------
136 // Construction of a star
137 //-----------------------------------------------------------------------
138
139 int nzet = nz - 2 ; // Number of domains occupied by the star
140
141 bool relat = true ; // true = relativisitic star
142 bool irrot = true ;
143
144 Et_bin_ncp star(mp, nzet, relat, eos0, irrot, mp.get_bvect_cart(),
145 flat) ;
146
147 //-----------------------------------------------------------------------
148 // Initialization of the stellar enthalpy field
149 //-----------------------------------------------------------------------
150
151 Cmp ent0(mp) ;
152
153 double ray = mp.val_r(nzet-1, 1, M_PI/2., 0.) ;
154
155 const Coord& r = mp.r ;
156
157 ent0 = 1 - r*r/(ray*ray) ;
158
159 ent0.annule(nz-1) ;
160 ent0.std_base_scal() ;
161
162 star.set_enthalpy(ent0) ;
163
164 cout << star << endl ;
165
166
167 }
168
169 return EXIT_SUCCESS ;
170
171 }
172