HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_SolverSwitch.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_SolverSwitch_h__
9 #define __SIM_SolverSwitch_h__
10 
11 #include "SIM_API.h"
12 #include "SIM_Solver.h"
13 #include "SIM_OptionsUser.h"
14 
15 /// This solver class passes the solve responsibility to one or more other
16 /// solvers. It searches for any SIM_Solver subdata attached to itself, and
17 /// and calls the one that matches the object's swithch value.
19  public SIM_OptionsUser
20 {
21 public:
23  GETSET_DATA_FUNCS_B("usedefswitchvalue", UseDefSwitchValue);
24  GETSET_DATA_FUNCS_B("valueenablesall", ValueEnablesAll);
26 
27 protected:
28  /// Basic SIM_SolverSwitch constructor.
29  explicit SIM_SolverSwitch(const SIM_DataFactory *factory);
30  /// Basic SIM_SolverSwitch destructor.
31  ~SIM_SolverSwitch() override;
32 
33  /// We are static if our switch is invalid or our input is.
34  bool isStaticSubclass(const SIM_Object *obj) const override;
35 
36  /// Override this function to pass this call along to our child solvers.
38  SIM_Engine &engine,
39  SIM_ObjectArray &objects,
40  SIM_ObjectArray &newobjects,
41  SIM_ObjectArray &feedbacktoobjects,
42  const SIM_Time &timestep) override;
44  SIM_Engine &engine,
45  SIM_Relationship &relation,
46  const SIM_Time &timestep) override;
47  /// Override this function to get the requirements of our child solvers.
48  int getRequestedCacheSubclass() const override;
50  const SIM_Object &object,
51  const UT_Vector3 &impulseworldpos,
52  UT_DMatrix3 &immatrix) const override;
54  const SIM_Object &object,
55  int ptnum,
56  UT_DMatrix3 &immatrix) const override;
59  const SIM_Object &object) const override;
61  const SIM_Object &object,
62  const UT_Vector3 &worldpos,
63  const SIM_Property &property) const override;
65  const SIM_Object &object,
66  int ptnum,
67  const SIM_Property &property) const override;
69  const SIM_Object &object,
70  UT_String &label) const override;
72  const SIM_Object &object,
73  const UT_String &colliderlabel,
74  UT_String &collidertype,
75  bool &colliderreverseobjectroles
76  ) const override;
77 
78 private:
79  int getSubSolverAssignment(const SIM_Object &object,
80  SIM_ConstSolverArray &subsolvers,
81  const char *switchvaluename) const;
82  void getSubSolverAssignments(SIM_ObjectArray &objects,
83  SIM_SolverArray &subsolvers,
84  const char *switchvaluename,
86 
87  static const SIM_DopDescription *getSolverSwitchDopDescription();
88 
89  SIM_Solver *myCurrentSolver;
90 
93  SIM_Solver,
94  "Switch Solver",
95  getSolverSwitchDopDescription());
96 };
97 
98 #endif
99 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define GETSET_DATA_FUNCS_B(DataName, FuncName)
#define GETSET_DATA_FUNCS_S(DataName, FuncName)
virtual void getDefaultColliderSubclass(const SIM_Object &object, const UT_String &colliderlabel, UT_String &collidertype, bool &colliderreverseobjectroles) const
virtual int getRequestedCacheSubclass() const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
Holds pointers to a number of SIM_Object objects.
GLhandleARB obj
Definition: glew.h:6266
INT property
Definition: wglew.h:145
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
virtual void getImpulseMassMatrixSubclass(const SIM_Object &object, const UT_Vector3 &impulseworldpos, UT_DMatrix3 &immatrix) const
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
virtual SIM_PointImpulseMassMatrixResolver * getPointImpulseMassMatrixResolverSubclass(const SIM_Object &object) const
Builds a resolver for evaluating mass matrices swiftly.
virtual SIM_Result solveObjectsSubclass(SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)=0
virtual fpreal getPropertyAtPositionSubclass(const SIM_Object &object, const UT_Vector3 &worldpos, const SIM_Property &property) const
virtual void getDefaultColliderLabelSubclass(const SIM_Object &object, UT_String &label) const
Gets the default collider label for an object using this solver.
#define SIM_NAME_SWITCHVALUENAME
Definition: SIM_Names.h:197
fpreal64 fpreal
Definition: SYS_Types.h:277
#define SIM_NAME_DEFAULTSWITCHVALUE
Definition: SIM_Names.h:98
#define SIM_API
Definition: SIM_API.h:10
virtual SIM_Result solveRelationshipSubclass(SIM_Engine &engine, SIM_Relationship &relationship, const SIM_Time &timestep)
Definition: SIM_Solver.h:182
virtual void getPointImpulseMassMatrixSubclass(const SIM_Object &object, int ptnum, UT_DMatrix3 &immatrix) const
virtual bool isStaticSubclass(const SIM_Object *obj) const
Determines if this solver does nothing on the object.
Definition: SIM_Solver.h:159
SIM_Property
virtual fpreal getPropertyAtPointSubclass(const SIM_Object &object, int ptnum, const SIM_Property &property) const