diff --git a/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C b/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C index 89dbe0398..497b1ba9f 100644 --- a/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C +++ b/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C @@ -45,6 +45,7 @@ int main(int argc, char *argv[]) // Add option to write empty sets argList::validOptions.insert("writeEmptySets", ""); + argList::validOptions.insert("liveObjectsOnly", ""); # include "setRootCase.H" # include "createTime.H" @@ -52,6 +53,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << endl; bool writeEmptySets = args.optionFound("writeEmptySets"); + bool liveObjectsOnly = args.optionFound("liveObjectsOnly"); // Determine the processor count directly label nProcs = 0; @@ -128,10 +130,18 @@ int main(int argc, char *argv[]) { const labelList& addr = procMeshes.pointProcAddressing()[procI]; + const label nProcPoints = procMeshes.meshes()[procI].nPoints(); + labelHashSet procSet; forAll (addr, pointI) { + // Skip list when nPoints is reached + if (liveObjectsOnly && pointI >= nProcPoints) + { + break; + } + if (set.found(addr[pointI])) { procSet.insert(pointI); @@ -143,14 +153,14 @@ int main(int argc, char *argv[]) // Set created, write it Info<< "Writing point set " << set.name() << " on processor " << procI << endl; - pointSet cs + pointSet ps ( procMeshes.meshes()[procI], set.name(), procSet, IOobject::NO_WRITE ); - cs.write(); + ps.write(); } } } @@ -172,10 +182,18 @@ int main(int argc, char *argv[]) { const labelList& addr = procMeshes.faceProcAddressing()[procI]; + const label nProcFaces = procMeshes.meshes()[procI].nFaces(); + labelHashSet procSet; forAll (addr, faceI) { + // Skip list when nPoints is reached + if (liveObjectsOnly && faceI >= nProcFaces) + { + break; + } + // Note faceProcAddressing peculiarity: // change of sign and offset. HJ, 7/Mar/2011 if (set.found(mag(addr[faceI]) - 1)) @@ -189,14 +207,14 @@ int main(int argc, char *argv[]) // Set created, write it Info<< "Writing face set " << set.name() << " on processor " << procI << endl; - faceSet cs + faceSet fs ( procMeshes.meshes()[procI], set.name(), procSet, IOobject::NO_WRITE ); - cs.write(); + fs.write(); } } } @@ -218,6 +236,8 @@ int main(int argc, char *argv[]) { const labelList& addr = procMeshes.cellProcAddressing()[procI]; + // There are no retired cells: no special handling required + labelHashSet procSet; forAll (addr, cellI) diff --git a/src/meshTools/sets/topoSets/cellSet.C b/src/meshTools/sets/topoSets/cellSet.C index c9e6cf36f..aad7c05cc 100644 --- a/src/meshTools/sets/topoSets/cellSet.C +++ b/src/meshTools/sets/topoSets/cellSet.C @@ -61,7 +61,7 @@ cellSet::cellSet : topoSet(mesh, typeName, name, r, w) { - // Make sure set within valid range + // Make sure set within valid range: there are no retired cells check(mesh.nCells()); } diff --git a/src/meshTools/sets/topoSets/faceSet.C b/src/meshTools/sets/topoSets/faceSet.C index 8affe4ae3..f1ab86fc9 100644 --- a/src/meshTools/sets/topoSets/faceSet.C +++ b/src/meshTools/sets/topoSets/faceSet.C @@ -63,7 +63,8 @@ faceSet::faceSet : topoSet(mesh, typeName, name, r, w) { - check(mesh.nFaces()); + // Sets can also contain retired faces. HJ, 17/Aug/2015 + check(mesh.allFaces().size()); } @@ -228,7 +229,7 @@ void faceSet::sync(const polyMesh& mesh) label faceSet::maxSize(const polyMesh& mesh) const { - return mesh.nFaces(); + return mesh.allFaces().size(); } diff --git a/src/meshTools/sets/topoSets/pointSet.C b/src/meshTools/sets/topoSets/pointSet.C index cdcd6d6c9..efd9bb677 100644 --- a/src/meshTools/sets/topoSets/pointSet.C +++ b/src/meshTools/sets/topoSets/pointSet.C @@ -62,7 +62,8 @@ pointSet::pointSet : topoSet(mesh, typeName, name, r, w) { - check(mesh.nPoints()); + // Sets can contain retired points. HJ, 17/Aug/2015 + check(mesh.allPoints().size()); } @@ -147,7 +148,7 @@ void pointSet::sync(const polyMesh& mesh) label pointSet::maxSize(const polyMesh& mesh) const { - return mesh.nPoints(); + return mesh.allPoints().size(); }