polyTopoChange: Removed restrictive faceZone functionality

Now faceZones are handled directly by the applications and the new
faceZone::topoChange function so that any face can now be in any number of
zones, significantly increasing the flexibility and usefulness of faceZones.

This completes the generalisation of cellZone, faceZone and pointZone to support
multiple zones for each cell, face or point respectively.  Next step will be to
make zones polymorphic and run-time selectable so that they can alter during the
run and adapt to moving meshes for example.
This commit is contained in:
Henry Weller
2024-03-25 14:32:59 +00:00
parent 7c86fc69bb
commit a833a81560
41 changed files with 296 additions and 1379 deletions

View File

@ -70,8 +70,6 @@ void modifyOrAddFace
const label own,
const bool flipFaceFlux,
const label newPatchi,
const label zoneID,
const bool zoneFlip,
PackedBoolList& modifiedFace
)
@ -86,9 +84,7 @@ void modifyOrAddFace
own, // owner
-1, // neighbour
flipFaceFlux, // face flip
newPatchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchi // patch for face
);
modifiedFace[facei] = 1;
}
@ -102,9 +98,7 @@ void modifyOrAddFace
-1, // neighbour
facei, // master face
flipFaceFlux, // face flip
newPatchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchi // patch for face
);
}
}
@ -308,21 +302,11 @@ void createCoupledBaffles
PackedBoolList& modifiedFace
)
{
const meshFaceZones& faceZones = mesh.faceZones();
forAll(coupledWantedPatch, facei)
{
if (coupledWantedPatch[facei] != -1)
{
const face& f = mesh.faces()[facei];
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Use owner side of face
modifyOrAddFace
@ -333,21 +317,11 @@ void createCoupledBaffles
mesh.faceOwner()[facei], // owner
false, // face flip
coupledWantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add status
);
if (mesh.isInternalFace(facei))
{
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Use neighbour side of face
modifyOrAddFace
(
@ -357,8 +331,6 @@ void createCoupledBaffles
mesh.faceNeighbour()[facei],// owner
false, // face flip
coupledWantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add status
);
}
@ -376,23 +348,12 @@ void createCyclicCoupledBaffles
PackedBoolList& modifiedFace
)
{
const meshFaceZones& faceZones = mesh.faceZones();
forAll(cyclicMasterPatch, facei)
{
if (cyclicMasterPatch[facei] != -1)
{
const face& f = mesh.faces()[facei];
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
modifyOrAddFace
(
meshMod,
@ -401,8 +362,6 @@ void createCyclicCoupledBaffles
mesh.faceNeighbour()[facei], // owner
false, // face flip
cyclicMasterPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add
);
}
@ -415,14 +374,6 @@ void createCyclicCoupledBaffles
const face& f = mesh.faces()[facei];
if (mesh.isInternalFace(facei))
{
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Use owner side of face
modifyOrAddFace
(
@ -432,8 +383,6 @@ void createCyclicCoupledBaffles
mesh.faceOwner()[facei], // owner
false, // face flip
cyclicSlavePatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add status
);
}
@ -449,23 +398,12 @@ void createBaffles
polyTopoChange& meshMod
)
{
const meshFaceZones& faceZones = mesh.faceZones();
Info << "faceZone:createBaffle " << faceZones << endl;
forAll(wantedPatch, facei)
{
if (wantedPatch[facei] != -1)
{
const face& f = mesh.faces()[facei];
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.modifyFace
(
f, // modified face
@ -473,22 +411,11 @@ void createBaffles
mesh.faceOwner()[facei], // owner
-1, // neighbour
false, // face flip
wantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
wantedPatch[facei] // patch for face
);
if (mesh.isInternalFace(facei))
{
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.addFace
(
f.reverseFace(), // modified face
@ -496,9 +423,7 @@ void createBaffles
-1, // neighbour
facei, // masterFaceID,
false, // face flip
wantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
wantedPatch[facei] // patch for face
);
}
}

View File

@ -191,13 +191,6 @@ label mergePatchFaces
// Restore. Get face properties.
label own = mesh.faceOwner()[newMasterI];
label zoneID = mesh.faceZones().whichZone(newMasterI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)];
}
label patchID = mesh.boundaryMesh().whichPatch(newMasterI);
Pout<< "Restoring new master face " << newMasterI
@ -211,12 +204,9 @@ label mergePatchFaces
own, // owner
-1, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
// Add the previously removed faces
for (label i = 1; i < setFaces.size(); i++)
{
@ -230,9 +220,7 @@ label mergePatchFaces
-1, // neighbour,
newMasterI, // masterFaceID,
false, // flipFaceFlux,
patchID, // patchID,
zoneID, // zoneID,
zoneFlip // zoneFlip
patchID // patchID,
);
}
}

View File

@ -1296,9 +1296,7 @@ int main(int argc, char *argv[])
neighbour[facei],
facei, // masterFace
false, // flipFaceFlux
-1, // patchID
faceZonei, // zoneID
fm[facei] // zoneFlip
-1 // patchID
);
}
@ -1345,9 +1343,7 @@ int main(int argc, char *argv[])
-1,
facei, // masterFace
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
patchi // patchID
);
// For baffles create the opposite face
@ -1360,9 +1356,7 @@ int main(int argc, char *argv[])
-1,
facei, // masterFace
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
patchi // patchID
);
}
}
@ -1408,9 +1402,7 @@ int main(int argc, char *argv[])
neighbour[facei],
facei, // masterFace
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
-1 // patchID
);
}
}
@ -1459,6 +1451,27 @@ int main(int argc, char *argv[])
);
}
// Add the face zones as required
forAll(faceZoneIDs, faceZonei)
{
const label cgi = faceZoneIDs[faceZonei];
mesh.faceZones()[faceZonei].resetAddressing
(
identityMap
(
faceGroupStartIndex[cgi],
faceGroupEndIndex[cgi] + 1 - faceGroupStartIndex[cgi]
),
boolList::subList
(
fm,
faceGroupEndIndex[cgi] + 1 - faceGroupStartIndex[cgi],
faceGroupStartIndex[cgi]
)
);
}
mesh.setInstance(runTime.constant());
// Set the precision of the points data to 10

View File

@ -224,14 +224,6 @@ void Foam::extrude2DMesh::setRefinement
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
{
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID != -1)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
face newFace(4);
const face& f = faces[facei];
newFace[0] = f[0] + currentLayerOffset;
@ -248,9 +240,7 @@ void Foam::extrude2DMesh::setRefinement
mesh_.faceNeighbour()[facei] + offset, // nei
nFaces++, // masterFaceID
false, // flipFaceFlux
-1, // patchID
zoneID, // zoneID
zoneFlip // zoneFlip
-1 // patchID
);
if (debug)
@ -276,14 +266,6 @@ void Foam::extrude2DMesh::setRefinement
for (label facei = startFacei; facei < endFacei; facei++)
{
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID != -1)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
face newFace(4);
const face& f = faces[facei];
newFace[0] = f[0] + currentLayerOffset;
@ -300,9 +282,7 @@ void Foam::extrude2DMesh::setRefinement
-1, // nei
nFaces++, // masterFaceID
false, // flipFaceFlux
patchi, // patchID
zoneID, // zoneID
zoneFlip // zoneFlip
patchi // patchID
);
if (debug)
@ -393,9 +373,7 @@ void Foam::extrude2DMesh::setRefinement
nei, // nei
nFaces++, // masterFaceID
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
-1 // patchID
);
if (debug)
@ -472,9 +450,7 @@ void Foam::extrude2DMesh::setRefinement
-1, // nei
nFaces++, // masterFaceID
false, // flipFaceFlux
backPatchi_, // patchID
-1, // zoneID
false // zoneFlip
backPatchi_ // patchID
);
if (debug)
@ -500,9 +476,7 @@ void Foam::extrude2DMesh::setRefinement
-1, // nei
nFaces++, // masterFaceID
false, // flipFaceFlux
frontPatchi_, // patchID
-1, // zoneID
false // zoneFlip
frontPatchi_ // patchID
);
if (debug)

View File

@ -425,14 +425,6 @@ int main(int argc, char *argv[])
nei = mesh.faceNeighbour()[patchFacei];
}
label zoneI = mesh.faceZones().whichZone(patchFacei);
bool zoneFlip = false;
if (zoneI != -1)
{
label index = mesh.faceZones()[zoneI].whichFace(patchFacei);
zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
}
meshMod.modifyFace
(
mesh.faces()[patchFacei].reverseFace(), // modified face
@ -440,9 +432,7 @@ int main(int argc, char *argv[])
own, // owner
nei, // neighbour
true, // face flip
patchi, // patch for face
zoneI, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
}
@ -968,30 +958,11 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
const word cutZoneName("originalCutFaceZone");
List<faceZone*> fz
(
1,
new faceZone
(
cutZoneName,
frontPatchFaces,
boolList(frontPatchFaces.size(), false),
mesh.faceZones()
)
);
mesh.addZones(List<pointZone*>(0), fz, List<cellZone*>(0));
// Add the perfect interface mesh modifier
perfectInterface perfectStitcher
(
"couple",
mesh,
cutZoneName,
word::null, // dummy patch name
word::null // dummy patch name
);

View File

