2.2. Demonstration Routines

The demonstration routines demonstrate several ways to use the binary file access routines provided with Mechanical APDL. The programs described below (all available on your distribution media; see Accessing Mechanical APDL Binary Files for their location) demonstrate other tasks that the binary access routines can do.

2.2.1. Program bintst (Demonstrates Dumping a Binary File and Copying It for Comparison Purposes)

The bintst program dumps a binary file with the name file.rst to the screen. It then takes that file, copies it to a new file, file2.rst, and dumps the new file to the screen for comparison purposes.

2.2.1.1. Common Variables:

VariableType, Size, IntentDescription
ioutint, sc, commThe output unit number
intpdpint, sc, commThe number of integers per double precision word
lenfnmint, sc, commThe number of characters in the filename
reclngint, sc, commThe system record length

Note:  The bintst program is not part of the binlib.a library. It is included here only to aid you.


2.2.2. Subroutine bintrd (Demonstrates Printing a Dump of File Contents)

*deck,bintrd
      subroutine bintrd (pname)
c *** primary function: bin file dump utility
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c Copyright ANSYS.  All Rights Reserved.
c *** ansys, inc.
c
c     typ=int,dp,log,chr,dcp   siz=sc,ar(n)   intent=in,out,inout
c
c  input arguments:
c     variable  (typ,siz,intent)    description
c     pname     (chr,sc,in)       - name of binary file which is to
c                                   be dumped to the screen
c
c  output arguments:
c     none.
c
c  common variables:
c     iout      (int,sc,comm)     - output unit number
c     intpdp    (int,sc,comm)     - number of integers per double precision word
c     lenfnm    (int,sc,comm)     - number of characters in the filename
c     reclng    (int,sc,comm)     - system record length
c
c                           NOTE: bintrd is not part of binlib.a.  it is 
c                                 included only as an aid to users.
c


Note:  The bintrd routine and the bintwr routine described below are not part of binlib.a. This chapter includes it only to aid you. You can find the source for this routine on the product-distribution media.


Both subroutines require the following common:

COMMON/BINTCM/ IOUT,INTPDP,LENFNM,RECLNG
  • Iout is the output unit number.

  • Intpdp is the number of integers per double precision word.

  • Lenfnm is the number of characters in the filename.

  • Reclng is the system record length.

2.2.3. Subroutine bintwr (Demonstrates Copying Binary File Contents)

*deck,bintwr
      subroutine bintwr (pname,nname)
c *** primary function: bin file copy utility
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c Copyright ANSYS.  All Rights Reserved.
c *** ansys, inc.
c
c     typ=int,dp,log,chr,dcp   siz=sc,ar(n)   intent=in,out,inout
c
c  input arguments:
c     variable  (typ,siz,intent)    description
c     pname     (chr,sc,in)       - name of binary file which is to be copied
c
c  output arguments:
c     variable  (typ,siz,intent)    description
c     nname     (chr,sc,out)      - name of new binary file which is a copy
c                                   of pname
c  common variables:
c     iout      (int,sc,comm)     - output unit number
c     intpdp    (int,sc,comm)     - number of integers per double precision word
c     lenfnm    (int,sc,comm)     - number of characters in the filename
c     reclng    (int,sc,comm)     - system record length
c
c                           NOTE: bintwr is not part of binlib.a.  it is 
c                                 included only as an aid to users.
c

2.2.4. Program ResRdDemo (Demonstrates Reading a Results File)

Program ResRdDemo demonstrates how to read a results file using the results file access routines. The file must be named test.rst and the file contents are written to the screen.

This file resides in the subdirectory \Program Files\ANSYS Inc\V242\ANSYS\customize\user (on Windows systems) or /ansys_inc/v242/ansys/customize/misc (on Linux systems).

2.2.5. Program ResWrDemo (Demonstrates Writing a Results File)

Program ResWrDemo demonstrates how to write a Mechanical APDL-readable results file. This file resides in the subdirectory \Program Files\ANSYS Inc\V242\ANSYS\customize\user (on Windows systems) or /ansys_inc/v242/ansys/customize/misc (on Linux systems).

The intent of ResWrDemo is to show how the results file is constructed. It does not include the most up-to-date and comprehensive results file records. To obtain a complete results file, you should run Mechanical APDL directly.