CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   RunTimevalue and runTimetimeName with %3d%3d operator (

maka May 1, 2006 19:20

I noticed that when I write a
I noticed that when I write a condition like :
This refere to OpenFOAM V1.2:

(a) If(runTime.timeName() == runTime.endTime().value()) {// do something}
(b) If(runTime.value() == runTime.endTime().value()) {// do something}

condition (b) works while condition (a) does not.

I looked further, I found that the compiler sees those expressions as:

(a) Foam::Time::timeName() const() == Foam::Time::endTime() const().Foam::dimensioned<type>::value [with Type = Foam::scalar]()

(b) runTime.Foam::Time::<anonymous>.Foam::TimeState::< anonymous>.Foam::dimensioned<t ype>::value [with Type = Foam::scalar]() == Foam::Time::endTime() const().Foam::dimensioned<type>::value [with Type = Foam::scalar]()

with the nearest candidate operator== as:

int Foam::operator==(const Foam::instant&, const Foam::instant&)

I'm aware that there is automatic conversion between word and instant that is why (a) works but why (b) does not work? after all it returned & scalar. I noticed that runTime.value() is not a const member function, but how that can have such an effect?

Can any body help explain why that happens? Thanks.

Best regards,

maka May 1, 2006 19:22

correction: sorry for the typi
correction: sorry for the typing mistake
condition (a) works while condition (b) does not.
/ Maka

All times are GMT -4. The time now is 19:29.