Set management updates

This commit is contained in:
Hrvoje Jasak 2015-08-17 20:38:31 +01:00
parent ec7f7f4df9
commit 307f8131e7
4 changed files with 31 additions and 9 deletions

View file

@ -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)

View file

@ -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());
}

View file

@ -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();
}

View file

@ -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();
}