From f999013f416b83b981bc9622a9cc6035fd0f21f6 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Sun, 25 Oct 2020 21:45:21 +0100
Subject: [PATCH] ENH: use static to define default blockMesh verbosity

- make handling of verbosity more consistent.

  Make all setter return the old value, remove (unused) default
  parameter as being counter-intuitive.  This makes it easier to
  restore the original values.

  For example,

     const bool oldVerbose = sampler.verbose(false);
     ...
     sampler.verbose(oldVerbose);
---
 src/functionObjects/field/Curle/Curle.C       |  2 +-
 .../surfaceFieldValue/surfaceFieldValue.C     |  2 +-
 .../utilities/areaWrite/areaWrite.C           | 10 +++++---
 .../utilities/areaWrite/areaWrite.H           |  5 ++--
 .../FacePostProcessing/FacePostProcessing.C   |  4 +--
 .../ParticleCollector/ParticleCollector.C     |  2 +-
 src/mesh/blockMesh/blockMesh/blockMesh.C      | 10 +++++---
 src/mesh/blockMesh/blockMesh/blockMesh.H      | 25 ++++++++++++++-----
 src/mesh/blockMesh/blockMesh/blockMeshCheck.C |  4 +--
 .../blockMesh/blockMesh/blockMeshCreate.C     | 14 +++++------
 .../blockMesh/blockMeshMergeGeometrical.C     |  8 +++---
 .../blockMesh/blockMeshMergeTopological.C     |  8 +++---
 .../blockMesh/blockMesh/blockMeshTopology.C   | 12 ++++-----
 .../blockVertices/blockVertex/blockVertex.C   | 10 ++++----
 .../blockVertices/blockVertex/blockVertex.H   |  4 +--
 .../noiseModels/surfaceNoise/surfaceNoise.C   |  2 +-
 .../sampledSet/sampledSets/sampledSets.C      |  8 +++---
 .../sampledSet/sampledSets/sampledSets.H      |  5 ++--
 .../sampledSurfaces/sampledSurfaces.C         | 14 ++++++-----
 .../sampledSurfaces/sampledSurfaces.H         |  5 ++--
 src/surfMesh/writers/surfaceWriter.H          | 10 +++++++-
 src/surfMesh/writers/surfaceWriterI.H         | 18 ++++++++++++-
 22 files changed, 115 insertions(+), 67 deletions(-)

diff --git a/src/functionObjects/field/Curle/Curle.C b/src/functionObjects/field/Curle/Curle.C
index b2494706680..ad5c382efba 100644
--- a/src/functionObjects/field/Curle/Curle.C
+++ b/src/functionObjects/field/Curle/Curle.C
@@ -169,7 +169,7 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict)
             );
 
             // Use outputDir/TIME/surface-name
-            surfaceWriterPtr_->useTimeDir() = true;
+            surfaceWriterPtr_->useTimeDir(true);
         }
     }
 
diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C
index bfc8baaddaf..1d7cd88a296 100644
--- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C
+++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C
@@ -969,7 +969,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
 
         if (debug)
         {
-            surfaceWriterPtr_->verbose() = true;
+            surfaceWriterPtr_->verbose(true);
         }
 
         if (surfaceWriterPtr_->enabled())
diff --git a/src/functionObjects/utilities/areaWrite/areaWrite.C b/src/functionObjects/utilities/areaWrite/areaWrite.C
index eb70b9c835b..7b21d4f8a9c 100644
--- a/src/functionObjects/utilities/areaWrite/areaWrite.C
+++ b/src/functionObjects/utilities/areaWrite/areaWrite.C
@@ -109,9 +109,11 @@ Foam::areaWrite::areaWrite
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void Foam::areaWrite::verbose(const bool verbosity)
+bool Foam::areaWrite::verbose(const bool on)
 {
-    verbose_ = verbosity;
+    bool old(verbose_);
+    verbose_ = on;
+    return old;
 }
 
 
@@ -188,8 +190,8 @@ bool Foam::areaWrite::read(const dictionary& dict)
         auto surfWriter = surfaceWriter::New(writerType, writerOptions);
 
         // Use outputDir/TIME/surface-name
-        surfWriter->useTimeDir() = true;
-        surfWriter->verbose() = verbose_;
+        surfWriter->useTimeDir(true);
+        surfWriter->verbose(verbose_);
 
         writers_.set(areaName, surfWriter);
     }
