Merge branch 'master' into feature/overlapGgi

This commit is contained in:
Oliver Borm (boroli) 2010-12-02 18:19:40 +01:00
commit e5a96484f3
45 changed files with 439 additions and 236 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
cd ${0%/*} || exit 1 # run from this directory
if [ "$PWD" != "$WM_PROJECT_DIR" ]
@ -16,6 +16,10 @@ fi
#( cd $WM_THIRD_PARTY_DIR && ./Allwmake )
# ( cd $WM_THIRD_PARTY_DIR && ./AllMake )
# We make sure the ThirdParty packages environment variables are up-to-date
# before compiling the rest of OpenFOAM
. $WM_PROJECT_DIR/etc/settings.sh
# build OpenFOAM libraries and applications
src/Allwmake
applications/Allwmake

View file

@ -56,7 +56,6 @@ echo Starting ThirdParty AllMake: Stage3
echo ========================================
echo
# Metis
( rpm_make metis-5.0pre2 http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.0pre2.tar.gz )
@ -69,25 +68,17 @@ echo
# Mesquite
( rpm_make mesquite-2.1.2 http://software.sandia.gov/~jakraft/mesquite-2.1.2.tar.gz )
# The following two packages depends on the availability of OpenMPI
# The macro rpm_make() will make sure to update the ThirdParty environment variables before starting
# the compilation.
# Just make sure the OpenMPI environment variables are properly initialized, or that
# the AllMake.stage2 script completed correctly
#
# Scotch
if [ -d "$OPENMPI_DIR" ]; then
( rpm_make scotch-5.1.10b https://gforge.inria.fr/frs/download.php/27583/scotch-5.1.10b.tar.gz )
else
echo "WARNING: The OPENMPI_DIR environment variable is not set."
echo "WARNING: Please make sure your environment is properly set up for openmpi. This is necessary for compiling scotch-5.1.10b"
echo "WARNING: Skipping the compilation of scotch-5.1.10b"
echo ""
fi
( rpm_make scotch-5.1.10b https://gforge.inria.fr/frs/download.php/27583/scotch-5.1.10b.tar.gz )
# ParMetis
if [ -d "$OPENMPI_DIR" ]; then
( rpm_make ParMetis-3.1.1 http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/ParMetis-3.1.1.tar.gz )
else
echo "WARNING: The OPENMPI_DIR environment variable is not set."
echo "WARNING: Please make sure your environment is properly set up for openmpi. This is necessary for compiling ParMetis-3.1.1"
echo "WARNING: Skipping the compilation of ParMetis-3.1.1"
echo ""
fi
( rpm_make ParMetis-3.1.1 http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/ParMetis-3.1.1.tar.gz )
echo ========================================
echo Done ThirdParty AllMake: Stage3

View file

@ -68,7 +68,7 @@ then
else
echo "WARNING: Skipping the installation of ParaView-3.8.1."
echo "WARNING: Please initialize the QT_DIR environment variable to your QT installation directory."
echo "WARNING: The command $QT_DIR/bin/qmake needs to be valid"
echo "WARNING: The command \$QT_DIR/bin/qmake needs to be valid"
echo "WARNING: "
fi

View file

@ -91,7 +91,6 @@ Group: Development/Tools
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
GMP_VERSION=gmp-5.0.1
./configure \
--prefix=%{_installPrefix} \
--enable-release \
@ -104,6 +103,10 @@ Group: Development/Tools
--enable-trap-fpe \
--disable-function-timers
# Remove the file include/Mesquite_all_headers.hpp
# This file will be regenerated during the compilation process
[ -e include/Mesquite_all_headers.hpp ] && rm -f include/Mesquite_all_headers.hpp
make
%install

View file

@ -50,6 +50,11 @@ echo ""
rpm_make()
{
package="$1"
# Make sure the ThirdParty environment is up-to-date
echo "Updating the ThirdParty environment variables before building package $package"
. $WM_PROJECT_DIR/etc/settings.sh
rpmName=$package-$WM_OPTIONS.$architecture
rpmFile=$buildBase/RPMS/$architecture/$rpmName.rpm
@ -121,7 +126,10 @@ rpm_build()
#Build RPM package
echo "Building package $package"
rpmbuild --define "_topdir $buildBase" --dbpath $buildBase/rpmDB --clean -bb ./SPECS/$specFile "$@"
#rpmbuild --define "_topdir $buildBase" --dbpath $buildBase/rpmDB --clean -bb ./SPECS/$specFile "$@"
#
# Let's keep the compilation directory alive for now in order to facilitate postmortems of failed compilations
rpmbuild --define "_topdir $buildBase" --dbpath $buildBase/rpmDB -bb ./SPECS/$specFile "$@"
}
#

View file

@ -102,6 +102,8 @@ int main(int argc, char *argv[])
);
}
turbulence->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View file

@ -78,11 +78,7 @@ Foam::ellipticCylindricalCS Foam::ellipseEdge::calcCS()
Info << "p = " << p << " q = " << q << " n = " << normal << endl;
}
tensor A;
A.x() = p;
A.z() = normal;
A.y() = normal ^ p;
tensor A(p, normal ^ p, normal);
vector2D p2D(1.0, 0.0);
vector qTmp = (A & q);

View file

@ -55,6 +55,19 @@ _foamAddLib()
done
}
# Source files, possibly with some verbosity
# Yes, this is the same definition as in the file etc/bash
# We need that definition available for scripts sourcing
# settings.sh directly.
_foamSource()
{
while [ $# -ge 1 ]
do
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
. $1
shift
done
}
# location of the jobControl directory
export FOAM_JOB_DIR=$HOME/$WM_PROJECT/jobControl

View file

@ -67,27 +67,23 @@ void Foam::coordinateRotation::calcTransform
switch (order)
{
case e1e2:
Rtr.x() = a;
Rtr.y() = b;
Rtr.z() = c;
Rtr = tensor(a, b, c);
break;
case e2e3:
Rtr.x() = c;
Rtr.y() = a;
Rtr.z() = b;
Rtr = tensor(c, a, b);
break;
case e3e1:
Rtr.x() = b;
Rtr.y() = c;
Rtr.z() = a;
Rtr = tensor(b, c, a);
break;
default:
FatalErrorIn("coordinateRotation::calcTransform()")
<< "programmer error" << endl
<< abort(FatalError);
// To satisfy compiler warnings
Rtr = tensor::zero;
break;
}
@ -187,7 +183,8 @@ Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
(
"coordinateRotation::New(const dictionary&)",
dict
) << "Unknown coordinateRotation type " << rotType << nl << nl
) << "Unknown coordinateRotation type "
<< rotType << nl << nl
<< "Valid coordinateRotation types are :" << nl
<< "[default: axes " << typeName_() << "]"
<< dictionaryConstructorTablePtr_->toc()

View file

@ -185,19 +185,19 @@ public:
}
//- Return local Cartesian x-axis
vector& e1() const
vector e1() const
{
return tensor::T().x();
}
//- Return local Cartesian y-axis
vector& e2() const
vector e2() const
{
return tensor::T().y();
}
//- Return local Cartesian z-axis
vector& e3() const
vector e3() const
{
return tensor::T().z();
}

View file

@ -348,33 +348,33 @@ public:
}
//- Return local Cartesian x-axis
const vector& e1() const
vector e1() const
{
return Rtr_.x();
}
//- Return local Cartesian y-axis
const vector& e2() const
vector e2() const
{
return Rtr_.y();
}
//- Return local Cartesian z-axis
const vector& e3() const
vector e3() const
{
return Rtr_.z();
}
//- Return axis (e3: local Cartesian z-axis)
// @deprecated method e3 is preferred
const vector& axis() const
vector axis() const
{
return Rtr_.z();
}
//- Return direction (e1: local Cartesian x-axis)
// @deprecated method e1 is preferred
const vector& direction() const
const vector direction() const
{
return Rtr_.x();
}

View file

@ -67,7 +67,7 @@ template<class Type>
Field<Type>::Field
(
const UList<Type>& mapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
)
:
List<Type>(mapAddressing.size())
@ -79,7 +79,7 @@ template<class Type>
Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
)
:
List<Type>(mapAddressing.size())
@ -298,7 +298,7 @@ template<class Type>
void Field<Type>::map
(
const UList<Type>& mapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
)
{
Field<Type>& f = *this;
@ -327,7 +327,7 @@ template<class Type>
void Field<Type>::map
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
)
{
map(tmapF(), mapAddressing);
@ -469,7 +469,7 @@ template<class Type>
void Field<Type>::rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
)
{
Field<Type>& f = *this;
@ -489,7 +489,7 @@ template<class Type>
void Field<Type>::rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
)
{
rmap(tmapF(), mapAddressing);
@ -501,7 +501,7 @@ template<class Type>
void Field<Type>::rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing,
const unallocLabelList& mapAddressing,
const scalarList& mapWeights
)
{
@ -519,7 +519,7 @@ template<class Type>
void Field<Type>::rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing,
const unallocLabelList& mapAddressing,
const scalarList& mapWeights
)
{

View file

@ -128,14 +128,14 @@ public:
Field
(
const UList<Type>& mapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
);
//- Construct by 1 to 1 mapping from the given tmp field
Field
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
);
//- Construct by interpolative mapping from the given field
@ -215,14 +215,14 @@ public:
void map
(
const UList<Type>& mapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
);
//- 1 to 1 map from the given tmp field
void map
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
);
//- Interpolative map from the given field
@ -265,21 +265,21 @@ public:
void rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
);
//- 1 to 1 reverse-map from the given tmp field
void rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const unallocLabelList& mapAddressing
);
//- Interpolative reverse map from the given field
void rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing,
const unallocLabelList& mapAddressing,
const scalarList& weights
);
@ -287,7 +287,7 @@ public:
void rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing,
const unallocLabelList& mapAddressing,
const scalarList& weights
);

View file

@ -50,6 +50,7 @@ class objectMap;
inline bool operator==(const objectMap& a, const objectMap& b);
inline bool operator!=(const objectMap& a, const objectMap& b);
inline Ostream& operator<<(Ostream&, const objectMap&);
inline Istream& operator>>(Istream&, objectMap&);
/*---------------------------------------------------------------------------*\
@ -101,6 +102,8 @@ public:
// IOstream Operators
friend Ostream& operator<<(Ostream&, const objectMap&);
friend Istream& operator>>(Istream&, objectMap&);
};

View file

@ -123,6 +123,18 @@ inline Ostream& operator<<(Ostream& os, const objectMap& a)
}
inline Istream& operator>>(Istream& is, objectMap& a)
{
is.readBegin("objectMap");
is >> a.index_ >> a.masterObjects_;
is.readEnd("objectMap");
// Check state of Istream
is.check("Istream& operator>>(Istream&, objectMap&)");
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // Master namespace Foam

View file

@ -101,6 +101,14 @@ public:
//- Construct given SymmTensor
inline Tensor(const SymmTensor<Cmpt>&);
//- Construct given the three vectors
inline Tensor
(
const Vector<Cmpt>& x,
const Vector<Cmpt>& y,
const Vector<Cmpt>& z
);
//- Construct given the nine components
inline Tensor
(
@ -117,14 +125,6 @@ public:
// Access
inline const Vector<Cmpt>& x() const;
inline const Vector<Cmpt>& y() const;
inline const Vector<Cmpt>& z() const;
inline Vector<Cmpt>& x();
inline Vector<Cmpt>& y();
inline Vector<Cmpt>& z();
inline const Cmpt& xx() const;
inline const Cmpt& xy() const;
inline const Cmpt& xz() const;
@ -145,6 +145,13 @@ public:
inline Cmpt& zy();
inline Cmpt& zz();
// Access vector components.
// Note: returning const only to find out lhs usage
inline const Vector<Cmpt> x() const;
inline const Vector<Cmpt> y() const;
inline const Vector<Cmpt> z() const;
//- Transpose
inline Tensor<Cmpt> T() const;

View file

@ -65,6 +65,21 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
}
//- Construct given the three vector components
template <class Cmpt>
inline Tensor<Cmpt>::Tensor
(
const Vector<Cmpt>& x,
const Vector<Cmpt>& y,
const Vector<Cmpt>& z
)
{
this->v_[XX] = x.x(); this->v_[XY] = x.y(); this->v_[XZ] = x.z();
this->v_[YX] = y.x(); this->v_[YY] = y.y(); this->v_[YZ] = y.z();
this->v_[ZX] = z.x(); this->v_[ZY] = z.y(); this->v_[ZZ] = z.z();
}
//- Construct from components
template <class Cmpt>
inline Tensor<Cmpt>::Tensor
@ -91,40 +106,21 @@ inline Tensor<Cmpt>::Tensor(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::x() const
inline const Vector<Cmpt> Tensor<Cmpt>::x() const
{
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[XX]);
return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
}
template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::y() const
inline const Vector<Cmpt> Tensor<Cmpt>::y() const
{
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[YX]);
return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
}
template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::z() const
inline const Vector<Cmpt> Tensor<Cmpt>::z() const
{
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[ZX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::x()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[XX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::y()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[YX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::z()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[ZX]);
return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
}

View file

@ -267,36 +267,17 @@ tensor eigenVectors(const tensor& t)
{
vector evals(eigenValues(t));
tensor evs;
// Modification for strict-aliasing compliance.
// Sandeep Menon, 01/Dec/2010
// Test for null eigen values to return a not null eigen vector
// Jovani Favero, 18/Nov/2009
if (mag(evals.x()) < SMALL)
{
evs.x() = vector(0, 0, 1);
}
else
{
evs.x() = eigenVector(t, evals.x());
}
if (mag(evals.y()) < SMALL)
{
evs.y() = vector(0, 1, 0);
}
else
{
evs.y() = eigenVector(t, evals.y());
}
if (mag(evals.z()) < SMALL)
{
evs.z() = vector(1, 0, 0);
}
else
{
evs.z() = eigenVector(t, evals.z());
}
tensor evs
(
(mag(evals.x()) < SMALL) ? vector(0, 0, 1) : eigenVector(t, evals.x()),
(mag(evals.y()) < SMALL) ? vector(0, 1, 0) : eigenVector(t, evals.y()),
(mag(evals.z()) < SMALL) ? vector(1, 0, 0) : eigenVector(t, evals.z())
);
return evs;
}
@ -490,8 +471,16 @@ tensor eigenVectors(const symmTensor& t)
{
vector evals(eigenValues(t));
tensor evs;
// Modification for strict-aliasing compliance.
// Sandeep Menon, 01/Dec/2010
tensor evs
(
(mag(evals.x()) < SMALL) ? vector(0, 0, 1) : eigenVector(t, evals.x()),
(mag(evals.y()) < SMALL) ? vector(0, 1, 0) : eigenVector(t, evals.y()),
(mag(evals.z()) < SMALL) ? vector(1, 0, 0) : eigenVector(t, evals.z())
);
/*
// Test for null eigen values to return a not null eigen vector.
// Jovani Favero, 18/Nov/2009
if (mag(evals.x()) < SMALL)
@ -520,6 +509,7 @@ tensor eigenVectors(const symmTensor& t)
{
evs.z() = eigenVector(t, evals.z());
}
*/
return evs;
}

