 |
OpendTect
6.6
|
Go to the documentation of this file.
38 virtual inline bool isOK()
const;
41 virtual T
getND(
const int*)
const = 0;
43 virtual void setND(
const int*,T) = 0;
46 {
return getStorage_(); }
50 {
delete s;
return true; }
55 {
return getData_(); }
57 virtual const T*
get1D(
const int*)
const;
84 {
return info().getNDim(); }
86 {
return info().getSize(dim); }
88 {
return info().getTotalSz(); }
90 {
return info().validPos(pos); }
98 return getStorage()->arr();
114 virtual void set(
int,T) = 0;
115 virtual T
get(
int)
const = 0;
116 void setND(
const int* pos,T v) {
set( pos[0], v ); }
118 {
return get(pos[0]); }
128 inline T operator [](
int idx )
const
129 {
return get( idx ); }
142 virtual void set(
int,
int, T ) = 0;
143 virtual T
get(
int p0,
int p1 )
const = 0;
145 {
set( pos[0], pos[1], v);}
147 {
return get( pos[0], pos[1] ); }
165 virtual void set(
int,
int,
int, T ) = 0;
166 virtual T
get(
int p0,
int p1,
int p2 )
const = 0;
168 {
set( pos[0], pos[1], pos[2], v);}
170 {
return get( pos[0], pos[1], pos[2] ); }
187 virtual void set(
int,
int,
int,
int,T)= 0;
188 virtual T
get(
int,
int,
int,
int)
const = 0;
190 {
set( pos[0], pos[1], pos[2], pos[3], v ); }
192 {
return get( pos[0], pos[1], pos[2], pos[3] );}
219 template <
class T>
void inline setPos(
const T& idxabl);
220 const int*
getPos()
const {
return position_; }
232 #define mArrayNDVSAdapterNrDim 20
248 if ( array_.getData() || array_.getStorage() )
250 pErrMsg(
"Not a good idea to use adapter. "
251 "Use getStorage() instead");
259 pErrMsg(
"Too many dimensions");
272 array_.info().getArrayPos( idx, pos );
273 return array_.getND( pos );
276 const T*
arr()
const {
return array_.getData(); }
287 for (
int idx=
sz_.
getNDim()-1; idx>=0; idx-- )
298 #define mDefArrayNDStdMembers(nd) \
300 Array##nd##Conv(Array##nd<TT>* arr) \
302 ~Array##nd##Conv() { delete arr_; } \
304 const Array##nd##Info& info() const { return arr_->info(); } \
308 Array##nd<TT>* arr_; \
312 #define mDefArrayNDConverter(nd) \
313 template <class T, class TT> \
314 class Array##nd##Conv : public Array##nd<T> \
315 { mDefArrayNDStdMembers(nd);
319 template <
class T,
class TT>
331 template <
class T,
class TT>
334 T
get(
int p0,
int p1 )
const
335 {
return (T)
arr_->
get( p0, p1 ); }
336 void set(
int p0,
int p1, T v )
337 {
arr_->
set( p0, p1, (TT)v ); }
341 template <
class T,
class TT>
345 T
get(
int p0,
int p1,
int p2 )
const
346 {
return (T)
arr_->
get( p0, p1, p2 ); }
347 void set(
int p0,
int p1,
int p2, T v )
348 {
arr_->
set( p0, p1, p2, (TT)v ); }
353 template <
class T,
class TT>
357 T
get(
int p0,
int p1,
int p2,
int p3 )
const
358 {
return (T)
arr_->
get( p0, p1, p2, p3 ); }
359 void set(
int p0,
int p1,
int p2,
int p3, T v )
360 {
arr_->
set( p0, p1, p2, p3, (TT)v ); }
366 template <
class T>
inline
369 return getStorage() ? getStorage()->isOK() :
true;
373 template <
class T>
inline
376 return !isOK() || info().getTotalSz() == 0;
380 template <
class T>
inline
383 const T* ptr = getData();
384 if ( !ptr )
return 0;
386 int ndim = info().getNDim();
389 OD::memCopy(pos,i, (
int)
sizeof(
int)*(ndim-1));
393 return &ptr[info().getOffset( pos )];
397 template <
class T>
inline
399 {
return info().getNDim()-1; }
402 template <
class T>
inline
405 return !isSettable() ? 0
406 :
const_cast<T*
>(((
const ArrayND*)
this)->getData_());
410 template <
class T>
inline
413 return !isSettable() ? 0 :
418 template <
class T>
inline
421 return !isSettable() ? 0 :
const_cast<T*
>(((
const ArrayND*)
this)->get1D(i));
425 template <
class T>
inline
448 setND( iterator.
getPos(), val );
449 }
while ( iterator.
next() );
463 , totalnr_( arr.info().getTotalSz() )
470 , totalnr_( arr.info().getTotalSz() )
471 , vs_( vs.arr() ? 0 : &vs )
477 if ( !arr_.info().getArrayPos( start, pos ) )
481 iterator.
setPos( (
int*) pos );
485 for (
od_int64 idx=start; idx<=stop; idx++ )
488 arr_.getND( iterator.
getPos() ) );
492 if ( !iterator.
next() )
498 T* res = ptr_ + start;
499 for (
od_int64 idx=start; idx<=stop; idx++, res++ )
501 *res = arr_.getND( iterator.
getPos() );
505 if ( !iterator.
next() )
525 template <
class T>
inline
529 { getAll( vs.
arr() );
return; }
531 const od_int64 totalsz = info().getTotalSz();
546 template <
class T>
inline
549 const od_int64 totalsz = info().getTotalSz();
553 const T* tdata = getData();
555 OD::memCopy( ptr, tdata, totalsz *
sizeof(T) );
virtual const ValueSeries< T > * getStorage_() const
Definition: arraynd.h:93
virtual bool canSetInfo() const
Definition: arraynd.h:63
Interface to a series of values.
Definition: odmemory.h:16
#define od_uint64
Definition: plftypes.h:36
Adapter that makes any ArrayND to a (slow) value series.
Definition: arraynd.h:243
T value(int64_t i) const
Definition: arraynd.h:121
virtual ~ArrayND()
Definition: arraynd.h:36
4-Dim ArrayND
Definition: arraynd.h:183
ValueSeries Copier.
Definition: odmemory.h:89
bool isOK() const
Definition: arraynd.h:255
virtual void set(int, int, int, int, T)=0
Contains the information about the size of Array2D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:124
virtual const T * get1D(const int *) const
Definition: arraynd.h:381
virtual T get(int p0, int p1) const =0
ArrayNDIter(const ArrayNDInfo &)
virtual int get1DDim() const
Definition: arraynd.h:398
virtual T * get1D(const int *)
Definition: arraynd.h:419
Contains the information about the size of ArrayND, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:25
bool execute()
Definition: paralleltask.h:70
void set(int p0, int p1, T v)
Definition: arraynd.h:336
virtual void set(int, T)=0
Array1D< TT > * arr_
Definition: arraynd.h:321
virtual const T **** get4DData() const
Definition: arraynd.h:195
void setValue(int64_t i, T t)
Definition: arraynd.h:123
void set(int p0, int p1, int p2, int p3, T v)
Definition: arraynd.h:359
virtual bool canSetAll() const
Definition: valseries.h:47
ArrayNDValseriesAdapter(const ArrayND< T > &a)
Definition: arraynd.h:245
#define od_int64
Definition: plftypes.h:35
#define mExpClass(module)
Definition: commondefs.h:177
virtual void set(int, int, int, T)=0
virtual const Array3DInfo & info() const =0
T get(int p0) const
Definition: arraynd.h:323
virtual bool canChangeNrDims() const
Definition: arraynd.h:65
const ArrayND< T > & array_
Definition: arraynd.h:281
int getSize(int dim) const
Definition: arraynd.h:85
Definition: arraynd.h:333
const ValueSeries< T > * getStorage() const
Definition: arraynd.h:45
const ArrayNDInfo & sz_
Definition: arraynd.h:228
virtual const Array4DInfo & info() const =0
int * position_
Definition: arraynd.h:227
Array1D ( Subclass of ArrayND ) is a one dimensional array.
Definition: arraynd.h:111
T * getData()
Definition: arraynd.h:403
ValueSeries< T > * getStorage()
Definition: arraynd.h:411
virtual bool isOK() const
Definition: arraynd.h:367
virtual void setAll(T t)
Definition: arraynd.h:124
virtual const Array1DInfo & info() const =0
T value(int64_t idx) const
Definition: arraynd.h:269
virtual void setND(const int *, T)=0
void set(int p0, T v)
Definition: arraynd.h:325
bool isEmpty(const NLAModel *mdl)
Array3D< TT > * arr_
Definition: arraynd.h:343
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:162
void set(int p0, int p1, int p2, T v)
Definition: arraynd.h:347
virtual const T ** get2DData() const
Definition: arraynd.h:150
void setPos(const T &idxabl)
Definition: arraynd.h:285
virtual const ArrayNDInfo & info() const =0
#define mDefArrayNDStdMembers(nd)
Definition: arraynd.h:298
bool setGlobalPos(int64_t)
Definition: arraynd.h:293
T * arr()
Definition: arraynd.h:277
Array4D< TT > * arr_
Definition: arraynd.h:355
#define mClass(module)
Definition: commondefs.h:181
T get(int p0, int p1, int p2, int p3) const
Definition: arraynd.h:357
Contains the information about the size of Array1D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:100
const int * getPos() const
Definition: arraynd.h:220
Iterates through all samples in an ArrayND.
Definition: arraynd.h:209
void setND(const int *pos, T v)
Definition: arraynd.h:116
virtual T **** get4DData()
Definition: arraynd.h:194
#define mTypeDefArrNDTypes
Definition: arrayndinfo.h:65
Contains the information about the size of Array4D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:166
#define mArrayNDVSAdapterNrDim
Definition: arraynd.h:232
uint64_t totalSize() const
Definition: arraynd.h:87
virtual T *** get3DData()
Definition: arraynd.h:172
void setND(const int *pos, T v)
Definition: arraynd.h:189
virtual T get(int p0, int p1, int p2) const =0
virtual bool setStorage(ValueSeries< T > *s)
Definition: arraynd.h:49
#define pErrMsg(msg)
Usual access point for programmer error messages.
Definition: errmsg.h:37
void set(T &_to, const F &fr)
template based type conversion
Definition: convert.h:27
Contains the information about the size of Array3D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:147
virtual T get(int, int, int, int) const =0
void setND(const int *pos, T v)
Definition: arraynd.h:144
virtual const Array2DInfo & info() const =0
T getND(const int *pos) const
Definition: arraynd.h:191
T getND(const int *pos) const
Definition: arraynd.h:146
virtual T getND(const int *) const =0
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
virtual bool getArrayPos(uint64_t, int *) const
#define mAllocLargeVarLenArr(type, varnm, __size)
Definition: varlenarray.h:30
virtual bool setInfo(const ArrayNDInfo &)
Definition: arraynd.h:67
bool writable() const
Definition: arraynd.h:122
Definition: arraynd.h:321
T get(int p0, int p1, int p2) const
Definition: arraynd.h:345
T getND(const int *pos) const
Definition: arraynd.h:169
ValueSeries< T > * clone() const
Definition: arraynd.h:266
T getND(const int *pos) const
Definition: arraynd.h:117
virtual bool isEmpty() const
Definition: arraynd.h:374
virtual const T * getData_() const
Definition: arraynd.h:95
virtual void getAll(ValueSeries< T > &vs) const
Definition: arraynd.h:526
int nrDims() const
Definition: arraynd.h:83
bool validPos(int *pos) const
Definition: arraynd.h:89
void getValues(ValueSeries< T > &, int64_t nrvals) const
Definition: valseries.h:255
Definition: arraynd.h:355
virtual T ** get2DData()
Definition: arraynd.h:149
#define mAllocVarLenArr(type, varnm, __size)
Definition: varlenarray.h:53
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:33
virtual void setAll(T)
Definition: arraynd.h:426
virtual void setAll(T)
Definition: valseries.h:48
virtual const T *** get3DData() const
Definition: arraynd.h:173
virtual int getNDim() const =0
virtual bool isSettable() const
Definition: arraynd.h:42
virtual void getAll(T *ptr) const
Definition: arraynd.h:547
virtual void set(int, int, T)=0
Definition: arraynd.h:343
virtual bool canSetStorage() const
Definition: arraynd.h:48
int operator[](int) const
void setND(const int *pos, T v)
Definition: arraynd.h:167
T get(int p0, int p1) const
Definition: arraynd.h:334
virtual T get(int) const =0
const T * arr() const
Definition: arraynd.h:276
Sets large amounts of values to a constant using multiple threads.
Definition: odmemory.h:42
Array2D< TT > * arr_
Definition: arraynd.h:333
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:140
const T * getData() const
Definition: arraynd.h:54
virtual T * arr()
Definition: valseries.h:55
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021