mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add blockMesh -sets option to write cellZones as cellSets (closes #348)
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,6 +49,9 @@ Usage
|
||||
- \par -dict \<filename\>
|
||||
Specify alternative dictionary for the block mesh description.
|
||||
|
||||
- \par -sets
|
||||
Write cellZones as cellSets too (for processing purposes)
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Time.H"
|
||||
@ -85,7 +88,11 @@ int main(int argc, char *argv[])
|
||||
"file",
|
||||
"specify alternative dictionary for the blockMesh description"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"sets",
|
||||
"write cellZones as cellSets too (for processing purposes)"
|
||||
);
|
||||
argList::addNote
|
||||
(
|
||||
"Block description\n"
|
||||
@ -187,7 +194,6 @@ int main(int argc, char *argv[])
|
||||
IOdictionary meshDict(meshDictIO);
|
||||
blockMesh blocks(meshDict, regionName);
|
||||
|
||||
|
||||
if (args.optionFound("blockTopology"))
|
||||
{
|
||||
// Write mesh as edges.
|
||||
@ -251,7 +257,6 @@ int main(int argc, char *argv[])
|
||||
defaultFacesType
|
||||
);
|
||||
|
||||
|
||||
// Read in a list of dictionaries for the merge patch pairs
|
||||
if (meshDict.found("mergePatchPairs"))
|
||||
{
|
||||
@ -271,8 +276,7 @@ int main(int argc, char *argv[])
|
||||
// Set any cellZones (note: cell labelling unaffected by above
|
||||
// mergePatchPairs)
|
||||
|
||||
label nZones = blocks.numZonedBlocks();
|
||||
|
||||
const label nZones = blocks.numZonedBlocks();
|
||||
if (nZones > 0)
|
||||
{
|
||||
Info<< nl << "Adding cell zones" << endl;
|
||||
@ -325,11 +329,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<cellZone*> cz(zoneMap.size());
|
||||
|
||||
Info<< nl << "Writing cell zones as cellSets" << endl;
|
||||
|
||||
forAllConstIter(HashTable<label>, zoneMap, iter)
|
||||
{
|
||||
label zoneI = iter();
|
||||
@ -341,10 +341,6 @@ int main(int argc, char *argv[])
|
||||
zoneI,
|
||||
mesh.cellZones()
|
||||
);
|
||||
|
||||
// Write as cellSet for ease of processing
|
||||
cellSet cset(mesh, iter.key(), zoneCells[zoneI].shrink());
|
||||
cset.write();
|
||||
}
|
||||
|
||||
mesh.pointZones().setSize(0);
|
||||
@ -356,7 +352,14 @@ int main(int argc, char *argv[])
|
||||
// Set the precision of the points data to 10
|
||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||
|
||||
Info<< nl << "Writing polyMesh" << endl;
|
||||
Info<< nl << "Writing polyMesh with "
|
||||
<< mesh.cellZones().size() << " cellZones";
|
||||
if (args.optionFound("sets") && !mesh.cellZones().empty())
|
||||
{
|
||||
Info<< " (written as cellSets too)";
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
mesh.removeFiles();
|
||||
if (!mesh.write())
|
||||
{
|
||||
@ -365,6 +368,14 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (args.optionFound("sets"))
|
||||
{
|
||||
forAll(mesh.cellZones(), zonei)
|
||||
{
|
||||
const cellZone& cz = mesh.cellZones()[zonei];
|
||||
cellSet(mesh, cz.name(), cz).write();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// write some information
|
||||
|
||||
Reference in New Issue
Block a user