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

Problem with using runtime().path

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 1, 2013, 05:34
Default Problem with using runtime().path
  #1
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
I'm writing a utility and I want to plot some graphs, for the path I need runTime.path() but where I need it somewhere else than the main file.
Assume the structure is like this:
utility.C // being the main file
#include "aux.H"
#include "createTime.H"

aux.C // where I defined a class to be used in utility
#include "graph.H"

Now I need to have runTime in aux.C but if I include it there compiler complains as:

error: incomplete type ‘Foam::Time’ used in nested name specifier

any idea?
anishtain4 is offline   Reply With Quote

Old   February 2, 2013, 08:14
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Mahdi,

Could you please create and share a simple utility that shows this? Because your description is reaaaally too vague.
The problem could be one of several possibilities and listing them all could lead someone to the brink of despair...

Best regards,
Bruno
anishtain4 likes this.
__________________
wyldckat is offline   Reply With Quote

Old   February 3, 2013, 15:40
Default
  #3
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
I did over simplified the files.

I have commented a line in file cGen.C, that is the problem I'm facing.
Attached Files
File Type: gz cGen.tar.gz (90.6 KB, 11 views)
anishtain4 is offline   Reply With Quote

Old   February 3, 2013, 17:16
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Mahdi,

Attached is the modified code. I removed some "*~" files, to avoid confusion.

The solution is simple: when constructing an instance of the class, simply give it the reference path for it to keep a copy of it. Then it can be used whenever needed.

In "applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C" you can find more examples of this kind of manipulations, as well as how to create and remove folders.

Best regards,
Bruno
Attached Files
File Type: gz cGen_mod.tar.gz (3.3 KB, 12 views)
__________________
wyldckat is offline   Reply With Quote

Old   February 5, 2013, 09:08
Default
  #5
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
What do you think by passing whole runTime object?
for the moment I need graph setup of runTime (which is manually set to "raw" for the moment) and by developing more I may need timeName(). Is it a bad idea?
anishtain4 is offline   Reply With Quote

Old   February 5, 2013, 09:51
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Honestly I don't know if it's good or bad. I suggest that you try it.
If it breaks with using the full object, then you'll know that maybe it's better to give only the strictly necessary information
__________________
wyldckat is offline   Reply With Quote

Old   February 5, 2013, 10:26
Default
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Mahdi,

I have previously been passing the full runTime (class Time) as

Code:
const Time & t_
and it was without any problems. A small note is that I only did it in pre- and post-processing tools, so I have not tried it for solvers and their libraries, where I always use the mesh instead. Nonetheless, I do not think it will pose you any problems.

Kind regards,

Niels
ngj is offline   Reply With Quote

Old   February 5, 2013, 11:28
Default
  #8
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
Thank you gentlemen for your time. It was really helpful to me
anishtain4 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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 05:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 06:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 15:52


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