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
<< " invert - inverts 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
<< " delete <source> - deletes ,," << nl
<< " subtract <source> - subtract the source set elements" << nl
<< " subset <source> - combines current set with the source set"
<< nl
<< nl

View File

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

View File

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

View File

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

View File

@ -142,15 +142,15 @@ void Foam::boxToCell::applyToSet
topoSet& set
) 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);
}
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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -74,10 +74,9 @@ void Foam::fieldToCell::applyToSet
topoSet& set
) const
{
Info<< " Field min:" << min(field)
<< " max:" << max(field) << endl;
Info<< " Field min:" << min(field) << " 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_
<< " within range " << min_ << ".." << max_ << endl;
@ -86,11 +85,11 @@ void Foam::fieldToCell::applyToSet
{
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_
<< " within range " << min_ << ".." << max_ << endl;
@ -99,7 +98,7 @@ void Foam::fieldToCell::applyToSet
{
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
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding cells mentioned in dictionary" << " ..." << endl;
addOrDelete(set, labels_, true);
}
else if (action == topoSetSource::DELETE)
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing cells mentioned in dictionary" << " ..." << endl;

View File

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

View File

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

View File

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

View File

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

View File

@ -176,15 +176,15 @@ void Foam::rotatedBoxToCell::applyToSet
topoSet& set
) 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);
}
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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -96,9 +96,9 @@ void Foam::setToCellZone::applyToSet
}
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_
<< " ..." << endl;
@ -107,20 +107,20 @@ void Foam::setToCellZone::applyToSet
cellSet fSet(mesh_, setName_);
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
DynamicList<label> newAddressing(zoneSet.addressing());
for (const label celli : fSet)
{
if (!fzSet.found(celli))
if (!zoneSet.found(celli))
{
newAddressing.append(celli);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.updateSet();
zoneSet.addressing().transfer(newAddressing);
zoneSet.updateSet();
}
else if (action == topoSetSource::DELETE)
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all cells from cellSet " << setName_
<< " ..." << endl;
@ -129,17 +129,17 @@ void Foam::setToCellZone::applyToSet
cellSet loadedSet(mesh_, setName_);
// 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);
fzSet.updateSet();
zoneSet.addressing().transfer(newAddressing);
zoneSet.updateSet();
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -128,7 +128,7 @@ void Foam::normalToFace::applyToSet
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding faces according to normal being aligned with "
<< normal_ << " (to within " << tol_ << ") ..." << endl;
@ -139,11 +139,11 @@ void Foam::normalToFace::applyToSet
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 "
<< 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
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
if (action == topoSetSource::ADD || action == topoSetSource::NEW)
{
Info<< " Adding all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all faces of patches "
<< flatOutput(selectedPatches_) << " ..." << endl;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -96,9 +96,9 @@ void Foam::setToPointZone::applyToSet
}
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_
<< " ..." << endl;
@ -108,20 +108,20 @@ void Foam::setToPointZone::applyToSet
const labelHashSet& pointLabels = loadedSet;
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
DynamicList<label> newAddressing(zoneSet.addressing());
for (const label pointi : pointLabels)
{
if (!fzSet.found(pointi))
if (!zoneSet.found(pointi))
{
newAddressing.append(pointi);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.updateSet();
zoneSet.addressing().transfer(newAddressing);
zoneSet.updateSet();
}
else if (action == topoSetSource::DELETE)
else if (action == topoSetSource::SUBTRACT)
{
Info<< " Removing all points from pointSet " << setName_
<< " ..." << endl;
@ -130,17 +130,17 @@ void Foam::setToPointZone::applyToSet
pointSet loadedSet(mesh_, setName_);
// 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);
fzSet.updateSet();
zoneSet.addressing().transfer(newAddressing);
zoneSet.updateSet();
}
}
}

View File

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

View File

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

View File

@ -49,7 +49,7 @@ void Foam::cellZoneSet::updateSet()
cellSet::clearStorage();
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());

View File

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

View File

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

View File

@ -54,7 +54,7 @@ void Foam::faceZoneSet::updateSet()
faceSet::clearStorage();
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;
@ -301,7 +301,7 @@ void Foam::faceZoneSet::deleteSet(const topoSet& set)
if (nConflict > 0)
{
WarningInFunction
<< "deleteSet : there are " << nConflict
<< "subtractSet : there are " << nConflict
<< " faces with different orientation in faceZonesSets "
<< name() << " and " << set.name() << endl;
}

View File

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

View File

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

View File

@ -50,7 +50,7 @@ void Foam::pointZoneSet::updateSet()
pointSet::clearStorage();
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());

View File

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

View File

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

View File

@ -324,7 +324,11 @@ public:
//- Add elements present in 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);
//- Sync set across coupled patches.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
cellSet c0 new
cellSet c0 invert
cellSet c0 delete 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 delete 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.1 0.1) (0.6 0.3 0.3)
cellSet c0 subtract boxToCell (0.4 0.1 0.4) (0.6 0.3 0.6)
cellSet c0 subtract boxToCell (0.4 0.4 0.1) (0.6 0.6 0.3)
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;
type cellSet;
action delete;
action subtract;
source boxToCell;
sourceInfo
{
@ -40,7 +40,7 @@ actions
{
name c0;
type cellSet;
action delete;
action subtract;
source boxToCell;
sourceInfo
{
@ -50,7 +50,7 @@ actions
{
name c0;
type cellSet;
action delete;
action subtract;
source boxToCell;
sourceInfo
{
@ -60,7 +60,7 @@ actions
{
name c0;
type cellSet;
action delete;
action subtract;
source boxToCell;
sourceInfo
{

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,3 @@
cellSet c0 new
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;
type cellSet;
action delete;
action subtract;
source boxToCell;
sourceInfo
{

View File

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

View File

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