View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003564 | OpenFOAM | Bug | public | 2020-10-05 02:30 | 2020-10-05 11:04 |
Reporter | GCr | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Summary | 0003564: compiled errors while using DimensionedField<Type, GeoMesh> | ||||
Description | When using DimensionedField<tensor, volMesh>, there is compiling error: no matching function for call to ‘T(const Foam::Field<Foam::Tensor<double> >&, const Foam::Field<Foam::Tensor<double> >&)’ Foam::T(result(), *this); | ||||
Steps To Reproduce | 1.write the following code in createFields.H of the icoFoam application. volTensorField Ut = fvc::grad(U); DimensionedField<tensor, volMesh> Ud = Ut.internalField(); Info << Ud.T() << endl; 2.compile and the error occurs. | ||||
Additional Information | the Foam::T() global functions in the FieldFunctions.H is declared as: template<class Type> void T(Field<Type>& res, const UList<Type>& f); However, the member function T() of the class dimensionedField<Type, GeoMesh> is defined as: template<class Type, class GeoMesh> tmp<DimensionedField<Type, GeoMesh>> DimensionedField<Type, GeoMesh>::T() const { tmp<DimensionedField<Type, GeoMesh>> result ( DimensionedField<Type, GeoMesh>::New ( name() + ".T()", mesh_, dimensions_ ) ); Foam::T(result(), *this); return result; } where the operator() of the tmp<T> return a const reference of T rather than a non-const reference which is required by Foam::T() global function. So, I modify the above code: Foam::T(result(), *this); into: Foam::T(result.ref(), *this); After this modification, the compilation can be done successfully. | ||||
Tags | No tags attached. | ||||