ENH: use mapDistribute linear construct order in a few places
- simplifies code by avoiding code duplication: * parLagrangianDistributor * meshToMesh (processorLOD and AABBTree methods) BUG: inconsistent mapping when using processorLOD boxes (fixes #2932) - internally the processorLODs createMap() method used a 'localFirst' layout whereas a 'linear' order is what is actually expected for the meshToMesh mapping. This will cause of incorrect behaviour if using processorLOD instead of AABBTree. A dormant bug since processorLOD is not currently selectable.
This commit is contained in:
parent
0d456a4c66
commit
a1e34bb251
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -144,10 +144,10 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
|
|||||||
|
|
||||||
const label oldLpi = lpi.size();
|
const label oldLpi = lpi.size();
|
||||||
|
|
||||||
labelListList subMap;
|
labelListList sendMap;
|
||||||
|
|
||||||
// Allocate transfer buffers
|
// Transfer buffers
|
||||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
|
||||||
|
|
||||||
{
|
{
|
||||||
// List of lists of particles to be transferred for all of the
|
// 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
|
// Per processor the indices of the particles to send
|
||||||
subMap = invertOneToMany(Pstream::nProcs(), destProc);
|
sendMap = invertOneToMany(UPstream::nProcs(), destProc);
|
||||||
|
|
||||||
|
|
||||||
// Stream into send buffers
|
// Stream into send buffers
|
||||||
@ -282,29 +282,12 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
|
|||||||
lpi.rename(cloudName);
|
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
|
return autoPtr<mapDistributeBase>::New
|
||||||
(
|
(
|
||||||
constructSize,
|
mapDistributeBase::layoutTypes::linear,
|
||||||
std::move(subMap),
|
std::move(sendMap)
|
||||||
std::move(constructMap)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,28 +51,27 @@ void Foam::processorLODs::box::writeBoxes
|
|||||||
const label iter
|
const label iter
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
static label time = 0;
|
static label timeIndex = 0;
|
||||||
|
|
||||||
OFstream os
|
OFstream os
|
||||||
(
|
(
|
||||||
"processor" + Foam::name(Pstream::myProcNo())
|
"processor" + Foam::name(Pstream::myProcNo())
|
||||||
+ "_time" + Foam::name(time)
|
+ "_time" + Foam::name(timeIndex)
|
||||||
+ "_iter" + Foam::name(iter) + ".obj"
|
+ "_iter" + Foam::name(iter) + ".obj"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
++timeIndex;
|
||||||
|
|
||||||
label verti = 0;
|
label verti = 0;
|
||||||
for (const int proci : Pstream::allProcs())
|
for (const int proci : UPstream::allProcs())
|
||||||
{
|
{
|
||||||
if (proci == Pstream::myProcNo())
|
if (proci == UPstream::myProcNo())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicList<treeBoundBox>& procBoxes = fixedBoxes[proci];
|
for (const treeBoundBox& bb : fixedBoxes[proci])
|
||||||
forAll(procBoxes, boxi)
|
|
||||||
{
|
{
|
||||||
const treeBoundBox& bb = procBoxes[boxi];
|
|
||||||
|
|
||||||
// Write the points
|
// Write the points
|
||||||
const pointField pts(bb.points());
|
const pointField pts(bb.points());
|
||||||
meshTools::writeOBJ(os, pts);
|
meshTools::writeOBJ(os, pts);
|
||||||
@ -90,8 +89,6 @@ void Foam::processorLODs::box::writeBoxes
|
|||||||
verti += pts.size();
|
verti += pts.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -418,7 +415,8 @@ bool Foam::processorLODs::box::doRefineBoxes
|
|||||||
Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::box::createMap
|
Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::box::createMap
|
||||||
(
|
(
|
||||||
const label nSrcElems,
|
const label nSrcElems,
|
||||||
const label nTgtElems
|
const label nTgtElems,
|
||||||
|
const mapDistributeBase::layoutTypes constructLayout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Store elements to send - will be used to build the mapDistribute
|
// 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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,8 +38,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef processorLODs_box
|
#ifndef Foam_processorLODs_box
|
||||||
#define processorLODs_box
|
#define Foam_processorLODs_box
|
||||||
|
|
||||||
#include "processorLOD.H"
|
#include "processorLOD.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
@ -62,7 +62,7 @@ class box
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
// Flags to indicate what to do with a box
|
// Flags to indicate what to do with a box
|
||||||
|
|
||||||
@ -112,8 +112,11 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
virtual boundBox calcSrcBox(const label srcObji) const = 0;
|
//- The local boundBox associated with given source object
|
||||||
virtual boundBox calcTgtBox(const label tgtObji) const = 0;
|
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
|
//- Set the box refinement flags
|
||||||
void setRefineFlags
|
void setRefineFlags
|
||||||
@ -158,10 +161,13 @@ protected:
|
|||||||
List<DynamicList<treeBoundBox>>& fixedBoxes
|
List<DynamicList<treeBoundBox>>& fixedBoxes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Return the parallel distribution map
|
||||||
|
//- (often linear construct order)
|
||||||
autoPtr<mapDistribute> createMap
|
autoPtr<mapDistribute> createMap
|
||||||
(
|
(
|
||||||
const label nSrcElems,
|
const label nSrcElems,
|
||||||
const label nTgtElems
|
const label nTgtElems,
|
||||||
|
const mapDistributeBase::layoutTypes constructLayout
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -170,15 +176,18 @@ public:
|
|||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("box");
|
TypeName("box");
|
||||||
|
|
||||||
//- Construct from list of points
|
// Constructors
|
||||||
box
|
|
||||||
(
|
//- Construct from list of points for source and target
|
||||||
const UList<point>& srcPoints,
|
box
|
||||||
const UList<point>& tgtPoints,
|
(
|
||||||
const label maxObjectsPerLeaf,
|
const UList<point>& srcPoints,
|
||||||
const label nObjectsOfType,
|
const UList<point>& tgtPoints,
|
||||||
const label nRefineIterMax = 100
|
const label maxObjectsPerLeaf,
|
||||||
);
|
const label nObjectsOfType,
|
||||||
|
const label nRefineIterMax = 100
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~box() = default;
|
virtual ~box() = default;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,12 +39,12 @@ namespace processorLODs
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::boundBox Foam::processorLODs::cellBox::calcSrcBox
|
Foam::treeBoundBox Foam::processorLODs::cellBox::calcSrcBox
|
||||||
(
|
(
|
||||||
const label srcObji
|
const label srcObji
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
boundBox bb;
|
treeBoundBox bb;
|
||||||
|
|
||||||
for (const label facei : srcCells_[srcObji])
|
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 label tgtObji
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
boundBox bb;
|
treeBoundBox bb;
|
||||||
|
|
||||||
for (const label facei : tgtCells_[tgtObji])
|
for (const label facei : tgtCells_[tgtObji])
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ Foam::processorLODs::cellBox::cellBox
|
|||||||
const label nRefineIterMax
|
const label nRefineIterMax
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faceBox
|
processorLODs::faceBox
|
||||||
(
|
(
|
||||||
srcFaces,
|
srcFaces,
|
||||||
srcPoints,
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,8 +38,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef processorLODs_cellBox
|
#ifndef Foam_processorLODs_cellBox
|
||||||
#define processorLODs_cellBox
|
#define Foam_processorLODs_cellBox
|
||||||
|
|
||||||
#include "faceBox.H"
|
#include "faceBox.H"
|
||||||
#include "cellList.H"
|
#include "cellList.H"
|
||||||
@ -48,7 +48,6 @@ Description
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace processorLODs
|
namespace processorLODs
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -58,23 +57,27 @@ namespace processorLODs
|
|||||||
|
|
||||||
class cellBox
|
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_;
|
const cellList& srcCells_;
|
||||||
|
|
||||||
//- Reference to the target face list
|
//- Reference to the target cell list
|
||||||
const cellList& tgtCells_;
|
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:
|
public:
|
||||||
@ -82,19 +85,22 @@ public:
|
|||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("box");
|
TypeName("box");
|
||||||
|
|
||||||
//- Construct from list of points
|
// Constructors
|
||||||
cellBox
|
|
||||||
(
|
//- Construct from list of points/faces/cells for source and target
|
||||||
const cellList& srcCells,
|
cellBox
|
||||||
const faceList& srcFaces,
|
(
|
||||||
const UList<point>& srcPoints,
|
const cellList& srcCells,
|
||||||
const cellList& tgtCells,
|
const faceList& srcFaces,
|
||||||
const faceList& tgtFaces,
|
const UList<point>& srcPoints,
|
||||||
const UList<point>& tgtPoints,
|
const cellList& tgtCells,
|
||||||
const label maxObjectsPerLeaf,
|
const faceList& tgtFaces,
|
||||||
const label nObjectsOfType,
|
const UList<point>& tgtPoints,
|
||||||
const label nRefineIterMax = 100
|
const label maxObjectsPerLeaf,
|
||||||
);
|
const label nObjectsOfType,
|
||||||
|
const label nRefineIterMax = 100
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~cellBox() = default;
|
virtual ~cellBox() = default;
|
||||||
@ -103,16 +109,17 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the parallel distribution map
|
//- 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 processorLODs
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,21 +38,21 @@ namespace processorLODs
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::boundBox Foam::processorLODs::faceBox::calcSrcBox
|
Foam::treeBoundBox Foam::processorLODs::faceBox::calcSrcBox
|
||||||
(
|
(
|
||||||
const label srcObji
|
const label srcObji
|
||||||
) const
|
) 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 label tgtObji
|
||||||
) const
|
) 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
|
const label nRefineIterMax
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
box(srcPoints, tgtPoints, maxObjectsPerLeaf, nObjectsOfType),
|
processorLODs::box(srcPoints, tgtPoints, maxObjectsPerLeaf, nObjectsOfType),
|
||||||
srcFaces_(srcFaces),
|
srcFaces_(srcFaces),
|
||||||
tgtFaces_(tgtFaces)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,8 +38,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef processorLODs_faceBox
|
#ifndef Foam_processorLODs_faceBox
|
||||||
#define processorLODs_faceBox
|
#define Foam_processorLODs_faceBox
|
||||||
|
|
||||||
#include "box.H"
|
#include "box.H"
|
||||||
|
|
||||||
@ -47,7 +47,6 @@ Description
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace processorLODs
|
namespace processorLODs
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -57,11 +56,11 @@ namespace processorLODs
|
|||||||
|
|
||||||
class faceBox
|
class faceBox
|
||||||
:
|
:
|
||||||
public box
|
public processorLODs::box
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
//- Reference to the source face list
|
//- Reference to the source face list
|
||||||
const faceList& srcFaces_;
|
const faceList& srcFaces_;
|
||||||
@ -72,8 +71,11 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
virtual boundBox calcSrcBox(const label srcObji) const;
|
//- The local boundBox associated with given source object
|
||||||
virtual boundBox calcTgtBox(const label tgtObji) const;
|
virtual treeBoundBox calcSrcBox(const label srcObji) const;
|
||||||
|
|
||||||
|
//- The local boundBox associated with given target object
|
||||||
|
virtual treeBoundBox calcTgtBox(const label tgtObji) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -81,17 +83,20 @@ public:
|
|||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("box");
|
TypeName("box");
|
||||||
|
|
||||||
//- Construct from list of points
|
// Constructors
|
||||||
faceBox
|
|
||||||
(
|
//- Construct from list of points/faces for source and target
|
||||||
const faceList& srcFaces,
|
faceBox
|
||||||
const UList<point>& srcPoints,
|
(
|
||||||
const faceList& tgtFaces,
|
const faceList& srcFaces,
|
||||||
const UList<point>& tgtPoints,
|
const UList<point>& srcPoints,
|
||||||
const label maxObjectsPerLeaf,
|
const faceList& tgtFaces,
|
||||||
const label nObjectsOfType,
|
const UList<point>& tgtPoints,
|
||||||
const label nRefineIterMax = 100
|
const label maxObjectsPerLeaf,
|
||||||
);
|
const label nObjectsOfType,
|
||||||
|
const label nRefineIterMax = 100
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~faceBox() = default;
|
virtual ~faceBox() = default;
|
||||||
@ -100,16 +105,17 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the parallel distribution map
|
//- 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 processorLODs
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
@ -38,7 +38,7 @@ Foam::processorLOD::processorLOD
|
|||||||
(
|
(
|
||||||
const label maxObjectsPerLeaf,
|
const label maxObjectsPerLeaf,
|
||||||
const label nObjectsOfType
|
const label nObjectsOfType
|
||||||
)
|
) noexcept
|
||||||
:
|
:
|
||||||
maxObjectsPerLeaf_(maxObjectsPerLeaf),
|
maxObjectsPerLeaf_(maxObjectsPerLeaf),
|
||||||
nObjectsOfType_(nObjectsOfType)
|
nObjectsOfType_(nObjectsOfType)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,17 +33,19 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef processorLOD_H
|
#ifndef Foam_processorLOD_H
|
||||||
#define processorLOD_H
|
#define Foam_processorLOD_H
|
||||||
|
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
|
#include "mapDistributeBase.H" // For layoutTypes
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
class mapDistribute;
|
class mapDistribute;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -52,16 +54,15 @@ class mapDistribute;
|
|||||||
|
|
||||||
class processorLOD
|
class processorLOD
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
//- Maximum number of objects per leaf
|
//- Maximum number of objects per leaf
|
||||||
label maxObjectsPerLeaf_;
|
label maxObjectsPerLeaf_;
|
||||||
|
|
||||||
//- Number of objects of this type, e.g. number of faces/cells on this
|
//- Number of objects of this type.
|
||||||
//- processor
|
//- e.g. number of faces/cells on this processor
|
||||||
label nObjectsOfType_;
|
label nObjectsOfType_;
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ public:
|
|||||||
(
|
(
|
||||||
const label maxObjectsPerLeaf,
|
const label maxObjectsPerLeaf,
|
||||||
const label nObjectsOfType
|
const label nObjectsOfType
|
||||||
);
|
) noexcept;
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~processorLOD() = default;
|
virtual ~processorLOD() = default;
|
||||||
@ -84,7 +85,12 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the parallel distribution map
|
//- 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -846,8 +846,8 @@ Foam::meshToMesh::meshToMesh
|
|||||||
(
|
(
|
||||||
const polyMesh& src,
|
const polyMesh& src,
|
||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const interpolationMethod& method,
|
const interpolationMethod method,
|
||||||
const procMapMethod& mapMethod,
|
const procMapMethod mapMethod,
|
||||||
bool interpAllPatches
|
bool interpAllPatches
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -884,7 +884,7 @@ Foam::meshToMesh::meshToMesh
|
|||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const word& methodName,
|
const word& methodName,
|
||||||
const word& AMIMethodName,
|
const word& AMIMethodName,
|
||||||
const procMapMethod& mapMethod,
|
const procMapMethod mapMethod,
|
||||||
bool interpAllPatches
|
bool interpAllPatches
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -914,10 +914,10 @@ Foam::meshToMesh::meshToMesh
|
|||||||
(
|
(
|
||||||
const polyMesh& src,
|
const polyMesh& src,
|
||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const interpolationMethod& method,
|
const interpolationMethod method,
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
const procMapMethod& mapMethod,
|
const procMapMethod mapMethod,
|
||||||
const bool normalise
|
const bool normalise
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -956,7 +956,7 @@ Foam::meshToMesh::meshToMesh
|
|||||||
const word& AMIMethodName, // boundary mapping
|
const word& AMIMethodName, // boundary mapping
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
const procMapMethod& mapMethod,
|
const procMapMethod mapMethod,
|
||||||
const bool normalise
|
const bool normalise
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -315,8 +315,8 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& src,
|
const polyMesh& src,
|
||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const interpolationMethod& method,
|
const interpolationMethod method,
|
||||||
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
const procMapMethod mapMethod = procMapMethod::pmAABB,
|
||||||
const bool interpAllPatches = true
|
const bool interpAllPatches = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ public:
|
|||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const word& methodName, // internal mapping
|
const word& methodName, // internal mapping
|
||||||
const word& AMIMethodName, // boundary mapping
|
const word& AMIMethodName, // boundary mapping
|
||||||
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
const procMapMethod mapMethod = procMapMethod::pmAABB,
|
||||||
const bool interpAllPatches = true
|
const bool interpAllPatches = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -336,10 +336,10 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& src,
|
const polyMesh& src,
|
||||||
const polyMesh& tgt,
|
const polyMesh& tgt,
|
||||||
const interpolationMethod& method,
|
const interpolationMethod method,
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
const procMapMethod mapMethod = procMapMethod::pmAABB,
|
||||||
const bool normalise = true
|
const bool normalise = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ public:
|
|||||||
const word& AMIMethodName, // boundary mapping
|
const word& AMIMethodName, // boundary mapping
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
const procMapMethod& mapMethod = procMapMethod::pmAABB,
|
const procMapMethod mapMethod = procMapMethod::pmAABB,
|
||||||
const bool normalise = true
|
const bool normalise = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -114,6 +114,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
const polyMesh& tgt
|
const polyMesh& tgt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
// Uses linear construct order
|
||||||
|
const
|
||||||
|
mapDistributeBase::layoutTypes constructLayout =
|
||||||
|
mapDistributeBase::layoutTypes::linear;
|
||||||
|
|
||||||
switch (procMapMethod_)
|
switch (procMapMethod_)
|
||||||
{
|
{
|
||||||
case procMapMethod::pmLOD:
|
case procMapMethod::pmLOD:
|
||||||
@ -139,7 +144,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
|||||||
src.nCells()
|
src.nCells()
|
||||||
);
|
);
|
||||||
|
|
||||||
return boxLOD.map();
|
return boxLOD.map(constructLayout);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
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
|
return autoPtr<mapDistribute>::New
|
||||||
(
|
(
|
||||||
constructSize,
|
constructLayout,
|
||||||
std::move(sendMap),
|
std::move(sendMap)
|
||||||
std::move(constructMap)
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user