Introduction to StepCore Design

Main classes in the StepCore are World, Item (Body and Force) and Solver.

Item is the root of the physical bodies and forces hierarchy. Body is an interface for bodies (anything that has dynamic variables that require ODE integration) and Force is an interface for forces (anything that acts upon bodies changing derivatives of dynamic variables). One Item can be a Body and a Force at the same time: for example massive spring or fluid.

World distinguishes between Body and Force using dynamic_cast. This is also used by Force to distinguish between Body types.

Solver is an interface for generic ODE solvers. It is quite general so it can be used not only by World but also by Body or Force that may require it (massive springs ?), and it allows to implement variety of integration algorithms.

World encapsulates multiple Items and one Solver. It also provides World::doEvolve() function which control integration.

Integration algorithm (World::doEvolve()) is like the following:

  1. Gather all dynamic variables from all Bodies in one array
  2. Call Solver::doEvolve() function which will call World::solverFunction() as callback when Solver needs to calculate variable derivatives (Solver may call the callback several times during one step with different variable adjustments - it depends on integration algorithm)
  3. World::solverFunction() function does:
    1. scatters variables to Bodies and updates World::time
    2. calls Force::calcForce() for all forces
    3. gathers variable derivatives from all Bodies
  4. World::doEvolve() scatters variables to all Bodies and updates World::time

Currently I'm thinking how to avoid variables copying but preserve generic solvers. One of the ideas it to store variables in array permanently and only its indexes in bodies, as a side effect this will allow saving world state at several moments simultaneously.

Latter one more Item interface will be added: Restriction. It will manage all movement restrictions - anchors, collisions, etc. Restrictions will be calculated after Forces and will compute force adjustments. More details are still to be decided.

StepCore still depends on Qt (it uses QString, QVariant and QXml), this dependency will be removed in the future.

Vector is a template for generic fixed-length vector with some common methods on it. This is quite simple, if StepCore will require more I will look at Eigen library.


Generated on Thu Mar 15 14:23:37 2007 for StepCore by  doxygen 1.5.1