mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: gmshToFoam: remove empty defaultFaces patch
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -757,9 +757,23 @@ int main(int argc, char *argv[])
|
|||||||
"retain raw orientation for prisms/hexs"
|
"retain raw orientation for prisms/hexs"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# include "addRegionOption.H"
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
Foam::word regionName;
|
||||||
|
|
||||||
|
if (args.optionReadIfPresent("region", regionName))
|
||||||
|
{
|
||||||
|
Foam::Info
|
||||||
|
<< "Creating polyMesh for region " << regionName << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
regionName = Foam::polyMesh::defaultRegion;
|
||||||
|
}
|
||||||
|
|
||||||
const bool keepOrientation = args.optionFound("keepOrientation");
|
const bool keepOrientation = args.optionFound("keepOrientation");
|
||||||
IFstream inFile(args[1]);
|
IFstream inFile(args[1]);
|
||||||
|
|
||||||
@ -894,7 +908,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
polyMesh::defaultRegion,
|
regionName,
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime
|
runTime
|
||||||
),
|
),
|
||||||
@ -984,6 +998,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
//Get polyMesh to write to constant
|
//Get polyMesh to write to constant
|
||||||
|
|
||||||
runTime.setTime(instant(runTime.constant()), 0);
|
runTime.setTime(instant(runTime.constant()), 0);
|
||||||
|
|
||||||
repatcher.repatch();
|
repatcher.repatch();
|
||||||
@ -1079,6 +1094,32 @@ int main(int argc, char *argv[])
|
|||||||
mesh.addZones(List<pointZone*>(0), fz, cz);
|
mesh.addZones(List<pointZone*>(0), fz, cz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove empty defaultFaces
|
||||||
|
label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName);
|
||||||
|
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
|
||||||
|
{
|
||||||
|
List<polyPatch*> newPatchPtrList((mesh.boundaryMesh().size() - 1));
|
||||||
|
label newPatchI = 0;
|
||||||
|
forAll(mesh.boundaryMesh(), patchI)
|
||||||
|
{
|
||||||
|
if (patchI != defaultPatchID)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh.boundaryMesh()[patchI];
|
||||||
|
|
||||||
|
newPatchPtrList[newPatchI] = patch.clone
|
||||||
|
(
|
||||||
|
mesh.boundaryMesh(),
|
||||||
|
newPatchI,
|
||||||
|
patch.size(),
|
||||||
|
patch.start()
|
||||||
|
).ptr();
|
||||||
|
|
||||||
|
newPatchI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repatcher.changePatches(newPatchPtrList);
|
||||||
|
}
|
||||||
|
|
||||||
mesh.write();
|
mesh.write();
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user