@ -1896,9 +1896,7 @@ int main(int argc, char *argv[])
mesh.faceOwner()[meshFacei],// owner
-1, // neighbour
false, // face flip
interMeshBottomPatch[zonei],// patch for face
zoneMeshZoneID[zonei], // zone for face
false // face flip in zone
interMeshBottomPatch[zonei] // patch for face
);
}
else if (mesh.isInternalFace(meshFacei))
@ -1910,9 +1908,7 @@ int main(int argc, char *argv[])
mesh.faceNeighbour()[meshFacei],// owner
-1, // neighbour
true, // face flip
interMeshBottomPatch[zonei], // patch for face
zoneMeshZoneID[zonei], // zone for face
true // face flip in zone
interMeshBottomPatch[zonei] // patch for face
);
}
}
@ -1935,9 +1931,7 @@ int main(int argc, char *argv[])
mesh.faceOwner()[meshFacei],// owner
-1, // neighbour
false, // face flip
interMeshTopPatch[zonei], // patch for face
zoneMeshZoneID[zonei], // zone for face
false // face flip in zone
interMeshTopPatch[zonei] // patch for face
);
}
else if (mesh.isInternalFace(meshFacei))
@ -1949,9 +1943,7 @@ int main(int argc, char *argv[])
mesh.faceNeighbour()[meshFacei],// owner
-1, // neighbour
true, // face flip
interMeshTopPatch[zonei], // patch for face
zoneMeshZoneID[zonei], // zone for face
true // face flip in zone
interMeshTopPatch[zonei] // patch for face
);
}
}
@ -1973,9 +1965,7 @@ int main(int argc, char *argv[])
-1, // neighbour
meshFacei, // master face
true, // flip flux
interMeshTopPatch[zonei], // patch for face
-1, // zone for face
false // face flip in zone
interMeshTopPatch[zonei] // patch for face
);
}
}
@ -1988,9 +1978,7 @@ int main(int argc, char *argv[])
-1, // neighbour
meshFacei, // master face
false, // flip flux
interMeshTopPatch[zonei], // patch for face
-1, // zone for face
false // zone flip
interMeshTopPatch[zonei] // patch for face
);
}
}

View File

@ -138,8 +138,6 @@ void modifyOrAddFace
const label own,
const bool flipFaceFlux,
const label newPatchi,
const label zoneID,
const bool zoneFlip,
PackedBoolList& modifiedFace
)
{
@ -153,9 +151,7 @@ void modifyOrAddFace
own, // owner
-1, // neighbour
flipFaceFlux, // face flip
newPatchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchi // patch for face
);
modifiedFace[facei] = 1;
@ -170,9 +166,7 @@ void modifyOrAddFace
-1, // neighbour
facei, // master face
flipFaceFlux, // face flip
newPatchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchi // patch for face
);
}
}
@ -183,7 +177,6 @@ label createFaces
const bool internalFacesOnly,
const fvMesh& mesh,
const faceZone& fZone,
const label fZonei,
const label newOwnerPatchi,
const label newNeighbourPatchi,
polyTopoChange& meshMod,
@ -212,8 +205,6 @@ label createFaces
mesh.faceOwner()[facei],// owner
false, // face flip
newOwnerPatchi, // patch for face
fZonei, // zone for face
false, // face flip in zone
modifiedFace // modify or add status
);
}
@ -231,8 +222,6 @@ label createFaces
mesh.faceNeighbour()[facei],// owner
true, // face flip
newOwnerPatchi, // patch for face
fZonei, // zone for face
false, // face flip in zone
modifiedFace // modify or add status
);
}
@ -259,8 +248,6 @@ label createFaces
mesh.faceNeighbour()[facei], // owner
true, // face flip
newNeighbourPatchi, // patch for face
fZonei, // zone for face
true, // face flip in zone
modifiedFace // modify or add
);
}
@ -275,8 +262,6 @@ label createFaces
mesh.faceOwner()[facei],// owner
false, // face flip
newNeighbourPatchi, // patch for face
fZonei, // zone for face
true, // face flip in zone
modifiedFace // modify or add status
);
}
@ -323,8 +308,6 @@ label createFaces
mesh.faceOwner()[facei], // owner
false, // face flip
newPp.index(), // patch for face
fZonei, // zone for face
fZone.flipMap()[zoneFacei], // face flip in zone
modifiedFace // modify or add
);
@ -632,7 +615,6 @@ int main(int argc, char *argv[])
internalFacesOnly,
mesh,
fZone,
fZonei,
newPatchIDs[0],
newPatchIDs[1],
meshMod,

View File

@ -61,17 +61,6 @@ void changePatchID
polyTopoChange& meshMod
)
{
const label zoneID = mesh.faceZones().whichZone(faceID);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)];
}
meshMod.modifyFace
(
mesh.faces()[faceID], // face
@ -79,9 +68,7 @@ void changePatchID
mesh.faceOwner()[faceID], // owner
-1, // neighbour
false, // flip flux
patchID, // patch ID
zoneID, // zone ID
zoneFlip // zone flip
patchID // patch ID
);
}

View File

@ -88,7 +88,6 @@ void mergeDuplicateBoundaryFaces
const faceList& faces = mesh.faces();
const labelList& faceOwner = mesh.faceOwner();
const meshFaceZones& faceZones = mesh.faceZones();
forAll(duplicates, bFacei)
{
@ -107,14 +106,6 @@ void mergeDuplicateBoundaryFaces
if (own0 < own1)
{
// Use face0 as the new internal face.
label zoneID = faceZones.whichZone(face0);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(face0)];
}
meshMod.removeFace(face1, -1);
meshMod.modifyFace
@ -124,22 +115,12 @@ void mergeDuplicateBoundaryFaces
own0, // owner
own1, // neighbour
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
-1 // patch for face
);
}
else
{
// Use face1 as the new internal face.
label zoneID = faceZones.whichZone(face1);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(face1)];
}
meshMod.removeFace(face0, -1);
meshMod.modifyFace
@ -149,9 +130,7 @@ void mergeDuplicateBoundaryFaces
own1, // owner
own0, // neighbour
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
-1 // patch for face
);
}
}

View File

@ -162,11 +162,14 @@ Foam::mergePolyMesh::mergePolyMesh(polyMesh& mesh)
{
faceZoneNames_.setCapacity(2*curFaceZoneNames.size());
}
forAll(curFaceZoneNames, zonei)
{
faceZoneNames_.append(curFaceZoneNames[zonei]);
}
faceZonesAddedFaces_.setSize(faceZoneNames_.size());
// Cell zones
wordList curCellZoneNames = mesh_.cellZones().names();
@ -278,8 +281,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
const labelList& own = m.faceOwner();
const labelList& nei = m.faceNeighbour();
label newOwn, newNei, newPatch, newZone;
bool newZoneFlip;
label newOwn, newNei, newPatch;
forAll(f, facei)
{
@ -326,18 +328,6 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
newNei = renumberCells[newNei];
}
newZone = fz.whichZone(facei);
newZoneFlip = false;
if (newZone >= 0)
{
newZoneFlip = fz[newZone].flipMap()[fz[newZone].whichFace(facei)];
// Grab the new zone
newZone = faceZoneIndices[newZone];
}
renumberFaces[facei] = meshMod_.addFace
(
newFace,
@ -345,10 +335,18 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
newNei,
-1,
false,
newPatch,
newZone,
newZoneFlip
newPatch
);
const labelList zones(fz.whichZones(facei));
forAll(zones, zonei)
{
const faceZone& fzi = fz[zones[zonei]];
const bool flip = fzi.flipMap()[fzi.whichFace(facei)];
faceZonesAddedFaces_[faceZoneIndices[zonei]]
.insert(renumberFaces[facei], flip);
}
}
}
@ -506,6 +504,12 @@ void Foam::mergePolyMesh::merge()
mesh_.pointZones()[zonei].insert(pointZonesAddedPoints_[zonei]);
}
// Add the new faces to the faceZones in the merged mesh
forAll(faceZonesAddedFaces_, zonei)
{
mesh_.faceZones()[zonei].insert(faceZonesAddedFaces_[zonei]);
}
// Add the new cells to the cellZones in the merged mesh
forAll(cellZonesAddedCells_, zonei)
{

View File

@ -72,6 +72,9 @@ class mergePolyMesh
//- Face zone names
DynamicList<word> faceZoneNames_;
//- Zones of the added faces
List<Map<bool>> faceZonesAddedFaces_;
//- Cell zone names
DynamicList<word> cellZoneNames_;

View File

@ -187,9 +187,7 @@ Foam::label Foam::meshDualiser::addInternalFace
dualCell1, // nei
masterFacei, // masterFaceID
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
-1 // patchID
);
// pointField dualPoints(meshMod.points());
@ -212,9 +210,7 @@ Foam::label Foam::meshDualiser::addInternalFace
dualCell0, // nei
masterFacei, // masterFaceID
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
-1 // patchID
);
// pointField dualPoints(meshMod.points());
@ -253,9 +249,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace
-1, // nei
masterFacei, // masterFaceID
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
patchi // patchID
);
// pointField dualPoints(meshMod.points());

View File

@ -293,6 +293,41 @@ void addToInterface
}
label whichZone
(
const polyMesh& mesh,
const bool useFaceZones,
const label facei
)
{
if (useFaceZones)
{
const labelList zones(mesh.faceZones().whichZones(facei));
if (zones.size() == 0)
{
return -1;
}
else if (zones.size() == 1)
{
return zones[0];
}
else
{
FatalErrorInFunction
<< "Face " << facei << " is in more than one zone " << zones
<< exit(FatalError);
return -1;
}
}
else
{
return -1;
}
}
// Get region-region interface name and sizes.
// Returns interfaces as straight list for looping in identical order.
void getInterfaceSizes
@ -326,7 +361,7 @@ void getInterfaceSizes
addToInterface
(
mesh,
(useFaceZones ? mesh.faceZones().whichZone(facei) : -1),
whichZone(mesh, useFaceZones, facei),
ownRegion,
neiRegion,
regionsToSize
@ -358,7 +393,7 @@ void getInterfaceSizes
addToInterface
(
mesh,
(useFaceZones ? mesh.faceZones().whichZone(facei) : -1),
whichZone(mesh, useFaceZones, facei),
ownRegion,
neiRegion,
regionsToSize
@ -517,11 +552,7 @@ void getInterfaceSizes
if (ownRegion != neiRegion)
{
label zoneID = -1;
if (useFaceZones)
{
zoneID = mesh.faceZones().whichZone(facei);
}
const label zoneID = whichZone(mesh, useFaceZones, facei);
edge interface
(
@ -540,11 +571,7 @@ void getInterfaceSizes
if (ownRegion != neiRegion)
{
label zoneID = -1;
if (useFaceZones)
{
zoneID = mesh.faceZones().whichZone(facei);
}
const label zoneID = whichZone(mesh, useFaceZones, facei);
edge interface
(

View File

@ -116,24 +116,13 @@ bool repatchFace
if (nearest[bFacei] != -1)
{
// Use boundary mesh one.
label rMeshPatchID = rMesh.whichPatch(nearest[bFacei]);
const label rMeshPatchID = rMesh.whichPatch(nearest[bFacei]);
label patchID = surfToMeshPatch[rMeshPatchID];
const label patchID = surfToMeshPatch[rMeshPatchID];
if (patchID != mesh.boundaryMesh().whichPatch(facei))
{
label own = mesh.faceOwner()[facei];
label zoneID = mesh.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
const label own = mesh.faceOwner()[facei];
meshMod.modifyFace
(
@ -142,9 +131,7 @@ bool repatchFace
own, // owner
-1, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
changed = true;
@ -154,6 +141,7 @@ bool repatchFace
{
changed = false;
}
return changed;
}

View File

@ -158,6 +158,21 @@ Foam::MeshZones<ZoneType, MeshType>::~MeshZones()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::found(const label objectIndex) const
{
forAll(*this, zi)
{
if (this->operator[](zi).localIndex(objectIndex) != -1)
{
return true;
}
}
return false;
}
template<class ZoneType, class MeshType>
Foam::labelList Foam::MeshZones<ZoneType, MeshType>::whichZones
(
@ -178,26 +193,6 @@ Foam::labelList Foam::MeshZones<ZoneType, MeshType>::whichZones
}
template<class ZoneType, class MeshType>
Foam::label Foam::MeshZones<ZoneType, MeshType>::whichZone
(
const label objectIndex
) const
{
label zoneIndex = -1;
forAll(*this, zi)
{
if (this->operator[](zi).localIndex(objectIndex) != -1)
{
zoneIndex = zi;
}
}
return zoneIndex;
}
template<class ZoneType, class MeshType>
Foam::boolList Foam::MeshZones<ZoneType, MeshType>::zonesFlipFace
(

View File

@ -127,14 +127,12 @@ public:
return mesh_;
}
//- Return true if objectIndex is in any zone
bool found(const label objectIndex) const;
//- Given a global object index, return the list of zones it is in
labelList whichZones(const label objectIndex) const;
//- Given a global object index, return the zone it is in.
// If object does not belong to any zones, return -1
// *** This will be replaced by whichZones
label whichZone(const label objectIndex) const;
//- Return the list of flips for the facei
// for each of the face zones in faceiZones
boolList zonesFlipFace

View File

@ -179,19 +179,18 @@ void Foam::faceZone::checkAddressing() const
}
void Foam::faceZone::reset(const Map<bool>& indices)
void Foam::faceZone::reset(const Map<bool>& newIndices)
{
clearAddressing();
labelList::setSize(indices.size());
labelList& indices = *this;
indices = newIndices.sortedToc();
flipMap_.setSize(indices.size());
label i = 0;
forAllConstIter(Map<bool>, indices, iter)
forAll(flipMap_, i)
{
operator[](i) = iter.key();
flipMap_[i] = *iter;
i++;
flipMap_[i] = newIndices[indices[i]];
}
}
@ -506,17 +505,23 @@ void Foam::faceZone::swap(faceZone& fz)
void Foam::faceZone::topoChange(const polyTopoChangeMap& map)
{
/*
Map<bool> indices;
const labelList& faceMap = map.faceMap();
const labelList& reverseFaceMap = map.reverseFaceMap();
const labelHashSet& flipFaceFlux = map.flipFaceFlux();
forAll(faceMap, facei)
{
const label i = localIndex(faceMap[facei]);
if (faceMap[facei] >= 0 && i != -1)
{
indices.insert(facei, flipMap_[i]);
indices.insert
(
facei,
flipFaceFlux.found(facei)
? !flipMap_[i]
: flipMap_[i]
);
}
}
@ -525,12 +530,17 @@ void Foam::faceZone::topoChange(const polyTopoChangeMap& map)
const label i = localIndex(facei);
if (reverseFaceMap[facei] >= 0 && i != -1)
{
indices.insert(reverseFaceMap[facei], flipMap_[i]);
indices.insert
(
reverseFaceMap[facei],
flipFaceFlux.found(reverseFaceMap[facei])
? !flipMap_[i]
: flipMap_[i]
);
}
}
reset(indices);
*/
}

View File

@ -272,9 +272,7 @@ void Foam::polyMeshUnMergeCyclics(polyMesh& mesh, const scalar includedAngle)
false,
patchFaceHalves[patchFacei]
? patchHalf0[patchi]
: patchHalf1[patchi],
-1,
false
: patchHalf1[patchi]
);
}
}

View File

@ -710,15 +710,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::splitFaces
nei = mesh_.faceNeighbour()[facei];
}
const label zonei = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zonei != -1)
{
const faceZone& fz = mesh_.faceZones()[zonei];
zoneFlip = fz.flipMap()[fz.whichFace(facei)];
}
if (debug)
{
Pout<< "face:" << facei << " verts:" << f
@ -734,9 +725,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::splitFaces
own, // owner
nei, // neighbour
false, // face flip
patchi, // patch for face
zonei, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
meshMod.addFace
@ -746,9 +735,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::splitFaces
nei, // neighbour
facei, // master face
false, // face flip
patchi, // patch for face
zonei, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
}

View File

@ -27,7 +27,6 @@ License
#include "refinementSurfaces.H"
#include "faceSet.H"
#include "polyTopoChange.H"
#include "meshTools.H"
#include "localPointRegion.H"
#include "duplicatePoints.H"
#include "regionSplit.H"
@ -37,7 +36,6 @@ License
#include "patchFaceOrientation.H"
#include "PatchEdgeFaceWave.H"
#include "patchEdgeFaceRegion.H"
#include "OSspecific.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -50,14 +48,6 @@ Foam::label Foam::meshRefinement::createBaffle
) const
{
const face& f = mesh_.faces()[facei];
const label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.modifyFace
(
@ -66,12 +56,9 @@ Foam::label Foam::meshRefinement::createBaffle
mesh_.faceOwner()[facei], // owner
-1, // neighbour
false, // face flip
ownPatch, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
ownPatch // patch for face
);
label dupFacei = -1;
if (mesh_.isInternalFace(facei))
@ -84,12 +71,6 @@ Foam::label Foam::meshRefinement::createBaffle
<< " ownPatch:" << ownPatch << abort(FatalError);
}
bool reverseFlip = false;
if (zoneID >= 0)
{
reverseFlip = !zoneFlip;
}
dupFacei = meshMod.addFace
(
f.reverseFace(), // modified face
@ -97,9 +78,7 @@ Foam::label Foam::meshRefinement::createBaffle
-1, // neighbour
facei, // masterFaceID,
true, // face flip
nbrPatch, // patch for face
zoneID, // zone for face
reverseFlip // face flip in zone
nbrPatch // patch for face
);
}
return dupFacei;
@ -431,18 +410,21 @@ void Foam::meshRefinement::checkZoneFaces() const
forAll(pp, i)
{
const label facei = pp.start() + i;
const label zonei = fZones.whichZone(facei);
const labelList zones = fZones.whichZones(facei);
if (zonei != -1)
forAll(zones, zonei)
{
if (zones[zonei] != -1)
{
FatalErrorInFunction
<< "face:" << facei << " on patch " << pp.name()
<< " is in zone " << fZones[zonei].name()
<< " is in zone " << fZones[zones[zonei]].name()
<< exit(FatalError);
}
}
}
}
}
}
@ -809,7 +791,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::mergeBaffles
const faceList& faces = mesh_.faces();
const labelList& faceOwner = mesh_.faceOwner();
const meshFaceZones& faceZones = mesh_.faceZones();
forAll(couples, i)
{
@ -824,15 +805,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::mergeBaffles
if (face1 < 0 || own0 < own1)
{
// Use face0 as the new internal face.
const label zoneID = faceZones.whichZone(face0);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(face0)];
}
const label nei = (face1 < 0 ? -1 : own1);
meshMod.removeFace(face1, -1);
@ -843,22 +815,12 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::mergeBaffles
own0, // owner
nei, // neighbour
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
-1 // patch for face
);
}
else
{
// Use face1 as the new internal face.
const label zoneID = faceZones.whichZone(face1);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(face1)];
}
meshMod.removeFace(face0, -1);
meshMod.modifyFace
@ -868,9 +830,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::mergeBaffles
own1, // owner
own0, // neighbour
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
-1 // patch for face
);
}
}
@ -3170,6 +3130,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::zonify
// Put the faces into the correct zone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List<Map<bool>> faceZonesAddedFaces(mesh_.faceZones().size());
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
{
@ -3200,17 +3161,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::zonify
);
}
meshMod.modifyFace
(
mesh_.faces()[facei], // modified face
facei, // label of face
faceOwner[facei], // owner
faceNeighbour[facei], // neighbour
false, // face flip
-1, // patch for face
faceZoneI, // zone for face
flip // face flip in zone
);
faceZonesAddedFaces[faceZoneI].insert(facei, flip);
}
}
@ -3247,17 +3198,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::zonify
);
}
meshMod.modifyFace
(
mesh_.faces()[facei], // modified face
facei, // label of face
faceOwner[facei], // owner
-1, // neighbour
false, // face flip
patchi, // patch for face
faceZoneI, // zone for face
flip // face flip in zone
);
faceZonesAddedFaces[faceZoneI].insert(facei, flip);
}
facei++;
}
@ -3268,6 +3209,12 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::zonify
// Change the mesh without keeping old points, parallel sync
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true);
// Add the new faces to the faceZones in the merged mesh
forAll(faceZonesAddedFaces, zonei)
{
mesh_.faceZones()[zonei].insert(faceZonesAddedFaces[zonei]);
}
// Update fields
mesh_.topoChange(map);

