31 bool Foam::functionObjects::multiply::initialiseResult(
const word& fieldName)
33 typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
43 resultFieldPtr->checkOut();
46 Log <<
" Initialising " 57 bool Foam::functionObjects::multiply::multiplyResult
59 const word& fieldName,
63 typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
65 auto* resultFieldPtr = mesh_.getObjectPtr<volFieldType>(resultName_);
69 multiplyFieldType<Type, scalar>(*resultFieldPtr, fieldName, processed);
70 multiplyFieldType<Type, vector>(*resultFieldPtr, fieldName, processed);
71 multiplyFieldType<Type, sphericalTensor>
77 multiplyFieldType<Type, symmTensor>
83 multiplyFieldType<Type, tensor>(*resultFieldPtr, fieldName, processed);
90 template<
class Type1,
class Type2>
91 typename std::enable_if
93 Foam::functionObjects::multiply::is_valid_op<Type1, Type2>::value,
bool 95 Foam::functionObjects::multiply::multiplyFieldType
97 GeometricField<Type1, fvPatchField, volMesh>& result,
98 const word& fieldName,
102 if (processed)
return processed;
104 typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType;
106 auto* fieldPtr = mesh_.cfindObject<volFieldType>(fieldName);
110 Log <<
" Performing " << result.name() <<
" * " << fieldPtr->name()
113 auto newResult(result*(*fieldPtr));
116 store(resultName_, newResult);
125 template<
class Type1,
class Type2>
126 typename std::enable_if
128 !Foam::functionObjects::multiply::is_valid_op<Type1, Type2>::value,
bool 130 Foam::functionObjects::multiply::multiplyFieldType
132 GeometricField<Type1, fvPatchField, volMesh>& result,
133 const word& fieldName,
137 if (processed)
return processed;
139 typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType;
141 auto* fieldPtr = mesh_.cfindObject<volFieldType>(fieldName);
145 Info<<
" Unsupported operation for " 146 << result.name() <<
'(' << pTraits<Type1>::typeName <<
')' 148 << fieldPtr->name() <<
'(' << pTraits<Type2>::typeName <<
')' Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
Store the field in the (sub) objectRegistry under the given name.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
word resultName_
Name of result fields.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const fvMesh & mesh_
Reference to the fvMesh.