OpendTect-6_4  6.4
seistrc.h
Go to the documentation of this file.
1 #ifndef seistrc_h
2 #define seistrc_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 10-5-1995
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "seismod.h"
16 #include "seisinfo.h"
17 #include "tracedata.h"
18 #include "datachar.h"
19 #include "valseries.h"
20 #include "mathfunc.h"
21 #include "valseriesinterpol.h"
22 
23 template <class T> class ValueSeriesInterpolator;
24 template <class T> class Array1D;
25 
35 {
36 public:
37 
38  SeisTrc( int ns=0, const DataCharacteristics& dc
40  : intpol_(0)
41  { data_.addComponent(ns,dc); }
42  SeisTrc( const SeisTrc& t )
43  : intpol_(0)
44  { *this = t; }
45  ~SeisTrc();
46  SeisTrc& operator =(const SeisTrc& t);
47  inline bool isEmpty() const { return data_.isEmpty(); }
48 
49  SeisTrcInfo& info() { return info_; }
50  const SeisTrcInfo& info() const { return info_; }
51  TraceData& data() { return data_; }
52  const TraceData& data() const { return data_; }
53  int nrComponents() const { return data_.nrComponents(); }
54 
55  inline void set( int idx, float v, int icomp )
56  { data_.setValue( idx, v, icomp ); }
57  inline float get( int idx, int icomp ) const
58  { return data_.getValue(idx,icomp); }
59  inline float getFirst( int icomp=0 ) const
60  { return isEmpty() ? 0 : get(0,icomp); }
61  inline float getLast( int icomp=0 ) const
62  { return isEmpty() ? 0 : get(size()-1,icomp); }
63 
64  inline int size() const
65  { return data_.size(0); }
66  float getValue(float,int icomp) const;
67 
68  bool isNull(int icomp=-1) const;
69  bool hasUndef(int icomp=-1) const;
70  inline void zero( int icomp=-1 )
71  { data_.zero( icomp ); }
72  void setNrComponents(int,DataCharacteristics::UserType dt
74  bool reSize(int,bool copydata);
75  void copyDataFrom(const SeisTrc&,int icomp=-1,
76  bool forcefloats=false);
78 
79  static const float snapdist;
80 
83  const ValueSeriesInterpolator<float>& interpolator() const;
84  void setInterpolator(ValueSeriesInterpolator<float>*);
86 
87  inline float startPos() const
88  { return info_.sampling.start; }
89  inline float endPos() const
90  { return info_.sampling.atIndex( size()-1 ); }
91  inline StepInterval<float> zRange() const
92  { return StepInterval<float>(startPos(),endPos(),
93  info_.sampling.step ); }
94  inline float samplePos( int idx ) const
95  { return info_.samplePos(idx); }
96  inline int nearestSample( float pos ) const
97  { return info_.nearestSample(pos); }
98  void setStartPos( float p )
99  { info_.sampling.start = p; }
100  inline bool dataPresent( float t ) const
101  { return info_.dataPresent(t,size()); }
102  SampleGate sampleGate(const Interval<float>&,bool check) const;
103 
104  SeisTrc* getRelTrc(const ZGate&,float sr=mUdf(float)) const;
107  SeisTrc* getExtendedTo(const ZGate&,bool usetrcvals=true) const;
111 
112  void convertToFPs(bool preserve_data=true);
113 
114  static const char* sKeyExtTrcToSI()
115  { return "Extend Traces To Survey Z Range"; }
116 
117 protected:
118 
122 
123  bool chkForSpecVal(int icomp,bool isnull) const;
124 
125 private:
126 
127  void cleanUp();
128 
129 };
130 
131 
139 {
140 public:
141 
142  SeisTrcValueSeries( const SeisTrc& t, int c )
143  : trc_(const_cast<SeisTrc&>(t))
144  , icomp_(c) {}
145 
146  void setComponent( int idx ) { icomp_ = idx; }
147  float value( od_int64 idx ) const;
148  bool writable() const { return true; }
149  void setValue( od_int64 idx,float v);
150  float* arr();
151  const float* arr() const;
152 
153  bool copytoArray(Array1D<float>&);
154 
155  inline ValueSeries<float>* clone() const;
156 
157 protected:
158 
159  SeisTrc& trc_;
160  int icomp_;
161 };
162 
171 {
172 public:
173 
174  SeisTrcFunction(const SeisTrc& trc, int icomp)
175  : trc_(trc), icomp_(icomp) {}
176 
177  float getValue( float z ) const { return trc_.getValue(z,icomp_); }
178  float getValue( const float* p ) const { return getValue(*p); }
179 
180 protected:
181 
182  const SeisTrc& trc_;
183  const int icomp_;
184 };
185 
187 { return new SeisTrcValueSeries( trc_, icomp_ ); }
188 
189 #endif
virtual ValueSeries< T > * clone() const =0
Array1D ( Subclass of ArrayND ) is a one dimensional array.
Definition: arraynd.h:101
void zero(int icomp=-1)
Definition: seistrc.h:70
#define mExpClass(module)
Definition: commondefs.h:160
Summary for a Seismic object.
Definition: segydirectdef.h:23
T value(int64_t i) const
Definition: arraynd.h:113
void setStartPos(float p)
Definition: seistrc.h:98
const TraceData & data() const
Definition: seistrc.h:52
Definition: seistrc.h:170
int nrComponents() const
Definition: seistrc.h:53
TraceData & data()
Definition: seistrc.h:51
float samplePos(int idx) const
Definition: seistrc.h:94
const int icomp_
Definition: seistrc.h:183
Definition: seistrc.h:138
SeisTrcInfo info_
Definition: seistrc.h:120
#define od_int64
Definition: plftypes.h:36
int nearestSample(float pos) const
Definition: seistrc.h:96
SeisTrcValueSeries(const SeisTrc &t, int c)
Definition: seistrc.h:142
Mathematical function.
Definition: mathfunc.h:61
bool writable() const
Definition: seistrc.h:148
float startPos() const
Definition: seistrc.h:87
const SeisTrcInfo & info() const
Definition: seistrc.h:50
int icomp_
Definition: seistrc.h:160
SeisTrc(int ns=0, const DataCharacteristics &dc=DataCharacteristics())
Definition: seistrc.h:38
Definition: ptrman.h:79
byte-level data characteristics of stored data.
Definition: datachar.h:37
SeisTrc & trc_
Definition: seistrc.h:159
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
Interface to a series of values.
Definition: odmemory.h:17
float getValue(const float *p) const
Definition: seistrc.h:178
Definition: valseriesinterpol.h:25
SeisTrcFunction(const SeisTrc &trc, int icomp)
Definition: seistrc.h:174
float endPos() const
Definition: seistrc.h:89
bool dataPresent(float t) const
Definition: seistrc.h:100
float getLast(int icomp=0) const
Definition: seistrc.h:61
Information for a seismic trace, AKA trace header info.
Definition: seisinfo.h:27
StepInterval< float > zRange() const
Definition: seistrc.h:91
static const float snapdist
Definition: seistrc.h:79
bool isEmpty() const
Definition: seistrc.h:47
Definition: datachar.h:88
const SeisTrc & trc_
Definition: seistrc.h:182
float getValue(float z) const
Definition: seistrc.h:177
Seismic trace.
Definition: seistrc.h:34
ValueSeries< float > * clone() const
Definition: seistrc.h:186
int size() const
Definition: seistrc.h:64
PtrMan< ValueSeriesInterpolator< float > > intpol_
Definition: seistrc.h:121
UserType
Definition: datachar.h:88
void setValue(int64_t i, T t)
Definition: arraynd.h:115
A set of data buffers and their interpreters.
Definition: tracedata.h:32
bool isEmpty(const NLAModel *mdl)
SeisTrc(const SeisTrc &t)
Definition: seistrc.h:42
static const char * sKeyExtTrcToSI()
Definition: seistrc.h:114
virtual T * arr()
Definition: valseries.h:55
void setComponent(int idx)
Definition: seistrc.h:146
SeisTrcInfo & info()
Definition: seistrc.h:49
TraceData data_
Definition: seistrc.h:119
float getFirst(int icomp=0) const
Definition: seistrc.h:59

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