mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Standardized cell, patch, face and processor loop index names
This commit is contained in:
@ -103,8 +103,8 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
label& startSeedI
|
||||
)
|
||||
{
|
||||
label srcCellI = srcSeedI;
|
||||
label tgtCellI = tgtSeedI;
|
||||
label srcCelli = srcSeedI;
|
||||
label tgtCelli = tgtSeedI;
|
||||
|
||||
List<DynamicList<label>> srcToTgtAddr(src_.nCells());
|
||||
List<DynamicList<scalar>> srcToTgtWght(src_.nCells());
|
||||
@ -115,12 +115,12 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
// list of tgt cell neighbour cells
|
||||
DynamicList<label> nbrTgtCells(10);
|
||||
|
||||
// list of tgt cells currently visited for srcCellI to avoid multiple hits
|
||||
// list of tgt cells currently visited for srcCelli to avoid multiple hits
|
||||
DynamicList<label> visitedTgtCells(10);
|
||||
|
||||
// list to keep track of tgt cells used to seed src cells
|
||||
labelList seedCells(src_.nCells(), -1);
|
||||
seedCells[srcCellI] = tgtCellI;
|
||||
seedCells[srcCelli] = tgtCelli;
|
||||
|
||||
const scalarField& srcVol = src_.cellVolumes();
|
||||
|
||||
@ -130,27 +130,27 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
visitedTgtCells.clear();
|
||||
|
||||
// append initial target cell and neighbours
|
||||
nbrTgtCells.append(tgtCellI);
|
||||
appendNbrCells(tgtCellI, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
nbrTgtCells.append(tgtCelli);
|
||||
appendNbrCells(tgtCelli, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
|
||||
do
|
||||
{
|
||||
tgtCellI = nbrTgtCells.remove();
|
||||
visitedTgtCells.append(tgtCellI);
|
||||
tgtCelli = nbrTgtCells.remove();
|
||||
visitedTgtCells.append(tgtCelli);
|
||||
|
||||
scalar vol = interVol(srcCellI, tgtCellI);
|
||||
scalar vol = interVol(srcCelli, tgtCelli);
|
||||
|
||||
// accumulate addressing and weights for valid intersection
|
||||
if (vol/srcVol[srcCellI] > tolerance_)
|
||||
if (vol/srcVol[srcCelli] > tolerance_)
|
||||
{
|
||||
// store src/tgt cell pair
|
||||
srcToTgtAddr[srcCellI].append(tgtCellI);
|
||||
srcToTgtWght[srcCellI].append(vol);
|
||||
srcToTgtAddr[srcCelli].append(tgtCelli);
|
||||
srcToTgtWght[srcCelli].append(vol);
|
||||
|
||||
tgtToSrcAddr[tgtCellI].append(srcCellI);
|
||||
tgtToSrcWght[tgtCellI].append(vol);
|
||||
tgtToSrcAddr[tgtCelli].append(srcCelli);
|
||||
tgtToSrcWght[tgtCelli].append(vol);
|
||||
|
||||
appendNbrCells(tgtCellI, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
appendNbrCells(tgtCelli, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
|
||||
// accumulate intersection volume
|
||||
V_ += vol;
|
||||
@ -158,21 +158,21 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
}
|
||||
while (!nbrTgtCells.empty());
|
||||
|
||||
mapFlag[srcCellI] = false;
|
||||
mapFlag[srcCelli] = false;
|
||||
|
||||
// find new source seed cell
|
||||
setNextCells
|
||||
(
|
||||
startSeedI,
|
||||
srcCellI,
|
||||
tgtCellI,
|
||||
srcCelli,
|
||||
tgtCelli,
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
visitedTgtCells,
|
||||
seedCells
|
||||
);
|
||||
}
|
||||
while (srcCellI != -1);
|
||||
while (srcCelli != -1);
|
||||
|
||||
// transfer addressing into persistent storage
|
||||
forAll(srcToTgtCellAddr, i)
|
||||
@ -192,15 +192,15 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
void Foam::cellVolumeWeightMethod::setNextCells
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcCellI,
|
||||
label& tgtCellI,
|
||||
label& srcCelli,
|
||||
label& tgtCelli,
|
||||
const labelList& srcCellIDs,
|
||||
const boolList& mapFlag,
|
||||
const DynamicList<label>& visitedCells,
|
||||
labelList& seedCells
|
||||
) const
|
||||
{
|
||||
const labelList& srcNbrCells = src_.cellCells()[srcCellI];
|
||||
const labelList& srcNbrCells = src_.cellCells()[srcCelli];
|
||||
|
||||
// set possible seeds for later use by querying all src cell neighbours
|
||||
// with all visited target cells
|
||||
@ -221,8 +221,8 @@ void Foam::cellVolumeWeightMethod::setNextCells
|
||||
|
||||
if (!valuesSet)
|
||||
{
|
||||
srcCellI = cellS;
|
||||
tgtCellI = cellT;
|
||||
srcCelli = cellS;
|
||||
tgtCelli = cellT;
|
||||
valuesSet = true;
|
||||
}
|
||||
}
|
||||
@ -253,8 +253,8 @@ void Foam::cellVolumeWeightMethod::setNextCells
|
||||
|
||||
if (seedCells[cellS] != -1)
|
||||
{
|
||||
srcCellI = cellS;
|
||||
tgtCellI = seedCells[cellS];
|
||||
srcCelli = cellS;
|
||||
tgtCelli = seedCells[cellS];
|
||||
|
||||
return;
|
||||
}
|
||||
@ -274,8 +274,8 @@ void Foam::cellVolumeWeightMethod::setNextCells
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
startSeedI,
|
||||
srcCellI,
|
||||
tgtCellI
|
||||
srcCelli,
|
||||
tgtCelli
|
||||
);
|
||||
|
||||
if (restart)
|
||||
@ -286,8 +286,8 @@ void Foam::cellVolumeWeightMethod::setNextCells
|
||||
}
|
||||
|
||||
// if we have got to here, there are no more src/tgt cell intersections
|
||||
srcCellI = -1;
|
||||
tgtCellI = -1;
|
||||
srcCelli = -1;
|
||||
tgtCelli = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,8 +85,8 @@ protected:
|
||||
void setNextCells
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcCellI,
|
||||
label& tgtCellI,
|
||||
label& srcCelli,
|
||||
label& tgtCelli,
|
||||
const labelList& srcCellIDs,
|
||||
const boolList& mapFlag,
|
||||
const DynamicList<label>& visitedCells,
|
||||
|
||||
@ -40,14 +40,14 @@ namespace Foam
|
||||
|
||||
bool Foam::directMethod::intersect
|
||||
(
|
||||
const label srcCellI,
|
||||
const label tgtCellI
|
||||
const label srcCelli,
|
||||
const label tgtCelli
|
||||
) const
|
||||
{
|
||||
return tgt_.pointInCell
|
||||
(
|
||||
src_.cellCentres()[srcCellI],
|
||||
tgtCellI,
|
||||
src_.cellCentres()[srcCelli],
|
||||
tgtCelli,
|
||||
polyMesh::FACE_PLANES
|
||||
);
|
||||
}
|
||||
@ -124,20 +124,20 @@ void Foam::directMethod::calculateAddressing
|
||||
const scalarField& srcVc = src_.cellVolumes();
|
||||
const scalarField& tgtVc = tgt_.cellVolumes();
|
||||
|
||||
label srcCellI = srcSeedI;
|
||||
label tgtCellI = tgtSeedI;
|
||||
label srcCelli = srcSeedI;
|
||||
label tgtCelli = tgtSeedI;
|
||||
|
||||
do
|
||||
{
|
||||
// store src/tgt cell pair
|
||||
srcToTgt[srcCellI].append(tgtCellI);
|
||||
tgtToSrc[tgtCellI].append(srcCellI);
|
||||
srcToTgt[srcCelli].append(tgtCelli);
|
||||
tgtToSrc[tgtCelli].append(srcCelli);
|
||||
|
||||
// mark source cell srcSeedI as matched
|
||||
mapFlag[srcCellI] = false;
|
||||
mapFlag[srcCelli] = false;
|
||||
|
||||
// accumulate intersection volume
|
||||
V_ += srcVc[srcCellI];
|
||||
V_ += srcVc[srcCelli];
|
||||
|
||||
// find new source seed cell
|
||||
appendToDirectSeeds
|
||||
@ -145,11 +145,11 @@ void Foam::directMethod::calculateAddressing
|
||||
mapFlag,
|
||||
srcTgtSeed,
|
||||
srcSeeds,
|
||||
srcCellI,
|
||||
tgtCellI
|
||||
srcCelli,
|
||||
tgtCelli
|
||||
);
|
||||
}
|
||||
while (srcCellI >= 0);
|
||||
while (srcCelli >= 0);
|
||||
|
||||
// transfer addressing into persistent storage
|
||||
forAll(srcToTgtCellAddr, i)
|
||||
|
||||
@ -59,8 +59,8 @@ protected:
|
||||
//- Return the true if cells intersect
|
||||
virtual bool intersect
|
||||
(
|
||||
const label srcCellI,
|
||||
const label tgtCellI
|
||||
const label srcCelli,
|
||||
const label tgtCelli
|
||||
) const;
|
||||
|
||||
//- Find indices of overlapping cells in src and tgt meshes - returns
|
||||
|
||||
@ -109,35 +109,35 @@ void Foam::mapNearestMethod::calculateAddressing
|
||||
const scalarField& tgtVc = tgt_.cellVolumes();
|
||||
|
||||
{
|
||||
label srcCellI = srcSeedI;
|
||||
label tgtCellI = tgtSeedI;
|
||||
label srcCelli = srcSeedI;
|
||||
label tgtCelli = tgtSeedI;
|
||||
|
||||
do
|
||||
{
|
||||
// find nearest tgt cell
|
||||
findNearestCell(src_, tgt_, srcCellI, tgtCellI);
|
||||
findNearestCell(src_, tgt_, srcCelli, tgtCelli);
|
||||
|
||||
// store src/tgt cell pair
|
||||
srcToTgt[srcCellI].append(tgtCellI);
|
||||
tgtToSrc[tgtCellI].append(srcCellI);
|
||||
srcToTgt[srcCelli].append(tgtCelli);
|
||||
tgtToSrc[tgtCelli].append(srcCelli);
|
||||
|
||||
// mark source cell srcCellI and tgtCellI as matched
|
||||
mapFlag[srcCellI] = false;
|
||||
// mark source cell srcCelli and tgtCelli as matched
|
||||
mapFlag[srcCelli] = false;
|
||||
|
||||
// accumulate intersection volume
|
||||
V_ += srcVc[srcCellI];
|
||||
V_ += srcVc[srcCelli];
|
||||
|
||||
// find new source cell
|
||||
setNextNearestCells
|
||||
(
|
||||
startSeedI,
|
||||
srcCellI,
|
||||
tgtCellI,
|
||||
srcCelli,
|
||||
tgtCelli,
|
||||
mapFlag,
|
||||
srcCellIDs
|
||||
);
|
||||
}
|
||||
while (srcCellI >= 0);
|
||||
while (srcCelli >= 0);
|
||||
}
|
||||
|
||||
// for the case of multiple source cells per target cell, select the
|
||||
@ -145,16 +145,16 @@ void Foam::mapNearestMethod::calculateAddressing
|
||||
const vectorField& srcCc = src_.cellCentres();
|
||||
const vectorField& tgtCc = tgt_.cellCentres();
|
||||
|
||||
forAll(tgtToSrc, targetCellI)
|
||||
forAll(tgtToSrc, targetCelli)
|
||||
{
|
||||
if (tgtToSrc[targetCellI].size() > 1)
|
||||
if (tgtToSrc[targetCelli].size() > 1)
|
||||
{
|
||||
const vector& tgtC = tgtCc[targetCellI];
|
||||
const vector& tgtC = tgtCc[targetCelli];
|
||||
|
||||
DynamicList<label>& srcCells = tgtToSrc[targetCellI];
|
||||
DynamicList<label>& srcCells = tgtToSrc[targetCelli];
|
||||
|
||||
label srcCellI = srcCells[0];
|
||||
scalar d = magSqr(tgtC - srcCc[srcCellI]);
|
||||
label srcCelli = srcCells[0];
|
||||
scalar d = magSqr(tgtC - srcCc[srcCelli]);
|
||||
|
||||
for (label i = 1; i < srcCells.size(); i++)
|
||||
{
|
||||
@ -163,26 +163,26 @@ void Foam::mapNearestMethod::calculateAddressing
|
||||
if (dNew < d)
|
||||
{
|
||||
d = dNew;
|
||||
srcCellI = srcI;
|
||||
srcCelli = srcI;
|
||||
}
|
||||
}
|
||||
|
||||
srcCells.clear();
|
||||
srcCells.append(srcCellI);
|
||||
srcCells.append(srcCelli);
|
||||
}
|
||||
}
|
||||
|
||||
// If there are more target cells than source cells, some target cells
|
||||
// might not yet be mapped
|
||||
forAll(tgtToSrc, tgtCellI)
|
||||
forAll(tgtToSrc, tgtCelli)
|
||||
{
|
||||
if (tgtToSrc[tgtCellI].empty())
|
||||
if (tgtToSrc[tgtCelli].empty())
|
||||
{
|
||||
label srcCellI = findMappedSrcCell(tgtCellI, tgtToSrc);
|
||||
label srcCelli = findMappedSrcCell(tgtCelli, tgtToSrc);
|
||||
|
||||
findNearestCell(tgt_, src_, tgtCellI, srcCellI);
|
||||
findNearestCell(tgt_, src_, tgtCelli, srcCelli);
|
||||
|
||||
tgtToSrc[tgtCellI].append(srcCellI);
|
||||
tgtToSrc[tgtCelli].append(srcCelli);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,21 +241,21 @@ void Foam::mapNearestMethod::findNearestCell
|
||||
void Foam::mapNearestMethod::setNextNearestCells
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcCellI,
|
||||
label& tgtCellI,
|
||||
label& srcCelli,
|
||||
label& tgtCelli,
|
||||
boolList& mapFlag,
|
||||
const labelList& srcCellIDs
|
||||
) const
|
||||
{
|
||||
const labelList& srcNbr = src_.cellCells()[srcCellI];
|
||||
const labelList& srcNbr = src_.cellCells()[srcCelli];
|
||||
|
||||
srcCellI = -1;
|
||||
srcCelli = -1;
|
||||
forAll(srcNbr, i)
|
||||
{
|
||||
label celli = srcNbr[i];
|
||||
if (mapFlag[celli])
|
||||
{
|
||||
srcCellI = celli;
|
||||
srcCelli = celli;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -275,26 +275,26 @@ void Foam::mapNearestMethod::setNextNearestCells
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
startSeedI,
|
||||
srcCellI,
|
||||
tgtCellI
|
||||
srcCelli,
|
||||
tgtCelli
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::mapNearestMethod::findMappedSrcCell
|
||||
(
|
||||
const label tgtCellI,
|
||||
const label tgtCelli,
|
||||
const List<DynamicList<label>>& tgtToSrc
|
||||
) const
|
||||
{
|
||||
DynamicList<label> testCells(10);
|
||||
DynamicList<label> visitedCells(10);
|
||||
|
||||
testCells.append(tgtCellI);
|
||||
testCells.append(tgtCelli);
|
||||
|
||||
do
|
||||
{
|
||||
// search target tgtCellI neighbours for match with source cell
|
||||
// search target tgtCelli neighbours for match with source cell
|
||||
label tgtI = testCells.remove();
|
||||
|
||||
if (findIndex(visitedCells, tgtI) == -1)
|
||||
|
||||
@ -98,16 +98,16 @@ protected:
|
||||
virtual void setNextNearestCells
|
||||
(
|
||||
label& startSeedI,
|
||||
label& srcCellI,
|
||||
label& tgtCellI,
|
||||
label& srcCelli,
|
||||
label& tgtCelli,
|
||||
boolList& mapFlag,
|
||||
const labelList& srcCellIDs
|
||||
) const;
|
||||
|
||||
//- Find a source cell mapped to target cell tgtCellI
|
||||
//- Find a source cell mapped to target cell tgtCelli
|
||||
virtual label findMappedSrcCell
|
||||
(
|
||||
const label tgtCellI,
|
||||
const label tgtCelli,
|
||||
const List<DynamicList<label>>& tgtToSrc
|
||||
) const;
|
||||
|
||||
|
||||
@ -76,22 +76,22 @@ Foam::labelList Foam::meshToMeshMethod::maskCells() const
|
||||
|
||||
bool Foam::meshToMeshMethod::intersect
|
||||
(
|
||||
const label srcCellI,
|
||||
const label tgtCellI
|
||||
const label srcCelli,
|
||||
const label tgtCelli
|
||||
) const
|
||||
{
|
||||
scalar threshold = tolerance_*src_.cellVolumes()[srcCellI];
|
||||
scalar threshold = tolerance_*src_.cellVolumes()[srcCelli];
|
||||
|
||||
tetOverlapVolume overlapEngine;
|
||||
|
||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCellI]);
|
||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
||||
|
||||
return overlapEngine.cellCellOverlapMinDecomp
|
||||
(
|
||||
src_,
|
||||
srcCellI,
|
||||
srcCelli,
|
||||
tgt_,
|
||||
tgtCellI,
|
||||
tgtCelli,
|
||||
bbTgtCell,
|
||||
threshold
|
||||
);
|
||||
@ -100,20 +100,20 @@ bool Foam::meshToMeshMethod::intersect
|
||||
|
||||
Foam::scalar Foam::meshToMeshMethod::interVol
|
||||
(
|
||||
const label srcCellI,
|
||||
const label tgtCellI
|
||||
const label srcCelli,
|
||||
const label tgtCelli
|
||||
) const
|
||||
{
|
||||
tetOverlapVolume overlapEngine;
|
||||
|
||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCellI]);
|
||||
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
|
||||
|
||||
scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
|
||||
(
|
||||
src_,
|
||||
srcCellI,
|
||||
srcCelli,
|
||||
tgt_,
|
||||
tgtCellI,
|
||||
tgtCelli,
|
||||
bbTgtCell
|
||||
);
|
||||
|
||||
@ -134,15 +134,15 @@ void Foam::meshToMeshMethod::appendNbrCells
|
||||
// filter out cells already visited from cell neighbours
|
||||
forAll(nbrCells, i)
|
||||
{
|
||||
label nbrCellI = nbrCells[i];
|
||||
label nbrCelli = nbrCells[i];
|
||||
|
||||
if
|
||||
(
|
||||
(findIndex(visitedCells, nbrCellI) == -1)
|
||||
&& (findIndex(nbrCellIDs, nbrCellI) == -1)
|
||||
(findIndex(visitedCells, nbrCelli) == -1)
|
||||
&& (findIndex(nbrCellIDs, nbrCelli) == -1)
|
||||
)
|
||||
{
|
||||
nbrCellIDs.append(nbrCellI);
|
||||
nbrCellIDs.append(nbrCelli);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,21 +74,21 @@ protected:
|
||||
//- Return the true if cells intersect
|
||||
virtual bool intersect
|
||||
(
|
||||
const label srcCellI,
|
||||
const label tgtCellI
|
||||
const label srcCelli,
|
||||
const label tgtCelli
|
||||
) const;
|
||||
|
||||
//- Return the intersection volume between two cells
|
||||
virtual scalar interVol
|
||||
(
|
||||
const label srcCellI,
|
||||
const label tgtCellI
|
||||
const label srcCelli,
|
||||
const label tgtCelli
|
||||
) const;
|
||||
|
||||
//- Append target cell neihgbour cells to cellIDs list
|
||||
virtual void appendNbrCells
|
||||
(
|
||||
const label tgtCellI,
|
||||
const label tgtCelli,
|
||||
const polyMesh& mesh,
|
||||
const DynamicList<label>& visitedTgtCells,
|
||||
DynamicList<label>& nbrTgtCellIDs
|
||||
|
||||
@ -387,11 +387,11 @@ void Foam::meshToMesh::calculatePatchAMIs(const word& AMIMethodName)
|
||||
|
||||
forAll(srcPatchID_, i)
|
||||
{
|
||||
label srcPatchI = srcPatchID_[i];
|
||||
label tgtPatchI = tgtPatchID_[i];
|
||||
label srcPatchi = srcPatchID_[i];
|
||||
label tgtPatchi = tgtPatchID_[i];
|
||||
|
||||
const polyPatch& srcPP = srcRegion_.boundaryMesh()[srcPatchI];
|
||||
const polyPatch& tgtPP = tgtRegion_.boundaryMesh()[tgtPatchI];
|
||||
const polyPatch& srcPP = srcRegion_.boundaryMesh()[srcPatchi];
|
||||
const polyPatch& tgtPP = tgtRegion_.boundaryMesh()[tgtPatchi];
|
||||
|
||||
Info<< "Creating AMI between source patch " << srcPP.name()
|
||||
<< " and target patch " << tgtPP.name()
|
||||
@ -441,11 +441,11 @@ void Foam::meshToMesh::constructNoCuttingPatches
|
||||
{
|
||||
srcPatchID.append(pp.index());
|
||||
|
||||
label tgtPatchI = tgtBM.findPatchID(pp.name());
|
||||
label tgtPatchi = tgtBM.findPatchID(pp.name());
|
||||
|
||||
if (tgtPatchI != -1)
|
||||
if (tgtPatchi != -1)
|
||||
{
|
||||
tgtPatchID.append(tgtPatchI);
|
||||
tgtPatchID.append(tgtPatchi);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ Foam::label Foam::meshToMesh::calcDistribution
|
||||
const polyMesh& tgt
|
||||
) const
|
||||
{
|
||||
label procI = 0;
|
||||
label proci = 0;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
@ -60,7 +60,7 @@ Foam::label Foam::meshToMesh::calcDistribution
|
||||
|
||||
if (nHaveCells > 1)
|
||||
{
|
||||
procI = -1;
|
||||
proci = -1;
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
@ -69,16 +69,16 @@ Foam::label Foam::meshToMesh::calcDistribution
|
||||
}
|
||||
else if (nHaveCells == 1)
|
||||
{
|
||||
procI = findIndex(cellsPresentOnProc, 1);
|
||||
proci = findIndex(cellsPresentOnProc, 1);
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Meshes local to processor" << procI << endl;
|
||||
<< "Meshes local to processor" << proci << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return procI;
|
||||
return proci;
|
||||
}
|
||||
|
||||
|
||||
@ -93,13 +93,13 @@ Foam::label Foam::meshToMesh::calcOverlappingProcs
|
||||
|
||||
label nOverlaps = 0;
|
||||
|
||||
forAll(procBb, procI)
|
||||
forAll(procBb, proci)
|
||||
{
|
||||
const boundBox& bbp = procBb[procI];
|
||||
const boundBox& bbp = procBb[proci];
|
||||
|
||||
if (bbp.overlaps(bb))
|
||||
{
|
||||
overlaps[procI] = true;
|
||||
overlaps[proci] = true;
|
||||
nOverlaps++;
|
||||
}
|
||||
}
|
||||
@ -141,9 +141,9 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
InfoInFunction
|
||||
<< "Determining extent of src mesh per processor:" << nl
|
||||
<< "\tproc\tbb" << endl;
|
||||
forAll(procBb, procI)
|
||||
forAll(procBb, proci)
|
||||
{
|
||||
Info<< '\t' << procI << '\t' << procBb[procI] << endl;
|
||||
Info<< '\t' << proci << '\t' << procBb[proci] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,9 +160,9 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
List<DynamicList<label>> dynSendMap(Pstream::nProcs());
|
||||
label iniSize = floor(tgt.nCells()/Pstream::nProcs());
|
||||
|
||||
forAll(dynSendMap, procI)
|
||||
forAll(dynSendMap, proci)
|
||||
{
|
||||
dynSendMap[procI].setCapacity(iniSize);
|
||||
dynSendMap[proci].setCapacity(iniSize);
|
||||
}
|
||||
|
||||
// work array - whether src processor bb overlaps the tgt cell bounds
|
||||
@ -186,20 +186,20 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
// find the overlapping tgt cells on each src processor
|
||||
(void)calcOverlappingProcs(procBb, cellBb, procBbOverlaps);
|
||||
|
||||
forAll(procBbOverlaps, procI)
|
||||
forAll(procBbOverlaps, proci)
|
||||
{
|
||||
if (procBbOverlaps[procI])
|
||||
if (procBbOverlaps[proci])
|
||||
{
|
||||
dynSendMap[procI].append(celli);
|
||||
dynSendMap[proci].append(celli);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convert dynamicList to labelList
|
||||
sendMap.setSize(Pstream::nProcs());
|
||||
forAll(sendMap, procI)
|
||||
forAll(sendMap, proci)
|
||||
{
|
||||
sendMap[procI].transfer(dynSendMap[procI]);
|
||||
sendMap[proci].transfer(dynSendMap[proci]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,9 +208,9 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
{
|
||||
Pout<< "Of my " << cells.size() << " target cells I need to send to:"
|
||||
<< nl << "\tproc\tcells" << endl;
|
||||
forAll(sendMap, procI)
|
||||
forAll(sendMap, proci)
|
||||
{
|
||||
Pout<< '\t' << procI << '\t' << sendMap[procI].size() << endl;
|
||||
Pout<< '\t' << proci << '\t' << sendMap[proci].size() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,9 +218,9 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
// send over how many tgt cells I need to receive from each processor
|
||||
labelListList sendSizes(Pstream::nProcs());
|
||||
sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs());
|
||||
forAll(sendMap, procI)
|
||||
forAll(sendMap, proci)
|
||||
{
|
||||
sendSizes[Pstream::myProcNo()][procI] = sendMap[procI].size();
|
||||
sendSizes[Pstream::myProcNo()][proci] = sendMap[proci].size();
|
||||
}
|
||||
Pstream::gatherList(sendSizes);
|
||||
Pstream::scatterList(sendSizes);
|
||||
@ -230,15 +230,15 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
|
||||
labelListList constructMap(Pstream::nProcs());
|
||||
|
||||
label segmentI = 0;
|
||||
forAll(constructMap, procI)
|
||||
forAll(constructMap, proci)
|
||||
{
|
||||
// what I need to receive is what other processor is sending to me
|
||||
label nRecv = sendSizes[procI][Pstream::myProcNo()];
|
||||
constructMap[procI].setSize(nRecv);
|
||||
label nRecv = sendSizes[proci][Pstream::myProcNo()];
|
||||
constructMap[proci].setSize(nRecv);
|
||||
|
||||
for (label i = 0; i < nRecv; i++)
|
||||
{
|
||||
constructMap[procI][i] = segmentI++;
|
||||
constructMap[proci][i] = segmentI++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,9 +292,9 @@ void Foam::meshToMesh::distributeCells
|
||||
{
|
||||
// reverse cell map
|
||||
labelList reverseCellMap(tgtMesh.nCells(), -1);
|
||||
forAll(sendElems, subCellI)
|
||||
forAll(sendElems, subCelli)
|
||||
{
|
||||
reverseCellMap[sendElems[subCellI]] = subCellI;
|
||||
reverseCellMap[sendElems[subCelli]] = subCelli;
|
||||
}
|
||||
|
||||
DynamicList<face> subFaces(tgtMesh.nFaces());
|
||||
@ -368,7 +368,7 @@ void Foam::meshToMesh::distributeCells
|
||||
{
|
||||
const polyPatch& pp = tgtMesh.boundaryMesh()[patchi];
|
||||
|
||||
label nbrProcI = -1;
|
||||
label nbrProci = -1;
|
||||
|
||||
// store info for faces on processor patches
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
@ -376,7 +376,7 @@ void Foam::meshToMesh::distributeCells
|
||||
const processorPolyPatch& ppp =
|
||||
dynamic_cast<const processorPolyPatch&>(pp);
|
||||
|
||||
nbrProcI = ppp.neighbProcNo();
|
||||
nbrProci = ppp.neighbProcNo();
|
||||
}
|
||||
|
||||
forAll(pp, i)
|
||||
@ -389,7 +389,7 @@ void Foam::meshToMesh::distributeCells
|
||||
subFaces.append(tgtMesh.faces()[facei]);
|
||||
subFaceOwner.append(reverseCellMap[own]);
|
||||
subFaceNeighbour.append(-1);
|
||||
subNbrProcIDs.append(nbrProcI);
|
||||
subNbrProcIDs.append(nbrProci);
|
||||
subProcLocalFaceIDs.append(i);
|
||||
}
|
||||
}
|
||||
@ -398,9 +398,9 @@ void Foam::meshToMesh::distributeCells
|
||||
// reverse point map
|
||||
labelList reversePointMap(tgtMesh.nPoints(), -1);
|
||||
DynamicList<point> subPoints(tgtMesh.nPoints());
|
||||
forAll(subFaces, subFaceI)
|
||||
forAll(subFaces, subFacei)
|
||||
{
|
||||
face& f = subFaces[subFaceI];
|
||||
face& f = subFaces[subFacei];
|
||||
forAll(f, fp)
|
||||
{
|
||||
label pointI = f[fp];
|
||||
@ -563,19 +563,19 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
// Starting offset for points
|
||||
label nPoints = 0;
|
||||
labelList pointOffset(Pstream::nProcs(), 0);
|
||||
forAll(allPoints, procI)
|
||||
forAll(allPoints, proci)
|
||||
{
|
||||
pointOffset[procI] = nPoints;
|
||||
nPoints += allPoints[procI].size();
|
||||
pointOffset[proci] = nPoints;
|
||||
nPoints += allPoints[proci].size();
|
||||
}
|
||||
|
||||
// Starting offset for cells
|
||||
label nCells = 0;
|
||||
labelList cellOffset(Pstream::nProcs(), 0);
|
||||
forAll(allTgtCellIDs, procI)
|
||||
forAll(allTgtCellIDs, proci)
|
||||
{
|
||||
cellOffset[procI] = nCells;
|
||||
nCells += allTgtCellIDs[procI].size();
|
||||
cellOffset[proci] = nCells;
|
||||
nCells += allTgtCellIDs[proci].size();
|
||||
}
|
||||
|
||||
// Count any coupled faces
|
||||
@ -583,19 +583,19 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
typedef HashTable<label, label3, label3::Hash<>> procCoupleInfo;
|
||||
procCoupleInfo procFaceToGlobalCell;
|
||||
|
||||
forAll(allNbrProcIDs, procI)
|
||||
forAll(allNbrProcIDs, proci)
|
||||
{
|
||||
const labelList& nbrProcI = allNbrProcIDs[procI];
|
||||
const labelList& localFaceI = allProcLocalFaceIDs[procI];
|
||||
const labelList& nbrProci = allNbrProcIDs[proci];
|
||||
const labelList& localFacei = allProcLocalFaceIDs[proci];
|
||||
|
||||
forAll(nbrProcI, i)
|
||||
forAll(nbrProci, i)
|
||||
{
|
||||
if (nbrProcI[i] != -1 && localFaceI[i] != -1)
|
||||
if (nbrProci[i] != -1 && localFacei[i] != -1)
|
||||
{
|
||||
label3 key;
|
||||
key[0] = min(procI, nbrProcI[i]);
|
||||
key[1] = max(procI, nbrProcI[i]);
|
||||
key[2] = localFaceI[i];
|
||||
key[0] = min(proci, nbrProci[i]);
|
||||
key[1] = max(proci, nbrProci[i]);
|
||||
key[2] = localFacei[i];
|
||||
|
||||
procCoupleInfo::const_iterator fnd =
|
||||
procFaceToGlobalCell.find(key);
|
||||
@ -613,7 +613,7 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
<< " across local face " << key[2] << endl;
|
||||
}
|
||||
|
||||
allNIntCoupledFaces[procI]++;
|
||||
allNIntCoupledFaces[proci]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -624,14 +624,14 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
label nIntFaces = 0;
|
||||
label nFacesTotal = 0;
|
||||
labelList internalFaceOffset(Pstream::nProcs(), 0);
|
||||
forAll(allNIntCoupledFaces, procI)
|
||||
forAll(allNIntCoupledFaces, proci)
|
||||
{
|
||||
label nCoupledFaces =
|
||||
allNIntCoupledFaces[procI] - allNInternalFaces[procI];
|
||||
allNIntCoupledFaces[proci] - allNInternalFaces[proci];
|
||||
|
||||
internalFaceOffset[procI] = nIntFaces;
|
||||
nIntFaces += allNIntCoupledFaces[procI];
|
||||
nFacesTotal += allFaceOwners[procI].size() - nCoupledFaces;
|
||||
internalFaceOffset[proci] = nIntFaces;
|
||||
nIntFaces += allNIntCoupledFaces[proci];
|
||||
nFacesTotal += allFaceOwners[proci].size() - nCoupledFaces;
|
||||
}
|
||||
|
||||
tgtPoints.setSize(nPoints);
|
||||
@ -641,99 +641,99 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
tgtCellIDs.setSize(nCells);
|
||||
|
||||
// Insert points
|
||||
forAll(allPoints, procI)
|
||||
forAll(allPoints, proci)
|
||||
{
|
||||
const pointField& pts = allPoints[procI];
|
||||
SubList<point>(tgtPoints, pts.size(), pointOffset[procI]) = pts;
|
||||
const pointField& pts = allPoints[proci];
|
||||
SubList<point>(tgtPoints, pts.size(), pointOffset[proci]) = pts;
|
||||
}
|
||||
|
||||
// Insert cellIDs
|
||||
forAll(allTgtCellIDs, procI)
|
||||
forAll(allTgtCellIDs, proci)
|
||||
{
|
||||
const labelList& cellIDs = allTgtCellIDs[procI];
|
||||
SubList<label>(tgtCellIDs, cellIDs.size(), cellOffset[procI]) = cellIDs;
|
||||
const labelList& cellIDs = allTgtCellIDs[proci];
|
||||
SubList<label>(tgtCellIDs, cellIDs.size(), cellOffset[proci]) = cellIDs;
|
||||
}
|
||||
|
||||
|
||||
// Insert internal faces (from internal faces)
|
||||
forAll(allFaces, procI)
|
||||
forAll(allFaces, proci)
|
||||
{
|
||||
const faceList& fcs = allFaces[procI];
|
||||
const labelList& faceOs = allFaceOwners[procI];
|
||||
const labelList& faceNs = allFaceNeighbours[procI];
|
||||
const faceList& fcs = allFaces[proci];
|
||||
const labelList& faceOs = allFaceOwners[proci];
|
||||
const labelList& faceNs = allFaceNeighbours[proci];
|
||||
|
||||
SubList<face> slice
|
||||
(
|
||||
tgtFaces,
|
||||
allNInternalFaces[procI],
|
||||
internalFaceOffset[procI]
|
||||
allNInternalFaces[proci],
|
||||
internalFaceOffset[proci]
|
||||
);
|
||||
slice = SubList<face>(fcs, allNInternalFaces[procI]);
|
||||
slice = SubList<face>(fcs, allNInternalFaces[proci]);
|
||||
forAll(slice, i)
|
||||
{
|
||||
add(slice[i], pointOffset[procI]);
|
||||
add(slice[i], pointOffset[proci]);
|
||||
}
|
||||
|
||||
SubField<label> ownSlice
|
||||
(
|
||||
tgtFaceOwners,
|
||||
allNInternalFaces[procI],
|
||||
internalFaceOffset[procI]
|
||||
allNInternalFaces[proci],
|
||||
internalFaceOffset[proci]
|
||||
);
|
||||
ownSlice = SubField<label>(faceOs, allNInternalFaces[procI]);
|
||||
add(ownSlice, cellOffset[procI]);
|
||||
ownSlice = SubField<label>(faceOs, allNInternalFaces[proci]);
|
||||
add(ownSlice, cellOffset[proci]);
|
||||
|
||||
SubField<label> nbrSlice
|
||||
(
|
||||
tgtFaceNeighbours,
|
||||
allNInternalFaces[procI],
|
||||
internalFaceOffset[procI]
|
||||
allNInternalFaces[proci],
|
||||
internalFaceOffset[proci]
|
||||
);
|
||||
nbrSlice = SubField<label>(faceNs, allNInternalFaces[procI]);
|
||||
add(nbrSlice, cellOffset[procI]);
|
||||
nbrSlice = SubField<label>(faceNs, allNInternalFaces[proci]);
|
||||
add(nbrSlice, cellOffset[proci]);
|
||||
|
||||
internalFaceOffset[procI] += allNInternalFaces[procI];
|
||||
internalFaceOffset[proci] += allNInternalFaces[proci];
|
||||
}
|
||||
|
||||
|
||||
// Insert internal faces (from coupled face-pairs)
|
||||
forAll(allNbrProcIDs, procI)
|
||||
forAll(allNbrProcIDs, proci)
|
||||
{
|
||||
const labelList& nbrProcI = allNbrProcIDs[procI];
|
||||
const labelList& localFaceI = allProcLocalFaceIDs[procI];
|
||||
const labelList& faceOs = allFaceOwners[procI];
|
||||
const faceList& fcs = allFaces[procI];
|
||||
const labelList& nbrProci = allNbrProcIDs[proci];
|
||||
const labelList& localFacei = allProcLocalFaceIDs[proci];
|
||||
const labelList& faceOs = allFaceOwners[proci];
|
||||
const faceList& fcs = allFaces[proci];
|
||||
|
||||
forAll(nbrProcI, i)
|
||||
forAll(nbrProci, i)
|
||||
{
|
||||
if (nbrProcI[i] != -1 && localFaceI[i] != -1)
|
||||
if (nbrProci[i] != -1 && localFacei[i] != -1)
|
||||
{
|
||||
label3 key;
|
||||
key[0] = min(procI, nbrProcI[i]);
|
||||
key[1] = max(procI, nbrProcI[i]);
|
||||
key[2] = localFaceI[i];
|
||||
key[0] = min(proci, nbrProci[i]);
|
||||
key[1] = max(proci, nbrProci[i]);
|
||||
key[2] = localFacei[i];
|
||||
|
||||
procCoupleInfo::iterator fnd = procFaceToGlobalCell.find(key);
|
||||
|
||||
if (fnd != procFaceToGlobalCell.end())
|
||||
{
|
||||
label tgtFaceI = fnd();
|
||||
if (tgtFaceI == -1)
|
||||
label tgtFacei = fnd();
|
||||
if (tgtFacei == -1)
|
||||
{
|
||||
// on first visit store the new cell on this side
|
||||
fnd() = cellOffset[procI] + faceOs[i];
|
||||
fnd() = cellOffset[proci] + faceOs[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// get owner and neighbour in new cell numbering
|
||||
label newOwn = cellOffset[procI] + faceOs[i];
|
||||
label newOwn = cellOffset[proci] + faceOs[i];
|
||||
label newNbr = fnd();
|
||||
label tgtFaceI = internalFaceOffset[procI]++;
|
||||
label tgtFacei = internalFaceOffset[proci]++;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " proc " << procI
|
||||
<< "\tinserting face:" << tgtFaceI
|
||||
Pout<< " proc " << proci
|
||||
<< "\tinserting face:" << tgtFacei
|
||||
<< " connection between owner " << newOwn
|
||||
<< " and neighbour " << newNbr
|
||||
<< endl;
|
||||
@ -742,19 +742,19 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
if (newOwn < newNbr)
|
||||
{
|
||||
// we have correct orientation
|
||||
tgtFaces[tgtFaceI] = fcs[i];
|
||||
tgtFaceOwners[tgtFaceI] = newOwn;
|
||||
tgtFaceNeighbours[tgtFaceI] = newNbr;
|
||||
tgtFaces[tgtFacei] = fcs[i];
|
||||
tgtFaceOwners[tgtFacei] = newOwn;
|
||||
tgtFaceNeighbours[tgtFacei] = newNbr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// reverse orientation
|
||||
tgtFaces[tgtFaceI] = fcs[i].reverseFace();
|
||||
tgtFaceOwners[tgtFaceI] = newNbr;
|
||||
tgtFaceNeighbours[tgtFaceI] = newOwn;
|
||||
tgtFaces[tgtFacei] = fcs[i].reverseFace();
|
||||
tgtFaceOwners[tgtFacei] = newNbr;
|
||||
tgtFaceNeighbours[tgtFacei] = newOwn;
|
||||
}
|
||||
|
||||
add(tgtFaces[tgtFaceI], pointOffset[procI]);
|
||||
add(tgtFaces[tgtFacei], pointOffset[proci]);
|
||||
|
||||
// mark with unique value
|
||||
fnd() = -2;
|
||||
@ -765,50 +765,50 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
}
|
||||
|
||||
|
||||
forAll(allNbrProcIDs, procI)
|
||||
forAll(allNbrProcIDs, proci)
|
||||
{
|
||||
const labelList& nbrProcI = allNbrProcIDs[procI];
|
||||
const labelList& localFaceI = allProcLocalFaceIDs[procI];
|
||||
const labelList& faceOs = allFaceOwners[procI];
|
||||
const labelList& faceNs = allFaceNeighbours[procI];
|
||||
const faceList& fcs = allFaces[procI];
|
||||
const labelList& nbrProci = allNbrProcIDs[proci];
|
||||
const labelList& localFacei = allProcLocalFaceIDs[proci];
|
||||
const labelList& faceOs = allFaceOwners[proci];
|
||||
const labelList& faceNs = allFaceNeighbours[proci];
|
||||
const faceList& fcs = allFaces[proci];
|
||||
|
||||
forAll(nbrProcI, i)
|
||||
forAll(nbrProci, i)
|
||||
{
|
||||
// coupled boundary face
|
||||
if (nbrProcI[i] != -1 && localFaceI[i] != -1)
|
||||
if (nbrProci[i] != -1 && localFacei[i] != -1)
|
||||
{
|
||||
label3 key;
|
||||
key[0] = min(procI, nbrProcI[i]);
|
||||
key[1] = max(procI, nbrProcI[i]);
|
||||
key[2] = localFaceI[i];
|
||||
key[0] = min(proci, nbrProci[i]);
|
||||
key[1] = max(proci, nbrProci[i]);
|
||||
key[2] = localFacei[i];
|
||||
|
||||
label tgtFaceI = procFaceToGlobalCell[key];
|
||||
label tgtFacei = procFaceToGlobalCell[key];
|
||||
|
||||
if (tgtFaceI == -1)
|
||||
if (tgtFacei == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unvisited " << key
|
||||
<< abort(FatalError);
|
||||
}
|
||||
else if (tgtFaceI != -2)
|
||||
else if (tgtFacei != -2)
|
||||
{
|
||||
label newOwn = cellOffset[procI] + faceOs[i];
|
||||
label tgtFaceI = nIntFaces++;
|
||||
label newOwn = cellOffset[proci] + faceOs[i];
|
||||
label tgtFacei = nIntFaces++;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " proc " << procI
|
||||
<< "\tinserting boundary face:" << tgtFaceI
|
||||
Pout<< " proc " << proci
|
||||
<< "\tinserting boundary face:" << tgtFacei
|
||||
<< " from coupled face " << key
|
||||
<< endl;
|
||||
}
|
||||
|
||||
tgtFaces[tgtFaceI] = fcs[i];
|
||||
add(tgtFaces[tgtFaceI], pointOffset[procI]);
|
||||
tgtFaces[tgtFacei] = fcs[i];
|
||||
add(tgtFaces[tgtFacei], pointOffset[proci]);
|
||||
|
||||
tgtFaceOwners[tgtFaceI] = newOwn;
|
||||
tgtFaceNeighbours[tgtFaceI] = -1;
|
||||
tgtFaceOwners[tgtFacei] = newOwn;
|
||||
tgtFaceNeighbours[tgtFacei] = -1;
|
||||
}
|
||||
}
|
||||
// normal boundary face
|
||||
@ -818,14 +818,14 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
label nbr = faceNs[i];
|
||||
if ((own != -1) && (nbr == -1))
|
||||
{
|
||||
label newOwn = cellOffset[procI] + faceOs[i];
|
||||
label tgtFaceI = nIntFaces++;
|
||||
label newOwn = cellOffset[proci] + faceOs[i];
|
||||
label tgtFacei = nIntFaces++;
|
||||
|
||||
tgtFaces[tgtFaceI] = fcs[i];
|
||||
add(tgtFaces[tgtFaceI], pointOffset[procI]);
|
||||
tgtFaces[tgtFacei] = fcs[i];
|
||||
add(tgtFaces[tgtFacei], pointOffset[proci]);
|
||||
|
||||
tgtFaceOwners[tgtFaceI] = newOwn;
|
||||
tgtFaceNeighbours[tgtFaceI] = -1;
|
||||
tgtFaceOwners[tgtFacei] = newOwn;
|
||||
tgtFaceNeighbours[tgtFacei] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user