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

This commit is contained in:
andy
2008-05-22 15:04:38 +01:00
68 changed files with 299 additions and 42 deletions

2
.gitignore vendored
View File

@ -8,7 +8,7 @@
*.bak *.bak
# CVS recovered versions - anywhere # CVS recovered versions - anywhere
.#* *\#*\#
# objects and archives - anywhere # objects and archives - anywhere
*.[oa] *.[oa]

View File

@ -1,4 +1,4 @@
buoyantSimpleRadiationFoam.C buoyantSimpleRadiationFoam.C
EXE = $(FOAM_USER_APPBIN)/buoyantSimpleRadiationFoam EXE = $(FOAM_APPBIN)/buoyantSimpleRadiationFoam

View File

@ -1,3 +1,3 @@
compressibleLesInterFoam.C compressibleLesInterFoam.C
EXE = $(FOAM_USER_APPBIN)/compressibleLesInterFoam EXE = $(FOAM_APPBIN)/compressibleLesInterFoam

View File

@ -1,4 +0,0 @@
:q
calcDivPhi.C
EXE = $(FOAM_USER_APPBIN)/divPhi

View File

@ -1,7 +0,0 @@
EXE_INC = \
-I$(FOAM_SRC)/postProcessing/postCalc \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lpostCalc \
-lfiniteVolume

View File

@ -1183,7 +1183,8 @@ void Foam::autoHexMeshDriver::mergePatchFaces()
meshRefiner.mergePatchFaces meshRefiner.mergePatchFaces
( (
Foam::cos(45*mathematicalConstant::pi/180.0), Foam::cos(45*mathematicalConstant::pi/180.0),
Foam::cos(45*mathematicalConstant::pi/180.0) Foam::cos(45*mathematicalConstant::pi/180.0),
meshRefinement::addedPatches(globalToPatch_)
); );
if (debug_) if (debug_)

View File

@ -62,7 +62,15 @@ Foam::label Foam::autoHexMeshDriver::mergePatchFacesUndo
combineFaces faceCombiner(mesh_, true); combineFaces faceCombiner(mesh_, true);
// Get all sets of faces that can be merged // Get all sets of faces that can be merged
labelListList allFaceSets(faceCombiner.getMergeSets(minCos, concaveCos)); labelListList allFaceSets
(
faceCombiner.getMergeSets
(
minCos,
concaveCos,
meshRefinement::addedPatches(globalToPatch_)
)
);
label nFaceSets = returnReduce(allFaceSets.size(), sumOp<label>()); label nFaceSets = returnReduce(allFaceSets.size(), sumOp<label>());

View File

@ -607,9 +607,8 @@ public:
label mergePatchFaces label mergePatchFaces
( (
const scalar minCos, const scalar minCos,
const scalar concaveCos const scalar concaveCos,
//const dictionary& motionDict, const labelList& patchIDs
//const labelList& globalToPatch
); );
//- Remove points not used by any face or points used //- Remove points not used by any face or points used

View File

@ -48,14 +48,43 @@ Class
Foam::label Foam::meshRefinement::mergePatchFaces Foam::label Foam::meshRefinement::mergePatchFaces
( (
const scalar minCos, const scalar minCos,
const scalar concaveCos const scalar concaveCos,
const labelList& patchIDs
) )
{ {
// Patch face merging engine // Patch face merging engine
combineFaces faceCombiner(mesh_); combineFaces faceCombiner(mesh_);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Pick up all cells on boundary
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const polyPatch& patch = patches[patchI];
if (!patch.coupled())
{
forAll(patch, i)
{
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
}
}
}
// Get all sets of faces that can be merged // Get all sets of faces that can be merged
labelListList mergeSets(faceCombiner.getMergeSets(minCos, concaveCos)); labelListList mergeSets
(
faceCombiner.getMergeSets
(
minCos,
concaveCos,
boundaryCells
)
);
label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>()); label nFaceSets = returnReduce(mergeSets.size(), sumOp<label>());

View File

@ -293,27 +293,10 @@ Foam::combineFaces::combineFaces
Foam::labelListList Foam::combineFaces::getMergeSets Foam::labelListList Foam::combineFaces::getMergeSets
( (
const scalar featureCos, const scalar featureCos,
const scalar minConcaveCos const scalar minConcaveCos,
const labelHashSet& boundaryCells
) const ) const
{ {
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Pick up all cells on boundary
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
forAll(patches, patchI)
{
const polyPatch& patch = patches[patchI];
if (!patch.coupled())
{
forAll(patch, i)
{
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
}
}
}
// Lists of faces that can be merged. // Lists of faces that can be merged.
DynamicList<labelList> allFaceSets(boundaryCells.size() / 10); DynamicList<labelList> allFaceSets(boundaryCells.size() / 10);
@ -387,6 +370,34 @@ Foam::labelListList Foam::combineFaces::getMergeSets
} }
Foam::labelListList Foam::combineFaces::getMergeSets
(
const scalar featureCos,
const scalar minConcaveCos
) const
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Pick up all cells on boundary
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
forAll(patches, patchI)
{
const polyPatch& patch = patches[patchI];
if (!patch.coupled())
{
forAll(patch, i)
{
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
}
}
}
return getMergeSets(featureCos, minConcaveCos, boundaryCells);
}
// Gets outside edgeloop as a face // Gets outside edgeloop as a face
// - in same order as faces // - in same order as faces
// - in mesh vertex labels // - in mesh vertex labels

View File

