1 | include(dom.inc)
2 | SUBROUTINE readstructure(path)
3 |
4 | ! ===============================================================!
5 | ! !
6 | ! readatas.F : Reads the data base of the geometry. !
7 | ! Format: V2.X !
8 | ! !
9 | ! in : The complete Data Base !
10 | ! !
11 | ! author : J. AMAYA (june 2007) !
12 | ! !
13 | ! ===============================================================!
14 |
15 | USE datas
16 |
17 | IMPLICIT NONE
18 |
19 | INCLUDE 'predatas_const.h'
20 | INCLUDE 'dom_constants.h'
21 |
22 | ! IN
23 | CHARACTER*80 :: path
24 |
25 | ! OUT
26 |
27 | ! LOCAL
28 | DOM_INT, allocatable, dimension(:) :: fatnodelist
29 | DOM_INT :: i, i_fatnodes
30 | DOM_INT :: parent1, parent2
31 | character*80 :: nodesfile, cellsfile, facesfile
32 | type(cell), pointer :: pt_cell
33 | type(face), pointer :: pt_face, pv_face
34 | type(fatnode), pointer :: pt_fatnode
35 |
36 | ! --------------------------------------!
37 | ! Set file names and open them to write !
38 | ! --------------------------------------!
39 |
40 | nodesfile = path(1:len_trim(path))//'Nodes.in'
41 | cellsfile = path(1:len_trim(path))//'Cells.in'
42 | facesfile = path(1:len_trim(path))//'Faces.in'
43 |
44 | OPEN(FILE_NODES, FILE=nodesfile, FORM='UNFORMATTED')
45 | OPEN(FILE_CELLS, FILE=cellsfile, FORM='UNFORMATTED')
46 | OPEN(FILE_FACES, FILE=facesfile, FORM='UNFORMATTED')
47 |
48 | ! ---------------------------!
49 | ! Reconstruct the faces list !
50 | ! ---------------------------!
51 |
52 | READ(FILE_FACES) i_nfaces
53 | IF (ASSOCIATED(face_list)) NULLIFY(face_list)
54 | NULLIFY(pv_face)
55 |
56 | DO i=1, i_nfaces
57 |
58 | i_buffer = 0
59 | ALLOCATE(pt_face)
60 |
61 | IF (i.eq.1) face_list => pt_face
62 |
63 | READ(FILE_FACES) pt_face%face_id, &
64 | & pt_face%i_nbnodes, &
65 | & pt_face%face_normal(1:4,1), &
66 | & pt_face%area, &
67 | & i_buffer(1:MAX_INTS), &
68 | & parent1, &
69 | & parent2
70 |
71 | NULLIFY(pt_face%next_face)
72 | pt_face%prev_face => pv_face
73 | pv_face => pt_face
74 |
75 | ENDDO
76 |
77 | ! --------------------------!
78 | ! Reconstruct the node list !
79 | ! --------------------------!
80 |
81 | READ(FILE_NODES) i_nnodes
82 |
83 | IF (ALLOCATED(node_list)) DEALLOCATE(node_list)
84 | ALLOCATE(node_list(3,i_nnodes))
85 |
86 | DO i=1, i_nnodes
87 | ALLOCATE(fatnodelist(1:i_fatnodes))
88 | READ(FILE_NODES) node_list(1:3,i), i_fatnodes, &
89 | & fatnodelist(1:i_fatnodes)
90 | print*, node_list(1:3,i)
91 |
92 | DEALLOCATE(fatnodelist)
93 | ENDDO
94 |
95 | ! ------------------------------------!
96 | ! Reconstruct the 'facesatnode' array !
97 | ! ------------------------------------!
98 |
99 | IF (ALLOCATED(facesatnode)) DEALLOCATE(facesatnode)
100 | ALLOCATE(facesatnode(1:i_nnodes))
101 |
102 | ! ----------------!
103 | ! Close all files !
104 | ! ----------------!
105 |
106 | CLOSE(FILE_NODES)
107 | CLOSE(FILE_CELLS)
108 | CLOSE(FILE_FACES)
109 |
110 | END SUBROUTINE readstructure
readstructure.F could be called by: