28 #define mODMemMinThreadSize 131072 50 typedef T (*ValueFunc)();
99 void setInput(
const T* ptr ) { inptr_ = ptr; invs_ = 0; }
146 void setPtr(T* ptr) { ptr_ = ptr; vs_ = 0; }
176 #include "valseries.h" 179 template <
class T>
inline 188 template <
class T>
inline 198 template <
class T>
inline 208 template <
class T>
inline 213 template <
class T>
inline 221 T* stopptr =
ptr_+stop;
222 while ( ptr<=stopptr )
232 return setPtr( start, stop-start+1 );
238 for ( od_int64 idx=start; idx<=stop; idx++ )
243 for ( od_int64 idx=start; idx<=stop; idx++ )
244 {
vs_->setValue( idx,
val_ ); }
285 #define mODMemSetterFullImpl(Type) \ 286 Type* ptr = ptr_ + start; \ 287 const Type* stopptr = ptr + size; \ 288 while ( ptr != stopptr ) \ 299 #define mODMemSpecialImpl( Type ) \ 301 bool MemSetter<Type>::setPtr( od_int64 start, od_int64 size ) \ 304 OD::sysMemZero( ptr_+start, size*sizeof(Type) ); \ 306 OD::sysMemValueSet( ptr_+start, val_, size ); \ 308 addToNrDone( size ); \ 324 template <
class T>
inline 332 #undef mODMemSpecialImpl 333 #undef mODMemSetterFullImpl 336 template <
class T>
inline 338 :
sz_(0), inptr_(0), invs_(0), outptr_(0), outvs_(0) {}
340 template <
class T>
inline 344 template <
class T>
inline 348 template <
class T>
inline 352 template <
class T>
inline 358 template <
class T>
inline 363 template <
class T>
inline 367 return setPtr( start, stop-start+1 );
371 for ( od_int64 idx=start; idx<=stop; idx++ )
376 for ( od_int64 idx=start; idx<=stop; idx++ )
381 for ( od_int64 idx=start; idx<=stop; idx++ )
389 template <
class T>
inline 398 template <
class T>
inline 403 , fromval_( fromval )
409 template <
class T>
inline 421 template <
class T>
inline 426 template <
class T>
inline 430 return setPtr( start, stop-start+1 );
432 for ( od_int64 idx=start; idx<=stop; idx++ )
441 template <
class T>
inline 444 T* ptr =
ptr_ + start;
445 const T* stopptr = ptr + size;
446 while ( ptr != stopptr )
460 #define cMinMemValSetParallelSize 400 468 if ( !ptr || size<=0 )
469 return ptr ? ptr : 0;
471 const T* stopptr = ptr + size;
472 while ( ptr != stopptr )
489 taskrun ? taskrun->
execute( msetter )
uiString uiMessage() const
will be message() again in 7.x
Definition: odmemory.h:107
bool doWork(int64_t, int64_t, int)
Definition: odmemory.h:364
T val_
Definition: odmemory.h:70
int64_t sz_
Definition: odmemory.h:69
T toval_
Definition: odmemory.h:163
bool doPrepare(int)
Definition: odmemory.h:209
T to(const F &fr)
Definition: convert.h:33
ValueSeries< T > * vs_
Definition: odmemory.h:67
Sets large amounts of values to a constant using multiple threads.
Definition: odmemory.h:42
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
#define mGlobal(module)
Definition: commondefs.h:163
#define od_int64
Definition: plftypes.h:36
int minThreadSize() const
Definition: odmemory.h:64
void setToValue(const T &val)
Definition: odmemory.h:145
int64_t nrIterations() const
Definition: odmemory.h:63
ValueFunc valfunc_
Definition: odmemory.h:71
Definition: uistring.h:89
Goes through some mem or a ValSeries and replaces one value with another.
Definition: odmemory.h:136
void setTarget(ValueSeries< T > &vs)
Definition: odmemory.h:54
uiString uiMessage() const
will be message() again in 7.x
Definition: odmemory.h:150
void setOutput(ValueSeries< T > &vs)
Definition: odmemory.h:103
void setSize(int64_t sz)
Definition: odmemory.h:105
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
int64_t sz_
Definition: odmemory.h:162
static bool execute(TaskRunner *tr, Task &)
Taskrunner may be zero.
MemSetter()
Definition: odmemory.h:180
int minThreadSize() const
Definition: odmemory.h:114
void setSize(int64_t sz)
Definition: odmemory.h:148
bool doPrepare(int)
Definition: odmemory.h:359
void setInput(const ValueSeries< T > &vs)
Definition: odmemory.h:100
Class that can execute a task.
Definition: task.h:169
void sysMemSet(void *, int, size_t)
bool setPtr(int64_t start, int64_t size)
Definition: odmemory.h:325
#define mODMemMinThreadSize
Definition: odmemory.h:28
const T * inptr_
Definition: odmemory.h:117
bool execute()
Definition: paralleltask.h:71
Interface to a series of values.
Definition: odmemory.h:17
Definition: odmemory.h:22
void setPtr(T *ptr)
Definition: odmemory.h:146
void sysMemZero(void *, size_t)
T * ptr_
Definition: odmemory.h:68
bool setPtr(int64_t start, int64_t size)
Definition: odmemory.h:390
int64_t nrIterations() const
Definition: odmemory.h:156
void setValueFunc(ValueFunc valfunc)
Definition: odmemory.h:51
void setOutput(T *ptr)
Definition: odmemory.h:102
void memValueSet(T *, T, int64_t, TaskRunner *taskrun=0)
Definition: odmemory.h:480
T * outptr_
Definition: odmemory.h:119
ValueSeries< T > * outvs_
Definition: odmemory.h:120
void setInput(const T *ptr)
Definition: odmemory.h:99
int64_t nrIterations() const
Definition: odmemory.h:113
int minThreadSize() const
Definition: odmemory.h:157
#define cMinMemValSetParallelSize
size determined experimentally on different Linux and Windows systems
Definition: odmemory.h:460
void setPtr(ValueSeries< T > &vs)
Definition: odmemory.h:147
#define od_uint64
Definition: plftypes.h:37
ValueSeries< T > * vs_
Definition: odmemory.h:160
void sysMemCopy(void *, const void *, int64_t)
int64_t sz_
Definition: odmemory.h:121
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: odmemory.h:108
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: odmemory.h:58
MemCopier()
Definition: odmemory.h:337
T * sysMemValueSet(T *, T, int64_t nrsamp)
Definition: odmemory.h:466
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: odmemory.h:151
T * ptr_
Definition: odmemory.h:161
OpendTect.
Definition: commontypes.h:29
PtrPolicy
Definition: odmemory.h:22
T fromval_
Definition: odmemory.h:164
bool doWork(int64_t, int64_t, int)
Definition: odmemory.h:427
ValueSeries Copier.
Definition: odmemory.h:89
const ValueSeries< T > * invs_
Definition: odmemory.h:118
void setSize(int64_t sz)
Definition: odmemory.h:55
#define mClass(module)
Definition: commondefs.h:164
bool doWork(int64_t, int64_t, int)
Definition: odmemory.h:214
Definition: odmemory.h:22
uiString uiMessage() const
will be message() again in 7.x
Definition: odmemory.h:57
void addToNrDone(int64_t increment)
virtual T * arr()
Definition: valseries.h:55
void setTarget(T *ptr)
Definition: odmemory.h:53
#define mODMemSpecialImpl(Type)
Definition: odmemory.h:299
void setValue(const T &val)
Definition: odmemory.h:52
Definition: odmemory.h:22
bool doPrepare(int)
Definition: odmemory.h:422
void setFromValue(const T &val)
Definition: odmemory.h:144