openfoam/etc/config.csh/paraview

157 lines
5.7 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# 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 (and cmake)
# Sourced from OpenFOAM-<VERSION>/etc/cshrc or from foamPV alias
#
# If using system-wide installation for cmake, use the following settings:
#
# cmake_version=cmake-system
#
# Note
# The following env. variables are required for building plugins:
# ParaView_DIR
# ParaView_INCLUDE_DIR
# PV_PLUGIN_PATH
#
# If using a central installation not located under ThirdParty, you will
# need to set some environment values directly. For example,
#
# setenv ParaView_DIR /opt/paraview/paraview-5.0.1
# setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-5.0
# setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-5.0
#
# setenv PATH ${ParaView_DIR}/bin:${PATH}
# setenv LD_LIBRARY_PATH ${ParaView_DIR}/lib/paraview-5.0:${LD_LIBRARY_PATH}
# unsetenv ParaView_VERSION # avoid using ThirdParty settings
#
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
setenv ParaView_VERSION 5.3.0
setenv ParaView_MAJOR detect # Automatically determine major version
set cmake_version=cmake-system
# END OF (NORMAL) USER EDITABLE PART
#------------------------------------------------------------------------------
if ( ! $?ParaView_DIR ) setenv ParaView_DIR
# Clean PATH and LD_LIBRARY_PATH
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $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
if ( $?LD_LIBRARY_PATH ) then
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$LD_LIBRARY_PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
endif
# ThirdParty cmake
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version
if ( -r $cmake/bin/cmake ) then
# _foamAddPath not available when foamPV alias is used
setenv PATH $cmake/bin:${PATH}
endif
# Evaluate command-line parameters for ParaView
while ( $#argv > 0 )
switch ($argv[1])
case ParaView*=*:
# name=value -> setenv name value
eval "setenv $argv[1]:s/=/ /"
breaksw
endsw
shift
end
# Require that ParaView_VERSION has not been unset.
# Avoids conflict with an alternative (non-ThirdParty) installation.
if ( $?ParaView_VERSION ) then
# Set MAJOR version to correspond to VERSION
# ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION
switch ("$ParaView_VERSION")
case "$ParaView_MAJOR".*:
# Version and major appear to correspond
breaksw
case [0-9]*:
# Extract major from the version
setenv ParaView_MAJOR `echo ${ParaView_VERSION} | \
sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
breaksw
endsw
set pvName=ParaView-$ParaView_VERSION
set pvMajor=paraview-$ParaView_MAJOR
setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$pvName
# Set paths if binaries are present
if ( -r $ParaView_DIR ) then
set pvLibDir=${ParaView_DIR}/lib/$pvMajor
set pvPython=$ParaView_DIR/Utilities/VTKPythonWrapping
setenv PATH ${ParaView_DIR}/bin:${PATH}
setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/$pvMajor
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/$pvMajor
setenv LD_LIBRARY_PATH "${pvLibDir}:${LD_LIBRARY_PATH}"
# Add in python libraries if required
if ( -r $pvPython ) then
if ($?PYTHONPATH) then
setenv PYTHONPATH ${PYTHONPATH}:${pvPython}:$pvLibDir
else
setenv PYTHONPATH ${pvPython}:$pvLibDir
endif
endif
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using paraview"
echo " ParaView_DIR : $ParaView_DIR"
echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR"
echo " library dir : $pvLibDir"
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
endif
else
if ($?FOAM_VERBOSE && $?prompt) then
echo "No paraview found"
echo " ParaView_DIR : $ParaView_DIR"
endif
unsetenv ParaView_INCLUDE_DIR PV_PLUGIN_PATH
setenv ParaView_DIR # Defined but empty (used by foamPV alias)
endif
endif
unset cleaned cmake cmake_version pvName pvMajor pvLibDir pvPython
unsetenv ParaView_MAJOR ParaView_VERSION
#------------------------------------------------------------------------------