GPLIB++
SeisTools.h
Go to the documentation of this file.
1 #ifndef SEISTOOLS_H_
2 #define SEISTOOLS_H_
3 
4 #include <algorithm>
5 #include <cassert>
6 #include <boost/bind.hpp>
7 #include <vector>
8 
9 namespace gplib
10  {
11  /** \addtogroup seistools Seismic data analysis and modeling */
12  /* @{ */
13 
14  //! Calculate density from a given S-velocity, the formula is taken from Owen et al. JGR 89,7783-7795 and modified for vs
15  struct CalcDensity
16  {
17  double operator()(const double svel)
18  {
19  return (0.77 + 0.554 * svel);
20  }
21  };
22 
23  struct CalcAngle1 // we compute cos (2phi) to use formula Vapp = Viso + B*cos(2phi)
24  {
25  double operator()(const double phi)
26  {
27  return cos(2.0 * phi *M_PI /180.0);
28  }
29  };
30 
31  struct Pow10 // 10 exp (x)
32  {
33  double operator()(const double Temp2)
34  {
35  return pow(10,Temp2);
36  }
37  };
38 
39  inline void Normalize(std::vector<double> &Trace)
40  {
41  const double maxtrace = *std::max_element(Trace.begin(), Trace.end());
42  assert(std::abs(maxtrace) > 0.0 );
43  const double maxamp = 1. / maxtrace;
44  std::transform(Trace.begin(), Trace.end(), Trace.begin(), boost::bind(
45  std::multiplies<double>(), _1, maxamp));
46  }
47  /* @} */
48  }
49 #endif /*SEISTOOLS_H_*/
double operator()(const double svel)
Definition: SeisTools.h:17
Calculate density from a given S-velocity, the formula is taken from Owen et al. JGR 89...
Definition: SeisTools.h:15
void Normalize(std::vector< double > &Trace)
Definition: SeisTools.h:39
double operator()(const double Temp2)
Definition: SeisTools.h:33
double operator()(const double phi)
Definition: SeisTools.h:25