Commit 75fabe36 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Added copy/clone functionality to solids and solidMixture classes

parent 77e36020
......@@ -54,6 +54,18 @@ Foam::solidMixture::solidMixture
}
Foam::solidMixture::solidMixture(const solidMixture& s)
:
components_(s.components_),
properties_(s.properties_.size())
{
forAll(properties_, i)
{
properties_.set(i, s.properties_(i)->clone());
}
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::solidMixture> Foam::solidMixture::New
......
......@@ -59,7 +59,6 @@ namespace Foam
class solidMixture
{
// Private data
//- The names of the solids
......@@ -76,6 +75,20 @@ public:
//- Construct from dictionary
solidMixture(const dictionary&);
//- Construct copy
solidMixture(const solidMixture& lm);
//- Construct and return a clone
virtual autoPtr<solidMixture> clone() const
{
return autoPtr<solidMixture>(new solidMixture(*this));
}
//- Destructor
virtual ~solidMixture()
{}
// Selectors
......
......@@ -69,6 +69,12 @@ Foam::C::C(const dictionary& dict)
{}
Foam::C::C(const C& s)
:
solid(s)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::C::writeData(Ostream& os) const
......
......@@ -46,8 +46,8 @@ class C;
Ostream& operator<<
(
Ostream&,
const C&
Ostream&,
const C&
);
......@@ -79,6 +79,15 @@ public:
//- Construct from dictionary
C(const dictionary& dict);
//- Construct copy
C(const C& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
{
return autoPtr<solid>(new C(*this));
}
// I-O
......
......@@ -69,6 +69,12 @@ Foam::CaCO3::CaCO3(const dictionary& dict)
{}
Foam::CaCO3::CaCO3(const CaCO3& s)
:
solid(s)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::CaCO3::writeData(Ostream& os) const
......
......@@ -46,8 +46,8 @@ class CaCO3;
Ostream& operator<<
(
Ostream&,
const CaCO3&
Ostream&,
const CaCO3&
);
......@@ -80,6 +80,15 @@ public:
//- Construct from dictionary
CaCO3(const dictionary& dict);
//- Construct copy
CaCO3(const CaCO3& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
{
return autoPtr<solid>(new CaCO3(*this));
}
// I-O
......
......@@ -69,6 +69,12 @@ Foam::ash::ash(const dictionary& dict)
{}
Foam::ash::ash(const ash& s)
:
solid(s)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::ash::writeData(Ostream& os) const
......
......@@ -46,8 +46,8 @@ class ash;
Ostream& operator<<
(
Ostream&,
const ash&
Ostream&,
const ash&
);
......@@ -80,6 +80,15 @@ public:
//- Construct from dictionary
ash(const dictionary& dict);
//- Construct copy
ash(const ash& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
{
return autoPtr<solid>(new ash(*this));
}
// I-O
......
......@@ -74,6 +74,16 @@ Foam::solid::solid(const dictionary& dict)
{}
Foam::solid::solid(const solid& s)
:
rho_(s.rho_),
Cp_(s.Cp_),
K_(s.K_),
Hf_(s.Hf_),
emissivity_(s.emissivity_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::solid::writeData(Ostream& os) const
......
......@@ -133,6 +133,18 @@ public:
//- Construct from dictionary
solid(const dictionary& dict);
//- Construct copy
solid(const solid& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
{
return autoPtr<solid>(new solid(*this));
}
// Selectors
//- Return a pointer to a new solid created from input
static autoPtr<solid> New(Istream& is);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment