CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Problem with using runtime().path (https://www.cfd-online.com/Forums/openfoam-programming-development/112620-problem-using-runtime-path.html)

anishtain4 February 1, 2013 04:34

Problem with using runtime().path
 
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?

wyldckat February 2, 2013 07:14

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... :rolleyes:

Best regards,
Bruno

anishtain4 February 3, 2013 14:40

1 Attachment(s)
I did over simplified the files.

I have commented a line in file cGen.C, that is the problem I'm facing.

wyldckat February 3, 2013 16:16

1 Attachment(s)
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

anishtain4 February 5, 2013 08:08

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?

wyldckat February 5, 2013 08:51

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 ;)

ngj February 5, 2013 09:26

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

anishtain4 February 5, 2013 10:28

Thank you gentlemen for your time. It was really helpful to me


All times are GMT -4. The time now is 01:33.