| 1 |
C Copyright(C) 1999-2020, 2023 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 (VALUEE, NVALUES, VALUEOK, VALUES) |
| 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 -- VALUEE - the value to be searched for |
| 19 |
C -- NVALUES - the number of values in the list |
| 20 |
C -- VALUEOK - VALUES(i) is selected iff VALUEOK(i) |
| 21 |
C -- VALUES - the list of values |
| 22 |
|
| 23 |
LOGICAL VALUEOK(*) |
| 24 |
REAL VALUES(*) |
| 25 |
|
| 26 |
IX = 0 |
| 27 |
DO 100 I = 1, NVALUES |
| 28 |
IF (VALUEOK(I)) THEN |
| 29 |
DIFI = ABS (VALUES(I) - VALUEE) |
| 30 |
IF ((IX .EQ. 0) .OR. (DIF .GT. DIFI)) THEN |
| 31 |
DIF = DIFI |
| 32 |
IX = I |
| 33 |
END IF |
| 34 |
END IF |
| 35 |
100 CONTINUE |
| 36 |
|
| 37 |
LOCRL = IX |
| 38 |
|
| 39 |
RETURN |
| 40 |
END |