mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Standardized cell, patch, face and processor loop index names
This commit is contained in:
@ -120,16 +120,16 @@ int main(int argc, char *argv[])
|
||||
//
|
||||
|
||||
// Current patch number.
|
||||
label newPatchI = bMesh.patches().size();
|
||||
label newPatchi = bMesh.patches().size();
|
||||
|
||||
label suffix = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Find first unset face.
|
||||
label unsetFaceI = findIndex(patchIDs, -1);
|
||||
label unsetFacei = findIndex(patchIDs, -1);
|
||||
|
||||
if (unsetFaceI == -1)
|
||||
if (unsetFacei == -1)
|
||||
{
|
||||
// All faces have patchID set. Exit.
|
||||
break;
|
||||
@ -148,10 +148,10 @@ int main(int argc, char *argv[])
|
||||
bMesh.changePatchType(patchName, "patch");
|
||||
|
||||
|
||||
// Fill visited with all faces reachable from unsetFaceI.
|
||||
// Fill visited with all faces reachable from unsetFacei.
|
||||
boolList visited(bMesh.mesh().size());
|
||||
|
||||
bMesh.markFaces(markedEdges, unsetFaceI, visited);
|
||||
bMesh.markFaces(markedEdges, unsetFacei, visited);
|
||||
|
||||
|
||||
// Assign all visited faces to current patch
|
||||
@ -163,14 +163,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
nVisited++;
|
||||
|
||||
patchIDs[facei] = newPatchI;
|
||||
patchIDs[facei] = newPatchi;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Assigned " << nVisited << " faces to patch " << patchName
|
||||
<< endl << endl;
|
||||
|
||||
newPatchI++;
|
||||
newPatchi++;
|
||||
}
|
||||
|
||||
|
||||
@ -180,41 +180,41 @@ int main(int argc, char *argv[])
|
||||
// Create new list of patches with old ones first
|
||||
List<polyPatch*> newPatchPtrList(patches.size());
|
||||
|
||||
newPatchI = 0;
|
||||
newPatchi = 0;
|
||||
|
||||
// Copy old patches
|
||||
forAll(mesh.boundaryMesh(), patchi)
|
||||
{
|
||||
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
||||
|
||||
newPatchPtrList[newPatchI] =
|
||||
newPatchPtrList[newPatchi] =
|
||||
patch.clone
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
newPatchI,
|
||||
newPatchi,
|
||||
patch.size(),
|
||||
patch.start()
|
||||
).ptr();
|
||||
|
||||
newPatchI++;
|
||||
newPatchi++;
|
||||
}
|
||||
|
||||
// Add new ones with empty size.
|
||||
for (label patchi = newPatchI; patchi < patches.size(); patchi++)
|
||||
for (label patchi = newPatchi; patchi < patches.size(); patchi++)
|
||||
{
|
||||
const boundaryPatch& bp = patches[patchi];
|
||||
|
||||
newPatchPtrList[newPatchI] = polyPatch::New
|
||||
newPatchPtrList[newPatchi] = polyPatch::New
|
||||
(
|
||||
polyPatch::typeName,
|
||||
bp.name(),
|
||||
0,
|
||||
mesh.nFaces(),
|
||||
newPatchI,
|
||||
newPatchi,
|
||||
mesh.boundaryMesh()
|
||||
).ptr();
|
||||
|
||||
newPatchI++;
|
||||
newPatchi++;
|
||||
}
|
||||
|
||||
if (!overwrite)
|
||||
@ -236,9 +236,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(patchIDs, facei)
|
||||
{
|
||||
label meshFaceI = meshFace[facei];
|
||||
label meshFacei = meshFace[facei];
|
||||
|
||||
polyMeshRepatcher.changePatchID(meshFaceI, patchIDs[facei]);
|
||||
polyMeshRepatcher.changePatchID(meshFacei, patchIDs[facei]);
|
||||
}
|
||||
|
||||
polyMeshRepatcher.repatch();
|
||||
|
||||
@ -84,9 +84,9 @@ bool Foam::checkWedges
|
||||
}
|
||||
|
||||
// Find opposite
|
||||
label oppositePatchI = findOppositeWedge(mesh, pp);
|
||||
label oppositePatchi = findOppositeWedge(mesh, pp);
|
||||
|
||||
if (oppositePatchI == -1)
|
||||
if (oppositePatchi == -1)
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
@ -97,7 +97,7 @@ bool Foam::checkWedges
|
||||
}
|
||||
|
||||
const wedgePolyPatch& opp =
|
||||
refCast<const wedgePolyPatch>(patches[oppositePatchI]);
|
||||
refCast<const wedgePolyPatch>(patches[oppositePatchi]);
|
||||
|
||||
|
||||
if (mag(opp.axis() & pp.axis()) < (1-1e-3))
|
||||
@ -351,13 +351,13 @@ bool Foam::checkCoupledPoints
|
||||
|
||||
forAll(cpp, i)
|
||||
{
|
||||
label bFaceI = cpp.start() + i - mesh.nInternalFaces();
|
||||
label bFacei = cpp.start() + i - mesh.nInternalFaces();
|
||||
const face& f = cpp[i];
|
||||
nbrPoints[bFaceI].setSize(f.size());
|
||||
nbrPoints[bFacei].setSize(f.size());
|
||||
forAll(f, fp)
|
||||
{
|
||||
const point& p0 = p[f[fp]];
|
||||
nbrPoints[bFaceI][fp] = p0;
|
||||
nbrPoints[bFacei][fp] = p0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -397,15 +397,15 @@ bool Foam::checkCoupledPoints
|
||||
|
||||
forAll(cpp, i)
|
||||
{
|
||||
label bFaceI = cpp.start() + i - mesh.nInternalFaces();
|
||||
label bFacei = cpp.start() + i - mesh.nInternalFaces();
|
||||
const face& f = cpp[i];
|
||||
|
||||
if (f.size() != nbrPoints[bFaceI].size())
|
||||
if (f.size() != nbrPoints[bFacei].size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Local face size : " << f.size()
|
||||
<< " does not equal neighbour face size : "
|
||||
<< nbrPoints[bFaceI].size()
|
||||
<< nbrPoints[bFacei].size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ bool Foam::checkCoupledPoints
|
||||
forAll(f, j)
|
||||
{
|
||||
const point& p0 = p[f[fp]];
|
||||
scalar d = mag(p0 - nbrPoints[bFaceI][j]);
|
||||
scalar d = mag(p0 - nbrPoints[bFacei][j]);
|
||||
|
||||
if (d > smallDist[i])
|
||||
{
|
||||
|
||||
@ -113,7 +113,7 @@ void modifyOrAddFace
|
||||
const label facei,
|
||||
const label own,
|
||||
const bool flipFaceFlux,
|
||||
const label newPatchI,
|
||||
const label newPatchi,
|
||||
const label zoneID,
|
||||
const bool zoneFlip,
|
||||
|
||||
@ -132,7 +132,7 @@ void modifyOrAddFace
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
flipFaceFlux, // face flip
|
||||
newPatchI, // patch for face
|
||||
newPatchi, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
@ -154,7 +154,7 @@ void modifyOrAddFace
|
||||
-1, // master edge
|
||||
facei, // master face
|
||||
flipFaceFlux, // face flip
|
||||
newPatchI, // patch for face
|
||||
newPatchi, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
@ -186,11 +186,11 @@ void createFaces
|
||||
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
{
|
||||
label zoneFaceI = fZone.whichFace(facei);
|
||||
label zoneFacei = fZone.whichFace(facei);
|
||||
|
||||
if (zoneFaceI != -1)
|
||||
if (zoneFacei != -1)
|
||||
{
|
||||
if (!fZone.flipMap()[zoneFaceI])
|
||||
if (!fZone.flipMap()[zoneFacei])
|
||||
{
|
||||
// Use owner side of face
|
||||
modifyOrAddFace
|
||||
@ -236,11 +236,11 @@ void createFaces
|
||||
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
{
|
||||
label zoneFaceI = fZone.whichFace(facei);
|
||||
label zoneFacei = fZone.whichFace(facei);
|
||||
|
||||
if (zoneFaceI != -1)
|
||||
if (zoneFacei != -1)
|
||||
{
|
||||
if (!fZone.flipMap()[zoneFaceI])
|
||||
if (!fZone.flipMap()[zoneFacei])
|
||||
{
|
||||
// Use neighbour side of face
|
||||
modifyOrAddFace
|
||||
@ -294,9 +294,9 @@ void createFaces
|
||||
{
|
||||
const polyPatch& pp = pbm[patchi];
|
||||
|
||||
label newPatchI = newMasterPatches[i];
|
||||
label newPatchi = newMasterPatches[i];
|
||||
|
||||
if (pp.coupled() && pbm[newPatchI].coupled())
|
||||
if (pp.coupled() && pbm[newPatchi].coupled())
|
||||
{
|
||||
// Do not allow coupled faces to be moved to different
|
||||
// coupled patches.
|
||||
@ -307,9 +307,9 @@ void createFaces
|
||||
{
|
||||
label facei = pp.start()+i;
|
||||
|
||||
label zoneFaceI = fZone.whichFace(facei);
|
||||
label zoneFacei = fZone.whichFace(facei);
|
||||
|
||||
if (zoneFaceI != -1)
|
||||
if (zoneFacei != -1)
|
||||
{
|
||||
if (patchWarned.insert(patchi))
|
||||
{
|
||||
@ -318,7 +318,7 @@ void createFaces
|
||||
<< pp.name()
|
||||
<< ") in faceZone " << fZone.name()
|
||||
<< " to convert to baffle patch "
|
||||
<< pbm[newPatchI].name()
|
||||
<< pbm[newPatchi].name()
|
||||
<< endl
|
||||
<< " Run with -internalFacesOnly option"
|
||||
<< " if you don't wish to convert"
|
||||
@ -332,9 +332,9 @@ void createFaces
|
||||
facei, // label of face
|
||||
mesh.faceOwner()[facei], // owner
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
newPatchi, // patch for face
|
||||
fZone.index(), // zone for face
|
||||
fZone.flipMap()[zoneFaceI], // face flip in zone
|
||||
fZone.flipMap()[zoneFacei], // face flip in zone
|
||||
modifiedFace // modify or add
|
||||
);
|
||||
nModified++;
|
||||
|
||||
@ -555,7 +555,7 @@ int main(int argc, char *argv[])
|
||||
// Old and new patches.
|
||||
DynamicList<polyPatch*> allPatches(patches.size()+patchSources.size());
|
||||
|
||||
label startFaceI = mesh.nInternalFaces();
|
||||
label startFacei = mesh.nInternalFaces();
|
||||
|
||||
// Copy old patches.
|
||||
forAll(patches, patchi)
|
||||
@ -571,10 +571,10 @@ int main(int argc, char *argv[])
|
||||
patches,
|
||||
patchi,
|
||||
pp.size(),
|
||||
startFaceI
|
||||
startFacei
|
||||
).ptr()
|
||||
);
|
||||
startFaceI += pp.size();
|
||||
startFacei += pp.size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,20 +584,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
word patchName(dict.lookup("name"));
|
||||
|
||||
label destPatchI = patches.findPatchID(patchName);
|
||||
label destPatchi = patches.findPatchID(patchName);
|
||||
|
||||
if (destPatchI == -1)
|
||||
if (destPatchi == -1)
|
||||
{
|
||||
dictionary patchDict(dict.subDict("patchInfo"));
|
||||
|
||||
destPatchI = allPatches.size();
|
||||
destPatchi = allPatches.size();
|
||||
|
||||
Info<< "Adding new patch " << patchName
|
||||
<< " as patch " << destPatchI
|
||||
<< " as patch " << destPatchi
|
||||
<< " from " << patchDict << endl;
|
||||
|
||||
patchDict.set("nFaces", 0);
|
||||
patchDict.set("startFace", startFaceI);
|
||||
patchDict.set("startFace", startFacei);
|
||||
|
||||
// Add an empty patch.
|
||||
allPatches.append
|
||||
@ -606,7 +606,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
patchName,
|
||||
patchDict,
|
||||
destPatchI,
|
||||
destPatchi,
|
||||
patches
|
||||
).ptr()
|
||||
);
|
||||
@ -632,10 +632,10 @@ int main(int argc, char *argv[])
|
||||
patches,
|
||||
patchi,
|
||||
pp.size(),
|
||||
startFaceI
|
||||
startFacei
|
||||
).ptr()
|
||||
);
|
||||
startFaceI += pp.size();
|
||||
startFacei += pp.size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,9 +659,9 @@ int main(int argc, char *argv[])
|
||||
const dictionary& dict = patchSources[addedI];
|
||||
|
||||
const word patchName(dict.lookup("name"));
|
||||
label destPatchI = patches.findPatchID(patchName);
|
||||
label destPatchi = patches.findPatchID(patchName);
|
||||
|
||||
if (destPatchI == -1)
|
||||
if (destPatchi == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "patch " << patchName << " not added. Problem."
|
||||
@ -686,7 +686,7 @@ int main(int argc, char *argv[])
|
||||
const polyPatch& pp = patches[iter.key()];
|
||||
|
||||
Info<< "Moving faces from patch " << pp.name()
|
||||
<< " to patch " << destPatchI << endl;
|
||||
<< " to patch " << destPatchi << endl;
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
@ -694,7 +694,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
pp.start() + i,
|
||||
destPatchI,
|
||||
destPatchi,
|
||||
meshMod
|
||||
);
|
||||
}
|
||||
@ -732,7 +732,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
facei,
|
||||
destPatchI,
|
||||
destPatchi,
|
||||
meshMod
|
||||
);
|
||||
}
|
||||
|
||||
@ -76,16 +76,16 @@ void insertDuplicateMerge
|
||||
const labelList& faceOwner = mesh.faceOwner();
|
||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
forAll(duplicates, bFacei)
|
||||
{
|
||||
label otherFaceI = duplicates[bFaceI];
|
||||
label otherFacei = duplicates[bFacei];
|
||||
|
||||
if (otherFaceI != -1 && otherFaceI > bFaceI)
|
||||
if (otherFacei != -1 && otherFacei > bFacei)
|
||||
{
|
||||
// Two duplicate faces. Merge.
|
||||
|
||||
label face0 = mesh.nInternalFaces() + bFaceI;
|
||||
label face1 = mesh.nInternalFaces() + otherFaceI;
|
||||
label face0 = mesh.nInternalFaces() + bFacei;
|
||||
label face1 = mesh.nInternalFaces() + otherFacei;
|
||||
|
||||
label own0 = faceOwner[face0];
|
||||
label own1 = faceOwner[face1];
|
||||
@ -166,11 +166,11 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces)
|
||||
// Check that none are on processor patches
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
forAll(duplicates, bFacei)
|
||||
{
|
||||
if (duplicates[bFaceI] != -1)
|
||||
if (duplicates[bFacei] != -1)
|
||||
{
|
||||
label facei = mesh.nInternalFaces() + bFaceI;
|
||||
label facei = mesh.nInternalFaces() + bFacei;
|
||||
label patchi = patches.whichPatch(facei);
|
||||
|
||||
if (isA<processorPolyPatch>(patches[patchi]))
|
||||
@ -196,14 +196,14 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces)
|
||||
(mesh.nFaces() - mesh.nInternalFaces())/256
|
||||
);
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
forAll(duplicates, bFacei)
|
||||
{
|
||||
label otherFaceI = duplicates[bFaceI];
|
||||
label otherFacei = duplicates[bFacei];
|
||||
|
||||
if (otherFaceI != -1 && otherFaceI > bFaceI)
|
||||
if (otherFacei != -1 && otherFacei > bFacei)
|
||||
{
|
||||
duplicateSet.insert(mesh.nInternalFaces() + bFaceI);
|
||||
duplicateSet.insert(mesh.nInternalFaces() + otherFaceI);
|
||||
duplicateSet.insert(mesh.nInternalFaces() + bFacei);
|
||||
duplicateSet.insert(mesh.nInternalFaces() + otherFacei);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,14 +101,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(faceLabels, facei)
|
||||
{
|
||||
const label meshFaceI = faceLabels[facei];
|
||||
const label patchi = bm.whichPatch(meshFaceI);
|
||||
const label meshFacei = faceLabels[facei];
|
||||
const label patchi = bm.whichPatch(meshFacei);
|
||||
|
||||
if
|
||||
(
|
||||
patchi != -1
|
||||
&& bm[patchi].coupled()
|
||||
&& !isMasterFace[meshFaceI]
|
||||
&& !isMasterFace[meshFacei]
|
||||
)
|
||||
{
|
||||
// Slave side. Mark so doesn't get visited.
|
||||
@ -127,9 +127,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(faceLabels, facei)
|
||||
{
|
||||
const label meshFaceI = faceLabels[facei];
|
||||
const label meshFacei = faceLabels[facei];
|
||||
|
||||
if (isMasterFace[meshFaceI])
|
||||
if (isMasterFace[meshFacei])
|
||||
{
|
||||
const labelList& fEdges = patch.faceEdges()[facei];
|
||||
forAll(fEdges, fEdgeI)
|
||||
@ -183,59 +183,59 @@ int main(int argc, char *argv[])
|
||||
while (true)
|
||||
{
|
||||
// Pick an unset face
|
||||
label unsetFaceI = labelMax;
|
||||
label unsetFacei = labelMax;
|
||||
forAll(allFaceInfo, facei)
|
||||
{
|
||||
if (allFaceInfo[facei] == orientedSurface::UNVISITED)
|
||||
{
|
||||
unsetFaceI = globalFaces.toGlobal(facei);
|
||||
unsetFacei = globalFaces.toGlobal(facei);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(unsetFaceI, minOp<label>());
|
||||
reduce(unsetFacei, minOp<label>());
|
||||
|
||||
if (unsetFaceI == labelMax)
|
||||
if (unsetFacei == labelMax)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
label procI = globalFaces.whichProcID(unsetFaceI);
|
||||
label seedFaceI = globalFaces.toLocal(procI, unsetFaceI);
|
||||
Info<< "Seeding from processor " << procI << " face " << seedFaceI
|
||||
label proci = globalFaces.whichProcID(unsetFacei);
|
||||
label seedFacei = globalFaces.toLocal(proci, unsetFacei);
|
||||
Info<< "Seeding from processor " << proci << " face " << seedFacei
|
||||
<< endl;
|
||||
|
||||
if (procI == Pstream::myProcNo())
|
||||
if (proci == Pstream::myProcNo())
|
||||
{
|
||||
// Determine orientation of seedFace
|
||||
|
||||
vector d = outsidePoint-patch.faceCentres()[seedFaceI];
|
||||
const vector& fn = patch.faceNormals()[seedFaceI];
|
||||
vector d = outsidePoint-patch.faceCentres()[seedFacei];
|
||||
const vector& fn = patch.faceNormals()[seedFacei];
|
||||
|
||||
// Set information to correct orientation
|
||||
patchFaceOrientation& faceInfo = allFaceInfo[seedFaceI];
|
||||
patchFaceOrientation& faceInfo = allFaceInfo[seedFacei];
|
||||
faceInfo = orientedSurface::NOFLIP;
|
||||
|
||||
if ((fn&d) < 0)
|
||||
{
|
||||
faceInfo.flip();
|
||||
|
||||
Pout<< "Face " << seedFaceI << " at "
|
||||
<< patch.faceCentres()[seedFaceI]
|
||||
Pout<< "Face " << seedFacei << " at "
|
||||
<< patch.faceCentres()[seedFacei]
|
||||
<< " with normal " << fn
|
||||
<< " needs to be flipped." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< "Face " << seedFaceI << " at "
|
||||
<< patch.faceCentres()[seedFaceI]
|
||||
Pout<< "Face " << seedFacei << " at "
|
||||
<< patch.faceCentres()[seedFacei]
|
||||
<< " with normal " << fn
|
||||
<< " points in positive direction (cos = " << (fn&d)/mag(d)
|
||||
<< ")" << endl;
|
||||
}
|
||||
|
||||
|
||||
const labelList& fEdges = patch.faceEdges()[seedFaceI];
|
||||
const labelList& fEdges = patch.faceEdges()[seedFacei];
|
||||
forAll(fEdges, fEdgeI)
|
||||
{
|
||||
label edgeI = fEdges[fEdgeI];
|
||||
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
|
||||
mesh,
|
||||
patch,
|
||||
edgeI,
|
||||
seedFaceI,
|
||||
seedFacei,
|
||||
faceInfo,
|
||||
tol,
|
||||
dummyTrackData
|
||||
@ -300,10 +300,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
const label meshFaceI = faceLabels[i];
|
||||
if (!mesh.isInternalFace(meshFaceI))
|
||||
const label meshFacei = faceLabels[i];
|
||||
if (!mesh.isInternalFace(meshFacei))
|
||||
{
|
||||
neiStatus[meshFaceI-mesh.nInternalFaces()] =
|
||||
neiStatus[meshFacei-mesh.nInternalFaces()] =
|
||||
allFaceInfo[i].flipStatus();
|
||||
}
|
||||
}
|
||||
@ -311,31 +311,31 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
const label meshFaceI = faceLabels[i];
|
||||
const label patchi = bm.whichPatch(meshFaceI);
|
||||
const label meshFacei = faceLabels[i];
|
||||
const label patchi = bm.whichPatch(meshFacei);
|
||||
|
||||
if
|
||||
(
|
||||
patchi != -1
|
||||
&& bm[patchi].coupled()
|
||||
&& !isMasterFace[meshFaceI]
|
||||
&& !isMasterFace[meshFacei]
|
||||
)
|
||||
{
|
||||
// Slave side. Take flipped from neighbour
|
||||
label bFaceI = meshFaceI-mesh.nInternalFaces();
|
||||
label bFacei = meshFacei-mesh.nInternalFaces();
|
||||
|
||||
if (neiStatus[bFaceI] == orientedSurface::NOFLIP)
|
||||
if (neiStatus[bFacei] == orientedSurface::NOFLIP)
|
||||
{
|
||||
allFaceInfo[i] = orientedSurface::FLIP;
|
||||
}
|
||||
else if (neiStatus[bFaceI] == orientedSurface::FLIP)
|
||||
else if (neiStatus[bFacei] == orientedSurface::FLIP)
|
||||
{
|
||||
allFaceInfo[i] = orientedSurface::NOFLIP;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Incorrect status for face " << meshFaceI
|
||||
<< "Incorrect status for face " << meshFacei
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
(
|
||||
const label masterPointI,
|
||||
const label masterEdgeI,
|
||||
const label masterFaceI,
|
||||
const label masterFacei,
|
||||
|
||||
const bool edgeOrder,
|
||||
const label dualCell0,
|
||||
@ -240,30 +240,30 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
|
||||
label zoneID = -1;
|
||||
bool zoneFlip = false;
|
||||
if (masterFaceI != -1)
|
||||
if (masterFacei != -1)
|
||||
{
|
||||
zoneID = mesh_.faceZones().whichZone(masterFaceI);
|
||||
zoneID = mesh_.faceZones().whichZone(masterFacei);
|
||||
|
||||
if (zoneID != -1)
|
||||
{
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFacei)];
|
||||
}
|
||||
}
|
||||
|
||||
label dualFaceI;
|
||||
label dualFacei;
|
||||
|
||||
if (dualCell0 < dualCell1)
|
||||
{
|
||||
dualFaceI = meshMod.addFace
|
||||
dualFacei = meshMod.addFace
|
||||
(
|
||||
newFace,
|
||||
dualCell0, // own
|
||||
dualCell1, // nei
|
||||
masterPointI, // masterPointID
|
||||
masterEdgeI, // masterEdgeID
|
||||
masterFaceI, // masterFaceID
|
||||
masterFacei, // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
-1, // patchID
|
||||
zoneID, // zoneID
|
||||
@ -273,7 +273,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
//pointField dualPoints(meshMod.points());
|
||||
//vector n(newFace.normal(dualPoints));
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated internal dualFace:" << dualFaceI
|
||||
//Pout<< "Generated internal dualFace:" << dualFacei
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
@ -283,14 +283,14 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
}
|
||||
else
|
||||
{
|
||||
dualFaceI = meshMod.addFace
|
||||
dualFacei = meshMod.addFace
|
||||
(
|
||||
newFace,
|
||||
dualCell1, // own
|
||||
dualCell0, // nei
|
||||
masterPointI, // masterPointID
|
||||
masterEdgeI, // masterEdgeID
|
||||
masterFaceI, // masterFaceID
|
||||
masterFacei, // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
-1, // patchID
|
||||
zoneID, // zoneID
|
||||
@ -300,7 +300,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
//pointField dualPoints(meshMod.points());
|
||||
//vector n(newFace.normal(dualPoints));
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated internal dualFace:" << dualFaceI
|
||||
//Pout<< "Generated internal dualFace:" << dualFacei
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
@ -308,7 +308,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
// << " dualneigbour:" << dualCell0
|
||||
// << endl;
|
||||
}
|
||||
return dualFaceI;
|
||||
return dualFacei;
|
||||
}
|
||||
|
||||
|
||||
@ -316,9 +316,9 @@ Foam::label Foam::meshDualiser::addBoundaryFace
|
||||
(
|
||||
const label masterPointI,
|
||||
const label masterEdgeI,
|
||||
const label masterFaceI,
|
||||
const label masterFacei,
|
||||
|
||||
const label dualCellI,
|
||||
const label dualCelli,
|
||||
const label patchi,
|
||||
const DynamicList<label>& verts,
|
||||
polyTopoChange& meshMod
|
||||
@ -328,26 +328,26 @@ Foam::label Foam::meshDualiser::addBoundaryFace
|
||||
|
||||
label zoneID = -1;
|
||||
bool zoneFlip = false;
|
||||
if (masterFaceI != -1)
|
||||
if (masterFacei != -1)
|
||||
{
|
||||
zoneID = mesh_.faceZones().whichZone(masterFaceI);
|
||||
zoneID = mesh_.faceZones().whichZone(masterFacei);
|
||||
|
||||
if (zoneID != -1)
|
||||
{
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFacei)];
|
||||
}
|
||||
}
|
||||
|
||||
label dualFaceI = meshMod.addFace
|
||||
label dualFacei = meshMod.addFace
|
||||
(
|
||||
newFace,
|
||||
dualCellI, // own
|
||||
dualCelli, // own
|
||||
-1, // nei
|
||||
masterPointI, // masterPointID
|
||||
masterEdgeI, // masterEdgeID
|
||||
masterFaceI, // masterFaceID
|
||||
masterFacei, // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
patchi, // patchID
|
||||
zoneID, // zoneID
|
||||
@ -357,13 +357,13 @@ Foam::label Foam::meshDualiser::addBoundaryFace
|
||||
//pointField dualPoints(meshMod.points());
|
||||
//vector n(newFace.normal(dualPoints));
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated boundary dualFace:" << dualFaceI
|
||||
//Pout<< "Generated boundary dualFace:" << dualFacei
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " on dualowner:" << dualCellI
|
||||
// << " on dualowner:" << dualCelli
|
||||
// << endl;
|
||||
return dualFaceI;
|
||||
return dualFacei;
|
||||
}
|
||||
|
||||
|
||||
@ -376,7 +376,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
const bool splitFace,
|
||||
const PackedBoolList& isBoundaryEdge,
|
||||
const label edgeI,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
polyTopoChange& meshMod,
|
||||
boolList& doneEFaces
|
||||
) const
|
||||
@ -386,7 +386,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
|
||||
label fp = edgeFaceCirculator::getMinIndex
|
||||
(
|
||||
mesh_.faces()[startFaceI],
|
||||
mesh_.faces()[startFacei],
|
||||
e[0],
|
||||
e[1]
|
||||
);
|
||||
@ -394,7 +394,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
edgeFaceCirculator ie
|
||||
(
|
||||
mesh_,
|
||||
startFaceI, // face
|
||||
startFacei, // face
|
||||
true, // ownerSide
|
||||
fp, // fp
|
||||
isBoundaryEdge.get(edgeI) == 1 // isBoundaryEdge
|
||||
@ -475,7 +475,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
(
|
||||
-1, // masterPointI
|
||||
edgeI, // masterEdgeI
|
||||
-1, // masterFaceI
|
||||
-1, // masterFacei
|
||||
edgeOrder,
|
||||
currentDualCell0,
|
||||
currentDualCell1,
|
||||
@ -527,7 +527,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
(
|
||||
-1, // masterPointI
|
||||
edgeI, // masterEdgeI
|
||||
-1, // masterFaceI
|
||||
-1, // masterFacei
|
||||
edgeOrder,
|
||||
currentDualCell0,
|
||||
currentDualCell1,
|
||||
@ -621,7 +621,7 @@ void Foam::meshDualiser::createFaceFromInternalFace
|
||||
(
|
||||
-1, // masterPointI
|
||||
-1, // masterEdgeI
|
||||
facei, // masterFaceI
|
||||
facei, // masterFacei
|
||||
true, // edgeOrder,
|
||||
currentDualCell0,
|
||||
currentDualCell1,
|
||||
@ -642,7 +642,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
(
|
||||
const label patchi,
|
||||
const label patchPointI,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
polyTopoChange& meshMod,
|
||||
boolList& donePFaces // pFaces visited
|
||||
) const
|
||||
@ -660,7 +660,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
// pointFaces.
|
||||
|
||||
// Starting face
|
||||
label facei = startFaceI;
|
||||
label facei = startFacei;
|
||||
|
||||
DynamicList<label> verts(4);
|
||||
|
||||
@ -678,7 +678,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
// Insert face centre
|
||||
verts.append(faceToDualPoint_[facei]);
|
||||
|
||||
label dualCellI = findDualCell(own[facei], pointI);
|
||||
label dualCelli = findDualCell(own[facei], pointI);
|
||||
|
||||
// Get the edge before the patchPointI
|
||||
const face& f = mesh_.faces()[facei];
|
||||
@ -721,7 +721,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
}
|
||||
|
||||
// Check if different cell.
|
||||
if (dualCellI != findDualCell(own[facei], pointI))
|
||||
if (dualCelli != findDualCell(own[facei], pointI))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Different dual cells but no feature edge"
|
||||
@ -733,7 +733,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
|
||||
verts.shrink();
|
||||
|
||||
label dualCellI = findDualCell(own[facei], pointI);
|
||||
label dualCelli = findDualCell(own[facei], pointI);
|
||||
|
||||
//Bit dodgy: create dualface from the last face (instead of from
|
||||
// the central point). This will also use the original faceZone to
|
||||
@ -744,8 +744,8 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
//pointI, // masterPointI
|
||||
-1, // masterPointI
|
||||
-1, // masterEdgeI
|
||||
facei, // masterFaceI
|
||||
dualCellI,
|
||||
facei, // masterFacei
|
||||
dualCelli,
|
||||
patchi,
|
||||
verts,
|
||||
meshMod
|
||||
@ -753,7 +753,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
}
|
||||
else
|
||||
{
|
||||
label facei = startFaceI;
|
||||
label facei = startFacei;
|
||||
|
||||
// Storage for face
|
||||
DynamicList<label> verts(mesh_.faces()[facei].size());
|
||||
@ -798,7 +798,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
(
|
||||
-1, // masterPointI
|
||||
-1, // masterEdgeI
|
||||
facei, // masterFaceI
|
||||
facei, // masterFacei
|
||||
findDualCell(own[facei], pointI),
|
||||
patchi,
|
||||
verts.shrink(),
|
||||
@ -831,7 +831,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
}
|
||||
while
|
||||
(
|
||||
facei != startFaceI
|
||||
facei != startFacei
|
||||
&& facei >= pp.start()
|
||||
&& facei < pp.start()+pp.size()
|
||||
);
|
||||
@ -843,7 +843,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
|
||||
(
|
||||
-1, // masterPointI
|
||||
-1, // masterEdgeI
|
||||
startFaceI, // masterFaceI
|
||||
startFacei, // masterFacei
|
||||
findDualCell(own[facei], pointI),
|
||||
patchi,
|
||||
verts.shrink(),
|
||||
@ -1070,22 +1070,22 @@ void Foam::meshDualiser::setRefinement
|
||||
|
||||
pointToDualCells_[pointI].setSize(pCells.size());
|
||||
|
||||
forAll(pCells, pCellI)
|
||||
forAll(pCells, pCelli)
|
||||
{
|
||||
pointToDualCells_[pointI][pCellI] = meshMod.addCell
|
||||
pointToDualCells_[pointI][pCelli] = meshMod.addCell
|
||||
(
|
||||
pointI, //masterPointID
|
||||
-1, //masterEdgeID
|
||||
-1, //masterFaceID
|
||||
-1, //masterCellID
|
||||
mesh_.cellZones().whichZone(pCells[pCellI]) //zoneID
|
||||
mesh_.cellZones().whichZone(pCells[pCelli]) //zoneID
|
||||
);
|
||||
if (dualCcStr.valid())
|
||||
{
|
||||
meshTools::writeOBJ
|
||||
(
|
||||
dualCcStr(),
|
||||
0.5*(mesh_.points()[pointI]+cellCentres[pCells[pCellI]])
|
||||
0.5*(mesh_.points()[pointI]+cellCentres[pCells[pCelli]])
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1299,13 +1299,13 @@ void Foam::meshDualiser::setRefinement
|
||||
// happen for non-manifold edges where a single edge can
|
||||
// become multiple faces.
|
||||
|
||||
label startFaceI = eFaces[i];
|
||||
label startFacei = eFaces[i];
|
||||
|
||||
//Pout<< "Walking edge:" << edgeI
|
||||
// << " points:" << mesh_.points()[e[0]]
|
||||
// << mesh_.points()[e[1]]
|
||||
// << " startFace:" << startFaceI
|
||||
// << " at:" << mesh_.faceCentres()[startFaceI]
|
||||
// << " startFace:" << startFacei
|
||||
// << " at:" << mesh_.faceCentres()[startFacei]
|
||||
// << endl;
|
||||
|
||||
createFacesAroundEdge
|
||||
@ -1313,7 +1313,7 @@ void Foam::meshDualiser::setRefinement
|
||||
splitFace,
|
||||
isBoundaryEdge,
|
||||
edgeI,
|
||||
startFaceI,
|
||||
startFacei,
|
||||
meshMod,
|
||||
doneEFaces
|
||||
);
|
||||
@ -1407,20 +1407,20 @@ void Foam::meshDualiser::setRefinement
|
||||
if (!donePFaces[i])
|
||||
{
|
||||
// Starting face
|
||||
label startFaceI = pp.start()+pFaces[i];
|
||||
label startFacei = pp.start()+pFaces[i];
|
||||
|
||||
//Pout<< "Walking around point:" << pointI
|
||||
// << " coord:" << mesh_.points()[pointI]
|
||||
// << " on patch:" << patchi
|
||||
// << " startFace:" << startFaceI
|
||||
// << " at:" << mesh_.faceCentres()[startFaceI]
|
||||
// << " startFace:" << startFacei
|
||||
// << " at:" << mesh_.faceCentres()[startFacei]
|
||||
// << endl;
|
||||
|
||||
createFacesAroundBoundaryPoint
|
||||
(
|
||||
patchi,
|
||||
patchPointI,
|
||||
startFaceI,
|
||||
startFacei,
|
||||
meshMod,
|
||||
donePFaces // pFaces visited
|
||||
);
|
||||
|
||||
@ -117,7 +117,7 @@ class meshDualiser
|
||||
(
|
||||
const label masterPointI,
|
||||
const label masterEdgeI,
|
||||
const label masterFaceI,
|
||||
const label masterFacei,
|
||||
|
||||
const bool edgeOrder,
|
||||
const label dualCell0,
|
||||
@ -131,9 +131,9 @@ class meshDualiser
|
||||
(
|
||||
const label masterPointI,
|
||||
const label masterEdgeI,
|
||||
const label masterFaceI,
|
||||
const label masterFacei,
|
||||
|
||||
const label dualCellI,
|
||||
const label dualCelli,
|
||||
const label patchI,
|
||||
const DynamicList<label>& verts,
|
||||
polyTopoChange& meshMod
|
||||
@ -145,7 +145,7 @@ class meshDualiser
|
||||
const bool splitFace,
|
||||
const PackedBoolList&,
|
||||
const label edgeI,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
polyTopoChange&,
|
||||
boolList& doneEFaces
|
||||
) const;
|
||||
@ -163,7 +163,7 @@ class meshDualiser
|
||||
(
|
||||
const label patchI,
|
||||
const label patchPointI,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
polyTopoChange&,
|
||||
boolList& donePFaces // pFaces visited
|
||||
) const;
|
||||
|
||||
@ -329,9 +329,9 @@ int main(int argc, char *argv[])
|
||||
// Create cellSet with added cells for easy inspection
|
||||
cellSet newCells(mesh, "refinedCells", refCells.size());
|
||||
|
||||
forAll(oldToNew, oldCellI)
|
||||
forAll(oldToNew, oldCelli)
|
||||
{
|
||||
const labelList& added = oldToNew[oldCellI];
|
||||
const labelList& added = oldToNew[oldCelli];
|
||||
|
||||
forAll(added, i)
|
||||
{
|
||||
@ -372,21 +372,21 @@ int main(int argc, char *argv[])
|
||||
+ oldTimeName;
|
||||
|
||||
|
||||
forAll(oldToNew, oldCellI)
|
||||
forAll(oldToNew, oldCelli)
|
||||
{
|
||||
const labelList& added = oldToNew[oldCellI];
|
||||
const labelList& added = oldToNew[oldCelli];
|
||||
|
||||
if (added.size())
|
||||
{
|
||||
forAll(added, i)
|
||||
{
|
||||
newToOld[added[i]] = oldCellI;
|
||||
newToOld[added[i]] = oldCelli;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unrefined cell
|
||||
newToOld[oldCellI] = oldCellI;
|
||||
newToOld[oldCelli] = oldCelli;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,16 +174,16 @@ labelList getFaceOrder
|
||||
|
||||
labelList oldToNewFace(mesh.nFaces(), -1);
|
||||
|
||||
label newFaceI = 0;
|
||||
label newFacei = 0;
|
||||
|
||||
labelList nbr;
|
||||
labelList order;
|
||||
|
||||
forAll(cellOrder, newCellI)
|
||||
forAll(cellOrder, newCelli)
|
||||
{
|
||||
label oldCellI = cellOrder[newCellI];
|
||||
label oldCelli = cellOrder[newCelli];
|
||||
|
||||
const cell& cFaces = mesh.cells()[oldCellI];
|
||||
const cell& cFaces = mesh.cells()[oldCelli];
|
||||
|
||||
// Neighbouring cells
|
||||
nbr.setSize(cFaces.size());
|
||||
@ -195,16 +195,16 @@ labelList getFaceOrder
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
// Internal face. Get cell on other side.
|
||||
label nbrCellI = reverseCellOrder[mesh.faceNeighbour()[facei]];
|
||||
if (nbrCellI == newCellI)
|
||||
label nbrCelli = reverseCellOrder[mesh.faceNeighbour()[facei]];
|
||||
if (nbrCelli == newCelli)
|
||||
{
|
||||
nbrCellI = reverseCellOrder[mesh.faceOwner()[facei]];
|
||||
nbrCelli = reverseCellOrder[mesh.faceOwner()[facei]];
|
||||
}
|
||||
|
||||
if (newCellI < nbrCellI)
|
||||
if (newCelli < nbrCelli)
|
||||
{
|
||||
// CellI is master
|
||||
nbr[i] = nbrCellI;
|
||||
// Celli is master
|
||||
nbr[i] = nbrCelli;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -227,13 +227,13 @@ labelList getFaceOrder
|
||||
label index = order[i];
|
||||
if (nbr[index] != -1)
|
||||
{
|
||||
oldToNewFace[cFaces[index]] = newFaceI++;
|
||||
oldToNewFace[cFaces[index]] = newFacei++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Leave patch faces intact.
|
||||
for (label facei = newFaceI; facei < mesh.nFaces(); facei++)
|
||||
for (label facei = newFacei; facei < mesh.nFaces(); facei++)
|
||||
{
|
||||
oldToNewFace[facei] = facei;
|
||||
}
|
||||
@ -267,20 +267,20 @@ labelList getRegionFaceOrder
|
||||
|
||||
labelList oldToNewFace(mesh.nFaces(), -1);
|
||||
|
||||
label newFaceI = 0;
|
||||
label newFacei = 0;
|
||||
|
||||
label prevRegion = -1;
|
||||
|
||||
forAll(cellOrder, newCellI)
|
||||
forAll(cellOrder, newCelli)
|
||||
{
|
||||
label oldCellI = cellOrder[newCellI];
|
||||
label oldCelli = cellOrder[newCelli];
|
||||
|
||||
if (cellToRegion[oldCellI] != prevRegion)
|
||||
if (cellToRegion[oldCelli] != prevRegion)
|
||||
{
|
||||
prevRegion = cellToRegion[oldCellI];
|
||||
prevRegion = cellToRegion[oldCelli];
|
||||
}
|
||||
|
||||
const cell& cFaces = mesh.cells()[oldCellI];
|
||||
const cell& cFaces = mesh.cells()[oldCelli];
|
||||
|
||||
SortableList<label> nbr(cFaces.size());
|
||||
|
||||
@ -291,21 +291,21 @@ labelList getRegionFaceOrder
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
// Internal face. Get cell on other side.
|
||||
label nbrCellI = reverseCellOrder[mesh.faceNeighbour()[facei]];
|
||||
if (nbrCellI == newCellI)
|
||||
label nbrCelli = reverseCellOrder[mesh.faceNeighbour()[facei]];
|
||||
if (nbrCelli == newCelli)
|
||||
{
|
||||
nbrCellI = reverseCellOrder[mesh.faceOwner()[facei]];
|
||||
nbrCelli = reverseCellOrder[mesh.faceOwner()[facei]];
|
||||
}
|
||||
|
||||
if (cellToRegion[oldCellI] != cellToRegion[cellOrder[nbrCellI]])
|
||||
if (cellToRegion[oldCelli] != cellToRegion[cellOrder[nbrCelli]])
|
||||
{
|
||||
// Treat like external face. Do later.
|
||||
nbr[i] = -1;
|
||||
}
|
||||
else if (newCellI < nbrCellI)
|
||||
else if (newCelli < nbrCelli)
|
||||
{
|
||||
// CellI is master
|
||||
nbr[i] = nbrCellI;
|
||||
// Celli is master
|
||||
nbr[i] = nbrCelli;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -326,7 +326,7 @@ labelList getRegionFaceOrder
|
||||
{
|
||||
if (nbr[i] != -1)
|
||||
{
|
||||
oldToNewFace[cFaces[nbr.indices()[i]]] = newFaceI++;
|
||||
oldToNewFace[cFaces[nbr.indices()[i]]] = newFacei++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -367,12 +367,12 @@ labelList getRegionFaceOrder
|
||||
prevKey = key;
|
||||
}
|
||||
|
||||
oldToNewFace[sortKey.indices()[i]] = newFaceI++;
|
||||
oldToNewFace[sortKey.indices()[i]] = newFacei++;
|
||||
}
|
||||
}
|
||||
|
||||
// Leave patch faces intact.
|
||||
for (label facei = newFaceI; facei < mesh.nFaces(); facei++)
|
||||
for (label facei = newFacei; facei < mesh.nFaces(); facei++)
|
||||
{
|
||||
oldToNewFace[facei] = facei;
|
||||
}
|
||||
@ -477,8 +477,8 @@ autoPtr<mapPolyMesh> reorderMesh
|
||||
boolList newFlipMap(fZone.size());
|
||||
forAll(fZone, i)
|
||||
{
|
||||
label oldFaceI = fZone[i];
|
||||
newAddressing[i] = reverseFaceOrder[oldFaceI];
|
||||
label oldFacei = fZone[i];
|
||||
newAddressing[i] = reverseFaceOrder[oldFacei];
|
||||
if (flipFaceFlux.found(newAddressing[i]))
|
||||
{
|
||||
newFlipMap[i] = !fZone.flipMap()[i];
|
||||
@ -999,8 +999,8 @@ int main(int argc, char *argv[])
|
||||
label sortedI = mesh.nCells();
|
||||
forAllReverse(order, i)
|
||||
{
|
||||
label origCellI = bndCells[order[i]];
|
||||
newReverseCellOrder[origCellI] = --sortedI;
|
||||
label origCelli = bndCells[order[i]];
|
||||
newReverseCellOrder[origCelli] = --sortedI;
|
||||
}
|
||||
|
||||
Info<< "Ordered all " << nBndCells << " cells with a coupled face"
|
||||
@ -1009,12 +1009,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Compact
|
||||
sortedI = 0;
|
||||
forAll(cellOrder, newCellI)
|
||||
forAll(cellOrder, newCelli)
|
||||
{
|
||||
label origCellI = cellOrder[newCellI];
|
||||
if (newReverseCellOrder[origCellI] == -1)
|
||||
label origCelli = cellOrder[newCelli];
|
||||
if (newReverseCellOrder[origCelli] == -1)
|
||||
{
|
||||
newReverseCellOrder[origCellI] = sortedI++;
|
||||
newReverseCellOrder[origCelli] = sortedI++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1106,14 +1106,14 @@ int main(int argc, char *argv[])
|
||||
forAllConstIter(labelHashSet, fff, iter)
|
||||
{
|
||||
label facei = iter.key();
|
||||
label masterFaceI = faceProcAddressing[facei];
|
||||
label masterFacei = faceProcAddressing[facei];
|
||||
|
||||
faceProcAddressing[facei] = -masterFaceI;
|
||||
faceProcAddressing[facei] = -masterFacei;
|
||||
|
||||
if (masterFaceI == 0)
|
||||
if (masterFacei == 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " masterFaceI:" << masterFaceI << exit(FatalError);
|
||||
<< " masterFacei:" << masterFacei << exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,13 +81,13 @@ void writeVTK
|
||||
|
||||
faceList setFaces(currentSet.size());
|
||||
labelList faceValues(currentSet.size());
|
||||
label setFaceI = 0;
|
||||
label setFacei = 0;
|
||||
|
||||
forAllConstIter(topoSet, currentSet, iter)
|
||||
{
|
||||
setFaces[setFaceI] = mesh.faces()[iter.key()];
|
||||
faceValues[setFaceI] = iter.key();
|
||||
setFaceI++;
|
||||
setFaces[setFacei] = mesh.faces()[iter.key()];
|
||||
faceValues[setFacei] = iter.key();
|
||||
setFacei++;
|
||||
}
|
||||
|
||||
primitiveFacePatch fp(setFaces, mesh.points());
|
||||
@ -120,14 +120,14 @@ void writeVTK
|
||||
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
label otherCellI = mesh.faceOwner()[facei];
|
||||
label otherCelli = mesh.faceOwner()[facei];
|
||||
|
||||
if (otherCellI == celli)
|
||||
if (otherCelli == celli)
|
||||
{
|
||||
otherCellI = mesh.faceNeighbour()[facei];
|
||||
otherCelli = mesh.faceNeighbour()[facei];
|
||||
}
|
||||
|
||||
if (!currentSet.found(otherCellI))
|
||||
if (!currentSet.found(otherCelli))
|
||||
{
|
||||
cellFaces.insert(facei, celli);
|
||||
}
|
||||
@ -141,13 +141,13 @@ void writeVTK
|
||||
|
||||
faceList setFaces(cellFaces.size());
|
||||
labelList faceValues(cellFaces.size());
|
||||
label setFaceI = 0;
|
||||
label setFacei = 0;
|
||||
|
||||
forAllConstIter(Map<label>, cellFaces, iter)
|
||||
{
|
||||
setFaces[setFaceI] = mesh.faces()[iter.key()];
|
||||
faceValues[setFaceI] = iter(); // Cell ID
|
||||
setFaceI++;
|
||||
setFaces[setFacei] = mesh.faces()[iter.key()];
|
||||
faceValues[setFacei] = iter(); // Cell ID
|
||||
setFacei++;
|
||||
}
|
||||
|
||||
primitiveFacePatch fp(setFaces, mesh.points());
|
||||
|
||||
@ -159,41 +159,41 @@ void Foam::regionSide::visitConnectedFaces
|
||||
// we hit face on faceSet.
|
||||
|
||||
// Find face reachable from edge
|
||||
label otherFaceI = otherFace(mesh, celli, facei, edgeI);
|
||||
label otherFacei = otherFace(mesh, celli, facei, edgeI);
|
||||
|
||||
if (mesh.isInternalFace(otherFaceI))
|
||||
if (mesh.isInternalFace(otherFacei))
|
||||
{
|
||||
label otherCellI = celli;
|
||||
label otherCelli = celli;
|
||||
|
||||
// Keep on crossing faces/cells until back on face on
|
||||
// surface
|
||||
while (!region.found(otherFaceI))
|
||||
while (!region.found(otherFacei))
|
||||
{
|
||||
visitedFace.insert(otherFaceI);
|
||||
visitedFace.insert(otherFacei);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "visitConnectedFaces : celli:" << celli
|
||||
<< " found insideEdgeFace:" << otherFaceI
|
||||
<< " found insideEdgeFace:" << otherFacei
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// Cross otherFaceI into neighbouring cell
|
||||
otherCellI =
|
||||
// Cross otherFacei into neighbouring cell
|
||||
otherCelli =
|
||||
meshTools::otherCell
|
||||
(
|
||||
mesh,
|
||||
otherCellI,
|
||||
otherFaceI
|
||||
otherCelli,
|
||||
otherFacei
|
||||
);
|
||||
|
||||
otherFaceI =
|
||||
otherFacei =
|
||||
otherFace
|
||||
(
|
||||
mesh,
|
||||
otherCellI,
|
||||
otherFaceI,
|
||||
otherCelli,
|
||||
otherFacei,
|
||||
edgeI
|
||||
);
|
||||
}
|
||||
@ -203,8 +203,8 @@ void Foam::regionSide::visitConnectedFaces
|
||||
mesh,
|
||||
region,
|
||||
fenceEdges,
|
||||
otherCellI,
|
||||
otherFaceI,
|
||||
otherCelli,
|
||||
otherFacei,
|
||||
visitedFace
|
||||
);
|
||||
}
|
||||
@ -223,25 +223,25 @@ void Foam::regionSide::walkPointConnectedFaces
|
||||
const primitiveMesh& mesh,
|
||||
const labelHashSet& regionEdges,
|
||||
const label regionPointI,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
const label startEdgeI,
|
||||
labelHashSet& visitedEdges
|
||||
)
|
||||
{
|
||||
// Mark as visited
|
||||
insidePointFaces_.insert(startFaceI);
|
||||
insidePointFaces_.insert(startFacei);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "walkPointConnectedFaces : regionPointI:" << regionPointI
|
||||
<< " facei:" << startFaceI
|
||||
<< " facei:" << startFacei
|
||||
<< " edgeI:" << startEdgeI << " verts:"
|
||||
<< mesh.edges()[startEdgeI]
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Cross facei i.e. get edge not startEdgeI which uses regionPointI
|
||||
label edgeI = otherEdge(mesh, startFaceI, startEdgeI, regionPointI);
|
||||
label edgeI = otherEdge(mesh, startFacei, startEdgeI, regionPointI);
|
||||
|
||||
if (!regionEdges.found(edgeI))
|
||||
{
|
||||
@ -263,9 +263,9 @@ void Foam::regionSide::walkPointConnectedFaces
|
||||
|
||||
const labelList& eFaces = mesh.edgeFaces()[edgeI];
|
||||
|
||||
forAll(eFaces, eFaceI)
|
||||
forAll(eFaces, eFacei)
|
||||
{
|
||||
label facei = eFaces[eFaceI];
|
||||
label facei = eFaces[eFacei];
|
||||
|
||||
walkPointConnectedFaces
|
||||
(
|
||||
@ -353,7 +353,7 @@ void Foam::regionSide::walkAllPointConnectedFaces
|
||||
label edgeI = fEdges[fEdgeI];
|
||||
|
||||
// Get the face 'perpendicular' to facei on region.
|
||||
label otherFaceI = otherFace(mesh, celli, facei, edgeI);
|
||||
label otherFacei = otherFace(mesh, celli, facei, edgeI);
|
||||
|
||||
// Edge
|
||||
const edge& e = mesh.edges()[edgeI];
|
||||
@ -365,14 +365,14 @@ void Foam::regionSide::walkAllPointConnectedFaces
|
||||
|
||||
visitedPoint.insert(e.start());
|
||||
|
||||
//edgeI = otherEdge(mesh, otherFaceI, edgeI, e.start());
|
||||
//edgeI = otherEdge(mesh, otherFacei, edgeI, e.start());
|
||||
|
||||
walkPointConnectedFaces
|
||||
(
|
||||
mesh,
|
||||
regionEdges,
|
||||
e.start(),
|
||||
otherFaceI,
|
||||
otherFacei,
|
||||
edgeI,
|
||||
visitedEdges
|
||||
);
|
||||
@ -384,14 +384,14 @@ void Foam::regionSide::walkAllPointConnectedFaces
|
||||
|
||||
visitedPoint.insert(e.end());
|
||||
|
||||
//edgeI = otherEdge(mesh, otherFaceI, edgeI, e.end());
|
||||
//edgeI = otherEdge(mesh, otherFacei, edgeI, e.end());
|
||||
|
||||
walkPointConnectedFaces
|
||||
(
|
||||
mesh,
|
||||
regionEdges,
|
||||
e.end(),
|
||||
otherFaceI,
|
||||
otherFacei,
|
||||
edgeI,
|
||||
visitedEdges
|
||||
);
|
||||
@ -409,8 +409,8 @@ Foam::regionSide::regionSide
|
||||
const primitiveMesh& mesh,
|
||||
const labelHashSet& region, // faces of region
|
||||
const labelHashSet& fenceEdges, // outside edges
|
||||
const label startCellI,
|
||||
const label startFaceI
|
||||
const label startCelli,
|
||||
const label startFacei
|
||||
)
|
||||
:
|
||||
sideOwner_(region.size()),
|
||||
@ -427,8 +427,8 @@ Foam::regionSide::regionSide
|
||||
mesh,
|
||||
region,
|
||||
fenceEdges,
|
||||
startCellI,
|
||||
startFaceI,
|
||||
startCelli,
|
||||
startFacei,
|
||||
visitedFace
|
||||
);
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ class regionSide
|
||||
const primitiveMesh& mesh,
|
||||
const labelHashSet& regionEdges,
|
||||
const label regionPointI,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
const label startEdgeI,
|
||||
labelHashSet& visitedEdges
|
||||
);
|
||||
@ -128,7 +128,7 @@ public:
|
||||
(
|
||||
const primitiveMesh& mesh,
|
||||
const label celli,
|
||||
const label excludeFaceI,
|
||||
const label excludeFacei,
|
||||
const label edgeI
|
||||
);
|
||||
|
||||
|
||||
@ -200,15 +200,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Find sides reachable from 0th face of faceSet
|
||||
label startFaceI = faces[0];
|
||||
label startFacei = faces[0];
|
||||
|
||||
regionSide regionInfo
|
||||
(
|
||||
mesh,
|
||||
facesSet,
|
||||
fenceEdges,
|
||||
mesh.faceOwner()[startFaceI],
|
||||
startFaceI
|
||||
mesh.faceOwner()[startFacei],
|
||||
startFacei
|
||||
);
|
||||
|
||||
// Determine flip state for all faces in faceSet
|
||||
|
||||
@ -972,19 +972,19 @@ void createAndWriteRegion
|
||||
{
|
||||
// face + turning index. (see decomposePar)
|
||||
// Is the face pointing in the same direction?
|
||||
label oldFaceI = map().faceMap()[facei];
|
||||
label oldFacei = map().faceMap()[facei];
|
||||
|
||||
if
|
||||
(
|
||||
map().cellMap()[newMesh().faceOwner()[facei]]
|
||||
== mesh.faceOwner()[oldFaceI]
|
||||
== mesh.faceOwner()[oldFacei]
|
||||
)
|
||||
{
|
||||
faceProcAddressing[facei] = oldFaceI+1;
|
||||
faceProcAddressing[facei] = oldFacei+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceProcAddressing[facei] = -(oldFaceI+1);
|
||||
faceProcAddressing[facei] = -(oldFacei+1);
|
||||
}
|
||||
}
|
||||
Info<< "Writing map " << faceProcAddressing.name()
|
||||
@ -1261,15 +1261,15 @@ void matchRegions
|
||||
Pstream::gatherList(zoneNames);
|
||||
Pstream::scatterList(zoneNames);
|
||||
|
||||
forAll(zoneNames, procI)
|
||||
forAll(zoneNames, proci)
|
||||
{
|
||||
if (zoneNames[procI] != zoneNames[0])
|
||||
if (zoneNames[proci] != zoneNames[0])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "cellZones not synchronised across processors." << endl
|
||||
<< "Master has cellZones " << zoneNames[0] << endl
|
||||
<< "Processor " << procI
|
||||
<< " has cellZones " << zoneNames[procI]
|
||||
<< "Processor " << proci
|
||||
<< " has cellZones " << zoneNames[proci]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -1561,14 +1561,14 @@ int main(int argc, char *argv[])
|
||||
<< " This requires all"
|
||||
<< " cells to be in one and only one cellZone." << nl << endl;
|
||||
|
||||
label unzonedCellI = findIndex(zoneID, -1);
|
||||
if (unzonedCellI != -1)
|
||||
label unzonedCelli = findIndex(zoneID, -1);
|
||||
if (unzonedCelli != -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "For the cellZonesOnly option all cells "
|
||||
<< "have to be in a cellZone." << endl
|
||||
<< "Cell " << unzonedCellI
|
||||
<< " at" << mesh.cellCentres()[unzonedCellI]
|
||||
<< "Cell " << unzonedCelli
|
||||
<< " at" << mesh.cellCentres()[unzonedCelli]
|
||||
<< " is not in a cellZone. There might be more unzoned cells."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -1610,14 +1610,14 @@ int main(int argc, char *argv[])
|
||||
labelList newNeiZoneID(mesh.nFaces()-mesh.nInternalFaces());
|
||||
getZoneID(mesh, newCellZones, newZoneID, newNeiZoneID);
|
||||
|
||||
label unzonedCellI = findIndex(newZoneID, -1);
|
||||
if (unzonedCellI != -1)
|
||||
label unzonedCelli = findIndex(newZoneID, -1);
|
||||
if (unzonedCelli != -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "For the cellZonesFileOnly option all cells "
|
||||
<< "have to be in a cellZone." << endl
|
||||
<< "Cell " << unzonedCellI
|
||||
<< " at" << mesh.cellCentres()[unzonedCellI]
|
||||
<< "Cell " << unzonedCelli
|
||||
<< " at" << mesh.cellCentres()[unzonedCelli]
|
||||
<< " is not in a cellZone. There might be more unzoned cells."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user