mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -35,7 +35,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" },
|
||||
@ -74,7 +74,7 @@ bool Foam::functionObjects::ensightWrite::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)
|
||||
@ -95,19 +95,16 @@ bool Foam::functionObjects::ensightWrite::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);
|
||||
@ -132,41 +129,6 @@ bool Foam::functionObjects::ensightWrite::updateSubset
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
Foam::labelList Foam::functionObjects::ensightWrite::getSelectedPatches
|
||||
(
|
||||
const polyBoundaryMesh& patches
|
||||
) const
|
||||
{
|
||||
DynamicList<label> patchIDs(patches.size());
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (isType<emptyPolyPatch>(pp))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (isType<processorPolyPatch>(pp))
|
||||
{
|
||||
break; // No processor patches
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
selectPatches_.size()
|
||||
? selectPatches_.match(pp.name())
|
||||
: true
|
||||
)
|
||||
{
|
||||
patchIDs.append(pp.index());
|
||||
}
|
||||
}
|
||||
|
||||
return patchIDs.shrink();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Foam::functionObjects::ensightWrite::update()
|
||||
{
|
||||
if (meshState_ == polyMesh::UNCHANGED)
|
||||
|
||||
Reference in New Issue
Block a user