From 8fc98848b56ce9fdff1d212f1c2f1c34de0e604b Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Wed, 31 Oct 2018 09:22:58 +0000 Subject: [PATCH] ENH: allow changing verbosity of topoSetSource (#1060) - make topoSet set/unset methods virtual to allow overloading --- .../badQualityToCell/badQualityToCell.C | 12 +++- .../badQualityToFace/badQualityToFace.C | 12 +++- .../sets/cellSources/boxToCell/boxToCell.C | 12 +++- .../sets/cellSources/cellToCell/cellToCell.C | 14 +++-- .../cylinderAnnulusToCell.C | 26 ++++---- .../cylinderToCell/cylinderToCell.C | 18 ++++-- .../sets/cellSources/faceToCell/faceToCell.C | 14 +++-- .../faceZoneToCell/faceZoneToCell.C | 27 ++++++--- .../cellSources/fieldToCell/fieldToCell.C | 19 ++++-- .../cellSources/labelToCell/labelToCell.C | 12 +++- .../sets/cellSources/nbrToCell/nbrToCell.C | 14 +++-- .../cellSources/nearestToCell/nearestToCell.C | 10 +++- .../cellSources/pointToCell/pointToCell.C | 14 +++-- .../cellSources/regionToCell/regionToCell.C | 20 +++++-- .../rotatedBoxToCell/rotatedBoxToCell.C | 12 +++- .../cellSources/shapeToCell/shapeToCell.C | 12 +++- .../cellSources/sphereToCell/sphereToCell.C | 14 +++-- .../cellSources/surfaceToCell/surfaceToCell.C | 59 +++++++++++++------ .../targetVolumeToCell/targetVolumeToCell.C | 31 +++++++--- .../sets/cellSources/zoneToCell/zoneToCell.C | 21 +++++-- .../setToCellZone/setToCellZone.C | 14 +++-- .../boundaryToFace/boundaryToFace.C | 10 +++- .../sets/faceSources/boxToFace/boxToFace.C | 12 +++- .../sets/faceSources/cellToFace/cellToFace.C | 14 +++-- .../cylinderAnnulusToFace.C | 28 +++++---- .../cylinderToFace/cylinderToFace.C | 18 ++++-- .../sets/faceSources/faceToFace/faceToFace.C | 14 +++-- .../faceSources/labelToFace/labelToFace.C | 12 +++- .../faceSources/normalToFace/normalToFace.C | 16 +++-- .../faceSources/patchToFace/patchToFace.C | 21 +++++-- .../faceSources/pointToFace/pointToFace.C | 14 +++-- .../faceSources/regionToFace/regionToFace.C | 38 +++++++----- .../sets/faceSources/zoneToFace/zoneToFace.C | 21 +++++-- .../faceZoneToFaceZone/faceZoneToFaceZone.C | 14 +++-- .../searchableSurfaceToFaceZone.C | 14 +++-- .../setAndNormalToFaceZone.C | 14 +++-- .../setToFaceZone/setToFaceZone.C | 14 +++-- .../setsToFaceZone/setsToFaceZone.C | 14 +++-- .../sets/pointSources/boxToPoint/boxToPoint.C | 14 +++-- .../pointSources/cellToPoint/cellToPoint.C | 12 +++- .../pointSources/faceToPoint/faceToPoint.C | 14 +++-- .../pointSources/labelToPoint/labelToPoint.C | 12 +++- .../nearestToPoint/nearestToPoint.C | 10 +++- .../pointSources/pointToPoint/pointToPoint.C | 12 +++- .../surfaceToPoint/surfaceToPoint.C | 21 +++++-- .../pointSources/zoneToPoint/zoneToPoint.C | 21 +++++-- .../setToPointZone/setToPointZone.C | 14 +++-- .../sets/topoSetSource/topoSetSource.C | 3 +- .../sets/topoSetSource/topoSetSource.H | 23 +++++++- src/meshTools/sets/topoSets/topoSet.C | 24 ++++++++ src/meshTools/sets/topoSets/topoSet.H | 15 ++++- src/overset/regionsToCell/regionsToCell.C | 20 +++++-- 52 files changed, 654 insertions(+), 236 deletions(-) diff --git a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C index 1284127080..062322da57 100644 --- a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C +++ b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C @@ -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); } } diff --git a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C index 1b7ee0d2ac..c68d0b7351 100644 --- a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C +++ b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C @@ -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); } } diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C index b403151a59..9cb921f3dd 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/cellToCell/cellToCell.C b/src/meshTools/sets/cellSources/cellToCell/cellToCell.C index aa23317c56..f061205c8a 100644 --- a/src/meshTools/sets/cellSources/cellToCell/cellToCell.C +++ b/src/meshTools/sets/cellSources/cellToCell/cellToCell.C @@ -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_); diff --git a/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C b/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C index 4cb8e1bfed..6421182264 100644 --- a/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C +++ b/src/meshTools/sets/cellSources/cylinderAnnulusToCell/cylinderAnnulusToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C index 7eb50853a6..9eda86e0f4 100644 --- a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C +++ b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C index 8d7d136530..508b187dc8 100644 --- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C +++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C index 9d50ffa689..c4d453e308 100644 --- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C +++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C index cf57936c72..2ec9e8045d 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C +++ b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C @@ -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) { diff --git a/src/meshTools/sets/cellSources/labelToCell/labelToCell.C b/src/meshTools/sets/cellSources/labelToCell/labelToCell.C index 5828a2ba81..43f2281067 100644 --- a/src/meshTools/sets/cellSources/labelToCell/labelToCell.C +++ b/src/meshTools/sets/cellSources/labelToCell/labelToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C b/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C index 4a62f60f72..eee88d9a4f 100644 --- a/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C +++ b/src/meshTools/sets/cellSources/nbrToCell/nbrToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C b/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C index 924de4ca6d..9f18e91cc4 100644 --- a/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C +++ b/src/meshTools/sets/cellSources/nearestToCell/nearestToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C index 26e0a619f1..8aa5b11704 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C index 10df22acf0..670dd99527 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C b/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C index f4c8216e69..6bd0acdf3f 100644 --- a/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C +++ b/src/meshTools/sets/cellSources/rotatedBoxToCell/rotatedBoxToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C index 9fda5ad9ad..352e884ee2 100644 --- a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C +++ b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C index 0c164dc714..8c47d75418 100644 --- a/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C +++ b/src/meshTools/sets/cellSources/sphereToCell/sphereToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C index 5723b9962c..39a31e2c46 100644 --- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C +++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C index 12862a2ada..51f15800d5 100644 --- a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C +++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C index 16003df577..558622336a 100644 --- a/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C +++ b/src/meshTools/sets/cellSources/zoneToCell/zoneToCell.C @@ -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); } diff --git a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C index 51c55942d2..55eca622f0 100644 --- a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C +++ b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.C @@ -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_); diff --git a/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C b/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C index c788a3aeee..1875b9c9c8 100644 --- a/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C +++ b/src/meshTools/sets/faceSources/boundaryToFace/boundaryToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C index 1a8bbd1d12..3eef661de9 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C index 4147aece2c..a5368ef03a 100644 --- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C +++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C b/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C index 89db47312e..b3f7ea64de 100644 --- a/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C +++ b/src/meshTools/sets/faceSources/cylinderAnnulusToFace/cylinderAnnulusToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C b/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C index ec993610b0..a4806d99f7 100644 --- a/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C +++ b/src/meshTools/sets/faceSources/cylinderToFace/cylinderToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/faceToFace/faceToFace.C b/src/meshTools/sets/faceSources/faceToFace/faceToFace.C index 1bfa44e824..c94a4be4da 100644 --- a/src/meshTools/sets/faceSources/faceToFace/faceToFace.C +++ b/src/meshTools/sets/faceSources/faceToFace/faceToFace.C @@ -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_); diff --git a/src/meshTools/sets/faceSources/labelToFace/labelToFace.C b/src/meshTools/sets/faceSources/labelToFace/labelToFace.C index 0a6147550b..16899058b0 100644 --- a/src/meshTools/sets/faceSources/labelToFace/labelToFace.C +++ b/src/meshTools/sets/faceSources/labelToFace/labelToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/normalToFace/normalToFace.C b/src/meshTools/sets/faceSources/normalToFace/normalToFace.C index 2bf77f2971..162bdf15ec 100644 --- a/src/meshTools/sets/faceSources/normalToFace/normalToFace.C +++ b/src/meshTools/sets/faceSources/normalToFace/normalToFace.C @@ -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); diff --git a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C index 46da30cbe9..b2529bf378 100644 --- a/src/meshTools/sets/faceSources/patchToFace/patchToFace.C +++ b/src/meshTools/sets/faceSources/patchToFace/patchToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C index 8b6d9168b9..ba32284bde 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/regionToFace/regionToFace.C b/src/meshTools/sets/faceSources/regionToFace/regionToFace.C index a5ebb929e7..0bc6322240 100644 --- a/src/meshTools/sets/faceSources/regionToFace/regionToFace.C +++ b/src/meshTools/sets/faceSources/regionToFace/regionToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C index becbcb66dc..dc39276500 100644 --- a/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C +++ b/src/meshTools/sets/faceSources/zoneToFace/zoneToFace.C @@ -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); } diff --git a/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.C b/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.C index db90f92d51..d589d3d8c4 100644 --- a/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.C @@ -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_); diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C index 9047216302..23121c3eb7 100644 --- a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C @@ -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()); diff --git a/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C index bd34ad6cf9..1470d91960 100644 --- a/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C @@ -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_); diff --git a/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.C b/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.C index 411512705a..04228b9f43 100644 --- a/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.C @@ -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_); diff --git a/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.C b/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.C index 776f0b06c9..0942e4474b 100644 --- a/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.C @@ -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_); diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C index add0cf7f4c..a76ea3aed6 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C index c18b5d37d2..3bc3ff3a71 100644 --- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C +++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C index f2d50b750a..3351a14ad6 100644 --- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C +++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C b/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C index 0e6455d7f6..705c85c1fc 100644 --- a/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C +++ b/src/meshTools/sets/pointSources/labelToPoint/labelToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C index 240509ca45..8b48b2e7c5 100644 --- a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C +++ b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C b/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C index ebab5698dc..5ede16171a 100644 --- a/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C +++ b/src/meshTools/sets/pointSources/pointToPoint/pointToPoint.C @@ -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_); diff --git a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C index d44b69e3a1..df45bddc99 100644 --- a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C +++ b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C index 3781ff5ccb..42ae663794 100644 --- a/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C +++ b/src/meshTools/sets/pointSources/zoneToPoint/zoneToPoint.C @@ -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); } diff --git a/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.C b/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.C index c9b58da462..de2f8e58f2 100644 --- a/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.C +++ b/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.C @@ -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_); diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.C b/src/meshTools/sets/topoSetSource/topoSetSource.C index e31efe15c4..63370dd82a 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.C +++ b/src/meshTools/sets/topoSetSource/topoSetSource.C @@ -201,7 +201,8 @@ void Foam::topoSetSource::addOrDelete Foam::topoSetSource::topoSetSource(const polyMesh& mesh) : - mesh_(mesh) + mesh_(mesh), + verbose_(true) {} diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.H b/src/meshTools/sets/topoSetSource/topoSetSource.H index 67511f048e..aed7e6557a 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.H +++ b/src/meshTools/sets/topoSetSource/topoSetSource.H @@ -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; }; diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index 3b92d5c2a3..a7ddabcb7b 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.C @@ -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. diff --git a/src/meshTools/sets/topoSets/topoSet.H b/src/meshTools/sets/topoSets/topoSet.H index 5d5794dac5..7f4e1e9589 100644 --- a/src/meshTools/sets/topoSets/topoSet.H +++ b/src/meshTools/sets/topoSets/topoSet.H @@ -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. diff --git a/src/overset/regionsToCell/regionsToCell.C b/src/overset/regionsToCell/regionsToCell.C index 500140f00a..24d29c5aeb 100644 --- a/src/overset/regionsToCell/regionsToCell.C +++ b/src/overset/regionsToCell/regionsToCell.C @@ -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); } -- GitLab