diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 034da573494e1d166c261b4f3a2d5e4d424fe8fa..a1ac6c46f6590e1b5fd456272aad268b13a6b793 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -43,26 +43,17 @@ using namespace Foam::constant::mathematical; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum +const Foam::Enum < Foam::compressible:: - alphatWallBoilingWallFunctionFvPatchScalarField::phaseType, - 2 ->::names[] = -{ - "vapor", - "liquid" -}; - -const Foam::NamedEnum -< - Foam::compressible:: - alphatWallBoilingWallFunctionFvPatchScalarField::phaseType, - 2 + alphatWallBoilingWallFunctionFvPatchScalarField::phaseType > Foam::compressible:: -alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_; +alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_ +{ + { phaseType::vaporPhase, "vapor" }, + { phaseType::liquidPhase, "liquid" }, +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -111,7 +102,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField ) : alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict), - phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))), + phaseType_(phaseTypeNames_.lookup("phaseType", dict)), relax_(dict.lookupOrDefault<scalar>("relax", 0.5)), AbyV_(p.size(), 0), alphatConv_(p.size(), 0), diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H index 665d41197ebf573be4e7599b3c9dbd07055e516b..33ca2fe31e2a9119775f414b00e6a30fab8161b7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -164,7 +164,7 @@ private: // Private data //- Heat source type names - static const NamedEnum<phaseType, 2> phaseTypeNames_; + static const Enum<phaseType> phaseTypeNames_; //- Heat source type phaseType phaseType_; diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 26b23f691ae85553053315f6c1b7b710dce9c3e0..52dba40d6e30d31d6c40123cc06fc69c06e17783 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -69,18 +69,12 @@ enum ExtrudeMode SURFACE }; -namespace Foam +static const Enum<ExtrudeMode> ExtrudeModeNames { - template<> - const char* NamedEnum<ExtrudeMode, 3>::names[] = - { - "mesh", - "patch", - "surface" - }; -} - -static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames; + { ExtrudeMode::MESH, "mesh" }, + { ExtrudeMode::PATCH, "patch" }, + { ExtrudeMode::SURFACE, "surface" }, +}; void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) @@ -305,9 +299,10 @@ int main(int argc, char *argv[]) const Switch flipNormals(dict.lookup("flipNormals")); // What to extrude - const ExtrudeMode mode = ExtrudeModeNames.read + const ExtrudeMode mode = ExtrudeModeNames.lookup ( - dict.lookup("constructFrom") + "constructFrom", + dict ); // Any merging of small edges diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index f10a593a290c8305f06ab939cf4df6774ec3a1ef..e978b44e61c66e045e8fedff56a200df797468a9 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -60,17 +60,11 @@ enum ExtrudeMode MESHEDSURFACE }; -namespace Foam +static const Enum<ExtrudeMode> ExtrudeModeNames { - template<> - const char* NamedEnum<ExtrudeMode, 2>::names[] = - { - "polyMesh2D", - "MeshedSurface" - }; -} - -static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames; + { ExtrudeMode::POLYMESH2D, "polyMesh2D" }, + { ExtrudeMode::MESHEDSURFACE, "MeshedSurface" }, +}; //pointField moveInitialPoints diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 43131671d542ee69c1155e325fda802bc74c4837..141f36b93372175d0355c4770280843167ec42af 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -42,24 +42,20 @@ License namespace Foam { defineTypeNameAndDebug(conformalVoronoiMesh, 0); - - template<> - const char* NamedEnum - < - conformalVoronoiMesh::dualMeshPointType, - 5 - >::names[] = - { - "internal", - "surface", - "featureEdge", - "featurePoint", - "constrained" - }; } -const Foam::NamedEnum<Foam::conformalVoronoiMesh::dualMeshPointType, 5> - Foam::conformalVoronoiMesh::dualMeshPointTypeNames_; +const Foam::Enum +< + Foam::conformalVoronoiMesh::dualMeshPointType +> +Foam::conformalVoronoiMesh::dualMeshPointTypeNames_ +{ + { dualMeshPointType::internal, "internal" }, + { dualMeshPointType::surface, "surface" }, + { dualMeshPointType::featureEdge, "featureEdge" }, + { dualMeshPointType::featurePoint, "featurePoint" }, + { dualMeshPointType::constrained, "constrained" }, +}; // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index d204911c8f9162024cefd1fd31db9a55d451774f..0960b5e63c4b62e79e59a6d9156c95b72b89a758 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -122,7 +122,7 @@ public: constrained = 4 }; - static const NamedEnum<dualMeshPointType, 5> dualMeshPointTypeNames_; + static const Enum<dualMeshPointType> dualMeshPointTypeNames_; private: diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C index 5dfac3963cc4e2415bc84ac66c80b48a6ebd6638..b9542b22ab01fd19c5726358089acf49acf6e7d5 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C @@ -27,20 +27,19 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* -Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>::names[] = +const Foam::Enum +< + Foam::indexedCellEnum::cellTypes +> +Foam::indexedCellEnum::cellTypesNames_ { - "Unassigned", - "Internal", - "Surface", - "FeatureEdge", - "FeaturePoint", - "Far" + { cellTypes::ctUnassigned, "Unassigned" }, + { cellTypes::ctFar, "Far" }, + { cellTypes::ctInternal, "Internal" }, + { cellTypes::ctSurface, "Surface" }, + { cellTypes::ctFeatureEdge, "FeatureEdge" }, + { cellTypes::ctFeaturePoint,"FeaturePoint" }, }; -const Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6> -cellTypesNames_; - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H index d81deca00c938dc797003fb21fec8aa9416a915a..eeab020502b9319f40e727da0bb2e8d972a8d2e9 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H @@ -34,7 +34,7 @@ SourceFiles #ifndef indexedCellEnum_H #define indexedCellEnum_H -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,6 @@ class indexedCellEnum { public: - enum cellTypes { ctUnassigned = INT_MIN, @@ -58,7 +57,7 @@ public: ctFeaturePoint = INT_MIN + 5 }; - static const Foam::NamedEnum<cellTypes, 6> cellTypesNames_; + static const Enum<cellTypes> cellTypesNames_; }; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C index ddb03fa28ed59cc1928124e044aa5bb1b15aec44..729eea93d20c1795916608738608f0998836df23 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C @@ -28,42 +28,42 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* -Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>::names[] = +const Foam::Enum +< + Foam::indexedVertexEnum::vertexType +> +Foam::indexedVertexEnum::vertexTypeNames_ { - "Unassigned", - "Internal", - "InternalNearBoundary", - "InternalSurface", - "InternalSurfaceBaffle", - "ExternalSurfaceBaffle", - "InternalFeatureEdge", - "InternalFeatureEdgeBaffle", - "ExternalFeatureEdgeBaffle", - "InternalFeaturePoint", - "ExternalSurface", - "ExternalFeatureEdge", - "ExternalFeaturePoint", - "Far", - "Constrained" + { vertexType::vtUnassigned, "Unassigned" }, + { vertexType::vtInternal, "Internal" }, + { vertexType::vtInternalNearBoundary, "InternalNearBoundary" }, + { vertexType::vtInternalSurface, "InternalSurface" }, + { vertexType::vtInternalSurfaceBaffle, "InternalSurfaceBaffle" }, + { vertexType::vtExternalSurfaceBaffle, "ExternalSurfaceBaffle" }, + { vertexType::vtInternalFeatureEdge, "InternalFeatureEdge" }, + { vertexType::vtInternalFeatureEdgeBaffle, "InternalFeatureEdgeBaffle" }, + { vertexType::vtExternalFeatureEdgeBaffle, "ExternalFeatureEdgeBaffle" }, + { vertexType::vtInternalFeaturePoint, "InternalFeaturePoint" }, + { vertexType::vtExternalSurface, "ExternalSurface" }, + { vertexType::vtExternalFeatureEdge, "ExternalFeatureEdge" }, + { vertexType::vtExternalFeaturePoint, "ExternalFeaturePoint" }, + { vertexType::vtFar, "Far" }, + { vertexType::vtConstrained, "Constrained" }, }; -const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15> -Foam::indexedVertexEnum::vertexTypeNames_; - -template<> -const char* -Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>::names[] = +const Foam::Enum +< + Foam::indexedVertexEnum::vertexMotion +> +Foam::indexedVertexEnum::vertexMotionNames_ { - "fixed", - "movable" + { vertexMotion::fixed, "fixed" }, + { vertexMotion::movable, "movable" }, }; -const Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2> -vertexMotionNames_; +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H index 581bcf80a6e140c36fafe45852ac4a98c44f35e7..1568061fae6752b3df31d10c0fcf5c5d270a7f55 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H @@ -34,7 +34,7 @@ SourceFiles #ifndef indexedVertexEnum_H #define indexedVertexEnum_H -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -72,9 +72,9 @@ public: movable = 1 }; - static const Foam::NamedEnum<vertexType, 15> vertexTypeNames_; + static const Enum<vertexType> vertexTypeNames_; - static const Foam::NamedEnum<vertexMotion, 2> vertexMotionNames_; + static const Enum<vertexMotion> vertexMotionNames_; friend Ostream& operator<<(Foam::Ostream&, const vertexType&); diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 28d5d4dfc6b067e1db5b98c620ee9cf7e7bd739d..00f2c7d05d9ab3c67536afe45156a81db16ee9ea 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -848,7 +848,7 @@ int main(int argc, char *argv[]) ( meshRefinement::readFlags ( - meshRefinement::IOdebugTypeNames, + meshRefinement::debugTypeNames, flags ) ); @@ -873,7 +873,7 @@ int main(int argc, char *argv[]) ( meshRefinement::readFlags ( - meshRefinement::IOwriteTypeNames, + meshRefinement::writeTypeNames, flags ) ) @@ -892,7 +892,7 @@ int main(int argc, char *argv[]) ( meshRefinement::readFlags ( - meshRefinement::IOoutputTypeNames, + meshRefinement::outputTypeNames, flags ) ) diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C index 11fc19ac3e6144e028d76f52174a527810296dcb..5ea7f196f52369c95143a06ca63059067faec3fd 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C @@ -33,23 +33,14 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* Foam::NamedEnum - < - Foam::vector::components, - 3 - >::names[] = - { - "x", - "y", - "z" - }; -} - -const Foam::NamedEnum<Foam::vector::components, 3> - Foam::channelIndex::vectorComponentsNames_; +const Foam::Enum +< + Foam::vector::components +> +Foam::channelIndex::vectorComponentsNames_ +( + Foam::vector::components::X, { "x", "y", "z" } +); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -233,7 +224,7 @@ Foam::channelIndex::channelIndex ) : symmetric_(readBool(dict.lookup("symmetric"))), - dir_(vectorComponentsNames_.read(dict.lookup("component"))) + dir_(vectorComponentsNames_.lookup("component", dict)) { const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.H b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.H index 5e554fa062158324693dabefc0493b537c835dfe..36e7764c4d32e661af0936887a5ac4b2a6404b6a 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.H +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.H @@ -55,7 +55,7 @@ class channelIndex // Private data - static const NamedEnum<vector::components, 3> vectorComponentsNames_; + static const Enum<vector::components> vectorComponentsNames_; //- Is mesh symmetric const bool symmetric_; diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C index 4bea82a29513fd710a3558536f291358cbdeeebe..280e2ac645ce4a7a7b43042f50fcd77d93b0e037 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C @@ -29,24 +29,19 @@ License #include "polyMesh.H" #include "regionProperties.H" -using namespace Foam; - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::solverTemplate::solverType +> +Foam::solverTemplate::solverTypeNames_ { - template<> - const char* Foam::NamedEnum<Foam::solverTemplate::solverType, 4>::names[] = - { - "compressible", - "incompressible", - "buoyant", - "unknown" - }; -} - -const Foam::NamedEnum<Foam::solverTemplate::solverType, 4> - Foam::solverTemplate::solverTypeNames_; + { solverType::stCompressible, "compressible" }, + { solverType::stIncompressible, "incompressible" }, + { solverType::stBuoyant, "buoyant" }, + { solverType::stUnknown, "unknown" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -261,7 +256,7 @@ Foam::solverTemplate::solverTemplate Info<< "Selecting " << solverName << ": "; - solverType_ = solverTypeNames_.read(solverDict.lookup("solverType")); + solverType_ = solverTypeNames_.lookup("solverType", solverDict); Info<< solverTypeNames_[solverType_]; multiRegion_ = readBool(solverDict.lookup("multiRegion")); @@ -366,7 +361,7 @@ bool Foam::solverTemplate::multiRegion() const } -label Foam::solverTemplate::nRegion() const +Foam::label Foam::solverTemplate::nRegion() const { return regionTypes_.size(); } diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H index 26c9577f4c5fae9117b44e10fb32046ee1e7c185..89810575fca82c9333303c65c287dd716f137b1d 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H @@ -36,7 +36,7 @@ Description #include "wordList.H" #include "dimensionSet.H" #include "IOobject.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,7 +65,7 @@ public: }; //- Solver type names - static const NamedEnum<solverType, 4> solverTypeNames_; + static const Enum<solverType> solverTypeNames_; private: diff --git a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C index 6fe8001e31d440e8a8d4e188c80308cd84d5be49..58fde7f78d84d99f2cf3b6f5b031204e7889590b 100644 --- a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C +++ b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C @@ -59,7 +59,12 @@ class shapeSelector static const Foam::Enum<shapeType> shapeTypeNames; }; -const Foam::Enum<shapeSelector::shapeType> shapeSelector::shapeTypeNames + +const Foam::Enum +< + shapeSelector::shapeType +> +shapeSelector::shapeTypeNames { { shapeSelector::shapeType::PLANE, "plane" }, { shapeSelector::shapeType::SPHERE, "sphere" }, diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C index 7857569be374ebfbc911c11675cf83554f4e7cdc..eb38f408b28655ec741f5da66435b6a1ae796f44 100644 --- a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C @@ -41,22 +41,16 @@ namespace Foam dictionary ); } - - template<> - const char* Foam::NamedEnum - < - Foam::tabulatedWallFunctions::general::interpolationType, - 1 - >::names[] = - { - "linear" - }; - } -const -Foam::NamedEnum<Foam::tabulatedWallFunctions::general::interpolationType, 1> - Foam::tabulatedWallFunctions::general::interpolationTypeNames_; +const Foam::Enum +< + Foam::tabulatedWallFunctions::general::interpolationType +> +Foam::tabulatedWallFunctions::general::interpolationTypeNames_ +{ + { interpolationType::itLinear, "linear" }, +}; // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // @@ -138,7 +132,7 @@ Foam::tabulatedWallFunctions::general::general ) : tabulatedWallFunction(dict, mesh, typeName), - interpType_(interpolationTypeNames_[coeffDict_.lookup("interpType")]), + interpType_(interpolationTypeNames_.lookup("interpType", coeffDict_)), yPlus_(), uPlus_(), log10YPlus_(coeffDict_.lookup("log10YPlus")), diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H index c61cc356d6744bd4864e2e6b2901bdf5cc53efb7..fc3c7ead914343dc87f554e30b37aef4c14f899b 100644 --- a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H @@ -63,7 +63,7 @@ SourceFiles #define general_H #include "tabulatedWallFunction.H" -#include "NamedEnum.H" +#include "Enum.H" #include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -91,7 +91,7 @@ public: itLinear }; - static const NamedEnum<interpolationType, 1> interpolationTypeNames_; + static const Enum<interpolationType> interpolationTypeNames_; protected: diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C index ff7deb7538a1f9f7c307c4f2212b7590c46146ae..bdab2431b727d70091132b8b1d96f236a4b8c0be 100644 --- a/src/OSspecific/POSIX/fileMonitor.C +++ b/src/OSspecific/POSIX/fileMonitor.C @@ -45,25 +45,22 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::NamedEnum<Foam::fileMonitor::fileState, 3> - Foam::fileMonitor::fileStateNames_; +const Foam::Enum +< + Foam::fileMonitor::fileState +> +Foam::fileMonitor::fileStateNames_ +{ + { fileState::UNMODIFIED, "unmodified" }, + { fileState::MODIFIED, "modified" }, + { fileState::DELETED, "deleted" }, +}; + namespace Foam { defineTypeNameAndDebug(fileMonitor, 0); - template<> - const char* Foam::NamedEnum - < - Foam::fileMonitor::fileState, - 3 - >::names[] = - { - "unmodified", - "modified", - "deleted" - }; - //- Reduction operator for PackedList of fileState class reduceFileStates { diff --git a/src/OSspecific/POSIX/fileMonitor.H b/src/OSspecific/POSIX/fileMonitor.H index 18e4ab05ff6266abf8b495ce121b398d46752587..6a9cc1245e638bcc8ba1869ec5a602d132ed9048 100644 --- a/src/OSspecific/POSIX/fileMonitor.H +++ b/src/OSspecific/POSIX/fileMonitor.H @@ -43,7 +43,7 @@ SourceFiles #define fileMonitor_H #include <sys/types.h> -#include "NamedEnum.H" +#include "Enum.H" #include "className.H" #include "DynamicList.H" @@ -74,7 +74,7 @@ public: DELETED = 2 }; - static const NamedEnum<fileState, 3> fileStateNames_; + static const Enum<fileState> fileStateNames_; private: // Private data diff --git a/src/OpenFOAM/algorithms/indexedOctree/volumeType.C b/src/OpenFOAM/algorithms/indexedOctree/volumeType.C index 1bb1356b9670d1deefb5ed23b398bb559ffef36d..beabdfb61472381eef6f015961f453f28d693c8b 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/volumeType.C +++ b/src/OpenFOAM/algorithms/indexedOctree/volumeType.C @@ -27,23 +27,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::volumeType +> +Foam::volumeType::names { - template<> - const char* Foam::NamedEnum - < - Foam::volumeType, - 4 - >::names[] = - { - "unknown", - "mixed", - "inside", - "outside" - }; -} - -const Foam::NamedEnum<Foam::volumeType, 4> Foam::volumeType::names; + { type::UNKNOWN, "unknown" }, + { type::MIXED, "mixed" }, + { type::INSIDE, "inside" }, + { type::OUTSIDE, "outside" }, +}; // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // diff --git a/src/OpenFOAM/algorithms/indexedOctree/volumeType.H b/src/OpenFOAM/algorithms/indexedOctree/volumeType.H index 3d845c414bef3fda5df79c57cb64d471f2dd3218..56c6c93f2e2c5957d40cb5c11bb231ee63d1364a 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/volumeType.H +++ b/src/OpenFOAM/algorithms/indexedOctree/volumeType.H @@ -34,7 +34,7 @@ SourceFiles #ifndef volumeType_H #define volumeType_H -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,8 +44,8 @@ namespace Foam // Forward declaration of friend functions and operators class volumeType; -Istream& operator>>(Istream& is, volumeType&); -Ostream& operator<<(Ostream& os, const volumeType& C); +Istream& operator>>(Istream& is, volumeType& vt); +Ostream& operator<<(Ostream& os, const volumeType& vt); /*---------------------------------------------------------------------------*\ @@ -65,6 +65,9 @@ public: OUTSIDE = 3 }; + // Static data + static const Enum<volumeType> names; + private: @@ -76,11 +79,6 @@ private: public: - // Static data - - static const NamedEnum<volumeType, 4> names; - - // Constructors //- Construct null diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index f61465bcb34ee98b017267889575a3fa822caa7e..9fa9499c63f4a08131be5f29337ee4480ca25553 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -32,37 +32,32 @@ License namespace Foam { defineTypeNameAndDebug(IOobject, 0); - - template<> - const char* NamedEnum - < - IOobject::fileCheckTypes, - 4 - >::names[] = - { - "timeStamp", - "timeStampMaster", - "inotify", - "inotifyMaster" - }; } +const Foam::Enum +< + Foam::IOobject::fileCheckTypes +> +Foam::IOobject::fileCheckTypesNames +{ + { fileCheckTypes::timeStamp, "timeStamp" }, + { fileCheckTypes::timeStampMaster, "timeStampMaster" }, + { fileCheckTypes::inotify, "inotify" }, + { fileCheckTypes::inotifyMaster, "inotifyMaster" }, +}; -const Foam::NamedEnum<Foam::IOobject::fileCheckTypes, 4> - Foam::IOobject::fileCheckTypesNames; // Default fileCheck type Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking ( - fileCheckTypesNames.read + fileCheckTypesNames.lookup ( - debug::optimisationSwitches().lookup - ( - "fileModificationChecking" - ) + "fileModificationChecking", + debug::optimisationSwitches() ) ); + namespace Foam { // Register re-reader diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index a0502fb1df6faa82af9d430c0c53747dfe48bece..567511f6ab1029669d2a36d403e0fa5c79e68b67 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -76,7 +76,7 @@ SourceFiles #include "typeInfo.H" #include "autoPtr.H" #include "InfoProxy.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -129,7 +129,7 @@ public: inotifyMaster }; - static const NamedEnum<fileCheckTypes, 4> fileCheckTypesNames; + static const Enum<fileCheckTypes> fileCheckTypesNames; private: diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index 11fc0a0a44acf7135d419da3b204f4bdf48dfc5a..7230b5c5973cc322d2b6dfa29514741f6af55f74 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -34,23 +34,18 @@ License namespace Foam { defineTypeNameAndDebug(UPstream, 0); - - template<> - const char* Foam::NamedEnum - < - Foam::UPstream::commsTypes, - 3 - >::names[] = - { - "blocking", - "scheduled", - "nonBlocking" - }; } - -const Foam::NamedEnum<Foam::UPstream::commsTypes, 3> - Foam::UPstream::commsTypeNames; +const Foam::Enum +< + Foam::UPstream::commsTypes +> +Foam::UPstream::commsTypeNames +{ + { commsTypes::blocking, "blocking" }, + { commsTypes::scheduled, "scheduled" }, + { commsTypes::nonBlocking, "nonBlocking" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -411,7 +406,11 @@ registerOptSwitch Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType ( - commsTypeNames.read(Foam::debug::optimisationSwitches().lookup("commsType")) + commsTypeNames.lookup + ( + "commsType", + Foam::debug::optimisationSwitches() + ) ); namespace Foam diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H index d6a62e3af67800a13b8f727c6d79ac8536e0ed7e..ba791916d0b43b050b49c1b3b852ba83b9b78e2e 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H @@ -43,7 +43,7 @@ SourceFiles #include "DynamicList.H" #include "HashTable.H" #include "string.H" -#include "NamedEnum.H" +#include "Enum.H" #include "ListOps.H" #include "LIFOStack.H" @@ -69,7 +69,7 @@ public: nonBlocking }; - static const NamedEnum<commsTypes, 3> commsTypeNames; + static const Enum<commsTypes> commsTypeNames; // Public classes diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index fbf6ebff65e0227479cf34d0b42c28066f6665ca..0a7ae9f3df21dd58ec3f8b21cf6fb730f0a8c376 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -37,40 +37,34 @@ License namespace Foam { defineTypeNameAndDebug(Time, 0); - - template<> - const char* Foam::NamedEnum - < - Foam::Time::stopAtControls, - 4 - >::names[] = - { - "endTime", - "noWriteNow", - "writeNow", - "nextWrite" - }; - - template<> - const char* Foam::NamedEnum - < - Foam::Time::writeControls, - 5 - >::names[] = - { - "timeStep", - "runTime", - "adjustableRunTime", - "clockTime", - "cpuTime" - }; } -const Foam::NamedEnum<Foam::Time::stopAtControls, 4> - Foam::Time::stopAtControlNames_; +const Foam::Enum +< + Foam::Time::stopAtControls +> +Foam::Time::stopAtControlNames_ +{ + { stopAtControls::saEndTime, "endTime" }, + { stopAtControls::saNoWriteNow, "noWriteNow" }, + { stopAtControls::saWriteNow, "writeNow" }, + { stopAtControls::saNextWrite, "nextWrite" }, +}; + + +const Foam::Enum +< + Foam::Time::writeControls +> +Foam::Time::writeControlNames_ +{ + { writeControls::wcTimeStep, "timeStep" }, + { writeControls::wcRunTime, "runTime" }, + { writeControls::wcAdjustableRunTime, "adjustableRunTime" }, + { writeControls::wcClockTime, "clockTime" }, + { writeControls::wcCpuTime, "cpuTime" }, +}; -const Foam::NamedEnum<Foam::Time::writeControls, 5> - Foam::Time::writeControlNames_; Foam::Time::fmtflags Foam::Time::format_(Foam::Time::general); diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 5f6dc17321121270684cb353cdc859d16c26c96d..f43f74d360e15c97b4b51e63e995d9f771835cf0 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -47,7 +47,7 @@ SourceFiles #include "TimeState.H" #include "Switch.H" #include "instantList.H" -#include "NamedEnum.H" +#include "Enum.H" #include "typeInfo.H" #include "dlLibraryTable.H" #include "functionObjectList.H" @@ -130,10 +130,10 @@ protected: scalar startTime_; mutable scalar endTime_; - static const NamedEnum<stopAtControls, 4> stopAtControlNames_; + static const Enum<stopAtControls> stopAtControlNames_; mutable stopAtControls stopAt_; - static const NamedEnum<writeControls, 5> writeControlNames_; + static const Enum<writeControls> writeControlNames_; writeControls writeControl_; scalar writeInterval_; diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 86517390fa4829d1fa38822862ace291022e3c58..5c8c2c5c5ab39bad0d0a09e1919ab8711a9e054e 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -201,9 +201,10 @@ void Foam::Time::readDict() if (controlDict_.found("writeControl")) { - writeControl_ = writeControlNames_.read + writeControl_ = writeControlNames_.lookup ( - controlDict_.lookup("writeControl") + "writeControl", + controlDict_ ); } @@ -288,7 +289,7 @@ void Foam::Time::readDict() // if nothing is specified, the endTime is zero if (controlDict_.found("stopAt")) { - stopAt_ = stopAtControlNames_.read(controlDict_.lookup("stopAt")); + stopAt_ = stopAtControlNames_.lookup("stopAt", controlDict_); if (stopAt_ == saEndTime) { diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C index 816049967d74c75fa21add8c9a75ad197cdda724..5a10c23e1fccf7623e068d34c53b9c329b7278ec 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.C @@ -28,27 +28,22 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::timeControl::timeControls +> +Foam::timeControl::timeControlNames_ { - template<> - const char* NamedEnum<timeControl::timeControls, 9>:: - names[] = - { - "timeStep", - "writeTime", - "outputTime", - "adjustableRunTime", - "runTime", - "clockTime", - "cpuTime", - "onEnd", - "none" - }; -} - -const Foam::NamedEnum<Foam::timeControl::timeControls, 9> - Foam::timeControl::timeControlNames_; - + { timeControl::ocTimeStep, "timeStep" }, + { timeControl::ocWriteTime, "writeTime" }, + { timeControl::ocOutputTime, "outputTime" }, + { timeControl::ocAdjustableRunTime, "adjustableRunTime" }, + { timeControl::ocRunTime, "runTime" }, + { timeControl::ocClockTime, "clockTime" }, + { timeControl::ocCpuTime, "cpuTime" }, + { timeControl::ocOnEnd, "onEnd" }, + { timeControl::ocNone, "none" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -117,7 +112,7 @@ void Foam::timeControl::read(const dictionary& dict) if (dict.found(controlName)) { - timeControl_ = timeControlNames_.read(dict.lookup(controlName)); + timeControl_ = timeControlNames_.lookup(controlName, dict); } else { diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H index 247ef2d3de85374b9cf8d4b44c227085d14f7d45..86b91b2466ef8477f680edc1e3476b0b657b85a7 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControl.H @@ -77,7 +77,7 @@ private: const word prefix_; //- String representation of timeControls enums - static const NamedEnum<timeControls, 9> timeControlNames_; + static const Enum<timeControls> timeControlNames_; //- Type of time control timeControls timeControl_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index 343461da4230dd7193b5024db39e522162eed0d5..4090f6eafa9afacb73ddd8c41aa612ced5dfbabe 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -35,22 +35,23 @@ namespace Foam defineTypeNameAndDebug(coupledPolyPatch, 0); const scalar coupledPolyPatch::defaultMatchTol_ = 1e-4; - - template<> - const char* NamedEnum<coupledPolyPatch::transformType, 5>::names[] = - { - "unknown", - "rotational", - "translational", - "coincidentFullMatch", - "noOrdering" - }; - - const NamedEnum<coupledPolyPatch::transformType, 5> - coupledPolyPatch::transformTypeNames; } +const Foam::Enum +< + Foam::coupledPolyPatch::transformType +> +Foam::coupledPolyPatch::transformTypeNames +{ + { transformType::UNKNOWN, "unknown" }, + { transformType::ROTATIONAL, "rotational" }, + { transformType::TRANSLATIONAL, "translational" }, + { transformType::COINCIDENTFULLMATCH, "coincidentFullMatch" }, + { transformType::NOORDERING, "noOrdering" }, +}; + + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void Foam::coupledPolyPatch::writeOBJ(Ostream& os, const point& pt) @@ -500,9 +501,12 @@ Foam::coupledPolyPatch::coupledPolyPatch matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)), transform_ ( - dict.found("transform") - ? transformTypeNames.read(dict.lookup("transform")) - : UNKNOWN + transformTypeNames.lookupOrDefault + ( + "transform", + dict, + transformType::UNKNOWN + ) ) {} @@ -562,10 +566,8 @@ void Foam::coupledPolyPatch::write(Ostream& os) const polyPatch::write(os); //if (matchTolerance_ != defaultMatchTol_) { - os.writeKeyword("matchTolerance") << matchTolerance_ - << token::END_STATEMENT << nl; - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; + os.writeEntry("matchTolerance", matchTolerance_); + os.writeEntry("transform", transformTypeNames[transform_]); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 9c761907af5a123f23bc258af81ea03634f4401c..0be8978f7301e7d791a05d968b77c9e67d875ed6 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -65,7 +65,7 @@ public: NOORDERING // unspecified, no automatic ordering }; - static const NamedEnum<transformType, 5> transformTypeNames; + static const Enum<transformType> transformTypeNames; private: diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C index ffc7dd49f16550cf0f80876a3368c62251e51ca7..11392de2dd4ae6de98bde0847a7eee62057a8ec6 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C @@ -29,37 +29,27 @@ License Foam::scalar Foam::intersection::planarTol_ = 0.2; -namespace Foam +const Foam::Enum +< + Foam::intersection::direction +> +Foam::intersection::directionNames_ { - template<> - const char* Foam::NamedEnum - < - Foam::intersection::direction, - 2 - >::names[] = - { - "vector", - "contactSphere" - }; + { intersection::direction::VECTOR, "vector" }, + { intersection::direction::CONTACT_SPHERE, "contactSphere" }, +}; - template<> - const char* Foam::NamedEnum - < - Foam::intersection::algorithm, - 3 - >::names[] = - { - "fullRay", - "halfRay", - "visible" - }; -} -const Foam::NamedEnum<Foam::intersection::direction, 2> -Foam::intersection::directionNames_; - -const Foam::NamedEnum<Foam::intersection::algorithm, 3> -Foam::intersection::algorithmNames_; +const Foam::Enum +< + Foam::intersection::algorithm +> +Foam::intersection::algorithmNames_ +{ + { intersection::algorithm::FULL_RAY, "fullRay" }, + { intersection::algorithm::HALF_RAY, "halfRay" }, + { intersection::algorithm::VISIBLE, "visible" }, +}; // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.H index 6051b36c4254b446b7ee3844850c5e42119f5902..330a985b0178ffd56aa883bd9d45690452177e55 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +28,7 @@ Description Foam::intersection SourceFiles - intersection.C + intersection.C \*---------------------------------------------------------------------------*/ @@ -36,7 +36,7 @@ SourceFiles #define intersection_H #include "scalar.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,10 +77,10 @@ public: // Static Member Functions //- Direction names - static const NamedEnum<direction, 2> directionNames_; + static const Enum<direction> directionNames_; //- Projection algorithm names - static const NamedEnum<algorithm, 3> algorithmNames_; + static const Enum<algorithm> algorithmNames_; //- Return planar tolerance static scalar planarTol() diff --git a/src/OpenFOAM/orientedType/orientedType.C b/src/OpenFOAM/orientedType/orientedType.C index 4a04453ac09a3da6e0190477bcaef7562c7db649..eac0f9527de1819b4a5c7a7fa4f5657e8201ae3e 100644 --- a/src/OpenFOAM/orientedType/orientedType.C +++ b/src/OpenFOAM/orientedType/orientedType.C @@ -27,23 +27,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* NamedEnum - < - orientedType::orientedOption, - 3 - >::names[] = - { - "oriented", - "unoriented", - "unknown" - }; -} - -const Foam::NamedEnum<Foam::orientedType::orientedOption, 3> - Foam::orientedType::orientedOptionNames; +const Foam::Enum +< + Foam::orientedType::orientedOption +> +Foam::orientedType::orientedOptionNames +{ + { orientedOption::ORIENTED, "oriented" }, + { orientedOption::UNORIENTED, "unoriented" }, + { orientedOption::UNKNOWN, "unknown" }, +}; bool Foam::orientedType::checkType @@ -118,14 +111,12 @@ void Foam::orientedType::setOriented(const bool oriented) void Foam::orientedType::read(const dictionary& dict) { - if (dict.found("oriented")) - { - oriented_ = orientedOptionNames.read(dict.lookup("oriented")); - } - else - { - oriented_ = UNKNOWN; - } + oriented_ = orientedOptionNames.lookupOrDefault + ( + "oriented", + dict, + orientedOption::UNKNOWN + ); } diff --git a/src/OpenFOAM/orientedType/orientedType.H b/src/OpenFOAM/orientedType/orientedType.H index d050f71dcb5aaeb960f7e2a7b4658d55b04f1b0f..31805f4a0d2c8802a8d4f2b8a07edeb45f8df4a7 100644 --- a/src/OpenFOAM/orientedType/orientedType.H +++ b/src/OpenFOAM/orientedType/orientedType.H @@ -38,7 +38,7 @@ SourceFiles #include "Istream.H" #include "Ostream.H" #include "dictionary.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,9 +49,9 @@ namespace Foam class orientedType; -Istream& operator>>(Istream&, orientedType&); +Istream& operator>>(Istream& is, orientedType& ot); -Ostream& operator<<(Ostream&, const orientedType&); +Ostream& operator<<(Ostream& os, const orientedType& ot); /*---------------------------------------------------------------------------*\ Class orientedType Declaration @@ -71,7 +71,7 @@ public: UNKNOWN }; - static const NamedEnum<orientedOption, 3> orientedOptionNames; + static const Enum<orientedOption> orientedOptionNames; private: diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index d1b23832861b1e9e4b5eda5e7bd62676d19870f1..9663cfc2f77f7f11c5241891622a55c3e094f881 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -33,27 +33,16 @@ using Foam::constant::physicoChemical::sigma; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* - NamedEnum - < - externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, - 3 - >::names[] = - { - "power", - "flux", - "coefficient" - }; -} - -const Foam::NamedEnum +const Foam::Enum < - Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, - 3 -> Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames; + Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationMode +> +Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames +{ + { operationMode::fixedPower, "power" }, + { operationMode::fixedHeatFlux, "flux" }, + { operationMode::fixedHeatTransferCoeff, "coefficient" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -92,7 +81,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), - mode_(operationModeNames.read(dict.lookup("mode"))), + mode_(operationModeNames.lookup("mode", dict)), Q_(0), relaxation_(dict.lookupOrDefault<scalar>("relaxation", 1)), emissivity_(dict.lookupOrDefault<scalar>("emissivity", 0)), @@ -457,17 +446,14 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write { fvPatchScalarField::write(os); - os.writeKeyword("mode") - << operationModeNames[mode_] << token::END_STATEMENT << nl; + os.writeEntry("mode", operationModeNames[mode_]); temperatureCoupledBase::write(os); switch (mode_) { case fixedPower: { - os.writeKeyword("Q") - << Q_ << token::END_STATEMENT << nl; - + os.writeEntry("Q", Q_); break; } case fixedHeatFlux: @@ -483,14 +469,12 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write if (relaxation_ < 1) { - os.writeKeyword("relaxation") - << relaxation_ << token::END_STATEMENT << nl; + os.writeEntry("relaxation", relaxation_); } if (emissivity_ > 0) { - os.writeKeyword("emissivity") - << emissivity_ << token::END_STATEMENT << nl; + os.writeEntry("emissivity", emissivity_); } if (thicknessLayers_.size()) @@ -503,12 +487,11 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write } } - os.writeKeyword("qr")<< qrName_ << token::END_STATEMENT << nl; + os.writeEntry("qr", qrName_); if (qrName_ != "none") { - os.writeKeyword("qrRelaxation") - << qrRelaxation_ << token::END_STATEMENT << nl; + os.writeEntry("qrRelaxation", qrRelaxation_); qrPrevious_.writeEntry("qrPrevious", os); } diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index f823eb6fa79ee6f1c4913e90b81cd7554c824a70..00f30e2a6049ce8bb5195b5a5854b51248b78710 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -127,7 +127,7 @@ public: fixedHeatTransferCoeff, //!< Fixed heat transfer coefficient }; - static const NamedEnum<operationMode, 3> operationModeNames; + static const Enum<operationMode> operationModeNames; private: diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C index 50c15be701b224cacd6d181e7a04c0dff92085fb..3de675ac0d75b9c9c947e7ea5fc2f4b172bbdd53 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C @@ -31,25 +31,17 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::temperatureCoupledBase::KMethodType +> +Foam::temperatureCoupledBase::KMethodTypeNames_ { - template<> - const char* Foam::NamedEnum - < - Foam::temperatureCoupledBase::KMethodType, - 4 - >::names[] = - { - "fluidThermo", - "solidThermo", - "directionalSolidThermo", - "lookup" - }; -} - - -const Foam::NamedEnum<Foam::temperatureCoupledBase::KMethodType, 4> - Foam::temperatureCoupledBase::KMethodTypeNames_; + { KMethodType::mtFluidThermo, "fluidThermo" }, + { KMethodType::mtSolidThermo, "solidThermo" }, + { KMethodType::mtDirectionalSolidThermo, "directionalSolidThermo" }, + { KMethodType::mtLookup, "lookup" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -76,7 +68,7 @@ Foam::temperatureCoupledBase::temperatureCoupledBase ) : patch_(patch), - method_(KMethodTypeNames_.read(dict.lookup("kappaMethod"))), + method_(KMethodTypeNames_.lookup("kappaMethod", dict)), kappaName_(dict.lookupOrDefault<word>("kappa", "none")), alphaAniName_(dict.lookupOrDefault<word>("alphaAni","none")) {} @@ -232,10 +224,9 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa void Foam::temperatureCoupledBase::write(Ostream& os) const { - os.writeKeyword("kappaMethod") << KMethodTypeNames_[method_] - << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappaName_ << token::END_STATEMENT << nl; - os.writeKeyword("alphaAni") << alphaAniName_ << token::END_STATEMENT << nl; + os.writeEntry("kappaMethod", KMethodTypeNames_[method_]); + os.writeEntry("kappa", kappaName_); + os.writeEntry("alphaAni", alphaAniName_); } diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H index 777f4c6d2ab549bebecf957a862cc59edfb7581c..96c45867985a6462c09bbae2fdf83eb1c58987ab 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H @@ -66,7 +66,7 @@ SourceFiles #define temperatureCoupledBase_H #include "scalarField.H" -#include "NamedEnum.H" +#include "Enum.H" #include "fvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -98,7 +98,7 @@ protected: // Protected data - static const NamedEnum<KMethodType, 4> KMethodTypeNames_; + static const Enum<KMethodType> KMethodTypeNames_; //- Underlying patch const fvPatch& patch_; diff --git a/src/combustionModels/EDC/EDC.C b/src/combustionModels/EDC/EDC.C index 64d822ee5225657f9c63c05fd4c61a5648143e99..c4b7e0b29f160a3e7cfb16e20382d2d73c8acc15 100644 --- a/src/combustionModels/EDC/EDC.C +++ b/src/combustionModels/EDC/EDC.C @@ -39,14 +39,12 @@ Foam::combustionModels::EDC<Type>::EDC laminar<Type>(modelType, mesh, combustionProperties, phaseName), version_ ( - EDCversionNames - [ - this->coeffs().lookupOrDefault - ( - "version", - word(EDCversionNames[EDCdefaultVersion]) - ) - ] + EDCversionNames.lookupOrDefault + ( + "version", + this->coeffs(), + EDCdefaultVersion + ) ), C1_(this->coeffs().lookupOrDefault("C1", 0.05774)), C2_(this->coeffs().lookupOrDefault("C2", 0.5)), @@ -220,14 +218,12 @@ bool Foam::combustionModels::EDC<Type>::read() { version_ = ( - EDCversionNames - [ - this->coeffs().lookupOrDefault - ( - "version", - word(EDCversionNames[EDCdefaultVersion]) - ) - ] + EDCversionNames.lookupOrDefault + ( + "version", + this->coeffs(), + EDCdefaultVersion + ) ); C1_ = this->coeffs().lookupOrDefault("C1", 0.05774); C2_ = this->coeffs().lookupOrDefault("C2", 0.5); diff --git a/src/combustionModels/EDC/EDC.H b/src/combustionModels/EDC/EDC.H index d9ed191f9998793afa82df37b77feb62cc65ee6c..a59fc55bcfc3f37d2a9d5f81c18c8e55027d2b9f 100644 --- a/src/combustionModels/EDC/EDC.H +++ b/src/combustionModels/EDC/EDC.H @@ -100,7 +100,7 @@ SourceFiles #define EDC_H #include "../laminar/laminar.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -118,7 +118,7 @@ enum class EDCversions v2016 }; -extern const NamedEnum<EDCversions, 4> EDCversionNames; +extern const Enum<EDCversions> EDCversionNames; extern const EDCversions EDCdefaultVersion; const scalar EDCexp1[] = {3, 2, 2, 2}; diff --git a/src/combustionModels/EDC/EDCs.C b/src/combustionModels/EDC/EDCs.C index 280d6c3db31cc29e31456c80127079b57d2e36d3..bd81ae6834be75feab359566be8cdec2cb341d90 100644 --- a/src/combustionModels/EDC/EDCs.C +++ b/src/combustionModels/EDC/EDCs.C @@ -31,31 +31,26 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::combustionModels::EDCversions, - 4 ->::names[] = + Foam::combustionModels::EDCversions +> +Foam::combustionModels::EDCversionNames { - "v1981", - "v1996", - "v2005", - "v2016" + { EDCversions::v1981, "v1981" }, + { EDCversions::v1996, "v1996" }, + { EDCversions::v2005, "v2005" }, + { EDCversions::v2016, "v2016" }, }; -const Foam::NamedEnum<Foam::combustionModels::EDCversions, 4> - Foam::combustionModels::EDCversionNames; - const Foam::combustionModels::EDCversions -Foam::combustionModels::EDCdefaultVersion -( - Foam::combustionModels::EDCversions::v2005 -); +Foam::combustionModels::EDCdefaultVersion(EDCversions::v2005); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makeCombustionTypes(EDC, psiChemistryCombustion, psiCombustionModel); makeCombustionTypes(EDC, rhoChemistryCombustion, rhoCombustionModel); + // ************************************************************************* // diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C index 2097a2c578530f8b2153d650515fcb85261ce979..8ee5a691cfd550491dc2afc5d1c451038e3e3a4a 100644 --- a/src/dynamicMesh/meshCut/directions/directions.C +++ b/src/dynamicMesh/meshCut/directions/directions.C @@ -36,23 +36,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::directions::directionType +> +Foam::directions::directionTypeNames_ { - template<> - const char* Foam::NamedEnum - < - Foam::directions::directionType, - 3 - >::names[] = - { - "tan1", - "tan2", - "normal" - }; -} - -const Foam::NamedEnum<Foam::directions::directionType, 3> - Foam::directions::directionTypeNames_; + { directionType::TAN1, "tan1" }, + { directionType::TAN2, "tan2" }, + { directionType::NORMAL, "normal" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -289,9 +282,9 @@ Foam::directions::directions if (coordSystem != "fieldBased") { - forAll(wantedDirs, i) + for (const word& wantedName : wantedDirs) { - directionType wantedDir = directionTypeNames_[wantedDirs[i]]; + directionType wantedDir = directionTypeNames_[wantedName]; if (wantedDir == NORMAL) { diff --git a/src/dynamicMesh/meshCut/directions/directions.H b/src/dynamicMesh/meshCut/directions/directions.H index c81c794ae813f951350996eac00cb743616a0275..b667aeb7f244560c19edc1c6ec7effff1b27427b 100644 --- a/src/dynamicMesh/meshCut/directions/directions.H +++ b/src/dynamicMesh/meshCut/directions/directions.H @@ -43,7 +43,7 @@ SourceFiles #include "List.H" #include "vectorField.H" -#include "NamedEnum.H" +#include "Enum.H" #include "point.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -82,7 +82,7 @@ public: private: - static const NamedEnum<directionType, 3> directionTypeNames_; + static const Enum<directionType> directionTypeNames_; // Private Member Functions diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C index 357c27678f3ebdf2d635963b73503c88000b20f3..9ea5e44203cc713a08a6ae391e5095516101d325 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C @@ -36,17 +36,18 @@ License namespace Foam { defineTypeNameAndDebug(tetDecomposer, 0); +} - template<> - const char* NamedEnum<tetDecomposer::decompositionType, 2>::names[] = - { - "faceCentre", - "faceDiagonal" - }; +const Foam::Enum +< + Foam::tetDecomposer::decompositionType +> +Foam::tetDecomposer::decompositionTypeNames +{ + { decompositionType::FACE_CENTRE_TRIS, "faceCentre" }, + { decompositionType::FACE_DIAG_TRIS, "faceDiagonal" }, +}; - const NamedEnum<tetDecomposer::decompositionType, 2> - tetDecomposer::decompositionTypeNames; -} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.H index 540df2dd208eb88607470ed17d9ba24bc86d34b2..4b854fdd124494113f155eb36d74beb99ceff6d1 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.H @@ -39,7 +39,7 @@ SourceFiles #include "PackedBoolList.H" #include "boolList.H" #include "typeInfo.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,7 +68,7 @@ public: FACE_DIAG_TRIS //- Faces decomposed into triangles diagonally }; - static const NamedEnum<decompositionType, 2> decompositionTypeNames; + static const Enum<decompositionType> decompositionTypeNames; private: diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index 52026efb9118122e1e27d1ca251ad2f6bbda95da..7048a5713aba786c0e9c42fdb31664e3e02c283f 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -45,22 +45,18 @@ namespace Foam slidingInterface, dictionary ); - - template<> - const char* Foam::NamedEnum - < - Foam::slidingInterface::typeOfMatch, - 2 - >::names[] = - { - "integral", - "partial" - }; } -const Foam::NamedEnum<Foam::slidingInterface::typeOfMatch, 2> -Foam::slidingInterface::typeOfMatchNames_; +const Foam::Enum +< + Foam::slidingInterface::typeOfMatch +> +Foam::slidingInterface::typeOfMatchNames_ +{ + { typeOfMatch::INTEGRAL, "integral" }, + { typeOfMatch::PARTIAL, "partial" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -248,7 +244,7 @@ Foam::slidingInterface::slidingInterface dict.lookup("slavePatchName"), mme.mesh().boundaryMesh() ), - matchType_(typeOfMatchNames_.read((dict.lookup("typeOfMatch")))), + matchType_(typeOfMatchNames_.lookup("typeOfMatch", dict)), coupleDecouple_(dict.lookup("coupleDecouple")), attached_(dict.lookup("attached")), projectionAlgo_ diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.H b/src/dynamicMesh/slidingInterface/slidingInterface.H index 6474e985ed12dabf807b92eade61536abb575938..52232d8475e480e7a6f131268ec7a1b240804c30 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.H +++ b/src/dynamicMesh/slidingInterface/slidingInterface.H @@ -85,7 +85,7 @@ public: }; //- Direction names - static const NamedEnum<typeOfMatch, 2> typeOfMatchNames_; + static const Enum<typeOfMatch> typeOfMatchNames_; private: diff --git a/src/fileFormats/coordSet/coordSet.C b/src/fileFormats/coordSet/coordSet.C index c4149dc943582a3a4723846a98c744437016b1c5..bb311a62edd47a2eb239e603a0c5dad190cd91d2 100644 --- a/src/fileFormats/coordSet/coordSet.C +++ b/src/fileFormats/coordSet/coordSet.C @@ -27,15 +27,18 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -const Foam::Enum<Foam::coordSet::coordFormat> - Foam::coordSet::coordFormatNames_ - { - { coordFormat::XYZ, "xyz" }, - { coordFormat::X, "x" }, - { coordFormat::Y, "y" }, - { coordFormat::Z, "z" }, - { coordFormat::DISTANCE, "distance" } - }; +const Foam::Enum +< + Foam::coordSet::coordFormat +> +Foam::coordSet::coordFormatNames_ +{ + { coordFormat::XYZ, "xyz" }, + { coordFormat::X, "x" }, + { coordFormat::Y, "y" }, + { coordFormat::Z, "z" }, + { coordFormat::DISTANCE, "distance" } +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/fileFormats/fire/FIRECore.C b/src/fileFormats/fire/FIRECore.C index 4cf98960801fec203d0017f4ee69fd4ff270401a..10b15fe7c8288c0151a9b8f965e47f5911315921 100644 --- a/src/fileFormats/fire/FIRECore.C +++ b/src/fileFormats/fire/FIRECore.C @@ -27,14 +27,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::Enum<Foam::fileFormats::FIRECore::fileExt3d> - Foam::fileFormats::FIRECore::file3dExtensions - { - { fileExt3d::POLY_ASCII, "fpma" }, - { fileExt3d::POLY_BINARY, "fpmb" }, - { fileExt3d::POLY_ASCII_Z, "fpmaz" }, - { fileExt3d::POLY_BINARY_Z, "fpmbz" } - }; +const Foam::Enum +< + Foam::fileFormats::FIRECore::fileExt3d +> +Foam::fileFormats::FIRECore::file3dExtensions +{ + { fileExt3d::POLY_ASCII, "fpma" }, + { fileExt3d::POLY_BINARY, "fpmb" }, + { fileExt3d::POLY_ASCII_Z, "fpmaz" }, + { fileExt3d::POLY_BINARY_Z, "fpmbz" } +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/fileFormats/starcd/STARCDCore.C b/src/fileFormats/starcd/STARCDCore.C index 412738131e200a35e3625a31ed50aacefbfcdf94..d6ff48fc57b1349fe69c0d5288ff9f3da04d4b1d 100644 --- a/src/fileFormats/starcd/STARCDCore.C +++ b/src/fileFormats/starcd/STARCDCore.C @@ -33,22 +33,30 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::Enum<Foam::fileFormats::STARCDCore::fileHeader> - Foam::fileFormats::STARCDCore::fileHeaders_ - { - { fileHeader::HEADER_CEL, "PROSTAR_CELL" }, - { fileHeader::HEADER_VRT, "PROSTAR_VERTEX" }, - { fileHeader::HEADER_BND, "PROSTAR_BOUNDARY" } - }; +const Foam::Enum +< + Foam::fileFormats::STARCDCore::fileHeader +> +Foam::fileFormats::STARCDCore::fileHeaders_ +{ + { fileHeader::HEADER_CEL, "PROSTAR_CELL" }, + { fileHeader::HEADER_VRT, "PROSTAR_VERTEX" }, + { fileHeader::HEADER_BND, "PROSTAR_BOUNDARY" } +}; + + +const Foam::Enum +< + Foam::fileFormats::STARCDCore::fileExt +> +Foam::fileFormats::STARCDCore::fileExtensions_ +{ + { fileExt::CEL_FILE, "cel" }, + { fileExt::VRT_FILE, "vrt" }, + { fileExt::BND_FILE, "bnd" }, + { fileExt::INP_FILE, "inp" } +}; -const Foam::Enum<Foam::fileFormats::STARCDCore::fileExt> - Foam::fileFormats::STARCDCore::fileExtensions_ - { - { fileExt::CEL_FILE, "cel" }, - { fileExt::VRT_FILE, "vrt" }, - { fileExt::BND_FILE, "bnd" }, - { fileExt::INP_FILE, "inp" } - }; const char* const Foam::fileFormats::STARCDCore::defaultBoundaryName = "Default_Boundary_Region"; diff --git a/src/fileFormats/vtk/core/foamVtkCore.C b/src/fileFormats/vtk/core/foamVtkCore.C index be0cffa033ed79ea971d761a6457c5f2b8e25ea1..62612deb57a46b245c1bc909af23f752622bfaa4 100644 --- a/src/fileFormats/vtk/core/foamVtkCore.C +++ b/src/fileFormats/vtk/core/foamVtkCore.C @@ -27,7 +27,11 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -const Foam::Enum<Foam::vtk::fileTag> Foam::vtk::fileTagNames +const Foam::Enum +< + Foam::vtk::fileTag +> +Foam::vtk::fileTagNames { { fileTag::VTK_FILE, "VTKFile" }, { fileTag::DATA_ARRAY, "DataArray" }, @@ -45,7 +49,11 @@ const Foam::Enum<Foam::vtk::fileTag> Foam::vtk::fileTagNames }; -const Foam::Enum<Foam::vtk::fileAttr> Foam::vtk::fileAttrNames +const Foam::Enum +< + Foam::vtk::fileAttr +> +Foam::vtk::fileAttrNames { { fileAttr::OFFSET, "offset" }, { fileAttr::NUMBER_OF_COMPONENTS, "NumberOfComponents" }, @@ -57,7 +65,11 @@ const Foam::Enum<Foam::vtk::fileAttr> Foam::vtk::fileAttrNames }; -const Foam::Enum<Foam::vtk::dataArrayAttr> Foam::vtk::dataArrayAttrNames +const Foam::Enum +< + Foam::vtk::dataArrayAttr +> +Foam::vtk::dataArrayAttrNames { { dataArrayAttr::POINTS, "Points" }, { dataArrayAttr::OFFSETS, "offsets" }, diff --git a/src/fileFormats/vtk/output/foamVtkOutput.C b/src/fileFormats/vtk/output/foamVtkOutput.C index 7e18f7231438a71916e30bbe4ed8335030e1022e..454f8ac3ddd744de2edefe00c1c503b9a4289d50 100644 --- a/src/fileFormats/vtk/output/foamVtkOutput.C +++ b/src/fileFormats/vtk/output/foamVtkOutput.C @@ -36,18 +36,24 @@ License // * * * * * * * * * * * * * * * Static Data * * * * * * * * * * * * * * * * // -const Foam::Enum<Foam::vtk::fileTag> +const Foam::Enum +< + Foam::vtk::fileTag +> Foam::vtk::legacy::contentNames { - { vtk::fileTag::POLY_DATA, "POLYDATA" }, + { vtk::fileTag::POLY_DATA, "POLYDATA" }, { vtk::fileTag::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" }, }; -const Foam::Enum<Foam::vtk::fileTag> +const Foam::Enum +< + Foam::vtk::fileTag +> Foam::vtk::legacy::dataTypeNames { - { vtk::fileTag::CELL_DATA, "CELL_DATA" }, + { vtk::fileTag::CELL_DATA, "CELL_DATA" }, { vtk::fileTag::POINT_DATA, "POINT_DATA" } }; diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReader.C b/src/fileFormats/vtk/read/vtkUnstructuredReader.C index f29d57995ce3fc4909e69bc203995d75791591fb..2510aca05750ce97b88d91756e4f2dd6248d3273 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReader.C +++ b/src/fileFormats/vtk/read/vtkUnstructuredReader.C @@ -37,36 +37,47 @@ namespace Foam defineTypeNameAndDebug(vtkUnstructuredReader, 1); } -const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataType> - Foam::vtkUnstructuredReader::vtkDataTypeNames - { - { vtkDataType::VTK_INT, "int" }, - { vtkDataType::VTK_UINT, "unsigned_int" }, - { vtkDataType::VTK_LONG, "long" }, - { vtkDataType::VTK_ULONG, "unsigned_long" }, - { vtkDataType::VTK_FLOAT, "float" }, - { vtkDataType::VTK_DOUBLE, "double" }, - { vtkDataType::VTK_STRING, "string" }, - { vtkDataType::VTK_ID, "vtkIdType" } - }; - -const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataSetType> - Foam::vtkUnstructuredReader::vtkDataSetTypeNames - { - { vtkDataSetType::VTK_FIELD, "FIELD" }, - { vtkDataSetType::VTK_SCALARS, "SCALARS" }, - { vtkDataSetType::VTK_VECTORS, "VECTORS" } - }; +const Foam::Enum +< + Foam::vtkUnstructuredReader::vtkDataType +> +Foam::vtkUnstructuredReader::vtkDataTypeNames +{ + { vtkDataType::VTK_INT, "int" }, + { vtkDataType::VTK_UINT, "unsigned_int" }, + { vtkDataType::VTK_LONG, "long" }, + { vtkDataType::VTK_ULONG, "unsigned_long" }, + { vtkDataType::VTK_FLOAT, "float" }, + { vtkDataType::VTK_DOUBLE, "double" }, + { vtkDataType::VTK_STRING, "string" }, + { vtkDataType::VTK_ID, "vtkIdType" } +}; + + +const Foam::Enum +< + Foam::vtkUnstructuredReader::vtkDataSetType +> +Foam::vtkUnstructuredReader::vtkDataSetTypeNames +{ + { vtkDataSetType::VTK_FIELD, "FIELD" }, + { vtkDataSetType::VTK_SCALARS, "SCALARS" }, + { vtkDataSetType::VTK_VECTORS, "VECTORS" } +}; -const Foam::Enum<Foam::vtkUnstructuredReader::parseMode> - Foam::vtkUnstructuredReader::parseModeNames - { - { parseMode::NOMODE, "NOMODE" }, - { parseMode::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" }, - { parseMode::POLYDATA, "POLYDATA" }, - { parseMode::CELL_DATA, "CELL_DATA" }, - { parseMode::POINT_DATA, "POINT_DATA" } - }; + +const Foam::Enum +< + Foam::vtkUnstructuredReader::parseMode +> +Foam::vtkUnstructuredReader::parseModeNames +{ + { parseMode::NOMODE, "NOMODE" }, + { parseMode::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" }, + { parseMode::POLYDATA, "POLYDATA" }, + { parseMode::CELL_DATA, "CELL_DATA" }, + { parseMode::POINT_DATA, "POINT_DATA" } +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index 9719903efc9c37a9667755f7114c466c7f6e3d1a..3ddb6408dd528c9e473e6a4fcfea6e4c14e49d3c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -30,25 +30,15 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* NamedEnum - < - fanPressureFvPatchScalarField::fanFlowDirection, - 2 - >::names[] = - { - "in", - "out" - }; -} - -const Foam::NamedEnum +const Foam::Enum < - Foam::fanPressureFvPatchScalarField::fanFlowDirection, - 2 -> Foam::fanPressureFvPatchScalarField::fanFlowDirectionNames_; + Foam::fanPressureFvPatchScalarField::fanFlowDirection +> +Foam::fanPressureFvPatchScalarField::fanFlowDirectionNames_ +{ + { fanFlowDirection::ffdIn, "in" }, + { fanFlowDirection::ffdOut, "out" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -94,7 +84,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField : totalPressureFvPatchScalarField(p, iF, dict), fanCurve_(dict), - direction_(fanFlowDirectionNames_.read(dict.lookup("direction"))), + direction_(fanFlowDirectionNames_.lookup("direction", dict)), nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)), rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)), dm_(dict.lookupOrDefault<scalar>("dm", 0.0)) @@ -205,10 +195,8 @@ void Foam::fanPressureFvPatchScalarField::write(Ostream& os) const { totalPressureFvPatchScalarField::write(os); fanCurve_.write(os); - os.writeKeyword("direction") - << fanFlowDirectionNames_[direction_] << token::END_STATEMENT << nl; - os.writeKeyword("nonDimensional") << nonDimensional_ - << token::END_STATEMENT << nl; + os.writeEntry("direction", fanFlowDirectionNames_[direction_]); + os.writeEntry("nonDimensional", nonDimensional_); os.writeEntry("rpm", rpm_); os.writeEntry("dm", dm_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H index 60780a0cd8c4b18d1d631e276ca528d346547f44..fa8f07cdb06fce3fc91c2daa3f5f12e919c45034 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H @@ -123,8 +123,8 @@ public: ffdOut }; - //- Fan flow directions names - static const NamedEnum<fanFlowDirection, 2> fanFlowDirectionNames_; + //- Fan flow direction names + static const Enum<fanFlowDirection> fanFlowDirectionNames_; private: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C index 4b25603ce045c166af4b3ca3377e147b6f8b1efe..4d986bd2914c237eade76b3b03bb05ced71e82b6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C @@ -35,27 +35,25 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeType +> +Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeTypeNames_ { - template<> - const char* NamedEnum - < - waveSurfacePressureFvPatchScalarField::ddtSchemeType, - 3 - >::names[] = { - fv::EulerDdtScheme<scalar>::typeName_(), - fv::CrankNicolsonDdtScheme<scalar>::typeName_(), + ddtSchemeType::tsEuler, + fv::EulerDdtScheme<scalar>::typeName_() + }, + { + ddtSchemeType::tsCrankNicolson, + fv::CrankNicolsonDdtScheme<scalar>::typeName_() + }, + { + ddtSchemeType::tsBackward, fv::backwardDdtScheme<scalar>::typeName_() - }; -} - - -const Foam::NamedEnum -< - Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeType, - 3 -> Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeTypeNames_; + }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H index ef8214ee36a43e5019df73b988fc43f52bbf5b96..3706827143f242673271dad94b2876785e6d8530 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H @@ -79,7 +79,7 @@ SourceFiles #define waveSurfacePressureFvPatchScalarField_H #include "fixedValueFvPatchFields.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -121,7 +121,7 @@ private: word rhoName_; //- Time scheme type names - static const NamedEnum<ddtSchemeType, 3> ddtSchemeTypeNames_; + static const Enum<ddtSchemeType> ddtSchemeTypeNames_; public: diff --git a/src/finiteVolume/functionObjects/volRegion/volRegion.C b/src/finiteVolume/functionObjects/volRegion/volRegion.C index ab2f65fcfb06a49e6075d78055be88f115255539..34efa8a1e65f546f55f77cbe8de25ce0c84b3da9 100644 --- a/src/finiteVolume/functionObjects/volRegion/volRegion.C +++ b/src/finiteVolume/functionObjects/volRegion/volRegion.C @@ -37,19 +37,16 @@ namespace functionObjects } } -template<> -const char* -Foam::NamedEnum -< - Foam::functionObjects::volRegion::regionTypes, - 2 ->::names[] = {"cellZone", "all"}; -const Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::volRegion::regionTypes, - 2 -> Foam::functionObjects::volRegion::regionTypeNames_; + Foam::functionObjects::volRegion::regionTypes +> +Foam::functionObjects::volRegion::regionTypeNames_ +{ + { regionTypes::vrtCellZone, "cellZone" }, + { regionTypes::vrtAll, "all" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -79,9 +76,12 @@ Foam::functionObjects::volRegion::volRegion mesh_(mesh), regionType_ ( - dict.found("regionType") - ? regionTypeNames_.read(dict.lookup("regionType")) - : vrtAll + regionTypeNames_.lookupOrDefault + ( + "regionType", + dict, + regionTypes::vrtAll + ) ), regionName_(polyMesh::defaultRegion), regionID_(-1) @@ -144,7 +144,7 @@ bool Foam::functionObjects::volRegion::read { FatalIOErrorInFunction(dict) << "Unknown region type. Valid region types are:" - << regionTypeNames_.toc() + << regionTypeNames_.sortedToc() << exit(FatalIOError); } } diff --git a/src/finiteVolume/functionObjects/volRegion/volRegion.H b/src/finiteVolume/functionObjects/volRegion/volRegion.H index d466a131410b2793a5b113e5c48cf283dd0d9111..f95504684d9d5e922c35b7a7169f02d40b76eab2 100644 --- a/src/finiteVolume/functionObjects/volRegion/volRegion.H +++ b/src/finiteVolume/functionObjects/volRegion/volRegion.H @@ -71,7 +71,7 @@ SourceFiles #define functionObjects_volRegion_H #include "writeFile.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -111,7 +111,7 @@ public: }; //- Region type names - static const NamedEnum<regionTypes, 2> regionTypeNames_; + static const Enum<regionTypes> regionTypeNames_; protected: diff --git a/src/functionObjects/field/externalCoupled/externalCoupled.C b/src/functionObjects/field/externalCoupled/externalCoupled.C index 8bcf452ce958d85f3667a14245eba71b62ec902c..80ef9247da65644cf6324e9f616321403ff7a841 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupled.C +++ b/src/functionObjects/field/externalCoupled/externalCoupled.C @@ -50,13 +50,16 @@ namespace functionObjects } } -const Foam::Enum<Foam::functionObjects::externalCoupled::stateEnd> - Foam::functionObjects::externalCoupled::stateEndNames_ - { - { stateEnd::REMOVE, "remove" }, - { stateEnd::DONE, "done" } - // 'IGNORE' is internal use only and thus without a name - }; +const Foam::Enum +< + Foam::functionObjects::externalCoupled::stateEnd +> +Foam::functionObjects::externalCoupled::stateEndNames_ +{ + { stateEnd::REMOVE, "remove" }, + { stateEnd::DONE, "done" } + // 'IGNORE' is internal use only and thus without a name +}; Foam::word Foam::functionObjects::externalCoupled::lockName = "OpenFOAM"; diff --git a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C index efd22faf1188c49104df1657b8a3e8eb46d060ab..f42858f1f6915f4fdfcaae20be30197ba8eb5446 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C +++ b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C @@ -37,18 +37,16 @@ const Foam::word Foam::functionObjects::fieldAverageItem::EXT_PRIME2MEAN "Prime2Mean" ); -template<> -const char* Foam::NamedEnum -< - Foam::functionObjects::fieldAverageItem::baseType, - 2 ->::names[] = { "iteration", "time"}; -const Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::fieldAverageItem::baseType, - 2 -> Foam::functionObjects::fieldAverageItem::baseTypeNames_; + Foam::functionObjects::fieldAverageItem::baseType +> +Foam::functionObjects::fieldAverageItem::baseTypeNames_ +{ + { baseType::ITER, "iteration" }, + { baseType::TIME, "time" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H index d0b900f0e8b6386ab59f53efcc4abc814cfe3636..d683cafea7a4ca39745d86c147e15988c6c79431 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H +++ b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H @@ -50,7 +50,7 @@ SourceFiles #ifndef fieldAverageItem_H #define fieldAverageItem_H -#include "NamedEnum.H" +#include "Enum.H" #include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -119,7 +119,7 @@ private: word prime2MeanFieldName_; //- Averaging base type names - static const NamedEnum<baseType, 2> baseTypeNames_; + static const Enum<baseType> baseTypeNames_; //- Averaging base type baseType base_; diff --git a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C index 65e4e21abcb46bd79ce500c4ed152c0fa08f131d..a057aba5762ec8767a0a91e9e73f081adf03d016 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C +++ b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C @@ -47,7 +47,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is) fieldName_ = entry.keyword(); mean_ = readBool(entry.lookup("mean")); prime2Mean_ = readBool(entry.lookup("prime2Mean")); - base_ = baseTypeNames_[entry.lookup("base")]; + base_ = baseTypeNames_.lookup("base", entry); window_ = entry.lookupOrDefault<scalar>("window", -1.0); windowName_ = entry.lookupOrDefault<word>("windowName", ""); @@ -77,7 +77,7 @@ Foam::Istream& Foam::functionObjects::operator>> faItem.fieldName_ = entry.keyword(); faItem.mean_ = readBool(entry.lookup("mean")); faItem.prime2Mean_ = readBool(entry.lookup("prime2Mean")); - faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")]; + faItem.base_ = faItem.baseTypeNames_.lookup("base", entry); faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0); faItem.windowName_ = entry.lookupOrDefault<word>("windowName", ""); diff --git a/src/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/functionObjects/field/fieldMinMax/fieldMinMax.C index 491b05fb61f183bfde807f2f0e47a2f611ddfdb6..35d68b92f0a5876b16aaf1a26edb2a9fe4376d7a 100644 --- a/src/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -38,18 +38,15 @@ namespace functionObjects } } -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::fieldMinMax::modeType, - 2 ->::names[] = {"magnitude", "component"}; - -const Foam::NamedEnum -< - Foam::functionObjects::fieldMinMax::modeType, - 2 -> Foam::functionObjects::fieldMinMax::modeTypeNames_; + Foam::functionObjects::fieldMinMax::modeType +> +Foam::functionObjects::fieldMinMax::modeTypeNames_ +{ + { modeType::mdMag, "magnitude" }, + { modeType::mdCmpt, "component" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -126,7 +123,7 @@ bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict) location_ = dict.lookupOrDefault<Switch>("location", true); - mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")]; + mode_ = modeTypeNames_.lookupOrDefault("mode", dict, modeType::mdMag); dict.lookup("fields") >> fieldSet_; return true; diff --git a/src/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/functionObjects/field/fieldMinMax/fieldMinMax.H index 1871fdbfe9b8fdc2474986ba32ddb29eb967af95..588dc5c7fdd7ee22c41a43c601b583821fe6db54 100644 --- a/src/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -78,7 +78,7 @@ SourceFiles #define functionObjects_fieldMinMax_H #include "Switch.H" -#include "NamedEnum.H" +#include "Enum.H" #include "fvMeshFunctionObject.H" #include "writeFile.H" #include "vector.H" @@ -115,7 +115,7 @@ protected: // Protected data //- Mode type names - static const NamedEnum<modeType, 2> modeTypeNames_; + static const Enum<modeType> modeTypeNames_; //- Switch to write location of min/max values Switch location_; diff --git a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C index ca24bdad368348cce2d594a8c14ea327cd21bb27..68291255d13db596b559b5ff0b58f43b0023a5f0 100644 --- a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C +++ b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,24 +40,19 @@ namespace fieldValues } } -template<> -const char* Foam::NamedEnum + +const Foam::Enum < - Foam::functionObjects::fieldValues::fieldValueDelta::operationType, - 5 ->::names[] = + Foam::functionObjects::fieldValues::fieldValueDelta::operationType +> +Foam::functionObjects::fieldValues::fieldValueDelta::operationTypeNames_ { - "add", - "subtract", - "min", - "max", - "average" + { operationType::opAdd, "add" }, + { operationType::opSubtract, "subtract" }, + { operationType::opMin, "min" }, + { operationType::opMax, "max" }, + { operationType::opAverage, "average" }, }; -const Foam::NamedEnum -< - Foam::functionObjects::fieldValues::fieldValueDelta::operationType, - 5 -> Foam::functionObjects::fieldValues::fieldValueDelta::operationTypeNames_; // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -151,7 +146,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read ).ptr() ); - operation_ = operationTypeNames_.read(dict.lookup("operation")); + operation_ = operationTypeNames_.lookup("operation", dict); return true; } diff --git a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H index 038ef142fcec64fc174640896a136df4e39e3245..b4701247c75f6e6ab8e44f311d66c3adb31552a3 100644 --- a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H +++ b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,6 +85,7 @@ SourceFiles #include "stateFunctionObject.H" #include "writeFile.H" #include "fieldValue.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -116,7 +117,7 @@ public: }; //- Operation type names - static const NamedEnum<operationType, 5> operationTypeNames_; + static const Enum<operationType> operationTypeNames_; private: diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index 3d39aa4655d3b13b5637d85ca81a796d00b8cc41..f0eb481dd77f1f8dbb769e04b9ca02d7d8920a7b 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -49,75 +49,54 @@ namespace fieldValues } } -template<> -const char* Foam::NamedEnum -< - Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes, - 4 ->::names[] = -{ - "faceZone", - "patch", - "surface", - "sampledSurface" -}; -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::fieldValues::surfaceFieldValue::operationType, - 17 ->::names[] = + Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes +> +Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_ { - "none", - "sum", - "weightedSum", - "sumMag", - "sumDirection", - "sumDirectionBalance", - "average", - "weightedAverage", - "areaAverage", - "weightedAreaAverage", - "areaIntegrate", - "weightedAreaIntegrate", - "min", - "max", - "CoV", - "areaNormalAverage", - "areaNormalIntegrate" + { regionTypes::stFaceZone, "faceZone" }, + { regionTypes::stPatch, "patch" }, + { regionTypes::stSurface, "surface" }, + { regionTypes::stSampledSurface, "sampledSurface" }, }; -template<> -const char* Foam::NamedEnum + +const Foam::Enum < - Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType, - 2 ->::names[] = + Foam::functionObjects::fieldValues::surfaceFieldValue::operationType +> +Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_ { - "none", - "sqrt" + { operationType::opNone, "none" }, + { operationType::opSum, "sum" }, + { operationType::opWeightedSum, "weightedSum" }, + { operationType::opSumMag, "sumMag" }, + { operationType::opSumDirection, "sumDirection" }, + { operationType::opSumDirectionBalance, "sumDirectionBalance" }, + { operationType::opAverage, "average" }, + { operationType::opWeightedAverage, "weightedAverage" }, + { operationType::opAreaAverage, "areaAverage" }, + { operationType::opWeightedAreaAverage, "weightedAreaAverage" }, + { operationType::opAreaIntegrate, "areaIntegrate" }, + { operationType::opWeightedAreaIntegrate, "weightedAreaIntegrate" }, + { operationType::opMin, "min" }, + { operationType::opMax, "max" }, + { operationType::opCoV, "CoV" }, + { operationType::opAreaNormalAverage, "areaNormalAverage" }, + { operationType::opAreaNormalIntegrate, "areaNormalIntegrate" }, }; - -const Foam::NamedEnum -< - Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes, - 4 -> Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_; - -const Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::fieldValues::surfaceFieldValue::operationType, - 17 -> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_; - -const Foam::NamedEnum -< - Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType, - 2 + Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType > -Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_; +Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_ +{ + { postOperationType::postOpNone, "none" }, + { postOperationType::postOpSqrt, "sqrt" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -832,12 +811,16 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue ) : fieldValue(name, runTime, dict, typeName), - regionType_(regionTypeNames_.read(dict.lookup("regionType"))), - operation_(operationTypeNames_.read(dict.lookup("operation"))), + regionType_(regionTypeNames_.lookup("regionType", dict)), + operation_(operationTypeNames_.lookup("operation", dict)), postOperation_ ( - postOperationTypeNames_ - [dict.lookupOrDefault<word>("postOperation", "none")] + postOperationTypeNames_.lookupOrDefault + ( + "postOperation", + dict, + postOperationType::postOpNone + ) ), weightFieldName_("none"), writeArea_(dict.lookupOrDefault("writeArea", false)), @@ -859,12 +842,16 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue ) : fieldValue(name, obr, dict, typeName), - regionType_(regionTypeNames_.read(dict.lookup("regionType"))), - operation_(operationTypeNames_.read(dict.lookup("operation"))), + regionType_(regionTypeNames_.lookup("regionType", dict)), + operation_(operationTypeNames_.lookup("operation", dict)), postOperation_ ( - postOperationTypeNames_ - [dict.lookupOrDefault<word>("postOperation", "none")] + postOperationTypeNames_.lookupOrDefault + ( + "postOperation", + dict, + postOperationType::postOpNone + ) ), weightFieldName_("none"), writeArea_(dict.lookupOrDefault("writeArea", false)), diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H index a58b27b8a0b55170f214eae7999d2685b1458494..4cf6b7c5153c658cff1b13f097d64a0a8c706754 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H @@ -156,7 +156,7 @@ SourceFiles #define functionObjects_surfaceFieldValue_H #include "fieldValue.H" -#include "NamedEnum.H" +#include "Enum.H" #include "meshedSurf.H" #include "surfaceMesh.H" #include "fvsPatchField.H" @@ -198,7 +198,7 @@ public: }; //- Region type names - static const NamedEnum<regionTypes, 4> regionTypeNames_; + static const Enum<regionTypes> regionTypeNames_; //- Operation type enumeration @@ -224,7 +224,7 @@ public: }; //- Operation type names - static const NamedEnum<operationType, 17> operationTypeNames_; + static const Enum<operationType> operationTypeNames_; //- Post-operation type enumeration @@ -235,7 +235,7 @@ public: }; //- Operation type names - static const NamedEnum<postOperationType, 2> postOperationTypeNames_; + static const Enum<postOperationType> postOperationTypeNames_; private: diff --git a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C index fa77d962b08eefb0fe4e8382fbc52c73dc696ef8..912b6459bbf137d7009296b3551c4e4d3be9e005 100644 --- a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C +++ b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C @@ -43,35 +43,27 @@ namespace fieldValues } } -template<> -const char* -Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::fieldValues::volFieldValue::operationType, - 13 ->::names[] = + Foam::functionObjects::fieldValues::volFieldValue::operationType +> +Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_ { - "none", - "sum", - "weightedSum", - "sumMag", - "average", - "weightedAverage", - "volAverage", - "weightedVolAverage", - "volIntegrate", - "weightedVolIntegrate", - "min", - "max", - "CoV" + { operationType::opNone, "none" }, + { operationType::opSum, "sum" }, + { operationType::opWeightedSum, "weightedSum" }, + { operationType::opSumMag, "sumMag" }, + { operationType::opAverage, "average" }, + { operationType::opWeightedAverage, "weightedAverage" }, + { operationType::opVolAverage, "volAverage" }, + { operationType::opWeightedVolAverage, "weightedVolAverage" }, + { operationType::opVolIntegrate, "volIntegrate" }, + { operationType::opWeightedVolIntegrate, "weightedVolIntegrate" }, + { operationType::opMin, "min" }, + { operationType::opMax, "max" }, + { operationType::opCoV, "CoV" }, }; -const Foam::NamedEnum -< - Foam::functionObjects::fieldValues::volFieldValue::operationType, - 13 -> Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_; - // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -198,7 +190,7 @@ Foam::functionObjects::fieldValues::volFieldValue::volFieldValue : fieldValue(name, runTime, dict, typeName), volRegion(fieldValue::mesh_, dict), - operation_(operationTypeNames_.read(dict.lookup("operation"))), + operation_(operationTypeNames_.lookup("operation", dict)), weightFieldName_("none") { read(dict); @@ -215,7 +207,7 @@ Foam::functionObjects::fieldValues::volFieldValue::volFieldValue : fieldValue(name, obr, dict, typeName), volRegion(fieldValue::mesh_, dict), - operation_(operationTypeNames_.read(dict.lookup("operation"))), + operation_(operationTypeNames_.lookup("operation", dict)), weightFieldName_("none") { read(dict); diff --git a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.H b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.H index db9b34bc1e0ff2b6fa1c2fcd7e7eb95d686d6b5c..f2730c526f87b7deaf16603a1670a8e9d3ec081d 100644 --- a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.H +++ b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.H @@ -153,7 +153,7 @@ public: }; //- Operation type names - static const NamedEnum<operationType, 13> operationTypeNames_; + static const Enum<operationType> operationTypeNames_; protected: diff --git a/src/functionObjects/field/fluxSummary/fluxSummary.C b/src/functionObjects/field/fluxSummary/fluxSummary.C index 462aa40557f23eaa1880361755ff69de1706c2e5..cac7ab686adca278c5b5b32e5c6d914666675af0 100644 --- a/src/functionObjects/field/fluxSummary/fluxSummary.C +++ b/src/functionObjects/field/fluxSummary/fluxSummary.C @@ -52,24 +52,20 @@ namespace functionObjects dictionary ); } -template<> -const char* NamedEnum +} + +const Foam::Enum < - functionObjects::fluxSummary::modeType, - 5 ->::names[] = + Foam::functionObjects::fluxSummary::modeType +> +Foam::functionObjects::fluxSummary::modeTypeNames_ { - "faceZone", - "faceZoneAndDirection", - "cellZoneAndDirection", - "surface", - "surfaceAndDirection" + { modeType::mdFaceZone , "faceZone" }, + { modeType::mdFaceZoneAndDirection, "faceZoneAndDirection" }, + { modeType::mdCellZoneAndDirection, "cellZoneAndDirection" }, + { modeType::mdSurface, "surface" }, + { modeType::mdSurfaceAndDirection, "surfaceAndDirection" }, }; -} - - -const Foam::NamedEnum<Foam::functionObjects::fluxSummary::modeType, 5> -Foam::functionObjects::fluxSummary::modeTypeNames_; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -823,7 +819,7 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict) fvMeshFunctionObject::read(dict); writeFile::read(dict); - mode_ = modeTypeNames_.read(dict.lookup("mode")); + mode_ = modeTypeNames_.lookup("mode", dict); phiName_ = dict.lookupOrDefault<word>("phi", "phi"); scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0); tolerance_ = dict.lookupOrDefault<scalar>("tolerance", 0.8); diff --git a/src/functionObjects/field/fluxSummary/fluxSummary.H b/src/functionObjects/field/fluxSummary/fluxSummary.H index 287c6a3782fda55e7cab16deb00dbdb6411d5232..8c5a3a5a755f40def7d8da14f1e5ae69e998cf3b 100644 --- a/src/functionObjects/field/fluxSummary/fluxSummary.H +++ b/src/functionObjects/field/fluxSummary/fluxSummary.H @@ -124,7 +124,7 @@ public: }; //- Mode type names - static const NamedEnum<modeType, 5> modeTypeNames_; + static const Enum<modeType> modeTypeNames_; protected: diff --git a/src/functionObjects/field/setFlow/setFlow.C b/src/functionObjects/field/setFlow/setFlow.C index 0d61bbff3f450b4f96c584bf8ebd9346397bd68e..7d3353ab64ad19316a8a8ef6a4415c55f08a3d8c 100644 --- a/src/functionObjects/field/setFlow/setFlow.C +++ b/src/functionObjects/field/setFlow/setFlow.C @@ -48,7 +48,10 @@ namespace functionObjects } -const Foam::Enum<Foam::functionObjects::setFlow::modeType> +const Foam::Enum +< + Foam::functionObjects::setFlow::modeType +> Foam::functionObjects::setFlow::modeTypeNames { { functionObjects::setFlow::modeType::FUNCTION, "function" }, diff --git a/src/functionObjects/field/setFlow/setFlow.H b/src/functionObjects/field/setFlow/setFlow.H index 26425d8092781a2b526ab94b49de0bb05d1142bc..1a96940bb16a3ccafc9126d155e418ef1f1e289b 100644 --- a/src/functionObjects/field/setFlow/setFlow.H +++ b/src/functionObjects/field/setFlow/setFlow.H @@ -110,7 +110,7 @@ class setFlow VORTEX3D }; - static const Foam::Enum<modeType> modeTypeNames; + static const Enum<modeType> modeTypeNames; // Private Data diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/functionObjects/field/turbulenceFields/turbulenceFields.C index b09c20ad5f37a58d61e5ee2347933f361683be13..214aa9896a82014fe8b79fac09f1efbe09d5030e 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,51 +45,39 @@ namespace functionObjects } } -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::turbulenceFields::compressibleField, - 9 ->::names[] = + Foam::functionObjects::turbulenceFields::compressibleField +> +Foam::functionObjects::turbulenceFields::compressibleFieldNames_ { - "k", - "epsilon", - "omega", - "mut", - "muEff", - "alphat", - "alphaEff", - "R", - "devRhoReff" + { compressibleField::cfK, "k" }, + { compressibleField::cfEpsilon, "epsilon" }, + { compressibleField::cfOmega, "omega" }, + { compressibleField::cfMut, "mut" }, + { compressibleField::cfMuEff, "muEff" }, + { compressibleField::cfAlphat, "alphat" }, + { compressibleField::cfAlphaEff, "alphaEff" }, + { compressibleField::cfR, "R" }, + { compressibleField::cfDevRhoReff, "devRhoReff" }, }; -const Foam::NamedEnum -< - Foam::functionObjects::turbulenceFields::compressibleField, - 9 -> Foam::functionObjects::turbulenceFields::compressibleFieldNames_; -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::turbulenceFields::incompressibleField, - 7 ->::names[] = + Foam::functionObjects::turbulenceFields::incompressibleField +> +Foam::functionObjects::turbulenceFields::incompressibleFieldNames_ { - "k", - "epsilon", - "omega", - "nut", - "nuEff", - "R", - "devReff" + { incompressibleField::ifK, "k" }, + { incompressibleField::ifEpsilon, "epsilon" }, + { incompressibleField::ifOmega, "omega" }, + { incompressibleField::ifNut, "nut" }, + { incompressibleField::ifNuEff, "nuEff" }, + { incompressibleField::ifR, "R" }, + { incompressibleField::ifDevReff, "devReff" }, }; -const Foam::NamedEnum -< - Foam::functionObjects::turbulenceFields::incompressibleField, - 7 -> Foam::functionObjects::turbulenceFields::incompressibleFieldNames_; const Foam::word Foam::functionObjects::turbulenceFields::modelName ( diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/functionObjects/field/turbulenceFields/turbulenceFields.H index 5798fc3f75673a0472b56f23b06e1fc757f7e3a1..dc6e168abd4ac738e06ced35791ce94052c022e2 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.H +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -90,7 +90,7 @@ SourceFiles #include "fvMeshFunctionObject.H" #include "HashSet.H" -#include "NamedEnum.H" +#include "Enum.H" #include "volFieldsFwd.H" #include "Switch.H" @@ -123,7 +123,7 @@ public: cfR, cfDevRhoReff }; - static const NamedEnum<compressibleField, 9> compressibleFieldNames_; + static const Enum<compressibleField> compressibleFieldNames_; enum incompressibleField { @@ -135,7 +135,7 @@ public: ifR, ifDevReff }; - static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_; + static const Enum<incompressibleField> incompressibleFieldNames_; static const word modelName; diff --git a/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C b/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C index 3645ddbb0cbf720453f664937e64fd34d7d057b0..68818625dc6bb80384b3e3a5715f89cef5eb3fb4 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C +++ b/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C @@ -47,46 +47,27 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::functionObjects::fieldVisualisationBase::colourByType +> +Foam::functionObjects::fieldVisualisationBase::colourByTypeNames { - template<> - const char* NamedEnum - < - functionObjects::fieldVisualisationBase::colourByType, - 2 - >::names[] = - { - "colour", - "field" - }; - - template<> - const char* NamedEnum - < - functionObjects::fieldVisualisationBase::colourMapType, - 4 - >::names[] = - { - "rainbow", - "blueWhiteRed", - "fire", - "greyscale" - }; -} - -const Foam::NamedEnum - < - Foam::functionObjects::fieldVisualisationBase::colourByType, - 2 - > - Foam::functionObjects::fieldVisualisationBase::colourByTypeNames; - -const Foam::NamedEnum - < - Foam::functionObjects::fieldVisualisationBase::colourMapType, - 4 - > - Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames; + { colourByType::cbColour, "colour" }, + { colourByType::cbField, "field" }, +}; + +const Foam::Enum +< + Foam::functionObjects::fieldVisualisationBase::colourMapType +> +Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames +{ + { colourMapType::cmRainbow, "rainbow" }, + { colourMapType::cmBlueWhiteRed, "blueWhiteRed" }, + { colourMapType::cmFire, "fire" }, + { colourMapType::cmGreyscale, "greyscale" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -508,7 +489,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase colourMap_(cmRainbow), range_() { - colourBy_ = colourByTypeNames.read(dict.lookup("colourBy")); + colourBy_ = colourByTypeNames.lookup("colourBy", dict); switch (colourBy_) { @@ -523,7 +504,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase if (dict.found("colourMap")) { - colourMap_ = colourMapTypeNames.read(dict.lookup("colourMap")); + colourMap_ = colourMapTypeNames.lookup("colourMap", dict); } const dictionary& sbarDict = dict.subDict("scalarBar"); diff --git a/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.H b/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.H index 0ae8c6a608075c16eb359e1c18ef1d8a9864cbe1..3df00661a1e60cfed02277694663d80e4f58ac12 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.H +++ b/src/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.H @@ -37,7 +37,7 @@ SourceFiles #include "dictionary.H" #include "Tuple2.H" -#include "NamedEnum.H" +#include "Enum.H" #include "vector.H" #include "HashPtrTable.H" #include "Function1.H" @@ -78,7 +78,7 @@ public: cbField }; - static const NamedEnum<colourByType, 2> colourByTypeNames; + static const Enum<colourByType> colourByTypeNames; enum colourMapType { @@ -88,7 +88,7 @@ public: cmGreyscale }; - static const NamedEnum<colourMapType, 4> colourMapTypeNames; + static const Enum<colourMapType> colourMapTypeNames; private: diff --git a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C index 2e9ac28b658a68bed82bce6b8deda3c27f4120fb..2bc15a840d15f2c8b0cfb0ed71511eb3ff65aa47 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C +++ b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.C @@ -32,27 +32,16 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* NamedEnum - < - functionObjects::runTimePostPro::geometryBase::renderModeType, - 3 - >::names[] = - { - "flat", - "gouraud", - "phong" - }; -} - -const Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::runTimePostPro::geometryBase::renderModeType, - 3 + Foam::functionObjects::runTimePostPro::geometryBase::renderModeType > - Foam::functionObjects::runTimePostPro::geometryBase::renderModeTypeNames; +Foam::functionObjects::runTimePostPro::geometryBase::renderModeTypeNames +{ + { renderModeType::rmFlat, "flat" }, + { renderModeType::rmGouraud, "gouraud" }, + { renderModeType::rmPhong, "phong" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -104,7 +93,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase { if (dict.found("renderMode")) { - renderMode_ = renderModeTypeNames.read(dict.lookup("renderMode")); + renderMode_ = renderModeTypeNames.lookup("renderMode", dict); } if (dict.found("opacity")) diff --git a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H index 714c5de0df3ed41f8b158b247aae05e337d574d9..bf27d3cb0f39b22afa64894c1e66352ca3b1b45a 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H +++ b/src/functionObjects/graphics/runTimePostProcessing/geometryBase.H @@ -39,7 +39,7 @@ SourceFiles #include "vector.H" #include "Function1.H" #include "HashPtrTable.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -75,7 +75,7 @@ public: rmPhong //!< Phong shading }; - static const NamedEnum<renderModeType, 3> renderModeTypeNames; + static const Enum<renderModeType> renderModeTypeNames; private: diff --git a/src/functionObjects/graphics/runTimePostProcessing/pathline.C b/src/functionObjects/graphics/runTimePostProcessing/pathline.C index 36c1aa9a013e8fa58c3c16dc100af592ef8d4a6f..717125fdc92c50e4ab8b7e7b6e5bca4bdbf2ff92 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/pathline.C +++ b/src/functionObjects/graphics/runTimePostProcessing/pathline.C @@ -48,27 +48,19 @@ namespace runTimePostPro defineRunTimeSelectionTable(pathline, dictionary); } } - -template<> -const char* NamedEnum -< - functionObjects::runTimePostPro::pathline::representationType, - 4 ->::names[] = -{ - "none", - "line", - "tube", - "vector" -}; } -const Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::runTimePostPro::pathline::representationType, - 4 + Foam::functionObjects::runTimePostPro::pathline::representationType > - Foam::functionObjects::runTimePostPro::pathline::representationTypeNames; +Foam::functionObjects::runTimePostPro::pathline::representationTypeNames +{ + { representationType::rtNone, "none" }, + { representationType::rtLine, "line" }, + { representationType::rtTube, "tube" }, + { representationType::rtVector, "vector" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -137,7 +129,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline geometryBase(parent, dict, colours), representation_ ( - representationTypeNames.read(dict.lookup("representation")) + representationTypeNames.lookup("representation", dict) ), tubeRadius_(0.0), lineColour_(nullptr) diff --git a/src/functionObjects/graphics/runTimePostProcessing/pathline.H b/src/functionObjects/graphics/runTimePostProcessing/pathline.H index 209a2887cd80840633f2d155026195f9e792ef99..fb4893cb7eecf4463dac7a068b942ac94a35208e 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/pathline.H +++ b/src/functionObjects/graphics/runTimePostProcessing/pathline.H @@ -35,7 +35,7 @@ SourceFiles #define functionObjects_runTimePostPro_pathline_H #include "geometryBase.H" -#include "NamedEnum.H" +#include "Enum.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,7 +71,7 @@ public: rtVector }; - static const NamedEnum<representationType, 4> representationTypeNames; + static const Enum<representationType> representationTypeNames; private: diff --git a/src/functionObjects/graphics/runTimePostProcessing/pointData.C b/src/functionObjects/graphics/runTimePostProcessing/pointData.C index 94c289d1f7b06177863624cd937e5de74f9bd212..e9c8afacce4c7e6cbc2476d54079deb1d26ae02d 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/pointData.C +++ b/src/functionObjects/graphics/runTimePostProcessing/pointData.C @@ -48,24 +48,17 @@ namespace runTimePostPro defineRunTimeSelectionTable(pointData, dictionary); } } -template<> -const char* NamedEnum -< - functionObjects::runTimePostPro::pointData::representationType, - 2 ->::names[] = -{ - "sphere", - "vector" -}; } -const Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::runTimePostPro::pointData::representationType, - 2 + Foam::functionObjects::runTimePostPro::pointData::representationType > - Foam::functionObjects::runTimePostPro::pointData::representationTypeNames; +Foam::functionObjects::runTimePostPro::pointData::representationTypeNames +{ + { representationType::rtSphere, "sphere" }, + { representationType::rtVector, "vector" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -106,7 +99,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData geometryBase(parent, dict, colours), representation_ ( - representationTypeNames.read(dict.lookup("representation")) + representationTypeNames.lookup("representation", dict) ), maxGlyphLength_(readScalar(dict.lookup("maxGlyphLength"))), pointColour_(nullptr) diff --git a/src/functionObjects/graphics/runTimePostProcessing/pointData.H b/src/functionObjects/graphics/runTimePostProcessing/pointData.H index 41c425e4aadad567548efbf03440605807574f47..73f7b5f61d1a2651c76e0f246cf05346ebafcc3f 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/pointData.H +++ b/src/functionObjects/graphics/runTimePostProcessing/pointData.H @@ -35,7 +35,7 @@ SourceFiles #define functionObjects_runTimePostPro_pointData_H #include "geometryBase.H" -#include "NamedEnum.H" +#include "Enum.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,7 +69,7 @@ public: rtVector //!< Vector }; - static const NamedEnum<representationType, 2> representationTypeNames; + static const Enum<representationType> representationTypeNames; private: diff --git a/src/functionObjects/graphics/runTimePostProcessing/scene.H b/src/functionObjects/graphics/runTimePostProcessing/scene.H index 127fcb6db6909bd0e94645efae5f1d2cc95bb05a..407896dc4ca2656fb5802628e8364e5b8647fdbe 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/scene.H +++ b/src/functionObjects/graphics/runTimePostProcessing/scene.H @@ -62,7 +62,7 @@ SourceFiles #include "vector.H" #include "point.H" #include "boundBox.H" -#include "NamedEnum.H" +#include "Enum.H" #include "HashPtrTable.H" #include "vector.H" diff --git a/src/functionObjects/graphics/runTimePostProcessing/surface.C b/src/functionObjects/graphics/runTimePostProcessing/surface.C index 222760c4563e399a05ca70ef372d373b35f98a30..809b8294ad7cf2d2b98fc36e9123669651981824 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/surface.C +++ b/src/functionObjects/graphics/runTimePostProcessing/surface.C @@ -48,27 +48,21 @@ namespace runTimePostPro defineRunTimeSelectionTable(surface, dictionary); } } -template<> -const char* NamedEnum -< - functionObjects::runTimePostPro::surface::representationType, - 5 ->::names[] = -{ - "none", - "wireframe", - "surface", - "surfaceWithEdges", - "glyph" -}; } -const Foam::NamedEnum + +const Foam::Enum < - Foam::functionObjects::runTimePostPro::surface::representationType, - 5 + Foam::functionObjects::runTimePostPro::surface::representationType > - Foam::functionObjects::runTimePostPro::surface::representationTypeNames; +Foam::functionObjects::runTimePostPro::surface::representationTypeNames +{ + { representationType::rtNone, "none" }, + { representationType::rtWireframe, "wireframe" }, + { representationType::rtSurface, "surface" }, + { representationType::rtSurfaceWithEdges, "surfaceWithEdges" }, + { representationType::rtGlyph, "glyph" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -155,7 +149,7 @@ Foam::functionObjects::runTimePostPro::surface::surface geometryBase(parent, dict, colours), representation_ ( - representationTypeNames.read(dict.lookup("representation")) + representationTypeNames.lookup("representation", dict) ), featureEdges_(false), surfaceColour_(nullptr), diff --git a/src/functionObjects/graphics/runTimePostProcessing/surface.H b/src/functionObjects/graphics/runTimePostProcessing/surface.H index e1510cab89e4600b252109df478ab0081dc01b03..3913087aa8da266a9d74c32d92ced10a740bb10a 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/surface.H +++ b/src/functionObjects/graphics/runTimePostProcessing/surface.H @@ -35,7 +35,7 @@ SourceFiles #define functionObjects_runTimePostPro_surface_H #include "geometryBase.H" -#include "NamedEnum.H" +#include "Enum.H" #include "runTimeSelectionTables.H" #include "vtkSmartPointer.h" @@ -74,7 +74,7 @@ public: rtGlyph }; - static const NamedEnum<representationType, 5> representationTypeNames; + static const Enum<representationType> representationTypeNames; private: diff --git a/src/functionObjects/utilities/abort/abort.C b/src/functionObjects/utilities/abort/abort.C index ef2b3cbf39b35e7888812c52c5ec29c22f35c1e6..93055ef5519311f3acc69262008abb25b220408c 100644 --- a/src/functionObjects/utilities/abort/abort.C +++ b/src/functionObjects/utilities/abort/abort.C @@ -48,24 +48,18 @@ namespace functionObjects } } -template<> -const char* Foam::NamedEnum + +const Foam::Enum < - Foam::functionObjects::abort::actionType, - 3 ->::names[] = + Foam::Time::stopAtControls +> +Foam::functionObjects::abort::actionNames_ { - "noWriteNow", - "writeNow", - "nextWrite" + { Time::stopAtControls::saNoWriteNow, "noWriteNow" }, + { Time::stopAtControls::saWriteNow, "writeNow" }, + { Time::stopAtControls::saNextWrite, "nextWrite" }, }; -const Foam::NamedEnum -< - Foam::functionObjects::abort::actionType, - 3 -> Foam::functionObjects::abort::actionTypeNames_; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -94,7 +88,7 @@ Foam::functionObjects::abort::abort functionObject(name), time_(runTime), abortFile_("$FOAM_CASE/" + name), - action_(nextWrite) + action_(Time::stopAtControls::saNextWrite) { abortFile_.expand(); read(dict); @@ -116,14 +110,12 @@ bool Foam::functionObjects::abort::read(const dictionary& dict) { functionObject::read(dict); - if (dict.found("action")) - { - action_ = actionTypeNames_.read(dict.lookup("action")); - } - else - { - action_ = nextWrite; - } + action_ = actionNames_.lookupOrDefault + ( + "action", + dict, + Time::stopAtControls::saNextWrite + ); if (dict.readIfPresent("file", abortFile_)) { @@ -143,9 +135,9 @@ bool Foam::functionObjects::abort::execute() { switch (action_) { - case noWriteNow : + case Time::saNoWriteNow : { - if (time_.stopAt(Time::saNoWriteNow)) + if (time_.stopAt(action_)) { Info<< "USER REQUESTED ABORT (timeIndex=" << time_.timeIndex() @@ -155,9 +147,9 @@ bool Foam::functionObjects::abort::execute() break; } - case writeNow : + case Time::saWriteNow : { - if (time_.stopAt(Time::saWriteNow)) + if (time_.stopAt(action_)) { Info<< "USER REQUESTED ABORT (timeIndex=" << time_.timeIndex() @@ -167,9 +159,9 @@ bool Foam::functionObjects::abort::execute() break; } - case nextWrite : + case Time::saNextWrite : { - if (time_.stopAt(Time::saNextWrite)) + if (time_.stopAt(action_)) { Info<< "USER REQUESTED ABORT (timeIndex=" << time_.timeIndex() @@ -178,6 +170,11 @@ bool Foam::functionObjects::abort::execute() } break; } + + default: + { + // Invalid choices already filtered out by Enum + } } } diff --git a/src/functionObjects/utilities/abort/abort.H b/src/functionObjects/utilities/abort/abort.H index d9c16c8a23855355cb80a95c33f42f694692a3e2..3106f857cc68ddaa8f94d5a07efda928d30352d2 100644 --- a/src/functionObjects/utilities/abort/abort.H +++ b/src/functionObjects/utilities/abort/abort.H @@ -45,7 +45,7 @@ SourceFiles #define functionObjects_abort_H #include "functionObject.H" -#include "NamedEnum.H" +#include "Time.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,33 +62,19 @@ class abort : public functionObject { -public: - - // Public data - - //- Enumeration defining the type of action - enum actionType - { - noWriteNow, //!< stop immediately without writing data - writeNow, //!< write data and stop immediately - nextWrite //!< stop the next time data are written - }; - -private: - // Private data + //- A subset of Time stopAtControls + static const Enum<Time::stopAtControls> actionNames_; + //- Reference to the Time const Time& time_; //- The fully-qualified name of the abort file fileName abortFile_; - //- Action type names - static const NamedEnum<actionType, 3> actionTypeNames_; - //- The type of action - actionType action_; + Time::stopAtControls action_; // Private Member Functions @@ -97,10 +83,10 @@ private: void removeFile() const; //- Disallow default bitwise copy construct - abort(const abort&); + abort(const abort&) = delete; //- Disallow default bitwise assignment - void operator=(const abort&); + void operator=(const abort&) = delete; public: @@ -127,7 +113,7 @@ public: // Member Functions //- Read the dictionary settings - virtual bool read(const dictionary&); + virtual bool read(const dictionary& dict); //- Execute, check existence of abort file and take action virtual bool execute(); diff --git a/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.C b/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.C index 4967d50143b029a498bc938d4508f4d3d18bfead..8bc3ac5e468ef8d3634c41c11d4dc3347d5d1752 100644 --- a/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.C +++ b/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.C @@ -47,32 +47,21 @@ namespace runTimeControls } } } -template<> -const char* Foam::NamedEnum -< - Foam - ::functionObjects - ::runTimeControls - ::equationInitialResidualCondition - ::operatingMode, - 2 ->::names[] = -{ - "minimum", - "maximum" -}; -const Foam::NamedEnum +const Foam::Enum < Foam ::functionObjects ::runTimeControls ::equationInitialResidualCondition - ::operatingMode, - 2 + ::operatingMode > Foam::functionObjects::runTimeControls::equationInitialResidualCondition:: - operatingModeNames; +operatingModeNames +{ + { operatingMode::omMin, "minimum" }, + { operatingMode::omMax, "maximum" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -90,7 +79,7 @@ equationInitialResidualCondition fieldNames_(dict.lookup("fields")), value_(readScalar(dict.lookup("value"))), timeStart_(dict.lookupOrDefault("timeStart", -GREAT)), - mode_(operatingModeNames.read(dict.lookup("mode"))) + mode_(operatingModeNames.lookup("mode", dict)) { if (fieldNames_.size()) { diff --git a/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.H b/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.H index 85dc192476be5248add6e48b2b2dc3e9c5307223..849342ad55a4393d8195767b58ee6fc298ebaa2f 100644 --- a/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.H +++ b/src/functionObjects/utilities/runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.H @@ -37,7 +37,7 @@ SourceFiles #define functionObjects_runTimeControls_equationInitialResidualCondition_H #include "runTimeCondition.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +64,7 @@ public: omMax //!< Maximum }; - static const NamedEnum<operatingMode, 2> operatingModeNames; + static const Enum<operatingMode> operatingModeNames; protected: diff --git a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C index e848a310871413f5505861d75b9e4f52a92ca314..e7b2062fb5585d7e86304a6e1b121d6eb8389d31 100644 --- a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C +++ b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C @@ -57,27 +57,19 @@ namespace runTimeControls } } -template<> -const char* Foam::NamedEnum -< - Foam::functionObjects::runTimeControls::minMaxCondition::modeType, - 2 ->::names[] = -{ - "minimum", - "maximum" -}; - -const Foam::NamedEnum +const Foam::Enum < Foam ::functionObjects ::runTimeControls ::minMaxCondition - ::modeType, - 2 + ::modeType > - Foam::functionObjects::runTimeControls::minMaxCondition::modeTypeNames_; +Foam::functionObjects::runTimeControls::minMaxCondition::modeTypeNames_ +{ + { modeType::mdMin, "minimum" }, + { modeType::mdMax, "maximum" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -92,7 +84,7 @@ Foam::functionObjects::runTimeControls::minMaxCondition::minMaxCondition : runTimeCondition(name, obr, dict, state), functionObjectName_(dict.lookup("functionObject")), - mode_(modeTypeNames_.read(dict.lookup("mode"))), + mode_(modeTypeNames_.lookup("mode", dict)), fieldNames_(dict.lookup("fields")), value_(readScalar(dict.lookup("value"))) {} diff --git a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.H b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.H index 27cbe4356d7cc552635af48515bd8c6bc5fdaebc..ef95f935cd4e6162ca64cd7b68237e0830895878 100644 --- a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.H +++ b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.H @@ -38,7 +38,7 @@ SourceFiles #define functionObjects_runTimeControls_minMaxCondition_H #include "runTimeCondition.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,7 +68,7 @@ public: mdMax //!< Maximum }; - static const NamedEnum<modeType, 2> modeTypeNames_; + static const Enum<modeType> modeTypeNames_; protected: diff --git a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minTimeStepCondition/minTimeStepCondition.H b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minTimeStepCondition/minTimeStepCondition.H index a207a8a49eeb0ebc1157b942dfc20849b831b8d4..c68069e468513f879106172eaf24ac074ccef505 100644 --- a/src/functionObjects/utilities/runTimeControl/runTimeCondition/minTimeStepCondition/minTimeStepCondition.H +++ b/src/functionObjects/utilities/runTimeControl/runTimeCondition/minTimeStepCondition/minTimeStepCondition.H @@ -37,7 +37,6 @@ SourceFiles #define functionObjects_runTimeConditions_minTimeStepCondition_H #include "runTimeCondition.H" -#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/functionObjects/utilities/writeObjects/writeObjects.C b/src/functionObjects/utilities/writeObjects/writeObjects.C index eade94640241e57bd18c4fc9af480457cf0752c5..de380505523ad04e00e9741ad5c7e78f02fd24c5 100644 --- a/src/functionObjects/utilities/writeObjects/writeObjects.C +++ b/src/functionObjects/utilities/writeObjects/writeObjects.C @@ -45,24 +45,17 @@ namespace functionObjects } } -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::functionObjects::writeObjects::writeOption, - 3 ->::names[] = + Foam::functionObjects::writeObjects::writeOption +> +Foam::functionObjects::writeObjects::writeOptionNames_ { - "autoWrite", - "noWrite", - "anyWrite" + { writeOption::AUTO_WRITE, "autoWrite" }, + { writeOption::NO_WRITE, "noWrite" }, + { writeOption::ANY_WRITE, "anyWrite" }, }; -const Foam::NamedEnum -< - Foam::functionObjects::writeObjects::writeOption, - 3 -> Foam::functionObjects::writeObjects::writeOptionNames_; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -114,14 +107,12 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict) dict.lookup("objects") >> objectNames_; } - if (dict.found("writeOption")) - { - writeOption_ = writeOptionNames_.read(dict.lookup("writeOption")); - } - else - { - writeOption_ = ANY_WRITE; - } + writeOption_ = writeOptionNames_.lookupOrDefault + ( + "writeOption", + dict, + writeOption::ANY_WRITE + ); return true; } diff --git a/src/functionObjects/utilities/writeObjects/writeObjects.H b/src/functionObjects/utilities/writeObjects/writeObjects.H index 0858772e1f413a9920dbc7d2ccb4ba4efc09dacd..f86364a1b70a37f411db3d729b649764acc636bb 100644 --- a/src/functionObjects/utilities/writeObjects/writeObjects.H +++ b/src/functionObjects/utilities/writeObjects/writeObjects.H @@ -84,8 +84,8 @@ SourceFiles #define functionObjects_writeObjects_H #include "functionObject.H" -#include "wordReList.H" -#include "NamedEnum.H" +#include "wordRes.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -119,7 +119,7 @@ public: ANY_WRITE }; - static const NamedEnum<writeOption, 3> writeOptionNames_; + static const Enum<writeOption> writeOptionNames_; private: @@ -138,10 +138,10 @@ private: // Private Member Functions //- Disallow default bitwise copy construct - writeObjects(const writeObjects&); + writeObjects(const writeObjects&) = delete; //- Disallow default bitwise assignment - void operator=(const writeObjects&); + void operator=(const writeObjects&) = delete; public: diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index 52d68a6fb6b3b74537fd08875eaa8405a5fd7ad8..85d3cd19fd82f6f5f85058dbaee1f39394a9f1cc 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C @@ -30,31 +30,23 @@ License #include "fvMesh.H" #include "displacementMotionSolver.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* -NamedEnum<surfaceDisplacementPointPatchVectorField::projectMode, 3>:: -names[] = +const Foam::Enum +< + Foam::surfaceDisplacementPointPatchVectorField::projectMode +> +Foam::surfaceDisplacementPointPatchVectorField::projectModeNames_ { - "nearest", - "pointNormal", - "fixedNormal" + { projectMode::NEAREST, "nearest" }, + { projectMode::POINTNORMAL, "pointNormal" }, + { projectMode::FIXEDNORMAL, "fixedNormal" }, }; -const NamedEnum<surfaceDisplacementPointPatchVectorField::projectMode, 3> - surfaceDisplacementPointPatchVectorField::projectModeNames_; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void surfaceDisplacementPointPatchVectorField::calcProjection +void Foam::surfaceDisplacementPointPatchVectorField::calcProjection ( vectorField& displacement ) const @@ -300,7 +292,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -surfaceDisplacementPointPatchVectorField:: +Foam::surfaceDisplacementPointPatchVectorField:: surfaceDisplacementPointPatchVectorField ( const pointPatch& p, @@ -315,7 +307,7 @@ surfaceDisplacementPointPatchVectorField {} -surfaceDisplacementPointPatchVectorField:: +Foam::surfaceDisplacementPointPatchVectorField:: surfaceDisplacementPointPatchVectorField ( const pointPatch& p, @@ -326,7 +318,7 @@ surfaceDisplacementPointPatchVectorField fixedValuePointPatchVectorField(p, iF, dict), velocity_(dict.lookup("velocity")), surfacesDict_(dict.subDict("geometry")), - projectMode_(projectModeNames_.read(dict.lookup("projectMode"))), + projectMode_(projectModeNames_.lookup("projectMode", dict)), projectDir_(dict.lookup("projectDirection")), wedgePlane_(dict.lookupOrDefault("wedgePlane", -1)), frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null)) @@ -342,7 +334,7 @@ surfaceDisplacementPointPatchVectorField } -surfaceDisplacementPointPatchVectorField:: +Foam::surfaceDisplacementPointPatchVectorField:: surfaceDisplacementPointPatchVectorField ( const surfaceDisplacementPointPatchVectorField& ppf, @@ -361,7 +353,7 @@ surfaceDisplacementPointPatchVectorField {} -surfaceDisplacementPointPatchVectorField:: +Foam::surfaceDisplacementPointPatchVectorField:: surfaceDisplacementPointPatchVectorField ( const surfaceDisplacementPointPatchVectorField& ppf @@ -377,7 +369,7 @@ surfaceDisplacementPointPatchVectorField {} -surfaceDisplacementPointPatchVectorField:: +Foam::surfaceDisplacementPointPatchVectorField:: surfaceDisplacementPointPatchVectorField ( const surfaceDisplacementPointPatchVectorField& ppf, @@ -396,8 +388,8 @@ surfaceDisplacementPointPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const searchableSurfaces& -surfaceDisplacementPointPatchVectorField::surfaces() const +const Foam::searchableSurfaces& +Foam::surfaceDisplacementPointPatchVectorField::surfaces() const { if (surfacesPtr_.empty()) { @@ -423,7 +415,7 @@ surfaceDisplacementPointPatchVectorField::surfaces() const } -void surfaceDisplacementPointPatchVectorField::updateCoeffs() +void Foam::surfaceDisplacementPointPatchVectorField::updateCoeffs() { if (this->updated()) { @@ -469,38 +461,33 @@ void surfaceDisplacementPointPatchVectorField::updateCoeffs() } -void surfaceDisplacementPointPatchVectorField::write(Ostream& os) const +void Foam::surfaceDisplacementPointPatchVectorField::write(Ostream& os) const { fixedValuePointPatchVectorField::write(os); - os.writeKeyword("velocity") << velocity_ - << token::END_STATEMENT << nl; - os.writeKeyword("geometry") << surfacesDict_ - << token::END_STATEMENT << nl; - os.writeKeyword("projectMode") << projectModeNames_[projectMode_] - << token::END_STATEMENT << nl; - os.writeKeyword("projectDirection") << projectDir_ - << token::END_STATEMENT << nl; - os.writeKeyword("wedgePlane") << wedgePlane_ - << token::END_STATEMENT << nl; + os.writeEntry("velocity", velocity_); + os.writeEntry("geometry", surfacesDict_); + os.writeEntry("projectMode", projectModeNames_[projectMode_]); + os.writeEntry("projectDirection", projectDir_); + os.writeEntry("wedgePlane", wedgePlane_); + if (frozenPointsZone_ != word::null) { - os.writeKeyword("frozenPointsZone") << frozenPointsZone_ - << token::END_STATEMENT << nl; + os.writeEntry("frozenPointsZone", frozenPointsZone_); } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePointPatchTypeField ( fixedValuePointPatchVectorField, surfaceDisplacementPointPatchVectorField ); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H index c5db3f0c6a6783aad17a39088fde883c52186e6c..652794efa798e8e7abb32cae2e3d4a5dd84de60e 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.H @@ -60,6 +60,7 @@ SourceFiles #include "pointPatchFields.H" #include "fixedValuePointPatchFields.H" #include "searchableSurfaces.H" +#include "Enum.H" #include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -92,7 +93,7 @@ private: // Private data //- Project mode names - static const NamedEnum<projectMode, 3> projectModeNames_; + static const Enum<projectMode> projectModeNames_; //- Maximum velocity const vector velocity_; diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index 6eee20eb32c0a8b4f2ae546c6a1da0e2f8aa66a3..a85df2a86373406e533eda6df1e4ec4ba3e46a64 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -30,30 +30,23 @@ License #include "fvMesh.H" #include "displacementMotionSolver.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* -NamedEnum<surfaceSlipDisplacementPointPatchVectorField::projectMode, 3>:: -names[] = +const Foam::Enum +< + Foam::surfaceSlipDisplacementPointPatchVectorField::projectMode +> +Foam::surfaceSlipDisplacementPointPatchVectorField::projectModeNames_ { - "nearest", - "pointNormal", - "fixedNormal" + { projectMode::NEAREST, "nearest" }, + { projectMode::POINTNORMAL, "pointNormal" }, + { projectMode::FIXEDNORMAL, "fixedNormal" }, }; -const NamedEnum<surfaceSlipDisplacementPointPatchVectorField::projectMode, 3> - surfaceSlipDisplacementPointPatchVectorField::projectModeNames_; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void surfaceSlipDisplacementPointPatchVectorField::calcProjection +void Foam::surfaceSlipDisplacementPointPatchVectorField::calcProjection ( vectorField& displacement ) const @@ -299,7 +292,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -surfaceSlipDisplacementPointPatchVectorField:: +Foam::surfaceSlipDisplacementPointPatchVectorField:: surfaceSlipDisplacementPointPatchVectorField ( const pointPatch& p, @@ -313,7 +306,7 @@ surfaceSlipDisplacementPointPatchVectorField {} -surfaceSlipDisplacementPointPatchVectorField:: +Foam::surfaceSlipDisplacementPointPatchVectorField:: surfaceSlipDisplacementPointPatchVectorField ( const pointPatch& p, @@ -323,14 +316,14 @@ surfaceSlipDisplacementPointPatchVectorField : pointPatchVectorField(p, iF, dict), surfacesDict_(dict.subDict("geometry")), - projectMode_(projectModeNames_.read(dict.lookup("projectMode"))), + projectMode_(projectModeNames_.lookup("projectMode", dict)), projectDir_(dict.lookup("projectDirection")), wedgePlane_(dict.lookupOrDefault("wedgePlane", -1)), frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null)) {} -surfaceSlipDisplacementPointPatchVectorField:: +Foam::surfaceSlipDisplacementPointPatchVectorField:: surfaceSlipDisplacementPointPatchVectorField ( const surfaceSlipDisplacementPointPatchVectorField& ppf, @@ -348,7 +341,7 @@ surfaceSlipDisplacementPointPatchVectorField {} -surfaceSlipDisplacementPointPatchVectorField:: +Foam::surfaceSlipDisplacementPointPatchVectorField:: surfaceSlipDisplacementPointPatchVectorField ( const surfaceSlipDisplacementPointPatchVectorField& ppf @@ -363,7 +356,7 @@ surfaceSlipDisplacementPointPatchVectorField {} -surfaceSlipDisplacementPointPatchVectorField:: +Foam::surfaceSlipDisplacementPointPatchVectorField:: surfaceSlipDisplacementPointPatchVectorField ( const surfaceSlipDisplacementPointPatchVectorField& ppf, @@ -381,8 +374,8 @@ surfaceSlipDisplacementPointPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const searchableSurfaces& -surfaceSlipDisplacementPointPatchVectorField::surfaces() const +const Foam::searchableSurfaces& +Foam::surfaceSlipDisplacementPointPatchVectorField::surfaces() const { if (surfacesPtr_.empty()) { @@ -408,7 +401,7 @@ surfaceSlipDisplacementPointPatchVectorField::surfaces() const } -void surfaceSlipDisplacementPointPatchVectorField::evaluate +void Foam::surfaceSlipDisplacementPointPatchVectorField::evaluate ( const Pstream::commsTypes commsType ) @@ -428,36 +421,34 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate } -void surfaceSlipDisplacementPointPatchVectorField::write(Ostream& os) const +void Foam::surfaceSlipDisplacementPointPatchVectorField::write +( + Ostream& os +) const { pointPatchVectorField::write(os); - os.writeKeyword("geometry") << surfacesDict_ - << token::END_STATEMENT << nl; - os.writeKeyword("projectMode") << projectModeNames_[projectMode_] - << token::END_STATEMENT << nl; - os.writeKeyword("projectDirection") << projectDir_ - << token::END_STATEMENT << nl; - os.writeKeyword("wedgePlane") << wedgePlane_ - << token::END_STATEMENT << nl; + os.writeEntry("geometry", surfacesDict_); + os.writeEntry("projectMode", projectModeNames_[projectMode_]); + os.writeEntry("projectDirection", projectDir_); + os.writeEntry("wedgePlane", wedgePlane_); if (frozenPointsZone_ != word::null) { - os.writeKeyword("frozenPointsZone") << frozenPointsZone_ - << token::END_STATEMENT << nl; + os.writeEntry("frozenPointsZone", frozenPointsZone_); } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePointPatchTypeField ( pointPatchVectorField, surfaceSlipDisplacementPointPatchVectorField ); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H index 1e1cc4838e7f169687a1d7e16f640b22d352d4cb..d6de719e545fe3b11385c6d3f7f7b093e05d4ea2 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.H @@ -86,7 +86,7 @@ private: // Private data //- Project mode names - static const NamedEnum<projectMode, 3> projectModeNames_; + static const Enum<projectMode> projectModeNames_; //- Names of surfaces const dictionary surfacesDict_; diff --git a/src/fvOptions/cellSetOption/cellSetOption.C b/src/fvOptions/cellSetOption/cellSetOption.C index 929b457a7ee93995ba7c0f182c7fa243671d94bb..28d058622123457f106ebd1971ab36526ed89262 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.C +++ b/src/fvOptions/cellSetOption/cellSetOption.C @@ -34,24 +34,22 @@ namespace Foam { defineTypeNameAndDebug(cellSetOption, 0); } - - template<> const char* NamedEnum - < - fv::cellSetOption::selectionModeType, - 4 - >::names[] = - { - "points", - "cellSet", - "cellZone", - "all" - }; - - const NamedEnum<fv::cellSetOption::selectionModeType, 4> - fv::cellSetOption::selectionModeTypeNames_; } +const Foam::Enum +< + Foam::fv::cellSetOption::selectionModeType +> +Foam::fv::cellSetOption::selectionModeTypeNames_ +{ + { selectionModeType::smPoints, "points" }, + { selectionModeType::smCellSet, "cellSet" }, + { selectionModeType::smCellZone, "cellZone" }, + { selectionModeType::smAll, "all" }, +}; + + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void Foam::fv::cellSetOption::setSelection(const dictionary& dict) @@ -82,7 +80,7 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict) FatalErrorInFunction << "Unknown selectionMode " << selectionModeTypeNames_[selectionMode_] - << ". Valid selectionMode types are " + << ". Valid selectionMode types : " << selectionModeTypeNames_ << exit(FatalError); } @@ -210,7 +208,7 @@ Foam::fv::cellSetOption::cellSetOption duration_(0.0), selectionMode_ ( - selectionModeTypeNames_.read(coeffs_.lookup("selectionMode")) + selectionModeTypeNames_.lookup("selectionMode", coeffs_) ), cellSetName_("none"), V_(0.0) diff --git a/src/fvOptions/cellSetOption/cellSetOption.H b/src/fvOptions/cellSetOption/cellSetOption.H index 6dd94847c7bae739fb22bc7f37fee181a3d75805..312768a0f44b9629157370e7a3e8397e1a20057b 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.H +++ b/src/fvOptions/cellSetOption/cellSetOption.H @@ -84,9 +84,8 @@ public: smAll }; - //- Word list of selection mode type names - static const NamedEnum<selectionModeType, 4> - selectionModeTypeNames_; + //- List of selection mode type names + static const Enum<selectionModeType> selectionModeTypeNames_; protected: diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C index 2fdfeddd133e6e1328228b4375ad87b3d3dff441..32446b4fb29586bafdb23677cbe3917a8ba8529f 100644 --- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C +++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C @@ -43,18 +43,17 @@ namespace Foam dictionary ); } - - template<> - const char* NamedEnum<fv::fixedTemperatureConstraint::temperatureMode, 2>:: - names[] = - { - "uniform", - "lookup" - }; } -const Foam::NamedEnum<Foam::fv::fixedTemperatureConstraint::temperatureMode, 2> - Foam::fv::fixedTemperatureConstraint::temperatureModeNames_; +const Foam::Enum +< + Foam::fv::fixedTemperatureConstraint::temperatureMode +> +Foam::fv::fixedTemperatureConstraint::temperatureModeNames_ +{ + { temperatureMode::tmUniform, "uniform" }, + { temperatureMode::tmLookup, "lookup" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -68,7 +67,7 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint ) : cellSetOption(name, modelType, dict, mesh), - mode_(temperatureModeNames_.read(coeffs_.lookup("mode"))), + mode_(temperatureModeNames_.lookup("mode", coeffs_)), Tuniform_(nullptr), TName_("T") { @@ -89,7 +88,7 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint } default: { - // error handling done by NamedEnum + // Error handling already done by Enum } } @@ -139,7 +138,7 @@ void Foam::fv::fixedTemperatureConstraint::constrain } default: { - // error handling done by NamedEnum + // Error handling already done by Enum } } } diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H index a7c702944bef9f530d18523fd05d08ada446b0dc..00c83396eb2110588201b89e51f848ebeeeb6b05 100644 --- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H +++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H @@ -60,7 +60,7 @@ SourceFiles #define fixedTemperatureConstraint_H #include "cellSetOption.H" -#include "NamedEnum.H" +#include "Enum.H" #include "Function1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -90,7 +90,7 @@ public: //- String representation of temperatureMode enums - static const NamedEnum<temperatureMode, 2> temperatureModeNames_; + static const Enum<temperatureMode> temperatureModeNames_; protected: diff --git a/src/fvOptions/interRegionOption/interRegionOption.C b/src/fvOptions/interRegionOption/interRegionOption.C index 545601905589ac45075fc4ecbd3b0efa1880391f..e25aa741c941fb896e9e4d197d600485e56c197c 100644 --- a/src/fvOptions/interRegionOption/interRegionOption.C +++ b/src/fvOptions/interRegionOption/interRegionOption.C @@ -65,9 +65,10 @@ void Foam::fv::interRegionOption::setMapper() ( mesh_, nbrMesh, - meshToMesh::interpolationMethodNames_.read + meshToMesh::interpolationMethodNames_.lookup ( - coeffs_.lookup("interpolationMethod") + "interpolationMethod", + coeffs_ ), false // not interpolating patches ) diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C index 0bc5217e98d55757faf856e0e03e97ada298cfdc..c05736e3c6e07ae186f2393bf2b19fb5ee21975c 100644 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C @@ -57,28 +57,16 @@ namespace fv // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* Foam::NamedEnum - < - Foam::fv:: - directionalPressureGradientExplicitSource:: - pressureDropModel, - 3 - >::names[] = - { - "volumetricFlowRateTable", - "constant", - "DarcyForchheimer" - }; -} - -const Foam::NamedEnum +const Foam::Enum < - Foam::fv::directionalPressureGradientExplicitSource::pressureDropModel, - 3 -> Foam::fv::directionalPressureGradientExplicitSource::PressureDropModelNames_; + Foam::fv::directionalPressureGradientExplicitSource::pressureDropModel +> +Foam::fv::directionalPressureGradientExplicitSource::pressureDropModelNames_ +{ + { pressureDropModel::pVolumetricFlowRateTable, "volumetricFlowRateTable" }, + { pressureDropModel::pConstant, "constant" }, + { pressureDropModel::pDarcyForchheimer, "DarcyForchheimer" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -178,7 +166,7 @@ directionalPressureGradientExplicitSource ) : cellSetOption(sourceName, modelType, dict, mesh), - model_(PressureDropModelNames_.read(coeffs_.lookup("model"))), + model_(pressureDropModelNames_.lookup("model", coeffs_)), gradP0_(cells_.size(), Zero), dGradP_(cells_.size(), Zero), gradPporous_(cells_.size(), Zero), @@ -236,7 +224,7 @@ directionalPressureGradientExplicitSource << "Did not find mode " << model_ << nl << "Please set 'model' to one of " - << PressureDropModelNames_ + << pressureDropModelNames_ << exit(FatalError); } diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H index d53f1dc76cde0ba567b6d2a34d1b0427abfc338a..d4cfaf63a89f71f814ed0dd6c6db5300ebf2dc5c 100644 --- a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H @@ -126,9 +126,9 @@ private: // Private data - static const NamedEnum<pressureDropModel, 3> PressureDropModelNames_; + static const Enum<pressureDropModel> pressureDropModelNames_; - //- Pressure drop model + //- Pressure drop model pressureDropModel model_; //- Pressure gradient before correction diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C index bf8594073bb207229c3ebca119b0551584e99dff..c36123833a3010471984b4dd75492cc0b829f301 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C @@ -41,28 +41,30 @@ namespace Foam defineTypeNameAndDebug(rotorDiskSource, 0); addToRunTimeSelectionTable(option, rotorDiskSource, dictionary); } +} - template<> const char* NamedEnum<fv::rotorDiskSource::geometryModeType, 2>:: - names[] = - { - "auto", - "specified" - }; - const NamedEnum<fv::rotorDiskSource::geometryModeType, 2> - fv::rotorDiskSource::geometryModeTypeNames_; +const Foam::Enum +< + Foam::fv::rotorDiskSource::geometryModeType +> +Foam::fv::rotorDiskSource::geometryModeTypeNames_ +{ + { geometryModeType::gmAuto, "auto" }, + { geometryModeType::gmSpecified, "specified" }, +}; - template<> const char* NamedEnum<fv::rotorDiskSource::inletFlowType, 3>:: - names[] = - { - "fixed", - "surfaceNormal", - "local" - }; - const NamedEnum<fv::rotorDiskSource::inletFlowType, 3> - fv::rotorDiskSource::inletFlowTypeNames_; -} +const Foam::Enum +< + Foam::fv::rotorDiskSource::inletFlowType +> +Foam::fv::rotorDiskSource::inletFlowTypeNames_ +{ + { inletFlowType::ifFixed, "fixed" }, + { inletFlowType::ifSurfaceNormal, "surfaceNormal" }, + { inletFlowType::ifLocal, "local" }, +}; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -267,7 +269,7 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() vector refDir(Zero); geometryModeType gm = - geometryModeTypeNames_.read(coeffs_.lookup("geometryMode")); + geometryModeTypeNames_.lookup("geometryMode", coeffs_); switch (gm) { @@ -596,7 +598,7 @@ bool Foam::fv::rotorDiskSource::read(const dictionary& dict) coeffs_.lookup("nBlades") >> nBlades_; - inletFlow_ = inletFlowTypeNames_.read(coeffs_.lookup("inletFlowType")); + inletFlow_ = inletFlowTypeNames_.lookup("inletFlowType", coeffs_); coeffs_.lookup("tipEffect") >> tipEffect_; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H index 2ff034676ad9902e773351ebc92590daaf181f37..ea8b3be22a957c7e31df1426a2422a1e09f593fe 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -103,7 +103,7 @@ SourceFiles #include "cellSetOption.H" #include "cylindricalCS.H" #include "cylindrical.H" -#include "NamedEnum.H" +#include "Enum.H" #include "bladeModel.H" #include "profileModelList.H" #include "volFieldsFwd.H" @@ -134,7 +134,7 @@ public: gmAuto, gmSpecified }; - static const NamedEnum<geometryModeType, 2> geometryModeTypeNames_; + static const Enum<geometryModeType> geometryModeTypeNames_; enum inletFlowType { @@ -142,7 +142,7 @@ public: ifSurfaceNormal, ifLocal }; - static const NamedEnum<inletFlowType, 3> inletFlowTypeNames_; + static const Enum<inletFlowType> inletFlowTypeNames_; protected: diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C index 7867633b8dfdf4407efee3bfa442f88a674d601a..057614e094822c5141ef3dffc9895255eabcc223 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.C @@ -36,17 +36,6 @@ License namespace Foam { - template<> - const char* NamedEnum - < - fv::solidificationMeltingSource::thermoMode, - 2 - >::names[] = - { - "thermo", - "lookup" - }; - namespace fv { defineTypeNameAndDebug(solidificationMeltingSource, 0); @@ -60,8 +49,15 @@ namespace Foam } } -const Foam::NamedEnum<Foam::fv::solidificationMeltingSource::thermoMode, 2> - Foam::fv::solidificationMeltingSource::thermoModeTypeNames_; +const Foam::Enum +< + Foam::fv::solidificationMeltingSource::thermoMode +> +Foam::fv::solidificationMeltingSource::thermoModeTypeNames_ +{ + { thermoMode::mdThermo, "thermo" }, + { thermoMode::mdLookup, "lookup" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -191,7 +187,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource Tmelt_(readScalar(coeffs_.lookup("Tmelt"))), L_(readScalar(coeffs_.lookup("L"))), relax_(coeffs_.lookupOrDefault("relax", 0.9)), - mode_(thermoModeTypeNames_.read(coeffs_.lookup("thermoMode"))), + mode_(thermoModeTypeNames_.lookup("thermoMode", coeffs_)), rhoRef_(readScalar(coeffs_.lookup("rhoRef"))), TName_(coeffs_.lookupOrDefault<word>("T", "T")), CpName_(coeffs_.lookupOrDefault<word>("Cp", "Cp")), diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H index d1ea36c07cfa6bdf78cdc5b3bd756a42b9554c31..7c3b576a30a3e2fc55398ff62f8ad07f91bb9aac 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H @@ -97,7 +97,7 @@ SourceFiles #include "fvMesh.H" #include "volFields.H" #include "cellSetOption.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -122,7 +122,7 @@ public: mdLookup }; - static const NamedEnum<thermoMode, 2> thermoModeTypeNames_; + static const Enum<thermoMode> thermoModeTypeNames_; private: diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C index d1e924d36f69e79807c6ba5fe4cac62e7fc62595..baaec145680a62c2c9a58f4a99b20ad860e2264e 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSourceIO.C @@ -36,7 +36,7 @@ bool Foam::fv::solidificationMeltingSource::read(const dictionary& dict) coeffs_.readIfPresent("relax", relax_); - mode_ = thermoModeTypeNames_.read(coeffs_.lookup("thermoMode")); + mode_ = thermoModeTypeNames_.lookup("thermoMode", coeffs_); coeffs_.lookup("rhoRef") >> rhoRef_; coeffs_.readIfPresent("T", TName_); diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C index af0894d4f496ffa035a30e3b8dd3e120506aae7a..fe7fa6a32a72d1023b722311ab4ae2fb36a0d5a5 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.C @@ -41,21 +41,17 @@ namespace Foam dictionary ); } - - template<> - const char* Foam::NamedEnum - < - Foam::fv::tabulatedNTUHeatTransfer::geometryModeType, - 2 - >::names[] = - { - "calculated", - "user" - }; } -const Foam::NamedEnum<Foam::fv::tabulatedNTUHeatTransfer::geometryModeType, 2> -Foam::fv::tabulatedNTUHeatTransfer::geometryModelNames_; +const Foam::Enum +< + Foam::fv::tabulatedNTUHeatTransfer::geometryModeType +> +Foam::fv::tabulatedNTUHeatTransfer::geometryModelNames_ +{ + { geometryModeType::gmCalculated, "calculated" }, + { geometryModeType::gmUser, "user" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -93,8 +89,7 @@ void Foam::fv::tabulatedNTUHeatTransfer::initialiseGeometry() { if (Ain_ < 0) { - geometryMode_ = - geometryModelNames_.read(coeffs_.lookup("geometryMode")); + geometryMode_ = geometryModelNames_.lookup("geometryMode", coeffs_); Info<< "Region " << mesh_.name() << " " << type() << " " << name_ << " " << geometryModelNames_[geometryMode_] << " geometry:" << nl; diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H index 0f087fd3287014a1d5405ea46663741aa54b9caf..a0fd5591934f9841d8e14624bbf9b7dde93211e9 100644 --- a/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransfer/tabulatedNTUHeatTransfer/tabulatedNTUHeatTransfer.H @@ -107,7 +107,7 @@ SeeAlso #include "interRegionHeatTransferModel.H" #include "autoPtr.H" #include "interpolation2DTable.H" -#include "NamedEnum.H" +#include "Enum.H" #include "basicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -135,7 +135,7 @@ public: gmUser }; - static const NamedEnum<geometryModeType, 2> geometryModelNames_; + static const Enum<geometryModeType> geometryModelNames_; private: diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C index 3041ab5c541b0a4fadc41b3dd936b7b436e9e801..27f74158e21886720aea7fbac9d4b3ed33776862 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C @@ -27,24 +27,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::phaseProperties::phaseType +> +Foam::phaseProperties::phaseTypeNames { - template<> - const char* Foam::NamedEnum - < - Foam::phaseProperties::phaseType, - 4 - >::names[] = - { - "gas", - "liquid", - "solid", - "unknown" - }; -} - -const Foam::NamedEnum<Foam::phaseProperties::phaseType, 4> - Foam::phaseProperties::phaseTypeNames; + { phaseType::GAS, "gas" }, + { phaseType::LIQUID, "liquid" }, + { phaseType::SOLID, "solid" }, + { phaseType::UNKNOWN, "unknown" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H index 2d775a741540b5ce8af13b9139617c2b3f565023..87b6882d6c06d17b881786ce82d5eaef5139fb01 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H @@ -36,7 +36,7 @@ SourceFiles #ifndef phaseProperties_H #define phaseProperties_H -#include "NamedEnum.H" +#include "Enum.H" #include "Tuple2.H" #include "PtrList.H" #include "volFields.H" @@ -74,7 +74,7 @@ public: }; //- Corresponding word representations for phase type enumerations - static const NamedEnum<phaseType, 4> phaseTypeNames; + static const Enum<phaseType> phaseTypeNames; private: diff --git a/src/lumpedPointMotion/lumpedPointMovement.C b/src/lumpedPointMotion/lumpedPointMovement.C index b12a3ef9419f846195751a3d0503f99faecb83e4..1f61bc1c36349b924ff3a7ae8cc74bc41fad25e6 100644 --- a/src/lumpedPointMotion/lumpedPointMovement.C +++ b/src/lumpedPointMotion/lumpedPointMovement.C @@ -38,12 +38,15 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::Enum<Foam::lumpedPointMovement::outputFormatType> - Foam::lumpedPointMovement::formatNames - { - { outputFormatType::PLAIN, "plain" }, - { outputFormatType::DICTIONARY, "dictionary" } - }; +const Foam::Enum +< + Foam::lumpedPointMovement::outputFormatType +> +Foam::lumpedPointMovement::formatNames +{ + { outputFormatType::PLAIN, "plain" }, + { outputFormatType::DICTIONARY, "dictionary" } +}; const Foam::word diff --git a/src/lumpedPointMotion/lumpedPointState.C b/src/lumpedPointMotion/lumpedPointState.C index 511c756697458f335aaf5e722e536a10423b0419..22d2fe9648c86af0aa23519dd3a79849d29a0a2d 100644 --- a/src/lumpedPointMotion/lumpedPointState.C +++ b/src/lumpedPointMotion/lumpedPointState.C @@ -33,12 +33,15 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::Enum<Foam::lumpedPointState::inputFormatType> - Foam::lumpedPointState::formatNames - { - { inputFormatType::PLAIN, "plain" }, - { inputFormatType::DICTIONARY, "dictionary" } - }; +const Foam::Enum +< + Foam::lumpedPointState::inputFormatType +> +Foam::lumpedPointState::formatNames +{ + { inputFormatType::PLAIN, "plain" }, + { inputFormatType::DICTIONARY, "dictionary" } +}; // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index d09b9a95dfa6a37886bb3df20547dc8f649aeda8..92eedd79ab043597b4683f1d69c8c4c56938652c 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,55 +63,45 @@ License namespace Foam { defineTypeNameAndDebug(meshRefinement, 0); - - template<> - const char* Foam::NamedEnum - < - Foam::meshRefinement::IOdebugType, - 5 - >::names[] = - { - "mesh", - "intersections", - "featureSeeds", - "attraction", - "layerInfo" - }; - - template<> - const char* Foam::NamedEnum - < - Foam::meshRefinement::IOoutputType, - 1 - >::names[] = - { - "layerInfo" - }; - - template<> - const char* Foam::NamedEnum - < - Foam::meshRefinement::IOwriteType, - 5 - >::names[] = - { - "mesh", - "noRefinement", - "scalarLevels", - "layerSets", - "layerFields" - }; - } -const Foam::NamedEnum<Foam::meshRefinement::IOdebugType, 5> -Foam::meshRefinement::IOdebugTypeNames; -const Foam::NamedEnum<Foam::meshRefinement::IOoutputType, 1> -Foam::meshRefinement::IOoutputTypeNames; +const Foam::Enum +< + Foam::meshRefinement::debugType +> +Foam::meshRefinement::debugTypeNames +{ + { debugType::MESH, "mesh" }, + { debugType::OBJINTERSECTIONS, "intersections" }, + { debugType::FEATURESEEDS, "featureSeeds" }, + { debugType::ATTRACTION, "attraction" }, + { debugType::LAYERINFO, "layerInfo" }, +}; + + +const Foam::Enum +< + Foam::meshRefinement::outputType +> +Foam::meshRefinement::outputTypeNames +{ + { outputType::OUTPUTLAYERINFO, "layerInfo" } +}; + -const Foam::NamedEnum<Foam::meshRefinement::IOwriteType, 5> -Foam::meshRefinement::IOwriteTypeNames; +const Foam::Enum +< + Foam::meshRefinement::writeType +> +Foam::meshRefinement::writeTypeNames +{ + { writeType::WRITEMESH, "mesh" }, + { writeType::NOWRITEREFINEMENT, "noRefinement" }, + { writeType::WRITELEVELS, "scalarLevels" }, + { writeType::WRITELAYERSETS, "layerSets" }, + { writeType::WRITELAYERFIELDS, "layerFields" }, +}; Foam::meshRefinement::writeType Foam::meshRefinement::writeLevel_; diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H index 3500a3aef13090a724d6d8a2d57607249757e7e7..f0a9af23d1f31d5348ffd085c2105d00b7807ce6 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -82,64 +82,43 @@ class snapParameters; class meshRefinement { - public: // Public data types - //- Enumeration for what to debug - enum IOdebugType - { - IOMESH, - IOOBJINTERSECTIONS, - IOFEATURESEEDS, - IOATTRACTION, - IOLAYERINFO - }; - - static const NamedEnum<IOdebugType, 5> IOdebugTypeNames; + //- Enumeration for what to debug. Used as a bit-pattern. enum debugType { - MESH = 1<<IOMESH, - OBJINTERSECTIONS = 1<<IOOBJINTERSECTIONS, - FEATURESEEDS = 1<<IOFEATURESEEDS, - ATTRACTION = 1<< IOATTRACTION, - LAYERINFO = 1<<IOLAYERINFO + MESH = (1 << 0), + OBJINTERSECTIONS = (1 << 1), + FEATURESEEDS = (1 << 2), + ATTRACTION = (1 << 3), + LAYERINFO = (1 << 4) }; - //- Enumeration for what to output - enum IOoutputType - { - IOOUTPUTLAYERINFO - }; + static const Enum<debugType> debugTypeNames; - static const NamedEnum<IOoutputType, 1> IOoutputTypeNames; + //- Enumeration for what to output. Used as a bit-pattern. enum outputType { - OUTPUTLAYERINFO = 1<<IOOUTPUTLAYERINFO + OUTPUTLAYERINFO = (1 << 0) }; - //- Enumeration for what to write - enum IOwriteType - { - IOWRITEMESH, - IONOWRITEREFINEMENT, - IOWRITELEVELS, - IOWRITELAYERSETS, - IOWRITELAYERFIELDS - }; + static const Enum<outputType> outputTypeNames; - static const NamedEnum<IOwriteType, 5> IOwriteTypeNames; + //- Enumeration for what to write. Used as a bit-pattern. enum writeType { - WRITEMESH = 1<<IOWRITEMESH, - NOWRITEREFINEMENT = 1<<IONOWRITEREFINEMENT, - WRITELEVELS = 1<<IOWRITELEVELS, - WRITELAYERSETS = 1<<IOWRITELAYERSETS, - WRITELAYERFIELDS = 1<<IOWRITELAYERFIELDS + WRITEMESH = (1 << 0), + NOWRITEREFINEMENT = (1 << 1), + WRITELEVELS = (1 << 2), + WRITELAYERSETS = (1 << 3), + WRITELAYERFIELDS = (1 << 4) }; - //- Enumeration for how the userdata is to be mapped upon refinement. + static const Enum<writeType> writeTypeNames; + + //- Enumeration for how userdata is to be mapped upon refinement. enum mapType { MASTERONLY = 1, //!< maintain master only @@ -1476,10 +1455,13 @@ public: static void outputLevel(const outputType); - //- Helper: convert wordList into bit pattern using provided - // NamedEnum - template<class Enum> - static int readFlags(const Enum& namedEnum, const wordList&); + //- Helper: convert wordList into bit pattern using provided Enum + template<class EnumContainer> + static int readFlags + ( + const EnumContainer& namedEnum, + const wordList& words + ); }; diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C index 64a59adea491c5f9d6e8224ef256c296edcbe457..ceaf09f50c4aa8ca18ca67d8fdce7159645525eb 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C @@ -252,21 +252,20 @@ void Foam::meshRefinement::reorderPatchFields } -template<class Enum> +template<class EnumContainer> int Foam::meshRefinement::readFlags ( - const Enum& namedEnum, + const EnumContainer& namedEnum, const wordList& words ) { int flags = 0; - forAll(words, i) + for (const word& w : words) { - int index = namedEnum[words[i]]; - int val = 1<<index; - flags |= val; + flags |= namedEnum[w]; } + return flags; } diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C index 2e1fb9541125dcf14cd5302de1195b183dd6c856..d65d7e0eac8a01d194aa8f7d1404e3606df7342a 100644 --- a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C +++ b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C @@ -31,41 +31,29 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::surfaceZonesInfo::areaSelectionAlgo +> +Foam::surfaceZonesInfo::areaSelectionAlgoNames { - template<> - const char* Foam::NamedEnum - < - Foam::surfaceZonesInfo::areaSelectionAlgo, - 4 - >::names[] = - { - "inside", - "outside", - "insidePoint", - "none" - }; -} -const Foam::NamedEnum<Foam::surfaceZonesInfo::areaSelectionAlgo, 4> - Foam::surfaceZonesInfo::areaSelectionAlgoNames; - - -namespace Foam + { areaSelectionAlgo::INSIDE, "inside" }, + { areaSelectionAlgo::OUTSIDE, "outside" }, + { areaSelectionAlgo::INSIDEPOINT, "insidePoint" }, + { areaSelectionAlgo::NONE, "none" }, +}; + + +const Foam::Enum +< + Foam::surfaceZonesInfo::faceZoneType +> +Foam::surfaceZonesInfo::faceZoneTypeNames { - template<> - const char* Foam::NamedEnum - < - Foam::surfaceZonesInfo::faceZoneType, - 3 - >::names[] = - { - "internal", - "baffle", - "boundary" - }; -} -const Foam::NamedEnum<Foam::surfaceZonesInfo::faceZoneType, 3> - Foam::surfaceZonesInfo::faceZoneTypeNames; + { faceZoneType::INTERNAL, "internal" }, + { faceZoneType::BAFFLE, "baffle" }, + { faceZoneType::BOUNDARY, "boundary" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.H b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.H index a6af0f24113f74154cbf7b0dd73f9833a77c9e61..c99c7251ed8dd9d393edf4adfa1ef0a72add8faf 100644 --- a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.H +++ b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.H @@ -34,7 +34,7 @@ SourceFiles #ifndef surfaceZonesInfo_H #define surfaceZonesInfo_H -#include "NamedEnum.H" +#include "Enum.H" #include "point.H" #include "word.H" #include "PtrList.H" @@ -68,7 +68,7 @@ public: NONE }; - static const NamedEnum<areaSelectionAlgo, 4> areaSelectionAlgoNames; + static const Enum<areaSelectionAlgo> areaSelectionAlgoNames; //- What to do with faceZone faces enum faceZoneType @@ -78,7 +78,7 @@ public: BOUNDARY }; - static const NamedEnum<faceZoneType, 3> faceZoneTypeNames; + static const Enum<faceZoneType> faceZoneTypeNames; private: diff --git a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C index 768618bf5e0aa399c0d192d08331f48b3db3c45e..1e2999a155cd85702162beffc1ee339cd8848341 100644 --- a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C @@ -35,25 +35,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - -template<> -const char* -NamedEnum<shellSurfaces::refineMode, 3>:: -names[] = +const Foam::Enum +< + Foam::shellSurfaces::refineMode +> +Foam::shellSurfaces::refineModeNames_ { - "inside", - "outside", - "distance" + { refineMode::INSIDE, "inside" }, + { refineMode::OUTSIDE, "outside" }, + { refineMode::DISTANCE, "distance" }, }; -const NamedEnum<shellSurfaces::refineMode, 3> shellSurfaces::refineModeNames_; - -} // End namespace Foam - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -617,7 +609,7 @@ Foam::shellSurfaces::shellSurfaces unmatchedKeys.erase(ePtr->keyword()); shells_[shellI] = geomI; - modes_[shellI] = refineModeNames_.read(dict.lookup("mode")); + modes_[shellI] = refineModeNames_.lookup("mode", dict); // Read pairs of distance+level setAndCheckLevels(shellI, dict.lookup("levels")); diff --git a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.H b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.H index 2b3c5b3df6aef1d6e3b9e685e044002ca785a07b..93ff45b52e6909183f780280bf8410c0862c8993 100644 --- a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.H +++ b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.H @@ -37,6 +37,7 @@ SourceFiles #define shellSurfaces_H #include "searchableSurface.H" +#include "Enum.H" #include "Tuple2.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -97,7 +98,7 @@ private: // Private data //- refineMode names - static const NamedEnum<refineMode, 3> refineModeNames_; + static const Enum<refineMode> refineModeNames_; // Private Member Functions diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C index 617a85a0a080e166acd08e4258297a153368f523..4d215af6de3a37fa4ca1054a0d9a2416040ba1b1 100644 --- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C +++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C @@ -27,21 +27,19 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::faceAreaIntersect::triangulationMode +> +Foam::faceAreaIntersect::triangulationModeNames_ { - template<> - const char* NamedEnum<faceAreaIntersect::triangulationMode, 2>::names[] = - { - "fan", - "mesh" - }; -} - -const Foam::NamedEnum<Foam::faceAreaIntersect::triangulationMode, 2> - Foam::faceAreaIntersect::triangulationModeNames_; + { triangulationMode::tmFan, "fan" }, + { triangulationMode::tmMesh, "mesh" }, +}; Foam::scalar Foam::faceAreaIntersect::tol = 1e-6; + // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // void Foam::faceAreaIntersect::triSliceWithPlane diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H index 8b44fd5c8284328adc4a9e133a4875e8f6dbd3b2..450d343d644fb32733831a747746668e2c5f6e4b 100644 --- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H +++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H @@ -42,7 +42,7 @@ SourceFiles #include "plane.H" #include "face.H" #include "triPoints.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,7 +63,7 @@ public: tmMesh }; - static const NamedEnum<triangulationMode, 2> triangulationModeNames_; + static const Enum<triangulationMode> triangulationModeNames_; private: diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C index 24c13c35594c8f6a4e813954dd9ebde87b7be292..8758a9662ae6928346167f011a4e8e66f5d7c1b1 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C @@ -40,57 +40,50 @@ License namespace Foam { defineTypeNameAndDebug(extendedEdgeMesh, 0); - - template<> - const char* Foam::NamedEnum - < - Foam::extendedEdgeMesh::pointStatus, - 4 - >::names[] = - { - "convex", - "concave", - "mixed", - "nonFeature" - }; - - template<> - const char* Foam::NamedEnum - < - Foam::extendedEdgeMesh::edgeStatus, - 6 - >::names[] = - { - "external", - "internal", - "flat", - "open", - "multiple", - "none" - }; - - template<> - const char* Foam::NamedEnum - < - Foam::extendedEdgeMesh::sideVolumeType, - 4 - >::names[] = - { - "inside", - "outside", - "both", - "neither" - }; } -const Foam::NamedEnum<Foam::extendedEdgeMesh::pointStatus, 4> - Foam::extendedEdgeMesh::pointStatusNames_; -const Foam::NamedEnum<Foam::extendedEdgeMesh::edgeStatus, 6> - Foam::extendedEdgeMesh::edgeStatusNames_; +const Foam::Enum +< + Foam::extendedEdgeMesh::pointStatus +> +Foam::extendedEdgeMesh::pointStatusNames_ +{ + { pointStatus::CONVEX, "convex" }, + { pointStatus::CONCAVE, "concave" }, + { pointStatus::MIXED, "mixed" }, + { pointStatus::NONFEATURE, "nonFeature" }, +}; + + +const Foam::Enum +< + Foam::extendedEdgeMesh::edgeStatus +> +Foam::extendedEdgeMesh::edgeStatusNames_ +{ + { edgeStatus::EXTERNAL, "external" }, + { edgeStatus::INTERNAL, "internal" }, + { edgeStatus::FLAT, "flat" }, + { edgeStatus::OPEN, "open" }, + { edgeStatus::MULTIPLE, "multiple" }, + { edgeStatus::NONE, "none" }, + +}; + + +const Foam::Enum +< + Foam::extendedEdgeMesh::sideVolumeType +> +Foam::extendedEdgeMesh::sideVolumeTypeNames_ +{ + { sideVolumeType::INSIDE, "inside" }, + { sideVolumeType::OUTSIDE, "outside" }, + { sideVolumeType::BOTH, "both" }, + { sideVolumeType::NEITHER, "neither" }, +}; -const Foam::NamedEnum<Foam::extendedEdgeMesh::sideVolumeType, 4> - Foam::extendedEdgeMesh::sideVolumeTypeNames_; Foam::scalar Foam::extendedEdgeMesh::cosNormalAngleTol_ = Foam::cos(degToRad(0.1)); diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H index 71a4b8177956ce89717000e58253504985d8fb97..649d7d6b134ee9aa68879a83c5e54ea70ab0078f 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H @@ -100,7 +100,7 @@ public: NONFEATURE //!< Not a feature point }; - static const Foam::NamedEnum<pointStatus, 4> pointStatusNames_; + static const Enum<pointStatus> pointStatusNames_; enum edgeStatus { @@ -112,7 +112,7 @@ public: NONE //!< Unclassified (consistency with surfaceFeatures) }; - static const Foam::NamedEnum<edgeStatus, 6> edgeStatusNames_; + static const Enum<edgeStatus> edgeStatusNames_; //- Normals point to the outside enum sideVolumeType @@ -123,7 +123,7 @@ public: NEITHER = 3 //!< not sure when this may be used }; - static const Foam::NamedEnum<sideVolumeType, 4> sideVolumeTypeNames_; + static const Enum<sideVolumeType> sideVolumeTypeNames_; //- Angular closeness tolerance for treating normals as the same static scalar cosNormalAngleTol_; diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index ac6be7983dea5bccb7d1745be44b25d05fa0af97..6f114e545b3fc11c9be299bb8b50a64727df7fdf 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -48,41 +48,34 @@ License namespace Foam { defineTypeNameAndDebug(mappedPatchBase, 0); - - template<> - const char* Foam::NamedEnum - < - Foam::mappedPatchBase::sampleMode, - 6 - >::names[] = - { - "nearestCell", - "nearestPatchFace", - "nearestPatchFaceAMI", - "nearestPatchPoint", - "nearestFace", - "nearestOnlyCell" - }; - - template<> - const char* Foam::NamedEnum - < - Foam::mappedPatchBase::offsetMode, - 3 - >::names[] = - { - "uniform", - "nonuniform", - "normal" - }; } -const Foam::NamedEnum<Foam::mappedPatchBase::sampleMode, 6> - Foam::mappedPatchBase::sampleModeNames_; - -const Foam::NamedEnum<Foam::mappedPatchBase::offsetMode, 3> - Foam::mappedPatchBase::offsetModeNames_; +const Foam::Enum +< + Foam::mappedPatchBase::sampleMode +> +Foam::mappedPatchBase::sampleModeNames_ +{ + { sampleMode::NEARESTCELL, "nearestCell" }, + { sampleMode::NEARESTPATCHFACE, "nearestPatchFace" }, + { sampleMode::NEARESTPATCHFACEAMI, "nearestPatchFaceAMI" }, + { sampleMode::NEARESTPATCHPOINT, "nearestPatchPoint" }, + { sampleMode::NEARESTFACE, "nearestFace" }, + { sampleMode::NEARESTONLYCELL, "nearestOnlyCell" }, +}; + + +const Foam::Enum +< + Foam::mappedPatchBase::offsetMode +> +Foam::mappedPatchBase::offsetModeNames_ +{ + { offsetMode::UNIFORM, "uniform" }, + { offsetMode::NONUNIFORM, "nonuniform" }, + { offsetMode::NORMAL, "normal" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -1042,7 +1035,7 @@ Foam::mappedPatchBase::mappedPatchBase : patch_(pp), sampleRegion_(dict.lookupOrDefault<word>("sampleRegion", "")), - mode_(sampleModeNames_.read(dict.lookup("sampleMode"))), + mode_(sampleModeNames_.lookup("sampleMode", dict)), samplePatch_(dict.lookupOrDefault<word>("samplePatch", "")), coupleGroup_(dict), offsetMode_(UNIFORM), @@ -1068,7 +1061,7 @@ Foam::mappedPatchBase::mappedPatchBase if (dict.found("offsetMode")) { - offsetMode_ = offsetModeNames_.read(dict.lookup("offsetMode")); + offsetMode_ = offsetModeNames_.lookup("offsetMode", dict); switch (offsetMode_) { @@ -1387,17 +1380,14 @@ Foam::pointIndexHit Foam::mappedPatchBase::facePoint void Foam::mappedPatchBase::write(Ostream& os) const { - os.writeKeyword("sampleMode") << sampleModeNames_[mode_] - << token::END_STATEMENT << nl; + os.writeEntry("sampleMode", sampleModeNames_[mode_]); if (!sampleRegion_.empty()) { - os.writeKeyword("sampleRegion") << sampleRegion_ - << token::END_STATEMENT << nl; + os.writeEntry("sampleRegion", sampleRegion_); } if (!samplePatch_.empty()) { - os.writeKeyword("samplePatch") << samplePatch_ - << token::END_STATEMENT << nl; + os.writeEntry("samplePatch", samplePatch_); } coupleGroup_.write(os); @@ -1412,15 +1402,13 @@ void Foam::mappedPatchBase::write(Ostream& os) const } else { - os.writeKeyword("offsetMode") << offsetModeNames_[offsetMode_] - << token::END_STATEMENT << nl; + os.writeEntry("offsetMode", offsetModeNames_[offsetMode_]); switch (offsetMode_) { case UNIFORM: { - os.writeKeyword("offset") << offset_ << token::END_STATEMENT - << nl; + os.writeEntry("offset", offset_); break; } case NONUNIFORM: @@ -1430,8 +1418,7 @@ void Foam::mappedPatchBase::write(Ostream& os) const } case NORMAL: { - os.writeKeyword("distance") << distance_ << token::END_STATEMENT - << nl; + os.writeEntry("distance", distance_); break; } } @@ -1440,8 +1427,7 @@ void Foam::mappedPatchBase::write(Ostream& os) const { if (AMIReverse_) { - os.writeKeyword("flipNormals") << AMIReverse_ - << token::END_STATEMENT << nl; + os.writeEntry("flipNormals", AMIReverse_); } if (!surfDict_.empty()) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H index 1fe40bfc354b4868dd831dfe8de32010b05f3687..3539832918a34d22bdee54ae6fce649abbe8bec6 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H @@ -111,25 +111,25 @@ public: //- Mesh items to sample enum sampleMode { - NEARESTCELL, // nearest cell containing sample - NEARESTPATCHFACE, // nearest face on selected patch - NEARESTPATCHFACEAMI, // nearest patch face + AMI interpolation - NEARESTPATCHPOINT, // nearest point on selected patch - NEARESTFACE, // nearest face - NEARESTONLYCELL // nearest cell (even if not containing cell) + NEARESTCELL, //!< nearest cell containing sample + NEARESTPATCHFACE, //!< nearest face on selected patch + NEARESTPATCHFACEAMI, //!< nearest patch face + AMI interpolation + NEARESTPATCHPOINT, //!< nearest point on selected patch + NEARESTFACE, //!< nearest face + NEARESTONLYCELL //!< nearest cell (even if not containing cell) }; //- How to project face centres enum offsetMode { - UNIFORM, // single offset vector - NONUNIFORM, // per-face offset vector - NORMAL // use face normal + distance + UNIFORM, //!< single offset vector + NONUNIFORM, //!< per-face offset vector + NORMAL //!< use face normal + distance }; - static const NamedEnum<sampleMode, 6> sampleModeNames_; + static const Enum<sampleMode> sampleModeNames_; - static const NamedEnum<offsetMode, 3> offsetModeNames_; + static const Enum<offsetMode> offsetModeNames_; //- Helper class for finding nearest diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C index 4fdb93b1b827d069bc5bfb47f9555580351fa01e..5a9b3a3f630224affaa56501b5640827d5a2f6eb 100644 --- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C +++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C @@ -36,19 +36,6 @@ namespace Foam defineTypeNameAndDebug(faceToCell, 0); addToRunTimeSelectionTable(topoSetSource, faceToCell, word); addToRunTimeSelectionTable(topoSetSource, faceToCell, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::faceToCell::faceAction, - 4 - >::names[] = - { - "neighbour", - "owner", - "any", - "all" - }; } @@ -60,8 +47,17 @@ Foam::topoSetSource::addToUsageTable Foam::faceToCell::usage_ " of the faces in the faceSet or where all faces are in the faceSet\n\n" ); -const Foam::NamedEnum<Foam::faceToCell::faceAction, 4> - Foam::faceToCell::faceActionNames_; +const Foam::Enum +< + Foam::faceToCell::faceAction +> +Foam::faceToCell::faceActionNames_ +{ + { faceAction::NEIGHBOUR, "neighbour" }, + { faceAction::OWNER, "owner" }, + { faceAction::ANY, "any" }, + { faceAction::ALL, "all" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -175,7 +171,7 @@ Foam::faceToCell::faceToCell : topoSetSource(mesh), setName_(dict.lookup("set")), - option_(faceActionNames_.read(dict.lookup("option"))) + option_(faceActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.H b/src/meshTools/sets/cellSources/faceToCell/faceToCell.H index 95d856d88a9922667debe269adcee88cdf901d7b..59564ac2a1edf07944474e284f6dd02922e59264 100644 --- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.H +++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.H @@ -36,7 +36,7 @@ SourceFiles #define faceToCell_H #include "topoSetSource.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,7 +63,7 @@ public: private: - static const NamedEnum<faceAction, 4> faceActionNames_; + static const Enum<faceAction> faceActionNames_; //- Add usage string diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C index a9c9158af339e813dfd0ea409f45222d3c5f7924..7640e0519229eaef3e7554e144fc31d02733d8ce 100644 --- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C +++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C @@ -35,17 +35,6 @@ namespace Foam defineTypeNameAndDebug(faceZoneToCell, 0); addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word); addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::faceZoneToCell::faceAction, - 2 - >::names[] = - { - "master", - "slave" - }; } @@ -58,8 +47,15 @@ Foam::topoSetSource::addToUsageTable Foam::faceZoneToCell::usage_ ); -const Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2> - Foam::faceZoneToCell::faceActionNames_; +const Foam::Enum +< + Foam::faceZoneToCell::faceAction +> +Foam::faceZoneToCell::faceActionNames_ +{ + { faceAction::MASTER, "master" }, + { faceAction::SLAVE, "slave" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -132,7 +128,7 @@ Foam::faceZoneToCell::faceZoneToCell : topoSetSource(mesh), zoneName_(dict.lookup("name")), - option_(faceActionNames_.read(dict.lookup("option"))) + option_(faceActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H index 50172717a6380f990de223873ee9bbffe7cc6aac..5c8dcb61a5b909e787fa29fc98a1567c90327498 100644 --- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H +++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.H @@ -63,7 +63,7 @@ private: // Private data - static const NamedEnum<faceAction, 2> faceActionNames_; + static const Enum<faceAction> faceActionNames_; //- Add usage string static addToUsageTable usage_; diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C index 467e894f8cc990b635b30965164d4526091ee1ed..cfafa4d2e7191a614d3049532a9c97d3b21652bb 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C @@ -36,17 +36,6 @@ namespace Foam defineTypeNameAndDebug(pointToCell, 0); addToRunTimeSelectionTable(topoSetSource, pointToCell, word); addToRunTimeSelectionTable(topoSetSource, pointToCell, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::pointToCell::pointAction, - 2 - >::names[] = - { - "any", - "edge" - }; } @@ -58,8 +47,15 @@ Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_ " in the pointSet\n\n" ); -const Foam::NamedEnum<Foam::pointToCell::pointAction, 2> - Foam::pointToCell::pointActionNames_; +const Foam::Enum +< + Foam::pointToCell::pointAction +> +Foam::pointToCell::pointActionNames_ +{ + { pointAction::ANY, "any" }, + { pointAction::EDGE, "edge" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -132,7 +128,7 @@ Foam::pointToCell::pointToCell : topoSetSource(mesh), setName_(dict.lookup("set")), - option_(pointActionNames_.read(dict.lookup("option"))) + option_(pointActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H b/src/meshTools/sets/cellSources/pointToCell/pointToCell.H index 96f02f18bf64c475f8526e82403c45e3b6627ba7..4be629c5d7bd90543a134f2f21a77950c109b38b 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.H +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.H @@ -36,7 +36,7 @@ SourceFiles #define pointToCell_H #include "topoSetSource.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,7 +65,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<pointAction, 2> pointActionNames_; + static const Enum<pointAction> pointActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C index 64e04fe756375feaa16fb3b774a7e8b7730f00ed..cd5e68520f5fd3fb73f5e3292f1e29f9df5cf689 100644 --- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C +++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C @@ -37,17 +37,6 @@ namespace Foam defineTypeNameAndDebug(cellToFace, 0); addToRunTimeSelectionTable(topoSetSource, cellToFace, word); addToRunTimeSelectionTable(topoSetSource, cellToFace, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::cellToFace::cellAction, - 2 - >::names[] = - { - "all", - "both" - }; } @@ -59,8 +48,15 @@ Foam::topoSetSource::addToUsageTable Foam::cellToFace::usage_ " -both: faces where both neighbours are in the cellSet\n\n" ); -const Foam::NamedEnum<Foam::cellToFace::cellAction, 2> - Foam::cellToFace::cellActionNames_; +const Foam::Enum +< + Foam::cellToFace::cellAction +> +Foam::cellToFace::cellActionNames_ +{ + { cellAction::ALL, "all" }, + { cellAction::BOTH, "both" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -177,7 +173,7 @@ Foam::cellToFace::cellToFace : topoSetSource(mesh), setName_(dict.lookup("set")), - option_(cellActionNames_.read(dict.lookup("option"))) + option_(cellActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.H b/src/meshTools/sets/faceSources/cellToFace/cellToFace.H index d49917a63c75e4e49c59edf6ee1c0f2642d31eeb..f0fcca37bf6530dbe060b163ee041c5d7da93998 100644 --- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.H +++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.H @@ -40,7 +40,7 @@ SourceFiles #define cellToFace_H #include "topoSetSource.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,7 +69,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<cellAction, 2> cellActionNames_; + static const Enum<cellAction> cellActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/faceSources/normalToFace/normalToFace.H b/src/meshTools/sets/faceSources/normalToFace/normalToFace.H index ff2f99c253bd2bce0c6a20058fe96564a12452b0..9891680204523287aa28450eb349845c424989c9 100644 --- a/src/meshTools/sets/faceSources/normalToFace/normalToFace.H +++ b/src/meshTools/sets/faceSources/normalToFace/normalToFace.H @@ -36,7 +36,6 @@ SourceFiles #define normalToFace_H #include "topoSetSource.H" -#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C index e85becdabb43d904443cf6f8e0079e75631fd046..31e5322a39e28c21d5df2b69e7c2b41aacd8f2de 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C @@ -36,18 +36,6 @@ namespace Foam defineTypeNameAndDebug(pointToFace, 0); addToRunTimeSelectionTable(topoSetSource, pointToFace, word); addToRunTimeSelectionTable(topoSetSource, pointToFace, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::pointToFace::pointAction, - 3 - >::names[] = - { - "any", - "all", - "edge" - }; } @@ -61,8 +49,16 @@ Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_ " -two consecutive points (an edge) in the pointSet\n\n" ); -const Foam::NamedEnum<Foam::pointToFace::pointAction, 3> - Foam::pointToFace::pointActionNames_; +const Foam::Enum +< + Foam::pointToFace::pointAction +> +Foam::pointToFace::pointActionNames_ +{ + { pointAction::ANY, "any" }, + { pointAction::ALL, "all" }, + { pointAction::EDGE, "edge" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -173,7 +169,7 @@ Foam::pointToFace::pointToFace : topoSetSource(mesh), setName_(dict.lookup("set")), - option_(pointActionNames_.read(dict.lookup("option"))) + option_(pointActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H b/src/meshTools/sets/faceSources/pointToFace/pointToFace.H index e31bc65086f02e96086085e25bfbe57c778d48ca..03e09a25ddbbf1c43e1d43509d17db4288313590 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.H +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.H @@ -36,7 +36,7 @@ SourceFiles #define pointToFace_H #include "topoSetSource.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,7 +68,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<pointAction, 3> pointActionNames_; + static const Enum<pointAction> pointActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C index 27d55c7813877068d36659dbcceef7cf3b8cf5a7..244dc1bba1b53e4041abba8689ee425761bc836e 100644 --- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C +++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C @@ -36,16 +36,6 @@ namespace Foam defineTypeNameAndDebug(cellToPoint, 0); addToRunTimeSelectionTable(topoSetSource, cellToPoint, word); addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::cellToPoint::cellAction, - 1 - >::names[] = - { - "all" - }; } @@ -56,8 +46,14 @@ Foam::topoSetSource::addToUsageTable Foam::cellToPoint::usage_ " Select all points of cells in the cellSet\n\n" ); -const Foam::NamedEnum<Foam::cellToPoint::cellAction, 1> - Foam::cellToPoint::cellActionNames_; +const Foam::Enum +< + Foam::cellToPoint::cellAction +> +Foam::cellToPoint::cellActionNames_ +{ + { cellAction::ALL, "all" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -111,7 +107,7 @@ Foam::cellToPoint::cellToPoint : topoSetSource(mesh), setName_(dict.lookup("set")), - option_(cellActionNames_.read(dict.lookup("option"))) + option_(cellActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H index 5b0e75eb3da429c5a849c05f2a5d68d99b3da325..d19be4f1941fc24fd738c3ce834138fac9dd7698 100644 --- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H +++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.H @@ -36,7 +36,7 @@ SourceFiles #define cellToPoint_H #include "topoSetSource.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +64,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<cellAction, 1> cellActionNames_; + static const Enum<cellAction> cellActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C index 7b17632b6646d56dc7c50330434f29b169220245..6e8392f885196cab5adfe4e5a282e09af6ec46ce 100644 --- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C +++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C @@ -36,19 +36,8 @@ namespace Foam defineTypeNameAndDebug(faceToPoint, 0); addToRunTimeSelectionTable(topoSetSource, faceToPoint, word); addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::faceToPoint::faceAction, - 1 - >::names[] = - { - "all" - }; } - Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_ ( faceToPoint::typeName, @@ -56,8 +45,14 @@ Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_ " Select all points of faces in the faceSet\n\n" ); -const Foam::NamedEnum<Foam::faceToPoint::faceAction, 1> - Foam::faceToPoint::faceActionNames_; +const Foam::Enum +< + Foam::faceToPoint::faceAction +> +Foam::faceToPoint::faceActionNames_ +{ + { faceAction::ALL, "all" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -105,7 +100,7 @@ Foam::faceToPoint::faceToPoint : topoSetSource(mesh), setName_(dict.lookup("set")), - option_(faceActionNames_.read(dict.lookup("option"))) + option_(faceActionNames_.lookup("option", dict)) {} diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H index 6ab5e86b729a1e6a10d4e7cabe807cda2800b03b..99c598e150ec7394e8da12ecb0cdca4d14ca2943 100644 --- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H +++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.H @@ -36,7 +36,7 @@ SourceFiles #define faceToPoint_H #include "topoSetSource.H" -#include "NamedEnum.H" +#include "Enum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +64,7 @@ private: //- Add usage string static addToUsageTable usage_; - static const NamedEnum<faceAction, 1> faceActionNames_; + static const Enum<faceAction> faceActionNames_; //- Name of set to use word setName_; diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.C b/src/meshTools/sets/topoSetSource/topoSetSource.C index b20ddfbd49bd7f69b6306ad95ada79e748d2006d..acf6238b38536edcd2f1f6cfa997a793d2792886 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.C +++ b/src/meshTools/sets/topoSetSource/topoSetSource.C @@ -34,31 +34,27 @@ namespace Foam defineTypeNameAndDebug(topoSetSource, 0); defineRunTimeSelectionTable(topoSetSource, word); defineRunTimeSelectionTable(topoSetSource, istream); - - template<> - const char* Foam::NamedEnum - < - Foam::topoSetSource::setAction, - 8 - >::names[] = - { - "clear", - "new", - "invert", - "add", - "delete", - "subset", - "list", - "remove" - }; } Foam::HashTable<Foam::string>* Foam::topoSetSource::usageTablePtr_ = nullptr; -const Foam::NamedEnum<Foam::topoSetSource::setAction, 8> - Foam::topoSetSource::actionNames_; +const Foam::Enum +< + Foam::topoSetSource::setAction +> +Foam::topoSetSource::actionNames_ +{ + { setAction::CLEAR, "clear" }, + { setAction::NEW, "new" }, + { setAction::INVERT, "invert" }, + { setAction::ADD, "add" }, + { setAction::DELETE, "delete" }, + { setAction::SUBSET, "subset" }, + { setAction::LIST, "list" }, + { setAction::REMOVE, "remove" }, +}; const Foam::string Foam::topoSetSource::illegalSource_ diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.H b/src/meshTools/sets/topoSetSource/topoSetSource.H index 5bef2158195ccd502f2317171b45d92b6b563612..0957df277dc87c6e4273cc364d2c478bc3a52e9a 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.H +++ b/src/meshTools/sets/topoSetSource/topoSetSource.H @@ -45,7 +45,7 @@ SourceFiles #include "typeInfo.H" #include "runTimeSelectionTables.H" #include "autoPtr.H" -#include "NamedEnum.H" +#include "Enum.H" #include "HashTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -132,7 +132,7 @@ protected: private: - static const NamedEnum<setAction, 8> actionNames_; + static const Enum<setAction> actionNames_; static const string illegalSource_; @@ -140,10 +140,10 @@ private: // Private Member Functions //- Disallow default bitwise copy construct - topoSetSource(const topoSetSource&); + topoSetSource(const topoSetSource&) = delete; //- Disallow default bitwise assignment - void operator=(const topoSetSource&); + void operator=(const topoSetSource&) = delete; public: diff --git a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C index 07e5b5cd5130a33131b69d202770e2c6211693e1..b8cc1834247668bba5744ab81856df00986d0d39 100644 --- a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C +++ b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C @@ -36,23 +36,19 @@ License namespace Foam { defineTypeNameAndDebug(booleanSurface, 0); +} -template<> -const char* Foam::NamedEnum +const Foam::Enum < - Foam::booleanSurface::booleanOpType, - 4 ->::names[] = + Foam::booleanSurface::booleanOpType +> +Foam::booleanSurface::booleanOpTypeNames { - "union", - "intersection", - "difference", - "all" + { booleanOpType::UNION, "union" }, + { booleanOpType::INTERSECTION, "intersection" }, + { booleanOpType::DIFFERENCE, "difference" }, + { booleanOpType::ALL, "all" }, }; -} - -const Foam::NamedEnum<Foam::booleanSurface::booleanOpType, 4> -Foam::booleanSurface::booleanOpTypeNames; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.H b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.H index 1bc0d0f0592b593071de3dada1445adfe5682404..6b044bacb70d066b982623c4cbdcb659a8bab036 100644 --- a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.H +++ b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.H @@ -172,7 +172,7 @@ public: // Static data - static const NamedEnum<booleanOpType, 4> booleanOpTypeNames; + static const Enum<booleanOpType> booleanOpTypeNames; diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C index 8c552335d462c8f3757de0d7120fa471ae0745d4..c38da917f025972ce9cc66de04903940d0419d51 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C @@ -41,7 +41,10 @@ namespace Foam defineTypeNameAndDebug(surfaceIntersection, 0); } -const Foam::Enum<Foam::surfaceIntersection::intersectionType> +const Foam::Enum +< + Foam::surfaceIntersection::intersectionType +> Foam::surfaceIntersection::selfIntersectionNames { { intersectionType::SELF, "self" }, diff --git a/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C b/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C index d40c00877671782dcd92cfd5df4c7c9b75769281..a653f53bae09b1857ec7cc88e5ef3ce80431c5dd 100644 --- a/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C +++ b/src/meshTools/triSurface/triSurfaceLoader/triSurfaceLoader.C @@ -30,11 +30,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::Enum<Foam::triSurfaceLoader::loadingOption> +const Foam::Enum +< + Foam::triSurfaceLoader::loadingOption +> Foam::triSurfaceLoader::loadingOptionNames -( - SINGLE_REGION, { "single", "file", "offset", "merge" } -); +{ + { loadingOption::SINGLE_REGION, "single" }, + { loadingOption::FILE_REGION, "file" }, + { loadingOption::OFFSET_REGION, "offset" }, + { loadingOption::MERGE_REGION, "merge" } +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C index 9ef72576fae0b8de66f4e6218ce6716f43439f4d..c6327181dc4e0a5e373dccbd900024ded29a2859 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C @@ -35,22 +35,19 @@ namespace Foam { defineTypeNameAndDebug(cellCellStencil, 0); defineRunTimeSelectionTable(cellCellStencil, mesh); - - template<> - const char* NamedEnum - < - cellCellStencil::cellType, - 3 - >::names[] = - { - "calculated", - "interpolated", - "hole" - }; } -const Foam::NamedEnum<Foam::cellCellStencil::cellType, 3> -Foam::cellCellStencil::cellTypeNames_; +const Foam::Enum +< + Foam::cellCellStencil::cellType +> +Foam::cellCellStencil::cellTypeNames_ +{ + { cellType::CALCULATED, "calculated" }, + { cellType::INTERPOLATED, "interpolated" }, + { cellType::HOLE, "hole" }, +}; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H index 327bce87cf3c1c28f0c9bd0bb6672ee8fde8735c..b46f5339932f504f7e94e431a75ea92cdec9110a 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H @@ -81,7 +81,7 @@ protected: // Protected data //- Mode type names - static const NamedEnum<cellType, 3> cellTypeNames_; + static const Enum<cellType> cellTypeNames_; //- Reference to the mesh const fvMesh& mesh_; diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C index ae6f0b8c7ab31f26b6da7d09a1a2f5a13e1e85f1..8ceb27f37ccc34a0154eceaf319e17c750e755d6 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C @@ -51,23 +51,19 @@ namespace Foam distributedTriSurfaceMesh, dict ); - - template<> - const char* Foam::NamedEnum - < - Foam::distributedTriSurfaceMesh::distributionType, - 3 - >::names[] = - { - "follow", - "independent", - "frozen" - }; } -const Foam::NamedEnum<Foam::distributedTriSurfaceMesh::distributionType, 3> - Foam::distributedTriSurfaceMesh::distributionTypeNames_; +const Foam::Enum +< + Foam::distributedTriSurfaceMesh::distributionType +> +Foam::distributedTriSurfaceMesh::distributionTypeNames_ +{ + { distributionType::FOLLOW, "follow" }, + { distributionType::INDEPENDENT, "independent" }, + { distributionType::FROZEN, "frozen" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -83,7 +79,7 @@ bool Foam::distributedTriSurfaceMesh::read() Pstream::scatterList(procBb_); // Distribution type - distType_ = distributionTypeNames_.read(dict_.lookup("distributionType")); + distType_ = distributionTypeNames_.lookup("distributionType", dict_); // Merge distance mergeDist_ = readScalar(dict_.lookup("mergeDistance")); diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H index 03451e72e2607b5072a7096bcdf6534faf039314..8294da4a0ca1b72175d4eaa46d95f1ba78e181c2 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H @@ -87,7 +87,7 @@ public: FROZEN = 2 }; - static const NamedEnum<distributionType, 3> distributionTypeNames_; + static const Enum<distributionType> distributionTypeNames_; private: diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C index 1fcabf5243a53f4b51ee64908704ddc8bbad97ce..b372995659d8cae39ee35d67c69a69de16fc56f7 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C @@ -30,27 +30,16 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* Foam::NamedEnum - < - Foam::energyRegionCoupledFvPatchScalarField::kappaMethodType, - 3 - >::names[] = - { - "solid", - "fluid", - "undefined" - }; -} - - -const Foam::NamedEnum +const Foam::Enum < - Foam::energyRegionCoupledFvPatchScalarField::kappaMethodType, - 3 -> Foam::energyRegionCoupledFvPatchScalarField::methodTypeNames_; + Foam::energyRegionCoupledFvPatchScalarField::kappaMethodType +> +Foam::energyRegionCoupledFvPatchScalarField::methodTypeNames_ +{ + { kappaMethodType::SOLID, "solid" }, + { kappaMethodType::FLUID, "fluid" }, + { kappaMethodType::UNDEFINED, "undefined" }, +}; // * * * * * * * * * * * * * * * * Private members * * * * * * * * * * * * *// diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H index 877d40583de06fc6aaf575a005f3abb42273a753..0aed50e6b70076378b02ce41258c042307d3a3c7 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H @@ -41,7 +41,7 @@ SourceFiles #include "regionCoupledBaseFvPatch.H" #include "LduInterfaceField.H" #include "fvPatchField.H" -#include "NamedEnum.H" +#include "Enum.H" #include "basicThermo.H" #include "coupledFvPatchField.H" @@ -77,16 +77,16 @@ private: //- Local reference to region couple patch const regionCoupledBaseFvPatch& regionCoupledPatch_; - //- Methof to extract kappa - static const NamedEnum<kappaMethodType, 3> methodTypeNames_; + //- Method to extract kappa + static const Enum<kappaMethodType> methodTypeNames_; //- How to get K mutable kappaMethodType method_; - //- AutoPtr to nbr thermo + //- An autoPtr to nbr thermo mutable const basicThermo* nbrThermoPtr_; - //- AutoPtr to my thermo + //- An autoPtr to my thermo mutable const basicThermo* thermoPtr_; diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 9d4360d8ce2617a95fe577a52ea20bc87e5b402d..94628ee4652607530a6afb86f5ef890f246b85f5 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H @@ -44,7 +44,6 @@ SourceFiles #include "volFieldsFwd.H" #include "DimensionedField.H" #include "labelList.H" -#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 3ac9607fff03b38202aead924dc51e40be570894..0e39240d435968980fd24efe741ed2cc3d50aaab 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -33,23 +33,23 @@ License namespace Foam { defineTypeNameAndDebug(meshToMesh, 0); +} + - template<> - const char* Foam::NamedEnum - < - Foam::meshToMesh::interpolationMethod, - 4 - >::names[] = +const Foam::Enum +< + Foam::meshToMesh::interpolationMethod +> +Foam::meshToMesh::interpolationMethodNames_ +{ + { interpolationMethod::imDirect, "direct" }, + { interpolationMethod::imMapNearest, "mapNearest" }, + { interpolationMethod::imCellVolumeWeight, "cellVolumeWeight" }, { - "direct", - "mapNearest", - "cellVolumeWeight", + interpolationMethod::imCorrectedCellVolumeWeight, "correctedCellVolumeWeight" - }; - - const NamedEnum<meshToMesh::interpolationMethod, 4> - meshToMesh::interpolationMethodNames_; -} + }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/meshToMesh/meshToMesh.H b/src/sampling/meshToMesh/meshToMesh.H index 62b5781979ac1f27135f4dd589630fdd015e4958..fb5b4c0d494f201ec533d265d5cd5384aa56ae74 100644 --- a/src/sampling/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMesh/meshToMesh.H @@ -46,7 +46,7 @@ SourceFiles #include "treeBoundBox.H" #include "mapDistribute.H" #include "volFieldsFwd.H" -#include "NamedEnum.H" +#include "Enum.H" #include "AMIPatchToPatchInterpolation.H" #include "pointList.H" @@ -74,8 +74,7 @@ public: imCorrectedCellVolumeWeight }; - static const NamedEnum<interpolationMethod, 4> - interpolationMethodNames_; + static const Enum<interpolationMethod> interpolationMethodNames_; private: diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C index f79bdf3a6813e971d43a7b452ad5487bf1123afa..50fe214cbe8e4f8cd4894e3c1e8d49b41fb6dca9 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C @@ -35,6 +35,18 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +const Foam::Enum +< + Foam::sampledTriSurfaceMesh::samplingSource +> +Foam::sampledTriSurfaceMesh::samplingSourceNames_ +{ + { samplingSource::cells, "cells" }, + { samplingSource::insideCells, "insideCells" }, + { samplingSource::boundaryFaces, "boundaryFaces" }, +}; + + namespace Foam { defineTypeNameAndDebug(sampledTriSurfaceMesh, 0); @@ -45,18 +57,6 @@ namespace Foam word ); - template<> - const char* NamedEnum<sampledTriSurfaceMesh::samplingSource, 3>::names[] = - { - "cells", - "insideCells", - "boundaryFaces" - }; - - const NamedEnum<sampledTriSurfaceMesh::samplingSource, 3> - sampledTriSurfaceMesh::samplingSourceNames_; - - //- Private class for finding nearest // Comprising: // - global index @@ -685,7 +685,7 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh false ) ), - sampleSource_(samplingSourceNames_[dict.lookup("source")]), + sampleSource_(samplingSourceNames_.lookup("source", dict)), needsUpdate_(true), keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)), originalIds_(), diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H index b46d7649f6bc9ed80b0ac98bfb41bcd3fd138a6d..c94f90cd3fbfea6a33da745be897d8976cfa2812 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H @@ -108,7 +108,7 @@ private: // Private data - static const NamedEnum<samplingSource, 3> samplingSourceNames_; + static const Enum<samplingSource> samplingSourceNames_; //- Surface to sample on const triSurfaceMesh surface_; diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C index 384192756d1beeabe484600a3c2e77fef2ebaf17..3ecb1836b615653759672f2ee0c2a9e3d0e680cb 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C @@ -38,29 +38,30 @@ namespace Foam // Create write methods defineSurfaceWriterWriteFields(nastranSurfaceWriter); - - template<> - const char* NamedEnum<nastranSurfaceWriter::writeFormat, 3>::names[] = - { - "short", - "long", - "free" - }; +} - const NamedEnum<nastranSurfaceWriter::writeFormat, 3> - nastranSurfaceWriter::writeFormatNames_; +const Foam::Enum +< + Foam::nastranSurfaceWriter::writeFormat +> +Foam::nastranSurfaceWriter::writeFormatNames_ +{ + { writeFormat::wfShort, "short" }, + { writeFormat::wfLong, "long" }, + { writeFormat::wfFree, "free" }, +}; - template<> - const char* NamedEnum<nastranSurfaceWriter::dataFormat, 2>::names[] = - { - "PLOAD2", - "PLOAD4" - }; - const NamedEnum<nastranSurfaceWriter::dataFormat, 2> - nastranSurfaceWriter::dataFormatNames_; -} +const Foam::Enum +< + Foam::nastranSurfaceWriter::dataFormat +> +Foam::nastranSurfaceWriter::dataFormatNames_ +{ + { dataFormat::dfPLOAD2, "PLOAD2" }, + { dataFormat::dfPLOAD4, "PLOAD4" }, +}; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -405,18 +406,17 @@ Foam::nastranSurfaceWriter::nastranSurfaceWriter() Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options) : surfaceWriter(), - writeFormat_(wfLong), + writeFormat_(writeFormat::wfLong), fieldMap_(), scale_(options.lookupOrDefault("scale", 1.0)), separator_("") { - if (options.found("format")) - { - writeFormat_ = writeFormatNames_.read - ( - options.lookup("format") - ); - } + writeFormat_ = writeFormatNames_.lookupOrDefault + ( + "format", + options, + writeFormat::wfLong + ); if (writeFormat_ == wfFree) { diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H index 921182af987ff1bf1eae33cca473ee450903fe3a..2106dc1b4c5ce134fc2aa623e60675121bbd12f7 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H @@ -56,7 +56,7 @@ SourceFiles #define nastranSurfaceWriter_H #include "surfaceWriter.H" -#include "NamedEnum.H" +#include "Enum.H" #include "OFstream.H" #include "HashTable.H" @@ -93,8 +93,8 @@ private: // Private data - static const NamedEnum<writeFormat, 3> writeFormatNames_; - static const NamedEnum<dataFormat, 2> dataFormatNames_; + static const Enum<writeFormat> writeFormatNames_; + static const Enum<dataFormat> dataFormatNames_; //- Write option writeFormat writeFormat_; diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurface.C b/src/sampling/surface/triSurfaceMesh/discreteSurface.C index b6bc9d87d85d9b1c7fedd136b3a6af111a840516..ef95c86318e6f5de75991c72ef2726c2a876d356 100644 --- a/src/sampling/surface/triSurfaceMesh/discreteSurface.C +++ b/src/sampling/surface/triSurfaceMesh/discreteSurface.C @@ -35,21 +35,21 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::discreteSurface::samplingSource +> +Foam::discreteSurface::samplingSourceNames_ { - defineTypeNameAndDebug(discreteSurface, 0); - - template<> - const char* NamedEnum<discreteSurface::samplingSource, 3>::names[] = - { - "cells", - "insideCells", - "boundaryFaces" - }; + { samplingSource::cells, "cells" }, + { samplingSource::insideCells, "insideCells" }, + { samplingSource::boundaryFaces, "boundaryFaces" }, +}; - const NamedEnum<discreteSurface::samplingSource, 3> - discreteSurface::samplingSourceNames_; +namespace Foam +{ + defineTypeNameAndDebug(discreteSurface, 0); //- Private class for finding nearest // Comprising: @@ -686,7 +686,7 @@ Foam::discreteSurface::discreteSurface false ) ), - sampleSource_(samplingSourceNames_[dict.lookup("source")]), + sampleSource_(samplingSourceNames_.lookup("source", dict)), needsUpdate_(true), keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)), originalIds_(), diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurface.H b/src/sampling/surface/triSurfaceMesh/discreteSurface.H index 5114a0974d5d1e62f3c7a9f1c8e05bc38453e1a3..9f59550b5322bc469554a2af18aba01b59aa7a0b 100644 --- a/src/sampling/surface/triSurfaceMesh/discreteSurface.H +++ b/src/sampling/surface/triSurfaceMesh/discreteSurface.H @@ -107,7 +107,7 @@ private: // Private data - static const NamedEnum<samplingSource, 3> samplingSourceNames_; + static const Enum<samplingSource> samplingSourceNames_; //- Reference to mesh const polyMesh& mesh_; diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C index 369c9788a24bf4d194335739f72c9f09eb8ba110..12569bda35106906d2b0026a5db9155243426a55 100644 --- a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C +++ b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C @@ -30,26 +30,16 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam -{ - template<> - const char* Foam::NamedEnum - < - Foam::radiation::boundaryRadiationPropertiesPatch::methodType, - 3 - >::names[] = - { - "solidRadiation", - "lookup", - "model" - }; -} - -const Foam::NamedEnum +const Foam::Enum < - Foam::radiation::boundaryRadiationPropertiesPatch::methodType, - 3 -> Foam::radiation::boundaryRadiationPropertiesPatch::methodTypeNames_; + Foam::radiation::boundaryRadiationPropertiesPatch::methodType +> +Foam::radiation::boundaryRadiationPropertiesPatch::methodTypeNames_ +{ + { methodType::SOLIDRADIATION, "solidRadiation" }, + { methodType::LOOKUP, "lookup" }, + { methodType::MODEL, "model" } +}; // * * * * * * * * * * * * * * * * Private functions * * * * * * * * * * * * // @@ -84,7 +74,7 @@ boundaryRadiationPropertiesPatch const dictionary& dict ) : - method_(methodTypeNames_.read(dict.lookup("mode"))), + method_(methodTypeNames_.lookup("mode", dict)), dict_(dict), absorptionEmission_(nullptr), transmissivity_(nullptr), @@ -411,20 +401,15 @@ void Foam::radiation::boundaryRadiationPropertiesPatch::write Ostream& os ) const { - os.writeKeyword("mode") << methodTypeNames_[method_] - << token::END_STATEMENT << nl; + os.writeEntry("mode", methodTypeNames_[method_]); switch (method_) { case MODEL: { - word modelType - ( - word(dict_.lookup("absorptionEmissionModel")) - ); + word modelType(dict_.lookup("absorptionEmissionModel")); - os.writeKeyword("absorptionEmissionModel") << modelType - << token::END_STATEMENT << nl; + os.writeEntry("absorptionEmissionModel", modelType); word modelCoeffs(modelType + word("Coeffs")); os.writeKeyword(modelCoeffs); @@ -433,8 +418,7 @@ void Foam::radiation::boundaryRadiationPropertiesPatch::write modelType = word(dict_.lookup("transmissivityModel")); - os.writeKeyword("transmissivityModel") << modelType - << token::END_STATEMENT << nl; + os.writeEntry("transmissivityModel", modelType); modelCoeffs = modelType + word("Coeffs"); diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H index 59ad9a4415a5b4af74df11d7b4f2da73f2942ff7..a663b253d352f3df58a2f9fd199e0af218204e69 100644 --- a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H +++ b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H @@ -41,7 +41,7 @@ SourceFiles #define boundaryRadiationPropertiesPatch_H #include "scalarField.H" -#include "NamedEnum.H" +#include "Enum.H" #include "fvPatch.H" #include "calculatedFvPatchFields.H" #include "transmissivityModel.H" @@ -74,7 +74,7 @@ private: // Private data - static const NamedEnum<methodType, 3> methodTypeNames_; + static const Enum<methodType> methodTypeNames_; //- How to get property const methodType method_; diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C index dea53edd9195d98168676ae6492853348a212918..7c720f5ab0a5981c915035471f22a2709e1eb73e 100644 --- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C +++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C @@ -35,36 +35,34 @@ using namespace Foam::constant; namespace Foam { defineTypeNameAndDebug(solarCalculator, 0); - - template<> - const char* NamedEnum - < - solarCalculator::sunDirModel, - 2 - >::names[] = - { - "sunDirConstant", - "sunDirTracking" - }; - - template<> - const char* NamedEnum - < - solarCalculator::sunLModel, - 3 - >::names[] = - { - "sunLoadConstant", - "sunLoadFairWeatherConditions", - "sunLoadTheoreticalMaximum" - }; } -const Foam::NamedEnum<Foam::solarCalculator::sunDirModel, 2> - Foam::solarCalculator::sunDirectionModelTypeNames_; -const Foam::NamedEnum<Foam::solarCalculator::sunLModel, 3> - Foam::solarCalculator::sunLoadModelTypeNames_; +const Foam::Enum +< + Foam::solarCalculator::sunDirModel +> +Foam::solarCalculator::sunDirectionModelTypeNames_ +{ + { sunDirModel::mSunDirConstant, "sunDirConstant" }, + { sunDirModel::mSunDirTracking, "sunDirTracking" }, +}; + + +const Foam::Enum +< + Foam::solarCalculator::sunLModel +> +Foam::solarCalculator::sunLoadModelTypeNames_ +{ + { sunLModel::mSunLoadConstant, "sunLoadConstant" }, + { + sunLModel::mSunLoadFairWeatherConditions, + "sunLoadFairWeatherConditions" + }, + { sunLModel::mSunLoadTheoreticalMaximum, "sunLoadTheoreticalMaximum" }, +}; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -271,11 +269,11 @@ Foam::solarCalculator::solarCalculator C_(readScalar(dict.lookup("C"))), sunDirectionModel_ ( - sunDirectionModelTypeNames_.read(dict.lookup("sunDirectionModel")) + sunDirectionModelTypeNames_.lookup("sunDirectionModel", dict) ), sunLoadModel_ ( - sunLoadModelTypeNames_.read(dict.lookup("sunLoadModel")) + sunLoadModelTypeNames_.lookup("sunLoadModel", dict) ), coord_() { diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H index 9eeb5bfc4db695f0a463b17d8bc68c8797ed6f5a..fb9b8eb6a76fd63728a627b69ca3b9d9ad397ccf 100644 --- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H +++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H @@ -126,10 +126,10 @@ public: protected: //- Sun direction models - static const NamedEnum<sunDirModel, 2> sunDirectionModelTypeNames_; + static const Enum<sunDirModel> sunDirectionModelTypeNames_; //- Sun load models - static const NamedEnum<sunLModel, 3> sunLoadModelTypeNames_; + static const Enum<sunLModel> sunLoadModelTypeNames_; private: diff --git a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C index 8dc32437e4f5700ab43a39f7535ef28b2d3d11a8..e12b63b72534ec5048951f78aa98f4c20870fa5b 100644 --- a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C @@ -33,29 +33,20 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -namespace Foam +const Foam::Enum +< + Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massTransferMode +> +Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massModeTypeNames_ { - template<> - const char* Foam::NamedEnum - < - Foam:: - humidityTemperatureCoupledMixedFvPatchScalarField:: - massTransferMode, - 4 - >::names[] = + { massTransferMode::mtConstantMass, "constantMass" }, + { massTransferMode::mtCondensation, "condensation" }, + { massTransferMode::mtEvaporation, "evaporation" }, { - "constantMass", - "condensation", - "evaporation", + massTransferMode::mtCondensationAndEvaporation, "condensationAndEvaporation" - }; -} - -const Foam::NamedEnum -< - Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massTransferMode, - 4 -> Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massModeTypeNames_; + }, +}; // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // @@ -256,7 +247,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField if (dict.found("mode")) { - mode_ = massModeTypeNames_.read(dict.lookup("mode")); + mode_ = massModeTypeNames_.lookup("mode", dict); fluid_ = true; } @@ -746,17 +737,15 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::write if (fluid_) { - os.writeKeyword("mode")<< massModeTypeNames_[mode_] - << token::END_STATEMENT <<nl; + os.writeEntry("mode", massModeTypeNames_[mode_]); writeEntryIfDifferent<word>(os, "specie", "none", specieName_); - os.writeKeyword("carrierMolWeight")<< Mcomp_ - << token::END_STATEMENT <<nl; + os.writeEntry("carrierMolWeight", Mcomp_); - os.writeKeyword("L")<< L_ << token::END_STATEMENT << nl; - os.writeKeyword("Tvap")<< Tvap_ << token::END_STATEMENT << nl; - os.writeKeyword("fluid")<< fluid_ << token::END_STATEMENT << nl; + os.writeEntry("L", L_); + os.writeEntry("Tvap", Tvap_); + os.writeEntry("fluid", fluid_); mass_.writeEntry("mass", os); if (mode_ == mtConstantMass) diff --git a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H index 3f5b1c0eead451bad20441aae85071336c87b63e..258af191cc49421364394d3088007a36256945d3 100644 --- a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H +++ b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H @@ -188,7 +188,7 @@ private: // Private data - static const NamedEnum<massTransferMode, 4> massModeTypeNames_; + static const Enum<massTransferMode> massModeTypeNames_; //- Operating mode massTransferMode mode_; diff --git a/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C index 78bd0115271c8e7c032a9be641bcafec1aa5f17b..75763c8301cbe3e4856a47b5b2ba0faeda0b90c4 100644 --- a/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C +++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C @@ -33,27 +33,19 @@ License namespace Foam { defineTypeNameAndDebug(alphaContactAngleFvPatchScalarField, 0); - - template<> - const char* Foam::NamedEnum - < - Foam::alphaContactAngleFvPatchScalarField::limitControls, - 4 - >::names[] = - { - "none", - "gradient", - "zeroGradient", - "alpha" - }; } - -const Foam::NamedEnum +const Foam::Enum < - Foam::alphaContactAngleFvPatchScalarField::limitControls, - 4 -> Foam::alphaContactAngleFvPatchScalarField::limitControlNames_; + Foam::alphaContactAngleFvPatchScalarField::limitControls +> +Foam::alphaContactAngleFvPatchScalarField::limitControlNames_ +{ + { limitControls::lcNone, "none" }, + { limitControls::lcGradient, "gradient" }, + { limitControls::lcZeroGradient, "zeroGradient" }, + { limitControls::lcAlpha, "alpha" }, +}; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -77,7 +69,7 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), - limit_(limitControlNames_.read(dict.lookup("limit"))) + limit_(limitControlNames_.lookup("limit", dict)) { if (dict.found("gradient")) { @@ -166,8 +158,7 @@ void Foam::alphaContactAngleFvPatchScalarField::write ) const { fixedGradientFvPatchScalarField::write(os); - os.writeKeyword("limit") - << limitControlNames_[limit_] << token::END_STATEMENT << nl; + os.writeEntry("limit", limitControlNames_[limit_]); } diff --git a/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H index fdc46b9e0f40012282b01a4db9eb7b7bb664ce43..d07f107c08b823c8262df518239732d8106a2448 100644 --- a/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H +++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H @@ -92,7 +92,7 @@ public: lcAlpha }; - static const NamedEnum<limitControls, 4> limitControlNames_; + static const Enum<limitControls> limitControlNames_; limitControls limit_; // Constructors