Debian Codegraph @

Codes/Bin_BH_mass_diff/init_bh_mdiff.C

raw
1 /*
2 * Main code for computing Misner-Lindquist solution
3 *
4 */
5
6 /*
7 * Copyright (c) 2005 Philippe Grandclement
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 init_bh_mdiff_C[] = "$Header: ";
27
28 /*
29 * $Id: init_bh_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $
30 * $Log: init_bh_mdiff.C,v $
31 * Revision 1.3 2014/10/13 08:53:52 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.2 2014/10/06 15:09:41 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.1 2005/08/29 15:10:19 p_grandclement
38 * Addition of things needed :
39 * 1) For BBH with different masses
40 * 2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
41 * WORKING YET !!!
42 *
43 *
44 * $Header: /cvsroot/Lorene/Codes/Bin_BH_mass_diff/init_bh_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $
45 *
46 */
47
48 #include "headcpp.h"
49
50 //standard
51 #include <cstdlib>
52 #include <cmath>
53
54 // LORENE
55 #include "type_parite.h"
56 #include "nbr_spx.h"
57 #include "proto.h"
58 #include "coord.h"
59 #include "tenseur.h"
60 #include "bhole.h"
61 #include "utilitaires.h"
62 #include "graphique.h"
63
64
65 using namespace Lorene ;
66
67 int main(int argc, char** argv) {
68
69 // Lecture du fichier de parametres :
70 if (argc <2) {
71 cout <<" Passer nom du ficher en arguments SVP !" << endl ;
72 abort() ;
73 }
74 char blabla [119] ;
75 char* name_fich = argv[1] ;
76 ifstream param(name_fich) ;
77
78 double precis, relax, distance ;
79 int nz_un, nz_deux, nbrer, nbret, nbrep ;
80
81 param >> distance ; param.getline(blabla, 120) ;
82 param >> nz_un ; param >> nz_deux ; param.getline(blabla, 120) ;
83 param >> nbrer ; param >> nbret ; param >> nbrep ; param.getline(blabla, 120) ;
84
85 double* bornes_un = new double[nz_un+1] ;
86 for (int i=0 ; i<nz_un ; i++)
87 param >> bornes_un[i] ;
88 bornes_un[nz_un] = __infinity ;
89 param.getline(blabla, 120) ;
90
91 double* bornes_deux = new double[nz_deux+1] ;
92 for (int i=0 ; i<nz_deux ; i++)
93 param >> bornes_deux[i] ;
94 bornes_deux[nz_deux] = __infinity ;
95 param.getline(blabla, 120) ;
96
97 param >> precis ; param.getline(blabla, 120) ;
98 param >> relax ; param.getline(blabla, 120) ;
99
100 param.close() ;
101
102 int symetrie = NONSYM ;
103 // echantillonnage en phi :
104 int* np_un = new int [nz_un] ;
105 for (int l=0 ; l<nz_un ; l++)
106 np_un[l] = nbrep ;
107 int type_p = symetrie ;
108
109 // echantillonnage en theta :
110 int* nt_un = new int [nz_un] ;
111 for (int l=0 ; l<nz_un ; l++)
112 nt_un[l] = nbret ;
113 int type_t = SYM ;
114
115 // echantillonage en r :
116 int* nr_un = new int [nz_un] ;
117 for (int l=0 ; l<nz_un ; l++)
118 nr_un[l] = nbrer ;
119
120 int* type_r_un = new int[nz_un] ;
121 type_r_un[0] = RARE ;
122 for (int l=1 ; l<nz_un-1 ; l++)
123 type_r_un[l] = FIN ;
124 type_r_un[nz_un-1] = UNSURR ;
125
126 Mg3d grille_un (nz_un, nr_un, type_r_un, nt_un, type_t, np_un, type_p) ;
127
128 // echantillonnage en phi :
129 int* np_deux = new int [nz_deux] ;
130 for (int l=0 ; l<nz_deux ; l++)
131 np_deux[l] = nbrep ;
132
133 // echantillonnage en theta :
134 int* nt_deux = new int [nz_deux] ;
135 for (int l=0 ; l<nz_deux ; l++)
136 nt_deux[l] = nbret ;
137
138 // echantillonage en r :
139 int* nr_deux = new int [nz_deux] ;
140 for (int l=0 ; l<nz_deux ; l++)
141 nr_deux[l] = nbrer ;
142
143 int* type_r_deux = new int[nz_deux] ;
144 type_r_deux[0] = RARE ;
145 for (int l=1 ; l<nz_deux-1 ; l++)
146 type_r_deux[l] = FIN ;
147 type_r_deux[nz_deux-1] = UNSURR ;
148
149 Mg3d grille_deux (nz_deux, nr_deux, type_r_deux, nt_deux, type_t, np_deux, type_p) ;
150
151 Map_af mapping_un (grille_un, bornes_un) ;
152 Map_af mapping_deux (grille_deux, bornes_deux) ;
153
154 mapping_un.set_ori (distance/2.,0, 0) ;
155 mapping_deux.set_ori (-distance/2., 0, 0) ;
156 mapping_deux.set_rot_phi (M_PI) ;
157
158 Bhole_binaire bin (mapping_un, mapping_deux) ;
159 bin.set_statiques(precis, relax) ;
160
161 FILE* fich = fopen("statiques.dat", "w") ;
162 grille_un.sauve(fich) ;
163 grille_deux.sauve(fich) ;
164 mapping_un.sauve(fich) ;
165 mapping_deux.sauve(fich) ;
166 bin(1).sauve(fich) ;
167 bin(2).sauve(fich) ;
168 fclose(fich) ;
169
170 delete [] nr_un ;
171 delete [] nt_un ;
172 delete [] np_un ;
173 delete [] type_r_un ;
174 delete [] nr_deux ;
175 delete [] nt_deux ;
176 delete [] np_deux ;
177 delete [] type_r_deux ;
178 delete [] bornes_un ;
179 delete [] bornes_deux ;
180
181 return 0 ;
182 }