ENH: topoSetSource::SUBTRACT enum action (#1060)

- old 'DELETE' enum was easily confused with 'REMOVE', which removes
  the set, not the elements from the set.

- provide corresponding subtractSet() method

STYLE: HashSet set/unset instead of insert/erase methods in topoSetSource

- simplifies switching to/from bitSet storage
This commit is contained in:
Mark Olesen
2018-10-30 15:09:44 +00:00
parent 9b638f9a71
commit 7325e3ac7d
79 changed files with 288 additions and 283 deletions

View File

@ -132,9 +132,9 @@ void printHelp(Ostream& os)
<< " clear - clears the set" << nl << " clear - clears the set" << nl
<< " invert - inverts the set" << nl << " invert - inverts the set" << nl
<< " remove - remove the set" << nl << " remove - remove the set" << nl
<< " new <source> - sets to set to the source set" << nl << " new <source> - use all elements from the source set" << nl
<< " add <source> - adds all elements from the source set" << nl << " add <source> - adds all elements from the source set" << nl
<< " delete <source> - deletes ,," << nl << " subtract <source> - subtract the source set elements" << nl
<< " subset <source> - combines current set with the source set" << " subset <source> - combines current set with the source set"
<< nl << nl
<< nl << nl

View File

@ -247,8 +247,8 @@ int main(int argc, char *argv[])
autoPtr<topoSet> currentSet; autoPtr<topoSet> currentSet;
if if
( (
(action == topoSetSource::NEW) action == topoSetSource::NEW
|| (action == topoSetSource::CLEAR) || action == topoSetSource::CLEAR
) )
{ {
currentSet = topoSet::New(setType, mesh, setName, 10000); currentSet = topoSet::New(setType, mesh, setName, 10000);
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
{ {
case topoSetSource::NEW: case topoSetSource::NEW:
case topoSetSource::ADD: case topoSetSource::ADD:
case topoSetSource::DELETE: case topoSetSource::SUBTRACT:
{ {
const word sourceName(dict.get<word>("source")); const word sourceName(dict.get<word>("source"));

View File

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

View File

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

View File

@ -142,15 +142,15 @@ void Foam::boxToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells with center within boxes " << bbs_ << endl; Info<< " Adding cells with centre within boxes " << bbs_ << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells with center within boxes " << bbs_ << endl; Info<< " Removing cells with centre within boxes " << bbs_ << endl;
combine(set, false); combine(set, false);
} }

View File

@ -94,7 +94,7 @@ void Foam::cellToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all elements of cellSet " << setName_ << " ..." Info<< " Adding all elements of cellSet " << setName_ << " ..."
<< endl; << endl;
@ -104,7 +104,7 @@ void Foam::cellToCell::applyToSet
set.addSet(loadedSet); set.addSet(loadedSet);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all elements of cellSet " << setName_ << " ..." Info<< " Removing all elements of cellSet " << setName_ << " ..."
<< endl; << endl;
@ -112,7 +112,7 @@ void Foam::cellToCell::applyToSet
// Load the set // Load the set
cellSet loadedSet(mesh_, setName_); cellSet loadedSet(mesh_, setName_);
set.deleteSet(loadedSet); set.subtractSet(loadedSet);
} }
} }

View File

@ -158,7 +158,7 @@ void Foam::cylinderAnnulusToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells with centre within cylinder annulus," Info<< " Adding cells with centre within cylinder annulus,"
<< " with p1 = " << " with p1 = "
@ -168,7 +168,7 @@ void Foam::cylinderAnnulusToCell::applyToSet
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells with centre within cylinder annulus," Info<< " Removing cells with centre within cylinder annulus,"
<< " with p1 = " << " with p1 = "

View File

@ -142,7 +142,7 @@ void Foam::cylinderToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells with centre within cylinder, with p1 = " Info<< " Adding cells with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_ << point1_ << ", p2 = " << point2_ << ", radius = " << radius_
@ -150,7 +150,7 @@ void Foam::cylinderToCell::applyToSet
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells with centre within cylinder, with p1 = " Info<< " Removing cells with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_ << point1_ << ", p2 = " << point2_ << ", radius = " << radius_

View File

@ -176,14 +176,14 @@ void Foam::faceToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells according to faceSet " << setName_ Info<< " Adding cells according to faceSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells according to faceSet " << setName_ Info<< " Removing cells according to faceSet " << setName_
<< " ..." << endl; << " ..." << endl;

View File

@ -159,7 +159,7 @@ void Foam::faceZoneToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all " << faceActionNames_[option_] Info<< " Adding all " << faceActionNames_[option_]
<< " cells of face zones " << " cells of face zones "
@ -167,7 +167,7 @@ void Foam::faceZoneToCell::applyToSet
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all " << faceActionNames_[option_] Info<< " Removing all " << faceActionNames_[option_]
<< " cells of face zones " << " cells of face zones "

View File

@ -74,10 +74,9 @@ void Foam::fieldToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
Info<< " Field min:" << min(field) Info<< " Field min:" << min(field) << " max:" << max(field) << endl;
<< " max:" << max(field) << endl;
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all cells with value of field " << fieldName_ Info<< " Adding all cells with value of field " << fieldName_
<< " within range " << min_ << ".." << max_ << endl; << " within range " << min_ << ".." << max_ << endl;
@ -86,11 +85,11 @@ void Foam::fieldToCell::applyToSet
{ {
if (field[celli] >= min_ && field[celli] <= max_) if (field[celli] >= min_ && field[celli] <= max_)
{ {
set.insert(celli); set.set(celli);
} }
} }
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all cells with value of field " << fieldName_ Info<< " Removing all cells with value of field " << fieldName_
<< " within range " << min_ << ".." << max_ << endl; << " within range " << min_ << ".." << max_ << endl;
@ -99,7 +98,7 @@ void Foam::fieldToCell::applyToSet
{ {
if (field[celli] >= min_ && field[celli] <= max_) if (field[celli] >= min_ && field[celli] <= max_)
{ {
set.erase(celli); set.unset(celli);
} }
} }
} }

View File

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

View File

@ -151,14 +151,14 @@ void Foam::nbrToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells with only " << minNbrs_ << " or less" Info<< " Adding cells with only " << minNbrs_ << " or less"
" neighbouring cells" << " ..." << endl; " neighbouring cells" << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells with only " << minNbrs_ << " or less" Info<< " Removing cells with only " << minNbrs_ << " or less"
" neighbouring cells" << " ..." << endl; " neighbouring cells" << " ..." << endl;

View File

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

View File

@ -159,14 +159,14 @@ void Foam::pointToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells according to pointSet " << setName_ Info<< " Adding cells according to pointSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells according to pointSet " << setName_ Info<< " Removing cells according to pointSet " << setName_
<< " ..." << endl; << " ..." << endl;

View File

@ -432,14 +432,14 @@ void Foam::regionToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all cells of connected region containing points " Info<< " Adding all cells of connected region containing points "
<< insidePoints_ << " ..." << endl; << insidePoints_ << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all cells of connected region containing points " Info<< " Removing all cells of connected region containing points "
<< insidePoints_ << " ..." << endl; << insidePoints_ << " ..." << endl;

View File

@ -176,15 +176,15 @@ void Foam::rotatedBoxToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells with center within rotated box " << endl; Info<< " Adding cells with centre within rotated box " << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells with center within rotated box " << endl; Info<< " Removing cells with centre within rotated box " << endl;
combine(set, false); combine(set, false);
} }

View File

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

View File

@ -129,14 +129,14 @@ void Foam::sphereToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells within a sphere with centre = " Info<< " Adding cells within a sphere with centre = "
<< origin_ << " and radius = " << radius_ << endl; << origin_ << " and radius = " << radius_ << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells within a sphere with centre = " Info<< " Removing cells within a sphere with centre = "
<< origin_ << " and radius = " << radius_ << endl; << origin_ << " and radius = " << radius_ << endl;

View File

@ -487,14 +487,14 @@ void Foam::surfaceToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells in relation to surface " << surfName_ Info<< " Adding cells in relation to surface " << surfName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells in relation to surface " << surfName_ Info<< " Removing cells in relation to surface " << surfName_
<< " ..." << endl; << " ..." << endl;

View File

@ -327,14 +327,14 @@ void Foam::targetVolumeToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding cells up to target volume " << vol_ Info<< " Adding cells up to target volume " << vol_
<< " out of total volume " << gSum(mesh_.cellVolumes()) << endl; << " out of total volume " << gSum(mesh_.cellVolumes()) << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing cells up to target volume " << vol_ Info<< " Removing cells up to target volume " << vol_
<< " out of total volume " << gSum(mesh_.cellVolumes()) << endl; << " out of total volume " << gSum(mesh_.cellVolumes()) << endl;

View File

@ -152,14 +152,14 @@ void Foam::zoneToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all cells of cell zones " Info<< " Adding all cells of cell zones "
<< flatOutput(selectedZones_) << " ..." << endl; << flatOutput(selectedZones_) << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all cells of cell zones " Info<< " Removing all cells of cell zones "
<< flatOutput(selectedZones_) << " ..." << endl; << flatOutput(selectedZones_) << " ..." << endl;

View File

@ -96,9 +96,9 @@ void Foam::setToCellZone::applyToSet
} }
else else
{ {
cellZoneSet& fzSet = refCast<cellZoneSet>(set); cellZoneSet& zoneSet = refCast<cellZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all cells from cellSet " << setName_ Info<< " Adding all cells from cellSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -107,20 +107,20 @@ void Foam::setToCellZone::applyToSet
cellSet fSet(mesh_, setName_); cellSet fSet(mesh_, setName_);
// Start off from copy // Start off from copy
DynamicList<label> newAddressing(fzSet.addressing()); DynamicList<label> newAddressing(zoneSet.addressing());
for (const label celli : fSet) for (const label celli : fSet)
{ {
if (!fzSet.found(celli)) if (!zoneSet.found(celli))
{ {
newAddressing.append(celli); newAddressing.append(celli);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.updateSet(); zoneSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all cells from cellSet " << setName_ Info<< " Removing all cells from cellSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -129,17 +129,17 @@ void Foam::setToCellZone::applyToSet
cellSet loadedSet(mesh_, setName_); cellSet loadedSet(mesh_, setName_);
// Start off empty // Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size()); DynamicList<label> newAddressing(zoneSet.addressing().size());
forAll(fzSet.addressing(), i) forAll(zoneSet.addressing(), i)
{ {
if (!loadedSet.found(fzSet.addressing()[i])) if (!loadedSet.found(zoneSet.addressing()[i]))
{ {
newAddressing.append(fzSet.addressing()[i]); newAddressing.append(zoneSet.addressing()[i]);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.updateSet(); zoneSet.updateSet();
} }
} }
} }

View File

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

View File

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

View File

@ -196,14 +196,14 @@ void Foam::cellToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding faces according to cellSet " << setName_ Info<< " Adding faces according to cellSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing faces according to cellSet " << setName_ Info<< " Removing faces according to cellSet " << setName_
<< " ..." << endl; << " ..." << endl;

View File

@ -158,7 +158,7 @@ void Foam::cylinderAnnulusToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding faces with centre within cylinder annulus," Info<< " Adding faces with centre within cylinder annulus,"
<< " with p1 = " << " with p1 = "
@ -168,7 +168,7 @@ void Foam::cylinderAnnulusToFace::applyToSet
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing faces with centre within cylinder annulus," Info<< " Removing faces with centre within cylinder annulus,"
<< " with p1 = " << " with p1 = "

View File

@ -142,7 +142,7 @@ void Foam::cylinderToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding faces with centre within cylinder, with p1 = " Info<< " Adding faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_ << point1_ << ", p2 = " << point2_ << ", radius = " << radius_
@ -150,7 +150,7 @@ void Foam::cylinderToFace::applyToSet
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing faces with centre within cylinder, with p1 = " Info<< " Removing faces with centre within cylinder, with p1 = "
<< point1_ << ", p2 = " << point2_ << ", radius = " << radius_ << point1_ << ", p2 = " << point2_ << ", radius = " << radius_

View File

@ -94,7 +94,7 @@ void Foam::faceToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces from faceSet " << setName_ << " ..." Info<< " Adding all faces from faceSet " << setName_ << " ..."
<< endl; << endl;
@ -104,7 +104,7 @@ void Foam::faceToFace::applyToSet
set.addSet(loadedSet); set.addSet(loadedSet);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces from faceSet " << setName_ << " ..." Info<< " Removing all faces from faceSet " << setName_ << " ..."
<< endl; << endl;
@ -112,7 +112,7 @@ void Foam::faceToFace::applyToSet
// Load the set // Load the set
faceSet loadedSet(mesh_, setName_); faceSet loadedSet(mesh_, setName_);
set.deleteSet(loadedSet); set.subtractSet(loadedSet);
} }
} }

