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;
188 if (!dEntry.isDict())
191 <<
"Ignoring non-dictionary entry "
207 Log <<
"- select all" <<
nl;
213 Log <<
"- clear" <<
nl;
219 Log <<
"- invert" <<
nl;
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)
280 [=](
const label
id) ->
bool {
return !(
id % stride); },
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
328 Log <<
" : " << expr1;
330 else if (9 == is.
size())
358 Log <<
" : " << expr1 <<
' ' << logicName <<
' ' << expr2;
398 [](
const vector& val) -> scalar
400 return Foam::mag(val);
static const Enum< actionType > actionNames
Names for the actionType.
sourceType
Enumeration defining the valid sources.
@ STRIDE
"stride" - select based on stride (parcel id)
@ FIELD
"field" - select based on field value
bitSet parcelAddr_
The filtered parcel addressing. Eg, for the current cloud.
bool calculateFilter(const objectRegistry &obrTmp, const bool log=true)
Calculate parcel selection filter.
static const Enum< logicType > logicNames
Names for the logicType.
actionType
Enumeration defining the valid selection actions.
@ CLEAR
"clear" - clear the selection
@ IGNORE
"ignore" - dummy no-op
@ SUBTRACT
"subtract" - remove parcel selection
@ ALL
"all" - select all parcels
@ INVERT
"invert" - invert the selection
@ ADD
"add" - parcel selection
dictionary parcelSelect_
The filtered parcel addressing. Eg, for the current cloud.
logicType
Enumeration defining and/or logic.
static const Enum< sourceType > sourceNames
Names for the sourceType.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
EnumType get(const word &enumName) const
The enumeration corresponding to the given name.
An input stream of tokens.
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
label size() const noexcept
Number of entries.
void clear()
Clear the list, i.e. set addressable size to zero.
void reset()
Clear all bits but do not adjust the addressable size.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T & first()
Return the first element of the list.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void flip()
Invert all bits in the addressable region.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bitSet & unset(const bitSet &other)
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
const entry & lookupEntry(const word &keyword, enum keyType::option matchOpt) const
Search for an entry (const access) with the given keyword.
A keyword and a list of tokens is an 'entry'.
Registry of regIOobjects.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const Type & lookupObject(const word &name, const bool recursive=false) const
A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (e...
static unary operation(const opType op, const scalar opVal, const scalar tol=VSMALL)
Standard comparison method by type.
A class for handling words, derived from Foam::string.
#define WarningInFunction
Report a warning using Foam::Warning.
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.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
constexpr char nl
The newline '\n' character (0x0a)