SeisTools.h
Go to the documentation of this file.00001 #ifndef SEISTOOLS_H_
00002 #define SEISTOOLS_H_
00003
00004 #include <algorithm>
00005 #include <cassert>
00006 #include <boost/bind.hpp>
00007 #include <vector>
00008 namespace gplib
00009 {
00010
00011
00012
00013
00014 struct CalcDensity
00015 {
00016 double operator()(const double svel)
00017 {
00018 return (0.77 + 0.554 * svel);
00019 }
00020 };
00021
00022 inline void Normalize(std::vector<double> &Trace)
00023 {
00024 const double maxtrace = *max_element(Trace.begin(), Trace.end());
00025 assert(std::abs(maxtrace) > 0.0 );
00026 const double maxamp = 1. / maxtrace;
00027 std::transform(Trace.begin(), Trace.end(), Trace.begin(), boost::bind(
00028 std::multiplies<double>(), _1, maxamp));
00029 }
00030
00031 }
00032 #endif