AGX Dynamics  2.37.2.0
SolveAlgorithms.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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::UInt m_numRestingIterations
AGXCORE_EXPORT Type * getType(const agx::String &name)
agx::SolveAlgorithm::TaskRef m_root
agx::SolveAlgorithm::Task::Type m_type
agx::UInt m_wrapperJobCounter
bool Bool
Definition: Integer.h:48
Solver for islands with zero models.
agx::Vector< agx::ref_ptr< SolveAlgorithm::Task > > SolveAlgorithmTaskContainer
agx::SolveAlgorithm::Task::SolveAlgorithmTaskContainer m_children
#define AGXPHYSICS_EXPORT
agx::UInt m_numDryFrictionIterations
Type
Solve algorithm type "guessed" by findSolveAlgorithm.
Algorithm task either empty, single or group type.
Pointer to a entity instance of type Physics.SolveIsland.
Pointer to a entity instance of type Physics.SolveGroup.
Base class providing referencing counted objects.
Definition: Referenced.h:119
Templated vector class.
Definition: Vector.h:52
uint32_t UInt
Definition: Integer.h:34
agx::UInt m_numPPGSIterations
agx::Solver * m_solver
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
Algorithm for hybrid solve.
A group of jobs to be executed.
Definition: Job.h:340
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Type
Task type either EMPTY branch (no callback), EXIT branch (no callback, traversal of this branch will ...
agxData::Array< agx::JobGroup > m_wrapperJobs
Algorithm for pure iterative solve.
agx::Solver * getSolver()
Parent class for solve algorithms compatible with the constraint framework.
Only direct constraints.
agx::VectorPOD< agx::JobGroup *> JobGroupPtrVector
The type of tasks may depend on the data in this structure.
agx::ref_ptr< SolveAlgorithm::Task > TaskRef
agx::UInt m_solveJobCounter
Utility class used to generate jobs for ALL islands.
Algorithm for pure direct solve.
agx::UInt m_numImpactIterations
Only iterative constraints.
agx::ref_ptr< SolveAlgorithm > SolveAlgorithmRef
agxData::Array< agx::SolveJob > m_solveJobs
Algorithm for an island without solve models.
agx::SolveAlgorithm::Task * m_parent