Files
OpenFOAM-12/etc/config.sh/paraview
Will Bainbridge 48fcb7f6d1 etc: Explicit control of decomposition and ParaView installation type
*** Note that this commit depends on a corresponding change in
ThirdParty-dev. Ensure that both repositories are up to date before
re-building OpenFOAM.

New environment variables have been added to explicitly control the
installation type of the thirdparty decomposition libraries and of the
ParaView visualiation software. These are set in the etc/bashrc and can
be overridden in a ~/.OpenFOAM/<version>/prefs.sh file or similar.

The variables relating to the decomposition libraries are SCOTCH_TYPE,
METIS_TYPE, PARMETIS_TYPE and ZOLTAN_TYPE, and they can take values of
none, system, or ThirdParty. In the case of ThirdParty, a
<library>_VERSION variable can also be specified. If the version is not
specified then the configuration will search for a source directory, and
if multiple such directories are found then the one with the highest
version number will be used.

The variable relating to ParaView is ParaView_TYPE, and this can be
similarly be set to none, system, or ThirdParty, and ParaView_VERSION
can also be specified when the type is ThirdParty. If the version is not
specified then the installation with the highest version number will be
used.

An example  ~/.OpenFOAM/dev/prefs.sh file, in which all decomposition
libraries are enabled, and the Scotch and ParaView versions are
explicitly set, is as follows:

    export SCOTCH_TYPE=ThirdParty
    export SCOTCH_VERSION=7.0.3
    export METIS_TYPE=ThirdParty
    export PARMETIS_TYPE=ThirdParty
    export ZOLTAN_TYPE=ThirdParty

    export ParaView_TYPE=ThirdParty
    export ParaView_VERSION=5.11.2

*** Note that if version numbers are not set then the configuration will
search for a decomposition source directory, but it will search for a
ParaView installation directory. This is because decomposition libraries
are built as part of OpenFOAM's ./Allwmake, but ParaView is not. This
distinction remains. If a local compilation of ParaView is needed, then
'./makeParaView -version X.XX.X' should be called explicitly in the
third party directory prior to building OpenFOAM.

The name of the third party directory can now also be independently set.
This simplifies some packaging processes in that it permits third party
to be located within the OpenFOAM installation directory and therefore
bundled into the same binary package.
2024-06-06 15:20:19 +01:00

166 lines
5.7 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
# \\/ 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 3 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, see <http://www.gnu.org/licenses/>.
#
# File
# etc/config.sh/paraview
#
# Description
# Setup file for paraview-[4-5].x
# Sourced from OpenFOAM-<VERSION>/etc/bashrc or from foamPV alias
#
#------------------------------------------------------------------------------
# Clean the PATH
cleaned=$("$WM_PROJECT_DIR"/bin/foamCleanPath "$PATH" \
"/opt/paraviewopenfoam \
$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- \
$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-" \
) \
&& PATH="$cleaned"
# Detect the most recent version of cmake available and add to the PATH
cmakeDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/cmake-*)
if [ -n "$cmakeDir" ]
then
export PATH=$cmakeDir/bin:$PATH
fi
unset cmakeDir
# Set up the paraview environment
case "$ParaView_TYPE" in
none)
;;
system)
# Look for a paraview installation
if pvserverExe=$(which pvserver 2> /dev/null)
then
paraviewBinDir=$(dirname $pvserverExe)
paraviewBinDir=$(cd $paraviewBinDir && pwd -P)
fi
# Set the environment
if [ -d "$paraviewBinDir" ]
then
export ParaView_DIR=$(dirname $paraviewBinDir)
export ParaView_LIB_DIR=$(unset LD_LIBRARY_PATH && \
ldd $paraviewBinDir/paraview | \
grep -o "/.*/libpqCore-pv.*.so" | \
xargs dirname)
export ParaView_VERSION=$(unset LD_LIBRARY_PATH && \
pvserver --version 2> /dev/null | \
awk '{print $NF}')
export ParaView_MAJOR=${ParaView_VERSION%.*}
export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
# Add to the library path
export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$PV_PLUGIN_PATH:$LD_LIBRARY_PATH
fi
unset pvserverExe paraviewBinDir
;;
paraviewopenfoam)
# Look for a paraview installation. The version should be set externally.
if [ -n "$ParaView_VERSION" ]
then
export ParaView_MAJOR=${ParaView_VERSION%.*}
paraviewDir=/opt/paraviewopenfoam$(echo "$ParaView_MAJOR" | tr -d '.')
fi
# Set the environment
if [ -d "$paraviewDir" ]
then
export ParaView_DIR=$paraviewDir
export ParaView_LIB_DIR=$(echo "$ParaView_DIR"/lib* | tr ' ' ':')
export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
# Add to the path and the library path
export PATH=$ParaView_DIR/bin:$PATH
export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$PV_PLUGIN_PATH:$LD_LIBRARY_PATH
fi
unset paraviewDir
;;
OpenFOAM | ThirdParty)
# Look for a paraview installation
if [ -z "$ParaView_VERSION" ]
then
paraviewDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/ParaView-*)
else
paraviewDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION
fi
# Set the environment
if [ -d "$paraviewDir" ]
then
export ParaView_DIR=$paraviewDir
export ParaView_LIB_DIR=$(echo "$ParaView_DIR"/lib* | tr ' ' ':')
export ParaView_VERSION=${paraviewDir##*ParaView-}
export ParaView_MAJOR=${ParaView_VERSION%.*}
export ParaView_INCLUDE_DIR=$paraviewDir/include/paraview-$ParaView_MAJOR
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
# Add to the path and the library path
export PATH=$ParaView_DIR/bin:$PATH
export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$PV_PLUGIN_PATH:$LD_LIBRARY_PATH
# Add in python libraries if required
paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
if [ -r "$paraviewPython" ]
then
if [ "$PYTHONPATH" ]
then
export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR
else
export PYTHONPATH=$paraviewPython:$ParaView_LIB_DIR
fi
fi
unset paraviewPython
fi
unset paraviewDir
;;
esac
# Report
if [ "$FOAM_VERBOSE" ] && [ "$PS1" ] && [ -d "$ParaView_DIR" ]
then
echo "Using paraview"
echo " ParaView_DIR : $ParaView_DIR"
echo " ParaView_LIB_DIR : $ParaView_LIB_DIR"
echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR"
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
fi
unset cleaned
#------------------------------------------------------------------------------