UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
accumulator.hpp
1 /* accumulator.hpp */
2 /* $Id$ */
3 #ifndef __accumulator_hpp
4 #define __accumulator_hpp
5 
6 #ifdef GE_BUILD
7 #include <s2_abstract_db_access.hpp>
8 #include <polycor.hpp>
9 #include <s2_traces_quality.hpp>
10 #include <s2_row_gen.hpp>
11 #else
12 #include <s2proc/s2_abstract_db_access.hpp>
13 #include <s2proc/polycor.hpp>
14 #include <s2proc/s2_traces_quality.hpp>
15 #include <s2proc/s2_row_gen.hpp>
16 #endif
17 
18 typedef std::set<std::pair<int, int> > ROW_IDS;
19 
20 typedef std::map<int, ROW_IDS> STRIDE_ID_MAP;
21 
22 typedef std::map<int, STRIDE_ID_MAP> ID_MAP;
23 
25 {
26 public:
27 
29  S2TracesQuality &TQ,
30  const PSC::PSC_Params &params);
31 
32  ~Accumulator();
33 
34  bool operator()(std::map<int, PSC::ROW> &recv_rows,
35  std::map<int, PSC::ROW> &shot_rows) const;
36 
37 
38 
39 protected:
40 
41  //prepare map of index pairs for rows calculation and formation
42  bool form_index_map(PSC::StMode mode,
43  ID_MAP &shots_pair_ids,
44  ID_MAP &recvs_pair_ids) const;
45 
46  //fill maps of indexes for CSP or CRP seismograms
47  bool append_indexes(PSC::StMode mode,
48  const std::set<int> &outer_ids,
49  const std::set<int> &inner_ids,
50  bool is_outer_nsp,
51  ID_MAP &result_pair_ids) const;
52 
53 
54  //compose and stack rows for statics determination
55  bool stack_rows(PSC::StMode mode,
56  PSC::Direction row_dir,
57  const ID_MAP &pair_map,
58  std::map<int, PSC::ROW> &shot_rows,
59  std::map<int, PSC::ROW> &recv_rows) const;
60 
61 
62  // prepare queue of rows to be calculated and stacked for result sum rows formation
63  // rows_queue contains pairs [stride, row's id]
64  bool prepare_rows_queue(const ID_MAP &pair_map,
65  int stride,
66  const std::map<int, Trace::AmplT>& rows_weights,
67  std::vector<std::pair<int, int> >& rows_queue) const;
68 
69 
70  // construct result rows by formed rows queue
71  bool construct_result_rows(PSC::StMode mode,
72  PSC::Direction row_dir,
73  const ID_MAP &pair_map,
74  const std::vector<std::pair<int, int> >& rows_queue,
75  const std::map<int, Trace::AmplT>& rows_weights,
76  const std::map<int, Trace::AmplT>& offset_weights,
77  const std::map<int, Trace::AmplT>& cmps_weights,
78  PSC::ROW &sum_ccf1_row,
79  PSC::ROW &sum_ccf2_row) const;
80 
81 
82  //calculate row for current stride, in corresponded mode and direction
83  bool calculate_row(PSC::StMode mode,
84  PSC::Direction row_dir,
85  int stride,
86  int row_id,
87  const ROW_IDS& row_traces,
88  PSC::ROW &row) const;
89 
90 
91  // stack pair of rows
92  bool stack_row_pair(PSC::ROW &base_row,
93  PSC::ROW &add_row,
94  Trace &ccf2,
95  bool use_inversion,
96  bool stack) const;
97 
98 
99  //get intersection of rows pair
100  bool get_id_intersection(const ROW_IDS &add_id_pair, const ROW_IDS &base_id_pair, float &intersection) const;
101 
102 
103 
104  // for each stride method accumulate sum rows, calculated by each Statics calculation mode (PSC::StMode),
105  // into integral sum row for result ststics determination
106  bool integrate_rows(const PSC::ROWS_MAP &calculated_rows, std::map<int, PSC::ROW> &result_rows) const;
107 
108  // get base shift for summ row
109  bool get_base_shift(PSC::Direction row_dir, int row_id, int stride, int& shift) const;
110 
111  S2AbstractDBAccess *mp_adba;
112 
113  S2TracesQuality *mp_tq;
114 
115  PSC::PSC_Params m_params;
116 };
117 
118 #endif /* accumulator.hpp */
Definition: s2_abstract_db_access.hpp:15
Definition: accumulator.hpp:24
Definition: trace.hpp:14
Definition: polycor.hpp:19
Definition: s2_traces_quality.hpp:17