ENH: allow changing verbosity of topoSetSource (#1060)

- make topoSet set/unset methods virtual to allow overloading
This commit is contained in:
Mark Olesen
2018-10-31 09:22:58 +00:00
parent 7325e3ac7d
commit b3156b0d0f
52 changed files with 654 additions and 236 deletions

View File

@ -116,12 +116,20 @@ void Foam::badQualityToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding bad-quality cells" << endl;
if (verbose_)
{
Info<< " Adding bad-quality cells" << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing bad-quality cells" << endl;
if (verbose_)
{
Info<< " Removing bad-quality cells" << endl;
}
combine(set, false);
}
}

View File

@ -112,12 +112,20 @@ void Foam::badQualityToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding bad-quality faces" << endl;
if (verbose_)
{
Info<< " Adding bad-quality faces" << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing bad-quality faces" << endl;
if (verbose_)
{
Info<< " Removing bad-quality faces" << endl;
}
combine(set, false);
}
}

View File

@ -144,13 +144,21 @@ void Foam::boxToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells with centre within boxes " << bbs_ << endl;
if (verbose_)
{
Info<< " Adding cells with centre within boxes "
<< bbs_ << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells with centre within boxes " << bbs_ << endl;
if (verbose_)
{
Info<< " Removing cells with centre within boxes "
<< bbs_ << endl;
}
combine(set, false);
}

View File

@ -96,8 +96,11 @@ void Foam::cellToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all elements of cellSet " << setName_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Adding all elements of cellSet " << setName_
<< " ..." << endl;
}
// Load the set
cellSet loadedSet(mesh_, setName_);
@ -106,8 +109,11 @@ void Foam::cellToCell::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all elements of cellSet " << setName_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Removing all elements of cellSet " << setName_
<< " ..." << endl;
}
// Load the set
cellSet loadedSet(mesh_, setName_);

View File

@ -160,21 +160,27 @@ void Foam::cylinderAnnulusToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
if (verbose_)
{
Info<< " Adding cells with centre within cylinder annulus,"
<< " with p1 = " << point1_ << ", p2 = " << point2_
<< ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
if (verbose_)
{
Info<< " Removing cells with centre within cylinder annulus,"
<< " with p1 = " << point1_ << ", p2 = " << point2_
<< ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
}
combine(set, false);
}

View File

@ -144,17 +144,23 @@ void Foam::cylinderToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
if (verbose_)
{
Info<< " Adding cells with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
if (verbose_)
{
Info<< " Removing cells with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
}
combine(set, false);
}

View File

@ -178,15 +178,21 @@ void Foam::faceToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells according to faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding cells according to faceSet " << setName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells according to faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing cells according to faceSet " << setName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -78,9 +78,12 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
: zone.slaveCells()
);
Info<< " Found matching zone " << zone.name()
<< " with " << cellLabels.size() << " cells on "
<< faceActionNames_[option_] << " side" << endl;
if (verbose_)
{
Info<< " Found matching zone " << zone.name()
<< " with " << cellLabels.size() << " cells on "
<< faceActionNames_[option_] << " side" << endl;
}
for (const label celli : cellLabels)
{
@ -161,17 +164,23 @@ void Foam::faceZoneToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all " << faceActionNames_[option_]
<< " cells of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Adding all " << faceActionNames_[option_]
<< " cells of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all " << faceActionNames_[option_]
<< " cells of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Removing all " << faceActionNames_[option_]
<< " cells of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, false);
}

View File

