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

This commit is contained in:
laurence
2013-09-26 14:16:21 +01:00
16 changed files with 125 additions and 55 deletions

View File

@ -13,6 +13,7 @@ EXE_INC = \
${CGAL_EXACT} \ ${CGAL_EXACT} \
${CGAL_INEXACT} \ ${CGAL_INEXACT} \
${CGAL_INC} \ ${CGAL_INC} \
${c++CGALWARN} \
-IconformalVoronoiMesh/lnInclude \ -IconformalVoronoiMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -14,6 +14,7 @@ EXE_INC = \
${CGAL_EXACT} \ ${CGAL_EXACT} \
${CGAL_INEXACT} \ ${CGAL_INEXACT} \
${CGAL_INC} \ ${CGAL_INC} \
${c++CGALWARN} \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \

View File

@ -9,6 +9,7 @@ EXE_INC = \
${EXE_FROUNDING_MATH} \ ${EXE_FROUNDING_MATH} \
${EXE_NDEBUG} \ ${EXE_NDEBUG} \
${CGAL_INC} \ ${CGAL_INC} \
${c++CGALWARN} \
-I$(FOAM_APP)/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \ -I$(FOAM_APP)/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \
-I../cvMesh/vectorTools \ -I../cvMesh/vectorTools \
-IconformalVoronoi2DMesh/lnInclude \ -IconformalVoronoi2DMesh/lnInclude \

View File

@ -1,4 +1,3 @@
patchFaceOrientation.C
orientFaceZone.C orientFaceZone.C
EXE = $(FOAM_APPBIN)/orientFaceZone EXE = $(FOAM_APPBIN)/orientFaceZone

View File

@ -1,7 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude -I$(LIB_SRC)/triSurface/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-lautoMesh \
-ltriSurface -ltriSurface

View File

@ -52,10 +52,14 @@ inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reUse)
ptr_ = ap.ptr_; ptr_ = ap.ptr_;
ap.ptr_ = 0; ap.ptr_ = 0;
} }
else else if (ap.valid())
{ {
ptr_ = ap().clone().ptr(); ptr_ = ap().clone().ptr();
} }
else
{
ptr_ = NULL;
}
} }

View File

