Merge commit 'origin/master' into olesenm

This commit is contained in:
Mark Olesen
2008-06-23 17:26:06 +02:00
2 changed files with 23 additions and 26 deletions

View File

@ -47,7 +47,7 @@ printUsage() {
cat <<LABUSAGE cat <<LABUSAGE
$PROGNAME - extracts xy files from Foam logs. $PROGNAME - extracts xy files from Foam logs.
Usage: $PROGNAME [-n][-s] <root> <case> <log> Usage: $PROGNAME [-n][-s] <log>
extracts xy files from log extracts xy files from log
$PROGNAME -l <log> $PROGNAME -l <log>
lists but does not extract lists but does not extract
@ -82,11 +82,11 @@ files with the extracted data only.
The query database is a simple text format with three entries per line, The query database is a simple text format with three entries per line,
separated with '/'. Column 1 is the name of the variable (cannot contain separated with '/'. Column 1 is the name of the variable (cannot contain
spaces), column 2 is the regular expression to select the line and spaces), column 2 is the extended regular expression (egrep) to select
column 3 is the string to select the column inside the line. The value the line and column 3 is the string (fgrep) to select the column inside the
taken will be the first (non-space)word after this column. line. The value taken will be the first (non-space)word after this
The database will either be \$HOME/.${PROGNAME}.db or if not found column. The database will either be \$HOME/.${PROGNAME}.db or if not
$PROGDIR/${PROGNAME}.db. found $PROGDIR/${PROGNAME}.db.
Option -s suppresses the default information and only prints the extracted Option -s suppresses the default information and only prints the extracted
variables. variables.
@ -105,7 +105,7 @@ myEcho() {
# getSolvedVars logFile # getSolvedVars logFile
# Prints names of all 'solved for' variables in the log file. # Prints names of all 'solved for' variables in the log file.
getSolvedVars() { getSolvedVars() {
grep ' Solving for ' $1 | fgrep ',' | sed -e 's/.* Solving for \([^,]*\)[,:].*/\1/' | sort -u fgrep ' Solving for ' $1 | fgrep ',' | sed -e 's/.* Solving for \([^,]*\)[,:].*/\1/' | sort -u
} }
@ -163,7 +163,7 @@ getAllQueries() {
for var in $dbQueries for var in $dbQueries
do do
getQueries $1 "$var" getQueries $1 "$var"
line=`grep "$LINEQ" $2` line=`egrep "$LINEQ" $2`
if [ "$line" ]; then if [ "$line" ]; then
column=`echo "$line" | fgrep "$NUMQ"` column=`echo "$line" | fgrep "$NUMQ"`
if [ "$column" ]; then if [ "$column" ]; then
@ -228,14 +228,13 @@ if [ "$LISTONLY" ]; then
exit 0 exit 0
fi fi
if [ $# -ne 3 ]; then if [ $# -ne 1 ]; then
printUsage printUsage
exit 1 exit 1
fi fi
ROOT=$1 CASEDIR=.
CASE=$2 LOG=$1
LOG=$3
if [ ! -r $LOG ]; then if [ ! -r $LOG ]; then
echo "$PROGNAME: Cannot read log $LOG" echo "$PROGNAME: Cannot read log $LOG"
exit 1 exit 1
@ -244,13 +243,13 @@ fi
QUERYNAMES=`getAllQueries $DBFILE $LOG` QUERYNAMES=`getAllQueries $DBFILE $LOG`
if [ ! "$ROOT" -o ! "$CASE" ]; then if [ ! "$CASEDIR" ]; then
printUsage printUsage
exit 1 exit 1
fi fi
if [ ! -d "$ROOT/$CASE" ]; then if [ ! -d "$CASEDIR" ]; then
echo "$PROGNAME: Cannot read $ROOT/$CASE" echo "$PROGNAME: Cannot read $CASEDIR"
exit 1 exit 1
fi fi
@ -262,16 +261,14 @@ fi
#-- Make logs dir in case directory and put awk file there. #-- Make logs dir in case directory and put awk file there.
mkdir -p $ROOT/$CASE/logs mkdir -p $CASEDIR/logs
AWKFILE=$ROOT/$CASE/logs/$PROGNAME.awk AWKFILE=$CASEDIR/logs/$PROGNAME.awk
myEcho "Using:" myEcho "Using:"
myEcho " root : $ROOT"
myEcho " case : $CASE"
myEcho " log : $LOG" myEcho " log : $LOG"
myEcho " database : $DBFILE" myEcho " database : $DBFILE"
myEcho " awk file : $AWKFILE" myEcho " awk file : $AWKFILE"
myEcho " files to : $ROOT/$CASE/logs" myEcho " files to : $CASEDIR/logs"
myEcho "" myEcho ""
@ -364,19 +361,19 @@ cat <<LABSOLVE >> $AWKFILE
varName=varNameVal[1] varName=varNameVal[1]
file=varName "_" subIter[varName]++ file=varName "_" subIter[varName]++
file="$ROOT/$CASE/logs/" file file="$CASEDIR/logs/" file
extract(\$0, "Initial residual = ", val) extract(\$0, "Initial residual = ", val)
print $TIMENAME "\t" val[1] > file print $TIMENAME "\t" val[1] > file
varName=varNameVal[1] "FinalRes" varName=varNameVal[1] "FinalRes"
file=varName "_" subIter[varName]++ file=varName "_" subIter[varName]++
file="$ROOT/$CASE/logs/" file file="$CASEDIR/logs/" file
extract(\$0, "Final residual = ", val) extract(\$0, "Final residual = ", val)
print $TIMENAME "\t" val[1] > file print $TIMENAME "\t" val[1] > file
varName=varNameVal[1] "Iters" varName=varNameVal[1] "Iters"
file=varName "_" subIter[varName]++ file=varName "_" subIter[varName]++
file="$ROOT/$CASE/logs/" file file="$CASEDIR/logs/" file
extract(\$0, "No Iterations ", val) extract(\$0, "No Iterations ", val)
print $TIMENAME "\t" val[1] > file print $TIMENAME "\t" val[1] > file
} }
@ -393,7 +390,7 @@ do
echo "#-- Extraction of $queryName" >> $AWKFILE echo "#-- Extraction of $queryName" >> $AWKFILE
echo "/$LINEQ/ {" >> $AWKFILE echo "/$LINEQ/ {" >> $AWKFILE
echo " extract(\$0, \"$NUMQ\", val)" >> $AWKFILE echo " extract(\$0, \"$NUMQ\", val)" >> $AWKFILE
echo " file=\"$ROOT/$CASE/logs/${queryName}_\" ${counter}" >> $AWKFILE echo " file=\"$CASEDIR/logs/${queryName}_\" ${counter}" >> $AWKFILE
echo " print $TIMENAME \"\\t\" val[1] > file" >> $AWKFILE echo " print $TIMENAME \"\\t\" val[1] > file" >> $AWKFILE
echo " ${counter}++" >> $AWKFILE echo " ${counter}++" >> $AWKFILE
echo "}" >> $AWKFILE echo "}" >> $AWKFILE

View File

@ -48,6 +48,6 @@ epsMax/bounding epsilon,/max:
epsAvg/bounding epsilon,/average: epsAvg/bounding epsilon,/average:
#- gamma bounding #- gamma bounding
gammaMin/Min\(gamma\) =/Min(gamma) = gammaMin/Min\(gamma\) =/Min(gamma) =
gammaMax/Max\(gamma\) =/Max(gamma) = gammaMax/Max\(gamma\) =/Max(gamma) =