Files
OpenFOAM-12/etc/config.csh/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
6.0 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
# config.csh/paraview
#
# Description
# Setup file for paraview-[4-5].x
# Sourced from OpenFOAM-<VERSION>/etc/cshrc or from foamPV alias
#
#------------------------------------------------------------------------------
# Clean the PATH
set 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-" \
`
if ( $status == 0 ) setenv PATH $cleaned
# Detect the most recent version of cmake available and add to the PATH
set cmakeDir=`eval _foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/cmake-*`
if ( "$cmakeDir" != "" ) then
setenv PATH $cmakeDir/bin:$PATH
endif
unset cmakeDir
# Set up the paraview environment
switch ("$ParaView_TYPE")
case none:
unset PV_PLUGIN_PATH
breaksw
case system:
# Look for a paraview installation
set pvserverExe=`which pvserver 2> /dev/null`
if ( $status == 0 ) then
set pvserverBinDir=`dirname $pvserverExe`
set paraviewBinDir=`cd $pvserverBinDir && pwd -P`
endif
# Set the environment
if ( $?paraviewBinDir ) then
if ( -d "$paraviewBinDir" ) then
setenv ParaView_DIR `dirname paraviewBinDir`
export ParaView_LIB_DIR `unset LD_LIBRARY_PATH && \
ldd $paraviewBinDir/paraview | \
grep -o "/.*/libpqCore-pv.*.so" | \
xargs dirname`
setenv ParaView_VERSION `unset LD_LIBRARY_PATH && \
pvserver --version 2> /dev/null | \
awk '{print $NF}'`
setenv ParaView_MAJOR `echo $ParaView_VERSION | sed 's/\.[^\.]\+$//g'`
setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-$ParaView_MAJOR
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-$ParaView_MAJOR
# Add to the library path
setenv LD_LIBRARY_PATH ${ParaView_LIB_DIR}:${PV_PLUGIN_PATH}:${LD_LIBRARY_PATH}
endif
endif
unset pvserverExe paraviewBinDir
breaksw
case paraviewopenfoam:
# Look for a paraview installation. The version should be set externally.
if ( $?ParaView_VERSION ) then
setenv ParaView_MAJOR `echo $ParaView_VERSION | sed 's/\.[^\.]\+$//g'`
set paraviewDir=/opt/paraviewopenfoam`echo $ParaView_MAJOR | tr -d '.'`
endif
# Set the environment
if ( $?paraviewDir ) then
if ( -d "$paraviewDir" ) then
setenv ParaView_DIR $paraviewDir
setenv ParaView_LIB_DIR `echo "$ParaView_DIR"/lib* | tr ' ' ':'`
setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-$ParaView_MAJOR
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-$ParaView_MAJOR
# Add to the path and the library path
setenv PATH $ParaView_DIR/bin:${PATH}
setenv LD_LIBRARY_PATH ${ParaView_LIB_DIR}:${PV_PLUGIN_PATH}:${LD_LIBRARY_PATH}
endif
endif
unset paraviewDir
breaksw
case OpenFOAM:
case ThirdParty:
# Look for a paraview installation
if ( ! $?ParaView_VERSION ) then
set paraviewDir=`eval _foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/ParaView-*`
else
set paraviewDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION
endif
# Set the environment
if ( -d "$paraviewDir" ) then
setenv ParaView_DIR $paraviewDir
setenv ParaView_LIB_DIR `echo "$ParaView_DIR"/lib* | tr ' ' ':'`
setenv ParaView_VERSION `echo $ParaView_DIR | sed 's/.*ParaView-//g'`
setenv ParaView_MAJOR `echo $ParaView_VERSION | sed 's/\.[^\.]\+$//g'`
setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-$ParaView_MAJOR
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-$ParaView_MAJOR
# Add to the path and the library path
setenv PATH $ParaView_DIR/bin:${PATH}
setenv LD_LIBRARY_PATH ${ParaView_LIB_DIR}:${PV_PLUGIN_PATH}:${LD_LIBRARY_PATH}
# Add in python libraries if required
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
if ( -r $paraviewPython ) then
if ( $?PYTHONPATH ) then
setenv PYTHONPATH $PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR
else
setenv PYTHONPATH $paraviewPython:$ParaView_LIB_DIR
endif
endif
unset paraviewPython
endif
unset paraviewDir
breaksw
endsw
# Report
if ( $?ParaView_DIR ) then
if ( -d "$ParaView_DIR" && $?FOAM_VERBOSE && $?prompt ) 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"
endif
endif
unset cleaned
#------------------------------------------------------------------------------