Skip to content
Snippets Groups Projects
Select Git revision
  • 105d48507ef3f12bc68a76c6cf9446a1096602d4
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

anim.script

Blame
  • Forked from gmsh / gmsh
    18003 commits behind the upstream repository.
    Christophe Geuzaine's avatar
    Christophe Geuzaine authored
    polish
    9871e9aa
    History
    anim.script 2.00 KiB
    // This script creates an mpeg or gif animation by looping over all
    // the time steps and/or all the post-processing views
    
    neww = GetValue("Width of animation? (enter 0 to keep current width)", 640); 
    newh = GetValue("Height of animation? (enter 0 to keep current height)", 640) ;
    all = GetValue("Animate one view at a time or all views together?
    
    0: one at a time, 1: all together", 1) ;
    method = GetValue("Animation encoder?
    
    0: mpeg_encode (MPEG1), 1: mencoder (MPEG4), 2: whirlgif (GIF89)", 0) ;
    MPEG_ENCODE = 0;
    MENCODER = 1;
    WHIRLGIF = 2;
    
    oldw = General.GraphicsWidth;
    oldh = General.GraphicsHeight;
    
    If(neww)
      General.GraphicsWidth = neww;
    EndIf
    If(newh)
      General.GraphicsHeight = newh;
    EndIf
    
    If(all)
      maxstep = 1;
      For i In {1:PostProcessing.NbViews}
        View[i-1].TimeStep = 0;
        // compute max num of steps
        If(View[i-1].Visible)
          If(View[i-1].NbTimeStep > maxstep)
            maxstep = View[i-1].NbTimeStep;
          EndIf
        EndIf
      EndFor
      For index In {1:maxstep}
        Draw;
        If(method == WHIRLGIF)
          Print Sprintf("/tmp/tmp%03g.gif", index);
        EndIf
        If(method == MPEG_ENCODE || method == MENCODER)
          Print Sprintf("/tmp/tmp%03g.jpg", index);
        EndIf
        For i In {1:PostProcessing.NbViews}
          View[i-1].TimeStep++;
        EndFor
      EndFor
    EndIf
    
    If(!all)
      // Hide all views
      For i In {1:PostProcessing.NbViews}
        View[i-1].Visible = 0;
        View[i-1].TimeStep = 0;
      EndFor
      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;
          If(method == WHIRLGIF)
            Print Sprintf("/tmp/tmp%03g.gif", index);
          EndIf
          If(method == MPEG_ENCODE || method == MENCODER)
            Print Sprintf("/tmp/tmp%03g.jpg", index);
          EndIf
          View[i-1].TimeStep++;
        EndFor
        View[i-1].Visible = 0;
      EndFor
    EndIf
    
    NUM_FRAMES = index;
    ENCODER = method;
    Include "encode.script";
    
    General.GraphicsWidth = oldw;
    General.GraphicsHeight = oldh;