View File

@ -569,21 +569,11 @@ void Foam::createShellMesh::setRefinement
-1, // nei
faceToFaceMap.size(), // masterFaceID : current facei
true, // flipFaceFlux
bottomPatchID[facei], // patchID
-1, // zoneID
false // zoneFlip
bottomPatchID[facei] // patchID
);
faceToFaceMap.append(-facei-1); // points to flipped original face
faceToEdgeMap.append(-1);
// const face newF(patch_.localFaces()[facei].reverseFace());
// Pout<< "Added bottom face "
// << newF
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
// << " own " << addedCells[facei]
// << " patch:" << bottomPatchID[facei]
// << " at " << patch_.faceCentres()[facei]
// << endl;
}
// Add in between faces and face on top
@ -624,20 +614,11 @@ void Foam::createShellMesh::setRefinement
nei, // nei
faceToFaceMap.size(), // masterFaceID : current facei
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
patchi // patchID
);
faceToFaceMap.append(facei+1); // unflipped
faceToEdgeMap.append(-1);
// Pout<< "Added in between face " << newF
// << " coords:" << UIndirectList<point>(meshMod.points(), newF)
// << " at layer " << layerI
// << " own " << own
// << " nei " << nei
// << " at " << patch_.faceCentres()[facei]
// << endl;
}
}
@ -750,21 +731,6 @@ void Foam::createShellMesh::setRefinement
patchi = ePatches[0];
}
//{
// Pout<< "Adding from face:" << patch_.faceCentres()[eFaces[0]]
// << " from edge:"
// << patch_.localPoints()[f[fp0]]
// << patch_.localPoints()[f[fp1]]
// << " at layer:" << layerI
// << " with new points:" << newF
// << " locations:"
// << UIndirectList<point>(meshMod.points(), newF)
// << " own:" << minCelli
// << " nei:" << maxCelli
// << endl;
//}
// newF already outwards pointing.
meshMod.addFace
(
@ -773,10 +739,9 @@ void Foam::createShellMesh::setRefinement
maxCelli, // nei
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
patchi // patchID
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
@ -844,19 +809,6 @@ void Foam::createShellMesh::setRefinement
}
newF.last() = v0;
}
////if (ePatches.size() == 0)
//{
// Pout<< "Adding from MULTI face:"
// << patch_.faceCentres()[minFacei]
// << " from edge:"
// << patch_.localPoints()[f[fp0]]
// << patch_.localPoints()[f[fp1]]
// << " at layer:" << layerI
// << " with new points:" << newF
// << " locations:"
// << UIndirectList<point>(meshMod.points(), newF)
// << endl;
//}
// newF already outwards pointing.
meshMod.addFace
@ -866,9 +818,7 @@ void Foam::createShellMesh::setRefinement
-1, // nei
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
ePatches[i], // patchID
-1, // zoneID
false // zoneFlip
ePatches[i] // patchID
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);

View File

@ -539,16 +539,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::repatch
{
if (newPatchID[bFacei] != -1)
{
label facei = mesh_.nInternalFaces() + bFacei;
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
const label facei = mesh_.nInternalFaces() + bFacei;
meshMod.modifyFace
(
@ -557,9 +548,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::repatch
mesh_.faceOwner()[facei], // owner
-1, // neighbour
false, // face flip
newPatchID[bFacei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchID[bFacei] // patch for face
);
}
}
@ -747,14 +736,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::mergeSharedPoints
label patchID = mesh_.boundaryMesh().whichPatch(facei);
label nei = (patchID == -1 ? mesh_.faceNeighbour()[facei] : -1);
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.modifyFace
(
@ -763,9 +744,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::mergeSharedPoints
mesh_.faceOwner()[facei], // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
}
}

View File

@ -218,9 +218,7 @@ void Foam::mergePatchPairs::addFaces
tgtOwn, // Neighbour cell
srcFacei, // Master face index
false, // Flip
-1, // Patch index
-1, // Zone index
false // Zone sign
-1 // Patch index
);
if (debug)
@ -239,9 +237,7 @@ void Foam::mergePatchPairs::addFaces
srcOwn, // Neighbour cell
tgtFacei, // Master face index
false, // Flip
-1, // Patch index
-1, // Zone index
false // Zone sign
-1 // Patch index
);
if (debug)
@ -257,15 +253,6 @@ void Foam::mergePatchPairs::addFaces
const label srcFacei = srcPatchStart + faceSrcFaces[fi];
const label srcOwn = mesh_.faceOwner()[srcFacei];
// Get source face zone info
const label zoneIndex = mesh_.faceZones().whichZone(srcFacei);
bool zoneFlip = false;
if (zoneIndex >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneIndex];
zoneFlip = fZone.flipMap()[fZone.whichFace(srcFacei)];
}
meshMod.addFace
(
f, // Face to add
@ -273,9 +260,7 @@ void Foam::mergePatchPairs::addFaces
-1, // Neighbour cell
srcFacei, // Master face index
false, // Flip
srcPatchi, // Patch index
zoneIndex, // Zone index
zoneFlip // Zone sign
srcPatchi // Patch index
);
if (debug)
@ -290,15 +275,6 @@ void Foam::mergePatchPairs::addFaces
const label tgtFacei = tgtPatchStart + faceTgtFaces[fi];
const label tgtOwn = mesh_.faceOwner()[tgtFacei];
// Get target face zone info
const label zoneIndex = mesh_.faceZones().whichZone(tgtFacei);
bool zoneFlip = false;
if (zoneIndex >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneIndex];
zoneFlip = fZone.flipMap()[fZone.whichFace(tgtFacei)];
}
meshMod.addFace
(
f.reverseFace(), // Face to add
@ -306,9 +282,7 @@ void Foam::mergePatchPairs::addFaces
-1, // Neighbour cell
tgtFacei, // Master face index
false, // Flip
tgtPatchi, // Patch index
zoneIndex, // Zone index
zoneFlip // Zone sign
tgtPatchi // Patch index
);
if (debug)
@ -510,15 +484,6 @@ void Foam::mergePatchPairs::modifyFaces
if (modified)
{
// Get current zone info
const label zoneIndex = mesh_.faceZones().whichZone(fi);
bool zoneFlip = false;
if (zoneIndex >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneIndex];
zoneFlip = fZone.flipMap()[fZone.whichFace(fi)];
}
if (mesh_.isInternalFace(fi))
{
if (debug)
@ -539,9 +504,7 @@ void Foam::mergePatchPairs::modifyFaces
mesh_.faceOwner()[fi], // Owner cell
mesh_.faceNeighbour()[fi], // Neighbour cell
false, // Face flip
-1, // Patch index
zoneIndex, // Zone index
zoneFlip // Zone flip
-1 // Patch index
);
}
else
@ -564,9 +527,7 @@ void Foam::mergePatchPairs::modifyFaces
mesh_.faceOwner()[fi], // Owner cell
-1, // Neighbour cell
false, // Face flip
mesh_.boundaryMesh().whichPatch(fi), // Patch index
zoneIndex, // Zone index
zoneFlip // Zone flip
mesh_.boundaryMesh().whichPatch(fi) // Patch index
);
}
}

View File

@ -162,31 +162,16 @@ void Foam::meshCutter::faceCells
}
void Foam::meshCutter::getFaceInfo
(
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
) const
Foam::label Foam::meshCutter::getPatchIndex(const label facei) const
{
patchID = -1;
label patchID = -1;
if (!mesh().isInternalFace(facei))
{
patchID = mesh().boundaryMesh().whichPatch(facei);
}
zoneID = mesh().faceZones().whichZone(facei);
zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh().faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
return patchID;
}
@ -199,9 +184,7 @@ void Foam::meshCutter::addFace
const label nei
)
{
label patchID, zoneID, zoneFlip;
getFaceInfo(facei, patchID, zoneID, zoneFlip);
const label patchID = getPatchIndex(facei);
if ((nei == -1) || (own < nei))
{
@ -212,8 +195,6 @@ void Foam::meshCutter::addFace
<< " with new owner:" << own
<< " with new neighbour:" << nei
<< " patchID:" << patchID
<< " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip
<< endl;
}
@ -224,9 +205,7 @@ void Foam::meshCutter::addFace
nei, // neighbour
facei, // master face for addition
false, // flux flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
patchID // patch for face
);
}
else
@ -238,8 +217,6 @@ void Foam::meshCutter::addFace
<< " with new owner:" << nei
<< " with new neighbour:" << own
<< " patchID:" << patchID
<< " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip
<< endl;
}
@ -250,9 +227,7 @@ void Foam::meshCutter::addFace
own, // neighbour
facei, // master face for addition
false, // flux flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
patchID // patch for face
);
}
}
@ -267,9 +242,7 @@ void Foam::meshCutter::modifyFace
const label nei
)
{
label patchID, zoneID, zoneFlip;
getFaceInfo(facei, patchID, zoneID, zoneFlip);
const label patchID = getPatchIndex(facei);
if
(
@ -288,8 +261,6 @@ void Foam::meshCutter::modifyFace
<< " new vertices:" << newFace
<< " new owner:" << own
<< " new neighbour:" << nei
<< " new zoneID:" << zoneID
<< " new zoneFlip:" << zoneFlip
<< endl;
}
@ -302,9 +273,7 @@ void Foam::meshCutter::modifyFace
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
}
else
@ -316,9 +285,7 @@ void Foam::meshCutter::modifyFace
nei, // owner
own, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
}
}
@ -632,19 +599,16 @@ void Foam::meshCutter::setRefinement
// Convert loop (=list of cuts) into proper face.
// Orientation should already be ok. (done by cellCuts)
//
face newFace(loopToFace(celli, loop));
const face newFace(loopToFace(celli, loop));
label addedFacei =
meshMod.addFace
const label addedFacei = meshMod.addFace
(
newFace, // face
celli, // owner
addedCells_[celli], // neighbour
-1, // master face for addition
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
-1 // patch for face
);
addedFaces_.insert(celli, addedFacei);

