[Gmsh] How to post-process from the command line

Christophe Geuzaine geuzaine at gmail.com
Thu Jul 7 22:38:40 CEST 2005


Jean-Francois Rit wrote:
> Hello,
> 
> I am trying get gmsh (1.60.1) to post process in batch mode from the command
> line, but success is only limited so far...
> 
> Here is what I try to do.
> 
> 1) I have a DAAAGI.pos file with 10 views in ASCII PostProcessing.Format =
> 0. First five lines are :
> 
> $PostFormat
> 1.2 0 8
> $EndPostFormat
> $View
> CDAAAGI_DEPL_VECTEUR     1
> 
> 2) I want to extract a cut plane on view[3]  and print it. So I write a
> stt.geo file like this :
> 
> //PostProcessing.Format = 0;
> //Include "/local00/home/rit/aster/01paluel/criss/1/DAAAGIcol.pos";
> // Coupe Oxz
> Plugin(CutPlane).A = 0 ; 
> Plugin(CutPlane).B = 1 ; 
> Plugin(CutPlane).C = 0 ; 
> Plugin(CutPlane).D = 0 ; 
> // View[3] = sigma theta-theta
> Plugin(CutPlane).iView = 3 ;
> Plugin(CutPlane).Run ; 
> 
> Print.Format = 10; // File format (10=automatic)
> View[10].Visible=1;
> Print "DAAAGIcol.png";
> 
> 3) If I call :
>  gmsh DAAAGI.pos stt.geo 
> 
> gmsh runs, as expected, in interactive mode, then I toggle visibility on
> View[10] interactively and save it as a .png file. 
> So far so good, but partly interactive.
> 
> 4) Problems :
> 
> 4.1) The Include line is commented out because it generates an error : 
>  line 1 : parse error ($)
>  Do I have to live with reading DAAAGI.pos with the command line ?

No. You just need to use 'Merge "DAAAGI.pos"' instead of 'Include 
"DAAAGI.pos"', since DAAAGI.pos is not in parsed format.

You should be able to toggle all the visibility stuff in the script, 
too. (You can also delete views with 'Delete View[xxx]'.)


> 
> 4.2) When I call :
>  gmsh DAAAGI.pos stt.geo -0
> gmsh runs, as expected, in batch mode but generates no .png file.
> Did I miss something on how to print any chosen view ?

The problem is that Gmsh cannot save an image if the OpenGL window is 
not shown on screen. There are ways to do offscreen rendering, but last 
time I looked it was very complicated and not easily portable across 
different architectures.

Best,

Christophe

-- 
Christophe Geuzaine
Applied and Computational Mathematics, Caltech
geuzaine at acm.caltech.edu - http://geuz.org