From cce74d493b7d4ac06b644b8555d3219ea3a4eb54 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 11 Jul 2017 14:57:05 +0200
Subject: [PATCH] ENH: remove deprecated ensight output order (issue #523)

- Added for transition purposes only in 1612 but can now be removed.
---
 .../foamToEnsight/foamToEnsight.C             | 11 -------
 etc/config.sh/bashcompletion                  |  2 +-
 src/conversion/ensight/mesh/ensightMesh.H     | 12 -------
 src/conversion/ensight/mesh/ensightMeshI.H    |  6 ----
 src/conversion/ensight/mesh/ensightMeshIO.C   | 22 -------------
 .../ensight/mesh/ensightMeshOptions.C         | 13 --------
 src/conversion/ensight/output/ensightOutput.H |  3 +-
 .../ensight/output/ensightOutputTemplates.C   | 31 ++-----------------
 8 files changed, 4 insertions(+), 96 deletions(-)

diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
index bf15ffef0aa..e95296e1b5f 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
@@ -61,9 +61,6 @@ Usage
       - \par -width \<n\>
         Width of EnSight data subdir (default: 8)
 
-      - \par -deprecatedOrder
-        Use older ordering for volume cells (hex prism pyr tet poly)
-
 Note
     Writes to \a EnSight directory to avoid collisions with
     foamToEnsightParts
@@ -181,13 +178,6 @@ int main(int argc, char *argv[])
         "n",
         "width of ensight data subdir"
     );
-    argList::addBoolOption
-    (
-        "deprecatedOrder",
-        "Use old ordering (hex prism pyr tet poly) "
-        "instead of the ascending number of points "
-        "(tet pyr prism hex poly)."
-    );
 
     // The volume field types that we handle
     const hashedWordList volFieldTypes
@@ -261,7 +251,6 @@ int main(int argc, char *argv[])
     //
     ensightMesh::options writeOpts(format);
     writeOpts.noPatches(args.optionFound("noPatches"));
-    writeOpts.deprecatedOrder(args.optionFound("deprecatedOrder"));
 
     if (args.optionFound("patches"))
     {
diff --git a/etc/config.sh/bashcompletion b/etc/config.sh/bashcompletion
index 77f8612599f..c2589be81f9 100644
--- a/etc/config.sh/bashcompletion
+++ b/etc/config.sh/bashcompletion
@@ -2309,7 +2309,7 @@ _of_foamToEnsight()
     local cur="${COMP_WORDS[COMP_CWORD]}"
     local prev="${COMP_WORDS[COMP_CWORD-1]}"
 
-    local opts="-ascii -constant -deprecatedOrder -latestTime -newTimes -noFunctionObjects -noLagrangian -noPatches -noZero -nodeValues -parallel -srcDoc -doc -help "
+    local opts="-ascii -constant -latestTime -newTimes -noFunctionObjects -noLagrangian -noPatches -noZero -nodeValues -parallel -srcDoc -doc -help "
     local optsWithArgs="-case -cellZone -decomposeParDict -faceZones -fields -name -patches -region -roots -time -width "
 
     case ${prev} in
diff --git a/src/conversion/ensight/mesh/ensightMesh.H b/src/conversion/ensight/mesh/ensightMesh.H
index 41ebb07aa77..120a1b59a31 100644
--- a/src/conversion/ensight/mesh/ensightMesh.H
+++ b/src/conversion/ensight/mesh/ensightMesh.H
@@ -293,9 +293,6 @@ public:
         //- Using internalMesh?
         inline bool useInternalMesh() const;
 
-        //- Using deprecated order? (hex prism pyr tet poly)
-        inline bool deprecatedOrder() const;
-
         //- The volume cells (internalMesh)
         inline const ensightCells& meshCells() const;
 
@@ -369,9 +366,6 @@ class ensightMesh::options
     //- Suppress patches
     bool noPatches_;
 
-    //- Using deprecated order (hex prism pyr tet poly)
-    bool deprecatedOrder_;
-
     //- Output selected patches only
     autoPtr<wordReList> patchPatterns_;
 
@@ -399,9 +393,6 @@ public:
         //- Using internalMesh?
         bool useInternalMesh() const;
 
-        //- Using deprecated order? (hex prism pyr tet poly)
-        bool deprecatedOrder() const;
-
         //- Using patches?
         bool usePatches() const;
 
@@ -426,9 +417,6 @@ public:
         //- Lazy creation - ensightMesh starts as needsUpdate.
         void lazy(const bool);
 
-        //- Alter deprecated order.
-        void deprecatedOrder(const bool);
-
         //- Alter the patches/no-patches state
         void noPatches(const bool);
 
diff --git a/src/conversion/ensight/mesh/ensightMeshI.H b/src/conversion/ensight/mesh/ensightMeshI.H
index 1f0bc4a1466..8213182e274 100644
--- a/src/conversion/ensight/mesh/ensightMeshI.H
+++ b/src/conversion/ensight/mesh/ensightMeshI.H
@@ -49,12 +49,6 @@ inline bool Foam::ensightMesh::useInternalMesh() const
 }
 
 
