 |
AGXDynamics
2.35.0.3
|
Go to the documentation of this file.
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);
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();
306 virtual void implementation()
override;
348 void addJob(
Job *job);
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),
436 m_name(other.m_name),
437 m_children(other.m_children),
438 m_parents(other.m_parents),
439 m_callback(other.m_callback),
440 m_timer(other.m_timer),
441 m_numDependencies(other.m_numDependencies),
442 m_dependencyCounter(other.m_dependencyCounter.load()),
443 m_task(other.m_task),
444 m_targetThread(other.m_targetThread),
445 m_assignedThread(other.m_assignedThread),
446 m_syncTag(other.m_syncTag),
447 m_cost(other.m_cost),
449 m_index(other.m_index)
458 m_callback(callback),
459 m_numDependencies(0),
460 m_dependencyCounter(0),
462 m_targetThread(nullptr),
463 m_assignedThread(nullptr),
464 m_cost(costEstimate),
617 this->
init(callback,
range, costPerElement);
657 :
RangeJob(callback, range, costPerElement)
673 static_cast<T *
>(m_task)->dispatch(*
this);
710 # pragma warning(pop)
A task job is a job which executes an agx::Task.
void removeAllDependencies()
Remove all parent dependencies.
void setTask(Task *task)
Set the task which the job belongs to.
void decrementNumDependencies(agx::UInt32 size=1)
Explicitly decrement the number of parent dependencies.
const Callback & getCallback() const
Return the current callback.
Thread * getAssignedThread()
void init(const Callback &callback=Callback(), agx::UInt32 costEstimate=100)
Initialize the job.
void setTag(agx::UInt32 tag)
Set the job tag, can be used to keep track of different job classes etc.
bool findAndErase(const T &element, bool searchMultiple=false)
Find and erase an element.
An abstract job/workblock representation, which allows work threads to execute arbitrary tasks.
void setCallback(const Callback &callback)
Set the callback which is called when execute() runs.
RangeCallback m_rangeCallback
void clearChildDependencies()
Remove all child dependencies.
Generalized callback, using std::function.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool hasDependency(Job *parent)
virtual void implementation() override
Job implementation, override in subclass.
const JobPtrVector & getParentDependencies() const
void setName(const char *name)
Set the name of the job, for debugging.
const JobPtrVector & getChildDependencies() const
Block synchronization primitive.
A representation of a generic task.
std::deque< class Job * > JobPtrQueue
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements, optionally with maintained buffer allocation.
A group of jobs to be executed.
void init(const RangeCallback &callback, const IndexRange &range, agx::UInt32 costPerElement=1)
Real64 getTime() const
Report total elapsed time since start in milliseconds, excluding intervals when the timer was suspend...
void setNumDependencies(agx::UInt32 numDependencies)
Explicitly set the number of parent dependencies.
bool contains(const T2 &element) const
Test if the vector contains a certain element.
A range job executes a kernel implementation on a subset of the data.
Thread * getTargetThread()
Thread * m_assignedThread
const Timer & getTimer() const
const JobPtrVector & getSubJobs() const
RangeJob & operator=(const RangeJob &other)
agx::UInt32 getCostEstimate() const
void incrementNumDependencies(agx::UInt32 size=1)
Explicitly increment the number of parent dependencies.
Templated callback with one argument.
VectorPOD< class Job * > JobPtrVector
void push_back(const T &value)
The Timer class permits timing execution speed with the same refinement as the built in hardware cloc...
A job used as a synchronization utility when waiting for another job to complete.
agx::UInt32 m_numDependencies
Job & operator=(const Job &other)
const char * getName() const
agx::Callback1< const RangeJob & > RangeCallback
agx::Thread is a representation of an OS specific implementation of a computational thread.
void removeDependency(Job *parent)
Remove a dependency from a job.
Real getExecutionTime() const
#define AGX_TYPE_BINDING(_Type, _Name)
void AGXPHYSICS_EXPORT init()
Initialize agx.
Vector< RangeJob > RangeJobVector
const AGXCORE_EXPORT InvalidIndexStruct InvalidIndex
agx::UInt32 getNumDependencies() const
void addDependency(Job *parent)
Add a dependency to a job.
void setSyncTag(SyncTag *tag)
Set the synchronization tag which must enter completion status before the job is executed.
std::atomic< Int32 > m_dependencyCounter
void setCostEstimate(agx::UInt32 cost)
Specify the cost estimate for this job.
void setTargetThread(Thread *thread)
Set the target thread which the job will be executed on.
agx::UInt32 getTag() const