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
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.
found(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))
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Return true if hashed entry is found in table.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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...
A keyword and a list of tokens is an 'entry'.
A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (e...
static unary lessOp(const scalar opVal)
Test if value is 'less' than prescribed.
static unary greaterEqualOp(const scalar opVal)
Test if value is 'greater_equal' to prescribed.
static unary falseOp()
Predicate that always returns false.
static unary notEqualOp(const scalar opVal, const scalar tol=VSMALL)
Compare for inequality, with specified tolerance (non-negative)
static unary lessEqualOp(const scalar opVal)
Test if value is 'less_equal' to prescribed.
static unary greaterOp(const scalar opVal)
label find(const scalar value, label pos=0) const
Index of the first match for the value.
static unary operation(const opType op, const scalar opVal, const scalar tol=VSMALL)
Standard comparison method by type.
void assign(std::initializer_list< std::pair< word, scalar > > entries)
opType
Enumerations for some standard comparison predicates.
@ GREATER_EQUAL
"ge", "greaterEqual", "greaterEq"
@ LESS_EQUAL
"le", "lessEqual", "lessEq"
@ NOT_EQUAL
"neq", "notEqual"
static unary equalOp(const scalar opVal, const scalar tol=VSMALL)
Compare for equality, with specified tolerance (non-negative)
static const Enum< opType > opNames
Names for the opType enumeration.
label rfind(const scalar value, label pos=-1) const
Index of the last match for the value.
static unary trueOp()
Predicate that always returns true.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar pos(const dimensionedScalar &ds)
static bool hasBadEntries(const Container &entries, const Get0 &get0)
Istream & operator>>(Istream &, directionInfo &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
static Error & printBadEntries(Error &err, const Container &entries, const Get0 &get0, const Get1 &get1)
constexpr char nl
The newline '\n' character (0x0a)