21 # pragma warning(push) 22 # pragma warning(disable:4355) // Disable warnings about passing the 'this' pointer to base class constructors. 23 # pragma warning(disable: 6011) // Disable warningC6011: dereferencing nullptr pointer 70 Job& operator=(
const Job& other);
79 void addDependency(
Job *parent);
85 void removeDependency(
Job *parent);
91 bool hasDependency(
Job *parent);
97 void removeAllDependencies();
103 void clearChildDependencies();
109 void setNumDependencies(
agx::UInt32 numDependencies);
119 void incrementNumDependencies(
agx::UInt32 size = 1);
124 void decrementNumDependencies(
agx::UInt32 size = 1);
129 const JobPtrVector& getChildDependencies()
const;
134 const JobPtrVector& getParentDependencies()
const;
139 void setCallback(
const Callback& callback);
144 const Callback& getCallback()
const;
161 Thread *getTargetThread();
166 void setTargetThread(
Thread *thread);
176 void setTask(
Task *task);
181 SyncTag *getSyncTag();
186 void setSyncTag(SyncTag *tag);
191 Real getExecutionTime()
const;
196 const Timer& getTimer()
const;
211 Thread *getAssignedThread();
227 void setName(
const char *name);
232 const char *getName()
const;
246 virtual void implementation();
253 void execute(JobPtrVector& resolvedChildren,
Thread* thread);
306 virtual void implementation()
override;
331 virtual void implementation()
override;
348 void addJob(
Job *job);
349 const JobPtrVector& getSubJobs()
const;
354 virtual void implementation()
override;
385 const Job *getTarget()
const;
423 m_numDependencies(0),
424 m_dependencyCounter(0),
426 m_targetThread(nullptr),
427 m_assignedThread(nullptr),
600 m_jobs.push_back(job);
617 this->
init(callback, range, costPerElement);
657 :
RangeJob(callback, range, costPerElement)
673 static_cast<T *
>(
m_task)->dispatch(*
this);
710 # pragma warning(pop)
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
Real64 getTime() const
Report total elapsed time since start in milliseconds, excluding intervals when the timer was suspend...
void push_back(const T &value)
agx::Thread is a representation of an OS specific implementation of a computational thread...
An abstract job/workblock representation, which allows work threads to execute arbitrary tasks...
A job used as a synchronization utility when waiting for another job to complete. ...
void setCostEstimate(agx::UInt32 cost)
Specify the cost estimate for this job.
Generalized callback, using std::function.
void removeAllDependencies()
Remove all parent dependencies.
#define AGX_TYPE_BINDING(_Type, _Name)
agx::UInt32 getTag() const
void setTargetThread(Thread *thread)
Set the target thread which the job will be executed on.
bool hasDependency(Job *parent)
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
const JobPtrVector & getChildDependencies() const
void setTag(agx::UInt32 tag)
Set the job tag, can be used to keep track of different job classes etc.
A representation of a generic task.
The Timer class permits timing execution speed with the same refinement as the built in hardware cloc...
const JobPtrVector & getSubJobs() const
Block synchronization primitive.
A range job executes a kernel implementation on a subset of the data.
void removeDependency(Job *parent)
Remove a dependency from a job.
const JobPtrVector & getParentDependencies() const
VectorPOD< class Job * > JobPtrVector
const Timer & getTimer() const
Real getExecutionTime() const
Thread * getAssignedThread()
RangeJob & operator=(const RangeJob &other)
A task job is a job which executes an agx::Task.
Job & operator=(const Job &other)
const char * getName() const
virtual void implementation() override
Job implementation, override in subclass.
agx::UInt32 getNumDependencies() const
A group of jobs to be executed.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Templated callback with one argument.
void setNumDependencies(agx::UInt32 numDependencies)
Explicitly set the number of parent dependencies.
void setName(const char *name)
Set the name of the job, for debugging.
void setCallback(const Callback &callback)
Set the callback which is called when execute() runs.
bool findAndErase(const T &element, bool searchMultiple=false)
Find and erase an element.
void incrementNumDependencies(agx::UInt32 size=1)
Explicitly increment the number of parent dependencies.
RangeCallback m_rangeCallback
bool contains(const T2 &element) const
Test if the vector contains a certain element.
void clearChildDependencies()
Remove all child dependencies.
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements, optionally with maintained buffer allocation.
agx::UInt32 m_numDependencies
void decrementNumDependencies(agx::UInt32 size=1)
Explicitly decrement the number of parent dependencies.
Vector< RangeJob > RangeJobVector
std::atomic< Int32 > m_dependencyCounter
void setTask(Task *task)
Set the task which the job belongs to.
const Callback & getCallback() const
Return the current callback.
std::deque< class Job * > JobPtrQueue
void init(const Callback &callback=Callback(), agx::UInt32 costEstimate=100)
Initialize the job.
void addDependency(Job *parent)
Add a dependency to a job.
agx::UInt32 getCostEstimate() const
Thread * getTargetThread()
Thread * m_assignedThread
void spawn()
Schedule job for execution in thread pool.
void setSyncTag(SyncTag *tag)
Set the synchronization tag which must enter completion status before the job is executed.
void init(const RangeCallback &callback, const IndexRange &range, agx::UInt32 costPerElement=1)
agx::Callback1< const RangeJob & > RangeCallback