@ -74,12 +74,18 @@ void Foam::fieldToCell::applyToSet
topoSet& set
) const
{
Info<< " Field min:" << min(field) << " max:" << max(field) << endl;
if (verbose_)
{
Info << " Field min:" << min(field) << " max:" << max(field) << nl;
}
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all cells with value of field " << fieldName_
<< " within range " << min_ << ".." << max_ << endl;
if (verbose_)
{
Info<< " Adding all cells with value of field " << fieldName_
<< " within range " << min_ << ".." << max_ << endl;
}
forAll(field, celli)
{
@ -91,8 +97,11 @@ void Foam::fieldToCell::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells with value of field " << fieldName_
<< " within range " << min_ << ".." << max_ << endl;
if (verbose_)
{
Info<< " Removing all cells with value of field " << fieldName_
<< " within range " << min_ << ".." << max_ << endl;
}
forAll(field, celli)
{

View File

@ -118,13 +118,21 @@ void Foam::labelToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells mentioned in dictionary" << " ..." << endl;
if (verbose_)
{
Info<< " Adding cells mentioned in dictionary"
<< " ..." << endl;
}
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells mentioned in dictionary" << " ..." << endl;
if (verbose_)
{
Info<< " Removing cells mentioned in dictionary"
<< " ..." << endl;
}
addOrDelete(set, labels_, false);
}

View File

@ -153,15 +153,21 @@ void Foam::nbrToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells with only " << minNbrs_ << " or less"
" neighbouring cells" << " ..." << endl;
if (verbose_)
{
Info<< " Adding cells with only " << minNbrs_
<< " or fewer neighbouring cells" << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells with only " << minNbrs_ << " or less"
" neighbouring cells" << " ..." << endl;
if (verbose_)
{
Info<< " Removing cells with only " << minNbrs_
<< " or fewer neighbouring cells" << " ..." << endl;
}
combine(set, false);
}

View File

@ -154,13 +154,19 @@ void Foam::nearestToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells nearest to " << points_ << endl;
if (verbose_)
{
Info<< " Adding cells nearest to " << points_ << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells nearest to " << points_ << endl;
if (verbose_)
{
Info<< " Removing cells nearest to " << points_ << endl;
}
combine(set, false);
}

View File

@ -161,15 +161,21 @@ void Foam::pointToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells according to pointSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding cells according to pointSet " << setName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells according to pointSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing cells according to pointSet " << setName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -157,7 +157,7 @@ void Foam::regionToCell::unselectOutsideRegions
regionSplit cellRegion(mesh_, blockedFace);
// Determine regions containing insidePoints_
boolList keepRegion(findRegions(true, cellRegion));
boolList keepRegion(findRegions(verbose_, cellRegion));
// Go back to bool per cell
forAll(cellRegion, celli)
@ -268,7 +268,7 @@ void Foam::regionToCell::erode
regionSplit cellRegion(mesh_, blockedFace);
// Determine regions containing insidePoints
boolList keepRegion(findRegions(true, cellRegion));
boolList keepRegion(findRegions(verbose_, cellRegion));
// Extract cells in regions that are not to be kept.
@ -434,15 +434,23 @@ void Foam::regionToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all cells of connected region containing points "
<< insidePoints_ << " ..." << endl;
if (verbose_)
{
Info<< " Adding all cells of connected region "
<< "containing points "
<< insidePoints_ << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells of connected region containing points "
<< insidePoints_ << " ..." << endl;
if (verbose_)
{
Info<< " Removing all cells of connected region "
<< "containing points "
<< insidePoints_ << " ..." << endl;
}
combine(set, false);
}

View File

@ -178,13 +178,21 @@ void Foam::rotatedBoxToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells with centre within rotated box " << endl;
if (verbose_)
{
Info<< " Adding cells with centre within rotated box"
<< endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells with centre within rotated box " << endl;
if (verbose_)
{
Info<< " Removing cells with centre within rotated box"
<< endl;
}
combine(set, false);
}

View File

@ -144,13 +144,21 @@ void Foam::shapeToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all cells of type " << type_ << " ..." << endl;
if (verbose_)
{
Info<< " Adding all cells of type " << type_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells of type " << type_ << " ..." << endl;
if (verbose_)
{
Info<< " Removing all cells of type " << type_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -131,15 +131,21 @@ void Foam::sphereToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells within a sphere with centre = "
<< origin_ << " and radius = " << radius_ << endl;
if (verbose_)
{
Info<< " Adding cells within a sphere with centre = "
<< origin_ << " and radius = " << radius_ << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells within a sphere with centre = "
<< origin_ << " and radius = " << radius_ << endl;
if (verbose_)
{
Info<< " Removing cells within a sphere with centre = "
<< origin_ << " and radius = " << radius_ << endl;
}
combine(set, false);
}

View File

@ -154,8 +154,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
//- Calculate for each searchPoint inside/outside status.
boolList isInside(querySurf().calcInside(mesh_.cellCentres()));
Info<< " Marked inside/outside using surface orientation in = "
<< timer.cpuTimeIncrement() << " s" << endl << endl;
if (verbose_)
{
Info<< " Marked inside/outside using surface orientation in = "
<< timer.cpuTimeIncrement() << " s" << nl << endl;
}
forAll(isInside, celli)
{
@ -206,8 +209,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
);
Info<< " Marked inside/outside using surface intersection in = "
<< timer.cpuTimeIncrement() << " s" << endl << endl;
if (verbose_)
{
Info<< " Marked inside/outside using surface intersection in = "
<< timer.cpuTimeIncrement() << " s" << nl << endl;
}
//- Add/remove cells using set
forAll(cellType, celli)
@ -250,8 +256,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
if (curvature_ < -1)
{
Info<< " Selecting cells with cellCentre closer than "
<< nearDist_ << " to surface" << endl;
if (verbose_)
{
Info<< " Selecting cells with cellCentre closer than "
<< nearDist_ << " to surface" << endl;
}
// No need to test curvature. Insert near cells into set.
@ -267,17 +276,22 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
}
}
Info<< " Determined nearest surface point in = "
<< timer.cpuTimeIncrement() << " s" << endl << endl;
if (verbose_)
{
Info<< " Determined nearest surface point in = "
<< timer.cpuTimeIncrement() << " s" << nl << endl;
}
}
else
{
// Test near cells for curvature
Info<< " Selecting cells with cellCentre closer than "
<< nearDist_ << " to surface and curvature factor"
<< " less than " << curvature_ << endl;
if (verbose_)
{
Info<< " Selecting cells with cellCentre closer than "
<< nearDist_ << " to surface and curvature factor"
<< " less than " << curvature_ << endl;
}
// Cache for nearest surface triangle for a point
Map<label> pointToNearest(mesh_.nCells()/10);
@ -307,8 +321,11 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
}
}
Info<< " Determined nearest surface point in = "
<< timer.cpuTimeIncrement() << " s" << endl << endl;
if (verbose_)
{
Info<< " Determined nearest surface point in = "
<< timer.cpuTimeIncrement() << " s" << nl << endl;
}
}
}
}
@ -489,15 +506,21 @@ void Foam::surfaceToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells in relation to surface " << surfName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding cells in relation to surface " << surfName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells in relation to surface " << surfName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing cells in relation to surface " << surfName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -124,8 +124,11 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
if (maskSetName_.size())
{
// Read cellSet
Info<< " Operating on subset defined by cellSet " << maskSetName_
<< endl;
if (verbose_)
{
Info<< " Operating on subset defined by cellSet "
<< maskSetName_ << endl;
}
maskSet = false;
cellSet subset(mesh_, maskSetName_);
@ -262,9 +265,11 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
}
Info<< " Selected " << nSelected << " with actual volume "
<< selectedVol << endl;
if (verbose_)
{
Info<< " Selected " << nSelected << " with actual volume "
<< selectedVol << endl;
}
// Loop over selected cells only
for (const label celli : selected)
@ -329,15 +334,23 @@ void Foam::targetVolumeToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells up to target volume " << vol_
<< " out of total volume " << gSum(mesh_.cellVolumes()) << endl;
if (verbose_)
{
Info<< " Adding cells up to target volume " << vol_
<< " out of total volume "
<< gSum(mesh_.cellVolumes()) << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells up to target volume " << vol_
<< " out of total volume " << gSum(mesh_.cellVolumes()) << endl;
if (verbose_)
{
Info<< " Removing cells up to target volume " << vol_
<< " out of total volume "
<< gSum(mesh_.cellVolumes()) << endl;
}
combine(set, false);
}

