Skip to content
Snippets Groups Projects
Commit 6aecbac2 authored by mattijs's avatar mattijs
Browse files

ENH: UniformDimensionedField: do READ_IF_PRESENT for 2 argument constructor

parent 39426e88
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -36,7 +36,22 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField ...@@ -36,7 +36,22 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
: :
regIOobject(io), regIOobject(io),
dimensioned<Type>(dt) 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> template<class Type>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components. Either reads or uses supplied value.
UniformDimensionedField(const IOobject&, const dimensioned<Type>&); UniformDimensionedField(const IOobject&, const dimensioned<Type>&);
//- Construct as copy //- Construct as copy
......
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