35 return standard() ? t : t*multiplier_;
52 return standard() ? t : t/multiplier_;
68 template<
class Type,
class Convert>
98 Foam::typeUnits<Foam::label>(
const unitSet& units)
102 if (!units.standard())
105 <<
"Unit conversions are not supported for "
118 Foam::typeUnits<Foam::label>(
const dimensionSet& dimensions)
120 if (!dimensions.dimensionless())
139 Type value = Foam::read<Type>(is);
142 if (!haveUnits && !is.
eof())
157 return readAndConvert<Type>(is,
unitSet(dimensions));
161 template<
class Type,
class Units>
165 Type value = Foam::read<Type>(is);
170 Units units(defaultUnits);
190 <<
"Unit conversion is not supported for entries of type "
198 const Type value = Foam::read<Type>(is);
216 return readAndConvert<Type>(is, nil());
236 return dimensionSet(is);
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool eof() const
Return true if end of input seen.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Dimension set for the base types.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
A zero-sized class without any storage. Used, for example, in HashSet.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
Unit conversion structure. Contains the associated dimensions and the multiplier with which to conver...
static unitSet newAny()
Return a new "any" unit set.
bool readIfPresent(const word &keyword, const dictionary &)
Update if found in the dictionary.
T toUser(const T &) const
Convert a value to user units.
void makeStandard(T &) const
Convert a value to standard units.
bool standard() const
Return whether this unit is standard. I.e., is its multiplier one?
T toStandard(const T &) const
Convert a value to standard units.
void makeUser(T &) const
Convert a value to user units.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
std::enable_if_t<!scaleable< Type >::value, Void > enableIfNotScaleable
std::enable_if_t< std::is_same< scalar, typename pTraits< Type >::cmptType >::value, Void > enableIfScalarCmptType
const typeUnitsType< label >::type & typeUnits< label >(const unitSet &)
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
Type readAndConvert(Istream &, const unitSet &)
Read a type which supports unit conversion.
errorManip< error > abort(error &err)
enableIfScaleable< Type, Type > readAndMaybeConvert(Istream &)
Read a type which may or may not support unit conversion.
std::enable_if_t< scaleable< Type >::value, Void > enableIfScaleable
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
const typeUnitsType< Type >::type & typeUnits(const unitSet &)
void convert(UList< Type > &l, const Args &... args)
Apply a conversion to a UList by applying to each element individually.
Trait to identify types which are "scaleable"; i.e., that can be multiply-equals-d with a scalar....
Functor to convert to standard.
Functor to convert to user.