File: hash.F

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (57 lines) | stat: -rw-r--r-- 1,347 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#if HAVE_CONFIG_H
#   include "config.fh"
#endif
      subroutine clear_hash
#include "common.fh"
      integer i
c
c   Clear all information from hash tables prior to setting new tables
c
      do i = 1, MAXAT
        link_a(i) = 0
        top_a(i) = 0
        hash_key_a(i) = 0
        hash_value_a(i) = 0
      end do
      a_cnt = 0
      return
      end
c
      subroutine add_hash_a(igx, idx)
#include "common.fh"
      integer igx, idx, ifunc, itmp
c
c   Add an element to hash table A, which tracks local particles.
c   Start by computing hash function value of idx.
c
      ifunc = mod(igx,MAXAT) + 1
c
c   Store value in a linked list
c
      a_cnt = a_cnt+1
      itmp = top_a(ifunc)
      top_a(ifunc) = a_cnt
      link_a(a_cnt) = itmp
      hash_key_a(a_cnt) = igx
      hash_value_a(a_cnt) = idx
      return
      end
c
      integer function get_hash_a(igx)
#include "common.fh"
      integer igx, ifunc, itmp, jtmp
c
c   Return the local index of a locally held particle from the global
c   index. Start by computing the hash function value of idx.
c
      ifunc = mod(igx,MAXAT) + 1
      get_hash_a = 0
      itmp = top_a(ifunc)
      do while (hash_key_a(itmp).ne.igx.and.itmp.gt.0)
        itmp = link_a(itmp)
      end do
      if (itmp.gt.0) then
        get_hash_a = hash_value_a(itmp)
      endif
      return
      end