View File

@ -76,8 +76,11 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
const labelList& cellLabels = zone;
Info<< " Found matching zone " << zone.name()
<< " with " << cellLabels.size() << " cells." << endl;
if (verbose_)
{
Info<< " Found matching zone " << zone.name()
<< " with " << cellLabels.size() << " cells." << endl;
}
for (const label celli : cellLabels)
{
@ -154,15 +157,21 @@ void Foam::zoneToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all cells of cell zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Adding all cells of cell zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells of cell zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Removing all cells of cell zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, false);
}

View File

@ -100,8 +100,11 @@ void Foam::setToCellZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all cells from cellSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding all cells from cellSet " << setName_
<< " ..." << endl;
}
// Load the sets
cellSet fSet(mesh_, setName_);
@ -122,8 +125,11 @@ void Foam::setToCellZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells from cellSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing all cells from cellSet " << setName_
<< " ..." << endl;
}
// Load the set
cellSet loadedSet(mesh_, setName_);

View File

@ -115,13 +115,19 @@ void Foam::boundaryToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all boundary faces ..." << endl;
if (verbose_)
{
Info<< " Adding all boundary faces ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all boundary faces ..." << endl;
if (verbose_)
{
Info<< " Removing all boundary faces ..." << endl;
}
combine(set, false);
}

