Commit c1678f89 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Added copy/clone functionality to cloud integration schemes

parent 3bb7bccd
......@@ -39,6 +39,13 @@ Foam::Analytical<Type>::Analytical
{}
template<class Type>
Foam::Analytical<Type>::Analytical(const Analytical& is)
:
IntegrationScheme<Type>(is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
......@@ -59,8 +66,11 @@ Foam::Analytical<Type>::integrate
) const
{
typename IntegrationScheme<Type>::integrationResult retValue;
retValue.average() = alpha + (phi - alpha)*(1 - exp(-beta*dt))/(beta*dt);
retValue.value() = alpha + (phi - alpha)*exp(-beta*dt);
const scalar expTerm = exp(min(50, -beta*dt));
retValue.average() = alpha + (phi - alpha)*(1 - expTerm)/(beta*dt);
retValue.value() = alpha + (phi - alpha)*expTerm;
return retValue;
}
......
......@@ -59,6 +59,18 @@ public:
//- Construct from components
Analytical(const word& phiName, const dictionary& dict);
//- Copy constructor
Analytical(const Analytical& is);
//- Construct and return clone
virtual autoPtr<IntegrationScheme<Type> > clone() const
{
return autoPtr<IntegrationScheme<Type> >
(
new Analytical<Type>(*this)
);
}
//- Destructor
virtual ~Analytical();
......
......@@ -39,6 +39,13 @@ Foam::Euler<Type>::Euler
{}
template<class Type>
Foam::Euler<Type>::Euler(const Euler& is)
:
IntegrationScheme<Type>(is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
......
......@@ -59,6 +59,15 @@ public:
//- Construct from components
Euler(const word& phiName, const dictionary& dict);
//- Copy constructor
Euler(const Euler& is);
//- Construct and return clone
virtual autoPtr<IntegrationScheme<Type> > clone() const
{
return autoPtr<IntegrationScheme<Type> >(new Euler<Type>(*this));
}
//- Destructor
virtual ~Euler();
......
......@@ -39,6 +39,14 @@ Foam::IntegrationScheme<Type>::IntegrationScheme
{}
template<class Type>
Foam::IntegrationScheme<Type>::IntegrationScheme(const IntegrationScheme& is)
:
phiName_(is.phiName_),
dict_(is.dict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
......@@ -48,6 +56,38 @@ Foam::IntegrationScheme<Type>::~IntegrationScheme()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
typename Foam::IntegrationScheme<Type>::integrationResult
Foam::IntegrationScheme<Type>::integrate
(
const Type phi,
const scalar dt,
const Type alpha,
const scalar beta
) const
{
notImplemented
(
"Foam::IntegrationScheme<Type>::integrationResult"
"Foam::IntegrationScheme<Type>::integrate"
"("
"const Type, "
"const scalar, "
"const Type, "
"const scalar"
") const"
);
typename IntegrationScheme<Type>::integrationResult retValue;
retValue.average() = pTraits<Type>::zero;
retValue.value() = pTraits<Type>::zero;
return retValue;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "IntegrationSchemeNew.C"
// ************************************************************************* //
......@@ -121,9 +121,6 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
IntegrationScheme(const IntegrationScheme&);
//- Disallow default bitwise assignment
void operator=(const IntegrationScheme&);
......@@ -154,6 +151,18 @@ public:
//- Construct from components
IntegrationScheme(const word& phiName, const dictionary& dict);
//- Copy constructor
IntegrationScheme(const IntegrationScheme& is);
//- Construct and return clone
virtual autoPtr<IntegrationScheme<Type> > clone() const
{
return autoPtr<IntegrationScheme<Type> >
(
new IntegrationScheme<Type>(*this)
);
}
// Selectors
......@@ -178,7 +187,7 @@ public:
const scalar dt,
const Type alpha,
const scalar beta
) const = 0;
) const;
};
......
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