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:
@ -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,15 +374,7 @@ 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
|
||||
// Use owner side of face
|
||||
modifyOrAddFace
|
||||
(
|
||||
meshMod,
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -246,11 +238,9 @@ void Foam::extrude2DMesh::setRefinement
|
||||
newFace,
|
||||
mesh_.faceOwner()[facei] + offset, // own
|
||||
mesh_.faceNeighbour()[facei] + offset, // nei
|
||||
nFaces++, // masterFaceID
|
||||
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)
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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_;
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user