View File

@ -144,13 +144,21 @@ void Foam::boxToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces with centre within boxes " << bbs_ << endl;
if (verbose_)
{
Info<< " Adding faces with centre within boxes "
<< bbs_ << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces with centre within boxes " << bbs_ << endl;
if (verbose_)
{
Info<< " Removing faces with centre within boxes "
<< bbs_ << endl;
}
combine(set, false);
}

View File

@ -198,15 +198,21 @@ void Foam::cellToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces according to cellSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding faces according to cellSet " << setName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces according to cellSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing faces according to cellSet " << setName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -160,21 +160,29 @@ void Foam::cylinderAnnulusToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
if (verbose_)
{
Info<< " Adding faces with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_
<< ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
if (verbose_)
{
Info<< " Removing faces with centre within cylinder annulus,"
<< " with p1 = "
<< point1_ << ", p2 = " << point2_
<< ", radius = " << outerRadius_
<< ", inner radius = " << innerRadius_
<< endl;
}
combine(set, false);
}

View File

@ -144,17 +144,23 @@ void Foam::cylinderToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
if (verbose_)
{
Info<< " Adding faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
if (verbose_)
{
Info<< " Removing faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_
<< endl;
}
combine(set, false);
}

View File

@ -96,8 +96,11 @@ void Foam::faceToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces from faceSet " << setName_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl;
}
// Load the set
faceSet loadedSet(mesh_, setName_);
@ -106,8 +109,11 @@ void Foam::faceToFace::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces from faceSet " << setName_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl;
}
// Load the set
faceSet loadedSet(mesh_, setName_);

View File

@ -122,13 +122,21 @@ void Foam::labelToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces mentioned in dictionary" << " ..." << endl;
if (verbose_)
{
Info<< " Adding faces mentioned in dictionary"
<< " ..." << endl;
}
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces mentioned dictionary" << " ..." << endl;
if (verbose_)
{
Info<< " Removing faces mentioned dictionary"
<< " ..." << endl;
}
addOrDelete(set, labels_, false);
}

View File

