Merge branch 'master' of ssh://noisy/home/noisy2/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2008-06-05 12:14:12 +01:00
6 changed files with 464 additions and 88 deletions

View File

@ -127,7 +127,7 @@ public:
{}
//- Return the block holding these datasets
const int block() const
int block() const
{
return block_;
}
@ -137,17 +137,17 @@ public:
return name_;
}
const int start() const
int start() const
{
return start_;
}
const int end() const
int end() const
{
return start_ + size_;
}
const int size() const
int size() const
{
return size_;
}

393
bin/foamThirdParty Executable file
View File

@ -0,0 +1,393 @@
#!/usr/bin/perl -w
use strict;
use File::Spec;
use Getopt::Long;
#############################################################################
# SETTINGS
#
my %config = (
thirdParty => "$ENV{WM_PROJECT_INST_DIR}/ThirdParty",
project => ( $ENV{WM_PROJECT} || '' ) . "-"
. ( $ENV{WM_PROJECT_VERSION} || '' ),
);
my %packages = (
lam => {
-opt => 1,
url => "http://www.lam-mpi.org/download/files/lam-7.1.4.tar.bz2",
},
libccmio => {
-opt => 1,
url =>
"https://wci.llnl.gov/codes/visit/3rd_party/libccmio-2.6.1.tar.gz",
},
openmpi => {
url =>
"http://www.open-mpi.org/software/ompi/v1.2/downloads/openmpi-1.2.6.tar.bz2",
},
metis => {
url =>
"http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.0pre2.tar.gz"
},
mico => {
-opt => 1,
url => "http://www.mico.org/mico-2.3.12.tar.gz",
},
mpich => {
-opt => 1,
url => "ftp://ftp.mcs.anl.gov/pub/mpi/old/mpich-1.2.4.tar.gz",
},
ParMetis => {
url =>
"http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/ParMetis-3.1.tar.gz",
},
ParMGridGen => {
url =>
"http://www-users.cs.umn.edu/~moulitsa/download/ParMGridGen-1.0.tar.gz",
},
zlib => { url => "http://www.zlib.net/zlib-1.2.3.tar.gz", },
hoard => {
-opt => 1,
url =>
"http://www.cs.umass.edu/%7Eemery/hoard/hoard-3.7.1/hoard-371.tar.gz"
},
## # this really doesn't work well, but code needs minor patching anyhow:
## fbsdmalloc => {
## url =>
## "http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/lib/libc/stdlib/malloc.c?rev=1.171",
##
## },
);
#
# END OF SETTINGS
############################################################################
( my $Script = $0 ) =~ s{^.*/}{};
# --------------------------------------------------------------------------
sub usage {
my ( @req, @opt );
for ( sort keys %packages ) {
if ( $packages{$_}{-opt} ) {
push @opt, $_;
}
else {
push @req, $_;
}
}
$! = 0; # clean exit
warn "@_\n" if @_;
die <<"USAGE";
usage:
$Script [OPTION] [package1 .. packageN]
options:
-help usage
-status show status [default]
-list list versions and resource locations
-version list versions only
-dir list unpack directory
-reldir list unpack directory relative to cwd
-get get packages as required (uses curl)
-unpack unpack packages where required and possible
Simple management of 3rd party software for '$config{project}'
using the directory
$config{thirdParty}
Packages: @req
Optional: @opt
Return codes:
-status -get -unpack number of missing packages or errors
USAGE
}
# --------------------------------------------------------------------------
my %opt;
# default action is -status
@ARGV or $opt{status}++;
GetOptions(
\%opt, ##
"help", "status", "list", "version", "dir",
"reldir", "get", "unpack",
)
or usage;
$opt{help} and usage;
-d $config{thirdParty} or usage "ERROR: no '$config{thirdParty}' dir";
#
# complete the config
#
if ( not exists $config{sources} ) {
$config{sources} = "$config{thirdParty}/sources";
-d $config{sources} or mkdir $config{sources};
}
#
# cleanup the packages table
#
for my $name ( keys %packages ) {
my $href = $packages{$name};
if ( not $href->{url} ) {
warn "$name without url\n";
delete $packages{$name};
next;
}
if ( not exists $href->{file} ) {
( $href->{file} = $href->{url} ) =~ s{^.*/|\?.*$}{}g;
}
if ( not exists $href->{dir} ) {
( $href->{dir} = $href->{file} ) =~ s{\.(zip|tar(\.(gz|bz2))?)$}{};
}
}
#
# check for names in the packages
#
sub selectNames {
my @names;
my $req;
while ( @_ and $_[0] =~ /^-/ ) {
my $opt = shift;
if ( $opt =~ /^-req/ ) {
$req++;
}
}
if (@_) {
my ( %seen, @reject );
for my $name (@_) {
next if $seen{$name}++;
if ( exists $packages{$name} ) {
push @names, $name;
}
else {
push @reject, $name;
}
}
usage "unknown package(s): @reject" if @reject;
}
else {
@names =
grep { not $req or not $packages{$_}{-opt} } sort keys %packages;
}
@names or usage "no packages";
return @names;
}
#
# list the current status
#
if ( $opt{status} ) {
my @names = selectNames @ARGV;
my $nMissing = 0;
for my $name (@names) {
my $href = $packages{$name};
my ( $dir, $file, $url ) = @$href{qw( dir file url )};
my @status;
if ( -e "$config{sources}/$file" ) {
push @status, " packed: $config{sources}/$file";
}
if ( -d "$config{thirdParty}/$dir" ) {
push @status, "unpacked: $config{thirdParty}/$dir";
}
unless (@status) {
$nMissing++;
@status = "missing";
}
for (@status) {
printf "%-16s %-16s %s", $name, $dir, $_;
if ( $href->{-opt} ) {
print " [optional]";
}
print "\n";
}
}
exit $nMissing;
}
#
# show an overview of the versions and the resource locations
#
if ( $opt{list} ) {
my @names = selectNames @ARGV;
for my $name (@names) {
my $href = $packages{$name};
my ( $dir, $file, $url ) = @$href{qw( dir file url )};
printf "%-16s %-16s %s", $name, $dir, $url;
if ( $href->{-opt} ) {
print " [optional]";
}
print "\n";
}
exit 0;
}
#
# show the version (directory name) only
#
if ( $opt{version} ) {
my @names = selectNames @ARGV;
for my $name (@names) {
my $href = $packages{$name};
my ( $dir, $file, $url ) = @$href{qw( dir file url )};
print $dir, "\n";
}
exit 0;
}
#
# show the unpack directory name
#
if ( $opt{dir} or $opt{reldir} ) {
my @names = selectNames @ARGV;
my $base = $config{thirdParty};
if ( $opt{reldir} ) {
$base = File::Spec->abs2rel($base);
length $base or $base = '.';
}
for my $name (@names) {
my $href = $packages{$name};
my ( $dir, $file, $url ) = @$href{qw( dir file url )};
print File::Spec->catfile( $base, $dir ), "\n";
}
exit 0;
}
#
# get and/or unpack packages as required and possible
# avoid getting/unpacking optional packages
#
if ( $opt{get} or $opt{unpack} ) {
my @names = selectNames -required => @ARGV;
my $nError = 0;
for my $name (@names) {
my $href = $packages{$name};
my ( $dir, $file, $url ) = @$href{qw( dir file url )};
my $flags = "";
if ( $href->{-opt} ) {
$flags .= "[optional]";
}
warn '-' x 70, "\n", "$name ($dir) $flags\n";
if ( -d "$config{thirdParty}/$dir" ) {
warn "unpacked: $config{thirdParty}/$dir\n";
next;
}
if ( $opt{get} ) {
if ( -e "$config{sources}/$file" ) {
warn " packed: $config{sources}/$file\n";
}
else {
my $fetch = "curl -k -o $file";
# curl seems to hang on anonymous ftp?
if ( $url =~ /^ftp:/ ) {
$fetch = "wget -v";
}
system "set -x; cd $config{sources} && $fetch $url";
if ( not -e "$config{sources}/$file" ) {
$nError++;
warn " download failed!?\n";
next;
}
}
}
if ( $opt{unpack} ) {
if ( -e "$config{sources}/$file" ) {
my $unpack;
if ( $file =~ m{\.zip$} ) {
$unpack = "unzip";
}
elsif ( $file =~ m{\.tar$} ) {
$unpack = "tar -xf";
}
elsif ( $file =~ m{\.tar\.bz2$} ) {
$unpack = "tar -xjf";
}
elsif ( $file =~ m{\.(tgz|tar\.gz)$} ) {
$unpack = "tar -xzf";
}
else {
$nError++;
warn " no unpack defined for $file\n";
next;
}
system
"set -x; cd $config{thirdParty} && $unpack $config{sources}/$file";
# catch isolated cases where it unpacks without a version number
if ( -d "$config{thirdParty}/$name"
and not -d "$config{thirdParty}/$dir" )
{
rename "$config{thirdParty}/$name",
"$config{thirdParty}/$dir";
}
unless ( -d "$config{thirdParty}/$dir" ) {
$nError++;
warn "unpack failed!?\n";
next;
}
}
}
}
warn '-' x 70, "\n\n";
exit $nError;
}
# --------------------------------------------------------------------------

View File

@ -130,60 +130,56 @@ endif
# Communications library
# ~~~~~~~~~~~~~~~~~~~~~~
unset MPI_ARCH_PATH
switch ("$WM_MPLIB")
case OPENMPI:
set ompi_version=1.2.6
setenv OPENMPI_HOME $thirdParty/openmpi-$ompi_version
setenv OPENMPI_ARCH_PATH $OPENMPI_HOME/platforms/$WM_OPTIONS
setenv MPI_ARCH_PATH $OPENMPI_ARCH_PATH
set mpi_version=openmpi-1.2.6
setenv MPI_ARCH_PATH $thirdParty/$mpi_version/platforms/$WM_OPTIONS
# Tell OpenMPI where to find it's install directory
setenv OPAL_PREFIX $OPENMPI_ARCH_PATH
setenv OPAL_PREFIX $MPI_ARCH_PATH
AddLib $OPENMPI_ARCH_PATH/lib
AddPath $OPENMPI_ARCH_PATH/bin
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/openmpi-$ompi_version
unset ompi_version
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
breaksw
case LAM:
set lam_version=7.1.4
setenv LAMHOME $thirdParty/lam-$lam_version
setenv LAM_ARCH_PATH $LAMHOME/platforms/$WM_OPTIONS
setenv MPI_ARCH_PATH $LAM_ARCH_PATH
set mpi_version=lam-7.1.4
setenv MPI_ARCH_PATH $thirdParty/$mpi_version/platforms/$WM_OPTIONS
setenv LAMHOME $thirdParty/$mpi_version
AddLib $LAM_ARCH_PATH/lib
AddPath $LAM_ARCH_PATH/bin
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/lam-$lam_version
unset lam_version
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
breaksw
case MPICH:
set mpich_version=1.2.4
setenv MPICH_PATH $thirdParty/mpich-$mpich_version
setenv MPICH_ARCH_PATH $MPICH_PATH/platforms/$WM_OPTIONS
setenv MPICH_ROOT $MPICH_ARCH_PATH
setenv MPI_ARCH_PATH $MPICH_ARCH_PATH
set mpi_version=mpich-1.2.4
setenv MPI_ARCH_PATH $thirdParty/$mpi_version/platforms/$WM_OPTIONS
setenv MPICH_ROOT $MPI_ARCH_PATH
AddLib $MPICH_ARCH_PATH/lib
AddPath $MPICH_ARCH_PATH/bin
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-$mpich_version
unset mpich_version
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
breaksw
case MPICH-GM:
setenv MPICH_PATH /opt/mpi
setenv MPICH_ARCH_PATH $MPICH_PATH
setenv MPICH_ROOT $MPICH_ARCH_PATH
setenv MPI_ARCH_PATH $MPICH_PATH
setenv GM_LIB_PATH /opt/gm/lib64
setenv MPI_ARCH_PATH $MPICH_ARCH_PATH
AddLib $MPICH_ARCH_PATH/lib
AddLib $MPI_ARCH_PATH/lib
AddLib $GM_LIB_PATH
AddPath $MPICH_ARCH_PATH/bin
AddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
breaksw

