OpendTect  7.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Stats::ParallelCalc< T > Class Template Reference

Stats computation running in parallel. More...

Inheritance diagram for Stats::ParallelCalc< T >:
[legend]

Public Member Functions

 ParallelCalc (const CalcSetup &s)
 
 ParallelCalc (const CalcSetup &s, const T *data, size_type sz, const T *weights=0)
 
const uiString errMsg () const
 
 mUseType (CalcSetup, idx_type)
 
 mUseType (CalcSetup, size_type)
 
void setEmpty ()
 
void setValues (const T *inp, size_type sz, const T *wght=0)
 
double variance () const
 
double variance () const override
 
- Public Member Functions inherited from ParallelTask
virtual ~ParallelTask ()
 
void doParallel (bool yn)
 
bool execute () override
 
virtual bool executeParallel (bool parallel)
 
std::int64_t nrDone () const override
 May be -1, i.e. class does not report nrdone. More...
 
std::int64_t totalNr () const override
 
- Public Member Functions inherited from ReportingTask
virtual ~ReportingTask ()
 
void getProgress (const ReportingTask &)
 
- Public Member Functions inherited from Task
virtual ~Task ()
 
virtual void controlWork (Control)
 
virtual void enableWorkControl (bool=true)
 Must be called before execute() More...
 
virtual uiRetVal errorWithDetails () const
 
virtual Control getState () const
 
virtual uiString uiMessage () const
 will be message() again in 7.x More...
 
virtual uiString uiNrDoneText () const
 will be nrDoneText() in 7.x More...
 
bool workControlEnabled () const
 
- Public Member Functions inherited from NamedCallBacker
 NamedCallBacker (const char *nm=0)
 
 NamedCallBacker (const NamedCallBacker &)
 
virtual Notifier< NamedCallBacker > & objectToBeDeleted () const
 
bool operator== (const NamedCallBacker &oth) const
 
bool operator== (const NamedObject &oth) const
 
- Public Member Functions inherited from CallBacker
 CallBacker ()
 
 CallBacker (const CallBacker &)
 
virtual ~CallBacker ()
 
bool attachCB (const NotifierAccess &, const CallBack &, bool onlyifnew=false) const
 
bool attachCB (const NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false) const
 
void detachAllNotifiers () const
 Call from the destructor of your inherited object. More...
 
void detachCB (const NotifierAccess &, const CallBack &) const
 
void detachCB (const NotifierAccess *notif, const CallBack &cb) const
 
virtual bool isCapsule () const
 
bool isNotifierAttached (const NotifierAccess *) const
 Only for debugging purposes, don't use. More...
 
void stopReceivingNotifications () const
 
virtual CallBackertrueCaller ()
 
- Public Member Functions inherited from NamedObject
 NamedObject (const char *nm=nullptr)
 
 NamedObject (const NamedObject &oth)
 
virtual ~NamedObject ()
 
virtual BufferString getName () const
 
bool getNameFromPar (const IOPar &)
 
const name_typename () const override
 
NamedObjectoperator= (const NamedObject &)
 
bool operator== (const NamedObject &oth) const
 
virtual void setName (const char *nm)
 
- Public Member Functions inherited from ObjectWithName
virtual ~ObjectWithName ()
 
bool hasName (const char *nm) const
 
bool hasName (const name_type &nm) const
 
void putNameInPar (IOPar &) const
 
- Public Member Functions inherited from Stats::BaseCalc< T >
virtual ~BaseCalc ()
 
double average () const
 
void clear ()
 
clipVal (float ratio, bool upper) const
 requires sort; 0 <= ratio <= 1 More...
 
size_type count () const
 
extreme (idx_type *index_of_extr=0) const
 
idx_type getIndex (Type) const
 only for Median, Min and Max More...
 
double getValue (Type) const
 
bool hasUndefs () const
 
bool isEmpty () const
 
bool isWeighted () const
 
max (idx_type *index_of_max=0) const
 
median (idx_type *index_of_median=0) const
 
const T * medValsArr () const
 
min (idx_type *index_of_min=0) const
 
mostFreq () const
 
float_complex mostFreq () const
 
 mUseType (CalcSetup, idx_type)
 
 mUseType (CalcSetup, size_type)
 
double normvariance () const
 
double rms () const
 
const CalcSetupsetup () const
 