View File

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

View File

@ -128,7 +128,7 @@ void Foam::normalToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding faces according to normal being aligned with " Info<< " Adding faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl; << normal_ << " (to within " << tol_ << ") ..." << endl;
@ -139,11 +139,11 @@ void Foam::normalToFace::applyToSet
if (mag(1 - (n & normal_)) < tol_) if (mag(1 - (n & normal_)) < tol_)
{ {
set.insert(facei); set.set(facei);
} }
} }
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing faces according to normal being aligned with " Info<< " Removing faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl; << normal_ << " (to within " << tol_ << ") ..." << endl;
@ -160,7 +160,7 @@ void Foam::normalToFace::applyToSet
} }
} }
set.erase(toBeRemoved); set.unset(toBeRemoved);
} }
} }

View File

@ -152,14 +152,14 @@ void Foam::patchToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces of patches " Info<< " Adding all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl; << flatOutput(selectedPatches_) << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces of patches " Info<< " Removing all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl; << flatOutput(selectedPatches_) << " ..." << endl;

View File

@ -204,14 +204,14 @@ void Foam::pointToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding faces according to pointSet " << setName_ Info<< " Adding faces according to pointSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing faces according to pointSet " << setName_ Info<< " Removing faces according to pointSet " << setName_
<< " ..." << endl; << " ..." << endl;

View File

@ -234,7 +234,7 @@ void Foam::regionToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces of connected region of set " Info<< " Adding all faces of connected region of set "
<< setName_ << setName_
@ -243,7 +243,7 @@ void Foam::regionToFace::applyToSet
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all cells of connected region of set " Info<< " Removing all cells of connected region of set "
<< setName_ << setName_

View File

@ -152,14 +152,14 @@ void Foam::zoneToFace::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces of face zones " Info<< " Adding all faces of face zones "
<< flatOutput(selectedZones_) << " ..." << endl; << flatOutput(selectedZones_) << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces of face zones " Info<< " Removing all faces of face zones "
<< flatOutput(selectedZones_) << " ..." << endl; << flatOutput(selectedZones_) << " ..." << endl;

View File

@ -96,9 +96,9 @@ void Foam::faceZoneToFaceZone::applyToSet
} }
else else
{ {
faceZoneSet& fSet = refCast<faceZoneSet>(set); faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces from faceZone " << setName_ << " ..." Info<< " Adding all faces from faceZone " << setName_ << " ..."
<< endl; << endl;
@ -106,22 +106,22 @@ void Foam::faceZoneToFaceZone::applyToSet
// Load the set // Load the set
faceZoneSet loadedSet(mesh_, setName_); faceZoneSet loadedSet(mesh_, setName_);
DynamicList<label> newAddressing(fSet.addressing()); DynamicList<label> newAddressing(zoneSet.addressing());
DynamicList<bool> newFlipMap(fSet.flipMap()); DynamicList<bool> newFlipMap(zoneSet.flipMap());
forAll(loadedSet.addressing(), i) forAll(loadedSet.addressing(), i)
{ {
if (!fSet.found(loadedSet.addressing()[i])) if (!zoneSet.found(loadedSet.addressing()[i]))
{ {
newAddressing.append(loadedSet.addressing()[i]); newAddressing.append(loadedSet.addressing()[i]);
newFlipMap.append(loadedSet.flipMap()[i]); newFlipMap.append(loadedSet.flipMap()[i]);
} }
} }
fSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fSet.updateSet(); zoneSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces from faceZone " << setName_ << " ..." Info<< " Removing all faces from faceZone " << setName_ << " ..."
<< endl; << endl;
@ -129,20 +129,20 @@ void Foam::faceZoneToFaceZone::applyToSet
// Load the set // Load the set
faceZoneSet loadedSet(mesh_, setName_); faceZoneSet loadedSet(mesh_, setName_);
DynamicList<label> newAddressing(fSet.addressing().size()); DynamicList<label> newAddressing(zoneSet.addressing().size());
DynamicList<bool> newFlipMap(fSet.flipMap().size()); DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
forAll(fSet.addressing(), i) forAll(zoneSet.addressing(), i)
{ {
if (!loadedSet.found(fSet.addressing()[i])) if (!loadedSet.found(zoneSet.addressing()[i]))
{ {
newAddressing.append(fSet.addressing()[i]); newAddressing.append(zoneSet.addressing()[i]);
newFlipMap.append(fSet.flipMap()[i]); newFlipMap.append(zoneSet.flipMap()[i]);
} }
} }
fSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fSet.updateSet(); zoneSet.updateSet();
} }
} }
} }

