OpendTect  6.6
ranges.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: A.H. Bril
8  Date: 23-10-1996
9  Contents: Ranges
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "gendefs.h"
16 #include "math2.h"
17 #include "ptrman.h"
18 #include "varlenarray.h"
19 
20 
21 
29 template <class T>
31 {
32 public:
33  inline BasicInterval();
34  inline BasicInterval(const T& start,const T& stop);
35  inline BasicInterval<T>& operator=(const BasicInterval<T>&);
36 
37  inline void set(const T& start,const T& stop);
38  inline bool isEqual(const BasicInterval<T>& i,
39  const T& eps) const;
40  inline bool operator==(const BasicInterval<T>&) const;
41  inline bool operator!=(const BasicInterval<T>&) const;
42  inline BasicInterval<T> operator+(const BasicInterval<T>&) const;
43  inline BasicInterval<T>& operator+=(const BasicInterval<T>&);
44  template <class X>
45  const BasicInterval<T>& setFrom(const BasicInterval<X>&);
46 
47  inline T width(bool allowrev=true) const;
48  inline T center() const;
49  inline float getfCenter() const;
50  inline void shift(const T& len);
51  inline void widen(const T& len,bool allowrev=true);
52 
53  inline T atIndex(int,const T& step) const;
54  template <class X>
55  inline int getIndex(const X&,const T& step) const;
56  template <class X>
57  inline float getfIndex(const X&,const T& step) const;
58  template <class X>
59  inline int nearestIndex(const X& x,const T& step) const;
60  template <class X>
61  inline int indexOnOrAfter(X x,const T& step,
62  float eps=1e-5) const;
63  template <class X>
64  inline void limitTo( const BasicInterval<X>& i )
65  { start = i.limitValue(start);
66  stop = i.limitValue(stop); }
67  template <class X>
68  inline X limitValue(const X&) const;
69 
70  template <class X>
71  inline bool overlaps(const BasicInterval<X>&,
72  bool allrev=true) const;
73  template <class X>
74  inline bool includes(const X&, bool allowrev ) const;
75  template <class X>
76  inline bool includes(const BasicInterval<X>&,
77  bool allowrev=true) const;
78  template <class X>
79  inline bool includes(const Interval<X>&,
80  bool allowrev=true) const;
81 
82  template <class X>
83  inline float pos(X val,bool limit=true,
84  bool allowrev=true) const;
87  inline void include(const T&, bool allowrev=true);
88  inline void include(const BasicInterval<T>&,
89  bool allowrev=true);
90 
91  T start;
92  T stop;
93 
94  static BasicInterval<T> udf(){return BasicInterval<T>(mUdf(T),mUdf(T));}
95 
96  inline bool isRev() const { return start > stop; }
97 };
98 
99 
107 template <class T>
108 mClass(Basic) Interval : public BasicInterval<T>
109 {
110 public:
111  inline Interval() : BasicInterval<T>() {}
112  inline virtual ~Interval() {}
113  inline Interval(const T& start,const T& stop);
114  inline Interval(const BasicInterval<T>& b );
115  inline
116  virtual Interval<T>* clone() const;
117 
118  virtual bool inline isUdf() const;
119  virtual void setUdf();
120 
121  inline virtual void scale(const T&);
122 
123  virtual void sort( bool asc=true );
124 
125  virtual bool hasStep() const { return false; }
126  static Interval<T> udf() {return Interval<T>(mUdf(T),mUdf(T));}
127 };
128 
129 
132 
133 
138 template <class T>
139 mClass(Basic) StepInterval : public Interval<T>
140 {
141 public:
142 
143  inline StepInterval();
144  inline StepInterval(const T& start,const T& stop,
145  const T& step);
146  inline StepInterval(const Interval<T>&);
147  inline StepInterval( const StepInterval<T>& si )
148  : Interval<T>(si), step(si.step) {}
150 
151  virtual bool inline isUdf() const;
152  virtual void setUdf();
154  {return StepInterval<T>(mUdf(T),mUdf(T),mUdf(T));}
155 
156  virtual bool hasStep() const { return true; }
157 
158  inline
159  virtual StepInterval<T>* clone() const;
160  inline void set(const T& start,const T& stop,const T& step);
161 
162  template <class X>
164 
165  inline bool isEqual(const StepInterval<T>& i,const T& eps) const;
166  inline bool operator==(const StepInterval<T>&) const;
167  inline bool operator!=(const StepInterval<T>&) const;
168  inline T atIndex(int) const;
169  template <class X>
170  inline int getIndex(const X&) const;
171  template <class X> inline
172  int indexOnOrAfter( X x, float eps ) const;
173  template <class X>
174  bool isPresent(const X&,float eps=1e-5f) const;
175 
176  template <class X>
177  inline float getfIndex(const X&) const;
178  template <class X>
179  inline int nearestIndex(const X&) const;
180  template <class X>
181  inline T snap(const X&) const;
182  template <class X>
183  inline T snap(const X&,int dir) const;
185 
186  inline int nrSteps() const;
187  inline float nrfSteps() const;
188  virtual inline void sort(bool asc=true);
189  inline void scale(const T&);
190  inline T snappedCenter() const;
191 
192  inline bool isCompatible(const StepInterval<T>&,
193  float eps=mDefEps) const;
197  inline T snapStep(const T& inpstep) const;
200  T step;
201 
202 };
203 
204 
206 
207 
212 template <class T>
214 {
215 public:
216  IntervalND( int ndim_ )
217  : ranges (new Interval<T>[ndim_] )
218  , ndim( ndim_ )
219  , isset( false ) {}
220 
221  virtual ~IntervalND() { delete [] ranges; }
222 
223  int nDim() const { return ndim; }
224  bool isSet() const { return isset; }
225 
226  const Interval<T>& getRange(int dim) const { return ranges[dim]; }
227  template <class X> inline
228  void setRange(const X& val);
229  template <class X> inline
230  void setRange(const X& start,const X& stop);
231  template <class X> inline
232  void include(const X& val);
233 
234  template <class X> inline
235  bool includes(const X& val,bool allowrev) const;
236  inline bool intersects(const IntervalND<T>&,
237  bool allowrev) const;
238 
239 protected:
240 
241  int ndim;
243  bool isset;
244 
245 };
246 
247 
248 #include "samplingdata.h"
249 
250 
251 template <class T> template <class X> inline
252 void IntervalND<T>::setRange( const X& val )
253 {
254  for ( int dim=0; dim<ndim; dim++ )
255  ranges[dim].start = ranges[dim].stop = (T) val[dim];
256 
257  isset = true;
258 }
259 
260 
261 
262 template <class T> template <class X> inline
263 void IntervalND<T>::setRange( const X& start, const X& stop)
264 {
265  for ( int dim=0; dim<ndim; dim++ )
266  {
267  ranges[dim].start = start[dim];
268  ranges[dim].stop = stop[dim];
269  }
270 
271  isset = true;
272 }
273 
274 
275 template <class T> template <class X> inline
276 void IntervalND<T>::include( const X& val )
277 {
278 #ifdef __debug__
279  if ( !isset )
280  pErrMsg("Doing include on undefined IntervalND");
281 #endif
282 
283  for ( int dim=0; dim<ndim; dim++ )
284  ranges[dim].include((T) val[dim]);
285 
286  isset = true;
287 }
288 
289 
290 template <class T> template <class X> inline
291 bool IntervalND<T>::includes( const X& val, bool allowrev ) const
292 {
293 #ifdef __debug__
294  if ( !isset )
295  {
296  pErrMsg("Doing includes on undefined IntervalND");
297  return false;
298  }
299 #endif
300 
301  for ( int dim=0; dim<ndim; dim++ )
302  {
303  if ( !ranges[dim].includes(val[dim], allowrev ) )
304  return false;
305  }
306 
307  return true;
308 }
309 
310 
311 template <class T> inline
312 bool IntervalND<T>::intersects( const IntervalND<T>& b, bool allowrev ) const
313 {
314  if ( !isset || !b.isset || ndim!=b.ndim)
315  {
316  pErrMsg("Invalid intersection");
317  return false;
318  }
319 
320  mAllocLargeVarLenArr( T, vector, ndim );
321  mAllocLargeVarLenArr( bool, isstart, ndim );
322  for ( int dim=0; dim<ndim; dim++ )
323  {
324  vector[dim] = ranges[dim].start;
325  isstart[dim] = true;
326  }
327 
328  do
329  {
330  if ( b.includes((T*)vector, allowrev ) )
331  return true;
332 
333  int dim = 0;
334  while ( dim<ndim )
335  {
336  if ( isstart[dim] )
337  {
338  isstart[dim] = false;
339  vector[dim] = ranges[dim].stop;
340  break;
341  }
342  else
343  {
344  isstart[dim] = true;
345  vector[dim] = ranges[dim].start;
346  dim++;
347  }
348  }
349 
350  if ( dim==ndim )
351  break;
352 
353  } while ( true );
354 
355 
356  return false;
357 }
358 
359 
360 template <class T1,class T2>
361 inline void assign( Interval<T1>& i1, const Interval<T2>& i2 )
362 {
363  i1.start = (T1)i2.start;
364  i1.stop = (T1)i2.stop;
366  mDynamicCastGet(const StepInterval<T2>*,si2,&i2)
367  if ( si1 && si2 )
368  si1->step = (T1)si2->step;
369 }
370 
371 
372 template <class T1,class T2>
373 inline void assign( StepInterval<T1>& i1, const StepInterval<T2>& i2 )
374 { i1.start = (T1)i2.start; i1.stop = (T1)i2.stop; i1.step = (T1)i2.step; }
375 
376 
377 
378 // ---------------- BasicInterval ---------------------
379 
380 template <class T>
381 inline BasicInterval<T>&
383 { start = intv.start; stop = intv.stop; return *this; }
384 
385 
386 template <class T> template <class X> inline
387 int BasicInterval<T>::nearestIndex( const X& x, const T& step ) const
388 {
389  return SamplingData<T>( start, step ).nearestIndex( x );
390 }
391 
392 
393 template <class T>
394 template <class X> inline
395 int BasicInterval<T>::indexOnOrAfter( X x, const T& step, float eps ) const
396 {
397  return SamplingData<T>( start, step ).indexOnOrAfter( x, eps );
398 }
399 
400 
401 template <class T> inline BasicInterval<T>::BasicInterval()
402  : start(0), stop(0) {}
403 
404 
405 template <class T> inline
406 BasicInterval<T>::BasicInterval( const T& t1, const T& t2 )
407  : start(t1), stop(t2) {}
408 
409 
410 template <class T> inline
412 { return new Interval<T>( *this ); }
413 
414 
415 template <class T> inline
416 void BasicInterval<T>::set( const T& t1, const T& t2 )
417 { start = t1; stop = t2; }
418 
419 
420 template <class T> inline
421 bool BasicInterval<T>::isEqual( const BasicInterval<T>& i, const T& eps ) const
422 { return mIsEqual(start,i.start,eps) && mIsEqual(stop,i.stop,eps); }
423 
424 
425 template <class T> inline
427 { return start == i.start && stop == i.stop; }
428 
429 
430 template <class T> inline
432 { return ! (i == *this); }
433 
434 
435 template <class T> inline
437 { return Interval<T>(start+i.start, stop+i.stop); }
438 
439 
440 template <class T> inline
442 { start += i.start; stop += i.stop; return *this; }
443 
444 
445 template <class T> template <class X> inline
447 {
448  start = (T)i.start;
449  stop = (T)i.stop;
450  return *this;
451 }
452 
453 
454 template <class T> inline
455 T BasicInterval<T>::width( bool allowrev ) const
456 { return allowrev && isRev() ? start - stop : stop - start; }
457 
458 
459 #define mCenterImpl(func,typ) \
460 template <class T> inline \
461 typ BasicInterval<T>::func() const \
462 { return ((typ)(start+stop))/2; }
463 
464 mCenterImpl(center, T )
465 mCenterImpl(getfCenter, float )
466 
467 #undef mCenterImpl
468 
469 
470 template <class T> inline
471 void BasicInterval<T>::shift( const T& len )
472 { start += len; stop += len; }
473 
474 
475 template <class T> inline
476 void BasicInterval<T>::widen( const T& len, bool allowrev )
477 {
478  if ( allowrev && isRev() )
479  { start += len; stop -= len; }
480  else
481  { start -= len; stop += len; }
482 }
483 
484 
485 template <class T> template <class X> inline
486 bool BasicInterval<T>::includes( const X& t, bool allowrev ) const
487 {
488  return allowrev && isRev()
489  ? t>=stop && start>=t
490  : t>=start && stop>=t;
491 }
492 
493 
494 template <class T> template <class X> inline
495 bool BasicInterval<T>::includes( const BasicInterval<X>& t, bool allowrev )const
496 {
497  return includes( t.start, allowrev ) && includes( t.stop, allowrev );
498 }
499 
500 
501 template <class T> template <class X> inline
502 bool BasicInterval<T>::includes( const Interval<X>& t, bool allowrev ) const
503 {
504  return BasicInterval<T>::includes( static_cast<BasicInterval>( t ));
505 }
506 
507 
508 template <class T> template <class X> inline
509 float BasicInterval<T>::pos( X val, bool limit, bool allowrev ) const
510 {
511  float res = allowrev && isRev()
512  ? (val-stop)/(start-stop)
513  : (val-start)/(stop-start);
514 
515  if ( limit )
516  {
517  if ( res<0 ) res = 0;
518  else if ( res>1 ) res = 1;
519  }
520 
521  return res;
522 }
523 
524 
525 template <class T> template <class X> inline
527  bool allowrev ) const
528 {
529  return includes( t.start, allowrev ) || includes( t.stop, allowrev ) ||
530  t.includes( start, allowrev ) || t.includes( stop, allowrev );
531 }
532 
533 
534 template <class T> inline
535 void BasicInterval<T>::include( const T& i, bool allowrev )
536 {
537  if ( mIsUdf(i) )
538  return;
539  if ( mIsUdf(start) || mIsUdf(stop) )
540  start = stop =i;
541  else if ( allowrev && isRev() )
542  { if ( stop>i ) stop=i; if ( start<i ) start=i; }
543  else
544  { if ( start>i ) start=i; if ( stop<i ) stop=i; }
545 }
546 
547 
548 template <class T> inline
549 void BasicInterval<T>::include( const BasicInterval<T>& i, bool allowrev )
550 { include( i.start, allowrev ); include( i.stop, allowrev ); }
551 
552 
553 template <class T> inline
554 T BasicInterval<T>::atIndex( int idx, const T& step ) const
555 { return start + step * idx; }
556 
557 
558 template <class T> template <class X> inline
559 int BasicInterval<T>::getIndex( const X& t, const T& step ) const
560 { return (int)(( t - start ) / step); }
561 
562 
563 template <class T> template <class X> inline
564 float BasicInterval<T>::getfIndex( const X& t, const T& step ) const
565 { return SamplingData<T>( start, step ).getfIndex( t ); }
566 
567 
568 template <class T> template <class X> inline
570 {
571  const bool isrev = isRev();
572  if ( (!isrev&&t>stop) || (isrev&&t<stop) ) return stop;
573  if ( (!isrev&&t<start) || (isrev&&t>start) ) return start;
574  return t;
575 }
576 
577 
578 // ---------------- Interval ------------------------
579 
580 template <class T> inline
581 Interval<T>::Interval( const T& startval, const T& stopval )
582  : BasicInterval<T>( startval, stopval )
583 {}
584 
585 
586 template <class T> inline
588  : BasicInterval<T>( b )
589 {}
590 
591 
592 template <class T> inline
593 void Interval<T>::sort( bool asc )
594 {
598 }
599 
600 
601 template <class T> inline
602 void Interval<T>::scale( const T& factor )
603 { BasicInterval<T>::start *= factor; BasicInterval<T>::stop *= factor; }
604 
605 
606 template <class T> inline
607 bool Interval<T>::isUdf() const
608 {
610 }
611 
612 
613 template <class T> inline
615 { BasicInterval<T>::set( mUdf(T), mUdf(T) ); }
616 
617 
618 // ---------------- StepInterval --------------------
619 
620 template <class T>
622  : step(1) {}
623 
624 
625 template <class T>
626 StepInterval<T>::StepInterval( const T& t1, const T& t2, const T& t3 )
627  : Interval<T>(t1,t2), step(t3) {}
628 
629 
630 template <class T>
632  : Interval<T>(intv)
633 {
634  step = 1;
635  if ( intv.hasStep() )
636  {
637  mDynamicCastGet(const StepInterval<T>*,sintv,&intv);
638  step = sintv ? sintv->step : 1;
639  }
640 }
641 
642 
643 template <class T>
645 { assign( *this, intv ); return *this; }
646 
647 
648 template <class T> inline
650 { return Interval<T>::isUdf() || mIsUdf(step); }
651 
652 
653 template <class T> inline
655 { Interval<T>::set( mUdf(T), mUdf(T) ); step = mUdf(T); }
656 
657 
658 template <class T> inline
660 { return new StepInterval<T>( *this ); }
661 
662 
663 template <class T> inline
664 void StepInterval<T>::set( const T& t1, const T& t2, const T& t3 )
665 { Interval<T>::set( t1, t2 ); step = t3; }
666 
667 
668 template <class T> inline
669 bool StepInterval<T>::isEqual( const StepInterval<T>& i, const T& eps ) const
670 { return Interval<T>::isEqual(i,eps) && mIsEqual(step,i.step,eps); }
671 
672 
673 template <class T> inline
675 { return Interval<T>::operator==(i) && i.step==step; }
676 
677 
678 template <class T> inline
680 { return ! (i == *this); }
681 
682 
683 template <class T> template <class X> inline
685 {
687  if ( i.hasStep() )
688  step = (T)(((const StepInterval<X>&)i).step);
689 
690  return *this;
691 }
692 
693 
694 template <class T> inline
695 T StepInterval<T>::atIndex( int idx ) const
696 { return Interval<T>::atIndex(idx,step); }
697 
698 
699 template <class T> template <class X> inline
700 int StepInterval<T>::getIndex( const X& t ) const
701 { return Interval<T>::getIndex( t, step ); }
702 
703 
704 template <class T> template <class X> inline
705 float StepInterval<T>::getfIndex( const X& t ) const
706 { return Interval<T>::getfIndex( t, step ); }
707 
708 
709 template <class T> template <class X> inline
710 int StepInterval<T>::indexOnOrAfter( X x, float eps ) const
711 {
712  return Interval<T>::indexOnOrAfter( x, step, eps );
713 }
714 
715 
716 template <class T> template <class X> inline
717 bool StepInterval<T>::isPresent( const X& t, float eps ) const
718 {
719  const float fidx = getfIndex( t );
720  const float snapdiff = std::abs( fidx - int(fidx) );
721  if ( snapdiff > eps )
722  return false;
723 
724  return fidx > -eps && fidx <= nrSteps() + eps;
725 }
726 
727 
728 template <class T> template <class X> inline
729 int StepInterval<T>::nearestIndex( const X& x ) const
730 { return Interval<T>::nearestIndex( x, step ); }
731 
732 
733 template <class T> template <class X> inline
734 T StepInterval<T>::snap( const X& t ) const
735 { return atIndex( nearestIndex(t) ); }
736 
737 
738 template <class T> template <class X> inline
739 T StepInterval<T>::snap( const X& t, int dir ) const
740 {
741  if ( dir==0 )
742  return atIndex( nearestIndex(t) );
743 
744  const float fidx = getfIndex( t );
745  const int idx = mNINT32( dir==-1 ? Math::Floor(fidx) : Math::Ceil(fidx) );
746  return atIndex( idx );
747 }
748 
749 
750 template <class T> inline
751 void StepInterval<T>::sort( bool asc )
752 {
753  Interval<T>::sort(asc);
754  if ( (asc && step < 0) || (!asc && step > 0) )
755  step = -step;
756 }
757 
758 
759 template <class T> inline
760 void StepInterval<T>::scale( const T& factor )
761 {
762  Interval<T>::scale( factor );
763  step *= factor;
764 }
765 
766 
767 template <class T> inline
769 { return snap( Interval<T>::center() ); }
770 
771 
772 template <class T> inline
773 T StepInterval<T>::snapStep( const T& inputstep ) const
774 {
775  const float relstep = (float) inputstep/step;
776  int nrsteps = mNINT32(relstep);
777  if ( nrsteps<1 ) nrsteps = 1;
778  return step*nrsteps;
779 }
780 
781 
782 template <class T> inline
784 {
785  const float w = Interval<T>::width( true );
786  return w/step;
787 }
788 
789 
790 template <class T>
791 inline int StepInterval<T>::nrSteps() const
792 {
793  if ( !step ) return 0;
794  int ret = (((int)this->start) - ((int) this->stop)) / ((int) step);
795  return ret < 0 ? -ret : ret;
796 }
797 
798 
799 #define mDefFNrSteps(typ) \
800 template <> \
801 inline int StepInterval<typ>::nrSteps() const \
802 { \
803  if ( !step ) return 0; \
804  typ ns = ( (start > stop ? start : stop) \
805  - (start > stop ? stop : start) ) \
806  / (step > 0 ? step : -step); \
807  return mNINT32(ns); \
808 }
809 
810 mDefFNrSteps(float)
811 mDefFNrSteps(double)
812 
813 template <class T>
815  float ) const
816 {
817  if ( step>b.step || b.step%step )
818  return false;
819 
820  // const T diff = static_cast<const Interval<T>*>(this)->start - b.start;
821  const T diff = this->start - b.start;
822  return !(diff%step);
823 }
824 
825 
826 #define mDefFltisCompat(typ,releps) \
827 template <> \
828 inline bool StepInterval<typ>::isCompatible( const StepInterval<typ>& b, \
829  float eps ) const \
830 { \
831  const typ castedeps = (typ) eps; \
832  if ( !mIsEqual(step,b.step, castedeps) ) return false; \
833  \
834  typ nrsteps = (start - b.start) / step; \
835  const int nrstepsi = mNINT32( nrsteps ); \
836  if ( !nrstepsi ) \
837  return mIsEqual( start, b.start, \
838  mIsZero(start,releps) ? releps \
839  : start < 0. ? -start * releps \
840  : start * releps );\
841 \
842  typ reldiff = (nrsteps - nrstepsi) / nrsteps; \
843  return ( (reldiff) < (releps) && (reldiff) > (-releps) ); \
844 }
845 
846 mDefFltisCompat(float,1e-5f)
847 mDefFltisCompat(double,1e-10)
848 // Do not change the above releps values as they originate from the types.
849 
Interval::isUdf
virtual bool isUdf() const
Definition: ranges.h:607
Swap
void Swap(T &a, T &b)
Definition: commondefs.h:46
StepInterval::StepInterval
StepInterval()
Definition: ranges.h:621
sKey::X
FixedString X()
Definition: keystrs.h:188
BasicInterval::set
void set(const T &start, const T &stop)
Definition: ranges.h:416
IntervalND::includes
bool includes(const X &val, bool allowrev) const
Definition: ranges.h:291
IntervalND::ndim
int ndim
Definition: ranges.h:241
BasicInterval::width
T width(bool allowrev=true) const
Definition: ranges.h:455
IntervalND::nDim
int nDim() const
Definition: ranges.h:223
mDefFltisCompat
#define mDefFltisCompat(typ, releps)
Definition: ranges.h:826
SampleGate
Interval< int > SampleGate
Definition: ranges.h:130
StepInterval::indexOnOrAfter
int indexOnOrAfter(X x, float eps) const
Definition: ranges.h:710
BasicInterval::indexOnOrAfter
int indexOnOrAfter(X x, const T &step, float eps=1e-5) const
Definition: ranges.h:395
StepInterval::sort
virtual void sort(bool asc=true)
Definition: ranges.h:751
StepInterval::isEqual
bool isEqual(const StepInterval< T > &i, const T &eps) const
Definition: ranges.h:669
BasicInterval::setFrom
const BasicInterval< T > & setFrom(const BasicInterval< X > &)
Definition: ranges.h:446
mIsEqual
#define mIsEqual(x, y, eps)
Definition: commondefs.h:67
BasicInterval::getIndex
int getIndex(const X &, const T &step) const
Definition: ranges.h:559
Interval::Interval
Interval()
Definition: ranges.h:111
mIsUdf
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:289
StepInterval::nrSteps
int nrSteps() const
Definition: ranges.h:791
BasicInterval::shift
void shift(const T &len)
Definition: ranges.h:471
StepInterval::clone
virtual StepInterval< T > * clone() const
Definition: ranges.h:659
Interval::sort
virtual void sort(bool asc=true)
Definition: ranges.h:593
StepInterval::atIndex
T atIndex(int) const
Definition: ranges.h:695
BasicInterval::operator+
BasicInterval< T > operator+(const BasicInterval< T > &) const
Definition: ranges.h:436
Math::Floor
float Floor(float)
samplingdata.h
StepInterval::isUdf
virtual bool isUdf() const
Definition: ranges.h:649
BasicInterval::operator==
bool operator==(const BasicInterval< T > &) const
Definition: ranges.h:426
mDefEps
#define mDefEps
Definition: commondefs.h:71
varlenarray.h
BasicInterval::BasicInterval
BasicInterval()
Definition: ranges.h:401
Interval::clone
virtual Interval< T > * clone() const
Definition: ranges.h:411
StepInterval::isCompatible
bool isCompatible(const StepInterval< T > &, float eps=(1e-10)) const
Definition: ranges.h:814
Interval::~Interval
virtual ~Interval()
Definition: ranges.h:112
IntervalND::ranges
Interval< T > * ranges
Definition: ranges.h:242
mDynamicCastGet
#define mDynamicCastGet(typ, out, in)
Definition: commondefs.h:148
assign
void assign(Interval< T1 > &i1, const Interval< T2 > &i2)
Definition: ranges.h:361
IntervalND::isSet
bool isSet() const
Definition: ranges.h:224
StepInterval::setUdf
virtual void setUdf()
Definition: ranges.h:654
operator==
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:81
mCenterImpl
#define mCenterImpl(func, typ)
Definition: ranges.h:459
IntervalND::getRange
const Interval< T > & getRange(int dim) const
Definition: ranges.h:226
StepInterval::StepInterval
StepInterval(const Interval< T > &)
Definition: ranges.h:631
StepInterval::getIndex
int getIndex(const X &) const
Definition: ranges.h:700
BasicInterval::widen
void widen(const T &len, bool allowrev=true)
Definition: ranges.h:476
BasicInterval::includes
bool includes(const X &, bool allowrev) const
Definition: ranges.h:486
StepInterval::snappedCenter
T snappedCenter() const
Definition: ranges.h:768
StepInterval::setFrom
const StepInterval< T > & setFrom(const Interval< X > &)
Definition: ranges.h:684
BasicInterval::start
T start
Definition: ranges.h:91
IntervalND::setRange
void setRange(const X &val)
Definition: ranges.h:252
StepInterval
Interval with step.
Definition: commontypes.h:32
IntervalND::~IntervalND
virtual ~IntervalND()
Definition: ranges.h:221
ZGate
Interval< float > ZGate
Definition: ranges.h:131
IntervalND
Class to store ranges in N dimensions.
Definition: ranges.h:214
BasicInterval::pos
float pos(X val, bool limit=true, bool allowrev=true) const
Definition: ranges.h:509
BasicInterval::nearestIndex
int nearestIndex(const X &x, const T &step) const
Definition: ranges.h:387
ptrman.h
BasicInterval::overlaps
bool overlaps(const BasicInterval< X > &, bool allrev=true) const
Definition: ranges.h:526
Interval::setUdf
virtual void setUdf()
Definition: ranges.h:614
operator!=
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:90
mClass
#define mClass(module)
Definition: commondefs.h:181
Interval::Interval
Interval(const T &start, const T &stop)
Definition: ranges.h:581
StepInterval::set
void set(const T &start, const T &stop, const T &step)
Definition: ranges.h:664
SamplingData
Holds the fundamental sampling info: start and interval.
Definition: samplingdata.h:22
SamplingData::getfIndex
float getfIndex(FT) const
Definition: samplingdata.h:126
gendefs.h
StepInterval::snap
T snap(const X &) const
Definition: ranges.h:734
BasicInterval::operator!=
bool operator!=(const BasicInterval< T > &) const
Definition: ranges.h:431
BasicInterval::include
void include(const T &, bool allowrev=true)
Definition: ranges.h:535
Interval::Interval
Interval(const BasicInterval< T > &b)
Definition: ranges.h:587
IntervalND::include
void include(const X &val)
Definition: ranges.h:276
StepInterval::operator!=
bool operator!=(const StepInterval< T > &) const
Definition: ranges.h:679
StepInterval::nrfSteps
float nrfSteps() const
Definition: ranges.h:783
pErrMsg
#define pErrMsg(msg)
Usual access point for programmer error messages.
Definition: errmsg.h:37
Conv::set
void set(T &_to, const F &fr)
template based type conversion
Definition: convert.h:27
StepInterval::snap
T snap(const X &, int dir) const
dir=0: nearest; -1: downward, 1: upward
Definition: ranges.h:739
StepInterval::snapStep
T snapStep(const T &inpstep) const
Definition: ranges.h:773
IntervalND::IntervalND
IntervalND(int ndim_)
Definition: ranges.h:216
SamplingData::nearestIndex
int nearestIndex(FT) const
Definition: samplingdata.h:138
StepInterval::StepInterval
StepInterval(const T &start, const T &stop, const T &step)
Definition: ranges.h:626
Interval::hasStep
virtual bool hasStep() const
Definition: ranges.h:125
mAllocLargeVarLenArr
#define mAllocLargeVarLenArr(type, varnm, __size)
Definition: varlenarray.h:30
Math::Ceil
float Ceil(float)
StepInterval::operator=
StepInterval< T > & operator=(const Interval< T > &)
Definition: ranges.h:644
BasicInterval::getfIndex
float getfIndex(const X &, const T &step) const
Definition: ranges.h:564
IntervalND::intersects
bool intersects(const IntervalND< T > &, bool allowrev) const
Definition: ranges.h:312
BasicInterval::udf
static BasicInterval< T > udf()
Definition: ranges.h:94
BasicInterval::operator=
BasicInterval< T > & operator=(const BasicInterval< T > &)
Definition: ranges.h:382
ZSampling
StepInterval< float > ZSampling
Definition: ranges.h:205
SamplingData::indexOnOrAfter
int indexOnOrAfter(FT, float eps=(1e-10)) const
Definition: samplingdata.h:144
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
Interval::udf
static Interval< T > udf()
Definition: ranges.h:126
BasicInterval::stop
T stop
Definition: ranges.h:92
StepInterval::nearestIndex
int nearestIndex(const X &) const
Definition: ranges.h:729
BasicInterval::isEqual
bool isEqual(const BasicInterval< T > &i, const T &eps) const
Definition: ranges.h:421
BasicInterval::atIndex
T atIndex(int, const T &step) const
Definition: ranges.h:554
BasicInterval
Base class for Interval. Has no virtual functions and can hence be used in places where no virtual fu...
Definition: ranges.h:31
IntervalND::isset
bool isset
Definition: ranges.h:243
StepInterval::scale
void scale(const T &)
Definition: ranges.h:760
Interval
Interval of values.
Definition: commontypes.h:30
BasicInterval::operator+=
BasicInterval< T > & operator+=(const BasicInterval< T > &)
Definition: ranges.h:441
mNINT32
#define mNINT32(x)
Definition: commondefs.h:58
BasicInterval::limitTo
void limitTo(const BasicInterval< X > &i)
Definition: ranges.h:64
StepInterval::udf
static StepInterval< T > udf()
Definition: ranges.h:153
math2.h
StepInterval::operator==
bool operator==(const StepInterval< T > &) const
Definition: ranges.h:674
mDefFNrSteps
#define mDefFNrSteps(typ)
Definition: ranges.h:799
StepInterval::isPresent
bool isPresent(const X &, float eps=1e-5f) const
Definition: ranges.h:717
StepInterval::getfIndex
float getfIndex(const X &) const
Definition: ranges.h:705
StepInterval::hasStep
virtual bool hasStep() const
Definition: ranges.h:156
Interval::scale
virtual void scale(const T &)
Definition: ranges.h:602
BasicInterval::limitValue
X limitValue(const X &) const
Definition: ranges.h:569
StepInterval::StepInterval
StepInterval(const StepInterval< T > &si)
Definition: ranges.h:147
StepInterval::step
T step
Definition: ranges.h:200
BasicInterval::isRev
bool isRev() const
Definition: ranges.h:96

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