[Gmsh] Animations in gmsh

Stephane Pierre Bordas spb276 at mail.mech.northwestern.edu
Thu Apr 3 02:05:46 CEST 2003


Dear Christophe,
Thanks for your help  on this animation business. I am sorry to ask such a 
stupid question, but what do you mean by "merge this file after your 
post-processing views". Could you explain to me how to do this? Again, I 
apologize for asking such a dumb question.
Thank you,
Stephane

 On Thu, 17 Oct 2002, Christophe Geuzaine wrote:

> Stephane Pierre Bordas wrote:
> > 
> > Dear Christophe,
> > Unfortunately, I do not have the anim-*.script in my demos directory.
> > Where could I get a hold of them?
> > Thank you very much for your help,
> 
> Here is an example (merge this file after your post-processing views).
> 
> // set the dimension of the animation
> 
> General.GraphicsWidth = 320 ; 
> General.GraphicsHeight = 240 ;
> 
> // Set max jpeg quality
> 
> Print.JpegQuality = 100; 
> 
> // Hide all views
> 
> For i In {1:PostProcessing.NbViews}
>   View[i-1].Visible = 0;
> EndFor
> 
> // Loop on all views
> 
> index = 0;
> 
> For i In {1:PostProcessing.NbViews}
> 
>   // Display view i-1
> 
>   View[i-1].Visible = 1;
> 
>   // Loop on all solutions in view i-1
> 
>   For j In {1:View[i-1].NbTimeStep}
> 
>     index++;
>     Draw;
> 
>     // generate a jpeg image
> 
>     Print Sprintf("anim-%03g.jpg", index);
> 
>     View[i-1].TimeStep++;
> 
>   EndFor
> 
>   View[i-1].Visible = 0;
> 
> EndFor
> 
> // create the parameter file for mpeg_encode
> 
> System 'echo "PATTERN          I"               > anim.par' ;
> System 'echo "BASE_FILE_FORMAT JPEG"           >> anim.par' ;
> System 'echo "GOP_SIZE         30"             >> anim.par' ;
> System 'echo "SLICES_PER_FRAME 1"              >> anim.par' ;
> System 'echo "PIXEL            HALF"           >> anim.par' ;
> System 'echo "RANGE            10"             >> anim.par' ;
> System 'echo "PSEARCH_ALG      TWOLEVEL"       >> anim.par' ;
> System 'echo "BSEARCH_ALG      CROSS2"         >> anim.par' ;
> System 'echo "IQSCALE          8"              >> anim.par' ;
> System 'echo "PQSCALE          10"             >> anim.par' ;
> System 'echo "BQSCALE          25"             >> anim.par' ;
> System 'echo "REFERENCE_FRAME  ORIGINAL"       >> anim.par' ;
> System 'echo "OUTPUT           anim.mpg"       >> anim.par' ;
> System 'echo "INPUT_CONVERT    *"              >> anim.par' ;
> System 'echo "INPUT_DIR        ."              >> anim.par' ;
> System 'echo "INPUT"                           >> anim.par' ;
> System Sprintf('echo "anim-*.jpg [001-%03g]"   >> anim.par', index) ;
> System 'echo "END_INPUT"                       >> anim.par' ;
> 
> // Call mpeg_encode
> 
> System "mpeg_encode anim.par" ;
> 
> // Clean-up all temp files
> 
> System "rm -f anim-*.gif" ;
> System "rm -f anim-*.jpg" ;
> System "rm -f anim.par" ;
> 
> 
> 
> You can of course use different image formats and other animation
> encoders than jpeg and mpeg_encode... (for example, I often use
> "whirlgif" to produce animated gifs.)
> 
> Christophe
> 
> 

-- 
Stephane Bordas
Ph.D. candidate
Theoretical and Applied Mechanics
Northwestern University, Evanston, Illinois, 60208

"There is nothing more deceitful than the appearance of humility. It is 
often carelessness of opinion and sometimes an indirect boast." 
Jane Austin, Pride and Prejudice