From 18b632e71dcf9e43af0e4ad3a78a144f589165e5 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Sun, 12 Jun 2016 22:32:15 +0100
Subject: [PATCH] Utilities patchAverage and patchIntegrate replaced by
 postProcess

e.g.
    postProcess -func 'patchAverage(name=inlet,p)'
    postProcess -func 'patchIntegrate(name=inlet,p)'
---
 .../patch/patchAverage/Make/files             |   3 -
 .../patch/patchAverage/Make/options           |   8 -
 .../patch/patchAverage/patchAverage.C         | 147 ----------
 .../patch/patchIntegrate/Make/files           |   3 -
 .../patch/patchIntegrate/Make/options         |   8 -
 .../patch/patchIntegrate/patchIntegrate.C     | 255 ------------------
 .../postProcessing/postProcess/postProcess.C  |   3 +
 bin/patchAverage                              |  37 +++
 bin/patchIntegrate                            |  37 +++
 .../postProcessing/surfaceRegion/patchAverage |   2 -
 .../surfaceRegion/patchIntegrate              |   2 -
 .../functionObject/functionObject.C           |  16 +-
 .../functionObject/functionObject.H           |   9 +-
 .../functionObjectList/postProcess.H          |   3 +
 .../regionFunctionObject.C                    |  10 +-
 .../regionFunctionObject.H                    |   4 -
 16 files changed, 106 insertions(+), 441 deletions(-)
 delete mode 100644 applications/utilities/postProcessing/patch/patchAverage/Make/files
 delete mode 100644 applications/utilities/postProcessing/patch/patchAverage/Make/options
 delete mode 100644 applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
 delete mode 100644 applications/utilities/postProcessing/patch/patchIntegrate/Make/files
 delete mode 100644 applications/utilities/postProcessing/patch/patchIntegrate/Make/options
 delete mode 100644 applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
 create mode 100755 bin/patchAverage
 create mode 100755 bin/patchIntegrate

