# UsesCase_MEDmesh_2.f90

Aller à la documentation de ce fichier.

    00001 !*  This file is part of MED.
    00002 !*
    00003 !*  COPYRIGHT (C) 1999 - 2011  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 !*  Use case 3 : read an unstructured mesh : read a 2D unstructured mesh with 15 nodes,
    00020 !*               8 triangular cells, 4 triangular cells
    00021 !*  - Computation step : NO
    00022 !*
    00023
    00024 program UsesCase_MEDmesh_2
    00025
    00026   implicit none
    00027   include 'med.hf'
    00028
    00029   integer cret
    00030   integer fid, nmesh, it, naxis
    00031   character(64)  :: mname = "2D unstructured mesh"
    00032   character(200) :: desc
    00033   character(16)  :: dtunit
    00034   integer nstep, mdim, sdim, stype, mtype, atype
    00035   character(16), dimension(:), allocatable :: aname
    00036   character(16), dimension (:), allocatable :: aunit
    00037
    00038   ! open file             **
    00039   call mfiope(fid,'UsesCase_MEDmesh_1.med',MED_ACC_RDONLY, cret)
    00040   print *,cret
    00041   print *,fid
    00042   if (cret .ne. 0 ) then
    00043      print *,'ERROR : open file'
    00044      call efexit(-1)
    00045   endif
    00046
    00047   ! ... we know that the MED file has only one mesh,
    00048   ! a real code working would check ...
    00049
    00050   ! read computation space dimension **
    00051   call mmhnan(fid,mname,naxis,cret)
    00052   print *,cret
    00053   if (cret .ne. 0 ) then
    00054      print *,'Read number of axis in the mesh'
    00055      call efexit(-1)
    00056   endif
    00057   print *,'Number of axis in the mesh  = ',naxis
    00058
    00059   allocate ( aname(naxis), aunit(naxis) ,STAT=cret )
    00060   if (cret > 0) then
    00061      print *,'Memory allocation'
    00062      call efexit(-1)
    00063   endif
    00064   ! read mesh informations **
    00065   call  mmhmin(fid, mname, sdim, mdim, mtype, desc, dtunit, stype, nstep, atype, aname, aunit, cret)
    00066   print *,cret
    00067   if (cret .ne. 0 ) then
    00068      print *,'Read mesh informations'
    00069      call efexit(-1)
    00070   endif
    00071   print *,"mesh name =", mname
    00072   print *,"space dim =", sdim
    00073   print *,"mesh dim =", mdim
    00074   print *,"mesh type =", mtype
    00075   print *,"mesh description =", desc
    00076   print *,"dt unit = ", dtunit
    00077   print *,"sorting type =", stype
    00078   print *,"number of computing step =", nstep
    00079   print *,"coordinates axis type =", atype
    00080   print *,"coordinates axis name =", aname
    00081   print *,"coordinates axis units =", aunit
    00082   deallocate(aname, aunit)
    00083
    00084   ! close file **
    00085   call mficlo(fid,cret)
    00086   print *,cret
    00087   if (cret .ne. 0 ) then
    00088      print *,'ERROR :  close file'
    00089      call efexit(-1)
    00090   endif
    00091
    00092 end program UsesCase_MEDmesh_2
    00093
    00094