| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
program UsesCase_MEDmesh_5 |
| 24 |
|
| 25 |
implicit none |
| 26 |
include 'med.hf90' |
| 27 |
|
| 28 |
integer cret |
| 29 |
integer*8 fid |
| 30 |
integer nmesh, it, naxis, axis |
| 31 |
integer coocha, geotra |
| 32 |
character(64) :: mname = "2D structured mesh" |
| 33 |
character(200) :: desc |
| 34 |
character(16) :: dtunit |
| 35 |
integer nstep, mdim, sdim, stype, mtype, atype, asize |
| 36 |
integer gtype, ncell |
| 37 |
character(16), dimension(:), allocatable :: aname |
| 38 |
character(16), dimension (:), allocatable :: aunit |
| 39 |
real*8, dimension (:), allocatable :: cooXaxis |
| 40 |
real*8, dimension (:), allocatable :: cooYaxis |
| 41 |
character*16, dimension (:), allocatable :: cnames |
| 42 |
|
| 43 |
|
| 44 |
call mfiope(fid,'UsesCase_MEDmesh_4.med',MED_ACC_RDONLY, cret) |
| 45 |
if (cret .ne. 0 ) then |
| 46 |
print *,'ERROR : open file' |
| 47 |
call efexit(-1) |
| 48 |
endif |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
call mmhnan(fid,mname,naxis,cret) |
| 55 |
if (cret .ne. 0 ) then |
| 56 |
print *,'Read number of axis in the mesh' |
| 57 |
call efexit(-1) |
| 58 |
endif |
| 59 |
print *,'Number of axis in the mesh = ',naxis |
| 60 |
|
| 61 |
|
| 62 |
allocate ( aname(naxis), aunit(naxis) ,STAT=cret ) |
| 63 |
if (cret > 0) then |
| 64 |
print *,'Memory allocation' |
| 65 |
call efexit(-1) |
| 66 |
endif |
| 67 |
|
| 68 |
call mmhmin(fid, mname, sdim, mdim, mtype, desc, dtunit, stype, nstep, atype, aname, aunit, cret) |
| 69 |
if (cret .ne. 0 ) then |
| 70 |
print *,'Read mesh informations' |
| 71 |
call efexit(-1) |
| 72 |
endif |
| 73 |
print *,"mesh name =", mname |
| 74 |
print *,"space dim =", sdim |
| 75 |
print *,"mesh dim =", mdim |
| 76 |
print *,"mesh type =", mtype |
| 77 |
print *,"mesh description =", desc |
| 78 |
print *,"dt unit = ", dtunit |
| 79 |
print *,"sorting type =", stype |
| 80 |
print *,"number of computing step =", nstep |
| 81 |
print *,"coordinates axis type =", atype |
| 82 |
print *,"coordinates axis name =", aname |
| 83 |
print *,"coordinates axis units =", aunit |
| 84 |
deallocate(aname, aunit) |
| 85 |
|
| 86 |
|
| 87 |
call mmhgtr(fid,mname,gtype,cret) |
| 88 |
if (cret .ne. 0 ) then |
| 89 |
print *,'Read grid type' |
| 90 |
call efexit(-1) |
| 91 |
endif |
| 92 |
print *,"grid type =", gtype |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
axis = 1 |
| 100 |
call mmhnme(fid,mname,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,MED_COORDINATE_AXIS1,MED_NO_CMODE,coocha,geotra,asize,cret) |
| 101 |
if (cret .ne. 0 ) then |
| 102 |
print *,'Read number of coordinates on X axis ' |
| 103 |
call efexit(-1) |
| 104 |
endif |
| 105 |
print *,"Number of coordinates on X axis =", asize |
| 106 |
ncell = asize-1 |
| 107 |
|
| 108 |
allocate ( cooXaxis(asize),STAT=cret ) |
| 109 |
if (cret > 0) then |
| 110 |
print *,'Memory allocation' |
| 111 |
call efexit(-1) |
| 112 |
endif |
| 113 |
|
| 114 |
call mmhgcr(fid,mname,MED_NO_DT,MED_NO_IT,axis,cooXaxis,cret) |
| 115 |
if (cret .ne. 0 ) then |
| 116 |
print *,'Read axis X coordinates' |
| 117 |
call efexit(-1) |
| 118 |
endif |
| 119 |
print *,"Axis X coordinates =", cooXaxis |
| 120 |
deallocate(cooXaxis) |
| 121 |
|
| 122 |
|
| 123 |
axis = 2 |
| 124 |
call mmhnme(fid,mname,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,MED_COORDINATE_AXIS2,MED_NO_CMODE,coocha,geotra,asize,cret) |
| 125 |
if (cret .ne. 0 ) then |
| 126 |
print *,'Read number of coordinates on Y axis ' |
| 127 |
call efexit(-1) |
| 128 |
endif |
| 129 |
print *,"Number of coordinates on Y axis =", asize |
| 130 |
ncell = ncell * (asize-1) |
| 131 |
|
| 132 |
allocate ( cooYaxis(asize),STAT=cret ) |
| 133 |
if (cret > 0) then |
| 134 |
print *,'Memory allocation' |
| 135 |
call efexit(-1) |
| 136 |
endif |
| 137 |
|
| 138 |
call mmhgcr(fid,mname,MED_NO_DT,MED_NO_IT,axis,cooYaxis,cret) |
| 139 |
if (cret .ne. 0 ) then |
| 140 |
print *,'Read axis Y coordinates' |
| 141 |
call efexit(-1) |
| 142 |
endif |
| 143 |
print *,"Axis Y coordinates =", cooYaxis |
| 144 |
deallocate(cooYaxis) |
| 145 |
|
| 146 |
|
| 147 |
print *,'ncell :', ncell |
| 148 |
allocate ( cnames(ncell),STAT=cret ) |
| 149 |
if (cret > 0) then |
| 150 |
print *,'Memory allocation' |
| 151 |
call efexit(-1) |
| 152 |
endif |
| 153 |
|
| 154 |
call mmhear(fid,mname,MED_NO_DT,MED_NO_IT,MED_CELL,MED_QUAD4,cnames,cret) |
| 155 |
if (cret .ne. 0 ) then |
| 156 |
print *,'Read names for elements' |
| 157 |
call efexit(-1) |
| 158 |
endif |
| 159 |
print *,'Cells names =', cnames |
| 160 |
deallocate(cnames) |
| 161 |
|
| 162 |
|
| 163 |
call mficlo(fid,cret) |
| 164 |
if (cret .ne. 0 ) then |
| 165 |
print *,'ERROR : close file' |
| 166 |
call efexit(-1) |
| 167 |
endif |
| 168 |
|
| 169 |
end program UsesCase_MEDmesh_5 |
| 170 |
|