View File

@ -172,14 +172,8 @@ class meshCutter
label& nei
) const;
//- Get patch information for face.
void getFaceInfo
(
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
) const;
//- Get patch index face
label getPatchIndex(const label facei) const;
//- Adds a face on top of existing facei. Flips face
// if owner>neighbour

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,13 +69,11 @@ Foam::perfectInterface::perfectInterface
(
const word& name,
const polyMesh& mesh,
const word& faceZoneName,
const word& masterPatchName,
const word& slavePatchName
)
:
mesh_(mesh),
faceZoneIndex_(mesh_.faceZones().findIndex(faceZoneName)),
masterPatchIndex_(mesh_.boundaryMesh().findIndex(masterPatchName)),
slavePatchIndex_(mesh_.boundaryMesh().findIndex(slavePatchName))
{}
@ -250,16 +248,6 @@ void Foam::perfectInterface::setRefinement
patchi = patches.whichPatch(facei);
}
const label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
ref.modifyFace
(
newFace, // modified face
@ -267,9 +255,7 @@ void Foam::perfectInterface::setRefinement
mesh_.faceOwner()[facei], // owner
nbr, // neighbour
false, // face flip
patchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
}
@ -297,9 +283,6 @@ void Foam::perfectInterface::setRefinement
// 5. Modify patch0 faces for new points (not really necessary; see
// comment above about patch1 and patch0 never sharing points) and
// becoming internal.
const boolList& mfFlip =
mesh_.faceZones()[faceZoneIndex_].flipMap();
forAll(pp0, i)
{
const label facei = pp0.addressing()[i];
@ -325,9 +308,7 @@ void Foam::perfectInterface::setRefinement
own, // owner
nbr, // neighbour
false, // face flip
-1, // patch for face
faceZoneIndex_, // zone for face
mfFlip[i] // face flip in zone
-1 // patch for face
);
}
else
@ -339,9 +320,7 @@ void Foam::perfectInterface::setRefinement
nbr, // owner
own, // neighbour
true, // face flip
-1, // patch for face
faceZoneIndex_, // zone for face
!mfFlip[i] // face flip in zone
-1 // patch for face
);
}
}
@ -354,8 +333,7 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
{
Pout<< "bool perfectInterface::setRefinement(polyTopoChange&) const : "
<< "masterPatchIndex_:" << masterPatchIndex_
<< " slavePatchIndex_:" << slavePatchIndex_
<< " faceZoneIndex_:" << faceZoneIndex_ << endl;
<< " slavePatchIndex_:" << slavePatchIndex_ << endl;
}
const polyBoundaryMesh& patches = mesh_.boundaryMesh();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,9 +56,6 @@ class perfectInterface
const polyMesh& mesh_;
//- Master face zone ID
label faceZoneIndex_;
//- Master patch ID
label masterPatchIndex_;
@ -88,7 +85,6 @@ public:
(
const word& name,
const polyMesh& mesh,
const word& faceZoneName,
const word& masterPatchName,
const word& slavePatchName
);
@ -109,7 +105,7 @@ public:
//- Insert the layer addition/removal instructions
// into the topological change. Uses only mesh, not any of the
// patch and zone indices. Bit of a workaround - used in extruding
// patch indices. Bit of a workaround - used in extruding
// a mesh.
virtual void setRefinement
(

View File

@ -228,12 +228,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace
) const
{
label masterFacei = -1;
// Zone info comes from any side patch face. Otherwise -1 since we
// don't know what to put it in - inherit from the extruded faces?
label zonei = -1; // mesh_.faceZones().whichZone(meshFacei);
bool flip = false;
label addedFacei = -1;
// Is patch edge external edge of indirectPrimitivePatch?
@ -246,7 +240,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace
// Loop over all faces connected to edge and see if we can find a face
// that is otherPatchID
// Get my mesh face and its zone.
// Get my mesh face
label meshFacei = pp.addressing()[ownFacei];
forAll(meshFaces, k)
@ -261,13 +255,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace
{
// Found the patch face. Use it to map from
masterFacei = facei;
zonei = mesh_.faceZones().whichZone(facei);
if (zonei != -1)
{
label index = mesh_.faceZones()[zonei].whichFace(facei);
flip = mesh_.faceZones()[zonei].flipMap()[index];
}
break;
}
}
@ -295,12 +282,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace
layerOwn = layerI;
}
// Pout<< "Added boundary face:" << newFace
// << " own:" << addedCells[ownFacei][layerOwn]
// << " patch:" << newPatchID
// << endl;
addedFacei = meshMod.addFace
(
newFace, // face
@ -308,9 +289,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace
-1, // neighbour
masterFacei, // master face
false, // flux flip
newPatchID, // patch for face
zonei, // zone for face
flip // face zone flip
newPatchID // patch for face
);
}
else
@ -369,15 +348,8 @@ Foam::label Foam::addPatchCellLayer::addSideFace
addedCells[nbrFacei][layerNbr], // neighbour
-1, // master face
false, // flux flip
-1, // patch for face
zonei, // zone for face
flip // face zone flip
-1 // patch for face
);
// Pout<< "Added internal face:" << newFace
// << " own:" << addedCells[ownFacei][layerOwn]
// << " nei:" << addedCells[nbrFacei][layerNbr]
// << endl;
}
return addedFacei;
@ -1158,21 +1130,12 @@ void Foam::addPatchCellLayer::setRefinement
// Get new neighbour
label nei;
label patchi;
label zonei = -1;
bool flip = false;
if (i == addedCells[patchFacei].size()-1)
{
// Top layer so is patch face.
nei = -1;
patchi = patchID[patchFacei];
zonei = mesh_.faceZones().whichZone(meshFacei);
if (zonei != -1)
{
const faceZone& fz = mesh_.faceZones()[zonei];
flip = fz.flipMap()[fz.whichFace(meshFacei)];
}
}
else
{
@ -1181,7 +1144,6 @@ void Foam::addPatchCellLayer::setRefinement
patchi = -1;
}
layerFaces_[patchFacei][i+1] = meshMod.addFace
(
newFace, // face
@ -1189,9 +1151,7 @@ void Foam::addPatchCellLayer::setRefinement
nei, // neighbour
(addToMesh_ ? meshFacei : -1), // master face
false, // flux flip
patchi, // patch for face
zonei, // zone for face
flip // face zone flip
patchi // patch for face
);
}
}
@ -1218,9 +1178,7 @@ void Foam::addPatchCellLayer::setRefinement
mesh_.faceOwner()[meshFacei], // owner
addedCells[patchFacei][0], // neighbour
false, // face flip
-1, // patch for face
-1, // zonei, // zone for face
false // face flip in zone
-1 // patch for face
);
}
}
@ -1233,15 +1191,6 @@ void Foam::addPatchCellLayer::setRefinement
{
if (nFaceLayers[patchFacei] > 0)
{
label meshFacei = pp.addressing()[patchFacei];
label zonei = mesh_.faceZones().whichZone(meshFacei);
bool zoneFlip = false;
if (zonei != -1)
{
const faceZone& fz = mesh_.faceZones()[zonei];
zoneFlip = !fz.flipMap()[fz.whichFace(meshFacei)];
}
// Reverse and renumber old patch face.
face f(pp.localFaces()[patchFacei].reverseFace());
forAll(f, fp)
@ -1256,9 +1205,7 @@ void Foam::addPatchCellLayer::setRefinement
-1, // neighbour
-1, // masterFace
true, // face flip
exposedPatchID[patchFacei], // patch for face
zonei, // zone for face
zoneFlip // face flip in zone
exposedPatchID[patchFacei] // patch for face
);
}
}

View File

@ -639,23 +639,12 @@ void Foam::combineFaces::setRefinement
// Modify master face
// ~~~~~~~~~~~~~~~~~~
label masterFacei = setFaces[0];
const label masterFacei = setFaces[0];
// Get outside face in mesh vertex labels
face outsideFace(getOutsideFace(bigFace));
const face outsideFace(getOutsideFace(bigFace));
label zoneID = mesh_.faceZones().whichZone(masterFacei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFacei)];
}
label patchi = mesh_.boundaryMesh().whichPatch(masterFacei);
const label patchi = mesh_.boundaryMesh().whichPatch(masterFacei);
meshMod.modifyFace
(
@ -664,9 +653,7 @@ void Foam::combineFaces::setRefinement
mesh_.faceOwner()[masterFacei], // owner
-1, // neighbour
false, // face flip
patchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
@ -922,15 +909,8 @@ void Foam::combineFaces::setUnrefinement
// Restore
// ~~~~~~~
label own = mesh_.faceOwner()[masterFacei];
label zoneID = mesh_.faceZones().whichZone(masterFacei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFacei)];
}
label patchi = mesh_.boundaryMesh().whichPatch(masterFacei);
const label own = mesh_.faceOwner()[masterFacei];
const label patchi = mesh_.boundaryMesh().whichPatch(masterFacei);
if (mesh_.boundaryMesh()[patchi].coupled())
{
@ -951,9 +931,7 @@ void Foam::combineFaces::setUnrefinement
own, // owner
-1, // neighbour
false, // face flip
patchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
restoredFaces.insert(masterFacei, masterFacei);
@ -970,9 +948,7 @@ void Foam::combineFaces::setUnrefinement
-1, // neighbour,
masterFacei, // masterFaceID,
false, // flipFaceFlux,
patchi, // patchID,
zoneID, // zoneID,
zoneFlip // zoneFlip
patchi // patchID,
);
restoredFaces.insert(facei, masterFacei);
}

View File

