UniformDimensionedField: Added support for oldTime
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,8 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
)
|
||||
:
|
||||
regIOobject(io),
|
||||
dimensioned<Type>(dt)
|
||||
dimensioned<Type>(dt),
|
||||
OldTimeField<UniformDimensionedField>(this->time().timeIndex())
|
||||
{
|
||||
// Read value
|
||||
if
|
||||
@ -59,11 +60,12 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
template<class Type>
|
||||
Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
(
|
||||
const UniformDimensionedField<Type>& rdt
|
||||
const UniformDimensionedField<Type>& udt
|
||||
)
|
||||
:
|
||||
regIOobject(rdt),
|
||||
dimensioned<Type>(rdt)
|
||||
regIOobject(udt),
|
||||
dimensioned<Type>(udt),
|
||||
OldTimeField<UniformDimensionedField>(udt)
|
||||
{}
|
||||
|
||||
|
||||
@ -74,7 +76,8 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
)
|
||||
:
|
||||
regIOobject(io),
|
||||
dimensioned<Type>(regIOobject::name(), dimless, Zero)
|
||||
dimensioned<Type>(regIOobject::name(), dimless, Zero),
|
||||
OldTimeField<UniformDimensionedField>(this->time().timeIndex())
|
||||
{
|
||||
dictionary dict(readStream(typeName));
|
||||
scalar multiplier;
|
||||
@ -93,6 +96,21 @@ Foam::UniformDimensionedField<Type>::~UniformDimensionedField()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Type& Foam::UniformDimensionedField<Type>::value()
|
||||
{
|
||||
this->storeOldTimes();
|
||||
return dimensioned<Type>::value();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Type& Foam::UniformDimensionedField<Type>::value() const
|
||||
{
|
||||
return dimensioned<Type>::value();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::UniformDimensionedField<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
@ -107,6 +125,16 @@ bool Foam::UniformDimensionedField<Type>::writeData(Ostream& os) const
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::UniformDimensionedField<Type>::operator==
|
||||
(
|
||||
const UniformDimensionedField<Type>& rhs
|
||||
)
|
||||
{
|
||||
dimensioned<Type>::operator=(rhs);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::UniformDimensionedField<Type>::operator=
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,12 +40,15 @@ SourceFiles
|
||||
#include "regIOobject.H"
|
||||
#include "dimensionedType.H"
|
||||
#include "UniformField.H"
|
||||
#include "OldTimeField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type> class UniformDimensionedField;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class UniformDimensionedField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -54,7 +57,8 @@ template<class Type>
|
||||
class UniformDimensionedField
|
||||
:
|
||||
public regIOobject,
|
||||
public dimensioned<Type>
|
||||
public dimensioned<Type>,
|
||||
public OldTimeField<UniformDimensionedField<Type>>
|
||||
{
|
||||
|
||||
public:
|
||||
@ -103,6 +107,18 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Dummy reference count uniqueness test
|
||||
bool unique() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return a reference to the value
|
||||
Type& value();
|
||||
|
||||
//- Return a const-reference to the value
|
||||
const Type& value() const;
|
||||
|
||||
//- Return the non-dimensioned field
|
||||
FieldType field() const
|
||||
{
|
||||
@ -115,6 +131,7 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator==(const UniformDimensionedField<Type>&);
|
||||
void operator=(const UniformDimensionedField<Type>&);
|
||||
void operator=(const dimensioned<Type>&);
|
||||
|
||||
@ -122,6 +139,10 @@ public:
|
||||
{
|
||||
return this->value();
|
||||
}
|
||||
|
||||
//- Dummy reference count decrement
|
||||
void operator--()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user