65 fieldToCell::typeName,
66 "\n Usage: fieldToCell field min max\n\n"
67 " Select all cells with field value >= min and <= max\n\n"
73void Foam::fieldToCell::applyToSet
75 const topoSetSource::setAction action,
76 const scalarField&
field,
89 Info<<
" Adding all cells with value of field " << fieldName_
90 <<
" within range " << min_ <<
".." << max_ <<
endl;
95 if (
field[celli] >= min_ &&
field[celli] <= max_)
105 Info<<
" Removing all cells with value of field " << fieldName_
106 <<
" within range " << min_ <<
".." << max_ <<
endl;
111 if (
field[celli] >= min_ &&
field[celli] <= max_)
125 const word& fieldName,
131 fieldName_(fieldName),
138 <<
"Input min value = " << min_ <<
" is larger than "
139 <<
"input max value = " << max_ <<
" for field = " << fieldName_
147 const polyMesh&
mesh,
152 fieldName_(
dict.get<
word>(
"field")),
153 min_(
dict.get<scalar>(
"min")),
154 max_(
dict.get<scalar>(
"max"))
165 fieldName_(checkIs(is)),
173void Foam::fieldToCell::applyToSet
195 <<
"Cannot read field " << fieldName_
198 else if (fieldObject.isHeaderClass(
"volScalarField"))
203 IFstream str(fieldObject.typeFilePath<
labelIOList>());
206 fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
210 applyToSet(action, internalVals, set);
212 else if (fieldObject.isHeaderClass(
"volVectorField"))
224 applyToSet(action,
mag(internalVals), set);
229 <<
"Cannot handle fields of type " << fieldObject.headerClassName()
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool isHeaderClass(const word &expectedType) const
Check if headerClassName() equals the expected type. Always true if the expected type is empty.
const word & headerClassName() const noexcept
Return name of the class name read from header.
fileName typeFilePath(const bool search=true) const
Call localFilePath or globalFilePath for given type depending on its is_globalIOobject trait.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Read field as dictionary (without mesh).
A topoSetCellSource to select cells based on volScalarField values, i.e. select cells with given fiel...
fieldToCell(const polyMesh &mesh, const word &fieldName, const scalar min, const scalar max)
Construct from components.
const Time & time() const
Return the top-level database.
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.
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.
static Istream & checkIs(Istream &is)
Check state of stream.
General set of labels of mesh quantity (points, cells, faces).
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
IOList< label > labelIOList
IO for a List of label.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Field< vector > vectorField
Specialisation of Field<T> for vector.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.