50 cellToFaceZone::typeName,
51 "\n Usage: cellToFaceZone <slaveCellSet>\n\n" 52 " Select all outside faces in the cellSet." 53 " Orientated so slave side is in cellSet.\n\n" 59 void Foam::cellToFaceZone::selectFaces
61 const bitSet& whichCells,
82 for (label facei = 0; facei < nInt; ++facei)
84 const bool ownFound = whichCells.
test(own[facei]);
85 const bool neiFound = whichCells.test(nei[facei]);
87 if (ownFound && !neiFound)
89 selectedFace.set(facei);
90 doFlip.set(facei, flip_);
92 else if (!ownFound && neiFound)
94 selectedFace.set(facei);
95 doFlip.set(facei, !flip_);
106 label facei =
pp.start();
109 neiInSet[facei-nInt] = whichCells.test(own[facei]);
120 label facei =
pp.start();
123 const bool ownFound = whichCells.test(own[facei]);
124 const bool neiFound = neiInSet[facei-nInt];
126 if (ownFound && !neiFound)
128 selectedFace.set(facei);
129 doFlip.set(facei, flip_);
131 else if (!ownFound && neiFound)
133 selectedFace.set(facei);
134 doFlip.set(facei, !flip_);
146 const polyMesh&
mesh,
151 topoSetFaceZoneSource(
mesh),
160 const polyMesh&
mesh,
161 const dictionary&
dict 167 flip_(
dict.getOrDefault(
"flip", false))
178 names_(
Foam::
one{}, word(checkIs(is))),
192 if (!isA<faceZoneSet>(
set))
195 <<
"Operation only allowed on a faceZoneSet." <<
endl;
200 faceZoneSet& zoneSet = refCast<faceZoneSet>(
set);
206 Info<<
" Adding all faces on outside of cell " 207 << (isZone_ ?
"zones:" :
"sets: ")
208 <<
flatOutput(names_) <<
"; orientation pointing ";
216 Info<<
"away from cell sets" <<
endl;
220 bitSet selectedFace(mesh_.nFaces());
221 bitSet doFlip(mesh_.nFaces());
223 for (
const word& setName : names_)
225 bitSet whichCells(mesh_.nCells());
228 whichCells.set(mesh_.cellZones()[setName]);
234 whichCells.setMany(loadedSet.begin(), loadedSet.end());
238 selectFaces(whichCells, selectedFace, doFlip);
242 DynamicList<label> newAddressing(zoneSet.addressing());
243 DynamicList<bool> newFlipMap(zoneSet.flipMap());
245 for (
const label facei : selectedFace)
247 if (!zoneSet.found(facei))
249 newAddressing.append(facei);
250 newFlipMap.append(doFlip[facei]);
254 zoneSet.addressing().transfer(newAddressing);
255 zoneSet.flipMap().transfer(newFlipMap);
262 Info<<
" Removing all faces on outside of cell " 263 << (isZone_ ?
"zones:" :
"sets: ")
267 bitSet selectedFace(mesh_.nFaces());
268 bitSet doFlip(mesh_.nFaces());
269 for (
const word& setName : names_)
271 bitSet whichCells(mesh_.nCells());
274 whichCells.set(mesh_.cellZones()[setName]);
280 whichCells.setMany(loadedSet.begin(), loadedSet.end());
283 selectFaces(whichCells, selectedFace, doFlip);
287 DynamicList<label> newAddressing(zoneSet.addressing().size());
288 DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
290 for (
const label facei : selectedFace)
292 newAddressing.append(facei);
293 newFlipMap.append(doFlip[facei]);
295 zoneSet.addressing().transfer(newAddressing);
296 zoneSet.flipMap().transfer(newFlipMap);
const T * test(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
virtual const labelList & faceNeighbour() const
Return face neighbour.
Create a new set and ADD elements to it.
Add elements to current set.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
label nFaces() const noexcept
Number of mesh faces.
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
#define forAll(list, i)
Loop across all elements in list.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
setAction
Enumeration defining various actions.
virtual const labelList & faceOwner() const
Return face owner.
label nInternalFaces() const noexcept
Number of internal faces.
const polyMesh & mesh_
Reference to the mesh.
defineTypeNameAndDebug(combustionModel, 0)
General set of labels of mesh quantity (points, cells, faces).
Subtract elements from current set.
#define WarningInFunction
Report a warning using Foam::Warning.
Class with constructor to add usage string to table.
cellToFaceZone(const polyMesh &mesh, const word &cellSetName, const bool flip)
Construct from components.
const polyBoundaryMesh & patches
messageStream Info
Information stream (stdout output on master, null elsewhere)
The topoSetFaceZoneSource is a intermediate class for handling topoSet sources for selecting face zon...
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
List< bool > boolList
A List of bools.
Do not request registration (bool: false)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.