 |
OpendTect
6.6
|
Go to the documentation of this file.
27 #define mODMemMinThreadSize 131072
49 typedef T (*ValueFunc)();
98 void setInput(
const T* ptr ) { inptr_ = ptr; invs_ = 0; }
145 void setPtr(T* ptr) { ptr_ = ptr; vs_ = 0; }
178 template <
class T>
inline
187 template <
class T>
inline
197 template <
class T>
inline
207 template <
class T>
inline
209 {
return ptr_ || vs_; }
212 template <
class T>
inline
220 T* stopptr = ptr_+stop;
221 while ( ptr<=stopptr )
231 return setPtr( start, stop-start+1 );
237 for (
od_int64 idx=start; idx<=stop; idx++ )
238 { vs_->setValue( idx, valfunc_() ); }
242 for (
od_int64 idx=start; idx<=stop; idx++ )
243 { vs_->setValue( idx, val_ ); }
284 #define mODMemSetterFullImpl(Type) \
285 Type* ptr = ptr_ + start; \
286 const Type* stopptr = ptr + size; \
287 while ( ptr != stopptr ) \
298 #define mODMemSpecialImpl( Type ) \
300 bool MemSetter<Type>::setPtr( od_int64 start, od_int64 size ) \
303 OD::sysMemZero( ptr_+start, size*sizeof(Type) ); \
305 OD::sysMemValueSet( ptr_+start, val_, size ); \
307 addToNrDone( size ); \
323 template <
class T>
inline
331 #undef mODMemSpecialImpl
332 #undef mODMemSetterFullImpl
335 template <
class T>
inline
337 : sz_(0), inptr_(0), invs_(0), outptr_(0), outvs_(0) {}
339 template <
class T>
inline
341 : sz_(sz), inptr_(i), invs_(0), outptr_(o), outvs_(0) {}
343 template <
class T>
inline
345 : sz_(sz), inptr_(i), invs_(0), outptr_(o.arr()), outvs_(&o) {}
347 template <
class T>
inline
349 : sz_(sz), inptr_(i.arr()), invs_(&i), outptr_(o), outvs_(0) {}
351 template <
class T>
inline
354 : sz_(sz), inptr_(i.arr), invs_(&i), outptr_(o.arr()), outvs_(&o) {}
357 template <
class T>
inline
359 {
return (inptr_ || invs_) && (outptr_ || outvs_); }
362 template <
class T>
inline
365 if ( inptr_ && outptr_ )
366 return setPtr( start, stop-start+1 );
370 for (
od_int64 idx=start; idx<=stop; idx++ )
371 { outptr_[idx] = invs_->value( idx ); }
375 for (
od_int64 idx=start; idx<=stop; idx++ )
376 { outvs_->setValue( idx, inptr_[idx] ); }
380 for (
od_int64 idx=start; idx<=stop; idx++ )
381 { outvs_->setValue( idx, invs_->value(idx)); }
388 template <
class T>
inline
397 template <
class T>
inline
402 , fromval_( fromval )
408 template <
class T>
inline
415 , fromval_( fromval )
420 template <
class T>
inline
422 {
return ptr_ || vs_; }
425 template <
class T>
inline
429 return setPtr( start, stop-start+1 );
431 for (
od_int64 idx=start; idx<=stop; idx++ )
433 if ( vs_->value(idx)==fromval_ )
434 vs_->setValue( idx, toval_ );
440 template <
class T>
inline
443 T* ptr = ptr_ + start;
444 const T* stopptr = ptr + size;
445 while ( ptr != stopptr )
447 if ( *ptr==fromval_ )
459 #define cMinMemValSetParallelSize 400
467 if ( !ptr || size<=0 )
468 return ptr ? ptr : 0;
470 const T* stopptr = ptr + size;
471 while ( ptr != stopptr )
488 taskrun ? taskrun->
execute( msetter )
Interface to a series of values.
Definition: odmemory.h:16
int64_t sz_
Definition: odmemory.h:161
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: odmemory.h:107
bool doWork(int64_t, int64_t, int)
Definition: odmemory.h:426
#define od_uint64
Definition: plftypes.h:36
bool setPtr(int64_t start, int64_t size)
Definition: odmemory.h:324
static bool execute(TaskRunner *tr, Task &)
Taskrunner may be zero.
void sysMemZero(void *, size_t)
ValueSeries Copier.
Definition: odmemory.h:89
void memValueSet(T *, T, int64_t, TaskRunner *taskrun=0)
Definition: odmemory.h:479
void setPtr(T *ptr)
Definition: odmemory.h:145
void setToValue(const T &val)
Definition: odmemory.h:144
void setValueFunc(ValueFunc valfunc)
Definition: odmemory.h:50
#define mODMemMinThreadSize
Definition: odmemory.h:27
T * outptr_
Definition: odmemory.h:118
ValueSeries< T > * vs_
Definition: odmemory.h:159
T to(const F &fr)
Definition: convert.h:34
#define mGlobal(module)
Definition: commondefs.h:180
bool execute()
Definition: paralleltask.h:70
void setPtr(ValueSeries< T > &vs)
Definition: odmemory.h:146
#define od_int64
Definition: plftypes.h:35
void setTarget(T *ptr)
Definition: odmemory.h:52
T * ptr_
Definition: odmemory.h:160
OpendTect.
Definition: commontypes.h:28
void setTarget(ValueSeries< T > &vs)
Definition: odmemory.h:53
void setValue(const T &val)
Definition: odmemory.h:51
MemCopier()
Definition: odmemory.h:336
@ UsePtr
Definition: odmemory.h:21
bool setPtr(int64_t start, int64_t size)
Definition: odmemory.h:389
MemSetter()
Definition: odmemory.h:179
void setOutput(T *ptr)
Definition: odmemory.h:101
ValueSeries< T > * outvs_
Definition: odmemory.h:119
void setInput(const T *ptr)
Definition: odmemory.h:98
void setSize(int64_t sz)
Definition: odmemory.h:54
#define mODTextTranslationClass(clss)
Definition: uistring.h:40
bool doPrepare(int)
Definition: odmemory.h:421
void setFromValue(const T &val)
Definition: odmemory.h:143
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: odmemory.h:150
bool doWork(int64_t, int64_t, int)
Definition: odmemory.h:213
ValueSeries< T > * vs_
Definition: odmemory.h:66
int64_t nrIterations() const
Definition: odmemory.h:112
#define mClass(module)
Definition: commondefs.h:181
bool doPrepare(int)
Definition: odmemory.h:358
void setSize(int64_t sz)
Definition: odmemory.h:147
int64_t sz_
Definition: odmemory.h:68
Class that can execute a task.
Definition: task.h:170
ValueFunc valfunc_
Definition: odmemory.h:70
T toval_
Definition: odmemory.h:162
T val_
Definition: odmemory.h:69
#define mODMemSpecialImpl(Type)
Definition: odmemory.h:298
bool doPrepare(int)
Definition: odmemory.h:208
uiString uiMessage() const
will be message() again in 7.x
Definition: odmemory.h:106
void setSize(int64_t sz)
Definition: odmemory.h:104
int minThreadSize() const
Definition: odmemory.h:113
@ TakeOverPtr
Definition: odmemory.h:21
T * sysMemValueSet(T *, T, int64_t nrsamp)
Definition: odmemory.h:465
void sysMemCopy(void *, const void *, int64_t)
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
T * ptr_
Definition: odmemory.h:67
int minThreadSize() const
Definition: odmemory.h:63
uiString uiMessage() const
will be message() again in 7.x
Definition: odmemory.h:149
bool doWork(int64_t, int64_t, int)
Definition: odmemory.h:363
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
const ValueSeries< T > * invs_
Definition: odmemory.h:117
Goes through some mem or a ValSeries and replaces one value with another.
Definition: odmemory.h:136
int64_t sz_
Definition: odmemory.h:120
int minThreadSize() const
Definition: odmemory.h:156
const T * inptr_
Definition: odmemory.h:116
@ CopyPtr
Definition: odmemory.h:21
T fromval_
Definition: odmemory.h:163
int64_t nrIterations() const
Definition: odmemory.h:155
uiString uiMessage() const
will be message() again in 7.x
Definition: odmemory.h:56
PtrPolicy
Definition: odmemory.h:21
#define cMinMemValSetParallelSize
size determined experimentally on different Linux and Windows systems
Definition: odmemory.h:459
void setOutput(ValueSeries< T > &vs)
Definition: odmemory.h:102
void setInput(const ValueSeries< T > &vs)
Definition: odmemory.h:99
Sets large amounts of values to a constant using multiple threads.
Definition: odmemory.h:42
int64_t nrIterations() const
Definition: odmemory.h:62
virtual T * arr()
Definition: valseries.h:55
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: odmemory.h:57
void sysMemSet(void *, int, size_t)
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021