UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
psc_solver.hpp
1 /* psc_solver.hpp */
2 /* $Id$ */
3 #ifndef __psc_solver_hpp
4 #define __psc_solver_hpp
5 
6 #include <utility>
7 #include <vector>
8 #include <set>
9 #include <string>
10 #include <lapackpp/laslv.h>
11 #include <lapackpp/laexcp.h>
12 
13 #ifdef GE_BUILD
14 #include <wave_field.hpp>
15 #else
16 #include <s2proc/wave_field.hpp>
17 #endif
18 
20 namespace psc
21 {
23  class Solver
24  {
25  public:
26 
28  enum RowType
29  {
32  };
33 
35  struct TimeShift
36  {
37  int id;
39  };
40 
42  struct RowElem
43  {
44  int id1, id2, id3, id4;
47  static bool stride_asc_id1_asc_comp(const RowElem &re1, const RowElem &re2)
48  {
49  int stride1 = abs(re1.id2 - re1.id1);
50  int stride2 = abs(re2.id2 - re2.id1);
51 
52  if (stride1 < stride2)
53  return true;
54  else if (stride1 > stride2)
55  return false;
56  else
57  return (re1.id1 < re2.id1);
58  }
59  };
60 
62  typedef std::vector<RowElem> RowElemVec;
63 
65  typedef std::vector<TimeShift> TimeShifts;
66 
68  struct Params
69  {
71  Params():
73  max_time_shift(-1),
74  max_used_stride(0),
75  remove_trend_flag(true),
77  remove_low_freq_flag(false),
79  ids_range(std::pair<int,int>(0,0))
80  {/* nothing to do */}
81 
85  unsigned int max_used_stride;
91  std::pair<int,int> ids_range;
93  };
94 
95 
97  Solver(const Params &params);
98 
100  virtual ~Solver();
101 
102 
104  bool operator()(const WaveField &row,
105  TimeShifts &time_shifts) const;
106 
108  bool operator()(RowElemVec &row_elem_vec,
109  TimeShifts &time_shifts) const;
110 
112  void setParameters(const Params &params);
113 
115  const Params& getParameters() const;
116 
117 
118  protected:
119 
122 
123 
125  void update_eq_data(const WaveField &row,
126  RowElemVec &row_elem_vec) const;
127 
129  bool determine_statics(const RowElemVec &row_elem_vec,
130  TimeShifts &time_shifts) const;
131 
133  std::set<int> get_row_ids(const RowElemVec &row_elem_vec) const;
134 
136  bool get_eq_row(const RowElem &row_elem, const std::set<int> &ids_set,
137  std::vector<Trace::AmplT> &row_vec, Trace::TimeT &rp_elem) const;
138 
141  bool remove_low_freq(const size_t polynomial_degree, RowElemVec &row_elem_vec) const;
142 
145  bool remove_low_freq(const size_t polynomial_degree,
146  RowElemVec::iterator elem_it1,
147  RowElemVec::iterator elem_it2) const;
148 
151  bool remove_trend(const size_t trend_polynomial_degree, TimeShifts& time_shifts) const;
152 
153 
154  void test_la_to_files(const std::string &matr_fname, const std::string &vec_fname,
155  const LaGenMatDouble &Am, const LaVectorDouble &bv) const;
156  };
157 }; // namespace psc
158 
159 #endif /* psc_solver.hpp */
160 
RowType
Definition: psc_solver.hpp:28
Definition: psc_solver.hpp:68
void setParameters(const Params &params)
Trace::TimeT max_time_shift
Definition: psc_solver.hpp:83
Params m_params
Definition: psc_solver.hpp:121
Definition: psc_solver.hpp:42
RowType row_type
Definition: psc_solver.hpp:82
float TimeT
Definition: trace.hpp:22
std::vector< TimeShift > TimeShifts
Definition: psc_solver.hpp:65
std::pair< int, int > ids_range
Definition: psc_solver.hpp:91
virtual ~Solver()
void update_eq_data(const WaveField &row, RowElemVec &row_elem_vec) const
int id4
Definition: psc_solver.hpp:44
unsigned int max_used_stride
Definition: psc_solver.hpp:85
Definition: psc_solver.hpp:31
bool remove_low_freq(const size_t polynomial_degree, RowElemVec &row_elem_vec) const
Definition: psc_solver.hpp:30
Params()
Definition: psc_solver.hpp:71
const Params & getParameters() const
std::vector< RowElem > RowElemVec
Definition: psc_solver.hpp:62
Definition: psc_solver.hpp:35
Trace::TimeT dt
Definition: psc_solver.hpp:38
Definition: wave_field.hpp:13
bool operator()(const WaveField &row, TimeShifts &time_shifts) const
Trace::TimeT dt
Definition: psc_solver.hpp:45
size_t trend_polynomial_degree
Definition: psc_solver.hpp:88
size_t low_freq_polynomial_degree
Definition: psc_solver.hpp:90
bool get_eq_row(const RowElem &row_elem, const std::set< int > &ids_set, std::vector< Trace::AmplT > &row_vec, Trace::TimeT &rp_elem) const
bool remove_trend(const size_t trend_polynomial_degree, TimeShifts &time_shifts) const
bool remove_low_freq_flag
Definition: psc_solver.hpp:89
Solver(const Params &params)
Definition: psc_solver.hpp:23
bool determine_statics(const RowElemVec &row_elem_vec, TimeShifts &time_shifts) const
bool remove_trend_flag
Definition: psc_solver.hpp:87
int id
Definition: psc_solver.hpp:37
std::set< int > get_row_ids(const RowElemVec &row_elem_vec) const