From 5fa1338e0e1ca451a07a809f0ca5ce1c775404b4 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 28 Jul 2011 22:21:35 +0100 Subject: [PATCH] ENH: splitMeshRegions: -overwrite and -insidePoint/-largestOnly will overwrite starting mesh --- .../splitMeshRegions/splitMeshRegions.C | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index e01dd5ca43..e8d634f7a3 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,6 @@ Description this if you don't mind having disconnected domains in a single region. This option requires all cells to be in one (and one only) cellZone. - - Should work in parallel. cellZones can differ on either side of processor boundaries in which case the faces get moved from processor patch to directMapped patch. Not @@ -66,6 +65,13 @@ Description region that covers more than 50% of the zone. It has to be a subset so cannot have any cells in any other zone. + - If explicitly a single region has been selected (-largestOnly or + -insidePoint) its region name will be either + - name of a cellZone it matches to or + - "largestOnly" respectively "insidePoint" or + - polyMesh::defaultRegion if additionally -overwrite + (so it will overwrite the input mesh!) + - writes maps like decomposePar back to original mesh: - pointRegionAddressing : for every point in this region the point in the original mesh @@ -1866,6 +1872,29 @@ int main(int argc, char *argv[]) regionNames, zoneToRegion ); + + // Override any default region names if single region selected + if (largestOnly || insidePoint) + { + forAll(regionToZone, regionI) + { + if (regionToZone[regionI] == -1) + { + if (overwrite) + { + regionNames[regionI] = polyMesh::defaultRegion; + } + else if (insidePoint) + { + regionNames[regionI] = "insidePoint"; + } + else if (largestOnly) + { + regionNames[regionI] = "largestOnly"; + } + } + } + } } Info<< endl << "Number of regions:" << nCellRegions << nl << endl; @@ -2173,7 +2202,8 @@ int main(int argc, char *argv[]) Info<< nl << "Subsetting region " << regionI - << " of size " << regionSizes[regionI] << endl; + << " of size " << regionSizes[regionI] + << " as named region " << regionNames[regionI] << endl; createAndWriteRegion (