92 #include <type_traits> 100 template<
class T>
class MinMax;
133 inline MinMax(
const T& minVal,
const T& maxVal);
148 inline explicit MinMax(
const T& val);
186 inline
T span() const;
189 inline scalar
mag() const;
192 inline
bool empty() const;
195 inline
bool good() const;
204 inline void reset(
const T& val);
207 inline void reset(
const T& minVal,
const T& maxVal);
219 inline bool overlaps(
const MinMax<T>&
b)
const;
226 inline int compare(
const T& val)
const;
229 inline bool contains(
const T& val)
const;
233 inline T clamp(
const T& val)
const;
276 T clip(
const T& val)
const {
return this->
clamp(val); }
bool intersects(const MinMax< T > &b) const
Test if the ranges intersect (exclusive check)
MinMax< scalar > scalarMinMax
A scalar min/max range.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
A min/max value pair with additional methods. In addition to conveniently storing values...
A traits class, which is primarily used for primitives and vector-space.
bool good() const
Range is non-inverted.
T clip(const T &val) const
Old method name. Same as clamp (2023-01)
static MinMax< T > zero_one()
A 0-1 range corresponding to the pTraits zero, one.
void reset()
Reset to an inverted (invalid) range.
const T & min() const noexcept
The min value (first)
bool empty() const
Range is empty if it is inverted.
An ordered pair of two objects of type <T> with first() and second() elements.
T clamp(const T &val) const
Return value clamped component-wise.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
static MinMax< T > ge(const T &minVal)
A semi-infinite range from minVal to the type max.
T value_type
The value type the MinMax represents.
bool valid() const
Range is non-inverted.
T centre() const
The min/max average value.
MinMax< label > labelMinMax
A label min/max range.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
MinMax< T > & operator/=(const scalar &s)
Divide range by scalar factor.
bool overlaps(const MinMax< T > &b) const
Test if ranges overlap/touch (inclusive check)
MinMax< T > & operator &=(const MinMax< T > &b)
Restrict min/max range to union with other range.
MinMax< T > & add(const MinMax &other)
Extend the range to include the other min/max range.
bool operator()(const T &val) const
Identical to contains(), for use as a predicate.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void inplaceClip(T &val) const
Old method (2023-01)
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
int compare(const T &val) const
Compares the min/max range with the specified value.
MinMax< T > & operator+=(const MinMax< T > &b)
Extend min/max range to include other range.
Global functions and operators related to the MinMax class. Included by MinMax.H. ...
const T & max() const noexcept
The max value (second)
T span() const
The min to max span. Zero if the range is invalid.
static MinMax< T > le(const T &maxVal)
A semi-infinite range from type min to maxVal.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
scalar mag() const
The magnitude of the min to max span. Zero if the range is invalid.
pTraits< T >::cmptType cmptType
Component type.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool contains(const T &val) const
True if the value is within the range (inclusive check)
void clear()
Same as reset() - reset to an inverted (invalid) range.
MinMax()
Construct inverted range.
MinMax< T > & operator*=(const scalar &s)
Multiply range by scalar factor.