OpendTect-6_4  6.4
arrayndimpl.h
Go to the documentation of this file.
1 #ifndef arrayndimpl_h
2 #define arrayndimpl_h
3 /*
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: K. Tingdahl
8  Date: 9-3-1999
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 */
13 
14 
15 #include "arraynd.h"
16 
17 #ifdef __debug__
18 # include "debug.h"
19 #endif
20 
23 template <class T>
25 {
26 protected:
27  virtual od_int64 getStorageSize() const = 0;
28 
29  ArrayImplBase();
30  ~ArrayImplBase() { delete stor_; }
31 
32  bool storageOK() const;
33  bool updateStorageSize();
37  bool setStorageNoResize(ValueSeries<T>*);
38  bool setStorageInternal(ValueSeries<T>*);
39  bool getDataFrom(const ArrayND<T>& templ);
40 
42  T* ptr_; //not owned, only a shortcut
43  //for the 99% percent case
44 };
45 
46 
51 template <class T>
52 mClass(Basic) Array1DImpl : public Array1D<T>, public ArrayImplBase<T>
54 public:
55 
56  Array1DImpl(int sz);
57  Array1DImpl(const Array1D<T>&);
59  Array1DImpl<T>& operator =( const Array1D<T>& ai )
60  { copyFrom(ai); return *this; }
61  Array1DImpl<T>& operator =( const Array1DImpl<T>& ai )
62  { copyFrom(ai); return *this; }
63 
65  { return new Array1DImpl<T>(*this); }
66 
67  bool isOK() const { return base::storageOK(); }
68  void copyFrom(const Array1D<T>&);
70  { return base::setStorageInternal(vs); }
71  bool canSetStorage() const { return true; }
72 
73  void set(int pos,T);
74  T get(int pos) const;
75 
76  const Array1DInfo& info() const { return in_; }
77  bool canSetInfo() const { return true; }
78  bool setInfo(const ArrayNDInfo&);
79  bool setSize(int);
80  bool setSize( od_int64 sz )
81  { return setSize( ((int)sz) ); }
82 
83  // ValueSeries interface
84  T* arr() { return base::ptr_; }
85  const T* arr() const { return base::ptr_; }
86 
87 protected:
88  const T* getData_() const { return base::ptr_; }
89  const ValueSeries<T>* getStorage_() const { return base::stor_; }
90  od_int64 getStorageSize() const { return in_.getTotalSz(); }
91 
93 
94 };
95 
96 
101 template <class T>
102 mClass(Basic) Array2DImpl : public Array2D<T>, public ArrayImplBase<T>
104 public:
105  Array2DImpl(int sz0,int sz1);
106  Array2DImpl(const Array2DInfo&);
107  Array2DImpl(const Array2D<T>&);
108  Array2DImpl(const Array2DImpl<T>&);
110 
111  Array2DImpl<T>& operator =( const Array2D<T>& ai )
112  { copyFrom(ai); return *this; }
113  Array2DImpl<T>& operator =( const Array2DImpl<T>& ai )
114  { copyFrom(ai); return *this; }
115 
116  bool isOK() const { return base::storageOK(); }
117  bool canSetStorage() const { return true; }
118  bool setStorage(ValueSeries<T>* vs);
119 
120  void set(int,int,T);
121  T get(int,int) const;
122  void copyFrom(const Array2D<T>&);
123 
124  const Array2DInfo& info() const { return in_; }
125  bool canSetInfo() const { return true; }
126 
127  bool setInfo(const ArrayNDInfo&);
128  bool setSize(int,int);
129 
130  T** get2DData() { return ptr2d_; }
131  const T** get2DData() const { return (const T**) ptr2d_; }
132 
133 protected:
134  void updateStorage();
135  const T* getData_() const { return base::ptr_; }
136  const ValueSeries<T>* getStorage_() const { return base::stor_; }
137  od_int64 getStorageSize() const { return in_.getTotalSz(); }
138 
139  void updateCachePointers();
140 
142  T** ptr2d_;
143 };
144 
145 
150 template <class T>
151 mClass(Basic) Array3DImpl : public Array3D<T>, public ArrayImplBase<T>
153 public:
154  Array3DImpl(int sz0,int sz1,int sz2);
155  Array3DImpl(const Array3DInfo&);
156  Array3DImpl(const Array3D<T>&);
157  Array3DImpl(const Array3DImpl<T>&);
158  ~Array3DImpl() { eraseCache(); }
159  Array3DImpl<T>& operator =( const Array3D<T>& ai )
160  { copyFrom(ai); return *this; }
161  Array3DImpl<T>& operator =( const Array3DImpl<T>& ai )
162  { copyFrom(ai); return *this; }
163 
164  bool isOK() const { return base::storageOK(); }
165  bool canSetStorage() const { return true; }
166  bool setStorage(ValueSeries<T>* vs);
167 
168  void set(int,int,int,T);
169  T get(int,int,int) const;
170  void copyFrom(const Array3D<T>&);
171 
172  const Array3DInfo& info() const { return in_; }
173  bool canSetInfo() const { return true; }
174  bool setInfo(const ArrayNDInfo&);
175  bool setSize(int,int,int);
176 
177  T*** get3DData() { return ptr3d_; }
178  const T*** get3DData() const { return (const T***) ptr3d_; }
179 
180 protected:
181  void updateStorage();
182  const T* getData_() const { return base::ptr_; }
183  const ValueSeries<T>* getStorage_() const { return base::stor_; }
184  od_int64 getStorageSize() const { return in_.getTotalSz(); }
185 
186  void updateCachePointers();
187  void eraseCache();
188 
190  T*** ptr3d_;
192 };
193 
194 
199 template <class T>
200 mClass(Basic) ArrayNDImpl : public ArrayND<T>, public ArrayImplBase<T>
202 public:
203 
204  static ArrayND<T>* create(const ArrayNDInfo& nsz);
205  static ArrayND<T>* clone(const ArrayND<T>&);
206  static bool clone(const ArrayND<T>&,ArrayND<T>&);
207 
208  ArrayNDImpl(const ArrayNDInfo&);
209  ArrayNDImpl(const ArrayND<T>&);
210  ArrayNDImpl(const ArrayNDImpl<T>&);
211  ArrayNDImpl<T>& operator =( const ArrayND<T>& ai )
212  { copyFrom(ai); return *this; }
213  ArrayNDImpl<T>& operator =( const ArrayNDImpl<T>& ai )
214  { copyFrom(ai); return *this; }
215  ~ArrayNDImpl();
216 
217  bool isOK() const { return base::storageOK(); }
218  bool canSetStorage() const { return true; }
220  { return base::setStorageInternal(vs); }
221 
222  void setND(const int*,T);
223  T getND(const int*) const;
224 
225  const ArrayNDInfo& info() const { return *in_; }
226  bool canSetInfo() const { return true; }
227  bool canChangeNrDims() const { return true; }
228  bool setInfo(const ArrayNDInfo&);
229 
230  bool setSize(const int*);
231  void copyFrom(const ArrayND<T>&);
232 
233 protected:
234 
235  const T* getData_() const { return base::ptr_; }
236  const ValueSeries<T>* getStorage_() const { return base::stor_; }
237  od_int64 getStorageSize() const { return in_->getTotalSz(); }
238 
240 };
241 
242 
243 template <class T> inline
245  : stor_(0)
246  , ptr_(0)
247 { }
248 
249 
250 template <class T> inline
252 {
253  ptr_ = 0;
254  delete stor_;
255 
256  stor_ = s;
257 
258  ptr_ = stor_->arr();
259 
260  return true;
261 }
262 
263 
264 template <class T> inline
266 {
267  ptr_ = 0;
268  if ( !s->setSize(getStorageSize()) )
269  {
270  delete s;
271  return false;
272  }
273 
274  return setStorageNoResize( s );
275 }
276 
277 
278 template <class T> inline
280 {
281  if ( !stor_ )
282  {
285  }
286 
287  if ( !stor_ || !stor_->setSize( getStorageSize() ) )
288  {
289  ptr_ = 0;
290  delete stor_;
291  stor_ = 0;
292  return false;
293  }
294 
295  ptr_ = stor_->arr();
296  return true;
297 }
298 
299 
300 template <class T> inline
302 { return stor_ && stor_->isOK(); }
303 
304 
305 template <class T> inline
307 {
308  if ( !storageOK() )
309  return false;
310 
311  if ( ptr_ )
312  {
313  templ.getAll( ptr_ );
314  return true;
315  }
316 
317  if ( stor_ )
318  {
319  templ.getAll( *stor_ );
320  return true;
321  }
322 
323  if ( getStorageSize() )
324  {
325  pErrMsg("Cannot store in array without storage" );
326  return false;
327  }
328 
329  return true;
330 }
331 
332 
333 template <class T> inline
335  : in_(nsz)
336 {
338 }
339 
340 
341 template <class T> inline
343  : in_(templ.info())
344 {
346  copyFrom( templ );
347 }
348 
349 
350 template <class T> inline
352  : in_(templ.info())
353 {
355  copyFrom( templ );
356 }
357 
358 
359 template <class T> inline
360 void Array1DImpl<T>::set( int pos, T v )
361 {
362 #ifdef __debug__
363  if ( !in_.validPos( pos ) )
364  { pErrMsg("Invalid access"); DBG::forceCrash(true); }
365 #endif
366  if ( base::ptr_ ) base::ptr_[pos] = v;
367  else base::stor_->setValue(pos,v);
368 }
369 
370 
371 template <class T> inline
372 T Array1DImpl<T>::get( int pos ) const
373 {
374 #ifdef __debug__
375  if ( !in_.validPos( pos ) )
376  { pErrMsg("Invalid access"); DBG::forceCrash(true); }
377 #endif
378  return base::ptr_ ? base::ptr_[pos] : base::stor_->value(pos);
379 }
380 
381 
382 template <class T> inline
384 {
385  if ( in_ != templ.info() )
386  setInfo( templ.info() );
387 
388  base::getDataFrom( templ );
389 }
390 
391 
392 template <class T> inline
394 {
395  if ( ni.getNDim() != 1 ) return false;
396  return setSize( ni.getSize(0) );
397 }
398 
399 
400 template <class T> inline
402 {
403  in_.setSize( 0, s );
405  return true;
406 }
407 
408 
409 template <class T> inline
410 Array2DImpl<T>::Array2DImpl( int sz0, int sz1 )
411  : in_(sz0,sz1)
412  , ptr2d_(0)
413 {
414  updateStorage();
415 }
416 
417 
418 template <class T> inline
420  : in_( nsz )
421  , ptr2d_(0)
422 {
423  updateStorage();
424 }
425 
426 
427 template <class T> inline
429  : in_(templ.info())
430  , ptr2d_(0)
431 {
432  updateStorage();
433  copyFrom( templ );
434 }
435 
436 
437 template <class T> inline
439  : in_(templ.info())
440  , ptr2d_(0)
441 {
442  updateStorage();
443  copyFrom( templ );
444 }
445 
446 
447 template <class T> inline
448 void Array2DImpl<T>::set( int p0, int p1, T v )
449 {
450 #ifdef __debug__
451  if ( !in_.validPos( p0, p1 ) )
452  {
453  pErrMsg("Invalid access");
454  DBG::forceCrash(true);
455  }
456 #endif
457  if ( ptr2d_ )
458  {
459  ptr2d_[p0][p1] = v;
460  }
461  else
462  {
463  const od_int64 offset = in_.getOffset( p0, p1 );
464  base::stor_->setValue( offset, v );
465  }
466 }
467 
468 
469 template <class T> inline
470 T Array2DImpl<T>::get( int p0, int p1 ) const
471 {
472 #ifdef __debug__
473  if ( !in_.validPos( p0, p1 ) )
474  {
475  pErrMsg("Invalid access");
476  DBG::forceCrash(true);
477  }
478 #endif
479 
480  if ( ptr2d_ )
481  return ptr2d_[p0][p1];
482 
483  const od_int64 offset = in_.getOffset( p0, p1 );
484  return base::stor_->value( offset );
485 }
486 
487 
488 template <class T> inline
490 {
491  bool res = base::setStorageInternal(vs);
493  return res;
494 }
495 
496 
497 template <class T> inline
499 {
500  if ( in_ != templ.info() )
501  setInfo( templ.info() );
502 
503  base::getDataFrom( templ );
504 }
505 
506 
507 template <class T> inline
509 {
510  if ( ni.getNDim() != 2 ) return false;
511  return setSize( ni.getSize(0), ni.getSize(1) );
512 }
513 
514 
515 template <class T> inline
516 bool Array2DImpl<T>::setSize( int d0, int d1 )
517 {
518  in_.setSize( 0, d0 ); in_.setSize( 1, d1 );
519  updateStorage();
520  return true;
521 }
522 
523 
524 template <class T> inline
526 {
529 }
530 
531 
532 template <class T> inline
534 {
536 
537  if ( !base::ptr_ )
538  return;
539 
540  const int n1 = in_.getSize( 0 );
541  mTryAlloc(ptr2d_,T*[n1])
542  if ( !ptr2d_ )
543  return;
544 
545  const int n2 = in_.getSize( 1 );
546  od_uint64 offset = 0;
547  for ( int idx=0; idx<n1; idx++, offset+=n2 )
548  ptr2d_[idx] = base::ptr_ + offset;
549 }
550 
551 
552 template <class T> inline
553 Array3DImpl<T>::Array3DImpl( int sz0, int sz1, int sz2 )
554  : in_(sz0,sz1,sz2)
555  , ptr3d_(0)
556 {
557  updateStorage();
558 }
559 
560 
561 template <class T> inline
563  : in_(nsz)
564  , ptr3d_(0)
565 {
566  updateStorage();
567 }
568 
569 
570 template <class T> inline
572  : in_(templ.info())
573  , ptr3d_(0)
574 {
575  updateStorage();
576  copyFrom( templ );
577 }
578 
579 
580 template <class T> inline
582  : in_(templ.info())
583  , ptr3d_(0)
584 {
585  updateStorage();
586  copyFrom( templ );
587 }
588 
589 
590 template <class T> inline
591 void Array3DImpl<T>::set( int p0, int p1, int p2, T v )
592 {
593 #ifdef __debug__
594  if ( !in_.validPos( p0, p1, p2 ) )
595  { pErrMsg("Invalid access"); DBG::forceCrash(true); }
596 #endif
597  if ( ptr3d_ )
598  {
599  ptr3d_[p0][p1][p2] = v;
600  }
601  else
602  {
603  const od_int64 offset = in_.getOffset( p0, p1, p2 );
604  base::stor_->setValue( offset, v );
605  }
606 }
607 
608 
609 template <class T> inline
610 T Array3DImpl<T>::get( int p0, int p1, int p2 ) const
611 {
612 #ifdef __debug__
613  if ( !in_.validPos( p0, p1, p2 ) )
614  { pErrMsg("Invalid access"); DBG::forceCrash(true); }
615 #endif
616  if ( ptr3d_ )
617  return ptr3d_[p0][p1][p2];
618 
619  const od_int64 offset = in_.getOffset( p0, p1, p2 );
620  return base::stor_->value( offset );
621 }
622 
623 
624 template <class T> inline
626 {
627  if ( in_ != templ.info() )
628  setInfo( templ.info() );
629 
630  base::getDataFrom( templ );
631 }
632 
633 
634 template <class T> inline
636 {
637  bool res = base::setStorageInternal(vs);
639  return res;
640 }
641 
642 template <class T> inline
644 {
645  if ( ni.getNDim() != 3 ) return false;
646  return setSize( ni.getSize(0), ni.getSize(1), ni.getSize(2) );
647 }
648 
649 
650 template <class T> inline
651 bool Array3DImpl<T>::setSize( int d0, int d1, int d2 )
652 {
653  in_.setSize( 0, d0 ); in_.setSize( 1, d1 ); in_.setSize( 2, d2 );
654  updateStorage();
655  return true;
656 }
657 
658 
659 template <class T> inline
661 {
664 }
665 
666 
667 template <class T> inline
669 {
670  for ( int idx=0; idx<cachestor_.size(); idx++ )
671  {
672  delete [] cachestor_[idx];
673  }
674 
675  cachestor_.erase();
676  ptr3d_ = 0;
677 }
678 
679 
680 template <class T> inline
682 {
683  eraseCache();
684 
685  if ( !base::ptr_ )
686  return;
687 
688  const int n1 = in_.getSize( 0 );
689  const int n2 = in_.getSize( 1 );
690  const int n3 = in_.getSize( 2 );
691  od_uint64 offset = 0;
692  for ( int idx=0; idx<n1; idx++ )
693  {
694  mDeclareAndTryAlloc(T**,ptr2d,T*[n2])
695  if ( !ptr2d )
696  return;
697 
698  for ( int idy=0; idy<n2; idy++, offset+=n3 )
699  ptr2d[idy] = base::ptr_ + offset;
700 
701  cachestor_ += ptr2d;
702  }
703 
704  ptr3d_ = &cachestor_[0];
705 }
706 
707 
708 template <class T> inline
710  : in_(nsz.clone())
711 {
713 }
714 
715 
716 template <class T> inline
718  : in_( templ.info().clone() )
719 {
721  copyFrom( templ );
722 }
723 
724 
725 template <class T> inline
727  : in_( templ.info().clone() )
728 {
730  copyFrom( templ );
731 }
732 
733 
734 template <class T> inline ArrayNDImpl<T>::~ArrayNDImpl()
735 { delete in_; }
736 
737 
738 template <class T> inline
740 {
741  if ( info()!=templ.info() )
742  {
743  delete in_;
744  in_ = templ.info().clone();
745  }
746 
747  base::getDataFrom( templ );
748 }
749 
750 
751 template <class T> inline
752 void ArrayNDImpl<T>::setND( const int* pos, T v )
753 {
754 #ifdef __debug__
755  if ( !in_->validPos( pos ) )
756  { pErrMsg("Invalid access"); DBG::forceCrash(true); }
757 #endif
758  const od_int64 offset = in_->getOffset(pos);
759  if ( base::ptr_ ) base::ptr_[offset] = v ;
760  else base::stor_->setValue( offset, v);
761 }
762 
763 
764 template <class T> inline
765 T ArrayNDImpl<T>::getND( const int* pos ) const
766 {
767 #ifdef __debug__
768  if ( !in_->validPos( pos ) )
769  { pErrMsg("Invalid access"); DBG::forceCrash(true); }
770 #endif
771  const od_int64 offset = in_->getOffset(pos);
772  return base::ptr_ ? base::ptr_[offset] : base::stor_->value( offset );
773 }
774 
775 
776 template <class T> inline
778 {
779  if ( ni.getNDim() != in_->getNDim() )
780  return false;
781 
782  const int ndim = in_->getNDim();
783  TypeSet<int> sizes( ndim, 0 );
784  for ( int idx=0; idx<ndim; idx++ )
785  sizes[idx] = ni.getSize(idx);
786 
787  return setSize( sizes.arr() );
788 }
789 
790 
791 template <class T> inline
792 bool ArrayNDImpl<T>::setSize( const int* d )
793 {
794  const int ndim = in_->getNDim();
795  for ( int idx=0; idx<ndim; idx++ )
796  in_->setSize( idx, d[idx] );
797 
799  return true;
800 }
801 
802 
803 template <class T> inline
805 {
806  int ndim = nsz.getNDim();
807 
808  if ( ndim==1 ) return new Array1DImpl<T>( nsz.getSize(0) );
809  if ( ndim==2 ) return new Array2DImpl<T>( nsz.getSize(0), nsz.getSize(1) );
810  if ( ndim==3 ) return new Array3DImpl<T>( nsz.getSize(0), nsz.getSize(1),
811  nsz.getSize(2) );
812 
813  return new ArrayNDImpl<T>( nsz );
814 }
815 
816 
817 template <class T> inline
819 {
820  ArrayND<T>* out = create( oth.info() );
821  if ( !out )
822  return 0;
823 
824  if ( !out->isOK() )
825  { delete out; return 0; }
826 
827  const bool success = clone( oth, *out );
828  if ( !success )
829  { delete out; return 0; }
830 
831  return out;
832 }
833 
834 
835 template <class T> inline
837 {
838  const od_uint64 sz = inp.info().getTotalSz();
839  if ( !inp.isOK() )
840  return false;
841 
842  if ( !out.isOK() || out.info() != inp.info() )
843  {
844  if ( !out.setInfo(inp.info()) ) //Also allocates storage
845  return false;
846  }
847 
848  if ( inp.getData() && out.getData() )
849  {
850  OD::memCopy( out.getData(), inp.getData(), sz*sizeof(T) );
851  return true;
852  }
853 
854  const int ndim = inp.info().getNDim();
855  if ( ndim==1 )
856  {
857  mDynamicCastGet(const Array1DImpl<T>*,inp1d,&inp)
858  mDynamicCastGet(Array1DImpl<T>*,out1d,&out)
859  if ( inp1d && out1d )
860  { *out1d = *inp1d; return true; }
861  }
862  else if ( ndim==2 )
863  {
864  mDynamicCastGet(const Array2DImpl<T>*,inp2d,&inp)
865  mDynamicCastGet(Array2DImpl<T>*,out2d,&out)
866  if ( inp2d && out2d )
867  { *out2d = *inp2d; return true; }
868  }
869  else if ( ndim==3 )
870  {
871  mDynamicCastGet(const Array3DImpl<T>*,inp3d,&inp)
872  mDynamicCastGet(Array3DImpl<T>*,out3d,&out)
873  if ( inp3d && out3d )
874  { *out3d = *inp3d; return true; }
875  }
876 
877  mDynamicCastGet(const ArrayNDImpl<T>*,inpnd,&inp)
878  mDynamicCastGet(ArrayNDImpl<T>*,outnd,&out)
879  if ( inpnd && outnd )
880  {
881  *outnd = *inpnd;
882  return true;
883  }
884 
885  ValueSeries<T>* newstor = out.getStorage();
886  if ( newstor )
887  {
888  inp.getAll( *newstor );
889  return true;
890  }
891 
892  ArrayNDIter iter( inp.info() );
893  do
894  {
895  const int* pos = iter.getPos();
896  out.setND( pos, inp.getND(pos) );
897  } while ( iter.next() );
898 
899  return true;
900 }
901 
902 #endif
Array1D ( Subclass of ArrayND ) is a one dimensional array.
Definition: arraynd.h:101
void copyFrom(const ArrayND< T > &)
Definition: arrayndimpl.h:739
virtual bool validPos(int, int, int) const
virtual uint64_t getTotalSz() const
virtual int getNDim() const =0
static ArrayND< T > * create(const ArrayNDInfo &nsz)
Definition: arrayndimpl.h:804
virtual bool setSize(int dim, int nsz)
T * ptr_
Definition: arrayndimpl.h:42
Array1DImpl(int sz)
Definition: arrayndimpl.h:334
T ** ptr2d_
Definition: arrayndimpl.h:142
#define mDeclareAndTryAlloc(tp, var, stmt)
Creates variable, try to alloc and catch bad_alloc.
Definition: commondefs.h:248
const Array2DInfo & info() const
Definition: arrayndimpl.h:124
bool isOK() const
Definition: arrayndimpl.h:67
virtual uint64_t getOffset(int, int) const
bool isOK() const
Definition: arrayndimpl.h:164
Valueseries that allocates its data in smaller chunks. By doing this, it performs better in environme...
Definition: valseries.h:164
bool setStorage(ValueSeries< T > *vs)
Definition: arrayndimpl.h:69
void updateCachePointers()
Definition: arrayndimpl.h:533
const ValueSeries< T > * getStorage_() const
Definition: arrayndimpl.h:89
virtual int64_t getStorageSize() const =0
virtual bool validPos(const int *) const
Contains the information about the size of Array3D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:118
ArrayNDImpl(const ArrayNDInfo &)
Definition: arrayndimpl.h:709
virtual bool setSize(int dim, int sz)
const ValueSeries< T > * getStorage() const
Definition: arraynd.h:46
#define od_int64
Definition: plftypes.h:36
const T * getData_() const
Definition: arrayndimpl.h:182
~ArrayImplBase()
Definition: arrayndimpl.h:30
const ArrayNDInfo & info() const
Definition: arrayndimpl.h:225
void updateCachePointers()
Definition: arrayndimpl.h:681
T * arr()
Definition: arrayndimpl.h:84
T ** get2DData()
Definition: arrayndimpl.h:130
Implementation of Array2D.
Definition: arrayndimpl.h:102
const Array3DInfo & info() const
Definition: arrayndimpl.h:172
const T * getData_() const
Definition: arrayndimpl.h:135
Contains the information about the size of ArrayND, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:23
Contains the information about the size of Array1D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:71
virtual int getSize(int dim) const
Definition: arrayndinfo.h:258
bool updateStorageSize()
Definition: arrayndimpl.h:279
T get(int, int) const
Definition: arrayndimpl.h:470
bool getDataFrom(const ArrayND< T > &templ)
Definition: arrayndimpl.h:306
bool canChangeNrDims() const
Definition: arrayndimpl.h:227
virtual bool setSize(int64_t)
Definition: valseries.h:53
virtual bool validPos(int, int) const
virtual void setND(const int *, T)=0
void set(int pos, T)
Definition: arrayndimpl.h:360
void updateStorage()
Definition: arrayndimpl.h:660
bool setSize(int, int, int)
Definition: arrayndimpl.h:651
Array3DInfoImpl in_
Definition: arrayndimpl.h:191
void deleteAndZeroArrPtr(T *&ptr, bool isowner=true)
Definition: ptrman.h:37
static ArrayND< T > * clone(const ArrayND< T > &)
Definition: arrayndimpl.h:818
virtual T * arr()
3rd party access
Definition: typeset.h:92
virtual int getSize(int dim) const =0
Array2DImpl(int sz0, int sz1)
Definition: arrayndimpl.h:410
const T * getData() const
Definition: arraynd.h:55
virtual T getND(const int *) const =0
const T * arr() const
Definition: arrayndimpl.h:85
virtual const Array3DInfo & info() const =0
bool canSetInfo() const
Definition: arrayndimpl.h:173
Array3DImpl(int sz0, int sz1, int sz2)
Definition: arrayndimpl.h:553
const ValueSeries< T > * getStorage_() const
Definition: arrayndimpl.h:136
virtual uint64_t getOffset(int, int, int) const
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:131
bool setInfo(const ArrayNDInfo &)
Definition: arrayndimpl.h:777
bool setStorage(ValueSeries< T > *vs)
Definition: arrayndimpl.h:489
bool setSize(int)
Definition: arrayndimpl.h:401
void eraseCache()
Definition: arrayndimpl.h:668
TypeSet< T ** > cachestor_
Definition: arrayndimpl.h:189
int64_t getStorageSize() const
Definition: arrayndimpl.h:90
T *** get3DData()
Definition: arrayndimpl.h:177
bool setInfo(const ArrayNDInfo &)
Definition: arrayndimpl.h:508
Implementation of Array3DInfo.
Definition: arrayndinfo.h:193
Interface to a series of values.
Definition: odmemory.h:17
bool setStorageNoResize(ValueSeries< T > *)
Definition: arrayndimpl.h:251
#define mTryAlloc(var, stmt)
Catches bad_alloc and sets ptr to null as normal.
Definition: commondefs.h:241
void copyFrom(const Array3D< T > &)
Definition: arrayndimpl.h:625
bool storageOK() const
Definition: arrayndimpl.h:301
const T *** get3DData() const
Definition: arrayndimpl.h:178
int64_t getStorageSize() const
Definition: arrayndimpl.h:237
virtual bool validPos(int pos) const
Definition: arrayndinfo.h:79
bool setSize(const int *)
Definition: arrayndimpl.h:792
Definition: arrayndimpl.h:24
Contains the information about the size of Array2D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:95
Implementation of ArrayND.
Definition: arrayndimpl.h:200
void updateStorage()
Definition: arrayndimpl.h:525
const T * getData_() const
Definition: arrayndimpl.h:88
virtual ArrayNDInfo * clone() const =0
virtual uint64_t getOffset(const int *) const
#define mDynamicCastGet(typ, out, in)
Definition: commondefs.h:131
bool canSetInfo() const
Definition: arrayndimpl.h:125
ArrayImplBase< T > base
Definition: arrayndimpl.h:53
#define od_uint64
Definition: plftypes.h:37
ArrayImplBase< T > base
Definition: arrayndimpl.h:152
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:33
bool canSetStorage() const
Definition: arrayndimpl.h:117
Iterates through all samples in an ArrayND.
Definition: arraynd.h:179
bool setInfo(const ArrayNDInfo &)
Definition: arrayndimpl.h:643
ValueSeries< T > * clone() const
Definition: arrayndimpl.h:64
const T ** get2DData() const
Definition: arrayndimpl.h:131
virtual bool setSize(int dim, int nsz)
size_type size() const
Definition: typeset.h:254
const ValueSeries< T > * getStorage_() const
Definition: arrayndimpl.h:236
T *** ptr3d_
Definition: arrayndimpl.h:190
bool setSize(int64_t sz)
Definition: arrayndimpl.h:80
ValueSeries< T > * stor_
Definition: arrayndimpl.h:41
static uiHor3DInterpol * create(uiParent *)
void copyFrom(const Array2D< T > &)
Definition: arrayndimpl.h:498
virtual bool setInfo(const ArrayNDInfo &)
Definition: arraynd.h:68
virtual const Array1DInfo & info() const =0
Array2DInfoImpl in_
Definition: arrayndimpl.h:141
bool isOK() const
Definition: arrayndimpl.h:217
void copyFrom(const Array1D< T > &)
Definition: arrayndimpl.h:383
Implementation of Array1DInfo.
Definition: arrayndinfo.h:140
bool setStorage(ValueSeries< T > *vs)
Definition: arrayndimpl.h:219
const int * getPos() const
Definition: arraynd.h:191
virtual bool setSize(int dim, int nsz)
void forceCrash(bool withdump)
bool setSize(int, int)
Definition: arrayndimpl.h:516
Implementation of Array3D.
Definition: arrayndimpl.h:151
Implementation of Array2DInfo.
Definition: arrayndinfo.h:166
bool canSetInfo() const
Definition: arrayndimpl.h:77
virtual void erase()
Definition: typeset.h:339
const ValueSeries< T > * getStorage_() const
Definition: arrayndimpl.h:183
bool canSetStorage() const
Definition: arrayndimpl.h:71
const T * getData_() const
Definition: arrayndimpl.h:235
bool canSetStorage() const
Definition: arrayndimpl.h:218
void set(int, int, T)
Definition: arrayndimpl.h:448
Array1DInfoImpl in_
Definition: arrayndimpl.h:92
~Array3DImpl()
Definition: arrayndimpl.h:158
virtual const ArrayNDInfo & info() const =0
int64_t getStorageSize() const
Definition: arrayndimpl.h:137
virtual int getSize(int dim) const
Definition: arrayndinfo.h:252
virtual bool isOK() const
Definition: arraynd.h:327
bool setInfo(const ArrayNDInfo &)
Definition: arrayndimpl.h:393
Implementation of Array1D.
Definition: arrayndimpl.h:52
#define mClass(module)
Definition: commondefs.h:164
virtual const Array2DInfo & info() const =0
#define pErrMsg(msg)
Definition: errmsg.h:60
T get(int, int, int) const
Definition: arrayndimpl.h:610
bool canSetInfo() const
Definition: arrayndimpl.h:226
const Array1DInfo & info() const
Definition: arrayndimpl.h:76
virtual void getAll(T *ptr) const
Definition: arraynd.h:507
ArrayImplBase< T > base
Definition: arrayndimpl.h:201
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:153
ArrayImplBase< T > base
Definition: arrayndimpl.h:103
void set(int, int, int, T)
Definition: arrayndimpl.h:591
~Array2DImpl()
Definition: arrayndimpl.h:109
bool isOK() const
Definition: arrayndimpl.h:116
T getND(const int *) const
Definition: arrayndimpl.h:765
int64_t getStorageSize() const
Definition: arrayndimpl.h:184
ArrayNDInfo * in_
Definition: arrayndimpl.h:239
bool setStorageInternal(ValueSeries< T > *)
Definition: arrayndimpl.h:265
void setND(const int *, T)
Definition: arrayndimpl.h:752
T get(int pos) const
Definition: arrayndimpl.h:372
bool setStorage(ValueSeries< T > *vs)
Definition: arrayndimpl.h:635
~ArrayNDImpl()
Definition: arrayndimpl.h:734
bool canSetStorage() const
Definition: arrayndimpl.h:165
ArrayImplBase()
Definition: arrayndimpl.h:244

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