OpendTect  6.3
seisposindexer.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: Nov 2008
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "seisposkey.h"
15 #include "threadlock.h"
16 #include "ranges.h"
17 #include "sets.h"
18 #include "od_iosfwd.h"
19 
20 
21 template <class T> class DataInterpreter;
22 
23 namespace Seis
24 {
25 
27 {
28 public:
29 
31 
32  virtual ~PosKeyList() {}
33  virtual FileIdxType size() const = 0;
34  virtual bool key(FileIdxType,PosKey&) const = 0;
35 
36 };
37 
46 {
47 public:
48 
59 
60 
61  PosIndexer(const PosKeyList&,bool doindex,
62  bool exclude_unreasonable_traces);
64  virtual ~PosIndexer();
65  void setEmpty();
66 
67  bool ioCompressed() const { return iocompressed_;}
68  void setIOCompressed(bool yn=true)
69  { iocompressed_ = yn; }
70 
71  void add(const PosKey&,FileIdxType);
72  void reIndex();
73 
74  inline GeomType geomType() const
75  { return geomTypeOf(is2d_,isps_); }
76  const Interval<KeyIdxType>& inlRange() const { return inlrg_; }
77  const KeyIdxSet& getInls() const { return inls_; }
78  const Interval<KeyIdxType>& crlRange() const { return crlrg_; }
79  const Interval<KeyIdxType>& trcNrRange() const { return crlrg_; }
80  void getCrls(KeyIdxType,KeyIdxSet&) const;
81  const Interval<float>& offsetRange() const { return offsrg_; }
82 
83  FileIdxType nrRejected() const { return nrrejected_; }
84  inline bool validFileIdx( FileIdxType idx ) const
85  { return idx >= 0 && idx < maxfileidx_; }
86  inline FileIdxType maxFileIdx() const { return maxfileidx_; }
87 
88  // -1 = inl not found (or empty in poskey)
89  // -2 crl/trcnr not found
90  FileIdxType findFirst(const BinID&) const;
91  FileIdxType findFirst(KeyIdxType trcnr) const;
92  FileIdxType findFirst(const PosKey&,
93  bool chckoffs=true) const;
95  FileIdxType findOcc(const PosKey&,int occ) const;
97  FileIdxSet findAll(const PosKey&) const;
99 
100  bool dumpTo(od_ostream&) const;
101  bool readFrom(const char* fnm,FileIdxType,bool all,
102  Int32Interpreter* =0,Int64Interpreter* =0,
103  FloatInterpreter* =0);
104 
105 protected:
106 
107  bool readHeader(Int32Interpreter*,Int64Interpreter*,
108  FloatInterpreter*);
109  bool readLine(KeyIdxSet& crls,FileIdxSet&,
110  Int32Interpreter*,Int64Interpreter*) const;
111 
113  Int32Interpreter* int32interp_;
114  Int64Interpreter* int64interp_;
115  FileOffsSet inlfileoffsets_;
116 
118  mutable FileIdxSet curfileidxs_;
119  mutable KeyIdxSet curcrlset_;
120  mutable KeyIdxType curinl_;
121 
122  const PosKeyList& pkl_;
123  const bool is2d_;
124  const bool isps_;
127  KeyIdxSet inls_;
130  FileIdxType maxfileidx_;
131 
135 
138  FileIdxType nrrejected_;
139 
140  bool isReasonable(const BinID&) const;
141  int getFirstIdxs(const BinID&,int&,int&) const;
142  void dumpLineCompressed(od_ostream&,const KeyIdxSet&,
143  const FileIdxSet&) const;
144  bool readLineCompressed(KeyIdxSet&,
145  FileIdxSet&) const;
146 
147 };
148 
149 
150 } // namespace Seis
#define mExpClass(module)
Definition: commondefs.h:157
FileOffsSet inlfileoffsets_
Definition: seisposindexer.h:115
Seismics.
Definition: segydirectdef.h:20
TypeSet< FileIdxType > FileIdxSet
Definition: seisposindexer.h:53
DataInterpreter< od_int64 > Int64Interpreter
Definition: seisposindexer.h:57
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:25
Int64Interpreter * int64interp_
Definition: seisposindexer.h:114
bool readLine(std::istream &, BufferString *b=0, bool *newline_found=0)
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:51
Definition: seisposindexer.h:26
KeyIdxSet::size_type SetIdxType
Definition: seisposindexer.h:51
KeyIdxType curinl_
Definition: seisposindexer.h:120
#define od_int64
Definition: plftypes.h:34
od_int64 od_stream_Pos
Definition: od_iosfwd.h:19
Definition: i_layout.h:33
Int32Interpreter * int32interp_
Definition: seisposindexer.h:113
const bool isps_
Definition: seisposindexer.h:124
DataInterpreter< int > Int32Interpreter
Definition: seisposindexer.h:56
bool validFileIdx(FileIdxType idx) const
Definition: seisposindexer.h:84
FileIdxType maxFileIdx() const
Definition: seisposindexer.h:86
builds an index of a list of positions, making it easy to find a specific position.
Definition: seisposindexer.h:45
od_stream_Pos FileOffsType
Definition: seisposindexer.h:54
Interval< KeyIdxType > crlrg_
Definition: seisposindexer.h:133
PosKeyList::FileIdxType FileIdxType
Definition: seisposindexer.h:52
od_int32 Index_Type
Definition: commontypes.h:29
Index_Type KeyIdxType
Definition: seisposindexer.h:49
const PosKeyList & pkl_
Definition: seisposindexer.h:122
Definition: seisposkey.h:20
GeomType geomType() const
Definition: seisposindexer.h:74
OD class for stream read.
Definition: od_istream.h:23
KeyIdxSet inls_
Definition: seisposindexer.h:127
FileIdxType maxfileidx_
Definition: seisposindexer.h:130
Interval< KeyIdxType > goodcrlrg_
Definition: seisposindexer.h:137
ObjectSet< FileIdxSet > fileidxsets_
Definition: seisposindexer.h:129
Byte-level data interpreter.
Definition: cbvswriter.h:20
bool ioCompressed() const
Definition: seisposindexer.h:67
Set of pointers to objects.
Definition: commontypes.h:28
GeomType
Definition: seistype.h:31
void setIOCompressed(bool yn=true)
Definition: seisposindexer.h:68
I size_type
Definition: typeset.h:29
FileIdxSet curfileidxs_
Definition: seisposindexer.h:118
const Interval< KeyIdxType > & crlRange() const
Definition: seisposindexer.h:78
const Interval< KeyIdxType > & inlRange() const
Definition: seisposindexer.h:76
od_int64 FileIdxType
Definition: seisposindexer.h:30
const Interval< KeyIdxType > & trcNrRange() const
Definition: seisposindexer.h:79
Threads::Lock lock_
Definition: seisposindexer.h:117
od_istream * strm_
Definition: seisposindexer.h:112
bool iocompressed_
Definition: seisposindexer.h:125
bool excludeunreasonable_
Definition: seisposindexer.h:126
TypeSet< FileOffsType > FileOffsSet
Definition: seisposindexer.h:55
const bool is2d_
Definition: seisposindexer.h:123
Interval< KeyIdxType > inlrg_
Definition: seisposindexer.h:132
TypeSet< KeyIdxType > KeyIdxSet
Definition: seisposindexer.h:50
const Interval< float > & offsetRange() const
Definition: seisposindexer.h:81
KeyIdxSet curcrlset_
Definition: seisposindexer.h:119
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:28
Interval< KeyIdxType > goodinlrg_
Definition: seisposindexer.h:136
Interval< float > offsrg_
Definition: seisposindexer.h:134
ObjectSet< KeyIdxSet > crlsets_
Definition: seisposindexer.h:128
virtual ~PosKeyList()
Definition: seisposindexer.h:32
FileIdxType nrRejected() const
Definition: seisposindexer.h:83
DataInterpreter< float > FloatInterpreter
Definition: seisposindexer.h:58
FileIdxType nrrejected_
Definition: seisposindexer.h:138
GeomType geomTypeOf(const char *)
const KeyIdxSet & getInls() const
Definition: seisposindexer.h:77

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017