Go to the documentation of this file.
46 #ifndef scalarPredicates_H
47 #define scalarPredicates_H
69 public List<std::function<bool(Foam::scalar)>>
76 typedef std::function<
bool(Foam::scalar)>
unary;
101 const scalar tol = VSMALL
104 return [=](
const scalar val)
115 const scalar tol = VSMALL
118 return [=](
const scalar val)
130 std::less<scalar>(), std::placeholders::_1, opVal
140 std::less_equal<scalar>(), std::placeholders::_1, opVal
151 std::greater<scalar>(), std::placeholders::_1, opVal
161 std::greater_equal<scalar>(), std::placeholders::_1, opVal
171 return [](
const scalar) {
return true; };
177 return [](
const scalar) {
return false; };
186 return [=](
const scalar value)
188 return (test1(value) && test2(value));
195 return [=](
const scalar value)
197 return (test1(value) || test2(value));
209 const scalar tol = VSMALL
217 const scalar tol = VSMALL
224 const scalar tol = VSMALL
230 const std::pair<word, scalar>& op,
231 const scalar tol = VSMALL
243 std::initializer_list<std::pair<word, scalar>> entries
265 label
find(
const scalar value, label
pos = 0)
const;
271 label
rfind(
const scalar value, label
pos = -1)
const;
277 inline bool found(
const scalar value, label
pos=0)
const;
282 inline bool match(
const scalar& value)
const;
287 inline bool matchAny(
const scalar& value)
const;
292 inline bool matchAll(
const scalar& value)
const;
316 inline bool operator()(
const scalar& value)
const;
334 Istream&
operator>>(Istream& is, predicates::scalars& list);
scalars(std::initializer_list< std::pair< word, scalar >> entries)
Construct from an initializer list of (opName opValue) tuples.
static unary greaterEqOp(const scalar opVal)
Test if value is 'greater_equal' to prescribed.
A class for handling words, derived from Foam::string.
static const Enum< opType > opNames
Names for the opType enumeration.
opType
Enumerations for some standard comparison predicates.
A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (e...
Istream & operator>>(Istream &, directionInfo &)
bool match(const scalar &value) const
Match any condition in the list.
static unary greaterOp(const scalar opVal)
label find(const scalar value, label pos=0) const
Index of the first match for the value.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
label rfind(const scalar value, label pos=-1) const
Index of the last match for the value.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
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 trueOp()
Predicate that always returns true.
~scalars()=default
Destructor.
static unary andOp(const unary &test1, const unary &test2)
Combine unary tests as an AND operation.
OBJstream os(runTime.globalPath()/outputName)
static unary lessEqOp(const scalar opVal)
Test if value is 'less_equal' to prescribed.
bool operator()(const scalar &value) const
Identical to found(), match(), for use as a predicate.
bool matchAll(const scalar &value) const
Match all conditions in the list.
static unary equalOp(const scalar opVal, const scalar tol=VSMALL)
Compare for equality, with specified tolerance (non-negative)
static unary lessOp(const scalar opVal)
Test if value is 'less' than prescribed.
bool found(const scalar value, label pos=0) const
True if the value matches any in the list.
static unary operation(const opType op, const scalar opVal, const scalar tol=VSMALL)
Standard comparison method by type.
bool matchAny(const scalar &value) const
Match any condition in the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static Istream & input(Istream &is, IntRange< T > &range)
static unary orOp(const unary &test1, const unary &test2)
Combine unary tests as an OR operation.
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...
labelList matching(const scalar &value) const
Extract list indices for all matches.
std::function< bool(Foam::scalar)> unary
The unary function type for testing a scalar.
dimensionedScalar pos(const dimensionedScalar &ds)