STYLE: use fallthrough for 'use' action in selections (#926)

- applyToSet() automatically handles NEW like ADD, so no need to do
  so explicitly
This commit is contained in:
Mark Olesen
2018-12-09 11:51:13 +01:00
parent 08bcee7a3f
commit 0a056fdbbf
2 changed files with 10 additions and 51 deletions

View File

@ -34,7 +34,7 @@ namespace Foam
// A limited selection of actions
const Enum<topoSetSource::setAction> actionNames
({
{ topoSetSource::NEW, "use" },
{ topoSetSource::NEW, "use" }, // Reuse NEW for "use" action name
{ topoSetSource::ADD, "add" },
{ topoSetSource::SUBTRACT, "subtract" },
{ topoSetSource::SUBSET, "subset" },
@ -72,7 +72,7 @@ bool Foam::functionObjects::vtkWrite::updateSubset
const dictionary& dict = dEntry.dict();
auto action = actionNames.get("action", dict);
const auto action = actionNames.get("action", dict);
// Handle manually
if (action == topoSetSource::INVERT)
@ -93,19 +93,16 @@ bool Foam::functionObjects::vtkWrite::updateSubset
{
case topoSetSource::NEW: // "use"
case topoSetSource::ADD:
case topoSetSource::SUBTRACT:
if (topoSetSource::NEW == action)
{
// NEW (use) = CLEAR + ADD (ie, only use this selection)
// "use": only use this selection (clear + ADD)
// NEW is handled like ADD in applyToSet()
cellsToSelect.reset();
action = topoSetSource::ADD;
}
source->applyToSet(action, cellsToSelect);
break;
case topoSetSource::SUBTRACT:
source->applyToSet(action, cellsToSelect);
break;
case topoSetSource::SUBSET:
{
cellBitSet other(mesh, false);