@ -142,16 +142,6 @@ void Foam::duplicatePoints::setRefinement
}
}
// Get current zone info
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
if (mesh_.isInternalFace(facei))
{
meshMod.modifyFace
@ -161,9 +151,7 @@ void Foam::duplicatePoints::setRefinement
mesh_.faceOwner()[facei], // owner
mesh_.faceNeighbour()[facei], // neighbour
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
-1 // patch for face
);
}
else
@ -175,9 +163,7 @@ void Foam::duplicatePoints::setRefinement
mesh_.faceOwner()[facei], // owner
-1, // neighbour
false, // face flip
patches.whichPatch(facei), // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patches.whichPatch(facei) // patch for face
);
}
}

View File

@ -1550,7 +1550,6 @@ bool Foam::edgeCollapser::setRefinement
const polyBoundaryMesh& boundaryMesh = mesh_.boundaryMesh();
const meshFaceZones& faceZones = mesh_.faceZones();
// Renumber faces that use points
forAll(allPointInfo, pointi)
@ -1567,18 +1566,6 @@ bool Foam::edgeCollapser::setRefinement
{
doneFace[facei] = true;
// Get current zone info
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Get current connectivity
label own = faceOwner[facei];
label nei = -1;
@ -1600,9 +1587,7 @@ bool Foam::edgeCollapser::setRefinement
own, // owner
nei, // neighbour
false, // flipFaceFlux
patchID, // patch
zoneID,
zoneFlip
patchID // patch
);
meshChanged = true;

View File

@ -90,31 +90,16 @@ void Foam::hexRef8::reorder
}
void Foam::hexRef8::getFaceInfo
(
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
) const
Foam::label Foam::hexRef8::getPatchIndex(const label facei) const
{
patchID = -1;
label patchID = -1;
if (!mesh_.isInternalFace(facei))
{
patchID = mesh_.boundaryMesh().whichPatch(facei);
}
zoneID = mesh_.faceZones().whichZone(facei);
zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
return patchID;
}
@ -127,9 +112,7 @@ Foam::label Foam::hexRef8::addFace
const label nei
) const
{
label patchID, zoneID, zoneFlip;
getFaceInfo(facei, patchID, zoneID, zoneFlip);
const label patchID = getPatchIndex(facei);
label newFacei = -1;
@ -143,9 +126,7 @@ Foam::label Foam::hexRef8::addFace
nei, // neighbour
facei, // master face for addition
false, // flux flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
patchID // patch for face
);
}
else
@ -158,9 +139,7 @@ Foam::label Foam::hexRef8::addFace
own, // neighbour
facei, // master face for addition
false, // flux flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
patchID // patch for face
);
}
return newFacei;
@ -186,9 +165,7 @@ Foam::label Foam::hexRef8::addInternalFace
nei, // neighbour
meshFacei, // master face for addition
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
-1 // patch for face
);
}
else
@ -202,9 +179,7 @@ Foam::label Foam::hexRef8::addInternalFace
nei, // neighbour
-1, // master face for addition
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
-1 // patch for face
);
}
}
@ -219,9 +194,7 @@ void Foam::hexRef8::modifyFace
const label nei
) const
{
label patchID, zoneID, zoneFlip;
getFaceInfo(facei, patchID, zoneID, zoneFlip);
const label patchID = getPatchIndex(facei);
if
(
@ -242,9 +215,7 @@ void Foam::hexRef8::modifyFace
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
}
else
@ -256,9 +227,7 @@ void Foam::hexRef8::modifyFace
nei, // owner
own, // neighbour
false, // face flip
patchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchID // patch for face
);
}
}

View File

@ -105,14 +105,8 @@ class hexRef8
labelList& elems
);
//- Get patch and zone info
void getFaceInfo
(
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
) const;
//- Get patch index
label getPatchIndex(const label facei) const;
//- Adds a face on top of existing facei. Reverses if necessary.
label addFace

View File

