diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C index 0ffe75d2e657ba40a62a791e49d9c91224d6a2e1..7907c17b8ba1bf6f5767e78494782cbd6c0b7ede 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C @@ -274,6 +274,16 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation } +Foam::EulerCoordinateRotation::EulerCoordinateRotation +( + const EulerCoordinateRotation& r +) +: + R_(r.R_), + Rtr_(r.Rtr_) +{} + + void Foam::EulerCoordinateRotation::write(Ostream& os) const { os.writeKeyword("e1") << e1() << token::END_STATEMENT << nl; diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H index 362c846fe15e38505a2f0eff983d92b228282e44..d1694c3d20bab3911da39d82df9af1819a833f8b 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H @@ -120,6 +120,21 @@ public: //- Construct from dictionary and mesh EulerCoordinateRotation(const dictionary&, const objectRegistry&); + //- Construct as copy + EulerCoordinateRotation(const EulerCoordinateRotation&); + + //- Return clone + autoPtr<coordinateRotation> clone() const + { + return autoPtr<coordinateRotation> + ( + new EulerCoordinateRotation + ( + *this + ) + ); + } + // Member Functions diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C index fde7eb39cc270e744967d6575e081c57082929d4..06265a721ba0e300850878b38d5d2affb7018766 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C @@ -271,6 +271,16 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation } +Foam::STARCDCoordinateRotation::STARCDCoordinateRotation +( + const STARCDCoordinateRotation& r +) +: + R_(r.R_), + Rtr_(r.Rtr_) +{} + + void Foam::STARCDCoordinateRotation::write(Ostream& os) const { os.writeKeyword("e1") << e1() << token::END_STATEMENT << nl; diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H index 1b73f71ee2aae3de871b824779e25567700e23e1..b124f3d4c3541625d88a9ad53ca0c74310d30890 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H @@ -117,7 +117,23 @@ public: //- Construct from dictionary and mesh STARCDCoordinateRotation(const dictionary&, const objectRegistry&); - // Member Functions + //- Construct as copy + STARCDCoordinateRotation(const STARCDCoordinateRotation&); + + //- Return clone + autoPtr<coordinateRotation> clone() const + { + return autoPtr<coordinateRotation> + ( + new STARCDCoordinateRotation + ( + *this + ) + ); + } + + + // Member Functions //- Reset rotation to an identity rotation virtual void clear() diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C index c28a6fd3b480896e7c82a74ac977700569b147d2..70bb54e640e83b7e7d0b33950dec9bb0dc0f4b74 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C @@ -157,6 +157,14 @@ Foam::axesRotation::axesRotation(const tensor& R) {} +Foam::axesRotation::axesRotation(const axesRotation& r) +: + R_(r.R_), + Rtr_(r.Rtr_) +{} + + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::tensorField& Foam::axesRotation::Tr() const diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H index 937f28c04193ce22b2014683f028b55ccd17b2d5..f0be4d09b7ce75fc8b98971dc722ea3e8116ace2 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H @@ -111,10 +111,13 @@ public: //- Construct from dictionary and mesh axesRotation(const dictionary&, const objectRegistry&); + //- Construct as copy + axesRotation(const axesRotation&); + //- Return clone - autoPtr<axesRotation> clone() const + autoPtr<coordinateRotation> clone() const { - return autoPtr<axesRotation>(new axesRotation(*this)); + return autoPtr<coordinateRotation>(new axesRotation(*this)); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index ae37a3764f3a1fdc8f57f5cdef34f2d7d3755fe4..a10485a5c2fa18f6abab48db0979a76ba12a4698 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -110,6 +110,11 @@ public: (dict) ); + // Constructors + + //- Construct and return a clone + virtual autoPtr<coordinateRotation> clone() const = 0; + // Selectors diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C index a5427b5fa1e3acf2dfb2706626a2e36e687afacf..5dffccac01532f5c58cf1b3275a65d4fca0815de 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C @@ -172,6 +172,15 @@ Foam::cylindrical::cylindrical(const tensorField& R) } +Foam::cylindrical::cylindrical(const cylindrical& r) +: + Rptr_(r.Rptr_, false), // clone + origin_(r.origin_), + e3_(r.e3_) +{} + + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::cylindrical::clear() diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H index 50e0450b271c781a954bfee6e9b1a1bff371916d..df0bc55b1a3378ef0b67c398ef9b598d9dd70070 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H @@ -120,10 +120,13 @@ public: //- Construct from tensor Field cylindrical(const tensorField&); + //- Construct as copy + cylindrical(const cylindrical&); + //- Return clone - autoPtr<cylindrical> clone() const + autoPtr<coordinateRotation> clone() const { - return autoPtr<cylindrical>(new cylindrical(*this)); + return autoPtr<coordinateRotation>(new cylindrical(*this)); } diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index 68aa5e06f906347a5bdaf68df49668c48ff13656..751fd36b7e807d000a5f2f88e4eeb6fc59180d34 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -57,7 +57,7 @@ Foam::coordinateSystem::coordinateSystem name_(name), note_(), origin_(cs.origin_), - R_(const_cast<coordinateRotation*>(&cs.R())) + R_(cs.R().clone()) {} @@ -71,7 +71,7 @@ Foam::coordinateSystem::coordinateSystem name_(name), note_(), origin_(origin), - R_(const_cast<coordinateRotation*>(&cr)) + R_(cr.clone()) {}