size_type size (bool used=true) const
 
sqSum () const
 
double stdDev () const
 
sum () const
 
double variance () const
 

Protected Member Functions

bool doFinish (bool)
 
bool doFinish (bool) override
 
bool doPrepare (int) override
 
bool doWork (od_int64, od_int64, int)
 
bool doWork (od_int64, od_int64, int) override
 
od_int64 nrIterations () const override
 
const float_complex * sort (idx_type *idx_of_med)
 
const T * sort (idx_type *index_of_median=nullptr) override
 
- Protected Member Functions inherited from ParallelTask
 ParallelTask (const char *nm=0)
 
 ParallelTask (const ParallelTask &)
 
void addToNrDone (std::int64_t increment)
 
std::int64_t calculateThreadSize (std::int64_t totalnr, int nrthreads, int thread) const
 
virtual int maxNrThreads () const
 
virtual int minThreadSize () const
 
void quickAddToNrDone (std::int64_t loopidx)
 
void resetNrDone ()
 
virtual bool stopAllOnFailure () const
 
- Protected Member Functions inherited from ReportingTask
 ReportingTask (const char *nm=nullptr)
 
void incrementProgress ()
 
ProgressMeterprogressMeter () const
 
void reportProgressFinished ()
 
void reportProgressStarted ()
 
void resetProgress ()
 
void setProgressMeter (ProgressMeter *) override
 Must be called before execute() More...
 
void updateProgressMeter (bool forced=false, std::int64_t *totalnr=0)
 
void updateReportedName ()
 
- Protected Member Functions inherited from Task
 Task (const char *nm=nullptr)
 
virtual bool shouldContinue ()
 
- Protected Member Functions inherited from NamedCallBacker
void sendDelNotif () const
 
- Protected Member Functions inherited from Stats::BaseCalc< T >
 BaseCalc (const CalcSetup &s)
 
computeMedian (idx_type *index_of_median=nullptr) const
 
computeWeightedMedian (idx_type *index_of_median=nullptr) const
 
bool isZero (const double &val) const
 
bool isZero (const float &val) const
 
bool isZero (const T &) const
 
const float_complex * sort (idx_type *idx_of_med)
 

Protected Attributes

Threads::Barrier barrier_
 
const T * data_ = nullptr
 
uiString errmsg_
 
meanval_
 
meanval_w_
 
bool * udfarr_ = nullptr
 
variance_
 
variance_w_
 
const T * weights_ = nullptr
 
- Protected Attributes inherited from Task
Control control_
 
Threads::ConditionVarworkcontrolcondvar_
 
- Protected Attributes inherited from NamedCallBacker
Threads::Atomic< bool > delalreadytriggered_
 
Notifier< NamedCallBackerdelnotif_
 
- Protected Attributes inherited from NamedObject
BufferString name_
 
- Protected Attributes inherited from Stats::BaseCalc< T >
LargeValVec< idx_type > clss_
 
LargeValVec< T > clsswt_
 
bool issorted_ = false
 
idx_type maxidx_
 
maxval_
 
LargeValVec< idx_type > medidxs_
 
LargeValVec< T > medvals_
 
LargeValVec< T > medwts_
 
idx_type minidx_
 
minval_
 
size_type nradded_
 
Threads::Atomic< size_type > nrused_
 
CalcSetup setup_
 
sum_w_
 
sum_wx_
 
sum_wxx_
 
sum_x_
 
sum_xx_
 

Additional Inherited Members

- Public Types inherited from Task
enum  Control { Run , Pause , Stop }
 
- Public Types inherited from ObjectWithName
typedef OD::String name_type
 
- Static Public Member Functions inherited from ParallelTask
static uiString sPosFinished ()
 
static uiString sTrcFinished ()
 
- Static Public Member Functions inherited from Task
static uiString stdNrDoneText ()
 
static uiString uiStdNrDoneText ()
 
- Static Public Member Functions inherited from CallBacker
static void createReceiverForCurrentThread ()
 
static void removeReceiverForCurrentThread ()
 
- Public Attributes inherited from ReportingTask
Notifier< ReportingTaskprogressUpdated
 

Detailed Description

template<class T>
class Stats::ParallelCalc< T >

Stats computation running in parallel.

The difference with the running values (Stats::RunCalc) is that you have to pass the entire data array prior to the execution.