@ -327,13 +327,12 @@ void Foam::polyTopoChange::checkFace
const label facei,
const label own,
const label nei,
const label patchi,
const label zoneI
const label patchi
) const
{
if (nei == -1)
{
if (own == -1 && zoneI != -1)
if (own == -1)
{
// retired face
}
@ -865,9 +864,6 @@ void Foam::polyTopoChange::reorderCompactFaces
inplaceReorder(oldToNew, flipFaceFlux_);
flipFaceFlux_.setCapacity(newSize);
renumberKey(oldToNew, faceZone_);
inplaceReorder(oldToNew, faceZoneFlip_);
faceZoneFlip_.setCapacity(newSize);
}
@ -1174,12 +1170,6 @@ void Foam::polyTopoChange::compact
? 0
: 1
);
faceZoneFlip_[facei] =
(
faceZoneFlip_[facei]
? 0
: 1
);
}
}
}
@ -1313,150 +1303,6 @@ void Foam::polyTopoChange::calcPatchPointMap
}
void Foam::polyTopoChange::resetZones
(
const polyMesh& mesh,
polyMesh& newMesh
) const
{
// faceZones
// ~~~~~~~~~
{
const meshFaceZones& faceZones = mesh.faceZones();
labelList nFaces(faceZones.size(), 0);
forAllConstIter(Map<label>, faceZone_, iter)
{
label zoneI = iter();
if (zoneI < 0 || zoneI >= faceZones.size())
{
FatalErrorInFunction
<< "Illegal zoneID " << zoneI << " for face "
<< iter.key()
<< abort(FatalError);
}
nFaces[zoneI]++;
}
labelListList addressing(faceZones.size());
boolListList flipMode(faceZones.size());
forAll(addressing, zoneI)
{
addressing[zoneI].setSize(nFaces[zoneI]);
flipMode[zoneI].setSize(nFaces[zoneI]);
}
nFaces = 0;
forAllConstIter(Map<label>, faceZone_, iter)
{
label zoneI = iter();
label facei = iter.key();
label index = nFaces[zoneI]++;
addressing[zoneI][index] = facei;
flipMode[zoneI][index] = faceZoneFlip_[facei];
}
// Sort the addressing
forAll(addressing, zoneI)
{
labelList newToOld;
sortedOrder(addressing[zoneI], newToOld);
{
labelList newAddressing(addressing[zoneI].size());
forAll(newAddressing, i)
{
newAddressing[i] = addressing[zoneI][newToOld[i]];
}
addressing[zoneI].transfer(newAddressing);
}
{
boolList newFlipMode(flipMode[zoneI].size());
forAll(newFlipMode, i)
{
newFlipMode[i] = flipMode[zoneI][newToOld[i]];
}
flipMode[zoneI].transfer(newFlipMode);
}
}
// Reset the addressing on the zone
forAll(newMesh.faceZones(), zoneI)
{
if (debug)
{
Pout<< "faceZone:" << zoneI
<< " name:" << newMesh.faceZones()[zoneI].name()
<< " size:" << addressing[zoneI].size()
<< endl;
}
newMesh.faceZones()[zoneI].resetAddressing
(
addressing[zoneI],
flipMode[zoneI]
);
}
}
}
void Foam::polyTopoChange::calcFaceZonePointMap
(
const polyMesh& mesh,
const List<Map<label>>& oldMeshFaceZonesPointMaps,
labelListList& faceZonePointMap
) const
{
const meshFaceZones& faceZones = mesh.faceZones();
faceZonePointMap.setSize(faceZones.size());
forAll(faceZones, zoneI)
{
const faceZone& newZone = faceZones[zoneI];
const labelList& newMeshZonePoints = newZone().meshPoints();
const Map<label>& oldMeshZonePointMap =
oldMeshFaceZonesPointMaps[zoneI];
labelList& curFzPointRnb = faceZonePointMap[zoneI];
curFzPointRnb.setSize(newMeshZonePoints.size());
forAll(newMeshZonePoints, pointi)
{
if (newMeshZonePoints[pointi] < pointMap_.size())
{
Map<label>::const_iterator ozmpmIter =
oldMeshZonePointMap.find
(
pointMap_[newMeshZonePoints[pointi]]
);
if (ozmpmIter != oldMeshZonePointMap.end())
{
curFzPointRnb[pointi] = ozmpmIter();
}
else
{
curFzPointRnb[pointi] = -1;
}
}
else
{
curFzPointRnb[pointi] = -1;
}
}
}
}
void Foam::polyTopoChange::reorderCoupledFaces
(
const bool syncParallel,
@ -1591,8 +1437,7 @@ void Foam::polyTopoChange::compactAndReorder
List<Map<label>>& oldPatchMeshPointMaps,
labelList& oldPatchNMeshPoints,
labelList& oldPatchSizes,
labelList& oldPatchStarts,
List<Map<label>>& oldMeshFaceZonesPointMaps
labelList& oldPatchStarts
)
{
if (mesh.boundaryMesh().size() != nPatches_)
@ -1667,24 +1512,11 @@ void Foam::polyTopoChange::compactAndReorder
forAll(boundary, patchi)
{
// Copy old face zone point maps
oldPatchMeshPointMaps[patchi] = boundary[patchi].meshPointMap();
oldPatchNMeshPoints[patchi] = boundary[patchi].meshPoints().size();
oldPatchSizes[patchi] = boundary[patchi].size();
oldPatchStarts[patchi] = boundary[patchi].start();
}
// Grab old face zone point maps.
// These need to be saved before resetting the mesh and are used
// later on to calculate the faceZone pointMaps.
oldMeshFaceZonesPointMaps.setSize(mesh.faceZones().size());
forAll(mesh.faceZones(), zoneI)
{
const faceZone& oldZone = mesh.faceZones()[zoneI];
oldMeshFaceZonesPointMaps[zoneI] = oldZone().meshPointMap();
}
}
@ -1706,8 +1538,6 @@ Foam::polyTopoChange::polyTopoChange(const label nPatches, const bool strict)
faceMap_(0),
reverseFaceMap_(0),
flipFaceFlux_(0),
faceZone_(0),
faceZoneFlip_(0),
nActiveFaces_(0),
cellMap_(0),
reverseCellMap_(0)
@ -1734,8 +1564,6 @@ Foam::polyTopoChange::polyTopoChange
faceMap_(0),
reverseFaceMap_(0),
flipFaceFlux_(0),
faceZone_(0),
faceZoneFlip_(0),
nActiveFaces_(0),
cellMap_(0),
reverseCellMap_(0)
@ -1781,7 +1609,6 @@ Foam::polyTopoChange::polyTopoChange
const faceList& faces = mesh.faces();
const labelList& faceOwner = mesh.faceOwner();
const labelList& faceNeighbour = mesh.faceNeighbour();
const meshFaceZones& faceZones = mesh.faceZones();
// Resize
label nAllFaces = mesh.faces().size();
@ -1793,26 +1620,8 @@ Foam::polyTopoChange::polyTopoChange
faceMap_.setCapacity(faceMap_.size() + nAllFaces);
reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
flipFaceFlux_.setCapacity(faces_.size() + nAllFaces);
faceZone_.resize(faceZone_.size() + nAllFaces/100);
faceZoneFlip_.setCapacity(faces_.size() + nAllFaces);
// Precalc offset zones
labelList newZoneID(nAllFaces, -1);
boolList zoneFlip(nAllFaces, false);
forAll(faceZones, zoneI)
{
const labelList& faceLabels = faceZones[zoneI];
const boolList& flipMap = faceZones[zoneI].flipMap();
forAll(faceLabels, j)
{
newZoneID[faceLabels[j]] = zoneI;
zoneFlip[faceLabels[j]] = flipMap[j];
}
}
// Add faces in mesh order
// 1. Internal faces
@ -1825,9 +1634,7 @@ Foam::polyTopoChange::polyTopoChange
faceNeighbour[facei],
facei, // masterFaceID
false, // flipFaceFlux
-1, // patchID
newZoneID[facei], // zoneID
zoneFlip[facei] // zoneFlip
-1 // patchID
);
}
@ -1857,9 +1664,7 @@ Foam::polyTopoChange::polyTopoChange
-1, // neighbour
facei, // masterFaceID
false, // flipFaceFlux
patchi, // patchID
newZoneID[facei], // zoneID
zoneFlip[facei] // zoneFlip
patchi // patchID
);
}
}
@ -1884,8 +1689,6 @@ void Foam::polyTopoChange::clear()
faceMap_.clearStorage();
reverseFaceMap_.clearStorage();
flipFaceFlux_.clearStorage();
faceZone_.clearStorage();
faceZoneFlip_.clearStorage();
nActiveFaces_ = 0;
cellMap_.clearStorage();
@ -1911,8 +1714,6 @@ void Foam::polyTopoChange::setCapacity
faceMap_.setCapacity(nFaces);
reverseFaceMap_.setCapacity(nFaces);
flipFaceFlux_.setCapacity(nFaces);
faceZone_.resize(faceZone_.size() + nFaces/100);
faceZoneFlip_.setCapacity(nFaces);
cellMap_.setCapacity(nCells);
reverseCellMap_.setCapacity(nCells);
@ -2031,15 +1832,13 @@ Foam::label Foam::polyTopoChange::addFace
const label nei,
const label masterFaceID,
const bool flipFaceFlux,
const label patchID,
const label zoneID,
const bool zoneFlip
const label patchID
)
{
// Check validity
if (debug)
{
checkFace(f, -1, own, nei, patchID, zoneID);
checkFace(f, -1, own, nei, patchID);
}
label facei = faces_.size();
@ -2066,12 +1865,6 @@ Foam::label Foam::polyTopoChange::addFace
flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
if (zoneID >= 0)
{
faceZone_.insert(facei, zoneID);
}
faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
return facei;
}
@ -2083,15 +1876,13 @@ void Foam::polyTopoChange::modifyFace
const label own,
const label nei,
const bool flipFaceFlux,
const label patchID,
const label zoneID,
const bool zoneFlip
const label patchID
)
{
// Check validity
if (debug)
{
checkFace(f, facei, own, nei, patchID, zoneID);
checkFace(f, facei, own, nei, patchID);
}
faces_[facei] = f;
@ -2100,25 +1891,6 @@ void Foam::polyTopoChange::modifyFace
region_[facei] = patchID;
flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
Map<label>::iterator faceFnd = faceZone_.find(facei);
if (faceFnd != faceZone_.end())
{
if (zoneID >= 0)
{
faceFnd() = zoneID;
}
else
{
faceZone_.erase(faceFnd);
}
}
else if (zoneID >= 0)
{
faceZone_.insert(facei, zoneID);
}
faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
}
@ -2158,8 +1930,6 @@ void Foam::polyTopoChange::removeFace(const label facei, const label mergeFacei)
reverseFaceMap_[facei] = -1;
}
flipFaceFlux_[facei] = 0;
faceZone_.erase(facei);
faceZoneFlip_[facei] = 0;
}
@ -2244,7 +2014,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::changeMesh
labelList oldPatchNMeshPoints;
labelList oldPatchSizes;
labelList oldPatchStarts;
List<Map<label>> oldMeshFaceZonesPointMaps;
// Compact, reorder patch faces and calculate mesh/patch maps.
compactAndReorder
@ -2264,8 +2033,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::changeMesh
oldPatchMeshPointMaps,
oldPatchNMeshPoints,
oldPatchSizes,
oldPatchStarts,
oldMeshFaceZonesPointMaps
oldPatchStarts
);
const label nOldPoints(mesh.nPoints());
@ -2344,17 +2112,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::changeMesh
}
// Zones
// ~~~~~
resetZones(mesh, mesh);
// Clear zone info
{
faceZone_.clearStorage();
faceZoneFlip_.clearStorage();
}
// Patch point renumbering
// For every preserved point on a patch give the old position.
// For added points, the index is set to -1
@ -2366,10 +2123,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::changeMesh
patchPointMap
);
// Create the face zone point renumbering
labelListList faceZonePointMap(mesh.faceZones().size());
calcFaceZonePointMap(mesh, oldMeshFaceZonesPointMaps, faceZonePointMap);
labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
return autoPtr<polyTopoChangeMap>
@ -2452,7 +2205,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::makeMesh
labelList oldPatchNMeshPoints;
labelList oldPatchSizes;
labelList oldPatchStarts;
List<Map<label>> oldMeshFaceZonesPointMaps;
// Compact, reorder patch faces and calculate mesh/patch maps.
compactAndReorder
@ -2472,8 +2224,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::makeMesh
oldPatchMeshPointMaps,
oldPatchNMeshPoints,
oldPatchSizes,
oldPatchStarts,
oldMeshFaceZonesPointMaps
oldPatchStarts
);
const label nOldPoints(mesh.nPoints());
@ -2580,19 +2331,13 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::makeMesh
}
}
// Start with empty faceZone
// Copy faceZone from old mesh
const meshFaceZones& oldFaceZones = mesh.faceZones();
List<faceZone*> fZonePtrs(oldFaceZones.size());
{
forAll(oldFaceZones, i)
{
fZonePtrs[i] = new faceZone
(
oldFaceZones[i].name(),
labelList(0),
boolList(0),
newMesh.faceZones()
);
fZonePtrs[i] = oldFaceZones[i].clone(newMesh.faceZones()).ptr();
}
}
@ -2607,13 +2352,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::makeMesh
}
newMesh.addZones(pZonePtrs, fZonePtrs, cZonePtrs);
resetZones(mesh, newMesh);
// Clear zone info
{
faceZone_.clearStorage();
faceZoneFlip_.clearStorage();
}
// Patch point renumbering
// For every preserved point on a patch give the old position.
@ -2626,10 +2364,6 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::polyTopoChange::makeMesh
patchPointMap
);
// Create the face zone point renumbering
labelListList faceZonePointMap(newMesh.faceZones().size());
calcFaceZonePointMap(newMesh, oldMeshFaceZonesPointMaps, faceZonePointMap);
if (debug)
{
Pout<< "New mesh:" << nl;

View File

@ -155,12 +155,6 @@ class polyTopoChange
//- In mapping whether to reverse the flux
PackedBoolList flipFaceFlux_;
//- Zone of face
Map<label> faceZone_;
//- Orientation of face in zone
PackedBoolList faceZoneFlip_;
//- Active faces
label nActiveFaces_;
@ -236,8 +230,7 @@ class polyTopoChange
const label facei,
const label own,
const label nei,
const label patchi,
const label zoneI
const label patchi
) const;
//- Construct cells (in packed storage)
@ -323,22 +316,6 @@ class polyTopoChange
labelListList&
) const;
void resetZones
(
const polyMesh&, // mesh to get existing info from
polyMesh& // mesh to change zones on
) const;
void calcFaceZonePointMap
(
const polyMesh&,
const List<Map<label>>&,
labelListList&
) const;
// Coupling
//- Do all coupled patch face reordering
void reorderCoupledFaces
(
@ -365,8 +342,7 @@ class polyTopoChange
List<Map<label>>& oldPatchMeshPointMaps,
labelList& oldPatchNMeshPoints,
labelList& oldPatchSizes,
labelList& oldPatchStarts,
List<Map<label>>& oldMeshFaceZonesPointMaps
labelList& oldPatchStarts
);
@ -465,7 +441,7 @@ public:
void removePoint(const label, const label);
//- Add face to cells and return new face index
// own,nei<0, zoneID>=0 : add inactive face (to end of face list)
// own, nei <0 >=0 : add inactive face (to end of face list)
label addFace
(
const face& f,
@ -473,9 +449,7 @@ public:
const label nei,
const label masterFaceID,
const bool flipFaceFlux,
const label patchID,
const label zoneID,
const bool zoneFlip
const label patchID
);
//- Modify vertices or cell of face
@ -486,9 +460,7 @@ public:
const label own,
const label nei,
const bool flipFaceFlux,
const label patchID,
const label zoneID,
const bool zoneFlip
const label patchID
);
//- Remove face / merge faces

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -244,7 +244,6 @@ void Foam::removeCells::setRefinement
const faceList& faces = mesh_.faces();
const labelList& faceOwner = mesh_.faceOwner();
const labelList& faceNeighbour = mesh_.faceNeighbour();
const meshFaceZones& faceZones = mesh_.faceZones();
// Count starting number of faces using each point. Keep up to date whenever
// removing a face.
@ -291,21 +290,6 @@ void Foam::removeCells::setRefinement
// nei is remaining cell. Facei becomes external cell
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
// Note: we reverse the owner/neighbour of the face
// so should also select the other side of the zone
zoneFlip = !fZone.flipMap()[fZone.whichFace(facei)];
}
// Pout<< "Putting exposed internal face " << facei
// << " fc:" << mesh_.faceCentres()[facei]
// << " into patch " << newPatchID[facei] << endl;
meshMod.modifyFace
(
f.reverseFace(), // modified face
@ -313,9 +297,7 @@ void Foam::removeCells::setRefinement
nei, // owner
-1, // neighbour
true, // face flip
newPatchID[facei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchID[facei] // patch for face
);
}
}
@ -334,16 +316,6 @@ void Foam::removeCells::setRefinement
// << " fc:" << mesh_.faceCentres()[facei]
// << " into patch " << newPatchID[facei] << endl;
// own is remaining cell. Facei becomes external cell.
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.modifyFace
(
f, // modified face
@ -351,9 +323,7 @@ void Foam::removeCells::setRefinement
own, // owner
-1, // neighbour
false, // face flip
newPatchID[facei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchID[facei] // patch for face
);
}
}
@ -370,19 +340,6 @@ void Foam::removeCells::setRefinement
{
if (newPatchID[facei] != -1)
{
// Pout<< "Putting uncoupled coupled face " << facei
// << " fc:" << mesh_.faceCentres()[facei]
// << " into patch " << newPatchID[facei] << endl;
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.modifyFace
(
faces[facei], // modified face
@ -390,9 +347,7 @@ void Foam::removeCells::setRefinement
faceOwner[facei], // owner
-1, // neighbour
false, // face flip
newPatchID[facei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchID[facei] // patch for face
);
}
else if (removedCell[faceOwner[facei]])

View File

@ -325,10 +325,7 @@ void Foam::removeFaces::mergeFaces
own = cellRegionMaster[cellRegion[own]];
}
label patchID, zoneID, zoneFlip;
getFaceInfo(facei, patchID, zoneID, zoneFlip);
const label patchID = getPatchIndex(facei);
label nei = -1;
if (mesh_.isInternalFace(facei))
@ -367,17 +364,6 @@ void Foam::removeFaces::mergeFaces
reverse(mergedFace);
}
//{
// Pout<< "Modifying masterface " << facei
// << " from faces:" << faceLabels
// << " old verts:" << UIndirectList<face>(mesh_.faces(), faceLabels)
// << " for new verts:"
// << mergedFace
// << " possibly new owner " << own
// << " or new nei " << nei
// << endl;
//}
modifyFace
(
mergedFace, // modified face
@ -386,14 +372,10 @@ void Foam::removeFaces::mergeFaces
nei, // neighbour
false, // face flip
patchID, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip, // face flip in zone
meshMod
);
// Remove all but master face.
forAll(faceLabels, patchFacei)
{
@ -407,37 +389,19 @@ void Foam::removeFaces::mergeFaces
}
// Get patch, zone info for facei
void Foam::removeFaces::getFaceInfo
(
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
) const
Foam::label Foam::removeFaces::getPatchIndex(const label facei) const
{
patchID = -1;
label patchID = -1;
if (!mesh_.isInternalFace(facei))
{
patchID = mesh_.boundaryMesh().whichPatch(facei);
}
zoneID = mesh_.faceZones().whichZone(facei);
zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
return patchID;
}
// Return face with all pointsToRemove removed.
Foam::face Foam::removeFaces::filterFace
(
const labelHashSet& pointsToRemove,
@ -466,7 +430,6 @@ Foam::face Foam::removeFaces::filterFace
}
// Wrapper for meshMod.modifyFace. Reverses face if own>nei.
void Foam::removeFaces::modifyFace
(
const face& f,
@ -475,30 +438,12 @@ void Foam::removeFaces::modifyFace
const label nei,
const bool flipFaceFlux,
const label newPatchID,
const bool removeFromZone,
const label zoneID,
const bool zoneFlip,
polyTopoChange& meshMod
) const
{
if ((nei == -1) || (own < nei))
{
// if (debug)
// {
// Pout<< "ModifyFace (unreversed) :"
// << " facei:" << masterFaceID
// << " f:" << f
// << " own:" << own
// << " nei:" << nei
// << " flipFaceFlux:" << flipFaceFlux
// << " newPatchID:" << newPatchID
// << " removeFromZone:" << removeFromZone
// << " zoneID:" << zoneID
// << " zoneFlip:" << zoneFlip
// << endl;
// }
meshMod.modifyFace
(
f, // modified face
@ -506,28 +451,11 @@ void Foam::removeFaces::modifyFace
own, // owner
nei, // neighbour
flipFaceFlux, // face flip
newPatchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchID // patch for face
);
}
else
{
// if (debug)
// {
// Pout<< "ModifyFace (!reversed) :"
// << " facei:" << masterFaceID
// << " f:" << f.reverseFace()
// << " own:" << nei
// << " nei:" << own
// << " flipFaceFlux:" << flipFaceFlux
// << " newPatchID:" << newPatchID
// << " removeFromZone:" << removeFromZone
// << " zoneID:" << zoneID
// << " zoneFlip:" << zoneFlip
// << endl;
// }
meshMod.modifyFace
(
f.reverseFace(),// modified face
@ -535,9 +463,7 @@ void Foam::removeFaces::modifyFace
nei, // owner
own, // neighbour
flipFaceFlux, // face flip
newPatchID, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newPatchID // patch for face
);
}
}
@ -1440,10 +1366,7 @@ void Foam::removeFaces::setRefinement
own = cellRegionMaster[cellRegion[own]];
}
label patchID, zoneID, zoneFlip;
getFaceInfo(facei, patchID, zoneID, zoneFlip);
const label patchID = getPatchIndex(facei);
label nei = -1;
if (mesh_.isInternalFace(facei))
@ -1456,16 +1379,6 @@ void Foam::removeFaces::setRefinement
}
}
// if (debug)
// {
// Pout<< "Modifying " << facei
// << " old verts:" << mesh_.faces()[facei]
// << " for new verts:" << f
// << " or for new owner " << own << " or for new nei "
// << nei
// << endl;
// }
modifyFace
(
f, // modified face
@ -1474,10 +1387,6 @@ void Foam::removeFaces::setRefinement
nei, // neighbour
false, // face flip
patchID, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip, // face flip in zone
meshMod
);
}