View file

@ -93,7 +93,14 @@ public:
//- Construct given SphericalTensor2D
inline Tensor2D(const SphericalTensor2D<Cmpt>&);
//- Construct given the nine components
//- Construct given the two vectors
inline Tensor2D
(
const Vector2D<Cmpt>& x,
const Vector2D<Cmpt>& y
);
//- Construct given the four components
inline Tensor2D
(
const Cmpt txx, const Cmpt txy,
@ -108,12 +115,6 @@ public:
// Access
inline const Vector2D<Cmpt>& x() const;
inline const Vector2D<Cmpt>& y() const;
inline Vector2D<Cmpt>& x();
inline Vector2D<Cmpt>& y();
inline const Cmpt& xx() const;
inline const Cmpt& xy() const;
inline const Cmpt& yx() const;
@ -124,6 +125,11 @@ public:
inline Cmpt& yx();
inline Cmpt& yy();
// Access vector components.
inline Vector2D<Cmpt> x() const;
inline Vector2D<Cmpt> y() const;
//- Transpose
inline Tensor2D<Cmpt> T() const;

View file

@ -51,6 +51,18 @@ inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st)
}
template <class Cmpt>
inline Tensor2D<Cmpt>::Tensor2D
(
const Vector2D<Cmpt>& x,
const Vector2D<Cmpt>& y
)
{
this->v_[XX] = x.x(); this->v_[XY] = x.y();
this->v_[YX] = y.x(); this->v_[YY] = y.y();
}
template <class Cmpt>
inline Tensor2D<Cmpt>::Tensor2D
(
@ -73,28 +85,15 @@ inline Tensor2D<Cmpt>::Tensor2D(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt>
inline const Vector2D<Cmpt>& Tensor2D<Cmpt>::x() const
inline Vector2D<Cmpt> Tensor2D<Cmpt>::x() const
{
return reinterpret_cast<const Vector2D<Cmpt>&>(this->v_[XX]);
return Vector2D<Cmpt>(this->v_[XX], this->v_[XY]);
}
template <class Cmpt>
inline const Vector2D<Cmpt>& Tensor2D<Cmpt>::y() const
inline Vector2D<Cmpt> Tensor2D<Cmpt>::y() const
{
return reinterpret_cast<const Vector2D<Cmpt>&>(this->v_[YX]);
}
template <class Cmpt>
inline Vector2D<Cmpt>& Tensor2D<Cmpt>::x()
{
return reinterpret_cast<Vector2D<Cmpt>&>(this->v_[XX]);
}
template <class Cmpt>
inline Vector2D<Cmpt>& Tensor2D<Cmpt>::y()
{
return reinterpret_cast<Vector2D<Cmpt>&>(this->v_[YX]);
return Vector2D<Cmpt>(this->v_[YX], this->v_[YY]);
}

View file

@ -160,9 +160,11 @@ tensor2D eigenVectors(const tensor2D& t)
{
vector2D evals(eigenValues(t));
tensor2D evs;
evs.x() = eigenVector(t, evals.x());
evs.y() = eigenVector(t, evals.y());
tensor2D evs
(
eigenVector(t, evals.x()),
eigenVector(t, evals.y())
);
return evs;
}

View file

@ -8,10 +8,10 @@
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@ -19,8 +19,7 @@ License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Read token and binary block from IPstream
@ -30,15 +29,7 @@ Description
#include "mpi.h"
#include "IPstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// Outstanding non-blocking operations.
//! @cond fileScope
Foam::DynamicList<MPI_Request> IPstream_outstandingRequests_;
//! @endcond fileScope
#include "PstreamGlobals.H"
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
@ -171,7 +162,7 @@ Foam::label Foam::IPstream::read
return 0;
}
IPstream_outstandingRequests_.append(request);
PstreamGlobals::IPstream_outstandingRequests_.append(request);
return 1;
}
@ -191,14 +182,14 @@ Foam::label Foam::IPstream::read
void Foam::IPstream::waitRequests()
{
if (IPstream_outstandingRequests_.size())
if (PstreamGlobals::IPstream_outstandingRequests_.size())
{
if
(
MPI_Waitall
(
IPstream_outstandingRequests_.size(),
IPstream_outstandingRequests_.begin(),
PstreamGlobals::IPstream_outstandingRequests_.size(),
PstreamGlobals::IPstream_outstandingRequests_.begin(),
MPI_STATUSES_IGNORE
)
)
@ -209,19 +200,20 @@ void Foam::IPstream::waitRequests()
) << "MPI_Waitall returned with error" << endl;
}
IPstream_outstandingRequests_.clear();
PstreamGlobals::IPstream_outstandingRequests_.clear();
}
}
bool Foam::IPstream::finishedRequest(const label i)
{
if (i >= IPstream_outstandingRequests_.size())
if (i >= PstreamGlobals::IPstream_outstandingRequests_.size())
{
FatalErrorIn
(
"IPstream::finishedRequest(const label)"
) << "There are " << IPstream_outstandingRequests_.size()
) << "There are "
<< PstreamGlobals::IPstream_outstandingRequests_.size()
<< " outstanding send requests and you are asking for i=" << i
<< nl
<< "Maybe you are mixing blocking/non-blocking comms?"
@ -229,7 +221,12 @@ bool Foam::IPstream::finishedRequest(const label i)
}
int flag;
MPI_Test(&IPstream_outstandingRequests_[i], &flag, MPI_STATUS_IGNORE);
MPI_Test
(
&PstreamGlobals::IPstream_outstandingRequests_[i],
&flag,
MPI_STATUS_IGNORE
);
return flag != 0;
}