View File

@ -162,7 +162,7 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
// Select intersected faces // Select intersected faces
// ~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces from surface " Info<< " Adding all faces from surface "
<< surfacePtr_().name() << " ..." << endl; << surfacePtr_().name() << " ..." << endl;
@ -184,7 +184,7 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
fzSet.flipMap().transfer(newFlipMap); fzSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); fzSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces from surface " Info<< " Removing all faces from surface "
<< surfacePtr_().name() << " ..." << endl; << surfacePtr_().name() << " ..." << endl;

View File

@ -100,9 +100,9 @@ void Foam::setAndNormalToFaceZone::applyToSet
} }
else else
{ {
faceZoneSet& fzSet = refCast<faceZoneSet>(set); faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces from faceSet " << setName_ Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -112,15 +112,15 @@ void Foam::setAndNormalToFaceZone::applyToSet
labelHashSet& faceIds = loadedSet; labelHashSet& faceIds = loadedSet;
// Start off from copy // Start off from copy
DynamicList<label> newAddressing(fzSet.addressing()); DynamicList<label> newAddressing(zoneSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap()); DynamicList<bool> newFlipMap(zoneSet.flipMap());
const faceList& faces = mesh_.faces(); const faceList& faces = mesh_.faces();
const pointField& points = mesh_.points(); const pointField& points = mesh_.points();
for (const label facei : faceIds) for (const label facei : faceIds)
{ {
if (!fzSet.found(facei)) if (!zoneSet.found(facei))
{ {
newAddressing.append(facei); newAddressing.append(facei);
@ -136,11 +136,11 @@ void Foam::setAndNormalToFaceZone::applyToSet
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); zoneSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces from faceSet " << setName_ Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -149,20 +149,20 @@ void Foam::setAndNormalToFaceZone::applyToSet
faceSet loadedSet(mesh_, setName_); faceSet loadedSet(mesh_, setName_);
// Start off empty // Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size()); DynamicList<label> newAddressing(zoneSet.addressing().size());
DynamicList<bool> newFlipMap(fzSet.flipMap().size()); DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
forAll(fzSet.addressing(), i) forAll(zoneSet.addressing(), i)
{ {
if (!loadedSet.found(fzSet.addressing()[i])) if (!loadedSet.found(zoneSet.addressing()[i]))
{ {
newAddressing.append(fzSet.addressing()[i]); newAddressing.append(zoneSet.addressing()[i]);
newFlipMap.append(fzSet.flipMap()[i]); newFlipMap.append(zoneSet.flipMap()[i]);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); zoneSet.updateSet();
} }
} }
} }

View File

@ -97,9 +97,9 @@ void Foam::setToFaceZone::applyToSet
} }
else else
{ {
faceZoneSet& fzSet = refCast<faceZoneSet>(set); faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces from faceSet " << setName_ Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -109,23 +109,23 @@ void Foam::setToFaceZone::applyToSet
const labelHashSet& faceLabels = loadedSet; const labelHashSet& faceLabels = loadedSet;
// Start off from copy // Start off from copy
DynamicList<label> newAddressing(fzSet.addressing()); DynamicList<label> newAddressing(zoneSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap()); DynamicList<bool> newFlipMap(zoneSet.flipMap());
for (const label facei : faceLabels) for (const label facei : faceLabels)
{ {
if (!fzSet.found(facei)) if (!zoneSet.found(facei))
{ {
newAddressing.append(facei); newAddressing.append(facei);
newFlipMap.append(false); newFlipMap.append(false);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); zoneSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces from faceSet " << setName_ Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -134,20 +134,20 @@ void Foam::setToFaceZone::applyToSet
faceSet loadedSet(mesh_, setName_); faceSet loadedSet(mesh_, setName_);
// Start off empty // Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size()); DynamicList<label> newAddressing(zoneSet.addressing().size());
DynamicList<bool> newFlipMap(fzSet.flipMap().size()); DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
forAll(fzSet.addressing(), i) forAll(zoneSet.addressing(), i)
{ {
if (!loadedSet.found(fzSet.addressing()[i])) if (!loadedSet.found(zoneSet.addressing()[i]))
{ {
newAddressing.append(fzSet.addressing()[i]); newAddressing.append(zoneSet.addressing()[i]);
newFlipMap.append(fzSet.flipMap()[i]); newFlipMap.append(zoneSet.flipMap()[i]);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); zoneSet.updateSet();
} }
} }
} }

View File

@ -106,9 +106,9 @@ void Foam::setsToFaceZone::applyToSet
} }
else else
{ {
faceZoneSet& fzSet = refCast<faceZoneSet>(set); faceZoneSet& zoneSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all faces from faceSet " << faceSetName_ Info<< " Adding all faces from faceSet " << faceSetName_
<< " ..." << endl; << " ..." << endl;
@ -118,14 +118,14 @@ void Foam::setsToFaceZone::applyToSet
cellSet cSet(mesh_, cellSetName_); cellSet cSet(mesh_, cellSetName_);
// Start off from copy // Start off from copy
DynamicList<label> newAddressing(fzSet.addressing()); DynamicList<label> newAddressing(zoneSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap()); DynamicList<bool> newFlipMap(zoneSet.flipMap());
forAllConstIter(faceSet, fSet, iter) forAllConstIter(faceSet, fSet, iter)
{ {
label facei = iter.key(); label facei = iter.key();
if (!fzSet.found(facei)) if (!zoneSet.found(facei))
{ {
bool flipFace = false; bool flipFace = false;
@ -176,11 +176,11 @@ void Foam::setsToFaceZone::applyToSet
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); zoneSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all faces from faceSet " << faceSetName_ Info<< " Removing all faces from faceSet " << faceSetName_
<< " ..." << endl; << " ..." << endl;
@ -189,20 +189,20 @@ void Foam::setsToFaceZone::applyToSet
faceZoneSet loadedSet(mesh_, faceSetName_); faceZoneSet loadedSet(mesh_, faceSetName_);
// Start off empty // Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size()); DynamicList<label> newAddressing(zoneSet.addressing().size());
DynamicList<bool> newFlipMap(fzSet.flipMap().size()); DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
forAll(fzSet.addressing(), i) forAll(zoneSet.addressing(), i)
{ {
if (!loadedSet.found(fzSet.addressing()[i])) if (!loadedSet.found(zoneSet.addressing()[i]))
{ {
newAddressing.append(fzSet.addressing()[i]); newAddressing.append(zoneSet.addressing()[i]);
newFlipMap.append(fzSet.flipMap()[i]); newFlipMap.append(zoneSet.flipMap()[i]);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap); zoneSet.flipMap().transfer(newFlipMap);
fzSet.updateSet(); zoneSet.updateSet();
} }
} }
} }

View File

@ -142,14 +142,14 @@ void Foam::boxToPoint::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding points that are within boxes " << bbs_ << " ..." Info<< " Adding points that are within boxes " << bbs_ << " ..."
<< endl; << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing points that are within boxes " << bbs_ << " ..." Info<< " Removing points that are within boxes " << bbs_ << " ..."
<< endl; << endl;

View File

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

View File

@ -127,14 +127,14 @@ void Foam::faceToPoint::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding points from face in faceSet " << setName_ Info<< " Adding points from face in faceSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing points from face in faceSet " << setName_ Info<< " Removing points from face in faceSet " << setName_
<< " ..." << endl; << " ..." << endl;

View File

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

View File

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

View File

@ -90,7 +90,7 @@ void Foam::pointToPoint::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all from pointSet " << setName_ << " ..." << endl; Info<< " Adding all from pointSet " << setName_ << " ..." << endl;
@ -99,14 +99,14 @@ void Foam::pointToPoint::applyToSet
set.addSet(loadedSet); set.addSet(loadedSet);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all from pointSet " << setName_ << " ..." << endl; Info<< " Removing all from pointSet " << setName_ << " ..." << endl;
// Load the set // Load the set
pointSet loadedSet(mesh_, setName_); pointSet loadedSet(mesh_, setName_);
set.deleteSet(loadedSet); set.subtractSet(loadedSet);
} }
} }

