From ff05ae19210ef69f3d4e24bb25099c24db7ee928 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 30 Oct 2018 12:01:36 +0000
Subject: [PATCH] ENH: consistency update for box topoSetSources (#1060)

- "boxes" has precedence over "box" (similar to treatment of "zones"
  vs "zone")
---
 src/meshTools/sets/cellSources/boxToCell/boxToCell.C    | 7 ++-----
 src/meshTools/sets/cellSources/boxToCell/boxToCell.H    | 9 +++++----
 src/meshTools/sets/faceSources/boxToFace/boxToFace.C    | 7 ++-----
 src/meshTools/sets/faceSources/boxToFace/boxToFace.H    | 9 +++++----
 src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C | 7 ++-----
 src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H | 9 +++++----
 6 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C
index 7714d038da..377a36d455 100644
--- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C
+++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C
@@ -87,15 +87,12 @@ Foam::boxToCell::boxToCell
     topoSetSource(mesh),
     bbs_()
 {
-    if (dict.found("box"))
+    // Look for 'boxes' or 'box'
+    if (!dict.readIfPresent("boxes", bbs_))
     {
         bbs_.resize(1);
         dict.readEntry("box", bbs_.first());
     }
-    else
-    {
-        dict.readEntry("boxes", bbs_);
-    }
 }
 
 
diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H
index 7360bd0e90..ce69cda4eb 100644
--- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H
+++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H
@@ -29,13 +29,14 @@ Description
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        box         | A single bounding box             | partly    |
-        boxes       | Multiple bounding boxes           | partly    |
+        Property    | Description                           | Required | Default
+        box         | A single bounding box                 | partly   |
+        boxes       | Multiple bounding boxes               | partly   |
     \endtable
 
 Note
-    Must specify either "box" or "boxes"
+    Must specify either "box" or "boxes".
+    The selection of multiple boxes has precedence.
 
 SourceFiles
     boxToCell.C
diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C
index c589fcecb0..2c388468c6 100644
--- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C
+++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C
@@ -87,15 +87,12 @@ Foam::boxToFace::boxToFace
     topoSetSource(mesh),
     bbs_()
 {
-    if (dict.found("box"))
+    // Look for 'boxes' or 'box'
+    if (!dict.readIfPresent("boxes", bbs_))
     {
         bbs_.resize(1);
         dict.readEntry("box", bbs_.first());
     }
-    else
-    {
-        dict.readEntry("boxes", bbs_);
-    }
 }
 
 
diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H
index 6a9bc01cea..96c17c4e83 100644
--- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H
+++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H
@@ -29,13 +29,14 @@ Description
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        box         | A single bounding box             | partly    |
-        boxes       | Multiple bounding boxes           | partly    |
+        Property    | Description                           | Required | Default
+        box         | A single bounding box                 | partly   |
+        boxes       | Multiple bounding boxes               | partly   |
     \endtable
 
 Note
-    Must specify either "box" or "boxes"
+    Must specify either "box" or "boxes".
+    The selection of multiple boxes has precedence.
 
 SourceFiles
     boxToFace.C
diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C
index b907152dcc..3987f7373a 100644
--- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C
+++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C
@@ -87,15 +87,12 @@ Foam::boxToPoint::boxToPoint
     topoSetSource(mesh),
     bbs_()
 {
-    if (dict.found("box"))
+    // Look for 'boxes' or 'box'
+    if (!dict.readIfPresent("boxes", bbs_))
     {
         bbs_.resize(1);
         dict.readEntry("box", bbs_.first());
     }
-    else
-    {
-        dict.readEntry("boxes", bbs_);
-    }
 }
 
 
diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H
index 474c1538ff..545418f257 100644
--- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H
+++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H
@@ -29,13 +29,14 @@ Description
 
     \heading Dictionary parameters
     \table
-        Property    | Description                       | Required  | Default
-        box         | A single bounding box             | partly    |
-        boxes       | Multiple bounding boxes           | partly    |
+        Property    | Description                           | Required | Default
+        box         | A single bounding box                 | partly   |
+        boxes       | Multiple bounding boxes               | partly   |
     \endtable
 
 Note
-    Must specify either "box" or "boxes"
+    Must specify either "box" or "boxes".
+    The selection of multiple boxes has precedence.
 
 SourceFiles
     boxToPoint.C
-- 
GitLab