PCL Examples > Results Postprocessing Functions > Results Utility Functions
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Results Utility Functions
This section contains examples of some of the results utility functions used to extract results data and attributes of results data from the database.
   
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_elem_pos_ids()
#
#                      This session file extracts the internal element
#                      position id for the specified element.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
# 
#  The function res_utl_extract_elem_pos_ids()
#  has the following arguments:
#
#  res_utl_extract_elem_pos_ids
#     (  res_ids,
#        elem_list,
#        count,
#        ids,
#        npos,
#        posids )
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER  ia_res_ids(5)
STRING   s_elem_list[10]
INTEGER  i_count
INTEGER  iv_ids(VIRTUAL)
INTEGER  iv_npos(VIRTUAL)
INTEGER  iv_posids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#--------------------------------------------------------------------
# Argument initialization
ia_res_ids         = [3, 1, 2, 1, 1]
s_elem_list        = "Elem 77"
#---------------------------------------------------------------------
# Extract the result data for one element
i_return_value =                                 @
   res_utl_extract_elem_pos_ids                  @
      (  ia_res_ids,                             @
         s_elem_list,                            @
         i_count,                                @
         iv_ids,                                 @
         iv_npos,                                @
         iv_posids )
dump i_return_value
dump i_count
# This value shows the number of elements 
dump iv_ids
# This shows list of element ids
dump iv_npos
# This shows the number of element positions per element
dump iv_posids
# This shows element position ids for the specified elements
sys_free_array(iv_ids)
sys_free_array(iv_npos)
sys_free_array(iv_posids)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_elem_pos_loc()
#
#                      This session file extracts specified results 
#                      from the database. It gives XYZ coordinates of
#                      node belonging to specific element.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file 
#                      through the "File","Session","Play" pulldown 
#                      menus on the menu bar.
#
#  The function res_utl_get_elem_pos_loc()
#  has the following arguments:
#
#  res_utl_get_elem_pos_loc
#     (  elem_id,
#        param_flag,
#        epos_id,
#        location )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_elem_id
INTEGER  i_param_flag
INTEGER  i_epos_id
REAL     ra_location(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_elem_id      = 100
i_param_flag   = 0
i_epos_id      = 2 
#---------------------------------------------------------------------
# Extract element position location for an element
i_return_value =                                 @
   res_utl_get_elem_pos_loc                      @
      (  i_elem_id,                              @
         i_param_flag,                           @
         i_epos_id,                              @
         ra_location )
dump i_return_value
dump ra_location
# These are the XYZ coordinates of the 2nd node of element 100.
#---------------------------------------------------------------------
   
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_result_info()
#
#                      This session file extracts information about
#                      the specified results from the database. It
#                      gives title, number and type of results etc.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_get_result_info()
#  has the following arguments:
#
#  res_utl_get_result_info
#     (  res_ids,
#        title,
#        nres,
#        datatype,
#        assoc,
#        resloc,
#        cidflag,
#        minloc,
#        maxloc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
STRING   sa_title[80](3)
INTEGER  i_nres
INTEGER  i_datatype
INTEGER  i_assoc
INTEGER  i_resloc
LOGICAL  l_cidflag
INTEGER  iaa_minloc(2,6)
INTEGER  iaa_maxloc(2,6)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids   = [3, 1, 2, 1, 1]
#---------------------------------------------------------------------
# Extract information about the specified result case
i_return_value =                                 @
   res_utl_get_result_info                       @
      (  ia_res_ids,                             @
         sa_title,                               @
         i_nres,                                 @
         i_datatype,                             @
         i_assoc,                                @
         i_resloc,                               @
         l_cidflag,                              @
         iaa_minloc,                             @
         iaa_maxloc )
dump i_return_value
dump sa_title
# This shows title of the result
dump i_nres
# This shows total number of results
dump i_datatype
# This value shows that results are associated with vector 
dump i_assoc
# This value shows that results are associated with nodes
dump i_resloc
# This value shows the result location
dump l_cidflag
# This shows that results are defined in non-global system
dump iaa_minloc
# This shows id and location for each minimum result component
dump iaa_maxloc
# This shows id and location for each maximum result component
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_clear_result()
#
#                      This session file clears previously used
#                      results from memory.
# 
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_clear_result() has no arguments.
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
INTEGER  i_type
INTEGER  i_nids
INTEGER  ia_ids(1)
INTEGER  ia_cids(1)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids    = [3, 1, 2, 1, 1]
i_type        = 1 
i_nids        = 1
ia_ids        = [100]
#---------------------------------------------------------------------
# Clear any previous results from the memory
i_return_value =                                 @
   res_utl_clear_result()
dump i_return_value
#---------------------------------------------------------------------
# Extract cids for the specified nodes
i_return_value =                                 @
   res_utl_get_results_cids                      @
      (  ia_res_ids, i_type, i_nids, ia_ids, ia_cids )
dump i_return_value
dump ia_cids
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_result_entities()
#
#                      This session file extracts specified results
#                      from the database. It gives the list of ids for
#                      which specified result exists.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_get_result_entities()
#  has the following arguments:
#
#  res_utl_get_result_entities
#     (  res_ids,
#        id_list )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
STRING   sv_id_list[VIRTUAL]
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids     = [3, 1, 2, 1, 1]
#---------------------------------------------------------------------
# Gets the result entities
i_return_value =                                 @
   res_utl_get_result_entities                   @
      (  ia_res_ids,                             @
         sv_id_list )
dump i_return_value
dump sv_id_list
# This shows the list of ids for which specified results exists
sys_free_string(sv_id_list)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_result_type()
#
#                      This session file extracts specified results
#                      from the database. It returns a value 
#                      which shows the type of result i.e. scaler,
#                      vector or tensor.
#                      
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar. 
#
#  The function res_utl_get_result_type()
#  has the following arguments:
#
#  res_utl_get_result_type
#     (  res_ids,
#        type )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
INTEGER  i_type
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids    = [3, 1, 2, 1, 1]
#---------------------------------------------------------------------
# Extract the tupe of result
i_return_value =                                 @
   res_utl_get_result_type                       @
      (  ia_res_ids,                             @
         i_type )
dump i_return_value
dump i_type
# This value shows type of result, 1 = scaler, 2 = vector 3 = tensor.
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_result_cids()
#
#                      This session file shows cids used for result
#                      defined at the specified node.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
# 
#  The function res_utl_get_result_cids()
#  has the following arguments:
#
#  res_utl_get_result_cids
#     (  res_ids,
#        type,
#        nids,
#        ids,
#        cids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
INTEGER  i_type
INTEGER  i_nids
INTEGER  ia_ids(1)
INTEGER  ia_cids(1)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids    = [3, 1, 2, 1, 1]
i_type        = 1 
i_nids        = 1
ia_ids        = [100]
#---------------------------------------------------------------------
# Clear any previous results from the memory
i_return_value = res_utl_clear_result()
dump i_return_value
#---------------------------------------------------------------------
# Extract cids for the specified nodes
i_return_value =                                 @
   res_utl_get_results_cids                      @
      (  ia_res_ids,                             @
         i_type,                                 @
         i_nids,                                 @
         ia_ids,                                 @
         ia_cids )
dump i_return_value
dump ia_cids
#---------------------------------------------------------------------
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_nodal_results()
#
#                      This session file extracts specified results
#                      from the database. It gives the result at each
#                      node along with the type of result, node ids, 
#                      minimum and maximum values of results within
#                      specified nodes.
#                       
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_extract_nodal_results()
#  has the following arguments:
#
#  res_utl_extract_nodal_results
#     (  res_ids,
#        node_list,
#        derivation,
#        cid,
#        datatype,
#        nres,
#        ids,
#        results,
#        minloc,
#        maxloc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
STRING   s_node_list[15]
STRING   s_derivation[5]
STRING   s_cid[1]
INTEGER  i_datatype
INTEGER  i_nres
INTEGER  iv_ids(VIRTUAL)
REAL     rv_results(VIRTUAL)
INTEGER  ia_minloc(6)
INTEGER  ia_maxloc(6)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids       = [3, 1, 2, 1, 1]
s_node_list      = "Node 10:20"
s_derivation     = "MAG" 
s_cid            = ""
#---------------------------------------------------------------------
# Extract the result data for specified nodes
i_return_value =                                 @
   res_utl_extract_nodal_results                 @
      (  ia_res_ids,                             @
         s_node_list,                            @
         s_derivation,                           @
         s_cid,                                  @
         i_datatype,                             @
         i_nres,                                 @
         iv_ids,                                 @
         rv_results,                             @
         ia_minloc,                              @
         ia_maxloc )
dump i_return_value
dump i_datatype
# This value shows type of result
dump i_nres
# This value shows number of node ids
dump iv_ids
# This shows list of node ids
dump rv_results
# This shows magnitude of results at the specified nodes
dump ia_minloc
# This value shows minimum result component
dump ia_maxloc
# This value shows maximum result component 
sys_free_array(iv_ids)
sys_free_array(rv_results)
#---------------------------------------------------------------------
 
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_nodal_history()
#
#                      This session file extracts specified results
#                      from the database. It gives the result at each
#                      node along with the type of result, node ids.
#                      It also gives load case/subcase id array index
#                      for each node maximum and minimum result 
#                      component.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_extract_nodal_history()
#  has the following arguments:
#
#  res_utl_extract_nodal_history
#     (  nlcs,
#        lcids,
#        subids,
#        res_ids,
#        node_list,
#        derivation,
#        cid,
#        datatype,
#        nres,
#        ids,
#        results,
#        minloc,
#        maxloc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nlcs
INTEGER  ia_lcids(2)
INTEGER  ia_subids(2)
INTEGER  ia_res_ids(3)
STRING   s_node_list[15]
STRING   s_derivation[5]
STRING   s_cid[2]
INTEGER  i_datatype
INTEGER  i_nres
INTEGER  iv_ids(VIRTUAL)
REAL     rv_results(VIRTUAL)
INTEGER  iv_minloc(VIRTUAL)
INTEGER  iv_maxloc(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_nlcs        = 2 
ia_lcids      = [3, 4]
ia_subids     = [1, 2]
ia_res_ids    = [2, 1, 1]
s_node_list   = "Node 10:20"
s_derivation  = "MAG" 
s_cid         = ""
#---------------------------------------------------------------------
# Extract the result data for specified nodes
i_return_value =                                 @
   res_utl_extract_nodal_history                 @
      (  i_nlcs,                                 @
         ia_lcids,                               @
         ia_subids,                              @
         ia_res_ids,                             @
         s_node_list,                            @
         s_derivation,                           @
         s_cid,                                  @
         i_datatype,                             @
         i_nres,                                 @
         iv_ids,                                 @
         rv_results,                             @
         iv_minloc,                              @
         iv_maxloc )
dump i_return_value
dump i_datatype
# This value shows type of result
dump i_nres
# This value shows number of node ids
dump iv_ids
# This shows list of node ids
dump rv_results
# These values shows the results associated with the specified nodes
dump iv_minloc
# This shows load case/subcase id array index for each node minimum
# result component
dump iv_maxloc
# This shows load case/subcase id array index for each node maximum
# result component
sys_free_array(iv_ids)
sys_free_array(rv_results)
sys_free_array(iv_minloc)
sys_free_array(iv_maxloc)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_create_nodal_result()
#
#                      This session file creates new result case and
#                      writes to the database. The new result case is
#                      then displayed in the viewport.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_create_nodal_result()
#  has the following arguments:
#
#  res_utl_create_nodal_result
#     (  res_ids,
#        prim_title,
#        sec_title,
#        nids,
#        ids,
#        cid_list,
#        datatype,
#        results )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i
INTEGER  ia_res_ids(5)
STRING   s_prim_title[80]
STRING   s_sec_title[80]
INTEGER  i_nids
INTEGER  iv_ids(VIRTUAL)
STRING   s_cid_list[10]
INTEGER  i_datatype
REAL     rv_new_results(VIRTUAL)
INTEGER  i_return_value
INTEGER  i_nres
INTEGER  ia_minloc(6)
INTEGER  ia_maxloc(6)
REAL     rv_results(VIRTUAL)
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Extracts the existing results
i_return_value    =                              @
   res_utl_extract_nodal_results( [4, 2, 2, 1,   @
      1], "Node 1:#", "MAG", "", i_datatype,     @
      i_nres, iv_ids, rv_results, ia_minloc, ia_maxloc )
dump i_return_value
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids    = [4, 2, 0, 0, 1]
s_prim_title  = "New result case"
s_sec_title   = "Displacement"
i_nids        = i_nres
s_cid_list    = ""
#---------------------------------------------------------------------
# Creates new result values twice the older values
sys_allocate_array(rv_new_results, 1, i_nres)
FOR (i = 1 TO i_nres)
   rv_new_results(i) =  2 * rv_results(i)
END FOR
#---------------------------------------------------------------------
# Creates new result case
i_return_value =                                 @
   res_utl_create_nodal_result                   @
      (  ia_res_ids,                             @
         s_prim_title,                           @
         s_sec_title,                            @
         i_nids,                                 @
         iv_ids,                                 @
         s_cid_list,                             @
         i_datatype,                             @
         rv_new_results )
dump i_return_value
#---------------------------------------------------------------------
# Creates the plot
i_return_value =                                 @
   res_data_load_dbresult( 0, "Nodal", "Scalar", @
      "SPOOL_LOADS", "Static Subcase",           @
      "New result case", "Displacement",         @
      "(NON-LAYERED)", "", "Default",            @
      "DeriveAverage", "All", "ShapeFunc" )
dump i_return_value
 
i_return_value =                                 @
   res_data_title( 0, "Nodal", "Scalar", 1,      @
      [ "SPOOL_LOADS, Static Subcase: New result @
      case, Displacement-(NON-LAYERED) "] )
dump i_return_value
 
i_return_value =                                 @
   res_display_fringe_create( "", "FreeFaces", 0,@
      [""], 12, [ "Range:Fri_default_Fringe",    @
      "RangeOverwrite:ON",                       @
      "FringeStyle:Discrete/Smooth" ,            @
      "Shade:None",                              @
      "ElemEdge:FreeEdge,Blue,Solid,1",          @
      "Shrink:0", "TitleDisplay:ON",             @
      "MinMaxDisplay:ON", "ValueDisplay:OFF",    @
      "Filter:None", "ScaleFactor:1.",           @
      "LabelStyle:Exponential, 12, White, 3"], TRUE )
dump i_return_value
 
i_return_value =                                 @
   res_display_fringe_post( "", 0, "Nodal", TRUE, TRUE )
dump i_return_value
 
sys_free_array(iv_ids)
sys_free_array(rv_new_results)
sys_free_array(rv_results)
#---------------------------------------------------------------------
 
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_elem_results()
#
#                      This session file extracts specified results
#                      from the database. It gives the result at each
#                      elements along with the type of result, element
#                      ids.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_extract_elem_results()
#  has the following arguments:
#
#  res_utl_extract_elem_results
#     (  res_ids,
#        elem_list,
#        derivation,
#        location,
#        cid,
#        datatype,
#        resloc,
#        nres,
#        ids,
#        nresults,
#        results,
#        minloc,
#        maxloc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
STRING   s_elem_list[12], s_derivation[5], s_location[10], s_cid[2]
INTEGER  i_datatype, i_resloc, i_nres, iv_ids(VIRTUAL)
INTEGER  iv_nresults(VIRTUAL) 
INTEGER  i_return_value, iv_minloc(VIRTUAL), iv_maxloc(VIRTUAL) 
REAL     rv_results(VIRTUAL)
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids     = [3, 1, 2, 1, 1]
s_elem_list    = "Elem 295:305"
s_derivation   = "MAG"
s_location     = "N[odal]"
s_cid          = ""
#---------------------------------------------------------------------
# Extract the result data for specified elements
i_return_value =                                 @
   res_utl_extract_elem_results                  @
      (  ia_res_ids,                             @
         s_elem_list,                            @
         s_derivation,                           @
         s_location,                             @
         s_cid,                                  @
         i_datatype,                             @
         i_resloc,                               @
         i_nres,                                 @
         iv_ids,                                 @
         iv_nresults,                            @
         rv_results,                             @
         iv_minloc,                              @
         iv_maxloc )
dump i_return_value
dump i_datatype
# This value shows type of result, 1=scaler, 2=vector, 3=tensor
dump i_resloc
# This value returns the result location, 1=centroid, 2=nodal
# 3=multiple. 
dump i_nres
# This value shows the number of elements selected
dump iv_ids
# This shows list of element ids
dump iv_nresults
# This value shows number of results per element.
dump rv_results
# This value shows all the results at the specified element locations
dump iv_minloc
# This shows an array index for each minimum result component
dump iv_maxloc
# This shows an array index for each maximum result component
sys_free_array(iv_ids)
sys_free_array(iv_nresults)
sys_free_array(rv_results)
sys_free_array(iv_minloc)
sys_free_array(iv_maxloc)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_elem_history()
#
#                      This session file extracts specified results
#                      from the database. It gives the result at each
#                      element along with the type of result, element 
#                      ids. It also gives an array index for each 
#                      minimum and maximum element result component. 
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the 
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
# 
#  The function res_utl_extract_elem_history()
#  has the following arguments:
#
#  res_utl_extract_elem_history
#     (  nlcs,
#        lcids,
#        subids,
#        res_ids,
#        elem_list,
#        derivation,
#        location,
#        cid,
#        datatype,
#        resloc,
#        nres,
#        ids,
#        nresults,
#        results,
#        minloc,
#        maxloc )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nlcs, ia_lcids(2), ia_subids(2), ia_res_ids(3)
STRING   s_elem_list[12], s_derivation[12], s_location[12], s_cid[12]
INTEGER  i_datatype, i_resloc, i_nres, iv_ids(VIRTUAL)
INTEGER  iv_nresults(VIRTUAL), iv_minloc(VIRTUAL), iv_maxloc(VIRTUAL)
REAL     rv_results(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_nlcs        = 2 
ia_lcids      = [3, 4]
ia_subids     = [1, 2]
ia_res_ids    = [2, 1, 1]
s_elem_list   = "Elem 200"
s_derivation  = "MAG"
s_location    = "C[entroid]"
s_cid         = ""
#---------------------------------------------------------------------
# Clear any previous results from the memory
i_return_value = res_utl_clear_result()
dump i_return_value            
#---------------------------------------------------------------------
# Extract result data for one element from the database 
i_return_value =                                 @
   res_utl_extract_elem_history                  @
      (  i_nlcs,                                 @
         ia_lcids,                               @
         ia_subids,                              @
         ia_res_ids,                             @
         s_elem_list,                            @
         s_derivation,                           @
         s_location,                             @
         s_cid,                                  @
         i_datatype,                             @
         i_resloc,                               @
         i_nres,                                 @
         iv_ids,                                 @
         iv_nresults,                            @
         rv_results,                             @
         iv_minloc,                              @
         iv_maxloc )
dump i_return_value
dump i_datatype
# This shows type of result 1=scaler, 2=vector, 3=tensor 
dump i_resloc
# This shows result location 1=centroid, 2=nodal, 3=multiple
dump i_nres
# This shows the number of element id
dump iv_ids
# This shows list of element ids
dump iv_nresults
# This shows number of results per element
dump rv_results
# This shows result at the specified element
dump iv_minloc
# This shows minimum element result component
dump iv_maxloc
# This shows maximum element result component
sys_free_array(iv_ids)
sys_free_array(iv_nresults)
sys_free_array(rv_results)
sys_free_array(iv_minloc)
sys_free_array(iv_maxloc)
#---------------------------------------------------------------------
   
()
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_create_elem_result() 
#
#                      This session file creates new result case and 
#                      writes to the database. After that the new result 
#                      case can be displayed in the viewport.               
#                      
#                      Before running this session file run spool.ses and
#                      create result file spool.op2 as per the instructions 
#                      given in it. Import this result file spool.op2 into 
#                      spool.db.                    
#                       
#                      This file can be run by starting a session of
#                      Patran, and running this session file through
#                      the "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#
#  The function res_utl_create_elem_result() 
#  has the following arguments:
#
#  res_utl_create_elem_result( resultids,                            @
#                              primary_title,                        @
#                              secondary_title,                      @
#                              nids,                                 @
#                              ids,                                  @ 
#                              cidlist,                              @
#                              datatype,                             @
#                              location,                             @
#                              nresults,                             @
#                              results)
#                              
#
#---------------------------------------------------------------------
# Variable Decleration
 
INTEGER   resultids(5)
STRING    primary_title[80]
STRING    secondary_title[80]
INTEGER   nids 
INTEGER   ids(virtual)
STRING    cidlist[12]
INTEGER   datatype
STRING    location[12]
INTEGER   nresults(VIRTUAL)
REAL      results(VIRTUAL)
 
STRING    elem_list[12]
STRING    derivation[12]
INTEGER   resloc, cnt
INTEGER   min_loc(12), max_loc(12)
INTEGER   nrc, lcids(virtual), subids(virtual)
INTEGER   nres, primary_id(virtual), secondary_id(virtual)
INTEGER   nsub(virtual), nsub1
INTEGER   result_ids(4), nlayers, layerids(VIRTUAL)
STRING    layerlabels[80](VIRTUAL)
INTEGER   i_return_value
 
#---------------------------------------------------------------------
#  Opening the file spool.db
 
uil_file_open.go( "./spool.db") 
 
#---------------------------------------------------------------------
# Clear any previous results from the memory
 
res_utl_clear_result()
 
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
 
res_utl_get_loadcases(nrc, lcids, nsub)
dump nrc, lcids, nsub
 
#---------------------------------------------------------------------
# Gets the subcases
 
res_utl_get_subcases(lcids(1), nsub1, subids)
dump lcids(1), nsub1, subids
 
#---------------------------------------------------------------------
# Gets the result ids
 
res_utl_get_result_ids (  nrc, lcids,                                @
                          subids, nres,                              @
                          primary_id, secondary_id)
 
dump nres, primary_id, secondary_id
dump nrc
dump lcids
dump subids
 
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
 
result_ids(1) = lcids(1)
result_ids(2) = subids(1)
result_ids(3) = primary_id(2)
result_ids(4) = secondary_id(2)
 
res_utl_get_result_layers( result_ids, nlayers,                      @
                           layerids, layerlabels)
 
dump nlayers
dump layerids
dump layerlabels
 
#---------------------------------------------------------------------
# Extracts result data for 10 elements (Elm 1:10) from the database
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = primary_id(2)
resultids(4)    = secondary_id(2)
resultids(5)    = layerids(1)
 
elem_list       = "Elm 1:10"
derivation      = "MAG"
location        = "N[odal"
cidlist         = ""
 
res_utl_extract_elem_results ( resultids,                            @
                               elem_list,                            @
                               derivation,                           @
                               location,                             @
                               cidlist,                              @
                               datatype,                             @
                               resloc,                               @
                               cnt,                                  @
                               ids,                                  @
                               nresults,                             @
                               results,                              @
                               min_loc,                              @
                               max_loc )
 
#---------------------------------------------------------------------
# Dump all extracted results as a output
 
dump datatype
dump resloc
dump cnt
dump ids
dump nresults
dump results 
dump min_loc
dump max_loc 
 
#---------------------------------------------------------------------
# Argument Initialization
 
resultids(1)    = lcids(1)
resultids(2)    = subids(1)
resultids(3)    = 0
resultids(4)    = 0 
resultids(5)    = layerids(1)
 
primary_title   = "NEW RESULT CASE"
secondary_title = "Displacement"
 
nids            = nres
location        = "N[odal"
cidlist         = ""
 
#---------------------------------------------------------------------
# Created new result case in the database as a 
# "NEW RESULT CASE" (Primary load case title) and 
# "DISPLACEMENT" (Secondary load case title)
 
i_return_value =  res_utl_create_elem_result( resultids,             @
                                              primary_title,         @
                                              secondary_title,       @
                                              nids,                  @
                                              ids,                   @
                                              cidlist,               @
                                              datatype,              @
                                              location,              @
                                              nresults,              @
                                              results )
 
#---------------------------------------------------------------------
# Dump the return value of the function and output of the used function.
# The resultids(3) and resultids(4) are created newly.
 
dump i_return_value
dump resultids
 
#---------------------------------------------------------------------
#  Closing the patran environment.
 
uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_extract_path_results()
#
#                      This session file extracts the specified result
#                      data from the database along a specified set
#                      of XYZ coordinates.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_extract_path_results()
#  has the following arguments:
#
#  res_utl_extract_path_results
#     (  res_ids,
#        npts,
#        pts,
#        derivation,
#        cid,
#        datatype,
#        results,
#        minloc,
#        maxloc,
#        elem_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(5)
INTEGER  i_npts
REAL     ra_pts(3)
STRING   s_derivation[5]
STRING   s_cid[8]
INTEGER  i_datatype
REAL     rv_results(VIRTUAL)
INTEGER  ia_minloc(6)
INTEGER  ia_maxloc(6)
INTEGER  ia_elem_ids(1)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids   = [2, 2, 2, 1, 1]
#
# Where ia_res_ids[0] = loadcase id (in this case 2)
#       ia_res_ids[1] = subcase id (in this case 2)
#       ia_res_ids[2] = Primary results_id (2 for Displacements)
#       ia_res_ids[3] = Secondary results_id (1 for Translational)
#       ia_res_ids[4] = Layer Position id (1 for (Non-Layered)
i_npts       = 1
#Try various points by using the FEM Element Show menu for Node values
#Example point this point does give a result value:
ra_pts   = [-4.0, 8.0, -1.75]
s_derivation = "MAG"
s_cid        = "Coord 1"
s_derivation = "MAG" 
s_cid        = "Coord 1"
#---------------------------------------------------------------------
# Extracts the results along the specified coordinates
i_return_value =                                 @
   res_utl_extract_path_results                  @
      (  ia_res_ids,                             @
         i_npts,                                 @
         ra_pts,                                 @
         s_derivation,                           @
         s_cid,                                  @
         i_datatype,                             @
         rv_results,                             @
         ia_minloc,                              @
         ia_maxloc,                              @
         ia_elem_ids )
dump i_return_value
dump i_datatype
dump rv_results
dump ia_minloc
dump ia_maxloc
dump ia_elem_ids
sys_free_array(rv_results)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_loadcases()
#
#                      This session file retrieves the existing load
#                      cases associated with results from the database
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
# 
#  The function res_utl_get_loadcases()
#  has the following arguments:
#
#  res_utl_get_loadcases
#     (  ncases,
#        lcids,
#        nsub )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ncases
INTEGER  iv_lcids(VIRTUAL)
INTEGER  iv_nsub(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Gets the loadcases associated with the results
i_return_value =                                 @
   res_utl_get_loadcases                         @
      (  i_ncases,                               @
         iv_lcids,                               @
         iv_nsub )
dump i_return_value
dump i_ncases
# This value shows number of loadcases
dump iv_lcids
# This shows the list of load case ids
dump iv_nsub
# This shows number of subcases for each load case
sys_free_array(iv_lcids)
sys_free_array(iv_nsub)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_subcases()
#
#                      This session file retrieves the existing
#                      subcases associated with results from the
#                      database.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_get_subcases()
#  has the following arguments:
#
#  res_utl_get_subcases
#     (  lcid,
#        nsub,
#        subids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lcid
INTEGER  i_nsub
INTEGER  iv_subids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_lcid    = 3
#---------------------------------------------------------------------
# Gets the subcases
i_return_value =                                 @
   res_utl_get_subcases                          @
      (  i_lcid,                                 @
         i_nsub,                                 @
         iv_subids )
dump i_return_value
dump i_nsub
# This shows the number of subcases
dump iv_subids
# This shows the list of subcase ids
sys_free_array(iv_subids)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_result_ids()
#
#                      This session file retrieves the existing result
#                      ids associated with a list of load case/subcase
#                      ids from the database.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.  
#
#  The function res_utl_get_result_ids()
#  has the following arguments:
#
#  res_utl_get_result_ids
#     (  ncls,
#        lcid,
#        subids,
#        nres,
#        prim_ids,
#        sec_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ncls
INTEGER  ia_lcid(2)
INTEGER  ia_subids(2)
INTEGER  i_nres
INTEGER  iv_prim_ids(VIRTUAL)
INTEGER  iv_sec_ids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_ncls      = 2
ia_lcid     = [3, 4]
ia_subids   = [1, 1]
#---------------------------------------------------------------------
# Gets the result ids
i_return_value =                                 @
   res_utl_get_result_ids                        @
      (  i_ncls,                                 @
         ia_lcid,                                @
         ia_subids,                              @
         i_nres,                                 @
         iv_prim_ids,                            @
         iv_sec_ids )
dump i_return_value
dump i_nres
# This value shows the number of results
dump iv_prim_ids
# This shows the list of primary result ids
dump iv_sec_ids
# This shows the list of secondary result ids
sys_free_array(iv_prim_ids)
sys_free_array(iv_sec_ids)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_result_layers()
#
#                      This session file retrieves the layer positions
#                      associated with results from the database.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
# 
#  The function res_utl_get_result_layers()
#  has the following arguments:
#
#  res_utl_get_result_layers
#     (  res_ids,
#        nlayers,
#        ids,
#        labels )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_res_ids(4)
INTEGER  i_nlayers
INTEGER  iv_ids(VIRTUAL)
STRING   sav_labels[32](VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
ia_res_ids  = [3, 1, 2, 1]
#---------------------------------------------------------------------
# Gets the layer positions associated with the results
i_return_value =                                 @
   res_utl_get_result_layers                     @
      (  ia_res_ids,                             @
         i_nlayers,                              @
         iv_ids,                                 @
         sav_labels )
dump i_return_value
dump i_nlayers
# This shows the number of associated layers
dump iv_ids
# This shows a list of layer position ids
dump sav_labels
# This shows the labels for the layers
sys_free_array(iv_ids)
sys_free_array(sav_labels)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_global_vars()
#
#                      This session file retrieves the existing global
#                      variables from the database.
#
#                      Before running this session file run dyna.ses
#                      to create dyna.db. Then create dyna.op2 as per
#                      the instructions in dyna.ses and import it in
#                      dyna.db to create dyna.db with results.
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_get_global_vars()
#  has the following arguments:
#
#  res_utl_get_global_vars
#     (  nvar,
#        varnames )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nvar
STRING   sav_varnames[16](VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file dyna.db
uil_file_open.go ("dyna.db")
#---------------------------------------------------------------------
# Gets global variables 
i_return_value =                                 @
   res_utl_get_global_vars                       @
      (  i_nvar,                                 @
         sav_varnames )
dump i_return_value
dump i_nvar
# This value shows number of global variables 
dump sav_varnames
# This shows the label for the variable.
sys_free_array(sav_varnames)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_global_var_for_lc()
#
#                      This function retrieves the value of a specific
#                      global variable associated with a loadcase.
#
#                      Before running this session file run dyna.ses
#                      to create dyna.db. Then create dyna.op2 as per
#                      the instructions in dyna.ses and import it in
#                      dyna.db to create dyna.db with results.
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function res_utl_get_global_var_for_lc()
#  has the following arguments:
#
#  res_utl_get_global_var_for_lc
#     (  lcid,
#        subid,
#        varname,
#        ncomp,
#        vals )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lcid
INTEGER  i_subid
STRING   s_varname[10]
INTEGER  i_ncomp
REAL     ra_vals(6)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file dyna.db
uil_file_open.go ("dyna.db")
#---------------------------------------------------------------------
# Argument initialization
i_lcid       = 1 
i_subid      = 5
s_varname    = "Frequency"
#---------------------------------------------------------------------
# Retrieve value of the specified global variable
i_return_value =                                 @
   res_utl_get_global_var_for_lc                 @
      (  i_lcid,                                 @
         i_subid,                                @
         s_varname,                              @
         i_ncomp,                                @
         ra_vals )
dump i_return_value
dump i_ncomp
# This shows number of components used for the variable value
dump ra_vals
# This shows the value of global variable
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_get_subcases_by_gv()
#
#                      This session file retrieves all subcase ids 
#                      with the specified global variable value within
#                      the specified range.
#
#                      Before running this session file run dyna.ses
#                      to create dyna.db. Then create dyna.op2 as per
#                      the instructions in dyna.ses and import it in
#                      dyna.db to create dyna.db with results.
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function res_utl_get_subcases_by_gv()
#  has the following arguments:
#
#  res_utl_get_subcases_by_gv
#     (  lcid,
#        varname,
#        compnum,
#        val1,
#        val2,
#        method,
#        nscs,
#        subids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lcid
STRING   s_varname[16]
INTEGER  i_compnum
REAL     r_val1
REAL     r_val2
STRING   s_method[16]
INTEGER  i_nscs
INTEGER  iv_subids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file dyna.db
uil_file_open.go ("dyna.db")
#---------------------------------------------------------------------
# Sets the viewport size
ga_viewport_size_set("default_viewport", 6.926, 5.29, 1)
ga_viewport_location_set("default_viewport", 0.000, 3.826, 1)
#---------------------------------------------------------------------
# Argument initialization
i_lcid     = 1
s_varname  = "Mode number"
i_compnum  = 1
r_val1     = 1.
r_val2     = 10.
s_method   = "B[etween]"
#---------------------------------------------------------------------
i_return_value =                                 @
   res_utl_get_subcases_by_gv                    @
      (  i_lcid,                                 @
         s_varname,                              @
         i_compnum,                              @
         r_val1,                                 @
         r_val2,                                 @
         s_method,                               @
         i_nscs,                                 @
         iv_subids )
dump i_return_value
dump i_nscs
# This shows the number of subcases associated with the given range
dump iv_subids
# This shows list of subcase ids associated with the given range of
# Mode numbers
sys_free_array(iv_subids)
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_calc_results()
#
#                      This session file operates mathematically on
#                      two arrays on a component by component basis.
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_calc_results()
#  has the following arguments:
#
#  res_utl_calc_results
#     (  res1,
#        operator,
#        res2,
#        res3 )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     ra_res1(2)
STRING   s_operator[5]
REAL     ra_res2(2)
REAL     ra_res3(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Argument initialization
ra_res1     = [10., 20.]
s_operator  = "*"
ra_res2     = [5., 3.]
#---------------------------------------------------------------------
# Calculates the result
i_return_value =                                 @
   res_utl_calc_results                          @
      (  ra_res1,                                @
         s_operator,                             @
         ra_res2,                                @
         ra_res3 )
dump i_return_value
dump ra_res3
# First value in the array shows the multiplication of 10.0 and 5.0 
# and second value shows the multiplication of 20.0 and 3.0
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_dot_results()
#
#                      This session file calculates the dot product of
#                      2 vector arrays.
#            
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#  
#  The function res_utl_dot_results()
#  has the following arguments:
#
#  res_utl_dot_results
#     (  nres,
#        res1,
#        res2,
#        res3 )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nres
REAL     ra_res1(2, 3)
REAL     ra_res2(2, 3)
REAL     ra_res3(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Argument initialization
i_nres      = 2
ra_res1    = [[1., 4., 5.] [2., 2., 2.]]
ra_res2    = [[1., 2., 3.] [4., 5., 6.]]
#---------------------------------------------------------------------
# Calculates the dot product
i_return_value =                                 @
   res_utl_dot_results                           @
      (  i_nres,                                 @
         ra_res1,                                @
         ra_res2,                                @
         ra_res3 )
dump i_return_value
dump ra_res3
# This shows the dot product of two arrays
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_cross_results()
#
#                      This session file calculates the cross product
#                      of 2 vector arrays.
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
# 
#  The function res_utl_cross_results()
#  has the following arguments:
#
#  res_utl_cross_results
#     (  nres,
#        res1,
#        res2,
#        res3 )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nres
REAL     ra_res1(2, 3)
REAL     ra_res2(2, 3)
REAL     ra_res3(2, 3)
INTEGER  i_return_value
#---------------------------------------------------------------------
# Argument initialization
i_nres     = 2
ra_res1    = [[1., 4., 5.] [2., 2., 2.]]
ra_res2    = [[1., 2., 3.] [4., 5., 6.]]
#---------------------------------------------------------------------
# Calculates cross products
i_return_value =                                 @
   res_utl_cross_results                         @
      (  i_nres,                                 @
         ra_res1,                                @
         ra_res2,                                @
         ra_res3 )
dump i_return_value
dump ra_res3
# This shows the cross product of two arrays
#---------------------------------------------------------------------
  
()
 
#
#  Purpose          :  This file provides an example of a call to the
#                      function res_utl_transform_results()
#
#                      This session file transforms the input vector
#                      or tensor from one rectangular coordinate 
#                      system to another.
#
#                      Before running this session file run spool.ses
#                      and create result file spool.op2 as per the
#                      instructions given in it. Import this result
#                      file spool.op2 into spool.db. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function res_utl_transform_results()
#  has the following arguments:
#
#  res_utl_transform_results
#     (  nvals,
#        ncomp,
#        in_vals,
#        from_cid,
#        to_cid,
#        out_vals )
#
#---------------------------------------------------------------------
# Opens file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nvals
INTEGER  i_ncomp
REAL     ra_in_vals(1, 3)
INTEGER  i_from_cid
INTEGER  i_to_cid
REAL     ra_out_vals(1, 3)
INTEGER  i_return_value
STRING   asm_create_cord_axi_created_ids[VIRTUAL]
#---------------------------------------------------------------------
# Creates a new coordinate frame
i_return_value =                                 @ 
   asm_const_coord_axis( "2", "XY", "Coord 0", 1,@
      "[0 0 5]", "[1 0 0]", "[0 1 0]" ,          @
      asm_create_cord_axi_created_ids )
dump i_return_value
#---------------------------------------------------------------------
# Argument initialization
i_nvals     = 1
i_ncomp     = 3
ra_in_vals  = [[1., 1., 0.]]
i_from_cid  = 0
i_to_cid    = 2
#---------------------------------------------------------------------
# Transforms the input vector
i_return_value =                                 @
   res_utl_transform_results                     @
      (  i_nvals,                                @
         i_ncomp,                                @
         ra_in_vals,                             @
         i_from_cid,                             @
         i_to_cid,                               @
         ra_out_vals )
dump i_return_value
dump ra_out_vals
# This shows the transformed array
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_load_case_title()
#
#                      This session file retrieves the title for a 
#                      specified loadcase id.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#     
#  The function db_get_load_case_title()
#  has the following arguments:
#
#  db_get_load_case_title
#     (  id,
#        title )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_title[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_id   = 4
#---------------------------------------------------------------------
# Gets the loadcase title
i_return_value =                                 @
   db_get_load_case_title                        @
      (  i_id,                                   @
         s_title )
dump i_return_value
dump s_title
# This shows the loadcase title
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_load_case_id()
#
#                      This session file retrieves the id for a
#                      specified loadcase title.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_load_case_id()
#  has the following arguments:
#
#  db_get_load_case_id
#     (  title,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_title[32]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
s_title    = "SPOOL_LOADS"
#---------------------------------------------------------------------
# Gets the loadcase id 
i_return_value =                                 @
   db_get_load_case_id                           @
      (  s_title,                                @
         i_id )
dump i_return_value
dump i_id
# This shows loadcase id for specified loadcase title
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_sub_case_title()
#
#                      This session file retrieves the title for a
#                      specified loadcase/subcase id.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_sub_case_title()
#  has the following arguments:
#
#  db_get_sub_case_title
#     (  lcid,
#        subid,
#        title )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lcid
INTEGER  i_subid
STRING   s_title[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_lcid    = 4
i_subid   = 2 
#---------------------------------------------------------------------
# Gets the subcase title
i_return_value =                                 @
   db_get_sub_case_title                         @
      (  i_lcid,                                 @
         i_subid,                                @
         s_title )
dump i_return_value
dump s_title
# This shows the subcase title 
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_sub_case_id()
#
#                      This session file retrieves the id for a
#                      specified loadcase/subcase title.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_sub_case_id()
#  has the following arguments:
#
#  db_get_sub_case_id
#     (  lcid,
#        title,
#        subid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lcid
STRING   s_title[32]
INTEGER  i_subid
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_lcid    = 4
s_title   = "Static Subcase"
#---------------------------------------------------------------------
# Gets the loadcase/subcase id
i_return_value =                                 @
   db_get_sub_case_id                            @
      (  i_lcid,                                 @
         s_title,                                @
         i_subid )
dump i_return_value
dump i_subid
# This value shows subcase id for the specified title
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_primary_res_label()
#
#                      This session file retrieves the title for a
#                      specified primary result id.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_primary_res_label()
#  has the following arguments:
#
#  db_get_primary_res_label
#     (  id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_label[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_id    = 2
#---------------------------------------------------------------------
# Gets the primary result label
i_return_value =                                 @
   db_get_primary_res_label                      @
      (  i_id,                                   @
         s_label )
dump i_return_value
dump s_label
# This shows the primary result label
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_primary_res_id()
#
#                      This session file retrieves the id for a
#                      specified primary result label.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_primary_res_id()
#  has the following arguments:
#
#  db_get_primary_res_id
#     (  label,
#        id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_label[32]
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
s_label = "Stress Tensor"
#---------------------------------------------------------------------
# Gets the primary result id
i_return_value =                                 @
   db_get_primary_res_id                         @
      (  s_label,                                @
         i_id )
dump i_return_value
dump i_id
# This value shows primary result id
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_secondary_res_label()
#
#                      This session file retrieves the label for a
#                      specified secondary result id.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_secondary_res_label()
#  has the following arguments:
#
#  db_get_secondary_res_label
#     (  primary_id,
#        secondary_id,
#        label )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_primary_id
INTEGER  i_secondary_id
STRING   s_label[32]
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_primary_id   = 2
i_secondary_id = 1
#---------------------------------------------------------------------
# Gets the secondary result label
i_return_value =                                 @
   db_get_secondary_res_label                    @
      (  i_primary_id,                           @
         i_secondary_id,                         @
         s_label )
dump i_return_value
dump s_label
# This shows the secondary result label
#---------------------------------------------------------------------
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_secondary_res_id()
#
#                      This session file retrieves the id for a
#                      specified secondary result label.
#
#                      Before running this session file run spool.ses
#                      and import result file spool.op2 to create
#                      spool.db with results. For instructions
#                      see file spool.ses
#
#                      This file can be run by starting a session of
#                      Patran, and running this session file
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#  The function db_get_secondary_res_id()
#  has the following arguments:
#
#  db_get_secondary_res_id
#     (  primary_id,
#        label,
#        secondary_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_primary_id
STRING   s_label[32]
INTEGER  i_secondary_id
INTEGER  i_return_value
#---------------------------------------------------------------------
# Opens the file spool.db
uil_file_open.go ("spool.db")
#---------------------------------------------------------------------
# Argument initialization
i_primary_id   = 1
s_label        = "Translational"
#---------------------------------------------------------------------
# Gets the secondary result id
i_return_value =                                 @
   db_get_secondary_res_id                       @
      (  i_primary_id,                           @
         s_label,                                @
         i_secondary_id )
dump i_return_value
dump i_secondary_id
# This value shows the id for the specified secondary result label
#---------------------------------------------------------------------