| 1 |
/* |
| 2 |
* Prepare a file describing a sequence from a list of resformat.d files |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 2005 Francois Limousin |
| 8 |
* Jose Luis Jaramillo |
| 9 |
* |
| 10 |
* This file is part of LORENE. |
| 11 |
* |
| 12 |
* LORENE is free software; you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License version 2 |
| 14 |
* as published by the Free Software Foundation. |
| 15 |
* |
| 16 |
* LORENE is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with LORENE; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
char prepare_seq_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_hor/prepare_seq.C,v 1.10 2014/10/13 08:53:53 j_novak Exp $" ; |
| 28 |
|
| 29 |
/* |
| 30 |
* $Id: prepare_seq.C,v 1.10 2014/10/13 08:53:53 j_novak Exp $ |
| 31 |
* $Log: prepare_seq.C,v $ |
| 32 |
* Revision 1.10 2014/10/13 08:53:53 j_novak |
| 33 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 34 |
* |
| 35 |
* Revision 1.9 2014/10/06 15:09:42 j_novak |
| 36 |
* Modified #include directives to use c++ syntax. |
| 37 |
* |
| 38 |
* Revision 1.8 2007/04/13 15:30:58 f_limousin |
| 39 |
* Lots of improvements, generalisation to an arbitrary state of |
| 40 |
* rotation, implementation of the spatial metric given by Samaya. |
| 41 |
* |
| 42 |
* Revision 1.6 2006/06/29 08:54:52 f_limousin |
| 43 |
* Boundary conditions and grid writen in resformat.dat |
| 44 |
* |
| 45 |
* Revision 1.5 2006/06/28 13:36:52 f_limousin |
| 46 |
* Convergence to a given irreductible mass |
| 47 |
* |
| 48 |
* Revision 1.4 2006/05/24 16:59:08 f_limousin |
| 49 |
* New version |
| 50 |
* |
| 51 |
* Revision 1.2 2005/06/09 16:17:21 f_limousin |
| 52 |
* Many different changes. |
| 53 |
* |
| 54 |
* |
| 55 |
* $Header: /cvsroot/Lorene/Codes/Bin_hor/prepare_seq.C,v 1.10 2014/10/13 08:53:53 j_novak Exp $ |
| 56 |
* |
| 57 |
*/ |
| 58 |
|
| 59 |
// C++ headers |
| 60 |
#include <iostream> |
| 61 |
#include <fstream> |
| 62 |
using namespace std ; |
| 63 |
|
| 64 |
// C headers |
| 65 |
#include <cmath> |
| 66 |
#include <cstdlib> |
| 67 |
|
| 68 |
|
| 69 |
int main() { |
| 70 |
|
| 71 |
ifstream fichlist("list_prepare_seq.d") ; |
| 72 |
if ( !fichlist.good() ) { |
| 73 |
cout << "Problem with opening the file list_prepare_seq.d ! " << endl ; |
| 74 |
abort() ; |
| 75 |
} |
| 76 |
|
| 77 |
ofstream outfich("sequence.dat") ; |
| 78 |
|
| 79 |
outfich << "# Beta omega M_ADM M_Komar M_area J_ADM J_hor M_ADM/M_area J_ADM/M_area2 omega * M_area M_ADM/M_ih J_ADM/M_ih2 omega * M_ih hor-adm adm-smarr hor-smarr " << endl ; |
| 80 |
|
| 81 |
//------------------------------------------------------- |
| 82 |
// Loop of the files seq.d |
| 83 |
//------------------------------------------------------- |
| 84 |
|
| 85 |
char filename[120] ; |
| 86 |
fichlist.getline(filename, 120) ; |
| 87 |
|
| 88 |
while( !fichlist.eof() ) { |
| 89 |
|
| 90 |
cout << filename << endl ; |
| 91 |
if ( (filename[0] != ' ') && (filename[0] != '#') ) { |
| 92 |
|
| 93 |
ifstream infich(filename) ; |
| 94 |
if ( !infich.good() ) { |
| 95 |
cout << "Problem with opening the file " << filename << " ! " |
| 96 |
<< endl ; |
| 97 |
abort() ; |
| 98 |
} |
| 99 |
|
| 100 |
double beta, omega, mass_adm, mass_area, mass_komar ; |
| 101 |
double j_adm, j_hor, madm_area, jadm_area2, omega_marea ; |
| 102 |
double mass_ih1, mass_ih2, mass_ih, j1, j2, omega1, omega2 ; |
| 103 |
double hor_adm, adm_smarr, hor_smarr ; |
| 104 |
|
| 105 |
infich.ignore(1000,'\n') ; // skip first line |
| 106 |
infich.ignore(1000,'\n') ; // skip second line |
| 107 |
infich.ignore(1000,'\n') ; // skip third line |
| 108 |
infich >> beta ; |
| 109 |
infich >> omega ; |
| 110 |
infich >> mass_adm ; |
| 111 |
infich >> mass_komar ; |
| 112 |
infich >> mass_area ; |
| 113 |
infich >> j_adm ; |
| 114 |
infich >> j_hor ; |
| 115 |
infich.ignore(1000,'\n') ; |
| 116 |
infich.ignore(1000,'\n') ; |
| 117 |
infich >> mass_ih1 ; |
| 118 |
infich >> mass_ih2 ; |
| 119 |
infich >> mass_ih ; |
| 120 |
infich >> j1 ; |
| 121 |
infich >> j2 ; |
| 122 |
infich >> omega1 ; |
| 123 |
infich >> omega2 ; |
| 124 |
infich.ignore(1000,'\n') ; |
| 125 |
infich.ignore(1000,'\n') ; |
| 126 |
infich >> madm_area ; |
| 127 |
infich >> jadm_area2 ; |
| 128 |
infich >> omega_marea ; |
| 129 |
infich.ignore(1000,'\n') ; |
| 130 |
infich.ignore(1000,'\n') ; |
| 131 |
infich >> hor_adm ; |
| 132 |
infich >> adm_smarr ; |
| 133 |
infich >> hor_smarr ; |
| 134 |
|
| 135 |
infich.close() ; |
| 136 |
|
| 137 |
// --------------------------------------------------- |
| 138 |
// End of file reading |
| 139 |
// --------------------------------------------------- |
| 140 |
|
| 141 |
cout.precision(8); |
| 142 |
cout << "m_adm = " << mass_adm |
| 143 |
<< " j_adm = " << j_adm |
| 144 |
<< " omega = " << omega |
| 145 |
<< " beta = " << beta ; |
| 146 |
|
| 147 |
|
| 148 |
//----------------------------------------------------- |
| 149 |
// ***** Start of modifiable part ****** |
| 150 |
//----------------------------------------------------- |
| 151 |
|
| 152 |
outfich.setf(ios::scientific) ; |
| 153 |
outfich.precision(8) ; |
| 154 |
outfich << beta << " " ; |
| 155 |
outfich << omega << " " ; |
| 156 |
outfich << mass_adm << " " ; |
| 157 |
outfich << mass_komar << " " ; |
| 158 |
outfich << mass_area << " " ; |
| 159 |
outfich << j_adm << " " ; |
| 160 |
outfich << j_hor << " " ; |
| 161 |
outfich << madm_area << " " ; |
| 162 |
outfich << jadm_area2 << " " ; |
| 163 |
outfich << omega_marea << " " ; |
| 164 |
outfich << mass_adm/mass_ih << " " ; |
| 165 |
outfich << j_adm/mass_ih/mass_ih << " " ; |
| 166 |
outfich << omega*mass_ih << " " ; |
| 167 |
outfich << hor_adm << " " ; |
| 168 |
outfich << adm_smarr << " " ; |
| 169 |
outfich << hor_smarr << endl ; |
| 170 |
|
| 171 |
//----------------------------------------------------- |
| 172 |
// ***** End of modifiable part ***** |
| 173 |
//----------------------------------------------------- |
| 174 |
} |
| 175 |
|
| 176 |
fichlist.getline(filename, 120) ; // next file |
| 177 |
|
| 178 |
} |
| 179 |
|
| 180 |
outfich.close() ; |
| 181 |
|
| 182 |
return 0 ; |
| 183 |
} |