@ -69,8 +69,6 @@ void Foam::normalToFace::setNormal()
{
normal_.normalise();
Info<< " normalToFace : Normalized vector to " << normal_ << endl;
if (tol_ < -1 || tol_ > 1)
{
FatalErrorInFunction
@ -130,8 +128,11 @@ void Foam::normalToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl;
if (verbose_)
{
Info<< " Adding faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl;
}
forAll(mesh_.faceAreas(), facei)
{
@ -145,8 +146,11 @@ void Foam::normalToFace::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl;
if (verbose_)
{
Info<< " Removing faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl;
}
DynamicList<label> toBeRemoved(set.size()/10);

View File

@ -76,8 +76,11 @@ void Foam::patchToFace::combine(topoSet& set, const bool add) const
{
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
Info<< " Found matching patch " << pp.name()
<< " with " << pp.size() << " faces." << endl;
if (verbose_)
{
Info<< " Found matching patch " << pp.name()
<< " with " << pp.size() << " faces." << endl;
}
for
(
@ -154,15 +157,21 @@ void Foam::patchToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl;
if (verbose_)
{
Info<< " Removing all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl;
}
combine(set, false);
}

View File

@ -206,15 +206,21 @@ void Foam::pointToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces according to pointSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding faces according to pointSet " << setName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing faces according to pointSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing faces according to pointSet " << setName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -124,8 +124,11 @@ void Foam::regionToFace::markZone
void Foam::regionToFace::combine(topoSet& set, const bool add) const
{
Info<< " Loading subset " << setName_
<< " to delimit search region." << endl;
if (verbose_)
{
Info<< " Loading subset " << setName_
<< " to delimit search region." << endl;
}
faceSet subSet(mesh_, setName_);
@ -162,10 +165,13 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
// Globally reduce
combineReduce(ni, mappedPatchBase::nearestEqOp());
Info<< " Found nearest face at " << ni.first().rawPoint()
<< " on processor " << ni.second().second()
<< " face " << ni.first().index()
<< " distance " << Foam::sqrt(ni.second().first()) << endl;
if (verbose_)
{
Info<< " Found nearest face at " << ni.first().rawPoint()
<< " on processor " << ni.second().second()
<< " face " << ni.first().index()
<< " distance " << Foam::sqrt(ni.second().first()) << endl;
}
labelList faceRegion(patch.size(), -1);
markZone
@ -236,19 +242,23 @@ void Foam::regionToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces of connected region of set "
<< setName_
<< " starting from point "
<< nearPoint_ << " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces of connected region of set "
<< setName_ << " starting from point " << nearPoint_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells of connected region of set "
<< setName_
<< " starting from point "
<< nearPoint_ << " ..." << endl;
if (verbose_)
{
Info<< " Removing all cells of connected region of set "
<< setName_ << " starting from point " << nearPoint_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -76,8 +76,11 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
const labelList& faceLabels = zone;
Info<< " Found matching zone " << zone.name()
<< " with " << faceLabels.size() << " faces." << endl;
if (verbose_)
{
Info<< " Found matching zone " << zone.name()
<< " with " << faceLabels.size() << " faces." << endl;
}
for (const label facei : faceLabels)
{
@ -154,15 +157,21 @@ void Foam::zoneToFace::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Removing all faces of face zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, false);
}

View File

@ -100,8 +100,11 @@ void Foam::faceZoneToFaceZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces from faceZone " << setName_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Adding all faces from faceZone " << setName_
<< " ..." << endl;
}
// Load the set
faceZoneSet loadedSet(mesh_, setName_);
@ -123,8 +126,11 @@ void Foam::faceZoneToFaceZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces from faceZone " << setName_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Removing all faces from faceZone " << setName_
<< " ..." << endl;
}
// Load the set
faceZoneSet loadedSet(mesh_, setName_);

View File

@ -164,8 +164,11 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces from surface "
<< surfacePtr_().name() << " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces from surface "
<< surfacePtr_().name() << " ..." << endl;
}
DynamicList<label> newAddressing(fzSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap());
@ -186,8 +189,11 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces from surface "
<< surfacePtr_().name() << " ..." << endl;
if (verbose_)
{
Info<< " Removing all faces from surface "
<< surfacePtr_().name() << " ..." << endl;
}
// Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size());

View File

@ -104,8 +104,11 @@ void Foam::setAndNormalToFaceZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl;
}
// Load the sets
faceSet loadedSet(mesh_, setName_);
@ -142,8 +145,11 @@ void Foam::setAndNormalToFaceZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl;
}
// Load the set
faceSet loadedSet(mesh_, setName_);

View File

@ -101,8 +101,11 @@ void Foam::setToFaceZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl;
}
// Load the sets
faceSet loadedSet(mesh_, setName_);
@ -127,8 +130,11 @@ void Foam::setToFaceZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl;
}
// Load the set
faceSet loadedSet(mesh_, setName_);

View File

