avbp_coor.F [SRC] [CPP] [JOB] [SCAN]
TOOLS / EXTERNAL



   1 | include(dom.inc)
   2 | !     ===============================================================
   3 | !     Copyright (c) CERFACS (all rights reserved)
   4 | !     ===============================================================
   5 | 
   6 | 
   7 | !     ================================================================
   8 | !     ================================================================
   9 |       module avbp_coor
  10 | 
  11 |         implicit none
  12 | 
  13 |         character*80  coorfile
  14 | 
  15 |         DOM_REAL,dimension(:,:),allocatable:: coor
  16 | 
  17 |         DOM_INT coor_neq,                                               &
  18 |      &          coor_ndim,                                              &
  19 |      &          coor_nnode,                                             &
  20 |      &          coor_nblock,                                            &
  21 |      &          coor_nnbegin,                                           &
  22 |      &          coor_nnlength,                                          &
  23 |      &          coor_mynodes
  24 | 
  25 |         logical :: coor_itexists = .false.
  26 |         logical :: coor_show     = .true.
  27 |         
  28 |         character*1,dimension(1:3),parameter ::                         &
  29 |      &          coor_vname = (/'x','y','z'/)
  30 | 
  31 |         contains
  32 | 
  33 | !     ================================================================
  34 |       subroutine destroycoormemory
  35 | 
  36 |       if(allocated(coor)) then
  37 |          deallocate(coor)
  38 |       endif
  39 | 
  40 |       end subroutine destroycoormemory
  41 | !     ================================================================
  42 | 
  43 | 
  44 | !     ================================================================
  45 |       subroutine getcoorinfo
  46 | 
  47 |       implicit none
  48 |       DOM_INT n
  49 | 
  50 |       inquire(file=coorfile,exist=coor_itexists)
  51 | 
  52 |       if(coor_itexists) then
  53 |         open( unit=1, file=coorfile, form='unformatted' )
  54 |           read(1) coor_ndim,   coor_neq
  55 |           read(1) coor_nblock, coor_nnode
  56 |         close(1)
  57 |       else
  58 |         n = len_trim(coorfile)
  59 |         write(*,*) ' could not find the file ',coorfile(1:n)
  60 |       endif
  61 | 
  62 |       end subroutine getcoorinfo
  63 | !     ================================================================
  64 | 
  65 | 
  66 | !     ================================================================
  67 |         subroutine readcoor
  68 | 
  69 |           implicit none
  70 |           DOM_INT k,n
  71 | 
  72 |           n = len_trim(coorfile)
  73 |           if (coor_show) then 
  74 |             write(*,*) ' >>>> Reading mesh file ',coorfile(1:n)
  75 |           end if 
  76 |   
  77 |           inquire(file=coorfile,exist=coor_itexists)
  78 | 
  79 | 
  80 |           if(coor_itexists) then
  81 |             open( unit=1, file=coorfile, form='unformatted' )
  82 | 
  83 |             read(1) coor_ndim,   coor_neq
  84 |             read(1) coor_nblock, coor_nnode
  85 | 
  86 |             if(allocated(coor)) deallocate(coor)
  87 |         
  88 |             allocate(coor(1:coor_ndim,1:coor_nnode))
  89 |             
  90 |             read(1) coor_nnbegin,coor_nnlength,coor_mynodes
  91 |             read(1) ( (coor(k,n), n=1,coor_nnode),k=1,coor_ndim )
  92 |   
  93 |             close(1)
  94 |          else
  95 |             n = len_trim(coorfile)
  96 |             write(*,*) ' could not find the file ',coorfile(1:n)
  97 |          endif
  98 | 
  99 |         end subroutine readcoor
 100 | !     ================================================================
 101 | 
 102 | 
 103 | !     ================================================================
 104 |         subroutine writecoor
 105 | 
 106 |           implicit none
 107 |           DOM_INT k,n
 108 | 
 109 |           n = len_trim(coorfile)
 110 |           write(*,*) ' >>>> Writing mesh file ',coorfile(1:n)
 111 |   
 112 |           open( unit=1, file=coorfile, form='unformatted' )
 113 | 
 114 |           write(1) coor_ndim,   coor_neq
 115 |           write(1) coor_nblock, coor_nnode
 116 |           
 117 |           write(1) coor_nnbegin,coor_nnlength,coor_mynodes
 118 |           write(1) ( (coor(k,n), n=1,coor_nnode),k=1,coor_ndim )
 119 |           
 120 |           close(1)
 121 |   
 122 |         end subroutine writecoor
 123 | !     ================================================================
 124 | 
 125 | 
 126 |       end module avbp_coor
 127 | !     ================================================================
 128 | !     ================================================================
 129 |