step/stepcore
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 MetaObject::inherits(). 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:
- Gather all dynamic variables from all Bodies in one array
- 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)
- World::solverFunction() function does:
- scatters variables to Bodies and updates World::time
- calls Force::calcForce() for all forces
- gathers variable derivatives from all Bodies
- 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.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.