mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Standardized cell, patch and face loop index names
This commit is contained in:
@ -193,24 +193,24 @@ void Foam::decompositionMethod::calcCellCells
|
||||
|
||||
labelList globalNeighbour(mesh.nFaces()-mesh.nInternalFaces());
|
||||
|
||||
forAll(patches, patchI)
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const polyPatch& pp = patches[patchi];
|
||||
|
||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||
{
|
||||
label faceI = pp.start();
|
||||
label facei = pp.start();
|
||||
label bFaceI = pp.start() - mesh.nInternalFaces();
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
globalNeighbour[bFaceI] = globalAgglom.toGlobal
|
||||
(
|
||||
agglom[faceOwner[faceI]]
|
||||
agglom[faceOwner[facei]]
|
||||
);
|
||||
|
||||
bFaceI++;
|
||||
faceI++;
|
||||
facei++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,27 +225,27 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// Number of faces per coarse cell
|
||||
labelList nFacesPerCell(nLocalCoarse, 0);
|
||||
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
{
|
||||
label own = agglom[faceOwner[faceI]];
|
||||
label nei = agglom[faceNeighbour[faceI]];
|
||||
label own = agglom[faceOwner[facei]];
|
||||
label nei = agglom[faceNeighbour[facei]];
|
||||
|
||||
nFacesPerCell[own]++;
|
||||
nFacesPerCell[nei]++;
|
||||
}
|
||||
|
||||
forAll(patches, patchI)
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const polyPatch& pp = patches[patchi];
|
||||
|
||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||
{
|
||||
label faceI = pp.start();
|
||||
label facei = pp.start();
|
||||
label bFaceI = pp.start()-mesh.nInternalFaces();
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
label own = agglom[faceOwner[faceI]];
|
||||
label own = agglom[faceOwner[facei]];
|
||||
|
||||
label globalNei = globalNeighbour[bFaceI];
|
||||
if
|
||||
@ -257,7 +257,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
nFacesPerCell[own]++;
|
||||
}
|
||||
|
||||
faceI++;
|
||||
facei++;
|
||||
bFaceI++;
|
||||
}
|
||||
}
|
||||
@ -275,28 +275,28 @@ void Foam::decompositionMethod::calcCellCells
|
||||
const labelList& offsets = cellCells.offsets();
|
||||
|
||||
// For internal faces is just offsetted owner and neighbour
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
{
|
||||
label own = agglom[faceOwner[faceI]];
|
||||
label nei = agglom[faceNeighbour[faceI]];
|
||||
label own = agglom[faceOwner[facei]];
|
||||
label nei = agglom[faceNeighbour[facei]];
|
||||
|
||||
m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.toGlobal(nei);
|
||||
m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.toGlobal(own);
|
||||
}
|
||||
|
||||
// For boundary faces is offsetted coupled neighbour
|
||||
forAll(patches, patchI)
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const polyPatch& pp = patches[patchi];
|
||||
|
||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||
{
|
||||
label faceI = pp.start();
|
||||
label facei = pp.start();
|
||||
label bFaceI = pp.start()-mesh.nInternalFaces();
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
label own = agglom[faceOwner[faceI]];
|
||||
label own = agglom[faceOwner[facei]];
|
||||
|
||||
label globalNei = globalNeighbour[bFaceI];
|
||||
|
||||
@ -309,7 +309,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
m[offsets[own] + nFacesPerCell[own]++] = globalNei;
|
||||
}
|
||||
|
||||
faceI++;
|
||||
facei++;
|
||||
bFaceI++;
|
||||
}
|
||||
}
|
||||
@ -330,12 +330,12 @@ void Foam::decompositionMethod::calcCellCells
|
||||
|
||||
label startIndex = cellCells.offsets()[0];
|
||||
|
||||
forAll(cellCells, cellI)
|
||||
forAll(cellCells, celli)
|
||||
{
|
||||
nbrCells.clear();
|
||||
nbrCells.insert(globalAgglom.toGlobal(cellI));
|
||||
nbrCells.insert(globalAgglom.toGlobal(celli));
|
||||
|
||||
label endIndex = cellCells.offsets()[cellI+1];
|
||||
label endIndex = cellCells.offsets()[celli+1];
|
||||
|
||||
for (label i = startIndex; i < endIndex; i++)
|
||||
{
|
||||
@ -345,20 +345,20 @@ void Foam::decompositionMethod::calcCellCells
|
||||
}
|
||||
}
|
||||
startIndex = endIndex;
|
||||
cellCells.offsets()[cellI+1] = newIndex;
|
||||
cellCells.offsets()[celli+1] = newIndex;
|
||||
}
|
||||
|
||||
cellCells.m().setSize(newIndex);
|
||||
|
||||
//forAll(cellCells, cellI)
|
||||
//forAll(cellCells, celli)
|
||||
//{
|
||||
// Pout<< "Original: Coarse cell " << cellI << endl;
|
||||
// forAll(mesh.cellCells()[cellI], i)
|
||||
// Pout<< "Original: Coarse cell " << celli << endl;
|
||||
// forAll(mesh.cellCells()[celli], i)
|
||||
// {
|
||||
// Pout<< " nbr:" << mesh.cellCells()[cellI][i] << endl;
|
||||
// Pout<< " nbr:" << mesh.cellCells()[celli][i] << endl;
|
||||
// }
|
||||
// Pout<< "Compacted: Coarse cell " << cellI << endl;
|
||||
// const labelUList cCells = cellCells[cellI];
|
||||
// Pout<< "Compacted: Coarse cell " << celli << endl;
|
||||
// const labelUList cCells = cellCells[celli];
|
||||
// forAll(cCells, i)
|
||||
// {
|
||||
// Pout<< " nbr:" << cCells[i] << endl;
|
||||
@ -400,24 +400,24 @@ void Foam::decompositionMethod::calcCellCells
|
||||
//
|
||||
// labelList globalNeighbour(mesh.nFaces()-mesh.nInternalFaces());
|
||||
//
|
||||
// forAll(patches, patchI)
|
||||
// forAll(patches, patchi)
|
||||
// {
|
||||
// const polyPatch& pp = patches[patchI];
|
||||
// const polyPatch& pp = patches[patchi];
|
||||
//
|
||||
// if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||
// {
|
||||
// label faceI = pp.start();
|
||||
// label facei = pp.start();
|
||||
// label bFaceI = pp.start() - mesh.nInternalFaces();
|
||||
//
|
||||
// forAll(pp, i)
|
||||
// {
|
||||
// globalNeighbour[bFaceI] = globalAgglom.toGlobal
|
||||
// (
|
||||
// agglom[faceOwner[faceI]]
|
||||
// agglom[faceOwner[facei]]
|
||||
// );
|
||||
//
|
||||
// bFaceI++;
|
||||
// faceI++;
|
||||
// facei++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@ -433,12 +433,12 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// labelList nFacesPerCell(nLocalCoarse, 0);
|
||||
//
|
||||
// // 1. Internal faces
|
||||
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
// for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
// {
|
||||
// if (!blockedFace[faceI])
|
||||
// if (!blockedFace[facei])
|
||||
// {
|
||||
// label own = agglom[faceOwner[faceI]];
|
||||
// label nei = agglom[faceNeighbour[faceI]];
|
||||
// label own = agglom[faceOwner[facei]];
|
||||
// label nei = agglom[faceNeighbour[facei]];
|
||||
//
|
||||
// nFacesPerCell[own]++;
|
||||
// nFacesPerCell[nei]++;
|
||||
@ -446,20 +446,20 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// }
|
||||
//
|
||||
// // 2. Coupled faces
|
||||
// forAll(patches, patchI)
|
||||
// forAll(patches, patchi)
|
||||
// {
|
||||
// const polyPatch& pp = patches[patchI];
|
||||
// const polyPatch& pp = patches[patchi];
|
||||
//
|
||||
// if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||
// {
|
||||
// label faceI = pp.start();
|
||||
// label facei = pp.start();
|
||||
// label bFaceI = pp.start()-mesh.nInternalFaces();
|
||||
//
|
||||
// forAll(pp, i)
|
||||
// {
|
||||
// if (!blockedFace[faceI])
|
||||
// if (!blockedFace[facei])
|
||||
// {
|
||||
// label own = agglom[faceOwner[faceI]];
|
||||
// label own = agglom[faceOwner[facei]];
|
||||
//
|
||||
// label globalNei = globalNeighbour[bFaceI];
|
||||
// if
|
||||
@ -471,7 +471,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// nFacesPerCell[own]++;
|
||||
// }
|
||||
//
|
||||
// faceI++;
|
||||
// facei++;
|
||||
// bFaceI++;
|
||||
// }
|
||||
// }
|
||||
@ -560,12 +560,12 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// const labelList& offsets = cellCells.offsets();
|
||||
//
|
||||
// // 1. For internal faces is just offsetted owner and neighbour
|
||||
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
// for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
// {
|
||||
// if (!blockedFace[faceI])
|
||||
// if (!blockedFace[facei])
|
||||
// {
|
||||
// label own = agglom[faceOwner[faceI]];
|
||||
// label nei = agglom[faceNeighbour[faceI]];
|
||||
// label own = agglom[faceOwner[facei]];
|
||||
// label nei = agglom[faceNeighbour[facei]];
|
||||
//
|
||||
// m[offsets[own] + nFacesPerCell[own]++] =
|
||||
// globalAgglom.toGlobal(nei);
|
||||
@ -575,20 +575,20 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// }
|
||||
//
|
||||
// // 2. For boundary faces is offsetted coupled neighbour
|
||||
// forAll(patches, patchI)
|
||||
// forAll(patches, patchi)
|
||||
// {
|
||||
// const polyPatch& pp = patches[patchI];
|
||||
// const polyPatch& pp = patches[patchi];
|
||||
//
|
||||
// if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||
// {
|
||||
// label faceI = pp.start();
|
||||
// label facei = pp.start();
|
||||
// label bFaceI = pp.start()-mesh.nInternalFaces();
|
||||
//
|
||||
// forAll(pp, i)
|
||||
// {
|
||||
// if (!blockedFace[faceI])
|
||||
// if (!blockedFace[facei])
|
||||
// {
|
||||
// label own = agglom[faceOwner[faceI]];
|
||||
// label own = agglom[faceOwner[facei]];
|
||||
//
|
||||
// label globalNei = globalNeighbour[bFaceI];
|
||||
//
|
||||
@ -601,7 +601,7 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// m[offsets[own] + nFacesPerCell[own]++] = globalNei;
|
||||
// }
|
||||
//
|
||||
// faceI++;
|
||||
// facei++;
|
||||
// bFaceI++;
|
||||
// }
|
||||
// }
|
||||
@ -705,12 +705,12 @@ void Foam::decompositionMethod::calcCellCells
|
||||
//
|
||||
// label startIndex = cellCells.offsets()[0];
|
||||
//
|
||||
// forAll(cellCells, cellI)
|
||||
// forAll(cellCells, celli)
|
||||
// {
|
||||
// nbrCells.clear();
|
||||
// nbrCells.insert(globalAgglom.toGlobal(cellI));
|
||||
// nbrCells.insert(globalAgglom.toGlobal(celli));
|
||||
//
|
||||
// label endIndex = cellCells.offsets()[cellI+1];
|
||||
// label endIndex = cellCells.offsets()[celli+1];
|
||||
//
|
||||
// for (label i = startIndex; i < endIndex; i++)
|
||||
// {
|
||||
@ -720,20 +720,20 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// }
|
||||
// }
|
||||
// startIndex = endIndex;
|
||||
// cellCells.offsets()[cellI+1] = newIndex;
|
||||
// cellCells.offsets()[celli+1] = newIndex;
|
||||
// }
|
||||
//
|
||||
// cellCells.m().setSize(newIndex);
|
||||
//
|
||||
// //forAll(cellCells, cellI)
|
||||
// //forAll(cellCells, celli)
|
||||
// //{
|
||||
// // Pout<< "Original: Coarse cell " << cellI << endl;
|
||||
// // forAll(mesh.cellCells()[cellI], i)
|
||||
// // Pout<< "Original: Coarse cell " << celli << endl;
|
||||
// // forAll(mesh.cellCells()[celli], i)
|
||||
// // {
|
||||
// // Pout<< " nbr:" << mesh.cellCells()[cellI][i] << endl;
|
||||
// // Pout<< " nbr:" << mesh.cellCells()[celli][i] << endl;
|
||||
// // }
|
||||
// // Pout<< "Compacted: Coarse cell " << cellI << endl;
|
||||
// // const labelUList cCells = cellCells[cellI];
|
||||
// // Pout<< "Compacted: Coarse cell " << celli << endl;
|
||||
// // const labelUList cCells = cellCells[celli];
|
||||
// // forAll(cCells, i)
|
||||
// // {
|
||||
// // Pout<< " nbr:" << cCells[i] << endl;
|
||||
@ -789,9 +789,9 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
|
||||
// Any faces not blocked?
|
||||
label nUnblocked = 0;
|
||||
forAll(blockedFace, faceI)
|
||||
forAll(blockedFace, facei)
|
||||
{
|
||||
if (!blockedFace[faceI])
|
||||
if (!blockedFace[facei])
|
||||
{
|
||||
nUnblocked++;
|
||||
}
|
||||
@ -858,13 +858,13 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
|
||||
pointField regionCentres(localRegion.nLocalRegions(), point::max);
|
||||
|
||||
forAll(localRegion, cellI)
|
||||
forAll(localRegion, celli)
|
||||
{
|
||||
label regionI = localRegion[cellI];
|
||||
label regionI = localRegion[celli];
|
||||
|
||||
if (regionCentres[regionI] == point::max)
|
||||
{
|
||||
regionCentres[regionI] = mesh.cellCentres()[cellI];
|
||||
regionCentres[regionI] = mesh.cellCentres()[celli];
|
||||
}
|
||||
}
|
||||
|
||||
@ -875,18 +875,18 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
|
||||
if (nWeights > 0)
|
||||
{
|
||||
forAll(localRegion, cellI)
|
||||
forAll(localRegion, celli)
|
||||
{
|
||||
label regionI = localRegion[cellI];
|
||||
label regionI = localRegion[celli];
|
||||
|
||||
regionWeights[regionI] += cellWeights[cellI];
|
||||
regionWeights[regionI] += cellWeights[celli];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(localRegion, cellI)
|
||||
forAll(localRegion, celli)
|
||||
{
|
||||
label regionI = localRegion[cellI];
|
||||
label regionI = localRegion[celli];
|
||||
|
||||
regionWeights[regionI] += 1.0;
|
||||
}
|
||||
@ -951,11 +951,11 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
// Take over blockedFaces by seeding a negative number
|
||||
// (so is always less than the decomposition)
|
||||
label nUnblocked = 0;
|
||||
forAll(blockedFace, faceI)
|
||||
forAll(blockedFace, facei)
|
||||
{
|
||||
if (blockedFace[faceI])
|
||||
if (blockedFace[facei])
|
||||
{
|
||||
faceData[faceI] = minData(-123);
|
||||
faceData[facei] = minData(-123);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -968,12 +968,12 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
List<minData> seedData(nUnblocked);
|
||||
nUnblocked = 0;
|
||||
|
||||
forAll(blockedFace, faceI)
|
||||
forAll(blockedFace, facei)
|
||||
{
|
||||
if (!blockedFace[faceI])
|
||||
if (!blockedFace[facei])
|
||||
{
|
||||
label own = mesh.faceOwner()[faceI];
|
||||
seedFaces[nUnblocked] = faceI;
|
||||
label own = mesh.faceOwner()[facei];
|
||||
seedFaces[nUnblocked] = facei;
|
||||
seedData[nUnblocked] = minData(finalDecomp[own]);
|
||||
nUnblocked++;
|
||||
}
|
||||
@ -992,11 +992,11 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
);
|
||||
|
||||
// And extract
|
||||
forAll(finalDecomp, cellI)
|
||||
forAll(finalDecomp, celli)
|
||||
{
|
||||
if (cellData[cellI].valid(deltaCalc.data()))
|
||||
if (cellData[celli].valid(deltaCalc.data()))
|
||||
{
|
||||
finalDecomp[cellI] = cellData[cellI].data();
|
||||
finalDecomp[celli] = cellData[celli].data();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1035,12 +1035,12 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
const labelList& pFaces = mesh.pointFaces()[f[fp]];
|
||||
forAll(pFaces, i)
|
||||
{
|
||||
label faceI = pFaces[i];
|
||||
label facei = pFaces[i];
|
||||
|
||||
finalDecomp[mesh.faceOwner()[faceI]] = procI;
|
||||
if (mesh.isInternalFace(faceI))
|
||||
finalDecomp[mesh.faceOwner()[facei]] = procI;
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
finalDecomp[mesh.faceNeighbour()[faceI]] = procI;
|
||||
finalDecomp[mesh.faceNeighbour()[facei]] = procI;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1054,18 +1054,18 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
syncTools::swapBoundaryCellList(mesh, finalDecomp, nbrDecomp);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
forAll(patches, patchI)
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const polyPatch& pp = patches[patchi];
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
label own = mesh.faceOwner()[faceI];
|
||||
label bFaceI = faceI-mesh.nInternalFaces();
|
||||
label facei = pp.start()+i;
|
||||
label own = mesh.faceOwner()[facei];
|
||||
label bFaceI = facei-mesh.nInternalFaces();
|
||||
|
||||
if (!blockedFace[faceI])
|
||||
if (!blockedFace[facei])
|
||||
{
|
||||
label ownProc = finalDecomp[own];
|
||||
label nbrProc = nbrDecomp[bFaceI];
|
||||
@ -1073,8 +1073,8 @@ Foam::labelList Foam::decompositionMethod::decompose
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "patch:" << pp.name()
|
||||
<< " face:" << faceI
|
||||
<< " at:" << mesh.faceCentres()[faceI]
|
||||
<< " face:" << facei
|
||||
<< " at:" << mesh.faceCentres()[facei]
|
||||
<< " ownProc:" << ownProc
|
||||
<< " nbrProc:" << nbrProc
|
||||
<< exit(FatalError);
|
||||
@ -1119,9 +1119,9 @@ void Foam::decompositionMethod::setConstraints
|
||||
|
||||
forAll(pNames, i)
|
||||
{
|
||||
const label patchI = patches.findPatchID(pNames[i]);
|
||||
const label patchi = patches.findPatchID(pNames[i]);
|
||||
|
||||
if (patchI == -1)
|
||||
if (patchi == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown preservePatch " << pNames[i]
|
||||
@ -1129,7 +1129,7 @@ void Foam::decompositionMethod::setConstraints
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const polyPatch& pp = patches[patchi];
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user