parameters: (image_root_directory,
                data_root_directory,
                file_name_padding,
                make_cinema_table,
                cinema_tracks,
                cinema_arrays,
                rendering_info)
docstring: The user facing entry point. Here we get a hold of ParaView's animation controls, step through the animation, and export the things we've been asked to be the caller.
docstring_summary: The user facing entry point. Here we get a hold of ParaView's animation controls, step through the animation, and export the things we've been asked to be the caller.
docstring_tokens: The user facing entry point . Here we get a hold of ParaView s animation controls step through the animation and export the things we ve been asked to be the caller .
function: def ExportNow(image_root_directory,
                data_root_directory,
                file_name_padding,
                make_cinema_table,
                cinema_tracks,
                cinema_arrays,
                rendering_info):
      """The user facing entry point. Here we get a hold of ParaView's animation controls, step through the animation, and export the things we've been asked to be the caller."""
  
      CIND = CinemaDHelper(make_cinema_table, image_root_directory)
      image_root_directory = _fixup_and_makedir_if_needed(image_root_directory)
      data_root_directory = _fixup_and_makedir_if_needed(data_root_directory)
  
      # get a hold of the scene
      spm = servermanager.vtkSMProxyManager.GetProxyManager().GetActiveSessionProxyManager()
      ed = spm.GetExportDepot()
      s = GetAnimationScene()
      s.GoToFirst()
      et = s.EndTime
      tnow = s.AnimationTime
  
      numTimesteps = len(paraview.simple.GetAnimationScene().TimeKeeper.TimestepValues)
      timesteps = {}
      # We must perform the export loop at least once, even in the case where
      # the input data contains no timesteps
      if (numTimesteps == 0):
          timesteps = list(range(1))
      else:
          timesteps = list(range(numTimesteps))
  
      # export loop
      for tstep in timesteps:
          padded_tstep = str(tstep).rjust(file_name_padding, '0')
          helpers = []
  
          # loop through the configured writers and export at the requested times
          ed.InitNextWriterProxy()
          wp = ed.GetNextWriterProxy()
          writercnt = 0
          while wp:
              freq = wp.GetProperty("WriteFrequency").GetElement(0)
              if ((tstep % freq==0) and
                  (not (wp.GetXMLName() == "Cinema image options"))):
                  # this isn't pretty. I couldn't find a way to write
                  # directly with the writer proxy. So what I do here
                  # is find the input and filename and make a new writer
                  # to use.
                  proxyname = spm.GetProxyName("export_writers", wp)
                  inputname = proxyname[0:proxyname.find("|")]
                  inputproxy = FindSource(inputname)
                  if wp.GetProperty("ChooseArraysToWrite").GetElement(0) == 1:
                      point_arrays = []
                      cell_arrays = []
                      arrays_property = wp.GetProperty("PointDataArrays")
                      for i in range(arrays_property.GetNumberOfElements()):
                          point_arrays.append(arrays_property.GetElement(i))
                      arrays_property = wp.GetProperty("CellDataArrays")
                      for i in range(arrays_property.GetNumberOfElements()):
                          cell_arrays.append(arrays_property.GetElement(i))
                      if not point_arrays:
                          point_arrays = [' ']
                      if not cell_arrays:
                          cell_arrays = [' ']
                      # create a temporary array culling filter
                      pass_arrays = PassArrays(Input=inputproxy, \
                          PointDataArrays=point_arrays, CellDataArrays=cell_arrays)
                      inputproxy = pass_arrays
                      helpers.append(inputproxy)
                  fname = wp.GetProperty("CatalystFilePattern").GetElement(0)
                  if wp.GetXMLName() == "ExodusIIWriter":
                      fnamefilled = data_root_directory+fname+padded_tstep
                  else:
                      fnamefilled = data_root_directory+fname.replace("%t", padded_tstep)
  
                  kwargs = {}
                  DataMode = wp.GetProperty("DataMode")
                  if DataMode is not None:
                      kwargs["DataMode"] = wp.GetProperty("DataMode").GetElement(0)
                  HeaderType = wp.GetProperty("HeaderType")
                  if HeaderType is not None:
                      kwargs["HeaderType"] = wp.GetProperty("HeaderType").GetElement(0)
                  EncodeAppendedData = wp.GetProperty("EncodeAppendedData")
                  if EncodeAppendedData is not None:
                      kwargs["EncodeAppendedData"] = wp.GetProperty("EncodeAppendedData").GetElement(0)
                  CompressorType = wp.GetProperty("CompressorType")
                  if CompressorType is not None:
                      kwargs["CompressorType"] = wp.GetProperty("CompressorType").GetElement(0)
                  CompressionLevel = wp.GetProperty("CompressionLevel")
                  if CompressionLevel is not None:
                      kwargs["CompressionLevel"] = wp.GetProperty("CompressionLevel").GetElement(0)
  
                  # finally after all of the finageling above, save the data
                  SaveData(fnamefilled, inputproxy, **kwargs)
                  # don't forget to tell cinema D about it
                  CIND.AppendToCinemaDTable(tnow, "writer_%s" % writercnt, fnamefilled)
              wp = ed.GetNextWriterProxy()
              writercnt = writercnt + 1
  
          # loop through the configured screenshots and export at the requested times
          ed.InitNextScreenshotProxy()
          ssp = ed.GetNextScreenshotProxy()
          viewcnt = 0
          while ssp:
              if not ssp.HasAnnotation("enabled") or not (ssp.GetAnnotation("enabled") == '1'):
                  ssp= ed.GetNextScreenshotProxy()
                  continue
              freq = ssp.GetProperty("WriteFrequency").GetElement(0)
              if tstep % freq==0:
                  fname = ssp.GetProperty("CatalystFilePattern").GetElement(0)
                  if fname.endswith("cdb"):
                      CINAC = __CinemaACHelper(image_root_directory,
                                rendering_info,
                                cinema_tracks,
                                cinema_arrays)
                      # special treatment for cinema image data bases
                      CINAC.ExportNow(tnow)
                      # don't forget to tell cinema D about it
                      CIND.AppendCViewToCinemaDTable(tnow, "cview_%s"%viewcnt, CINAC.NewFiles)
                  else:
                      fnamefilled = image_root_directory+fname.replace("%t", padded_tstep)
                      # save the screenshot
                      ssp.WriteImage(fnamefilled)
                      # don't forget to tell cinema D about it
                      CIND.AppendToCinemaDTable(tnow, "view_%s"%viewcnt, fnamefilled)
              ssp = ed.GetNextScreenshotProxy()
              viewcnt = viewcnt + 1
          tstep = tstep + 1
          s.GoToNext()
          tnow = s.AnimationTime
  
          # destroy array culling filters
          for x in helpers:
            Delete(x)
  
      # defer actual cinema D output until the end because we only know now what the full set of cinema D columns actually are
      CIND.Finalize()
