compare.F [SRC] [CPP] [JOB] [SCAN]
TOOLS / PREDATAS / FUNCTIONS



   1 | include(dom.inc)
   2 | 
   3 |       RECURSIVE FUNCTION compare(patch, i, patchesofthisnode,           &
   4 |      &                           nodepatch, nvert) RESULT(somme)
   5 | 
   6 | !     ==================================================================!
   7 | !                                                                       !
   8 | !     compare.F : This function makes a recursive comparison to check   !
   9 | !                 if one value is repeated in all the given vectors.    !
  10 | !                 In PRISSMA it is used to detect wich is the common    !
  11 | !                 patch of all the nodes in a boundary face.            !
  12 | !                                                                       !
  13 | !     in        : The 'patch' to be tested                              !
  14 | !                 The node 'i'                                          !
  15 | !                 The nb of patches for each node 'patchesofthisnode'   !
  16 | !                 The list of patches for each node 'nodepatch'         !
  17 | !                 The total number of nodes 'nvert' of the face         !
  18 | !                                                                       !
  19 | !     out       : 'somme' with zero if no common patch, and patch if    !
  20 | !                 the comparison has reached correctly the las node     !
  21 | !                                                                       !
  22 | !     author    : J. Amaya (december 2007)                              !
  23 | !                                                                       !
  24 | !     ==================================================================!
  25 | 
  26 |         IMPLICIT NONE
  27 | 
  28 | !       IN
  29 |         DOM_INT                     :: patch, nvert, i
  30 |         DOM_INT, DIMENSION(nvert)   :: patchesofthisnode
  31 |         DOM_INT, DIMENSION(nvert,3) :: nodepatch
  32 | 
  33 | !       OUT
  34 |         DOM_INT                     :: somme
  35 | 
  36 | !       LOCAL
  37 |         DOM_INT                     :: j
  38 | 
  39 |         somme = 0
  40 | 
  41 | !       print*, " --cmp--patchesofthisnode ",i,":", patchesofthisnode(i)
  42 |         DO j = 1, patchesofthisnode(i)
  43 |           IF (somme.eq.0) THEN
  44 | !           print*, " --cmp--nodepatch ",i,j,":",nodepatch(i,j)
  45 |             IF(nodepatch(i,j).eq.patch) THEN
  46 |               IF(nodepatch(i,j).eq.patch) THEN
  47 |                 IF (i.eq.nvert) THEN
  48 |                   somme = patch
  49 |                 ELSE
  50 | !                 print*, " --cmp-to ", i+1, j
  51 |                   somme = somme + compare(nodepatch(i,j), i+1,          &
  52 |      &                            patchesofthisnode, nodepatch, nvert)
  53 | !                 print*, " --cmp-update to line ", i
  54 | !                 print*, " --cmp-update next in list ", j+1
  55 |                 ENDIF
  56 |               ENDIF
  57 |             ENDIF
  58 |           ENDIF
  59 |         ENDDO
  60 | !       print*, " --cmp-----done line ",i
  61 | 
  62 | !     ==================================================================!
  63 | !
  64 | !       -- Ancient version:
  65 | !       -- this version helps to better understand
  66 | !       -- how the function works
  67 | !       -- IF somme=0 is needed in order to sum only one time the patch
  68 | !
  69 | !       IF (i.eq.nvert) THEN
  70 | !
  71 | !         DO j = 1, patchesofthisnode(i)
  72 | !           IF(nodepatch(i,j).eq.patch) somme = patch
  73 | !         ENDDO
  74 | !
  75 | !       ELSE
  76 | !
  77 | !         DO j = 1, patchesofthisnode(i)
  78 | !           IF(nodepatch(i,j).eq.patch) THEN
  79 | !             somme = somme + compare(nodepatch(i,j), i+1,              &
  80 | !    &                      patchesofthisnode, nodepatch, nvert)
  81 | !           ENDIF
  82 | !         ENDDO
  83 | !
  84 | !       ENDIF
  85 | !
  86 | !     ==================================================================!
  87 | 
  88 |       END FUNCTION compare


compare.F could be called by:
compare.F [TOOLS/PREDATAS/FUNCTIONS] - 3 - 51
detectpatch.F [TOOLS/PREDATAS/INOUT] - 36 - 67
Makefile [TOOLS/PREDATAS] - 87
qsort_C.c [SOURCES/FUNCTIONS] - 13
testcompare.F [TOOLS/PREDATAS/FUNCTIONS] - 16 - 26 - 27