diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C
index 48807d2e68393a8e8d7a40428713d2308596b92b..982d5e28dc0321496473f4d4cc1de8d59669781e 100644
--- a/src/OSspecific/POSIX/fileMonitor.C
+++ b/src/OSspecific/POSIX/fileMonitor.C
@@ -49,19 +49,19 @@ Class
 
 defineTypeNameAndDebug(Foam::fileMonitor, 0);
 
-template<>
-const char* Foam::NamedEnum<Foam::fileMonitor::fileState, 3>::names[] =
-{
-    "unmodified",
-    "modified",
-    "deleted"
-};
 const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
     Foam::fileMonitor::fileStateNames_;
 
-
 namespace Foam
 {
+    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/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
index b5d22692f0c9187ffd537e4570f86ec8953e1a3b..51e2fadfe77a4cc749b12a20a27e2dd9b198dfcd 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
@@ -32,13 +32,17 @@ License
 
 defineTypeNameAndDebug(Foam::UPstream, 0);
 
-template<>
-const char* Foam::NamedEnum<Foam::UPstream::commsTypes, 3>::names[] =
+namespace Foam
 {
-    "blocking",
-    "scheduled",
-    "nonBlocking"
-};
+    template<>
+    const char* Foam::NamedEnum<Foam::UPstream::commsTypes, 3>::names[] =
+    {
+        "blocking",
+        "scheduled",
+        "nonBlocking"
+    };
+}
+
 
 const Foam::NamedEnum<Foam::UPstream::commsTypes, 3>
     Foam::UPstream::commsTypeNames;
diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C
index aadcdc7c54b34fcb3683cf0641505809af0c1c5e..487576586bf025995778a59e2289efaca093f33f 100644
--- a/src/OpenFOAM/db/Time/Time.C
+++ b/src/OpenFOAM/db/Time/Time.C
@@ -32,28 +32,31 @@ License
 
 defineTypeNameAndDebug(Foam::Time, 0);
 
-template<>
-const char* Foam::NamedEnum<Foam::Time::stopAtControls, 4>::names[] =
+namespace Foam
 {
-    "endTime",
-    "noWriteNow",
-    "writeNow",
-    "nextWrite"
-};
+    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_;
 
-template<>
-const char* Foam::NamedEnum<Foam::Time::writeControls, 5>::names[] =
-{
-    "timeStep",
-    "runTime",
-    "adjustableRunTime",
-    "clockTime",
-    "cpuTime"
-};
-
 const Foam::NamedEnum<Foam::Time::writeControls, 5>
     Foam::Time::writeControlNames_;
 
diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
index 82e74c55c7602f6a935dc8091a649807ade8ac02..008085253d443046669be3c61796c6cb9a6037b4 100644
--- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
+++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
@@ -27,16 +27,19 @@ License
 
 // * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * * //
 
-template<>
-const char* Foam::NamedEnum
-<
-    Foam::outputFilterOutputControl::outputControls,
-    2
->::names[] =
+namespace Foam
 {
-    "timeStep",
-    "outputTime"
-};
+    template<>
+    const char* Foam::NamedEnum
+    <
+        Foam::outputFilterOutputControl::outputControls,
+        2
+    >::names[] =
+    {
+        "timeStep",
+        "outputTime"
+    };
+}
 
 const Foam::NamedEnum<Foam::outputFilterOutputControl::outputControls, 2>
     Foam::outputFilterOutputControl::outputControlNames_;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
index 330b912fb90eeb8b0a24d9f0858bc113adc10dbd..01ed37fd1662765e9556cf31298401371d0e38ce 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
@@ -44,16 +44,20 @@ namespace Foam
 
     addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word);
     addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary);
-}
 
