mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
detect only option
This commit is contained in:
@ -154,10 +154,77 @@ void insertDuplicateMerge
|
||||
}
|
||||
|
||||
|
||||
labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces)
|
||||
{
|
||||
// Get all duplicate face labels (in boundaryFaces indices!).
|
||||
labelList duplicates = localPointRegion::findDuplicateFaces
|
||||
(
|
||||
mesh,
|
||||
boundaryFaces
|
||||
);
|
||||
|
||||
|
||||
// Check that none are on processor patches
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
{
|
||||
if (duplicates[bFaceI] != -1)
|
||||
{
|
||||
label faceI = mesh.nInternalFaces() + bFaceI;
|
||||
label patchI = patches.whichPatch(faceI);
|
||||
|
||||
if (isA<processorPolyPatch>(patches[patchI]))
|
||||
{
|
||||
FatalErrorIn("findBaffles(const polyMesh&, const labelList&)")
|
||||
<< "Duplicate face " << faceI
|
||||
<< " is on a processorPolyPatch."
|
||||
<< "This is not allowed." << nl
|
||||
<< "Face:" << faceI
|
||||
<< " is on patch:" << patches[patchI].name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Write to faceSet for ease of postprocessing.
|
||||
{
|
||||
faceSet duplicateSet
|
||||
(
|
||||
mesh,
|
||||
"duplicateFaces",
|
||||
(mesh.nFaces() - mesh.nInternalFaces())/256
|
||||
);
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
{
|
||||
label otherFaceI = duplicates[bFaceI];
|
||||
|
||||
if (otherFaceI != -1 && otherFaceI > bFaceI)
|
||||
{
|
||||
duplicateSet.insert(mesh.nInternalFaces() + bFaceI);
|
||||
duplicateSet.insert(mesh.nInternalFaces() + otherFaceI);
|
||||
}
|
||||
}
|
||||
|
||||
Pout<< "Writing " << duplicateSet.size()
|
||||
<< " duplicate faces to faceSet " << duplicateSet.objectPath()
|
||||
<< nl << endl;
|
||||
duplicateSet.write();
|
||||
}
|
||||
|
||||
return duplicates;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validOptions.insert("split", "");
|
||||
argList::validOptions.insert("overwrite", "");
|
||||
argList::validOptions.insert("detectOnly", "");
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
runTime.functionObjects().off();
|
||||
@ -165,6 +232,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
bool split = args.options().found("split");
|
||||
bool overwrite = args.options().found("overwrite");
|
||||
bool detectOnly = args.options().found("detectOnly");
|
||||
|
||||
// Collect all boundary faces
|
||||
labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());
|
||||
@ -175,6 +243,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if (detectOnly)
|
||||
{
|
||||
findBaffles(mesh, boundaryFaces);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Read objects in time directory
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
@ -238,62 +315,7 @@ int main(int argc, char *argv[])
|
||||
<< nl << endl;
|
||||
|
||||
// Get all duplicate face labels (in boundaryFaces indices!).
|
||||
labelList duplicates = localPointRegion::findDuplicateFaces
|
||||
(
|
||||
mesh,
|
||||
boundaryFaces
|
||||
);
|
||||
|
||||
|
||||
// Check that none are on processor patches
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
{
|
||||
if (duplicates[bFaceI] != -1)
|
||||
{
|
||||
label faceI = mesh.nInternalFaces() + bFaceI;
|
||||
label patchI = patches.whichPatch(faceI);
|
||||
|
||||
if (isA<processorPolyPatch>(patches[patchI]))
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Duplicate face " << faceI
|
||||
<< " is on a processorPolyPatch."
|
||||
<< "This is not allowed." << nl
|
||||
<< "Face:" << faceI
|
||||
<< " is on patch:" << patches[patchI].name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Write to faceSet for ease of postprocessing.
|
||||
{
|
||||
faceSet duplicateSet
|
||||
(
|
||||
mesh,
|
||||
"duplicateFaces",
|
||||
(mesh.nFaces() - mesh.nInternalFaces())/256
|
||||
);
|
||||
|
||||
forAll(duplicates, bFaceI)
|
||||
{
|
||||
label otherFaceI = duplicates[bFaceI];
|
||||
|
||||
if (otherFaceI != -1 && otherFaceI > bFaceI)
|
||||
{
|
||||
duplicateSet.insert(mesh.nInternalFaces() + bFaceI);
|
||||
duplicateSet.insert(mesh.nInternalFaces() + otherFaceI);
|
||||
}
|
||||
}
|
||||
|
||||
Pout<< "Writing " << duplicateSet.size()
|
||||
<< " duplicate faces to faceSet " << duplicateSet.objectPath()
|
||||
<< nl << endl;
|
||||
duplicateSet.write();
|
||||
}
|
||||
labelList duplicates(findBaffles(mesh, boundaryFaces));
|
||||
|
||||
// Merge into internal faces.
|
||||
insertDuplicateMerge(mesh, duplicates, meshMod);
|
||||
|
||||
Reference in New Issue
Block a user