2.3.6/test22.f

Aller à la documentation de ce fichier.
00001 C*  This file is part of MED.
00002 C*
00003 C*  COPYRIGHT (C) 1999 - 2015  EDF R&D, CEA/DEN
00004 C*  MED is free software: you can redistribute it and/or modify
00005 C*  it under the terms of the GNU Lesser General Public License as published by
00006 C*  the Free Software Foundation, either version 3 of the License, or
00007 C*  (at your option) any later version.
00008 C*
00009 C*  MED is distributed in the hope that it will be useful,
00010 C*  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 C*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 C*  GNU Lesser General Public License for more details.
00013 C*
00014 C*  You should have received a copy of the GNU Lesser General Public License
00015 C*  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016 C*
00017 
00018 C******************************************************************************
00019 C* - Nom du fichier : test22.f
00020 C*
00021 C* - Description : lecture des valeurs scalaires numeriques dans un fichier MED
00022 C ******************************************************************************
00023       program test22
00024 C     
00025       implicit none
00026       include 'med.hf'
00027 C
00028       integer fid,cret
00029       character*16 dtunit
00030       character*32 nom
00031       character*200 desc
00032       integer vali
00033       real*8 valr,dt
00034       integer n,npdt,i,j,type,numdt,numo
00035 C     
00036 C     Ouverture du fichier test21.med en lecture seule
00037 C
00038       call efouvr(fid,'test21.med',MED_LECTURE,cret)
00039       print *,cret
00040       if (cret .ne. 0 ) then
00041          print *,'Erreur ouverture du fichier'
00042          call efexit(-1)
00043       endif      
00044       print *,'Ouverture du fichier test21.med'
00045 C
00046 C     Lecture du nombre de variable scalaire
00047 C
00048       call efnsca(fid,n,cret)
00049       print *,cret
00050       if (cret .ne. 0 ) then
00051          print *,'Erreur lecture du nombre de variable'
00052          call efexit(-1)
00053       endif      
00054       print *,'Nombre de variables scalaires : ',n
00055 C
00056 C     Lecture des infos (type,description) propres 
00057 C     a chaque variable
00058 C
00059       do 10 i=1,n
00060          call efscai(fid,i,nom,type,desc,cret)
00061          print *,cret
00062          if (cret .ne. 0 ) then
00063             print *,'Erreur lecture des infos'
00064             call efexit(-1)
00065          endif      
00066          print *,'- Scalaire de nom : ',nom
00067          if (type.eq.MED_FLOAT64) then
00068             print *,'  de type flottant' 
00069          else
00070             print *,'  de type entier'
00071          endif
00072          print *,'  Description associee : ',desc
00073 C
00074 C     Pour chaque scalaire, on regarde les valeurs associees
00075 C     eventuellement a un pas de temps et/ou un numero d'ordre 
00076 C
00077          call efnspd(fid,nom,npdt,cret)
00078          if (cret .ne. 0 ) then
00079             print *,'Erreur lecture du nombre de pas de temps'
00080             call efexit(-1)
00081          endif      
00082          print *,cret
00083          print *,'  Nombre de valeurs : ',npdt
00084 C
00085          do 20 j=1,npdt
00086             call efspdi(fid,nom,j,numdt,dtunit,dt,numo,cret)
00087             print *,cret
00088             if (cret .ne. 0 ) then
00089                print *,'Erreur infos pas de temps'
00090                call efexit(-1)
00091             endif      
00092             print *,'   Valeur ', j
00093 C
00094             if (numdt.eq.MED_NOPDT) then
00095                print *,'     - Aucun pas de temps'
00096             else
00097                print *,'     - Pas de temps de numero ',numdt
00098                print *,'      de valeur : ',dt
00099                print *,'      unite : ',dtunit
00100             endif
00101 C
00102             if (numo.eq.MED_NONOR) then
00103                print *,'     - Aucun numero ordre'
00104             else
00105                print *,'     - Numero ordre : ',numo
00106             endif
00107 C
00108             if (type.eq.MED_FLOAT64) then
00109 C           ** Lecture de la valeur flottante associee 
00110 C           ** au pas de temps
00111                call efscfl(fid,nom,valr,numdt,numo,cret)
00112                print *,cret
00113                if (cret .ne. 0 ) then
00114                   print *,'Erreur lecture valeur'
00115                   call efexit(-1)
00116                endif      
00117                print *,'     - Valeur : ',valr
00118             else
00119 C           ** Lecture de la valeur entiere associee 
00120 C           ** au pas de temps
00121                call efscel(fid,nom,vali,numdt,numo,cret)
00122                print *,cret
00123                if (cret .ne. 0 ) then
00124                   print *,'Erreur lecture valeur'
00125                   call efexit(-1)
00126                endif      
00127                print *,'     - Valeur : ',vali
00128             endif
00129 C
00130  20      continue
00131 C
00132  10   continue
00133 C
00134 C     Fermeture du fichier      
00135 C
00136       call efferm(fid,cret)
00137       print *,cret
00138       if (cret .ne. 0 ) then
00139          print *,'Erreur fermeture du fichier'
00140          call efexit(-1)
00141       endif      
00142       print *,'Fermeture du fichier test21.med'
00143 C
00144       end

Généré le Thu Oct 8 14:26:17 2015 pour MED fichier par  doxygen 1.6.1