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  virtual ~SIM_SolverSwitch();
32 
33  /// We are static if our switch is invalid or our input is.
34  virtual bool isStaticSubclass(const SIM_Object *obj) const;
35 
36  /// Override this function to pass this call along to our child solvers.
38  SIM_ObjectArray &objects,
39  SIM_ObjectArray &newobjects,
40  SIM_ObjectArray &feedbacktoobjects,
41  const SIM_Time &timestep);
43  SIM_Relationship &relation,
44  const SIM_Time &timestep);
45  /// Override this function to get the requirements of our child solvers.
46  virtual int getRequestedCacheSubclass() const;
47  virtual void getImpulseMassMatrixSubclass(
48  const SIM_Object &object,
49  const UT_Vector3 &impulseworldpos,
50  UT_DMatrix3 &immatrix) const;
52  const SIM_Object &object,
53  int ptnum, UT_DMatrix3 &immatrix) const;
55  const SIM_Object &object) const;
56  virtual fpreal getPropertyAtPositionSubclass(const SIM_Object &object,
57  const UT_Vector3 &worldpos,
58  const SIM_Property &property) const;
59  virtual fpreal getPropertyAtPointSubclass(const SIM_Object &object,
60  int ptnum, const SIM_Property &property) const;
62  const SIM_Object &object,
63  UT_String &label) const;
64  virtual void getDefaultColliderSubclass(
65  const SIM_Object &object,
66  const UT_String &colliderlabel,
67  UT_String &collidertype,
68  bool &colliderreverseobjectroles) const;
69 
70 private:
71  int getSubSolverAssignment(const SIM_Object &object,
72  SIM_ConstSolverArray &subsolvers,
73  const char *switchvaluename) const;
74  void getSubSolverAssignments(SIM_ObjectArray &objects,
75  SIM_SolverArray &subsolvers,
76  const char *switchvaluename,
78 
79  static const SIM_DopDescription *getSolverSwitchDopDescription();
80 
81  SIM_Solver *myCurrentSolver;
82 
85  SIM_Solver,
86  "Switch Solver",
87  getSolverSwitchDopDescription());
88 };
89 
90 #endif
91 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
#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.
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:196
double fpreal
Definition: SYS_Types.h:270
#define SIM_NAME_DEFAULTSWITCHVALUE
Definition: SIM_Names.h:97
#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