37 if (!
result_.isPointData(wantPointData))
40 <<
"Expected a" << (wantPointData ?
" point" :
"")
41 <<
" field, but found a" << (!wantPointData ?
" point" :
"")
62 const auto iter = tbl.cfind(
name);
66 func = iter.val().get();
69 if (!func && listFailure)
71 *listFailure = tbl.sortedToc();
83 #define doLocalCode(WhichType, MapperMember) \
84 if constexpr (std::is_same_v<Type, WhichType>) \
88 this->template getFunction1Ptr<WhichType> \
118 #define doLocalCode(WhichType, MapperMember) \
119 if constexpr (std::is_same_v<Type, WhichType>) \
121 const Function1<WhichType>* ptr = \
122 this->template getFunction1Ptr<WhichType> \
124 name, MapperMember, &failed \
126 func = reinterpret_cast<const Function1<Type>*>(ptr); \
176 #define doLocalCode(WhichType, MapperMember) \
177 if constexpr (std::is_same_v<Type, WhichType>) \
179 const Function1<WhichType>* ptr = \
180 this->template getFunction1Ptr<WhichType> \
182 name, MapperMember, &failed \
184 func = reinterpret_cast<const Function1<Type>*>(ptr); \
198 <<
"No mapping '" <<
name <<
" (" << pTraits<Type>::typeName
207 const label len =
min(result.
size(), input.
size());
209 for (label i = 0; i < len; ++i)
211 result[i] = func->
value(input[i]);
215 for (label i = len; i < result.
size(); ++i)
236 <<
"Looking for local" << (wantPointData ?
" point" :
"")
237 <<
" field name:" <<
name <<
" type:"
241 bool good = hasVariable(
name);
245 const exprResult& var = variable(
name);
248 <<
" - found (" << var.valueType()
249 << (var.isPointData() ?
" point" :
"") <<
')';
251 good = (var.isType<Type>() && var.isPointData(wantPointData));
254 if (good && expectedSize >= 0)
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
virtual Type value(const scalar x) const
Return value as a function of (scalar) independent variable.
A HashTable similar to std::unordered_map.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
bool isLocalVariable(const word &name, bool wantPointData=false, label expectedSize=-1) const
Test existence of a local variable.
virtual label size() const
The natural field size for the expression.
exprResult result_
The result.
virtual exprResult & variable(const word &name)
Non-const access to the named variable (sub-classes only).
virtual label pointSize() const
The point field size for the expression.
tmp< Field< Type > > newField(const Type &val=pTraits< Type >::zero) const
Return a new field with the size().
HashTable< refPtr< Function1< scalar > > > scalarFuncs_
Function1 mappings/timelines (scalar), evaluated at the simulation time or with arbitrary scalars.
HashTable< refPtr< Function1< vector > > > vectorFuncs_
Function1 mappings/timelines (vector), evaluated at the simulation time or with arbitrary scalars.
Type getFunctionValue(const word &name, const scalar x) const
Evaluate named mapping for the given time/value. Zero for undefined/unknown.
const exprResult & result() const noexcept
Const access to expression result.
bool isFunction(const word &name) const
Named mapping with given type exists.
virtual bool hasVariable(const word &name) const
True if named variable exists.
void fillFunctionValues(Field< Type > &result, const word &name, const scalarField &input) const
Fill result with values remapped according to the named Function1.
tmp< Field< Type > > getResult(bool wantPointData=false)
Return the expression result as a tmp field.
tmp< Field< Type > > newPointField(const Type &val=pTraits< Type >::zero) const
Return a new field with the pointSize().
A polymorphic field/result from evaluating an expression.
const word & valueType() const noexcept
Basic type for the field or single value.
label size() const
The field or object size.
bool isType() const
True if valueType corresponds to the given Type.
bool isPointData(const bool wantPointData=true) const
True if representing point data, or test for same value as wantPointData argument.
A traits class, which is primarily used for primitives and vector-space.
A class for managing references or pointers (no reference counting).
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define doLocalCode(FieldType, Variable)
#define DebugInfo
Report an information message using Foam::Info.
Namespace for handling debugging switches.
List< word > wordList
List of word.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).