@ -152,6 +152,15 @@ public:
// Helper functions // Helper functions
//- Extract lists of all (non-coupled) boundary faces on selected
// cells that can be merged. Uses getFaceRegions.
labelListList getMergeSets
(
const scalar featureCos,
const scalar minConcaveCos,
const labelHashSet& boundaryCells
) const;
//- Extract lists of all (non-coupled) boundary faces that can //- Extract lists of all (non-coupled) boundary faces that can
// be merged. Uses getFaceRegions. // be merged. Uses getFaceRegions.
labelListList getMergeSets labelListList getMergeSets

View File

@ -78,7 +78,7 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError); << exit(FatalError);
} }
} }
@ -111,7 +111,7 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError); << exit(FatalError);
} }
} }

View File

@ -199,6 +199,16 @@ void Foam::directMappedPolyPatch::calcMapping() const
<< "Mapping already calculated" << exit(FatalError); << "Mapping already calculated" << exit(FatalError);
} }
if (offset_ == vector::zero)
{
FatalErrorIn("directMappedPolyPatch::calcMapping() const")
<< "Invalid offset " << offset_ << endl
<< "Offset is the vector added to the patch face centres to"
<< " find the cell supplying the data."
<< exit(FatalError);
}
// Get global list of all samples and the processor and face they come from. // Get global list of all samples and the processor and face they come from.
pointField samples; pointField samples;
labelList patchFaceProcs; labelList patchFaceProcs;

201
wmake/wmakeLockScheduler Executable file
View File

@ -0,0 +1,201 @@
#!/bin/bash
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
# \\/ 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 2 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, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# wmakeScheduler
#
# Description
# Scheduler for network distributed compilations using wmake.
# - WM_HOSTS contains a list of hosts and number of concurrent processes
# eg,
# export WM_HOSTS="hostA:1 hostB:2 hostC:1"
# - WM_COLOURS contains a list of colours to cycle through
# export WM_COLOURS="black blue green cyan red magenta yellow"
#
# Sources the relevant cshrc/bashrc if not set.
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine
#
# Usage
# wmakeScheduler COMMAND
# run 'COMMAND' on one of the slots listed in WM_HOSTS
#
# wmakeScheduler -count
# count the total number of slots available in WM_HOSTS
# eg, WM_NCOMPPROCS=$(wmakeScheduler -count)
#
#-------------------------------------------------------------------------------
lockDir=$HOME/.wmakeScheduler
# fallback - 1 core on current host
: ${WM_HOSTS:=$HOST:1}
# count the total number of slots available and exit
if [ "$1" = "-count" ]
then
expr $(
for slotGroup in $WM_HOSTS
do
n=${slotGroup##*:}
if [ "$n" = "${slotGroup%%:*}" ]; then n=1; fi # missing ':'
echo "+ ${n:-1}"
done)
exit 0
fi
# where to source WM_PROJECT settings in a remote shell
# This code tries to figure out which cshrc or bashrc to execute.
# !! Assumes remote computer running same shell and startup files
# in same location
sourceFoam=false # fallback command
case $SHELL in
*/csh | */tcsh ) # [t]csh vs bash|ksh|sh
shellRc=cshrc
;;
*)
shellRc=bashrc
;;
esac
# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/
# check <installedProject>/etc/
# check <installedProject/.$WM_PROJECT-$WM_PROJECT_VERSION/
if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
;
do
if [ -f "$i/$shellRc" ]; then
sourceFoam="$i/$shellRc"
break
fi
done
fi
# Construct test string for remote execution.
# Source WM_PROJECT settings if WM_PROJECT environment not set.
case $sourceFoam in
*/cshrc) sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam";;
*/bashrc) sourceFoam='[ "$WM_PROJECT" ] || . '"$sourceFoam";;
esac
# quote double-quotes for remote command line
rcmd=$(echo $* | sed -e s/\"/\'\"\'/g)
## the same, without forking (not ksh, maybe not /bin/sh either)
# rcmd=$(while [ "$#" -gt 0 ]; do echo "${1//\"/'\"'}"; shift; done)
# Convert WM_COLOURS into an array
declare colours
nColours=0
for col in $WM_COLOURS
do
colours[$nColours]=$col
((nColours = $nColours + 1))
done
# Bashism: make pipe fail early. This make sure return value of compilation
# is returned and not of colouring pipe.
set -o pipefail
# Define function to colour output by argument 1
colourPipe(){
if [ "$1" ]; then
(while read line; do setterm -foreground $1; echo "$line" ; done; setterm -foreground default)
else
cat
fi
}
colourIndex=0
while :
do
for slotGroup in $WM_HOSTS
do
# split 'host:N', but catch 'host:' and 'host' too
host=${slotGroup%%:*}
n=${slotGroup##*:}
if [ "$n" = "$host" ]; then n=1; fi # missing ':'
: ${n:=1}
i=0
while [ "$i" -lt "$n" ]
do
lockFile="$lockDir/$host:$i"
if lockfile -r0 "$lockFile" 2>/dev/null; then
# Set colour
colour=${colours[$colourIndex]}
#echo "** host=$host colourIndex=$colourIndex colour=$colour"
if [ "$host" = "$HOST" ]; then
if [ "$colour" ]; then
eval $* 2>&1 | colourPipe $colour
else
eval $*
fi
elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
else
if [ "$colour" ]; then
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe $colour
else
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd"
fi
fi
retval=$?
# Release lock
rm -f "$lockFile" 2>/dev/null
exit $retval
fi
i=$(expr $i + 1)
# Cycle through colours
colourIndex=$(expr $colourIndex + 1)
if (( $colourIndex >= $nColours )); then
colourIndex=0
fi
done
done
done
if [ "$WM_COLOURS" ]; then
setterm -foreground default
fi
#------------------------------------------------------------------------------