implicit none
include 'med.hf'
integer*8 fid
integer cret,i,j
integer mdim,nind,nmaa,type,quoi,rep,typmaa
integer edim,nstep,stype,atype, chgt, tsf
character*64 maa
integer nnoe
real*8 coo(8)
character*16 nomcoo(2), unicoo(2)
character*200 desc
integer strgri(2)
integer axe
real*8 indice(4)
character(16) :: dtunit
call mfiope(fid,
'test27.med',med_acc_rdonly, cret)
if (cret .ne. 0 ) then
print *,'Erreur ouverture du fichier'
call efexit(-1)
endif
print *,cret
print *,'Ouverture du fichier test27.med'
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture du nombre de maillage'
call efexit(-1)
endif
do 10 i=1,nmaa
call mmhmii(fid,i,maa,edim,mdim,
type,desc,
& dtunit,stype,nstep,atype,
& nomcoo,unicoo,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture maillage info'
call efexit(-1)
endif
print *,'Maillage de nom : ',maa
print *,'- Dimension : ',mdim
if (type.eq.med_structured_mesh) then
print *,'- Type : structure'
else
print *,'- Type : non structure'
endif
if (type.eq.med_structured_mesh) then
call mmhgtr(fid,maa,typmaa,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture nature de la grille'
call efexit(-1)
endif
if (typmaa.eq.med_cartesian_grid) then
print *,'- Nature de la grille : cartesienne'
endif
if (typmaa.eq.med_curvilinear_grid) then
print *,'- Nature de la grille : curviligne'
endif
endif
if ((typmaa.eq.med_curvilinear_grid)
& .and. (type.eq.med_structured_mesh)) then
call mmhnme(fid,maa,med_no_dt,med_no_it,med_node,
& med_none,med_coordinate,med_no_cmode,
& chgt,tsf,nnoe,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture nombre de noeud'
call efexit(-1)
endif
print *,'- Nombre de noeuds : ',nnoe
call mmhgsr(fid,maa,med_no_dt,med_no_it,strgri,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture structure de la grille'
call efexit(-1)
endif
print *,'- Structure de la grille : ',strgri
call mmhcor(fid,maa,med_no_dt,med_no_it,
& med_full_interlace,coo,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture des coordonnees des noeuds'
call efexit(-1)
endif
print *,'- Coordonnees :'
do 20 j=1,nnoe*mdim
print *,coo(j)
20 continue
endif
if ((typmaa.eq.med_cartesian_grid)
& .and. (type.eq. med_structured_mesh)) then
do 30 axe=1,mdim
if (axe.eq.1) then
quoi = med_coordinate_axis1
endif
if (axe.eq.2) then
quoi = med_coordinate_axis2
endif
if (axe.eq.3) then
quoi = med_coordinate_axis3
endif
call mmhnme(fid,maa,med_no_dt,med_no_it,med_node,
& med_none,quoi,med_no_cmode,
& chgt,tsf,nind,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture taille indice'
call efexit(-1)
endif
print *,'- Axe ',axe
print *,'- Nombre d indices : ',nind
call mmhgcr(fid,maa,med_no_dt,med_no_it,
& axe,indice,cret)
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur lecture indices de coordonnées'
call efexit(-1)
endif
print *,'- Axe ', nomcoo
print *,' unite : ',unicoo
do 40 j=1,nind
print *,indice(j)
40 continue
30 continue
endif
10 continue
print *,cret
if (cret .ne. 0 ) then
print *,'Erreur fermeture du fichier'
call efexit(-1)
endif
print *,'Fermeture du fichier'
end
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
subroutine mmhnmh(fid, n, cret)
Cette routine permet de lire le nombre de maillages dans un fichier.
subroutine mmhgtr(fid, name, gtype, cret)
Cette routine permet de lire le type d'un maillage structuré (MED_STRUCTURED_MESH).
subroutine mmhnme(fid, name, numdt, numit, entype, geotype, datype, cmode, chgt, tsf, n, cret)
Cette routine permet de lire le nombre d'entités dans un maillage pour une étape de calcul donnée.
subroutine mmhmii(fid, it, name, sdim, mdim, mtype, desc, dtunit, stype, nstep, atype, aname, aunit, cret)
Cette routine permet de lire les informations relatives à un maillage dans un fichier.
subroutine mmhgsr(fid, name, numdt, numit, st, cret)
subroutine mmhcor(fid, name, numdt, numit, swm, coo, cret)
subroutine mmhgcr(fid, name, numdt, numit, axis, index, cret)