AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agx::RangeJob Class Reference

A range job executes a kernel implementation on a subset of the data. More...

#include <Job.h>

+ Inheritance diagram for agx::RangeJob:

Public Types

using RangeCallback = agx::RangeCallback
 
- Public Types inherited from agx::Callback
typedef std::function< void()> CallbackFunction
 

Public Member Functions

 RangeJob ()
 
 RangeJob (const RangeCallback &callback, const IndexRange &range, agx::UInt32 costPerElement=1)
 
 RangeJob (const RangeJob &other)
 
virtual ~RangeJob ()
 
void init (const IndexRange &range, agx::UInt32 costPerElement=1)
 
void init (const RangeCallback &callback, const IndexRange &range, agx::UInt32 costPerElement=1)
 
RangeJob & operator= (const RangeJob &other)
 
IndexRange & range ()
 
const IndexRange & range () const
 
- Public Member Functions inherited from agx::Job
 Job ()
 
 Job (const Callback &callback, agx::UInt32 costEstimate=100)
 
 Job (const Job &other)
 
virtual ~Job ()
 
void addDependency (Job *parent)
 Add a dependency to a job.
 
void clearChildDependencies ()
 Remove all child dependencies.
 
void decrementNumDependencies (agx::UInt32 size=1)
 Explicitly decrement the number of parent dependencies.
 
Thread * getAssignedThread ()
 
const Callback & getCallback () const
 Return the current callback.
 
const JobPtrVector & getChildDependencies () const
 
agx::UInt32 getCostEstimate () const
 
Real getExecutionTime () const
 
const char * getName () const
 
agx::UInt32 getNumDependencies () const
 
const JobPtrVector & getParentDependencies () const
 
SyncTag * getSyncTag ()
 
agx::UInt32 getTag () const
 
Thread * getTargetThread ()
 
Task * getTask ()
 
const Timer & getTimer () const
 
bool hasDependency (Job *parent)
 
virtual void implementation ()
 Job implementation, override in subclass.
 
void incrementNumDependencies (agx::UInt32 size=1)
 Explicitly increment the number of parent dependencies.
 
agx::Index & index ()
 
const agx::Index & index () const
 
void init (const Callback &callback=Callback(), agx::UInt32 costEstimate=100)
 Initialize the job.
 
Job & operator= (const Job &other)
 
void removeAllDependencies ()
 Remove all parent dependencies.
 
void removeDependency (Job *parent)
 Remove a dependency from a job.
 
bool resolve ()
 Increase the dependency counter for the job, and queue job for execution if all dependencies are resolved.
 
void setCallback (const Callback &callback)
 Set the callback which is called when execute() runs.
 
void setCostEstimate (agx::UInt32 cost)
 Specify the cost estimate for this job.
 
void setName (const char *name)
 Set the name of the job, for debugging.
 
void setNumDependencies (agx::UInt32 numDependencies)
 Explicitly set the number of parent dependencies.
 
void setSyncTag (SyncTag *tag)
 Set the synchronization tag which must enter completion status before the job is executed.
 
void setTag (agx::UInt32 tag)
 Set the job tag, can be used to keep track of different job classes etc.
 
void setTargetThread (Thread *thread)
 Set the target thread which the job will be executed on.
 
void setTask (Task *task)
 Set the task which the job belongs to.
 
void spawn ()
 Schedule job for execution in thread pool.
 
- Public Member Functions inherited from agx::Callback
 Callback ()
 
 Callback (const CallbackFunction &func, bool repeatEnable=true)
 
template<class ClassT >
 Callback (void(ClassT::*fun)(), ClassT *obj, bool repeatEnable=true)
 
const CallbackFunction & implementation () const
 Return the std representation.
 
bool isRepeating () const
 
bool isValid () const
 
 operator bool () const
 
 operator const CallbackFunction & () const
 
void operator() () const
 Execute the callback.
 
void run () const
 

Protected Member Functions

virtual void implementation () override
 Job implementation, override in subclass.
 

Protected Attributes

IndexRange m_range
 
RangeCallback m_rangeCallback
 
- Protected Attributes inherited from agx::Job
Thread * m_assignedThread
 
Callback m_callback
 
JobPtrVector m_children
 
agx::UInt32 m_cost
 
std::atomic< Int32 > m_dependencyCounter
 
agx::Index m_index
 
const char * m_name
 
agx::UInt32 m_numDependencies
 
JobPtrVector m_parents
 
SyncTagRef m_syncTag
 
agx::UInt32 m_tag
 
Thread * m_targetThread
 
Task * m_task
 
Timer m_timer
 

Detailed Description

A range job executes a kernel implementation on a subset of the data.

Definition at line 281 of file Job.h.

Member Typedef Documentation

◆ RangeCallback

Definition at line 284 of file Job.h.

Constructor & Destructor Documentation

◆ RangeJob() [1/3]

agx::RangeJob::RangeJob ( )

Definition at line 610 of file Job.h.

◆ RangeJob() [2/3]

agx::RangeJob::RangeJob ( const RangeCallback &  callback,
const IndexRange &  range,
agx::UInt32  costPerElement = 1 
)

Definition at line 613 of file Job.h.

References agx::init(), and range().

◆ RangeJob() [3/3]

agx::RangeJob::RangeJob ( const RangeJob &  other)

Definition at line 618 of file Job.h.

◆ ~RangeJob()

virtual agx::RangeJob::~RangeJob ( )
virtual

References agx::init().

Member Function Documentation

◆ implementation()

virtual void agx::RangeJob::implementation ( )
overrideprotectedvirtual

Job implementation, override in subclass.

Default implementation use a generic callback.

Reimplemented from agx::Job.

Reimplemented in agx::RangeJobT< T >.

◆ init() [1/2]

void agx::RangeJob::init ( const IndexRange &  range,
agx::UInt32  costPerElement = 1 
)

Definition at line 641 of file Job.h.

References agx::Job::init(), m_range, range(), and agx::IndexRangeT< T >::size().

◆ init() [2/2]

void agx::RangeJob::init ( const RangeCallback &  callback,
const IndexRange &  range,
agx::UInt32  costPerElement = 1 
)

Definition at line 633 of file Job.h.

References agx::Job::init(), m_range, m_rangeCallback, range(), and agx::IndexRangeT< T >::size().

◆ operator=()

RangeJob & agx::RangeJob::operator= ( const RangeJob &  other)

Definition at line 623 of file Job.h.

References agx::init(), m_range, and m_rangeCallback.

◆ range() [1/2]

IndexRange & agx::RangeJob::range ( )
Returns
The work range allocated to this job.

Definition at line 629 of file Job.h.

References m_range.

Referenced by RangeJob(), and init().

◆ range() [2/2]

const IndexRange & agx::RangeJob::range ( ) const

Definition at line 630 of file Job.h.

References m_range.

Member Data Documentation

◆ m_range

IndexRange agx::RangeJob::m_range
protected

Definition at line 311 of file Job.h.

Referenced by init(), operator=(), and range().

◆ m_rangeCallback

RangeCallback agx::RangeJob::m_rangeCallback
protected

Definition at line 310 of file Job.h.

Referenced by init(), and operator=().


The documentation for this class was generated from the following file: