OpendTect-6_4  6.4
seisblocks.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: Apr 2017
9 ________________________________________________________________________
10 
11 */
12 
13 #include "seiscommon.h"
14 #include "filepath.h"
15 #include "ranges.h"
16 #include "datachar.h"
17 #include "zdomain.h"
18 #include "threadlock.h"
19 #include "survgeom3d.h"
20 
21 class DataBuffer;
22 class LinScaler;
23 class SeisTrc;
24 namespace Pos { class IdxPairDataSet; }
25 namespace PosInfo { class CubeData; }
26 template <class T> class DataInterpreter;
27 
28 
29 namespace Seis
30 {
31 
32 mGlobal(Seis) inline const char* sSeismicSubDir() { return "Seismics"; }
33 mGlobal(Seis) inline const char* sInfoFileExtension() { return "info"; }
34 
38 namespace Blocks
39 {
40  typedef short IdxType;
41  typedef unsigned short SzType;
44  typedef unsigned short CoordSysID;
45 
46  // From 7.x, this will be a simple typedef from Survey::Geometry3D
47  mExpClass(Seis) HGeom : public Survey::Geometry3D
48  {
49  public:
50  HGeom(const Survey::Geometry3D&);
51  HGeom(const HGeom&);
52  inline int idx4Inl(int) const;
53  inline int idx4Crl(int) const;
54  inline int idx4Z(float) const;
55  inline int inl4Idx(int) const;
56  inline int crl4Idx(int) const;
57  inline float z4Idx(int) const;
58  void getMapInfo(const IOPar&);
59  void putMapInfo(IOPar&) const;
60  bool isCompatibleWith(const Survey::Geometry&) const;
61  };
62 
63 #define mDefSeisBlockPairClass(clss,typ) \
64 mExpClass(Seis) clss : public std::pair<typ,typ> \
65 { \
66 public: \
67 \
68  inline clss() : std::pair<typ,typ>(0,0) {} \
69  inline clss( typ iidx, typ xidx ) \
70  : std::pair<typ,typ>(iidx,xidx) {} \
71  inline bool operator ==( const clss& oth ) const \
72  { return first == oth.first && second == oth.second; } \
73 \
74  inline typ inl() const { return first; } \
75  inline typ& inl() { return first; } \
76  inline typ crl() const { return second; } \
77  inline typ& crl() { return second; } \
78 }
79 
83 
84 #define mDefSeisBlockTripletClass(clss,typ) \
85 mExpClass(Seis) clss : public H##clss \
86 { \
87 public: \
88  \
89  inline clss() : third(0) {} \
90  inline clss( typ iidx, typ xidx, typ zidx ) \
91  : H##clss(iidx,xidx), third(zidx) {} \
92  inline bool operator ==( const clss& oth ) const \
93  { return H##clss::operator==(oth) \
94  && third == oth.third; } \
95  \
96  inline typ z() const { return third; } \
97  inline typ& z() { return third; } \
98  \
99  typ third; \
100  \
101 }
102 
106 
107 
111 {
112 public:
113 
114  ~Block() {}
115 
116  const GlobIdx& globIdx() const { return globidx_; }
117  const HLocIdx& start() const { return start_; }
118  const Dimensions& dims() const { return dims_; }
119 
120  static IdxType globIdx4Inl(const HGeom&,int inl,SzType inldim);
121  static IdxType globIdx4Crl(const HGeom&,int crl,SzType crldim);
122  static IdxType globIdx4Z(const ZGeom&,float z,SzType zdim);
123  static IdxType locIdx4Inl(const HGeom&,int inl,SzType inldim);
124  static IdxType locIdx4Crl(const HGeom&,int crl,SzType crldim);
125  static IdxType locIdx4Z(const ZGeom&,float z,SzType zdim);
126  static int startInl4GlobIdx(const HGeom&,IdxType,SzType inldim);
127  static int startCrl4GlobIdx(const HGeom&,IdxType,SzType crldim);
128  static float startZ4GlobIdx(const ZGeom&,IdxType,SzType zdim);
129  static int inl4Idxs(const HGeom&,SzType inldim,IdxType globidx,
130  IdxType sampidx);
131  static int crl4Idxs(const HGeom&,SzType crldim,IdxType globidx,
132  IdxType sampidx);
133  static float z4Idxs(const ZGeom&,SzType zdim,IdxType globidx,
134  IdxType loczidx);
135 
136  static Dimensions defDims();
137 
138 protected:
139 
140  Block( const GlobIdx& gidx, const HLocIdx& s,
141  const Dimensions& d )
142  : globidx_(gidx), start_(s), dims_(d) {}
143 
147 
148 };
149 
150 
154 {
155 public:
156 
157  virtual ~Column() {}
158 
159  const HGlobIdx& globIdx() const { return globidx_; }
160  const Dimensions& dims() const { return dims_; }
161  int nrComponents() const { return nrcomps_; }
162 
163 protected:
164 
165  Column( const HGlobIdx& gidx, const Dimensions& d,
166  int nc )
167  : globidx_(gidx), dims_(d), nrcomps_(nc) {}
168 
171  const int nrcomps_;
172 
173 };
174 
175 
179 {
180 public:
181 
183 
184  virtual ~IOClass();
185 
186  virtual const HGeom& hGeom() const { return hgeom_; }
187  const ZGeom& zGeom() const { return zgeom_; }
188  const ZDomain::Def& zDomain() const;
189 
190  const Dimensions& dimensions() const { return dims_; }
191  SzType version() const { return version_; }
192  const char* cubeName() const { return cubename_; }
193  const BufferStringSet& componentNames() const { return compnms_; }
194  FPDataRepType fPRep() const { return fprep_; }
195  const LinScaler* scaler() const { return scaler_; }
196  int nrAuxInfo() const { return auxiops_.size(); }
197  const IOPar& getAuxInfo( int i ) const { return *auxiops_[i]; }
198  DataType dataType() const { return datatype_; }
199 
200  const FilePath& basePath() const { return basepath_; }
201  BufferString infoFileName() const;
202  BufferString dataFileName() const;
203  BufferString overviewFileName() const;
204  static BufferString infoFileNameFor(const char*);
205  static BufferString dataFileNameFor(const char*);
206 
207  static const char* sKeyDataFileExt() { return "blocks"; }
208  static const char* sKeyOvvwFileExt() { return "ovvw"; }
209  static const char* sKeyFileType() { return "Column Cube"; }
210  static const char* sKeySectionPre() { return "Section-"; }
211  static const char* sKeyGenSection() { return "Section-General"; }
212  static const char* sKeyOffSection() { return "Section-Offsets"; }
213  static const char* sKeyPosSection() { return "Section-Positions"; }
214  static const char* sKeySurveyName() { return "Name.Survey"; }
215  static const char* sKeyCubeName() { return "Name.Cube"; }
216  static const char* sKeyFmtVersion() { return "Blocks.Version"; }
217  static const char* sKeyDimensions() { return "Blocks.Max Dimensions"; }
218  static const char* sKeyGlobInlRg() { return "Blocks.Inl ID Range"; }
219  static const char* sKeyGlobCrlRg() { return "Blocks.Crl ID Range"; }
220  static const char* sKeyGlobZRg() { return "Blocks.Z ID Range"; }
221  static const char* sKeyComponents() { return "Components"; }
222  static const char* sKeyDataType() { return "Data Type"; }
223  static const char* sKeyDepthInFeet() { return "Depth in Feet"; }
224 
225 protected:
226 
227  IOClass();
228 
231 
234  ZGeom zgeom_;
236  SzType version_;
240  FPDataRepType fprep_;
243  mutable bool needreset_;
244 
245  Column* findColumn(const HGlobIdx&) const;
246  void addColumn(Column*) const;
247  void clearColumns();
248  static SzType columnHeaderSize(SzType ver);
249 
250 };
251 
252 
253 inline int HGeom::idx4Inl( int inl ) const
254 { return sampling_.hsamp_.lineIdx( inl ); }
255 inline int HGeom::idx4Crl( int crl ) const
256 { return sampling_.hsamp_.trcIdx( crl ); }
257 inline int HGeom::idx4Z( float z ) const
258 { return sampling_.zsamp_.nearestIndex( z ); }
259 inline int HGeom::inl4Idx( int idx ) const
260 { return sampling_.hsamp_.lineID( idx ); }
261 inline int HGeom::crl4Idx( int idx ) const
262 { return sampling_.hsamp_.traceID( idx ); }
263 inline float HGeom::z4Idx( int idx ) const
264 { return sampling_.zsamp_.atIndex( idx ); }
265 
266 
267 } // namespace Blocks
268 
269 
270 } // namespace Seis
const Dimensions dims_
Definition: seisblocks.h:170
#define mExpClass(module)
Definition: commondefs.h:160
static const char * sKeyGenSection()
Definition: seisblocks.h:211
Summary for a Seismic object.
Definition: segydirectdef.h:23
static const char * sKeyOvvwFileExt()
Definition: seisblocks.h:208
unsigned short SzType
Definition: seisblocks.h:41
const GlobIdx globidx_
Definition: seisblocks.h:144
Dimensions dims_
Definition: seisblocks.h:235
FPDataRepType fprep_
Definition: seisblocks.h:240
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
const HLocIdx start_
Definition: seisblocks.h:145
short IdxType
Definition: seisblocks.h:40
#define mGlobal(module)
Definition: commondefs.h:163
SzType version() const
Definition: seisblocks.h:191
const char * cubeName() const
Definition: seisblocks.h:192
int nrComponents() const
Definition: seisblocks.h:161
const ZGeom & zGeom() const
Definition: seisblocks.h:187
#define mDefSeisBlockTripletClass(clss, typ)
Definition: seisblocks.h:84
const BufferStringSet & componentNames() const
Definition: seisblocks.h:193
static const char * sKeyDepthInFeet()
Definition: seisblocks.h:223
static const char * sKeyGlobZRg()
Definition: seisblocks.h:220
const HLocIdx & start() const
Definition: seisblocks.h:117
static const char * sKeyDataFileExt()
Definition: seisblocks.h:207
Definition: seisblocks.h:82
SzType version_
Definition: seisblocks.h:236
Threads::Lock accesslock_
Definition: seisblocks.h:229
Set of BufferString objects.
Definition: bufstringset.h:28
static const char * sKeyFileType()
Definition: seisblocks.h:209
static const char * sKeyOffSection()
Definition: seisblocks.h:212
Data type.
Definition: datainpspec.h:31
static const char * sKeyCubeName()
Definition: seisblocks.h:215
const IOPar & getAuxInfo(int i) const
Definition: seisblocks.h:197
Definition: seisblocks.h:103
const int nrcomps_
Definition: seisblocks.h:171
Byte-level data interpreter.
Definition: cbvswriter.h:22
static const char * sKeyComponents()
Definition: seisblocks.h:221
const HGlobIdx & globIdx() const
Definition: seisblocks.h:159
const Dimensions dims_
Definition: seisblocks.h:146
A sorted set of IdxPairs and associated data buffer.
Definition: posidxpairdataset.h:61
Block(const GlobIdx &gidx, const HLocIdx &s, const Dimensions &d)
Definition: seisblocks.h:140
Column(const HGlobIdx &gidx, const Dimensions &d, int nc)
Definition: seisblocks.h:165
static const char * sKeyDimensions()
Definition: seisblocks.h:217
const Dimensions & dims() const
Definition: seisblocks.h:118
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
virtual const HGeom & hGeom() const
Definition: seisblocks.h:186
Position.
Definition: commontypes.h:42
DataType datatype_
Definition: seisblocks.h:242
LinScaler * scaler_
Definition: seisblocks.h:239
FPDataRepType fPRep() const
Definition: seisblocks.h:194
static const char * sKeyDataType()
Definition: seisblocks.h:222
int nrAuxInfo() const
Definition: seisblocks.h:196
const char * sInfoFileExtension()
Definition: seisblocks.h:33
DataType dataType() const
Definition: seisblocks.h:198
const GlobIdx & globIdx() const
Definition: seisblocks.h:116
Definition: seisblocks.h:47
Raw data array with memory management.
Definition: databuf.h:22
static const char * sKeyPosSection()
Definition: seisblocks.h:213
BufferStringSet compnms_
Definition: seisblocks.h:238
static const char * sKeyFmtVersion()
Definition: seisblocks.h:216
Base class for Reader and Writer. For comments see master branch.
Definition: seisblocks.h:178
Position info, often segmented.
Definition: posinfo.h:40
File pathname tools.
Definition: filepath.h:34
const Dimensions & dimensions() const
Definition: seisblocks.h:190
DataCharacteristics::UserType FPDataRepType
Definition: seisblocks.h:182
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
ObjectSet< IOPar > auxiops_
Definition: seisblocks.h:241
Definition: seisblocks.h:80
Base class for single block.
Definition: seisblocks.h:110
FilePath basepath_
Definition: seisblocks.h:232
const char * sSeismicSubDir()
Definition: seisblocks.h:32
Scaled down survey geometry for an inl/crl geometry.
Definition: survgeom3d.h:28
ZGeom zgeom_
Definition: seisblocks.h:234
Seismic trace.
Definition: seistrc.h:34
unsigned short CoordSysID
Definition: seisblocks.h:44
StepInterval< float > ZGeom
Definition: seisblocks.h:42
BufferString cubename_
Definition: seisblocks.h:237
DataInterpreter< float > DataInterp
Definition: seisblocks.h:43
static const char * sKeySectionPre()
Definition: seisblocks.h:210
static const char * sKeyGlobCrlRg()
Definition: seisblocks.h:219
UserType
Definition: datachar.h:88
#define mDefSeisBlockPairClass(clss, typ)
Definition: seisblocks.h:63
static const char * sKeyGlobInlRg()
Definition: seisblocks.h:218
Definition: survgeom.h:25
Pos::IdxPairDataSet & columns_
Definition: seisblocks.h:230
static const char * sKeySurveyName()
Definition: seisblocks.h:214
Base class for column of blocks.
Definition: seisblocks.h:153
const HGlobIdx globidx_
Definition: seisblocks.h:169
Definition: seisblocks.h:104
const LinScaler * scaler() const
Definition: seisblocks.h:195
HGeom & hgeom_
Definition: seisblocks.h:233
bool needreset_
Definition: seisblocks.h:243
~Block()
Definition: seisblocks.h:114
Definition of z-domain.
Definition: zdomain.h:41
A Geometry which holds trace positions.
Definition: survgeom.h:40
const Dimensions & dims() const
Definition: seisblocks.h:160
virtual ~Column()
Definition: seisblocks.h:157
const FilePath & basePath() const
Definition: seisblocks.h:200
Definition: seisblocks.h:105
Linear scaling.
Definition: scaler.h:55
Definition: seisblocks.h:81

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