diff --git a/applications/utilities/postProcessing/patch/patchAverage/Make/files b/applications/utilities/postProcessing/patch/patchAverage/Make/files
deleted file mode 100644
index 4d17c39ce18..00000000000
--- a/applications/utilities/postProcessing/patch/patchAverage/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-patchAverage.C
-
-EXE = $(FOAM_APPBIN)/patchAverage
diff --git a/applications/utilities/postProcessing/patch/patchAverage/Make/options b/applications/utilities/postProcessing/patch/patchAverage/Make/options
deleted file mode 100644
index 318e1be8f4d..00000000000
--- a/applications/utilities/postProcessing/patch/patchAverage/Make/options
+++ /dev/null
@@ -1,8 +0,0 @@
-EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude
-
-EXE_LIBS = \
-    -lgenericPatchFields \
-    -lfiniteVolume \
-    -lmeshTools
diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
deleted file mode 100644
index 0d79e42b8ac..00000000000
--- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
+++ /dev/null
@@ -1,147 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-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/>.
-
-Application
-    patchAverage
-
-Description
-    Calculates the average of the specified field over the specified patch.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-template<class FieldType>
-void printAverage
-(
-    const fvMesh& mesh,
-    const IOobject& fieldHeader,
-    const scalar area,
-    const label patchi,
-    bool& done
-)
-{
-    if (!done && fieldHeader.headerClassName() == FieldType::typeName)
-    {
-        Info<< "    Reading " << fieldHeader.headerClassName() << " "
-            << fieldHeader.name() << endl;
-
-        FieldType field(fieldHeader, mesh);
-
-        typename FieldType::value_type sumField =
-            Zero;
-
-        if (area > 0)
-        {
-            sumField = gSum
-            (
-                mesh.magSf().boundaryField()[patchi]
-              * field.boundaryField()[patchi]
-            ) / area;
-        }
-
-        Info<< "    Average of " << fieldHeader.headerClassName()
-            << " over patch "
-            << mesh.boundary()[patchi].name()
-            << '[' << patchi << ']' << " = "
-            << sumField << endl;
-
-        done = true;
-    }
-}
-
-
-
-int main(int argc, char *argv[])
-{
-    timeSelector::addOptions();
-    #include "addRegionOption.H"
-    argList::validArgs.append("fieldName");
-    argList::validArgs.append("patchName");
-    #include "setRootCase.H"
-    #include "createTime.H"
-    instantList timeDirs = timeSelector::select0(runTime, args);
-    #include "createNamedMesh.H"
-
-    const word fieldName = args[1];
-    const word patchName = args[2];
-
-    forAll(timeDirs, timeI)
-    {
-        runTime.setTime(timeDirs[timeI], timeI);
-        Info<< "Time = " << runTime.timeName() << endl;
-
-        IOobject io
-        (
-            fieldName,
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ
-        );
-
-        // Check field exists
-        if (io.headerOk())
-        {
-            mesh.readUpdate();
-
-            const label patchi = mesh.boundaryMesh().findPatchID(patchName);
-            if (patchi < 0)
-            {
-                FatalError
-                    << "Unable to find patch " << patchName << nl
-                    << exit(FatalError);
-            }
-            scalar area = gSum(mesh.magSf().boundaryField()[patchi]);
-
-            bool done = false;
-            printAverage<volScalarField>(mesh, io, area, patchi, done);
-            printAverage<volVectorField>(mesh, io, area, patchi, done);
-            printAverage<volSphericalTensorField>(mesh, io, area, patchi, done);
-            printAverage<volSymmTensorField>(mesh, io, area, patchi, done);
-            printAverage<volTensorField>(mesh, io, area, patchi, done);
-
-            if (!done)
-            {
-                FatalError
-                    << "Only possible to average volFields."
-                    << " Field " << fieldName << " is of type "
-                    << io.headerClassName()
-                    << nl << exit(FatalError);
-            }
-        }
-        else
-        {
-            Info<< "    No field " << fieldName << endl;
-        }
-
-        Info<< endl;
-    }
-
-    Info<< "End\n" << endl;
-
-    return 0;
-}
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/Make/files b/applications/utilities/postProcessing/patch/patchIntegrate/Make/files
deleted file mode 100644
index 6595b6a7ff5..00000000000
--- a/applications/utilities/postProcessing/patch/patchIntegrate/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-patchIntegrate.C
-
-EXE = $(FOAM_APPBIN)/patchIntegrate
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/Make/options b/applications/utilities/postProcessing/patch/patchIntegrate/Make/options
deleted file mode 100644
index 318e1be8f4d..00000000000
--- a/applications/utilities/postProcessing/patch/patchIntegrate/Make/options
+++ /dev/null
@@ -1,8 +0,0 @@
-EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude
-
-EXE_LIBS = \
-    -lgenericPatchFields \
-    -lfiniteVolume \
-    -lmeshTools
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
deleted file mode 100644
index 61cecad4415..00000000000
--- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
+++ /dev/null
@@ -1,255 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-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/>.
-
-Application
-    patchIntegrate
-
-Description
-    Calculates the integral of the specified field over the specified patch.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-template<class FieldType>
-void printIntegrate
-(
-    const fvMesh& mesh,
-    const IOobject& fieldHeader,
-    const label patchi,
-    bool& done
-)
-{
-    if (!done && fieldHeader.headerClassName() == FieldType::typeName)
-    {
-        Info<< "    Reading " << fieldHeader.headerClassName() << " "
-            << fieldHeader.name() << endl;
-
-        FieldType field(fieldHeader, mesh);
-
-        Info<< "    Integral of " << fieldHeader.name()
-            << " over vector area of patch "
-            << mesh.boundary()[patchi].name() << '[' << patchi << ']' << " = "
-            << gSum
-               (
-                   mesh.Sf().boundaryField()[patchi]
-                  *field.boundaryField()[patchi]
-               )
-            << nl;
-
-        Info<< "    Integral of " << fieldHeader.name()
-            << " over area magnitude of patch "
-            << mesh.boundary()[patchi].name() << '[' << patchi << ']' << " = "
-            << gSum
-               (
-                   mesh.magSf().boundaryField()[patchi]
-                  *field.boundaryField()[patchi]
-               )
-            << nl;
-
-        done = true;
-    }
-}
-
-
-template<class FieldType>
-void printSum
-(
-    const fvMesh& mesh,
-    const IOobject& fieldHeader,
-    const label patchi,
-    bool& done
-)
-{
-    if (!done && fieldHeader.headerClassName() == FieldType::typeName)
-    {
-        Info<< "    Reading " << FieldType::typeName << " "
-            << fieldHeader.name() << endl;
-
-        FieldType field(fieldHeader, mesh);
-        typename FieldType::value_type sumField = gSum
-        (
-            field.boundaryField()[patchi]
-        );
-
-        Info<< "    Integral of " << fieldHeader.name() << " over patch "
-            << mesh.boundary()[patchi].name() << '[' << patchi << ']' << " = "
-            << sumField << nl;
-
-        done = true;
-    }
-}
-
-
-
-int main(int argc, char *argv[])
-{
-    timeSelector::addOptions();
-    #include "addRegionOption.H"
-    argList::validArgs.append("fieldName");
-    argList::validArgs.append("patchName");
-    #include "setRootCase.H"
-    #include "createTime.H"
-    instantList timeDirs = timeSelector::select0(runTime, args);
-    #include "createNamedMesh.H"
-
-    const word fieldName = args[1];
-    const word patchName = args[2];
-
-    forAll(timeDirs, timeI)
-    {
-        runTime.setTime(timeDirs[timeI], timeI);
-        Info<< "Time = " << runTime.timeName() << endl;
-
-        IOobject fieldHeader
-        (
-            fieldName,
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ
-        );
-
-        // Check field exists
-        if (fieldHeader.headerOk())
-        {
-            mesh.readUpdate();
-
-            const label patchi = mesh.boundaryMesh().findPatchID(patchName);
-            if (patchi < 0)
-            {
-                FatalError
-                    << "Unable to find patch " << patchName << nl
-                    << exit(FatalError);
-            }
-
-            // Give patch area
-            Info<< "    Area vector of patch "
-                << patchName << '[' << patchi << ']' << " = "
-                << gSum(mesh.Sf().boundaryField()[patchi]) << endl;
-            Info<< "    Area magnitude of patch "
-                << patchName << '[' << patchi << ']' << " = "
-                << gSum(mesh.magSf().boundaryField()[patchi]) << endl;
-
-            // Read field and calc integral
-            bool done = false;
-            printIntegrate<volScalarField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-            printIntegrate<volVectorField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-
-            //- No tensor integrations
-            //printIntegrate<volSphericalTensorField>
-            //(
-            //    mesh,
-            //    fieldHeader,
-            //    patchi,
-            //    done
-            //);
-            //printIntegrate<volSymmTensorField>
-            //(
-            //    mesh,
-            //    fieldHeader,
-            //    patchi,
-            //    done
-            //);
-            //printIntegrate<volTensorField>
-            //(
-            //    mesh,
-            //    fieldHeader,
-            //    patchi,
-            //    done
-            //);
-
-            printSum<surfaceScalarField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-            printSum<surfaceVectorField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-            printSum<volSphericalTensorField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-            printSum<volSymmTensorField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-            printSum<volTensorField>
-            (
-                mesh,
-                fieldHeader,
-                patchi,
-                done
-            );
-
-            if (!done)
-            {
-                FatalError
-                    << "Only possible to integrate "
-                    << "volFields and surfaceFields."
-                    << " Field " << fieldName << " is of type "
-                    << fieldHeader.headerClassName()
-                    << nl << exit(FatalError);
-            }
-        }
-        else
-        {
-            Info<< "    No field " << fieldName << endl;
-        }
-
-        Info<< endl;
-    }
-
-    Info<< "End\n" << endl;
-
-    return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C
index 335006d17cc..3b3878d4ba4 100644
--- a/applications/utilities/postProcessing/postProcess/postProcess.C
+++ b/applications/utilities/postProcessing/postProcess/postProcess.C
@@ -128,6 +128,9 @@ int main(int argc, char *argv[])
     #include "addRegionOption.H"
     #include "addFunctionObjectOptions.H"
 
+    // Set functionObject post-processing mode
+    functionObject::postProcess = true;
+
     #include "setRootCase.H"
 
     if (args.optionFound("list"))
diff --git a/bin/patchAverage b/bin/patchAverage
new file mode 100755
index 00000000000..bd15b518c65
--- /dev/null
+++ b/bin/patchAverage
@@ -0,0 +1,37 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2016 OpenFOAM Foundation
+#    \\/     M anipulation  |
+#-------------------------------------------------------------------------------
+# 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/>.
+#
+# Script
+#     patchAverage
+#
+# Description
+#     Script to suggest using the new "postProcess" utility.
+#
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+echo $Script "has been superceded by the postProcess utility:"
+echo "postProcess -func '"$Script"(name=inlet,p)'"
+
+#------------------------------------------------------------------------------
diff --git a/bin/patchIntegrate b/bin/patchIntegrate
new file mode 100755
index 00000000000..72c6021441f
--- /dev/null
+++ b/bin/patchIntegrate
@@ -0,0 +1,37 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2016 OpenFOAM Foundation
+#    \\/     M anipulation  |
+#-------------------------------------------------------------------------------
+# 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/>.
+#
+# Script
+#     patchIntegrate
+#
+# Description
+#     Script to suggest using the new "postProcess" utility.
+#
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+echo $Script "has been superceded by the postProcess utility:"
+echo "postProcess -func '"$Script"(name=inlet,p)'"
+
+#------------------------------------------------------------------------------
diff --git a/etc/caseDicts/postProcessing/surfaceRegion/patchAverage b/etc/caseDicts/postProcessing/surfaceRegion/patchAverage
index 8f042fa96ca..2a1bda2fc98 100644
--- a/etc/caseDicts/postProcessing/surfaceRegion/patchAverage
+++ b/etc/caseDicts/postProcessing/surfaceRegion/patchAverage
@@ -17,8 +17,6 @@ patchAverage
 
     operation average;
     #includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg"
-
-    log    true;
 }
 
 
