46#ifndef Foam_scalarPredicates_H
47#define Foam_scalarPredicates_H
69 public List<std::function<bool(Foam::scalar)>>
76 typedef std::function<
bool(Foam::scalar)>
unary;
105 const scalar tol = VSMALL
108 return [=](
const scalar val)
119 const scalar tol = VSMALL
122 return [=](
const scalar val)
134 std::less<scalar>(), std::placeholders::_1, opVal
144 std::less_equal<scalar>(), std::placeholders::_1, opVal
155 std::greater<scalar>(), std::placeholders::_1, opVal
165 std::greater_equal<scalar>(), std::placeholders::_1, opVal
175 return [](
const scalar) {
return true; };
181 return [](
const scalar) {
return false; };
190 return [=](
const scalar value)
192 return (test1(value) && test2(value));
199 return [=](
const scalar value)
201 return (test1(value) || test2(value));
213 const scalar tol = VSMALL
221 const scalar tol = VSMALL
228 const scalar tol = VSMALL
234 const std::pair<word, scalar>& op,
235 const scalar tol = VSMALL
247 std::initializer_list<std::pair<word, scalar>> entries
265 void assign(std::initializer_list<std::pair<word, scalar>> entries);
277 label
find(
const scalar value, label
pos = 0)
const;
283 label
rfind(
const scalar value, label
pos = -1)
const;
289 inline bool found(
const scalar value, label
pos=0)
const;
294 inline bool match(
const scalar value)
const;
299 inline bool matchAny(
const scalar value)
const;
304 inline bool matchAll(
const scalar value)
const;
328 inline bool operator()(
const scalar value)
const;
346Istream&
operator>>(Istream& is, predicates::scalars& list);
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
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...
constexpr List() noexcept
Default construct.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
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 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.
std::function< bool(Foam::scalar)> unary
The unary function type for testing a scalar.
static unary andOp(const unary &test1, const unary &test2)
Combine unary tests as an AND operation.
bool operator()(const scalar value) const
Identical to found(), match(), for use as a predicate.
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.
~scalars()=default
Destructor.
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.
bool matchAny(const scalar value) const
Match any condition in the list.
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.
labelList matching(const scalar value) const
Extract list indices for all matches.
static unary orOp(const unary &test1, const unary &test2)
Combine unary tests as an OR operation.
bool match(const scalar value) const
Match any condition in the list.
bool matchAll(const scalar value) const
Match all conditions in the list.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
dimensionedScalar pos(const dimensionedScalar &ds)
static Istream & input(Istream &is, IntRange< T > &range)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Istream & operator>>(Istream &, directionInfo &)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.