Transfering from dev copy constructors and clones for coordinateRotation classes

This commit is contained in:
sergio
2015-12-11 10:24:55 -08:00
parent 396169c108
commit 8179509780
10 changed files with 86 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -110,6 +110,11 @@ public:
(dict)
);
// Constructors
//- Construct and return a clone
virtual autoPtr<coordinateRotation> clone() const = 0;
// Selectors

View File

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

View File

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

View File

@ -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())
{}