Debian Codegraph @

packages/seacas/applications/algebra/ag_lnkvar.f

raw
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
7 C=======================================================================
8 SUBROUTINE LNKVAR (*)
9 C=======================================================================
10
11 C --*** LNKVAR *** (ALGEBRA) Link equation references with variables
12 C -- Written by Amy Gilkey - revised 11/30/87
13 C --
14 C --LNKVAR links the variables in the equation with the /VAR../ arrays.
15 C --Each equation variable (from /ENT../) is found in the /VAR../
16 C --arrays, and the /VAR../ index is stored in the INXENT array.
17 C --Note that since the /VAR../ arrays were constructed from the
18 C --equation variables, each variable will be found.
19 C --
20 C --Parameters:
21 C -- * - return statement if an error is found; message is printed
22 C --
23 C --Common Variables:
24 C -- Sets INXENT, VALENT of /ENT../
25 C -- Uses NAMENT, TYPENT of /ENT../
26 C -- Uses NAMVAR, TYPVAR, IDVAR, ISTVAR, NUMINP, IXLHS of /VAR../
27
28 include 'ag_namlen.blk'
29 include 'exodusII.inc'
30 include 'ag_numeqn.blk'
31 include 'ag_ent.blk'
32 include 'ag_var.blk'
33
34 PARAMETER (ICURTM = 1, ILSTTM = 2, IONETM = 3)
35
36 NUMLHS = MAXVAR - IXLHS + 1
37
38 DO 110 NEQN = 1, NUMEQN
39 DO 100 NENT = 1, NUMENT(NEQN)
40 IF (TYPENT(NENT,NEQN) .EQ. 'V') THEN
41
42 C --If searching for a LHS variable (INXENT < 0),
43 C -- then search the assigned variables, NAMVAR(IXLHS..MAXVAR)
44 C -- else search the input variables, NAMVAR(1..NUMINP)
45
46 IF (INXENT(NENT,NEQN) .LT. 0) THEN
47 IV = LOCSTR (NAMENT(NENT,NEQN),
48 & NUMLHS, NAMVAR(IXLHS))
49 IF (IV .GT. 0) IV = IXLHS + IV - 1
50 ELSE
51 IV = LOCSTR (NAMENT(NENT,NEQN), NUMINP, NAMVAR(1))
52 END IF
53
54 IF (IV .LE. 0) THEN
55 CALL PRTERR ('PROGRAM', 'Variable "'
56 & // NAMENT(NENT,NEQN) // '" cannot be found')
57 GOTO 120
58 END IF
59
60 INXENT(NENT,NEQN) = IV
61
62 IF ((TYPVAR(IV) .EQ. 'T')
63 & .OR. (TYPVAR(IV) .EQ. 'G')) THEN
64 c IF ((TYPVAR(IV) .EQ. 'T')
65 c & .OR. (TYPVAR(IV) .EQ. 'H')
66 c & .OR. (TYPVAR(IV) .EQ. 'G')) THEN
67 IF (NAMVAR(IV) .EQ. '.GLOBAL') THEN
68 c IF ((NAMVAR(IV) .EQ. '.HISTORY')
69 c & .OR. (NAMVAR(IV) .EQ. '.GLOBAL')) THEN
70 VALENT(NENT,NEQN) =
71 & VALENT(NENT,NEQN) + IDVAR(IV) - 1
72 ELSE
73 VALENT(NENT,NEQN) = IDVAR(IV)
74 END IF
75 END IF
76
77 END IF
78 100 CONTINUE
79 110 CONTINUE
80 RETURN
81
82 120 CONTINUE
83 RETURN 1
84 END