writedatas.F [SRC] [CPP] [JOB] [SCAN]
TOOLS / PREDATAS / INOUT



   1 | include(dom.inc)
   2 |       SUBROUTINE writedatas(path)
   3 | 
   4 | !       ===============================================================!
   5 | !                                                                      !
   6 | !       writedatas.F : Writes out 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, parent2
  30 |         character*80           :: nodesfile, cellsfile, facesfile
  31 |         type(cell),    pointer :: pt_cell
  32 |         type(face),    pointer :: pt_face
  33 |         type(fatnode), pointer :: pt_fatnode
  34 | 
  35 | !       -------------------!
  36 | !       Point at the lists !
  37 | !       -------------------!
  38 |         
  39 |         pt_cell => cell_list
  40 |         pt_face => face_list
  41 | 
  42 | !       --------------------------------------!
  43 | !       Set file names and open them to write !
  44 | !       --------------------------------------!
  45 | 
  46 |         nodesfile = path(1:len_trim(path))//'Nodes.in'
  47 |         cellsfile = path(1:len_trim(path))//'Cells.in'
  48 |         facesfile = path(1:len_trim(path))//'Faces.in'
  49 | 
  50 |         OPEN(FILE_NODES, FILE=nodesfile, FORM='UNFORMATTED')
  51 |         OPEN(FILE_CELLS, FILE=cellsfile, FORM='UNFORMATTED')
  52 |         OPEN(FILE_FACES, FILE=facesfile, FORM='UNFORMATTED')
  53 | 
  54 | !       ----------------------!
  55 | !       Write 'Faces.in' file !
  56 | !       ----------------------!
  57 | 
  58 |         WRITE(FILE_FACES) i_nfaces
  59 |         DO i=1, i_nfaces
  60 | 
  61 |           parent2 = 0
  62 |           IF (ASSOCIATED(pt_face%parent2_ptr)) THEN
  63 |             parent2 = pt_face%parent2_ptr%cell_id
  64 |           ENDIF
  65 | 
  66 |           i_buffer = 0
  67 |           i_buffer(1:pt_face%i_nbnodes) = pt_face%face_point            &
  68 |      &                                    (1:pt_face%i_nbnodes,1)
  69 | 
  70 |           WRITE(FILE_FACES) pt_face%face_id,                            &
  71 |      &                      pt_face%i_nbnodes,                          &
  72 |      &                      pt_face%face_normal(1:4,1),                 &
  73 |      &                      pt_face%area,                               &
  74 |      &                      i_buffer(1:MAX_INTS),                       &
  75 |      &                      pt_face%parent1_ptr%cell_id,                &
  76 |      &                      parent2
  77 | 
  78 |           pt_face => pt_face%next_face
  79 |         ENDDO
  80 | 
  81 | !       ----------------------!
  82 | !       Write 'Nodes.in' file !
  83 | !       ----------------------!
  84 | 
  85 |         WRITE(FILE_NODES) i_nnodes
  86 |         DO i=1, i_nnodes
  87 |           i_fatnodes = 1
  88 |           pt_fatnode => facesatnode(i)%fatnode_ptr
  89 | 
  90 |           DO WHILE (ASSOCIATED(pt_fatnode%next_fatnode))
  91 |             i_fatnodes = i_fatnodes + 1
  92 |             pt_fatnode => pt_fatnode%next_fatnode
  93 |           ENDDO
  94 | 
  95 |           ALLOCATE(fatnodelist(1:i_fatnodes))
  96 | 
  97 |           i_fatnodes = 1
  98 |           pt_fatnode => facesatnode(i)%fatnode_ptr
  99 | 
 100 |           DO WHILE (ASSOCIATED(pt_fatnode))
 101 |             fatnodelist(i_fatnodes) = pt_fatnode%fatthisnode%face_id
 102 |             pt_fatnode => pt_fatnode%next_fatnode
 103 |           ENDDO
 104 | 
 105 |           WRITE(FILE_NODES) node_list(1:3,i), i_fatnodes,               &
 106 |      &                      fatnodelist(1:i_fatnodes)
 107 | 
 108 |           DEALLOCATE(fatnodelist)
 109 |         ENDDO
 110 | 
 111 | !       ----------------!
 112 | !       Close all files !
 113 | !       ----------------!
 114 | 
 115 |         CLOSE(FILE_NODES)
 116 |         CLOSE(FILE_CELLS)
 117 |         CLOSE(FILE_FACES)
 118 | 
 119 |       END SUBROUTINE writedatas