47 faceZoneToCell::typeName,
48 "\n Usage: faceZoneToCell zone front|back|both\n\n"
49 " Select front, back or both sides of the faceZone."
50 " Note:accepts wildcards for zone.\n\n"
58Foam::faceZoneToCell::faceActionNames_
60 { faceAction::FRONT,
"front" },
61 { faceAction::BACK,
"back" },
62 { faceAction::BOTH,
"both" },
64 { faceAction::FRONT,
"master" },
65 { faceAction::BACK,
"slave" },
71void Foam::faceZoneToCell::combine
79 const label nZones =
mesh_.faceZones().size();
86 for (
const label zonei :
zoneIDs)
88 if (zonei < 0 || zonei >= nZones)
93 const auto& zone =
mesh_.faceZones()[zonei];
97 Info<<
" Using matching zone " << zone.name();
101 Info<<
" [front] cells:";
105 Info<<
" : [back] cells:";
109 Info<<
" : [front/back] cells:";
115 const labelList& cellLabels = zone.frontCells();
122 for (
const label celli : cellLabels)
125 if (celli >= 0 && celli <
mesh_.nCells())
134 const labelList& cellLabels = zone.backCells();
141 for (
const label celli : cellLabels)
144 if (celli >= 0 && celli <
mesh_.nCells())
159void Foam::faceZoneToCell::combine(
topoSet& set,
const bool add)
const
161 if (zoneMatcher_.empty())
166 const labelList matched(mesh_.faceZones().indices(zoneMatcher_));
171 <<
"Cannot find any faceZone matching "
173 <<
"Valid names: " <<
flatOutput(mesh_.faceZones().names())
189 const faceAction option
193 zoneMatcher_(zoneSelector),
202 const faceAction option
206 zoneMatcher_(
one{}, zoneName),
219 option_(faceActionNames_.get(
"option",
dict))
222 if (!
dict.readIfPresent(
"zones", zoneMatcher_))
224 zoneMatcher_.resize(1);
225 zoneMatcher_.front() = dict.getCompat<wordRe>(
"zone", {{
"name", 1806}});
232 const polyMesh&
mesh,
236 topoSetCellSource(
mesh),
252 zoneMatcher_ = zonesSelector;
259 zoneMatcher_.front() = zoneName;
271 if (verbose_ && !zoneMatcher_.empty())
273 Info<<
" Adding all " << faceActionNames_[option_]
274 <<
" cells of face zones "
282 if (verbose_ && !zoneMatcher_.empty())
284 Info<<
" Removing all " << faceActionNames_[option_]
285 <<
" cells of face zones "
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void resize(const label len)
Adjust allocated size of list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A topoSetCellSource to select cells based on front or back side of given faceZone(s).
faceZoneToCell(const polyMesh &mesh, const wordRes &zoneSelector, const faceAction option)
Construct from mesh, zones selector and selection option.
const wordRes & zones() const noexcept
Return the current zones selector.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
faceAction
Enumeration defining the valid options.
@ BOTH
Both front and back side of faces.
@ FRONT
The front (positive normal) side of the faces.
@ BACK
The back (negative normal) side of the faces.
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.
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
topoSetCellSource(const polyMesh &mesh)
Construct from mesh.
Class with constructor to add usage string to table.
Base class of a source for a topoSet.
void addOrDelete(topoSet &set, const label id, const bool add) const
Add or delete id from set. Add when 'add' is true.
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).
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const labelIOList & zoneIDs
#define WarningInFunction
Report a warning using Foam::Warning.
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
constexpr char nl
The newline '\n' character (0x0a).
dict add("bounds", meshBb)