Debian Codegraph @

packages/seacas/applications/blot/locrl.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 INTEGER FUNCTION LOCRL (VALU, NVALUS, VALUOK, VALUS)
9 C=======================================================================
10
11 C --*** LOCRL *** (TIMSEL) Find closest real value of selected values
12 C -- Written by Amy Gilkey - revised 11/10/87
13 C --
14 C --LOCRL returns the closest real value to the given value in a list of
15 C --selected real values (which may not be ordered).
16 C --
17 C --Parameters:
18 C -- VALU - the value to be searched for
19 C -- NVALUS - the number of values in the list
20 C -- VALUOK - VALUS(i) is selected iff VALUOK(i)
21 C -- VALUS - the list of values
22
23 LOGICAL VALUOK(*)
24 REAL VALUS(*)
25
26 DIF = 0.0
27 IX = 0
28 DO 100 I = 1, NVALUS
29 IF (VALUOK(I)) THEN
30 DIFI = ABS (VALUS(I) - VALU)
31 IF ((IX .EQ. 0) .OR. (DIF .GT. DIFI)) THEN
32 DIF = DIFI
33 IX = I
34 END IF
35 END IF
36 100 CONTINUE
37
38 LOCRL = IX
39
40 RETURN
41 END