52 { selectionModeType::smAll,
"all" },
53 { selectionModeType::smGeometric,
"geometric" },
54 { selectionModeType::smPoints,
"points" },
55 { selectionModeType::smMovingPoints,
"movingPoints" },
56 { selectionModeType::smCellSet,
"cellSet" },
57 { selectionModeType::smCellZone,
"cellZone" },
58 { selectionModeType::smCellType,
"cellType" }
91 for (
const entry& dEntry : mpsDict)
93 const word&
key = dEntry.keyword();
135 <<
"Unknown selectionMode " 137 <<
". Valid selectionMode types : " 150 for (
const label celli : cells_)
152 sumVol += mesh_.V()[celli];
154 reduce(sumVol, sumOp<scalar>());
156 const scalar old(V_);
168 <<
" cell(s) with volume " << V_ <<
endl;
175 switch (selectionMode_)
195 cells_ = selectedCells.sortedToc();
204 for (
const point&
p : points_)
206 const label celli = mesh_.findCell(
p);
208 const bool found = (celli >= 0);
212 selectedCells.insert(celli);
218 <<
"No owner cell found for point " <<
p <<
endl;
222 cells_ = selectedCells.sortedToc();
229 const scalar t = mesh_.time().timeOutputValue();
235 if (!movingPoints_.set(i))
240 const point p(movingPoints_[i].value(t));
242 const label celli = mesh_.findCell(
p);
244 const bool found = (celli >= 0);
252 reduce(proci, maxOp<label>());
256 selectedCells.insert(celli);
262 <<
"No owner cell found for point " <<
p <<
endl;
266 cells_ = selectedCells.sortedToc();
272 <<
"- selecting cells using cellSet " 273 << zoneName() <<
endl;
275 cells_ = cellSet(mesh_, zoneName()).sortedToc();
281 <<
"- selecting cells using cellZones " 284 const auto& zones = mesh_.cellZones();
292 <<
"No matching cellZones: " 304 cells_ = zones[
zoneIDs.first()];
309 cells_ = zones.selection(
zoneIDs).sortedToc();
322 selectedCells.insert(celli);
324 cells_ = selectedCells.sortedToc();
331 <<
"Unknown selectionMode " 332 << selectionModeTypeNames_[selectionMode_]
333 <<
". Valid selectionMode types are " 334 << selectionModeTypeNames_
341 !(smAll == selectionMode_ || smMovingPoints == selectionMode_)
346 <<
"No cells selected!" <<
endl;
356 const word& modelType,
362 selectionMode_(selectionModeTypeNames_.
get(
"selectionMode", coeffs_)),
363 updateSelection_(
false),
369 geometricSelection_(),
388 if (mesh_.changing())
390 if (mesh_.topoChanging())
398 selectionMode_ == smGeometric
399 || selectionMode_ == smPoints
400 || selectionMode_ == smCellType
401 || selectionMode_ == smMovingPoints
413 selectionMode_ == smMovingPoints
414 || selectionMode_ == smGeometric
438 if (coeffs_.readIfPresent(
"timeStart", timeStart_))
440 coeffs_.readEntry(
"duration", duration_);
444 updateSelection_ = coeffs_.getOrDefault(
"updateSelection",
false);
446 if (updateSelection_)
448 setSelection(coeffs_);
selectionModeType selectionMode_
Cell selection mode.
const labelIOList & zoneIDs
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvMesh & mesh_
Reference to the mesh database.
PtrList< Function1< point > > movingPoints_
List of points for "movingPoints" selectionMode.
static FOAM_NO_DANGLING_REFERENCE const Type & New(const Mesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
T & first()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
static int myProcNo(label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static unsigned int defaultPrecision() noexcept
Return the default precision.
virtual bool read(const dictionary &dict)
Read source dictionary.
const word & timeName() const noexcept
Return the current time name.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
UList< label > labelUList
A UList of labels.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
#define forAll(list, i)
Loop across all elements in list.
wordRes selectionNames_
Face selection names (for set or zone selections)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
virtual bool isActive()
Is the source active?
constexpr T & get(FixedList< T, N > &list) noexcept
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
const cellCellStencilObject & overlap
const labelUList & cellTypes
virtual bool read(const dictionary &dict)
Read source dictionary.
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.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
static bitSet select(const polyMesh &mesh, const dictionary &dict, const bool verbosity=false)
Return a cell selection according to the dictionary specification of actions.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
selectionModeType
Enumeration for selection mode types.
dictionary geometricSelection_
Dictionary entries for "geometric" (topoSetCellSource) selection.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
void setCellSelection()
Set the cell selection based on user input selection mode.
void setSelection(const dictionary &dict)
Set cell selection name or points selection from dictionary input.
decomposeUsingBbs false
Use bounding boxes (default) or unique decomposition of triangles (i.e. do not duplicate triangles) ...
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Mesh data needed to do the Finite Volume discretisation.
List< point > points_
List of points for "points" selectionMode.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool isActive()
Is the source active?
List< label > labelList
A List of labels.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
dictionary coeffs_
Dictionary containing source coefficients.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void setVol()
Recalculate the volume.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.