PDA

View Full Version : Discussion on GUI and Program-Solver Interaction



Omid123
14th February 2015, 14:42
Hi there,

I have written my numerical solution (for fluid dynamics) in Fortran. I have used Qt to make an application to serve as a GUI for my code.

So far, Qt application takes input from the user and save them in a text file. Then, the text file will serve as input for the Fortran code which solves the problem.
Solving the problem, Fortran saves results back into some other text files which can be loaded into Qt application for further analysis.

I am not expert in application development. My question is that, is this the simple and good way to do GUI and Program-Solver interaction, or should I try other ways?

Thanks for hints.

Omid

anda_skoa
14th February 2015, 15:24
Sounds good to me.
A simple, yet effective solution.

Do I assume correctly that the solver runs as a child process of the GUI?

Cheers,
_

d_stranz
14th February 2015, 17:19
I think a similar solution is used for many computational chemistry problems, where legacy Fortran code has been used forever, but where more modern GUIs are desired for entering parameters and reviewing results, all through the use of text files for input or output.

Further to anda_skoa's comment - if the Fortran program can be run as a child process of the GUI application, then you can create the parameters, run the process, wait for it to finish, and then read the results back in. It will appear to the user as if the GUI program is the only thing running.

If the computations are intensive and take a while, then you can offer to play a movie until the process finishes. Qt can do that, too. :-)

Omid123
23rd February 2015, 15:31
thanks for the note.
the GUI, depending on which parameters the user activate, will save different contents in the 'text file'. Then, FORTRAN which should read the 'text file', has several "if statement". Do you suggest to use a better way of transferring the 'input data' from GUI to FORTRAN? maybe using XML??

Omid

d_stranz
23rd February 2015, 23:54
Do you suggest to use a better way of transferring the 'input data' from GUI to FORTRAN?

No. As they say, if it isn't broken, don't fix it. What I was suggesting is, that if you can run the FORTRAN program as a sub-process from the GUI and then display the results in the GUI when the computation is finished, the user will think that he is directly controlling the computation.

I do not know how you run your FORTRAN program now. It sounds like it is started manually from the command line. With Qt, you can run this program from inside your GUI (maybe in response to the user clicking "Run" :) ) and avoid using the command prompt at all.