2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
8 #-------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
29 # start paraview with the OpenFOAM libraries
32 # combining -block or -builtin options with the -region option yields
34 #------------------------------------------------------------------------------
37 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
40 Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
42 -block use blockMesh reader (uses .blockMesh extension)
43 -builtin use VTK builtin OpenFOAM reader (uses .foam extension)
44 -case <dir> specify alternative case directory, default is the cwd
45 -region <name> specify alternative mesh region
46 -touch only create the file (eg, .blockMesh, .OpenFOAM, etc)
47 -touchAll create .blockMesh, .OpenFOAM files (and for all regions)
51 paraview options start with a double dashes
53 * start paraview $ParaView_VERSION with the OpenFOAM libraries
59 # We want to do nice exit when running paraview to give paraview opportunity
63 unset regionName optTouch
65 # Hack: change all locale to 'C' i.e. using '.' for decimal point. This is
66 # only needed temporarily until paraview is locale aware. (git version is
91 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
92 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
96 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
112 break # stop here, treat balance as paraview options
115 break # stop here, treat this and balance as paraview options
118 usage
"unknown option/argument: '$*'"
125 # check that reader module has been built
127 if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPV3FoamReader_SM.so
]
131 FATAL ERROR: ParaView reader module libraries do not exist
133 Please build the reader module before continuing:
134 cd \$FOAM_UTILITIES/postProcessing/graphics/PV3Readers
143 # check for --data=... argument
163 # get a sensible caseName from the directory name
165 caseFile
="$caseName.$extension"
168 if [ -n "$regionName" ]
170 caseFile
="$caseName{$regionName}.$extension"
171 fvControls
="$fvControls/$regionName"
174 case "${optTouch:-false}" in
177 if [ -f constant
/polyMesh
/blockMeshDict
]
179 touch "$caseName.blockMesh"
180 echo "created '$caseName.blockMesh'"
182 touch "$caseName.$extension"
183 echo "created '$caseName.$extension'"
184 # discover probable regions
185 for region
in constant
/*
187 if [ -d $region -a -d $region/polyMesh
]
189 regionName
=${region##*/}
190 touch "$caseName{$regionName}.$extension"
191 echo "created '$caseName{$regionName}.$extension'"
198 echo "created '$caseFile'"
204 # parent directory for normal or parallel results
206 processor
*) parentDir
=".." ;;
211 if [ "${hasData:-false}" = true
]
214 # has --data=.., send directly to paraview
219 # check existence of essential files
220 warn
="WARN file does not exist:"
225 constant
/polyMesh
/blockMeshDict \
228 [ -s "$parentDir/$check" ] ||
{
229 [ -n "$warn" ] && echo "$warn" 1>&2
230 echo " $parentDir/$check" 1>&2
239 $fvControls/fvSchemes \
240 $fvControls/fvSolution \
243 [ -s "$parentDir/$check" ] ||
{
244 [ -n "$warn" ] && echo "$warn" 1>&2
245 echo " $parentDir/$check" 1>&2
252 # only create/remove caseFile if it didn't already exist
253 [ -e $caseFile ] ||
{
254 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
256 echo "created temporary '$caseFile'"
259 # For now filter out any ld.so errors. Caused by non-system compiler?
260 paraview
--data="$caseFile" "$@" 2>&1 | fgrep
-v 'Inconsistency detected by ld.so'
264 #------------------------------------------------------------------------------