mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
unsynchronised looping
This commit is contained in:
@ -488,17 +488,18 @@ labelList getNonRegionCells(const labelList& cellRegion, const label regionI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get per region-region interface the sizes.
|
// Get per region-region interface the sizes. If sumParallel sums sizes.
|
||||||
// If sumParallel does merge.
|
// Returns interfaces as straight list for looping in identical order.
|
||||||
EdgeMap<label> getInterfaceSizes
|
void getInterfaceSizes
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& cellRegion,
|
const labelList& cellRegion,
|
||||||
const bool sumParallel
|
const bool sumParallel,
|
||||||
|
|
||||||
|
edgeList& interfaces,
|
||||||
|
EdgeMap<label>& interfaceSizes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EdgeMap<label> interfaceSizes;
|
|
||||||
|
|
||||||
forAll(mesh.faceNeighbour(), faceI)
|
forAll(mesh.faceNeighbour(), faceI)
|
||||||
{
|
{
|
||||||
label ownRegion = cellRegion[mesh.faceOwner()[faceI]];
|
label ownRegion = cellRegion[mesh.faceOwner()[faceI]];
|
||||||
@ -585,7 +586,12 @@ EdgeMap<label> getInterfaceSizes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return interfaceSizes;
|
// Make sure all processors have interfaces in same order
|
||||||
|
interfaces = interfaceSizes.toc();
|
||||||
|
if (sumParallel)
|
||||||
|
{
|
||||||
|
Pstream::scatter(interfaces);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -705,11 +711,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
|||||||
|
|
||||||
if (otherRegion != -1)
|
if (otherRegion != -1)
|
||||||
{
|
{
|
||||||
edge interface
|
edge interface(regionI, otherRegion);
|
||||||
(
|
|
||||||
min(regionI, otherRegion),
|
|
||||||
max(regionI, otherRegion)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Find the patch.
|
// Find the patch.
|
||||||
if (regionI < otherRegion)
|
if (regionI < otherRegion)
|
||||||
@ -848,6 +850,7 @@ void createAndWriteRegion
|
|||||||
|
|
||||||
|
|
||||||
const polyBoundaryMesh& newPatches = newMesh().boundaryMesh();
|
const polyBoundaryMesh& newPatches = newMesh().boundaryMesh();
|
||||||
|
newPatches.checkParallelSync(true);
|
||||||
|
|
||||||
// Delete empty patches
|
// Delete empty patches
|
||||||
// ~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -863,15 +866,14 @@ void createAndWriteRegion
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = newPatches[patchI];
|
const polyPatch& pp = newPatches[patchI];
|
||||||
|
|
||||||
if
|
if (!isA<processorPolyPatch>(pp))
|
||||||
(
|
{
|
||||||
!isA<processorPolyPatch>(pp)
|
if (returnReduce(pp.size(), sumOp<label>()) > 0)
|
||||||
&& returnReduce(pp.size(), sumOp<label>()) > 0
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
oldToNew[patchI] = newI++;
|
oldToNew[patchI] = newI++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Same for processor patches (but need no reduction)
|
// Same for processor patches (but need no reduction)
|
||||||
forAll(newPatches, patchI)
|
forAll(newPatches, patchI)
|
||||||
@ -983,10 +985,15 @@ void createAndWriteRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create for every region-region interface with non-zero size two patches.
|
||||||
|
// First one is for minimumregion to maximumregion.
|
||||||
|
// Note that patches get created in same order on all processors (if parallel)
|
||||||
|
// since looping over synchronised 'interfaces'.
|
||||||
EdgeMap<label> addRegionPatches
|
EdgeMap<label> addRegionPatches
|
||||||
(
|
(
|
||||||
fvMesh& mesh,
|
fvMesh& mesh,
|
||||||
const regionSplit& cellRegion,
|
const regionSplit& cellRegion,
|
||||||
|
const edgeList& interfaces,
|
||||||
const EdgeMap<label>& interfaceSizes,
|
const EdgeMap<label>& interfaceSizes,
|
||||||
const wordList& regionNames
|
const wordList& regionNames
|
||||||
)
|
)
|
||||||
@ -998,15 +1005,12 @@ EdgeMap<label> addRegionPatches
|
|||||||
|
|
||||||
EdgeMap<label> interfaceToPatch(cellRegion.nRegions());
|
EdgeMap<label> interfaceToPatch(cellRegion.nRegions());
|
||||||
|
|
||||||
// Keep start of added patches for later.
|
forAll(interfaces, interI)
|
||||||
label minAddedPatchI = labelMax;
|
|
||||||
|
|
||||||
forAllConstIter(EdgeMap<label>, interfaceSizes, iter)
|
|
||||||
{
|
{
|
||||||
if (iter() > 0)
|
const edge& e = interfaces[interI];
|
||||||
{
|
|
||||||
const edge& e = iter.key();
|
|
||||||
|
|
||||||
|
if (interfaceSizes[e] > 0)
|
||||||
|
{
|
||||||
label patchI = addPatch
|
label patchI = addPatch
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
@ -1025,12 +1029,9 @@ EdgeMap<label> addRegionPatches
|
|||||||
<< " " << mesh.boundaryMesh()[patchI].name()
|
<< " " << mesh.boundaryMesh()[patchI].name()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
interfaceToPatch.insert(iter.key(), patchI);
|
interfaceToPatch.insert(e, patchI);
|
||||||
|
|
||||||
minAddedPatchI = min(minAddedPatchI, patchI);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Info<< "minAddedPatchI:" << minAddedPatchI << endl;
|
|
||||||
return interfaceToPatch;
|
return interfaceToPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1348,24 +1349,26 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Sizes of interface between regions. From pair of regions to number of
|
// Sizes of interface between regions. From pair of regions to number of
|
||||||
// faces.
|
// faces.
|
||||||
EdgeMap<label> interfaceSizes
|
edgeList interfaces;
|
||||||
(
|
EdgeMap<label> interfaceSizes;
|
||||||
getInterfaceSizes
|
getInterfaceSizes
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
cellRegion,
|
cellRegion,
|
||||||
true // sum in parallel?
|
true, // sum in parallel?
|
||||||
)
|
|
||||||
|
interfaces,
|
||||||
|
interfaceSizes
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Region\tRegion\tFaces" << nl
|
Info<< "Region\tRegion\tFaces" << nl
|
||||||
<< "------\t------\t-----" << endl;
|
<< "------\t------\t-----" << endl;
|
||||||
|
|
||||||
forAllConstIter(EdgeMap<label>, interfaceSizes, iter)
|
forAll(interfaces, interI)
|
||||||
{
|
{
|
||||||
const edge& e = iter.key();
|
const edge& e = interfaces[interI];
|
||||||
|
|
||||||
Info<< e[0] << '\t' << e[1] << '\t' << iter() << nl;
|
Info<< e[0] << '\t' << e[1] << '\t' << interfaceSizes[e] << nl;
|
||||||
}
|
}
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
@ -1511,6 +1514,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
cellRegion,
|
cellRegion,
|
||||||
|
interfaces,
|
||||||
interfaceSizes,
|
interfaceSizes,
|
||||||
regionNames
|
regionNames
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user