SIM_Solver Class Reference

#include <SIM_Solver.h>

Inheritance diagram for SIM_Solver:

SIM_Data GAS_SubSolver RBD_Solver SIM_SingleSolver SIM_SolverBlend SIM_SolverEnable SIM_SolverMulti SIM_SolverScript SIM_SolverSwitch

List of all members.

Public Types

enum  SIM_Result { SIM_SOLVER_SUCCESS, SIM_SOLVER_REPEAT, SIM_SOLVER_SUBSTEP, SIM_SOLVER_FAIL }

Public Member Functions

SIM_Result solveObjects (SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)
SIM_Result postSolveObjects (SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)
SIM_Result solveRelationship (SIM_Engine &engine, SIM_Relationship &relationship, const SIM_Time &timestep)
int getRequestedCache ()
void getImpulseMassMatrix (const SIM_Object &object, const UT_Vector3 &impulseworldpos, UT_DMatrix3 &immatrix) const
void getPointImpulseMassMatrix (const SIM_Object &object, GA_Index ptnum, UT_DMatrix3 &immatrix) const
fpreal getPropertyAtPosition (const SIM_Object &object, const UT_Vector3 &worldpos, const SIM_Property &property) const
fpreal getPropertyAtPoint (const SIM_Object &object, GA_Index ptnum, const SIM_Property &property) const
SIM_PropertyResolvergetPropertyResolver (const SIM_Object &object, const SIM_Property &property) const
 Builds a resolver to efficiently compute property values.
void getDefaultColliderLabel (const SIM_Object &object, UT_String &label) const
 Gets the default collider label for an object using this solver.
void getDefaultCollider (const SIM_Object &object, const UT_String &colliderlabel, UT_String &collidertype, bool &colliderreverseobjectroles) const
void setStartTime (const SIM_Time &starttime)
bool isStatic (const SIM_Object *obj) const

Static Public Member Functions

static const char * getPropertyAttribName (const SIM_Property &property)
static fpreal getPropertyAtPositionStatic (const SIM_Object &object, const UT_Vector3 &worldpos, const SIM_Property &property)
static fpreal getPropertyAtPointStatic (const SIM_Object &object, GA_Index ptnum, const SIM_Property &property)
static SIM_PropertyResolvergetPropertyResolverStatic (const SIM_Object &object, const SIM_Property &property)
 Static resolver for getting property values.

Protected Member Functions

 SIM_Solver (const SIM_DataFactory *factory)
 Basic SIM_Solver constructor.
virtual ~SIM_Solver ()
 Basic SIM_Solver destructor.
bool getStartTime (SIM_Time &time)
void clearStartTime ()
void getSolverSubdata (SIM_SolverArray &subsolvers, UT_StringArray *subsolvernames)
void getConstSolverSubdata (SIM_ConstSolverArray &subsolvers, UT_StringArray *subsolvernames) const
virtual bool isStaticSubclass (const SIM_Object *obj) const
 Determines if this solver does nothing on the object.
virtual SIM_Result solveObjectsSubclass (SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)=0
virtual SIM_Result postSolveObjectsSubclass (SIM_Engine &engine, SIM_ObjectArray &objects, SIM_ObjectArray &newobjects, SIM_ObjectArray &feedbacktoobjects, const SIM_Time &timestep)
virtual SIM_Result solveRelationshipSubclass (SIM_Engine &engine, SIM_Relationship &relationship, const SIM_Time &timestep)
virtual int getRequestedCacheSubclass ()
virtual void getImpulseMassMatrixSubclass (const SIM_Object &object, const UT_Vector3 &impulseworldpos, UT_DMatrix3 &immatrix) const
virtual void getPointImpulseMassMatrixSubclass (const SIM_Object &object, int ptnum, UT_DMatrix3 &immatrix) const
virtual fpreal getPropertyAtPositionSubclass (const SIM_Object &object, const UT_Vector3 &worldpos, const SIM_Property &property) const
virtual fpreal getPropertyAtPointSubclass (const SIM_Object &object, int ptnum, const SIM_Property &property) const
virtual SIM_PropertyResolvergetPropertyResolverSubclass (const SIM_Object &object, const SIM_Property &property) const
 Builds a resolver for evaulating properties swiftly.
virtual void getDefaultColliderLabelSubclass (const SIM_Object &object, UT_String &label) const
 Gets the default collider label for an object using this solver.
virtual void getDefaultColliderSubclass (const SIM_Object &object, const UT_String &colliderlabel, UT_String &collidertype, bool &colliderreverseobjectroles) const


Detailed Description

This is the base class for all Solvers. Solvers are the classes that perform the actual simulation for objects. The solver is passed a set of objects with mutual affector relationships.

Definition at line 31 of file SIM_Solver.h.


Member Enumeration Documentation

The possible return codes from a solve operation. These are kept in order of priority to make multi-solvers easier to write. Any result value from a subsolver that is greater than the previous highest subsolver result becmoes the new overall return value.

