Go to the documentation of this file.
34 Type Foam::expressions::exprDriver::exprDriver::weightedAverage
37 const Field<Type>&
fld
57 const scalar
s =
gSum(wfield);
60 if (
mag(
s) < ROOTVSMALL)
70 Type Foam::expressions::exprDriver::exprDriver::weightedSum
73 const Field<Type>&
fld
96 <<
"Expected a" << (wantPointData ?
" point" :
"")
97 <<
" field, but found a" << (!wantPointData ?
" point" :
"")
118 const auto iter = tbl.cfind(
name);
122 func = iter.val().get();
125 if (!
func && listFailure)
127 *listFailure = tbl.sortedToc();
139 #define doLocalCode(WhichType, MapperMember) \
140 if (std::is_same<Type, WhichType>::value) \
144 this->template getFunction1Ptr<WhichType> \
174 #define doLocalCode(WhichType, MapperMember) \
175 if (std::is_same<Type, WhichType>::value) \
177 const Function1<WhichType>* ptr = \
178 this->template getFunction1Ptr<WhichType> \
180 name, MapperMember, &failed \
182 func = reinterpret_cast<const Function1<Type>*>(ptr); \
205 return func->value(
x);
232 #define doLocalCode(WhichType, MapperMember) \
233 if (std::is_same<Type, WhichType>::value) \
235 const Function1<WhichType>* ptr = \
236 this->template getFunction1Ptr<WhichType> \
238 name, MapperMember, &failed \
240 func = reinterpret_cast<const Function1<Type>*>(ptr); \
263 const label len =
min(result.size(),
input.size());
265 for (label i = 0; i < len; ++i)
271 for (label i = len; i < result.size(); ++i)
292 <<
"Looking for local" << (wantPointData ?
" point" :
"")
293 <<
" field name:" <<
name <<
" type:"
297 bool good = hasVariable(
name);
310 if (good && expectedSize >= 0)
312 good = (var.
size() == expectedSize);
int debug
Static debugging option.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A class for handling words, derived from Foam::string.
label size() const
The field or object size.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
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))
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
bool isPointData(const bool wantPointData=true) const
tmp< Field< Type > > getResult(bool cacheCopy=false)
tmp< Field< Type > > getResult(bool wantPointData=false)
Return the expression result as a tmp field.
tmp< Field< Type > > newField(const Type &val=pTraits< Type >::zero) const
Return a new field with the size()
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
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.
Generic templated field type.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void fillFunctionValues(Field< Type > &result, const word &name, const scalarField &input) const
Fill result with values remapped according to the named Function1.
void func(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool isLocalVariable(const word &name, bool wantPointData=false, label expectedSize=-1) const
Test existence of a local variable.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
bool isType() const
True if valueType corresponds to the given Type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define doLocalCode(WhichType, MapperMember)
A HashTable similar to std::unordered_map.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Type getFunctionValue(const word &name, const scalar x) const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
A traits class, which is primarily used for primitives.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static Istream & input(Istream &is, IntRange< T > &range)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
bool isNull(const T *ptr)
True if ptr is a pointer (of type T) to the nullObject.
bool isFunction(const word &name) const
Named mapping with given type exists.
exprResult result_
The result.
A class for managing references or pointers (no reference counting)