CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

RunTimevalue and runTimetimeName with %3d%3d operator

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By maka

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 1, 2006, 20:20
Default I noticed that when I write a
  #1
Senior Member
 
Maka Mohu
Join Date: Mar 2009
Posts: 305
Rep Power: 18
maka is on a distinguished road
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
Tushar@cfd likes this.
maka is offline   Reply With Quote

Old   May 1, 2006, 20:22
Default correction: sorry for the typi
  #2
Senior Member
 
Maka Mohu
Join Date: Mar 2009
Posts: 305
Rep Power: 18
maka is on a distinguished road
correction: sorry for the typing mistake
condition (a) works while condition (b) does not.
/ Maka
maka is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about fvmlaplacian operator cosimobianchini OpenFOAM Running, Solving & CFD 0 February 1, 2007 14:40
Template for operator overloading shuo OpenFOAM 0 November 10, 2006 22:17
Operator Splitting. Maria. Main CFD Forum 5 September 17, 2005 23:10
Operator precedence hemph OpenFOAM 1 September 13, 2005 13:40
a math operator in UDF lichun Dong FLUENT 7 June 18, 2005 23:04


All times are GMT -4. The time now is 22:20.