ENH: support 'use' action for selections in vtkWrite, ensightWrite (#926)

- have 'use' as the action appears more intuitive as the first entry
  instead of 'add'. Was previously also added to vtkCloud.
This commit is contained in:
Mark Olesen
2018-12-08 22:16:58 +01:00
parent 0e4ccd7cef
commit 08bcee7a3f
7 changed files with 31 additions and 9 deletions

View File

@ -35,6 +35,7 @@ namespace Foam
// A limited selection of actions
const Enum<topoSetSource::setAction> actionNames
({
{ topoSetSource::NEW, "use" },
{ topoSetSource::ADD, "add" },
{ topoSetSource::SUBTRACT, "subtract" },
{ topoSetSource::SUBSET, "subset" },
@ -73,7 +74,7 @@ bool Foam::functionObjects::ensightWrite::updateSubset
const dictionary& dict = dEntry.dict();
const auto action = actionNames.get("action", dict);
auto action = actionNames.get("action", dict);
// Handle manually
if (action == topoSetSource::INVERT)
@ -92,7 +93,17 @@ bool Foam::functionObjects::ensightWrite::updateSubset
switch (action)
{
case topoSetSource::NEW: // "use"
case topoSetSource::ADD:
if (topoSetSource::NEW == action)
{
// NEW (use) = CLEAR + ADD (ie, only use this selection)
cellsToSelect.reset();
action = topoSetSource::ADD;
}
source->applyToSet(action, cellsToSelect);
break;
case topoSetSource::SUBTRACT:
source->applyToSet(action, cellsToSelect);
break;