2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2010 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
31 #------------------------------------------------------------------------------
33 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
36 usage: ${0##*/} [OPTION]
38 -case dir specify alternative case directory
39 -region name specify mesh region name
40 -touch only create the .OpenFOAM file
42 * start paraview $ParaView_VERSION with the OpenFOAM libraries
48 unset regionName touchOnly
50 # We want to do nice exit when running paraview to give paraview opportunity
55 # Hack: change all locale to 'C' i.e. using '.' for decimal point. This is
56 # only needed temporarily until paraview is locale aware.
68 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
69 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
73 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
82 usage
"unknown option/argument: '$*'"
87 # get a sensible caseName
89 caseFile
="$caseName.OpenFOAM"
92 if [ -n "$regionName" ]
94 caseFile
="$caseName{$regionName}.OpenFOAM"
95 fvControls
="$fvControls/$regionName"
98 if [ -n "$touchOnly" ]
101 echo "created '$caseFile'"
105 # parent directory for normal or parallel results
107 processor
*) parentDir
=".." ;;
111 # check existence of essential files
112 for check
in system
/controlDict
$fvControls/fvSchemes
$fvControls/fvSolution
114 [ -s "$parentDir/$check" ] || usage
"file does not exist: '$parentDir/$check'"
118 case "$ParaView_VERSION" in
120 trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
123 # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
124 sed -e s@
%CASE
%@
$PWD/$caseFile@g \
125 $WM_PROJECT_DIR/bin
/tools
/paraFoam.pvs
> paraFoam.pvs
127 paraview paraFoam.pvs
131 # only create/remove caseFile if it didn't already exist
132 [ -e $caseFile ] ||
{
133 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
135 echo "created temporary '$caseFile'"
138 paraview
--data="$caseFile"
142 #------------------------------------------------------------------------------