-template<>
-const char* Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>::names[] =
-{
-    "unknown",
-    "rotational",
-    "translational",
-    "noOrdering"
-};
+    template<>
+    const char* Foam::NamedEnum
+    <
+        Foam::cyclicPolyPatch::transformType,
+        4
+    >::names[] =
+    {
+        "unknown",
+        "rotational",
+        "translational",
+        "noOrdering"
+    };
+}
 
 const Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>
     Foam::cyclicPolyPatch::transformTypeNames;
diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C
index abaf9c5015acbc743d507c00ea08836802b38550..110754f77a1494ff70167bf1c2ff7acf8cd1389a 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C
+++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C
@@ -29,27 +29,29 @@ License
 
 Foam::scalar Foam::intersection::planarTol_ = 0.2;
 
-template<>
-const char* Foam::NamedEnum<Foam::intersection::direction, 2>::names[] =
+namespace Foam
 {
-    "vector",
-    "contactSphere"
-};
+    template<>
+    const char* Foam::NamedEnum<Foam::intersection::direction, 2>::names[] =
+    {
+        "vector",
+        "contactSphere"
+    };
+
+    template<>
+    const char* Foam::NamedEnum<Foam::intersection::algorithm, 3>::names[] =
+    {
+        "fullRay",
+        "halfRay",
+        "visible"
+    };
+}
 
 const Foam::NamedEnum<Foam::intersection::direction, 2>
 Foam::intersection::directionNames_;
 
-template<>
-const char* Foam::NamedEnum<Foam::intersection::algorithm, 3>::names[] =
-{
-    "fullRay",
-    "halfRay",
-    "visible"
-};
-
 const Foam::NamedEnum<Foam::intersection::algorithm, 3>
 Foam::intersection::algorithmNames_;
 
 
-
 // ************************************************************************* //
diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C
index 793323e54dd5bc58582f543995d40a8dada01990..5f5fb220afe231762290b679da2cc0808a9c8cc5 100644
--- a/src/dynamicMesh/meshCut/directions/directions.C
+++ b/src/dynamicMesh/meshCut/directions/directions.C
@@ -35,19 +35,21 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template<>
-const char* Foam::NamedEnum<Foam::directions::directionType, 3>::names[] =
+namespace Foam
 {
-    "tan1",
-    "tan2",
-    "normal"
-};
+    template<>
+    const char* Foam::NamedEnum<Foam::directions::directionType, 3>::names[] =
+    {
+        "tan1",
+        "tan2",
+        "normal"
+    };
+}
 
 const Foam::NamedEnum<Foam::directions::directionType, 3>
     Foam::directions::directionTypeNames_;
 
 
-
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // For debugging
diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C
index b7bbecdc5c994ddf64fca8010c564a15083fff5c..85fa0807507e99cf9cbd958038cbda37ff3ee05f 100644
--- a/src/dynamicMesh/slidingInterface/slidingInterface.C
+++ b/src/dynamicMesh/slidingInterface/slidingInterface.C
@@ -45,15 +45,18 @@ namespace Foam
         slidingInterface,
         dictionary
     );
-}
-
 
-template<>
-const char* Foam::NamedEnum<Foam::slidingInterface::typeOfMatch, 2>::names[] =
-{
-    "integral",
-    "partial"
-};
+    template<>
+    const char* Foam::NamedEnum
+    <
+        Foam::slidingInterface::typeOfMatch,
+        2
+    >::names[] =
+    {
+        "integral",
+        "partial"
+    };
+}
 
 
 const Foam::NamedEnum<Foam::slidingInterface::typeOfMatch, 2>
diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C
index bd01c8b2070cbe3b9367cfb406b4cd226c9168d6..4ad492b064a26812115b16770df229ee470b8d31 100644
--- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C
+++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C
@@ -27,15 +27,17 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template<>
-const char* Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>::names[] =
+namespace Foam
 {
-    "gas",
-    "liquid",
-    "solid",
-    "unknown"
-};
-
+    template<>
+    const char* Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>::names[] =
+    {
+        "gas",
+        "liquid",
+        "solid",
+        "unknown"
+    };
+}
 
 const Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>
     Foam::phaseProperties::phaseTypeNames_;
diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
index ecb0542578b92c591d2d35741f6206aee992da8a..9a91bcccb0b37a0fe745b1935b506051d270aea1 100644
--- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
+++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
@@ -34,15 +34,19 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template<>
-const char*
-Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>::names[] =
+namespace Foam
 {
-    "inside",
-    "outside",
-    "insidePoint",
-    "none"
-};
+    template<>
+    const char*
+    Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>::names[] =
+    {
+        "inside",
+        "outside",
+        "insidePoint",
+        "none"
+    };
+}
+
 
 const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
     Foam::refinementSurfaces::areaSelectionAlgoNames;
@@ -388,7 +392,7 @@ Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
 }
 
 
-// Get indices of named surfaces with a 
+// Get indices of named surfaces with a
 Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
 {
     labelList closed(cellZoneNames_.size());
@@ -411,9 +415,9 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
 // Foam::labelList Foam::refinementSurfaces::countRegions(const triSurface& s)
 // {
 //     const geometricSurfacePatchList& regions = s.patches();
-// 
+//
 //     labelList nTris(regions.size(), 0);
-// 
+//
 //     forAll(s, triI)
 //     {
 //         nTris[s[triI].region()]++;
@@ -433,15 +437,15 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
 // ) const
 // {
 //     const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
-// 
+//
 //     // Get per element the region
 //     labelList region;
 //     geom.getRegion(info, region);
-// 
+//
 //     // Initialise fields to region wise minLevel
 //     minLevelField.setSize(ctrs.size());
 //     minLevelField = -1;
-// 
+//
 //     forAll(minLevelField, i)
 //     {
 //         if (info[i].hit())
@@ -449,12 +453,12 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
 //             minLevelField[i] = minLevel(surfI, region[i]);
 //         }
 //     }
-// 
+//
 //     // Find out if triangle inside shell with higher level
 //     // What level does shell want to refine fc to?
 //     labelList shellLevel;
 //     shells.findHigherLevel(ctrs, minLevelField, shellLevel);
-// 
+//
 //     forAll(minLevelField, i)
 //     {
 //         minLevelField[i] = max(minLevelField[i], shellLevel[i]);
diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C
index db7cb5269f2528af56830df5e6a84e2bf49ac374..9589929aeda44d03e879fbe431cdf40b794a12e5 100644
--- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C
+++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C
@@ -33,13 +33,18 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(faceToCell, 0);
+    addToRunTimeSelectionTable(topoSetSource, faceToCell, word);
+    addToRunTimeSelectionTable(topoSetSource, faceToCell, istream);
 
-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"
+    };
 }
 
 
@@ -51,15 +56,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceToCell::usage_
     " of the faces in the faceSet or where all faces are in the faceSet\n\n"
 );
 
-template<>
-const char* Foam::NamedEnum<Foam::faceToCell::faceAction, 4>::names[] =
-{
-    "neighbour",
-    "owner",
-    "any",
-    "all"
-};
-
 const Foam::NamedEnum<Foam::faceToCell::faceAction, 4>
     Foam::faceToCell::faceActionNames_;
 
diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
index da2feb7e04f0ae80cc6ccb28b3d4a318f8bc02cc..2d5bd7f4d509c5cf3d5cba9fb5da181231d963d3 100644
--- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
+++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C
@@ -32,13 +32,16 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(faceZoneToCell, 0);
+    addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
+    addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
 
-defineTypeNameAndDebug(faceZoneToCell, 0);
-
-addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word);
-
-addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream);
-
+    template<>
+    const char* Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>::names[] =
+    {
+        "master",
+        "slave"
+    };
 }
 
 
@@ -51,14 +54,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceZoneToCell::usage_
 );
 
 
-template<>
-const char* Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>::names[] =
-{
-    "master",
-    "slave"
-};
-
-
 const Foam::NamedEnum<Foam::faceZoneToCell::faceAction, 2>
     Foam::faceZoneToCell::faceActionNames_;
 
diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C
index 359f82fae3d99efdd83f4e96fbb00aeabbf17cd4..ebb3a010b947d2cdae776f807e8e5579156c7dd5 100644
--- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C
+++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C
@@ -33,13 +33,15 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(pointToCell, 0);
+    addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
+    addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
 
-defineTypeNameAndDebug(pointToCell, 0);
-
-addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
-
-addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
-
+    template<>
+    const char* Foam::NamedEnum<Foam::pointToCell::pointAction, 1>::names[] =
+    {
+        "any"
+    };
 }
 
 
@@ -50,13 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_
     "    Select all cells with any point in the pointSet\n\n"
 );
 
-template<>
-const char* Foam::NamedEnum<Foam::pointToCell::pointAction, 1>::names[] =
-{
-    "any"
-};
-
-
 const Foam::NamedEnum<Foam::pointToCell::pointAction, 1>
     Foam::pointToCell::pointActionNames_;
 
diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C
index a7e5b8c28543a98e0a6f809096e300e3775d7b55..2ff1769c8f9bd301553935142ab8e30947d6f158 100644
--- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C
+++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C
@@ -34,13 +34,16 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(cellToFace, 0);
+    addToRunTimeSelectionTable(topoSetSource, cellToFace, word);
+    addToRunTimeSelectionTable(topoSetSource, cellToFace, istream);
 
-defineTypeNameAndDebug(cellToFace, 0);
-
-addToRunTimeSelectionTable(topoSetSource, cellToFace, word);
-
-addToRunTimeSelectionTable(topoSetSource, cellToFace, istream);
-
+    template<>
+    const char* Foam::NamedEnum<Foam::cellToFace::cellAction, 2>::names[] =
+    {
+        "all",
+        "both"
+    };
 }
 
 
@@ -52,13 +55,6 @@ Foam::topoSetSource::addToUsageTable Foam::cellToFace::usage_
     "           -both: faces where both neighbours are in the cellSet\n\n"
 );
 
-template<>
-const char* Foam::NamedEnum<Foam::cellToFace::cellAction, 2>::names[] =
-{
-    "all",
-    "both"
-};
-
 const Foam::NamedEnum<Foam::cellToFace::cellAction, 2>
     Foam::cellToFace::cellActionNames_;
 
diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C
index 51c7fb135120c16b68336428e53e03a28475e671..8e272b86dff4e720043331bbeed09e13c469a5ff 100644
--- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C
+++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C
@@ -33,13 +33,16 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(pointToFace, 0);
+    addToRunTimeSelectionTable(topoSetSource, pointToFace, word);
+    addToRunTimeSelectionTable(topoSetSource, pointToFace, istream);
 
-defineTypeNameAndDebug(pointToFace, 0);
-
-addToRunTimeSelectionTable(topoSetSource, pointToFace, word);
-
-addToRunTimeSelectionTable(topoSetSource, pointToFace, istream);
-
+    template<>
+    const char* Foam::NamedEnum<Foam::pointToFace::pointAction, 2>::names[] =
+    {
+        "any",
+        "all"
+    };
 }
 
 
@@ -52,13 +55,6 @@ Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_
     "    -all points in the pointSet\n\n"
 );
 
-template<>
-const char* Foam::NamedEnum<Foam::pointToFace::pointAction, 2>::names[] =
-{
-    "any",
-    "all"
-};
-
 const Foam::NamedEnum<Foam::pointToFace::pointAction, 2>
     Foam::pointToFace::pointActionNames_;
 
diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C
index aaa74c8493285c5aff2cb208f3e70b33cee0e3a4..5026b51cfc119cb0aebe2e9dc2d885bafe1a41cb 100644
--- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C
+++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C
@@ -33,13 +33,15 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(cellToPoint, 0);
+    addToRunTimeSelectionTable(topoSetSource, cellToPoint, word);
+    addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream);
 
