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. (git version is
69 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
70 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
74 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
83 usage
"unknown option/argument: '$*'"
88 # get a sensible caseName
90 caseFile
="$caseName.OpenFOAM"
93 if [ -n "$regionName" ]
95 caseFile
="$caseName{$regionName}.OpenFOAM"
96 fvControls
="$fvControls/$regionName"
99 if [ -n "$touchOnly" ]
102 echo "created '$caseFile'"
106 # parent directory for normal or parallel results
108 processor
*) parentDir
=".." ;;
112 # check existence of essential files
113 for check
in system
/controlDict
$fvControls/fvSchemes
$fvControls/fvSolution
115 [ -s "$parentDir/$check" ] || usage
"file does not exist: '$parentDir/$check'"
119 case "$ParaView_VERSION" in
121 trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
124 # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
125 sed -e s@
%CASE
%@
$PWD/$caseFile@g \
126 $WM_PROJECT_DIR/bin
/tools
/paraFoam.pvs
> paraFoam.pvs
128 paraview paraFoam.pvs
132 # only create/remove caseFile if it didn't already exist
133 [ -e $caseFile ] ||
{
134 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
136 echo "created temporary '$caseFile'"
139 paraview
--data="$caseFile"
143 #------------------------------------------------------------------------------