# 2.3.6/test17.f90

Aller à la documentation de ce fichier.

    00001 !*  This file is part of MED.
    00002 !*
    00003 !*  COPYRIGHT (C) 1999 - 2012  EDF R&D, CEA/DEN
    00004 !*  MED is free software: you can redistribute it and/or modify
    00005 !*  it under the terms of the GNU Lesser General Public License as published by
    00006 !*  the Free Software Foundation, either version 3 of the License, or
    00007 !*  (at your option) any later version.
    00008 !*
    00009 !*  MED is distributed in the hope that it will be useful,
    00010 !*  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011 !*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012 !*  GNU Lesser General Public License for more details.
    00013 !*
    00014 !*  You should have received a copy of the GNU Lesser General Public License
    00015 !*  along with MED.  If not, see <http://www.gnu.org/licenses/>.
    00016 !*
    00017
    00018 ! ******************************************************************************
    00019 ! * - Nom du fichier : test17.f90
    00020 ! *
    00021 ! * - Description : lecture d'elements de maillages MED ecrits par test16
    00022 ! *                 via les routines de niveau 2
    00023 ! *                 - equivalent a test17.f90
    00024 ! *
    00025 ! ******************************************************************************
    00026
    00027 program test17
    00028
    00029   implicit none
    00030   include 'med.hf'
    00031
    00032   integer      :: cret,ret, fid, nse2, mdim
    00033   integer,     allocatable, dimension(:) ::se2
    00034   character*16, allocatable, dimension(:) ::nomse2
    00035   integer,     allocatable, dimension(:) ::numse2,nufase2
    00036   integer      ntr3
    00037   integer,     allocatable, dimension(:) ::tr3
    00038   character*16, allocatable, dimension(:) ::nomtr3
    00039   integer,     allocatable, dimension(:) ::numtr3
    00040   integer,     allocatable, dimension(:) ::nufatr3
    00041   character*32  :: maa = "maa1"
    00042   character*200 :: desc
    00043   logical      :: inoele1,inuele1,inoele2,inuele2
    00044   integer      tse2,ttr3
    00045   integer i,type
    00046
    00047   !   ** Ouverture du fichier test16.med en lecture seule **
    00048   call efouvr(fid,'test16.med',MED_LECTURE, cret)
    00049   print *,cret
    00050
    00051   !   ** Lecture des informations sur le 1er maillage **
    00052   if (cret.eq.0) then
    00053      call efmaai(fid,1,maa,mdim,type,desc,cret)
    00054      print *,"Maillage de nom : ",maa," et de dimension ",mdim
    00055   endif
    00056   print *,cret
    00057
    00058    !  ** Lecture du nombre de triangles et de segments **
    00059   if (cret.eq.0) then
    00060      call efnema(fid,maa,MED_CONN,MED_ARETE,MED_SEG2,MED_DESC,nse2,cret)
    00061   endif
    00062   print *,cret
    00063
    00064   if (cret.eq.0) then
    00065      call efnema(fid,maa,MED_CONN,MED_MAILLE,MED_TRIA3,MED_DESC,ntr3,cret)
    00066   endif
    00067   print *,cret
    00068
    00069   print *,"Nombre de MED_SEG2 : ",nse2," - nombre de MED_TRIA3 : ",ntr3
    00070
    00071   !  ** Allocations memoire **
    00072   tse2 = 2;
    00073   allocate(se2(tse2*nse2),nomse2(nse2),numse2(nse2),nufase2(nse2),STAT=ret)
    00074   ttr3 = 3;
    00075   allocate(tr3(ntr3*ttr3),nomtr3(ntr3),numtr3(ntr3),nufatr3(ntr3),STAT=ret)
    00076
    00077   !  ** Lecture des aretes segments MED_SEG2 :
    00078   !     - Connectivite,
    00079   !     - Noms (optionnel)
    00080   !     - Numeros (optionnel)
    00081   !     - Numeros de familles **
    00082   if (cret.eq.0) then
    00083      call efelel(fid,maa,mdim,se2,MED_NO_INTERLACE,nomse2,inoele1,numse2,inuele1,    &
    00084           &                       nufase2,nse2,MED_ARETE,MED_SEG2,MED_DESC,cret)
    00085   endif
    00086   print *,cret
    00087
    00088
    00089   !  ** lecture des mailles triangles MED_TRIA3 :
    00090   !     - Connectivite,
    00091   !     - Noms (optionnel)
    00092   !     - Numeros (optionnel)
    00093   !     - Numeros de familles **
    00094   if (cret.eq.0) then
    00095      call efelel(fid,maa,mdim,tr3,MED_NO_INTERLACE,nomtr3,inoele2,numtr3,inuele2,  &
    00096           &                       nufatr3,ntr3,MED_MAILLE,MED_TRIA3,MED_DESC,cret)
    00097   endif
    00098   print *,cret
    00099
    00100   ! ** Fermeture du fichier **
    00101   call efferm (fid,cret)
    00102   print *,cret
    00103
    00104   ! ** Affichage **
    00105   if (cret.eq.0) then
    00106       print *,"Connectivite des segments : ",nse2
    00107
    00108       if (inoele1) then
    00109          print *,"Noms des segments : ",nomse2
    00110       endif
    00111
    00112       if (inuele1) then
    00113          print *,"Numeros des segments : ",numse2
    00114       endif
    00115
    00116       print *,"Numeros des familles des segments : ",nufase2
    00117
    00118
    00119       print *,"Connectivite des triangles : ",tr3
    00120
    00121       if (inoele2) then
    00122          print *,"Noms des triangles :", nomtr3
    00123       endif
    00124
    00125       if (inuele2) then
    00126           print *,"Numeros des triangles :", numtr3
    00127       endif
    00128
    00129       print *,"Numeros des familles des triangles :", nufatr3
    00130
    00131    end if
    00132
    00133
    00134    ! ** Nettoyage memoire **
    00135    deallocate(se2,nomse2,numse2,nufase2);
    00136    deallocate(tr3,nomtr3,numtr3,nufatr3);
    00137
    00138    ! ** Code retour
    00139    call efexit(cret)
    00140
    00141  end program test17