32 const scalarRange::rangeTypes type,
45 scalarRange(rangeTypes::NONE, GREAT, -GREAT)
51 scalarRange(rangeTypes::EQ, val, val)
67 else if (
equal(minVal, maxVal))
69 type_ = rangeTypes::EQ;
77 return scalarRange(rangeTypes::GE, minVal, GREAT);
84 return scalarRange(rangeTypes::GT, minVal, GREAT);
91 return scalarRange(rangeTypes::GE, 0, GREAT);
98 return scalarRange(rangeTypes::GT, 0, GREAT);
105 return scalarRange(rangeTypes::LE, -GREAT, maxVal);
111 return scalarRange(rangeTypes::LT, -GREAT, maxVal);
118 return scalarRange(rangeTypes::GE_LE, 0, 1);
128 type_ = rangeTypes::NONE;
134 return (type_ == rangeTypes::NONE);
140 return (type_ != rangeTypes::NONE);
146 return (type_ == rangeTypes::EQ);
163 case rangeTypes::GE_LE:
165 return (0.5 * min_) + (0.5 * max_);
177 case rangeTypes::EQ:
return equal(val, min_);
178 case rangeTypes::GE:
return (val >= min_);
179 case rangeTypes::GT:
return (val > min_);
180 case rangeTypes::LE:
return (val <= max_);
181 case rangeTypes::LT:
return (val < max_);
182 case rangeTypes::GE_LE:
return (val >= min_ && val <= max_);
183 case rangeTypes::ALWAYS:
return true;
184 default:
return false;
194 return (type_ ==
rhs.type_ && min_ ==
rhs.min_ && max_ ==
rhs.max_);
201 return !(*
this ==
rhs);
Scalar bounds to be used as a unary predicate.
bool single() const noexcept
True if the range bounds represent a single value.
void reset() noexcept
Reset to an empty (inverse, NONE) range.
static constexpr scalarRange ge0() noexcept
A greater-equals zero bound.
scalar value() const
A representative (average) value for the range.
static constexpr scalarRange le(const scalar maxVal) noexcept
A less-equals bound.
bool empty() const noexcept
True if range is empty (eg, inverted, NONE).
bool good() const noexcept
True if range is non-empty.
bool contains(const scalar val) const
True if the value is matched by the condition.
constexpr bool operator!=(const scalarRange &rhs) const noexcept
static constexpr scalarRange ge(const scalar minVal) noexcept
A greater-equals bound.
static constexpr scalarRange gt0() noexcept
A greater-than zero bound.
static constexpr scalarRange lt(const scalar maxVal) noexcept
A less-than bound.
constexpr scalarRange() noexcept
Construct an empty (inverse, NONE) range - never matches.
static constexpr scalarRange gt(const scalar minVal) noexcept
A greater-than bound.
constexpr bool operator==(const scalarRange &rhs) const noexcept
static constexpr scalarRange zero_one() noexcept
A greater-equals 0, less-equals 1 bound.
limits reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL))
bool equal(const T &a, const T &b)
Compare two values for equality.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)