diff --git a/src/functionObjects/utilities/areaWrite/areaWrite.H b/src/functionObjects/utilities/areaWrite/areaWrite.H
index aa645f5c974..832bc00f321 100644
--- a/src/functionObjects/utilities/areaWrite/areaWrite.H
+++ b/src/functionObjects/utilities/areaWrite/areaWrite.H
@@ -205,8 +205,9 @@ public:
 
     // Member Functions
 
-        //- Set verbosity level
-        void verbose(const bool verbosity = true);
+        //- Enable/disable verbose output
+        //  \return old value
+        bool verbose(const bool on);
 
         //- Read the areaWrite dictionary
         virtual bool read(const dictionary& dict);
diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
index a5e187ca062..40a455ff642 100644
--- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
+++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2016-2019 OpenCFD Ltd.
+    Copyright (C) 2016-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -204,7 +204,7 @@ void Foam::FacePostProcessing<CloudType>::write()
 
                 if (debug)
                 {
-                    writer->verbose() = true;
+                    writer->verbose(true);
                 }
 
                 writer->open
diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C
index 351160e3053..ecafb4fc5bb 100644
--- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C
+++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C
@@ -474,7 +474,7 @@ void Foam::ParticleCollector<CloudType>::write()
 
         if (debug)
         {
-            writer->verbose() = true;
+            writer->verbose(true);
         }
 
         writer->open
diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.C b/src/mesh/blockMesh/blockMesh/blockMesh.C
index 3cedbba951e..ef0c90f1dac 100644
--- a/src/mesh/blockMesh/blockMesh/blockMesh.C
+++ b/src/mesh/blockMesh/blockMesh/blockMesh.C
@@ -36,6 +36,8 @@ namespace Foam
     defineDebugSwitch(blockMesh, 0);
 }
 
+bool Foam::blockMesh::verboseOutput = true;
+
 
 const Foam::Enum<Foam::blockMesh::mergeStrategy>
 Foam::blockMesh::strategyNames_
@@ -55,7 +57,7 @@ Foam::blockMesh::blockMesh
 )
 :
     meshDict_(dict),
-    verboseOutput(meshDict_.getOrDefault("verbose", true)),
+    verbose_(meshDict_.getOrDefault("verbose", verboseOutput)),
     checkFaceCorrespondence_
     (
         meshDict_.getOrDefault("checkFaceCorrespondence", true)
@@ -117,14 +119,14 @@ bool Foam::blockMesh::valid() const noexcept
 
 bool Foam::blockMesh::verbose() const noexcept
 {
-    return verboseOutput;
+    return verbose_;
 }
 
 
 bool Foam::blockMesh::verbose(const bool on) noexcept
 {
-    bool old(verboseOutput);
-    verboseOutput = on;
+    bool old(verbose_);
+    verbose_ = on;
     return old;
 }
 
diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H
index a082ff6c21c..ec55f4a20fe 100644
--- a/src/mesh/blockMesh/blockMesh/blockMesh.H
+++ b/src/mesh/blockMesh/blockMesh/blockMesh.H
@@ -63,7 +63,8 @@ SourceFiles
 #define blockMesh_H
 
 #include "Enum.H"
-#include "blockList.H"
+#include "block.H"
+#include "PtrList.H"
 #include "searchableSurfaces.H"
 #include "polyMesh.H"
 #include "IOdictionary.H"
@@ -82,10 +83,16 @@ namespace Foam
 
 class blockMesh
 :
-    public blockList
+    public PtrList<block>
 {
 public:
 
+    // Typedefs
+
+        //- The list of blocks is stored as a PtrList
+        typedef PtrList<block> blockList;
+
+
     // Data Types
 
         //- The block merging strategy
@@ -110,8 +117,8 @@ private:
         //- Reference to mesh dictionary
         const IOdictionary& meshDict_;
 
-        //- Switch for verbose output
-        bool verboseOutput;
+        //- Output verbosity
+        bool verbose_;
 
         //- Switch checking face consistency (defaults to true)
         bool checkFaceCorrespondence_;
@@ -218,6 +225,12 @@ private:
 
 public:
 
+    // Static Data
+
+        //- The default verbosity (true)
+        static bool verboseOutput;
+
+
     //- Runtime type information
     ClassName("blockMesh");
 
@@ -301,10 +314,10 @@ public:
 
     // Verbosity
 
-        //- Verbose information?
+        //- Verbose output
         bool verbose() const noexcept;
 
-        //- Enable/disable verbose information about the progress
+        //- Enable/disable verbose output
         //  \return old value
         bool verbose(const bool on) noexcept;
 
diff --git a/src/mesh/blockMesh/blockMesh/blockMeshCheck.C b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C
index 6f688e916b2..e38c73ec6ef 100644
--- a/src/mesh/blockMesh/blockMesh/blockMeshCheck.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C
@@ -143,7 +143,7 @@ void Foam::blockMesh::check(const polyMesh& bm, const dictionary& dict) const
     }
 
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< nl << tab << "Basic statistics" << nl
             << tab << tab << "Number of internal faces : "
@@ -219,7 +219,7 @@ void Foam::blockMesh::check(const polyMesh& bm, const dictionary& dict) const
         }
     }
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< endl;
     }