Enumerator:
SIM_SOLVER_SUCCESS 
SIM_SOLVER_REPEAT 
SIM_SOLVER_SUBSTEP 
SIM_SOLVER_FAIL 
Examples:
SIM/SIM_SolverHair.h, SIM/SNOW_Solver.C, and SIM/SNOW_Solver.h.

Definition at line 38 of file SIM_Solver.h.


Constructor & Destructor Documentation

SIM_Solver::SIM_Solver ( const SIM_DataFactory factory  )  [explicit, protected]

Basic SIM_Solver constructor.

virtual SIM_Solver::~SIM_Solver (  )  [protected, virtual]

Basic SIM_Solver destructor.


Member Function Documentation

void SIM_Solver::clearStartTime (  )  [protected]

void SIM_Solver::getConstSolverSubdata ( SIM_ConstSolverArray subsolvers,
UT_StringArray subsolvernames 
) const [protected]

Gets an array of const SIM_Solver subdata attached to this data. Useful for solvers which switch between or run other solvers.

void SIM_Solver::getDefaultCollider ( const SIM_Object object,
const UT_String colliderlabel,
UT_String collidertype,
bool &  colliderreverseobjectroles 
) const

Gets the default collider type for use on an object with a particular collider label. This information is used by SIM_Object::getCollider() to create a SIM_Collider to use for collision detection betweena pair of objects. The collidertype value returns the name of the SIM_Collider subclass to use, and the collidereverseobjectroles parameter returns whether the reverse object roles flag should be turned on for the new collider. See the ReverseObjectRoles flag in SIM_Collider for an explanation of this parameter.

void SIM_Solver::getDefaultColliderLabel ( const SIM_Object object,
UT_String label 
) const

Gets the default collider label for an object using this solver.

virtual void SIM_Solver::getDefaultColliderLabelSubclass ( const SIM_Object object,
UT_String label 
) const [protected, virtual]

Gets the default collider label for an object using this solver.

Reimplemented in RBD_Solver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverPop.

virtual void SIM_Solver::getDefaultColliderSubclass ( const SIM_Object object,
const UT_String colliderlabel,
UT_String collidertype,
bool &  colliderreverseobjectroles 
) const [protected, virtual]

Gets the default collider type for use on an object with a particular collider label.

Reimplemented in RBD_Solver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverPop.

void SIM_Solver::getImpulseMassMatrix ( const SIM_Object object,
const UT_Vector3 impulseworldpos,
UT_DMatrix3 immatrix 
) const

Gets the impulse mass matrix of an object for an impulse at the provided world space position. This function simply calls getImpulseMassMatrixSubclass().

virtual void SIM_Solver::getImpulseMassMatrixSubclass ( const SIM_Object object,
const UT_Vector3 impulseworldpos,
UT_DMatrix3 immatrix 
) const [protected, virtual]

Gets the impulse mass matrix of an object for an impulse at the provided world space position. The default implementation gets the closest point in the geometry and calls getPointImpulseMassMatrix().

Reimplemented in GAS_Integrator, GAS_SubStep, RBD_Solver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverPop.

void SIM_Solver::getPointImpulseMassMatrix ( const SIM_Object object,
GA_Index  ptnum,
UT_DMatrix3 immatrix 
) const

Gets the impulse mass matrix of an object for an impulse at the provided point on the geometry of the object. This function simply calls getPointImpulseMassMatrixSubclass().

virtual void SIM_Solver::getPointImpulseMassMatrixSubclass ( const SIM_Object object,
int  ptnum,
UT_DMatrix3 immatrix 
) const [protected, virtual]

Gets the impulse mass matrix of an object for an impulse at the provided point on the geometry of the object. The default implementation finds the world space position of the point and calls getImpulseMassMatrix().

Reimplemented in GAS_Integrator, GAS_SubStep, RBD_Solver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverPop.

fpreal SIM_Solver::getPropertyAtPoint ( const SIM_Object object,
GA_Index  ptnum,
const SIM_Property property 
) const

Gets the value of some physical property for the supplied object at a given point on the object's geometry. This function simply calls getPropertyAtPointSubclass().

static fpreal SIM_Solver::getPropertyAtPointStatic ( const SIM_Object object,
GA_Index  ptnum,
const SIM_Property property 
) [static]

Static method that implements a good standard approach to getting a property at a given point number.

virtual fpreal SIM_Solver::getPropertyAtPointSubclass ( const SIM_Object object,
int  ptnum,
const SIM_Property property 
) const [protected, virtual]

Gets the value of some physical property for the supplied object at a given point on the object's geometry.

Reimplemented in GAS_SubSolver, RBD_Solver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, and SIM_SolverSwitch.

fpreal SIM_Solver::getPropertyAtPosition ( const SIM_Object object,
const UT_Vector3 worldpos,
const SIM_Property property 
) const

Gets the value of some physical property for the supplied object at a given position in world space. This function simply calls getPropertyAtPositionSubclass().

static fpreal SIM_Solver::getPropertyAtPositionStatic ( const SIM_Object object,
const UT_Vector3 worldpos,
const SIM_Property property 
) [static]

