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

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