From 85c164340e7b458dadb01a728df73e18f740a74b Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Mon, 21 Jul 2008 16:40:05 +0200
Subject: [PATCH] Added IOobject::readOption to IOOutputFilter

 - allows post-processing functions with an optional dictionary
   (eg, the developer can hard-wire some defaults)
---
 .../sampling/probeLocations/probeLocations.C  |  2 +-
 .../postProcessing/sampling/sample/sample.C   | 81 ++++++++++---------
 .../IOOutputFilter/IOOutputFilter.C           |  3 +-
 .../IOOutputFilter/IOOutputFilter.H           |  4 +-
 4 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
index 920f2516567..4e960a7415b 100644
--- a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
+++ b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
     instantList timeDirs = timeSelector::select0(runTime, args);
 #   include "createMesh.H"
 
-    IOprobes sniff(mesh, "probesDict", true);
+    IOprobes sniff(mesh, "probesDict", IOobject::MUST_READ, true);
 
     forAll(timeDirs, timeI)
     {
diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C
index 1cc9115dbaa..f2b27de8ead 100644
--- a/applications/utilities/postProcessing/sampling/sample/sample.C
+++ b/applications/utilities/postProcessing/sampling/sample/sample.C
@@ -28,39 +28,39 @@ Description
 
     Keywords:
 
-    setFormat: set output format, choice of
-        xmgr
-        jplot
-        gnuplot
-        raw
-
-    surfaceFormat: surface output format, choice of
-        null        : suppress output
-        foamFile    : separate points, faces and values file
-        dx          : DX scalar or vector format
-        vtk         : VTK ascii format
-        raw         : x y z value format for use with e.g. gnuplot 'splot'.
-        stl         : ascii stl. Does not contain values!
-
-    interpolationScheme: interpolation scheme, choice of
-        cell          : use cell-centre value; constant over cells (default)
-        cellPoint     : use cell-centre and vertex values
-   	    cellPointFace : use cell-centre, vertex and face values.
-          1] vertex values determined from neighbouring cell-centre values
-          2] face values determined using the current face interpolation scheme
-             for the field (linear, limitedLinear, etc.)
-
-    fields: list of fields to sample
-
-    sets: list of sets to sample, choice of
-        uniform             evenly distributed points on line
-        face                one point per face intersection
-        midPoint            one point per cell, inbetween two face intersections
-        midPointAndFace     combination of face and midPoint
-
-        curve               specified points, not nessecary on line, uses
+    @param setFormat : set output format, choice of \n
+      - xmgr
+      - jplot
+      - gnuplot
+      - raw
+
+    @param surfaceFormat : surface output format, choice of \n
+      - null        : suppress output
+      - foamFile    : separate points, faces and values file
+      - dx          : DX scalar or vector format
+      - vtk         : VTK ascii format
+      - raw         : x y z value format for use with e.g. gnuplot 'splot'.
+      - stl         : ascii stl. Does not contain values!
+
+    @param interpolationScheme : interpolation scheme, choice of \n
+      - cell          : use cell-centre value; constant over cells (default)
+      - cellPoint     : use cell-centre and vertex values
+      - cellPointFace : use cell-centre, vertex and face values. \n
+        -# vertex values determined from neighbouring cell-centre values
+        -# face values determined using the current face interpolation scheme
+           for the field (linear, limitedLinear, etc.)
+
+    @param fields : list of fields to sample
+
+    @param sets : list of sets to sample, choice of \n
+      - uniform             evenly distributed points on line
+      - face                one point per face intersection
+      - midPoint            one point per cell, inbetween two face intersections
+      - midPointAndFace     combination of face and midPoint
+
+      - curve               specified points, not nessecary on line, uses
                             tracking
-        cloud               specified points, uses findCell
+      - cloud               specified points, uses findCell
 
         Option axis: how to write point coordinate. Choice of
           - x/y/z: x/y/z coordinate only
@@ -74,11 +74,12 @@ Description
             uniform: extra number of sampling points
             curve, cloud: list of coordinates
 
-    surfaces: list of surfaces to sample, choice of
-        plane : values on plane defined by point, normal.
-        patch : values on patch.
+    @param surfaces : list of surfaces to sample, choice of \n
+      - plane : values on plane defined by point, normal.
+      - patch : values on patch.
 
-    Runs in parallel.
+Notes
+    Runs in parallel
 
 \*---------------------------------------------------------------------------*/
 
@@ -100,8 +101,8 @@ int main(int argc, char *argv[])
     instantList timeDirs = timeSelector::select0(runTime, args);
 #   include "createMesh.H"
 
-    IOsampledSets sSets(mesh, "sampleDict", true);
-    IOsampledSurfaces sSurfaces(mesh, "sampleDict", true);
+    IOsampledSets sSets(mesh, "sampleDict", IOobject::MUST_READ, true);
+    IOsampledSurfaces sSurfs(mesh, "sampleDict", IOobject::MUST_READ, true);
 
     forAll(timeDirs, timeI)
     {
@@ -112,10 +113,10 @@ int main(int argc, char *argv[])
         polyMesh::readUpdateState state = mesh.readUpdate();
 
         sSets.readUpdate(state);
-        sSurfaces.readUpdate(state);
+        sSurfs.readUpdate(state);
 
         sSets.write();
-        sSurfaces.write();
+        sSurfs.write();
 
         Info<< endl;
     }
diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C
index b2ee559eaa6..e76c2252d47 100644
--- a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C
+++ b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C
@@ -34,6 +34,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
 (
     const objectRegistry& obr,
     const fileName& dictName,
+    const IOobject::readOption rOpt,
     const bool readFromFiles
 )
 :
@@ -44,7 +45,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
             dictName,
             obr.time().system(),
             obr,
-            IOobject::MUST_READ,
+            rOpt,
             IOobject::NO_WRITE
         )
     ),
diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H
index 77d30877371..bd69a5f3d3a 100644
--- a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H
+++ b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H
@@ -70,11 +70,13 @@ public:
     // Constructors
 
         //- Construct for given objectRegistry and dictionary
-        //  allow the possibility to load fields from files
+        //  Allow dictionary to be optional
+        //  Allow the possibility to load fields from files
         IOOutputFilter
         (
             const objectRegistry&,
             const fileName& dictName = OutputFilter::typeName() + "Dict",
+            const IOobject::readOption rOpt = IOobject::MUST_READ,
             const bool loadFromFile = false
         );
 
-- 
GitLab