GPLIB++
SurfaceWaveSynthetic.cpp
Go to the documentation of this file.
1 #include "SurfaceWaveSynthetic.h"
2 #include <boost/filesystem.hpp>
3 
4 namespace gplib
5  {
7  {
8  }
9 
11  {
12  }
13 
14  void SurfaceWaveSynthetic::PreParallel(const std::string &filename)
15  {
16 
17  Model.WriteRunFile("surf" + filename, calculationperiods);
18  Model.WriteModel("surf" + filename + ".mod");
19  }
20 
22  const std::string &filename)
23  {
24  const std::string fullname = "./surf" + filename;
25  int result = std::system((std::string("bash ")+fullname).c_str());
26  SynthData.ReadSurf96(fullname + ".asc96");
27  boost::filesystem::remove_all(fullname);
28  boost::filesystem::remove_all(fullname + "_dir");
29  return SynthData;
30  }
31 
33  const std::string &filename)
34  {
35  PreParallel(filename);
36  return SafeParallel(filename);
37  }
38  }
void PreParallel(const std::string &filename)
For a parallel execution, these are things that have to be done before any parallel block...
SurfaceWaveData SafeParallel(const std::string &filename)
Operations that are safe to perform in parallel.
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.
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'.
SurfaceWaveData GetSynthData(const std::string &filename)
Perform a complete forward calculation and return the calculated data, not thread safe as it calls Pr...