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

Algorithm for hybrid solve. More...

#include <SolveAlgorithms.h>

+ Inheritance diagram for agx::HybridSolver:

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

 HybridSolver (agx::Solver *solver)
 Construct a hybrid solve algorithm based on a previous solver (use same settings) 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
 
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. More...
 
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. More...
 
int getReferenceCount () const
 
virtual agx::SolveAlgorithm::Task * instantiate ()
 Initializes a solve algorithm and/or returns the root task. More...
 
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

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

Protected Member Functions

virtual ~HybridSolver ()
 Reference counted. More...
 
void allocateObserverVector () const
 
virtual SolveAlgorithm::Task * create (bool useComplexImpactStage) override
 Creates tree structure of this type of solver. More...
 
void deleteUsingDeleteHandler () const
 
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. More...
 
agx::Solver * getSolver ()
 

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

Mutex m_mutex
 
agx::UInt m_numDryFrictionIterations
 
agx::UInt m_numImpactIterations
 
agx::UInt m_numPPGSIterations
 
agx::UInt m_numRestingIterations
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 
agx::SolveAlgorithm::TaskRef m_root
 
agx::Solver * m_solver
 

Detailed Description

Algorithm for hybrid solve.

I.e., a combination of direct and iterative solves etc..

Definition at line 366 of file SolveAlgorithms.h.

Member Typedef Documentation

Definition at line 201 of file SolveAlgorithms.h.

Member Enumeration Documentation

enum agx::SolveAlgorithm::Type
inherited

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

agx::HybridSolver::HybridSolver ( agx::Solver *  solver)

Construct a hybrid solve algorithm based on a previous solver (use same settings)

virtual agx::HybridSolver::~HybridSolver ( )
protectedvirtual

Reference counted.

Protected destructor.

Member Function Documentation

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
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
inherited

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
virtual SolveAlgorithm::Task* agx::HybridSolver::create ( bool  useComplexImpactStage)
overrideprotectedvirtual

Creates tree structure of this type of solver.

Returns
the root task of a hybrid solver

Implements agx::SolveAlgorithm.

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
static agx::SolveAlgorithm::Type agx::SolveAlgorithm::findSolveAlgorithm ( agx::Physics::SolveIslandPtr  island,
UInt  numZones 
)
staticinherited

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
virtual void agx::SolveAlgorithm::generateJobs ( agx::JobGenerator &  generator,
const SolveAlgorithm::Task::ConditionData &  conditionData,
agx::Physics::SolveIslandPtr  island,
const agx::Physics::SolveGroupData &  solveGroup 
)
virtualinherited

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
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 
)
protectedvirtualinherited

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
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
agx::Solver* agx::SolveAlgorithm::getSolver ( )
inlineprotectedinherited
Returns
the solver

Definition at line 275 of file SolveAlgorithms.h.

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

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
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

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

agx::UInt agx::HybridSolver::m_numDryFrictionIterations
protected

Definition at line 389 of file SolveAlgorithms.h.

agx::UInt agx::HybridSolver::m_numImpactIterations
protected

Definition at line 387 of file SolveAlgorithms.h.

agx::UInt agx::HybridSolver::m_numPPGSIterations
protected

Definition at line 390 of file SolveAlgorithms.h.

agx::UInt agx::HybridSolver::m_numRestingIterations
protected

Definition at line 388 of file SolveAlgorithms.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

agx::SolveAlgorithm::TaskRef agx::SolveAlgorithm::m_root
protectedinherited

Definition at line 278 of file SolveAlgorithms.h.

agx::Solver* agx::SolveAlgorithm::m_solver
protectedinherited

Definition at line 279 of file SolveAlgorithms.h.


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