Go to the documentation of this file.
32 const scalarRange::testType
type,
67 else if (
equal(minVal, maxVal))
100 return scalarRange(scalarRange::LE, -GREAT, maxVal);
105 return scalarRange(scalarRange::LT, -GREAT, maxVal);
121 type_ = scalarRange::NONE;
127 return type_ == NONE;
139 return type_ == scalarRange::EQ;
159 case scalarRange::EQ:
160 case scalarRange::GE:
161 case scalarRange::GT:
164 case scalarRange::LE:
165 case scalarRange::LT:
168 case scalarRange::GE_LE:
170 return (0.5 * min_) + (0.5 * max_);
182 case EQ:
return equal(val, min_);
183 case GE:
return (val >= min_);
184 case GT:
return (val > min_);
185 case LE:
return (val <= max_);
186 case LT:
return (val < max_);
187 case GE_LE:
return (val >= min_ && val <= max_);
188 case ALWAYS:
return true;
189 default:
return false;
202 inline bool Foam::scalarRange::operator==
207 return (type_ == rhs.type_ && min_ == rhs.min_ && max_ == rhs.max_);
211 inline bool Foam::scalarRange::operator!=
static scalarRange lt(const scalar maxVal) noexcept
Construct a less-than bound.
static scalarRange gt0() noexcept
Construct a greater-than zero bound.
bool match(const scalar &val) const
True if the value matches the condition.
static scalarRange ge0() noexcept
Construct a greater-equals zero bound.
scalar max() const noexcept
The max value of the range.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
bool operator()(const scalar &val) const
Identical to match(), for use as a predicate.
Scalar bounds to be used as a unary predicate.
static scalarRange gt(const scalar minVal) noexcept
Construct a greater-than bound.
bool match(const UList< wordRe > &patterns, const std::string &text)
Return true if text matches one of the regular expressions.
scalar min() const noexcept
The min value of the range.
bool empty() const noexcept
True if range is empty (eg, inverted)
scalarRange() noexcept
Construct an empty (inverse) range.
static scalarRange le(const scalar maxVal) noexcept
Construct a less-equals bound.
void clear() noexcept
Reset to an empty (inverse) range.
static scalarRange ge(const scalar minVal) noexcept
Construct a greater-equals bound.
bool single() const noexcept
True if the range bounds represent a single value.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
bool valid() const noexcept
True if range is non-empty.
static scalarRange zero_one() noexcept
Construct a greater-equals 0, less-equals 1 bound.
scalar value() const
A representative (average) value for the range.