function_tokens: def ExportNow ( image_root_directory , data_root_directory , file_name_padding , make_cinema_table , cinema_tracks , cinema_arrays , rendering_info ) : CIND = CinemaDHelper ( make_cinema_table , image_root_directory ) image_root_directory = _fixup_and_makedir_if_needed ( image_root_directory ) data_root_directory = _fixup_and_makedir_if_needed ( data_root_directory ) # get a hold of the scene spm = servermanager . vtkSMProxyManager . GetProxyManager ( ) . GetActiveSessionProxyManager ( ) ed = spm . GetExportDepot ( ) s = GetAnimationScene ( ) s . GoToFirst ( ) et = s . EndTime tnow = s . AnimationTime numTimesteps = len ( paraview . simple . GetAnimationScene ( ) . TimeKeeper . TimestepValues ) timesteps = { } # We must perform the export loop at least once, even in the case where # the input data contains no timesteps if ( numTimesteps == 0 ) : timesteps = list ( range ( 1 ) ) else : timesteps = list ( range ( numTimesteps ) ) # export loop for tstep in timesteps : padded_tstep = str ( tstep ) . rjust ( file_name_padding , '0' ) helpers = [ ] # loop through the configured writers and export at the requested times ed . InitNextWriterProxy ( ) wp = ed . GetNextWriterProxy ( ) writercnt = 0 while wp : freq = wp . GetProperty ( "WriteFrequency" ) . GetElement ( 0 ) if ( ( tstep % freq == 0 ) and ( not ( wp . GetXMLName ( ) == "Cinema image options" ) ) ) : # this isn't pretty. I couldn't find a way to write # directly with the writer proxy. So what I do here # is find the input and filename and make a new writer # to use. proxyname = spm . GetProxyName ( "export_writers" , wp ) inputname = proxyname [ 0 : proxyname . find ( "|" ) ] inputproxy = FindSource ( inputname ) if wp . GetProperty ( "ChooseArraysToWrite" ) . GetElement ( 0 ) == 1 : point_arrays = [ ] cell_arrays = [ ] arrays_property = wp . GetProperty ( "PointDataArrays" ) for i in range ( arrays_property . GetNumberOfElements ( ) ) : point_arrays . append ( arrays_property . GetElement ( i ) ) arrays_property = wp . GetProperty ( "CellDataArrays" ) for i in range ( arrays_property . GetNumberOfElements ( ) ) : cell_arrays . append ( arrays_property . GetElement ( i ) ) if not point_arrays : point_arrays = [ ' ' ] if not cell_arrays : cell_arrays = [ ' ' ] # create a temporary array culling filter pass_arrays = PassArrays ( Input = inputproxy , PointDataArrays = point_arrays , CellDataArrays = cell_arrays ) inputproxy = pass_arrays helpers . append ( inputproxy ) fname = wp . GetProperty ( "CatalystFilePattern" ) . GetElement ( 0 ) if wp . GetXMLName ( ) == "ExodusIIWriter" : fnamefilled = data_root_directory + fname + padded_tstep else : fnamefilled = data_root_directory + fname . replace ( "%t" , padded_tstep ) kwargs = { } DataMode = wp . GetProperty ( "DataMode" ) if DataMode is not None : kwargs [ "DataMode" ] = wp . GetProperty ( "DataMode" ) . GetElement ( 0 ) HeaderType = wp . GetProperty ( "HeaderType" ) if HeaderType is not None : kwargs [ "HeaderType" ] = wp . GetProperty ( "HeaderType" ) . GetElement ( 0 ) EncodeAppendedData = wp . GetProperty ( "EncodeAppendedData" ) if EncodeAppendedData is not None : kwargs [ "EncodeAppendedData" ] = wp . GetProperty ( "EncodeAppendedData" ) . GetElement ( 0 ) CompressorType = wp . GetProperty ( "CompressorType" ) if CompressorType is not None : kwargs [ "CompressorType" ] = wp . GetProperty ( "CompressorType" ) . GetElement ( 0 ) CompressionLevel = wp . GetProperty ( "CompressionLevel" ) if CompressionLevel is not None : kwargs [ "CompressionLevel" ] = wp . GetProperty ( "CompressionLevel" ) . GetElement ( 0 ) # finally after all of the finageling above, save the data SaveData ( fnamefilled , inputproxy , * * kwargs ) # don't forget to tell cinema D about it CIND . AppendToCinemaDTable ( tnow , "writer_%s" % writercnt , fnamefilled ) wp = ed . GetNextWriterProxy ( ) writercnt = writercnt + 1 # loop through the configured screenshots and export at the requested times ed . InitNextScreenshotProxy ( ) ssp = ed . GetNextScreenshotProxy ( ) viewcnt = 0 while ssp : if not ssp . HasAnnotation ( "enabled" ) or not ( ssp . GetAnnotation ( "enabled" ) == '1' ) : ssp = ed . GetNextScreenshotProxy ( ) continue freq = ssp . GetProperty ( "WriteFrequency" ) . GetElement ( 0 ) if tstep % freq == 0 : fname = ssp . GetProperty ( "CatalystFilePattern" ) . GetElement ( 0 ) if fname . endswith ( "cdb" ) : CINAC = __CinemaACHelper ( image_root_directory , rendering_info , cinema_tracks , cinema_arrays ) # special treatment for cinema image data bases CINAC . ExportNow ( tnow ) # don't forget to tell cinema D about it CIND . AppendCViewToCinemaDTable ( tnow , "cview_%s" % viewcnt , CINAC . NewFiles ) else : fnamefilled = image_root_directory + fname . replace ( "%t" , padded_tstep ) # save the screenshot ssp . WriteImage ( fnamefilled ) # don't forget to tell cinema D about it CIND . AppendToCinemaDTable ( tnow , "view_%s" % viewcnt , fnamefilled ) ssp = ed . GetNextScreenshotProxy ( ) viewcnt = viewcnt + 1 tstep = tstep + 1 s . GoToNext ( ) tnow = s . AnimationTime # destroy array culling filters for x in helpers : Delete ( x ) # defer actual cinema D output until the end because we only know now what the full set of cinema D columns actually are CIND . Finalize ( )