| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
program UsesCase_MEDfield_2 |
| 23 |
|
| 24 |
implicit none |
| 25 |
include 'med.hf90' |
| 26 |
|
| 27 |
integer cret |
| 28 |
integer*8 fid |
| 29 |
|
| 30 |
character(64) :: mname |
| 31 |
|
| 32 |
character(64) :: finame = 'TEMPERATURE_FIELD' |
| 33 |
|
| 34 |
integer nstep, nvals, lcmesh, fitype |
| 35 |
|
| 36 |
character(16) :: cpname |
| 37 |
|
| 38 |
character(16) :: cpunit |
| 39 |
character(16) :: dtunit |
| 40 |
|
| 41 |
|
| 42 |
real*8, dimension(:), allocatable :: verval |
| 43 |
real*8, dimension(:), allocatable :: tria3v |
| 44 |
real*8, dimension(:), allocatable :: quad4v |
| 45 |
|
| 46 |
|
| 47 |
call mfiope(fid,'UsesCase_MEDfield_1.med',MED_ACC_RDONLY,cret) |
| 48 |
if (cret .ne. 0 ) then |
| 49 |
print *,'ERROR : opening file' |
| 50 |
call efexit(-1) |
| 51 |
endif |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
call mfdfin(fid,finame,mname,lcmesh,fitype,cpname,cpunit,dtunit,nstep,cret) |
| 58 |
print *,cret |
| 59 |
if (cret .ne. 0 ) then |
| 60 |
print *,'ERROR : field info by name' |
| 61 |
call efexit(-1) |
| 62 |
endif |
| 63 |
print *, 'Mesh name :', mname |
| 64 |
print *, 'Local mesh :', lcmesh |
| 65 |
print *, 'Field type :', fitype |
| 66 |
print *, 'Component name :', cpname |
| 67 |
print *, 'Component unit :', cpunit |
| 68 |
print *, 'dtunit :', dtunit |
| 69 |
print *, 'nstep :', nstep |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
call mfdnva(fid,finame,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,nvals,cret) |
| 76 |
if (cret .ne. 0 ) then |
| 77 |
print *,'ERROR : read number of values ...' |
| 78 |
call efexit(-1) |
| 79 |
endif |
| 80 |
|
| 81 |
print *, 'Node number :', nvals |
| 82 |
|
| 83 |
allocate ( verval(nvals),STAT=cret ) |
| 84 |
if (cret > 0) then |
| 85 |
print *,'Memory allocation' |
| 86 |
call efexit(-1) |
| 87 |
endif |
| 88 |
|
| 89 |
call mfdrvr(fid,finame,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,verval,cret) |
| 90 |
if (cret .ne. 0 ) then |
| 91 |
print *,'ERROR : read fields values on vertices ...' |
| 92 |
call efexit(-1) |
| 93 |
endif |
| 94 |
|
| 95 |
print *, 'Fields values on vertices :', verval |
| 96 |
|
| 97 |
deallocate(verval) |
| 98 |
|
| 99 |
|
| 100 |
call mfdnva(fid,finame,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,nvals,cret) |
| 101 |
if (cret .ne. 0 ) then |
| 102 |
print *,'ERROR : read number of values ...' |
| 103 |
call efexit(-1) |
| 104 |
endif |
| 105 |
|
| 106 |
print *, 'Triangulars cells number :', nvals |
| 107 |
|
| 108 |
allocate ( tria3v(nvals),STAT=cret ) |
| 109 |
if (cret > 0) then |
| 110 |
print *,'Memory allocation' |
| 111 |
call efexit(-1) |
| 112 |
endif |
| 113 |
|
| 114 |
call mfdrvr(fid,finame,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,tria3v,cret) |
| 115 |
if (cret .ne. 0 ) then |
| 116 |
print *,'ERROR : read fields values for MED_TRIA3 cells ...' |
| 117 |
call efexit(-1) |
| 118 |
endif |
| 119 |
|
| 120 |
print *, 'Fiels values for MED_TRIA3 cells :', tria3v |
| 121 |
|
| 122 |
deallocate(tria3v) |
| 123 |
|
| 124 |
|
| 125 |
call mfdnva(fid,finame,MED_NO_DT,MED_NO_IT,MED_CELL,MED_QUAD4,nvals,cret) |
| 126 |
if (cret .ne. 0 ) then |
| 127 |
print *,'ERROR : read number of values ...' |
| 128 |
call efexit(-1) |
| 129 |
endif |
| 130 |
|
| 131 |
print *, 'Quadrangulars cells number :', nvals |
| 132 |
|
| 133 |
allocate ( quad4v(nvals),STAT=cret ) |
| 134 |
if (cret > 0) then |
| 135 |
print *,'Memory allocation' |
| 136 |
call efexit(-1) |
| 137 |
endif |
| 138 |
|
| 139 |
call mfdrvr(fid,finame,MED_NO_DT,MED_NO_IT,MED_CELL,MED_QUAD4,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,quad4v,cret) |
| 140 |
if (cret .ne. 0 ) then |
| 141 |
print *,'ERROR : read fields values for MED_QUAD4 cells ...' |
| 142 |
call efexit(-1) |
| 143 |
endif |
| 144 |
|
| 145 |
print *, 'Fiels values for MED_QUAD4 cells :', quad4v |
| 146 |
|
| 147 |
deallocate(quad4v) |
| 148 |
|
| 149 |
|
| 150 |
call mficlo(fid,cret) |
| 151 |
if (cret .ne. 0 ) then |
| 152 |
print *,'ERROR : close file' |
| 153 |
call efexit(-1) |
| 154 |
endif |
| 155 |
|
| 156 |
end program UsesCase_MEDfield_2 |
| 157 |
|