41 { opType::EQUAL,
"eq" },
42 { opType::EQUAL,
"equal" },
43 { opType::NOT_EQUAL,
"neq" },
44 { opType::NOT_EQUAL,
"notEqual" },
45 { opType::LESS,
"lt" },
46 { opType::LESS,
"less" },
47 { opType::LESS_EQUAL,
"le" },
48 { opType::LESS_EQUAL,
"lessEqual" },
49 { opType::LESS_EQUAL,
"lessEq" },
50 { opType::GREATER,
"gt" },
51 { opType::GREATER,
"greater" },
52 { opType::GREATER_EQUAL,
"ge" },
53 { opType::GREATER_EQUAL,
"greaterEqual" },
54 { opType::GREATER_EQUAL,
"greaterEq" },
62 const enum predicates::scalars::opType op,
63 const Foam::scalar opVal,
64 const Foam::scalar tol
72 case opType::NOT_EQUAL:
78 case opType::LESS_EQUAL:
84 case opType::GREATER_EQUAL:
103 template<
class Container,
class Get0>
106 const Container& entries,
110 for (
const auto&
entry : entries)
123 template<
class Error,
class Container,
class Get0,
class Get1>
127 const Container& entries,
136 for (
const auto& entry : entries)
146 <<
"Entries with unknown operations:" <<
nl 151 for (
const auto& entry : entries)
153 const bool bad = badIndices.contains(idx);
164 err <<
'(' << get0(entry) <<
' ' << get1(entry) <<
')';
185 std::initializer_list<std::pair<word, scalar>> entries
211 std::initializer_list<std::pair<word, scalar>> entries
214 typedef std::pair<word, scalar> tuple_type;
217 const auto get0 = [](
const tuple_type&
entry) {
return entry.first; };
218 const auto get1 = [](
const tuple_type&
entry) {
return entry.second; };
228 this->resize_nocopy(entries.size());
229 auto iter = this->
begin();
231 for (
const tuple_type& entry : entries)
247 const auto get0 = [](
const tuple_type&
entry) {
return entry.first(); };
248 const auto get1 = [](
const tuple_type& entry) {
return entry.second(); };
258 this->resize_nocopy(entries.size());
259 auto iter = this->
begin();
261 for (
const tuple_type& entry : entries)
275 const label len = this->size();
283 if ((*
this)[
pos](value))
303 if (pos < 0 || pos >= this->size())
305 pos = this->size()-1;
310 if ((*
this)[
pos](value))
327 List<Tuple2<word, scalar>> entries(is);
static unary lessEqualOp(const scalar opVal)
Test if value is 'less_equal' to prescribed.
static unary greaterOp(const scalar opVal)
Test if value is 'greater' than prescribed Compare scalar values for inequality.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool hasBadEntries(const Container &entries, const Get0 &get0)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
label find(const scalar value, label pos=0) const
Index of the first matching test for the value.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
static unary notEqualOp(const scalar opVal, const scalar tol=VSMALL)
Compare for inequality, with specified tolerance (non-negative)
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
static unary equalOp(const scalar opVal, const scalar tol=VSMALL)
Compare for equality, with specified tolerance (non-negative)
void assign(std::initializer_list< std::pair< word, scalar >> entries)
Assign new predicates from an initializer list of (opName opValue) tuples.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static unary lessOp(const scalar opVal)
Test if value is 'less' than prescribed.
dimensionedScalar pos(const dimensionedScalar &ds)
label rfind(const scalar value, label pos=-1) const
Index of the last match for the value.
static Error & printBadEntries(Error &err, const Container &entries, const Get0 &get0, const Get1 &get1)
Istream & operator>>(Istream &, directionInfo &)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
static unary greaterEqualOp(const scalar opVal)
Test if value is 'greater_equal' to prescribed.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static unary falseOp()
Predicate that always returns false.
scalars(std::initializer_list< std::pair< word, scalar >> entries)
Construct from an initializer list of (opName opValue) tuples.
static unary trueOp()
Predicate that always returns true.
static unary operation(const opType op, const scalar opVal, const scalar tol=VSMALL)
Standard comparison method by type.
A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (e...
static const Enum< opType > opNames
Names for the opType enumeration.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
opType
Enumerations for some standard comparison predicates.
A keyword and a list of tokens is an 'entry'.