mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: UniformDimensionedField: do READ_IF_PRESENT for 2 argument constructor
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,7 +36,22 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
:
|
||||
regIOobject(io),
|
||||
dimensioned<Type>(dt)
|
||||
{}
|
||||
{
|
||||
// Read value
|
||||
if
|
||||
(
|
||||
(
|
||||
io.readOpt() == IOobject::MUST_READ
|
||||
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
|
||||
)
|
||||
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||
)
|
||||
{
|
||||
dictionary dict(readStream(typeName));
|
||||
this->dimensions().reset(dict.lookup("dimensions"));
|
||||
dict.lookup("value") >> this->value();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from components. Either reads or uses supplied value.
|
||||
UniformDimensionedField(const IOobject&, const dimensioned<Type>&);
|
||||
|
||||
//- Construct as copy
|
||||
|
||||
Reference in New Issue
Block a user