Go to the documentation of this file.
44 { actionType::ALL,
"all" },
45 { actionType::CLEAR,
"clear" },
46 { actionType::INVERT,
"invert" },
47 { actionType::USE,
"use" },
48 { actionType::ADD,
"add" },
49 { actionType::SUBTRACT,
"subtract" },
50 { actionType::SUBSET,
"subset" },
51 { actionType::IGNORE,
"ignore" },
61 { sourceType::FIELD,
"field" },
62 { sourceType::STRIDE,
"stride" },
71 { logicType::AND,
"and" },
72 { logicType::OR,
"or" },
80 template<
class Type,
class Predicate,
class AccessOp>
85 const Predicate& accept,
92 const label len = selection.
size();
99 if (actionType::USE == action)
105 for (label parceli = 0; parceli < len; ++parceli)
107 if (accept(aop(list[parceli])))
109 selection.
set(parceli);
115 case actionType::SUBTRACT:
117 for (label parceli = 0; parceli < len; ++parceli)
119 if (accept(aop(list[parceli])))
121 selection.
unset(parceli);
127 case actionType::SUBSET:
129 for (
const label parceli : selection)
131 if (!accept(aop(list[parceli])))
133 selection.
unset(parceli);
174 label nParcels = pointsPtr->size();
181 Log <<
"Applying parcel filtering to " << nParcels <<
" parcels" <<
nl;
193 predicates::scalars tests(3);
197 if (!dEntry.isDict())
200 <<
"Ignoring non-dictionary entry "
205 const dictionary&
dict = dEntry.dict();
215 case actionType::ALL:
216 Log <<
"- select all" <<
nl;
221 case actionType::CLEAR:
222 Log <<
"- clear" <<
nl;
227 case actionType::INVERT:
228 Log <<
"- invert" <<
nl;
233 case actionType::IGNORE:
247 case sourceType::STRIDE:
249 const label stride =
dict.get<label>(
"stride");
255 <<
" stride " << stride <<
nl;
261 <<
"Ignoring bad value for stride=" << stride <<
nl
264 else if (stride == 1)
270 case actionType::ADD:
274 case actionType::SUBTRACT:
289 [=](
const label
id) ->
bool {
return !(
id % stride); },
297 case sourceType::FIELD:
299 const word fieldName(
dict.get<word>(
"field"));
301 const auto* labelFld =
304 const auto* scalarFld =
307 const auto* vectorFld =
313 if (!labelFld && !scalarFld && !vectorFld)
317 <<
"No scalar/vector parcel field: " << fieldName
318 <<
" ignoring selection" <<
nl
325 ITstream& is =
e.stream();
332 Tuple2<word,scalar> expr1(is);
337 Log <<
" : " << expr1;
339 else if (9 == is.size())
345 Tuple2<word,scalar> expr1(is);
347 Tuple2<word,scalar> expr2(is);
367 Log <<
" : " << expr1 <<
' ' << logicName <<
' ' << expr2;
371 action = actionType::IGNORE;
407 [](
const vector& val) -> scalar
409 return Foam::mag(val);
A keyword and a list of tokens is an 'entry'.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void resize(const label numElem, const unsigned int val=0u)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A class for handling words, derived from Foam::string.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (e...
bitSet & unset(const bitSet &other)
static const Enum< actionType > actionNames
void set(const bitSet &bitset)
static const Enum< logicType > logicNames
Ostream & endl(Ostream &os)
EnumType get(const word &enumName) const
Field< vector > vectorField
Specialisation of Field<T> for vector.
bool calculateFilter(const objectRegistry &obrTmp, const bool log=true)
Registry of regIOobjects.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Generic templated field type.
Field< label > labelField
Specialisation of Field<T> for label.
An input stream of tokens.
const Type & lookupObject(const word &name, const bool recursive=false) const
static unary andOp(const unary &test1, const unary &test2)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static const Enum< sourceType > sourceNames
dimensionedScalar log(const dimensionedScalar &ds)
Vector< scalar > vector
A scalar version of the templated Vector.
static unary operation(const opType op, const scalar opVal, const scalar tol=VSMALL)
const Type * findObject(const word &name, const bool recursive=false) const
static void apply(bitSet &selection, const Detail::parcelSelection::actionType action, const Predicate &accept, const UList< Type > &list, const AccessOp &aop)
label size() const noexcept
const dimensionedScalar e
static const IOField< point > * findIOPosition(const objectRegistry &obr)
const Enum< topoSetSource::setAction > actionNames({ { topoSetSource::NEW, "use" }, { topoSetSource::ADD, "add" }, { topoSetSource::SUBTRACT, "subtract" }, { topoSetSource::SUBSET, "subset" }, { topoSetSource::INVERT, "invert" }, })
static unary orOp(const unary &test1, const unary &test2)
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
#define WarningInFunction