@ -110,8 +110,11 @@ void Foam::setsToFaceZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces from faceSet " << faceSetName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding all faces from faceSet " << faceSetName_
<< " ..." << endl;
}
// Load the sets
faceSet fSet(mesh_, faceSetName_);
@ -182,8 +185,11 @@ void Foam::setsToFaceZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces from faceSet " << faceSetName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing all faces from faceSet " << faceSetName_
<< " ..." << endl;
}
// Load the set
faceZoneSet loadedSet(mesh_, faceSetName_);

View File

@ -144,15 +144,21 @@ void Foam::boxToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding points that are within boxes " << bbs_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Adding points that are within boxes " << bbs_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing points that are within boxes " << bbs_ << " ..."
<< endl;
if (verbose_)
{
Info<< " Removing points that are within boxes " << bbs_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -135,13 +135,21 @@ void Foam::cellToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding from " << setName_ << " ..." << endl;
if (verbose_)
{
Info<< " Adding from " << setName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing from " << setName_ << " ..." << endl;
if (verbose_)
{
Info<< " Removing from " << setName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -129,15 +129,21 @@ void Foam::faceToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding points from face in faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding points from face in faceSet " << setName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing points from face in faceSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing points from face in faceSet " << setName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -118,13 +118,21 @@ void Foam::labelToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding points mentioned in dictionary" << " ..." << endl;
if (verbose_)
{
Info<< " Adding points mentioned in dictionary"
<< " ..." << endl;
}
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing points mentioned in dictionary" << " ..." << endl;
if (verbose_)
{
Info<< " Removing points mentioned in dictionary"
<< " ..." << endl;
}
addOrDelete(set, labels_, false);
}

View File

@ -169,13 +169,19 @@ void Foam::nearestToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding points nearest to " << points_ << endl;
if (verbose_)
{
Info<< " Adding points nearest to " << points_ << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing points nearest to " << points_ << endl;
if (verbose_)
{
Info<< " Removing points nearest to " << points_ << endl;
}
combine(set, false);
}

View File

@ -92,7 +92,11 @@ void Foam::pointToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all from pointSet " << setName_ << " ..." << endl;
if (verbose_)
{
Info<< " Adding all from pointSet " << setName_
<< " ..." << endl;
}
// Load the set
pointSet loadedSet(mesh_, setName_);
@ -101,7 +105,11 @@ void Foam::pointToPoint::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all from pointSet " << setName_ << " ..." << endl;
if (verbose_)
{
Info<< " Removing all from pointSet " << setName_
<< " ..." << endl;
}
// Load the set
pointSet loadedSet(mesh_, setName_);

View File

@ -63,8 +63,11 @@ void Foam::surfaceToPoint::combine(topoSet& set, const bool add) const
triSurface surf(surfName_, scale_);
Info<< " Read surface from " << surfName_
<< " in = "<< timer.cpuTimeIncrement() << " s" << endl << endl;
if (verbose_)
{
Info<< " Read surface from " << surfName_
<< " in = "<< timer.cpuTimeIncrement() << " s" << nl << endl;
}
// Construct search engine on surface
triSurfaceSearch querySurf(surf);
@ -190,15 +193,21 @@ void Foam::surfaceToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding points in relation to surface " << surfName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding points in relation to surface " << surfName_
<< " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing points in relation to surface " << surfName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing points in relation to surface " << surfName_
<< " ..." << endl;
}
combine(set, false);
}

View File

@ -76,8 +76,11 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
const labelList& pointLabels = zone;
Info<< " Found matching zone " << zone.name()
<< " with " << pointLabels.size() << " points." << endl;
if (verbose_)
{
Info<< " Found matching zone " << zone.name()
<< " with " << pointLabels.size() << " points." << endl;
}
for (const label pointi : pointLabels)
{
@ -154,15 +157,21 @@ void Foam::zoneToPoint::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all points of point zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Adding all points of point zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all points of point zones "
<< flatOutput(selectedZones_) << " ..." << endl;
if (verbose_)
{
Info<< " Removing all points of point zones "
<< flatOutput(selectedZones_) << " ..." << endl;
}
combine(set, false);
}

View File