View File

@ -188,14 +188,14 @@ void Foam::surfaceToPoint::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding points in relation to surface " << surfName_ Info<< " Adding points in relation to surface " << surfName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing points in relation to surface " << surfName_ Info<< " Removing points in relation to surface " << surfName_
<< " ..." << endl; << " ..." << endl;

View File

@ -152,14 +152,14 @@ void Foam::zoneToPoint::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all points of point zones " Info<< " Adding all points of point zones "
<< flatOutput(selectedZones_) << " ..." << endl; << flatOutput(selectedZones_) << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all points of point zones " Info<< " Removing all points of point zones "
<< flatOutput(selectedZones_) << " ..." << endl; << flatOutput(selectedZones_) << " ..." << endl;

View File

@ -96,9 +96,9 @@ void Foam::setToPointZone::applyToSet
} }
else else
{ {
pointZoneSet& fzSet = refCast<pointZoneSet>(set); pointZoneSet& zoneSet = refCast<pointZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all points from pointSet " << setName_ Info<< " Adding all points from pointSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -108,20 +108,20 @@ void Foam::setToPointZone::applyToSet
const labelHashSet& pointLabels = loadedSet; const labelHashSet& pointLabels = loadedSet;
// Start off from copy // Start off from copy
DynamicList<label> newAddressing(fzSet.addressing()); DynamicList<label> newAddressing(zoneSet.addressing());
for (const label pointi : pointLabels) for (const label pointi : pointLabels)
{ {
if (!fzSet.found(pointi)) if (!zoneSet.found(pointi))
{ {
newAddressing.append(pointi); newAddressing.append(pointi);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.updateSet(); zoneSet.updateSet();
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all points from pointSet " << setName_ Info<< " Removing all points from pointSet " << setName_
<< " ..." << endl; << " ..." << endl;
@ -130,17 +130,17 @@ void Foam::setToPointZone::applyToSet
pointSet loadedSet(mesh_, setName_); pointSet loadedSet(mesh_, setName_);
// Start off empty // Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size()); DynamicList<label> newAddressing(zoneSet.addressing().size());
forAll(fzSet.addressing(), i) forAll(zoneSet.addressing(), i)
{ {
if (!loadedSet.found(fzSet.addressing()[i])) if (!loadedSet.found(zoneSet.addressing()[i]))
{ {
newAddressing.append(fzSet.addressing()[i]); newAddressing.append(zoneSet.addressing()[i]);
} }
} }
fzSet.addressing().transfer(newAddressing); zoneSet.addressing().transfer(newAddressing);
fzSet.updateSet(); zoneSet.updateSet();
} }
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,14 +46,15 @@ const Foam::Enum
> >
Foam::topoSetSource::actionNames Foam::topoSetSource::actionNames
({ ({
{ setAction::ADD, "add" },
{ setAction::SUBTRACT, "subtract" },
{ setAction::SUBSET, "subset" },
{ setAction::INVERT, "invert" },
{ setAction::CLEAR, "clear" }, { setAction::CLEAR, "clear" },
{ setAction::NEW, "new" }, { setAction::NEW, "new" },
{ setAction::INVERT, "invert" },
{ setAction::ADD, "add" },
{ setAction::DELETE, "delete" },
{ setAction::SUBSET, "subset" },
{ setAction::LIST, "list" },
{ setAction::REMOVE, "remove" }, { setAction::REMOVE, "remove" },
{ setAction::LIST, "list" },
{ setAction::SUBTRACT, "delete" }, // Compat (1806)
}); });
@ -169,11 +170,11 @@ void Foam::topoSetSource::addOrDelete
{ {
if (add) if (add)
{ {
set.insert(id); set.set(id);
} }
else else
{ {
set.erase(id); set.unset(id);
} }
} }
@ -187,11 +188,11 @@ void Foam::topoSetSource::addOrDelete
{ {
if (add) if (add)
{ {
set.insert(labels); set.set(labels);
} }
else else
{ {
set.erase(labels); set.unset(labels);
} }
} }

View File

@ -69,26 +69,27 @@ public:
//- Enumeration defining the types of sources //- Enumeration defining the types of sources
enum sourceType enum sourceType
{ {
CELLSETSOURCE, CELLSETSOURCE = 0x1, //!< Cells
FACESETSOURCE, FACESETSOURCE = 0x2, //!< Faces
POINTSETSOURCE, POINTSETSOURCE = 0x4, //!< Points
CELLZONESOURCE, CELLZONESOURCE = 0x11, //!< Cells as zone
FACEZONESOURCE, FACEZONESOURCE = 0x12, //!< Faces as zone
POINTZONESOURCE POINTZONESOURCE = 0x14, //!< Points as zone
}; };
//- Enumeration defining the valid actions //- Enumeration defining the valid actions
enum setAction enum setAction
{ {
CLEAR, ADD, //!< Adds elements to the set
NEW, SUBTRACT, //!< Removes elements from the set
INVERT, SUBSET, //!< Subset with elements in the set
ADD, INVERT, //!< Invert the elements in the set
DELETE, CLEAR, //!< Clear the set, possibly creating it
SUBSET, NEW, //!< Create a new set and ADD elemets to it
LIST, REMOVE, //!< Remove the set (from the file system)
REMOVE LIST, //!< Print contents of the set
DELETE = SUBTRACT, //!< \deprecated alias for SUBTRACT (OCT-2018)
}; };
//- The setActions text representations //- The setActions text representations

View File

@ -49,7 +49,7 @@ void Foam::cellZoneSet::updateSet()
cellSet::clearStorage(); cellSet::clearStorage();
cellSet::resize(2*addressing_.size()); cellSet::resize(2*addressing_.size());
cellSet::insert(addressing_); cellSet::set(addressing_);
} }
@ -189,7 +189,7 @@ void Foam::cellZoneSet::addSet(const topoSet& set)
} }
void Foam::cellZoneSet::deleteSet(const topoSet& set) void Foam::cellZoneSet::subtractSet(const topoSet& set)
{ {
DynamicList<label> newAddressing(addressing_.size()); DynamicList<label> newAddressing(addressing_.size());

View File

@ -122,8 +122,8 @@ public:
//- Add elements present in set. //- Add elements present in set.
virtual void addSet(const topoSet& set); virtual void addSet(const topoSet& set);
//- Delete elements present in set. //- Subtract elements present in set.
virtual void deleteSet(const topoSet& set); virtual void subtractSet(const topoSet& set);
//- Sync cellSet across coupled patches; update cellZone from cellSet //- Sync cellSet across coupled patches; update cellZone from cellSet
virtual void sync(const polyMesh& mesh); virtual void sync(const polyMesh& mesh);

View File

@ -143,7 +143,7 @@ void Foam::faceSet::sync(const polyMesh& mesh)
{ {
if (set[facei]) if (set[facei])
{ {
if (insert(facei)) if (this->set(facei))
{ {
++nAdded; ++nAdded;
} }
@ -207,7 +207,7 @@ void Foam::faceSet::distribute(const mapDistributePolyMesh& map)
{ {
if (inSet[facei]) if (inSet[facei])
{ {
insert(facei); this->set(facei);
} }
} }
} }

View File

@ -54,7 +54,7 @@ void Foam::faceZoneSet::updateSet()
faceSet::clearStorage(); faceSet::clearStorage();
faceSet::resize(2*addressing_.size()); faceSet::resize(2*addressing_.size());
faceSet::insert(addressing_); faceSet::set(addressing_);
} }
@ -260,7 +260,7 @@ void Foam::faceZoneSet::addSet(const topoSet& set)
} }
void Foam::faceZoneSet::deleteSet(const topoSet& set) void Foam::faceZoneSet::subtractSet(const topoSet& set)
{ {
label nConflict = 0; label nConflict = 0;
@ -301,7 +301,7 @@ void Foam::faceZoneSet::deleteSet(const topoSet& set)
if (nConflict > 0) if (nConflict > 0)
{ {
WarningInFunction WarningInFunction
<< "deleteSet : there are " << nConflict << "subtractSet : there are " << nConflict
<< " faces with different orientation in faceZonesSets " << " faces with different orientation in faceZonesSets "
<< name() << " and " << set.name() << endl; << name() << " and " << set.name() << endl;
} }

View File

@ -137,8 +137,8 @@ public:
//- Add elements present in set. //- Add elements present in set.
virtual void addSet(const topoSet& set); virtual void addSet(const topoSet& set);
//- Delete elements present in set. //- Subtract elements present in set.
virtual void deleteSet(const topoSet& set); virtual void subtractSet(const topoSet& set);
//- Sync faceZoneSet across coupled patches. //- Sync faceZoneSet across coupled patches.
virtual void sync(const polyMesh& mesh); virtual void sync(const polyMesh& mesh);

View File

@ -153,7 +153,7 @@ void Foam::pointSet::sync(const polyMesh& mesh)
{ {
if (contents[pointi]) if (contents[pointi])
{ {
newContents.insert(pointi); newContents.set(pointi);
} }
} }
@ -202,7 +202,7 @@ void Foam::pointSet::distribute(const mapDistributePolyMesh& map)
{ {
if (inSet[pointi]) if (inSet[pointi])
{ {
insert(pointi); this->set(pointi);
} }
} }
} }

