From 041fddd197391bd7e50d371316c620d60ec7c9d9 Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Tue, 7 Mar 2017 10:52:00 +0100 Subject: [PATCH] Implementation of constraints, part 3 --- .../constantAngularAcceleration.C | 10 ++++++++++ .../constantAngularAcceleration.H | 12 +++--------- .../rotationalConstraint/rotationalConstraint.H | 12 +++--------- .../constantTranslationalAcceleration.C | 10 ++++++++++ .../constantTranslationalAcceleration.H | 15 +++------------ .../translationalConstraint.H | 12 +++--------- src/ODE/sixDOF/geometricSixDOF/geometricSixDOF.C | 1 + 7 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C b/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C index 6eccb0e35..289c0560b 100644 --- a/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C +++ b/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C @@ -55,6 +55,16 @@ Foam::constantAngularAcceleration::constantAngularAcceleration {} +Foam::autoPtr +Foam::constantAngularAcceleration::clone() const +{ + return autoPtr + ( + new constantAngularAcceleration(*this) + ); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::constantAngularAcceleration::~constantAngularAcceleration() diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H b/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H index 6f1a7494b..ccc8ba922 100644 --- a/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H +++ b/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H @@ -69,15 +69,6 @@ class constantAngularAcceleration const Switch inGlobal_; - // Private Member Functions - - //- Disallow default bitwise copy construct - constantAngularAcceleration(const constantAngularAcceleration&); - - //- Disallow default bitwise assignment - void operator=(const constantAngularAcceleration&); - - public: //- Runtime type information @@ -94,6 +85,9 @@ public: const dictionary& dict ); + //- Construct and return a clone + virtual autoPtr clone() const; + // Destructor diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H b/src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H index f897cbac6..9b7a32118 100644 --- a/src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H +++ b/src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H @@ -78,15 +78,6 @@ class rotationalConstraint const sixDOFODE& sixDOFODE_; - // Private Member Functions - - //- Disallow default bitwise copy construct - rotationalConstraint(const rotationalConstraint&); - - //- Disallow default bitwise assignment - void operator=(const rotationalConstraint&); - - public: //- Runtime type information @@ -141,6 +132,9 @@ public: const dictionary& dict ); + //- Construct and return a clone + virtual autoPtr clone() const = 0; + // Selectors diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C b/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C index 9289f6c1a..bf99874a7 100644 --- a/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C +++ b/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C @@ -54,6 +54,16 @@ Foam::constantTranslationalAcceleration::constantTranslationalAcceleration {} +Foam::autoPtr +Foam::constantTranslationalAcceleration::clone() const +{ + return autoPtr + ( + new constantTranslationalAcceleration(*this) + ); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::constantTranslationalAcceleration::~constantTranslationalAcceleration() diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H b/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H index 2670eda97..472f44c1d 100644 --- a/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H +++ b/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H @@ -65,18 +65,6 @@ class constantTranslationalAcceleration const scalar a_; - // Private Member Functions - - //- Disallow default bitwise copy construct - constantTranslationalAcceleration - ( - const constantTranslationalAcceleration& - ); - - //- Disallow default bitwise assignment - void operator=(const constantTranslationalAcceleration&); - - public: //- Runtime type information @@ -93,6 +81,9 @@ public: const dictionary& dict ); + //- Construct and return a clone + virtual autoPtr clone() const; + // Destructor diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H b/src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H index 32d509ec6..3a998e23c 100644 --- a/src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H +++ b/src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H @@ -78,15 +78,6 @@ class translationalConstraint const sixDOFODE& sixDOFODE_; - // Private Member Functions - - //- Disallow default bitwise copy construct - translationalConstraint(const translationalConstraint&); - - //- Disallow default bitwise assignment - void operator=(const translationalConstraint&); - - public: //- Runtime type information @@ -141,6 +132,9 @@ public: const dictionary& dict ); + //- Construct and return a clone + virtual autoPtr clone() const = 0; + // Selectors diff --git a/src/ODE/sixDOF/geometricSixDOF/geometricSixDOF.C b/src/ODE/sixDOF/geometricSixDOF/geometricSixDOF.C index fe27835e2..edfd01340 100644 --- a/src/ODE/sixDOF/geometricSixDOF/geometricSixDOF.C +++ b/src/ODE/sixDOF/geometricSixDOF/geometricSixDOF.C @@ -312,6 +312,7 @@ void Foam::geometricSixDOF::setState(const sixDOFODE& sd) // HJ, 23/Mar/2015 coeffs_ = gsd.coeffs_; + // Copy constraints translationalConstraints_ = gsd.translationalConstraints_; rotationalConstraints_ = gsd.rotationalConstraints_; }