@ -12,4 +12,22 @@ fi
wmake $makeType pairPatchAgglomeration wmake $makeType pairPatchAgglomeration
## get SCOTCH_VERSION, SCOTCH_ARCH_PATH
#if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config/scotch.sh`
#then
# . $settings
# echo "using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH"
#else
# echo
# echo "Error: no config/scotch.sh settings"
# echo
#fi
#
#if [ -n "$SCOTCH_ARCH_PATH" ]
#then
# wmake $makeType scotchGamgAgglomeration
#fi
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -17,6 +17,8 @@ $(autoHexMesh)/meshRefinement/meshRefinement.C
$(autoHexMesh)/meshRefinement/meshRefinementMerge.C $(autoHexMesh)/meshRefinement/meshRefinementMerge.C
$(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C $(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C $(autoHexMesh)/meshRefinement/meshRefinementRefine.C
$(autoHexMesh)/meshRefinement/patchFaceOrientation.C
$(autoHexMesh)/refinementFeatures/refinementFeatures.C $(autoHexMesh)/refinementFeatures/refinementFeatures.C
$(autoHexMesh)/refinementSurfaces/surfaceZonesInfo.C $(autoHexMesh)/refinementSurfaces/surfaceZonesInfo.C
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C $(autoHexMesh)/refinementSurfaces/refinementSurfaces.C

View File

@ -112,8 +112,6 @@ const
if (localCellI != -1) if (localCellI != -1)
{ {
Pout<< "Found point " << keepPoint << " in cell " << localCellI
<< " on processor " << Pstream::myProcNo() << endl;
globalCellI = globalCells.toGlobal(localCellI); globalCellI = globalCells.toGlobal(localCellI);
} }
@ -130,6 +128,14 @@ const
<< exit(FatalError); << exit(FatalError);
} }
label procI = globalCells.whichProcID(globalCellI);
label procCellI = globalCells.toLocal(procI, globalCellI);
Info<< "Found point " << keepPoint << " in cell " << procCellI
<< " on processor " << procI << endl;
if (globalCells.isLocal(globalCellI)) if (globalCells.isLocal(globalCellI))
{ {
cellLabels[i] = localCellI; cellLabels[i] = localCellI;

View File

@ -379,6 +379,7 @@ Foam::label Foam::regionSplit::calcLocalRegionSplit
Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
( (
const bool doGlobalRegions,
const boolList& blockedFace, const boolList& blockedFace,
const List<labelPair>& explicitConnections, const List<labelPair>& explicitConnections,
@ -395,7 +396,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
cellRegion cellRegion
); );
if (!Pstream::parRun()) if (!doGlobalRegions)
{ {
return autoPtr<globalIndex>(new globalIndex(nLocalRegions)); return autoPtr<globalIndex>(new globalIndex(nLocalRegions));
} }
@ -422,7 +423,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
// (this will create gaps in the global region list so they will get // (this will create gaps in the global region list so they will get
// merged later on) // merged later on)
while (Pstream::parRun()) while (true)
{ {
if (debug) if (debug)
{ {
@ -690,13 +691,14 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionSplit::regionSplit(const polyMesh& mesh) Foam::regionSplit::regionSplit(const polyMesh& mesh, const bool doGlobalRegions)
: :
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh), MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
labelList(mesh.nCells(), -1) labelList(mesh.nCells(), -1)
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
( (
doGlobalRegions, //do global regions
boolList(0, false), //blockedFaces boolList(0, false), //blockedFaces
List<labelPair>(0), //explicitConnections, List<labelPair>(0), //explicitConnections,
*this *this
@ -707,7 +709,8 @@ Foam::regionSplit::regionSplit(const polyMesh& mesh)
Foam::regionSplit::regionSplit Foam::regionSplit::regionSplit
( (
const polyMesh& mesh, const polyMesh& mesh,
const boolList& blockedFace const boolList& blockedFace,
const bool doGlobalRegions
) )
: :
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh), MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
@ -715,6 +718,7 @@ Foam::regionSplit::regionSplit
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
( (
doGlobalRegions,
blockedFace, //blockedFaces blockedFace, //blockedFaces
List<labelPair>(0), //explicitConnections, List<labelPair>(0), //explicitConnections,
*this *this
@ -726,7 +730,8 @@ Foam::regionSplit::regionSplit
( (
const polyMesh& mesh, const polyMesh& mesh,
const boolList& blockedFace, const boolList& blockedFace,
const List<labelPair>& explicitConnections const List<labelPair>& explicitConnections,
const bool doGlobalRegions
) )
: :
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh), MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
@ -734,6 +739,7 @@ Foam::regionSplit::regionSplit
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
( (
doGlobalRegions,
blockedFace, //blockedFaces blockedFace, //blockedFaces
explicitConnections, //explicitConnections, explicitConnections, //explicitConnections,
*this *this

View File

@ -87,6 +87,9 @@ Description
proc0 | proc1 | proc2 proc0 | proc1 | proc2
Can optionally keep all regions local to the processor.
SourceFiles SourceFiles
regionSplit.C regionSplit.C
@ -155,6 +158,7 @@ class regionSplit
//- Calculate global region split. Return globalIndex. //- Calculate global region split. Return globalIndex.
autoPtr<globalIndex> calcRegionSplit autoPtr<globalIndex> calcRegionSplit
( (
const bool doGlobalRegions,
const boolList& blockedFace, const boolList& blockedFace,
const List<labelPair>& explicitConnections, const List<labelPair>& explicitConnections,
labelList& cellRegion labelList& cellRegion
@ -170,11 +174,20 @@ public:
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
regionSplit(const polyMesh&); regionSplit
(
const polyMesh&,
const bool doGlobalRegions = Pstream::parRun()
);
//- Construct from mesh and whether face is blocked //- Construct from mesh and whether face is blocked
// NOTE: blockedFace has to be consistent across coupled faces! // NOTE: blockedFace has to be consistent across coupled faces!
regionSplit(const polyMesh&, const boolList& blockedFace); regionSplit
(
const polyMesh&,
const boolList& blockedFace,
const bool doGlobalRegions = Pstream::parRun()
);
//- Construct from mesh and whether face is blocked. Additional explicit //- Construct from mesh and whether face is blocked. Additional explicit
// connections between normal boundary faces. // connections between normal boundary faces.
@ -183,7 +196,8 @@ public:
( (
const polyMesh&, const polyMesh&,
const boolList& blockedFace, const boolList& blockedFace,
const List<labelPair>& const List<labelPair>&,
const bool doGlobalRegions = Pstream::parRun()
); );
@ -195,6 +209,12 @@ public:
return globalNumberingPtr_(); return globalNumberingPtr_();
} }
//- Return local number of regions
label nLocalRegions() const
{
return globalNumbering().localSize(Pstream::myProcNo());
}
//- Return total number of regions //- Return total number of regions
label nRegions() const label nRegions() const
{ {

View File

@ -167,7 +167,7 @@ void Foam::decompositionMethod::calcCellCells
( (
const polyMesh& mesh, const polyMesh& mesh,
const labelList& agglom, const labelList& agglom,
const label nCoarse, const label nLocalCoarse,
const bool parallel, const bool parallel,
CompactListList<label>& cellCells CompactListList<label>& cellCells
) )
@ -182,7 +182,7 @@ void Foam::decompositionMethod::calcCellCells
globalIndex globalAgglom globalIndex globalAgglom
( (
nCoarse, nLocalCoarse,
Pstream::msgType(), Pstream::msgType(),
Pstream::worldComm, Pstream::worldComm,
parallel parallel
@ -224,7 +224,7 @@ void Foam::decompositionMethod::calcCellCells
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Number of faces per coarse cell // Number of faces per coarse cell
labelList nFacesPerCell(nCoarse, 0); labelList nFacesPerCell(nLocalCoarse, 0);
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{ {
@ -374,7 +374,7 @@ void Foam::decompositionMethod::calcCellCells
// const boolList& blockedFace, // const boolList& blockedFace,
// const List<labelPair>& explicitConnections, // const List<labelPair>& explicitConnections,
// const labelList& agglom, // const labelList& agglom,
// const label nCoarse, // const label nLocalCoarse,
// const bool parallel, // const bool parallel,
// CompactListList<label>& cellCells // CompactListList<label>& cellCells
//) //)
@ -389,7 +389,7 @@ void Foam::decompositionMethod::calcCellCells
// //
// globalIndex globalAgglom // globalIndex globalAgglom
// ( // (
// nCoarse, // nLocalCoarse,
// Pstream::msgType(), // Pstream::msgType(),
// Pstream::worldComm, // Pstream::worldComm,
// parallel // parallel
@ -431,7 +431,7 @@ void Foam::decompositionMethod::calcCellCells
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// //
// // Number of faces per coarse cell // // Number of faces per coarse cell
// labelList nFacesPerCell(nCoarse, 0); // labelList nFacesPerCell(nLocalCoarse, 0);
// //
// // 1. Internal faces // // 1. Internal faces
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) // for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
@ -764,6 +764,24 @@ Foam::labelList Foam::decompositionMethod::decompose
// Any weights specified? // Any weights specified?
label nWeights = returnReduce(cellWeights.size(), sumOp<label>()); label nWeights = returnReduce(cellWeights.size(), sumOp<label>());
if (nWeights > 0 && cellWeights.size() != mesh.nCells())
{
FatalErrorIn
(
"decompositionMethod::decompose\n"
"(\n"
" const polyMesh&,\n"
" const scalarField&,\n"
" const boolList&,\n"
" const PtrList<labelList>&,\n"
" const labelList&,\n"
" const List<labelPair>&\n"
) << "Number of weights " << cellWeights.size()
<< " differs from number of cells " << mesh.nCells()
<< exit(FatalError);
}
// Any processor sets? // Any processor sets?
label nProcSets = 0; label nProcSets = 0;
forAll(specifiedProcessorFaces, setI) forAll(specifiedProcessorFaces, setI)
@ -828,10 +846,18 @@ Foam::labelList Foam::decompositionMethod::decompose
<< nProcSets << endl << endl; << nProcSets << endl << endl;
} }
// Determine global regions, separated by blockedFaces // Determine local regions, separated by blockedFaces
regionSplit globalRegion(mesh, blockedFace, explicitConnections); regionSplit localRegion(mesh, blockedFace, explicitConnections, false);
if (debug)
{
Info<< "Constrained decomposition:" << endl
<< " split into " << localRegion.nLocalRegions()
<< " regions."
<< endl;
}
// Determine region cell centres // Determine region cell centres
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -840,11 +866,11 @@ Foam::labelList Foam::decompositionMethod::decompose
// somewhere in the middle of the domain which might not be anywhere // somewhere in the middle of the domain which might not be anywhere
// near any of the cells. // near any of the cells.
pointField regionCentres(globalRegion.nRegions(), point::max); pointField regionCentres(localRegion.nLocalRegions(), point::max);
forAll(globalRegion, cellI) forAll(localRegion, cellI)
{ {
label regionI = globalRegion[cellI]; label regionI = localRegion[cellI];
if (regionCentres[regionI] == point::max) if (regionCentres[regionI] == point::max)
{ {
@ -855,22 +881,22 @@ Foam::labelList Foam::decompositionMethod::decompose
// Do decomposition on agglomeration // Do decomposition on agglomeration
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scalarField regionWeights(globalRegion.nRegions(), 0); scalarField regionWeights(localRegion.nLocalRegions(), 0);
if (nWeights > 0) if (nWeights > 0)
{ {
forAll(globalRegion, cellI) forAll(localRegion, cellI)
{ {
label regionI = globalRegion[cellI]; label regionI = localRegion[cellI];
regionWeights[regionI] += cellWeights[cellI]; regionWeights[regionI] += cellWeights[cellI];
} }
} }
else else
{ {
forAll(globalRegion, cellI) forAll(localRegion, cellI)
{ {
label regionI = globalRegion[cellI]; label regionI = localRegion[cellI];
regionWeights[regionI] += 1.0; regionWeights[regionI] += 1.0;
} }
@ -879,7 +905,7 @@ Foam::labelList Foam::decompositionMethod::decompose
finalDecomp = decompose finalDecomp = decompose
( (
mesh, mesh,
globalRegion, localRegion,
regionCentres, regionCentres,
regionWeights regionWeights
); );

View File

@ -219,7 +219,7 @@ public:
// Other // Other
//- Helper: determine (local or global) cellCells from mesh //- Helper: determine (local or global) cellCells from mesh
// agglomeration. // agglomeration. Agglomeration is local to the processor.
// local : connections are in local indices. Coupled across // local : connections are in local indices. Coupled across
// cyclics but not processor patches. // cyclics but not processor patches.
// global : connections are in global indices. Coupled across // global : connections are in global indices. Coupled across
@ -228,34 +228,11 @@ public:
( (
const polyMesh& mesh, const polyMesh& mesh,
const labelList& agglom, const labelList& agglom,
const label nCoarse, const label nLocalCoarse,
const bool global, const bool global,
CompactListList<label>& cellCells CompactListList<label>& cellCells
); );
//- Helper: determine (local or global) cellCells from mesh
// agglomeration and additional specification:
// - any additional connections between non-coupled internal
// or boundary faces.
// - any internal or coupled faces (or additional connections)
// are blocked
//
// local : connections are in local indices. Coupled across
// cyclics but not processor patches.
// global : connections are in global indices. Coupled across
// cyclics and processor patches.
//static void calcCellCells
//(
// const polyMesh& mesh,
// const boolList& blockedFace,
// const List<labelPair>& explicitConnections,
// const labelList& agglom,
// const label nCoarse,
// const bool global,
// CompactListList<label>& cellCells
//);
//- Helper: extract constraints: //- Helper: extract constraints:
// blockedface: existing faces where owner and neighbour on same // blockedface: existing faces where owner and neighbour on same
// proc // proc

View File

@ -1,5 +1,4 @@
CGAL_INC = \ CGAL_INC = \
-Wno-old-style-cast \
-I$(CGAL_ARCH_PATH)/include \ -I$(CGAL_ARCH_PATH)/include \
-I$(MPFR_ARCH_PATH)/include \ -I$(MPFR_ARCH_PATH)/include \
-I$(GMP_ARCH_PATH)/include \ -I$(GMP_ARCH_PATH)/include \

View File

@ -3,6 +3,10 @@
# -Woverloaded-virtual may produce spurious warnings, disable for now # -Woverloaded-virtual may produce spurious warnings, disable for now
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-unused-comparison c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-unused-comparison
# Suppress CGAL warnings
c++CGALWARN = -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-mismatched-tags
CC = clang++ -m64 CC = clang++ -m64
include $(RULES)/c++$(WM_COMPILE_OPTION) include $(RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -3,6 +3,10 @@
# -Woverloaded-virtual may produce spurious warnings, disable for now # -Woverloaded-virtual may produce spurious warnings, disable for now
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-unused-comparison c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-unused-comparison
# Suppress CGAL warnings
c++CGALWARN = -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-mismatched-tags
CC = clang++ -m32 CC = clang++ -m32
include $(RULES)/c++$(WM_COMPILE_OPTION) include $(RULES)/c++$(WM_COMPILE_OPTION)