View File

@ -50,7 +50,7 @@ void Foam::pointZoneSet::updateSet()
pointSet::clearStorage(); pointSet::clearStorage();
pointSet::resize(2*addressing_.size()); pointSet::resize(2*addressing_.size());
pointSet::insert(addressing_); pointSet::set(addressing_);
} }
@ -189,7 +189,7 @@ void Foam::pointZoneSet::addSet(const topoSet& set)
} }
void Foam::pointZoneSet::deleteSet(const topoSet& set) void Foam::pointZoneSet::subtractSet(const topoSet& set)
{ {
DynamicList<label> newAddressing(addressing_.size()); DynamicList<label> newAddressing(addressing_.size());

View File

@ -123,8 +123,8 @@ public:
//- Add elements present in set. //- Add elements present in set.
virtual void addSet(const topoSet& set); virtual void addSet(const topoSet& set);
//- Delete elements present in set. //- Subtract elements present in set.
virtual void deleteSet(const topoSet& set); virtual void subtractSet(const topoSet& set);
//- Sync pointZoneSet across coupled patches. //- Sync pointZoneSet across coupled patches.
virtual void sync(const polyMesh& mesh); virtual void sync(const polyMesh& mesh);

View File

@ -174,7 +174,7 @@ void Foam::topoSet::updateLabels(const labelList& map)
if (newId >= 0) if (newId >= 0)
{ {
newSet.insert(newId); newSet.set(newId);
} }
} }
@ -506,7 +506,7 @@ void Foam::topoSet::invert(const label maxLen)
{ {
if (!original.found(id)) if (!original.found(id))
{ {
insert(id); this->set(id);
} }
} }
} }
@ -514,22 +514,28 @@ void Foam::topoSet::invert(const label maxLen)
void Foam::topoSet::subset(const topoSet& set) void Foam::topoSet::subset(const topoSet& set)
{ {
// Only retain entries found in both HashSets // Only retain entries found in both sets
static_cast<labelHashSet&>(*this) &= set; static_cast<labelHashSet&>(*this) &= set;
} }
void Foam::topoSet::addSet(const topoSet& set) void Foam::topoSet::addSet(const topoSet& set)
{ {
// Add entries to the HashSet // Add entries to the set
static_cast<labelHashSet&>(*this) += set; static_cast<labelHashSet&>(*this) |= set;
}
void Foam::topoSet::subtractSet(const topoSet& set)
{
// Subtract entries from the set
static_cast<labelHashSet&>(*this) -= set;
} }
void Foam::topoSet::deleteSet(const topoSet& set) void Foam::topoSet::deleteSet(const topoSet& set)
{ {
// Remove entries from the HashSet this->subtractSet(set);
static_cast<labelHashSet&>(*this) -= set;
} }