@ -100,8 +100,11 @@ void Foam::setToPointZone::applyToSet
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all points from pointSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Adding all points from pointSet " << setName_
<< " ..." << endl;
}
// Load the sets
pointSet loadedSet(mesh_, setName_);
@ -123,8 +126,11 @@ void Foam::setToPointZone::applyToSet
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all points from pointSet " << setName_
<< " ..." << endl;
if (verbose_)
{
Info<< " Removing all points from pointSet " << setName_
<< " ..." << endl;
}
// Load the set
pointSet loadedSet(mesh_, setName_);

View File

@ -201,7 +201,8 @@ void Foam::topoSetSource::addOrDelete
Foam::topoSetSource::topoSetSource(const polyMesh& mesh)
:
mesh_(mesh)
mesh_(mesh),
verbose_(true)
{}

View File

@ -126,11 +126,14 @@ protected:
};
// Protected data
// Protected Data
//- Reference to the mesh
const polyMesh& mesh_;
//- Verbosity (default: true)
bool verbose_;
// Protected Member Functions
@ -289,6 +292,18 @@ public:
return mesh_;
}
//- Return the current verbosity
bool verbose() const
{
return verbose_;
}
//- Set the current verbosity
void verbose(bool on)
{
verbose_ = on;
}
// Member Functions
@ -296,7 +311,11 @@ public:
virtual sourceType setType() const = 0;
//- Apply specified action to the topoSet
virtual void applyToSet(const setAction action, topoSet& set) const = 0;
virtual void applyToSet
(
const setAction action,
topoSet& set
) const = 0;
};

View File

@ -491,6 +491,30 @@ Foam::topoSet::topoSet(const IOobject& io, labelHashSet&& labels)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::topoSet::set(const label id)
{
return static_cast<labelHashSet&>(*this).set(id);
}
bool Foam::topoSet::unset(const label id)
{
return static_cast<labelHashSet&>(*this).unset(id);
}
void Foam::topoSet::set(const labelUList& labels)
{
static_cast<labelHashSet&>(*this).set(labels);
}
void Foam::topoSet::unset(const labelUList& labels)
{
static_cast<labelHashSet&>(*this).unset(labels);
}
void Foam::topoSet::invert(const label maxLen)
{
// Retain a copy of the original (current) set.

View File

@ -66,7 +66,6 @@ class topoSet
public regIOobject,
public labelHashSet
{
protected:
// Protected Member Functions
@ -312,7 +311,19 @@ public:
virtual ~topoSet() = default;
// Member functions
// Member Functions
//- Set an index
virtual bool set(const label id);
//- Unset an index
virtual bool unset(const label id);
//- Set multiple indices
virtual void set(const labelUList& labels);
//- Unset multiple indices
virtual void unset(const labelUList& labels);
//- Invert contents.
// Insert all members [0,maxLen) which were not in set.

View File

@ -189,7 +189,7 @@ void Foam::regionsToCell::unselectOutsideRegions
regionSplit cellRegion(mesh_, blockedFace);
// Determine regions containing insidePoints_
boolList keepRegion(findRegions(true, selectedCell, cellRegion));
boolList keepRegion(findRegions(verbose_, selectedCell, cellRegion));
// Go back to bool per cell
forAll(cellRegion, cellI)
@ -298,7 +298,7 @@ void Foam::regionsToCell::erode
regionSplit cellRegion(mesh_, blockedFace);
// Determine regions containing insidePoints
boolList keepRegion(findRegions(true, shrunkSelectedCell, cellRegion));
boolList keepRegion(findRegions(verbose_, shrunkSelectedCell, cellRegion));
// Extract cells in regions that are not to be kept.
@ -465,15 +465,23 @@ void Foam::regionsToCell::applyToSet
{
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all cells of connected region containing points "
<< insidePoints_ << " ..." << endl;
if (verbose_)
{
Info<< " Adding all cells of connected region "
<< "containing points "
<< insidePoints_ << " ..." << endl;
}
combine(set, true);
}
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells of connected region containing points "
<< insidePoints_ << " ..." << endl;
if (verbose_)
{
Info<< " Removing all cells of connected region "
<< "containing points "
<< insidePoints_ << " ..." << endl;
}
combine(set, false);
}