diff --git a/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C b/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C index 0b7dbb462eb030228c4952c81e5342227f7d5028..820434fcb8587f74a4771b83086309f3b7a7bf13 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C +++ b/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2015-2022 OpenCFD Ltd. + Copyright (C) 2015-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -144,10 +144,10 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions const label oldLpi = lpi.size(); - labelListList subMap; + labelListList sendMap; - // Allocate transfer buffers - PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); + // Transfer buffers + PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking); { // List of lists of particles to be transferred for all of the @@ -173,7 +173,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions // Per processor the indices of the particles to send - subMap = invertOneToMany(Pstream::nProcs(), destProc); + sendMap = invertOneToMany(UPstream::nProcs(), destProc); // Stream into send buffers @@ -282,29 +282,12 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions lpi.rename(cloudName); } - // Until now (FEB-2023) we have always used processor ordering for the - // construct map (whereas mapDistribute has local transfers first), - // so we'll stick with that for now, but can likely just use the subMap - // directly with mapDistribute and have it determine the constructMap. - - labelList recvSizes; - Pstream::exchangeSizes(subMap, recvSizes); - - label constructSize = 0; - labelListList constructMap(Pstream::nProcs()); - - forAll(constructMap, proci) - { - const label len = recvSizes[proci]; - constructMap[proci] = identity(len, constructSize); - constructSize += len; - } + // The constructMap is in linear (processor) order return autoPtr<mapDistributeBase>::New ( - constructSize, - std::move(subMap), - std::move(constructMap) + mapDistributeBase::layoutTypes::linear, + std::move(sendMap) ); } diff --git a/src/meshTools/processorLOD/box/box.C b/src/meshTools/processorLOD/box/box.C index 9e2c08ba2be255a9de5ed920d7e25dc20e8beabb..dd6deffc320c5871718b0ef6ffd4d7b3603c773e 100644 --- a/src/meshTools/processorLOD/box/box.C +++ b/src/meshTools/processorLOD/box/box.C @@ -51,28 +51,27 @@ void Foam::processorLODs::box::writeBoxes const label iter ) const { - static label time = 0; + static label timeIndex = 0; OFstream os ( "processor" + Foam::name(Pstream::myProcNo()) - + "_time" + Foam::name(time) + + "_time" + Foam::name(timeIndex) + "_iter" + Foam::name(iter) + ".obj" ); + ++timeIndex; + label verti = 0; - for (const int proci : Pstream::allProcs()) + for (const int proci : UPstream::allProcs()) { - if (proci == Pstream::myProcNo()) + if (proci == UPstream::myProcNo()) { continue; } - const DynamicList<treeBoundBox>& procBoxes = fixedBoxes[proci]; - forAll(procBoxes, boxi) + for (const treeBoundBox& bb : fixedBoxes[proci]) { - const treeBoundBox& bb = procBoxes[boxi]; - // Write the points const pointField pts(bb.points()); meshTools::writeOBJ(os, pts); @@ -90,8 +89,6 @@ void Foam::processorLODs::box::writeBoxes verti += pts.size(); } } - - ++time; } @@ -418,7 +415,8 @@ bool Foam::processorLODs::box::doRefineBoxes Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::box::createMap ( const label nSrcElems, - const label nTgtElems + const label nTgtElems, + const mapDistributeBase::layoutTypes constructLayout ) { // Store elements to send - will be used to build the mapDistribute @@ -528,7 +526,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::box::createMap } } - return autoPtr<mapDistribute>::New(std::move(sendElems)); + return autoPtr<mapDistribute>::New + ( + constructLayout, + std::move(sendElems) + ); } diff --git a/src/meshTools/processorLOD/box/box.H b/src/meshTools/processorLOD/box/box.H index 029425a23c5f006299a204a526fe3ad95d0d24f5..d38a989f93434000bc52898c3e393ae6b0dfb987 100644 --- a/src/meshTools/processorLOD/box/box.H +++ b/src/meshTools/processorLOD/box/box.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,8 +38,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef processorLODs_box -#define processorLODs_box +#ifndef Foam_processorLODs_box +#define Foam_processorLODs_box #include "processorLOD.H" #include "treeBoundBox.H" @@ -62,7 +62,7 @@ class box { protected: - // Protected data + // Protected Data // Flags to indicate what to do with a box @@ -112,8 +112,11 @@ protected: ) const; - virtual boundBox calcSrcBox(const label srcObji) const = 0; - virtual boundBox calcTgtBox(const label tgtObji) const = 0; + //- The local boundBox associated with given source object + virtual treeBoundBox calcSrcBox(const label srcObji) const = 0; + + //- The local boundBox associated with given target object + virtual treeBoundBox calcTgtBox(const label tgtObji) const = 0; //- Set the box refinement flags void setRefineFlags @@ -158,10 +161,13 @@ protected: List<DynamicList<treeBoundBox>>& fixedBoxes ); + //- Return the parallel distribution map + //- (often linear construct order) autoPtr<mapDistribute> createMap ( const label nSrcElems, - const label nTgtElems + const label nTgtElems, + const mapDistributeBase::layoutTypes constructLayout ); @@ -170,15 +176,18 @@ public: //- Runtime type information TypeName("box"); - //- Construct from list of points - box - ( - const UList<point>& srcPoints, - const UList<point>& tgtPoints, - const label maxObjectsPerLeaf, - const label nObjectsOfType, - const label nRefineIterMax = 100 - ); + // Constructors + + //- Construct from list of points for source and target + box + ( + const UList<point>& srcPoints, + const UList<point>& tgtPoints, + const label maxObjectsPerLeaf, + const label nObjectsOfType, + const label nRefineIterMax = 100 + ); + //- Destructor virtual ~box() = default; diff --git a/src/meshTools/processorLOD/cellBox/cellBox.C b/src/meshTools/processorLOD/cellBox/cellBox.C index df9c0e190cfa44c4a98326dd0ccc11a31de57172..8e293ac3c37de0b7f509d1360893d4f1cf957efd 100644 --- a/src/meshTools/processorLOD/cellBox/cellBox.C +++ b/src/meshTools/processorLOD/cellBox/cellBox.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,12 +39,12 @@ namespace processorLODs // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::boundBox Foam::processorLODs::cellBox::calcSrcBox +Foam::treeBoundBox Foam::processorLODs::cellBox::calcSrcBox ( const label srcObji ) const { - boundBox bb; + treeBoundBox bb; for (const label facei : srcCells_[srcObji]) { @@ -55,12 +55,12 @@ Foam::boundBox Foam::processorLODs::cellBox::calcSrcBox } -Foam::boundBox Foam::processorLODs::cellBox::calcTgtBox +Foam::treeBoundBox Foam::processorLODs::cellBox::calcTgtBox ( const label tgtObji ) const { - boundBox bb; + treeBoundBox bb; for (const label facei : tgtCells_[tgtObji]) { @@ -86,7 +86,7 @@ Foam::processorLODs::cellBox::cellBox const label nRefineIterMax ) : - faceBox + processorLODs::faceBox ( srcFaces, srcPoints, @@ -101,9 +101,15 @@ Foam::processorLODs::cellBox::cellBox {} -Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::cellBox::map() +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::mapDistribute> +Foam::processorLODs::cellBox::map +( + const mapDistributeBase::layoutTypes constructLayout +) { - return createMap(srcCells_.size(), tgtCells_.size()); + return createMap(srcCells_.size(), tgtCells_.size(), constructLayout); } diff --git a/src/meshTools/processorLOD/cellBox/cellBox.H b/src/meshTools/processorLOD/cellBox/cellBox.H index df5766d83f95eef4036596e7a9c80d1fe043aa3f..424185f1541d8704ee108a0ec9af993f7b8b77ec 100644 --- a/src/meshTools/processorLOD/cellBox/cellBox.H +++ b/src/meshTools/processorLOD/cellBox/cellBox.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,8 +38,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef processorLODs_cellBox -#define processorLODs_cellBox +#ifndef Foam_processorLODs_cellBox +#define Foam_processorLODs_cellBox #include "faceBox.H" #include "cellList.H" @@ -48,7 +48,6 @@ Description namespace Foam { - namespace processorLODs { @@ -58,23 +57,27 @@ namespace processorLODs class cellBox : - public faceBox + public processorLODs::faceBox { -private: +protected: - // Private data + // Protected Data - //- Reference to the source face list + //- Reference to the source cell list const cellList& srcCells_; - //- Reference to the target face list + //- Reference to the target cell list const cellList& tgtCells_; - // Private Member Functions + // Protected Member Functions + + //- The local boundBox associated with given source object + virtual treeBoundBox calcSrcBox(const label srcObji) const; + + //- The local boundBox associated with given target object + virtual treeBoundBox calcTgtBox(const label tgtObji) const; - virtual boundBox calcSrcBox(const label srcObji) const; - virtual boundBox calcTgtBox(const label tgtObji) const; public: @@ -82,19 +85,22 @@ public: //- Runtime type information TypeName("box"); - //- Construct from list of points - cellBox - ( - const cellList& srcCells, - const faceList& srcFaces, - const UList<point>& srcPoints, - const cellList& tgtCells, - const faceList& tgtFaces, - const UList<point>& tgtPoints, - const label maxObjectsPerLeaf, - const label nObjectsOfType, - const label nRefineIterMax = 100 - ); + // Constructors + + //- Construct from list of points/faces/cells for source and target + cellBox + ( + const cellList& srcCells, + const faceList& srcFaces, + const UList<point>& srcPoints, + const cellList& tgtCells, + const faceList& tgtFaces, + const UList<point>& tgtPoints, + const label maxObjectsPerLeaf, + const label nObjectsOfType, + const label nRefineIterMax = 100 + ); + //- Destructor virtual ~cellBox() = default; @@ -103,16 +109,17 @@ public: // Member Functions //- Return the parallel distribution map - virtual autoPtr<mapDistribute> map(); + //- (usually linear construct order) + virtual autoPtr<mapDistribute> map + ( + const mapDistributeBase::layoutTypes constructLayout + ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace processorLODs - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/processorLOD/faceBox/faceBox.C b/src/meshTools/processorLOD/faceBox/faceBox.C index 1fa7c3997a7f417278215322af5ee67412205e93..d347b0cdaf01db53dc7030687c30235ca392c922 100644 --- a/src/meshTools/processorLOD/faceBox/faceBox.C +++ b/src/meshTools/processorLOD/faceBox/faceBox.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,21 +38,21 @@ namespace processorLODs // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::boundBox Foam::processorLODs::faceBox::calcSrcBox +Foam::treeBoundBox Foam::processorLODs::faceBox::calcSrcBox ( const label srcObji ) const { - return boundBox(srcPoints_, srcFaces_[srcObji], false); + return treeBoundBox(srcPoints_, srcFaces_[srcObji]); // No reduce } -Foam::boundBox Foam::processorLODs::faceBox::calcTgtBox +Foam::treeBoundBox Foam::processorLODs::faceBox::calcTgtBox ( const label tgtObji ) const { - return boundBox(tgtPoints_, tgtFaces_[tgtObji], false); + return treeBoundBox(tgtPoints_, tgtFaces_[tgtObji]); // No reduce } @@ -69,15 +69,21 @@ Foam::processorLODs::faceBox::faceBox const label nRefineIterMax ) : - box(srcPoints, tgtPoints, maxObjectsPerLeaf, nObjectsOfType), + processorLODs::box(srcPoints, tgtPoints, maxObjectsPerLeaf, nObjectsOfType), srcFaces_(srcFaces), tgtFaces_(tgtFaces) {} -Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::faceBox::map() +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::mapDistribute> +Foam::processorLODs::faceBox::map +( + const mapDistributeBase::layoutTypes constructLayout +) { - return createMap(srcFaces_.size(), tgtFaces_.size()); + return createMap(srcFaces_.size(), tgtFaces_.size(), constructLayout); } diff --git a/src/meshTools/processorLOD/faceBox/faceBox.H b/src/meshTools/processorLOD/faceBox/faceBox.H index 2b6b8acc4a1623b57d766ed3be6f54784847db58..68e9f9b002aad3423d393609404f3b3c3688e98d 100644 --- a/src/meshTools/processorLOD/faceBox/faceBox.H +++ b/src/meshTools/processorLOD/faceBox/faceBox.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,8 +38,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef processorLODs_faceBox -#define processorLODs_faceBox +#ifndef Foam_processorLODs_faceBox +#define Foam_processorLODs_faceBox #include "box.H" @@ -47,7 +47,6 @@ Description namespace Foam { - namespace processorLODs { @@ -57,11 +56,11 @@ namespace processorLODs class faceBox : - public box + public processorLODs::box { protected: - // Protected data + // Protected Data //- Reference to the source face list const faceList& srcFaces_; @@ -72,8 +71,11 @@ protected: // Protected Member Functions - virtual boundBox calcSrcBox(const label srcObji) const; - virtual boundBox calcTgtBox(const label tgtObji) const; + //- The local boundBox associated with given source object + virtual treeBoundBox calcSrcBox(const label srcObji) const; + + //- The local boundBox associated with given target object + virtual treeBoundBox calcTgtBox(const label tgtObji) const; public: @@ -81,17 +83,20 @@ public: //- Runtime type information TypeName("box"); - //- Construct from list of points - faceBox - ( - const faceList& srcFaces, - const UList<point>& srcPoints, - const faceList& tgtFaces, - const UList<point>& tgtPoints, - const label maxObjectsPerLeaf, - const label nObjectsOfType, - const label nRefineIterMax = 100 - ); + // Constructors + + //- Construct from list of points/faces for source and target + faceBox + ( + const faceList& srcFaces, + const UList<point>& srcPoints, + const faceList& tgtFaces, + const UList<point>& tgtPoints, + const label maxObjectsPerLeaf, + const label nObjectsOfType, + const label nRefineIterMax = 100 + ); + //- Destructor virtual ~faceBox() = default; @@ -100,16 +105,17 @@ public: // Member Functions //- Return the parallel distribution map - virtual autoPtr<mapDistribute> map(); + //- (usually linear construct order) + virtual autoPtr<mapDistribute> map + ( + const mapDistributeBase::layoutTypes constructLayout + ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace processorLODs - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/processorLOD/processorLOD/processorLOD.C b/src/meshTools/processorLOD/processorLOD/processorLOD.C index b1e478a891a62e924ab2e4a40f8e946980fb48ed..1b194bcc7592a553fd939156cb35a98c3b562663 100644 --- a/src/meshTools/processorLOD/processorLOD/processorLOD.C +++ b/src/meshTools/processorLOD/processorLOD/processorLOD.C @@ -38,7 +38,7 @@ Foam::processorLOD::processorLOD ( const label maxObjectsPerLeaf, const label nObjectsOfType -) +) noexcept : maxObjectsPerLeaf_(maxObjectsPerLeaf), nObjectsOfType_(nObjectsOfType) diff --git a/src/meshTools/processorLOD/processorLOD/processorLOD.H b/src/meshTools/processorLOD/processorLOD/processorLOD.H index db7bd6de3b7a479b219416fe6310103c75051821..900e32cce9bc43d6d8b4249006103d1748252520 100644 --- a/src/meshTools/processorLOD/processorLOD/processorLOD.H +++ b/src/meshTools/processorLOD/processorLOD/processorLOD.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,17 +33,19 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef processorLOD_H -#define processorLOD_H +#ifndef Foam_processorLOD_H +#define Foam_processorLOD_H #include "autoPtr.H" #include "typeInfo.H" +#include "mapDistributeBase.H" // For layoutTypes // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward Declarations class mapDistribute; /*---------------------------------------------------------------------------*\ @@ -52,16 +54,15 @@ class mapDistribute; class processorLOD { - protected: - // Protected data + // Protected Data //- Maximum number of objects per leaf label maxObjectsPerLeaf_; - //- Number of objects of this type, e.g. number of faces/cells on this - //- processor + //- Number of objects of this type. + //- e.g. number of faces/cells on this processor label nObjectsOfType_; @@ -75,7 +76,7 @@ public: ( const label maxObjectsPerLeaf, const label nObjectsOfType - ); + ) noexcept; //- Destructor virtual ~processorLOD() = default; @@ -84,7 +85,12 @@ public: // Member Functions //- Return the parallel distribution map - virtual autoPtr<mapDistribute> map() = 0; + //- (usually linear construct order) + virtual autoPtr<mapDistribute> map + ( + const mapDistributeBase::layoutTypes constructLayout + = mapDistributeBase::layoutTypes::linear + ) = 0; }; diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 6a15c093a4f6ab955b8c91821b91e1be12a66101..69ba954e7ec2fbae2fa1e11704a3bcaa89122ca0 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -846,8 +846,8 @@ Foam::meshToMesh::meshToMesh ( const polyMesh& src, const polyMesh& tgt, - const interpolationMethod& method, - const procMapMethod& mapMethod, + const interpolationMethod method, + const procMapMethod mapMethod, bool interpAllPatches ) : @@ -884,7 +884,7 @@ Foam::meshToMesh::meshToMesh const polyMesh& tgt, const word& methodName, const word& AMIMethodName, - const procMapMethod& mapMethod, + const procMapMethod mapMethod, bool interpAllPatches ) : @@ -914,10 +914,10 @@ Foam::meshToMesh::meshToMesh ( const polyMesh& src, const polyMesh& tgt, - const interpolationMethod& method, + const interpolationMethod method, const HashTable<word>& patchMap, const wordList& cuttingPatches, - const procMapMethod& mapMethod, + const procMapMethod mapMethod, const bool normalise ) : @@ -956,7 +956,7 @@ Foam::meshToMesh::meshToMesh const word& AMIMethodName, // boundary mapping const HashTable<word>& patchMap, const wordList& cuttingPatches, - const procMapMethod& mapMethod, + const procMapMethod mapMethod, const bool normalise ) : diff --git a/src/sampling/meshToMesh/meshToMesh.H b/src/sampling/meshToMesh/meshToMesh.H index 29ab929360577af63d4be51a7ad5e5961cc58cdb..f8ec022958eb85f48b7bf5944f9fc565926aaccb 100644 --- a/src/sampling/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMesh/meshToMesh.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2015-2022 OpenCFD Ltd. + Copyright (C) 2015-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -315,8 +315,8 @@ public: ( const polyMesh& src, const polyMesh& tgt, - const interpolationMethod& method, - const procMapMethod& mapMethod = procMapMethod::pmAABB, + const interpolationMethod method, + const procMapMethod mapMethod = procMapMethod::pmAABB, const bool interpAllPatches = true ); @@ -327,7 +327,7 @@ public: const polyMesh& tgt, const word& methodName, // internal mapping const word& AMIMethodName, // boundary mapping - const procMapMethod& mapMethod = procMapMethod::pmAABB, + const procMapMethod mapMethod = procMapMethod::pmAABB, const bool interpAllPatches = true ); @@ -336,10 +336,10 @@ public: ( const polyMesh& src, const polyMesh& tgt, - const interpolationMethod& method, + const interpolationMethod method, const HashTable<word>& patchMap, const wordList& cuttingPatches, - const procMapMethod& mapMethod = procMapMethod::pmAABB, + const procMapMethod mapMethod = procMapMethod::pmAABB, const bool normalise = true ); @@ -353,7 +353,7 @@ public: const word& AMIMethodName, // boundary mapping const HashTable<word>& patchMap, const wordList& cuttingPatches, - const procMapMethod& mapMethod = procMapMethod::pmAABB, + const procMapMethod mapMethod = procMapMethod::pmAABB, const bool normalise = true ); diff --git a/src/sampling/meshToMesh/meshToMeshParallelOps.C b/src/sampling/meshToMesh/meshToMeshParallelOps.C index ed4c3efb38e78e58693a3bf646c3a314053276ce..f1a9d756b0cb971180194c2bb58c43c81847f1ec 100644 --- a/src/sampling/meshToMesh/meshToMeshParallelOps.C +++ b/src/sampling/meshToMesh/meshToMeshParallelOps.C @@ -114,6 +114,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap const polyMesh& tgt ) const { + // Uses linear construct order + const + mapDistributeBase::layoutTypes constructLayout = + mapDistributeBase::layoutTypes::linear; + switch (procMapMethod_) { case procMapMethod::pmLOD: @@ -139,7 +144,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap src.nCells() ); - return boxLOD.map(); + return boxLOD.map(constructLayout); break; } default: @@ -232,25 +237,10 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap } - labelList recvSizes; - Pstream::exchangeSizes(sendMap, recvSizes, UPstream::worldComm); - - // Uses linear receive order - labelListList constructMap(UPstream::nProcs()); - - label constructSize = 0; - forAll(constructMap, proci) - { - const label len = recvSizes[proci]; - constructMap[proci] = identity(len, constructSize); - constructSize += len; - } - return autoPtr<mapDistribute>::New ( - constructSize, - std::move(sendMap), - std::move(constructMap) + constructLayout, + std::move(sendMap) ); break; }