From fe45863a11ac0285b09d3cc18a39809b13b71915 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 22 Oct 2009 11:59:25 +0100 Subject: [PATCH] new mapDistribute constructor; various fixes --- .../mapPolyMesh/mapDistribute/mapDistribute.C | 310 +++++++++++++++++- .../mapPolyMesh/mapDistribute/mapDistribute.H | 51 +++ .../mapDistribute/mapDistributeTemplates.C | 74 +++++ .../centredCPCCellToFaceStencilObject.H | 2 +- .../centredFECCellToFaceStencilObject.H | 2 +- .../upwindCECCellToFaceStencilObject.H | 2 +- .../upwindCPCCellToFaceStencilObject.H | 2 +- .../upwindFECCellToFaceStencilObject.H | 2 +- .../cellToFace/extendedCellToFaceStencil.C | 196 ----------- .../cellToFace/extendedCellToFaceStencil.H | 8 - .../extendedCentredCellToFaceStencil.C | 17 +- .../extendedUpwindCellToFaceStencil.C | 55 +++- .../extendedCentredFaceToCellStencil.C | 20 +- 13 files changed, 495 insertions(+), 246 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 0c524920af..0955585f5e 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -27,7 +27,7 @@ License #include "mapDistribute.H" #include "commSchedule.H" #include "HashSet.H" -#include "ListOps.H" +#include "globalIndex.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -257,6 +257,292 @@ Foam::mapDistribute::mapDistribute } +Foam::mapDistribute::mapDistribute +( + const globalIndex& globalNumbering, + labelList& elements, + List >& compactMap +) +: + constructSize_(0), + schedulePtr_() +{ + // 1. Construct per processor compact addressing of the global elements + // needed. The ones from the local processor are not included since + // these are always all needed. + compactMap.setSize(Pstream::nProcs()); + { + // Count all (non-local) elements needed. Just for presizing map. + labelList nNonLocal(Pstream::nProcs(), 0); + + forAll(elements, i) + { + label globalIndex = elements[i]; + + if (!globalNumbering.isLocal(globalIndex)) + { + label procI = globalNumbering.whichProcID(globalIndex); + nNonLocal[procI]++; + } + } + + forAll(compactMap, procI) + { + if (procI != Pstream::myProcNo()) + { + compactMap[procI].resize(2*nNonLocal[procI]); + } + } + + + // Collect all (non-local) elements needed. + forAll(elements, i) + { + label globalIndex = elements[i]; + + if (!globalNumbering.isLocal(globalIndex)) + { + label procI = globalNumbering.whichProcID(globalIndex); + label index = globalNumbering.toLocal(procI, globalIndex); + label nCompact = compactMap[procI].size(); + compactMap[procI].insert(index, nCompact); + } + } + + //// Sort remote elements needed (not really necessary) + //forAll(compactMap, procI) + //{ + // if (procI != Pstream::myProcNo()) + // { + // Map