From c0af2297837358e6a45b050a08da81c5e3722e7e Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Thu, 19 Oct 2023 20:01:39 +0200
Subject: [PATCH] STYLE: avoid deprecated dictionary methods

---
 .../cartesian2DMeshGenerator/cartesian2DMeshGenerator.C   | 2 +-
 .../cartesianMeshGenerator/cartesianMeshGenerator.C       | 8 ++------
 meshLibrary/tetMesh/tetMeshGenerator/tetMeshGenerator.C   | 6 +-----
 .../coordinateModification/boxScaling.C                   | 6 +++---
 .../refineBoundaryLayers/refineBoundaryLayers.C           | 2 +-
 .../meshes/polyMeshGen/boundaryPatch/boundaryPatchBase.C  | 8 ++++----
 .../polyMeshGen/boundaryPatch/processorBoundaryPatch.C    | 4 ++--
 .../meshOctreeAddressing/meshOctreeAddressing.C           | 6 +++---
 .../meshOctreeAddressing/meshOctreeAddressingCreation.C   | 2 +-
 .../meshOctreeAddressing/meshOctreeAddressingGluedMesh.C  | 2 +-
 .../meshOctreeAutomaticRefinement.C                       | 4 ++--
 .../voronoiMeshGenerator/voronoiMeshGenerator.C           | 6 +-----
 12 files changed, 22 insertions(+), 34 deletions(-)

