Debian Codegraph @

packages/seacas/applications/blot/rmixint.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 RMIXINT (INLINE, IFLD, INTYP, CFIELD, IFIELD,
9 & SELMSG, MAXSEL, NUMSEL, IXSEL, MAP, *)
10 C=======================================================================
11
12 C --*** RIXINT *** (BLOT) Parse selection command
13 C -- Written by Amy Gilkey - revised 05/20/88
14 C --
15 C --RMIXINT selects the items listed in the command. If there are no
16 C --fields, all the items are selected. If the first field is ADD, the
17 c --items are added to the items already selected, otherwise only the
18 C --listed items are selected.
19 C --
20 C --Parameters:
21 C -- INLINE - IN/OUT - the parsed input line for the log file
22 C -- IFLD - IN/OUT - the free-field reader index
23 C -- INTYP - IN - the free-field reader field types
24 C -- CFIELD - IN - the character fields
25 C -- IFIELD - IN - the integer fields
26 C -- SELMSG - IN - the type of item for error messages
27 C -- MAXSEL - IN - the number of the maximum selected items
28 C -- NUMSEL - IN/OUT - the number of selected items; set to zero
29 C -- upon entry unless ADD is the first field
30 C -- IXSEL - IN/OUT - the selected items
31 C -- MAP - IN - map local ids to global ids. User specifies global,
32 C ixsel stores local. Map size is MAXSEL
33 C -- * - return statement if error before any items selected
34
35 CHARACTER*(*) INLINE
36 INTEGER INTYP(*)
37 CHARACTER*(*) CFIELD(*)
38 INTEGER IFIELD(*)
39 CHARACTER*(*) SELMSG
40 INTEGER IXSEL(*)
41 INTEGER MAP(*)
42
43 LOGICAL FFEXST, FFNUMB, FFMATC
44 CHARACTER*80 ERRMSG
45 INTEGER IRNG(3)
46 CHARACTER*32 ISTR
47
48 IF (.NOT. (FFEXST (IFLD, INTYP))) THEN
49
50 C --Select all items if no fields
51
52 NUMSEL = MAXSEL
53 DO 100 I = 1, MAXSEL
54 IXSEL(I) = I
55 100 CONTINUE
56
57 ELSE IF (FFMATC (IFLD, INTYP, CFIELD, 'OFF', 3)) THEN
58
59 C --Select no items if OFF
60
61 CALL FFADDC ('OFF', INLINE)
62 NUMSEL = 0
63
64 ELSE
65
66 C --Reset to none selected unless ADD
67
68 IF (FFMATC (IFLD, INTYP, CFIELD, 'ADD', 3)) THEN
69 CALL FFADDC ('ADD', INLINE)
70 ELSE
71 IF (.NOT. FFNUMB (IFLD, INTYP)) THEN
72 ERRMSG =
73 & 'Expected "OFF" or "ADD" or ' // SELMSG // ' range'
74 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
75 GOTO 140
76 END IF
77 NUMSEL = 0
78 END IF
79
80 110 CONTINUE
81 IF (FFEXST (IFLD, INTYP)) THEN
82
83 C --Scan numeric range
84
85 CALL FFVRNG (IFLD, INTYP, CFIELD, IFIELD,
86 & SELMSG, -MAXSEL, IRNG, *130)
87 CALL FFADDV (IRNG, INLINE)
88
89 C --Store the range selected
90
91 DO 120 ID = IRNG(1), IRNG(2), IRNG(3)
92 C ... See if a node/element with id 'I' exists in map.
93 C Store the index of where this occurs.
94 I = LOCINT(ID, MAXSEL, MAP)
95
96 if (I .eq. 0) then
97 call intstr(1, -1, ID, ISTR, LSTR);
98 ERRMSG = 'No ' // SELMSG // ' with id equal '
99 * // ISTR(:LSTR) // ' found.'
100 ELSE
101 IF (LOCINT (I, NUMSEL, IXSEL) .LE. 0) THEN
102 IF (NUMSEL .GE. MAXSEL) THEN
103 ERRMSG = 'Too many ' // SELMSG // 's selected'
104 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
105 GOTO 130
106 END IF
107
108 NUMSEL = NUMSEL + 1
109 IXSEL(NUMSEL) = I
110 END IF
111 END IF
112 120 CONTINUE
113
114 GOTO 110
115 END IF
116
117 130 CONTINUE
118 IF (NUMSEL .EQ. 0) THEN
119 ERRMSG = 'No ' // SELMSG // 's are selected'
120 CALL PRTERR ('CMDWARN', ERRMSG(:LENSTR(ERRMSG)))
121 END IF
122 END IF
123
124 RETURN
125
126 140 CONTINUE
127 RETURN 1
128 END