30 template<
class Type, Foam::direction rank>
42 if (typeAndRanks[i].
second() == rank)
66 if (typeAndRanks[i].
second() == 0)
80 template<
class Type, Foam::direction rank>
139 template<
class Type, Foam::direction rank>
182 fs_.write(os,
units);
188 template<
class Type,
class ValueType>
197 if (
dict.found(valueName<ValueType>(argument)))
202 <<
"Multiple " <<
valueName(argument) <<
" and/or "
203 <<
valueName(argument,
"Type") <<
"-s specified"
229 #define LOOKUP_VALUE_TYPE_AND_RANK(ValueType, nullArg) \
230 lookupValueTypeAndRank<Type, ValueType> \
238 #undef LOOKUP_VALUE_TYPE_AND_RANK
244 <<
" undefined in dictionary " <<
dict.name()
251 <<
"Function " <<
valueName(argument, typeAndRank)
252 <<
" returns a type that cannot be used to produce a product"
253 <<
" of type " << pTraits<Type>::typeName
265 Pair<Tuple2<word, label>> typeAndRanks
267 lookupValueTypeAndRank<Type>(
dict, 0),
268 lookupValueTypeAndRank<Type>(
dict, 1)
275 pTraits<Type>::rank > 0
276 && typeAndRanks.first().second() == -1
277 && typeAndRanks.second().second() == -1
281 <<
"One of the functions " <<
valueName(0) <<
" and "
282 <<
valueName(1) <<
" needs to specify the return type, e.g., as "
290 typeAndRanks.first().second() != -1
291 && typeAndRanks.second().second() != -1
292 && typeAndRanks.first().second()
293 + typeAndRanks.second().second()
294 != pTraits<Type>::rank
298 <<
"The functions " <<
valueName(0, typeAndRanks.first())
299 <<
" and " <<
valueName(1, typeAndRanks.second()) <<
" return "
300 <<
"types for which the product is not of type "
308 pTraits<Type>::rank == 0
309 && typeAndRanks.first().second() == -1
310 && typeAndRanks.second().second() == -1
313 typeAndRanks.first().second() = 0;
314 typeAndRanks.second().second() = 0;
320 if (typeAndRanks[i].
second() == -1)
322 typeAndRanks[i].second() =
323 pTraits<Type>::rank - typeAndRanks[!i].second();
#define LOOKUP_VALUE_TYPE_AND_RANK(ValueType, nullArg)
#define forAll(list, i)
Loop across all elements in list.
Run-time selectable general function of one variable.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Pair< autoPtr< function1Type > > fs
Functions.
void write(Ostream &os, const unitConversions &units) const
Write to a stream.
ProductFunction1s(const unitConversions &units, const dictionary &dict, const Pair< Tuple2< word, label >> &typeAndRanks)
Construct from a dictionary.
Function2 which returns the product of two independent Function1-s of the two input arguments....
virtual ~Product()
Destructor.
virtual void write(Ostream &os, const unitConversions &units) const
Write in dictionary format.
Product(const word &name, const unitConversions &units, const dictionary &dict)
Construct from name and dictionary.
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 different types.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keyword definitions, which are a keyword followed by any number of values (e....
Traits class for primitives.
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void lookupValueTypeAndRank(const dictionary &dict, const direction argument, Tuple2< word, label > &typeAndRank, label &found)
Lookup the type and rank for the value entry for the given argument.
Pair< Tuple2< word, label > > lookupValueTypeAndRanks(const dictionary &dict)
Lookup the types and ranks for the value entries.
word valueName(const direction argument)
Return the name of the value entry for the given argument.
bool valid(const PtrList< ModelType > &l)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const unitConversion unitAny
word name(const bool)
Return a word representation of a bool.
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
const HashTable< unitConversion > & units()
Get the table of unit conversions.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)