ENH: Added copy/clone functionality to cloud integration schemes

This commit is contained in:
andy
2010-10-21 11:18:50 +01:00
parent 3bb7bccde4
commit c1678f897a
6 changed files with 93 additions and 6 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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"
// ************************************************************************* //

View File

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