View File

@ -126,14 +126,8 @@ class removeFaces
polyTopoChange& meshMod
) const;
//- Get patch, zone info for facei
void getFaceInfo
(
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
) const;
//- Get patch index
label getPatchIndex(const label facei) const;
//- Return face with all pointsToRemove removed.
face filterFace(const labelHashSet&, const label) const;
@ -147,9 +141,6 @@ class removeFaces
const label nei,
const bool flipFaceFlux,
const label newPatchID,
const bool removeFromZone,
const label zoneID,
const bool zoneFlip,
polyTopoChange& meshMod
) const;

View File

@ -94,17 +94,6 @@ void Foam::removePoints::modifyFace
patchi = mesh_.boundaryMesh().whichPatch(facei);
}
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.modifyFace
(
newFace, // modified face
@ -112,9 +101,7 @@ void Foam::removePoints::modifyFace
owner, // owner
neighbour, // neighbour
false, // face flip
patchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
patchi // patch for face
);
}

View File

@ -102,17 +102,6 @@ void Foam::repatcher::changePatchID
}
}
const label zoneID = mesh_.faceZones().whichZone(faceID);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)];
}
meshMod().modifyFace
(
mesh_.faces()[faceID], // face
@ -120,41 +109,7 @@ void Foam::repatcher::changePatchID
mesh_.faceOwner()[faceID], // owner
-1, // neighbour
false, // flip flux
patchID, // patch ID
zoneID, // zone ID
zoneFlip // zone flip
);
}
void Foam::repatcher::setFaceZone
(
const label faceID,
const label zoneID,
const bool zoneFlip
)
{
if (polyTopoChange::debug)
{
// Check that the request is possible
if (faceID > mesh_.faces().size())
{
FatalErrorInFunction
<< "out of range."
<< abort(FatalError);
}
}
meshMod().modifyFace
(
mesh_.faces()[faceID], // face
faceID, // face ID
mesh_.faceOwner()[faceID], // owner
mesh_.faceNeighbour()[faceID], // neighbour
false, // flip flux
mesh_.boundaryMesh().whichPatch(faceID), // patch ID
zoneID, // zone ID
zoneFlip // zone flip
patchID // patch ID
);
}
@ -188,17 +143,6 @@ void Foam::repatcher::changeAnchorPoint
label patchID = mesh_.boundaryMesh().whichPatch(faceID);
const label zoneID = mesh_.faceZones().whichZone(faceID);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)];
}
if (fp == 0)
{
// Do dummy modify to keep patch ordering.
@ -209,9 +153,7 @@ void Foam::repatcher::changeAnchorPoint
mesh_.faceOwner()[faceID], // owner
-1, // neighbour
false, // flip flux
patchID, // patch ID
zoneID, // zone ID
zoneFlip // zone flip
patchID // patch ID
);
}
else
@ -239,9 +181,7 @@ void Foam::repatcher::changeAnchorPoint
mesh_.faceOwner()[faceID], // owner
-1, // neighbour
false, // flip flux
patchID, // patch ID
zoneID, // zone ID
zoneFlip // zone flip
patchID // patch ID
);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,14 +95,6 @@ public:
const label patchID
);
//- Set zone ID for a face
void setFaceZone
(
const label faceID,
const label zoneID,
const bool zoneFlip
);
//- Change anchor point (zero'th point of face) for a boundary face.
void changeAnchorPoint
(