View file

@ -1,5 +1,6 @@
OPwrite.C
IPread.C
Pstream.C
PstreamGlobals.C
LIB = $(FOAM_MPI_LIBBIN)/libPstream

View file

@ -8,10 +8,10 @@
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@ -19,8 +19,7 @@ License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Write primitive and binary block from OPstream
@ -30,13 +29,7 @@ Description
#include "mpi.h"
#include "OPstream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// Outstanding non-blocking operations.
//! @cond fileScope
Foam::DynamicList<MPI_Request> OPstream_outstandingRequests_;
//! @endcond fileScope
#include "PstreamGlobals.H"
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -111,7 +104,7 @@ bool Foam::OPstream::write
&request
);
OPstream_outstandingRequests_.append(request);
PstreamGlobals::OPstream_outstandingRequests_.append(request);
}
else
{
@ -129,14 +122,14 @@ bool Foam::OPstream::write
void Foam::OPstream::waitRequests()
{
if (OPstream_outstandingRequests_.size())
if (PstreamGlobals::OPstream_outstandingRequests_.size())
{
if
(
MPI_Waitall
(
OPstream_outstandingRequests_.size(),
OPstream_outstandingRequests_.begin(),
PstreamGlobals::OPstream_outstandingRequests_.size(),
PstreamGlobals::OPstream_outstandingRequests_.begin(),
MPI_STATUSES_IGNORE
)
)
@ -147,19 +140,20 @@ void Foam::OPstream::waitRequests()
) << "MPI_Waitall returned with error" << Foam::endl;
}
OPstream_outstandingRequests_.clear();
PstreamGlobals::OPstream_outstandingRequests_.clear();
}
}
bool Foam::OPstream::finishedRequest(const label i)
{
if (i >= OPstream_outstandingRequests_.size())
if (i >= PstreamGlobals::OPstream_outstandingRequests_.size())
{
FatalErrorIn
(
"OPstream::finishedRequest(const label)"
) << "There are " << OPstream_outstandingRequests_.size()
) << "There are "
<< PstreamGlobals::OPstream_outstandingRequests_.size()
<< " outstanding send requests and you are asking for i=" << i
<< nl
<< "Maybe you are mixing blocking/non-blocking comms?"
@ -167,7 +161,12 @@ bool Foam::OPstream::finishedRequest(const label i)
}
int flag;
MPI_Test(&OPstream_outstandingRequests_[i], &flag, MPI_STATUS_IGNORE);
MPI_Test
(
&PstreamGlobals::OPstream_outstandingRequests_[i],
&flag,
MPI_STATUS_IGNORE
);
return flag != 0;
}

