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