1 | include(dom.inc)
2 | SUBROUTINE lookforface(nb_nodes, nodelist, ifoundface)
3 |
4 | ! ================================================================!
5 | ! !
6 | ! lookforface.F : Detects if other face has been created with the !
7 | ! same nodes, but in different order. Is the face !
8 | ! common to two cells? !
9 | ! !
10 | ! in : The number of nodes of the face 'nb_nodes' !
11 | ! The list of the nodes to evaluate 'nodelist' !
12 | ! out : The number of the face founded 'ifoundface'. !
13 | ! It's value is equal to zero if no face is found !
14 | ! !
15 | ! author : J. AMAYA (avril 2007) !
16 | ! !
17 | ! ================================================================!
18 |
19 | USE datas
20 | IMPLICIT NONE
21 |
22 | ! IN
23 | DOM_INT :: nb_nodes
24 | DOM_INT, DIMENSION(nb_nodes) :: nodelist
25 |
26 | ! OUT
27 | DOM_INT :: ifoundface
28 |
29 | ! LOCAL
30 | type(face), pointer :: face_pt
31 | type(fatnode), pointer :: fat_pt
32 | logical :: match
33 | DOM_INT :: i, j, nodeinface
34 |
35 | fat_pt => facesatnode(nodelist(1))%fatnode_ptr
36 | ifoundface = 0
37 |
38 | ! ------------------------!
39 | ! Search within all faces !
40 | ! ------------------------!
41 | DO WHILE ((ifoundface.eq.0).and.(ASSOCIATED(fat_pt)))
42 |
43 | face_pt => fat_pt%fatthisnode
44 |
45 | IF (face_pt%i_nbparents.eq.1) THEN
46 | ! print*, " comparing with: ", face_pt%face_point(:,1)
47 |
48 | ! ---------------------------------------------------!
49 | ! Compare only with faces with the same nb of points !
50 | ! ---------------------------------------------------!
51 | IF (nb_nodes.eq.face_pt%i_nbnodes) THEN
52 | match=.true.
53 | i = 1
54 |
55 | ! -------------------------------------------------------!
56 | ! Compare all nodes one by one. If only one node doesn't !
57 | ! have a pair, the loop will exit and i < nb_nodes !
58 | ! -------------------------------------------------------!
59 | DO WHILE ((i.le.nb_nodes).and.(match))
60 |
61 | match=.false.
62 |
63 | DO j=1, nb_nodes
64 | ! ---------------------------------------------------!
65 | ! Look only in the first column of face_point, cause !
66 | ! one face can have only two cell parents. !
67 | ! ---------------------------------------------------!
68 | nodeinface = face_pt%face_point(j,1)
69 | IF (nodelist(i).eq.nodeinface) match = .true.
70 | ENDDO
71 |
72 | i = i + 1
73 |
74 | ENDDO
75 |
76 | ! --------------------------------------!
77 | ! If all nodes match, the face is found !
78 | ! --------------------------------------!
79 | IF (((i-1).eq.nb_nodes).and.(match)) THEN
80 | ifoundface = face_pt%face_id
81 | ENDIF
82 |
83 | ENDIF
84 |
85 | ENDIF
86 |
87 | ! ----------!
88 | ! Next face !
89 | ! ----------!
90 | IF (ifoundface.eq.0) fat_pt => fat_pt%next_fatnode
91 |
92 | ENDDO
93 |
94 | IF (ifoundface.ne.0) current_face => face_pt
95 |
96 | END SUBROUTINE lookforface
lookforface.F could be called by: