find_ibnd.F [SRC] [CPP] [JOB] [SCAN]
SOURCES / FUNCTIONS



   1 | include(dom.inc)
   2 | 
   3 |       SUBROUTINE FIND_IBND(cell,face, index)
   4 | !     ================================================================!
   5 | !                                                                     !
   6 | !     findibnd.F : Find the boundary face number from the             !
   7 | !                  number of the cell and the number of the face      !
   8 | !                  with a dichotomy                                   !
   9 | !                                                                     !
  10 | !     author         : D. Poitou (sept2011)                           !
  11 | !                                                                     !
  12 | !     ================================================================!
  13 | 
  14 |       use mod_slave
  15 | 
  16 |       IMPLICIT NONE
  17 | 
  18 | !     IN
  19 |       DOM_INT :: cell, face
  20 | 
  21 | !     LOCAL
  22 |       DOM_INT :: imin, imax, di
  23 | 
  24 | !     OUT
  25 |       DOM_INT :: index
  26 | 
  27 | !     ---------------!
  28 | !     Initialisation !
  29 | !     ---------------!
  30 |  !     index  = 1
  31 | 
  32 | !     --------------------------------------------!
  33 | !     Test des cellules par itérations dichotomie !
  34 | !     --------------------------------------------!
  35 |       imin = 0
  36 |       imax = is_nbfaces
  37 |       di   = 1
  38 | 
  39 |       DO WHILE (ts_boundary(index)%icell.ne.cell)
  40 | 
  41 |         IF(ts_boundary(di)%icell.le.cell) THEN
  42 |           imin = di + 1
  43 |         ELSE
  44 |           imax = di
  45 |         ENDIF
  46 | 
  47 |         di = int(imax + imin)/2
  48 | 
  49 |         IF(ts_boundary(di)%icell.eq.cell) THEN
  50 |           index = di
  51 |         ENDIF
  52 | !       PRINT*, "loop", imax, imin, di
  53 | !       PRINT*, "cell",cell, ts_boundary(di)%icell
  54 | !       PRINT*, index
  55 |       ENDDO
  56 | 
  57 |       di = 0
  58 |       DO WHILE ((ts_boundary(index)%iface.ne.face).and.                 &
  59 |      &          ((index.le.is_nbfaces)))
  60 | 
  61 |         IF(ts_boundary(index+di)%iface.eq.face) THEN
  62 |           index = index + di
  63 |         ELSEIF(ts_boundary(index-di)%iface.eq.face) THEN
  64 |           index = index - di
  65 |         ELSE
  66 |           di = di + 1
  67 |         ENDIF
  68 |       ENDDO
  69 | 
  70 | !      PRINT*, cell, face
  71 | !      PRINT*, "index with dichotomy        :", index
  72 | 
  73 |        END SUBROUTINE FIND_IBND