Tutorial Toolkit Code Examples > Finite Element Model > Introduction
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Introduction
This chapter provides code examples for the PCL function described in Volume 1. These examples are designed so that they can be cut and pasted into a file and, by following the instructions listed with each example, executed in MSC Patran.
 
db_count_elem_topology_codes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_elem_topology_codes()
#
#                      This file opens fem1.db and calls the function
#                      to get total number of topologies currently
#                      defined in the system.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_elem_topology_codes()
#  has the following arguments:
#
#  db_count_elem_topology_codes
#     (  ntop )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ntop
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Call the function to count the number of element topologies
#  currently defined in the system.
#
i_return_value =                                 @
   db_count_elem_topology_codes                  @
      (  i_ntop )
dump i_return_value
 
#  Number of Topologies defined in the system is
dump i_ntop
#---------------------------------------------------------------------
db_count_elem_w_topology
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_elem_w_topology()
#
#                      This file opens fem1.db and calls the function
#                      to get number of elements in element topologies
#                      25 to 28. There are 16 elements of topology id
#                      28 in the fem1.db.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_elem_w_topology()
#  has the following arguments:
#  db_count_elem_w_topology
#     (  ntop,
#        top,
#        nelem )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ntop
INTEGER  ia_top(4)
INTEGER  ia_nelem(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Look for the topologies 25,26,27,28
i_ntop = 4
ia_top = [25,26,27,28]
 
i_return_value =                                 @
   db_count_elem_w_topology                      @
      (  i_ntop,                                 @
         ia_top,                                 @
         ia_nelem )
dump i_return_value
#  Number of elements in topologies 25,26,27,28 are
dump ia_nelem
#---------------------------------------------------------------------
db_count_elems_for_geo
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_elems_for_geo()
#
#                      This file opens fem1.db and calls the function
#                      to get number of elements that have geometry as
#                      SOLID and id 1. fem1.db contains 16 such
#                      elements.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_elems_for_geo() has the following arguments:
#  db_count_elems_for_geo
#     (  geo_type,
#        geo_id,
#        nbr_of_elements )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_geo_type
INTEGER  i_geo_id
INTEGER  i_nbr_of_elements
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Call the function db_count_elems_for_geo() to get the number of
#  elements that have SOLID as geometry type and 1 as geometry id.
#
 
i_geo_type = 4   /*  For SOLID from dbtypes.h */
i_geo_id = 1
 
i_return_value =                                 @
   db_count_elems_for_geo                        @
      (  i_geo_type,                             @
         i_geo_id,                               @
         i_nbr_of_elements )
dump i_return_value
 
#  Number of elements in the SOLID of id = 1 is
dump i_nbr_of_elements
#---------------------------------------------------------------------
db_count_elems_using_node
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_elems_using_node()
#
#                      This file opens fem3.db and calls the function
#                      to get the number of elements associated with
#                      the Nodes 1:20.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_elems_using_node()
#  has the following arguments:
#  db_count_elems_using_node
#     (  nnode,
#        nid,
#        nelem,
#        fflag )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  ia_nid(20)
INTEGER  ia_nelem(20)
INTEGER  i_fflag
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the number of elements associated with
#  the array of Nodes 1:20
#
i_nnode = 20
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
 
i_return_value =                                 @
   db_count_elems_using_node                     @
      (  i_nnode,                                @
         ia_nid,                                 @
         ia_nelem,                               @
         i_fflag )
dump i_return_value
 
#  The number of elements associated with the nodes
dump ia_nelem
#  Flag indicating if any of the node in the list was found not
#  associated to element(i.e. unreferenced).
dump i_fflag
#---------------------------------------------------------------------
db_count_mpcs_using_node
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_mpcs_using_node()
#
#                      This file opens fem3.db and calls the function
#                      to get the number of MPCs associated with the
#                      nodes 1:20.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_mpcs_using_node() has the following
#  arguments:
#  db_count_mpcs_using_node
#     (  nnode,
#        nid,
#        nmpc,
#        nnode )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  ia_nid(20)
INTEGER  ia_nmpc(20)
INTEGER  i_fflag
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to count the number of MPCs associated to the 
#  Nodes 1:20
#
i_nnode = 20
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
 
i_return_value =                                 @
   db_count_mpcs_using_node                      @
      (  i_nnode,                                @
         ia_nid,                                 @
         ia_nmpc,                                @
         i_fflag )
dump i_return_value
 
#  Number of MPCs associated to the Nodes
dump ia_nmpc
#  Flag indicating whether any of the node in the List is not
#  associated to any MPC in the database.
dump i_fflag
#---------------------------------------------------------------------
db_count_nodes_for_geometry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_nodes_for_geometry()
#
#                      This file opens fem1.db and calls the function
#                      to get the number of nodes present in the 
#                      Surface 1 (Solid 1.1) of Solid 1.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_nodes_for_geometry()
#  has the following arguments:
#
#  db_count_nodes_for_geometry
#     (  geoType,
#        geoId,
#        parentType,
#        parentId,
#        nodeCount )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_geoType,i_count
INTEGER  i_geoId,ia_orphan(1)
INTEGER  i_parentType
INTEGER  i_parentId
INTEGER  i_nodeCount
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Call the function with geotype = Surface and ParentType = Solid
#  Patran generates 6 orphan surfaces when it creates the SOLID.
#  To get the internal Id of the Surface “Solid 1.1” and to assign
#  it to i_geoid, call the function db_get_orphan_surfaces() and
#  db_get_surface_id().
 
db_count_orphan_surfaces(i_count)
db_get_orphan_surfaces(i_count,ia_orphan)
db_get_surface_id(ia_orphan(1), i_geoId)
dump i_geoId
 
i_geoType = 3        /* for SURFACE from dbtypes.h */
i_parentType = 4     /* for SOLID from dbtypes.h */
i_parentId = 1
 
i_return_value =                                 @
   db_count_nodes_for_geometry                   @
      (  i_geoType,                              @
         i_geoId,                                @
         i_parentType,                           @
         i_parentId,                             @
         i_nodeCount )
dump i_return_value
 
#  Number of nodes associated with the first surface of Solid 1 is
dump i_nodeCount
#---------------------------------------------------------------------
db_count_nodes_in_mpc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_nodes_in_mpc()
#
#                      This file opens fem3.db and calls the function
#                      to count the nodes in MPC 1.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_nodes_in_mpc()
#  has the following arguments:
#  db_count_nodes_in_mpc
#     (  nmpc,
#        mpcid,
#        nnode,
#        fflag )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nmpc
INTEGER  ia_mpcid(8)
INTEGER  ia_nnode(8)
INTEGER  i_fflag
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Get the number of MPCs in the database.
i_return_value =                                 @
   db_count_mpcs( i_nmpc )
dump i_return_value
 
#  Get the IDs of the MPCs
i_return_value =                                 @
   db_get_mpc_ids                                @
      ( i_nmpc,                                  @
        ia_mpcid )
dump i_return_value
 
#  Call the function to get the nodes in the MPCs
#
i_return_value =                                 @
   db_count_nodes_in_mpc                         @
      (  i_nmpc,                                 @
         ia_mpcid,                               @
         ia_nnode,                               @
         i_fflag )
dump i_return_value
 
#  Number of nodes in each MPC
dump ia_nnode
#  Error flag
dump i_fflag
#---------------------------------------------------------------------
db_count_unref_nodes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_unref_nodes()
#
#                      This file opens fem3.db and calls the function
#                      to count the unreferenced nodes.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It 
#                      contains 4 unreferenced nodes.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_unref_nodes() has the following arguments:
#  db_count_unref_nodes
#     (  nbr_unref_node )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nbr_unref_node
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to count the Unreferenced Nodes in the database.
#
i_return_value =                                 @
   db_count_unref_nodes                          @
      (  i_nbr_unref_node )
dump i_return_value
 
#  The number of Unreferenced nodes are
dump i_nbr_unref_node
#---------------------------------------------------------------------
db_count_valid_dofs_f_mpc_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_valid_dofs_f_mpc_type()
#
#                      This file opens fem2.db and calls the function
#                      to get the number of Valid Degree of Freedoms
#                      of MPC type “Explicit”
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_valid_dofs_f_mpc_type()
#  has the following arguments:
#
#  db_count_valid_dofs_f_mpc_type
#     (  mpc_type_id,
#        num_dofs )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_mpc_type_name[16]
INTEGER  i_mpc_type_id
INTEGER  i_num_dofs
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the ID of the MPC type “Explicit”
s_mpc_type_name = “Explicit”
i_return_value =                                 @
   db_get_mpc_type_id                            @
      (  s_mpc_type_name,                        @
         i_mpc_type_id )
dump i_mpc_type_id
 
#  Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value =                                 @
   db_count_valid_dofs_f_mpc_type                @
      (  i_mpc_type_id,                          @
         i_num_dofs )
dump i_return_value
 
#  Valid DOFs for MPC type “Explicit” is
dump i_num_dofs
#---------------------------------------------------------------------
db_count_valid_mpc_types
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_count_valid_mpc_types()
#
#                      This file opens fem2.db and calls the function
#                      to get the number of valid MPC type ids.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_count_valid_mpc_types()
#  has the following arguments:
#  db_count_valid_mpc_types
#     (  numtypes )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_numtypes
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Call the function to get the number of Valid MPC type ids.
#
i_return_value =                                 @
   db_count_valid_mpc_types                      @
      (  i_numtypes )
dump i_return_value
 
#  The number of valid MPC type ids for the current analysis code and
#  type is
dump i_numtypes
#---------------------------------------------------------------------
db_get_all_valid_dof_f_mpc_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_valid_dof_f_mpc_type()
#
#                      This file opens fem2.db and calls the function
#                      db_count_valid_dofs_f_mpc_type() to get the
#                      number of DOFs for the MPC type “Explicit”. It
#                      calls db_get_all_valid_dof_f_mpc_type() to get
#                      all the valid DOF. Then it calls the function
#                      db_get_nxt_valid_dof_f_mpc_type() to get the
#                      name and id of valid DOFs.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_valid_dof_f_mpc_type()
#  has the following arguments:
#  db_get_all_valid_dof_f_mpc_type
#     (  mpc_type_id )
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_mpc_type_name[16]
INTEGER  i_num_dofs,i_count
INTEGER  i_mpc_type_id
INTEGER  i_dof_id
STRING   s_dof_name[16]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the ID of the MPC type “Explicit”
s_mpc_type_name = “Explicit”
i_return_value =                                 @
   db_get_mpc_type_id                            @
      (  s_mpc_type_name,                        @
         i_mpc_type_id )
 
#  Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value =                                 @
   db_count_valid_dofs_f_mpc_type                @
      ( i_mpc_type_id,                           @
        i_num_dofs )
 
#  Call the function to get all the valid DOF for the MPC type
#  “Explicit”. This function should be called before the call
#  to the function db_get_nxt_valid_dof_f_mpc_type().
#
i_return_value =                                 @
   db_get_all_valid_dof_f_mpc_type               @
      (  i_mpc_type_id )
dump i_return_value
 
#  Get the DOF ID and name for the MPC type “Explicit”
FOR ( i_count = 1 TO i_num_dofs )
   i_return_value =                              @
      db_get_nxt_valid_dof_f_mpc_type            @
         ( i_mpc_type_id,                        @
           i_dof_id,                             @
           s_dof_name )
   dump i_dof_id
   dump s_dof_name
END FOR
#---------------------------------------------------------------------
db_get_all_valid_mpc_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_all_valid_mpc_type()
#
#                      This file opens fem2.db and calls the function
#                      db_count_valid_mpc_types() to get the number
#                      of valid MPC types. Then it calls db_get_all_
#                      valid_mpc_type() to make available all the 
#                      valid MPC types. Function db_get_next_valid_
#                      mpc_type() is called to get the MPC type ID
#                      and name.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_all_valid_mpc_type() has no arguments.
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_numtypes, i_count
INTEGER  i_mpc_type_id
STRING   s_mpc_type_name[16]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the number of valid mpc types for the default analysis type
#  and code.
i_return_value =                                 @
   db_count_valid_mpc_types                      @
      ( i_numtypes )
 
#  Get all the valid MPC types in the database
#
i_return_value =                                 @
   db_get_all_valid_mpc_type()
dump i_return_value
 
FOR ( i_count = 1 TO i_numtypes )
   i_return_value =                              @
      db_get_next_valid_mpc_type                 @
         ( i_mpc_type_id,                        @
           s_mpc_type_name )
   dump i_mpc_type_id
   dump s_mpc_type_name
END FOR
#---------------------------------------------------------------------
db_get_dep_nodes_in_sub_mpc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_dep_nodes_in_sub_mpc()
#
#                      This file opens fem2.db and calls the 
#                      functions to get the first MPC ID, first
#                      Sub-MPC ID in the first MPC and the maximum
#                      number of nodes associated to the MPCs.
#                      Then it calls the function to get the IDs of 
#                      the dependent nodes in the first Sub-MPC.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_dep_nodes_in_sub_mpc()
#  has the following arguments:
#  db_get_dep_nodes_in_sub_mpc
#     (  mpc_id,
#        sub_mpc_id,
#        maxnode,
#        nnode,
#        nid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_num_mpcs
INTEGER  ia_mpc_ids(8)
INTEGER  iv_id_symbol(VIRTUAL)
INTEGER  i_mpc_id
INTEGER  i_sub_mpc_id
INTEGER  i_maxnode
INTEGER  i_nnode
INTEGER  ia_nid(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Count the number of MPCs in the database
i_return_value =                                 @
   db_count_mpcs                                 @
      ( i_num_mpcs )
 
#  Get the MPC ids
i_return_value =                                 @
   db_get_mpc_ids                                @
      ( i_num_mpcs,                              @
        ia_mpc_ids )
 
i_mpc_id = ia_mpc_ids(1)
 
#  Get all the SUB MPCs.
i_return_value =                                 @
   db_get_all_sub_mpc                            @
      ( i_mpc_id )
 
#  Get the first Sub MPC ID
i_return_value =                                 @
   db_get_next_sub_mpc                           @
      ( i_mpc_id,                                @
        i_sub_mpc_id )
 
#  Get the Maximum number of nodes which may be returned for the
#  Sub-MPC
i_return_value =                                 @
   fem_get_mpc_assoc_nodes                       @
      ( i_num_mpcs,                              @
        ia_mpc_ids,                              @
        i_maxnode,                               @
        iv_id_symbol )
 
#  Call the function to get the dependent nodes in first  Sub MPC.
i_return_value =                                 @
   db_get_dep_nodes_in_sub_mpc                   @
      (  i_mpc_id,                               @
         i_sub_mpc_id,                           @
         i_maxnode,                              @
         i_nnode,                                @
         ia_nid )
dump i_return_value
 
#  The number of nodes using the Sub-MPC
dump i_nnode
#  IDs of the dependent nodes for the Sub-MPC
dump ia_nid
 
sys_free_array( iv_id_symbol )
#---------------------------------------------------------------------
 
db_get_dof_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_dof_id()
#
#                      This file opens fem2.db and calls the function
#                      to get the ID of the DOF “UX”.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_dof_id() has the following arguments:
#  db_get_dof_id
#     (  dof_name,
#        dof_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_dof_name[16]
INTEGER  i_dof_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Call the function to get the ID of DOF “UX”. List of the available
#  DOF can be referred in Chapter 7 of MSC Patran Users Manual Vol 4.
#
s_dof_name = “UX”
 
i_return_value =                                 @
   db_get_dof_id                                 @
      (  s_dof_name,                             @
         i_dof_id )
dump i_return_value
 
#  Id of DOF “UX” is 
dump i_dof_id
#---------------------------------------------------------------------
db_get_dof_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_dof_name()
#
#                      This file opens fem2.db and calls the function
#                      to get the name of DOF whose ID is 7
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_dof_name() has the following arguments:
#  db_get_dof_name
#     (  dof_id,
#        dof_name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_dof_id
STRING   s_dof_name[128]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Call the function to get the name of DOF whose ID is 7.
#  List containing DOF and their IDs can be referred in Chapter 7 of
#  MSC Patran Users Manual Volume 4
#
i_dof_id = 7
 
i_return_value =                                 @
   db_get_dof_name                               @
      (  i_dof_id,                               @
         s_dof_name )
dump i_return_value
 
#  The name of the DOF whose ID is 7
dump s_dof_name
#---------------------------------------------------------------------
db_get_elem_config_ntl
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_config_ntl()
#
#                      This file opens fem1.db and calls the function
#                      db_get_region_definition() to get the various
#                      IDs stored in the default configuration code.
#                      Then it calls db_get_elem_config_ntl() to get
#                      the ID of the default configuration.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_config_ntl() has the following
#  arguments:
#  db_get_elem_config_ntl
#     (  atid,
#        acid,
#        geopcd,
#        copcd,
#        fopcd,
#        lopcd,
#        etopcd,
#        dofsetid,
#        matlcode,
#        matdcode,
#        config )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_set_name[32]
INTEGER  i_num_region
INTEGER  ia_region_ids(1)
INTEGER  i_gener_elem_type
INTEGER  i_lay_id
INTEGER  i_mat_dir
INTEGER  i_atid
INTEGER  i_acid
INTEGER  i_geopcd
INTEGER  i_copcd
INTEGER  i_fopcd
INTEGER  i_lopcd
INTEGER  i_etopcd
INTEGER  i_dofsetid
INTEGER  i_matlcode
INTEGER  i_matdcode
INTEGER  i_config
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  To get the ids of the different parameters, call the function
#  db_get_region_definition().
 
#  Get number of regions.
db_count_region_ids(i_num_region)
 
#  Get IDs of all the regions.
db_get_all_region_ids(i_num_region, ia_region_ids)
 
i_return_value =                                 @
   db_get_region_definition                      @
      ( ia_region_ids(1),                        @
        s_set_name,                              @
        i_gener_elem_type,                       @
        i_dofsetid,                              @
        i_copcd,                                 @
        i_geopcd,                                @
        i_fopcd,                                 @
        i_lopcd,                                 @
        i_lay_id,                                @
        i_matlcode,                              @
        i_matdcode,                              @
        i_mat_dir )
#---------------------------------------------------------------------
#  Call the function to get the ID of the associated configuration
#  IDs of the Analysis Type and Code can be referred from Chapter 7
#  of MSC Patran User Manual, Volume 4. IDs of the Element topology
#  can be referred from Chapter 9 of the same Manual.
#
i_atid = 1  /* for  Analysis type “Structural Analysis” */
i_acid = 1  /* for Analysis Code “MSC.Nastran” */
i_etopcd = 28  /* for “Hex8” element */
 
i_return_value =                                 @
   db_get_elem_config_ntl                        @
      (  i_atid,                                 @
         i_acid,                                 @
         i_geopcd,                               @
         i_copcd,                                @
         i_fopcd,                                @
         i_lopcd,                                @
         i_etopcd,                               @
         i_dofsetid,                             @
         i_matlcode,                             @
         i_matdcode,                             @
         i_config )
dump i_return_value
dump i_config
#---------------------------------------------------------------------
db_get_elem_dimens
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_dimens()
#
#                      This file opens fem1.db and calls the function
#                      to get the element dimensionality of topology
#                      id 28 (i.e.) Hex8.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_dimens() has the following arguments:
#  db_get_elem_dimens
#     (  top_id,
#        dimen )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_top_id
INTEGER  i_dimen
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the element dimensionality of Hex8 element (Topology ID 28).
#
i_top_id = 28
 
i_return_value =                                 @
   db_get_elem_dimens                            @
      (  i_top_id,                               @
         i_dimen )
dump i_return_value
 
#  The element Dimensionality of Topology Id 28 is
dump i_dimen
#---------------------------------------------------------------------
db_get_elem_for_geo_type_and_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_for_geo_type_and_id()
#
#                      This file opens fem1.db and calls the function
#                      to get all the element ID’s having geometry
#                      type SOLID and ID 1.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_for_geo_type_and_id()
#  has the following arguments:
#  db_get_elem_for_geo_type_and_id
#     (  geo_type,
#        geo_id,
#        nbr_of_elements,
#        element )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_geo_type
INTEGER  i_geo_id
INTEGER  i_nbr_of_elements
INTEGER  ia_element(16)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the element IDs that have geometry type “SOLID” and geometry
#  ID 1
#
i_geo_type = 4  /* for SOLID from dbtypes.h */
i_geo_id = 1
i_nbr_of_elements = 16
 
i_return_value =                                 @
   db_get_elem_for_geo_type_and_id               @
      (  i_geo_type,                             @
         i_geo_id,                               @
         i_nbr_of_elements,                      @
         ia_element )
dump i_return_value
 
#  Array of element ids :
dump ia_element
#---------------------------------------------------------------------
db_get_elem_nodes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_nodes()
#
#                      This file opens fem3.db and calls the function
#                      to retrieve the node IDs associated with 
#                      Element 1.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_nodes() has the following arguments:
#  db_get_elem_nodes
#     (  eid,
#        numnode,
#        nid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_eid
INTEGER  i_numnode
INTEGER  ia_nid(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to retrieve the node IDs associated with
#  Element 1
#
i_eid = 1
 
i_return_value =                                 @
   db_get_elem_nodes                             @
      (  i_eid,                                  @
         i_numnode,                              @
         ia_nid )
dump i_return_value
 
#  The number of nodes associated with Element 1
dump i_numnode
#  The Node IDs associated with Element 1
dump ia_nid
#---------------------------------------------------------------------
db_get_elem_shape_for_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_shape_for_id()
#
#                      This file opens fem1.db and calls the function
#                      to get shape codes for element 1 and 2.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_shape_for_id()
#  has the following arguments:
#  db_get_elem_shape_for_id
#     (  nelem,
#        eid,
#        shape )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nelem
INTEGER  ia_eid(2)
INTEGER  ia_shape(2)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the shape code for Element 1 and 2
#
i_nelem = 2
ia_eid = [1,2]
 
i_return_value =                                 @
   db_get_elem_shape_for_id                      @
      (  i_nelem,                                @
         ia_eid,                                  @
         ia_shape )
dump i_return_value
 
#  The array of shape codes is
dump ia_shape
#---------------------------------------------------------------------
db_get_elem_top_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_top_name()
#
#                      This file opens fem1.db and calls the function
#                      to get the name of the topology ID 28.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_top_name() has the following arguments:
#  db_get_elem_top_name
#     (  id,
#        name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
STRING   s_name[128]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the element topology name of Hex8 (i.e.) topology id = 28
i_id = 28
 
i_return_value =                                 @
   db_get_elem_top_name                          @
      (  i_id,                                   @
         s_name )
dump i_return_value
 
#  The topology name is
dump s_name
#---------------------------------------------------------------------
 
db_get_elem_topology_codes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_topology_codes()
#
#                      This file opens fem1.db and calls the function
#                      to get the element topology IDs defined in the
#                      database.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_topology_codes()
#  has the following arguments:
#  db_get_elem_topology_codes
#     (  ntop,
#        top )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_ntop
INTEGER  ia_top(64)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the number of element topologies defined in the database.
db_count_elem_topology_codes(i_ntop)
 
#  Call the function to get the IDs of these topologies
#
i_return_value =                                 @
   db_get_elem_topology_codes                    @
      (  i_ntop,                                 @
         ia_top )
dump i_return_value
 
#  Array of element topology IDs is
dump ia_top
#---------------------------------------------------------------------
db_get_elem_topos_for_geom
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_topos_for_geom()
#
#                      This file opens fem1.db and calls the function
#                      to get the topology IDs in use for geometry 
#                      type SOLID and ID 1.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_topos_for_geom()
#  has the following arguments:
#  db_get_elem_topos_for_geom
#     (  geo_id,
#        geo_type,
#        n_tops,
#        top_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_geo_id
INTEGER  i_geo_type
INTEGER  i_n_tops
INTEGER  ia_top_ids(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the Topology IDs currently in use that match geometry type 
#  SOLID and geometry ID 1
#
i_geo_type = 4    /* for SOLID from dbtypes.h */
i_geo_id = 1
 
i_return_value =                                 @
   db_get_elem_topos_for_geom                    @
      (  i_geo_id,                               @
         i_geo_type,                             @
         i_n_tops,                               @
         ia_top_ids )
dump i_return_value
 
#  Number of topologies found
dump i_n_tops
#  Array of topology IDs
dump ia_top_ids
#---------------------------------------------------------------------
db_get_elem_verification_parms
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elem_verification_parms()
#
#                      In this file, the threshold value of aspect
#                      ratio(triangular element) for “MSC.Nastran”
#                      is retrived.
# 
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elem_verification_parms()
#  has the following arguments:
#  db_get_elem_verification_parms
#     (  analysis_code_name,
#        test_id,
#        threshold )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_analysis_code_name[128]
INTEGER  i_test_id
REAL     r_threshold
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the threshold value of aspect ratio for “MSC.Nastran”
#
s_analysis_code_name = “MSC.Nastran”
 
#  Test id of aspect ratio is 1 ( Refer section 7.11 of Chapter 7 of
#  MSC Patran USERs MANUAL, Volume 4 )
i_test_id = 1   
 
i_return_value =                                 @
   db_get_elem_verification_parms                @
      (  s_analysis_code_name,                   @
         i_test_id,                              @
         r_threshold )
dump i_return_value
 
#  The threshold value is
dump r_threshold
#---------------------------------------------------------------------
db_get_elems
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elems()
#
#                      This file opens fem1.db and calls the function
#                      to get all information about element 1 and 2.
#                      fem1.db contains 16 elements.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elems() has the following arguments:
#  db_get_elems
#     (  nelem,
#        maxnode,
#        eid,
#        etop,
#        gtype,
#        gid,
#        econ )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nelem
INTEGER  i_maxnode
INTEGER  ia_eid(2)
INTEGER  ia_etop(2)
INTEGER  ia_gtype(2)
INTEGER  ia_gid(2)
INTEGER  ia_econ(2, 8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Get the information of the element 1 and 2.
i_nelem = 2
i_maxnode = 8
ia_eid = [1,2]
 
i_return_value =                                 @
   db_get_elems                                  @
      (  i_nelem,                                @
         i_maxnode,                              @
         ia_eid,                                 @
         ia_etop,                                @
         ia_gtype,                               @
         ia_gid,                                 @
         ia_econ )
dump i_return_value
 
#  The element topology array is
dump ia_etop
#  Associated geometry array is
dump ia_gtype
#  Associated geometry IDs array  is
dump ia_gid
#  Array of node ids belong to each element
dump ia_econ
#---------------------------------------------------------------------
db_get_elems_by_lbc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elems_by_lbc()
#
#                      This file opens fem1.db and calls the function
#                      to get all the elements associated with
#                      “new_load”. fem1.db contains 16 elements and 
#                      two lbc’s.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elems_by_lbc()
#  has the following arguments:
#
#  db_get_elems_by_lbc
#     (  lbc_id,
#        max_elem,
#        nelem,
#        eid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_max_elem
INTEGER  i_nelem
INTEGER  ia_eid(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Get the id of the lbc “elem_lbc”
db_get_lbc_id(“new_load”, i_lbc_id)
dump i_lbc_id 
 
#  Call the function to get the number of elements and their ids
#  associated with the lbc “new_load”
 
i_max_elem = 8
 
i_return_value =                                 @
   db_get_elems_by_lbc                           @
      (  i_lbc_id,                               @
         i_max_elem,                             @
         i_nelem,                                @
         ia_eid )
dump i_return_value
 
#  Number of elements found associated with “new_load”
dump i_nelem
#  Ids of the elements associated to “new_load”
dump ia_eid
#---------------------------------------------------------------------
db_get_elems_using_nodes
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_elems_using_nodes()
#
#                      This file opens fem3.db and calls the function
#                      to retrieve the list of elements associated 
#                      with Nodes 1:16
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_elems_using_nodes() has the following
#  arguments:
#  db_get_elems_using_nodes
#     (  nnode,
#        nid,
#        mxelem,
#        nelem,
#        eid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  ia_nid(16)
INTEGER  i_mxelem
INTEGER  ia_nelem(16)
INTEGER  ia_eid(64)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to retrieve the list of elements associated with
#  Nodes 1:16 in the database.
#
i_nnode = 16
ia_nid = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
i_mxelem = 4
 
i_return_value =                                 @
   db_get_elems_using_nodes                      @
      (  i_nnode,                                @
         ia_nid,                                 @
         i_mxelem,                               @
         ia_nelem,                               @
         ia_eid )
dump i_return_value
 
#  Number of elements associated with the Nodes 1:16
dump ia_nelem
#  Ids of all the elements referencing Nodes 1:16
dump ia_eid
#---------------------------------------------------------------------
db_get_etop_for_a_code
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_etop_for_a_code()
#
#                      This function retrieves a set of element
#                      topology ids  based on the analysis code and
#                      type.This  file opens a new database “new.db”
#                      and gets the element topology ids for the
#                      analysis code   MSC.Nastran and analysis type 
#                      STRUCTURAL.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the “File”,”Session”,”Play” pulldown 
#                      menus on the menu bar.
#
#  The function db_get_etop_for_a_code()
#  has the following arguments:
#
#  db_get_etop_for_a_code
#     (  acid,
#        atid,
#        count,
#        etids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_acid
INTEGER  i_atid
INTEGER  i_count
INTEGER  iv_etids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open a new database “new.db”
uil_file_new.go(““,”new.db”)
$? YES 36000002
 
#  i_acid = 1  ( Analysis code is MSC.Nastran )
i_acid = 1
#  i_atid = 1  ( Analysis type is STRUCTURAL )
i_atid = 1
 
db_count_etop_for_a_code                          @
   (  i_acid,                                     @
      i_atid,                                     @
      i_count )
 
SYS_ALLOCATE_ARRAY(iv_etids,1,i_count)
 
i_return_value =                                  @
   db_get_etop_for_a_code                         @
      (  i_acid,                                  @
         i_atid,                                  @
         i_count,                                 @
         iv_etids )
dump i_return_value
 
#  The element topology ids for analysis code MSC.Nastran
#  and analysis type STRUCTURAL are
dump iv_etids
SYS_FREE_ARRAY(iv_etids)
#---------------------------------------------------------------------
db_get_indep_nodes_in_sub_mpc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_indep_nodes_in_sub_mpc()
#
#                      This file opens fem2.db and calls the 
#                      functions to get the first MPC ID, first
#                      Sub-MPC ID in the first MPC and the maximum
#                      number of nodes associated to the MPCs.
#                      Then it calls the function to get the IDs of 
#                      the independent nodes in the first Sub-MPC.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_indep_nodes_in_sub_mpc()
#  has the following arguments:
#  db_get_indep_nodes_in_sub_mpc
#     (  mpc_id,
#        sub_mpc_id,
#        maxnode,
#        nnode,
#        nid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_num_mpcs
INTEGER  ia_mpc_ids(8)
INTEGER  iv_id_symbol(VIRTUAL)
INTEGER  i_mpc_id
INTEGER  i_sub_mpc_id
INTEGER  i_maxnode
INTEGER  i_nnode
INTEGER  ia_nid(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Count the number of MPCs in the database
i_return_value =                                 @
   db_count_mpcs                                 @
      ( i_num_mpcs )
 
#  Get the MPC ids
i_return_value =                                 @
   db_get_mpc_ids                                @
      ( i_num_mpcs,                              @
        ia_mpc_ids )
 
i_mpc_id = ia_mpc_ids(1)
 
#  Get all the SUB MPCs.
i_return_value =                                 @
   db_get_all_sub_mpc                            @
      ( i_mpc_id )
 
#  Get the first Sub MPC ID
i_return_value =                                 @
   db_get_next_sub_mpc                           @
      ( i_mpc_id,                                @
        i_sub_mpc_id )
 
#  Get the Maximum number of nodes which may be returned for the
#  Sub-MPC
i_return_value =                                 @
   fem_get_mpc_assoc_nodes                       @
      ( i_num_mpcs,                              @
        ia_mpc_ids,                              @
        i_maxnode,                               @
        iv_id_symbol )
 
#  Call the function to get the independent nodes in first  Sub MPC.
i_return_value =                                 @
   db_get_indep_nodes_in_sub_mpc                   @
      (  i_mpc_id,                               @
         i_sub_mpc_id,                           @
         i_maxnode,                              @
         i_nnode,                                @
         ia_nid )
dump i_return_value
 
#  The number of nodes using the Sub-MPC
dump i_nnode
#  IDs of the independent nodes for the Sub-MPC
dump ia_nid
 
sys_free_array( iv_id_symbol )
#---------------------------------------------------------------------
db_get_max_elem_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_elem_id()
#
#                      This file opens fem1.db and calls the function
#                      to get maximum element id. fem1.db contains 
#                      16 elements.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_max_elem_id() has the following arguments:
#  db_get_max_elem_id
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
i_return_value =                                 @
   db_get_max_elem_id                            @
      (  i_id )
dump i_return_value
 
#  The Maximum element id in use is
dump i_id
#---------------------------------------------------------------------
db_get_max_node_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_max_node_id()
#
#                      This file opens fem3.db and calls the function
#                      to get the Largest Node Id in the database.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_max_node_id() has the following arguments:
#  db_get_max_node_id
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the Largest Node ID
#
i_return_value =                                 @
   db_get_max_node_id                            @
      (  i_id )
dump i_return_value
 
#  The largest Node ID is
dump i_id
#---------------------------------------------------------------------
db_get_mesh_params
 
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_mesh_params()
#
#                      This file opens fem3.db and calls the function
#                      to get the definition of an edge mesh.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_mesh_params() has the following arguments:
#  db_get_mesh_params
#     (  wmesh,
#        mshcyc,
#        relaxm,
#        tolmsh,
#        dgmesh,
#        itrngl )
#
#---------------------------------------------------------------------
#  Variable Declarations
REAL     r_wmesh
INTEGER  i_mshcyc
REAL     r_relaxm
REAL     r_tolmsh
INTEGER  i_dgmesh
INTEGER  i_itrngl
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the definition of an edge mesh from the
#  database
#
i_return_value =                                 @
   db_get_mesh_params                            @
      (  r_wmesh,                                @
         i_mshcyc,                               @
         r_relaxm,                               @
         r_tolmsh,                               @
         i_dgmesh,                               @
         i_itrngl )
dump i_return_value
 
#  The unique internal line identifying the mesh to be retrieved
dump r_wmesh
#  The number of elements on the edge
dump i_mshcyc
#  The mesh relaxm of the edge
dump r_relaxm
#  The tolmsh of the edge
dump r_tolmsh
#  The number of meshes on the edge
dump i_dgmesh
#  True if the edge has been itrngled
dump i_itrngl
#---------------------------------------------------------------------
db_get_min_elem_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_elem_id()
#
#                      This file opens fem1.db and calls the function
#                      to get minimum element id. fem1.db contains 
#                      16 elements. Id 1 is the minimum id.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_min_elem_id()
#  has the following arguments:
#
#  db_get_min_elem_id
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
#
i_return_value =                                 @
   db_get_min_elem_id                            @
      (  i_id )
dump i_return_value
#  Minimum element id  in use is 
dump i_id
#---------------------------------------------------------------------
db_get_min_node_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_min_node_id()
#
#                      This file opens fem3.db and calls the function
#                      to get the smallest Node ID in the database.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_min_node_id() has the following arguments:
#  db_get_min_node_id
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the smallest ID of the Nodes in the 
#  database.
#
i_return_value =                                 @
   db_get_min_node_id                            @
      (  i_id )
dump i_return_value
 
#  The smallest Node ID is
dump i_id
#---------------------------------------------------------------------
db_get_mpc_type_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_mpc_type_id()
#
#                      This file opens fem2.db and calls the function
#                      to get the id of MPC type “Explicit”
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_mpc_type_id() has the following arguments:
#  db_get_mpc_type_id
#     (  mpc_type_name,
#        mpc_type_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_mpc_type_name[128]
INTEGER  i_mpc_type_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the ID of the MPC type “Explicit”
#  List of MPCs and their IDs can be referred in Chapter 7 of
#  MSC Patran Users Manual, Volume 4.
#
s_mpc_type_name = “Explicit”
 
i_return_value =                                 @
   db_get_mpc_type_id                            @
      (  s_mpc_type_name,                        @
         i_mpc_type_id )
dump i_return_value
 
#  The ID of the MPC type “Explicit” is
dump i_mpc_type_id
#---------------------------------------------------------------------
db_get_mpc_type_name
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_mpc_type_name()
#
#                      This file opens fem2.db and calls the function
#                      to get the name of the MPC type whose ID is 1.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#                      This file can be run by starting a session of
#                      MSC Patran, opening a new or existing database,
#                      and running this session file through the 
#                      “File”,”Session”,”Play” pulldown menus
#                      on the menu bar.
#
#  The function db_get_mpc_type_name()
#  has the following arguments:
#
#  db_get_mpc_type_name
#     (  mpc_type_id,
#        mpc_type_name )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_mpc_type_id
STRING   s_mpc_type_name[128]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Call the function to get the name of MPC type whose ID is 1.
#  List of MPC types and the IDs can be referred in Chapter 7 of 
#  MSC Patran Users Manual, Volume 4.
#
i_mpc_type_id = 1
 
i_return_value =                                 @
   db_get_mpc_type_name                          @
      (  i_mpc_type_id,                          @
         s_mpc_type_name )
dump i_return_value
 
#  The name of the MPC Type is
dump s_mpc_type_name
#---------------------------------------------------------------------
 
db_get_next_elem_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_elem_id()
#
#                      This file opens fem1.db and calls the function
#                      to get the next available element id. The 
#                      fem1.db contains 16 elements.
#                      
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_elem_id()
#  has the following arguments:
#  db_get_next_elem_id
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
i_return_value =                                 @
   db_get_next_elem_id                           @
      (  i_id )
dump i_return_value
 
#  The next element id available is 
dump i_id
 
#---------------------------------------------------------------------
db_get_next_mpc_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_mpc_id()
#
#                      This file opens fem2.db and calls the function
#                      to get the next available mpc id.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs) and 2
#                      LBCs. 
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_mpc_id()
#  has the following arguments:
#
#  db_get_next_mpc_id
#     (  next_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_next_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Call the function to get the next mpc id
#
i_return_value =                                 @
   db_get_next_mpc_id                            @
      (  i_next_id )
dump i_return_value
#  The next MPC Id is 
dump i_next_id
#---------------------------------------------------------------------
db_get_next_node_id
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_node_id()
#
#                      This file opens fem3.db and calls the function
#                      to get the next available node id.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_node_id() has the following arguments:
#  db_get_next_node_id
#     (  id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function db_get_max_node_id() to get the Largest Node Id
i_return_value =                                 @
   db_get_max_node_id (i_id)
 
#  Largest Node ID is
dump i_id
 
#  Call the function to get the next available Node ID.
#
i_return_value =                                 @
   db_get_next_node_id                           @
      (  i_id )
dump i_return_value
 
#  Next available Node ID is
dump i_id
#---------------------------------------------------------------------
db_get_next_valid_mpc_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_next_valid_mpc_type()
#
#                      This file opens fem2.db and calls the function
#                      db_count_valid_mpc_types() to get the number
#                      of valid MPC types. Then it calls db_get_all_
#                      valid_mpc_type() to make available all the 
#                      valid MPC types. Function db_get_next_valid_
#                      mpc_type() is called to get the MPC type ID
#                      and name.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_next_valid_mpc_type() has the following
#  arguments.
#  db_get_next_valid_mpc_type
#     ( mpc_type_id,
#       mpc_type_name )
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_numtypes, i_count
INTEGER  i_mpc_type_id
STRING   s_mpc_type_name[16]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the number of valid mpc types for the default analysis type
#  and code.
i_return_value =                                 @
   db_count_valid_mpc_types                      @
      ( i_numtypes )
 
#  Get all the valid MPC types in the database
#
i_return_value =                                 @
   db_get_all_valid_mpc_type()
dump i_return_value
 
FOR ( i_count = 1 TO i_numtypes )
   i_return_value =                              @
      db_get_next_valid_mpc_type                 @
         ( i_mpc_type_id,                        @
           s_mpc_type_name )
   dump i_return_value
   dump i_mpc_type_id
   dump s_mpc_type_name
END FOR
#---------------------------------------------------------------------
 
db_get_nodal_association
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_nodal_association()
#
#                      This file opens fem3.db and calls the function
#                      to get the array of geometry IDs and Types 
#                      associated with nodes 1:16.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_nodal_association()
#  has the following arguments:
#
#  db_get_nodal_association
#     (  nnode,
#        nid,
#        gid,
#        gtype )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  ia_nid(16)
INTEGER  ia_gid(16)
INTEGER  ia_gtype(16)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the array of Geometry IDs and Geometry
#  Types of Node IDs 1:16
#
i_nnode = 16
ia_nid = [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ]
 
i_return_value =                                 @
   db_get_nodal_association                      @
      (  i_nnode,                                @
         ia_nid,                                 @
         ia_gid,                                 @
         ia_gtype )
dump i_return_value
 
#  IDs of the Geometry associated to Node 1:16 are
dump ia_gid
#  Array of the Geometry types associated to Node 1:16 are
dump ia_gtype
#---------------------------------------------------------------------
 
db_get_node
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_node()
#
#                      This file opens fem3.db and calls the function
#                      to get the XYZ coordinates of Node Id 17.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_node() has the following arguments:
#  db_get_node
#     (  id,
#        xyz )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_id
REAL     ra_xyz(3)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the coordinates of Node 17
#
i_id = 17
 
i_return_value =                                 @
   db_get_node                                   @
      (  i_id,                                   @
         ra_xyz )
dump i_return_value
 
#  Coordinates of Node 17 are
dump ra_xyz
#---------------------------------------------------------------------
db_get_nodes_by_lbc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_nodes_by_lbc()
#
#                      This file opens fem3.db and calls the function
#                      to get the Nodes associated with LBC 1. There
#                      are two LBCs in the database with IDs 1 and 2.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_nodes_by_lbc() has the following arguments:
#  db_get_nodes_by_lbc
#     (  lbc_id,
#        max_node,
#        nnode,
#        nid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_lbc_id
INTEGER  i_max_node
INTEGER  i_nnode
INTEGER  ia_nid(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Get the nodes associated with the LBC 1
#
i_lbc_id = 1
i_max_node = 8
 
i_return_value =                                 @
   db_get_nodes_by_lbc                           @
      (  i_lbc_id,                               @
         i_max_node,                             @
         i_nnode,                                @
         ia_nid )
dump i_return_value
 
#  Number of Nodes associated with LBC 1 is
dump i_nnode
#  IDs of the Nodes associated with LBC 1 
dump ia_nid
#---------------------------------------------------------------------
db_get_nodes_for_geometry
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_nodes_for_geometry()
#
#                      This file opens fem3.db and calls the function
#                      to get the number of nodes present in the
#                      Line 1 of Surface 1
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_nodes_for_geometry()
#  has the following arguments:
#
#  db_get_nodes_for_geometry
#     (  geo_type,
#        geo_id,
#        parent_type,
#        parent_id,
#        nnode,
#        nids,
#        ncoord )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_geo_type
INTEGER  i_geo_id
INTEGER  i_parent_type
INTEGER  i_parent_id
INTEGER  i_nnode
INTEGER  ia_nids(8)
REAL     ra_ncoord(16)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the nodes associated with the geotype 
#  Curve with ID 1 of parent type Surface with ID 1. There 2 Curves
#  associated to the Parent Surface 1 in the database.
#
i_geo_id = 1
i_geo_type = 2        /* for CURVE from dbtypes.h */
i_parent_id = 1
i_parent_type = 3     /* for SURFACE from dbtypes.h */
 
i_return_value =                                 @
   db_get_nodes_for_geometry                     @
      (  i_geo_type,                             @
         i_geo_id,                               @
         i_parent_type,                          @
         i_parent_id,                            @
         i_nnode,                                @
         ia_nids,                                @
         ra_ncoord )
dump i_return_value
 
#  Number of nodes found
dump i_nnode
#  IDs of the Nodes found
dump ia_nids
#  Coordinates of the Nodes found
dump ra_ncoord
#---------------------------------------------------------------------
db_get_nodes_in_mpc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_nodes_in_mpc()
#
#                      This file opens fem3.db and calls the function
#                      to retrieve all nodes associated with the MPCs
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_nodes_in_mpc() has the following arguments:
#
#  db_get_nodes_in_mpc
#     (  nmpc,
#        mpcid,
#        mxnode,
#        nnode,
#        nid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nmpc
INTEGER  ia_mpcid(2)
INTEGER  i_mxnode
INTEGER  ia_nnode(2)
INTEGER  ia_nid(10)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Get the number of MPCs in the database
i_return_value =                                 @
   db_count_mpcs( i_nmpc )
dump i_return_value
 
#  Get the IDs of the MPCs in the database
i_return_value =                                 @
   db_get_mpc_ids                                @
      ( i_nmpc,                                  @
        ia_mpcid )
dump i_return_value
 
#  Call the function to return the list of all the nodes associated
#  with the MPCs.
#
i_mxnode = 5
 
i_return_value =                                 @
   db_get_nodes_in_mpc                           @
      (  i_nmpc,                                 @
         ia_mpcid,                               @
         i_mxnode,                               @
         ia_nnode,                               @
         ia_nid )
dump i_return_value
 
#  The number of nodes using each MPC
dump ia_nnode
#  IDs of the Nodes for each MPC
dump ia_nid
#---------------------------------------------------------------------
db_get_nxt_valid_dof_f_mpc_type
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_nxt_valid_dof_f_mpc_type()
#
#                      This file opens fem2.db and calls the function
#                      db_count_valid_dofs_f_mpc_type() to get the
#                      number of DOFs for the MPC type “Explicit”. It
#                      calls db_get_all_valid_dof_f_mpc_type() to get
#                      all the valid DOF. Then it calls the function
#                      to get the name and id of valid DOFs.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_nxt_valid_dof_f_mpc_type() has the following
#  arguments:
#  db_get_nxt_valid_dof_f_mpc_type
#     ( i_mpc_type_id, 
#       i_dof_id,     
#       s_dof_name )
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_mpc_type_name[16]
INTEGER  i_num_dofs,i_count
INTEGER  i_mpc_type_id
INTEGER  i_dof_id
STRING   s_dof_name[16]
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the ID of the MPC type “Explicit”
s_mpc_type_name = “Explicit”
i_return_value =                                 @
   db_get_mpc_type_id                            @
      (  s_mpc_type_name,                        @
         i_mpc_type_id )
 
#  Get the number of Valid Degree Of Freedoms for MPC type “Explicit”
i_return_value =                                 @
   db_count_valid_dofs_f_mpc_type                @
      ( i_mpc_type_id,                           @
        i_num_dofs )
 
#  Call the function to get all the valid DOF for the MPC type
#  “Explicit”. This function should be called before the call
#  to the function db_get_nxt_valid_dof_f_mpc_type().
#
i_return_value =                                 @
   db_get_all_valid_dof_f_mpc_type               @
      (  i_mpc_type_id )
dump i_return_value
 
#  Get the next DOF ID and name for the MPC type “Explicit”
FOR ( i_count = 1 TO i_num_dofs )
   i_return_value =                              @
      db_get_nxt_valid_dof_f_mpc_type            @
         ( i_mpc_type_id,                        @
           i_dof_id,                             @
           s_dof_name )
   dump i_return_value
   dump i_dof_id
   dump s_dof_name
END FOR
#---------------------------------------------------------------------
db_get_unreferenced_node_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_unreferenced_node_ids()
#
#                      This file opens fem3.db and calls the function
#                      to get the unreferenced node IDs from the 
#                      database.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It 
#                      contains 4 unreferenced nodes.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_unreferenced_node_ids() has the following
#  arguments:
#  db_get_unreferenced_node_ids
#     (  nnode,
#        nunref,
#        nid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  i_nunref
INTEGER  ia_nid(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to count the number of nodes.
i_return_value =                                 @
   db_count_nodes( i_nnode )
#
i_return_value =                                 @
   db_get_unreferenced_node_ids                  @
      (  i_nnode,                                @
         i_nunref,                               @
         ia_nid )
dump i_return_value
 
#  The number of unreferenced nodes found
dump i_nunref
#  IDs of the Unreferenced nodes
dump ia_nid
#---------------------------------------------------------------------
db_get_valid_mpc_ids_in_group
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_get_valid_mpc_ids_in_group()
#
#                      This file opens fem2.db and calls the function
#                      db_get_current_group_id() to get the current
#                      group id. Then it gets the number of valid
#                      MPCs in the group. Finally,it calls the
#                      function to get the IDs of those MPCs.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_get_valid_mpc_ids_in_group()
#  has the following arguments:
#  db_get_valid_mpc_ids_in_group
#     (  gid,
#        nmpc,
#        numval,
#        mpcid )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_gid
INTEGER  i_nmpc
INTEGER  i_numval
INTEGER  ia_mpcid(8)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Get the ID  of the current group
i_return_value =                                 @
   db_get_current_group_id                       @
      ( i_gid )
 
#  Get the number of MPCs in the current group
i_return_value =                                 @
   db_count_valid_mpc_types                      @
       ( i_nmpc )
 
#  Get the IDs of the MPCs in the current group.
i_return_value =                                 @
   db_get_valid_mpc_ids_in_group                 @
      (  i_gid,                                  @
         i_nmpc,                                 @
         i_numval,                               @
         ia_mpcid )
dump i_return_value
 
#  The actual number of valid MPCs
dump i_numval
#  The MPC IDs
dump ia_mpcid
#---------------------------------------------------------------------
db_update_elem_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_update_elem_ids()
#
#                      This file opens fem1.db and calls the function
#                      to update element ID of the maximum element id.
#                      Finally it sets the ID to its original value.
#                      fem1.db contains 16 elements.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_update_elem_ids() has the following arguments:
#  db_update_elem_ids
#     (  numelem,
#        old_id,
#        new_id )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_numelem, i_id, ia_old_id(1)
INTEGER  ia_new_id(1), i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Get the Maximum Element id in the database.
i_return_value = db_get_max_elem_id(i_id)
 
#  Maximum element id is
dump i_id
 
#  Change the id of the Maximum id to a new value (i.e. i_id + 10)
#  by calling the function db_update_elem_ids()
 
ia_old_id = i_id
i_id = i_id + 10
ia_new_id = i_id
i_numelem = 1
 
i_return_value =                                 @
   db_update_elem_ids                            @
      (  i_numelem,                              @
         ia_old_id,                              @
         ia_new_id )
 
dump i_return_value
 
#  Verify the function by again calling db_get_max_elem_id()
i_return_value = db_get_max_elem_id(i_id)
#  Maximum element id is
dump i_id
 
#  Change the Maximum id to the old value itself.
ia_new_id = ia_old_id
ia_old_id = i_id
 
i_return_value =                                 @
   db_update_elem_ids                            @
      (  i_numelem,                              @
         ia_old_id,                              @
         ia_new_id )
 
dump i_return_value
#---------------------------------------------------------------------
 
db_update_elem_types
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_update_elem_types()
#
#                      This file opens fem1.db and calls the function
#                      db_get_elems() to get all information about
#                      element 1. Then it updates the element into 
#                      “Hex20” and calls the function db_get_elems()
#                      to get the information. fem1.db contains 16
#                      elements.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_update_elem_types() has the following arguments:
#  db_update_elem_types
#     (  nelem,
#        mxnode,
#        eid,
#        etop,
#        econ )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nelem
INTEGER  i_maxnode
INTEGER  ia_eid(1)
INTEGER  ia_etop(1)
INTEGER  ia_econ(1,20)
INTEGER  ia_gtype(1)
INTEGER  ia_gid(1)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Get the information of the Element 1.
i_nelem = 1
i_maxnode = 8
ia_eid = [1]
 
i_return_value =                                 @
   db_get_elems                                  @
      (  i_nelem,                                @
         i_maxnode,                              @
         ia_eid,                                 @
         ia_etop,                                @
         ia_gtype,                               @
         ia_gid,                                 @
         ia_econ )
dump i_return_value
 
#  The element topology of Elem 1 is
dump ia_etop
#  Array of node ids belong to Element 1 is
dump ia_econ
#---------------------------------------------------------------------
#  Update the Element 1 to have a topology Hex20 (Id = 20). Hex20 will
#  have 20 nodes.
#
ia_etop(1) = 20
i_maxnode = 20
 
i_return_value =                                 @
   db_update_elem_types                          @
      (  i_nelem,                                @
         i_maxnode,                               @
         ia_eid,                                 @
         ia_etop,                                @
         ia_econ )
dump i_return_value
#---------------------------------------------------------------------
#  Get the information of the Element 1 again.
#
i_return_value =                                 @
   db_get_elems                                  @
      (  i_nelem,                                @
         i_maxnode,                              @
         ia_eid,                                 @
         ia_etop,                                @
         ia_gtype,                               @
         ia_gid,                                 @
         ia_econ )
dump i_return_value
 
#  The element topology of Elem 1 is
dump ia_etop
#  Array of node ids belong to Element 1 is
dump ia_econ
#---------------------------------------------------------------------
db_validate_mpc
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_validate_mpc()
#
#                      This file opens fem2.db and calls the function
#                      to validate the first MPC in the database.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_validate_mpc() has the following arguments:
#  db_validate_mpc
#     (  mpc_id,
#        valid_flag )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nmpc
INTEGER  ia_idmpcs(8)
INTEGER  i_mpc_id
LOGICAL  l_valid_flag
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Count the number of MPCs in the database.
i_return_value =                                 @
   db_count_mpcs(i_nmpc)
 
#  Get the IDs of the MPCs
i_return_value =                                 @
   db_get_mpc_ids( i_nmpc, ia_idmpcs )
 
#  Validate the first MPC in the database.
#
i_mpc_id = ia_idmpcs(1)
 
i_return_value =                                 @
   db_validate_mpc                               @
      (  i_mpc_id,                               @
         l_valid_flag )
dump i_return_value
#  Dump to see whether MPC is VALID or not.
#  The first MPC should be valid or TRUE
dump l_valid_flag
 
#  Check and invalid MPC id.
#
i_mpc_id = i_nmpc + 1
 
i_return_value =                                 @
   db_validate_mpc                               @
      (  i_mpc_id,                               @
         l_valid_flag )
dump i_return_value
#  Dump to see whether MPC is VALID or not.
#  This MPC should be invalid or FALSE
dump l_valid_flag
 
#---------------------------------------------------------------------
db_verify_nodes_exist
()
#  Purpose          :  This file provides an example of a call to the
#                      function db_verify_nodes_exist()
#
#                      This file opens fem3.db and calls the function
#                      to verify an array of Node Ids for the
#                      existence of the nodes in the database.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function db_verify_nodes_exist() has the following arguments:
#  db_verify_nodes_exist
#     (  nnode,
#        nid,
#        exist )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  ia_nid(4)
INTEGER  ia_exist(4)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to verify the Node list [1,2,50,51]
#
i_nnode = 4
ia_nid = [1,2,50,51]
 
i_return_value =                                 @
   db_verify_nodes_exist                         @
      (  i_nnode,                                @
         ia_nid,                                 @
         ia_exist )
dump i_return_value
 
#  Array of integers indicating the presense of Node in the database
dump ia_exist
#---------------------------------------------------------------------
 
fem_create_mesh_sol_3
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_create_mesh_sol_3()
#
#                      This function creates Finite Element mesh on 
#                      solids and returns the FEM data for the solid.
#                      It returns an integer status of zero on 
#                      successful completion.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function fem_create_mesh_sol_3()
#  has the following arguments:
#
#   fem_create_mesh_sol_3
#     (mesher_pick,
#            flag,
#      solid_list,
#         num_val,
#       val_array,
#       elem_topo,
#       node_list,
#       elem_list,
#   a_coord_frame,
#   r_coord_frame,
#       num_nodes,
#      elem_nodes, 
#   nodes_created,
#    elems_created )
#
#---------------------------------------------------------------------
#  Variable Declarations
      INTEGER fem_create_mesh_solid_num_nodes
      INTEGER fem_create_mesh_solid_num_elems
      STRING fem_create_mesh_s_nodes_created[VIRTUAL]
      STRING fem_create_mesh_s_elems_created[VIRTUAL]
      STRING asm_create_hpat_xyz_created_ids[VIRTUAL]
      INTEGER int_status
#----------------------------------------------------------------------
#  Open a new database
     if(!db_is_open())THEN
     uil_file_new.go("","new.db")
$? YES 36000002
     endif
#----------------------------------------------------------------------
#  Setting the preference to MSC.Nastran.
 
       uil_pref_analysis.set_analysis_pref( "MSC.Nastran",    @
                                   "Structural",              @
                                   "",                        @
                                   ".op2" )
#---------------------------------------------------------------------
#  Create Geometric entities
 
      asm_const_hpat_xyz(    "1",                            @
                             "<10 10 10>",                   @
                             "[0 0 0]",                      @
                             "Coord 0",                      @
                             asm_create_hpat_xyz_created_ids )
#---------------------------------------------------------------------
#  Create Finite Element entities using the function 
#  fem_create_mesh_sol_3 to create 216 nodes and 125 elements
#  for the Solid 1
 
      int_status = fem_create_mesh_sol_3( "IsoMesh",         @
                             0,                              @
                             "Solid 1 ",                     @
                             1,                              @
                             [2.],                           @
                             "Hex8",                         @
                             "1",                            @
                             "1",                            @
                             "Coord 0",                      @
                             "Coord 0",                      @
                             fem_create_mesh_solid_num_nodes,@
                             fem_create_mesh_solid_num_elems,@
                             fem_create_mesh_s_nodes_created,@
                             fem_create_mesh_s_elems_created )
 
dump int_status
#---------------------------------------------------------------------
#  Closing the file new.db
 
#      uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
# End of file.
fem_get_elem_assoc_groups
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_elem_assoc_groups()
#
#                      This file opens fem1.db and calls the function
#                      to get all groups associated with element Id’s
#                      1 to 4. fem1.db contains  only one group.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_elem_assoc_groups()
#  has the following arguments:
#
#  fem_get_elem_assoc_groups
#     (  nelem,
#        idelems,
#        ngroups,
#        id_symbols )
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nelem
INTEGER  ia_idelems(4)
INTEGER  i_ngroups
INTEGER  iv_id_symbols(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem1.db
uil_file_open.go(“fem1.db”)
 
#  Call the function to get the group id of the element 1 to 4
i_nelem = 4
ia_idelems=[1, 2, 3, 4]
 
i_return_value =                                 @
   fem_get_elem_assoc_groups                     @
      (  i_nelem,                                @
         ia_idelems,                             @
         i_ngroups,                              @
         iv_id_symbols )
dump i_return_value
 
#  Number of groups associated with elements 1 to 4
dump i_ngroups
#  Associated group IDs are
dump iv_id_symbols
 
sys_free_array( iv_id_symbols ) 
#---------------------------------------------------------------------
fem_get_elem_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_elem_ids()
#
#                      This file opens fem1.db and calls the function
#                      to get the element ids present in the database.
#                      fem1.db contains 16 elements.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_elem_ids() has the following arguments:
#  fem_get_elem_ids
#     (  entity_list,
#        nelem,
#        idelem_symbol,
#        notfound,
#        noexist_symbol )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_entity_list[128]
INTEGER  i_nelem
INTEGER  iav_idelem_symbol(VIRTUAL)
INTEGER  i_notfound
INTEGER  iav_noexist_symbol(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Extract the array of existing element ids from the following entity
#  list by calling the function fem_get_elem_ids()
#
s_entity_list=”Elm 1:18”
 
i_return_value =                                 @
   fem_get_elem_ids                              @
      (  s_entity_list,                          @
         i_nelem,                                @
         iav_idelem_symbol,                       @
         i_notfound,                             @
         iav_noexist_symbol )
 
dump i_return_value
 
#  Number of Existing element ids
dump i_nelem
#  Array of sorted element ids
dump iav_idelem_symbol
#  Number of elements that were not found
dump i_notfound
#  Array of sorted nonexistent ids
dump iav_noexist_symbol
 
sys_free_array( iav_idelem_symbol )
sys_free_array( iav_noexist_symbol )
#---------------------------------------------------------------------
fem_get_mpc_assoc_groups
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_mpc_assoc_groups()
#
#                      This file opens fem2.db and calls the function
#                      db_count_mpcs() to get the number of MPCs in
#                      the database. Then it calls the function to 
#                      get the list of groups associated with the 
#                      MPCs.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_mpc_assoc_groups() has the following 
#  arguments:
#  fem_get_mpc_assoc_groups
#     (  nmpc,
#        idmpcs,
#        ngroups,
#        assoc_group_ids )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nmpc
INTEGER  ia_idmpcs(8)
INTEGER  i_ngroups
INTEGER  iv_assoc_group_ids(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Count the number of MPCs in the database.
i_return_value =                                 @
   db_count_mpcs(i_nmpc)
 
#  Get the IDs of the MPCs
i_return_value =                                 @
   db_get_mpc_ids( i_nmpc, ia_idmpcs )
 
#  Get the list of all the groups associated with the MPCs.
i_return_value =                                 @
   fem_get_mpc_assoc_groups                      @
      (  i_nmpc,                                 @
         ia_idmpcs,                               @
         i_ngroups,                             @
         iv_assoc_group_ids )
dump i_return_value
 
#  Number of unique groups associated with MPCs
dump i_ngroups
#  Array of IDs of the groups associated to MPCs
dump iv_assoc_group_ids
 
sys_free_array( iv_assoc_group_ids )
#---------------------------------------------------------------------
fem_get_mpc_assoc_nodes
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_mpc_assoc_nodes()
#
#                      This file opens fem2.db and calls the function
#                      db_get_mpc_ids() to get the id of the existing
#                      MPC. Then it calls the function to get the
#                      associated node list.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs) and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_mpc_assoc_nodes() has the following arguments:
#  fem_get_mpc_assoc_nodes
#     (  nmpc,
#        idmpcs,
#        nnodes,
#        id_symbols )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nmpc
INTEGER  ia_idmpcs(8)
INTEGER  i_nnodes
INTEGER  iv_id_symbols(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Count the number of MPCs in the database.
i_return_value =                                 @
   db_count_mpcs(i_nmpc)
 
#  Number of MPCs in the database is
dump i_nmpc
 
#  Get the IDs of the MPCs
i_return_value =                                 @
   db_get_mpc_ids( i_nmpc, ia_idmpcs )
 
#  Get the list of all associated nodes with the MPCs
i_return_value =                                 @
   fem_get_mpc_assoc_nodes                       @
      (  i_nmpc,                                 @
         ia_idmpcs,                              @
         i_nnodes,                               @
         iv_id_symbols )
dump i_return_value
 
#  Number of Nodes associated with MPCs
dump i_nnodes
#  Associated Nodes are
dump iv_id_symbols
 
sys_free_array(iv_id_symbols)
#---------------------------------------------------------------------
fem_get_mpc_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_mpc_ids()
#
#                      This file opens fem2.db and calls the function
#                      to extract the array of existing MPC IDs from
#                      the list supplied.
#
#                      Before running this session file, run fem2.ses
#                      to create fem2.db. The fem2.db contains 32 
#                      Quad elements, 1 MPC(with 3 Sub-MPCs and 2 
#                      LBCs.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_mpc_ids() has the following arguments:
#  fem_get_mpc_ids
#     (  entity_list,
#        nmpc,
#        nempc,
#        idmpc_symbol,
#        notfound,
#        idnoexist_symbol )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_entity_list[128]
INTEGER  i_nempc
INTEGER  iv_idmpc_symbol(VIRTUAL)
INTEGER  i_notfound
INTEGER  iv_idnoexist_symbol(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem2.db
uil_file_open.go(“fem2.db”)
 
#  Call the function with a MPC list which contains few existing
#  and few nonexisting MPCs.
#
s_entity_list = “Mpc 1 2 3”
 
i_return_value =                                 @
   fem_get_mpc_ids                               @
      (  s_entity_list,                          @
         i_nempc,                                @
         iv_idmpc_symbol,                        @
         i_notfound,                             @
         iv_idnoexist_symbol )
dump i_return_value
 
#  Number of existing MPCs in the list passed is
dump i_nempc
#  Array containing IDs of existing MPCs in the list passed
dump iv_idmpc_symbol
#  Number of non existing MPCs in the list passed is
dump i_notfound
#  Array containing IDs of non existing MPCs in the list passed
dump iv_idnoexist_symbol
 
sys_free_array(iv_idmpc_symbol)
sys_free_array(iv_idnoexist_symbol)
#---------------------------------------------------------------------
fem_get_node_assoc_groups
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_node_assoc_groups()
#
#                      This file opens fem3.db and calls the function
#                      to get the number of groups and their ids 
#                      which are associated to the Nodes 1 & 20.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_node_assoc_groups()
#  has the following arguments:
#  fem_get_node_assoc_groups
#     (  nnode,
#        idnodes,
#        ngroups,
#        id_symbol )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_nnode
INTEGER  ia_idnodes(2)
INTEGER  i_ngroups
INTEGER  iv_id_symbol(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Call the function to get the groups associated to the Nodes 1,20.
#
i_nnode = 2
ia_idnodes = [ 1,20 ]
 
i_return_value =                                 @
   fem_get_node_assoc_groups                     @
      (  i_nnode,                                @
         ia_idnodes,                             @
         i_ngroups,                              @
         iv_id_symbol )
dump i_return_value
 
#  Number of groups associated with nodes
dump i_ngroups
#  Associated group IDs
dump iv_id_symbol
 
sys_free_array(iv_id_symbol)
#---------------------------------------------------------------------
fem_get_node_ids
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_get_node_ids()
#
#                      This file opens fem3.db and calls the function
#                      to extract the array of existing Node IDs
#                      from the list of IDs supplied.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_get_node_ids() has the following arguments:
#  fem_get_node_ids
#     (  entity_list,
#        nenode,
#        id_node_symbol,
#        notfound,
#        id_noexist_symbol )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_entity_list[32]
INTEGER  i_nenode
INTEGER  iv_id_node_symbol(VIRTUAL)
INTEGER  i_notfound
INTEGER  iv_id_noexist_symbol(VIRTUAL)
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Extract the existing Node Ids from the ID list [1,2,50,51]
#
s_entity_list = “Node 1 2 50 51”
 
i_return_value =                                 @
   fem_get_node_ids                              @
      (  s_entity_list,                          @
         i_nenode,                               @
         iv_id_node_symbol,                      @
         i_notfound,                             @
         iv_id_noexist_symbol )
dump i_return_value
 
#  Number of Existing Node IDs
dump i_nenode
#  Existing Node IDs are
dump iv_id_node_symbol
#  Number of Nodes that were not found
dump i_notfound
#  Nonexistent Node IDs in the List supplied are
dump iv_id_noexist_symbol
 
sys_free_array(iv_id_node_symbol)
sys_free_array(iv_id_noexist_symbol)
#---------------------------------------------------------------------
fem_seed_display_dir_arrows
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_seed_display_dir_arrows()
#
#                      This file opens fem3.db and calls the function
#                      gm_segment_create() to create a segment. Then
#                      it calls the function to display the direction
#                      arrows on all visible curves.
#
#                      Before running this session file, run fem3.ses
#                      to create fem3.db. The fem3.db contains 9 
#                      Quad elements, 2 LBCs, 1 MPC, 21 nodes , a 
#                      surface and 2 lines on that surface. It also
#                      contains 2 groups.
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_seed_display_dir_arrows()
#  has the following arguments:
#  fem_seed_display_dir_arrows
#     (  arrow_segment )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  i_arrow_segment
INTEGER  i_return_value
#---------------------------------------------------------------------
#  Open the database fem3.db
uil_file_open.go(“fem3.db”)
 
#  Create a segment.
i_return_value =                                 @
   gm_segment_create ( i_arrow_segment )
dump i_return_value
 
#  Note that the curves in default viewport doesnot have direction
#  arrows.
#  Session file paused to observe the viewport. Press “Resume” to
#  continue..
sf_pause()
#---------------------------------------------------------------------
#  Call the function to display the direction arrows on all visible
#  curves.
#
i_return_value =                                 @
   fem_seed_display_dir_arrows                   @
      (  i_arrow_segment )
dump i_return_value
 
#  Note the direction arrows on the curves.
#---------------------------------------------------------------------
fem_u_get_free_edges
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_u_get_free_edges()
#
#                      This file opens fem1.db and calls the function
#                      to get all the free edges in the database.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_u_get_free_edges()
#  has the following arguments:
#  fem_u_get_free_edges
#     (  el_ids,
#        max_nodes,
#        max_per_edge,
#        max_edges,
#        nels,
#        el_con,
#        el_shape,
#        el_nodes,
#        edge_el_ids,
#        edge_ids,
#        free_edges )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_el_ids(16)
INTEGER  i_max_nodes
INTEGER  i_max_per_edge
INTEGER  i_max_edges
INTEGER  i_nels
INTEGER  ia_el_con(128)
INTEGER  ia_el_shape(16)
INTEGER  ia_el_nodes(16)
INTEGER  ia_edge_el_ids(192)
INTEGER  ia_edge_ids(192)
INTEGER  i_free_edges
INTEGER  i_return_value
INTEGER  ia_etop(16)
INTEGER  ia_gtype(16)
INTEGER  ia_gid(16)
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Get the information of the 16 elements in the database.
i_nels = 16
i_max_nodes = 8
ia_el_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
 
i_return_value =                                 @
   db_get_elems                                  @
      (  i_nels,                                 @
         i_max_nodes,                            @
         ia_el_ids,                              @
         ia_etop,                                @
         ia_gtype,                               @
         ia_gid,                                 @
         ia_el_con )
dump i_return_value
#---------------------------------------------------------------------
#  Get the Element Shape Array
#  Each Hex 8 Element has 2 nodes per edge, 12 edges and 8 nodes.
i_max_per_edge = 2
i_max_edges = 12
ia_el_nodes=[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
 
i_return_value =                                 @
   db_get_elem_shape_for_id                      @
      (  i_nels,                                 @
         ia_el_ids,                              @
         ia_el_shape )
#---------------------------------------------------------------------
#  Get the free edges in the database.
#
i_return_value =                                 @
   fem_u_get_free_edges                          @
      (  ia_el_ids,                              @
         i_max_nodes,                            @
         i_max_per_edge,                         @
         i_max_edges,                            @
         i_nels,                                 @
         ia_el_con,                              @
         ia_el_shape,                            @
         ia_el_nodes,                            @
         ia_edge_el_ids,                         @
         ia_edge_ids,                            @
         i_free_edges )
dump i_return_value
 
#  Associated element id is
dump ia_edge_el_ids
#  Free edge id is
dump ia_edge_ids
#  Number of free edges 
dump i_free_edges
#---------------------------------------------------------------------
 
fem_u_get_free_faces
()
#  Purpose          :  This file provides an example of a call to the
#                      function fem_u_get_free_faces()
#
#                      This file opens fem1.db and calls the function
#                      to get all the free faces in the database.
#
#                      Before running this session file, run fem1.ses
#                      to create fem1.db
#
#                      This file can be run by starting a session of
#                      MSC Patran and running this session file
#                      through the “File”,”Session”,”Play” pulldown
#                      menus on the menu bar.
#
#  The function fem_u_get_free_faces()
#  has the following arguments:
#  fem_u_get_free_faces
#     (  el_ids,
#        max_nodes,
#        max_per_face,
#        max_faces,
#        nels,
#        el_con,
#        el_shape,
#        el_nodes,
#        face_el_ids,
#        face_ids,
#        free_faces )
#
#---------------------------------------------------------------------
#  Variable Declarations
INTEGER  ia_el_ids(VIRTUAL)
INTEGER  i_max_nodes
INTEGER  i_max_per_face
INTEGER  i_max_faces
INTEGER  i_nels
INTEGER  iaa_econ(VIRTUAL)
INTEGER  ia_el_con(VIRTUAL)
INTEGER  ia_el_shape(VIRTUAL)
INTEGER  ia_el_nodes(VIRTUAL)
INTEGER  ia_face_el_ids(VIRTUAL)
INTEGER  ia_face_ids(VIRTUAL)
INTEGER  i_free_faces
INTEGER  i_return_value
INTEGER  ia_etop(VIRTUAL)
INTEGER  ia_gtype(VIRTUAL)
INTEGER  ia_gid(VIRTUAL)
INTEGER  i_array_size
#---------------------------------------------------------------------
#  Open the database “fem1.db”
uil_file_open.go(“fem1.db”)
 
#  Get the information of the 16 elements in the database.
i_nels      =  16
i_max_nodes =  8
 
SYS_ALLOCATE_ARRAY (ia_el_ids,   1, i_nels)
SYS_ALLOCATE_ARRAY (ia_etop,     1, i_nels)
SYS_ALLOCATE_ARRAY (ia_gtype,    1, i_nels)
SYS_ALLOCATE_ARRAY (ia_gid,      1, i_nels)
 
ia_el_ids   =  [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
 
SYS_ALLOCATE_ARRAY( iaa_econ, 1, i_nels, 1, i_max_nodes)
 
i_return_value =                                 @
   db_get_elems                                  @
      (  i_nels,                                 @
         i_max_nodes,                            @
         ia_el_ids,                              @
         ia_etop,                                @
         ia_gtype,                               @
         ia_gid,                                 @
         iaa_econ )
dump i_return_value
#---------------------------------------------------------------------
#  Get the Element Shape Array
#  Each Hex 8 Element has 4 nodes in each face, 12 faces and 8 nodes.
 
i_max_per_face    =  4
i_max_faces       =  12
 
SYS_ALLOCATE_ARRAY( ia_el_nodes, 1, i_nels )
 
ia_el_nodes       =  [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
 
SYS_ALLOCATE_ARRAY( ia_el_shape, 1, i_nels )
 
i_return_value =                                 @
   db_get_elem_shape_for_id                      @
      (  i_nels,                                 @
         ia_el_ids,                              @
         ia_el_shape )
#---------------------------------------------------------------------
#  Get the free faces in the database.
#
SYS_ALLOCATE_ARRAY( ia_el_con,   1, ( i_nels * i_max_nodes ) )
SYS_ALLOCATE_ARRAY( ia_el_nodes, 1, i_nels )
 
ia_el_nodes       =  [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
 
ia_el_con = iaa_econ
 
i_array_size = i_max_faces * i_nels
 
dump i_array_size
 
SYS_ALLOCATE_ARRAY( ia_face_el_ids, 1, i_array_size )
SYS_ALLOCATE_ARRAY( ia_face_ids,    1, i_array_size )
 
i_return_value =                                 @
   fem_u_get_free_faces                          @
      (  ia_el_ids,                              @
         i_max_nodes,                            @
         i_max_per_face,                         @
         i_max_faces,                            @
         i_nels,                                 @
         ia_el_con,                              @
         ia_el_shape,                            @
         ia_el_nodes,                            @
         ia_face_el_ids,                         @
         ia_face_ids,                            @
         i_free_faces )
dump i_return_value
 
#  Associated element id is
dump ia_face_el_ids
#  Free face id is
dump ia_face_ids
#  Number of free faces
dump i_free_faces
 
#---------------------------------------------------------------------
 
list_get_node_ass_el_edge
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_ass_el_edge()
#
#                      This function gets nodes associated to 
#                      specified element edge. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_ass_el_edge()
#  has the following arguments:
#
#  list_get_node_ass_el_edge (elem_edge_list,                        @
#                             node_list ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_surfa_num_nodes
INTEGER  fem_create_mesh_surfa_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
STRING   elem_edge_list[80]
STRING   node_list[virtual]
INTEGER  i_return_value        
        
#---------------------------------------------------------------------
# Open a new data base.  
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
#---------------------------------------------------------------------
# Create a 2-D patch. 
 
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0",           @
                     asm_create_patch_xy_created_ids )
 
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
 
fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1,            @
                        ["0.1"], "Quad4", "#", "#", "Coord 0",       @
                        "Coord 0",                                   @
                        fem_create_mesh_surfa_num_nodes,             @
                        fem_create_mesh_surfa_num_elems,             @
                        fem_create_mesh_s_nodes_created,             @
                        fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
elem_edge_list = "Elm 1.1.3, 4.1.1, 9.1.2"
 
#---------------------------------------------------------------------
# Get nodes associated to specified element edge. 
 
i_return_value = list_get_node_ass_el_edge(elem_edge_list,           @
                                           node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
#  uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
list_get_node_ass_el_face
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_ass_el_face()
#
#                      This function gets all nodes associated to 
#                      specified element faces. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_ass_el_face()
#  has the following arguments:
#
#  list_get_node_ass_el_face (elem_face_list, node_list ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_hpat_xyz_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_solid_num_nodes
INTEGER  fem_create_mesh_solid_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
STRING   elem_face_list[80]
STRING   node_list[virtual]
INTEGER  i_return_value
        
#---------------------------------------------------------------------
# Open a new data base.  
 
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
#---------------------------------------------------------------------
# Create a 3-D solid. 
 
asm_const_hpat_xyz( "1", "<1 1 1>", "[0 0 0]", "Coord 0",            @
                    asm_create_hpat_xyz_created_ids )
 
#---------------------------------------------------------------------
# Create a Fem mesh for this solid.
 
fem_create_mesh_sol_3( "IsoMesh", 16384, "Solid 1", 1, [0.1],        @
                       "Hex8", "#", "#", "Coord 0", "Coord 0",       @
                       fem_create_mesh_solid_num_nodes,              @
                       fem_create_mesh_solid_num_elems,              @
                       fem_create_mesh_s_nodes_created,              @
                       fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
elem_face_list = "Elm 50.3, 70.1, 100.3"
 
#---------------------------------------------------------------------
# Get all nodes associated to specified element faces 
 
i_return_value = list_get_node_ass_el_face(elem_face_list,           @
                                           node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
#---------------------------------------------------------------------
 
list_get_node_ass_elem
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_ass_elem()
#
#                      This function gets all nodes associated to 
#                      the specified elements. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_ass_elem()
#  has the following arguments:
#
#  list_get_node_ass_elem (elem_list, node_list ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_surfa_num_nodes
INTEGER  fem_create_mesh_surfa_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
STRING   elem_list[80]
STRING   node_list[virtual]
INTEGER  i_return_value
 
#---------------------------------------------------------------------
# Open a new data base.  
 
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
 
#---------------------------------------------------------------------
# Create a 2-D patch. 
 
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0",           @
                     asm_create_patch_xy_created_ids)
 
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
 
fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"],   @
                        "Quad4", "#", "#", "Coord 0", "Coord 0",     @
                        fem_create_mesh_surfa_num_nodes,             @
                        fem_create_mesh_surfa_num_elems,             @
                        fem_create_mesh_s_nodes_created,             @
                        fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
elem_list = "Elm 1:100"
 
#---------------------------------------------------------------------
# Get all nodes associated to specified elements. 
 
i_return_value = list_get_node_ass_elem(elem_list,                   @
                                        node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
list_get_node_ass_geo
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_ass_geo()
#
#                      This function gets all nodes associated 
#                      to specified geometry. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_ass_geo()
#  has the following arguments:
#
#  list_get_node_ass_geo (ent_list, node_list ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_surfa_num_nodes
INTEGER  fem_create_mesh_surfa_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
 
string   ent_list[80]
string   node_list[virtual]
integer  i_return_value
 
#---------------------------------------------------------------------
# Open a new data base.  
 
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
 
#---------------------------------------------------------------------
# Create a 2-D patch. 
 
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0",           @
                     asm_create_patch_xy_created_ids )
 
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
 
fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"],   @
                        "Quad4", "#", "#", "Coord 0", "Coord 0",     @
                        fem_create_mesh_surfa_num_nodes,             @
                        fem_create_mesh_surfa_num_elems,             @
                        fem_create_mesh_s_nodes_created,             @
                        fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
ent_list = "Surface 1"
 
#---------------------------------------------------------------------
# Get all nodes associated to specified geometry. 
 
i_return_value = list_get_node_ass_geo(ent_list, node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
list_get_node_ass_group
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_ass_group()
#
#                      This function gets all nodes associated to 
#                      specified groups. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_ass_group()
#  has the following arguments:
#
#  list_get_node_ass_group (num, group_list, node_list ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_surfa_num_nodes
INTEGER  fem_create_mesh_surfa_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
INTEGER  num 
STRING   group_list[80](2)
STRING   node_list[virtual]
INTEGER  i_return_value
 
#---------------------------------------------------------------------
# Open a new data base.  
 
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
 
#---------------------------------------------------------------------
# Create a 2-D patch. 
 
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0",            @
                     asm_create_patch_xy_created_ids )
 
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
 
fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"],    @
                        "Quad4","#", "#", "Coord 0", "Coord 0",       @
                        fem_create_mesh_surfa_num_nodes,              @
                        fem_create_mesh_surfa_num_elems,              @
                        fem_create_mesh_s_nodes_created,              @
                        fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Create first group "group1".
 
ga_group_create( "group1" )
 
ga_group_entity_add( "group1",                                        @
                     "Point 1 2 Surface 1 Node 1:4 12:15 23:26 3" //  @
                     "4:37 45:48 56:59 67:70 78:81 89:92 100:103" //  @
                     "111:114 Elm 1:4 11:14 21:24 31" //              @
                     ":34 41:44 51:54 61:64 71:74 81:84 91:94" )
 
ga_group_current_set( "group1" )
 
 
#---------------------------------------------------------------------
# Create second group "group2".
 
ga_group_create( "group2" )
 
ga_group_entity_add( "group2",                                        @
                     "Point 3 4 Surface 1 Node 9:11 20:22 31:33 "  // @
                     "42:44 53:55 64:66 75:77 86:88 97:99 108:110" // @
                     "119:121 Elm 8:10 18:20 28:30 " //               @
                     "38:40 48:50 58:60 68:70 78:80 88:90 98:100" )
 
ga_group_current_set( "group2" )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
num           = 2
group_list(1) = "group1"
group_list(2) = "group2"
 
#---------------------------------------------------------------------
# Get all nodes associated to specified groups. 
 
i_return_value = list_get_node_ass_group(num,                         @
                                         group_list,                  @
                                         node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
list_get_node_ass_mpc
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_ass_mpc()
#
#                      This function gets all nodes associated to 
#                      the specified mpcs. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_ass_mpc()
#  has the following arguments:
#
#  list_get_node_ass_mpc (mpc_list, node_list ) 
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_surfa_num_nodes
INTEGER  fem_create_mesh_surfa_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
 
STRING   mpc_list[80]
STRING   node_list[virtual]
INTEGER  i_return_value
 
#---------------------------------------------------------------------
# Open a new data base.  
 
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
#---------------------------------------------------------------------
# Create a 2-D patch. 
 
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0",           @
                     asm_create_patch_xy_created_ids )
 
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
 
fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.1"],   @
                        "Quad4","#", "#", "Coord 0", "Coord 0",      @
                        fem_create_mesh_surfa_num_nodes,             @
                        fem_create_mesh_surfa_num_elems,             @
                        fem_create_mesh_s_nodes_created,             @
                        fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Create one "Rigid (Fixed)" mpc. 
 
fem_create_mpc_nodal2(1, "Rigid (Fixed)", 0., 2, [TRUE, FALSE],      @
                      ["0", "0"],["Node 1:111:11","Node 11:121:11"], @
                      ["", ""] )
 
#---------------------------------------------------------------------
# Create one "Explicit" mpc.
 
fem_create_mpc_nodal2(2, "Explicit", 0., 2, [TRUE, FALSE],           @
                      ["0.", "1.0"], ["Node 112:120", "Node 2:10"],  @
                      ["UX", "UX"] )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
mpc_list = "Mpc 1:2"
 
#---------------------------------------------------------------------
# Get Nodes associated to mpcs. 
 
i_return_value = list_get_node_ass_mpc(mpc_list,                     @
                                       node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
list_get_node_att_fringe
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_att_fringe()
#
#                      This function gets all nodes with a specified fringe range. 
#                      
#                      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
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_att_fringe()
#  has the following arguments:
#
#  list_get_node_att_fringe(val,                                     @
#                           act,                                     @
#                           tol,                                     @
#                           group,                                   @
#                           node_list)
#
#---------------------------------------------------------------------
#  Variable Declarations
 
REAL     val(2)
STRING   act[80]
REAL     tol
string   group[32]
STRING   node_list[virtual]
INTEGER  i_return_value
 
#---------------------------------------------------------------------
# Open the file "spool.db" 
 
uil_file_open.go( "./spool.db" )
 
#---------------------------------------------------------------------
# Create the fringe plot for NEW RESULT CASE, Displacement 
 
res_data_load_dbresult( 0, "Nodal", "Scalar", "spool_loads",         @
                        "Static Subcase", "NEW RESULT CASE",         @
                        "Displacement", "(NON-LAYERED)", "",         @
                        "AsIs",                                      @
                        "DeriveAverage", "All",                      @
                        "ShapeFunc", "", 0. )
 
 
res_data_title( 0, "Nodal", "Scalar", 1,                             @
                ["spool_loads, Static Subcase,                       @
                NEW RESULT CASE, Displacement, (NON-LAYERED)"] )
 
 
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", "TitleDisplay:ON",         @
                           "MinMaxDisplay:ON", "ValueDisplay:OFF",   @
                           "Filter:None", "ScaleFactor:1.",          @
                           "LabelStyle:Exponential,                  @
                           12, White, 3"], TRUE )
 
 
res_display_fringe_post( "", 0, "Nodal", TRUE, TRUE )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
val(1)     = 0.0194
val(2)     = 0.234
act        = "range"
tol        = 0.005 
group      = "fem_model" 
 
#---------------------------------------------------------------------
# Get all nodes with a specified fringe range 
 
i_return_value = list_get_node_att_fringe(val,                       @
                                          act,                       @
                                          tol,                       @
                                          group,                     @
                                          node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
list_get_node_att_value
()
#  Purpose          :  This file provides an example of a call to the
#                      function list_get_node_att_value()
#
#                      This function gets all nodes with a 
#                      specified coordinate value. 
#
#                      This file can be run by starting a session of
#                      MSC Patran, running this session file through the 
#                      "File","Session","Play" pulldown menus
#                      on the menu bar.
#
#  The function list_get_node_att_value()
#  has the following arguments:
#
#  list_get_node_att_value(val_xyz,     @
#                          val_log,     @
#                          act,         @
#                          tol,         @
#                          coord,       @
#                          group,       @
#                          node_list)
#
#---------------------------------------------------------------------
#  Variable Declarations
 
STRING   asm_create_patch_xy_created_ids[VIRTUAL]
INTEGER  fem_create_mesh_surfa_num_nodes
INTEGER  fem_create_mesh_surfa_num_elems
STRING   fem_create_mesh_s_nodes_created[VIRTUAL]
STRING   fem_create_mesh_s_elems_created[VIRTUAL]
 
REAL     val_xyz(3)
LOGICAL  val_log(3)
STRING   act[80](3)
REAL     tol(3)
STRING   coord[32]
LOGICAL  group
STRING   node_list[virtual]
INTEGER  i_return_value
 
#---------------------------------------------------------------------
# Open a new data base.  
 
 
    IF( !db_is_open()) THEN
        uil_file_new.go( "", "new.db" )
    ENDIF
    
$? YES 36000002
 
#---------------------------------------------------------------------
# Create a 2-D patch. 
 
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0",           @
                      asm_create_patch_xy_created_ids )
 
#---------------------------------------------------------------------
# Create a Fem mesh for this patch.
 
fem_create_mesh_surf_3( "IsoMesh", 16384, "Surface 1", 1, ["0.05"],  @
                        "Quad4", "#", "#", "Coord 0", "Coord 0",     @
                        fem_create_mesh_surfa_num_nodes,             @
                        fem_create_mesh_surfa_num_elems,             @
                        fem_create_mesh_s_nodes_created,             @
                        fem_create_mesh_s_elems_created )
 
#---------------------------------------------------------------------
# Argument Initialization.
 
val_xyz(1) = 0.0
val_log(1) = TRUE
act(1)     = "equal"
tol(1)     = 0.005 
coord      = "coord 0"
group      = TRUE
 
#---------------------------------------------------------------------
# Get all nodes with a specified coordinate value 
 
i_return_value = list_get_node_att_value(val_xyz,                    @
                                         val_log,                    @
                                         act,                        @
                                         tol,                        @
                                         coord,                      @
                                         group,                      @
                                         node_list)
 
#---------------------------------------------------------------------
# Dump the output of the function 
 
dump node_list
dump i_return_value
 
#---------------------------------------------------------------------
# closing the patran environment.
 
# uil_file_close.goquit(  )
 
#---------------------------------------------------------------------
#  End of File.
 
move_mesh
()
#  Purpose          :  This file provides an example of a call to the
#                      function move_mesh()
#
#                      This function moves the finite element entities
#                      - vertex nodes, edge nodes and the face nodes
#                      from one surface to another.  The size of the 
#                      two surfaces should be equal and the user
#                      tolerance should be atleast equal to the normal
#                      distance between the two surface.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the "File","Session","Play" pulldown
#                      menus on the menu bar.
#
#
#  The function move_mesh()
#  has the following arguments:
#
#  move_mesh
#     (  Surface_id2,
#        Surface_id1,
#        usertol )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      INTEGER int_status
      STRING asm_create_patch_xy_created_ids[VIRTUAL]
      STRING sgm_transform_surf__created_ids[VIRTUAL]
      STRING fem_create_mesh_s_nodes_created[VIRTUAL]
      STRING fem_create_mesh_s_elems_created[VIRTUAL]
#----------------------------------------------------------------------
#  Open a new database
     if(!db_is_open())THEN
     uil_file_new.go("","new.db")
$? YES 36000002
     endif
#----------------------------------------------------------------------
#  Setting the preference to MSC.Nastran.
 
       uil_pref_analysis.set_analysis_pref( "MSC.Nastran",    @
                                   "Structural",              @
                                   "",                        @
                                   ".op2" )
#---------------------------------------------------------------------
#  Creating a Surface 1
#
      int_status = asm_const_patch_xyz(                      @
                          "1",                               @
                          "<1 1 0>",                         @
                          "[0 0 0]",                         @
                          "Coord 0",                         @
                          asm_create_patch_xy_created_ids )
dump  int_status
#---------------------------------------------------------------------
#  Making a copy of the surface -  Surface 2
 
 
      int_status = sgm_transform_translate(                  @
                          "2",                               @
                          "surface",                         @
                          "<0 0 0.5>",                       @
                          "Coord 0",                         @
                          1,                                 @
                          FALSE,                             @
                          "Surface 1",                       @
                          sgm_transform_surf__created_ids )
dump  int_status
#---------------------------------------------------------------------
#  Meshing the Surface 1 with quad4 elements
# creating 36 nodes and 25 elements for Surface 1.
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
 
      int_status = fem_create_mesh_surf_3(                   @
                          "IsoMesh",                         @
                          16384,                             @
                          "Surface 1",                       @
                          1,                                 @  
                          ["0.2"],                           @ 
                          "Quad4",                           @
                          "#",                               @
                          "#",                               @
                          "Coord 0",                         @
                          "Coord 0",                         @
                          fem_create_mesh_surfa_num_nodes,   @
                          fem_create_mesh_surfa_num_elems,   @
                          fem_create_mesh_s_nodes_created,   @
                          fem_create_mesh_s_elems_created )
dump  int_status
#---------------------------------------------------------------------
#  Using the function move mesh to move mesh from surface 1
#  to Surface 2.
 
      int_status = move_mesh(2,1,0.5)
   
dump  int_status
#---------------------------------------------------------------------
#  Closing the file new.db
 
      uil_file_close.goquit(  )
#---------------------------------------------------------------------
 
move_mesh_1
()
#  Purpose          :  This file provides an example of a call to the
#                      function move_mesh_1()
#
#                      This function moves the finite element entities
#                      - vertex nodes, edge nodes and the face nodes
#                      from one surface to another.  The size of the 
#                      two surfaces should be equal and the user
#                      tolerance should be atleast equal to the normal
#                      distance between the two surface.
#
#                      This file can be run by starting a session of
#                      MSC Patran, and running this session file 
#                      through the "File","Session","Play" pulldown 
#                      menus on the menu bar.
#
#
#  The function move_mesh_1()
#  has the following arguments:
#
#  move_mesh_1
#     (  Surface2,
#        Surface1,
#        usertol )
#
#---------------------------------------------------------------------
#  Variable Declarations
 
      INTEGER fem_create_mesh_surfa_num_nodes
      INTEGER fem_create_mesh_surfa_num_elems
      INTEGER int_status
      STRING asm_create_patch_xy_created_ids[VIRTUAL]
      STRING sgm_transform_surf__created_ids[VIRTUAL]
      STRING fem_create_mesh_s_nodes_created[VIRTUAL]
      STRING fem_create_mesh_s_elems_created[VIRTUAL]
#----------------------------------------------------------------------
#  Open a new database
     if(!db_is_open())THEN
     uil_file_new.go("","new.db")
$? YES 36000002
     endif
#----------------------------------------------------------------------
#  Setting the preference to MSC.Nastran.
 
       uil_pref_analysis.set_analysis_pref( "MSC.Nastran",    @
                                   "Structural",              @
                                   "",                        @
                                   ".op2" )
#---------------------------------------------------------------------
#  Creating a Surface 1
#
      int_status = asm_const_patch_xyz(                      @
                          "1",                               @
                          "<1 1 0>",                         @
                          "[0 0 0]",                         @
                          "Coord 0",                         @
                          asm_create_patch_xy_created_ids )
dump  int_status
#---------------------------------------------------------------------
#  Making a copy of the surface -  Surface 2
 
 
      int_status = sgm_transform_translate(                  @
                          "2",                               @
                          "surface",                         @
                          "<0 0 0.5>",                       @
                          "Coord 0",                         @
                          1,                                 @
                          FALSE,                             @
                          "Surface 1",                       @
                          sgm_transform_surf__created_ids )
dump  int_status
#---------------------------------------------------------------------
#  Meshing the Surface 1 with quad4 elements
# creating 36 nodes and 25 elements for Surface 1.
 
      ui_exec_function( "mesh_seed_display_mgr", "init" )
 
      int_status = fem_create_mesh_surf_3(                   @
                          "IsoMesh",                         @
                          16384,                             @
                          "Surface 1",                       @
                          1,                                 @  
                          ["0.2"],                           @ 
                          "Quad4",                           @
                          "#",                               @
                          "#",                               @
                          "Coord 0",                         @
                          "Coord 0",                         @
                          fem_create_mesh_surfa_num_nodes,   @
                          fem_create_mesh_surfa_num_elems,   @
                          fem_create_mesh_s_nodes_created,   @
                          fem_create_mesh_s_elems_created )
dump  int_status
#---------------------------------------------------------------------
#  Using the function move_mesh_1 to move mesh from surface 1
#  to Surface 2.
 
      int_status = move_mesh_1("Surface 2","Surface 1",0.5)
   
dump  int_status
#---------------------------------------------------------------------
#  Closing the file new.db
 
      uil_file_close.goquit(  )
#---------------------------------------------------------------------