-inline bool Foam::ensightMesh::deprecatedOrder() const
-{
-    return options_->deprecatedOrder();
-}
-
-
 inline const Foam::ensightCells& Foam::ensightMesh::meshCells() const
 {
     return meshCells_;
diff --git a/src/conversion/ensight/mesh/ensightMeshIO.C b/src/conversion/ensight/mesh/ensightMeshIO.C
index 213fd57eb5a..037b8d98a2d 100644
--- a/src/conversion/ensight/mesh/ensightMeshIO.C
+++ b/src/conversion/ensight/mesh/ensightMeshIO.C
@@ -452,28 +452,6 @@ void Foam::ensightMesh::writeCellConnectivity
     ensightGeoFile& os
 ) const
 {
-    if (deprecatedOrder())
-    {
-        // element ordering used in older versions
-        ensightCells::elemType oldOrder[5] =
-        {
-            ensightCells::HEXA8,
-            ensightCells::PENTA6,
-            ensightCells::PYRAMID5,
-            ensightCells::TETRA4,
-            ensightCells::NFACED
-        };
-
-        for (label typei=0; typei < ensightCells::nTypes; ++typei)
-        {
-            const ensightCells::elemType& what = oldOrder[typei];
-
-            writeCellConnectivity(what, ensCells, pointToGlobal, os);
-        }
-
-        return;
-    }
-
     for (label typei=0; typei < ensightCells::nTypes; ++typei)
     {
         const ensightCells::elemType what = ensightCells::elemType(typei);
diff --git a/src/conversion/ensight/mesh/ensightMeshOptions.C b/src/conversion/ensight/mesh/ensightMeshOptions.C
index ea89d439939..d2a91851728 100644
--- a/src/conversion/ensight/mesh/ensightMeshOptions.C
+++ b/src/conversion/ensight/mesh/ensightMeshOptions.C
@@ -33,7 +33,6 @@ Foam::ensightMesh::options::options(IOstream::streamFormat format)
     format_(format),
     lazy_(false),
     noPatches_(false),
-    deprecatedOrder_(false),
     patchPatterns_(),
     faceZonePatterns_()
 {}
@@ -59,12 +58,6 @@ bool Foam::ensightMesh::options::useInternalMesh() const
 }
 
 
-bool Foam::ensightMesh::options::deprecatedOrder() const
-{
-    return deprecatedOrder_;
-}
-
-
 bool Foam::ensightMesh::options::usePatches() const
 {
     return !noPatches_;
@@ -97,12 +90,6 @@ void Foam::ensightMesh::options::lazy(const bool b)
 }
 
 
-void Foam::ensightMesh::options::deprecatedOrder(const bool b)
-{
-    deprecatedOrder_ = b;
-}
-
-
 void Foam::ensightMesh::options::noPatches(const bool b)
 {
     noPatches_ = b;
diff --git a/src/conversion/ensight/output/ensightOutput.H b/src/conversion/ensight/output/ensightOutput.H
index 1f33b3f8304..bdead411f4f 100644
--- a/src/conversion/ensight/output/ensightOutput.H
+++ b/src/conversion/ensight/output/ensightOutput.H
@@ -91,8 +91,7 @@ class ensightOutput
     (
         const Field<Type>& fld,
         const ensightCells&,
-        ensightFile& os,
-        const bool deprecatedOrder = false
+        ensightFile& os
     );
 
 
diff --git a/src/conversion/ensight/output/ensightOutputTemplates.C b/src/conversion/ensight/output/ensightOutputTemplates.C
index 2ce1af6cd79..a29fa3ea584 100644
--- a/src/conversion/ensight/output/ensightOutputTemplates.C
+++ b/src/conversion/ensight/output/ensightOutputTemplates.C
@@ -171,8 +171,7 @@ bool Foam::ensightOutput::writeCellField
 (
     const Field<Type>& vf,
     const ensightCells& ensCells,
-    ensightFile& os,
-    const bool deprecatedOrder
+    ensightFile& os
 )
 {
     if (ensCells.total())
@@ -182,32 +181,6 @@ bool Foam::ensightOutput::writeCellField
             os.beginPart(ensCells.index());
         }
 
-        if (deprecatedOrder)
-        {
-            // element ordering used in older versions
-            ensightCells::elemType oldOrder[5] =
-            {
-                ensightCells::HEXA8,
-                ensightCells::PENTA6,
-                ensightCells::PYRAMID5,
-                ensightCells::TETRA4,
-                ensightCells::NFACED
-            };
-
-            for (label typei=0; typei < ensightCells::nTypes; ++typei)
-            {
-                const ensightCells::elemType& what = oldOrder[typei];
-
-                writeFieldContent
-                (
-                    ensightCells::key(what),
-                    Field<Type>(vf, ensCells.cellIds(what)),
-                    os
-                );
-            }
-            return true;
-        }
-
         for (label typei=0; typei < ensightCells::nTypes; ++typei)
         {
             const ensightCells::elemType what = ensightCells::elemType(typei);
@@ -248,7 +221,7 @@ bool Foam::ensightOutput::writeField
     //
     if (ensMesh.useInternalMesh())
     {
-        writeCellField(vf, meshCells, os, ensMesh.deprecatedOrder());
+        writeCellField(vf, meshCells, os);
     }
 
     //
-- 
GitLab