18 ofstream neu(filename.c_str());
20 double sourcethickness = 0;
21 double totalthickness = 0;
25 for (
int i = 0; i < sourceindex; ++i)
34 neu <<
" 6.0 " << setprecision(1) << setiosflags(
36 ios::scientific) <<
" 1" << setw(5) << setfill(
' ')
37 << setprecision(8) <<
GetNpts() / 2 << setw(5) << setfill(
' ')
38 <<
GetNpts() <<
" " << setprecision(3)
39 << setiosflags(ios::fixed) <<
GetDt() << resetiosflags(ios::fixed)
40 << setfill(
' ') << setw(6) << totallayers <<
" 1\n";
43 <<
" 1 1 1 1 1 1 1 1 1 1 0 \n";
45 for (
unsigned int i = 0; i < totallayers; ++i)
47 neu << setprecision(4) << setiosflags(ios::scientific) <<
" "
50 <<
GetQp().at(i) <<
" " <<
GetQs().at(i) << endl;
53 neu <<
" " << sourceindex + 1
55 neu <<
" 0.4000000E+03 1.500000E+00 0\n";
56 neu << setw(5) << setfill(
' ') <<
GetRecDist().size()
57 <<
" 10000.0 30.0 0.4 0.3\n";
58 for (
unsigned int i = 0; i <
GetRecDist().size(); ++i)
59 neu <<
" " << setw(3) << setprecision(3) << setiosflags(ios::fixed
68 ifstream infile(filename.c_str());
72 double SourceDepth, dt;
74 infile.getline(dummy, 255);
75 infile.getline(dummy, 255);
76 infile.getline(dummy, 255);
77 infile >> number >> SourceDepth >> number >> number >> npts >> dt
79 infile.getline(dummy, 255);
80 infile.getline(dummy, 255);
85 for (
int i = 0; i < nlayers; ++i)
90 infile.getline(dummy, 255);
91 infile.getline(dummy, 255);
92 infile >> nstat >> number >> number >> number >> number;
94 for (
int i = 0; i < nstat; ++i)
95 infile >>
SetRecDist().at(i) >> number >> number;
int FindLayer(const double depth)
Returns the index of the layer that correponds to depth in km.
trealdata & SetDensity()
Read-write access to the vector of densities in g/cm^3 in each layer.
double GetSourceDepth() const
Get the depth to the seismic source that generates the wavefield.
virtual void ReadModel(const std::string filename)
Read the model in its native format from a file.
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.
virtual void WriteModel(const std::string filename)
Write the model in its native format to a file.
const trealdata & GetQp() const
Read-only access to the vector of P quality factors for each layer.
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.
void SetNpts(const unsigned int s)
Set the number of points for synthetic seismogram calculation.
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...
void SetSourceDepth(const double s)
Set the depth to the seismic source.
double GetDt() const
Get the time between two samples in s, this is for synthetic forward calculations.
const trealdata & GetSVelocity() const
Read-only access to the vector of S-velocities in km/s in each layer.
void Init(const int nlayers)
Init provides a convenient way to allocate memory in all structures for a given number of layers...
trealdata & SetRecDist()
Read-write access to the vector of receiver distances.
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.
const trealdata & GetRecDist() const
Read-only access to the vector of receiver distances.
void SetDt(const double s)
Set the time between two samples in s, this is for synthetic forward calculations.
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.
const trealdata & GetQs() const
Read-only access to the vector of S quality factors for each layer.