BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / tutorials / incompressible / icoFoam / mixingPlane / twoBlocksMixingPlane_dirY_spanZ / RunFunctionsSupplemental
blobef90406c4010be5cce7595b5f5e99b8d86b38f22
1 #---------------------------------*- sh -*-------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright held by original author
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of OpenFOAM.
11 #     OpenFOAM is free software; you can redistribute it and/or modify it
12 #     under the terms of the GNU General Public License as published by the
13 #     Free Software Foundation; either version 2 of the License, or (at your
14 #     option) any later version.
16 #     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 #     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 #     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 #     for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with OpenFOAM; if not, write to the Free Software Foundation,
23 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 #     RunFunctionsSupplemental
28 # Description
29 #    Additionnal run functions, based on the original RunFunctions
31 # Author:
32 #    Martin Beaudoin, Hydro-Quebec. All rights reserved
34 #------------------------------------------------------------------------------
36 # Exception handler: dump the tail of the log file on error
37 verbose_report_on_runApplication_error()
39    if [ "$reportOnErrorOnlyOnce" ] ; then
40        echo "Error running $APP_RUN..."
41        if [ -f log.$APP_RUN ] ; then
42            tail log.$APP_RUN
43        fi
44    fi
46    # Do not report again when exiting
47    unset reportOnErrorOnlyOnce
50 # Variation of runApplication with exception handling
51 runApplicationAndReportOnError ()
53     trap 'verbose_report_on_runApplication_error' ERR
55     APP_RUN=$1; shift
57     reportOnErrorOnlyOnce=1
59     if [ -f log.$APP_RUN ] ; then
60         echo "$APP_RUN already run on $PWD: remove log file to run"
61     else
62         echo "Running $APP_RUN on $PWD"
63         $APP_RUN $* > log.$APP_RUN 2>&1
64     fi