| 1 |
C Copyright(C) 1999-2020 National Technology & Engineering Solutions |
| 2 |
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
C NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
C |
| 5 |
C See packages/seacas/LICENSE for details |
| 6 |
C======================================================================= |
| 7 |
SUBROUTINE ADDVAR (NAMEQV, NVAR, TYPEQV, IDEQV, NINP, ILHS) |
| 8 |
C======================================================================= |
| 9 |
C --*** ADDVAR *** (ALGEBRA) Add set of variables to list |
| 10 |
C -- Written by Amy Gilkey - revised 12/14/87 |
| 11 |
C -- |
| 12 |
C --ADDVAR adds all non-repeated input (INP) variables from a set of |
| 13 |
C --variables to the /VAR../ arrays as both input variables and assigned |
| 14 |
C --(LHS) variables. History variables are all assigned the input |
| 15 |
C --variable name ".HISTORY". Global variables are all assigned the input |
| 16 |
C --variable name ".GLOBAL". |
| 17 |
C -- |
| 18 |
C --Parameters: |
| 19 |
C -- NAMEQV - IN - the names of the variables in the set |
| 20 |
C -- NVAR - IN - the number of variables in the set |
| 21 |
C -- TYPEQV - IN - the type of all variables in the set |
| 22 |
C -- IDEQV - IN - the index of the first variable in the set; |
| 23 |
C -- following are consecutive |
| 24 |
C -- NINP - IN - the number of input variables in /VAR../ that need |
| 25 |
C -- to be checked |
| 26 |
C -- ILHS - IN - the starting index of the assigned variables in /VAR../ |
| 27 |
C -- that need to be checked |
| 28 |
C -- |
| 29 |
C --Common Variables: |
| 30 |
C -- Sets NUMINP, IXLHS, NAMVAR, TYPVAR, IDVAR, ISTVAR, IEVVAR of /VAR../ |
| 31 |
|
| 32 |
PARAMETER (ICURTM = 1, ILSTTM = 2, IONETM = 3) |
| 33 |
include 'ag_namlen.blk' |
| 34 |
include 'ag_var.blk' |
| 35 |
|
| 36 |
CHARACTER*(*) NAMEQV(*) |
| 37 |
CHARACTER TYPEQV |
| 38 |
CHARACTER*(maxnam) NAME |
| 39 |
|
| 40 |
NLHS = MAXVAR - ILHS + 1 |
| 41 |
|
| 42 |
DO 100 IVAR = 1, NVAR |
| 43 |
|
| 44 |
NAME = NAMEQV(IVAR) |
| 45 |
|
| 46 |
C --Skip if already an assigned variable |
| 47 |
|
| 48 |
IF (LOCSTR (NAME, NLHS, NAMVAR(ILHS)) .LE. 0) THEN |
| 49 |
|
| 50 |
C --If not already an input variable, insert it in the input variables |
| 51 |
|
| 52 |
IF ((TYPEQV .NE. 'G') .OR. (IVAR .EQ. 1)) THEN |
| 53 |
|
| 54 |
C --Only insert first global variable with name .GLOBAL |
| 55 |
IF (TYPEQV .EQ. 'G') NAME = '.GLOBAL' |
| 56 |
|
| 57 |
IF (LOCSTR (NAME, NINP, NAMVAR) .LE. 0) THEN |
| 58 |
NUMINP = NUMINP + 1 |
| 59 |
IF (NUMINP .LT. IXLHS) THEN |
| 60 |
NAMVAR(NUMINP) = NAME |
| 61 |
TYPVAR(NUMINP) = TYPEQV |
| 62 |
IDVAR(NUMINP) = IDEQV + IVAR - 1 |
| 63 |
ISTVAR(ICURTM,NUMINP) = 1 |
| 64 |
ISTVAR(ILSTTM,NUMINP) = 0 |
| 65 |
ISTVAR(IONETM,NUMINP) = 0 |
| 66 |
IF (TYPEQV .EQ. 'E') THEN |
| 67 |
IEVVAR(NUMINP) = IDEQV + IVAR - 1 |
| 68 |
ELSE |
| 69 |
IEVVAR(NUMINP) = -999 |
| 70 |
END IF |
| 71 |
END IF |
| 72 |
END IF |
| 73 |
END IF |
| 74 |
|
| 75 |
C --Insert into the LHS array as saved variable |
| 76 |
|
| 77 |
IXLHS = IXLHS - 1 |
| 78 |
IF (NUMINP .LT. IXLHS) THEN |
| 79 |
NAMVAR(IXLHS) = NAMEQV(IVAR) |
| 80 |
C --Do not use NAME here since the global name is wrong |
| 81 |
TYPVAR(IXLHS) = TYPEQV |
| 82 |
IDVAR(IXLHS) = -999 |
| 83 |
ISTVAR(ICURTM,IXLHS) = -2 |
| 84 |
ISTVAR(ILSTTM,IXLHS) = 0 |
| 85 |
ISTVAR(IONETM,IXLHS) = 0 |
| 86 |
IF (TYPEQV .EQ. 'E') THEN |
| 87 |
IEVVAR(IXLHS) = IDEQV + IVAR - 1 |
| 88 |
ELSE |
| 89 |
IEVVAR(IXLHS) = -999 |
| 90 |
END IF |
| 91 |
END IF |
| 92 |
END IF |
| 93 |
100 CONTINUE |
| 94 |
|
| 95 |
RETURN |
| 96 |
END |