For Programmers: Free Programming Magazines  


Home > Archive > Fortran > June 2005 > f90gl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author f90gl
NuclearWizard

2005-06-07, 3:57 am

I have begun using openGL with Fortran to visualize unstructured
meshes. It is great to have a visualization tool in Fortran! The
_only_ problem I'm experiencing is that I don't know how to run the
visualization and _then_ run the code---once you enter openGL's
MainLoop(), there's no coming back, so it seems. So to make it work
like I want, I'd have to embed my whole code into an openGL Display()
procedure---the subroutine openGL calls over and over again to know
what to display. If anyone knows how "come back" from the
MainLoop---without STOPping my main PROGRAM, please let me know. I
have checked all the online sources I can find and they all say that it
can't be done---but I think they might be saying it "can't" be done
because they think it "shouldn't" be done.

Jan Vorbrüggen

2005-06-07, 8:59 am

Such user interfaces are almost all event-driven. To get any useful "batch"
computation done, you need to create (at least) two threads when starting,
one that will later be the display loop and run the callbacks from the GUI,
the other doing the "real work". You will need some methods to communicate
and synchronize between the two threads. You usually also need to structure
the computation such that it periodically checks some status variable (which
will be set asynchronously by some GUI event) and then stops the computation,
waiting for your new instructions.

Jan
Steve Lionel

2005-06-07, 4:02 pm

On 6 Jun 2005 20:34:35 -0700, "NuclearWizard" <william.wieselquist@gmail.com>
wrote:

>I have begun using openGL with Fortran to visualize unstructured
>meshes. It is great to have a visualization tool in Fortran! The
>_only_ problem I'm experiencing is that I don't know how to run the
>visualization and _then_ run the code---once you enter openGL's
>MainLoop(), there's no coming back, so it seems.


In addition to what Jan writes, OpenGL defines in the "aux" library the
ability to declare an "Idle function" which is called by OpenGL when it is not
rendering. So this is where you would put your computation code, typically
just enough to render one change in output (the UI would become unresponsive
if you did too much work in an idle function.)

Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH

User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
NuclearWizard

2005-06-07, 8:58 pm

Thanks for the replies Jan and Steve. I believe I will do as Jan
suggests and enable multiple threads, with the option for the user to
completely turn off the graphics. So my main program will be something
like

IF( graphics_Enabled )THEN
CALL graphics_driver()
ELSE
CALL fast_driver()
ENDIF

Right now, I am simply using openGL to "debug" the geometry input, as
the mesh is unstructured, it is _very_ tedious to check the text output
assembly of user input vertices, edges, and cells for errors. I don't
anticipate using a runtime visualization of output (as as it would
be) as it would slow the code down too much. FYI, the code will solve
2D/3D uncharged particle transport problems using the Method of
Characteristics (MOC) with Quasi-Diffusion (QD) to accelerate
convergence of the MOC transport solution. Thanks for your help :]
-Will

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com