View File

@ -324,7 +324,11 @@ public:
//- Add elements present in set. //- Add elements present in set.
virtual void addSet(const topoSet& set); virtual void addSet(const topoSet& set);
//- Delete elements present in set. //- Subtract elements present in set.
virtual void subtractSet(const topoSet& set);
//- Subtract elements present in set.
// \deprecated use subtractSet instead (OCT-2018)
virtual void deleteSet(const topoSet& set); virtual void deleteSet(const topoSet& set);
//- Sync set across coupled patches. //- Sync set across coupled patches.

View File

@ -496,7 +496,7 @@ Foam::labelHashSet Foam::surfaceSets::getHangingCells
// //
// cellToCell deleteInsideSource(mesh, rawInside.name()); // cellToCell deleteInsideSource(mesh, rawInside.name());
// //
// deleteInsideSource.applyToSet(topoSetSource::DELETE, cutCells); // deleteInsideSource.applyToSet(topoSetSource::SUBTRACT, cutCells);
// Pout<< "Writing cut cells (" << cutCells.size() << ") to cellSet " // Pout<< "Writing cut cells (" << cutCells.size() << ") to cellSet "
// << cutCells.instance()/cutCells.local()/cutCells.name() // << cutCells.instance()/cutCells.local()/cutCells.name()
// << endl << endl; // << endl << endl;
@ -544,8 +544,8 @@ Foam::labelHashSet Foam::surfaceSets::getHangingCells
// cellSet inside(mesh, "inside", rawInside); // cellSet inside(mesh, "inside", rawInside);
// cellSet outside(mesh, "outside", rawOutside); // cellSet outside(mesh, "outside", rawOutside);
// //
// pToCell.applyToSet(topoSetSource::DELETE, inside); // pToCell.applyToSet(topoSetSource::SUBTRACT, inside);
// pToCell.applyToSet(topoSetSource::DELETE, outside); // pToCell.applyToSet(topoSetSource::SUBTRACT, outside);
// //
// Pout<< nl // Pout<< nl
// << "Removed " << rawInside.size() - inside.size() // << "Removed " << rawInside.size() - inside.size()