It also works with optional weights.

<>

Constructor & Destructor Documentation

◆ ParallelCalc() [1/2]

template<class T >
Stats::ParallelCalc< T >::ParallelCalc ( const CalcSetup s,
const T *  data,
size_type  sz,
const T *  weights = 0 
)
inline

◆ ParallelCalc() [2/2]

template<class T >
Stats::ParallelCalc< T >::ParallelCalc ( const CalcSetup s)
inline

Member Function Documentation

◆ doFinish() [1/2]

bool Stats::ParallelCalc< float_complex >::doFinish ( bool  success)
inlineprotectedvirtual

Called after all doWork have finished.

Parameters
successindicates whether all doWork returned true.

Reimplemented from ParallelTask.

◆ doFinish() [2/2]

template<class T >
bool Stats::ParallelCalc< T >::doFinish ( bool  success)
inlineoverrideprotectedvirtual

Called after all doWork have finished.

Parameters
successindicates whether all doWork returned true.

Reimplemented from ParallelTask.

◆ doPrepare()

template<class T >
bool Stats::ParallelCalc< T >::doPrepare ( int  nrthreads)
inlineoverrideprotectedvirtual

Called once, before any doWork is called.

Reimplemented from ParallelTask.

◆ doWork() [1/2]

bool Stats::ParallelCalc< float_complex >::doWork ( od_int64  ,
od_int64  ,
int   
)
inlineprotected

◆ doWork() [2/2]

template<class T >
bool Stats::ParallelCalc< T >::doWork ( od_int64  start,
od_int64  stop,
int  thread 
)
inlineoverrideprotected

◆ errMsg()

template<class T >
const uiString Stats::ParallelCalc< T >::errMsg ( ) const
inline

◆ mUseType() [1/2]

template<class T >
Stats::ParallelCalc< T >::mUseType ( CalcSetup  ,
idx_type   
)

◆ mUseType() [2/2]

template<class T >
Stats::ParallelCalc< T >::mUseType ( CalcSetup  ,
size_type   
)

◆ nrIterations()

template<class T >
od_int64 Stats::ParallelCalc< T >::nrIterations ( ) const
inlineoverrideprotectedvirtual
Returns
the number of times the process should be run.

Implements ParallelTask.

◆ setEmpty()

template<class T >
void Stats::ParallelCalc< T >::setEmpty
inline

◆ setValues()

template<class T >
void Stats::ParallelCalc< T >::setValues ( const T *  inp,
size_type  sz,
const T *  wght = 0 
)
inline

◆ sort() [1/2]

const float_complex * Stats::ParallelCalc< float_complex >::sort ( idx_type *  idx_of_med)
inlineprotectedvirtual

Reimplemented from Stats::BaseCalc< T >.

◆ sort() [2/2]

template<class T >
const T * Stats::ParallelCalc< T >::sort ( idx_type *  index_of_median = nullptr)
inlineoverrideprotectedvirtual

Reimplemented from Stats::BaseCalc< T >.

◆ variance() [1/2]

double Stats::ParallelCalc< float_complex >::variance ( ) const
inlinevirtual

Reimplemented from Stats::BaseCalc< T >.

◆ variance() [2/2]

template<class T >
double Stats::ParallelCalc< T >::variance
inlineoverridevirtual

Reimplemented from Stats::BaseCalc< T >.

Member Data Documentation

◆ barrier_

template<class T >
Threads::Barrier Stats::ParallelCalc< T >::barrier_
mutableprotected

◆ data_

template<class T >
const T* Stats::ParallelCalc< T >::data_ = nullptr
protected

◆ errmsg_

template<class T >
uiString Stats::ParallelCalc< T >::errmsg_
protected

◆ meanval_

template<class T >
T Stats::ParallelCalc< T >::meanval_
protected

◆ meanval_w_

template<class T >
T Stats::ParallelCalc< T >::meanval_w_
protected

◆ udfarr_

template<class T >
bool* Stats::ParallelCalc< T >::udfarr_ = nullptr
protected

◆ variance_

template<class T >
T Stats::ParallelCalc< T >::variance_
protected

◆ variance_w_

template<class T >
T Stats::ParallelCalc< T >::variance_w_
protected

◆ weights_

template<class T >
const T* Stats::ParallelCalc< T >::weights_ = nullptr
protected

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