OpendTect-6_4  6.4
welldahobj.h
Go to the documentation of this file.
1 #ifndef welldahobj_h
2 #define welldahobj_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert Bril
9  Date: May 2004
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "wellmod.h"
17 #include "sets.h"
18 #include "namedobj.h"
19 #include "ranges.h"
20 
21 namespace Well
22 {
23 
29 {
30 public:
31 
32  DahObj( const char* nm=0 )
33  : ::NamedObject(nm) {}
34  DahObj( const DahObj& d )
35  : ::NamedObject(d.name())
36  , dah_(d.dah_) {}
38  { dah_.erase(); }
39 
40  inline int size() const { return dah_.size(); }
41  inline float dah(int idx) const { return dah_[idx]; }
42  virtual float value(int idx) const = 0;
43  virtual bool insertAtDah(float dah, float val) = 0;
44  int indexOf(float dah) const;
45  virtual void remove( int idx )
46  { dah_.removeSingle(idx); removeAux(idx); }
47  virtual void setEmpty()
48  { dah_.erase(); eraseAux(); }
49  inline bool isEmpty() const { return size() == 0; }
50  Interval<float> dahRange() const;
52 
53  float dahStep(bool min_else_average) const;
54 
55  void addToDahFrom(int fromidx,float extradah);
56  void removeFromDahFrom(int fromidx,float extradah);
57 
58  void deInterpolate();
60  float* dahArr() { return dah_.arr(); }
61  const float* dahArr() const { return dah_.arr(); }
62 
63 protected:
64 
66 
67  virtual void removeAux(int) = 0;
68  virtual void eraseAux() = 0;
69 };
70 
71 
72 #define mWellDahObjInsertAtDah(dh,v,vals,ascvalonly)\
73 {\
74  if ( mIsUdf(v) ) return false;\
75  const bool ascendingvalonly = (ascvalonly); \
76  if ( dah_.isEmpty() || dh >= dah_[dah_.size()-1] )\
77  {\
78  if ( !dah_.isEmpty() && ascendingvalonly && v <= vals[dah_.size()-1] )\
79  return false;\
80  dah_ += dh; vals += val;\
81  }\
82  if ( dh < dah_[0] )\
83  {\
84  if ( ascendingvalonly && v >= vals[0] )\
85  return false;\
86  dah_.insert( 0, dh ); vals.insert( 0, v );\
87  return true; \
88  }\
89  const int insertidx = indexOf( dh );\
90  if ( insertidx<0 ) return false;\
91  if ( ascendingvalonly && (v <= vals[insertidx] || v >= vals[insertidx+1]) )\
92  return false;\
93  dah_.insert( insertidx+1, dh ); vals.insert( insertidx+1, v );\
94 }
95 
96 
97 
98 }; // namespace Well
99 
100 #endif
#define mExpClass(module)
Definition: commondefs.h:160
DahObj(const DahObj &d)
Definition: welldahobj.h:34
int size() const
Definition: welldahobj.h:40
const float * dahArr() const
Definition: welldahobj.h:61
virtual void setEmpty()
Definition: welldahobj.h:47
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
float dah(int idx) const
Definition: welldahobj.h:41
float * dahArr()
Definition: welldahobj.h:60
Definition: directionalsurvey.h:19
DahObj(const char *nm=0)
Definition: welldahobj.h:32
bool isEmpty() const
Definition: welldahobj.h:49
Depth/Distance along hole object.
Definition: welldahobj.h:28
~DahObj()
Definition: welldahobj.h:37
Object with a name.
Definition: namedobj.h:35
TypeSet< float > dah_
Definition: welldahobj.h:65

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