parameters: (self)
return_statement: return res
docstring: gather trace for the writer proxies that are not in the trace pipeline but
          rather in the new export state.
docstring_summary: gather trace for the writer proxies that are not in the trace pipeline but
          rather in the new export state.
docstring_tokens: gather trace for the writer proxies that are not in the trace pipeline but rather in the new export state .
function: def make_trace(self):
          """gather trace for the writer proxies that are not in the trace pipeline but
          rather in the new export state.
          """
          res = []
          res.append("")
          res.append("# Now any catalyst writers")
          pxm = servermanager.ProxyManager()
          globalepxy = pxm.GetProxy("export_global", "catalyst")
          exports = pxm.GetProxiesInGroup("export_writers") #todo should use ExportDepot
          for x in exports:
              xs = x[0]
              pxy = pxm.GetProxy('export_writers', xs)
              if not pxy.HasAnnotation('enabled'):
                  continue
  
              xmlname = pxy.GetXMLName()
              if xmlname == "Cinema image options":
                  # skip the array and property export information we stuff in this proxy
                  continue
  
              # note: this logic is not truly correct. the way this is setup,
              # there is no good way to really find the variable name used for the input since the names
              # that smtrace assigns are already cleaned up at this point.
              # Ideally, this class should have been written as a true `Accessor` so it could
              # be traced correctly. Right now, I am hacking this to attempt to get a reasonable name
              # that works in most cases.
              inputname = xs.split('|')[0]
              inputname = servermanager._make_name_valid(inputname)
              inputname = inputname[0].lower() + inputname[1:]
  
              writername = xs.split('|')[1]
  
              xmlgroup = pxy.GetXMLGroup()
  
              padding_amount = globalepxy.GetProperty("FileNamePadding").GetElement(0)
              write_frequency = pxy.GetProperty("WriteFrequency").GetElement(0)
              filename = pxy.GetProperty("CatalystFilePattern").GetElement(0)
  
              cpstate_globals = get_globals()
              sim_inputs = locate_simulation_inputs(pxy)
              for sim_input_name in sim_inputs:
                  if not write_frequency in cpstate_globals.write_frequencies[sim_input_name]:
                      cpstate_globals.write_frequencies[sim_input_name].append(write_frequency)
                      cpstate_globals.write_frequencies[sim_input_name].sort()
  
                  if not sim_input_name in cpstate_globals.channels_needed:
                      cpstate_globals.channels_needed.append(sim_input_name)
  
              prototype = pxm.GetPrototypeProxy(xmlgroup, xmlname)
              if not prototype:
                  varname = self.__make_name(xmlname)
              else:
                  varname = self.__make_name(prototype.GetXMLLabel())
              # Write pass array proxy
              if pxy.GetProperty("ChooseArraysToWrite").GetElement(0) == 1:
                  point_arrays = []
                  cell_arrays = []
                  arrays_property = pxy.GetProperty("PointDataArrays")
                  for i in range(arrays_property.GetNumberOfElements()):
                      point_arrays.append(arrays_property.GetElement(i))
                  arrays_property = pxy.GetProperty("CellDataArrays")
                  for i in range(arrays_property.GetNumberOfElements()):
                      cell_arrays.append(arrays_property.GetElement(i))
                  f = "%s_arrays = PassArrays(Input=%s, PointDataArrays=%s, CellDataArrays=%s)" % \
                      (inputname, inputname, str(point_arrays), str(cell_arrays))
                  inputname = "%s_arrays" % inputname
                  res.append(f)
              # Actual writer
              f = "%s = servermanager.writers.%s(Input=%s)" % (varname, writername, inputname)
              res.append(f)
              # set various writer properties, except for the filename since that will be set later.
              # point, cell and field arrays should already be set
              notNeededProperties = ['CatalystFilePattern', 'CellDataArrays', 'ChooseArraysToWrite', 'EdgeDataArrays',
                                     'FieldDataArrays', 'FileName', 'FileNameSuffix', 'Filenamesuffix', 'Input',
                                     'PointDataArrays', 'WriteFrequency',]
              for p in pxy.ListProperties():
                  if p not in notNeededProperties and len(pxy.GetProperty(p)):
                      if isinstance(pxy.GetProperty(p).GetData(), servermanager.Proxy):
                          proxyvalue = pxy.GetProperty(p).GetData()
                          cpstate_globals = get_globals()
                          if proxyvalue in cpstate_globals.variable_to_name_map:
                              f = "%s.%s = %s" % (varname, p, cpstate_globals.variable_to_name_map[proxyvalue])
                              res.append(f)
                      elif hasattr(pxy.GetProperty(p), 'GetElement'):
                          value = pxy.GetProperty(p).GetElement(0)
                          if isinstance(value, numbers.Number):
                              f = "%s.%s = %s" % (varname, p, value)
                          elif  isinstance(value, str):
                              f = "%s.%s = '%s'" % (varname, p, value)
                          else:
                              f = "%s.%s = %s" % (varname, p, str(value))
                          res.append(f)
  
              if self.__make_temporal_script:
                  f = "STP.RegisterWriter(%s, '%s', tp_writers)" % (
                      varname, filename)
              else:
                  f = "coprocessor.RegisterWriter(%s, filename='%s', freq=%s, paddingamount=%s)" % (
                      varname, filename, write_frequency, padding_amount)
              res.append(f)
              res.append("")
          if len(res) == 2:
              return [] # don't clutter output if there are no writers
          return res
