Force::Custom Class Reference

#include <Force.h>

Inheritance diagram for Force::Custom:

Force PIMPLHandle VanderWallSphere

List of all members.


Detailed Description

This class can be used to define new forces.

To use it, create a class that extends Force::Custom::Implementation. You can then create an instance of it and pass it to the Force::Custom constructor:

 Force::Custom myForce(forces, new MyForceImplementation());
 

Alternatively, you can create a subclass of Force::Custom which creates the Implementation itself:

 class MyForce : public Force::Custom {
 public:
   MyForce(GeneralForceSubsystem& forces) : Force::Custom(forces, new MyForceImplementation()) {
   }
 }
 

This allows a user to simply write

 MyForce(forces);
 

and not worry about implementation classes or creating objects on the heap. If you do this, your Force::Custom subclass must not have any data members or virtual methods. If it does, it will not work correctly. Instead, store all data in the Implementation subclass.

Public Member Functions

 Custom (GeneralForceSubsystem &forces, Implementation *implementation)
 Create a Custom force.
 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS (Custom, CustomImpl, Force)

Protected Member Functions

const ImplementationgetImplementation () const
ImplementationupdImplementation ()

Classes

class  Implementation


Constructor & Destructor Documentation

Custom ( GeneralForceSubsystem forces,
Implementation implementation 
)

Create a Custom force.

Parameters:
forces the subsystem to which this force should be added
implementation the object which implements the custom force. The Force::Custom takes over ownership of the implementation object, and deletes it when the Force itself is deleted.


Member Function Documentation

SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS ( Custom  ,
CustomImpl  ,
Force   
)

const Implementation& getImplementation (  )  const [protected]

Implementation& updImplementation (  )  [protected]


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

Generated on Fri Sep 26 07:44:31 2008 for SimTKcore by  doxygen 1.5.6