-defineTypeNameAndDebug(cellToPoint, 0);
-
-addToRunTimeSelectionTable(topoSetSource, cellToPoint, word);
-
-addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream);
-
+    template<>
+    const char* Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>::names[] =
+    {
+        "all"
+    };
 }
 
 
@@ -50,12 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::cellToPoint::usage_
     "    Select all points of cells in the cellSet\n\n"
 );
 
-template<>
-const char* Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>::names[] =
-{
-    "all"
-};
-
 const Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>
     Foam::cellToPoint::cellActionNames_;
 
diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C
index ff1161b820878d36d47e9c390be8c713733c6022..4d0919f7c88b8a94b266c1e8c47c8093cd69a0f1 100644
--- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C
+++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C
@@ -33,13 +33,15 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(faceToPoint, 0);
+    addToRunTimeSelectionTable(topoSetSource, faceToPoint, word);
+    addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream);
 
-defineTypeNameAndDebug(faceToPoint, 0);
-
-addToRunTimeSelectionTable(topoSetSource, faceToPoint, word);
-
-addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream);
-
+    template<>
+    const char* Foam::NamedEnum<Foam::faceToPoint::faceAction, 1>::names[] =
+    {
+        "all"
+    };
 }
 
 
@@ -50,12 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_
     "    Select all points of faces in the faceSet\n\n"
 );
 
-template<>
-const char* Foam::NamedEnum<Foam::faceToPoint::faceAction, 1>::names[] =
-{
-    "all"
-};
-
 const Foam::NamedEnum<Foam::faceToPoint::faceAction, 1>
     Foam::faceToPoint::faceActionNames_;
 
diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.C b/src/meshTools/sets/topoSetSource/topoSetSource.C
index bb68be7e9ca57fae64c20350cb7fe97e63664279..f82cf59a90df57b0e3cb87a6a7463c90b617b386 100644
--- a/src/meshTools/sets/topoSetSource/topoSetSource.C
+++ b/src/meshTools/sets/topoSetSource/topoSetSource.C
@@ -34,24 +34,24 @@ 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_ = NULL;
 
-template<>
-const char* Foam::NamedEnum<Foam::topoSetSource::setAction, 8>::names[] =
-{
-    "clear",
-    "new",
-    "invert",
-    "add",
-    "delete",
-    "subset",
-    "list",
-    "remove"
-};
-
 
 const Foam::NamedEnum<Foam::topoSetSource::setAction, 8>
     Foam::topoSetSource::actionNames_;
diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
index 80d9c43651a05650720302b075b1b7e0c2c6c94c..accee92b3f77325c0fa0a54b06b94b3f4ba9610b 100644
--- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
+++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
@@ -49,17 +49,19 @@ namespace Foam
         distributedTriSurfaceMesh,
         dict
     );
-}
-
 
-template<>
-const char*
-Foam::NamedEnum<Foam::distributedTriSurfaceMesh::distributionType, 3>::names[] =
-{
-    "follow",
-    "independent",
-    "frozen"
-};
+    template<>
+    const char* Foam::NamedEnum
+    <
+        Foam::distributedTriSurfaceMesh::distributionType,
+        3
+    >::names[] =
+    {
+        "follow",
+        "independent",
+        "frozen"
+    };
+}
 
 const Foam::NamedEnum<Foam::distributedTriSurfaceMesh::distributionType, 3>
     Foam::distributedTriSurfaceMesh::distributionTypeNames_;
diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C
index 591bc36229c2d637022b4f4b8f1b5f4b96032919..ee3d6e4e8ae331cfd04a403cfff6429449d4fba6 100644
--- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C
+++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C
@@ -27,12 +27,16 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template<>
-const char* Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>::names[] =
+namespace Foam
 {
-    "iteration",
-    "time"
-};
+    template<>
+    const char* Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>::names[] =
+    {
+        "iteration",
+        "time"
+    };
+}
+
 
 const Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>
     Foam::fieldAverageItem::baseTypeNames_;
diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C
index eda5f7434f0e3f46f4b1da64c27f1fdaf23c6da8..c0f715e71621aafe1527f9b2c2a8363cd217812e 100644
--- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C
+++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C
@@ -33,13 +33,15 @@ License
 
 defineTypeNameAndDebug(Foam::fieldMinMax, 0);
 
-
-template<>
-const char* Foam::NamedEnum<Foam::fieldMinMax::modeType, 2>::names[] =
+namespace Foam
 {
-    "magnitude",
-    "component"
-};
+    template<>
+    const char* Foam::NamedEnum<Foam::fieldMinMax::modeType, 2>::names[] =
+    {
+        "magnitude",
+        "component"
+    };
+}
 
 
 const Foam::NamedEnum<Foam::fieldMinMax::modeType, 2>
diff --git a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C
index 49ae674ef6f2d4012804e7a122665728ed9c4247..f26f558fb50cac4044d1b74d51de43c1f9489a3d 100644
--- a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C
+++ b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C
@@ -37,13 +37,21 @@ defineTypeNameAndDebug(Foam::abortCalculation, 0);
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template<>
-const char* Foam::NamedEnum<Foam::abortCalculation::actionType, 3>::names[] =
+namespace Foam
 {
-    "noWriteNow",
-    "writeNow",
-    "nextWrite"
-};
+    template<>
+    const char* Foam::NamedEnum
+    <
+       Foam::abortCalculation::actionType,
+       3
+    >::names[] =
+    {
+        "noWriteNow",
+        "writeNow",
+        "nextWrite"
+    };
+}
+
 
 const Foam::NamedEnum<Foam::abortCalculation::actionType, 3>
     Foam::abortCalculation::actionTypeNames_;
diff --git a/src/sampling/sampledSet/coordSet/coordSet.C b/src/sampling/sampledSet/coordSet/coordSet.C
index bc1237f31085af77d3452e3f038f82315e924d1e..24d6b4174cadc7318b4fe72a2b944aa3f299721a 100644
--- a/src/sampling/sampledSet/coordSet/coordSet.C
+++ b/src/sampling/sampledSet/coordSet/coordSet.C
@@ -27,15 +27,19 @@ License
 
 // * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * * //
 
-template<>
-const char* Foam::NamedEnum<Foam::coordSet::coordFormat, 5>::names[] =
+namespace Foam
 {
-    "xyz",
-    "x",
-    "y",
-    "z",
-    "distance"
-};
+    template<>
+    const char* Foam::NamedEnum<Foam::coordSet::coordFormat, 5>::names[] =
+    {
+        "xyz",
+        "x",
+        "y",
+        "z",
+        "distance"
+    };
+}
+
 
 const Foam::NamedEnum<Foam::coordSet::coordFormat, 5>
     Foam::coordSet::coordFormatNames_;
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
index 1d030286cf989c2d48256fd86dfbc7bd1a8213da..53e2bdc5c8b05cb492814158f6ae9d7a99e2c490 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
+++ b/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
@@ -33,20 +33,20 @@ License
 namespace Foam
 {
     defineTypeNameAndDebug(alphaContactAngleFvPatchScalarField, 0);
-}
 
-template<>
-const char* Foam::NamedEnum
-<
-    Foam::alphaContactAngleFvPatchScalarField::limitControls,
-    4
->::names[] =
-{
-    "none",
-    "gradient",
-    "zeroGradient",
-    "alpha"
-};
+    template<>
+    const char* Foam::NamedEnum
+    <
+        Foam::alphaContactAngleFvPatchScalarField::limitControls,
+        4
+    >::names[] =
+    {
+        "none",
+        "gradient",
+        "zeroGradient",
+        "alpha"
+    };
+}
 
 const Foam::NamedEnum
 <