35 #ifndef Foam_MinMaxOps_H 36 #define Foam_MinMaxOps_H 40 #include <type_traits> 61 return range.clamp(val);
131 inline MinMax<T>
minMax(
const MinMax<T>&
x,
const MinMax<T>&
y)
145 template<
class Form,
class Cmpt, direction nCmpt>
157 for (
const T& val : vals)
179 template<
class T1,
class T2>
187 template<
class T1,
class T2>
294 inline MinMax<T>
operator*(
const MinMax<T>&
x, scalar
s)
296 return MinMax<T>(
x.min()*
s,
x.max()*
s);
302 inline MinMax<T>
operator/(
const MinMax<T>&
x, scalar
s)
304 return MinMax<T>(
x.min()/
s,
x.max()/
s);
310 template<
class T,
class U>
311 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
312 operator<(const MinMax<T>&
range,
const U& val)
314 return (
range.compare(val) < 0);
317 template<
class T,
class U>
318 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
319 operator<=(const MinMax<T>&
range,
const U& val)
321 return (
range.compare(val) <= 0);
324 template<
class T,
class U>
325 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
328 return (
range.compare(val) > 0);
331 template<
class T,
class U>
332 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
335 return (
range.compare(val) >= 0);
339 template<
class T,
class U>
340 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
341 operator<(const U& val, const MinMax<T>&
range)
343 return (
range.compare(val) > 0);
346 template<
class T,
class U>
347 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
348 operator<=(const U& val, const MinMax<T>&
range)
350 return (
range.compare(val) >= 0);
353 template<
class T,
class U>
354 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
357 return (
range.compare(val) < 0);
360 template<
class T,
class U>
361 inline std::enable_if_t<std::is_convertible_v<U, T>,
bool>
364 return (
range.compare(val) <= 0);
MinMax< scalar > scalarMinMax
A scalar min/max range.
clampOp(const T &min, const T &max)
Construct from min/max limits. No validity checks.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A min/max value pair with additional methods. In addition to conveniently storing values...
bool operator>(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A newer than B.
T clip(const T &val, const MinMax< T > &range)
Return the value after clamping by the min/max limiter.
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
bool operator>=(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A same or newer than B.
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
Unary function for applying component-wise clamping.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
MinMax< T > & add(const MinMax &other)
Extend the range to include the other min/max range.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
T operator()(const T &val) const
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))