| 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/Isol_hor/prepare_seq.C,v 1.4 2014/10/13 08:53:57 j_novak Exp $" ; |
| 28 |
|
| 29 |
/* |
| 30 |
* $Id: prepare_seq.C,v 1.4 2014/10/13 08:53:57 j_novak Exp $ |
| 31 |
* $Log: prepare_seq.C,v $ |
| 32 |
* Revision 1.4 2014/10/13 08:53:57 j_novak |
| 33 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 34 |
* |
| 35 |
* Revision 1.3 2014/10/06 15:09:45 j_novak |
| 36 |
* Modified #include directives to use c++ syntax. |
| 37 |
* |
| 38 |
* Revision 1.2 2005/09/12 12:34:09 f_limousin |
| 39 |
* Compilation Warning - Change of convention for the angular velocity |
| 40 |
* Add Berlin boundary condition in the case of binary horizons. |
| 41 |
* |
| 42 |
* Revision 1.1 2005/04/06 14:44:45 f_limousin |
| 43 |
* First version |
| 44 |
* |
| 45 |
* |
| 46 |
* $Header: /cvsroot/Lorene/Codes/Isol_hor/prepare_seq.C,v 1.4 2014/10/13 08:53:57 j_novak Exp $ |
| 47 |
* |
| 48 |
*/ |
| 49 |
|
| 50 |
// C++ headers |
| 51 |
#include <iostream> |
| 52 |
#include <fstream> |
| 53 |
using namespace std ; |
| 54 |
|
| 55 |
// C headers |
| 56 |
#include <cmath> |
| 57 |
#include <cstdlib> |
| 58 |
|
| 59 |
int main() { |
| 60 |
|
| 61 |
ifstream fichlist("list_prepare_seq.dat") ; |
| 62 |
if ( !fichlist.good() ) { |
| 63 |
cout << "Problem with opening the file list_prepare_seq.d ! " << endl ; |
| 64 |
abort() ; |
| 65 |
} |
| 66 |
|
| 67 |
ofstream outfich("sequence.dat") ; |
| 68 |
|
| 69 |
outfich << "# M_ADM J_ADM J/M J/M2 Eps_a M_hor J_hor r_hor omega_hor" << endl ; |
| 70 |
|
| 71 |
//------------------------------------------------------- |
| 72 |
// Loop of the files seq.d |
| 73 |
//------------------------------------------------------- |
| 74 |
|
| 75 |
char filename[120] ; |
| 76 |
fichlist.getline(filename, 120) ; |
| 77 |
|
| 78 |
while( !fichlist.eof() ) { |
| 79 |
|
| 80 |
cout << filename << endl ; |
| 81 |
if ( (filename[0] != ' ') && (filename[0] != '#') ) { |
| 82 |
|
| 83 |
ifstream infich(filename) ; |
| 84 |
if ( !infich.good() ) { |
| 85 |
cout << "Problem with opening the file " << filename << " ! " |
| 86 |
<< endl ; |
| 87 |
abort() ; |
| 88 |
} |
| 89 |
|
| 90 |
double ham_constr, mom_constr, r_hor, j_hor, m_hor ; |
| 91 |
double kappa_hor, omega_hor, m_adm, j_adm, jsm, jsm2 ; |
| 92 |
double eps_a, diff_m, diff_j ; |
| 93 |
|
| 94 |
infich.ignore(1000,'\n') ; // skip first line |
| 95 |
infich >> ham_constr ; |
| 96 |
infich >> mom_constr ; |
| 97 |
infich.ignore(1000,'\n') ; |
| 98 |
infich.ignore(1000,'\n') ; |
| 99 |
infich >> r_hor ; |
| 100 |
infich >> j_hor ; |
| 101 |
infich >> m_hor ; |
| 102 |
infich >> kappa_hor ; |
| 103 |
infich >> omega_hor ; |
| 104 |
infich.ignore(1000,'\n') ; |
| 105 |
infich.ignore(1000,'\n') ; |
| 106 |
infich >> m_adm ; |
| 107 |
infich >> j_adm ; |
| 108 |
infich >> jsm ; |
| 109 |
infich >> jsm2 ; |
| 110 |
infich >> eps_a ; |
| 111 |
infich.ignore(1000,'\n') ; |
| 112 |
infich.ignore(1000,'\n') ; |
| 113 |
infich >> diff_m ; |
| 114 |
infich >> diff_j ; |
| 115 |
|
| 116 |
infich.close() ; |
| 117 |
|
| 118 |
// --------------------------------------------------- |
| 119 |
// End of file reading |
| 120 |
// --------------------------------------------------- |
| 121 |
|
| 122 |
cout.precision(8); |
| 123 |
cout << "m_adm = " << ham_constr |
| 124 |
<< " j_adm = " << j_adm |
| 125 |
<< " J/M = " << jsm |
| 126 |
<< " J/M2 = " << jsm2 << endl |
| 127 |
<< "eps_a = " << eps_a |
| 128 |
<< " j_hor = " << j_hor |
| 129 |
<< " m_hor = " << m_hor << endl ; |
| 130 |
|
| 131 |
|
| 132 |
//----------------------------------------------------- |
| 133 |
// ***** Start of modifiable part ****** |
| 134 |
//----------------------------------------------------- |
| 135 |
|
| 136 |
outfich.setf(ios::scientific) ; |
| 137 |
// outfich.width(23) ; |
| 138 |
outfich.precision(8) ; |
| 139 |
outfich << m_adm << " " ; |
| 140 |
outfich << j_adm << " " ; |
| 141 |
outfich << jsm << " " ; |
| 142 |
outfich << jsm2 << " " ; |
| 143 |
outfich << eps_a << " " ; |
| 144 |
outfich << m_hor << " " ; |
| 145 |
outfich << j_hor << " " ; |
| 146 |
outfich << r_hor << " " ; |
| 147 |
outfich << omega_hor << endl ; |
| 148 |
|
| 149 |
//----------------------------------------------------- |
| 150 |
// ***** End of 2nd modifiable part ***** |
| 151 |
//----------------------------------------------------- |
| 152 |
} |
| 153 |
|
| 154 |
fichlist.getline(filename, 120) ; // next file |
| 155 |
|
| 156 |
} |
| 157 |
|
| 158 |
outfich.close() ; |
| 159 |
|
| 160 |
return 0 ; |
| 161 |
} |