11 SurfaceWaveData::SurfaceWaveData()
15 SurfaceWaveData::~SurfaceWaveData()
20 periods(Old.periods), phasevelocities(Old.phasevelocities)
30 phasevelocities.clear();
31 copy(source.periods.begin(), source.periods.end(), back_inserter(
33 copy(source.phasevelocities.begin(), source.phasevelocities.end(),
34 back_inserter(phasevelocities));
40 std::string ending = GetFileExtension(filename);
52 ifstream infile(filename.c_str());
53 double currperiod, currphase, dummy;
55 phasevelocities.clear();
58 infile.getline(line, 255);
61 infile >> dummy >> dummy >> currperiod >> dummy >> currphase;
64 periods.push_back(currperiod);
65 phasevelocities.push_back(currphase);
68 if (periods.empty() || phasevelocities.empty() || periods.size() != phasevelocities.size())
75 ifstream infile(filename.c_str());
76 double currperiod, currphase;
78 phasevelocities.clear();
81 infile >> currperiod >> currphase;
84 periods.push_back(currperiod);
85 phasevelocities.push_back(currphase);
88 if (periods.empty() || phasevelocities.empty() || periods.size() != phasevelocities.size())
95 ofstream outfile(filename.c_str());
96 assert(periods.size() == phasevelocities.size());
97 const unsigned int nelements = periods.size();
98 for (
unsigned int i = 0; i < nelements; ++i)
100 outfile << setw(10) << setprecision(5) << periods.at(i);
101 outfile << setw(10) << setprecision(5) << phasevelocities.at(i);
void ReadSurf96(const std::string &filename)
read data as produced by the computer programs in seismology codes ascii
A class to read, write and store fundamental mode surface wave dispersion data.
SurfaceWaveData & operator=(const SurfaceWaveData &source)
virtual void ReadAscii(const std::string &filename)
Read a file in general ascii format, i.e lines with period velocity each.
virtual void WriteAscii(const std::string &filename) const
Write the data in simple ascii format.
void ReadFile(const std::string &filename)
Read data from file, depending on the extension.
The basic exception class for all errors that arise in gplib.