PURPOSE

To write data to a FMS Matrix File.

SYNOPSIS

CALL FMSROW (IEQN, DATA, LUA)
CALL FMSCOL (IEQN, DATA, LUA)

INPUT PARAMETERS

OUTPUT PARAMETERS

None.

FMS PARAMETERS

The following FMS Parameters are especially important to this routine:
Parameter Description
LOWASM First changed equation for nonlinear assembly.
IOSYNC Perform synchronlys I/O
IOKIDS Allow children to access a file
MAXMD Amount of memory to use
MDUSED Amount of memory already used

DESCRIPTION:

These subroutines provide an easy and efficient way to write data to FMS matrix files. You may define the matrix terms by calling FMSROW OR FMSCOL. You may not mix calls to FMSROW and FMSCOL when defining terms for the same matrix.

You may define the rows (columns) in any order but you must define all matrix terms. A fatal error condition occurs if you finish calling FMSROW (FMSCOL) and have not defined all rows (columns).

To use these subroutines, you must first open the matrix file by calling subroutines RSDI, RNDI, CHDI, CSDI CNDI. You then initialize FMSROW or FMSCOL to receive data by making one of the following calls:

        CALL FMSROW ( 0, DUMMY, LUA),   Access by parent only
        CALL FMSROW (-1, DUMMY, LUA),   Access by parent and children
        CALL FMSCOL ( 0, DUMMY, LUA),   Access by parent only
        CALL FMSCOL (-1, DUMMY, LUA),   Access by parent and children
The value of 0 or -1 for the equation number directs FMS to initialize files and assign buffers. If you specify a value of 0, only the parent can define the matrix by calling FMSROW (FMSCOL). If you are going to call FMSROW (FMSCOL) from subroutines you are running in parallel, specify a value of -1. In either case, this initialization call must be made by the parent, not the children. This initialization call must precede calls to FMSROW (FMSCOL) which transfer data.

FMS will use all remaining memory in the FMS memory pool to buffer your data for file LUA. If you plan to write to multiple files simultaneously, you must divide the remaining memory in the memory pool among the files.

You may do this by using the FMS Parameters MAXMD and MDUSED. For example, if you are populating 3 matrices whose file attributes are LUA(25,3), you would divide the memory among these files as follows:

C       Find out how much memory is left to allocate:
        CALL FMSIGT ('MAXMD' , MAXMD )
        CALL FMSIGT ('MDUSED', MDUSED)
        MDLEFT  = MAXMD - MDUSED
C
C       Divide the memory equally among the 3 files:
        MDINC   = MDLEFT/3
C
C       Save value of MAXMD:
        MAXMD_S = MAXMD
C
C       Initialize FMSROW for first file:
        MAXMD  = MDUSED + MDINC
        CALL FMSIST ('MAXMD' , MAXMD)
        CALL FMSROW (0, DUMMY, LUA(1,1))
C
C       Initialize FMSROW for second file:
        MAXMD  = MAXMD  + MDINC
        CALL FMSIST ('MAXMD' , MAXMD)
        CALL FMSROW (0, DUMMY, LUA(1,2))
C
C       Initialize FMSROW for third file:
        CALL FMSIST ('MAXMD' ,MAXMD_S)
        CALL FMSROW (0, DUMMY, LUA(1,3))
You should not set MAXMD beyond the first value returned by the call to FMSIGT. Doing so will cause all memory to be returned and new memory allocated.

The second step is to call FMSROW (FMSCOL) once for each row (column). You may define the rows (columns) in any order.

The final step is to direct FMS to release the buffers and close the files. This is accomplished by making the following call:

        CALL FMSROW (NUMEQ+1, DUMMY, LUA)
or
        CALL FMSCOL (NUMEQ+1, DUMMY, LUA)
where the value of NUMEQ+1 is greater than the number of equations. This call must be made by the parent.

At this point the data has been transferred to the FMS file but is not in standard FMS file format. This conversion will happen automatically during matrix assembly/factoring when subroutine RSDAF, RNDAF, CHDAF, CSDAF ,CNDAF is called. When calling the assemble/factor subroutine, you specify this matrix file LUA as an input matrix file.

You may call FMSROW|FMSCOL from subroutines you are running in parallel (which you started by calls to FMSPAR). This can reduce the time required to fill the matrix and vector arrays. To use this feature, you must direct FMS to open the file LUA for access by multiple processes. Use the FMS Parameter IOKIDS before the call which opens file LUA. The first and last calls to FMSROW|FMSCOL, which are used for setup and completion, must be called by the parent process before and after the calls to FMSPAR respectively.

Examples

Example 8 and Example 9 further illustrates how to use FMSROW to populate a matrix.