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_);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
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.
static const cellCellStencilObject & New(const fvMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
PtrList< Function1< point > > movingPoints_
List of points for "movingPoints" selectionMode.
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 unsigned int defaultPrecision() noexcept
Return the default precision.
virtual bool read(const dictionary &dict)
Read source dictionary.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
const word & timeName() const noexcept
Return the current time name.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
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.
#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.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
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...
virtual bool isActive()
Is the source active?
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
const cellCellStencilObject & overlap
virtual bool read(const dictionary &dict)
Read source dictionary.
const labelList & cellTypes
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.
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.
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...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
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.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
dictionary coeffs_
Dictionary containing source coefficients.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
void setVol()
Recalculate the volume.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.