OpendTect-6_4  6.4
attribprovider.h
Go to the documentation of this file.
1 #ifndef attribprovider_h
2 #define attribprovider_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl
9  Date: 07-10-1999
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "attributeenginemod.h"
16 #include "linekey.h"
17 #include "ranges.h"
18 #include "posinfo2dsurv.h"
19 #include "uistring.h"
20 
21 class BinDataDesc;
23 class SeisMSCProvider;
24 class SeisTrcInfo;
25 namespace Seis { class SelData; }
26 template <class T> class Array2DImpl;
27 
28 #define mMAXDIP 300 * 1e-6
29 #define mMAXDIPSECURE 2000 * 1e-6
30 #define mMAXDIPSECUREDEPTH 6
31 
32 namespace Attrib
33 {
34 
35 class DataHolder;
36 class DataHolderLineBuffer;
37 class Desc;
38 class ProviderTask;
39 
44 mExpClass(AttributeEngine) Provider
45 { mRefCountImpl(Provider);
47 
48  friend class ProviderTask;
49 
50 public:
51 
52  static Provider* create(Desc&,uiString& errmsg);
55  virtual bool isOK() const;
56  bool is2D() const;
57 
58  const Desc& getDesc() const;
59  Desc& getDesc();
60  const DataHolder* getData(const BinID& relpos=BinID(0,0),
61  int idx=0);
62  const DataHolder* getDataDontCompute(const BinID& relpos) const;
63 
64  int nrOutputs() const
65  { return outputinterest_.size(); }
66  void enableOutput(int output,bool yn=true);
67  bool isOutputEnabled(int output) const;
68  void setOutputInterestSize(bool preserve=false);
69  void enableAllOutputs(bool yn=true);
70  virtual void getCompNames(BufferStringSet&) const;
71 
72  virtual bool isSingleTrace() const;
73  virtual bool usesTracePosition() const;
74  virtual void setReqBufStepout(const BinID&,bool wait=false);
75  virtual void setDesBufStepout(const BinID&,bool wait=false);
76  const BinID& getReqBufStepout() const
77  { return reqbufferstepout_; }
78  const BinID& getDesBufStepout() const
79  { return desbufferstepout_; }
80  void setDesiredVolume(const TrcKeyZSampling&);
84  { return desiredvolume_; }
85  void resetDesiredVolume();
86  void setPossibleVolume(const TrcKeyZSampling&);
90  virtual bool getPossibleVolume(int outp,TrcKeyZSampling&);
92  { return possiblevolume_; }
93  int getTotalNrPos(bool);
94  void setCurLineName(const char*);
95  virtual void adjust2DLineStoredVolume();
96  virtual Pos::GeomID getGeomID() const;
97  virtual void setGeomID(Pos::GeomID);
98 
99  virtual int moveToNextTrace(BinID startpos = BinID(-1,-1),
100  bool firstcheck = false);
105  void computeNewStartPos(BinID&);
106  int alignInputs(ObjectSet<Provider>&);
107  int comparePosAndAlign(Provider*,bool,Provider*,
108  bool,bool);
109  void resetMoved();
110  void resetZIntervals();
111 
112  virtual const SeisTrcInfo* getCurrentTrcInfo() const {return curtrcinfo_;}
113  BinID getCurrentPosition() const;
114  virtual bool setCurrentPosition(const BinID&);
115  void updateCurrentInfo();
116  virtual bool needStoredInput() const;
117 
118  void addLocalCompZIntervals(
119  const TypeSet<Interval<int> >&);
120  const TypeSet< Interval<int> >& localCompZIntervals() const;
121 
122  void updateInputReqs(int input=-1);
123  virtual void updateStorageReqs(bool all=false);
124  void setUseSC() { useshortcuts_ = true;}
125  void setSelData(const Seis::SelData*);
126  void setExtraZ(const Interval<float>&);
127  void setNeedInterpol(bool);
128  void setExactZ(const TypeSet<float>&);
129 
130  void computeRefStep();
134  void setRefStep(float step);
135  float getRefStep() const;
136 
137  void computeRefZ0();
141  void setRefZ0(float z0);
142  float getRefZ0() const { return refz0_; }
143 
144  virtual BinID getStepoutStep() const;
145  ObjectSet<Provider>& getInputs() { return inputs_; }
146  BinID getTrcInfoBid() const { return trcinfobid_; }
147  uiString errMsg() const;
148 
149  virtual void initSteering() {}
150  virtual void prepSteeringForStepout(const BinID&) {}
151 
152  virtual bool prepPriorToOutputSetup();
155  virtual void prepPriorToBoundsCalc();
159  virtual void prepareForComputeData();
161  static uiString prepare(Desc&);
165  {}
166 
167  virtual void setRdmPaths(TypeSet<BinID>* truepath,
168  TypeSet<BinID>* snappedpath);
170 
175  virtual void updateCSIfNeeded(TrcKeyZSampling&) const {}
176  virtual bool compDistBetwTrcsStats(bool force=false);
177  float getApplicableCrlDist(bool) const;
178  virtual float getDistBetwTrcs(bool,
179  const char* linenm =0) const;
180  BinID getElementStepout() const;
181 
182 protected:
183 
184  Provider(Desc&);
185  virtual bool checkInpAndParsAtStart();
190  virtual SeisMSCProvider* getMSCProvider(bool&) const;
191  static Provider* internalCreate(Desc&,ObjectSet<Provider>&,
192  bool& issame,uiString&);
196  virtual bool getInputOutput(int input,TypeSet<int>&) const;
200  virtual bool getInputData(const BinID& relpos,int idx);
203  virtual bool preProcCommonToAllThreads(const DataHolder& out,
204  const BinID& relpos)
205  { return true; }
211  virtual bool computeData(const DataHolder& output,
212  const BinID& relpos,
213  int t0,int nrsamples,
214  int threadidx) const = 0;
221  int getDataIndex(int input) const;
224  void fillInputRangesArray(
226  int,const BasicInterval<int>&);
227 
228  // MultiThreading stuff
229  virtual bool allowParallelComputation() const
230  { return false; }
231  virtual bool setNrThreads( int idx ) { return true; }
232  virtual int minTaskSize() const { return 25; }
233  virtual bool finalizeCalculation(bool scs) { return scs; }
238  // DataHolder stuff
239  DataHolder* getDataHolder(const BinID& relpos);
240  void removeDataHolder(const BinID& relpos);
241  void setInput(int input,Provider*);
242  void addParent( Provider* prov ) { parents_+=prov; }
243  virtual BinDataDesc getOutputFormat(int output) const;
244  virtual bool doNotReUseDH() const { return false;}
245 
246  void computeDesInputCube(int inp,int out,
248  bool usestepout=true) const;
253  void setUsedMultTimes();
257  bool isUsedMultTimes() { return isusedmulttimes_; }
258  bool isNew2DLine() const
259  { return prevtrcnr_ > currentbid_.crl(); }
260 
261  virtual const BinID* desStepout(int input,int output) const;
270  virtual const BinID* reqStepout(int input,int output) const;
278  virtual const Interval<float>* desZMargin(int input,int output) const;
291  virtual const Interval<float>* reqZMargin(int input,int output) const;
292  /*<The gate is specified in
293  the depth-unit of the survey (e.g. seconds,
294  feet or meters), and is in addition to
295  the gate specified in reqZSampMargin. The
296  system will supply the attribute with the
297  required gate, and use it to compute the
298  volume that can be computed.
299  \returns the extra gate required on
300  \a input if \a output is going to be
301  computed, or NULL if no extra gate
302  is required. */
303  virtual const Interval<int>* desZSampMargin(int input,int output) const;
315  virtual const Interval<int>* reqZSampMargin(int input,int output) const;
326  virtual bool getZStepStoredData( float& step ) const
327  { return false; }
328  virtual bool getZ0StoredData( float& z0 ) const
329  { return false; }
330 
331  float getInterpolInputValue(const DataHolder&,
332  int inputidx,
333  float zval) const;
334  float getInterpolInputValue(const DataHolder&,
335  int inputidx,float sample,
336  int z0) const;
337  float getInputValue(const DataHolder&,int inputidx,
338  int sampleidx,int z0) const;
339  void setOutputValue(const DataHolder& output,
340  int outputidx,int sampleidx,
341  int z0,float val) const;
342  float getExtraZFromSampPos(float) const;
343  float getExtraZFromSampInterval(int,int) const;
344  virtual bool useInterTrcDist() const;
345  float getZAtSample(int idx) const
346  { return refz0_ + idx*refstep_; }
347 
348  bool zIsTime() const;
349  float zFactor() const;
350  float dipFactor() const;
351  float inlDist() const;
352  float crlDist() const;
353  float lineDist() const;
354  float trcDist() const;
355  float maxSecureDip() const
356  { return (float) (zIsTime() ? mMAXDIPSECURE
357  : mMAXDIPSECUREDEPTH); }
358  void stdPrepSteering(const BinID&);
359 
370  TypeSet<float> exactz_;//only used for outputs which require
371  //data at exact z values not placed
372  //at sample locations
373 
374  ProviderTask* providertask_;
384 
385  float refz0_;
386  float refstep_;
388 
393 
394 public:
395  void setDataUnavailableFlag(bool yn);
396  bool getDataUnavailableFlag() const;
397 };
398 
399 
400 mGlobal(AttributeEngine) int getSteeringIndex( const BinID& );
402 
403 
404 
405 }; // namespace Attrib
406 
407 #define mAttrDefCreateInstance(clss) \
408 Attrib::Provider* clss::createInstance( Attrib::Desc& desc ) \
409 { \
410  clss* res = new clss( desc ); \
411  res->ref(); \
412  if ( !res->isOK() ) \
413  { \
414  res->unRef(); \
415  return 0; \
416  } \
417  \
418  res->unRefNoDelete(); \
419  return res; \
420 }
421 
422 #define mAttrStartInitClass \
423  Attrib::Desc* desc = new Attrib::Desc( attribName()); \
424  desc->ref();
425 
426 #define mAttrStartInitClassWithUpdate \
427  Attrib::Desc* desc = new Attrib::Desc( attribName(), updateDesc ); \
428  desc->ref();
429 
430 #define mAttrStartInitClassWithDescAndDefaultsUpdate \
431  Attrib::Desc* desc = new Attrib::Desc( attribName(), updateDesc,\
432  updateDefaults ); \
433  desc->ref();
434 
435 #define mAttrStartInitClassWithDefaultsUpdate \
436  Attrib::Desc* desc = new Attrib::Desc( attribName(), 0,updateDefaults ); \
437  desc->ref();
438 
439 #define mAttrEndInitClass \
440  Attrib::PF().addDesc( desc, createInstance ); \
441  desc->unRef();
442 
443 #endif
#define mRefCountImpl(ClassName)
Macro to setup a class with destructor for reference counting.
Definition: refcount.h:163
bool isUsedMultTimes()
Definition: attribprovider.h:257
#define mExpClass(module)
Definition: commondefs.h:160
int getSteeringIndex(const BinID &)
For every position there is a single steering index ...?
Summary for a Seismic object.
Definition: segydirectdef.h:23
#define mMAXDIPSECUREDEPTH
Definition: attribprovider.h:30
ObjectSet< Provider > parents_
Definition: attribprovider.h:361
const BinID & getReqBufStepout() const
Definition: attribprovider.h:76
virtual void initSteering()
Definition: attribprovider.h:149
const Seis::SelData * seldata_
Definition: attribprovider.h:379
Interval< float > extraz_
Definition: attribprovider.h:380
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
virtual void updateCSIfNeeded(TrcKeyZSampling &) const
Definition: attribprovider.h:175
int nrOutputs() const
Definition: attribprovider.h:64
#define mGlobal(module)
Definition: commondefs.h:163
bool is2D(GeomType gt)
Definition: seistype.h:34
int prevtrcnr_
Definition: attribprovider.h:377
virtual bool allowParallelComputation() const
Definition: attribprovider.h:229
Definition: i_layout.h:35
BinID reqbufferstepout_
Definition: attribprovider.h:365
const TrcKeyZSampling * getPossibleVolume() const
Definition: attribprovider.h:91
Implementation of Array2D.
Definition: arrayndimpl.h:102
virtual bool getZStepStoredData(float &step) const
Definition: attribprovider.h:326
BinID trcinfobid_
Definition: attribprovider.h:382
SeisDataPack for 2D and 3D seismic data.
Definition: seisdatapack.h:28
ObjectSet< Provider > inputs_
Definition: attribprovider.h:360
float getRefZ0() const
Definition: attribprovider.h:142
Definition: uistring.h:89
ProviderTask * providertask_
Definition: attribprovider.h:374
Set of BufferString objects.
Definition: bufstringset.h:28
TypeSet< float > exactz_
Definition: attribprovider.h:370
#define mMAXDIPSECURE
Definition: attribprovider.h:29
const BinID & getDesBufStepout() const
Definition: attribprovider.h:78
float maxSecureDip() const
Definition: attribprovider.h:355
Attribute DataHolder Line Buffer.
Definition: attriblinebuffer.h:29
void setUseSC()
Definition: attribprovider.h:124
virtual void fillDataPackWithTrc(RegularSeisDataPack *) const
Definition: attribprovider.h:164
TypeSet< Interval< int > > localcomputezintervals_
Definition: attribprovider.h:368
TypeSet< int > outputinterest_
Definition: attribprovider.h:363
bool needinterp_
Definition: attribprovider.h:390
Set of pointers to objects.
Definition: commontypes.h:32
FixedString Desc()
Definition: keystrs.h:62
void addParent(Provider *prov)
Definition: attribprovider.h:242
Set of (small) copyable elements.
Definition: commontypes.h:30
float getZAtSample(int idx) const
Definition: attribprovider.h:345
const TrcKeyZSampling * getDesiredVolume() const
Definition: attribprovider.h:83
Description of an attribute in an Attrib::DescSet. Each attribute has a name (e.g. "Similarity"), a user reference (e.g. "My similarity"), and at least one output. In addition, it may have parameters and inputs. If it has multiple outputs, only one of the outputs are selected.
Definition: attribdesc.h:89
ObjectSet< Provider > allexistingprov_
Definition: attribprovider.h:369
Desc & desc_
Definition: attribprovider.h:362
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
bool useshortcuts_
Definition: attribprovider.h:383
virtual bool getZ0StoredData(float &z0) const
Definition: attribprovider.h:328
float refz0_
Definition: attribprovider.h:385
Information for a seismic trace, AKA trace header info.
Definition: seisinfo.h:27
virtual int minTaskSize() const
Definition: attribprovider.h:232
virtual bool preProcCommonToAllThreads(const DataHolder &out, const BinID &relpos)
Definition: attribprovider.h:203
const SeisTrcInfo * curtrcinfo_
Definition: attribprovider.h:381
contains input (sub-)selection data from a cube or lineset
Definition: seisselection.h:82
bool isNew2DLine() const
Definition: attribprovider.h:258
Index_Type GeomID
Definition: commontypes.h:52
virtual bool doNotReUseDH() const
Definition: attribprovider.h:244
TrcKeyZSampling * desiredvolume_
Definition: attribprovider.h:366
Holds the attribute data.
Definition: attribdataholder.h:43
virtual const SeisTrcInfo * getCurrentTrcInfo() const
Definition: attribprovider.h:112
static uiHor3DInterpol * create(uiParent *)
bool dataunavailableflag_
Definition: attribprovider.h:392
bool alreadymoved_
Definition: attribprovider.h:387
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
virtual void prepSteeringForStepout(const BinID &)
Definition: attribprovider.h:150
DataHolderLineBuffer * linebuffer_
Definition: attribprovider.h:375
uiString errmsg_
Definition: attribprovider.h:391
Pos::GeomID geomid_
Definition: attribprovider.h:378
virtual bool finalizeCalculation(bool scs)
Definition: attribprovider.h:233
Reads seismic data into buffers providing a Moving Virtual Subcube of seismic data.
Definition: seiscubeprov.h:56
Provides the actual output to ...
Definition: attribprovider.h:44
BinID currentbid_
Definition: attribprovider.h:376
ObjectSet< Provider > & getInputs()
Definition: attribprovider.h:145
const char * errMsg() const
Definition: horizontracker.h:61
float refstep_
Definition: attribprovider.h:386
Description of binary data.
Definition: bindatadesc.h:43
BinID desbufferstepout_
Definition: attribprovider.h:364
bool isusedmulttimes_
Definition: attribprovider.h:389
TrcKeyZSampling * possiblevolume_
Definition: attribprovider.h:367
BinID getTrcInfoBid() const
Definition: attribprovider.h:146
virtual bool setNrThreads(int idx)
Definition: attribprovider.h:231
Semblance Attribute.
Definition: attribdataholder.h:25

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