AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agx::SolveAlgorithm::Task Class Reference

Algorithm task either empty, single or group type. More...

#include <SolveAlgorithms.h>

+ Inheritance diagram for agx::SolveAlgorithm::Task:

Classes

struct  ConditionData
 The type of tasks may depend on the data in this structure. More...
 

Public Types

enum  Type {
  EMPTY, EXIT, SINGLE, GROUP,
  CUSTOM
}
 Task type either EMPTY branch (no callback), EXIT branch (no callback, traversal of this branch will end), SINGLE (getSolveKernel given agx::Solver callback) or GROUP (getSolveKernel given SolveGroupPtr callback). More...
 

Public Member Functions

 Task ()
 Default constructor, type set to EMPTY. More...
 
void addChild (agx::SolveAlgorithm::Task *child)
 Add child task. More...
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
virtual void customSetup (Solver *solver, JobGroup *entry, JobGroup *exit)
 
agx::SolveAlgorithm::Task * getChild (agx::UInt i) const
 
agx::UInt getNumChildren () const
 
agx::SolveAlgorithm::Task * getParent () const
 
int getReferenceCount () const
 
virtual agx::SolveKernel * getSolveKernel (agx::Solver *solver) const
 Callback for solve algorithms task type SINGLE. More...
 
virtual agx::SolveKernel * getSolveKernel (agx::Physics::SolveGroupPtr group) const
 Callback for solve algorithms task type GROUP. More...
 
virtual
agx::SolveAlgorithm::Task::Type 
getType (const agx::SolveAlgorithm::Task::ConditionData &conditionData) const
 
template<typename T >
bool is () const
 Subclass test. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Types

typedef agx::Vector
< agx::ref_ptr
< SolveAlgorithm::Task > > 
SolveAlgorithmTaskContainer
 

Protected Member Functions

 Task (agx::SolveAlgorithm::Task::Type type)
 Construct given type. More...
 
virtual ~Task ()
 Reference counted object - protected virtual destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

agx::SolveAlgorithm::Task::SolveAlgorithmTaskContainer m_children
 
Mutex m_mutex
 
ObserverContainer m_observers
 
agx::SolveAlgorithm::Task * m_parent
 
AtomicValue m_refCount
 
agx::SolveAlgorithm::Task::Type m_type
 

Detailed Description

Algorithm task either empty, single or group type.

The type of this task determines which callback (getSolveKernel) is called. EMPTY: Includes no jobs but has children. No callback. EXIT: Includes no jobs and any children and/or dependency will be ignored. This is an exit node. No callback. SINGLE: Includes one task (given agx::Solver) and receives getSolveKernel( agx::Solver* ) callback. GROUP: Includes several tasks (given SolveGroupPtr) and receives getSolveKernel( agx::Physics::SolveGroupPtr ) callback.

Definition at line 110 of file SolveAlgorithms.h.

Member Typedef Documentation

Member Enumeration Documentation

Task type either EMPTY branch (no callback), EXIT branch (no callback, traversal of this branch will end), SINGLE (getSolveKernel given agx::Solver callback) or GROUP (getSolveKernel given SolveGroupPtr callback).

Enumerator
EMPTY 
EXIT 
SINGLE 
GROUP 
CUSTOM 

Definition at line 117 of file SolveAlgorithms.h.

Constructor & Destructor Documentation

agx::SolveAlgorithm::Task::Task ( )

Default constructor, type set to EMPTY.

agx::SolveAlgorithm::Task::Task ( agx::SolveAlgorithm::Task::Type  type)
protected

Construct given type.

Parameters
type- type of this task
virtual agx::SolveAlgorithm::Task::~Task ( )
protectedvirtual

Reference counted object - protected virtual destructor.

Member Function Documentation

void agx::SolveAlgorithm::Task::addChild ( agx::SolveAlgorithm::Task *  child)

Add child task.

Parameters
child- child task to add
void agx::Referenced::allocateObserverVector ( ) const
protectedinherited
template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().

template<typename T >
const T* agx::Referenced::as ( ) const
inherited
template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited
virtual void agx::SolveAlgorithm::Task::customSetup ( Solver *  solver,
JobGroup *  entry,
JobGroup *  exit 
)
virtual
void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
agx::SolveAlgorithm::Task* agx::SolveAlgorithm::Task::getChild ( agx::UInt  i) const
Parameters
i- index of child
Returns
child with index i
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
agx::UInt agx::SolveAlgorithm::Task::getNumChildren ( ) const
Returns
the number of children this parent class has
agx::SolveAlgorithm::Task* agx::SolveAlgorithm::Task::getParent ( ) const
Returns
parent task this this task
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
virtual agx::SolveKernel* agx::SolveAlgorithm::Task::getSolveKernel ( agx::Solver *  solver) const
virtual

Callback for solve algorithms task type SINGLE.

Parameters
solver- solver with tasks
Returns
the solve kernel for this task
virtual agx::SolveKernel* agx::SolveAlgorithm::Task::getSolveKernel ( agx::Physics::SolveGroupPtr  group) const
virtual

Callback for solve algorithms task type GROUP.

One call for each solve group.

Parameters
group- current solve group
Returns
the solve kernel for this group
virtual agx::SolveAlgorithm::Task::Type agx::SolveAlgorithm::Task::getType ( const agx::SolveAlgorithm::Task::ConditionData &  conditionData) const
virtual
Returns
the type of this solve algorithm task
template<typename T >
bool agx::Referenced::is ( ) const
inherited
void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

Referenced by agxData::Val< UInt >::Val().

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

agx::SolveAlgorithm::Task::SolveAlgorithmTaskContainer agx::SolveAlgorithm::Task::m_children
protected

Definition at line 196 of file SolveAlgorithms.h.

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

agx::SolveAlgorithm::Task* agx::SolveAlgorithm::Task::m_parent
protected

Definition at line 197 of file SolveAlgorithms.h.

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

agx::SolveAlgorithm::Task::Type agx::SolveAlgorithm::Task::m_type
protected

Definition at line 198 of file SolveAlgorithms.h.


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