Static method that implements a good standard approach to getting a property at a given position.

virtual fpreal SIM_Solver::getPropertyAtPositionSubclass ( const SIM_Object object,
const UT_Vector3 worldpos,
const SIM_Property property 
) const [protected, virtual]

Gets the value of some physical property for the supplied object at a given position in world space.

Reimplemented in GAS_SubSolver, RBD_Solver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, and SIM_SolverSwitch.

static const char* SIM_Solver::getPropertyAttribName ( const SIM_Property property  )  [static]

Returns the standard attribute name that corresponds to a given SIM_Property value.

SIM_PropertyResolver* SIM_Solver::getPropertyResolver ( const SIM_Object object,
const SIM_Property property 
) const

Builds a resolver to efficiently compute property values.

static SIM_PropertyResolver* SIM_Solver::getPropertyResolverStatic ( const SIM_Object object,
const SIM_Property property 
) [static]

Static resolver for getting property values.

virtual SIM_PropertyResolver* SIM_Solver::getPropertyResolverSubclass ( const SIM_Object object,
const SIM_Property property 
) const [protected, virtual]

Builds a resolver for evaulating properties swiftly.

Reimplemented in GAS_SubSolver.

int SIM_Solver::getRequestedCache (  ) 

Get the number of cached time steps we want to solve for these objects. This function calls getRequestedCacheSubclass to get the real value.

virtual int SIM_Solver::getRequestedCacheSubclass (  )  [protected, virtual]

Returns the amount of history required by this solver. Override this function if your solver requires past data to calculate the next time step. The default implementation returns 0.

Reimplemented in SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverPop.

void SIM_Solver::getSolverSubdata ( SIM_SolverArray subsolvers,
UT_StringArray subsolvernames 
) [protected]

Gets an array of SIM_Solver subdata attached to this data. Useful for solvers which switch between or run other solvers.

bool SIM_Solver::getStartTime ( SIM_Time time  )  [protected]

bool SIM_Solver::isStatic ( const SIM_Object obj  )  const [inline]

Definition at line 139 of file SIM_Solver.h.

virtual bool SIM_Solver::isStaticSubclass ( const SIM_Object obj  )  const [inline, protected, virtual]

Determines if this solver does nothing on the object.

Reimplemented in SIM_SolverEnable, SIM_SolverStatic, and SIM_SolverSwitch.

Definition at line 162 of file SIM_Solver.h.

SIM_Result SIM_Solver::postSolveObjects ( SIM_Engine engine,
SIM_ObjectArray objects,
SIM_ObjectArray newobjects,
SIM_ObjectArray feedbacktoobjects,
const SIM_Time timestep 
)

virtual SIM_Result SIM_Solver::postSolveObjectsSubclass ( SIM_Engine engine,
SIM_ObjectArray objects,
SIM_ObjectArray newobjects,
SIM_ObjectArray feedbacktoobjects,
const SIM_Time timestep 
) [inline, protected, virtual]

Reimplemented in GAS_SubSolver.

Definition at line 179 of file SIM_Solver.h.

void SIM_Solver::setStartTime ( const SIM_Time starttime  ) 

SIM_Result SIM_Solver::solveObjects ( SIM_Engine engine,
SIM_ObjectArray objects,
SIM_ObjectArray newobjects,
SIM_ObjectArray feedbacktoobjects,
const SIM_Time timestep 
)

Solve for the given objects. This function is called for each timestep after the one where the objects are first created. This function calls solveObjectSubclass to perform the real work.

virtual SIM_Result SIM_Solver::solveObjectsSubclass ( SIM_Engine engine,
SIM_ObjectArray objects,
SIM_ObjectArray newobjects,
SIM_ObjectArray feedbacktoobjects,
const SIM_Time timestep 
) [protected, pure virtual]

This method solves for some objects. It performs whatever processing is necessary to take objects from their state at one time to another. The default implementation does nothing. The objects parameter holds all the objects that should be solved for this timestep. The newobjects parameter is a set of objects that were just created in this timestep, and so should in most cases not be solved on this timestep so that they maintain correct initial conditions.

Implemented in GAS_EachDataSolver, GAS_Integrator, GAS_RepeatSolver, GAS_SubSolver, GAS_SubStep, RBD_Solver, SIM_SingleSolver, SIM_SolverBlend, SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverScript.

SIM_Result SIM_Solver::solveRelationship ( SIM_Engine engine,
SIM_Relationship relationship,
const SIM_Time timestep 
)

Solves for a relationship. Invoked if "Solver" is a subdata of a SIM_Relationship data.

virtual SIM_Result SIM_Solver::solveRelationshipSubclass ( SIM_Engine engine,
SIM_Relationship relationship,
const SIM_Time timestep 
) [inline, protected, virtual]

Reimplemented in SIM_SolverEnable, SIM_SolverMulti, SIM_SolverSwitch, and SIM_SolverSop.

Definition at line 185 of file SIM_Solver.h.


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

Generated on Thu Jan 31 00:32:09 2013 for HDK by  doxygen 1.5.9