1 | include(dom.inc)
2 |
3 | SUBROUTINE FIND_IBND(cell,face, index)
4 |
5 | use mod_slave
6 |
7 | ! IN
8 | DOM_INT :: cell, face
9 |
10 | ! LOCAL
11 | DOM_INT :: i, j
12 | DOM_INT :: imin, imax, di
13 | DOM_REAL :: t1, t2, time
14 |
15 | ! OUT
16 | DOM_INT :: index, index2
17 |
18 |
19 | ! ---------------!
20 | ! Initialisation ! To remove after for multiples tests...
21 | ! ---------------!
22 | ! index = 1
23 | ! index2 = 1
24 |
25 | ! -----------------------------------------!
26 | ! Test des cellules par itérations simples !
27 | ! -----------------------------------------!
28 | ! DO WHILE (is_bcell(index2).ne.cell)
29 | ! index2 = index2 + 1
30 | ! ENDDO
31 | !
32 | ! DO WHILE (is_bface(index2).ne.face)
33 | ! IF(face.gt.is_bface(index2)) THEN
34 | ! index2 = index2 + 1
35 | ! ELSE
36 | ! index2 = index2 - 1
37 | ! ENDIF
38 | ! ENDDO
39 |
40 | ! --------------------------------------------!
41 | ! Test des cellules par itérations dichotomie !
42 | ! --------------------------------------------!
43 | imin = 0
44 | imax = is_nbfaces
45 | di = 1
46 |
47 | DO WHILE (is_bcell(index).ne.cell)
48 |
49 | IF(is_bcell(di).le.cell) THEN
50 | imin = di + 1
51 | ELSE
52 | imax = di
53 | ENDIF
54 |
55 | di = int(imax + imin)/2
56 |
57 | IF(is_bcell(di).eq.cell) THEN
58 | index = di
59 | ENDIF
60 | ! PRINT*, "loop", imax, imin, di
61 | ! PRINT*, "cell",cell, is_bcell(di)
62 | ! PRINT*, index2
63 | ENDDO
64 |
65 | DO WHILE (is_bface(index).ne.face)
66 | IF(is_bface(index).ge.face) THEN
67 | index = index - 1
68 | ELSE
69 | index = index + 1
70 | ENDIF
71 | ENDDO
72 |
73 |
74 | ! PRINT*, cell, face
75 | ! PRINT*, "index with simple iteration :", index2
76 | ! PRINT*, "index with dichotomy :", index
77 |
78 | END SUBROUTINE FIND_IBND
find_ibnd.F could be called by: