Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2011-05-12 15:58:46 +01:00
29 changed files with 708 additions and 158 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,6 +39,9 @@ const Foam::word Foam::functionEntries::includeEntry::typeName
// might include includeEntry
int Foam::functionEntries::includeEntry::debug(0);
bool Foam::functionEntries::includeEntry::report(false);
namespace Foam
{
namespace functionEntries
@ -89,10 +92,15 @@ bool Foam::functionEntries::includeEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
parentDict.read(ifs);
return true;
}
@ -119,10 +127,15 @@ bool Foam::functionEntries::includeEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
entry.read(parentDict, ifs);
return true;
}

View File

@ -82,6 +82,12 @@ protected:
public:
// Static data members
//- Report which file is included to stdout
static bool report;
//- Runtime type information
ClassName("include");

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,10 +69,15 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
parentDict.read(ifs);
}
@ -87,10 +92,15 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
Istream& is
)
{
IFstream ifs(includeFileName(is));
const fileName fName(includeFileName(is));
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::report)
{
Info<< fName << endl;
}
entry.read(parentDict, ifs);
}

View File

@ -548,10 +548,14 @@ Foam::argList::argList
if (options_.found("roots"))
{
source = "'-roots' option";
IStringStream str(options_["roots"]);
str >> roots;
dictNProcs = roots.size()+1;
source = "-roots";
IStringStream is(options_["roots"]);
roots = readList<fileName>(is);
if (roots.size() != 1)
{
dictNProcs = roots.size()+1;
}
}
else
{
@ -579,6 +583,21 @@ Foam::argList::argList
}
}
// convenience:
// when a single root is specified, use it for all processes
if (roots.size() == 1)
{
const fileName rootName(roots[0]);
roots.setSize(Pstream::nProcs()-1, rootName);
// adjust dictNProcs for command-line '-roots' option
if (dictNProcs < 0)
{
dictNProcs = roots.size()+1;
}
}
// Check number of processors.
// nProcs => number of actual procs
// dictNProcs => number of procs specified in decompositionDict
@ -602,11 +621,6 @@ Foam::argList::argList
// distributed data
if (roots.size())
{
forAll(roots, i)
{
roots[i].expand();
}
if (roots.size() != Pstream::nProcs()-1)
{
FatalError
@ -617,6 +631,11 @@ Foam::argList::argList
<< exit(FatalError);
}
forAll(roots, i)
{
roots[i].expand();
}
// Distribute the master's argument list (with new root)
bool hadCaseOpt = options_.found("case");
for
@ -626,11 +645,7 @@ Foam::argList::argList
slave++
)
{
options_.set
(
"case",
fileName(roots[slave-1])/globalCase_
);
options_.set("case", roots[slave-1]/globalCase_);
OPstream toSlave(Pstream::scheduled, slave);
toSlave << args_ << options_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -491,51 +491,52 @@ void Foam::face::flip()
}
Foam::point Foam::face::centre(const pointField& meshPoints) const
Foam::point Foam::face::centre(const pointField& points) const
{
// Calculate the centre by breaking the face into triangles and
// area-weighted averaging their centres
const label nPoints = size();
// If the face is a triangle, do a direct calculation
if (size() == 3)
if (nPoints)
{
return
(1.0/3.0)
*(
meshPoints[operator[](0)]
+ meshPoints[operator[](1)]
+ meshPoints[operator[](2)]
points[operator[](0)]
+ points[operator[](1)]
+ points[operator[](2)]
);
}
label nPoints = size();
point centrePoint = point::zero;
for (register label pI=0; pI<nPoints; pI++)
for (register label pI=0; pI<nPoints; ++pI)
{
centrePoint += meshPoints[operator[](pI)];
centrePoint += points[operator[](pI)];
}
centrePoint /= nPoints;
scalar sumA = 0;
vector sumAc = vector::zero;
for (register label pI=0; pI<nPoints; pI++)
for (register label pI=0; pI<nPoints; ++pI)
{
const point& nextPoint = meshPoints[operator[]((pI + 1) % nPoints)];
const point& nextPoint = points[operator[]((pI + 1) % nPoints)];
// Calculate 3*triangle centre
vector ttc
const vector ttc
(
meshPoints[operator[](pI)]
points[operator[](pI)]
+ nextPoint
+ centrePoint
);
// Calculate 2*triangle area
scalar ta = Foam::mag
const scalar ta = Foam::mag
(
(meshPoints[operator[](pI)] - centrePoint)
(points[operator[](pI)] - centrePoint)
^ (nextPoint - centrePoint)
);
@ -545,7 +546,7 @@ Foam::point Foam::face::centre(const pointField& meshPoints) const
if (sumA > VSMALL)
{
return sumAc/(3*sumA);
return sumAc/(3.0*sumA);
}
else
{
@ -556,6 +557,8 @@ Foam::point Foam::face::centre(const pointField& meshPoints) const
Foam::vector Foam::face::normal(const pointField& p) const
{
const label nPoints = size();
// Calculate the normal by summing the face triangle normals.
// Changed to deal with small concavity by using a central decomposition
//
@ -563,7 +566,7 @@ Foam::vector Foam::face::normal(const pointField& p) const
// If the face is a triangle, do a direct calculation to avoid round-off
// error-related problems
//
if (size() == 3)
if (nPoints == 3)
{
return triPointRef
(
@ -573,12 +576,10 @@ Foam::vector Foam::face::normal(const pointField& p) const
).normal();
}
label nPoints = size();
register label pI;
point centrePoint = vector::zero;
for (pI = 0; pI < nPoints; pI++)
for (pI = 0; pI < nPoints; ++pI)
{
centrePoint += p[operator[](pI)];
}
@ -588,7 +589,7 @@ Foam::vector Foam::face::normal(const pointField& p) const
point nextPoint = centrePoint;
for (pI = 0; pI < nPoints; pI++)
for (pI = 0; pI < nPoints; ++pI)
{
if (pI < nPoints - 1)
{

View File

@ -178,7 +178,7 @@ public:
void flip();
//- Return the points corresponding to this face
inline pointField points(const pointField& meshPoints) const;
inline pointField points(const pointField&) const;
//- Centre point of face
point centre(const pointField&) const;
@ -187,7 +187,7 @@ public:
template<class Type>
Type average(const pointField&, const Field<Type>&) const;
//- Scalar magnitude
//- Magnitude of face area
inline scalar mag(const pointField&) const;
//- Vector normal; magnitude is equal to area of face
@ -228,8 +228,8 @@ public:
//- Return potential intersection with face with a ray starting
// at p, direction n (does not need to be normalized)
// Does face-center decomposition and returns triangle intersection
// point closest to p. Face-center is calculated from point average.
// Does face-centre decomposition and returns triangle intersection
// point closest to p. Face-centre is calculated from point average.
// For a hit, the distance is signed. Positive number
// represents the point in front of triangle
// In case of miss the point is the nearest point on the face
@ -242,20 +242,20 @@ public:
(
const point& p,
const vector& n,
const pointField& meshPoints,
const pointField&,
const intersection::algorithm alg = intersection::FULL_RAY,
const intersection::direction dir = intersection::VECTOR
) const;
//- Fast intersection with a ray.
// Does face-center decomposition and returns triangle intersection
// Does face-centre decomposition and returns triangle intersection
// point closest to p. See triangle::intersection for details.
pointHit intersection
(
const point& p,
const vector& q,
const point& ctr,
const pointField& meshPoints,
const pointField&,
const intersection::algorithm alg,
const scalar tol = 0.0
) const;
@ -264,7 +264,7 @@ public:
pointHit nearestPoint
(
const point& p,
const pointField& meshPoints
const pointField&
) const;
//- Return nearest point to face and classify it:
@ -276,7 +276,7 @@ public:
pointHit nearestPointClassify
(
const point& p,
const pointField& meshPoints,
const pointField&,
label& nearType,
label& nearLabel
) const;
@ -286,13 +286,13 @@ public:
(
const point& p,
const vector& n,
const pointField& meshPoints
const pointField&
) const;
//- Return area in contact, given the displacement in vertices
scalar areaInContact
(
const pointField& points,
const pointField&,
const scalarField& v
) const;

View File

@ -103,7 +103,7 @@ public:
inline void flip();
//- Return the points corresponding to this face
inline pointField points(const pointField& meshPoints) const;
inline pointField points(const pointField&) const;
//- Return triangle as a face
inline face triFaceFace() const;
@ -118,10 +118,10 @@ public:
template<class Type>
Type average(const pointField&, const Field<Type>&) const;
//- Return scalar magnitude
//- Magnitude of face area
inline scalar mag(const pointField&) const;
//- Return vector normal
//- Vector normal; magnitude is equal to area of face
inline vector normal(const pointField&) const;
//- Number of triangles after splitting

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -176,6 +176,7 @@ inline Foam::scalar Foam::triFace::mag(const pointField& points) const
return ::Foam::mag(normal(points));
}
// could also delegate to triPointRef(...).normal()
inline Foam::vector Foam::triFace::normal(const pointField& points) const
{

View File

@ -1,8 +1,31 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
set -x
#
# define how to create an mpi-versioned library of $makeType
# compile into qualified directory
# use sentinel file to handle version changes
#
wmakeMpiLib()
{
set +x
for libName
do
(
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
whichmpi="$libName/Make/$WM_OPTIONS/using:$FOAM_MPI"
[ -e "$whichmpi" ] || wclean $libName
echo "wmake $makeType $libName"
wmake $makeType $libName
touch "$whichmpi"
)
done
set -x
}
set -x
wmake $makeType dummy
case "$WM_MPLIB" in
@ -11,9 +34,7 @@ case "$WM_MPLIB" in
echo
echo "Note: ignore spurious warnings about missing mpicxx.h headers"
echo
set -x
# force compilation into qualified directory
WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB wmake $makeType mpi
wmakeMpiLib mpi
;;
#GAMMA)

View File

@ -3,8 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
# get SCOTCH_VERSION, SCOTCH_ARCH_PATH
settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc`
if [ -f "$settings" ]
if settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc`
then
. $settings
echo "using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH"
@ -13,21 +12,45 @@ else
echo "Error: no apps/scotch/bashrc settings"
echo
fi
#
# define how to create an mpi-versioned library of $makeType
# compile into qualified directory
# use sentinel file to handle version changes
#
wmakeMpiLib()
{
set +x
for libName
do
(
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
whichmpi="$libName/Make/$WM_OPTIONS/using:$FOAM_MPI"
whichscotch="$libName/Make/$WM_OPTIONS/using:$SCOTCH_VERSION"
[ -e "$whichmpi" -a -e "$whichscotch" ] || wclean $libName
echo "wmake $makeType $libName"
wmake $makeType $libName
touch "$whichmpi" "$whichscotch"
)
done
set -x
}
set -x
wmakeLnInclude decompositionMethods
wmake $makeType scotchDecomp
if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ]
if [ -n "$SCOTCH_ARCH_PATH" ]
then
(
WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB
wmake $makeType ptscotchDecomp
)
wmake $makeType scotchDecomp
[ -d "$FOAM_LIBBIN/$FOAM_MPI" ] && wmakeMpiLib ptscotchDecomp
else
echo
echo "Skipping scotchDecomp (ptscotchDecomp)"
echo
fi
wmake $makeType decompositionMethods
# ----------------------------------------------------------------- end-of-file

View File

@ -1,6 +1,7 @@
# Note including of mplib compilation rules. This
# is purely to avoid scotch.h including mpicxx.h
# which causes problems.
/*
* Note including of mplib compilation rules.
* This is purely to avoid scotch.h including mpicxx.h, which causes problems.
*/
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB)