UsesCase_MEDmesh_3.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 : generic approach
00020 !*  - Computation step : NO
00021 !*
00022 
00023 program UsesCase_MEDmesh_3
00024 
00025   implicit none
00026   include 'med.hf'
00027 
00028   integer cret
00029   integer fid, nmesh, it, naxis
00030   character(64)  :: mname
00031   character(200) :: desc
00032   character(16)  :: dtunit
00033   integer nstep, mdim, sdim, stype, mtype, atype
00034   character(16), dimension(:), allocatable :: aname
00035   character(16), dimension (:), allocatable :: aunit
00036 
00037   ! open file             **
00038   call mfiope(fid,'UsesCase_MEDmesh_1.med',MED_ACC_RDONLY, cret)
00039   print *,cret
00040   print *,fid
00041   if (cret .ne. 0 ) then
00042      print *,'ERROR : open file'
00043      call efexit(-1)
00044   endif
00045 
00046   ! how many mesh in the file ? **
00047   call mmhnmh(fid,nmesh,cret)
00048   print *,cret
00049   if (cret .ne. 0 ) then
00050      print *,'Read how many mesh'
00051      call efexit(-1)
00052   endif
00053   print *,'Number of mesh = ',nmesh
00054 
00055   do it=1,nmesh
00056 
00057      print *,'mesh iterator =',it
00058 
00059      ! read computation space dimension **
00060      call mmhnax(fid,it,naxis,cret)
00061      print *,cret
00062      if (cret .ne. 0 ) then
00063         print *,'Read number of axis in the mesh'
00064         call efexit(-1)
00065      endif
00066      print *,'Number of axis in the mesh  = ',naxis
00067 
00068      allocate ( aname(naxis), aunit(naxis) ,STAT=cret )
00069      if (cret > 0) then
00070         print *,'Memory allocation'
00071         call efexit(-1)
00072      endif
00073      ! read mesh informations **
00074      call  mmhmii(fid, it, mname, sdim, mdim, mtype, desc, dtunit, stype, nstep, atype, aname, aunit, cret)
00075      print *,cret
00076      if (cret .ne. 0 ) then
00077         print *,'Read mesh informations'
00078         call efexit(-1)
00079      endif
00080      print *,"mesh name =", mname
00081      print *,"space dim =", sdim
00082      print *,"mesh dim =", mdim
00083      print *,"mesh type =", mtype
00084      print *,"mesh description =", desc
00085      print *,"dt unit = ", dtunit
00086      print *,"sorting type =", stype
00087      print *,"number of computing step =", nstep
00088      print *,"coordinates axis type =", atype
00089      print *,"coordinates axis name =", aname
00090      print *,"coordinates axis units =", aunit
00091      deallocate(aname, aunit)
00092      
00093   enddo
00094 
00095 
00096   ! close file **
00097   call mficlo(fid,cret)
00098   print *,cret
00099   if (cret .ne. 0 ) then
00100      print *,'ERROR :  close file'
00101      call efexit(-1)
00102   endif
00103 
00104 end program UsesCase_MEDmesh_3
00105 
00106 

Généré le Mon May 16 17:10:24 2011 pour MED fichier par  doxygen 1.6.1