6 #include <boost/bind.hpp>
8 #include <boost/filesystem.hpp>
25 std::cout <<
"Read Model " << std::endl;
99 const size_t nlayers = thicknesses.size();
102 assert(thicknesses.size() == nlayers);
103 assert(vp.size() == nlayers);
104 assert(vsapp.size() == nlayers);
105 assert(densities.size() == nlayers);
106 assert(B.size() == nlayers);
107 assert(C.size() == nlayers);
108 assert(phi.size() == nlayers);
109 std::ofstream outfile(filename.c_str());
111 outfile <<
"title" << std::endl;
113 outfile << 0 <<
" " << 50 <<
" " << 1 <<
" " << std::endl;
115 outfile << (nlayers - 1) * 2 + 1 + 14 <<
" " << 3 <<
" " << 5 <<
" "
118 outfile << 0 <<
" " << 13012.20 <<
" " << 11218.76 <<
" " << 3613.67
119 <<
" " << 99999 <<
" " << 85 <<
" " << 6371.00 <<
" " <<
"\n";
120 outfile << 101430 <<
" " << 13010.00 <<
" " << 11217.18 <<
" "
121 << 3612.58 <<
" " << 99999 <<
" " << 85 <<
" " << 6269.57 <<
" "
123 outfile << 1217500 <<
" " << 12703.70 <<
" " << 11002.11 <<
" "
124 << 3452.58 <<
" " << 99999 <<
" " << 85 <<
" " << 5153.50 <<
" "
126 outfile << 1217500 <<
" " << 12139.10 <<
" " << 10288.78 <<
" " << 0.00
127 <<
" " << 99999 <<
" " << 0.0 <<
" " << 5153.50 <<
" " <<
"\n";
128 outfile << 3479500 <<
" " << 9914.50 <<
" " << 7999.83 <<
" " << 0.00
129 <<
" " << 99999 <<
" " << 0.0 <<
" " << 2891.50 <<
" " <<
"\n";
130 outfile << 3479500 <<
" " << 5772.10 <<
" " << 13621.92 <<
" "
131 << 7248.53 <<
" " << 99999 <<
" " << 274.0 <<
" " << 2891.50 <<
" "
133 outfile << 3878500 <<
" " << 5331.30 <<
" " << 13330.80 <<
" "
134 << 7112.86 <<
" " << 99999 <<
" " << 371.8 <<
" " << 2492.50 <<
" "
136 outfile << 4373500 <<
" " << 5102.70 <<
" " << 12771.47 <<
" "
137 << 6898.60 <<
" " << 99999 <<
" " << 414.9 <<
" " << 1997.50 <<
" "
139 outfile << 4868500 <<
" " << 4856.20 <<
" " << 12170.18 <<
" "
140 << 6663.31 <<
" " << 99999 <<
" " << 463.0 <<
" " << 1502.50 <<
" "
142 outfile << 5363500 <<
" " << 4592.60 <<
" " << 11452.03 <<
" "
143 << 6370.39 <<
" " << 99999 <<
" " << 510.2 <<
" " << 1007.50 <<
" "
145 outfile << 5711000 <<
" " << 4238.70 <<
" " << 10775.04 <<
" "
146 << 5947.18 <<
" " << 99999 <<
" " << 549.5 <<
" " << 660.00 <<
" "
148 outfile << 5711000 <<
" " << 3920.10 <<
" " << 10152.58 <<
" "
149 << 5569.85 <<
" " << 99999 <<
" " << 172.9 <<
" " << 660.00 <<
" "
151 outfile << 5961000 <<
" " << 3931.70 <<
" " << 9314.71 <<
" "
152 << 5041.52 <<
" " << 99999 <<
" " << 162.5 <<
" " << 410.00 <<
" "
155 outfile << 5961000 <<
" " << 3467.98 <<
" " << 8435.09 <<
" "
156 << 4870.00 <<
" " << 99999 <<
" " << 140.0 <<
" " << 410.00 <<
" "
163 double currdepth = 0.0;
164 for (
size_t j = 0; j < nlayers - 1; j++)
166 currdepth += thicknesses.at(j);
168 double currdepth_center = (6371 - currdepth) * 1000;
171 outfile << currdepth_center <<
" " << (vs.at(nlayers - 2) * 0.554
172 + 0.77) * 1000 <<
" " << vs.at(nlayers - 2) * 1.80 * 1000 <<
" "
173 << vs.at(nlayers - 2) * 1000.0 <<
" " << 99999 <<
" " << 100 <<
" "
174 << currdepth <<
" " <<
"\n";
179 outfile << currdepth_center <<
" " << densities.at(i) * 1000.0
180 <<
" " << vp.at(i) * 1000 <<
" " << vsapp.at(i) * 1000.0 <<
" "
181 << 99999 <<
" " << 100 <<
" " << currdepth <<
" " <<
"\n";
183 currdepth -= thicknesses.at(i);
185 currdepth_center += thicknesses.at(i) * 1000;
187 outfile << currdepth_center <<
" " << densities.at(i) * 1000.0
188 <<
" " << vp.at(i) * 1000 <<
" " << vsapp.at(i) * 1000.0 <<
" "
189 << 99999 <<
" " << 100 <<
" " << currdepth <<
" " <<
"\n";
197 std::ofstream runfile(filename.c_str());
198 std::ofstream inputfile((filename +
".in").c_str());
199 inputfile <<
"isomodel" <<
" " << std::endl;
200 inputfile <<
"output" <<
" " << std::endl;
201 inputfile <<
"phase" <<
" " << std::endl;
203 inputfile << 34 <<
" " << std::endl;
204 inputfile << 14.08 <<
" " << 14.49 <<
" " << 14.92 <<
" " << 15.38
205 <<
" " << 15.87 <<
" " << 16.39 <<
" " << 16.94 <<
" " << 17.54
206 <<
" " << 18.18 <<
" " << 18.86 <<
" " << 19.60 <<
" " << 20.40
207 <<
" " << 21.27 <<
" " << 22.22 <<
" " << 23.25 <<
" " << 24.39
208 <<
" " << 25.64 <<
" " << 27.02 <<
" " << 29.41 <<
" " << 31.25
209 <<
" " << 33.33 <<
" " << 35.71 <<
" " << 38.46 <<
" " << 41.66
210 <<
" " << 45.45 <<
" " << 50. <<
" " << 55.55 <<
" " << 62.50
211 <<
" " << 71.42 <<
" " << 83.33 <<
" " << 100. <<
" " << 125.
212 <<
" " << 166.66 <<
" " << 250. <<
" " << std::endl;
222 boost::filesystem::path Path(filename);
223 std::string dirname(filename +
"_dir");
224 runfile <<
"#!/bin/bash" << std::endl;
225 runfile <<
"mkdir " << dirname << std::endl;
226 runfile <<
"mv " << filename <<
".* " << dirname << std::endl;
227 runfile <<
"cd " << dirname << std::endl;
228 runfile <<
"cp " << Path.leaf() <<
".mod isomodel" << std::endl;
229 runfile <<
"cp " << Path.leaf() <<
".in input" << std::endl;
231 runfile <<
"isoraylC_fund < input 2>&1> /dev/null" << std::endl;
232 runfile <<
"cp �MXAe ../" << filename +
".cvel" << std::endl;
243 std::ofstream outfile(filename.c_str());
244 const size_t nlayers = thicknesses.size();
245 outfile << 3613.67 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 6371.00
247 outfile << 3612.58 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 6269.57
249 outfile << 3452.58 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 5153.50
251 outfile << 0.00 <<
" " << 0 <<
" " << 0 <<
" " << 5153.50 <<
" "
253 outfile << 0.00 <<
" " << 0 <<
" " << 0 <<
" " << 2891.50 <<
" "
255 outfile << 7248.53 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 2891.50
257 outfile << 7112.86 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 2492.50
259 outfile << 6898.60 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 1997.50
261 outfile << 6663.31 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 1502.50
263 outfile << 6370.39 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 1007.50
265 outfile << 5947.18 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 660.00
267 outfile << 5569.85 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 660.00
269 outfile << 5041.52 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 410.00
271 outfile << 4870.00 / 1000 <<
" " << 0 <<
" " << 0 <<
" " << 410.00
276 double currdepth = 0.0;
277 for (j = 0; j < nlayers - 1; j++)
279 currdepth += thicknesses.at(j);
281 double currdepth_center = (6371 - currdepth) * 1000;
284 outfile << vs.at(nlayers - 2) <<
" " << 0 <<
" " << 0 <<
" "
285 << currdepth <<
" " <<
"\n";
289 outfile << vs.at(i) <<
" " << B.at(i) <<
" " << phi.at(i) <<
" "
290 << currdepth <<
" " <<
"\n";
292 currdepth -= thicknesses.at(i);
294 currdepth_center += thicknesses.at(i) * 1000;
296 outfile << vs.at(i) <<
" " << B.at(i) <<
" " << phi.at(i) <<
" "
297 << currdepth <<
" " <<
"\n";
void WriteModel(const std::string &filename) const
Write the model to a file with name filename.
virtual ~AnisoSurfaceWaveModel()
void ReadModel(const std::string &filename)
Read the model information from an ascii file with name filename.
void WriteRunFile(const std::string &filename) const
Write out a script that computes synthetic data for a model with name filename+.dat.
void WritePlot(const std::string &filename) const
Write out an ascii file for plotting the model with xmgrace.
The basic exception class for all errors that arise in gplib.