View File

@ -39,18 +39,22 @@ fi
AddPath()
{
if [ $# -ge 1 ]; then
while [ $# -ge 1 ]
do
[ -d $1 ] || mkdir -p $1
export PATH=$1:$PATH
fi
shift
done
}
AddLib()
{
if [ $# -ge 1 ]; then
while [ $# -ge 1 ]
do
[ -d $1 ] || mkdir -p $1
export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
fi
shift
done
}
@ -117,7 +121,7 @@ OpenFOAM)
if [ ! -d "$WM_COMPILER_DIR" ]
then
echo
echo "Warning in $1:"
echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
echo " Cannot find $WM_COMPILER_DIR installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " change the WM_COMPILER_INST setting to 'System' in this file"
@ -135,75 +139,66 @@ if [ "$WM_COMPILER_BIN" != "" ]; then
fi
# Third-party software
# ~~~~~~~~~~~~~~~~~~~~
thirdParty=$WM_PROJECT_INST_DIR/ThirdParty
# Communications library
# ~~~~~~~~~~~~~~~~~~~~~~
unset MPI_ARCH_PATH
case "$WM_MPLIB" in
OPENMPI)
ompi_version=1.2.6
export OPENMPI_HOME=$thirdParty/openmpi-$ompi_version
export OPENMPI_ARCH_PATH=$OPENMPI_HOME/platforms/$WM_OPTIONS
export MPI_ARCH_PATH=$OPENMPI_ARCH_PATH
mpi_version=openmpi-1.2.6
export MPI_ARCH_PATH=$thirdParty/$mpi_version/platforms/$WM_OPTIONS
# Tell OpenMPI where to find it's install directory
export OPAL_PREFIX=$OPENMPI_ARCH_PATH
# Tell OpenMPI where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH
AddLib $OPENMPI_ARCH_PATH/lib
AddPath $OPENMPI_ARCH_PATH/bin
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/openmpi-$ompi_version
unset ompi_version
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
;;
LAM)
lam_version=7.1.4
export LAMHOME=$thirdParty/lam-$lam_version
export LAM_ARCH_PATH=$LAMHOME/platforms/$WM_OPTIONS
export MPI_ARCH_PATH=$LAM_ARCH_PATH
mpi_version=lam-7.1.4
export MPI_ARCH_PATH=$thirdParty/$mpi_version/platforms/$WM_OPTIONS
export LAMHOME=$thirdParty/$mpi_version
# note: LAMHOME is deprecated, should probably point to MPI_ARCH_PATH too
AddLib $LAM_ARCH_PATH/lib
AddPath $LAM_ARCH_PATH/bin
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/lam-$lam_version
unset lam_version
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
;;
MPICH)
mpich_version=1.2.4
export MPICH_PATH=$thirdParty/mpich-$mpich_version
export MPICH_ARCH_PATH=$MPICH_PATH/platforms/$WM_OPTIONS
mpi_version=mpich-1.2.4
export MPI_ARCH_PATH=$thirdParty/$mpi_version/platforms/$WM_OPTIONS
export MPICH_ROOT=$MPICH_ARCH_PATH
export MPI_ARCH_PATH=$MPICH_ARCH_PATH
AddLib $MPICH_ARCH_PATH/lib
AddPath $MPICH_ARCH_PATH/bin
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-$mpich_version
unset mpich_version
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
;;
MPICH-GM)
export MPICH_PATH=/opt/mpi
export MPICH_ARCH_PATH=$MPICH_PATH
export MPICH_ROOT=$MPICH_ARCH_PATH
export MPICH_ROOT=$MPICH_PATH
export MPI_ARCH_PATH=$MPICH_PATH
export GM_LIB_PATH=/opt/gm/lib64
export MPI_ARCH_PATH=$MPICH_ARCH_PATH
AddLib $MPICH_ARCH_PATH/lib
AddLib $MPI_ARCH_PATH/lib
AddLib $GM_LIB_PATH
AddPath $MPICH_ARCH_PATH/bin
AddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
;;
GAMMA)
export GAMMA_ARCH_PATH=/usr
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/gamma
;;

