UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sim_impulse.hpp
1 /* sim_impulse.hpp */
2 /* $Id$ */
3 #ifndef __sim_impulse_hpp
4 #define __sim_impulse_hpp
5 
6 #include <s2proc/trace.hpp>
7 #include <s2proc/sim_service.hpp>
8 
12 namespace sim
13 {
16  {
17  IT_RICKER = 0,
20  };
21 
23  std::string toString(const ImpulseType &it);
24 
28  class Impulse
29  {
30  public:
31 
34  Impulse(const AmplT &gain = 1.): m_gain(gain) {/* nothing to do. */}
35 
36  virtual ~Impulse() {/* nothing to do. */}
37 
40  virtual Impulse* clone() const = 0;
41 
42 
43  virtual void setGain(const AmplT &gain) {m_gain = gain;}
44 
45  virtual const AmplT& gain() const {return m_gain;}
46 
47 
50  virtual AmplT operator()(const TimeT &t) const = 0;
51 
55  virtual ImpulseType type() const = 0;
56 
57  protected:
58 
59  AmplT m_gain;
60  };
61 
62 
66  class RickerImpulse : public Impulse
67  {
68  public:
69 
72  RickerImpulse(const FreqT &i_w, const AmplT &gain = 1.):
73  Impulse(gain), m_w(i_w){/* nothing to do */}
74 
75  virtual ~RickerImpulse()
76  {/* nothing to do. */}
77 
80  virtual Impulse* clone() const;
81 
82  FreqT w() const {return m_w;}
83 
86  virtual AmplT operator()(const TimeT &t) const;
87 
91  virtual ImpulseType type() const {return IT_RICKER;}
92 
93  private:
94 
95  FreqT m_w;
96  };
97 
98 
102  class DiracImpulse : public Impulse
103  {
104  public:
105 
108  DiracImpulse(const TimeT &i_eps, const AmplT &gain = 1.):
109  Impulse(gain), m_eps(i_eps) {/* nothing to do. */}
110 
111  virtual ~DiracImpulse() {/* nothing to do. */}
112 
115  virtual Impulse* clone() const;
116 
119  virtual AmplT operator()(const TimeT &t) const;
120 
124  virtual ImpulseType type() const {return IT_DIRAC;}
125 
126  protected:
127 
128  TimeT m_eps;
129  };
130 
131 
135  class UserImpulse : public Impulse
136  {
137  public:
138 
142  UserImpulse(const Trace &tr, const AmplT &gain = 1.):
143  Impulse(gain), m_tr(tr) {/* nothing to do. */}
144 
145  virtual ~UserImpulse() {/* nothing to do. */}
146 
149  virtual Impulse* clone() const;
150 
154  virtual AmplT operator()(const TimeT &t) const;
155 
159  virtual ImpulseType type() const {return IT_USER;}
160 
161  protected:
162 
164  };
165 
166 }; // simulation namespace
167 
168 #endif /* sim_impulse.hpp */
Definition: sim_impulse.hpp:135
Definition: sim_impulse.hpp:19
virtual ImpulseType type() const
Definition: sim_impulse.hpp:159
virtual Impulse * clone() const
Definition: sim_impulse.hpp:17
virtual ImpulseType type() const =0
virtual ImpulseType type() const
Definition: sim_impulse.hpp:124
UserImpulse(const Trace &tr, const AmplT &gain=1.)
Definition: sim_impulse.hpp:142
virtual AmplT operator()(const TimeT &t) const
Definition: sim_impulse.hpp:18
virtual ImpulseType type() const
Definition: sim_impulse.hpp:91
DiracImpulse(const TimeT &i_eps, const AmplT &gain=1.)
Definition: sim_impulse.hpp:108
RickerImpulse(const FreqT &i_w, const AmplT &gain=1.)
Definition: sim_impulse.hpp:72
std::string toString(const ImpulseType &it)
virtual AmplT operator()(const TimeT &t) const
Definition: trace.hpp:14
Trace m_tr
Definition: sim_impulse.hpp:163
Definition: sim_impulse.hpp:66
bool sim(size_t n, const Trace::AmplT *x, const Trace::AmplT *y, Trace::AmplT &s)
virtual AmplT operator()(const TimeT &t) const =0
Definition: sim_impulse.hpp:28
virtual Impulse * clone() const
Impulse(const AmplT &gain=1.)
Definition: sim_impulse.hpp:34
Definition: sim_impulse.hpp:102
virtual AmplT operator()(const TimeT &t) const
ImpulseType
Definition: sim_impulse.hpp:15
virtual Impulse * clone() const
virtual Impulse * clone() const =0
TimeT m_eps
Definition: sim_impulse.hpp:128
float AmplT
Definition: defines.hpp:17