49 "\n Usage: faceToCell <faceSet> neighbour|owner|any|all\n\n"
50 " Select cells that are the owner|neighbour|any"
51 " of the faces in the faceSet or where all faces are in the faceSet\n\n"
56 Foam::faceToCell::faceAction
58 Foam::faceToCell::faceActionNames_
60 { faceAction::ANY,
"any" },
61 { faceAction::ALL,
"all" },
62 { faceAction::OWNER,
"owner" },
63 { faceAction::NEIGHBOUR,
"neighbour" },
77 faceSet loadedSet(mesh_, setName);
82 for (
const label facei : faceLabels)
84 if ((option_ == OWNER) || (option_ == ANY))
86 const label celli = mesh_.faceOwner()[facei];
88 addOrDelete(set, celli,
add);
91 if (mesh_.isInternalFace(facei))
93 if ((option_ == NEIGHBOUR) || (option_ == ANY))
95 const label celli = mesh_.faceNeighbour()[facei];
97 addOrDelete(set, celli,
add);
107 Map<label> facesPerCell(loadedSet.size());
109 for (
const label facei : faceLabels)
112 ++(facesPerCell(mesh_.faceOwner()[facei], 0));
114 if (mesh_.isInternalFace(facei))
117 ++(facesPerCell(mesh_.faceNeighbour()[facei], 0));
125 const label celli = iter.key();
126 const label
count = iter.val();
128 if (
count == mesh_.cells()[celli].size())
130 addOrDelete(set, celli,
add);
139 Foam::faceToCell::faceToCell
141 const polyMesh&
mesh,
143 const faceAction option
146 topoSetCellSource(
mesh),
147 names_(one(), setName),
152 Foam::faceToCell::faceToCell
154 const polyMesh&
mesh,
155 const dictionary&
dict
158 topoSetCellSource(
mesh),
160 option_(faceActionNames_.get(
"option",
dict))
163 if (!
dict.readIfPresent(
"sets", names_))
166 dict.readEntry(
"set", names_.first());
171 Foam::faceToCell::faceToCell
173 const polyMesh&
mesh,
177 topoSetCellSource(
mesh),
178 names_(one(), word(checkIs(is))),
179 option_(faceActionNames_.
read(checkIs(is)))
185 void Foam::faceToCell::applyToSet
195 Info<<
" Adding cells according to faceSet "
199 for (
const word& setName : names_)
208 Info<<
" Removing cells according to faceSet "
212 for (
const word& setName : names_)