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

Problem with using runtime().path

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

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   February 1, 2013, 05:34
Default Problem with using runtime().path
  #1
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Posts: 124
Rep Power: 8
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
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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
Posts: 124
Rep Power: 8
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, 3 views)
anishtain4 is offline   Reply With Quote

Old   February 3, 2013, 17:16
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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, 3 views)
wyldckat is offline   Reply With Quote

Old   February 5, 2013, 09:08
Default
  #5
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Posts: 124
Rep Power: 8
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
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
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 online now   Reply With Quote

Old   February 5, 2013, 11:28
Default
  #8
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Posts: 124
Rep Power: 8
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

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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


All times are GMT -4. The time now is 05:06.