Hi all,
I'm trying to under
Hi all,
I'm trying to understand how evaluate function is implemented in fixedGradientFvPatchField.C, but the following lines are obscure to me: Field<type>::operator= ( this->patchInternalField() + gradient_/this->patch().deltaCoeffs() ); The function I'm referring to is this one: // Evaluate the field on the patch template<class> void fixedGradientFvPatchField<type>::evaluate() { if (!this->updated()) { this->updateCoeffs(); } Field<type>::operator= ( this->patchInternalField() + gradient_/this->patch().deltaCoeffs() ); fvPatchField<type>::evaluate(); } Thanks in advance |
Says:
The current value on
Says:
The current value on the boundary = the value in the cells next to the boundary + (boundary-normal gradient)*(distance form the cell centre to the boundary face). The this->patch().deltaCoeffs() bit means 1/distance, which is why you have a division instead of multiplication. Better? Hrv |
Thanks for your ready answer,
Thanks for your ready answer, but what was not clear to me was how the assignment was done, where was the receiver of the operation, since there is not anything on the left of operator "=", apart from Field<type>::, which is the scope resolution operator used to specify which class the operator "=" refers to.
I'have just read the effective implementation of this operator in the file "List.C" and I've seen that there is any type returned, the "returned type" is void, consequently no object has to be put on the left of "=", the operator "=" can be called as a usual function that "returns a void". Have I understood correctly? I'm a beginner in C++. Thanks again |
This is pure C++. I can call
This is pure C++. I can call operator= in 2 ways:
class HrvsClass { void operator=(const HrvsClass&); ;} and then HrvsClass a; HrvsClass b; a = b; which is the same as a.operator=(b); In the code above I would have to write this->operator=(b) Additionally, I wish to call operator= from the base class rather than the current class. So, the long (and ugly) notation would say: Field<type>& f = *this; f = this->patchInternalField() + gradient_/this->patch().deltaCoeffs(); which is pretty ugly. Hope this helps, Hrv |
Quote:
Can you tell me the value of the cells next to the boundary is known (taken from the previous iteration) or unknown (to be solved together with the current value on the boundayry ) ? Many thanks. |
All times are GMT -4. The time now is 11:49. |