ENH: additional read guards for dimensionedType. input consistency (#762, #1148)

- provide a lookupOrDefault constructor form, since this is a fairly
  commonly used requirement and simplifies the calling sequence.

  Before

      dimensionedScalar rhoMax
      (
          dimensionedScalar::lookupOrDefault
          (
              "rhoMax",
              pimple.dict(),
              dimDensity,
              GREAT
          )
     );

  After

      dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());

- read, readIfPresent methods with alternative lookup names.

- Mark the Istream related constructors with compile-time deprecated
  warnings.

BUG: read, readIfPresent methods not handling optional dimensions (#1148)
This commit is contained in:
Mark Olesen
2019-01-03 13:34:11 +01:00
parent af310075a0
commit 6a448016aa
58 changed files with 443 additions and 688 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,16 +36,7 @@ bool Foam::functionObjects::reference::calcType()
{
const VolFieldType& vf = *vfPtr;
dimensioned<Type> offset
(
dimensioned<Type>::lookupOrDefault
(
"offset",
localDict_,
vf.dimensions(),
Zero
)
);
dimensioned<Type> offset("offset", vf.dimensions(), Zero, localDict_);
dimensioned<Type> cellValue("value", vf.dimensions(), Zero);