Open Dynamics Engine

As a final example, let’s take a look at how to thread the Open Dynamics Engine, an open-source physics engine that is available for download and experimentation from http://www.ode.org. The Open Dynamics Engine (ODE) is a physics engine with two main components: a rigid body dynamics simulation engine and a collision detection engine.

We will walk through an example, which is typical of how we approach the task of helping thread programs with Threading Building Blocks when we are asked to assist with code we have not seen before.

Having never used the code before, we downloaded it to take a look at what we could do. We ended up finding two alternative implementations: parallel_for, which is quick and easy to implement, and a more advanced use of the task scheduler to deal with dynamics. It is interesting that the tasks into which we break up our program are relatively the same, so the discovery of the parallel_for solution has the program ready for better task handling when we understand the application a little better.

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.