parameters: (
          exoFrom,
          exo_to,
          array_type='ctype',
          additionalGlobalVariables=[],
          additionalNodalVariables=[],
          additionalElementVariables=[],
          additionalNodeSetVariables=[],
          additionalSideSetVariables=[])
return_statement: return exo_to
docstring: This function transfers variables from `exoFrom` to `exo_to` and allows
      additional variables to be added with `additionalGlobalVariables`,
      `additionalNodalVariables`, and `additionalElementVariables`.  Additional
      variables values are set to their defaults so that the user can populate
      them later.
  
      Parameters
      ----------
      exoFrom : exodus database object
          exodus object to transfer from
  
      exo_to : exodus database object
          exodus object to transfer to
  
      additionalGlobalVariables : list
          list of global variable names to add.
  
      additionalNodalVariables : list
          list of nodal variable names to add.
  
      additionalElementVariables : list
          should be a list of element variable names to add to all blocks or
          tuples `(name, blkIds)` where `name` is the element variable to add
          and `blkIds` is a list of block ids to add it to.
docstring_summary: This function transfers variables from `exoFrom` to `exo_to` and allows
      additional variables to be added with `additionalGlobalVariables`,
      `additionalNodalVariables`, and `additionalElementVariables`.  Additional
      variables values are set to their defaults so that the user can populate
      them later.
docstring_tokens: This function transfers variables from exoFrom to exo_to and allows additional variables to be added with additionalGlobalVariables additionalNodalVariables and additionalElementVariables . Additional variables values are set to their defaults so that the user can populate them later .
function: def transfer_variables(
          exoFrom,
          exo_to,
          array_type='ctype',
          additionalGlobalVariables=[],
          additionalNodalVariables=[],
          additionalElementVariables=[],
          additionalNodeSetVariables=[],
          additionalSideSetVariables=[]):
      """
      This function transfers variables from `exoFrom` to `exo_to` and allows
      additional variables to be added with `additionalGlobalVariables`,
      `additionalNodalVariables`, and `additionalElementVariables`.  Additional
      variables values are set to their defaults so that the user can populate
      them later.
  
      Parameters
      ----------
      exoFrom : exodus database object
          exodus object to transfer from
  
      exo_to : exodus database object
          exodus object to transfer to
  
      additionalGlobalVariables : list
          list of global variable names to add.
  
      additionalNodalVariables : list
          list of nodal variable names to add.
  
      additionalElementVariables : list
          should be a list of element variable names to add to all blocks or
          tuples `(name, blkIds)` where `name` is the element variable to add
          and `blkIds` is a list of block ids to add it to.
      """
      # IDEA: It may make sense to make transfer_variables() strictly transfer
      # variables, and use add_variables() to add new variables.  Alternatively,
      # add_variables() could be called within transfer_variables() to add
      # new variables to the exo_to database.  Either way, we should minimize
      # duplicate code if possible.
  
      debugPrint = False
  
      if not isinstance(additionalGlobalVariables, list):
          raise Exception("ERROR: additionalGlobalVariables is not a list.")
      if not isinstance(additionalNodalVariables, list):
          raise Exception("ERROR: additionalNodalVariables is not a list.")
      if not isinstance(additionalElementVariables, list):
          raise Exception("ERROR: additionalElementVariables is not a list.")
      if not isinstance(additionalNodeSetVariables, list):
          raise Exception("ERROR: additionalNodeSetVariables is not a list.")
      if not isinstance(additionalSideSetVariables, list):
          raise Exception("ERROR: additionalSideSetVariables is not a list.")
  
      if debugPrint:
          print("Transfer Info records")
      numInfoRecs = exoFrom.num_info_records()
      if numInfoRecs > 0:
          infoRecs = exoFrom.get_info_records()
          exo_to.put_info_records(infoRecs)
      if debugPrint:
          print("Transfer time values")
  
      nSteps = exoFrom.num_times()
      if nSteps == 0:
          return exo_to
  
      timeVals = exoFrom.get_times()
      for step in range(nSteps):
          exo_to.put_time(step + 1, timeVals[step])
  
      if debugPrint:
          print("Add Global Variables")
      nNewGlobalVars = len(additionalGlobalVariables)
      nGlobalVars = exoFrom.get_variable_number('EX_GLOBAL') + nNewGlobalVars
      defaultNewVarVals = []
      for _i in range(nNewGlobalVars):
          defaultNewVarVals.append(0.0)
      if nGlobalVars > 0:
          exo_to.set_variable_number('EX_GLOBAL', nGlobalVars)
          gVarNames = exoFrom.get_variable_names('EX_GLOBAL')
          gVarNames.extend(additionalGlobalVariables)
          for nameIndex in range(nGlobalVars):
              globalVarName = gVarNames[nameIndex]
              exo_to.put_variable_name('EX_GLOBAL', globalVarName, nameIndex + 1)
          for step in range(nSteps):
              gValues = exoFrom.get_all_global_variable_values(step + 1)
              if array_type == 'numpy':
                  gValues = exo_to.np.append(gValues, defaultNewVarVals)
              else:
                  gValues.extend(defaultNewVarVals)
              exo_to.put_all_global_variable_values(step + 1, gValues)
  
      if debugPrint:
          print("Add Nodal Variables")
      nNewNodalVars = len(additionalNodalVariables)
      nOrigNodalVars = exoFrom.get_variable_number('EX_NODAL')
      nNodalVars = nOrigNodalVars + nNewNodalVars
      if nNodalVars > 0:
          exo_to.set_variable_number('EX_NODAL', nNodalVars)
          nVarNames = exoFrom.get_variable_names('EX_NODAL')
          nVarNames.extend(additionalNodalVariables)
          for nameIndex in range(nNodalVars):
              nodalVarName = nVarNames[nameIndex]
              exo_to.put_variable_name('EX_NODAL', nodalVarName, nameIndex + 1)
              if nameIndex < nOrigNodalVars:
                  for step in range(nSteps):
                      nValues = exoFrom.get_node_variable_values(
                          nodalVarName, step + 1)
                      exo_to.put_node_variable_values(
                          nodalVarName, step + 1, nValues)
  
      internal_transfer_variables(exoFrom, exo_to, 'EX_ELEM_BLOCK', additionalElementVariables, debugPrint)
      internal_transfer_variables(exoFrom, exo_to, 'EX_NODE_SET', additionalNodeSetVariables, debugPrint)
      internal_transfer_variables(exoFrom, exo_to, 'EX_SIDE_SET', additionalSideSetVariables, debugPrint)
      return exo_to
