| 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_8 |
| 24 |
|
| 25 |
implicit none |
| 26 |
include 'med.hf90' |
| 27 |
|
| 28 |
integer cret |
| 29 |
integer*8 fid |
| 30 |
|
| 31 |
|
| 32 |
integer nmesh |
| 33 |
|
| 34 |
character(MED_NAME_SIZE) :: mname = "" |
| 35 |
|
| 36 |
character(MED_COMMENT_SIZE) :: mdesc = "" |
| 37 |
|
| 38 |
integer mdim, sdim |
| 39 |
|
| 40 |
integer stype |
| 41 |
integer nstep |
| 42 |
|
| 43 |
integer mtype, atype |
| 44 |
|
| 45 |
character(MED_SNAME_SIZE), dimension(:), allocatable :: aname |
| 46 |
character(MED_SNAME_SIZE), dimension(:), allocatable :: aunit |
| 47 |
character(MED_SNAME_SIZE) :: dtunit = "" |
| 48 |
|
| 49 |
real*8, dimension(:), allocatable :: coords |
| 50 |
integer ngeo |
| 51 |
integer nnodes |
| 52 |
|
| 53 |
integer , dimension(:), allocatable :: conity |
| 54 |
|
| 55 |
|
| 56 |
integer coocha, geotra |
| 57 |
|
| 58 |
integer i, it, j |
| 59 |
|
| 60 |
|
| 61 |
integer profsz |
| 62 |
|
| 63 |
character(MED_NAME_SIZE) :: profna = "" |
| 64 |
|
| 65 |
integer numdt, numit |
| 66 |
real*8 dt |
| 67 |
|
| 68 |
|
| 69 |
integer geotyp |
| 70 |
integer, dimension(MED_N_CELL_FIXED_GEO) :: geotps |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
geotps = MED_GET_CELL_GEOMETRY_TYPE |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
call mfiope(fid, "UsesCase_MEDmesh_6.med", MED_ACC_RDONLY, cret) |
| 84 |
if (cret .ne. 0 ) then |
| 85 |
print *, "ERROR : open file" |
| 86 |
call efexit(-1) |
| 87 |
endif |
| 88 |
|
| 89 |
|
| 90 |
call mmhnmh(fid, nmesh, cret) |
| 91 |
if (cret .ne. 0 ) then |
| 92 |
print *, "ERROR : read how many mesh" |
| 93 |
call efexit(-1) |
| 94 |
endif |
| 95 |
|
| 96 |
print *, "nmesh :", nmesh |
| 97 |
|
| 98 |
do i=1, nmesh |
| 99 |
|
| 100 |
|
| 101 |
call mmhnax(fid, i, sdim, cret) |
| 102 |
if (cret .ne. 0 ) then |
| 103 |
print *, "ERROR : read computation space dimension" |
| 104 |
call efexit(-1) |
| 105 |
endif |
| 106 |
|
| 107 |
|
| 108 |
allocate ( aname(sdim), aunit(sdim) ,STAT=cret ) |
| 109 |
if (cret > 0) then |
| 110 |
print *, "ERROR : memory allocation" |
| 111 |
call efexit(-1) |
| 112 |
endif |
| 113 |
|
| 114 |
|
| 115 |
call mmhmii(fid, i, mname, sdim, mdim, mtype, mdesc, dtunit, stype, nstep, & |
| 116 |
atype, aname, aunit, cret) |
| 117 |
if (cret .ne. 0 ) then |
| 118 |
print *, "ERROR : read mesh informations" |
| 119 |
call efexit(-1) |
| 120 |
endif |
| 121 |
print *,"mesh name =", mname |
| 122 |
print *,"space dim =", sdim |
| 123 |
print *,"mesh dim =", mdim |
| 124 |
print *,"mesh type =", mtype |
| 125 |
print *,"mesh description =", mdesc |
| 126 |
print *,"dt unit = ", dtunit |
| 127 |
print *,"sorting type =", stype |
| 128 |
print *,"number of computing step =", nstep |
| 129 |
print *,"coordinates axis type =", atype |
| 130 |
print *,"coordinates axis name =", aname |
| 131 |
print *,"coordinates axis units =", aunit |
| 132 |
deallocate(aname, aunit) |
| 133 |
|
| 134 |
|
| 135 |
call mmhnme(fid, mname, MED_NO_DT, MED_NO_IT, MED_NODE, MED_NO_GEOTYPE, & |
| 136 |
MED_COORDINATE, MED_NO_CMODE, coocha, geotra, nnodes, cret) |
| 137 |
if (cret .ne. 0 ) then |
| 138 |
print *, "ERROR : read how many nodes in the mesh" |
| 139 |
call efexit(-1) |
| 140 |
endif |
| 141 |
print *, "number of nodes in the mesh =", nnodes |
| 142 |
|
| 143 |
|
| 144 |
allocate (coords(nnodes*sdim),STAT=cret) |
| 145 |
if (cret > 0) then |
| 146 |
print *,"ERROR : memory allocation" |
| 147 |
call efexit(-1) |
| 148 |
endif |
| 149 |
|
| 150 |
call mmhcor(fid, mname, MED_NO_DT, MED_NO_IT, MED_FULL_INTERLACE, coords, cret) |
| 151 |
if (cret .ne. 0 ) then |
| 152 |
print *,"ERROR : nodes coordinates" |
| 153 |
call efexit(-1) |
| 154 |
endif |
| 155 |
print *,"Nodes coordinates =", coords |
| 156 |
deallocate(coords) |
| 157 |
|
| 158 |
|
| 159 |
do it=1, MED_N_CELL_FIXED_GEO |
| 160 |
|
| 161 |
geotyp = geotps(it) |
| 162 |
|
| 163 |
print *, "geotps(it) :", geotps(it) |
| 164 |
|
| 165 |
call mmhnme(fid, mname, MED_NO_DT, MED_NO_IT, MED_CELL, geotyp, & |
| 166 |
MED_CONNECTIVITY, MED_NODAL, coocha, & |
| 167 |
geotra, ngeo, cret) |
| 168 |
if (cret .ne. 0 ) then |
| 169 |
print *,"ERROR : number of cells" |
| 170 |
call efexit(-1) |
| 171 |
endif |
| 172 |
print *,"Number of cells =", ngeo |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
if (ngeo .ne. 0) then |
| 177 |
allocate (conity(ngeo*mod(geotyp,100)), STAT=cret) |
| 178 |
if (cret > 0) then |
| 179 |
print *,"ERROR : memory allocation" |
| 180 |
call efexit(-1) |
| 181 |
endif |
| 182 |
|
| 183 |
call mmhcyr(fid, mname, MED_NO_DT, MED_NO_IT, MED_CELL, & |
| 184 |
geotyp, MED_NODAL, MED_FULL_INTERLACE, & |
| 185 |
conity, cret) |
| 186 |
if (cret > 0) then |
| 187 |
print *,"ERROR : cellconnectivity", conity |
| 188 |
call efexit(-1) |
| 189 |
endif |
| 190 |
deallocate(conity) |
| 191 |
|
| 192 |
endif |
| 193 |
end do |
| 194 |
|
| 195 |
|
| 196 |
do it=1, nstep-1 |
| 197 |
|
| 198 |
call mmhcsi(fid, mname, it+1, numdt, numit, dt, cret) |
| 199 |
if (cret .ne. 0 ) then |
| 200 |
print *,"ERROR : computing step info" |
| 201 |
call efexit(-1) |
| 202 |
endif |
| 203 |
print *,"numdt =", numdt |
| 204 |
print *,"numit =", numit |
| 205 |
print *,"dt =", dt |
| 206 |
|
| 207 |
|
| 208 |
call mmhnep(fid, mname, numdt, numit, MED_NODE, MED_NO_GEOTYPE, & |
| 209 |
MED_COORDINATE, MED_NO_CMODE, MED_GLOBAL_STMODE, & |
| 210 |
profna, profsz, coocha, geotra, nnodes, cret) |
| 211 |
if (cret .ne. 0 ) then |
| 212 |
print *,"ERROR : nodes coordinates" |
| 213 |
call efexit(-1) |
| 214 |
endif |
| 215 |
print *, "profna =", profna |
| 216 |
print *, "coocha =", coocha |
| 217 |
print *, "geotra =", geotra |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
if (coocha == 1 .and. geotra == 1) then |
| 222 |
|
| 223 |
allocate (coords(nnodes*2),STAT=cret) |
| 224 |
if (cret > 0) then |
| 225 |
print *,"ERROR : memory allocation" |
| 226 |
call efexit(-1) |
| 227 |
endif |
| 228 |
|
| 229 |
call mmhcpr(fid, mname, numdt, numit,MED_GLOBAL_STMODE,profna, & |
| 230 |
MED_FULL_INTERLACE,MED_ALL_CONSTITUENT, coords, cret) |
| 231 |
if (cret .ne. 0 ) then |
| 232 |
print *,"ERROR : nodes coordinates" |
| 233 |
call efexit(-1) |
| 234 |
endif |
| 235 |
print *,"Nodes coordinates =", coords |
| 236 |
deallocate(coords) |
| 237 |
|
| 238 |
end if |
| 239 |
|
| 240 |
end do |
| 241 |
|
| 242 |
end do |
| 243 |
|
| 244 |
|
| 245 |
call mficlo(fid,cret) |
| 246 |
if (cret .ne. 0 ) then |
| 247 |
print *,"ERROR : close file" |
| 248 |
call efexit(-1) |
| 249 |
endif |
| 250 |
|
| 251 |
end program UsesCase_MEDmesh_8 |
| 252 |
|
| 253 |
|