All code is C/C++, and released under
the BSD license (BSD-new license version is used; i.e., no advertising clause).
Joint research with Prof Doug L. James, at the
Carnegie Mellon University Graphics Lab.
This code is research code, not industrial-strength code. There is no support.
If you find bugs, please let us know.
This code can numerically timestep a system of ODEs of the form:
M * q'' + (alpha * M + beta * K(q)) q' + R(q) = fext(t),where q is an unknown vector function, fext(t) are arbitrary user-provided external forces, R(q) is an arbitrary user-provided vector function, and K(q) = d R / d q is its user-provided gradient. Parameters alpha and beta are Rayleigh damping parameters. Implicit Newmark is stable even with large timesteps, but requires a system solve at every timestep. In this code, this system solve is dense, so this code is not really suitable for sparse ODEs with e.g., thousands of DOFs, but was used for dense ODEs with up to, e.g. 100 DOFs. Such ODEs are common with model reduction of large-deformation FEM deformable dynamics; appropriate R(q) and K(q) are already provided in this case.
Dependencies: BLAS, LAPACK, StVK (if used for deformable dynamics).
newmark-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
This class allows you to compute FEM internal forces and tangent stiffness matrices (and also the Hessian if you need it) for cube volumetric meshes (for full models, without any reduction), e.g., the ones stored in a sqmesh class. Large deformations are supported ("geometric nonlinearities"). The strain-stress law is linear (the Saint Venant-Kirchhoff model).
Dependencies: sqmesh, sparseMatrix.
StVK-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
This Windows executable allows you to perform the entire model reduction pre-process, from triangle meshes to data necessary to run real-time simulations. The application uses wxWidgets for the user interface (you don't need wxWidgets to run it). Also included is a real-time OpenGL application which performs the real-time simulation. Only anchored models (i.e., not free-flying models) are supported. The application also contains several useful sub-components: you can obtain and export sqmeshes for arbitrary input geometry, you can compute and export linear vibration modes (you can select constrained vertices manually, or read them from a text file), and you can compute and export modal derivaives. You can either build the reduced model from pre-existing data, or from a basis consisting of linear modes and derivatives.
This application outputs several files, which are compatible with the rest of the code available on this webpage. I.e., it produces the cubic polynomial of reduced internal forces that you can then load using the implicitNewmark class and timestep in your own code. It also produces sqmeshes loadable by the sqmesh class. All the modal matrices generated (linear modes, modal derivatives, or simulation basis matrix) can be loaded using the matrixIO class. Instructions are zipped with the executable.
Dependencies: none (this is a Windows executable, not source code).
largeModalDeformationBuilder-v1.0.zip
Version: 1.0 BETA. Released: Feb 29, 2008
This class is a container for a cube volumetric 3D mesh (all cubes are of equal size and aligned with coordinate system axes). The mesh input format is a text file, similar to Abaqus input files. The class has methods to assign material parameters to the mesh, perform various topology queries (list element vertices, seek 1-neighbors, etc.), and interpolate quantities to embedded triangle meshes (in a Free-Form Deformation (FFD) style). It can also generate the mass matrix for the given mesh. To generate a sqmesh from an input triangle mesh (optionally flood-filling interior chambers and/or including the interpolation weights), you can use the Large Modal Deformation Builder application (found on this same page).
Dependencies: minivector, sparseMatrix (for mass matrix generation).
sqmesh-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
A C++ counter to measure code execution time (requires access to the source code of the timed application). Designed for real-time system (e.g., real-time computer animation, haptics), where performance needs to be measured in milliseconds (or faster), but useful in general. You can time arbitrary segments of your code, by placing StartCounter() and StopCounter() before and after your code block. Same interface under Windows, Linux and Mac OS X.
Dependencies: none.
performanceCounter-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
Acknowledging
These routines allow you to read and write matrices from and to disk, using a special simple binary format (documented in matrixIO.h). LAPACK-style column-major format is used. Templated for both float and double datatypes. Also included are routines to multiply the matrix with a vector (BLAS required), project a vector onto a space spanned by an orthogonal matrix (BLAS required), or perform Principal Component Analysis (PCA) on the columns of the matrix (BLAS and LAPACK required).
Dependencies: none (Input/Output), BLAS (mtx-vec multiplication, projection), BLAS+LAPACK (PCA).
matrixIO-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
Acknowledging
A simple class for vector algebra on 2D vectors, 3D vectors (normalization, dot product, cross product, ...), and matrix algebra on 3x3 matrices (summation, multiplication, eigenvalue and eigenvector computation, ...).
Dependencies: none.
minivector-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
Acknowledging
This class implements sparse matrices (stores a list of indices of non-zero entries, together with non-zero double precision entries), with the common algebraic operations (incremental construction, addition, mtx-vec multiplication, load/save to disk, row-column deletion, etc.). Suitable for large sparse matrices. Also includes a rudimentary Conjugate Gradient linear system solver (for positive-definite large sparse symmetric matrices, without preconditioning). The CG Solver was implemented by following Jonathan Shewchuk's An Introduction to the Conjugate Gradient Method Without the Agonizing Pain .
Dependencies: none.
sparseMatrix-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
Acknowledging
These two classes ('RigidBodyDynamics' and 'RigidBodyDynamics_GeneralTensor') implement 6-DOF rigid dynamics of a single rigid body, as explained in:
David Baraff: "An Introduction to Physically Based Modeling: Rigid Body Simulation I: Unconstrained Rigid Body Dynamics" (SIGGRAPH 97 Course Notes)In other words, these two classes allow you to simulate the motion of a single rigid body, under any specified (potentially time-varying) external forces and torques. Arbitrary tensors of inertia are supported. The solution is computed by numerically timestepping the ordinary differential equations of rigid body motion, derived from the Newton's 2nd law, and conservation of linear momentum and angular momentum. For example, ballistic motion can be simulated if gravity is used as the external force. Objects bouncing off the ground/impacting other objects can be simulated if you combine 'RigidBodyDynamics' (or 'RigidBodyDynamics_GeneralTensor') with a collision detection algorithm that provides the contact external forces.
Only explicit Euler integration is supported at this time.
Dependencies: quaternion.
rigidBodyDynamics-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
Acknowledging
This C++ class implements quaternions and the commonly used algebraic operations on quaternions. The class is templated: you can use either float or double precision. Supports using quaternions to represent/manipulate rotations. The Matrix2Quaternion routine is borrowed from David Baraff's course notes (with permission).
Dependencies: none.
quaternion-v1.0.zip
Version: 1.0. Released: Feb 29, 2008
Acknowledging
This class integrates a single harmonic oscillator, that is,
this code can timestep the following one-dimensional Ordinary Differential Equation:
M * q''(t) + C * q'(t) + K * q(t) = f(t),
where M,C,K are scalar constants, and
f=f(t) is a given (discretely sampled) function of time, and
q=q(t) is the unknown (i.e., what we are solving for).
The system must be underdamped (as is the case in, e.g., sound simulations):
C < 2 * sqrt(M*K).Doug L. James, Jernej Barbic, Dinesh K. Pai: Precomputed Acoustic Transfer: Output-sensitive, accurate sound generation for geometrically complex vibration sources, ACM Transactions on Graphics 25(3) (SIGGRAPH 2006), p. 987-995, Boston, MA, August 2006.
Dependencies: none
harmonicOscillator_IIR-v1.0.zip
Version: 1.0. Released: Feb 29, 2008