|
[Sponsors] |
July 16, 2020, 10:02 |
fvPatchField<Type>::operator==
|
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Howdy Foamers:
Browsing through the uniformFixedValue fvPatchField implementation there is a call to an operator like this in the member function updateCoeffs(): Code:
fvPatchField<Type>::operator == ( uniformValue_->value(t) ); Code:
template<class Type> void Foam::fvPatchField<Type>::operator == ( const Type& t ) { Field<Type>::operator = (t); } Thanks in advance, Gerry. Last edited by Gerry Kan; July 16, 2020 at 11:02. |
|
July 17, 2020, 05:57 |
|
#2 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Howdy Foamers:
I think it is simply used as an assignment, and based on this OpenFOAM will somehow update the solver coefficients. I didn't dig so deep to see if this is the case but my results seems to tell me something is happening in the right direction. Gerry. |
|
July 17, 2020, 13:28 |
|
#3 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33 |
Hi,
We use operator== to indicate forced assignment, in contrast with normal assignment of an fvPatchField. Normal assignment is a virtual overload depending on type, where for example it does nothing for a fixedValue derives class. What the code says is “when forcing assignment, use the op= of the base class for the Field. This is not a virtual hierarchy and it will do the actual assignment job. Hope this helps, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
July 20, 2020, 02:38 |
|
#4 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10 |
Dear Professor Jasak:
Thank you very much for taking your time to explain this. In the end I went (just a little) deeper to the definition of the overloaded Field assignment operator and it confirmed your comments and my observation. In the end I would like to use this to assign a Field to the fvPatchField using this variant of the forced assignment operator, that is: Code:
void Foam::fvPatchField<Type>::operator == ( const Field<Type>& tf ) Code:
void Foam::fvPatchField<Type>::operator == ( const Type& t ) Thank you again, Gerry. |
|
|
|