|
[Sponsors] |
June 18, 2021, 13:23 |
fvmLaplacianUncorrected
|
#1 |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
Hello!
I have been trying to become acquainted with OpenFOAM code. Nonetheless I got stuck in one thing. In gaussLaplacianScheme.C, we have the following line of code in fvmLaplacian routine: tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected ( SfGammaSn, this->tsnGradScheme_().deltaCoeffs(vf), vf ); The object of the second parameter passed should belong to a surfaceScalarField class: template<class Type, class GType> tmp<fvMatrix<Type>> gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected ( const surfaceScalarField& gammaMagSf, const surfaceScalarField& deltaCoeffs, const GeometricField<Type, fvPatchField, volMesh>& vf ) Nonetheless, deltaCoeffs(vf), a pure virtual function declared in snGradScheme.H, is set to return a tmp pointer. virtual tmp<surfaceScalarField> deltaCoeffs ( const GeometricField<Type, fvPatchField, volMesh>& ) const = 0; Should it not be returned as a surfaceScalarField object? What am I missing here? Is there any implicit conversion taking place? Thank you! |
|
June 20, 2021, 10:57 |
|
#2 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
The GeometricField class (from which surfaceScalarField is defined) has a constructor that operates on a tmp object. The tmp class also has a const dereference operator overload, which implicitly converts a tmp object to a const reference (check tmp.H). All of this allows tmp objects to be implicitly convertible to the underlying GeometricField, while including reference counting capabilities.
|
|
July 13, 2021, 22:29 |
|
#3 |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
Just to be sure I understood, is the implicit conversion implemented in this routine?
template<class T> inline Foam::tmp<T>::operator const T&() const { return operator()(); } |
|
July 14, 2021, 10:22 |
|
#4 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Yup - that's the one.
|
|
Tags |
fvm::laplacian, laplacianscheme |
|
|