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
82 for (label facei = 0; facei < nInt; ++facei)
84 const bool ownFound = cSet.found(own[facei]);
85 const bool neiFound = cSet.found(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] = cSet.found(own[facei]);
120 label facei =
pp.start();
123 const bool ownFound = cSet.found(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,
152 names_(
one{}, setName),
159 const polyMesh&
mesh,
160 const dictionary&
dict 163 topoSetFaceZoneSource(
mesh),
165 flip_(
dict.getOrDefault(
"flip", false))
168 if (!
dict.readIfPresent(
"sets", names_))
178 const polyMesh&
mesh,
182 topoSetFaceZoneSource(
mesh),
183 names_(one{}, word(checkIs(is))),
196 if (!isA<faceZoneSet>(
set))
199 <<
"Operation only allowed on a faceZoneSet." <<
endl;
204 faceZoneSet& zoneSet = refCast<faceZoneSet>(
set);
210 Info<<
" Adding all faces on outside of cell sets: " 211 <<
flatOutput(names_) <<
"; orientation pointing ";
219 Info<<
"away from cell sets" <<
endl;
223 bitSet selectedFace(mesh_.nFaces());
224 bitSet doFlip(mesh_.nFaces());
225 for (
const word& setName : names_)
228 cellSet cSet(mesh_, setName);
230 selectFaces(cSet, selectedFace, doFlip);
234 DynamicList<label> newAddressing(zoneSet.addressing());
235 DynamicList<bool> newFlipMap(zoneSet.flipMap());
237 for (
const label facei : selectedFace)
239 if (!zoneSet.found(facei))
241 newAddressing.append(facei);
242 newFlipMap.append(doFlip[facei]);
246 zoneSet.addressing().transfer(newAddressing);
247 zoneSet.flipMap().transfer(newFlipMap);
254 Info<<
" Removing all faces on outside of cell sets: " 258 bitSet selectedFace(mesh_.nFaces());
259 bitSet doFlip(mesh_.nFaces());
260 for (
const word& setName : names_)
263 cellSet cSet(mesh_, setName);
265 selectFaces(cSet, selectedFace, doFlip);
269 DynamicList<label> newAddressing(zoneSet.addressing().size());
270 DynamicList<bool> newFlipMap(zoneSet.flipMap().size());
272 for (
const label facei : selectedFace)
274 newAddressing.append(facei);
275 newFlipMap.append(doFlip[facei]);
277 zoneSet.addressing().transfer(newAddressing);
278 zoneSet.flipMap().transfer(newFlipMap);
void resize(const label len)
Adjust allocated size of list.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Create a new set and ADD elements to it.
Add elements to current set.
T & front()
Access first element of the list, position [0].
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.
#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 T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
const polyMesh & mesh_
Reference to the mesh.
defineTypeNameAndDebug(combustionModel, 0)
General set of labels of mesh quantity (points, cells, faces).
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
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...
List< label > labelList
A List of labels.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
List< bool > boolList
A List of bools.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
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.