This sparse utility subroutine is used by each process to insert all blocks of data it owns into its local part of the general sparse matrix A.
| Fortran | CALL PSPINS (a, ia, ja, blck, desc_a) | 
Scope: local
Type: required
Specified as: the derived data type D_SPMAT.
Scope: local
Type: required
Specified as: a fullword integer; 1 <= ia <= DESC_A%MATRIX_DATA(M).
Scope: local
Type: required
Specified as: a fullword integer, where: ja = 1.
Specified as: a fullword integer; 1 <= BLCK%M <= DESC_A%MATRIX_DATA(N_ROW).
Specified as: a fullword integer; 1 <= BLCK%N <= n, where n is the order of the global general sparse matrix A.
If BLCK%FIDA='CSR', the submatrix BLCK is stored in the storage-by-rows storage mode. Scope: global.
Specified as: a character variable of length 5; BLCK%FIDA='CSR'.
If BLCK%FIDA='CSR', then you must specify the BLCK%AS, BLCK%IA1, and BLCK%IA2 components, as follows:
Specified as: a pointer to an assumed-shape array with shape (:), containing long-precision real numbers.
Specified as: a pointer to an assumed-shape array with shape (:), containing fullword integers; 1 <= BLCK%IA1(i) <= BLCK%N, where:
i = 1, nz and nz is the actual number of non-zero elements in the submatrix BLCK.
Specified as: a pointer to an assumed-shape array with shape (:), containing fullword integers, where:
Specified as: the derived data type D_SPMAT.
Type: required
Specified as: the derived data type DESC_TYPE.
Scope: local
Type: required
Returned as: the derived data type D_SPMAT.
Type: required
Returned as: the derived data type DESC_TYPE.
TYPE(D_SPMAT)  ::   BLCK                       !Declare the BLCK variable
        .
        .
        .
ALLOCATE(BLCK%AS(20),BLCK%IA1(20),BLCK%IA2(2)) !Allocate array pointers
 
When you are finished calling PSPINS, you should deallocate BLCK%AS, BLCK%IA1, and BLCK%IA2.
None
This piece of an example shows how to insert coefficients into the same GLOB_ROW row by calling PSPINS multiple times. It would be useful in finite element applications, where PSPINS inserts one element at a time into the global matrix, but more than one element may contribute to the same matrix row. In this case, PSPINS is called with the same value of ia by all the elements contributing to that row.
For a complete example, see Example--Using the Fortran 90 Sparse Subroutines.
            .
            .
            .
DO GLOB_ROW = 1, N
 
   ROW_MAT%DESCRA(1) = 'G'
   ROW_MAT%FIDA      = 'CSR'
 
   ROW_MAT%IA2(1) = 1
   ROW_MAT%IA2(2) = 1
 
   IA = GLOB_ROW
 
   !       (x-1,y,z)
   ROW_MAT%AS(1)  = COEFF(X-1,Y,Z,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X-1,Y,Z)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
   !       (x,y-1,z)
   ROW_MAT%AS(1)  = COEFF(X,Y-1,Z,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X,Y-1,Z)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
   !       (x,y,z-1)
   ROW_MAT%AS(1)  = COEFF(X,Y,Z-1,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X,Y,Z-1)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
   !       (x,y,z)
   ROW_MAT%AS(1)  = COEFF(X,Y,Z,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X,Y,Z)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
   !       (x,y,z+1)
   ROW_MAT%AS(1)  = COEFF(X,Y,Z+1,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X,Y,Z+1)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
   !       (x,y+1,z)
   ROW_MAT%AS(1)  = COEFF(X,Y+1,Z,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X,Y+1,Z)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
   !       (x+1,y,z)
   ROW_MAT%AS(1)  = COEFF(X+1,Y,Z,X,Y,Z)
   ROW_MAT%IA1(1) = IDX(X+1,Y,Z)
   CALL PSPINS(A,IA,1,ROW_MAT,DESC_A)
END DO
            .
            .
            .