diff --git a/bin/foamSequenceVTKFiles b/bin/foamSequenceVTKFiles index de4193285a..836f31e049 100755 --- a/bin/foamSequenceVTKFiles +++ b/bin/foamSequenceVTKFiles @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -44,7 +44,6 @@ usage() { cat < specify case directory (default = local dir) -dir | -d post-processing directory (default = postProcessing) diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C index 05733eadf2..f96bea14fe 100644 --- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C +++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,4 +120,25 @@ Foam::wordList Foam::NamedEnum::words() } +template +const char* Foam::NamedEnum::operator[](const Enum e) const +{ + unsigned int ue = unsigned(e); + + if (ue < nEnum) + { + return names[ue]; + } + else + { + FatalErrorInFunction + << "names array index " << ue << " out of range 0-" + << nEnum - 1 + << exit(FatalError); + + return names[0]; + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.H b/src/OpenFOAM/containers/NamedEnum/NamedEnum.H index e5ed68ddbf..7d9fae597b 100644 --- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.H +++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,6 @@ SourceFiles #include "HashTable.H" #include "stringList.H" #include "wordList.H" -#include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -108,10 +107,7 @@ public: } //- Return the name of the given enumeration element - const char* operator[](const Enum e) const - { - return names[unsigned(e)]; - } + const char* operator[](const Enum e) const; };