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"
59void 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_);
167 flip_(
dict.getOrDefault(
"flip", false))
195 <<
"Operation only allowed on a faceZoneSet." <<
endl;
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);
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);
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);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
@ NO_REGISTER
Do not request registration (bool: false).
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
label setMany(InputIter first, InputIter last)
Set the locations listed by the iterator range, auto-vivify entries if needed.
A collection of cell labels.
A topoSetSource to select faces with only one neighbour (i.e. outside) in a specified cellSet.
cellToFaceZone(const polyMesh &mesh, const word &cellSetName, const bool flip)
Construct from components.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Like faceSet but -reads data from faceZone -updates faceZone when writing.
const boolList & flipMap() const noexcept
const labelList & addressing() const noexcept
void updateSet()
Sort addressing and make faceSet part consistent with addressing.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
label nInternalFaces() const noexcept
Number of internal faces.
label nFaces() const noexcept
Number of mesh faces.
The topoSetFaceZoneSource is a intermediate class for handling topoSet sources for selecting face zon...
topoSetFaceZoneSource(const polyMesh &mesh)
Construct from mesh.
Class with constructor to add usage string to table.
Base class of a source for a topoSet.
static bool readNames(const dictionary &dict, wordList &names)
Helper: extract wordList of patches/zones from dictionary. Returns.
setAction
Enumeration defining various actions.
@ SUBTRACT
Subtract elements from current set.
@ ADD
Add elements to current set.
@ NEW
Create a new set and ADD elements to it.
bool verbose_
Output verbosity (default: true).
const polyMesh & mesh() const noexcept
Reference to the mesh.
const polyMesh & mesh_
Reference to the mesh.
static Istream & checkIs(Istream &is)
Check state of stream.
General set of labels of mesh quantity (points, cells, faces).
virtual bool found(const label id) const
Has the given index?
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define WarningInFunction
Report a warning using Foam::Warning.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
List< bool > boolList
A List of bools.
#define forAll(list, i)
Loop across all elements in list.