rigidBodyDynamics/bodies: Complete set of clone functions to support copy construction and assignment

This commit is contained in:
Henry Weller
2016-04-07 23:04:17 +01:00
parent 746cf915d4
commit 77ed073bdb
7 changed files with 35 additions and 1 deletions

View File

@ -81,7 +81,8 @@ int main(int argc, char *argv[])
*/
// Create the pendulum model from dictionary
rigidBodyModel pendulum(dictionary(IFstream("pendulum")()));
rigidBodyModel pendulum1(dictionary(IFstream("pendulum")()));
rigidBodyModel pendulum = pendulum1;
pendulum.write(Info);

View File

@ -31,6 +31,14 @@ Foam::RBD::compositeBody::~compositeBody()
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::RBD::rigidBody> Foam::RBD::compositeBody::clone() const
{
return autoPtr<rigidBody>(new compositeBody(*this));
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::word& Foam::RBD::compositeBody::type() const

View File

@ -68,6 +68,9 @@ public:
// and the transform relative to the parent
inline compositeBody(const autoPtr<rigidBody>& bodyPtr);
//- Return clone of this compositeBody
virtual autoPtr<rigidBody> clone() const;
//- Destructor
virtual ~compositeBody();

View File

@ -44,6 +44,14 @@ namespace RBD
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::RBD::rigidBody> Foam::RBD::masslessBody::clone() const
{
return autoPtr<rigidBody>(new masslessBody(*this));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::RBD::masslessBody::~masslessBody()

View File

@ -74,6 +74,9 @@ public:
const dictionary& dict
);
//- Return clone of this masslessBody
virtual autoPtr<rigidBody> clone() const;
//- Destructor
virtual ~masslessBody();

View File

@ -44,6 +44,14 @@ namespace RBD
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::RBD::rigidBody> Foam::RBD::sphere::clone() const
{
return autoPtr<rigidBody>(new sphere(*this));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::RBD::sphere::~sphere()

View File

@ -77,6 +77,9 @@ public:
const dictionary& dict
);
//- Return clone of this sphere
virtual autoPtr<rigidBody> clone() const;
//- Destructor
virtual ~sphere();