Commit 5872f2a7 authored by Mark Olesen's avatar Mark Olesen
Browse files

added test/ensightFoamReader with udr_checker.c from ensight80

- it looks okay to include: same copyrights as the other ensight headers
parent 60549b30
udr_checker.c
EXE = $(FOAM_USER_APPBIN)/ensightFoamReader-udr_checker
EXE_INC = \
-DUSERD_API_203
EXE_LIBS = \
-luserd-foam
udr_checker
-----------
udr_checker.c is a routine that can be used to debug EnSight User-defined
readers. It exists because of the difficulty of debugging dynamic shared
libraries when you don't have the source for the calling program (EnSight).
If udr_checker.c is compiled and linked with your reader source code (including
access to any libraries needed, and the global_extern.h file), it will exercise
most options of you reader, giving feedback as it goes. The resulting
executable can be debugged using your favorite debugger. And if you have
memory/bounds checking software (such as purify), you can (and should) run it
with this executable to make sure that you are not overwriting things. Readers
that bash memory will cause problems when run with EnSight!
You will note that the Makefile provided with the readers in the EnSight
distribution have a "checker" object. If you do a "make checker" instead of
just a "make", the "checker"executable will be produced. You may need to
modify these makefiles slightly if the locations of your reader files are
different than the normal.
--------------------------------------
Once the "checker" executable exists, you can run the checker program by simply
invoking it:
> checker
And you will be prompted for the type of information that you provide in the
EnSight Data Reader dialog, namely:
The path
filename_1
[filename_2] Only if your reader uses two fields
swapbytes flag
<toggle flags> Only if your reader implements extra GUI
<pulldown flags> one flag value per line
<field contents> one field string per line
There are certain command line options that you can use to control some aspects
of the checker program. One of the more useful is the ability to provide the
input just described in a file. This is done in this fashion:
> checker -p <playfile>
And <playfile> would be a simple ascii file with 3 [0r 4] lines:
line 1: the path
line 2: filename_1
line 3: [filename_2] (if two_fields is TRUE)
line 3 or 4: 0 or 1, for swapbytes (0 is FALSE, 1 is TRUE)
remaining lines 0 or 1 for toggle disable enabled
one line for each toggle
0 - num_pulldown_values for pulldown choice
one line for each pulldown
strings
one line for each field
example playfile for an EnSight Gold reader casefile (entitled cube.play)
could look something like the following: (Note: two_fields is FALSE)
-------------------
/usr/local/bin/data/ens
cube.case
0
And you would invoke checker as:
> checker -p check.play
Another example playfile
with swapbytes 0,
two enabled toggles,
three pulldowns with the value 0 chosen
and a single field "sample field value"
could look something like the following::
----------------------
/mydirectory/subdir/
myfile
0
1
1
0
0
0
sample field value
Other command line arguments are:
---------------------------------
-server_number For checking server number routines. If you use this
option, you will be prompted for the total number of
servers and the current server number. These will then be
used in the calls to the server number routines.
-gts # For specifying the geometry timestep to test. The default
is step 0.
The # is the (zero based) time step to read for geometry.
-vts # For specifying the variable timestep to test. The default
is step 0.
The # is the (zero based) time step to read for variables.
Testing optional routines using #defines
-----------------------------------------
For optional routines, such as the extra_gui, or var_extract_gui routines, you
must uncomment the proper #define in udr_checker.c
Currently the ones available are:
#define _EGS for extra gui routines
#define _VES for var extract gui routines
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
# \\/ 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 2 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, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# ensightFoamReaderTest
#
# Description
# start ensightFoamReader-udr_checker
#
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION]
options:
-case dir specify alternative case directory
* start ensightFoamReader-udr_checker
USAGE
exit 1
}
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-case)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
shift 2
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
# check existence of essential files
for check in system/controlDict system/fvSchemes system/fvSolution
do
[ -s "$check" ] || usage "file does not exist: '$check'"
done
# export values that might be needed
export FOAM_CASE=$PWD
export FOAM_CASENAME=${PWD##*/}
pathName=${PWD%/*}
playFile=/tmp/ensightFoamReader.$$
trap "rm -f $playFile 2>/dev/null; exit 0" EXIT TERM INT
cat << PLAY_FILE > $playFile
$pathName
$FOAM_CASENAME
0
PLAY_FILE
echo "ensightFoamReader-udr_checker -p $playFile"
ensightFoamReader-udr_checker -p $playFile
#------------------------------------------------------------------------------
../../utilities/postProcessing/graphics/ensightFoamReader/global_extern.h
\ No newline at end of file
../../utilities/postProcessing/graphics/ensightFoamReader/global_extern_proto.h
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
udr_checker-80.c
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment