AGXDynamics  2.35.0.3
SolveAlgorithms.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_SOLVEALGORITHMS_H
18 #define AGX_SOLVEALGORITHMS_H
19 
20 #include <agx/Vector.h>
21 
23 
24 #include <agxData/Array.h>
25 
26 
27 #ifdef _MSC_VER
28 # pragma warning( push )
29 # pragma warning( disable : 4251 ) // class X needs to have dll-interface to be used by clients of class Y
30 #endif
31 
32 namespace agx
33 {
34  // Forward declarations agx.
35  class Solver;
36  class SolveKernel;
37  class SolveJob;
38  class JobGroup;
39 
40  // Forward declarations agx::Physics.
41  namespace Physics
42  {
43  class SolveGroupPtr;
44  class SolveIslandPtr;
45  class SolveGroupData;
46  }
47 
48  // Typedefs.
50 
55  {
56  public:
63 
68  agx::JobGroup* getNewWrapperJob( agx::Solver* solver );
69 
73  agx::SolveJob* getNewSolveJob();
74 
75  protected:
80  };
81 
89  {
90  public:
94  enum Type {
98  HYBRID
99  };
100 
101  public:
111  {
112  public:
117  enum Type { EMPTY, EXIT, SINGLE, GROUP, CUSTOM };
118 
119  public:
124  {
129  };
130 
131  public:
135  Task();
136 
141  void addChild( agx::SolveAlgorithm::Task* child );
142 
147  agx::SolveAlgorithm::Task* getChild( agx::UInt i ) const;
148 
152  agx::UInt getNumChildren() const;
153 
157  agx::SolveAlgorithm::Task* getParent() const;
158 
163 
169  virtual agx::SolveKernel* getSolveKernel( agx::Solver* solver ) const;
170 
176  virtual agx::SolveKernel* getSolveKernel( agx::Physics::SolveGroupPtr group ) const;
177 
178  virtual void customSetup(Solver *solver, JobGroup *entry, JobGroup *exit);
179 
180  protected:
186 
190  virtual ~Task();
191 
192  protected:
194 
195  protected:
199  };
200 
202 
203  public:
210  static agx::SolveAlgorithm::Type findSolveAlgorithm( agx::Physics::SolveIslandPtr island, UInt numZones );
211 
212  public:
218  virtual agx::SolveAlgorithm::Task* instantiate();
219 
230  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;
231 
239  virtual void generateJobs( agx::JobGenerator& generator, const SolveAlgorithm::Task::ConditionData& conditionData, agx::Physics::SolveIslandPtr island, const agx::Physics::SolveGroupData& solveGroup );
240 
241  protected:
245  SolveAlgorithm(Solver *solver);
246 
250  virtual ~SolveAlgorithm();
251 
258  virtual agx::SolveAlgorithm::Task* create(bool useComplexImpactStage) = 0;
259 
270  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 );
271 
275  agx::Solver* getSolver() { return m_solver; }
276 
277  protected:
279  agx::Solver* m_solver;
280  };
281 
283 
288  {
289  public:
293  EmptySolver(Solver *solver);
294 
295  protected:
299  virtual ~EmptySolver();
300 
304  virtual SolveAlgorithm::Task* create(bool useComplexImpactStage) override;
305  };
306 
312  {
313  public:
317  PureIterativeSolver( Solver *solver );
318 
319  protected:
323  virtual ~PureIterativeSolver();
324 
329  virtual SolveAlgorithm::Task* create(bool useComplexImpactStage) override;
330 
331  protected:
335  };
336 
342  {
343  public:
347  PureDirectSolver(Solver *solver);
348 
349  protected:
353  virtual ~PureDirectSolver();
354 
359  virtual SolveAlgorithm::Task* create(bool useComplexImpactStage) override;
360  };
361 
367  {
368  public:
372  HybridSolver( agx::Solver *solver );
373 
374  protected:
378  virtual ~HybridSolver();
379 
384  virtual SolveAlgorithm::Task* create(bool useComplexImpactStage) override;
385 
386  protected:
391  };
392 }
393 
394 #ifdef _MSC_VER
395 # pragma warning( pop )
396 #endif
397 
398 #endif
agx::PureIterativeSolver
Algorithm for pure iterative solve.
Definition: SolveAlgorithms.h:311
agx::SolveAlgorithm::Task::SolveAlgorithmTaskContainer
agx::Vector< agx::ref_ptr< SolveAlgorithm::Task > > SolveAlgorithmTaskContainer
Definition: SolveAlgorithms.h:193
agx::HybridSolver::m_numImpactIterations
agx::UInt m_numImpactIterations
Definition: SolveAlgorithms.h:387
Vector.h
agx::SolveAlgorithm::Type
Type
Solve algorithm type "guessed" by findSolveAlgorithm.
Definition: SolveAlgorithms.h:94
agx::Physics::SolveIslandPtr
Pointer to a entity instance of type Physics.SolveIsland.
Definition: SolveIslandEntity.h:185
agx::SolveAlgorithm::PURE_DIRECT
@ PURE_DIRECT
Only direct constraints.
Definition: SolveAlgorithms.h:96
agx::Vector
Templated vector class.
Definition: Vector.h:52
agx::SolveAlgorithm::Task::m_type
agx::SolveAlgorithm::Task::Type m_type
Definition: SolveAlgorithms.h:198
agx::SolveAlgorithm::Task::m_children
agx::SolveAlgorithm::Task::SolveAlgorithmTaskContainer m_children
Definition: SolveAlgorithms.h:196
agxData::getType
AGXCORE_EXPORT Type * getType(const agx::String &name)
agx::HybridSolver::m_numDryFrictionIterations
agx::UInt m_numDryFrictionIterations
Definition: SolveAlgorithms.h:389
agx::PureIterativeSolver::m_numImpactIterations
agx::UInt m_numImpactIterations
Definition: SolveAlgorithms.h:332
agx::PureIterativeSolver::m_numPPGSIterations
agx::UInt m_numPPGSIterations
Definition: SolveAlgorithms.h:334
agx::JobGroupPtrVector
agx::VectorPOD< agx::JobGroup * > JobGroupPtrVector
Definition: SolveAlgorithms.h:49
agx::PureDirectSolver
Algorithm for pure direct solve.
Definition: SolveAlgorithms.h:341
agx::SolveAlgorithm::Task::ConditionData::impacting
agx::Bool impacting
Definition: SolveAlgorithms.h:125
agx::Physics::SolveGroupPtr
Pointer to a entity instance of type Physics.SolveGroup.
Definition: SolveGroupEntity.h:165
Array.h
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agx::JobGenerator::m_solveJobs
agxData::Array< agx::SolveJob > m_solveJobs
Definition: SolveAlgorithms.h:77
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxData::Array< agx::JobGroup >
agx::SolveAlgorithm::getSolver
agx::Solver * getSolver()
Definition: SolveAlgorithms.h:275
agx::JobGenerator::m_solveJobCounter
agx::UInt m_solveJobCounter
Definition: SolveAlgorithms.h:79
agx::SolveAlgorithm::Task::ConditionData
The type of tasks may depend on the data in this structure.
Definition: SolveAlgorithms.h:123
agx::ref_ptr< SolveAlgorithm::Task >
agx::JobGroup
A group of jobs to be executed.
Definition: Job.h:340
agx::SolveAlgorithm::TaskRef
agx::ref_ptr< SolveAlgorithm::Task > TaskRef
Definition: SolveAlgorithms.h:201
agx::SolveAlgorithm::Task::ConditionData::dryFrictionIterations
agx::Bool dryFrictionIterations
Definition: SolveAlgorithms.h:126
SolveGroupEntity.h
agx::HybridSolver
Algorithm for hybrid solve.
Definition: SolveAlgorithms.h:366
agx::SolveAlgorithm::Task::Type
Type
Task type either EMPTY branch (no callback), EXIT branch (no callback, traversal of this branch will ...
Definition: SolveAlgorithms.h:117
agx::HybridSolver::m_numRestingIterations
agx::UInt m_numRestingIterations
Definition: SolveAlgorithms.h:388
agx::JobGenerator::m_wrapperJobCounter
agx::UInt m_wrapperJobCounter
Definition: SolveAlgorithms.h:78
agx::HybridSolver::m_numPPGSIterations
agx::UInt m_numPPGSIterations
Definition: SolveAlgorithms.h:390
agx::JobGenerator::m_wrapperJobs
agxData::Array< agx::JobGroup > m_wrapperJobs
Definition: SolveAlgorithms.h:76
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
agx::JobGenerator
Utility class used to generate jobs for ALL islands.
Definition: SolveAlgorithms.h:54
agx::UInt
uint32_t UInt
Definition: Integer.h:34
agx::Bool
bool Bool
Definition: Integer.h:48
agx::SolveAlgorithm::Task::ConditionData::calculateResiduals
agx::Bool calculateResiduals
Definition: SolveAlgorithms.h:128
agx::SolveAlgorithm::Task::ConditionData::useParallelPgs
agx::Bool useParallelPgs
Definition: SolveAlgorithms.h:127
agx::SolveAlgorithm::Task::m_parent
agx::SolveAlgorithm::Task * m_parent
Definition: SolveAlgorithms.h:197
agx::EmptySolver
Algorithm for an island without solve models.
Definition: SolveAlgorithms.h:287
agx::SolveAlgorithm
Parent class for solve algorithms compatible with the constraint framework.
Definition: SolveAlgorithms.h:88
agx::PureIterativeSolver::m_numRestingIterations
agx::UInt m_numRestingIterations
Definition: SolveAlgorithms.h:333
agx::SolveAlgorithm::EMPTY
@ EMPTY
Solver for islands with zero models.
Definition: SolveAlgorithms.h:95
agx::SolveAlgorithmRef
agx::ref_ptr< SolveAlgorithm > SolveAlgorithmRef
Definition: SolveAlgorithms.h:282
agx::SolveAlgorithm::Task
Algorithm task either empty, single or group type.
Definition: SolveAlgorithms.h:110
agx::SolveAlgorithm::PURE_ITERATIVE
@ PURE_ITERATIVE
Only iterative constraints.
Definition: SolveAlgorithms.h:97
agx::SolveAlgorithm::m_solver
agx::Solver * m_solver
Definition: SolveAlgorithms.h:279
agx::SolveAlgorithm::m_root
agx::SolveAlgorithm::TaskRef m_root
Definition: SolveAlgorithms.h:278