From 19a93cc6969b084e868f4731b65de85ccf22dfbf Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 4 Apr 2016 17:08:20 +0100 Subject: [PATCH] applications/test/rigidBodyDynamics/pendulum: Simplified using sphere constructor and body lookup by name --- .../test/rigidBodyDynamics/pendulum/pendulum.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/applications/test/rigidBodyDynamics/pendulum/pendulum.C b/applications/test/rigidBodyDynamics/pendulum/pendulum.C index ac6455b0f7..8a15aec82d 100644 --- a/applications/test/rigidBodyDynamics/pendulum/pendulum.C +++ b/applications/test/rigidBodyDynamics/pendulum/pendulum.C @@ -32,6 +32,7 @@ Description #include "rigidBodyModel.H" #include "masslessBody.H" +#include "sphere.H" #include "joints.H" using namespace Foam; @@ -50,9 +51,9 @@ int main(int argc, char *argv[]) // by a hinge which rotates about the z-axis if (testMerge) { - label hingeID = pendulum.join + pendulum.join ( - 0, + pendulum.bodyID("root"), Xt(Zero), joint::New(new joints::Rz(pendulum)), autoPtr(new masslessBody("hinge")) @@ -60,19 +61,19 @@ int main(int argc, char *argv[]) pendulum.merge ( - hingeID, + pendulum.bodyID("hinge"), Xt(vector(0, -1, 0)), - rigidBody::New("weight", 1, Zero, 0.02*I) + autoPtr(new sphere("weight", 1, 0.05)) ); } else { pendulum.join ( - 0, + pendulum.bodyID("root"), Xt(Zero), joint::New(new joints::Rz(pendulum)), - rigidBody::New("pendulum", 1, vector(0, -1, 0), 0.02*I) + rigidBody::New("pendulum", 1, vector(0, -1, 0), 1e-3*I) ); }