View file

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PstreamGlobals.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// Outstanding non-blocking operations.
//! @cond fileScope
DynamicList<MPI_Request> PstreamGlobals::IPstream_outstandingRequests_;
DynamicList<MPI_Request> PstreamGlobals::OPstream_outstandingRequests_;
//! @endcond
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::PstreamGlobals
Description
Global functions and variables for working with parallel streams,
but principally for gamma/mpi
SourceFiles
PstreamGlobals.C
\*---------------------------------------------------------------------------*/
#ifndef PstreamGlobals_H
#define PstreamGlobals_H
#include "mpi.h"
#include "DynamicList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class PstreamGlobals Declaration
\*---------------------------------------------------------------------------*/
namespace PstreamGlobals
{
extern DynamicList<MPI_Request> IPstream_outstandingRequests_;
extern DynamicList<MPI_Request> OPstream_outstandingRequests_;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -242,6 +242,8 @@ void lengthScaleEstimator::writeLengthScaleInfo
// Clear existing buffers
sendLblBuffer_.clear();
recvLblBuffer_.clear();
sendLvlBuffer_.clear();
recvLvlBuffer_.clear();
sendSclBuffer_.clear();
recvSclBuffer_.clear();
@ -251,7 +253,9 @@ void lengthScaleEstimator::writeLengthScaleInfo
// Corresponding face labels
sendLblBuffer_.setSize(boundary.size());
sendLvlBuffer_.setSize(boundary.size());
recvLblBuffer_.setSize(boundary.size());
recvLvlBuffer_.setSize(boundary.size());
// Length-scales corresponding to face-labels
sendSclBuffer_.setSize(boundary.size());
@ -266,6 +270,7 @@ void lengthScaleEstimator::writeLengthScaleInfo
// Set the initial buffer size
sendLblBuffer_[pI].setSize(boundary[pI].size(), 0);
sendLvlBuffer_[pI].setSize(boundary[pI].size(), 0);
sendSclBuffer_[pI].setSize(boundary[pI].size(), 0.0);
forAll(fCells, faceI)
@ -277,6 +282,7 @@ void lengthScaleEstimator::writeLengthScaleInfo
{
// Fill the send buffer.
sendLblBuffer_[pI][nSendFaces[pI]] = faceI;
sendLvlBuffer_[pI][nSendFaces[pI]] = cellLevels[cI];
sendSclBuffer_[pI][nSendFaces[pI]] = lengthScale[cI];
nSendFaces[pI]++;
@ -285,6 +291,7 @@ void lengthScaleEstimator::writeLengthScaleInfo
// Resize to actual value
sendLblBuffer_[pI].setSize(nSendFaces[pI]);
sendLvlBuffer_[pI].setSize(nSendFaces[pI]);
sendSclBuffer_[pI].setSize(nSendFaces[pI]);
const processorPolyPatch& pp =
@ -330,6 +337,7 @@ void lengthScaleEstimator::writeLengthScaleInfo
Pout << " Processor patch " << patchI << ' ' << pp.name()
<< " communicating with " << neiProcNo
<< " Sending: " << nSendFaces[patchI]
<< " Recving: " << nRecvFaces[patchI]
<< endl;
}
@ -345,6 +353,14 @@ void lengthScaleEstimator::writeLengthScaleInfo
sendLblBuffer_[patchI].size()*sizeof(label)
);
OPstream::write
(
Pstream::nonBlocking,
neiProcNo,
reinterpret_cast<const char*>(&(sendLvlBuffer_[patchI][0])),
sendLblBuffer_[patchI].size()*sizeof(label)
);
OPstream::write
(
Pstream::nonBlocking,
@ -358,6 +374,7 @@ void lengthScaleEstimator::writeLengthScaleInfo
{
// Size the receive buffers
recvLblBuffer_[patchI].setSize(nRecvFaces[patchI], 0);
recvLvlBuffer_[patchI].setSize(nRecvFaces[patchI], 0);
recvSclBuffer_[patchI].setSize(nRecvFaces[patchI], 0.0);
IPstream::read
@ -372,9 +389,17 @@ void lengthScaleEstimator::writeLengthScaleInfo
(
Pstream::nonBlocking,
neiProcNo,
reinterpret_cast<char*>(&(recvSclBuffer_[patchI][0])),
reinterpret_cast<char*>(&(recvLvlBuffer_[patchI][0])),
nRecvFaces[patchI]*sizeof(label)
);
IPstream::read
(
Pstream::nonBlocking,
neiProcNo,
reinterpret_cast<char*>(&(recvSclBuffer_[patchI][0])),
nRecvFaces[patchI]*sizeof(scalar)
);
}
}
}
@ -410,17 +435,19 @@ void lengthScaleEstimator::readLengthScaleInfo
forAll(recvLblBuffer_[patchI], i)
{
label nLabel = recvLblBuffer_[patchI][i];
label pLevel = recvLvlBuffer_[patchI][i];
label cI = fCells[nLabel];
label& ngbLevel = cellLevels[cI];
// For an unvisited cell, update the level
bool unvisited = false;
if (ngbLevel == 0)
{
ngbLevel = level + 1;
levelCells.insert(cI);
visitedCells++;
ngbLevel = pLevel + 1;
unvisited = true;
}
// Visit all neighbours and re-calculate length-scale
@ -459,27 +486,34 @@ void lengthScaleEstimator::readLengthScaleInfo
if (isA<processorPolyPatch>(boundary[pF]))
{
// Determine the local index.
label local = boundary[pF].whichFace(cellCheck[faceI]);
label local =
(
boundary[pF].whichFace(cellCheck[faceI])
);
// Is this label present in the list?
forAll(recvLblBuffer_[pF], j)
label j = -1;
if ((j = findIndex(recvLblBuffer_[pF], local)) > -1)
{
if (recvLblBuffer_[pF][j] == local)
if
(
(recvLvlBuffer_[pF][j] < ngbLevel) &&
(recvLvlBuffer_[pF][j] > 0)
)
{
sumLength += recvSclBuffer_[pF][j];
nTouchedNgb++;
break;
}
}
}
else
if (fixedPatches_.found(boundary[pF].name()))
if (!isFreePatch(pF))
{
sumLength +=
(
fixedPatches_[boundary[pF].name()][0].scalarToken()
fixedLengthScale(cellCheck[faceI], pF, true)
);
nTouchedNgb++;
@ -489,9 +523,26 @@ void lengthScaleEstimator::readLengthScaleInfo
sumLength /= nTouchedNgb;
// Scale the length and assign to this cell
scalar sLength = sumLength*growthFactor_;
if (level < maxRefineLevel_)
{
sumLength *= growthFactor_;
}
else
if (meanScale_ > 0.0)
{
// If a mean scale has been specified,
// override the value
sumLength = meanScale_;
}
lengthScale[cI] = sLength;
lengthScale[cI] = sumLength;
if (unvisited)
{
levelCells.insert(cI);
visitedCells++;
}
}
}
}

