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);
165 label nParcels = pointsPtr->size();
172 Log <<
"Applying parcel filtering to " << nParcels <<
" parcels" <<
nl;
184 predicates::scalars tests(3);
188 if (!dEntry.isDict())
191 <<
"Ignoring non-dictionary entry " 206 case actionType::ALL:
207 Log <<
"- select all" <<
nl;
212 case actionType::CLEAR:
213 Log <<
"- clear" <<
nl;
218 case actionType::INVERT:
219 Log <<
"- invert" <<
nl;
224 case actionType::IGNORE:
238 case sourceType::STRIDE:
240 const label stride =
dict.get<label>(
"stride");
246 <<
" stride " << stride <<
nl;
252 <<
"Ignoring bad value for stride=" << stride <<
nl 255 else if (stride == 1)
261 case actionType::ADD:
265 case actionType::SUBTRACT:
280 [=](
const label
id) ->
bool {
return !(
id % stride); },
288 case sourceType::FIELD:
290 const word fieldName(
dict.get<word>(
"field"));
292 const auto* labelFld =
295 const auto* scalarFld =
298 const auto* vectorFld =
304 if (!labelFld && !scalarFld && !vectorFld)
308 <<
"No scalar/vector parcel field: " << fieldName
309 <<
" ignoring selection" <<
nl 316 ITstream& is =
e.stream();
323 Tuple2<word,scalar> expr1(is);
328 Log <<
" : " << expr1;
330 else if (9 == is.size())
336 Tuple2<word,scalar> expr1(is);
338 Tuple2<word,scalar> expr2(is);
358 Log <<
" : " << expr1 <<
' ' << logicName <<
' ' << expr2;
362 action = actionType::IGNORE;
398 [](
const vector& val) -> scalar
EnumType get(const word &enumName) const
The enumeration corresponding to the given name.
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
Field< label > labelField
Specialisation of Field<T> for label.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
void set(const bitSet &bitset)
Set specified bits from another bitset.
dimensionedScalar log(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a)
void flip()
Invert all bits in the addressable region.
static void apply(bitSet &selection, const Detail::parcelSelection::actionType action, const Predicate &accept, const UList< Type > &list, const AccessOp &aop)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
bitSet parcelAddr_
The filtered parcel addressing. Eg, for the current cloud.
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
static const Enum< actionType > actionNames
Names for the actionType.
const dimensionedScalar e
Elementary charge.
bitSet & unset(const bitSet &other)
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
sourceType
Enumeration defining the valid sources.
bool calculateFilter(const objectRegistry &obrTmp, const bool log=true)
Calculate parcel selection filter.
actionType
Enumeration defining the valid selection actions.
void clear()
Clear the list, i.e. set addressable size to zero.
static unary orOp(const unary &test1, const unary &test2)
Combine unary tests as an OR operation.
static unary andOp(const unary &test1, const unary &test2)
Combine unary tests as an AND operation.
dictionary parcelSelect_
The filtered parcel addressing. Eg, for the current cloud.
static const Enum< sourceType > sourceNames
Names for the sourceType.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#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...
static unary operation(const opType op, const scalar opVal, const scalar tol=VSMALL)
Standard comparison method by type.
Field< vector > vectorField
Specialisation of Field<T> for vector.
void reset()
Clear all bits but do not adjust the addressable size.
Registry of regIOobjects.
logicType
Enumeration defining and/or logic.
static const Enum< logicType > logicNames
Names for the logicType.
label size() const noexcept
Number of entries.
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.