View File

@ -463,14 +463,14 @@ void Foam::regionsToCell::applyToSet
topoSet& set topoSet& set
) const ) const
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{ {
Info<< " Adding all cells of connected region containing points " Info<< " Adding all cells of connected region containing points "
<< insidePoints_ << " ..." << endl; << insidePoints_ << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::SUBTRACT)
{ {
Info<< " Removing all cells of connected region containing points " Info<< " Removing all cells of connected region containing points "
<< insidePoints_ << " ..." << endl; << insidePoints_ << " ..." << endl;

View File

@ -228,19 +228,13 @@ actions
{ {
name wallPanel; name wallPanel;
type faceZoneSet; type faceZoneSet;
action delete; action subtract;
source setToFaceZone; source setToFaceZone;
sourceInfo sourceInfo
{ {
faceSet inletFace; faceSet inletFace;
} }
} }
); );
// ************************************************************************* // // ************************************************************************* //

View File

@ -59,7 +59,7 @@ actions
{ {
name c1; name c1;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {

View File

@ -63,7 +63,7 @@ actions
{ {
name solid; name solid;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {
@ -108,7 +108,7 @@ actions
{ {
name solid; name solid;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {

View File

@ -59,7 +59,7 @@ actions
{ {
name c1; name c1;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {

View File

@ -65,7 +65,7 @@ actions
{ {
name baffleFaceSet; name baffleFaceSet;
type faceSet; type faceSet;
action delete; action subtract;
source boxToFace; source boxToFace;
sourceInfo sourceInfo
{ {

View File

@ -63,7 +63,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source faceToCell; source faceToCell;
sourceInfo sourceInfo
{ {

View File

@ -1,6 +1,6 @@
cellSet c0 new cellSet c0 new
cellSet c0 invert cellSet c0 invert
cellSet c0 delete boxToCell (0.4 0.1 0.1) (0.6 0.3 0.3) cellSet c0 subtract boxToCell (0.4 0.1 0.1) (0.6 0.3 0.3)
cellSet c0 delete boxToCell (0.4 0.1 0.4) (0.6 0.3 0.6) cellSet c0 subtract boxToCell (0.4 0.1 0.4) (0.6 0.3 0.6)
cellSet c0 delete boxToCell (0.4 0.4 0.1) (0.6 0.6 0.3) cellSet c0 subtract boxToCell (0.4 0.4 0.1) (0.6 0.6 0.3)
cellSet c0 delete boxToCell (0.4 0.4 0.4) (0.6 0.6 0.6) cellSet c0 subtract boxToCell (0.4 0.4 0.4) (0.6 0.6 0.6)

View File

@ -30,7 +30,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source boxToCell; source boxToCell;
sourceInfo sourceInfo
{ {
@ -40,7 +40,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source boxToCell; source boxToCell;
sourceInfo sourceInfo
{ {
@ -50,7 +50,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source boxToCell; source boxToCell;
sourceInfo sourceInfo
{ {
@ -60,7 +60,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source boxToCell; source boxToCell;
sourceInfo sourceInfo
{ {

View File

@ -18,8 +18,8 @@ FoamFile
// Name of set to operate on // Name of set to operate on
name facesToBeRemoved; name facesToBeRemoved;
// One of (clear | new | invert | add | delete | subset | list) // One of (add | subtract | subset | clear | new | invert | list)
action new; action new;
// Actions to apply to pointSet. These are all the topoSetSource's ending // Actions to apply to pointSet. These are all the topoSetSource's ending
// in ..ToFace (see the meshTools library). // in ..ToFace (see the meshTools library).

View File

@ -23,7 +23,7 @@ FoamFile
// //
// // action to perform on set. Two types: // // action to perform on set. Two types:
// // - require no source : clear/invert // // - require no source : clear/invert
// // - require source : new/add/delete/subset // // - require source : add/subtract/subset/new
// action new; // action new;
// //
// The source entry varies according to the type of set: // The source entry varies according to the type of set:

View File

@ -56,7 +56,7 @@ actions
{ {
name inner; name inner;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {
@ -67,7 +67,7 @@ actions
{ {
name outer; name outer;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {

View File

@ -263,7 +263,7 @@ actions
{ {
name topBlockCells; name topBlockCells;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {

View File

@ -1,3 +1,3 @@
cellSet c0 new cellSet c0 new
cellSet c0 invert cellSet c0 invert
cellSet c0 delete boxToCell (0.375 0.375 0) (0.625 0.625 0.25) cellSet c0 subtract boxToCell (0.375 0.375 0) (0.625 0.625 0.25)

View File

@ -30,7 +30,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source boxToCell; source boxToCell;
sourceInfo sourceInfo
{ {

View File

@ -30,7 +30,7 @@ actions
{ {
name c0; name c0;
type cellSet; type cellSet;
action delete; action subtract;
source boxToCell; source boxToCell;
sourceInfo sourceInfo
{ {

View File

@ -59,7 +59,7 @@ actions
{ {
name c1; name c1;
type cellSet; type cellSet;
action delete; action subtract;
source cellToCell; source cellToCell;
sourceInfo sourceInfo
{ {