diff --git a/src/mesh/blockMesh/blockMesh/blockMeshCreate.C b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C
index 8d93b69b872..4f7657e61ce 100644
--- a/src/mesh/blockMesh/blockMesh/blockMeshCreate.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C
@@ -36,7 +36,7 @@ void Foam::blockMesh::createPoints() const
 {
     const blockList& blocks = *this;
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating points with scale " << scaleFactor_ << endl;
     }
@@ -47,7 +47,7 @@ void Foam::blockMesh::createPoints() const
     {
         const pointField& blockPoints = blocks[blocki].points();
 
-        if (verboseOutput)
+        if (verbose_)
         {
             const label nx = blocks[blocki].density().x();
             const label ny = blocks[blocki].density().y();
@@ -102,7 +102,7 @@ void Foam::blockMesh::createCells() const
     const blockList& blocks = *this;
     const cellModel& hex = cellModel::ref(cellModel::HEX);
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating cells" << endl;
     }
@@ -257,7 +257,7 @@ void Foam::blockMesh::createPatches() const
 {
     const polyPatchList& topoPatches = topology().boundaryMesh();
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating patches" << endl;
     }
@@ -278,7 +278,7 @@ Foam::blockMesh::mesh(const IOobject& io) const
 {
     const blockMesh& blkMesh = *this;
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< nl << "Creating polyMesh from blockMesh" << endl;
     }
@@ -303,7 +303,7 @@ Foam::blockMesh::mesh(const IOobject& io) const
     {
         polyMesh& pmesh = *meshPtr;
 
-        if (verboseOutput)
+        if (verbose_)
         {
             Info<< "Adding cell zones" << endl;
         }
@@ -340,7 +340,7 @@ Foam::blockMesh::mesh(const IOobject& io) const
                     zoneMap.insert(zoneName, zonei);
                     ++freeZonei;
 
-                    if (verboseOutput)
+                    if (verbose_)
                     {
                         Info<< "    " << zonei << '\t' << zoneName << endl;
                     }
diff --git a/src/mesh/blockMesh/blockMesh/blockMeshMergeGeometrical.C b/src/mesh/blockMesh/blockMesh/blockMeshMergeGeometrical.C
index fe59b12d449..7071290a989 100644
--- a/src/mesh/blockMesh/blockMesh/blockMeshMergeGeometrical.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshMergeGeometrical.C
@@ -34,7 +34,7 @@ void Foam::blockMesh::calcGeometricalMerge()
 {
     const blockList& blocks = *this;
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating block offsets" << endl;
     }
@@ -53,7 +53,7 @@ void Foam::blockMesh::calcGeometricalMerge()
     }
 
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating merge list (geometric search).." << flush;
     }
@@ -407,7 +407,7 @@ void Foam::blockMesh::calcGeometricalMerge()
                 }
             }
         }
-        if (verboseOutput)
+        if (verbose_)
         {
             Info<< '.' << flush;
         }
@@ -421,7 +421,7 @@ void Foam::blockMesh::calcGeometricalMerge()
     }
     while (changedPointMerge);
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< endl;
     }
