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

float or scalar for runTime.tinename() ??

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 2, 2011, 14:26
Default float or scalar for runTime.tinename() ??
  #1
Member
 
Fábio César Canesin
Join Date: Mar 2010
Location: Florianópolis
Posts: 67
Rep Power: 7
Canesin is on a distinguished road
I had look around but I'm not finding a method to call to provide the time the simulation is on.. I wan't to make a change when time = changetime..


I have tried to do casting like:

float(runTime.timeName()) but it do not work.... I'm starting to believe I will have to implement the casting..
Canesin is offline   Reply With Quote

Old   February 2, 2011, 15:12
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Fábio,

Type casting only works when the variables are similar, for example between pointers and between double/int/float and so on. To convert a string to float, you can use atof.

But I think that runTime.value() will get you the value already in scalar (float or double) format, without the need to convert the value.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   February 2, 2011, 16:36
Default
  #3
Member
 
Fábio César Canesin
Join Date: Mar 2010
Location: Florianópolis
Posts: 67
Rep Power: 7
Canesin is on a distinguished road
LOL ...

Thanks Bruno, I had looked at the doxygen but the method "value()" was not there, I believe it's because it is from inheritance..
Canesin is offline   Reply With Quote

Old   February 2, 2011, 18:13
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quote:
Originally Posted by Canesin View Post
I had looked at the doxygen but the method "value()" was not there, I believe it's because it is from inheritance..
You should always check the fine print
Quote:
Originally Posted by http://foam.sourceforge.net/docs/cpp/classFoam_1_1Time.php
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
Solving for an additional species CO in coalChemistryFoam N. A. OpenFOAM Programming & Development 2 November 13, 2014 09:43
OpenFOAM and gpgpu dewald OpenFOAM 37 August 29, 2014 09:32
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
to correct me an udf program farida hamadi FLUENT 0 December 18, 2004 06:54


All times are GMT -4. The time now is 02:10.