LISOUSI: Line Source Simulation
applytaper.cc
Go to the documentation of this file.
1 
35 #define TF_LISOUSI_APPLYTAPER_CC_VERSION \
36  "TF_LISOUSI_APPLYTAPER_CC V1.0 "
37 
38 #include "lisousi.h"
39 #include "functions.h"
40 
41 Tseries applytaper(const Tseries::Tcoc& input, const Tseries::Tcoc& taper,
42  const double& factor, const double& dt,
43  const double& offset, const Options& opt)
44 {
45  if (opt.verbose)
46  {
47  cout << " apply taper function"
48  << " with delay: " << dt*int(opt.tapdel/dt) << "s"
49  << endl;
50  }
51  TFXX_debug(opt.debug, "applytaper", "apply taper to time series\n"
52  << " "
53  << "size of series: " << input.size() << "; "
54  << "size of taper: " << taper.size());
55  // calculate taper delay
56  double taperdelay=opt.tapdel;
57  if (opt.tapsloset)
58  {
59  taperdelay=taperdelay<opt.tapslo*offset ? taperdelay : opt.tapslo*offset;
60  }
61  // prepare return value
62  Tseries retval(0,input.size()-1);
63  retval=Tseries::Tvalue(0.);
64  // prepare iterators
65  aff::Browser<Tseries::Tcoc> IT(taper);
66  aff::Browser<Tseries::Tcoc> II(input);
67  aff::Iterator<Tseries> IS(retval);
68  unsigned int i=0;
69  // apply taper
70  while (IT.valid() && IS.valid() && II.valid())
71  {
72  double t=i*dt;
73  (*IS) = (*II) * (*IT) * factor;
74  ++IS;
75  ++II;
76  if (t >= taperdelay) { ++IT; }
77  ++i;
78  }
79  return(retval);
80 }
81 
82 /* ----- END OF lisousi_applytaper.cc ----- */
Ttimeseries::Tseries Tseries
Definition: lisousi.h:71
bool tapsloset
Definition: lisousi.h:119
prototypes and structs for lisousi (prototypes)
double tapdel
Definition: lisousi.h:121
bool debug
Definition: lisousi.h:117
bool verbose
Definition: lisousi.h:117
lisousi functions (prototypes)
Tseries taper
Definition: globaldata.cc:47
double tapslo
Definition: lisousi.h:122
Tseries applytaper(const Tseries::Tcoc &input, const Tseries::Tcoc &taper, const double &factor, const double &dt, const double &offset, const Options &opt)
Definition: applytaper.cc:41