View File

@ -68,7 +68,8 @@ bool Foam::dictionary::add(entry* ePtr, bool mergeEntry)
else
{
IOWarningIn("dictionary::add(entry* ePtr)", (*this))
<< "problem replacing entry in dictionary " << name()
<< "problem replacing entry "<< ePtr->keyword()
<< " in dictionary " << name()
<< endl;
IDLList<entry>::remove(ePtr);
@ -91,7 +92,8 @@ bool Foam::dictionary::add(entry* ePtr, bool mergeEntry)
else
{
IOWarningIn("dictionary::add(entry* ePtr)", (*this))
<< "attempt to add an entry already in dictionary " << name()
<< "attempt to add entry "<< ePtr->keyword()
<< " which already exists in dictionary " << name()
<< endl;
delete ePtr;

View File

@ -535,16 +535,6 @@ Foam::argList::argList
// Set the case as an environment variable
setEnv("FOAM_CASE", rootPath_/globalCase_, true);
// Set the relative parent directory as an environment variable
if (parRunControl_.parRun())
{
setEnv("FOAM_ROOT", "..", true);
}
else
{
setEnv("FOAM_ROOT", ".", true);
}
// Switch on signal trapping. We have to wait until after Pstream::init
// since this sets up its own ones.
sigFpe_.set();