function_tokens: def make_trace ( self ) : res = [ ] res . append ( "" ) res . append ( "# Now any catalyst writers" ) pxm = servermanager . ProxyManager ( ) globalepxy = pxm . GetProxy ( "export_global" , "catalyst" ) exports = pxm . GetProxiesInGroup ( "export_writers" ) #todo should use ExportDepot for x in exports : xs = x [ 0 ] pxy = pxm . GetProxy ( 'export_writers' , xs ) if not pxy . HasAnnotation ( 'enabled' ) : continue xmlname = pxy . GetXMLName ( ) if xmlname == "Cinema image options" : # skip the array and property export information we stuff in this proxy continue # note: this logic is not truly correct. the way this is setup, # there is no good way to really find the variable name used for the input since the names # that smtrace assigns are already cleaned up at this point. # Ideally, this class should have been written as a true `Accessor` so it could # be traced correctly. Right now, I am hacking this to attempt to get a reasonable name # that works in most cases. inputname = xs . split ( '|' ) [ 0 ] inputname = servermanager . _make_name_valid ( inputname ) inputname = inputname [ 0 ] . lower ( ) + inputname [ 1 : ] writername = xs . split ( '|' ) [ 1 ] xmlgroup = pxy . GetXMLGroup ( ) padding_amount = globalepxy . GetProperty ( "FileNamePadding" ) . GetElement ( 0 ) write_frequency = pxy . GetProperty ( "WriteFrequency" ) . GetElement ( 0 ) filename = pxy . GetProperty ( "CatalystFilePattern" ) . GetElement ( 0 ) cpstate_globals = get_globals ( ) sim_inputs = locate_simulation_inputs ( pxy ) for sim_input_name in sim_inputs : if not write_frequency in cpstate_globals . write_frequencies [ sim_input_name ] : cpstate_globals . write_frequencies [ sim_input_name ] . append ( write_frequency ) cpstate_globals . write_frequencies [ sim_input_name ] . sort ( ) if not sim_input_name in cpstate_globals . channels_needed : cpstate_globals . channels_needed . append ( sim_input_name ) prototype = pxm . GetPrototypeProxy ( xmlgroup , xmlname ) if not prototype : varname = self . __make_name ( xmlname ) else : varname = self . __make_name ( prototype . GetXMLLabel ( ) ) # Write pass array proxy if pxy . GetProperty ( "ChooseArraysToWrite" ) . GetElement ( 0 ) == 1 : point_arrays = [ ] cell_arrays = [ ] arrays_property = pxy . GetProperty ( "PointDataArrays" ) for i in range ( arrays_property . GetNumberOfElements ( ) ) : point_arrays . append ( arrays_property . GetElement ( i ) ) arrays_property = pxy . GetProperty ( "CellDataArrays" ) for i in range ( arrays_property . GetNumberOfElements ( ) ) : cell_arrays . append ( arrays_property . GetElement ( i ) ) f = "%s_arrays = PassArrays(Input=%s, PointDataArrays=%s, CellDataArrays=%s)" % ( inputname , inputname , str ( point_arrays ) , str ( cell_arrays ) ) inputname = "%s_arrays" % inputname res . append ( f ) # Actual writer f = "%s = servermanager.writers.%s(Input=%s)" % ( varname , writername , inputname ) res . append ( f ) # set various writer properties, except for the filename since that will be set later. # point, cell and field arrays should already be set notNeededProperties = [ 'CatalystFilePattern' , 'CellDataArrays' , 'ChooseArraysToWrite' , 'EdgeDataArrays' , 'FieldDataArrays' , 'FileName' , 'FileNameSuffix' , 'Filenamesuffix' , 'Input' , 'PointDataArrays' , 'WriteFrequency' , ] for p in pxy . ListProperties ( ) : if p not in notNeededProperties and len ( pxy . GetProperty ( p ) ) : if isinstance ( pxy . GetProperty ( p ) . GetData ( ) , servermanager . Proxy ) : proxyvalue = pxy . GetProperty ( p ) . GetData ( ) cpstate_globals = get_globals ( ) if proxyvalue in cpstate_globals . variable_to_name_map : f = "%s.%s = %s" % ( varname , p , cpstate_globals . variable_to_name_map [ proxyvalue ] ) res . append ( f ) elif hasattr ( pxy . GetProperty ( p ) , 'GetElement' ) : value = pxy . GetProperty ( p ) . GetElement ( 0 ) if isinstance ( value , numbers . Number ) : f = "%s.%s = %s" % ( varname , p , value ) elif isinstance ( value , str ) : f = "%s.%s = '%s'" % ( varname , p , value ) else : f = "%s.%s = %s" % ( varname , p , str ( value ) ) res . append ( f ) if self . __make_temporal_script : f = "STP.RegisterWriter(%s, '%s', tp_writers)" % ( varname , filename ) else : f = "coprocessor.RegisterWriter(%s, filename='%s', freq=%s, paddingamount=%s)" % ( varname , filename , write_frequency , padding_amount ) res . append ( f ) res . append ( "" ) if len ( res ) == 2 : return [ ] # don't clutter output if there are no writers return res