function_tokens: def transfer_variables ( exoFrom , exo_to , array_type = 'ctype' , additionalGlobalVariables = [ ] , additionalNodalVariables = [ ] , additionalElementVariables = [ ] , additionalNodeSetVariables = [ ] , additionalSideSetVariables = [ ] ) : # IDEA: It may make sense to make transfer_variables() strictly transfer # variables, and use add_variables() to add new variables.  Alternatively, # add_variables() could be called within transfer_variables() to add # new variables to the exo_to database.  Either way, we should minimize # duplicate code if possible. debugPrint = False if not isinstance ( additionalGlobalVariables , list ) : raise Exception ( "ERROR: additionalGlobalVariables is not a list." ) if not isinstance ( additionalNodalVariables , list ) : raise Exception ( "ERROR: additionalNodalVariables is not a list." ) if not isinstance ( additionalElementVariables , list ) : raise Exception ( "ERROR: additionalElementVariables is not a list." ) if not isinstance ( additionalNodeSetVariables , list ) : raise Exception ( "ERROR: additionalNodeSetVariables is not a list." ) if not isinstance ( additionalSideSetVariables , list ) : raise Exception ( "ERROR: additionalSideSetVariables is not a list." ) if debugPrint : print ( "Transfer Info records" ) numInfoRecs = exoFrom . num_info_records ( ) if numInfoRecs > 0 : infoRecs = exoFrom . get_info_records ( ) exo_to . put_info_records ( infoRecs ) if debugPrint : print ( "Transfer time values" ) nSteps = exoFrom . num_times ( ) if nSteps == 0 : return exo_to timeVals = exoFrom . get_times ( ) for step in range ( nSteps ) : exo_to . put_time ( step + 1 , timeVals [ step ] ) if debugPrint : print ( "Add Global Variables" ) nNewGlobalVars = len ( additionalGlobalVariables ) nGlobalVars = exoFrom . get_variable_number ( 'EX_GLOBAL' ) + nNewGlobalVars defaultNewVarVals = [ ] for _i in range ( nNewGlobalVars ) : defaultNewVarVals . append ( 0.0 ) if nGlobalVars > 0 : exo_to . set_variable_number ( 'EX_GLOBAL' , nGlobalVars ) gVarNames = exoFrom . get_variable_names ( 'EX_GLOBAL' ) gVarNames . extend ( additionalGlobalVariables ) for nameIndex in range ( nGlobalVars ) : globalVarName = gVarNames [ nameIndex ] exo_to . put_variable_name ( 'EX_GLOBAL' , globalVarName , nameIndex + 1 ) for step in range ( nSteps ) : gValues = exoFrom . get_all_global_variable_values ( step + 1 ) if array_type == 'numpy' : gValues = exo_to . np . append ( gValues , defaultNewVarVals ) else : gValues . extend ( defaultNewVarVals ) exo_to . put_all_global_variable_values ( step + 1 , gValues ) if debugPrint : print ( "Add Nodal Variables" ) nNewNodalVars = len ( additionalNodalVariables ) nOrigNodalVars = exoFrom . get_variable_number ( 'EX_NODAL' ) nNodalVars = nOrigNodalVars + nNewNodalVars if nNodalVars > 0 : exo_to . set_variable_number ( 'EX_NODAL' , nNodalVars ) nVarNames = exoFrom . get_variable_names ( 'EX_NODAL' ) nVarNames . extend ( additionalNodalVariables ) for nameIndex in range ( nNodalVars ) : nodalVarName = nVarNames [ nameIndex ] exo_to . put_variable_name ( 'EX_NODAL' , nodalVarName , nameIndex + 1 ) if nameIndex < nOrigNodalVars : for step in range ( nSteps ) : nValues = exoFrom . get_node_variable_values ( nodalVarName , step + 1 ) exo_to . put_node_variable_values ( nodalVarName , step + 1 , nValues ) internal_transfer_variables ( exoFrom , exo_to , 'EX_ELEM_BLOCK' , additionalElementVariables , debugPrint ) internal_transfer_variables ( exoFrom , exo_to , 'EX_NODE_SET' , additionalNodeSetVariables , debugPrint ) internal_transfer_variables ( exoFrom , exo_to , 'EX_SIDE_SET' , additionalSideSetVariables , debugPrint ) return exo_to