Debian Codegraph @

packages/seacas/applications/algebra/ag_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 IX = 0
27 DIF = 1.0e30
28
29 DO 100 I = 1, NVALUS
30 IF (VALUOK(I)) THEN
31 DIFI = ABS (VALUS(I) - VALU)
32 IF ((IX .EQ. 0) .OR. (DIF .GT. DIFI)) THEN
33 DIF = DIFI
34 IX = I
35 END IF
36 END IF
37 100 CONTINUE
38
39 LOCRL = IX
40
41 RETURN
42 END