From 3e157225676659a40589446f927e2eeed39c4e16 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 14 Sep 2021 09:24:26 +0100 Subject: [PATCH] coordinateSystem: Added copy constructor and assignment operator Resolves bug-report https://bugs.openfoam.org/view.php?id=3727 --- .../coordinateSystems/coordinateSystem.C | 20 ++++++++++++++++++- .../coordinateSystems/coordinateSystem.H | 11 +++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index f4fd13b105..a5a970aa39 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -89,6 +89,14 @@ Foam::coordinateSystem::coordinateSystem {} +Foam::coordinateSystem::coordinateSystem(const coordinateSystem& cs) +: + name_(cs.name_), + origin_(cs.origin_), + R_(cs.R_, false) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::coordinateSystem::~coordinateSystem() @@ -193,6 +201,16 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::coordinateSystem::operator=(const coordinateSystem& cs) +{ + name_ = cs.name_; + origin_ = cs.origin_; + R_ = cs.R_->clone(); +} + + // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<(Ostream& os, const coordinateSystem& cs) diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index ad757f81b9..00660aa92a 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,6 +160,9 @@ public: //- Construct from dictionary with a given name coordinateSystem(const word& name, const dictionary&); + //- Copy constructor + coordinateSystem(const coordinateSystem& cs); + //- Construct and return a clone virtual autoPtr clone() const { @@ -306,6 +309,12 @@ public: } + // Member Operators + + //- Assignment operator + void operator=(const coordinateSystem&); + + // IOstream Operators friend Ostream& operator<<(Ostream&, const coordinateSystem&);