Debian Codegraph @

Codes/Bin_BH_mass_diff/coal_bh_mdiff.C

raw
1 /*
2 * Main code for computation of binary black hole quasiequilibrium
3 * configurations
4 *
5 *
6 */
7
8 /*
9 * Copyright (c) 2005 Philippe Grandclement
10 *
11 * This file is part of LORENE.
12 *
13 * LORENE is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2
15 * as published by the Free Software Foundation.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28 char coal_bh_mdiff_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_BH_mass_diff/coal_bh_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $" ;
29
30 /*
31 * $Id: coal_bh_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $
32 * $Log: coal_bh_mdiff.C,v $
33 * Revision 1.3 2014/10/13 08:53:52 j_novak
34 * Lorene classes and functions now belong to the namespace Lorene.
35 *
36 * Revision 1.2 2014/10/06 15:09:41 j_novak
37 * Modified #include directives to use c++ syntax.
38 *
39 * Revision 1.1 2005/08/29 15:10:19 p_grandclement
40 * Addition of things needed :
41 * 1) For BBH with different masses
42 * 2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
43 * WORKING YET !!!
44 *
45 * $Header: /cvsroot/Lorene/Codes/Bin_BH_mass_diff/coal_bh_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $
46 *
47 */
48
49
50 #include "headcpp.h"
51
52 //standard
53 #include <cstdlib>
54 #include <cmath>
55
56 // LORENE
57 #include "type_parite.h"
58 #include "nbr_spx.h"
59 #include "proto.h"
60 #include "coord.h"
61 #include "tenseur.h"
62 #include "bhole.h"
63 #include "utilitaires.h"
64 #include "graphique.h"
65
66 using namespace Lorene ;
67
68 int main(int argc, char** argv) {
69 // Lecture du fichier de parametres :
70 if (argc <3) {
71 cout <<" Passer nom des fichiers en arguments SVP !" << endl ;
72 abort() ;
73 }
74
75 char* name_fich = argv[2] ;
76
77 FILE* fich = fopen(name_fich, "r") ;
78 Mg3d grille_un (fich) ;
79 Mg3d grille_deux (fich) ;
80 Map_af map_un (grille_un, fich) ;
81 Map_af map_deux (grille_deux, fich) ;
82 Bhole hole_un (map_un, fich) ;
83 Bhole hole_deux (map_deux, fich) ;
84 fclose(fich) ;
85
86 char blabla [120] ;
87 name_fich = argv[1] ;
88 ifstream param(name_fich) ;
89
90 double precis, relax, search_ome, m1, m2 ;
91 int nbr_ome ;
92
93 param >> m1 ; param >> m2 ; param.getline(blabla, 120) ;
94 param >> search_ome ; param.getline(blabla, 120) ;
95 param >> precis ; param.getline(blabla, 120) ;
96 param >> relax ; param.getline(blabla, 120) ;
97 param >> nbr_ome ; param.getline(blabla, 120) ;
98
99 param.close() ;
100
101 // Le fichier sortie pour la recherche de omega :
102
103 Bhole_binaire bin (map_un, map_deux) ;
104 bin.set(1) = hole_un ;
105 bin.set(2) = hole_deux ;
106 bin.set_omega(0) ;
107 bin.set(1).fait_n_comp (bin(2)) ;
108 bin.set(1).fait_psi_comp (bin(2)) ;
109 bin.set(2).fait_n_comp (bin(1)) ;
110 bin.set(2).fait_psi_comp (bin(1)) ;
111 bin.fait_decouple() ;
112 bin.fait_tkij() ;
113
114 double distance = bin(1).get_mp().get_ori_x() - bin(2).get_mp().get_ori_x() ;
115 cout << "CALCUL AVEC L = " << distance << endl ;
116
117 bin.coal (precis, relax, nbr_ome, search_ome, m1, m2, 1) ;
118
119 char name[20] ;
120 sprintf(name, "bin.dat") ;
121 FILE* fich_sortie = fopen(name, "w") ;
122 grille_un.sauve(fich_sortie) ;
123 grille_deux.sauve(fich_sortie) ;
124 map_un.sauve(fich_sortie) ;
125 map_deux.sauve(fich_sortie) ;
126 bin(1).sauve(fich_sortie) ;
127 bin(2).sauve(fich_sortie) ;
128 fclose(fich_sortie) ;
129
130 return 0 ;
131 }