From 6d695062946e7ee7fbce7eabfd81bf55a027f3d9 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 15 Mar 2024 13:06:55 +0100
Subject: [PATCH] STYLE: adjust comments and iterator de-reference

STYLE: replace PackedListCore.H with in-file definition
---
 .../containers/Bits/PackedList/PackedList.H   | 22 +++++-
 .../Bits/PackedList/PackedListCore.C          |  2 +-
 .../Bits/PackedList/PackedListCore.H          | 70 +------------------
 .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C | 14 ++--
 .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H |  5 +-
 src/dynamicMesh/polyMeshAdder/polyMeshAdder.C |  2 +-
 6 files changed, 32 insertions(+), 83 deletions(-)

diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H
index e0e3fc6c6c1..cc88ba4c38c 100644
--- a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H
+++ b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H
@@ -83,8 +83,9 @@ See also
     Foam::DynamicList
 
 SourceFiles
-    PackedListI.H
     PackedList.C
+    PackedListCore.C
+    PackedListI.H
     PackedListIO.C
 
 \*---------------------------------------------------------------------------*/
@@ -92,11 +93,11 @@ SourceFiles
 #ifndef Foam_PackedList_H
 #define Foam_PackedList_H
 
+#include "className.H"
 #include "BitOps.H"
 #include "labelList.H"
 #include "IndirectListBase.H"
 #include "InfoProxy.H"
-#include "PackedListCore.H"
 
 #include <type_traits>
 
@@ -119,6 +120,23 @@ template<unsigned Width>
 Ostream& operator<<(Ostream& os, const InfoProxy<PackedList<Width>>& info);
 
 
+/*---------------------------------------------------------------------------*\
+                   Class Detail::PackedListCore Declaration
+\*---------------------------------------------------------------------------*/
+
+namespace Detail
+{
+
+//- Template-invariant parts for PackedList
+struct PackedListCore
+{
+    //- Define template name
+    ClassNameNoDebug("PackedList");
+};
+
+} // End namespace Detail
+
+
 /*---------------------------------------------------------------------------*\
                          Class PackedList Declaration
 \*---------------------------------------------------------------------------*/
diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.C b/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.C
index d17c6a29064..075f4e6754c 100644
--- a/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.C
+++ b/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.C
@@ -25,7 +25,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "PackedListCore.H"
+#include "PackedList.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.H b/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.H
index 8a564c47d95..7cec1b4541d 100644
--- a/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.H
+++ b/src/OpenFOAM/containers/Bits/PackedList/PackedListCore.H
@@ -1,69 +1 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | www.openfoam.com
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-    Copyright (C) 2018 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-Class
-    Foam::Detail::PackedListCore
-
-Description
-    Implementation of template-invariant details for Foam::PackedList
-
-SourceFiles
-    PackedListCore.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef PackedListCore_H
-#define PackedListCore_H
-
-#include "className.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace Detail
-{
-
-/*---------------------------------------------------------------------------*\
-                   Class Detail::PackedListCore Declaration
-\*---------------------------------------------------------------------------*/
-
-//- Template-invariant parts for PackedList
-struct PackedListCore
-{
-    //- Define template name
-    ClassNameNoDebug("PackedList");
-};
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Detail
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
+#warning File removed - left for old dependency check only
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C
index 9fa134061a9..f45bcd7be95 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C
@@ -96,7 +96,7 @@ void Foam::ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
                 {
                     map.insert(id, zonei);
                 }
-                else if (fnd() != zonei)
+                else if (fnd.val() != zonei)
                 {
                     // Multiple zones for same id
 
@@ -112,7 +112,7 @@ void Foam::ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
                               : static_cast<const labelList&>(zn)
                             )
                             {
-                                maxIndex = max(maxIndex, id);
+                                maxIndex = Foam::max(maxIndex, id);
                             }
                         }
                         additionalMapPtr_.reset(new labelListList(maxIndex+1));
@@ -135,7 +135,7 @@ void Foam::ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
 
                 if (zones.size())
                 {
-                    stableSort(zones);
+                    Foam::stableSort(zones);
                     const label zonei = map[id];
                     const label index = findLower(zones, zonei);
                     if (index == -1)
@@ -426,11 +426,11 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::whichZones
 ) const
 {
     zones.clear();
-    const auto fnd = zoneMap().find(objectIndex);
+    const auto fnd = zoneMap().cfind(objectIndex);
     if (fnd)
     {
         // Add main element
-        zones.push_back(fnd());
+        zones.push_back(fnd.val());
         if (additionalMapPtr_)
         {
             const auto& additionalMap = *additionalMapPtr_;
@@ -967,7 +967,7 @@ bool Foam::ZoneMesh<ZoneType, MeshType>::checkParallelSync
     const bool report
 ) const
 {
-    if (!Pstream::parRun())
+    if (!UPstream::parRun())
     {
         return false;
     }
@@ -1025,7 +1025,7 @@ bool Foam::ZoneMesh<ZoneType, MeshType>::checkParallelSync
             {
                 hasError = true;
 
-                if (debug || (report && Pstream::master()))
+                if (debug || (report && UPstream::master()))
                 {
                     Info<< " ***Zone " << zn.name()
                         << " of type " << zn.type()
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
index fa6d3eb0435..c729327a400 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H
@@ -194,9 +194,8 @@ public:
         //  If object does not belong to any zones, return -1
         label whichZone(const label objectIndex) const;
 
-        //- Given a global object index, return (in argument) the zones it is
-        //  in. Returns number of zones (0 if object does not belong to any
-        //  zones)
+        //- Given a global object index, return (in argument) its zones.
+        //  Returns number of zones (0 if object does not belong to any zones)
         label whichZones
         (
             const label objectIndex,
diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
index d5634a7cccb..a2ff8326812 100644
--- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
+++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
@@ -2817,7 +2817,7 @@ void Foam::polyMeshAdder::add
                 if (newNei < newOwn)
                 {
                     std::swap(newOwn, newNei);
-                    newFace = newFace.reverseFace();
+                    newFace.flip();
                     flipFaceFlux = !flipFaceFlux;
                     for (bool& flip : flips)
                     {
-- 
GitLab