7 #include <boost/filesystem.hpp>
13 Sdisp96Model::Sdisp96Model() :
27 isSpherical = source.isSpherical;
45 ofstream outfile(filename.c_str());
46 outfile <<
"MODEL" << endl;
48 outfile <<
"ISOTROPIC" << endl;
49 outfile <<
"KGS" << endl;
52 outfile <<
"SPHERICAL EARTH" << endl;
56 outfile <<
"FLAT EARTH" << endl;
58 outfile <<
"1-D" << endl;
59 outfile <<
"CONSTANT VELOCITY" << endl;
60 outfile <<
"LINE08" << endl;
61 outfile <<
"LINE09" << endl;
62 outfile <<
"LINE10" << endl;
63 outfile <<
"LINE11" << endl;
65 <<
"HR VP VS RHO QP QS ETAP ETAS FREFP FREFS"
68 for (
int i = 0; i < nlayers; ++i)
73 outfile << setw(7) << setprecision(3) <<
GetDensities().at(i);
74 outfile << setw(7) << setprecision(3) <<
GetQkappa().at(i);
75 outfile << setw(7) << setprecision(3) <<
GetQmu().at(i);
76 outfile << setw(7) << setprecision(3) <<
GetEta().at(i);
77 outfile << setw(7) << setprecision(3) <<
GetEta().at(i);
78 outfile <<
" 1.0 1.0" << endl;
85 const std::vector<double> periods)
const
88 assert(periods.size() > 0);
89 ofstream runfile(filename.c_str());
90 ofstream periodfile((filename +
".per").c_str());
91 copy(periods.begin(), periods.end(), ostream_iterator<double> (
93 boost::filesystem::path Path(filename);
94 string dirname(filename +
"_dir");
95 runfile <<
"#!/bin/bash" << endl;
96 runfile <<
"mkdir " << dirname << endl;
97 runfile <<
"mv " << filename <<
".* " << dirname << endl;
98 runfile <<
"cd " << dirname << endl;
99 runfile <<
"sprep96 -M " << Path.leaf() <<
".mod" <<
" -R -PARR "
100 << Path.leaf() <<
".per -NMOD 1 2>&1> /dev/null" << endl;
101 runfile <<
"sdisp96 2>&1> /dev/null" << endl;
102 runfile <<
"sdpsrf96 -R -ASC 2>&1> /dev/null" << endl;
103 runfile <<
"cp SDISPR.ASC ../" << filename +
".asc96" << endl;
const trealdata & GetPvVelocities() const
const trealdata & GetSvVelocities() const
A class to store 1D model for calculation of synthetic surface wave data.
This class can write files specific for the synthetic surface wave codes that are part of the compute...
const trealdata & GetQmu() const
std::string GetName() const
SurfaceWaveModel & operator=(const SurfaceWaveModel &source)
virtual void WriteModel(const std::string &filename) const
Write them model to a file so that the forward codes can use it.
virtual void WriteRunFile(const std::string &filename, const std::vector< double > periods) const
Write out a script file that when run creates synthetic data with the name filename+'.asc'.
Sdisp96Model & operator=(const Sdisp96Model &source)
const trealdata & GetDensities() const
const trealdata & GetEta() const
virtual void ReadModel(const std::string &filename)
Read the model from a file.
const trealdata & GetThicknesses() const
const trealdata & GetQkappa() const
void CheckConsistency() const
The basic exception class for all errors that arise in gplib.