7 #include <boost/cast.hpp>
12 ResPkModel::ResPkModel() :
13 slowness(-1.0), InputWave(PWave)
27 slowness(-1.0), InputWave(PWave)
35 this->slowness = source.slowness;
36 this->InputWave = source.InputWave;
37 copy(source.Strike.begin(), source.Strike.end(), back_inserter(this->Strike));
38 copy(source.Dip.begin(), source.Dip.end(), back_inserter(this->Dip));
46 this->slowness = source.slowness;
47 this->InputWave = source.InputWave;
48 Strike.assign(source.Strike.size(), 0);
49 Dip.assign(source.Dip.size(), 0);
50 copy(source.Strike.begin(), source.Strike.end(), Strike.begin());
51 copy(source.Dip.begin(), source.Dip.end(), Dip.begin());
59 neu.open(filename.c_str());
61 if (Dip.size() != nlayers)
63 Dip.assign(nlayers, 0.0);
65 if (Strike.size() != nlayers)
67 Strike.assign(nlayers, 0.0);
69 neu << setw(3) << nlayers <<
" " << filename << endl;
71 for (
unsigned int i = 0; i < nlayers; ++i)
80 neu << i + 1 << setw(8) << setprecision(4) <<
GetPVelocity().at(i);
81 neu << setw(8) << setprecision(4) <<
GetSVelocity().at(i) << setw(8)
83 neu << setw(8) << setprecision(2) <<
GetThickness().at(i) << setw(8)
84 << setprecision(4) <<
GetQp().at(i);
85 neu << setw(8) << setprecision(4) <<
GetQs().at(i);
86 neu << setw(8) << setprecision(4) <<
GetStrike().at(i) << setw(8)
87 << setprecision(4) <<
GetDip().at(i) <<
" 0.2500" << endl;
94 ifstream infile(filename.c_str());
99 infile.getline(dummy, 255);
104 while (infile.good())
124 const unsigned int mintime = 200;
126 runfile.open(filename.c_str());
127 runfile <<
"#!/bin/bash" << endl;
128 runfile <<
"respknt 2>&1> /dev/null << eof" << endl;
129 runfile << filename +
".mod" << endl;
130 runfile <<
"n" << endl;
131 if (InputWave ==
PWave)
133 runfile <<
"1" << endl;
137 runfile <<
"2" << endl;
139 runfile <<
GetDt() << endl;
141 << max(boost::numeric_cast<unsigned int>((
GetNpts() - 1) *
GetDt()), mintime)
144 runfile <<
"f" << endl;
145 runfile <<
"y" << endl;
146 runfile <<
"eof" << endl;
virtual void ReadModel(const std::string filename)
Read the model in its native format from a file.
virtual void WriteRunFile(const std::string &filename)
Write out a script that performs a forward calculation for the current model.
const trealdata & GetStrike() const
Read-only access to the vector of Strikes in each layer.
trealdata & SetDensity()
Read-write access to the vector of densities in g/cm^3 in each layer.
trealdata & SetStrike()
Read-write access to the vector of Strikes in each layer.
const trealdata & GetDensity() const
Read-only access to the vector of densities in g/cm^3 in each layer.
trealdata & SetQs()
Read-write access to the vector of S quality factors for each layer.
const trealdata & GetQp() const
Read-only access to the vector of P quality factors for each layer.
double GetSlowness() const
Get the slowness in s/km for the synthetic forward calculation.
trealdata & SetThickness()
Read-write access to the vector of thicknesses in km in each layer.
trealdata & SetQp()
Read-write access to the vector of P quality factors for each layer.
trealdata & SetDip()
Read-write access to the vector of Dips in each layer.
trealdata & SetPVelocity()
Read-write access to the vector of P-velocities in km/s in each layer.
The class SeismicModel is the base class for some of the model format for seismic codes...
double GetDt() const
Get the time between two samples in s, this is for synthetic forward calculations.
SeismicModel & operator=(const SeismicModel &source)
const trealdata & GetSVelocity() const
Read-only access to the vector of S-velocities in km/s in each layer.
ResPkModel & operator=(const ResPkModel &source)
void Init(const int nlayers)
Init provides a convenient way to allocate memory in all structures for a given number of layers...
trealdata & SetSVelocity()
Read-write access to the vector of S-velocities in km/s in each layer.
unsigned int GetNpts() const
Get the number of points for synthetic seismogram calculation.
virtual void WriteModel(const std::string filename)
Write the model in its native format to a file.
const trealdata & GetDip() const
Read-only access to the vector of Dips in each layer.
This class stores and writes model for the respktn 1D seismic code that we use for receiver function ...
const trealdata & GetPVelocity() const
Read-only access to the vector of P-velocities in km/s in each layer.
const trealdata & GetThickness() const
Read-only access to the vector of thicknesses in km in each layer.
The basic exception class for all errors that arise in gplib.
const trealdata & GetQs() const
Read-only access to the vector of S quality factors for each layer.