ENH: cleanup of Enum class

- more dictionary-like methods, enforce keyType::LITERAL for all
  lookups to avoid any spurious keyword matching.

- new readEntry, readIfPresent methods

- The get() method replaces the now deprecate lookup() method.

- Deprecate lookupOrFailsafe()
  Failsafe behaviour is now an optional parameter for lookupOrDefault,
  which makes it easier to tailor behaviour at runtime.

- output of the names is now always flatted without line-breaks.
  Thus,

     os << flatOutput(someEnumNames.names()) << nl;
     os << someEnumNames << nl;

  both generate the same output.

- Constructor now uses C-string (const char*) directly instead of
  Foam::word in its initializer_list.

- Remove special enum + initializer_list constructor form since
  it can create unbounded lookup indices.

- Removd old hasEnum, hasName forms that were provided during initial
  transition from NamedEnum.

- Added static_assert on Enum contents to restrict to enum or
  integral values.  Should not likely be using this class to enumerate
  other things since it internally uses an 'int' for its values.

  Changed volumeType accordingly to enumerate on its type (enum),
  not the class itself.
This commit is contained in:
Mark Olesen
2018-10-18 12:57:32 +02:00
parent f2c78362e7
commit 3b74512231
117 changed files with 825 additions and 857 deletions

View File

@ -48,9 +48,9 @@ const Foam::Enum
Foam::tabulatedWallFunctions::general::interpolationType
>
Foam::tabulatedWallFunctions::general::interpolationTypeNames_
{
({
{ interpolationType::itLinear, "linear" },
};
});
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -132,7 +132,7 @@ Foam::tabulatedWallFunctions::general::general
)
:
tabulatedWallFunction(dict, mesh, typeName),
interpType_(interpolationTypeNames_.lookup("interpType", coeffDict_)),
interpType_(interpolationTypeNames_.get("interpType", coeffDict_)),
yPlus_(),
uPlus_(),
log10YPlus_(coeffDict_.lookup("log10YPlus")),