From 52f22486c4853bf32a3800b5d6fbe8900834705a Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Tue, 5 May 2015 12:26:28 +0100
Subject: [PATCH] probes: Improved formatting of header to make it easier to
 parse and read probe locations

New layout:

    # Probe 0 (0.0254 0.0253 0)
    # Probe 1 (0.0508 0.0253 0)
    # Probe 2 (0.0762 0.0253 0)
    #       Probe             0             1             2
    #        Time
            1e-05        142974        128861        115934
            2e-05      -69444.1        -62541      -56395.7
            3e-05      -1546.81      -1445.94      -1154.79
---
 src/sampling/probes/probes.C | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C
index 7da91081884..38ef3a63b47 100644
--- a/src/sampling/probes/probes.C
+++ b/src/sampling/probes/probes.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,7 +34,7 @@ License
 
 namespace Foam
 {
-defineTypeNameAndDebug(probes, 0);
+    defineTypeNameAndDebug(probes, 0);
 }
 
 
@@ -228,30 +228,35 @@ Foam::label Foam::probes::prepare()
             // Create directory if does not exist.
             mkDir(probeDir);
 
-            OFstream* sPtr = new OFstream(probeDir/fieldName);
+            OFstream* fPtr = new OFstream(probeDir/fieldName);
+
+            OFstream& fout = *fPtr;
 
             if (debug)
             {
-                Info<< "open probe stream: " << sPtr->name() << endl;
+                Info<< "open probe stream: " << fout.name() << endl;
             }
 
-            probeFilePtrs_.insert(fieldName, sPtr);
+            probeFilePtrs_.insert(fieldName, fPtr);
 
             unsigned int w = IOstream::defaultPrecision() + 7;
 
-            for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
+            forAll(*this, probeI)
             {
-                *sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
-                    << vector::componentNames[cmpt];
+                fout<< "# Probe " << probeI << ' ' << operator[](probeI)
+                    << endl;
+            }
 
-                forAll(*this, probeI)
-                {
-                    *sPtr<< ' ' << setw(w) << operator[](probeI)[cmpt];
-                }
-                *sPtr << endl;
+            fout<< '#' << setw(IOstream::defaultPrecision() + 6)
+                << "Probe";
+
+            forAll(*this, probeI)
+            {
+                fout<< ' ' << setw(w) << probeI;
             }
+            fout<< endl;
 
-            *sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
+            fout<< '#' << setw(IOstream::defaultPrecision() + 6)
                 << "Time" << endl;
         }
     }
-- 
GitLab