LISOUSI: Line Source Simulation
filterresponse.cc
Go to the documentation of this file.
1 
35 #define TF_LISOUSI_FILTERRESPONSE_CC_VERSION \
36  "TF_LISOUSI_FILTERRESPONSE_CC V1.0 "
37 
38 #include "lisousi.h"
39 #include "functions.h"
40 
41 /* create a 1/sqrt(t) filter response */
42 Tseries filterresponse(const int& size, const double& dt, const Options& opt)
43 {
44  if (opt.verbose)
45  {
46  cout << " construct 1/sqrt(t); ";
47  if (opt.nointeg)
48  {
49  cout << "tshift: " << opt.tshift << "; "
50  << "tlim: " << opt.tlim << "; "
51  << "tfac: " << opt.tfac << endl;
52  }
53  else
54  {
55  cout << "integshift: " << opt.integshift << " means "
56  << opt.integshift*dt << "s time shift" << endl;
57  }
58  }
59  Tseries retval=Tseries(0,size-1);
60  aff::Iterator<Tseries> I(retval);
61  for (unsigned int i=0; i<retval.size(); ++i)
62  {
63  if (opt.nointeg)
64  {
65  double t=dt*(double(i)+opt.tshift);
66  if (t < (opt.tlim*dt)) { t=opt.tfac*dt; }
67  *I=sqrt(1./t);
68  }
69  else
70  {
71  if (i == 0)
72  {
73  double tref=1.-opt.integshift;
74  *I=2.*sqrt(tref/dt);
75  }
76  else
77  {
78  double tref=(double(i)-opt.integshift);
79  *I=2.*(sqrt(tref+1)-sqrt(tref))/sqrt(dt);
80  }
81  }
82  ++I;
83  }
84  return(retval);
85 }
86 
87 /* ----- END OF lisousi_filterresponse.cc ----- */
Ttimeseries::Tseries Tseries
Definition: lisousi.h:71
prototypes and structs for lisousi (prototypes)
Tseries filterresponse(const int &size, const double &dt, const Options &opt)
double integshift
Definition: lisousi.h:121
double tlim
Definition: lisousi.h:121
bool nointeg
Definition: lisousi.h:119
double tshift
Definition: lisousi.h:121
bool verbose
Definition: lisousi.h:117
double tfac
Definition: lisousi.h:121
lisousi functions (prototypes)