Commit a4d01188 authored by mattijs's avatar mattijs
Browse files

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

parents d8dbea45 429ab270
memInfo.C
EXE = $(FOAM_USER_APPBIN)/memInfo
#include "memInfo.H"
#include "IOstreams.H"
#include "List.H"
#include "vector.H"
using namespace Foam;
int main()
{
memInfo m;
Info<< m << endl;
List<vector> l(10000000, vector::one);
Info<< m.update() << endl;
return 0;
}
......@@ -56,6 +56,14 @@ int main(int argc, char *argv[])
"specify a list of fields to be reconstructed. Eg, '(U T p)' - "
"regular expressions not currently supported"
);
argList::addOption
(
"lagrangianFields",
"list",
"specify a list of lagrangian fields to be reconstructed. Eg, '(U d)' -"
"regular expressions not currently supported, "
"positions always included."
);
argList::addBoolOption
(
"noLagrangian",
......@@ -73,6 +81,20 @@ int main(int argc, char *argv[])
const bool noLagrangian = args.optionFound("noLagrangian");
HashSet<word> selectedLagrangianFields;
if (args.optionFound("lagrangianFields"))
{
if (noLagrangian)
{
FatalErrorIn(args.executable())
<< "Cannot specify noLagrangian and lagrangianFields "
<< "options together."
<< exit(FatalError);
}
args.optionLookup("lagrangianFields")() >> selectedLagrangianFields;
}
// determine the processor count directly
label nProcs = 0;
while (isDir(args.path()/(word("processor") + name(nProcs))))
......@@ -403,84 +425,96 @@ int main(int argc, char *argv[])
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<label>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<scalar>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<scalar>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<vector>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<vector>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<sphericalTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<sphericalTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<symmTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<symmTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<tensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<tensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
}
}
......
......@@ -188,12 +188,12 @@ then
fi
mpiopts="-np $NPROCS"
#
#
# is the machine ready to run parallel?
#
echo "Parallel processing using $WM_MPLIB with $NPROCS processors"
case "$WM_MPLIB" in
OPENMPI)
*OPENMPI)
# add hostfile info
for hostfile in \
hostfile \
......
......@@ -146,13 +146,20 @@ checkIllegalCode()
badFiles=$(
for f in $fileList
do
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
case "$f" in
# exclude potential makefiles
(wmake/[Mm]akefile* | wmake/rules/*)
;;
(*)
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
;;
esac
done
)
......@@ -243,7 +250,7 @@ checkLineLengthNonComments()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *//" \
--and --not -e '^ *//' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......@@ -276,7 +283,7 @@ checkLineLengthNonDirective()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *#" \
--and --not -e '^ *#' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......
......@@ -109,13 +109,20 @@ checkIllegalCode()
badFiles=$(
for f in $fileList
do
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
case "$f" in
# exclude potential makefiles
(wmake/[Mm]akefile* | wmake/rules/*)
;;
(*)
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
;;
esac
done
)
......@@ -206,7 +213,7 @@ checkLineLengthNonComments()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *//" \
--and --not -e '^ *//' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......@@ -239,7 +246,7 @@ checkLineLengthNonDirective()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *#" \
--and --not -e '^ *#' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......
......@@ -876,8 +876,8 @@ OptimisationSwitches
//- Modification checking:
// - timeStamp : use modification time on file
// - inotify : use inotify framework
// - timeStampMaster : do time stamp (and file reading) only on master.
// - inotifyMaster : do inotify (and file reading) only on master.
// - timeStampMaster : do time stamp (and file reading) only on master.
// - inotifyMaster : do inotify (and file reading) only on master.
fileModificationChecking timeStampMaster;//inotify;timeStamp;inotifyMaster;
commsType nonBlocking; //scheduled; //blocking;
......
......@@ -90,17 +90,20 @@ switch ("$compilerInstall")
case OpenFOAM:
switch ("$WM_COMPILER")
case Gcc:
case Gcc++0x:
set gcc_version=gcc-4.4.3
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
breaksw
case Gcc45:
case Gcc45++0x:
set gcc_version=gcc-4.5.0
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
set mpc_version=mpc-0.8.1
breaksw
case Gcc44:
case Gcc44++0x:
set gcc_version=gcc-4.4.3
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
......@@ -190,6 +193,18 @@ case OpenFOAM:
endsw
#
# add c++0x flags for external programs
#
if ( $?WM_CXXFLAGS ) then
switch ("$WM_COMPILER")
case Gcc*++0x:
setenv WM_CXXFLAGS "$WM_CXXFLAGS -std=c++0x"
breaksw
endsw
endif
# boost and CGAL
# ~~~~~~~~~~~~~~
......@@ -236,12 +251,9 @@ case OPENMPI:
breaksw
case SYSTEMOPENMPI:
# use the system installed openmpi, get library directory via mpicc
# Use the system installed openmpi, get library directory via mpicc
set mpi_version=openmpi-system
# Set to dummy value (but existing directory)
setenv MPI_ARCH_PATH /
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
setenv PINC "`mpicc --showme:compile`"
setenv PLIBS "`mpicc --showme:link`"
......
......@@ -111,18 +111,18 @@ unset MPFR_ARCH_PATH
case "${compilerInstall:-OpenFOAM}" in
OpenFOAM)
case "$WM_COMPILER" in
Gcc)
Gcc | Gcc++0x)
gcc_version=gcc-4.4.3
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
;;
Gcc45)
Gcc45 | Gcc45++0x)
gcc_version=gcc-4.5.0
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
mpc_version=mpc-0.8.1
;;
Gcc44)
Gcc44 | Gcc44++0x)
gcc_version=gcc-4.4.3
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
......@@ -213,6 +213,19 @@ OpenFOAM)
esac
#
# add c++0x flags for external programs
#
if [ -n "$WM_CXXFLAGS" ]
then
case "$WM_COMPILER" in
Gcc*++0x)
WM_CXXFLAGS="$WM_CXXFLAGS -std=c++0x"
;;
esac
fi
# boost and CGAL
# ~~~~~~~~~~~~~~
......@@ -261,12 +274,9 @@ OPENMPI)
;;
SYSTEMOPENMPI)
# use the system installed openmpi, get library directory via mpicc
# Use the system installed openmpi, get library directory via mpicc
mpi_version=openmpi-system
# Set to dummy (but existing directory). Used in Thirdparty Allwmake.
export MPI_ARCH_PATH=/
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
export PINC="`mpicc --showme:compile`"
export PLIBS="`mpicc --showme:link`"
......
......@@ -8,6 +8,7 @@ fileStat.C
POSIX.C
cpuTime/cpuTime.C
clockTime/clockTime.C
memInfo/memInfo.C
/*
* Note: fileMonitor assumes inotify by default. Compile with -DFOAM_USE_STAT
......
......@@ -36,6 +36,7 @@ Description
#include "fileName.H"
#include "fileStat.H"
#include "timer.H"
#include "IFstream.H"
#include <fstream>
#include <cstdlib>
......
......@@ -24,38 +24,25 @@ License
\*---------------------------------------------------------------------------*/
#include "clockTime.H"
#include "scalar.H"
#include <sys/time.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void clockTime::getTime(struct timeval& t)
void Foam::clockTime::getTime(timeType& t)
{
gettimeofday(&t, NULL);
gettimeofday(&t, 0);
}
double clockTime::timeDifference
(
const struct timeval& start,
const struct timeval& end
)
double Foam::clockTime::timeDifference(const timeType& beg, const timeType& end)
{
return end.tv_sec - start.tv_sec + 1E-6*(end.tv_usec - start.tv_usec);
return end.tv_sec - beg.tv_sec + 1E-6*(end.tv_usec - beg.tv_usec);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
clockTime::clockTime()
Foam::clockTime::clockTime()
{
getTime(startTime_);
lastTime_ = startTime_;
......@@ -65,14 +52,14 @@ clockTime::clockTime()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
double clockTime::elapsedTime() const
double Foam::clockTime::elapsedTime() const
{
getTime(newTime_);
return timeDifference(startTime_, newTime_);
}
double clockTime::timeIncrement() const
double Foam::clockTime::timeIncrement() const
{
lastTime_ = newTime_;
getTime(newTime_);
......@@ -80,8 +67,4 @@ double clockTime::timeIncrement() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -44,43 +44,45 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class clockTime Declaration
Class clockTime Declaration
\*---------------------------------------------------------------------------*/
class clockTime
{
// Private data
struct timeval startTime_;
mutable struct timeval lastTime_;
mutable struct timeval newTime_;
//- Time structure used
typedef struct timeval timeType;
static void getTime(struct timeval& t);
timeType startTime_;
static double timeDifference
(
const struct timeval& start,
const struct timeval& end
);
mutable timeType lastTime_;
mutable timeType newTime_;
// Private Member Functions
//- Retrieve the current time values from the system
static void getTime(timeType&);
//- Difference between two times
static double timeDifference(const timeType& beg, const timeType& end);
public:
// Constructors
//- Construct from components
//- Construct with the current clock time
clockTime();
// Member Functions
// Access
//- Returns CPU time from start of run
double elapsedTime() const;
//- Return time (in seconds) from the start
double elapsedTime() const;
//- Returns CPU time from last call of clockTimeIncrement()
double timeIncrement() const;
//- Return time (in seconds) since last call to timeIncrement()
double timeIncrement() const;
};
......
......@@ -21,45 +21,32 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Starts timing CPU usage and return elapsed time from start.
\*---------------------------------------------------------------------------*/
#include "cpuTime.H"
#include <unistd.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
long cpuTime::Hz_(sysconf(_SC_CLK_TCK));
const long Foam::cpuTime::Hz_(sysconf(_SC_CLK_TCK));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void cpuTime::getTime(struct tms& t)
void Foam::cpuTime::getTime(timeType& t)
{
times(&t);
}
double cpuTime::timeDifference
(
const struct tms& start,
const struct tms& end
)
double Foam::cpuTime::timeDifference(const timeType& beg, const timeType& end)
{
return
(
double
(
(end.tms_utime + end.tms_stime)
- (start.tms_utime + start.tms_stime)
- (beg.tms_utime + beg.tms_stime)
)/Hz_
);
}
......@@ -67,7 +54,7 @@ double cpuTime::timeDifference
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cpuTime::cpuTime()
Foam::cpuTime::cpuTime()
{
getTime(startTime_);
lastTime_ = startTime_;
......@@ -77,14 +64,14 @@ cpuTime::cpuTime()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
double cpuTime::elapsedCpuTime() const
double Foam::cpuTime::elapsedCpuTime() const
{
getTime(newTime_);
return timeDifference(startTime_, newTime_);
}
double cpuTime::cpuTimeIncrement() const
double Foam::cpuTime::cpuTimeIncrement() const
{
lastTime_ = newTime_;