View file

@ -84,6 +84,8 @@ class lengthScaleEstimator
// Buffers for parallel length-scale calculations
labelListList sendLblBuffer_;
labelListList recvLblBuffer_;
labelListList sendLvlBuffer_;
labelListList recvLvlBuffer_;
scalarListList sendSclBuffer_;
scalarListList recvSclBuffer_;

View file

@ -159,9 +159,11 @@ void wedgeFaPatchField<Type>::evaluate(const Pstream::commsTypes)
template<class Type>
tmp<Field<Type> > wedgeFaPatchField<Type>::snGradTransformDiag() const
{
diagTensor diagT =
const diagTensor diagT =
0.5*diag(I - refCast<const wedgeFaPatch>(this->patch()).faceT());
const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
return tmp<Field<Type> >
(
new Field<Type>
@ -171,7 +173,7 @@ tmp<Field<Type> > wedgeFaPatchField<Type>::snGradTransformDiag() const
(
pow
(
reinterpret_cast<const vector&>(diagT),
diagV,
pTraits<typename powProduct<vector, pTraits<Type>::rank>
::type>::zero
)

View file

@ -388,9 +388,12 @@ tmp<areaTensorField> faceLimitedGrad<vector>::grad
forAll(gIf, celli)
{
gIf[celli].x() = cmptMultiply(limiter[celli], gIf[celli].x());
gIf[celli].y() = cmptMultiply(limiter[celli], gIf[celli].y());
gIf[celli].z() = cmptMultiply(limiter[celli], gIf[celli].z());
gIf[celli] = tensor
(
cmptMultiply(limiter[celli], gIf[celli].x()),
cmptMultiply(limiter[celli], gIf[celli].y()),
cmptMultiply(limiter[celli], gIf[celli].z())
);
}
g.correctBoundaryConditions();

View file

@ -267,7 +267,7 @@ public:
}
//- Return axis
const vector& axis() const
vector axis() const
{
return coordSys_.axis();
}

View file

@ -169,9 +169,11 @@ void wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
template<class Type>
tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
{
diagTensor diagT =
const diagTensor diagT =
0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
return tmp<Field<Type> >
(
new Field<Type>
@ -181,7 +183,7 @@ tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
(
pow
(
reinterpret_cast<const vector&>(diagT),
diagV,
pTraits<typename powProduct<vector, pTraits<Type>::rank>
::type>::zero
)

View file

@ -390,9 +390,12 @@ tmp<volTensorField> cellLimitedGrad<vector>::grad
forAll(gIf, celli)
{
gIf[celli].x() = cmptMultiply(limiter[celli], gIf[celli].x());
gIf[celli].y() = cmptMultiply(limiter[celli], gIf[celli].y());
gIf[celli].z() = cmptMultiply(limiter[celli], gIf[celli].z());
gIf[celli] = tensor
(
cmptMultiply(limiter[celli], gIf[celli].x()),
cmptMultiply(limiter[celli], gIf[celli].y()),
cmptMultiply(limiter[celli], gIf[celli].z())
);
}
g.correctBoundaryConditions();

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -mabi=64
#CC = scg++ -mabi=64

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ $(WM_CXXFLAGS)

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ $(WM_CXXFLAGS)

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ $(WM_CXXFLAGS)

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor
CC = g++ -m64

View file

@ -1,4 +1,4 @@
CPP = cpp $(GFLAGS)
CPP = cpp -P $(GFLAGS)
LD = ld
PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m32

View file

@ -1,12 +1,12 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++
include $(RULES)/c++$(WM_COMPILE_OPTION)
ptFLAGS = -DNoRepository -ftemplate-depth-30
ptFLAGS = -DNoRepository -ftemplate-depth-40
c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64 -mcpu=power5+

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter
c++WARN = -Wall -Wextra -Wno-unused-parameter
CC = g++