Test_MEDinterpInfo.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  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 #include <med.h>
00019 #define MESGERR 1
00020 #include <med_utils.h>
00021 #include <string.h>
00022 
00023 #ifdef DEF_LECT_ECR
00024 #define MODE_ACCES MED_ACC_RDWR
00025 #elif DEF_LECT_AJOUT
00026 #define MODE_ACCES MED_ACC_RDEXT
00027 #else
00028 #define MODE_ACCES MED_ACC_CREAT
00029 #endif
00030 
00031 int main (int argc, char **argv)
00032 
00033 {
00034   med_err           _ret=-1;
00035   med_idt           _fid=0;
00036 
00037   med_int           _ninterp=0;
00038   int               _interpit                   =0;
00039   char              _interpname[MED_NAME_SIZE+1]="";
00040   med_geometry_type _geotype                    =MED_NONE;
00041   med_bool          _cellnodes                  =MED_FALSE;
00042   med_int           _nbasisfunc              =0;
00043   med_int           _nvariable               =0;
00044   med_int           _maxdegree                  =0;
00045   med_int           _nmaxcoefficient            =0;
00046 
00047 
00048  /* Ouverture en mode creation du fichier "current.med" */
00049   _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
00050   if (_fid < 0) {
00051     MESSAGE("Erreur a la creation du fichier current.med");
00052     return -1;
00053   }
00054 
00055   if ( (_ninterp = MEDnInterp(_fid)) <0) _ret=_ninterp;
00056 
00057   ISCRUTE(_ninterp);
00058 
00059   for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
00060 
00061     if ( (_ret = MEDinterpInfo(_fid,
00062                                _interpit,
00063                                _interpname,
00064                                &_geotype,
00065                                &_cellnodes,
00066                                &_nbasisfunc,
00067                                &_nvariable,
00068                                &_maxdegree,
00069                                &_nmaxcoefficient
00070                                ) <0) ) {
00071       MESSAGE("Erreur à la création de la fonction d'interpolation n°");ISCRUTE(_interpit);
00072       goto ERROR;
00073     }
00074 
00075     fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique n° %d\n",
00076             _interpit,_interpname, _geotype);
00077 
00078     if ( _cellnodes )
00079       if ( _nbasisfunc == (_geotype % 100) )
00080         fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
00081       else {
00082         MESSAGE("Erreur : le nombre de noeuds de construction "\
00083                 "est différent du nombre de noeuds de la maille de référence.\n");
00084         ISCRUTE(_nbasisfunc); ISCRUTE(_geotype % 100);
00085       }
00086 
00087     if ( _nvariable != (_geotype / 100) ) {
00088         MESSAGE("Erreur : le nombre de variables  "\
00089                 "est différent de la dimension de l'espace de la maille de référence.\n");
00090         ISCRUTE(_nvariable); ISCRUTE (_geotype / 100);
00091     } else
00092       fprintf(stdout,"\t Il y a  %d fonctions de base avec %d variables\n ",_nbasisfunc,_nvariable);
00093     fprintf(stdout,"\t Le degré maximum des fonctions de base est %d et possèdent au maximum %d coefficients\n"
00094             ,_maxdegree,_nmaxcoefficient);
00095 
00096   }
00097 
00098   if (MEDfileClose(_fid) < 0) {
00099     MESSAGE("ERROR : file closing");
00100     return -1;
00101   }
00102 
00103   _ret=0;
00104  ERROR:
00105 
00106   return _ret;
00107 
00108 }
00109 

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