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