diff --git a/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate b/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate
index 1c86de23283..41b24735310 100644
--- a/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate
+++ b/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate
@@ -17,8 +17,6 @@ patchIntegrate
 
     operation areaIntegrate;
     #includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg"
-
-    log    true;
 }
 
 
diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C
index 965cafff506..c0cd27a9738 100644
--- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C
+++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C
@@ -36,12 +36,15 @@ namespace Foam
     defineRunTimeSelectionTable(functionObject, dictionary);
 }
 
+bool Foam::functionObject::postProcess(false);
+
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::functionObject::functionObject(const word& name)
 :
-    name_(name)
+    name_(name),
+    log(postProcess)
 {}
 
 
@@ -120,6 +123,17 @@ const Foam::word& Foam::functionObject::name() const
 }
 
 
+bool Foam::functionObject::read(const dictionary& dict)
+{
+    if (!postProcess)
+    {
+        log = dict.lookupOrDefault<Switch>("log", true);
+    }
+
+    return true;
+}
+
+
 bool Foam::functionObject::end()
 {
     return execute() && write();
diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H
index 7958dc37d22..74457227aa2 100644
--- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H
+++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H
@@ -112,6 +112,7 @@ SourceFiles
 
 #include "typeInfo.H"
 #include "autoPtr.H"
+#include "Switch.H"
 #include "runTimeSelectionTables.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -152,6 +153,12 @@ public:
 
     static int debug;
 
+    //- Global post-processing mode switch
+    static bool postProcess;
+
+    //- Switch write log to Info
+    Switch log;
+
 
     // Declare run-time constructor selection tables
 
@@ -199,7 +206,7 @@ public:
         const word& name() const;
 
         //- Read and set the function object if its data have changed
-        virtual bool read(const dictionary&) = 0;
+        virtual bool read(const dictionary&);
 
         //- Called at each ++ or += of the time-loop.
         //  postProcess overrides the usual executeControl behaviour and
diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
index d264ebf4914..09a3b0d9534 100644
--- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
+++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
@@ -73,6 +73,9 @@ if (argList::postProcess(argc, argv))
     #include "addRegionOption.H"
     #include "addFunctionObjectOptions.H"
 
+    // Set functionObject post-processing mode
+    functionObject::postProcess = true;
+
     #include "setRootCase.H"
 
     if (args.optionFound("list"))
diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C
index d4cef191672..c010855bcee 100644
--- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C
+++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C
@@ -105,8 +105,7 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
         (
             dict.lookupOrDefault("region", polyMesh::defaultRegion)
         )
-    ),
-    log(true)
+    )
 {}
 
 
@@ -119,8 +118,7 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
 :
     functionObject(name),
     time_(obr.time()),
-    obr_(obr),
-    log(true)
+    obr_(obr)
 {}
 
 
@@ -134,9 +132,7 @@ Foam::functionObjects::regionFunctionObject::~regionFunctionObject()
 
 bool Foam::functionObjects::regionFunctionObject::read(const dictionary& dict)
 {
-    log = dict.lookupOrDefault<Switch>("log", true);
-
-    return true;
+    return functionObject::read(dict);
 }
 
 
diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H
index dcdb7b7f445..928ad04abdc 100644
--- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H
+++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H
@@ -40,7 +40,6 @@ SourceFiles
 #define functionObjects_regionFunctionObject_H
 
 #include "functionObject.H"
-#include "Switch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -115,9 +114,6 @@ public:
     //- Runtime type information
     TypeName("regionFunctionObject");
 
-    //- Switch write log to Info
-    Switch log;
-
 
     // Constructors
 
-- 
GitLab