diff --git a/src/mesh/blockMesh/blockMesh/blockMeshMergeTopological.C b/src/mesh/blockMesh/blockMesh/blockMeshMergeTopological.C
index 743877a77c7..15c3e518686 100644
--- a/src/mesh/blockMesh/blockMesh/blockMeshMergeTopological.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshMergeTopological.C
@@ -308,7 +308,7 @@ void Foam::blockMesh::calcTopologicalMerge()
 
     const blockList& blocks = *this;
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating block offsets" << endl;
     }
@@ -326,7 +326,7 @@ void Foam::blockMesh::calcTopologicalMerge()
         nCells_  += blocks[blocki].nCells();
     }
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating merge list (topological search).." << flush;
     }
@@ -547,7 +547,7 @@ void Foam::blockMesh::calcTopologicalMerge()
             }
         }
 
-        if (verboseOutput)
+        if (verbose_)
         {
             Info<< '.' << flush;
         }
@@ -561,7 +561,7 @@ void Foam::blockMesh::calcTopologicalMerge()
 
     } while (changedPointMerge);
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< endl;
     }
diff --git a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
index ae2c3b0f6dd..994149d53e9 100644
--- a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
@@ -369,7 +369,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::blockMesh::createTopology
     // Read the block edges
     if (meshDescription.found("edges"))
     {
-        if (verboseOutput)
+        if (verbose_)
         {
             Info<< "Creating block edges" << endl;
         }
@@ -382,7 +382,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::blockMesh::createTopology
 
         edges_.transfer(edges);
     }
-    else if (verboseOutput)
+    else if (verbose_)
     {
         Info<< "No non-linear block edges defined" << endl;
     }
@@ -391,7 +391,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::blockMesh::createTopology
     // Read the block faces
     if (meshDescription.found("faces"))
     {
-        if (verboseOutput)
+        if (verbose_)
         {
             Info<< "Creating block faces" << endl;
         }
@@ -404,14 +404,14 @@ Foam::autoPtr<Foam::polyMesh> Foam::blockMesh::createTopology
 
         faces_.transfer(faces);
     }
-    else if (verboseOutput)
+    else if (verbose_)
     {
         Info<< "No non-planar block faces defined" << endl;
     }
 
 
     // Create the blocks
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating topology blocks" << endl;
     }
@@ -430,7 +430,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::blockMesh::createTopology
 
     // Create the patches
 
-    if (verboseOutput)
+    if (verbose_)
     {
         Info<< "Creating topology patches" << endl;
     }
diff --git a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C
index cb0bdb00c43..05c2809bd3e 100644
--- a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C
+++ b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C
@@ -41,10 +41,6 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::blockVertex::blockVertex()
-{}
-
-
 Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::clone() const
 {
     NotImplemented;
@@ -103,7 +99,11 @@ Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New
 }
 
 
-Foam::label Foam::blockVertex::read(Istream& is, const dictionary& dict)
+Foam::label Foam::blockVertex::read
+(
+    Istream& is,
+    const dictionary& dict
+)
 {
     const dictionary* varDictPtr = dict.findDict("namedVertices");
     if (varDictPtr)
diff --git a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H
index 937f4eb212d..c85adddd12f 100644
--- a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H
+++ b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H
@@ -76,8 +76,8 @@ public:
 
     // Constructors
 
-        //- Construct null
-        blockVertex();
+        //- Default construct
+        blockVertex() noexcept = default;
 
         //- Clone function
         virtual autoPtr<blockVertex> clone() const;
diff --git a/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C
index 8c0b4bd8861..a3d4bd79bbe 100644
--- a/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C
+++ b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C
@@ -456,7 +456,7 @@ bool surfaceNoise::read(const dictionary& dict)
         );
 
         // Use outputDir/TIME/surface-name
-        writerPtr_->useTimeDir() = true;
+        writerPtr_->useTimeDir(true);
 
         return true;
     }
diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C
index 7197f1da552..965cad242f0 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSets.C
+++ b/src/sampling/sampledSet/sampledSets/sampledSets.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2015-2018 OpenCFD Ltd.
+    Copyright (C) 2015-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -150,9 +150,11 @@ Foam::sampledSets::sampledSets
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void Foam::sampledSets::verbose(const bool verbosity)
+bool Foam::sampledSets::verbose(const bool on)
 {
-    verbose_ = verbosity;
+    bool old(verbose_);
+    verbose_ = on;
+    return old;
 }
 
 
diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H
index eb24be8505f..0f38753b7d2 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSets.H
+++ b/src/sampling/sampledSet/sampledSets/sampledSets.H
@@ -283,8 +283,9 @@ public:
 
     // Member Functions
 
-        //- Set verbosity level
-        void verbose(const bool verbosity = true);
+        //- Enable/disable verbose output
+        //  \return old value
+        bool verbose(const bool on);
 
         //- Read the sampledSets
         virtual bool read(const dictionary&);
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
index 48b65330f9e..0c880736302 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
@@ -270,9 +270,11 @@ Foam::sampledSurfaces::sampledSurfaces
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void Foam::sampledSurfaces::verbose(const bool verbosity)
+bool Foam::sampledSurfaces::verbose(const bool on)
 {
-    verbose_ = verbosity;
+    bool old(verbose_);
+    verbose_ = on;
+    return old;
 }
 
 
@@ -361,8 +363,8 @@ bool Foam::sampledSurfaces::read(const dictionary& dict)
             writers_[surfi].isPointData() = surfs[surfi].interpolate();
 
             // Use outputDir/TIME/surface-name
-            writers_[surfi].useTimeDir() = true;
-            writers_[surfi].verbose() = verbose_;
+            writers_[surfi].useTimeDir(true);
+            writers_[surfi].verbose(verbose_);
 
             ++surfi;
         }
@@ -427,8 +429,8 @@ bool Foam::sampledSurfaces::read(const dictionary& dict)
             writers_[surfi].isPointData() = surfs[surfi].interpolate();
 
             // Use outputDir/TIME/surface-name
-            writers_[surfi].useTimeDir() = true;
-            writers_[surfi].verbose() = verbose_;
+            writers_[surfi].useTimeDir(true);
+            writers_[surfi].verbose(verbose_);
 
             ++surfi;
         }
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
index 8b1c82752f0..83508206a4b 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
@@ -348,8 +348,9 @@ public:
 
     // Member Functions
 
-        //- Set verbosity level
-        void verbose(const bool verbosity = true);
+        //- Enable/disable verbose output
+        //  \return old value
+        bool verbose(const bool on);
 
         //- Read the sampledSurfaces dictionary
         virtual bool read(const dictionary& dict);
diff --git a/src/surfMesh/writers/surfaceWriter.H b/src/surfMesh/writers/surfaceWriter.H
index c1142e88b86..2b18143c18a 100644
--- a/src/surfMesh/writers/surfaceWriter.H
+++ b/src/surfMesh/writers/surfaceWriter.H
@@ -391,13 +391,21 @@ public:
         //- Should a time directory be spliced into the output path?
         inline bool useTimeDir() const;
 
+        //- Enable/disable use of spliced output path
+        //  \return old value
+        inline bool useTimeDir(const bool on);
+
         //- Change handling of spliced output path.
         inline bool& useTimeDir();
 
         //- Get output verbosity
         inline bool verbose() const;
 
-        //- Set output verbosity
+        //- Enable/disable verbose output
+        //  \return old value
+        inline bool verbose(const bool on);
+
+        //- Access output verbosity
         inline bool& verbose();
 
         //- The current value of the point merge dimension (metre)
diff --git a/src/surfMesh/writers/surfaceWriterI.H b/src/surfMesh/writers/surfaceWriterI.H
index c42d1e7495d..b344a186939 100644
--- a/src/surfMesh/writers/surfaceWriterI.H
+++ b/src/surfMesh/writers/surfaceWriterI.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019 OpenCFD Ltd.
+    Copyright (C) 2019-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -57,6 +57,14 @@ inline bool Foam::surfaceWriter::useTimeDir() const
 }
 
 
+inline bool Foam::surfaceWriter::useTimeDir(const bool on)
+{
+    bool old(useTimeDir_);
+    useTimeDir_ = on;
+    return old;
+}
+
+
 inline bool& Foam::surfaceWriter::useTimeDir()
 {
     return useTimeDir_;
@@ -69,6 +77,14 @@ inline bool Foam::surfaceWriter::verbose() const
 }
 
 
+inline bool Foam::surfaceWriter::verbose(const bool on)
+{
+    bool old(verbose_);
+    verbose_ = on;
+    return old;
+}
+
+
 inline bool& Foam::surfaceWriter::verbose()
 {
     return verbose_;
-- 
GitLab