mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: cleanup linking of MGridGen
- use similar semantics as used for dealing with metis, scotch
This commit is contained in:
@ -42,7 +42,7 @@
|
|||||||
#
|
#
|
||||||
# If using a central installation, but not located under ThirdParty:
|
# If using a central installation, but not located under ThirdParty:
|
||||||
# - specify metis-system
|
# - specify metis-system
|
||||||
# - provide full paths for METIS_ARCH_PATH
|
# - provide full path for METIS_ARCH_PATH
|
||||||
#
|
#
|
||||||
# Note
|
# Note
|
||||||
# A csh version is not needed, since the values here are only sourced
|
# A csh version is not needed, since the values here are only sourced
|
||||||
|
|||||||
61
etc/config.sh/mgridgen
Normal file
61
etc/config.sh/mgridgen
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#----------------------------------*-sh-*--------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
|
# \\/ 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/mgridgen
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Setup file for MGridGen include/libraries.
|
||||||
|
# Sourced during wmake process only.
|
||||||
|
#
|
||||||
|
# Normally used to specify the MGridGen version and location for a
|
||||||
|
# ThirdParty installation.
|
||||||
|
#
|
||||||
|
# If using system-wide installations, use the following setting:
|
||||||
|
#
|
||||||
|
# MGRIDGEN_VERSION=mgridgen-system
|
||||||
|
#
|
||||||
|
# If the system mgridgen is unusable and you don't have or want
|
||||||
|
# a ThirdParty installation:
|
||||||
|
#
|
||||||
|
# MGRIDGEN_VERSION=mgridgen-none
|
||||||
|
#
|
||||||
|
# If using a central installation, but not located under ThirdParty:
|
||||||
|
# - specify mgridgen-system
|
||||||
|
# - provide full path for MGRIDGEN_ARCH_PATH
|
||||||
|
#
|
||||||
|
# Note
|
||||||
|
# A csh version is not needed, since the values here are only sourced
|
||||||
|
# during the wmake process.
|
||||||
|
#
|
||||||
|
# MGridGen can be entirely disabled, by either renaming this file or
|
||||||
|
# by creating an empty one with the same name at a user or site location.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||||
|
|
||||||
|
MGRIDGEN_VERSION=ParMGridGen-1.0
|
||||||
|
export MGRIDGEN_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$MGRIDGEN_VERSION
|
||||||
|
|
||||||
|
# END OF (NORMAL) USER EDITABLE PART
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -7,9 +7,80 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH} # Extra safety
|
: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH} # Extra safety
|
||||||
export FOAM_EXT_LIBBIN
|
export FOAM_EXT_LIBBIN
|
||||||
|
|
||||||
export ParMGridGen=$WM_THIRD_PARTY_DIR/ParMGridGen-1.0
|
# Test for mgridgen.
|
||||||
|
# - return 0 and export MGRIDGEN_ARCH_PATH on success
|
||||||
|
hasMgridGen()
|
||||||
|
{
|
||||||
|
local warning="==> skip mgridgen"
|
||||||
|
|
||||||
if [ -e "$FOAM_LIBBIN/libMGridGen.so" ]
|
unset MGRIDGEN_ARCH_PATH MGRIDGEN_VERSION
|
||||||
|
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/mgridgen) || {
|
||||||
|
# ignore silently# echo "$warning (no config.sh/mgridgen settings)"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
. $settings
|
||||||
|
if [ -z "$MGRIDGEN_ARCH_PATH" -o "${MGRIDGEN_ARCH_PATH##*-}" = none ]
|
||||||
|
then
|
||||||
|
# ignore silently# echo "$warning (not available)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Header
|
||||||
|
local header=$MGRIDGEN_ARCH_PATH/include/mgridgen.h
|
||||||
|
[ -f "$header" ] || {
|
||||||
|
# ignore silently# echo "$warning (no header)"
|
||||||
|
return 2 # file not found
|
||||||
|
}
|
||||||
|
|
||||||
|
# Library
|
||||||
|
[ -r $FOAM_EXT_LIBBIN/libMGridGen.so ] || \
|
||||||
|
[ -r $MGRIDGEN_ARCH_PATH/lib/libmgrid.a ] || \
|
||||||
|
[ -r $MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmgrid.a ] || \
|
||||||
|
[ "${MGRIDGEN_ARCH_PATH##*-}" = system ] || {
|
||||||
|
# ignore silently# echo "$warning (missing library)"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure consistent sizes with OpenFOAM and mgridgen header
|
||||||
|
# Extract typedef for idxtype, realtype
|
||||||
|
local label=$(sed -ne \
|
||||||
|
's/^.*typedef *\([^ ]*\) *idxtype.*/\1/ip' \
|
||||||
|
"$header")
|
||||||
|
local scalar=$(sed -ne \
|
||||||
|
's/^.*typedef *\([^ ]*\) *realtype.*/\1/ip' \
|
||||||
|
"$header")
|
||||||
|
|
||||||
|
: ${label:=unknown}
|
||||||
|
: ${scalar:=unknown}
|
||||||
|
|
||||||
|
case "$WM_LABEL_SIZE:$label" in
|
||||||
|
(32:int32_t | 32:int | 64:int64_t | 64:long)
|
||||||
|
export MGRIDGEN_ARCH_PATH
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "$warning (label='$WM_LABEL_SIZE', mgridgen.h has '$label')"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$WM_PRECISION_OPTION:$scalar" in
|
||||||
|
(SP:float | DP:double)
|
||||||
|
export MGRIDGEN_ARCH_PATH
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "$warning (scalar='$WM_PRECISION_OPTION', mgridgen.h has '$scalar')"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# OK
|
||||||
|
echo "mgridgen (label=$label, scalar=$scalar) - $MGRIDGEN_ARCH_PATH"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasMgridGen
|
||||||
then
|
then
|
||||||
wmake $targetType MGridGenGamgAgglomeration
|
wmake $targetType MGridGenGamgAgglomeration
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1,15 +1,9 @@
|
|||||||
/* Needs ParMGridGen environment variable set. (see Allwmake script) */
|
|
||||||
|
|
||||||
TYPE_REAL=
|
|
||||||
#if defined(WM_SP)
|
|
||||||
TYPE_REAL=-DTYPE_REAL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(ParMGridGen)/MGridGen/Lib/lnInclude \
|
-I$(MGRIDGEN_ARCH_PATH)/include
|
||||||
-I$(ParMGridGen)/MGridGen/IMlib/lnInclude \
|
|
||||||
$(TYPE_REAL)
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-L$(FOAM_EXT_LIBBIN) -lMGridGen
|
-L$(FOAM_EXT_LIBBIN) \
|
||||||
|
-L$(MGRIDGEN_ARCH_PATH)/lib \
|
||||||
|
-L$(MGRIDGEN_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
|
||||||
|
-lmgrid
|
||||||
|
|||||||
Reference in New Issue
Block a user