diff --git a/meshLibrary/cartesian2DMesh/cartesian2DMeshGenerator/cartesian2DMeshGenerator.C b/meshLibrary/cartesian2DMesh/cartesian2DMeshGenerator/cartesian2DMeshGenerator.C
index ee39d569..b976e817 100644
--- a/meshLibrary/cartesian2DMesh/cartesian2DMeshGenerator/cartesian2DMeshGenerator.C
+++ b/meshLibrary/cartesian2DMesh/cartesian2DMeshGenerator/cartesian2DMeshGenerator.C
@@ -63,7 +63,7 @@ void Foam::Module::cartesian2DMeshGenerator::createCartesianMesh()
 
     if
     (
-        meshDict_.lookupOrDefault<bool>
+        meshDict_.getOrDefault<bool>
         (
             "decomposePolyhedraIntoTetsAndPyrs",
             false
diff --git a/meshLibrary/cartesianMesh/cartesianMeshGenerator/cartesianMeshGenerator.C b/meshLibrary/cartesianMesh/cartesianMeshGenerator/cartesianMeshGenerator.C
index 32717bed..675dbcde 100644
--- a/meshLibrary/cartesianMesh/cartesianMeshGenerator/cartesianMeshGenerator.C
+++ b/meshLibrary/cartesianMesh/cartesianMeshGenerator/cartesianMeshGenerator.C
@@ -64,7 +64,7 @@ void Foam::Module::cartesianMeshGenerator::createCartesianMesh()
 
     if
     (
-        meshDict_.lookupOrDefault<bool>
+        meshDict_.getOrDefault<bool>
         (
             "decomposePolyhedraIntoTetsAndPyrs",
             false
@@ -177,11 +177,7 @@ void Foam::Module::cartesianMeshGenerator::optimiseFinalMesh()
 {
     // untangle the surface if needed
     const bool enforceConstraints =
-        meshDict_.lookupOrDefault<bool>
-        (
-            "enforceGeometryConstraints",
-            false
-        );
+        meshDict_.getOrDefault<bool>("enforceGeometryConstraints", false);
 
     if (true)
     {
diff --git a/meshLibrary/tetMesh/tetMeshGenerator/tetMeshGenerator.C b/meshLibrary/tetMesh/tetMeshGenerator/tetMeshGenerator.C
index d9bcfcd7..b2b5ebde 100644
--- a/meshLibrary/tetMesh/tetMeshGenerator/tetMeshGenerator.C
+++ b/meshLibrary/tetMesh/tetMeshGenerator/tetMeshGenerator.C
@@ -149,11 +149,7 @@ void Foam::Module::tetMeshGenerator::optimiseFinalMesh()
 {
     // final optimisation
     const bool enforceConstraints =
-        meshDict_.lookupOrDefault<bool>
-        (
-            "enforceGeometryConstraints",
-            false
-        );
+        meshDict_.getOrDefault<bool>("enforceGeometryConstraints", false);
 
     meshOptimizer optimizer(mesh_);
     if (enforceConstraints)
diff --git a/meshLibrary/utilities/anisotropicMeshing/coordinateModification/boxScaling.C b/meshLibrary/utilities/anisotropicMeshing/coordinateModification/boxScaling.C
index 44889f08..23222f6b 100644
--- a/meshLibrary/utilities/anisotropicMeshing/coordinateModification/boxScaling.C
+++ b/meshLibrary/utilities/anisotropicMeshing/coordinateModification/boxScaling.C
@@ -301,9 +301,9 @@ void Foam::Module::boxScaling::operator=(const dictionary& d)
         lengthVec_.z() = 0.0;
     }
 
-    scaleVec_.x() = dict.lookupOrDefault<scalar>("scaleX", 1.0);
-    scaleVec_.y() = dict.lookupOrDefault<scalar>("scaleY", 1.0);
-    scaleVec_.z() = dict.lookupOrDefault<scalar>("scaleZ", 1.0);
+    scaleVec_.x() = dict.getOrDefault<scalar>("scaleX", 1.0);
+    scaleVec_.y() = dict.getOrDefault<scalar>("scaleY", 1.0);
+    scaleVec_.z() = dict.getOrDefault<scalar>("scaleZ", 1.0);
 
     calculateBndBox();
 }
diff --git a/meshLibrary/utilities/boundaryLayers/refineBoundaryLayers/refineBoundaryLayers.C b/meshLibrary/utilities/boundaryLayers/refineBoundaryLayers/refineBoundaryLayers.C
index 0a28efbd..33272040 100644
--- a/meshLibrary/utilities/boundaryLayers/refineBoundaryLayers/refineBoundaryLayers.C
+++ b/meshLibrary/utilities/boundaryLayers/refineBoundaryLayers/refineBoundaryLayers.C
@@ -499,7 +499,7 @@ void Foam::Module::refineBoundaryLayers::readSettings
 
                     if
                     (
-                        patchDict.lookupOrDefault<bool>
+                        patchDict.getOrDefault<bool>
                         (
                             "allowDiscontinuity",
                             false
diff --git a/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/boundaryPatchBase.C b/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/boundaryPatchBase.C
index a15447d3..d1818a26 100644
--- a/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/boundaryPatchBase.C
+++ b/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/boundaryPatchBase.C
@@ -63,7 +63,7 @@ Foam::Module::boundaryPatchBase::New
     const dictionary& dict
 )
 {
-    word type(dict.lookup("type"));
+    word type(dict.get<word>("type"));
 
     // Check patch type - allowed types are processor and patch
     // Other patch types are treated as ordinary patches
@@ -125,9 +125,9 @@ Foam::Module::boundaryPatchBase::boundaryPatchBase
 )
 :
     name_(name),
-    type_(dict.lookup("type")),
-    nFaces_(readLabel(dict.lookup("nFaces"))),
-    startFace_(readLabel(dict.lookup("startFace")))
+    type_(dict.get<word>("type")),
+    nFaces_(dict.get<label>("nFaces")),
+    startFace_(dict.get<label>("startFace"))
 {}
 
 
diff --git a/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/processorBoundaryPatch.C b/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/processorBoundaryPatch.C
index 96176637..d6bbeeec 100644
--- a/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/processorBoundaryPatch.C
+++ b/meshLibrary/utilities/meshes/polyMeshGen/boundaryPatch/processorBoundaryPatch.C
@@ -79,8 +79,8 @@ Foam::Module::processorBoundaryPatch::processorBoundaryPatch
 )
 :
     boundaryPatchBase(name, dict),
-    myProcNo_(readLabel(dict.lookup("myProcNo"))),
-    neighbProcNo_(readLabel(dict.lookup("neighbProcNo")))
+    myProcNo_(dict.get<label>("myProcNo")),
+    neighbProcNo_(dict.get<label>("neighbProcNo"))
 {}
 
 
diff --git a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressing.C b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressing.C
index 75ca5fc9..fff27187 100644
--- a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressing.C
+++ b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressing.C
@@ -142,12 +142,12 @@ Foam::Module::meshOctreeAddressing::meshOctreeAddressing
     globalLeafToLocalPtr_(nullptr),
     leafAtProcsPtr_(nullptr)
 {
-    if (!useDATABoxes && dict.found("keepCellsIntersectingBoundary"))
+    if (!useDATABoxes_)
     {
-        useDATABoxes_ = readBool(dict.lookup("keepCellsIntersectingBoundary"));
+        dict.readIfPresent("keepCellsIntersectingBoundary", useDATABoxes_);
     }
 
-    if (dict.lookupOrDefault<bool>("nonManifoldMeshing", false))
+    if (dict.getOrDefault<bool>("nonManifoldMeshing", false))
     {
         useDATABoxes_ = true;
     }
diff --git a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingCreation.C b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingCreation.C
index a0e54b72..c4793956 100644
--- a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingCreation.C
+++ b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingCreation.C
@@ -520,7 +520,7 @@ void Foam::Module::meshOctreeAddressing::findUsedBoxes() const
             boxType[leafI] |= MESHCELL;
     }
 
-    if (meshDict_.lookupOrDefault<bool>("nonManifoldMeshing", false))
+    if (meshDict_.getOrDefault<bool>("nonManifoldMeshing", false))
     {
         # ifdef USE_OMP
         # pragma omp parallel for schedule(dynamic, 40)
diff --git a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingGluedMesh.C b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingGluedMesh.C
index b28153bc..2cd4b010 100644
--- a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingGluedMesh.C
+++ b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAddressing/meshOctreeAddressingGluedMesh.C
@@ -41,7 +41,7 @@ void Foam::Module::meshOctreeAddressing::checkGluedRegions()
     if
     (
         !useDATABoxes_
-     || !meshDict_.lookupOrDefault<bool>("checkForGluedMesh", false)
+     || !meshDict_.getOrDefault<bool>("checkForGluedMesh", false)
     )
     {
         return;
diff --git a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C
index bc928e9c..3c92da69 100644
--- a/meshLibrary/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C
+++ b/meshLibrary/utilities/octrees/meshOctree/meshOctreeAutomaticRefinement/meshOctreeAutomaticRefinement.C
@@ -180,9 +180,9 @@ Foam::Module::meshOctreeAutomaticRefinement::meshOctreeAutomaticRefinement
     curvaturePtr_(nullptr),
     maxRefLevel_(0)
 {
-    if (!useDATABoxes_ && dict.found("keepCellsIntersectingBoundary"))
+    if (!useDATABoxes_)
     {
-        useDATABoxes_ = readBool(dict.lookup("keepCellsIntersectingBoundary"));
+        dict.readIfPresent("keepCellsIntersectingBoundary", useDATABoxes_);
     }
 
     // calculate maximum allowed refinement level from the minimum cell size
diff --git a/meshLibrary/voronoiMesh/voronoiMeshGenerator/voronoiMeshGenerator.C b/meshLibrary/voronoiMesh/voronoiMeshGenerator/voronoiMeshGenerator.C
index 32278f79..d684b78d 100644
--- a/meshLibrary/voronoiMesh/voronoiMeshGenerator/voronoiMeshGenerator.C
+++ b/meshLibrary/voronoiMesh/voronoiMeshGenerator/voronoiMeshGenerator.C
@@ -208,11 +208,7 @@ void Foam::Module::voronoiMeshGenerator::optimiseFinalMesh()
 {
     // untangle the surface if needed
     const bool enforceConstraints =
-        meshDict_.lookupOrDefault<bool>
-        (
-            "enforceGeometryConstraints",
-            false
-        );
+        meshDict_.getOrDefault<bool>("enforceGeometryConstraints", false);
 
     if (true)
     {
-- 
GitLab