100template<
class T>
class MinMax;
157 inline explicit MinMax(
const T& val);
195 inline T span()
const;
198 inline scalar
mag()
const;
201 inline bool empty()
const;
204 inline bool good()
const;
210 inline void reset(
const T& val);
213 inline void reset(
const T& minVal,
const T& maxVal);
235 inline bool contains(
const T& val)
const;
239 inline T clamp(
const T& val)
const;
255 template<
class... Args>
256 inline MinMax<T>&
add(
const T& val0,
const T& val1, Args&&... values);
Global functions and operators related to the MinMax class. Included by MinMax.H.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
A min/max value pair with additional methods. In addition to conveniently storing values,...
MinMax< T > & add(const UList< T > &vals)
Include the values into the range.
MinMax(const UList< T > &vals)
Construct from list of values.
T & min() noexcept
The min value.
bool operator()(const T &val) const
Identical to contains(), for use as a predicate.
MinMax< T > & operator&=(const MinMax< T > &b)
Restrict min/max range to union with other range.
bool valid() const
Range is non-inverted. Same as good (2022-10).
MinMax(const Pair< T > &range)
Implicit construct from min/max limits.
void reset(const T &minVal, const T &maxVal)
Reset min/max to specified values.
T clip(const T &val) const
Old method name. Same as clamp (2023-01).
MinMax(Foam::zero_one)
Implicit construct from zero_one as 0-1 range (pTraits zero, one).
bool contains(const T &val) const
True if the value is within the range (inclusive check).
MinMax< T > & add(const T &val0, const T &val1, Args &&... values)
Include two or more values into the range.
bool empty() const
Range is empty if it is inverted.
MinMax(const Tuple2< T, T > &range)
Implicit construct from min/max limits.
T clamp(const T &val) const
Return value clamped component-wise.
MinMax< T > & add(const T &val)
Include the value into the range.
MinMax< T > & operator/=(scalar s)
Divide range by scalar factor.
const T & max() const noexcept
The max value.
MinMax< T > & operator*=(scalar s)
Multiply range by scalar factor.
T & max() noexcept
The max value.
MinMax(const std::pair< T, T > &range)
Implicit construct from min/max limits.
scalar mag() const
The magnitude of the min to max span. Zero for invalid range.
static MinMax< T > le(const T &maxVal)
A semi-infinite range from type min to maxVal.
const T & min() const noexcept
The min value.
bool overlaps(const MinMax< T > &b) const
Test if ranges overlap/touch (inclusive check).
static MinMax< T > ge(const T &minVal)
A semi-infinite range from minVal to the type max.
T centre() const
The min/max average value.
bool good() const
Range is non-inverted.
void clear()
Same as reset() - reset to an inverted (invalid) range.
MinMax< T > & operator+=(const UList< T > &vals)
Extend min/max range to include all values.
void reset()
Reset to an inverted (invalid) range.
MinMax(const T &minVal, const T &maxVal)
Construct from min/max limits.
pTraits< label >::cmptType cmptType
MinMax< T > & operator+=(const MinMax< T > &b)
Extend min/max range to include other range.
T span() const
The min to max span. Zero for invalid range.
int compare(const T &val) const
Compares the min/max range with the specified value.
MinMax()
Default construct: an inverted range.
bool intersects(const MinMax< T > &b) const
Test if the ranges intersect (exclusive check).
MinMax(Foam::zero)
Construct with a single zero value.
MinMax< T > & operator+=(const T &val)
Extend min/max range to include value.
MinMax< T > & add(const MinMax &other)
Extend the range to include the other min/max range.
MinMax(const T &val)
Construct with a single initial value.
static MinMax< T > zero_one()
A 0-1 range corresponding to the pTraits zero, one.
void reset(const T &val)
Reset min/max to be identical to the specified value.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
An ordered pair of two objects of type <T> with first() and second() elements.
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 traits class, which is primarily used for primitives and vector-space.
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
A class for handling words, derived from Foam::string.
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
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))
MinMax< label > labelMinMax
A label min/max range.
MinMax< scalar > scalarMinMax
A scalar min/max range.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A template class to specify that a data type can be considered as being contiguous in memory.