Compare commits
44 Commits
develop.mo
...
maintenanc
| Author | SHA1 | Date | |
|---|---|---|---|
| f65a95a68e | |||
| 344237b289 | |||
| b1d6297976 | |||
| 008d015689 | |||
| 0fcd1446c5 | |||
| 70451e680c | |||
| 5768a7e9c8 | |||
| 56de3901e2 | |||
| 36453aa9af | |||
| dd06e6448c | |||
| 74ff53cd88 | |||
| 173ce8511f | |||
| e93f3f6812 | |||
| 1949a31efb | |||
| eb3f7dfe74 | |||
| 2a3fd5afb4 | |||
| 06f14de0cd | |||
| 1ead175957 | |||
| 2fe9481262 | |||
| 76270c07a0 | |||
| 9d5585d37a | |||
| e1201d735f | |||
| 9aea491e58 | |||
| 00709429a5 | |||
| 864271b118 | |||
| 5790fbe2a4 | |||
| 10b9467f68 | |||
| f89de2b65c | |||
| cd2787d452 | |||
| 625f5f6cbb | |||
| d19515bfb8 | |||
| 1ea4fc986b | |||
| e3ac8fb4f4 | |||
| be6756f322 | |||
| f85e798532 | |||
| 240342b508 | |||
| 4ffea147dc | |||
| 4e884c03d2 | |||
| 6c7ae09251 | |||
| 7795f32fa6 | |||
| 14410a736a | |||
| 76137138ae | |||
| 1f83f48f3c | |||
| bc58837658 |
7
Allwmake
7
Allwmake
@ -63,11 +63,14 @@ echo
|
||||
applications/Allwmake $targetType $*
|
||||
|
||||
# Additional components/modules
|
||||
if [ -d "$WM_PROJECT_DIR/modules" ]
|
||||
if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ]
|
||||
then
|
||||
echo "========================================"
|
||||
echo "Compile OpenFOAM modules"
|
||||
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo
|
||||
elif [ -d "$WM_PROJECT_DIR/modules" ]
|
||||
then
|
||||
echo "Compile OpenFOAM modules"
|
||||
(cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all)
|
||||
fi
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=1912
|
||||
patch=200626
|
||||
patch=220610
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,13 +63,13 @@ void Foam::fluentFvMesh::writeFluentMesh() const
|
||||
/ time().caseName() + ".msh"
|
||||
);
|
||||
|
||||
Info<< "Writing Header" << endl;
|
||||
Info<< "Writing Fluent Mesh" << endl;
|
||||
|
||||
fluentMeshFile
|
||||
<< "(0 \"FOAM to Fluent Mesh File\")" << std::endl << std::endl
|
||||
<< "(0 \"Dimension:\")" << std::endl
|
||||
<< "(2 3)" << std::endl << std::endl
|
||||
<< "(0 \"Grid dimensions:\")" << std::endl;
|
||||
<< "(0 \"OpenFOAM to Fluent Mesh File\")" << nl << nl
|
||||
<< "(0 \"Dimension:\")" << nl
|
||||
<< "(2 3)" << nl << nl
|
||||
<< "(0 \"Grid dimensions:\")" << nl;
|
||||
|
||||
// Writing number of points
|
||||
fluentMeshFile
|
||||
@ -217,8 +218,8 @@ void Foam::fluentFvMesh::writeFluentMesh() const
|
||||
|
||||
// Writing cells
|
||||
fluentMeshFile
|
||||
<< "(12 (1 1 "
|
||||
<< nCells() << " 1 0)(" << std::endl;
|
||||
<< "(12 (1 1 " << nCells() << " 1 0)" << nl
|
||||
<< '(';
|
||||
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
@ -227,44 +228,59 @@ void Foam::fluentFvMesh::writeFluentMesh() const
|
||||
|
||||
const cellShapeList& cells = cellShapes();
|
||||
|
||||
bool hasWarned = false;
|
||||
label nPolys = 0;
|
||||
|
||||
int nElemPerLine = 25; // Start with linebreak and indent
|
||||
|
||||
forAll(cells, celli)
|
||||
{
|
||||
if (nElemPerLine == 25)
|
||||
{
|
||||
// 25 elements per line with initial indent (readability)
|
||||
fluentMeshFile << "\n ";
|
||||
nElemPerLine = 0;
|
||||
}
|
||||
else if (!(nElemPerLine % 5))
|
||||
{
|
||||
// Format in blocks of 5 (readability)
|
||||
fluentMeshFile << token::SPACE;
|
||||
}
|
||||
fluentMeshFile << token::SPACE;
|
||||
++nElemPerLine;
|
||||
|
||||
|
||||
if (cells[celli].model() == tet)
|
||||
{
|
||||
fluentMeshFile << " " << 2;
|
||||
fluentMeshFile << 2;
|
||||
}
|
||||
else if (cells[celli].model() == hex)
|
||||
{
|
||||
fluentMeshFile << " " << 4;
|
||||
fluentMeshFile << 4;
|
||||
}
|
||||
else if (cells[celli].model() == pyr)
|
||||
{
|
||||
fluentMeshFile << " " << 5;
|
||||
fluentMeshFile << 5;
|
||||
}
|
||||
else if (cells[celli].model() == prism)
|
||||
{
|
||||
fluentMeshFile << " " << 6;
|
||||
fluentMeshFile << 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasWarned)
|
||||
{
|
||||
hasWarned = true;
|
||||
|
||||
WarningInFunction
|
||||
<< "foamMeshToFluent: cell shape for cell "
|
||||
<< celli << " only supported by Fluent polyhedral meshes."
|
||||
<< nl
|
||||
<< " Suppressing any further messages for polyhedral"
|
||||
<< " cells." << endl;
|
||||
}
|
||||
fluentMeshFile << " " << 7;
|
||||
fluentMeshFile << 7;
|
||||
++nPolys;
|
||||
}
|
||||
}
|
||||
|
||||
fluentMeshFile << ")())" << std::endl;
|
||||
fluentMeshFile
|
||||
<< nl << "))" << nl;
|
||||
|
||||
|
||||
if (nPolys)
|
||||
{
|
||||
Info<< "Mesh had " << nPolys << " polyhedrals." << endl;
|
||||
}
|
||||
|
||||
|
||||
// Return to dec
|
||||
fluentMeshFile.setf(ios::dec, ios::basefield);
|
||||
|
||||
@ -169,14 +169,22 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"translate",
|
||||
"vector",
|
||||
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
|
||||
"Translate by specified <vector> before rotations"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"auto-centre",
|
||||
"Use bounding box centre as centre for rotations"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"origin",
|
||||
"centre",
|
||||
"point",
|
||||
"Use specified <point> as origin for rotations"
|
||||
"Use specified <point> as centre for rotations"
|
||||
);
|
||||
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
|
||||
argList::addOptionCompat("centre", {"origin", 2206});
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"rotate",
|
||||
@ -290,18 +298,24 @@ int main(int argc, char *argv[])
|
||||
if (args.readIfPresent("translate", v))
|
||||
{
|
||||
Info<< "Translating points by " << v << endl;
|
||||
|
||||
points += v;
|
||||
}
|
||||
|
||||
vector origin;
|
||||
const bool useOrigin = args.readIfPresent("origin", origin);
|
||||
if (useOrigin)
|
||||
vector rotationCentre;
|
||||
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
|
||||
if (args.found("auto-centre") && !useRotationCentre)
|
||||
{
|
||||
Info<< "Set origin for rotations to " << origin << endl;
|
||||
points -= origin;
|
||||
useRotationCentre = true;
|
||||
rotationCentre = boundBox(points).centre();
|
||||
}
|
||||
|
||||
if (useRotationCentre)
|
||||
{
|
||||
Info<< "Set centre of rotation to " << rotationCentre << endl;
|
||||
points -= rotationCentre;
|
||||
}
|
||||
|
||||
|
||||
if (args.found("rotate"))
|
||||
{
|
||||
Pair<vector> n1n2
|
||||
@ -380,6 +394,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (useRotationCentre)
|
||||
{
|
||||
Info<< "Unset centre of rotation from " << rotationCentre << endl;
|
||||
points += rotationCentre;
|
||||
}
|
||||
|
||||
|
||||
List<scalar> scaling;
|
||||
if (args.readListIfPresent("scale", scaling))
|
||||
{
|
||||
@ -410,12 +431,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (useOrigin)
|
||||
{
|
||||
Info<< "Unset origin for rotations from " << origin << endl;
|
||||
points += origin;
|
||||
}
|
||||
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||
|
||||
@ -73,10 +73,10 @@ if (doLagrangian)
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIters(theseCloudFields, fieldIter)
|
||||
// Field order may differ on individual processors, so sort by name
|
||||
for (const word& fieldName : theseCloudFields.sortedToc())
|
||||
{
|
||||
const word& fieldName = fieldIter.key();
|
||||
const word& fieldType = fieldIter.val();
|
||||
const word& fieldType = theseCloudFields[fieldName];
|
||||
|
||||
IOobject fieldObject
|
||||
(
|
||||
@ -94,9 +94,13 @@ if (doLagrangian)
|
||||
// but that combination does not work.
|
||||
// So check the header and sync globally
|
||||
|
||||
const bool parRun = Pstream::parRun();
|
||||
Pstream::parRun() = false;
|
||||
|
||||
fieldExists =
|
||||
fieldObject.typeHeaderOk<IOField<scalar>>(false);
|
||||
|
||||
Pstream::parRun() = parRun;
|
||||
reduce(fieldExists, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
@ -678,7 +678,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for
|
||||
(
|
||||
const word& opt
|
||||
const char * const opt
|
||||
: { "cellSet", "cellZone", "faceSet", "pointSet" }
|
||||
)
|
||||
{
|
||||
|
||||
@ -898,7 +898,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (exprDictPtr.valid())
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No command-line or dictionary??" << nl << endl
|
||||
|
||||
@ -92,7 +92,7 @@ bool setCellFieldType
|
||||
|
||||
fieldType field(fieldHeader, mesh, false);
|
||||
|
||||
const Type& value = pTraits<Type>(fieldValueStream);
|
||||
const Type value = pTraits<Type>(fieldValueStream);
|
||||
|
||||
if (selectedCells.size() == field.size())
|
||||
{
|
||||
@ -244,7 +244,7 @@ bool setFaceFieldType
|
||||
|
||||
fieldType field(fieldHeader, mesh);
|
||||
|
||||
const Type& value = pTraits<Type>(fieldValueStream);
|
||||
const Type value = pTraits<Type>(fieldValueStream);
|
||||
|
||||
// Create flat list of selected faces and their value.
|
||||
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());
|
||||
|
||||
@ -82,12 +82,20 @@ int main(int argc, char *argv[])
|
||||
"vector",
|
||||
"Translate by specified <vector> - eg, '(1 0 0)' before rotations"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"auto-centre",
|
||||
"Use bounding box centre as centre for rotations"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"origin",
|
||||
"centre",
|
||||
"point",
|
||||
"Use specified <point> as origin for rotations"
|
||||
"Use specified <point> as centre for rotations"
|
||||
);
|
||||
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
|
||||
argList::addOptionCompat("centre", {"origin", 2206});
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"rotate",
|
||||
@ -165,18 +173,24 @@ int main(int argc, char *argv[])
|
||||
if (args.readIfPresent("translate", v))
|
||||
{
|
||||
Info<< "Translating points by " << v << endl;
|
||||
|
||||
points += v;
|
||||
}
|
||||
|
||||
vector origin;
|
||||
const bool useOrigin = args.readIfPresent("origin", origin);
|
||||
if (useOrigin)
|
||||
vector rotationCentre;
|
||||
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
|
||||
if (args.found("auto-centre") && !useRotationCentre)
|
||||
{
|
||||
Info<< "Set origin for rotations to " << origin << endl;
|
||||
points -= origin;
|
||||
useRotationCentre = true;
|
||||
rotationCentre = boundBox(points).centre();
|
||||
}
|
||||
|
||||
if (useRotationCentre)
|
||||
{
|
||||
Info<< "Set centre of rotation to " << rotationCentre << endl;
|
||||
points -= rotationCentre;
|
||||
}
|
||||
|
||||
|
||||
if (args.found("rotate"))
|
||||
{
|
||||
Pair<vector> n1n2
|
||||
@ -235,6 +249,13 @@ int main(int argc, char *argv[])
|
||||
points = transform(rot, points);
|
||||
}
|
||||
|
||||
if (useRotationCentre)
|
||||
{
|
||||
Info<< "Unset centre of rotation from " << rotationCentre << endl;
|
||||
points += rotationCentre;
|
||||
}
|
||||
|
||||
|
||||
List<scalar> scaling;
|
||||
if (args.readListIfPresent("scale", scaling))
|
||||
{
|
||||
@ -265,11 +286,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (useOrigin)
|
||||
{
|
||||
Info<< "Unset origin for rotations from " << origin << endl;
|
||||
points += origin;
|
||||
}
|
||||
|
||||
surf1.movePoints(points);
|
||||
surf1.write(outFileName);
|
||||
|
||||
430
bin/tools/install-dirs
Executable file
430
bin/tools/install-dirs
Executable file
@ -0,0 +1,430 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# install-dirs
|
||||
#
|
||||
# Example usage
|
||||
# install-dirs -prefix=/opt/openfoam/openfoamVER -core
|
||||
#
|
||||
# Description
|
||||
# Simple installer to copy architecture-independent directories.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION]
|
||||
|
||||
input options:
|
||||
-source=SOURCE Source directory
|
||||
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
|
||||
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
|
||||
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
|
||||
|
||||
target options:
|
||||
-prefix=PREFIX Top-level installation directory in PREFIX ['']
|
||||
|
||||
selections:
|
||||
-[no-]common [do not] install (bin, etc, META-INFO)
|
||||
-[no-]devel [do not] install (applications, src, wmake)
|
||||
-[no-]doc [do not] install (doc)
|
||||
-[no-]tut [do not] install (tutorials)
|
||||
-no-app, -no-apps do not install (applications)
|
||||
-no-src do not install (src)
|
||||
-no-wmake do not install (wmake)
|
||||
|
||||
bundled selections:
|
||||
-core Select: -common -devel
|
||||
-default Select: -common -devel -doc -tut
|
||||
|
||||
tuning options:
|
||||
-collate Collate modules (doc, tutorials)
|
||||
-collate-doc Collate modules (doc) into doc/modules
|
||||
-collate-tut Collate modules (tutorials) into tutorials/modules
|
||||
|
||||
general options:
|
||||
-dry-run, -n Do not perform any operations
|
||||
-force, -f Ignored
|
||||
-verbose, -v Additional verbosity
|
||||
-help Print the help and exit
|
||||
|
||||
|
||||
Simple installer to copy OpenFOAM non-binary directories.
|
||||
|
||||
Example,
|
||||
${0##*/} -prefix=/opt/openfoamVER
|
||||
|
||||
USAGE
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
unset optDryRun hadError
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
exec 1>&2
|
||||
echo
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Report error and exit
|
||||
warnOrDie()
|
||||
{
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
hadError=true
|
||||
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
|
||||
else
|
||||
die "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Get the option's value (argument), or die on missing or empty value
|
||||
# $1 option=value
|
||||
getOptionValue()
|
||||
{
|
||||
local value="${1#*=}"
|
||||
# Remove any surrounding double quotes
|
||||
value="${value%\"}"
|
||||
value="${value#\"}"
|
||||
|
||||
[ -n "$value" ] || die "'${1%=}' option requires a value"
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
|
||||
# $1 option
|
||||
# [$2] truth value <true>
|
||||
getBoolOption()
|
||||
{
|
||||
case "$1" in
|
||||
(-no-* | -without-*) echo "false" ;;
|
||||
(*) echo "${2:-true}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Defaults from current OpenFOAM environment
|
||||
sourceDir="$WM_PROJECT_DIR"
|
||||
platform="$WM_OPTIONS"
|
||||
foam_mpi="$FOAM_MPI"
|
||||
|
||||
unset install_common install_devel
|
||||
unset install_app install_src install_wmake
|
||||
unset install_doc optCollate_doc
|
||||
unset install_tut optCollate_tut
|
||||
unset optCollate
|
||||
|
||||
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help*) printHelp ;;
|
||||
-n | -dry-run) optDryRun="(dry-run) " ;;
|
||||
-v | -verbose) optVerbose=true ;;
|
||||
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||
|
||||
# Inputs
|
||||
-source=*) sourceDir="$(getOptionValue "$1")" ;;
|
||||
-platform=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||
-foam-mpi=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||
|
||||
# Targets
|
||||
-prefix=*) prefix="$(getOptionValue "$1")" ;;
|
||||
-exec-prefix=*) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||
|
||||
# Selections
|
||||
-common | -no-common) install_common="$(getBoolOption "$1")" ;;
|
||||
-devel | -no-devel) install_devel="$(getBoolOption "$1")" ;;
|
||||
-doc | -no-doc) install_doc="$(getBoolOption "$1")" ;;
|
||||
-tut | -no-tut) install_tut="$(getBoolOption "$1")" ;;
|
||||
-no-app | -no-apps) install_app="$(getBoolOption "$1")" ;;
|
||||
-no-src) install_src="$(getBoolOption "$1")" ;;
|
||||
-no-wmake) install_wmake="$(getBoolOption "$1")" ;;
|
||||
|
||||
-core)
|
||||
install_common=true
|
||||
install_devel=true
|
||||
;;
|
||||
|
||||
-default | -all)
|
||||
[ "$1" = "-all" ] && echo "Compat: treat $1 like -default" 1>&2
|
||||
install_common=true
|
||||
install_devel=true
|
||||
install_doc=true
|
||||
install_tut=true
|
||||
;;
|
||||
|
||||
-collate | -no-collate)
|
||||
optCollate="$(getBoolOption "$1")"
|
||||
if [ "${optCollate:-false}" = false ]
|
||||
then
|
||||
unset optCollate optCollate_doc optCollate_tut
|
||||
fi
|
||||
;;
|
||||
-collate-doc) optCollate_doc=true ;;
|
||||
-collate-tut) optCollate_tut=true ;;
|
||||
|
||||
(*) die "Unknown option/argument: $1" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
[ "${install_common:-false}" = false ] && unset install_common
|
||||
if [ "${install_devel:-false}" = false ]
|
||||
then
|
||||
unset install_devel install_app install_src install_wmake
|
||||
fi
|
||||
|
||||
if [ "${install_doc:-false}" = false ]
|
||||
then
|
||||
unset install_doc
|
||||
elif [ "$optCollate_doc" = true ] || [ "$optCollate" = true ]
|
||||
then
|
||||
install_doc=collate
|
||||
fi
|
||||
|
||||
if [ "${install_tut:-false}" = false ]
|
||||
then
|
||||
unset install_tut
|
||||
elif [ "$optCollate_tut" = true ] || [ "$optCollate" = true ]
|
||||
then
|
||||
install_tut=collate
|
||||
fi
|
||||
|
||||
|
||||
# Input checks
|
||||
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
|
||||
|
||||
# Installation sanity check
|
||||
[ -n "$prefix" ] || warnOrDie "Must specify -prefix"
|
||||
|
||||
if [ -n "$hadError" ]
|
||||
then
|
||||
echo "Errors encounters in dry-run. Stopping" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${install_common}${install_devel}${install_doc}${install_tut}" ]
|
||||
then
|
||||
exec 1>&2
|
||||
echo "Nothing specified to install"
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo
|
||||
exit 0 # Treat as not an error
|
||||
fi
|
||||
|
||||
# Report settings
|
||||
echo "Preparing install with the following parameters" 1>&2
|
||||
echo "source:" 1>&2
|
||||
echo " directory $sourceDir" 1>&2
|
||||
echo 1>&2
|
||||
echo "target" 1>&2
|
||||
echo " prefix ${prefix-[]}" 1>&2
|
||||
##echo " binary ${install_binary:-[disabled]}" 1>&2
|
||||
echo " common ${install_common:-[disabled]}" 1>&2
|
||||
echo -n " devel " 1>&2
|
||||
if [ -n "$install_devel" ]
|
||||
then
|
||||
echo -n "true" 1>&2
|
||||
[ "$install_app" = false ] && echo -n " [app=disabled]" 1>&2
|
||||
[ "$install_src" = false ] && echo -n " [src=disabled]" 1>&2
|
||||
[ "$install_wmake" = false ] && echo -n " [wmake=disabled]" 1>&2
|
||||
echo 1>&2
|
||||
else
|
||||
echo "[disabled]" 1>&2
|
||||
fi
|
||||
echo " doc ${install_doc:-[disabled]}" 1>&2
|
||||
echo " tut ${install_tut:-[disabled]}" 1>&2
|
||||
echo 1>&2
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Proper umask
|
||||
umask 022
|
||||
|
||||
# The commands
|
||||
copy_cmd="cp -a ${optVerbose:+-v}"
|
||||
mkdir_cmd="mkdir -p"
|
||||
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
if [ -n "$optVerbose" ]
|
||||
then
|
||||
copy_cmd="echo cp -a"
|
||||
mkdir_cmd="echo mkdir -p"
|
||||
else
|
||||
copy_cmd="true"
|
||||
mkdir_cmd="true"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Copy file or directory to <prefix>
|
||||
doCopy()
|
||||
{
|
||||
$mkdir_cmd "$prefix" 2>/dev/null
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
if [ -e "$sourceDir/$i" ]
|
||||
then
|
||||
$copy_cmd "$sourceDir/$i" "$prefix"
|
||||
nCopied="x$nCopied"
|
||||
else
|
||||
echo "Missing? $sourceDir/$i" 1>&2
|
||||
fi
|
||||
done
|
||||
echo "${optDryRun}${#nCopied} items copied" 1>&2
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Collate (doc | tutorials)
|
||||
# Eg,
|
||||
# modules/{NAME}/tutorials
|
||||
# => tutorials/modules/{NAME}
|
||||
collateModuleFiles()
|
||||
{
|
||||
local subDir="$1"
|
||||
local subTarget="$prefix/$subDir/modules"
|
||||
|
||||
if [ -d "$sourceDir/modules" ]
|
||||
then
|
||||
(
|
||||
cd "$sourceDir/modules" || exit
|
||||
|
||||
$mkdir_cmd "$subTarget"
|
||||
|
||||
for i in $(find . -mindepth 2 -maxdepth 2 -name "$subDir" -type d)
|
||||
do
|
||||
$mkdir_cmd "$subTarget/${i%/*}"
|
||||
$copy_cmd "$i"/* "$subTarget/${i%/*}"
|
||||
done
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# common
|
||||
# ----
|
||||
message="${optDryRun}Install common:"
|
||||
if [ -n "$install_common" ]
|
||||
then
|
||||
echo "${message} bin etc META-INFO" 1>&2
|
||||
doCopy bin etc META-INFO
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
# develop (or source)
|
||||
# ----
|
||||
message="${optDryRun}Install devel:" 1>&2
|
||||
unset dirNames blockMessage
|
||||
if [ -n "$install_devel" ]
|
||||
then
|
||||
if [ "$install_wmake" = false ]
|
||||
then
|
||||
blockMessage="$blockMessage [wmake=disabled]"
|
||||
else
|
||||
dirNames="$dirNames wmake"
|
||||
fi
|
||||
if [ "$install_src" = false ]
|
||||
then
|
||||
blockMessage="$blockMessage [src=disabled]"
|
||||
else
|
||||
dirNames="$dirNames src"
|
||||
fi
|
||||
if [ "$install_app" = false ]
|
||||
then
|
||||
blockMessage="$blockMessage [app=disabled]"
|
||||
else
|
||||
dirNames="$dirNames applications"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$dirNames" ]
|
||||
then
|
||||
echo "${message}${dirNames}${blockMessage}" 1>&2
|
||||
doCopy $dirNames # Unquoted - uses word splitting
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
# doc
|
||||
# ----
|
||||
message="${optDryRun}Install doc:" 1>&2
|
||||
if [ -n "$install_doc" ]
|
||||
then
|
||||
echo "${message}" 1>&2
|
||||
doCopy doc
|
||||
|
||||
if [ "$install_doc" = collate ]
|
||||
then
|
||||
echo "${optDryRun}Collate module doc:" 1>&2
|
||||
collateModuleFiles doc
|
||||
fi
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
# tutorials
|
||||
# ----
|
||||
message="${optDryRun}Install tutorials:" 1>&2
|
||||
if [ -n "$install_tut" ]
|
||||
then
|
||||
echo "${message}" 1>&2
|
||||
doCopy tutorials
|
||||
|
||||
if [ "$install_tut" = collate ]
|
||||
then
|
||||
echo "${optDryRun}Collate module tutorials:" 1>&2
|
||||
collateModuleFiles tutorials
|
||||
fi
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
[ -n "$optVerbose" ] && echo 1>&2
|
||||
echo "${optDryRun}Done" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
exit 0 # clean exit
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
375
bin/tools/install-platform
Executable file
375
bin/tools/install-platform
Executable file
@ -0,0 +1,375 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# install-platform
|
||||
#
|
||||
# Example usage
|
||||
# install-platform -prefix=/opt/openfoam/openfoamVER
|
||||
#
|
||||
# Description
|
||||
# Simple installer to copy OpenFOAM binary bin/, lib/ (platforms)
|
||||
# directories.
|
||||
#
|
||||
# Note
|
||||
# The platforms/tools directory still must be handled separately
|
||||
#
|
||||
# Layout of OpenFOAM platforms
|
||||
#
|
||||
# platforms
|
||||
# |-- <WM_OPTIONS>
|
||||
# |-- bin
|
||||
# | |-- ...
|
||||
# `-- lib
|
||||
# |-- ...
|
||||
# |-- dummy
|
||||
# | `-- ...
|
||||
# |-- sys-openmpi
|
||||
# | |-- libPstream.so
|
||||
# | `-- libptscotchDecomp.so
|
||||
# `-- paraview-MAJ.MIN
|
||||
# `-- ...
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION]
|
||||
|
||||
input options:
|
||||
-source=SOURCE Source directory
|
||||
[\$WM_PROJECT_DIR ${WM_PROJECT_DIR:-''}]
|
||||
-platform=PLATFORM OpenFOAM platform name [\$WM_OPTIONS ${WM_OPTIONS:-''}]
|
||||
-foam-mpi=FOAM_MPI OpenFOAM mpi name [\$FOAM_MPI ${FOAM_MPI:-''}]
|
||||
|
||||
target options:
|
||||
-prefix=PREFIX Top-level installation directory in PREFIX ['']
|
||||
-exec-prefix=EPREFIX Architecture-dependent in EPREFIX
|
||||
[PREFIX/platforms/PLATFORM]
|
||||
-bindir=DIR bin directory [EPREFIX/bin]
|
||||
-libdir=DIR lib directory [EPREFIX/lib]
|
||||
-mpi-libdir=DIR mpi libdir [<libdir>/FOAM_MPI]
|
||||
|
||||
tuning options:
|
||||
-no-bin Do not install bin directory
|
||||
-no-lib Do not install lib directory
|
||||
-no-mpi Do not install mpi lib directory
|
||||
-mpi-only Only install mpi lib directory
|
||||
-mpi-mkdir Create foam-mpi directory within libdir
|
||||
|
||||
general options:
|
||||
-dry-run, -n Do not perform any operations
|
||||
-force, -f Ignored
|
||||
-verbose, -v Additional verbosity
|
||||
-help Print the help and exit
|
||||
|
||||
|
||||
Simple installer to copy OpenFOAM binary bin/, lib/ (platforms) directories.
|
||||
|
||||
Example,
|
||||
${0##*/} -prefix=/opt/openfoamVER
|
||||
|
||||
USAGE
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
unset optDryRun hadError
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
exec 1>&2
|
||||
echo
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Report error and exit
|
||||
warnOrDie()
|
||||
{
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
hadError=true
|
||||
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
|
||||
else
|
||||
die "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Get the option's value (argument), or die on missing or empty value
|
||||
# $1 option=value
|
||||
getOptionValue()
|
||||
{
|
||||
local value="${1#*=}"
|
||||
# Remove any surrounding double quotes
|
||||
value="${value%\"}"
|
||||
value="${value#\"}"
|
||||
|
||||
[ -n "$value" ] || die "'${1%=}' option requires a value"
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
|
||||
# Test for '-no-' or '-without-' prefix. Return "false" or "true"
|
||||
# $1 option
|
||||
# [$2] truth value <true>
|
||||
getBoolOption()
|
||||
{
|
||||
case "$1" in
|
||||
(-no-* | -without-*) echo "false" ;;
|
||||
(*) echo "${2:-true}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Defaults from current OpenFOAM environment
|
||||
sourceDir="$WM_PROJECT_DIR"
|
||||
platform="$WM_OPTIONS"
|
||||
foam_mpi="$FOAM_MPI"
|
||||
|
||||
unset install_bin install_lib
|
||||
unset optMkdir_mpi
|
||||
install_mpi=true
|
||||
|
||||
unset prefix exec_prefix bindir libdir libdir_mpi optVerbose
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help*) printHelp ;;
|
||||
-n | -dry-run) optDryRun="(dry-run) " ;;
|
||||
-v | -verbose) optVerbose=true ;;
|
||||
-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
|
||||
|
||||
# Inputs
|
||||
-source=*) sourceDir="$(getOptionValue "$1")" ;;
|
||||
-platform=*) platform="$(getOptionValue "$1")" ;;
|
||||
-foam-mpi=*) foam_mpi="$(getOptionValue "$1")" ;;
|
||||
|
||||
# Targets
|
||||
-prefix=*) prefix="$(getOptionValue "$1")" ;;
|
||||
-exec-prefix=*) exec_prefix="$(getOptionValue "$1")" ;;
|
||||
|
||||
-bindir=*) bindir="$(getOptionValue "$1")" ;;
|
||||
-libdir=*) libdir="$(getOptionValue "$1")" ;;
|
||||
-mpi-libdir=*) libdir_mpi="$(getOptionValue "$1")" ;;
|
||||
|
||||
-no-bin) install_bin=false ;;
|
||||
-no-lib) install_lib=false ;;
|
||||
-no-mpi) install_mpi=false ;;
|
||||
-mpi-only) install_mpi=exclusive ;;
|
||||
-mpi-mkdir) optMkdir_mpi=true ;;
|
||||
|
||||
(*) die "Unknown option/argument: $1" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Default <exec_prefix> based on <prefix>
|
||||
if [ -z "$exec_prefix" ] && [ -n "$prefix" ]
|
||||
then
|
||||
exec_prefix="$prefix/platforms/$platform"
|
||||
fi
|
||||
|
||||
# Default <bindir>, <libdir> based on <exec_prefix>
|
||||
if [ -n "$exec_prefix" ]
|
||||
then
|
||||
[ -n "$bindir" ] || bindir="$exec_prefix/bin"
|
||||
[ -n "$libdir" ] || libdir="$exec_prefix/lib"
|
||||
fi
|
||||
|
||||
# Default <mpi-libdir> based on <libdir> and <foam-mpi>
|
||||
if [ -z "$libdir_mpi" ] && [ -n "$libdir" ]
|
||||
then
|
||||
libdir_mpi="$libdir/$foam_mpi"
|
||||
fi
|
||||
|
||||
# Exclusions
|
||||
if [ "$install_bin" = false ] || [ "$install_mpi" = exclusive ]
|
||||
then
|
||||
unset bindir
|
||||
fi
|
||||
if [ "$install_lib" = false ] || [ "$install_mpi" = exclusive ]
|
||||
then
|
||||
unset libdir
|
||||
fi
|
||||
if [ "$install_mpi" = false ]
|
||||
then
|
||||
unset libdir_mpi
|
||||
fi
|
||||
|
||||
|
||||
# Input checks
|
||||
|
||||
sourcePlatform="$sourceDir/platforms/$platform"
|
||||
|
||||
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
|
||||
[ -n "$platform" ] || warnOrDie "No -platform detected or specified"
|
||||
[ -n "$foam_mpi" ] || warnOrDie "No -foam-mpi detected or specified"
|
||||
|
||||
[ -d "$sourcePlatform" ] || \
|
||||
warnOrDie "Missing platforms directory for: $platform"
|
||||
|
||||
|
||||
# Installation sanity check
|
||||
[ -n "$bindir$libdir$libdir_mpi" ] || \
|
||||
warnOrDie "Must specify at least one of -prefix, -exec-prefix, -bindir, -libdir, -mpi-libdir"
|
||||
|
||||
|
||||
if [ -n "$hadError" ]
|
||||
then
|
||||
echo "Errors encounters in dry-run. Stopping" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Report settings
|
||||
echo "Preparing install with the following parameters" 1>&2
|
||||
echo "source:" 1>&2
|
||||
echo " directory $sourceDir" 1>&2
|
||||
echo " platform $platform" 1>&2
|
||||
echo " foam-mpi $foam_mpi" 1>&2
|
||||
echo 1>&2
|
||||
echo "target (mpi-install: $install_mpi)" 1>&2
|
||||
echo " prefix ${prefix-[]}" 1>&2
|
||||
echo " exec-prefix ${exec_prefix:-[]}" 1>&2
|
||||
echo " bindir ${bindir:-[]}" 1>&2
|
||||
echo " libdir ${libdir:-[]}" 1>&2
|
||||
echo " libdir(mpi) ${libdir_mpi:-[]}" 1>&2
|
||||
echo 1>&2
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Proper umask
|
||||
umask 022
|
||||
|
||||
# The commands
|
||||
copy_cmd="cp -a ${optVerbose:+-v}"
|
||||
mkdir_cmd="mkdir -p"
|
||||
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
if [ -n "$optVerbose" ]
|
||||
then
|
||||
copy_cmd="echo cp -a"
|
||||
mkdir_cmd="echo mkdir -p"
|
||||
else
|
||||
copy_cmd="true"
|
||||
mkdir_cmd="true"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# bin/
|
||||
# ----
|
||||
message="${optDryRun}Install bindir:"
|
||||
if [ -n "$bindir" ]
|
||||
then
|
||||
input="$sourcePlatform/bin"
|
||||
|
||||
echo "From $input" 1>&2
|
||||
echo "${message} $bindir" 1>&2
|
||||
|
||||
$mkdir_cmd "$bindir" 2>/dev/null
|
||||
|
||||
for i in "$input/"*
|
||||
do
|
||||
if [ -e "$i" ]
|
||||
then
|
||||
$copy_cmd "$i" "$bindir"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
# lib/ without mpi
|
||||
# ----
|
||||
message="${optDryRun}Install libdir(non-mpi):"
|
||||
if [ -n "$libdir" ]
|
||||
then
|
||||
input="$sourcePlatform/lib"
|
||||
|
||||
echo "From $input" 1>&2
|
||||
echo "${message} $libdir" 1>&2
|
||||
|
||||
$mkdir_cmd "$libdir" 2>/dev/null
|
||||
|
||||
for i in "$input/"*
|
||||
do
|
||||
if [ "${i##*/}" = "$foam_mpi" ]
|
||||
then
|
||||
if [ "$optMkdir_mpi" = true ]
|
||||
then
|
||||
$mkdir_cmd "$libdir/$foam_mpi"
|
||||
fi
|
||||
elif [ -e "$i" ]
|
||||
then
|
||||
$copy_cmd "$i" "$libdir"
|
||||
else
|
||||
echo "bogus lib entry? $i" 1>&2
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
# lib/mpi
|
||||
# ----
|
||||
message="${optDryRun}Install libdir(mpi):"
|
||||
if [ -n "$libdir_mpi" ]
|
||||
then
|
||||
input="$sourcePlatform/lib/$foam_mpi"
|
||||
|
||||
echo "From $input" 1>&2
|
||||
echo "${message} $libdir_mpi" 1>&2
|
||||
|
||||
$mkdir_cmd "$libdir_mpi" 2>/dev/null
|
||||
|
||||
for i in "$input"/*
|
||||
do
|
||||
if [ -e "$i" ]
|
||||
then
|
||||
# Always verbose (not many files anyhow)
|
||||
$copy_cmd -v "$i" "$libdir_mpi"
|
||||
else
|
||||
echo "bogus mpi-lib entry? $i" 1>&2
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "${message} [disabled]" 1>&2
|
||||
fi
|
||||
# ----
|
||||
|
||||
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
[ -n "$optVerbose" ] && echo 1>&2
|
||||
echo "${optDryRun}Done" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
exit 0 # A clean exit
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
75
bin/tools/update-mpi-links.in
Normal file
75
bin/tools/update-mpi-links.in
Normal file
@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
FOAM_MPI="@FOAM_MPI@"
|
||||
FOAM_SYSTEM_MPI_LIBBIN="@FOAM_SYSTEM_MPI_LIBBIN@"
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Description
|
||||
# Update of links from system mpi lib/ to local lib/mpi-name
|
||||
#
|
||||
# Note
|
||||
# Normally located as a trigger within the platforms/ directory
|
||||
# Uses hard-coded values (eg, generated with autoconfig).
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
# Local values
|
||||
FOAM_LIBBIN="$(pwd -P)/lib"
|
||||
FOAM_MPI_LIBBIN="$FOAM_LIBBIN/$FOAM_MPI"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
echo "Link OpenFOAM ($FOAM_MPI) from system locations"
|
||||
echo "Target: $FOAM_MPI_LIBBIN"
|
||||
echo "Source: $FOAM_SYSTEM_MPI_LIBBIN"
|
||||
|
||||
if [ -z "$FOAM_MPI" ]
|
||||
then
|
||||
echo "FOAM_MPI not defined - skipping"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$FOAM_SYSTEM_MPI_LIBBIN" ]
|
||||
then
|
||||
echo "FOAM_SYSTEM_MPI_LIBBIN not defined - skipping"
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -d "$FOAM_SYSTEM_MPI_LIBBIN" ]
|
||||
then
|
||||
echo "No system mpi lib: $FOAM_SYSTEM_MPI_LIBBIN"
|
||||
echo "... not updating"
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -d "$FOAM_LIBBIN" ]
|
||||
then
|
||||
echo "Missing $FOAM_LIBBIN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
mkdir -p "$FOAM_MPI_LIBBIN"
|
||||
|
||||
# Create symlinks
|
||||
(
|
||||
cd "$FOAM_MPI_LIBBIN" || exit
|
||||
|
||||
for i in "$FOAM_SYSTEM_MPI_LIBBIN"/*
|
||||
do
|
||||
if [ -f "$i" ]
|
||||
then
|
||||
ln -svf "$i" "${i##*/}"
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
exit 0 # clean exit
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,7 +49,7 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
||||
"ODESolver",
|
||||
solverType,
|
||||
*dictionaryConstructorTablePtr_
|
||||
) << exit(FatalError);
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<ODESolver>(cstrIter()(odes, dict));
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -86,7 +86,19 @@ inline bool Foam::HashPtrTable<T, Key, Hash>::set
|
||||
T* ptr
|
||||
)
|
||||
{
|
||||
return this->parent_type::set(key, ptr);
|
||||
// Newer: const T* old = this->get(key);
|
||||
|
||||
iterator iter(this->find(key));
|
||||
const T* old = (iter.good() ? iter.val() : nullptr);
|
||||
|
||||
const bool ok = this->parent_type::set(key, ptr);
|
||||
|
||||
if (ok && old != ptr)
|
||||
{
|
||||
delete const_cast<T*>(old);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ void Foam::List<T>::doResize(const label newSize)
|
||||
{
|
||||
if (newSize > 0)
|
||||
{
|
||||
// With sign-check to avoid spurious -Walloc-size-larger-than
|
||||
T* nv = new T[newSize];
|
||||
|
||||
const label overlap = min(this->size_, newSize);
|
||||
|
||||
@ -31,8 +31,9 @@ License
|
||||
template<class T>
|
||||
inline void Foam::List<T>::doAlloc()
|
||||
{
|
||||
if (this->size_)
|
||||
if (this->size_ > 0)
|
||||
{
|
||||
// With sign-check to avoid spurious -Walloc-size-larger-than
|
||||
this->v_ = new T[this->size_];
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -79,7 +79,7 @@ void Foam::sortedOrder
|
||||
template<class T>
|
||||
void Foam::sort(UPtrList<T>& list)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order(list.size());
|
||||
sortedOrder(list, order);
|
||||
list.sortOrder(order, false); // false = allow nullptr
|
||||
}
|
||||
@ -88,7 +88,7 @@ void Foam::sort(UPtrList<T>& list)
|
||||
template<class T, class Compare>
|
||||
void Foam::sort(UPtrList<T>& list, const Compare& comp)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order(list.size());
|
||||
sortedOrder(list, order, comp);
|
||||
list.sortOrder(order, false); // false = allow nullptr
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef OSHA1stream_H
|
||||
#define OSHA1stream_H
|
||||
#ifndef Foam_OSHA1stream_H
|
||||
#define Foam_OSHA1stream_H
|
||||
|
||||
#include "OSstream.H"
|
||||
#include "SHA1.H"
|
||||
@ -63,10 +63,17 @@ class osha1stream
|
||||
|
||||
protected:
|
||||
|
||||
//- Handle overflow
|
||||
virtual int overflow(int c = EOF)
|
||||
{
|
||||
if (c != EOF) sha1_.append(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
//- Put sequence of characters
|
||||
virtual std::streamsize xsputn(const char* s, std::streamsize n)
|
||||
{
|
||||
sha1_.append(s, n);
|
||||
if (n) sha1_.append(s, n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
|
||||
OTstream toks;
|
||||
result.writeValue(toks);
|
||||
|
||||
return std::move(toks);
|
||||
return tokenList(std::move(toks.tokens()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,7 +26,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
@ -55,20 +55,22 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
|
||||
if
|
||||
(
|
||||
actualPatchType == word::null
|
||||
actualPatchType.empty()
|
||||
|| actualPatchType != p.type()
|
||||
)
|
||||
{
|
||||
if (pfPtr().constraintType() != p.constraintType())
|
||||
{
|
||||
// Use default constraint type
|
||||
// Incompatible (constraint-wise) with the patch type
|
||||
// - use default constraint type
|
||||
|
||||
auto patchTypeCstrIter =
|
||||
pointPatchConstructorTablePtr_->cfind(p.type());
|
||||
|
||||
if (!patchTypeCstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "inconsistent patch and patchField types for \n"
|
||||
<< "Inconsistent patch and patchField types for\n"
|
||||
<< " patch type " << p.type()
|
||||
<< " and patchField type " << patchFieldType
|
||||
<< exit(FatalError);
|
||||
@ -138,20 +140,17 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
|
||||
if
|
||||
(
|
||||
!dict.found("patchType")
|
||||
!dict.found("patchType")
|
||||
|| dict.get<word>("patchType") != p.type()
|
||||
)
|
||||
{
|
||||
if (pfPtr().constraintType() == p.constraintType())
|
||||
if (pfPtr().constraintType() != p.constraintType())
|
||||
{
|
||||
// Compatible (constraint-wise) with the patch type
|
||||
return pfPtr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use default constraint type
|
||||
auto patchTypeCstrIter
|
||||
= dictionaryConstructorTablePtr_->cfind(p.type());
|
||||
// Incompatible (constraint-wise) with the patch type
|
||||
// - use default constraint type
|
||||
|
||||
auto patchTypeCstrIter =
|
||||
dictionaryConstructorTablePtr_->cfind(p.type());
|
||||
|
||||
if (!patchTypeCstrIter.found())
|
||||
{
|
||||
@ -166,7 +165,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
}
|
||||
}
|
||||
|
||||
return cstrIter()(p, iF, dict);
|
||||
return pfPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1184,7 +1184,7 @@ void Foam::argList::parse
|
||||
{
|
||||
parRunControl_.distributed(true);
|
||||
source = "-roots";
|
||||
if (roots.size() != 1)
|
||||
if (roots.size() > 1)
|
||||
{
|
||||
dictNProcs = roots.size()+1;
|
||||
}
|
||||
@ -1193,6 +1193,7 @@ void Foam::argList::parse
|
||||
{
|
||||
roots.resize(Pstream::nProcs()-1, fileName::null);
|
||||
|
||||
parRunControl_.distributed(true);
|
||||
source = "-hostRoots";
|
||||
ITstream is(source, options_["hostRoots"]);
|
||||
|
||||
@ -1231,7 +1232,7 @@ void Foam::argList::parse
|
||||
}
|
||||
}
|
||||
|
||||
if (roots.size() != 1)
|
||||
if (roots.size() > 1)
|
||||
{
|
||||
dictNProcs = roots.size()+1;
|
||||
}
|
||||
@ -1259,6 +1260,12 @@ void Foam::argList::parse
|
||||
{
|
||||
parRunControl_.distributed(true);
|
||||
decompDict.readEntry("roots", roots);
|
||||
if (roots.empty())
|
||||
{
|
||||
DetailInfo
|
||||
<< "WARNING: running distributed"
|
||||
<< " but did not specify roots!" << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1326,8 +1333,8 @@ void Foam::argList::parse
|
||||
{
|
||||
options_.set("case", roots[slave-1]/globalCase_);
|
||||
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << args_ << options_ << roots.size();
|
||||
OPstream toProc(Pstream::commsTypes::scheduled, slave);
|
||||
toProc << args_ << options_ << parRunControl_.distributed();
|
||||
}
|
||||
options_.erase("case");
|
||||
|
||||
@ -1377,24 +1384,24 @@ void Foam::argList::parse
|
||||
slave++
|
||||
)
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << args_ << options_ << roots.size();
|
||||
OPstream toProc(Pstream::commsTypes::scheduled, slave);
|
||||
toProc << args_ << options_ << parRunControl_.distributed();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Collect the master's argument list
|
||||
label nroots;
|
||||
bool isDistributed;
|
||||
|
||||
IPstream fromMaster
|
||||
(
|
||||
Pstream::commsTypes::scheduled,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
fromMaster >> args_ >> options_ >> nroots;
|
||||
fromMaster >> args_ >> options_ >> isDistributed;
|
||||
|
||||
parRunControl_.distributed(nroots);
|
||||
parRunControl_.distributed(isDistributed);
|
||||
|
||||
// Establish rootPath_/globalCase_/case_ for slave
|
||||
setCasePaths();
|
||||
|
||||
@ -202,7 +202,8 @@ inline Foam::Matrix<Form, Type>::Matrix
|
||||
)
|
||||
:
|
||||
mRows_(Mb.m()),
|
||||
nCols_(Mb.n())
|
||||
nCols_(Mb.n()),
|
||||
v_(nullptr)
|
||||
{
|
||||
doAlloc();
|
||||
|
||||
@ -224,7 +225,8 @@ inline Foam::Matrix<Form, Type>::Matrix
|
||||
)
|
||||
:
|
||||
mRows_(Mb.m()),
|
||||
nCols_(Mb.n())
|
||||
nCols_(Mb.n()),
|
||||
v_(nullptr)
|
||||
{
|
||||
doAlloc();
|
||||
|
||||
|
||||
@ -35,8 +35,9 @@ inline void Foam::Matrix<Form, Type>::doAlloc()
|
||||
{
|
||||
const label len = size();
|
||||
|
||||
if (len)
|
||||
if (len > 0)
|
||||
{
|
||||
// With sign-check to avoid spurious -Walloc-size-larger-than
|
||||
v_ = new Type[len];
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -86,7 +86,7 @@ Foam::mapPolyMesh::mapPolyMesh(const polyMesh& mesh)
|
||||
|
||||
forAll(faceZoneFaceMap_, zonei)
|
||||
{
|
||||
pointZoneMap_[zonei] = identity(mesh.faceZones()[zonei].size());
|
||||
faceZoneFaceMap_[zonei] = identity(mesh.faceZones()[zonei].size());
|
||||
}
|
||||
|
||||
forAll(cellZoneMap_, zonei)
|
||||
|
||||
@ -45,6 +45,9 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mathematicalConstants.H"
|
||||
#include "error.H"
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
|
||||
@ -43,6 +43,10 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mathematicalConstants.H"
|
||||
#include "error.H"
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -514,6 +514,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Foam::Tensor<Cmpt>
|
||||
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
|
||||
{
|
||||
@ -537,6 +541,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Foam::Tensor<Cmpt>
|
||||
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
|
||||
{
|
||||
@ -641,7 +649,11 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Vector<Cmpt>
|
||||
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||
{
|
||||
return Vector<Cmpt>
|
||||
@ -654,7 +666,11 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Vector<Cmpt>
|
||||
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
||||
{
|
||||
return Vector<Cmpt>
|
||||
@ -922,6 +938,10 @@ operator-(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
|
||||
|
||||
//- Inner-product between a spherical tensor and a tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
{
|
||||
@ -936,6 +956,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
|
||||
//- Inner-product between a tensor and a spherical tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
|
||||
{
|
||||
@ -1058,6 +1082,10 @@ operator-(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
|
||||
//- Inner-product between a symmetric tensor and a tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
{
|
||||
@ -1080,6 +1108,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
|
||||
//- Inner-product between a tensor and a symmetric tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,8 +42,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SHA1_H
|
||||
#define SHA1_H
|
||||
#ifndef Foam_SHA1_H
|
||||
#define Foam_SHA1_H
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
@ -113,6 +113,9 @@ public:
|
||||
//- Reset the hashed data before appending more
|
||||
void clear();
|
||||
|
||||
//- Append single character
|
||||
inline void append(char c);
|
||||
|
||||
//- Append data for processing
|
||||
inline SHA1& append(const char* str);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,6 +53,12 @@ inline Foam::SHA1::SHA1(const std::string& str)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline void Foam::SHA1::append(char c)
|
||||
{
|
||||
processBytes(&c, 1);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::SHA1& Foam::SHA1::append(const char* data, size_t len)
|
||||
{
|
||||
processBytes(data, len);
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -969,7 +969,17 @@ void Foam::UPstream::allocatePstreamCommunicator
|
||||
|
||||
void Foam::UPstream::freePstreamCommunicator(const label communicator)
|
||||
{
|
||||
if (communicator != UPstream::worldComm)
|
||||
// Not touching the first communicator (WORLD)
|
||||
// or anything out-of bounds.
|
||||
//
|
||||
// No UPstream communicator indices when MPI is initialized outside
|
||||
// of OpenFOAM - thus needs a bounds check too!
|
||||
|
||||
if
|
||||
(
|
||||
communicator > 0
|
||||
&& (communicator < PstreamGlobals::MPICommunicators_.size())
|
||||
)
|
||||
{
|
||||
if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2010-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -261,7 +261,14 @@ Foam::tmp<GeomField> Foam::expressions::fvExprDriver::getOrReadFieldImpl
|
||||
|
||||
tfield.reset
|
||||
(
|
||||
GeomField::New(name, meshRef, dimensioned<Type>(Zero))
|
||||
GeomField::New
|
||||
(
|
||||
name,
|
||||
meshRef,
|
||||
dimensioned<Type>(Zero),
|
||||
// Patch is zeroGradient (volFields) or calculated (other)
|
||||
defaultBoundaryType(GeomField::null())
|
||||
)
|
||||
);
|
||||
|
||||
GeomField& fld = tfield.ref();
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Original code Copyright (C) 2011-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2011-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "fvPatch.H"
|
||||
#include "pointMesh.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -118,7 +119,6 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
|
||||
else
|
||||
{
|
||||
// No gradient expression - same as Zero
|
||||
|
||||
if (debug_)
|
||||
{
|
||||
Info<< "No gradientExpr" << nl;
|
||||
@ -127,7 +127,14 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
|
||||
|
||||
if (dict.readIfPresent("fractionExpr", expr))
|
||||
{
|
||||
if (!expr.empty() && expr != "0")
|
||||
stringOps::inplaceTrim(expr);
|
||||
|
||||
if (expr == "0" || expr == "1")
|
||||
{
|
||||
// Special cases, handled with more efficiency
|
||||
fracExpr_ = expr;
|
||||
}
|
||||
else if (!expr.empty())
|
||||
{
|
||||
if (isPointVal)
|
||||
{
|
||||
@ -137,11 +144,9 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
|
||||
fracExpr_ = expressions::exprString(expr, dict);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No fraction expression - same as 1 (one)
|
||||
// Mixed BC may elect to simply ignore gradient expression
|
||||
}
|
||||
|
||||
// No fraction expression? - defer treatment to inherited BC
|
||||
// Mixed BC may elect to simply ignore gradient expression
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Original code Copyright (C) 2009-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2009-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,7 +89,7 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
|
||||
setDebug();
|
||||
DebugInFunction << nl;
|
||||
|
||||
// Basic sanity
|
||||
// Require valueExpr
|
||||
if (this->valueExpr_.empty())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
@ -97,6 +97,7 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
driver_.readDict(dict);
|
||||
|
||||
if (dict.found("value"))
|
||||
@ -110,11 +111,12 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
|
||||
{
|
||||
(*this) == this->patchInternalField();
|
||||
|
||||
#ifdef FULLDEBUG
|
||||
WarningInFunction
|
||||
<< "No value defined for "
|
||||
<< this->internalField().name() << " on "
|
||||
<< this->patch().name() << " - setting to internalField value "
|
||||
<< nl;
|
||||
<< this->patch().name() << " - using patch internal field" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (this->evalOnConstruct_)
|
||||
@ -161,31 +163,29 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
|
||||
template<class Type>
|
||||
void Foam::exprFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Value: " << this->valueExpr_ << nl
|
||||
<< "Variables: ";
|
||||
driver_.writeVariableStrings(Info) << endl;
|
||||
}
|
||||
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DebugInFunction
|
||||
<< "updating" << nl;
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Value: " << this->valueExpr_ << nl
|
||||
<< "Variables: ";
|
||||
driver_.writeVariableStrings(Info) << nl;
|
||||
Info<< "... updating" << endl;
|
||||
}
|
||||
|
||||
|
||||
// Expression evaluation
|
||||
{
|
||||
bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ != "0");
|
||||
|
||||
|
||||
driver_.clearVariables();
|
||||
|
||||
if (this->valueExpr_.empty())
|
||||
{
|
||||
(*this) == Zero;
|
||||
}
|
||||
else
|
||||
if (evalValue)
|
||||
{
|
||||
tmp<Field<Type>> tresult(driver_.evaluate<Type>(this->valueExpr_));
|
||||
|
||||
@ -196,6 +196,10 @@ void Foam::exprFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
|
||||
(*this) == tresult;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this) == Zero;
|
||||
}
|
||||
}
|
||||
|
||||
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Original code Copyright (C) 2009-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2009-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -91,20 +91,51 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
|
||||
setDebug();
|
||||
DebugInFunction << nl;
|
||||
|
||||
// Basic sanity checks
|
||||
// Require one or both of valueExpr, gradientExpr
|
||||
if (this->valueExpr_.empty() && this->gradExpr_.empty())
|
||||
{
|
||||
if (this->valueExpr_.empty())
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "For " << this->internalField().name() << " on "
|
||||
<< this->patch().name() << nl
|
||||
<< "Require either or both: valueExpr and gradientExpr" << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (this->fracExpr_.empty())
|
||||
{
|
||||
// No fractionExpr. Expect only one of valueExpr or gradientExpr
|
||||
if (!this->valueExpr_.empty() && !this->gradExpr_.empty())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "The valueExpr was not defined!" << nl
|
||||
<< exit(FatalIOError);
|
||||
IOWarningInFunction(dict)
|
||||
<< "For " << this->internalField().name() << " on "
|
||||
<< this->patch().name() << nl
|
||||
<< "Recommend using fractionExpr when specifying both"
|
||||
<< " valueExpr and gradientExpr. Assuming a value of 1."
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
else if (this->fracExpr_ == "0")
|
||||
{
|
||||
// Gradient only. Expect gradientExpr
|
||||
if (this->gradExpr_.empty())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "The gradientExpr was not defined!" << nl
|
||||
<< exit(FatalIOError);
|
||||
IOWarningInFunction(dict)
|
||||
<< "For " << this->internalField().name() << " on "
|
||||
<< this->patch().name() << nl
|
||||
<< "Gradient only, but did not specify gradientExpr."
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
else if (this->fracExpr_ == "1")
|
||||
{
|
||||
// Value only. Expect valueExpr
|
||||
if (this->valueExpr_.empty())
|
||||
{
|
||||
IOWarningInFunction(dict)
|
||||
<< "For " << this->internalField().name() << " on "
|
||||
<< this->patch().name() << nl
|
||||
<< "Value only, but did not specify valueExpr."
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,14 +145,12 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
|
||||
// Similar to fvPatchField constructor, which we have bypassed
|
||||
dict.readIfPresent("patchType", this->patchType());
|
||||
|
||||
bool needsRefValue = true;
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
needsRefValue = false;
|
||||
this->refValue() = Field<Type>("refValue", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
this->refValue() = this->patchInternalField();
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
{
|
||||
@ -130,22 +159,27 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
|
||||
Field<Type>("value", dict, p.size())
|
||||
);
|
||||
|
||||
if (!dict.found("refValue"))
|
||||
if (needsRefValue)
|
||||
{
|
||||
// Ensure refValue has a sensible value for the "update" below
|
||||
this->refValue() = Field<Type>("value", dict, p.size());
|
||||
this->refValue() = static_cast<const Field<Type>&>(*this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (needsRefValue)
|
||||
{
|
||||
this->refValue() = this->patchInternalField();
|
||||
}
|
||||
|
||||
fvPatchField<Type>::operator=(this->refValue());
|
||||
|
||||
#ifdef FULLDEBUG
|
||||
WarningInFunction
|
||||
<< "No value defined for "
|
||||
<< this->internalField().name()
|
||||
<< " on " << this->patch().name() << " therefore using "
|
||||
<< "the internal field next to the patch"
|
||||
<< endl;
|
||||
<< this->internalField().name() << " on "
|
||||
<< this->patch().name() << " - using patch internal field" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +198,7 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
|
||||
}
|
||||
else
|
||||
{
|
||||
this->valueFraction() = 1;
|
||||
this->valueFraction() = scalar(1);
|
||||
}
|
||||
|
||||
|
||||
@ -234,6 +268,11 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
|
||||
template<class Type>
|
||||
void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
@ -241,45 +280,67 @@ void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
|
||||
<< "Gradient: " << this->gradExpr_ << nl
|
||||
<< "Fraction: " << this->fracExpr_ << nl
|
||||
<< "Variables: ";
|
||||
|
||||
driver_.writeVariableStrings(Info) << endl;
|
||||
driver_.writeVariableStrings(Info) << nl;
|
||||
Info<< "... updating" << endl;
|
||||
}
|
||||
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DebugInFunction << " - updating" << nl;
|
||||
|
||||
|
||||
// Expression evaluation
|
||||
{
|
||||
driver_.clearVariables();
|
||||
bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ != "0");
|
||||
bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ != "0");
|
||||
bool evalFrac = (!this->fracExpr_.empty());
|
||||
scalar fraction = 1;
|
||||
|
||||
// Have one or both of valueExpr, gradientExpr (checked in constructor)
|
||||
|
||||
if (this->valueExpr_.empty())
|
||||
{
|
||||
this->refValue() = Zero;
|
||||
// No value expression -> gradient only
|
||||
fraction = 0;
|
||||
evalValue = false;
|
||||
evalFrac = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
|
||||
}
|
||||
|
||||
bool evalGrad = !this->gradExpr_.empty();
|
||||
|
||||
if (this->fracExpr_.empty() || this->fracExpr_ == "1")
|
||||
else if (this->gradExpr_.empty())
|
||||
{
|
||||
// No gradient expression -> value only
|
||||
fraction = 1;
|
||||
evalGrad = false;
|
||||
this->valueFraction() = scalar(1);
|
||||
evalFrac = false;
|
||||
}
|
||||
else if (this->fracExpr_.empty())
|
||||
{
|
||||
// No fractionExpr, but has both valueExpr and gradientExpr
|
||||
// -> treat as value only (warning in constructor)
|
||||
fraction = 1;
|
||||
evalGrad = false;
|
||||
evalFrac = false;
|
||||
}
|
||||
else if (this->fracExpr_ == "0")
|
||||
{
|
||||
this->valueFraction() = Zero;
|
||||
// Gradient only
|
||||
fraction = 0;
|
||||
evalValue = false;
|
||||
evalFrac = false;
|
||||
}
|
||||
else if (this->fracExpr_ == "1")
|
||||
{
|
||||
// Value only
|
||||
fraction = 1;
|
||||
evalGrad = false;
|
||||
evalFrac = false;
|
||||
}
|
||||
|
||||
|
||||
driver_.clearVariables();
|
||||
|
||||
if (evalValue)
|
||||
{
|
||||
this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
|
||||
this->refValue() = Zero;
|
||||
}
|
||||
|
||||
if (evalGrad)
|
||||
@ -290,6 +351,15 @@ void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
this->refGrad() = Zero;
|
||||
}
|
||||
|
||||
if (evalFrac)
|
||||
{
|
||||
this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->valueFraction() = fraction;
|
||||
}
|
||||
}
|
||||
|
||||
mixedFvPatchField<Type>::updateCoeffs();
|
||||
|
||||
@ -166,35 +166,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
|
||||
void Foam::turbulentDigitalFilterInletFvPatchVectorField::
|
||||
checkRTensorRealisable() const
|
||||
{
|
||||
const vectorField& faceCentres = this->patch().patch().faceCentres();
|
||||
label badFacei = -1;
|
||||
|
||||
forAll(R_, facei)
|
||||
{
|
||||
if (R_[facei].xx() <= 0)
|
||||
{
|
||||
badFacei = facei;
|
||||
FatalErrorInFunction
|
||||
<< "Reynolds stress tensor component Rxx cannot be negative"
|
||||
"or zero, where Rxx = " << R_[facei].xx() << " at the face "
|
||||
"centre = " << faceCentres[facei] << exit(FatalError);
|
||||
<< " or zero, where Rxx = " << R_[facei].xx();
|
||||
break;
|
||||
}
|
||||
|
||||
if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
|
||||
{
|
||||
badFacei = facei;
|
||||
FatalErrorInFunction
|
||||
<< "Reynolds stress tensor components Ryy or Rzz cannot be"
|
||||
<< "negative where Ryy = " << R_[facei].yy() << ", and Rzz = "
|
||||
<< R_[facei].zz() << " at the face centre = "
|
||||
<< faceCentres[facei] << exit(FatalError);
|
||||
<< " negative where Ryy = " << R_[facei].yy()
|
||||
<< ", and Rzz = " << R_[facei].zz();
|
||||
break;
|
||||
}
|
||||
|
||||
scalar term0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
|
||||
|
||||
if (term0 <= 0)
|
||||
{
|
||||
badFacei = facei;
|
||||
FatalErrorInFunction
|
||||
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
|
||||
<< "cannot be negative or zero at the face centre = "
|
||||
<< faceCentres[facei] << exit(FatalError);
|
||||
<< " cannot be negative or zero";
|
||||
break;
|
||||
}
|
||||
|
||||
scalar term1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
|
||||
@ -205,18 +208,24 @@ checkRTensorRealisable() const
|
||||
|
||||
if (term3 < 0)
|
||||
{
|
||||
badFacei = facei;
|
||||
FatalErrorInFunction
|
||||
<< "Reynolds stress tensor component group,"
|
||||
<< "Reynolds stress tensor component group, "
|
||||
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
|
||||
<< "cannot be negative at the face centre = "
|
||||
<< faceCentres[facei] << exit(FatalError);
|
||||
<< " cannot be negative";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FULLDEBUG
|
||||
Info<< "Ends: checkRTensorRealisable()."
|
||||
<< " Reynolds tensor (on patch) is consistent." << nl;
|
||||
#endif
|
||||
if (badFacei >= 0)
|
||||
{
|
||||
FatalError
|
||||
<< " at the face centre = "
|
||||
<< this->patch().patch().faceCentres()[badFacei]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,7 +68,7 @@ Foam::surfaceInterpolationScheme<Type>::New
|
||||
"discretisation",
|
||||
schemeName,
|
||||
*MeshConstructorTablePtr_
|
||||
) << exit(FatalError);
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return cstrIter()(mesh, schemeData);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -892,6 +892,16 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
||||
mesh_,
|
||||
dict.subDict("sampledSurfaceDict")
|
||||
);
|
||||
|
||||
if (sampledPtr_->interpolate())
|
||||
{
|
||||
// Should probably ignore interpolate entirely,
|
||||
// but the oldest isoSurface algorithm requires it!
|
||||
WarningInFunction
|
||||
<< type() << ' ' << name() << ": "
|
||||
<< "sampledSurface with interpolate = true "
|
||||
<< "is likely incorrect" << nl << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< type() << " " << name() << ":" << nl
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -388,6 +388,15 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
// Point data? Should probably disallow
|
||||
if (sampledPtr_)
|
||||
{
|
||||
surfaceWriterPtr_->isPointData() =
|
||||
sampledPtr_->interpolate();
|
||||
}
|
||||
|
||||
surfaceWriterPtr_->nFields() = 1; // Needed for VTK legacy
|
||||
|
||||
surfaceWriterPtr_->write(fieldName, allValues);
|
||||
|
||||
surfaceWriterPtr_->clear();
|
||||
|
||||
@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
||||
const vectorField nf(patch.nf());
|
||||
const vectorField faceCellCentres(patch.patch().faceCellCentres());
|
||||
const labelUList& faceCells = patch.patch().faceCells();
|
||||
const vectorField::subField& faceCentres = patch.patch().faceCentres();
|
||||
const vectorField::subField faceCentres = patch.patch().faceCentres();
|
||||
|
||||
forAll(patch, patchFacei)
|
||||
{
|
||||
|
||||
@ -419,8 +419,6 @@ void Foam::ParticleCollector<CloudType>::write()
|
||||
massTotal_[facei] += mass_[facei];
|
||||
}
|
||||
|
||||
const label proci = Pstream::myProcNo();
|
||||
|
||||
Info<< type() << " output:" << nl;
|
||||
|
||||
Field<scalar> faceMassTotal(mass_.size(), Zero);
|
||||
@ -434,15 +432,11 @@ void Foam::ParticleCollector<CloudType>::write()
|
||||
scalar sumAverageMFR = 0.0;
|
||||
forAll(faces_, facei)
|
||||
{
|
||||
scalarList allProcMass(Pstream::nProcs());
|
||||
allProcMass[proci] = massTotal_[facei];
|
||||
Pstream::gatherList(allProcMass);
|
||||
faceMassTotal[facei] += sum(allProcMass);
|
||||
faceMassTotal[facei] +=
|
||||
returnReduce(massTotal_[facei], sumOp<scalar>());
|
||||
|
||||
scalarList allProcMassFlowRate(Pstream::nProcs());
|
||||
allProcMassFlowRate[proci] = massFlowRate_[facei];
|
||||
Pstream::gatherList(allProcMassFlowRate);
|
||||
faceMassFlowRate[facei] += sum(allProcMassFlowRate);
|
||||
faceMassFlowRate[facei] +=
|
||||
returnReduce(massFlowRate_[facei], sumOp<scalar>());
|
||||
|
||||
sumTotalMass += faceMassTotal[facei];
|
||||
sumAverageMFR += faceMassFlowRate[facei];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -129,6 +129,11 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptor& gd)
|
||||
is.readEnd("gradingDescriptor");
|
||||
}
|
||||
|
||||
if (gd.expansionRatio_ < 0)
|
||||
{
|
||||
gd.expansionRatio_ = 1.0/(-gd.expansionRatio_);
|
||||
}
|
||||
|
||||
is.check(FUNCTION_NAME);
|
||||
return is;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -396,22 +396,43 @@ Foam::AABBTree<Type>::AABBTree
|
||||
// transfer flattened tree to persistent storage
|
||||
DynamicList<treeBoundBox> boundBoxes(2*bbs.size());
|
||||
DynamicList<labelList> addressing(2*addr.size());
|
||||
|
||||
forAll(nodes, nodeI)
|
||||
{
|
||||
if (nodes[nodeI].first() < 0)
|
||||
{
|
||||
boundBoxes.append(bbs[nodeI].first());
|
||||
addressing.append(addr[nodeI + 1]);
|
||||
addressing.append(addr[-(nodes[nodeI].first() + 1)]);
|
||||
}
|
||||
if (nodes[nodeI].second() < 0)
|
||||
{
|
||||
boundBoxes.append(bbs[nodeI].second());
|
||||
addressing.append(addr[nodeI + 1]);
|
||||
addressing.append(addr[-(nodes[nodeI].second() + 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
boundBoxes_.transfer(boundBoxes);
|
||||
addressing_.transfer(addressing);
|
||||
|
||||
|
||||
if (0)
|
||||
{
|
||||
bitSet checked(objects.size());
|
||||
for (const auto& box : addressing_)
|
||||
{
|
||||
for (const auto& id : box)
|
||||
{
|
||||
checked.set(id);
|
||||
}
|
||||
}
|
||||
|
||||
const label unsetSize = checked.count(false);
|
||||
|
||||
if (unsetSize)
|
||||
{
|
||||
Info<< "*** Problem: IDs not set: " << unsetSize << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -142,8 +142,7 @@ public:
|
||||
AABBTree();
|
||||
|
||||
//- Construct from components
|
||||
// equalBinSize: divide into equal number of elements or
|
||||
// equal span
|
||||
// equalBinSize: divide into equal number of elements or equal span
|
||||
AABBTree
|
||||
(
|
||||
const UList<Type>& objects,
|
||||
@ -171,7 +170,7 @@ public:
|
||||
bool pointInside(const point& pt) const;
|
||||
|
||||
//- Determine whether a bounding box overlaps the tree bounding
|
||||
// boxes
|
||||
//- boxes
|
||||
bool overlaps(const boundBox& bbIn) const;
|
||||
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ bool Foam::vtk::writePointSet
|
||||
|
||||
if (parallel)
|
||||
{
|
||||
vtk::writeListParallel(format(), mesh.points(), pointLabels);
|
||||
vtk::writeListParallel(format.ref(), mesh.points(), pointLabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -290,6 +290,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
writerPtr_->nFields() = 1; // Legacy VTK
|
||||
writerPtr_->write(title, allData);
|
||||
|
||||
writerPtr_->endTime();
|
||||
@ -321,6 +322,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
writerPtr_->nFields() = 1; // Legacy VTK
|
||||
writerPtr_->write(title, data);
|
||||
|
||||
writerPtr_->endTime();
|
||||
|
||||
@ -155,7 +155,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
|
||||
const bool secondOrder
|
||||
) const
|
||||
{
|
||||
mapSrcToTgt(field, cop, result.primitiveFieldRef());
|
||||
mapTgtToSrc(field, cop, result.primitiveFieldRef());
|
||||
}
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
|
||||
const bool secondOrder
|
||||
) const
|
||||
{
|
||||
mapSrcToTgt(field, cop, result.primitiveFieldRef());
|
||||
mapTgtToSrc(field, cop, result.primitiveFieldRef());
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
|
||||
const bool secondOrder
|
||||
) const
|
||||
{
|
||||
mapSrcToTgt(field, cop, result.primitiveFieldRef());
|
||||
mapTgtToSrc(field, cop, result.primitiveFieldRef());
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
|
||||
const bool secondOrder
|
||||
) const
|
||||
{
|
||||
mapSrcToTgt(field, cop, result.primitiveFieldRef());
|
||||
mapTgtToSrc(field, cop, result.primitiveFieldRef());
|
||||
}
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
|
||||
const bool secondOrder
|
||||
) const
|
||||
{
|
||||
mapSrcToTgt(field, cop, result.primitiveFieldRef());
|
||||
mapTgtToSrc(field, cop, result.primitiveFieldRef());
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
|
||||
const bool secondOrder
|
||||
) const
|
||||
{
|
||||
mapSrcToTgt(field, cop, result.primitiveFieldRef());
|
||||
mapTgtToSrc(field, cop, result.primitiveFieldRef());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -875,15 +875,15 @@ Foam::meshToMesh::mapTgtToSrc
|
||||
label srcPatchi = srcPatchID_[i];
|
||||
label tgtPatchi = tgtPatchID_[i];
|
||||
|
||||
if (!srcPatchFields.set(tgtPatchi))
|
||||
if (!srcPatchFields.set(srcPatchi))
|
||||
{
|
||||
srcPatchFields.set
|
||||
(
|
||||
srcPatchi,
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
tgtBfld[srcPatchi],
|
||||
srcMesh.boundary()[tgtPatchi],
|
||||
tgtBfld[tgtPatchi],
|
||||
srcMesh.boundary()[srcPatchi],
|
||||
DimensionedField<Type, volMesh>::null(),
|
||||
directFvPatchFieldMapper
|
||||
(
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -107,7 +107,7 @@ void Foam::polySurface::storeField
|
||||
|
||||
if (dimfield)
|
||||
{
|
||||
dimfield->dimensions() = dims;
|
||||
dimfield->dimensions().reset(dims); // Dimensions may have changed
|
||||
dimfield->field() = values;
|
||||
}
|
||||
else
|
||||
@ -148,7 +148,7 @@ void Foam::polySurface::storeField
|
||||
|
||||
if (dimfield)
|
||||
{
|
||||
dimfield->dimensions() = dims;
|
||||
dimfield->dimensions().reset(dims); // Dimensions may have changed
|
||||
dimfield->field() = std::move(values);
|
||||
}
|
||||
else
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,7 +45,7 @@ void Foam::surfMesh::storeField
|
||||
|
||||
if (dimfield)
|
||||
{
|
||||
dimfield->dimensions() = dims;
|
||||
dimfield->dimensions().reset(dims); // Dimensions may have changed
|
||||
dimfield->field() = values;
|
||||
}
|
||||
else
|
||||
@ -85,7 +85,7 @@ void Foam::surfMesh::storeField
|
||||
|
||||
if (dimfield)
|
||||
{
|
||||
dimfield->dimensions() = dims;
|
||||
dimfield->dimensions().reset(dims); // Dimensions may have changed
|
||||
dimfield->field() = std::move(values);
|
||||
}
|
||||
else
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -416,11 +416,11 @@ bool Foam::surfaceWriter::empty() const
|
||||
|
||||
Foam::label Foam::surfaceWriter::size() const
|
||||
{
|
||||
const bool value =
|
||||
const label value =
|
||||
(
|
||||
useComponents_
|
||||
? surfComp_.faces().empty()
|
||||
: surf_.get().faces().empty()
|
||||
? surfComp_.faces().size()
|
||||
: surf_.get().faces().size()
|
||||
);
|
||||
|
||||
return (parallel_ ? returnReduce(value, sumOp<label>()) : value);
|
||||
|
||||
@ -140,17 +140,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
|
||||
|
||||
if (mesh_.nSolutionD() == 2)
|
||||
{
|
||||
// Omega for 2D
|
||||
omega_ = deltaPhi;
|
||||
|
||||
// dAve for 2D
|
||||
dAve_ = vector
|
||||
(
|
||||
2*sinPhi*Foam::sin(0.5*deltaPhi),
|
||||
2*cosPhi*Foam::sin(0.5*deltaPhi),
|
||||
0
|
||||
);
|
||||
|
||||
vector meshDir(Zero);
|
||||
if (dom_.meshOrientation() != vector::zero)
|
||||
{
|
||||
@ -172,7 +161,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
|
||||
|
||||
dAve_ = coordRot & dAve_;
|
||||
d_ = coordRot & d_;
|
||||
|
||||
}
|
||||
else if (mesh_.nSolutionD() == 1)
|
||||
{
|
||||
@ -195,9 +183,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
|
||||
|
||||
dAve_ = (dAve_ & normal)*meshDir;
|
||||
d_ = (d_ & normal)*meshDir;
|
||||
|
||||
// Omega normalization for 1D
|
||||
omega_ /= 2;
|
||||
}
|
||||
|
||||
autoPtr<volScalarField> IDefaultPtr;
|
||||
|
||||
@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs)
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const pointField& cf = pp.faceCentres();
|
||||
const vectorField::subField cf = pp.faceCentres();
|
||||
|
||||
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
|
||||
{
|
||||
|
||||
@ -155,7 +155,7 @@ void Foam::faceShading::calculate()
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const pointField& cf = pp.faceCentres();
|
||||
const vectorField::subField cf = pp.faceCentres();
|
||||
|
||||
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
|
||||
{
|
||||
|
||||
@ -72,16 +72,16 @@ Foam::liquidProperties::liquidProperties
|
||||
Foam::liquidProperties::liquidProperties(const dictionary& dict)
|
||||
:
|
||||
thermophysicalProperties(dict),
|
||||
Tc_(dict.get<label>("Tc")),
|
||||
Pc_(dict.get<label>("Pc")),
|
||||
Vc_(dict.get<label>("Vc")),
|
||||
Zc_(dict.get<label>("Zc")),
|
||||
Tt_(dict.get<label>("Tt")),
|
||||
Pt_(dict.get<label>("Pt")),
|
||||
Tb_(dict.get<label>("Tb")),
|
||||
dipm_(dict.get<label>("dipm")),
|
||||
omega_(dict.get<label>("omega")),
|
||||
delta_(dict.get<label>("delta"))
|
||||
Tc_(dict.get<scalar>("Tc")),
|
||||
Pc_(dict.get<scalar>("Pc")),
|
||||
Vc_(dict.get<scalar>("Vc")),
|
||||
Zc_(dict.get<scalar>("Zc")),
|
||||
Tt_(dict.get<scalar>("Tt")),
|
||||
Pt_(dict.get<scalar>("Pt")),
|
||||
Tb_(dict.get<scalar>("Tb")),
|
||||
dipm_(dict.get<scalar>("dipm")),
|
||||
omega_(dict.get<scalar>("omega")),
|
||||
delta_(dict.get<scalar>("delta"))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,7 +77,7 @@ void Foam::solidProperties::readIfPresent(const dictionary& dict)
|
||||
dict.readIfPresent("rho", rho_);
|
||||
dict.readIfPresent("Cp", Cp_);
|
||||
dict.readIfPresentCompat("kappa", {{"K", 1612}}, kappa_);
|
||||
dict.readIfPresent("Hf_", Hf_);
|
||||
dict.readIfPresent("Hf", Hf_);
|
||||
dict.readIfPresent("emissivity", emissivity_);
|
||||
dict.readIfPresent("W", W_);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 IH-Cantabria
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -63,7 +63,7 @@ protected:
|
||||
scalar waveAngle_;
|
||||
|
||||
//-
|
||||
const scalarField& x_;
|
||||
const scalarField x_;
|
||||
|
||||
const scalar x0_;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ include $(RULES)/c++$(WM_COMPILE_OPTION)
|
||||
|
||||
c++FLAGS = $(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS)
|
||||
|
||||
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -Wno-alloc-size-larger-than -c $< -o $@
|
||||
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@
|
||||
cxxtoo = $(Ctoo)
|
||||
cctoo = $(Ctoo)
|
||||
cpptoo = $(Ctoo)
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# wmake/scripts/AllwmakeParseArguments
|
||||
@ -22,14 +21,35 @@
|
||||
# # Parse the arguments by sourcing this script
|
||||
# . ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
|
||||
#
|
||||
# Parsed options (make)
|
||||
# -k | -keep-going | -non-stop
|
||||
# -j | -jN | -j N
|
||||
#
|
||||
# Parsed options (wmake)
|
||||
# -debug
|
||||
# -q | -queue
|
||||
# -module-prefix=...
|
||||
# Exports FOAM_MODULE_PREFIX value.
|
||||
# Unsets FOAM_MODULE_APPBIN, FOAM_MODULE_LIBBIN.
|
||||
# Handles (user|group|openfoam) or (u|g|o) as per foamEtcFile,
|
||||
# or absolute/relative paths
|
||||
#
|
||||
# Parsed options (special)
|
||||
# -l | -log | -log=FILE
|
||||
# -prefix=... same as -module-prefix=...
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
echo "$Script error: The OpenFOAM environment is not set."
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
# Check environment
|
||||
[ -d "$WM_PROJECT_DIR" ] || {
|
||||
exec 1>&2
|
||||
echo "$0"
|
||||
echo "Error encountered:"
|
||||
echo " The OpenFOAM environment not set or incorrect."
|
||||
echo " Check your setup."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
@ -40,13 +60,18 @@ Executing ${0##*/} is equivalent to
|
||||
|
||||
wmake -all [OPTIONS]
|
||||
|
||||
With these additional options:
|
||||
-l | -log | -log=name
|
||||
With additional options:
|
||||
-l | -log Tee output to log.\$WM_OPTIONS
|
||||
-log=FILE Tee output to given filename
|
||||
-prefix=... Define FOAM_MODULE_PREFIX (same as wmake -module-prefix)
|
||||
-no-recursion Prevent recursive call (do NOT call 'wmake -all')
|
||||
-fromWmake Same as -no-recursion
|
||||
|
||||
See
|
||||
wmake -help (or wmake -help-full)
|
||||
|
||||
USAGE
|
||||
|
||||
wmake -help
|
||||
exit 0
|
||||
exit 0 # clean exit
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +79,8 @@ USAGE
|
||||
# Parse the arguments and options
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset fromWmake optDebug optLog optQueue
|
||||
unset optDebug optLog optNonRecursive optQueue
|
||||
unset optWmakeFrontend
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
@ -65,41 +91,81 @@ do
|
||||
-h | -help*)
|
||||
usage
|
||||
;;
|
||||
-fromWmake)
|
||||
# If called from wmake (to avoid recursion)
|
||||
fromWmake=true
|
||||
|
||||
-no-recurs* | -fromWmake)
|
||||
# Avoid recursion (eg, if called from wmake)
|
||||
optNonRecursive=true
|
||||
# Pass onwards to other Allwmake scripts
|
||||
;;
|
||||
|
||||
-module-prefix=* | -prefix=* | --prefix=*)
|
||||
# As per setModulePrefix (wmakeFunctions)
|
||||
export FOAM_MODULE_PREFIX="${arg#*=}"
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
# Prefix: user
|
||||
(u | user) FOAM_MODULE_PREFIX="${FOAM_USER_LIBBIN%/*}" ;;
|
||||
|
||||
# Prefix: group
|
||||
(g | group) FOAM_MODULE_PREFIX="${FOAM_SITE_LIBBIN%/*}" ;;
|
||||
|
||||
# Prefix: openfoam (other)
|
||||
(o | openfoam) FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}" ;;
|
||||
|
||||
# Prefix: false | none (ie, 'disabled')
|
||||
(false | none) FOAM_MODULE_PREFIX=false ;;
|
||||
|
||||
# Prefix: directory (absolute or relative)
|
||||
(*)
|
||||
: "${FOAM_MODULE_PREFIX:=/usr/local}" # Fallback (autoconf-like)
|
||||
|
||||
# Require absolute path
|
||||
[ "${FOAM_MODULE_PREFIX#/}" != "${FOAM_MODULE_PREFIX}" ] || \
|
||||
FOAM_MODULE_PREFIX="${PWD}/${FOAM_MODULE_PREFIX}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Avoid potential conflicts
|
||||
unset FOAM_MODULE_APPBIN FOAM_MODULE_LIBBIN
|
||||
echo "Module prefix = ${FOAM_MODULE_PREFIX:-[]}" 1>&2
|
||||
continue # Argument handled, remove it
|
||||
;;
|
||||
|
||||
-k | -keep-going | -non-stop)
|
||||
# Keep going, ignoring errors
|
||||
export WM_CONTINUE_ON_ERROR=true
|
||||
continue # Permanently remove arg
|
||||
continue # Argument handled, remove it
|
||||
;;
|
||||
|
||||
-l | -log)
|
||||
optLog="log.${WM_OPTIONS:-Allwmake}"
|
||||
continue # Permanently remove arg
|
||||
optLog="log.${WM_OPTIONS:-build}"
|
||||
continue # Argument handled, remove it
|
||||
;;
|
||||
|
||||
-log=*)
|
||||
optLog="${arg##*=}"
|
||||
if [ -d "$optLog" ]
|
||||
then
|
||||
optLog="${optLog%/}/log.${WM_OPTIONS:-Allwmake}"
|
||||
optLog="${optLog%/}/log.${WM_OPTIONS:-build}"
|
||||
elif [ -z "$optLog" ]
|
||||
then
|
||||
optLog="log.${WM_OPTIONS:-Allwmake}"
|
||||
optLog="log.${WM_OPTIONS:-build}"
|
||||
fi
|
||||
continue # Permanently remove arg
|
||||
continue # Argument handled, remove it
|
||||
;;
|
||||
|
||||
-debug)
|
||||
optDebug="-debug"
|
||||
continue # Permanently remove arg
|
||||
continue # Argument handled, remove it
|
||||
;;
|
||||
|
||||
-q | -queue)
|
||||
optQueue="-queue"
|
||||
continue # Permanently remove arg
|
||||
continue # Argument handled, remove it
|
||||
;;
|
||||
|
||||
lib | libo | libso | dep | objects)
|
||||
# Target type
|
||||
targetType=$arg
|
||||
targetType="$arg"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -112,20 +178,22 @@ done
|
||||
# Execute wmake -all if not called from wmake
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$fromWmake" ]
|
||||
if [ -z "$optNonRecursive" ]
|
||||
then
|
||||
if [ -z "$optLog" ]
|
||||
then
|
||||
exec wmake -all $optQueue $*
|
||||
exec wmake $optWmakeFrontend -all \
|
||||
$optDebug $optQueue $*
|
||||
exit $? # Unneeded, but just in case something went wrong
|
||||
else
|
||||
echo "Logging wmake -all output to '$optLog'" 1>&2
|
||||
echo 1>&2
|
||||
exec wmake -all $optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
|
||||
exec wmake $optWmakeFrontend -all \
|
||||
$optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
|
||||
# Need to cleanup after the tee
|
||||
rc=$? # Error code from tee (not wmake), but not entirely important
|
||||
echo "Done logging to '$optLog'" 1>&2
|
||||
exit $rc
|
||||
exit "$rc"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -144,7 +212,8 @@ fi
|
||||
# Cleanup local variables and functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset fromWmake optDebug optLog optQueue
|
||||
unset optWmakeFrontend
|
||||
unset optNonRecursive optDebug optLog optQueue
|
||||
unset -f usage
|
||||
|
||||
|
||||
|
||||
@ -37,76 +37,6 @@ export CXXFLAGS="$(wmake -show-cxxflags)"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Save build/configure parameter information (dependency) into sentinel file
|
||||
#
|
||||
# 1 - sentinelFile
|
||||
# 2... build/configure parameters
|
||||
#
|
||||
storeDependency()
|
||||
{
|
||||
local sentinel="$1"
|
||||
local depend
|
||||
shift
|
||||
|
||||
if [ -n "$sentinel" ]
|
||||
then
|
||||
mkdir -p "$(dirname "$sentinel")"
|
||||
|
||||
echo '# Build/configure parameters' >| "$sentinel"
|
||||
|
||||
for depend
|
||||
do
|
||||
echo "-- $depend"
|
||||
done >> "$sentinel"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Check sentinel file(s) to handle changed build/configure parameters
|
||||
# such as paraview / vtk version changes
|
||||
#
|
||||
# 1 - sourceDir
|
||||
# 2... build/configure parameters
|
||||
#
|
||||
sameDependency()
|
||||
{
|
||||
local sourceDir="$1"
|
||||
shift
|
||||
local depend objectsDir
|
||||
local compare=0
|
||||
|
||||
# Where generated files are stored
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
local sentinel="$objectsDir/ThirdParty"
|
||||
|
||||
if [ -f "$sentinel" ]
|
||||
then
|
||||
# Create an .update version
|
||||
storeDependency "${sentinel}.update" $@
|
||||
cmp "${sentinel}" "${sentinel}.update" >/dev/null 2>&1
|
||||
compare=$?
|
||||
|
||||
if [ "$compare" -ne 0 ]
|
||||
then
|
||||
echo "build/configure parameters changed between builds" 1>&2
|
||||
fi
|
||||
|
||||
else
|
||||
# No sentinel file: First time, or failed compilation?
|
||||
if [ -f "$objectsDir/CMakeCache.txt" ]
|
||||
then
|
||||
echo "previous build was incomplete" 1>&2
|
||||
compare=1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$sentinel"
|
||||
return "$compare"
|
||||
}
|
||||
|
||||
|
||||
# Resolve the location of cmake (if needed) and call with output
|
||||
# suppressed according to WM_QUIET
|
||||
@ -151,7 +81,7 @@ cmakeVersioned()
|
||||
|
||||
mkdir -p "$objectsDir" \
|
||||
&& ( cd "$objectsDir" && call_cmake "$@" "$sourceDir" && \
|
||||
make "-j${WM_NCOMPPROCS:-1}" ) \
|
||||
make ) \
|
||||
&& storeDependency "$sentinel" "$depend" $@
|
||||
}
|
||||
|
||||
@ -178,7 +108,7 @@ cmakeVersionedInstall()
|
||||
|
||||
mkdir -p "$objectsDir" \
|
||||
&& ( cd "$objectsDir" && call_cmake "$@" "$sourceDir" && \
|
||||
make "-j${WM_NCOMPPROCS:-1}" install ) \
|
||||
make install ) \
|
||||
&& storeDependency "$sentinel" "$depend" $@
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
# ADIOS2_ARCH_PATH
|
||||
#
|
||||
# Functions provided
|
||||
# have_adios2, no_adios2, echo_adios2, hint_adios2, query_adios2
|
||||
# have_adios2, no_adios2, echo_adios2, query_adios2, search_adios2
|
||||
# hint_adios2
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_ADIOS2
|
||||
@ -33,7 +34,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_adios2()
|
||||
{
|
||||
unset HAVE_ADIOS2 ADIOS2_INC_DIR ADIOS2_LIB_DIR
|
||||
@ -44,9 +45,9 @@ no_adios2()
|
||||
echo_adios2()
|
||||
{
|
||||
echo "adios2=${HAVE_ADIOS2:-false}"
|
||||
echo "root=$ADIOS2_ARCH_PATH"
|
||||
echo "include=$ADIOS2_INC_DIR"
|
||||
echo "library=$ADIOS2_LIB_DIR"
|
||||
echo "root=\"$ADIOS2_ARCH_PATH\""
|
||||
echo "include=\"$ADIOS2_INC_DIR\""
|
||||
echo "library=\"$ADIOS2_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
@ -55,9 +56,7 @@ hint_adios2()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> adios2 not found?
|
||||
|
||||
Enable in the OpenFOAM etc/bashrc, define manually or try with the
|
||||
following (POSIX shell):
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config adios2 -- -force)
|
||||
|
||||
@ -66,43 +65,19 @@ INFORMATION
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_adios2()
|
||||
{
|
||||
local config="config.sh/adios2"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query adios2 "$ADIOS2_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "adios2=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
|
||||
have_adios2()
|
||||
search_adios2()
|
||||
{
|
||||
local warn # warn="==> skip adios2"
|
||||
local config="config.sh/adios2"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$ADIOS2_ARCH_PATH"
|
||||
local incName="adios2.h"
|
||||
local libName="libadios2"
|
||||
local libName2="libadios2_cxx11_mpi"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -132,6 +107,7 @@ have_adios2()
|
||||
# Library
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName2") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
@ -147,7 +123,45 @@ have_adios2()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_adios2()
|
||||
{
|
||||
local warn # warn="==> skip adios2"
|
||||
local config="config.sh/adios2"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_adios2 "$ADIOS2_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_adios2()
|
||||
{
|
||||
local config="config.sh/adios2"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query adios2 "$ADIOS2_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "adios2=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_adios2
|
||||
|
||||
# Test/query
|
||||
@ -159,6 +173,9 @@ case "$1" in
|
||||
-query)
|
||||
query_adios2
|
||||
;;
|
||||
-hint)
|
||||
hint_adios2
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
# or config.sh/CGAL (when BOOST_ARCH_PATH is empty)
|
||||
#
|
||||
# Functions provided
|
||||
# have_boost, no_boost, echo_boost, query_boost
|
||||
# have_boost, no_boost, echo_boost, query_boost, search_boost
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_BOOST
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_boost()
|
||||
{
|
||||
unset HAVE_BOOST BOOST_INC_DIR BOOST_LIB_DIR
|
||||
@ -45,53 +45,24 @@ no_boost()
|
||||
echo_boost()
|
||||
{
|
||||
echo "boost=${HAVE_BOOST:-false}"
|
||||
echo "root=$BOOST_ARCH_PATH"
|
||||
echo "include=$BOOST_INC_DIR"
|
||||
echo "library=$BOOST_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings (from CGAL setup)
|
||||
query_boost()
|
||||
{
|
||||
local config="config.sh/CGAL"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query boost "$BOOST_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "boost=unknown"
|
||||
fi
|
||||
echo "root=\"$BOOST_ARCH_PATH\""
|
||||
echo "include=\"$BOOST_INC_DIR\""
|
||||
echo "library=\"$BOOST_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
|
||||
have_boost()
|
||||
search_boost()
|
||||
{
|
||||
local warn # warn="==> skip boost"
|
||||
local config="config.sh/CGAL"
|
||||
local settings
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$BOOST_ARCH_PATH" ]
|
||||
then
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$BOOST_ARCH_PATH"
|
||||
local incName="boost/version.hpp"
|
||||
local libName="libboost_system"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -138,7 +109,49 @@ have_boost()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_boost()
|
||||
{
|
||||
local warn # warn="==> skip boost"
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$BOOST_ARCH_PATH" ]
|
||||
then
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
search_boost "$BOOST_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings (from CGAL setup)
|
||||
query_boost()
|
||||
{
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query boost "$BOOST_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "boost=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_boost
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# config.sh/ccmio
|
||||
#
|
||||
# Functions provided
|
||||
# have_ccmio, no_ccmio, echo_ccmio, query_ccmio
|
||||
# have_ccmio, no_ccmio, echo_ccmio, query_ccmio, search_ccmio
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_CCMIO
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_ccmio()
|
||||
{
|
||||
unset HAVE_CCMIO CCMIO_INC_DIR CCMIO_LIB_DIR
|
||||
@ -44,50 +44,25 @@ no_ccmio()
|
||||
echo_ccmio()
|
||||
{
|
||||
echo "ccmio=${HAVE_CCMIO:-false}"
|
||||
echo "root=$CCMIO_ARCH_PATH"
|
||||
echo "include=$CCMIO_INC_DIR"
|
||||
echo "library=$CCMIO_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_ccmio()
|
||||
{
|
||||
local config="config.sh/ccmio"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query ccmio "$CCMIO_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "ccmio=unknown"
|
||||
fi
|
||||
echo "root=\"$CCMIO_ARCH_PATH\""
|
||||
echo "include=\"$CCMIO_INC_DIR\""
|
||||
echo "library=\"$CCMIO_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR
|
||||
have_ccmio()
|
||||
search_ccmio()
|
||||
{
|
||||
local warn="==> skip ccmio"
|
||||
local config="config.sh/ccmio"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
# Link with static libccmio only (fewer issues)
|
||||
local prefix="$CCMIO_ARCH_PATH"
|
||||
local incName="libccmio/ccmio.h"
|
||||
local libName="libccmio.a"
|
||||
# Link with static libccmio only (fewer issues)
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -153,7 +128,45 @@ have_ccmio()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_ccmio()
|
||||
{
|
||||
local warn="==> skip ccmio"
|
||||
local config="config.sh/ccmio"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_ccmio "$CCMIO_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_ccmio()
|
||||
{
|
||||
local config="config.sh/ccmio"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query ccmio "$CCMIO_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "ccmio=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_ccmio
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -25,19 +25,23 @@
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_CGAL
|
||||
# CGAL_FLAVOUR (header, library, ...)
|
||||
# CGAL_ARCH_PATH
|
||||
# CGAL_INC_DIR
|
||||
# CGAL_LIB_DIR
|
||||
#
|
||||
# Uses
|
||||
# BOOST_ARCH_PATH and have_boost::search_boost()
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_boost # boost + system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_cgal()
|
||||
{
|
||||
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR
|
||||
unset HAVE_CGAL CGAL_FLAVOUR CGAL_INC_DIR CGAL_LIB_DIR
|
||||
}
|
||||
|
||||
|
||||
@ -45,54 +49,26 @@ no_cgal()
|
||||
echo_cgal()
|
||||
{
|
||||
echo "cgal=${HAVE_CGAL:-false}"
|
||||
echo "root=$CGAL_ARCH_PATH"
|
||||
echo "include=$CGAL_INC_DIR"
|
||||
echo "library=$CGAL_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings (from CGAL setup)
|
||||
query_cgal()
|
||||
{
|
||||
local config="config.sh/CGAL"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query cgal "$CGAL_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "cgal=unknown"
|
||||
fi
|
||||
echo "flavour=$CGAL_FLAVOUR"
|
||||
echo "root=\"$CGAL_ARCH_PATH\""
|
||||
echo "include=\"$CGAL_INC_DIR\""
|
||||
echo "library=\"$CGAL_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
|
||||
have_cgal()
|
||||
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR, CGAL_FLAVOUR
|
||||
search_cgal()
|
||||
{
|
||||
local warn # warn="==> skip cgal"
|
||||
local config="config.sh/CGAL"
|
||||
local settings
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$CGAL_ARCH_PATH"
|
||||
local incName="CGAL/version.h"
|
||||
local libName="libCGAL"
|
||||
local header library
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library flavour
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -118,12 +94,13 @@ have_cgal()
|
||||
return 2
|
||||
}
|
||||
|
||||
# Library
|
||||
# Library may be optional - eg, header-only
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
[ -n "$warn" ] && echo "==> cgal (no library)"
|
||||
unset library
|
||||
flavour="header" # Header only
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
@ -132,13 +109,59 @@ have_cgal()
|
||||
|
||||
# OK
|
||||
export HAVE_CGAL=true
|
||||
export CGAL_FLAVOUR="${flavour:-library}"
|
||||
export CGAL_ARCH_PATH="$prefix"
|
||||
export CGAL_INC_DIR="${header%/*}" # Basename
|
||||
export CGAL_LIB_DIR="${library%/*}" # Basename
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_cgal()
|
||||
{
|
||||
local warn # warn="==> skip cgal"
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Need boost for cgal
|
||||
search_boost "$BOOST_ARCH_PATH"
|
||||
|
||||
search_cgal "$CGAL_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings (from CGAL setup)
|
||||
query_cgal()
|
||||
{
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query cgal "$CGAL_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "cgal=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_cgal
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
# CMAKE_ARCH_PATH that may specify a possible cmake/bin directory.
|
||||
#
|
||||
# Functions provided
|
||||
# have_cmake, no_cmake, echo_cmake
|
||||
# have_cmake, no_cmake, echo_cmake, search_cmake
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_CMAKE
|
||||
@ -32,10 +32,10 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_cmake()
|
||||
{
|
||||
unset HAVE_CMAKE CMAKE_EXE
|
||||
unset HAVE_CMAKE CMAKE_EXE CMAKE_ARCH_PATH
|
||||
}
|
||||
|
||||
|
||||
@ -47,13 +47,49 @@ echo_cmake()
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# Try to locate cmake according to values specified in <etc/config.sh/cmake>
|
||||
# Locate cmake according to values specified in <etc/config.sh/cmake>
|
||||
# or just use what is found on the path.
|
||||
#
|
||||
# On success: return the resolved value as output.
|
||||
# On failure: set executable as "false" and return with 1
|
||||
#
|
||||
search_cmake()
|
||||
{
|
||||
# Treat previous queries as "sticky"
|
||||
if [ -n "$CMAKE_EXE" ]
|
||||
then
|
||||
test "$CMAKE_EXE" != "false"
|
||||
return $?
|
||||
fi
|
||||
|
||||
local prefix="${1:-/usr}"
|
||||
local candidate="$prefix"/bin/cmake
|
||||
local foundExe
|
||||
|
||||
if [ -f "$candidate" ] && [ -x "$candidate" ]
|
||||
then
|
||||
foundExe="$candidate"
|
||||
elif candidate="$(command -v cmake 2>/dev/null)"
|
||||
then
|
||||
# Resolved from PATH
|
||||
foundExe="$candidate"
|
||||
fi
|
||||
|
||||
if [ -z "$foundExe" ]
|
||||
then
|
||||
export CMAKE_EXE="false" # Avoid repeated calls?
|
||||
return 2
|
||||
fi
|
||||
|
||||
# OK
|
||||
export HAVE_CMAKE=true
|
||||
export CMAKE_EXE="$foundExe"
|
||||
}
|
||||
|
||||
|
||||
# Output as per search_* function
|
||||
have_cmake()
|
||||
{
|
||||
# Treat previous queries as "sticky"
|
||||
@ -64,48 +100,22 @@ have_cmake()
|
||||
fi
|
||||
|
||||
local config="config.sh/cmake"
|
||||
local file
|
||||
unset CMAKE_ARCH_PATH
|
||||
local settings candidate foundExe
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
|
||||
then
|
||||
. "$settings"
|
||||
|
||||
if [ -d "$CMAKE_ARCH_PATH" ]
|
||||
then
|
||||
candidate="$CMAKE_ARCH_PATH"/bin/cmake
|
||||
if [ -f "$candidate" ] && [ -x "$candidate" ]
|
||||
then
|
||||
foundExe="$candidate"
|
||||
fi
|
||||
fi
|
||||
. "$file"
|
||||
fi
|
||||
|
||||
if [ -z "$foundExe" ]
|
||||
then
|
||||
# Default: resolve from PATH
|
||||
if candidate="$(command -v cmake 2>/dev/null)"
|
||||
then
|
||||
foundExe="$candidate"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$foundExe" ]
|
||||
then
|
||||
# OK
|
||||
export HAVE_CMAKE=true
|
||||
export CMAKE_EXE="$foundExe"
|
||||
else
|
||||
# Failure
|
||||
export CMAKE_EXE="false" # Avoid repeated calls?
|
||||
return 2
|
||||
fi
|
||||
search_cmake "$CMAKE_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
no_cmake
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_cmake
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
@ -118,5 +128,4 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
# or config.sh/FFTW (when FFTW_ARCH_PATH is empty)
|
||||
#
|
||||
# Functions provided
|
||||
# have_fftw, no_fftw, echo_fftw, query_fftw
|
||||
# have_fftw, no_fftw, echo_fftw, query_fftw, search_fftw
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_FFTW
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_fftw()
|
||||
{
|
||||
unset HAVE_FFTW FFTW_INC_DIR FFTW_LIB_DIR
|
||||
@ -45,53 +45,25 @@ no_fftw()
|
||||
echo_fftw()
|
||||
{
|
||||
echo "fftw=${HAVE_FFTW:-false}"
|
||||
echo "root=$FFTW_ARCH_PATH"
|
||||
echo "include=$FFTW_INC_DIR"
|
||||
echo "library=$FFTW_LIB_DIR"
|
||||
echo "root=\"$FFTW_ARCH_PATH\""
|
||||
echo "include=\"$FFTW_INC_DIR\""
|
||||
echo "library=\"$FFTW_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_fftw()
|
||||
{
|
||||
local config="config.sh/FFTW"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query fftw "$FFTW_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "fftw=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR
|
||||
have_fftw()
|
||||
search_fftw()
|
||||
{
|
||||
local warn # warn="==> skip fftw"
|
||||
local config="config.sh/FFTW"
|
||||
local settings
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$FFTW_ARCH_PATH" ]
|
||||
then
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$FFTW_ARCH_PATH"
|
||||
local incName="fftw3.h"
|
||||
local libName="libfftw3"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -136,7 +108,49 @@ have_fftw()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_fftw()
|
||||
{
|
||||
local warn # warn="==> skip fftw"
|
||||
local config="config.sh/FFTW"
|
||||
local file
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$FFTW_ARCH_PATH" ]
|
||||
then
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
search_fftw "$FFTW_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_fftw()
|
||||
{
|
||||
local config="config.sh/FFTW"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query fftw "$FFTW_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "fftw=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_fftw
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -21,7 +21,8 @@
|
||||
# or config.sh/hypre
|
||||
#
|
||||
# Functions provided
|
||||
# have_hypre, no_hypre, echo_hypre, query_hypre
|
||||
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
|
||||
# hint_hypre
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_HYPRE
|
||||
@ -34,7 +35,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_hypre()
|
||||
{
|
||||
unset HAVE_HYPRE HYPRE_INC_DIR HYPRE_LIB_DIR
|
||||
@ -45,53 +46,38 @@ no_hypre()
|
||||
echo_hypre()
|
||||
{
|
||||
echo "hypre=${HAVE_HYPRE:-false}"
|
||||
echo "root=$HYPRE_ARCH_PATH"
|
||||
echo "include=$HYPRE_INC_DIR"
|
||||
echo "library=$HYPRE_LIB_DIR"
|
||||
echo "root=\"$HYPRE_ARCH_PATH\""
|
||||
echo "include=\"$HYPRE_INC_DIR\""
|
||||
echo "library=\"$HYPRE_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_hypre()
|
||||
# Hint for enabling
|
||||
hint_hypre()
|
||||
{
|
||||
local config="config.sh/hypre"
|
||||
local settings
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> hypre not found?
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query hypre "$HYPRE_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "hypre=unknown"
|
||||
fi
|
||||
eval \$(foamEtcFile -sh -config hypre -- -force)
|
||||
|
||||
==
|
||||
INFORMATION
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR
|
||||
have_hypre()
|
||||
search_hypre()
|
||||
{
|
||||
local warn="==> skip hypre"
|
||||
local config="config.sh/hypre"
|
||||
local settings
|
||||
|
||||
# Setup - prefer current environment value? (TDB)
|
||||
if [ ! -d "$HYPRE_ARCH_PATH" ]
|
||||
then
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$HYPRE_ARCH_PATH"
|
||||
local incName="HYPRE.h"
|
||||
local libName="libHYPRE"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -136,7 +122,52 @@ have_hypre()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_hypre()
|
||||
{
|
||||
local warn="==> skip hypre"
|
||||
local config="config.sh/hypre"
|
||||
local file
|
||||
|
||||
# Setup - prefer current environment value
|
||||
if [ -d "$HYPRE_ARCH_PATH" ] || [ "$HYPRE_ARCH_PATH" = system ]
|
||||
then
|
||||
:
|
||||
else
|
||||
# Use config file
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
search_hypre "$HYPRE_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_hypre()
|
||||
{
|
||||
local config="config.sh/hypre"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query hypre "$HYPRE_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "hypre=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_hypre
|
||||
|
||||
# Test/query
|
||||
@ -148,6 +179,9 @@ case "$1" in
|
||||
-query)
|
||||
query_hypre
|
||||
;;
|
||||
-hint)
|
||||
hint_hypre
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# config.sh/kahip
|
||||
#
|
||||
# Functions provided
|
||||
# have_kahip, no_kahip, echo_kahip, query_kahip
|
||||
# have_kahip, no_kahip, echo_kahip, query_kahip, search_kahip
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_KAHIP
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_kahip()
|
||||
{
|
||||
unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR
|
||||
@ -45,49 +45,24 @@ no_kahip()
|
||||
echo_kahip()
|
||||
{
|
||||
echo "kahip=${HAVE_KAHIP:-false}"
|
||||
echo "root=$KAHIP_ARCH_PATH"
|
||||
echo "include=$KAHIP_INC_DIR"
|
||||
echo "library=$KAHIP_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_kahip()
|
||||
{
|
||||
local config="config.sh/kahip"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query kahip "$KAHIP_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "kahip=unknown"
|
||||
fi
|
||||
echo "root=\"$KAHIP_ARCH_PATH\""
|
||||
echo "include=\"$KAHIP_INC_DIR\""
|
||||
echo "library=\"$KAHIP_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR
|
||||
have_kahip()
|
||||
search_kahip()
|
||||
{
|
||||
local warn="==> skip kahip"
|
||||
local config="config.sh/kahip"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$KAHIP_ARCH_PATH"
|
||||
local incName="kaHIP_interface.h"
|
||||
local libName="libkahip"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -124,7 +99,7 @@ have_kahip()
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
# kahip itself is 32-bit int, but our interface itself handles some
|
||||
# kahip itself is 32-bit int, but our interface handles some
|
||||
# 64-bit conversion (mesh size).
|
||||
|
||||
echo "kahip (label=32) - $prefix"
|
||||
@ -135,7 +110,45 @@ have_kahip()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_kahip()
|
||||
{
|
||||
local warn="==> skip kahip"
|
||||
local config="config.sh/kahip"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
search_kahip "$KAHIP_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_kahip()
|
||||
{
|
||||
local config="config.sh/kahip"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query kahip "$KAHIP_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "kahip=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_kahip
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# config.sh/metis
|
||||
#
|
||||
# Functions provided
|
||||
# have_metis, no_metis, echo_metis, query_metis
|
||||
# have_metis, no_metis, echo_metis, query_metis, search_metis
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_METIS
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_metis()
|
||||
{
|
||||
unset HAVE_METIS METIS_ARCH_PATH METIS_INC_DIR METIS_LIB_DIR
|
||||
@ -45,49 +45,24 @@ no_metis()
|
||||
echo_metis()
|
||||
{
|
||||
echo "metis=${HAVE_METIS:-false}"
|
||||
echo "root=$METIS_ARCH_PATH"
|
||||
echo "include=$METIS_INC_DIR"
|
||||
echo "library=$METIS_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_metis()
|
||||
{
|
||||
local config="config.sh/metis"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query metis "$METIS_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "metis=unknown"
|
||||
fi
|
||||
echo "root=\"$METIS_ARCH_PATH\""
|
||||
echo "include=\"$METIS_INC_DIR\""
|
||||
echo "library=\"$METIS_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_METIS, METIS_ARCH_PATH, METIS_INC_DIR, METIS_LIB_DIR
|
||||
have_metis()
|
||||
search_metis()
|
||||
{
|
||||
local warn="==> skip metis"
|
||||
local config="config.sh/metis"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$METIS_ARCH_PATH"
|
||||
local incName="metis.h"
|
||||
local libName="libmetis"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -142,6 +117,44 @@ have_metis()
|
||||
}
|
||||
|
||||
|
||||
# Output as per search_* function
|
||||
have_metis()
|
||||
{
|
||||
local warn="==> skip metis"
|
||||
local config="config.sh/metis"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_metis "$METIS_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_metis()
|
||||
{
|
||||
local config="config.sh/metis"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query metis "$METIS_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "metis=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
no_metis
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# config.sh/mgridgen
|
||||
#
|
||||
# Functions provided
|
||||
# have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen
|
||||
# have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen, search_mgridgen
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_MGRIDGEN
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_mgridgen()
|
||||
{
|
||||
unset HAVE_MGRIDGEN MGRIDGEN_ARCH_PATH MGRIDGEN_INC_DIR MGRIDGEN_LIB_DIR
|
||||
@ -45,50 +45,25 @@ no_mgridgen()
|
||||
echo_mgridgen()
|
||||
{
|
||||
echo "mgridgen=${HAVE_MGRIDGEN:-false}"
|
||||
echo "root=$MGRIDGEN_ARCH_PATH"
|
||||
echo "include=$MGRIDGEN_INC_DIR"
|
||||
echo "library=$MGRIDGEN_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_mgridgen()
|
||||
{
|
||||
local config="config.sh/mgridgen"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query mgridgen "$MGRIDGEN_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "mgridgen=unknown"
|
||||
fi
|
||||
echo "root=\"$MGRIDGEN_ARCH_PATH\""
|
||||
echo "include=\"$MGRIDGEN_INC_DIR\""
|
||||
echo "library=\"$MGRIDGEN_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_MGRIDGEN, MGRIDGEN_ARCH_PATH, MGRIDGEN_INC_DIR, MGRIDGEN_LIB_DIR
|
||||
have_mgridgen()
|
||||
search_mgridgen()
|
||||
{
|
||||
local warn="==> skip mgridgen"
|
||||
local config="config.sh/mgridgen"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
#silent# [ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$MGRIDGEN_ARCH_PATH"
|
||||
local incName="mgridgen.h"
|
||||
local libName="libMGridGen"
|
||||
local libName2="libmgrid"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -177,7 +152,45 @@ have_mgridgen()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_mgridgen()
|
||||
{
|
||||
local warn="==> skip mgridgen"
|
||||
local config="config.sh/mgridgen"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
#silent# [ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_mgridgen "$MGRIDGEN_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_mgridgen()
|
||||
{
|
||||
local config="config.sh/mgridgen"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query mgridgen "$MGRIDGEN_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "mgridgen=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_mgridgen
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -18,10 +18,12 @@
|
||||
#
|
||||
# Requires
|
||||
# PETSC_ARCH_PATH
|
||||
# or PETSC_DIR, PETSC_ARCH
|
||||
# or config.sh/petsc
|
||||
#
|
||||
# Functions provided
|
||||
# have_petsc, no_petsc, echo_petsc, hint_petsc, query_petsc
|
||||
# have_petsc, no_petsc, echo_petsc, query_petsc, search_petsc
|
||||
# hint_petsc
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_PETSC
|
||||
@ -34,7 +36,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_petsc()
|
||||
{
|
||||
unset HAVE_PETSC PETSC_INC_DIR PETSC_LIB_DIR
|
||||
@ -45,9 +47,9 @@ no_petsc()
|
||||
echo_petsc()
|
||||
{
|
||||
echo "petsc=${HAVE_PETSC:-false}"
|
||||
echo "root=$PETSC_ARCH_PATH"
|
||||
echo "include=$PETSC_INC_DIR"
|
||||
echo "library=$PETSC_LIB_DIR"
|
||||
echo "root=\"$PETSC_ARCH_PATH\""
|
||||
echo "include=\"$PETSC_INC_DIR\""
|
||||
echo "library=\"$PETSC_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +58,7 @@ hint_petsc()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> petsc not found?
|
||||
|
||||
Enable in the OpenFOAM etc/bashrc, define manually or try with the
|
||||
following (POSIX shell):
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config petsc -- -force)
|
||||
|
||||
@ -67,49 +67,29 @@ INFORMATION
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_petsc()
|
||||
{
|
||||
local config="config.sh/petsc"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query petsc "$PETSC_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "petsc=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
|
||||
have_petsc()
|
||||
#
|
||||
# $1 = prefix (eg, PETSC_DIR, PETSC_ARCH_PATH)
|
||||
# $2 = [arch] (eg, PETSC_ARCH)
|
||||
#
|
||||
# Gets ugly with in-source installation.
|
||||
# 1) In the simple case, petsc is installed with --prefix
|
||||
# we find PREFIX/{include,lib}
|
||||
#
|
||||
# 2) With in-source installation,
|
||||
# headers in PETSC_DIR/include and PETSC_DIR/PETSC_ARCH/include
|
||||
# library is PETSC_DIR/PETSC_ARCH/lib*
|
||||
search_petsc()
|
||||
{
|
||||
local warn="==> skip petsc"
|
||||
local config="config.sh/petsc"
|
||||
local settings
|
||||
|
||||
# Setup - prefer current environment value? (TDB)
|
||||
if [ ! -d "$PETSC_ARCH_PATH" ]
|
||||
then
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$PETSC_ARCH_PATH"
|
||||
local incName="petsc.h"
|
||||
local libName="libpetsc"
|
||||
local pkgName="PETSc"
|
||||
local header library
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local arch="$2"
|
||||
local header library includeDirs libraryDirs
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -128,34 +108,56 @@ have_petsc()
|
||||
# No system header, attempt discovery with pkg-config
|
||||
if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null
|
||||
then
|
||||
header=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//')
|
||||
library=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//')
|
||||
includeDirs=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||
libraryDirs=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||
|
||||
prefix="${header%/*}" # Basename
|
||||
|
||||
# Artifically adjust names (for later)
|
||||
[ -n "$header" ] && header="$header/$incName"
|
||||
[ -n "$library" ] && library="$library/$libName"
|
||||
prefix="${includeDirs% *}" # First entry (ie, split on space)
|
||||
prefix="${prefix%/*}" # Basename
|
||||
fi
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
# Header -> directory
|
||||
if [ -z "$includeDirs" ]
|
||||
then
|
||||
includeDirs="${header%/*}" # Basename
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
fi
|
||||
|
||||
# Library -> directory
|
||||
if [ -z "$libraryDirs" ]
|
||||
then
|
||||
if [ -n "$arch" ] && [ -d "$prefix/$arch" ]
|
||||
then
|
||||
# Prepend with petsc-arch/include
|
||||
if [ -d "$prefix/$arch/include" ]
|
||||
then
|
||||
includeDirs="$prefix/$arch/include${includeDirs:+ }$includeDirs"
|
||||
fi
|
||||
|
||||
# Prefer with petsc-arch/lib
|
||||
if [ -z "$library" ]
|
||||
then
|
||||
library=$(findLibrary -prefix="$prefix/$arch" -name="$libName")
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
libraryDirs="${library%/*}" # Basename
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# TODO: check size of petsc integer vs label, real vs double?
|
||||
@ -163,12 +165,64 @@ have_petsc()
|
||||
# OK
|
||||
export HAVE_PETSC=true
|
||||
export PETSC_ARCH_PATH="$prefix"
|
||||
export PETSC_INC_DIR="${header%/*}" # Basename
|
||||
export PETSC_LIB_DIR="${library%/*}" # Basename
|
||||
export PETSC_INC_DIR="$includeDirs"
|
||||
export PETSC_LIB_DIR="$libraryDirs"
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
|
||||
have_petsc()
|
||||
{
|
||||
local warn="==> skip petsc"
|
||||
local config="config.sh/petsc"
|
||||
local file
|
||||
|
||||
# Setup - prefer current environment value
|
||||
if [ -d "$PETSC_ARCH_PATH" ] || [ "$PETSC_ARCH_PATH" = system ]
|
||||
then
|
||||
# OpenFOAM prefix naming, possibly with petsc-arch
|
||||
search_petsc "$PETSC_ARCH_PATH" $PETSC_ARCH
|
||||
|
||||
elif [ -d "$PETSC_DIR" ]
|
||||
then
|
||||
# petsc-dir, petsc-arch naming
|
||||
search_petsc "$PETSC_DIR" $PETSC_ARCH
|
||||
|
||||
else
|
||||
# Use config file
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
search_petsc "$PETSC_ARCH_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_petsc()
|
||||
{
|
||||
local config="config.sh/petsc"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query petsc "$PETSC_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "petsc=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_petsc
|
||||
|
||||
# Test/query
|
||||
@ -180,6 +234,9 @@ case "$1" in
|
||||
-query)
|
||||
query_petsc
|
||||
;;
|
||||
-hint)
|
||||
hint_petsc
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# None
|
||||
#
|
||||
# Functions provided
|
||||
# have_readline, no_readline, echo_readline
|
||||
# have_readline, no_readline, echo_readline, search_readline
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_LIBREADLINE - as per GNU autoconf
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_readline()
|
||||
{
|
||||
unset HAVE_LIBREADLINE READLINE_INC_DIR READLINE_LIB_DIR
|
||||
@ -43,22 +43,23 @@ no_readline()
|
||||
echo_readline()
|
||||
{
|
||||
echo "readline=${HAVE_LIBREADLINE:-false}"
|
||||
echo "include=$READLINE_INC_DIR"
|
||||
echo "library=$READLINE_LIB_DIR"
|
||||
echo "include=\"$READLINE_INC_DIR\""
|
||||
echo "library=\"$READLINE_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_LIBREADLINE, READLINE_INC_DIR, READLINE_LIB_DIR
|
||||
have_readline()
|
||||
search_readline()
|
||||
{
|
||||
local warn # warn="==> skip readline"
|
||||
local settings
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix=system
|
||||
local incName="readline/readline.h"
|
||||
local libName="libreadline"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -104,7 +105,16 @@ have_readline()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_readline()
|
||||
{
|
||||
search_readline system
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_readline
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# config.sh/scotch
|
||||
#
|
||||
# Functions provided
|
||||
# have_scotch, no_scotch, echo_scotch, query_scotch
|
||||
# have_ptscotch, search_ptscotch
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_SCOTCH
|
||||
@ -28,12 +28,62 @@
|
||||
# SCOTCH_INC_DIR
|
||||
# SCOTCH_LIB_DIR
|
||||
#
|
||||
# Functions provided [Must call have_scotch first]
|
||||
# have_ptscotch, search_ptscotch
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_PTSCOTCH
|
||||
# PTSCOTCH_ARCH_PATH
|
||||
# PTSCOTCH_INC_DIR
|
||||
# PTSCOTCH_LIB_DIR
|
||||
#
|
||||
#
|
||||
# System files can be hiding in a large variety of locations
|
||||
#
|
||||
# ArchLinux
|
||||
# ---------
|
||||
# scotch include=/usr/include/ptscotch
|
||||
#
|
||||
# ptscotch include=/usr/include/ptscotch
|
||||
#
|
||||
#
|
||||
# Debian/Ubuntu
|
||||
# -------------
|
||||
# scotch include=/usr/include/scotch-int32
|
||||
# scotch library=/usr/lib/x86_64-linux-gnu
|
||||
#
|
||||
# ptscotch include=/usr/include/scotch-int32
|
||||
# ptscotch library=/usr/lib/x86_64-linux-gnu
|
||||
#
|
||||
#
|
||||
# RedHat
|
||||
# ------
|
||||
# scotch include=/usr/include
|
||||
# scotch library=/usr/lib64
|
||||
#
|
||||
# ptscotch include=/usr/include/openmpi-x86_64
|
||||
# ptscotch library=/usr/lib64/openmpi/lib
|
||||
#
|
||||
# when MPI_ARCH_PATH=/usr/lib64/openmpi
|
||||
# and mpicc --showme:compile -> -I/usr/include/openmpi-x86_64
|
||||
#
|
||||
#
|
||||
# openSUSE
|
||||
# --------
|
||||
# scotch include=/usr/include
|
||||
# scotch library=/usr/lib64
|
||||
#
|
||||
# ptscotch include=/usr/lib64/mpi/gcc/openmpi2/include
|
||||
# ptscotch library=/usr/lib64/mpi/gcc/openmpi2/lib64
|
||||
#
|
||||
# when MPI_ARCH_PATH=/usr/lib64/mpi/gcc/openmpi2
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_scotch()
|
||||
{
|
||||
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
|
||||
@ -46,55 +96,30 @@ no_scotch()
|
||||
echo_scotch()
|
||||
{
|
||||
echo "scotch=${HAVE_SCOTCH:-false}"
|
||||
echo "root=$SCOTCH_ARCH_PATH"
|
||||
echo "include=$SCOTCH_INC_DIR"
|
||||
echo "library=$SCOTCH_LIB_DIR"
|
||||
echo "root=\"$SCOTCH_ARCH_PATH\""
|
||||
echo "include=\"$SCOTCH_INC_DIR\""
|
||||
echo "library=\"$SCOTCH_LIB_DIR\""
|
||||
echo
|
||||
echo "ptscotch=${HAVE_PTSCOTCH:-false}"
|
||||
echo "root=$PTSCOTCH_ARCH_PATH"
|
||||
echo "include=$PTSCOTCH_INC_DIR"
|
||||
echo "library=$PTSCOTCH_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_scotch()
|
||||
{
|
||||
local config="config.sh/scotch"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query scotch "$SCOTCH_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "scotch=unknown"
|
||||
fi
|
||||
echo "root=\"$PTSCOTCH_ARCH_PATH\""
|
||||
echo "include=\"$PTSCOTCH_INC_DIR\""
|
||||
echo "library=\"$PTSCOTCH_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR
|
||||
have_scotch()
|
||||
search_scotch()
|
||||
{
|
||||
local warn="==> skip scotch"
|
||||
local config="config.sh/scotch"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$SCOTCH_ARCH_PATH"
|
||||
local incName="scotch.h"
|
||||
local libName="libscotch"
|
||||
local localDir="scotch-int$WM_LABEL_SIZE"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -106,6 +131,7 @@ have_scotch()
|
||||
then
|
||||
header=$(findFirstFile \
|
||||
"$prefix/include/$localDir/$incName" \
|
||||
"$prefix/include/scotch/$incName" \
|
||||
"$prefix/include/$incName" \
|
||||
)
|
||||
library=$(findExtLib "$libName")
|
||||
@ -192,30 +218,24 @@ have_scotch()
|
||||
}
|
||||
|
||||
|
||||
# Must be called after have_scotch!
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR
|
||||
have_ptscotch()
|
||||
search_ptscotch()
|
||||
{
|
||||
local warn="==> skip ptscotch"
|
||||
|
||||
if [ "$HAVE_SCOTCH" != true ]
|
||||
then
|
||||
echo "$warn (no serial scotch available?)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Reuse old settings
|
||||
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$PTSCOTCH_ARCH_PATH"
|
||||
local incName="ptscotch.h"
|
||||
local libName="libptscotch"
|
||||
local localDir="scotch-int$WM_LABEL_SIZE"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
local mpiPrefix="$MPI_ARCH_PATH"
|
||||
local mpiName="${MPI_ARCH_PATH##*/}"
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
then
|
||||
@ -226,12 +246,18 @@ have_ptscotch()
|
||||
header=$(findFirstFile \
|
||||
"$prefix/include/$FOAM_MPI/$incName" \
|
||||
"$prefix/include/$localDir/$incName" \
|
||||
"$prefix/include/$incName"
|
||||
"$prefix/include/ptscotch/$incName" \
|
||||
"$prefix/include/scotch/$incName" \
|
||||
"$prefix/include/$incName" \
|
||||
"$mpiPrefix/include/$incName" \
|
||||
"$prefix/include/$mpiName/$incName" \
|
||||
"$prefix/include/${mpiName}-$(uname -m)/$incName" \
|
||||
)
|
||||
library="$(findExtLib $FOAM_MPI/$libName $libName)"
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile \
|
||||
"/usr/local/include/$localDir/$incName" \
|
||||
"/usr/local/include/ptscotch/$incName" \
|
||||
"/usr/local/include/scotch/$incName" \
|
||||
"/usr/local/include/$incName" \
|
||||
@ -239,6 +265,9 @@ have_ptscotch()
|
||||
"/usr/include/ptscotch/$incName" \
|
||||
"/usr/include/scotch/$incName" \
|
||||
"/usr/include/$incName" \
|
||||
"$mpiPrefix/include/$incName" \
|
||||
"/usr/include/$mpiName/$incName" \
|
||||
"$prefix/include/${mpiName}-$(uname -m)/$incName" \
|
||||
)
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
@ -256,6 +285,7 @@ have_ptscotch()
|
||||
# Library
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
|
||||
|| library=$(findLibrary -prefix="$mpiPrefix" -name="$libName" -local="$localDir") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
@ -272,7 +302,63 @@ have_ptscotch()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_scotch()
|
||||
{
|
||||
local warn="==> skip scotch"
|
||||
local config="config.sh/scotch"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_scotch "$SCOTCH_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Output as per search_* function
|
||||
have_ptscotch()
|
||||
{
|
||||
local warn="==> skip ptscotch"
|
||||
|
||||
if [ "$HAVE_SCOTCH" != true ]
|
||||
then
|
||||
echo "$warn (no serial scotch available?)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Reuse old settings
|
||||
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
|
||||
|
||||
search_ptscotch "$PTSCOTCH_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_scotch()
|
||||
{
|
||||
local config="config.sh/scotch"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query scotch "$SCOTCH_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "scotch=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_scotch
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
# config.sh/zoltan
|
||||
#
|
||||
# Functions provided
|
||||
# have_zoltan, no_zoltan, echo_zoltan, query_zoltan
|
||||
# have_zoltan, no_zoltan, echo_zoltan, query_zoltan, search_zoltan
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_ZOLTAN
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_zoltan()
|
||||
{
|
||||
unset HAVE_ZOLTAN ZOLTAN_INC_DIR ZOLTAN_LIB_DIR
|
||||
@ -44,49 +44,24 @@ no_zoltan()
|
||||
echo_zoltan()
|
||||
{
|
||||
echo "zoltan=${HAVE_ZOLTAN:-false}"
|
||||
echo "root=$ZOLTAN_ARCH_PATH"
|
||||
echo "include=$ZOLTAN_INC_DIR"
|
||||
echo "library=$ZOLTAN_LIB_DIR"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_zoltan()
|
||||
{
|
||||
local config="config.sh/zoltan"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query zoltan "$ZOLTAN_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "zoltan=unknown"
|
||||
fi
|
||||
echo "root=\"$ZOLTAN_ARCH_PATH\""
|
||||
echo "include=\"$ZOLTAN_INC_DIR\""
|
||||
echo "library=\"$ZOLTAN_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_ZOLTAN, ZOLTAN_INC_DIR, ZOLTAN_LIB_DIR
|
||||
have_zoltan()
|
||||
search_zoltan()
|
||||
{
|
||||
local warn # warn="==> skip zoltan"
|
||||
local config="config.sh/zoltan"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$ZOLTAN_ARCH_PATH"
|
||||
local incName="zoltan.h"
|
||||
local libName="libzoltan"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -131,7 +106,45 @@ have_zoltan()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_zoltan()
|
||||
{
|
||||
local warn # warn="==> skip zoltan"
|
||||
local config="config.sh/zoltan"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_zoltan "$ZOLTAN_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_zoltan()
|
||||
{
|
||||
local config="config.sh/zoltan"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query zoltan "$ZOLTAN_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "zoltan=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_zoltan
|
||||
|
||||
# Test/query
|
||||
|
||||
@ -53,9 +53,9 @@ no_paraview()
|
||||
echo_paraview()
|
||||
{
|
||||
echo "paraview=${HAVE_PVPLUGIN_SUPPORT:-false}"
|
||||
echo "root=$ParaView_DIR"
|
||||
echo "include=$PARAVIEW_INC_DIR"
|
||||
echo "plugin=$FOAM_PV_PLUGIN_LIBBIN"
|
||||
echo "root=\"$ParaView_DIR\""
|
||||
echo "include=\"$PARAVIEW_INC_DIR\""
|
||||
echo "plugin=\"$FOAM_PV_PLUGIN_LIBBIN\""
|
||||
echo "api=$PARAVIEW_API"
|
||||
}
|
||||
|
||||
|
||||
@ -6,17 +6,19 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# wmakeFunctions
|
||||
#
|
||||
# Description
|
||||
# Functions to check wmake environment and find .dep and .o files
|
||||
# Support functions for wmake infrastructure.
|
||||
# For example, check environment, find .dep and .o files, various
|
||||
# wrappers when making libraries.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Ensure these variables are always defined
|
||||
@ -31,17 +33,18 @@ then
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Check environment variables
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Check environment variables
|
||||
checkEnv()
|
||||
{
|
||||
local check failed
|
||||
|
||||
for check in WM_PROJECT_DIR WM_OPTIONS WM_DIR
|
||||
# Default for WM_DIR already provided above
|
||||
|
||||
for check in WM_PROJECT_DIR WM_OPTIONS
|
||||
do
|
||||
eval test "\$$check" || failed="$failed $check"
|
||||
eval test -n "\$$check" || failed="$failed $check"
|
||||
done
|
||||
|
||||
[ -z "$failed" ] || {
|
||||
@ -52,11 +55,45 @@ checkEnv()
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Search up directories tree for the Make sub-directory
|
||||
# Set FOAM_MODULE_PREFIX according to
|
||||
# - absolute/relative path
|
||||
# - predefined type (u,user | g,group | o,openfoam)
|
||||
setModulePrefix()
|
||||
{
|
||||
export FOAM_MODULE_PREFIX="$1"
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
# Prefix: user
|
||||
(u | user) FOAM_MODULE_PREFIX="${FOAM_USER_LIBBIN%/*}" ;;
|
||||
|
||||
# Prefix: group
|
||||
(g | group) FOAM_MODULE_PREFIX="${FOAM_SITE_LIBBIN%/*}" ;;
|
||||
|
||||
# Prefix: openfoam (other)
|
||||
(o | openfoam) FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}" ;;
|
||||
|
||||
# Prefix: false | none (ie, 'disabled')
|
||||
(false | none) FOAM_MODULE_PREFIX=false ;;
|
||||
|
||||
# Prefix: directory (absolute or relative)
|
||||
(*)
|
||||
: "${FOAM_MODULE_PREFIX:=/usr/local}" # Fallback (autoconf-like)
|
||||
|
||||
# Require absolute path
|
||||
[ "${FOAM_MODULE_PREFIX#/}" != "${FOAM_MODULE_PREFIX}" ] || \
|
||||
FOAM_MODULE_PREFIX="${PWD}/${FOAM_MODULE_PREFIX}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Avoid potential conflicts
|
||||
unset FOAM_MODULE_APPBIN FOAM_MODULE_LIBBIN
|
||||
echo "Module prefix = ${FOAM_MODULE_PREFIX:-[]}" 1>&2
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Return the absolute path for a directory or a file's parent directory
|
||||
# Return the absolute (physical) path for a directory or
|
||||
# for a file's parent directory
|
||||
# expandPath dirName
|
||||
# expandPath fileName
|
||||
#
|
||||
@ -69,12 +106,13 @@ expandPath()
|
||||
(cd "$1" && pwd -P)
|
||||
elif [ -n "$1" ]
|
||||
then
|
||||
(cd $(dirname "$1") && pwd -P)
|
||||
(cd "$(dirname "$1")" && pwd -P)
|
||||
else
|
||||
pwd -P
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Find the target directory, which contains a Make/ directory
|
||||
# search upwards in its parent directories, but stopping
|
||||
# when it hits the project root, home, or the file-system root
|
||||
@ -88,15 +126,15 @@ expandPath()
|
||||
# - WM_PROJECT_DIR, HOME
|
||||
findTarget()
|
||||
{
|
||||
local project=$(expandPath $WM_PROJECT_DIR)
|
||||
local home=$(expandPath $HOME)
|
||||
local project=$(expandPath "$WM_PROJECT_DIR")
|
||||
local home=$(expandPath "$HOME")
|
||||
local reldir="${1:-.}"
|
||||
local absdir=$(expandPath $reldir)
|
||||
local absdir=$(expandPath "$reldir")
|
||||
|
||||
while [ -n "$absdir" ]
|
||||
do
|
||||
case "$absdir" in
|
||||
($project | $home | /)
|
||||
("$project" | "$home" | /)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
@ -112,7 +150,7 @@ findTarget()
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Error: no Make directory for $(expandPath $1)" 1>&2
|
||||
echo "Error: no Make directory for $(expandPath "$1")" 1>&2
|
||||
echo 1>&2
|
||||
return 1
|
||||
}
|
||||
@ -132,14 +170,14 @@ cdSource()
|
||||
echo " Searching up directories tree for Make directory" 1>&2
|
||||
|
||||
dir=$(findTarget .) || exit 1 # Fatal
|
||||
cd $dir 2>/dev/null || {
|
||||
cd "$dir" 2>/dev/null || {
|
||||
echo "$Script error: could not change to directory '$dir'" 1>&2
|
||||
exit 1
|
||||
}
|
||||
unset targetType
|
||||
fi
|
||||
|
||||
[ -r $MakeDir/files ] || {
|
||||
[ -r "$MakeDir"/files ] || {
|
||||
echo "$Script error: file '$MakeDir/files' does not exist in $PWD" 1>&2
|
||||
exit 1
|
||||
}
|
||||
@ -157,23 +195,34 @@ cdSource()
|
||||
# - WM_PROJECT_DIR, WM_OPTIONS
|
||||
findObjectDir()
|
||||
{
|
||||
local project=$(expandPath $WM_PROJECT_DIR)
|
||||
local absdir=$(expandPath ${1:-.})
|
||||
local objectsDir
|
||||
local project="$(expandPath "$WM_PROJECT_DIR")"
|
||||
local absdir="$(expandPath "${1:-.}")"
|
||||
local appDir relativeDir objectsDir
|
||||
|
||||
case "$absdir" in
|
||||
("$project"/*)
|
||||
local buildPath=$WM_PROJECT_DIR/build/${WM_OPTIONS}
|
||||
objectsDir=$buildPath$(echo $absdir | sed s%$project%% )
|
||||
;;
|
||||
(*)
|
||||
local path=$absdir
|
||||
local appDir=.
|
||||
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
|
||||
absdir=$(expandPath $appDir/.)
|
||||
objectsDir=$appDir/Make/${WM_OPTIONS}$(echo $path | sed s%$absdir%% )
|
||||
;;
|
||||
esac
|
||||
# Treat project/ builds as out-of-source
|
||||
relativeDir="${absdir#${project}/}"
|
||||
if [ "$relativeDir" != "$absdir" ]
|
||||
then
|
||||
[ -w "$WM_PROJECT_DIR" ] && \
|
||||
objectsDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${relativeDir}"
|
||||
fi
|
||||
|
||||
# Default (local) build directory
|
||||
if [ -z "$objectsDir" ]
|
||||
then
|
||||
if [ -d "$absdir/Make" ]
|
||||
then
|
||||
objectsDir="${absdir}/Make/${WM_OPTIONS}"
|
||||
else
|
||||
relativeDir="$absdir"
|
||||
appDir=.
|
||||
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
|
||||
absdir=$(expandPath "$appDir"/.)
|
||||
|
||||
relativeDir="${relativeDir#${absdir}}"
|
||||
objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$objectsDir"
|
||||
}
|
||||
@ -190,7 +239,7 @@ findObjectDir()
|
||||
# - WM_PROJECT_DIR, WM_OPTIONS
|
||||
removeObjectDir()
|
||||
{
|
||||
local objectsDir=$(findObjectDir ${1:-.})
|
||||
local objectsDir="$(findObjectDir "${1:-.}")"
|
||||
if [ -d "$objectsDir" ]
|
||||
then
|
||||
rm -rf "$objectsDir" 2>/dev/null
|
||||
@ -198,6 +247,139 @@ removeObjectDir()
|
||||
}
|
||||
|
||||
|
||||
# Save build/configure parameter information (dependency) into sentinel file
|
||||
#
|
||||
# 1 - sentinelFile
|
||||
# 2... build/configure parameters
|
||||
#
|
||||
storeDependency()
|
||||
{
|
||||
local sentinel="$1"
|
||||
local depend
|
||||
shift
|
||||
|
||||
if [ -n "$sentinel" ]
|
||||
then
|
||||
mkdir -p "$(dirname "$sentinel")"
|
||||
|
||||
echo '# Build/configure parameters' >| "$sentinel"
|
||||
|
||||
for depend
|
||||
do
|
||||
echo "-- $depend"
|
||||
done >> "$sentinel"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Check sentinel file(s) to handle changed build/configure parameters
|
||||
# such as paraview / vtk version changes
|
||||
#
|
||||
# 1 - sourceDir
|
||||
# 2... build/configure parameters
|
||||
#
|
||||
# The additional test for "CMakeCache.txt" helps for cmake projects and
|
||||
# has no adverse affect for others
|
||||
#
|
||||
sameDependency()
|
||||
{
|
||||
local sourceDir="$1"
|
||||
shift
|
||||
local objectsDir
|
||||
local compare=0
|
||||
|
||||
# Where generated files are stored
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
local sentinel="$objectsDir/ConfigParameters"
|
||||
|
||||
if [ -f "$sentinel" ]
|
||||
then
|
||||
# Create an .update version for comparison
|
||||
storeDependency "${sentinel}.update" $@
|
||||
cmp "${sentinel}" "${sentinel}.update" >/dev/null 2>&1
|
||||
compare=$?
|
||||
|
||||
if [ "$compare" -ne 0 ]
|
||||
then
|
||||
echo "build/configure parameters changed between builds" 1>&2
|
||||
## cat "${sentinel}.update" 1>&2
|
||||
fi
|
||||
|
||||
else
|
||||
# No sentinel file: First time, or failed compilation?
|
||||
if [ -f "$objectsDir/CMakeCache.txt" ]
|
||||
then
|
||||
echo "previous build was incomplete" 1>&2
|
||||
compare=1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$sentinel"
|
||||
return "$compare"
|
||||
}
|
||||
|
||||
|
||||
# Build a mpi-versioned library (targetType)
|
||||
# - use sentinel file(s) to handle paraview version changes
|
||||
# compile into qualified directory
|
||||
# use sentinel file(s) to handle version changes
|
||||
# 1 - libName
|
||||
# 2... build/configure information
|
||||
#
|
||||
# Global variables used:
|
||||
# - WM_OPTIONS, WM_MPLIB, FOAM_MPI
|
||||
#
|
||||
# Requires that WM_MPLIB contain an "MPI" string
|
||||
wmakeLibMpi()
|
||||
{
|
||||
local libName="$1"
|
||||
shift
|
||||
|
||||
case "$WM_MPLIB" in (*MPI* | *mpi*)
|
||||
(
|
||||
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
|
||||
|
||||
# Where generated files are stored
|
||||
objectsDir="$(findObjectDir "$libName")" || exit 1 # Fatal
|
||||
|
||||
# Something changed
|
||||
sentinel=$(sameDependency "$libName" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@) || \
|
||||
wclean "$libName"
|
||||
|
||||
echo "wmake $targetType $libName (mpi=$WM_MPLIB)"
|
||||
wmake $targetType "$libName" && \
|
||||
storeDependency "$sentinel" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@
|
||||
)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Clean an mpi-versioned library
|
||||
#
|
||||
# Global variables used:
|
||||
# - WM_OPTIONS, WM_MPLIB
|
||||
#
|
||||
# Requires that WM_MPLIB contain an "MPI" string
|
||||
wcleanLibMpi()
|
||||
{
|
||||
case "$WM_MPLIB" in (*MPI* | *mpi*)
|
||||
(
|
||||
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
|
||||
|
||||
for libName
|
||||
do
|
||||
wclean "$libName"
|
||||
done
|
||||
)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# depToSource depFile
|
||||
#
|
||||
# Output:
|
||||
@ -210,7 +392,7 @@ if [ -n "$BASH_VERSION" ]
|
||||
then
|
||||
depToSource()
|
||||
{
|
||||
local sourceFile=${1%.dep}
|
||||
local sourceFile="${1%.dep}"
|
||||
sourceFile="${sourceFile/build\/${WM_OPTIONS}\//}"
|
||||
sourceFile="${sourceFile/build\/${WM_OPTIONS}${WM_MPLIB}\//}"
|
||||
sourceFile="${sourceFile/Make\/${WM_OPTIONS}\//}"
|
||||
@ -221,13 +403,11 @@ then
|
||||
else
|
||||
depToSource()
|
||||
{
|
||||
local sourceFile=$(echo ${1%.dep} | \
|
||||
sed -e s%build/${WM_OPTIONS}/%% \
|
||||
-e s%build/${WM_OPTIONS}${WM_MPLIB}/%% \
|
||||
-e s%Make/${WM_OPTIONS}/%% \
|
||||
-e s%Make/${WM_OPTIONS}${WM_MPLIB}/%% )
|
||||
|
||||
echo "$sourceFile"
|
||||
echo "${1%.dep}" | sed \
|
||||
-e "s%build/${WM_OPTIONS}/%%" \
|
||||
-e "s%build/${WM_OPTIONS}${WM_MPLIB}/%%" \
|
||||
-e "s%Make/${WM_OPTIONS}/%%" \
|
||||
-e "s%Make/${WM_OPTIONS}${WM_MPLIB}/%%"
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
@ -152,6 +152,8 @@ die()
|
||||
# Default make is the "make" in the path
|
||||
make="make"
|
||||
|
||||
# Print compiler/system information (serial only)
|
||||
printInfo() { make --no-print-directory -f "$WM_DIR"/makefiles/info "$@"; }
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -189,11 +191,11 @@ do
|
||||
-show-api | -show-ext-so | \
|
||||
-show-compile-c | -show-c | -show-cflags | -show-cflags-arch | \
|
||||
-show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch )
|
||||
$make -f $WM_DIR/makefiles/info "${1#-show-}"
|
||||
printInfo "${1#-show-}"
|
||||
optShow=true
|
||||
;;
|
||||
-show-path-c | -show-path-cxx )
|
||||
command -v $($make -f $WM_DIR/makefiles/info "${1#-show-path-}")
|
||||
command -v $(printInfo "${1#-show-path-}")
|
||||
optShow=true
|
||||
;;
|
||||
-a | -all | all)
|
||||
@ -240,7 +242,7 @@ do
|
||||
: ${all:=all} # implies 'all', unless previous set to 'queue' etc.
|
||||
;;
|
||||
-version | --version)
|
||||
$make -f $WM_DIR/makefiles/info api
|
||||
printInfo api
|
||||
optShow=true
|
||||
break;
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user