View Issue Details

IDProjectCategoryView StatusLast Update
0000240OpenFOAMBugpublic2011-07-21 10:03
Reporteruser17Assigned Touser4 
PrioritynoneSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
PlatformLinuxOSOtherOS Version(please specify)
Summary0000240: foamLog -quiet option
DescriptionI've been using foamLog in a script. The -quiet option still outputs the list of variables that files are going to be generated for. Is there a reason for this, otherwise I think it would be better for foamLog to be "truly" quiet.

I also think it would be useful for there to be an option whereby ONLY the variables specified in a local foamLog.db file are searched for (i.e. I didn't want the "solved for" variables, just specific information that my solver had outputted).

I've attached a patch with my workaround.
TagsNo tags attached.

Activities

user17

2011-07-07 12:02

 

0001-Give-foamLog-the-localDB-option-and-make-quiet-optio.patch (3,433 bytes)   
From 85fbce2a862da20e442f6dedd3be7e72095e3e07 Mon Sep 17 00:00:00 2001
From: "Laurence R. McGlashan" <lrm29@cam.ac.uk>
Date: Thu, 7 Jul 2011 11:58:49 +0100
Subject: [PATCH] Give foamLog the localDB option and make quiet option truly
 quiet.

---
 bin/foamLog |   58 ++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/bin/foamLog b/bin/foamLog
index c86dce6..3cb6d10 100755
--- a/bin/foamLog
+++ b/bin/foamLog
@@ -45,6 +45,7 @@ Usage: $Script [OPTIONS] <log>
   -list             lists but does not extract
   -n                create single column files with the extracted data only
   -quiet            quiet operation
+  -localDB          only use the local database file
   -help             print the usage
 
 $Script - extracts xy files from OpenFOAM logs.
@@ -103,7 +104,7 @@ usage
 
 
 timeName=Time
-unset listOpt quietOpt
+unset listOpt quietOpt localDB
 
 # parse options
 while [ "$#" -gt 0 ]
@@ -125,6 +126,10 @@ do
         quietOpt=true
         shift
         ;;
+    -localDB)
+        localDB=true
+        shift
+        ;;
     -*)
         usage "unknown option: '$*'"
         ;;
@@ -219,7 +224,7 @@ getSolveQueryList()
 getAllQueries()
 {
     #-- All solved for queries from log file
-    queries=`getSolveQueryList $2`
+    [ "$localDB" = true ] || queries=`getSolveQueryList $2`
 
     #-- Add ones from database, present in log file
     # Note: just like awk, line selected with regular expression,
@@ -369,29 +374,30 @@ AWK_CONTENTS
 #
 # Code for extracting solved for quantities
 #
-cat << AWK_CONTENTS >> $AWKFILE
-# Extraction of any solved for variable
-/Solving for/ {
-    extract(\$0, "Solving for ", varNameVal)
-
-    varName=varNameVal[1]
-    file=varName "_" subIter[varName]++
-    file="$outputDir/" file
-    extract(\$0, "Initial residual = ", val)
-    print $timeName "\t" val[1] > file
-
-    varName=varNameVal[1] "FinalRes"
-    file=varName "_" subIter[varName]++
-    file="$outputDir/" file
-    extract(\$0, "Final residual = ", val)
-    print $timeName "\t" val[1] > file
-
-    varName=varNameVal[1] "Iters"
-    file=varName "_" subIter[varName]++
-    file="$outputDir/" file
-    extract(\$0, "No Iterations ", val)
-    print $timeName "\t" val[1] > file
-}
+[ "$localDB" = true ] || 
+    cat << AWK_CONTENTS >> $AWKFILE
+    # Extraction of any solved for variable
+    /Solving for/ {
+        extract(\$0, "Solving for ", varNameVal)
+
+        varName=varNameVal[1]
+        file=varName "_" subIter[varName]++
+        file="$outputDir/" file
+        extract(\$0, "Initial residual = ", val)
+        print $timeName "\t" val[1] > file
+
+        varName=varNameVal[1] "FinalRes"
+        file=varName "_" subIter[varName]++
+        file="$outputDir/" file
+        extract(\$0, "Final residual = ", val)
+        print $timeName "\t" val[1] > file
+
+        varName=varNameVal[1] "Iters"
+        file=varName "_" subIter[varName]++
+        file="$outputDir/" file
+        extract(\$0, "No Iterations ", val)
+        print $timeName "\t" val[1] > file
+    }
 
 AWK_CONTENTS
 # ----------
@@ -432,7 +438,7 @@ done
 # Print found
 #-----------------------------
 myEcho "Generated XY files for:"
-getAllQueries $DBFILE $LOG
+[ "$quietOpt" = true ] || getAllQueries $DBFILE $LOG
 myEcho "End"
 
 #------------------------------------------------------------------------------
-- 
1.7.6

user4

2011-07-21 10:03

  ~0000580

Fixed in bf728ef49ac04ad551d27d6d20d710315f40135a.

Thanks for the patch!

Issue History

Date Modified Username Field Change
2011-07-07 12:02 user17 New Issue
2011-07-07 12:02 user17 File Added: 0001-Give-foamLog-the-localDB-option-and-make-quiet-optio.patch
2011-07-21 10:03 user4 Note Added: 0000580
2011-07-21 10:03 user4 Status new => resolved
2011-07-21 10:03 user4 Fixed in Version => 2.0.x
2011-07-21 10:03 user4 Resolution open => fixed
2011-07-21 10:03 user4 Assigned To => user4