coordinateSystem: Added copy constructor and assignment operator

Resolves bug-report https://bugs.openfoam.org/view.php?id=3727
This commit is contained in:
Henry Weller
2021-09-14 09:24:26 +01:00
parent 5da0d1cf6f
commit 3e15722567
2 changed files with 29 additions and 2 deletions

View File

@ -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)

View File

@ -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<coordinateSystem> clone() const
{
@ -306,6 +309,12 @@ public:
}
// Member Operators
//- Assignment operator
void operator=(const coordinateSystem&);
// IOstream Operators
friend Ostream& operator<<(Ostream&, const coordinateSystem&);