AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agx::SolveAlgorithm Class Referenceabstract

Parent class for solve algorithms compatible with the constraint framework. More...

#include <SolveAlgorithms.h>

+ Inheritance diagram for agx::SolveAlgorithm:

Classes

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

Public Types

typedef agx::ref_ptr< SolveAlgorithm::Task > TaskRef
 
enum  Type { EMPTY , PURE_DIRECT , PURE_ITERATIVE , HYBRID }
 Solve algorithm type "guessed" by findSolveAlgorithm. More...
 

Public Member Functions

void calculateNumTasks (const agx::SolveAlgorithm::Task *task, const agx::SolveAlgorithm::Task::ConditionData &conditionData, agx::UInt &numEmptyTasks, agx::UInt &numSingleTasks, agx::UInt &numGroupTasks, agx::UInt &numCustomTasks) const
 After create method, this recursive method can be called to pre-calculate the number of types in the tree for a given island.
 
virtual void generateJobs (agx::JobGenerator &generator, const SolveAlgorithm::Task::ConditionData &conditionData, agx::Physics::SolveIslandPtr island, const agx::Physics::SolveGroupData &solveGroup)
 Generate jobs given the tree structure built by the implemented solve algorithm.
 
virtual agx::SolveAlgorithm::Task * instantiate ()
 Initializes a solve algorithm and/or returns the root task.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Static Public Member Functions

static agx::SolveAlgorithm::Type findSolveAlgorithm (agx::Physics::SolveIslandPtr island, UInt numZones)
 Static method to find the optimal solve algorithm for an island.
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

 SolveAlgorithm (Solver *solver)
 Protected constructor for pure virtual object.
 
virtual ~SolveAlgorithm ()
 Reference counted object, protected destructor.
 
virtual agx::SolveAlgorithm::Task * create (bool useComplexImpactStage)=0
 Create method called one time during first call to getOrCreateRoot.
 
virtual void generateJobs (agx::SolveAlgorithm::Task *task, const agx::SolveAlgorithm::Task::ConditionData &conditionData, agx::JobGroup *parentJobGroup, agx::JobGroupPtrVector &dependentJobs, agx::JobGenerator &generator, agx::Physics::SolveIslandPtr island, const agx::Physics::SolveGroupData &solveGroup)
 Recursive part of generateJobs.
 
agx::Solver * getSolver ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

agx::SolveAlgorithm::TaskRef m_root
 
agx::Solver * m_solver
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Parent class for solve algorithms compatible with the constraint framework.

The general solve algorithm is a tree structure of groups and solve jobs, where all children to the root are groups and dependent (serial) on each other.

Definition at line 88 of file SolveAlgorithms.h.

Member Typedef Documentation

◆ TaskRef

Member Enumeration Documentation

◆ Type

Solve algorithm type "guessed" by findSolveAlgorithm.

Enumerator
EMPTY 

Solver for islands with zero models.

PURE_DIRECT 

Only direct constraints.

PURE_ITERATIVE 

Only iterative constraints.

HYBRID 

Combination of direct and iterative constraints.

Definition at line 94 of file SolveAlgorithms.h.

Constructor & Destructor Documentation

◆ SolveAlgorithm()

agx::SolveAlgorithm::SolveAlgorithm ( Solver *  solver)
protected

Protected constructor for pure virtual object.

◆ ~SolveAlgorithm()

virtual agx::SolveAlgorithm::~SolveAlgorithm ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

◆ calculateNumTasks()

void agx::SolveAlgorithm::calculateNumTasks ( const agx::SolveAlgorithm::Task *  task,
const agx::SolveAlgorithm::Task::ConditionData &  conditionData,
agx::UInt &  numEmptyTasks,
agx::UInt &  numSingleTasks,
agx::UInt &  numGroupTasks,
agx::UInt &  numCustomTasks 
) const

After create method, this recursive method can be called to pre-calculate the number of types in the tree for a given island.

Parameters
task- current parent task
conditionData- branch condition data
numEmptyTasks- increment the number of empty tasks task contains
numSingleTasks- increment the number of single tasks task contains
numGroupTasks- increment the number of group tasks task contains
numCustomTasks- increment the number of custom tasks task contains

◆ create()

virtual agx::SolveAlgorithm::Task * agx::SolveAlgorithm::create ( bool  useComplexImpactStage)
protectedpure virtual

Create method called one time during first call to getOrCreateRoot.

During this call the solve algorithm should build the task tree.

Returns
the root task

Implemented in agx::EmptySolver, agx::PureIterativeSolver, agx::PureDirectSolver, and agx::HybridSolver.

◆ findSolveAlgorithm()

static agx::SolveAlgorithm::Type agx::SolveAlgorithm::findSolveAlgorithm ( agx::Physics::SolveIslandPtr  island,
UInt  numZones 
)
static

Static method to find the optimal solve algorithm for an island.

Parameters
island- island to find solve algorithm for
numZones- Number of zones
Returns
suggested, and compatible, type of the solve algorithm to use

◆ generateJobs() [1/2]

virtual void agx::SolveAlgorithm::generateJobs ( agx::JobGenerator &  generator,
const SolveAlgorithm::Task::ConditionData &  conditionData,
agx::Physics::SolveIslandPtr  island,
const agx::Physics::SolveGroupData &  solveGroup 
)
virtual

Generate jobs given the tree structure built by the implemented solve algorithm.

Parameters
generator- pool of groups and jobs
conditionData- specific condition data for current island
island- the island
solveGroup- solve group data

◆ generateJobs() [2/2]

virtual void agx::SolveAlgorithm::generateJobs ( agx::SolveAlgorithm::Task *  task,
const agx::SolveAlgorithm::Task::ConditionData &  conditionData,
agx::JobGroup *  parentJobGroup,
agx::JobGroupPtrVector &  dependentJobs,
agx::JobGenerator &  generator,
agx::Physics::SolveIslandPtr  island,
const agx::Physics::SolveGroupData &  solveGroup 
)
protectedvirtual

Recursive part of generateJobs.

Parameters
task- current parent task
conditionData- branch condition data
parentJobGroup- the job group of the parent of to task
dependentJobs- list of jobs that are dependent (only children to root)
generator- job pool
island- pointer to the current island
solveGroup- solve group data

◆ getSolver()

agx::Solver * agx::SolveAlgorithm::getSolver ( )
inlineprotected
Returns
the solver

Definition at line 275 of file SolveAlgorithms.h.

◆ instantiate()

virtual agx::SolveAlgorithm::Task * agx::SolveAlgorithm::instantiate ( )
virtual

Initializes a solve algorithm and/or returns the root task.

Note
This method has to be called for a solve algorithm to be created
Returns
the root task

Member Data Documentation

◆ m_root

agx::SolveAlgorithm::TaskRef agx::SolveAlgorithm::m_root
protected

Definition at line 278 of file SolveAlgorithms.h.

◆ m_solver

agx::Solver* agx::SolveAlgorithm::m_solver
protected

Definition at line 279 of file SolveAlgorithms.h.


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