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 69 Job& operator=(
const Job& other);
78 void addDependency(
Job *parent);
84 void removeDependency(
Job *parent);
90 bool hasDependency(
Job *parent);
96 void removeAllDependencies();
102 void clearChildDependencies();
108 void setNumDependencies(
agx::UInt32 numDependencies);
118 void incrementNumDependencies(
agx::UInt32 size = 1);
123 void decrementNumDependencies(
agx::UInt32 size = 1);
128 const JobPtrVector& getChildDependencies()
const;
133 const JobPtrVector& getParentDependencies()
const;
138 void setCallback(
const Delegate& callback);
143 const Delegate& getCallback()
const;
160 Thread *getTargetThread();
165 void setTargetThread(
Thread *thread);
175 void setTask(
Task *task);
180 SyncTag *getSyncTag();
185 void setSyncTag(SyncTag *tag);
190 Real getExecutionTime()
const;
195 const Timer& getTimer()
const;
210 Thread *getAssignedThread();
226 void setName(
const char *name);
231 const char *getName()
const;
245 virtual void implementation();
252 void execute(JobPtrVector& resolvedChildren,
Thread* thread);
305 virtual void implementation()
override;
330 virtual void implementation()
override;
347 void addJob(
Job *job);
348 const JobPtrVector& getSubJobs()
const;
353 virtual void implementation()
override;
384 const Job *getTarget()
const;
422 m_numDependencies(0),
423 m_dependencyCounter(0),
425 m_targetThread(nullptr),
426 m_assignedThread(nullptr),
599 m_jobs.push_back(job);
616 this->
init(callback, range, costPerElement);
656 :
RangeJob(callback, range, costPerElement)
672 static_cast<T *
>(
m_task)->dispatch(*
this);
709 # pragma warning(pop) void AGXPHYSICS_EXPORT init()
Initialize agx.
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...
agx::Callback1< const RangeJob & > RangeDelegate
An abstract job/workblock representation, which allows work threads to execute arbitrary tasks...
void init(const Delegate &callback=Delegate(), agx::UInt32 costEstimate=100)
Initialize the job.
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
void setCallback(const Delegate &callback)
Set the callback which is called when execute() runs.
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.
Namespace agx 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.
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 Delegate & getCallback() const
Return the current callback.
std::deque< class Job * > JobPtrQueue
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)