mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Fixing snappyHexMesh tut conflict
This commit is contained in:
@ -209,6 +209,8 @@ snapControls
|
||||
// Settings for the layer addition.
|
||||
addLayersControls
|
||||
{
|
||||
relativeSizes true;
|
||||
|
||||
// Per final patch (so not geometry!) the layer information
|
||||
layers
|
||||
{
|
||||
@ -226,11 +228,12 @@ addLayersControls
|
||||
// Expansion factor for layer mesh
|
||||
expansionRatio 1.0;
|
||||
|
||||
|
||||
//- Wanted thickness of final added cell layer. If multiple layers
|
||||
// is the
|
||||
// thickness of the layer furthest away from the wall.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
finalLayerRatio 0.3;
|
||||
finalLayerThickness 0.3;
|
||||
|
||||
//- Minimum thickness of cell layer. If for any reason layer
|
||||
// cannot be above minThickness do not add layer.
|
||||
|
||||
@ -7,6 +7,31 @@
|
||||
#include "pointSet.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
bool Foam::checkSync(const wordList& names)
|
||||
{
|
||||
List<wordList> allNames(Pstream::nProcs());
|
||||
allNames[Pstream::myProcNo()] = names;
|
||||
Pstream::gatherList(allNames);
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
for (label procI = 1; procI < allNames.size(); procI++)
|
||||
{
|
||||
if (allNames[procI] != allNames[0])
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
Info<< " ***Inconsistent zones across processors, "
|
||||
"processor 0 has zones:" << allNames[0]
|
||||
<< ", processor " << procI << " has zones:"
|
||||
<< allNames[procI]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
return hasError;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::checkTopology
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -24,6 +49,31 @@ Foam::label Foam::checkTopology
|
||||
// Check if the boundary processor patches are correct
|
||||
mesh.boundaryMesh().checkParallelSync(true);
|
||||
|
||||
// Check names of zones are equal
|
||||
if (checkSync(mesh.cellZones().names()))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
if (checkSync(mesh.faceZones().names()))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
if (checkSync(mesh.pointZones().names()))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
|
||||
// Check contents of faceZones consistent
|
||||
{
|
||||
forAll(mesh.faceZones(), zoneI)
|
||||
{
|
||||
if (mesh.faceZones()[zoneI].checkParallelSync(true))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
pointSet points(mesh, "unusedPoints", mesh.nPoints()/100);
|
||||
if (mesh.checkPoints(true, &points))
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
#include "label.H"
|
||||
#include "wordList.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
class polyMesh;
|
||||
|
||||
bool checkSync(const wordList& names);
|
||||
|
||||
label checkTopology(const polyMesh&, const bool, const bool);
|
||||
}
|
||||
|
||||
@ -69,13 +69,13 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
||||
<< " cells: "
|
||||
<< returnReduce(mesh.cells().size(), sumOp<label>()) << nl
|
||||
<< " boundary patches: "
|
||||
<< returnReduce(mesh.boundaryMesh().size(), sumOp<label>()) << nl
|
||||
<< mesh.boundaryMesh().size() << nl
|
||||
<< " point zones: "
|
||||
<< returnReduce(mesh.pointZones().size(), sumOp<label>()) << nl
|
||||
<< mesh.pointZones().size() << nl
|
||||
<< " face zones: "
|
||||
<< returnReduce(mesh.faceZones().size(), sumOp<label>()) << nl
|
||||
<< mesh.faceZones().size() << nl
|
||||
<< " cell zones: "
|
||||
<< returnReduce(mesh.cellZones().size(), sumOp<label>()) << nl
|
||||
<< mesh.cellZones().size() << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
|
||||
@ -43,16 +43,89 @@ Description
|
||||
#include "ReadFields.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "ZoneIDs.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void modifyOrAddFace
|
||||
(
|
||||
polyTopoChange& meshMod,
|
||||
const face& f,
|
||||
const label faceI,
|
||||
const label own,
|
||||
const bool flipFaceFlux,
|
||||
const label newPatchI,
|
||||
const label zoneID,
|
||||
const bool zoneFlip,
|
||||
|
||||
PackedBoolList& modifiedFace
|
||||
)
|
||||
{
|
||||
if (!modifiedFace[faceI])
|
||||
{
|
||||
// First usage of face. Modify.
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
f, // modified face
|
||||
faceI, // label of face
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
flipFaceFlux, // face flip
|
||||
newPatchI, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
modifiedFace[faceI] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Second or more usage of face. Add.
|
||||
meshMod.setAction
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
f, // modified face
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
faceI, // master face
|
||||
flipFaceFlux, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label findPatchID(const polyMesh& mesh, const word& name)
|
||||
{
|
||||
label patchI = mesh.boundaryMesh().findPatchID(name);
|
||||
|
||||
if (patchI == -1)
|
||||
{
|
||||
FatalErrorIn("findPatchID(const polyMesh&, const word&)")
|
||||
<< "Cannot find patch " << name << endl
|
||||
<< "Valid patches are " << mesh.boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
return patchI;
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validArgs.append("set");
|
||||
argList::validArgs.append("faceZone");
|
||||
argList::validArgs.append("patch");
|
||||
argList::validOptions.insert("additionalPatches", "(patch2 .. patchN)");
|
||||
argList::validOptions.insert("overwrite", "");
|
||||
@ -67,30 +140,28 @@ int main(int argc, char *argv[])
|
||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||
|
||||
// Faces to baffle
|
||||
word setName(args.additionalArgs()[0]);
|
||||
Info<< "Reading faceSet from " << setName << nl << endl;
|
||||
faceSet facesToSplit(mesh, setName);
|
||||
// Make sure set is synchronised across couples
|
||||
facesToSplit.sync(mesh);
|
||||
Info<< "Read " << returnReduce(facesToSplit.size(), sumOp<label>())
|
||||
<< " faces from " << setName << nl << endl;
|
||||
faceZoneID zoneID(args.additionalArgs()[0], faceZones);
|
||||
|
||||
Info<< "Converting faces on zone " << zoneID.name()
|
||||
<< " into baffles." << nl << endl;
|
||||
|
||||
const faceZone& fZone = faceZones[zoneID.index()];
|
||||
|
||||
Info<< "Found " << returnReduce(fZone.size(), sumOp<label>())
|
||||
<< " faces on zone " << zoneID.name() << nl << endl;
|
||||
|
||||
// Make sure patches and zoneFaces are synchronised across couples
|
||||
patches.checkParallelSync(true);
|
||||
fZone.checkParallelSync(true);
|
||||
|
||||
// Patches to put baffles into
|
||||
DynamicList<label> newPatches(1);
|
||||
|
||||
word patchName(args.additionalArgs()[1]);
|
||||
newPatches.append(patches.findPatchID(patchName));
|
||||
Pout<< "Using patch " << patchName
|
||||
newPatches.append(findPatchID(mesh, patchName));
|
||||
Info<< "Using patch " << patchName
|
||||
<< " at index " << newPatches[0] << endl;
|
||||
|
||||
if (newPatches[0] == -1)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot find patch " << patchName << endl
|
||||
<< "Valid patches are " << patches.names() << exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// Additional patches
|
||||
if (args.optionFound("additionalPatches"))
|
||||
@ -103,19 +174,9 @@ int main(int argc, char *argv[])
|
||||
newPatches.reserve(patchNames.size() + 1);
|
||||
forAll(patchNames, i)
|
||||
{
|
||||
label patchI = patches.findPatchID(patchNames[i]);
|
||||
newPatches.append(findPatchID(mesh, patchNames[i]));
|
||||
Info<< "Using additional patch " << patchNames[i]
|
||||
<< " at index " << patchI << endl;
|
||||
|
||||
if (patchI == -1)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot find patch " << patchNames[i] << endl
|
||||
<< "Valid patches are " << patches.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
newPatches.append(patchI);
|
||||
<< " at index " << newPatches[newPatches.size()-1] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,111 +227,112 @@ int main(int argc, char *argv[])
|
||||
polyTopoChange meshMod(mesh);
|
||||
|
||||
|
||||
// Do the actual changes
|
||||
// Note order in which faces are modified/added is so they end up correctly
|
||||
// for cyclic patches (original faces first and then reversed faces)
|
||||
// since otherwise it will have trouble matching baffles.
|
||||
// Do the actual changes. Note:
|
||||
// - loop in incrementing face order (not necessary if faceZone ordered).
|
||||
// Preserves any existing ordering on patch faces.
|
||||
// - two passes, do non-flip faces first and flip faces second. This
|
||||
// guarantees that when e.g. creating a cyclic all faces from one
|
||||
// side come first and faces from the other side next.
|
||||
|
||||
label nBaffled = 0;
|
||||
PackedBoolList modifiedFace(mesh.nFaces());
|
||||
|
||||
forAll(newPatches, i)
|
||||
{
|
||||
label newPatchI = newPatches[i];
|
||||
|
||||
// Pass 1. Do selected side of zone
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
if (facesToSplit.found(faceI))
|
||||
{
|
||||
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)];
|
||||
}
|
||||
label zoneFaceI = fZone.whichFace(faceI);
|
||||
|
||||
if (i == 0)
|
||||
if (zoneFaceI != -1)
|
||||
{
|
||||
if (!fZone.flipMap()[zoneFaceI])
|
||||
{
|
||||
// First usage of face. Modify.
|
||||
meshMod.setAction
|
||||
// Use owner side of face
|
||||
modifyOrAddFace
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
f, // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceOwner()[faceI], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
meshMod,
|
||||
mesh.faces()[faceI], // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceOwner()[faceI],// owner
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID.index(), // zone for face
|
||||
false, // face flip in zone
|
||||
modifiedFace // modify or add status
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Second or more usage of face. Add.
|
||||
meshMod.setAction
|
||||
// Use neighbour side of face
|
||||
modifyOrAddFace
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
f, // modified face
|
||||
mesh.faceOwner()[faceI], // owner
|
||||
-1, // neighbour
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
faceI, // master face
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
nBaffled++;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the reversed face.
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
if (facesToSplit.found(faceI))
|
||||
{
|
||||
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)];
|
||||
}
|
||||
label nei = mesh.faceNeighbour()[faceI];
|
||||
|
||||
meshMod.setAction
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
f.reverseFace(), // modified face
|
||||
nei, // owner
|
||||
-1, // neighbour
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
faceI, // masterFaceID,
|
||||
meshMod,
|
||||
mesh.faces()[faceI].reverseFace(), // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceNeighbour()[faceI],// owner
|
||||
true, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
nBaffled++;
|
||||
zoneID.index(), // zone for face
|
||||
true, // face flip in zone
|
||||
modifiedFace // modify or add status
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pass 2. Do other side of zone
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
label zoneFaceI = fZone.whichFace(faceI);
|
||||
|
||||
if (zoneFaceI != -1)
|
||||
{
|
||||
if (!fZone.flipMap()[zoneFaceI])
|
||||
{
|
||||
// Use neighbour side of face
|
||||
modifyOrAddFace
|
||||
(
|
||||
meshMod,
|
||||
mesh.faces()[faceI].reverseFace(), // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceNeighbour()[faceI], // owner
|
||||
true, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID.index(), // zone for face
|
||||
true, // face flip in zone
|
||||
modifiedFace // modify or add
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use owner side of face
|
||||
modifyOrAddFace
|
||||
(
|
||||
meshMod,
|
||||
mesh.faces()[faceI], // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceOwner()[faceI],// owner
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID.index(), // zone for face
|
||||
false, // face flip in zone
|
||||
modifiedFace // modify or add status
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Modify any boundary faces
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
@ -286,58 +348,22 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
|
||||
if (facesToSplit.found(faceI))
|
||||
label zoneFaceI = fZone.whichFace(faceI);
|
||||
|
||||
if (zoneFaceI != -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)];
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
// First usage of face. Modify.
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
f, // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceOwner()[faceI],// owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Second or more usage of face. Add.
|
||||
meshMod.setAction
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
f, // modified face
|
||||
mesh.faceOwner()[faceI],// owner
|
||||
-1, // neighbour
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
faceI, // master face
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
nBaffled++;
|
||||
modifyOrAddFace
|
||||
(
|
||||
meshMod,
|
||||
mesh.faces()[faceI], // modified face
|
||||
faceI, // label of face
|
||||
mesh.faceOwner()[faceI], // owner
|
||||
false, // face flip
|
||||
newPatchI, // patch for face
|
||||
zoneID.index(), // zone for face
|
||||
fZone.flipMap()[zoneFaceI], // face flip in zone
|
||||
modifiedFace // modify or add status
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -345,7 +371,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
Info<< "Converted " << returnReduce(nBaffled, sumOp<label>())
|
||||
Info<< "Converted " << returnReduce(modifiedFace.count(), sumOp<label>())
|
||||
<< " faces into boundary faces on patch " << patchName << nl << endl;
|
||||
|
||||
if (!overwrite)
|
||||
|
||||
@ -73,23 +73,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
label getPatch(const polyBoundaryMesh& patches, const word& patchName)
|
||||
{
|
||||
label patchI = patches.findPatchID(patchName);
|
||||
|
||||
if (patchI == -1)
|
||||
{
|
||||
FatalErrorIn("createPatch(const polyBoundaryMesh&, const word&)")
|
||||
<< "Cannot find source patch " << patchName
|
||||
<< endl << "Valid patch names are " << patches.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return patchI;
|
||||
}
|
||||
|
||||
|
||||
void changePatchID
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -704,14 +687,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (sourceType == "patches")
|
||||
{
|
||||
wordList patchSources(dict.lookup("patches"));
|
||||
labelHashSet patchSources(patches.patchSet(dict.lookup("patches")));
|
||||
|
||||
// Repatch faces of the patches.
|
||||
forAll(patchSources, sourceI)
|
||||
forAllConstIter(labelHashSet, patchSources, iter)
|
||||
{
|
||||
label patchI = getPatch(patches, patchSources[sourceI]);
|
||||
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const polyPatch& pp = patches[iter.key()];
|
||||
|
||||
Info<< "Moving faces from patch " << pp.name()
|
||||
<< " to patch " << destPatchI << endl;
|
||||
|
||||
@ -69,8 +69,8 @@ patches
|
||||
// How to construct: either from 'patches' or 'set'
|
||||
constructFrom patches;
|
||||
|
||||
// If constructFrom = patches : names of patches
|
||||
patches (periodic-1 periodic-2);
|
||||
// If constructFrom = patches : names of patches. Wildcards allowed.
|
||||
patches ("periodic.*");
|
||||
|
||||
// If constructFrom = set : name of faceSet
|
||||
set f0;
|
||||
|
||||
@ -367,7 +367,7 @@ bool doCommand
|
||||
{
|
||||
r = IOobject::NO_READ;
|
||||
|
||||
backup(mesh, setName, setName + "_old");
|
||||
//backup(mesh, setName, setName + "_old");
|
||||
|
||||
currentSetPtr = topoSet::New(setType, mesh, setName, typSize);
|
||||
}
|
||||
@ -399,11 +399,11 @@ bool doCommand
|
||||
<< " Action:" << actionName
|
||||
<< endl;
|
||||
|
||||
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
|
||||
{
|
||||
// currentSet has been read so can make copy.
|
||||
backup(mesh, setName, currentSet, setName + "_old");
|
||||
}
|
||||
//if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
|
||||
//{
|
||||
// // currentSet has been read so can make copy.
|
||||
// backup(mesh, setName, currentSet, setName + "_old");
|
||||
//}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@ -558,7 +558,8 @@ void printMesh(const Time& runTime, const polyMesh& mesh)
|
||||
<< " cells:" << mesh.nCells()
|
||||
<< " faces:" << mesh.nFaces()
|
||||
<< " points:" << mesh.nPoints()
|
||||
<< " patches:" << mesh.boundaryMesh().size() << nl;
|
||||
<< " patches:" << mesh.boundaryMesh().size()
|
||||
<< " bb:" << mesh.bounds() << nl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
||||
polyMesh::meshSubDir/"sets"
|
||||
);
|
||||
|
||||
Pout<< "Searched : " << mesh.pointsInstance()/polyMesh::meshSubDir/"sets"
|
||||
Info<< "Searched : " << mesh.pointsInstance()/polyMesh::meshSubDir/"sets"
|
||||
<< nl
|
||||
<< "Found : " << objects.names() << nl
|
||||
<< endl;
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
IOobjectList pointObjects(objects.lookupClass(pointSet::typeName));
|
||||
|
||||
Pout<< "pointSets:" << pointObjects.names() << endl;
|
||||
//Pout<< "pointSets:" << pointObjects.names() << endl;
|
||||
|
||||
for
|
||||
(
|
||||
@ -126,6 +126,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
mesh.pointZones().instance() = mesh.facesInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -133,57 +134,17 @@ int main(int argc, char *argv[])
|
||||
<< " with that of set " << set.name() << "." << endl;
|
||||
mesh.pointZones()[zoneID] = pointLabels;
|
||||
mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
mesh.pointZones().instance() = mesh.facesInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IOobjectList cellObjects(objects.lookupClass(cellSet::typeName));
|
||||
|
||||
Pout<< "cellSets:" << cellObjects.names() << endl;
|
||||
|
||||
for
|
||||
(
|
||||
IOobjectList::const_iterator iter = cellObjects.begin();
|
||||
iter != cellObjects.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
// Not in memory. Load it.
|
||||
cellSet set(*iter());
|
||||
SortableList<label> cellLabels(set.toc());
|
||||
|
||||
label zoneID = mesh.cellZones().findZoneID(set.name());
|
||||
if (zoneID == -1)
|
||||
{
|
||||
Info<< "Adding set " << set.name() << " as a cellZone." << endl;
|
||||
label sz = mesh.cellZones().size();
|
||||
mesh.cellZones().setSize(sz+1);
|
||||
mesh.cellZones().set
|
||||
(
|
||||
sz,
|
||||
new cellZone
|
||||
(
|
||||
set.name(), //name
|
||||
cellLabels, //addressing
|
||||
sz, //index
|
||||
mesh.cellZones() //pointZoneMesh
|
||||
)
|
||||
);
|
||||
mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Overwriting contents of existing cellZone " << zoneID
|
||||
<< " with that of set " << set.name() << "." << endl;
|
||||
mesh.cellZones()[zoneID] = cellLabels;
|
||||
mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IOobjectList faceObjects(objects.lookupClass(faceSet::typeName));
|
||||
|
||||
Pout<< "faceSets:" << faceObjects.names() << endl;
|
||||
HashSet<word> slaveCellSets;
|
||||
|
||||
//Pout<< "faceSets:" << faceObjects.names() << endl;
|
||||
|
||||
for
|
||||
(
|
||||
@ -203,9 +164,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
word setName(set.name() + "SlaveCells");
|
||||
|
||||
Pout<< "Trying to load cellSet " << setName
|
||||
Info<< "Trying to load cellSet " << setName
|
||||
<< " to find out the slave side of the zone." << nl
|
||||
<< " If you do not care about the flipMap"
|
||||
<< "If you do not care about the flipMap"
|
||||
<< " (i.e. do not use the sideness)" << nl
|
||||
<< "use the -noFlipMap command line option."
|
||||
<< endl;
|
||||
@ -213,6 +174,9 @@ int main(int argc, char *argv[])
|
||||
// Load corresponding cells
|
||||
cellSet cells(mesh, setName);
|
||||
|
||||
// Store setName to exclude from cellZones further on
|
||||
slaveCellSets.insert(setName);
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
label faceI = faceLabels[i];
|
||||
@ -227,7 +191,7 @@ int main(int argc, char *argv[])
|
||||
&& !cells.found(mesh.faceNeighbour()[faceI])
|
||||
)
|
||||
{
|
||||
flip = true;
|
||||
flip = false;
|
||||
}
|
||||
else if
|
||||
(
|
||||
@ -235,7 +199,7 @@ int main(int argc, char *argv[])
|
||||
&& cells.found(mesh.faceNeighbour()[faceI])
|
||||
)
|
||||
{
|
||||
flip = false;
|
||||
flip = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -257,11 +221,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (cells.found(mesh.faceOwner()[faceI]))
|
||||
{
|
||||
flip = true;
|
||||
flip = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
flip = false;
|
||||
flip = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,6 +263,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
mesh.faceZones().instance() = mesh.facesInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -310,10 +275,63 @@ int main(int argc, char *argv[])
|
||||
flipMap.shrink()
|
||||
);
|
||||
mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
mesh.faceZones().instance() = mesh.facesInstance();
|
||||
}
|
||||
}
|
||||
|
||||
Pout<< "Writing mesh." << endl;
|
||||
|
||||
|
||||
IOobjectList cellObjects(objects.lookupClass(cellSet::typeName));
|
||||
|
||||
//Pout<< "cellSets:" << cellObjects.names() << endl;
|
||||
|
||||
for
|
||||
(
|
||||
IOobjectList::const_iterator iter = cellObjects.begin();
|
||||
iter != cellObjects.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
if (!slaveCellSets.found(iter.key()))
|
||||
{
|
||||
// Not in memory. Load it.
|
||||
cellSet set(*iter());
|
||||
SortableList<label> cellLabels(set.toc());
|
||||
|
||||
label zoneID = mesh.cellZones().findZoneID(set.name());
|
||||
if (zoneID == -1)
|
||||
{
|
||||
Info<< "Adding set " << set.name() << " as a cellZone." << endl;
|
||||
label sz = mesh.cellZones().size();
|
||||
mesh.cellZones().setSize(sz+1);
|
||||
mesh.cellZones().set
|
||||
(
|
||||
sz,
|
||||
new cellZone
|
||||
(
|
||||
set.name(), //name
|
||||
cellLabels, //addressing
|
||||
sz, //index
|
||||
mesh.cellZones() //pointZoneMesh
|
||||
)
|
||||
);
|
||||
mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
mesh.cellZones().instance() = mesh.facesInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Overwriting contents of existing cellZone " << zoneID
|
||||
<< " with that of set " << set.name() << "." << endl;
|
||||
mesh.cellZones()[zoneID] = cellLabels;
|
||||
mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
mesh.cellZones().instance() = mesh.facesInstance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Info<< "Writing mesh." << endl;
|
||||
|
||||
if (!mesh.write())
|
||||
{
|
||||
@ -322,7 +340,7 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Pout << nl << "End" << endl;
|
||||
Info<< nl << "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user