_MEDequivalenceCorrespondenceSize30.c

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 
00020 #include <med.h>
00021 #include <med_config.h>
00022 #include <med_outils.h>
00023 #include <string.h>
00024 #include <stdlib.h>
00025 
00026 void
00027 _MEDequivalenceCorrespondenceSize30(int dummy, ...) {
00028 
00029   va_list params;
00030   va_start(params,dummy);
00031 
00032   const med_idt              fid       = va_arg(params,const med_idt               );
00033   const char * const         meshname  = va_arg(params,const char * const          );
00034   const char * const         equivname = va_arg(params,const char * const          );
00035   const med_int              numdt     = va_arg(params,const med_int               );
00036   const med_int              numit     = va_arg(params,const med_int               );
00037   const med_entity_type      entitype  = va_arg(params,const med_entity_type       );
00038   const med_geometry_type    geotype   = va_arg(params,const med_geometry_type     );
00039   med_int * const            nentity   = va_arg(params,med_int * const             );
00040   med_err *                  fret          = va_arg(params,        med_err*        );
00041 
00042   med_err  _ret=-1;
00043   med_idt  _eqid=0,_datagroup1=0,_dataset=0;
00044   char     _path[MED_TAILLE_EQS+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1+2*MED_TAILLE_NOM_ENTITE+2]=MED_EQS;
00045   char     _datagroupname1[2*MED_TAILLE_NOM_ENTITE+2]="";
00046   char     _cstpname[2*MED_MAX_PARA+1]="";
00047   med_size          _nequivarray=0;
00048   med_sorting_type  _sortingtype=0;
00049   med_int           _intentitype;
00050   med_int           _intgeotype;
00051   char              _geotypename [MED_TAILLE_NOM_ENTITE+1]="";
00052 
00053   /*
00054    * On inhibe le gestionnaire d'erreur
00055    */
00056 
00057   _MEDmodeErreurVerrouiller();
00058 
00059 
00060   if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
00061     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
00062     SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
00063   }
00064   
00065   strcat( _path, meshname);
00066   strcat( _path, "/");
00067   strcat( _path, equivname);
00068   strcat( _path, "/");
00069   _MEDgetComputationStepName(_sortingtype,numdt,numit,&_path[strlen(_path)]);
00070   strcat( _path, "/");
00071 
00072   /*
00073    *  Construction du nom de  datagroup <entitype>[.<geotype>]
00074    */
00075   if (_MEDgetEntityTypeName(&_path[strlen(_path)],entitype) < 0) {
00076     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00077     ISCRUTE_int(entitype);SSCRUTE(equivname);goto ERROR;
00078   }
00079   if ( entitype != MED_NODE ) {
00080     if ( _MEDgetGeometryTypeName(_geotypename,geotype) < 0) {
00081       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00082       ISCRUTE_int(geotype);SSCRUTE(equivname);goto ERROR;
00083     }
00084       strcat(_path,".");
00085       strcat(_path,_geotypename);
00086   }
00087 
00088   if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0 ) {
00089     *nentity=0;
00090     goto SORTIE;
00091   }
00092 
00093   if ((_dataset = _MEDdatasetOuvrir(_datagroup1,MED_NOM_COR)) < 0) {
00094     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
00095     SSCRUTE(_path);
00096     goto ERROR;
00097   }
00098 
00099   if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,nentity) < 0) {
00100     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
00101     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nentity);
00102     goto ERROR;
00103   }
00104 
00105  SORTIE:
00106   _ret = 0;
00107  ERROR:
00108 
00109   if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
00110     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
00111     ISCRUTE_id(_dataset);
00112   }
00113 
00114   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
00115     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00116     ISCRUTE_id(_datagroup1);
00117   }
00118 
00119 
00120   va_end(params);
00121   *fret = _ret;
00122   return;
00123 }

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