_MEDsubdomainCorrespondenceSize30.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 _MEDsubdomainCorrespondenceSize30(int dummy, ...) {
00027 
00028   va_list params;
00029   va_start(params,dummy);
00030 
00031   const med_idt              fid             = va_arg(params,const med_idt          );
00032   const char * const         meshname        = va_arg(params,const char * const     );
00033   const char * const         jointname       = va_arg(params,const char * const     );
00034   const med_int              numdt           = va_arg(params,const med_int          );
00035   const med_int              numit           = va_arg(params,const med_int          );
00036   const med_entity_type      localentitype   = va_arg(params,const med_entity_type  );
00037   const med_geometry_type    localgeotype    = va_arg(params,const med_geometry_type);
00038   const med_entity_type      remoteentitype  = va_arg(params,const med_entity_type  );
00039   const med_geometry_type    remotegeotype   = va_arg(params,const med_geometry_type);
00040   med_int * const            nentitycor      = va_arg(params,med_int * const        );
00041   med_err *                  fret            = va_arg(params,med_err *);
00042 
00043   med_err  _ret=-1;
00044   med_idt  _eqid=0,_datagroup1=0,_dataset=0;
00045   char     _path[MED_TAILLE_JNT+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1+4*MED_TAILLE_NOM_ENTITE+4]=MED_JNT;
00046   char     _datagroupname1[2*MED_TAILLE_NOM_ENTITE+2]="";
00047   char     _cstpname[2*MED_MAX_PARA+1]="";
00048   med_size          _njointarray=0;
00049   med_sorting_type  _sortingtype=0;
00050   med_int           _intlocalentitype;
00051   med_int           _intlocalgeotype;
00052   char              _localgeotypename [MED_TAILLE_NOM_ENTITE+1]="";
00053   char              _remotegeotypename  [MED_TAILLE_NOM_ENTITE+1]="";
00054 
00055   /*
00056    * On inhibe le gestionnaire d'erreur
00057    */
00058 
00059   _MEDmodeErreurVerrouiller();
00060 
00061 
00062   if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
00063     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
00064     SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
00065   }
00066 
00067 
00068   strcat( _path, meshname);
00069   strcat( _path, "/");
00070   strcat( _path, jointname);
00071   strcat( _path, "/");
00072   _MEDgetComputationStepName(_sortingtype,numdt,numit,&_path[strlen(_path)]);
00073   strcat( _path, "/");
00074 
00075   /*
00076    *  Construction du nom de  datagroup <localentitype>[.<localgeotype>].<remoteentitype>[.<remotegeotype>]
00077    */
00078   if (_MEDgetEntityTypeName(&_path[strlen(_path)],localentitype) < 0) {
00079     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00080     ISCRUTE_int(localentitype);SSCRUTE(jointname);goto ERROR;
00081   }
00082   if ( localentitype != MED_NODE ) {
00083     if ( _MEDgetGeometryTypeName(_localgeotypename,localgeotype) < 0) {
00084       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00085       ISCRUTE_int(localgeotype);SSCRUTE(jointname);goto ERROR;
00086     }
00087       strcat(_path,".");
00088       strcat(_path,_localgeotypename);
00089   }
00090 
00091   strcat(_path,".");
00092 
00093   if (_MEDgetEntityTypeName(&_path[strlen(_path)],remoteentitype) < 0) {
00094     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00095     ISCRUTE_int(remoteentitype);SSCRUTE(jointname);goto ERROR;
00096   }
00097   if ( remoteentitype != MED_NODE ) {
00098     if ( _MEDgetGeometryTypeName(_remotegeotypename,remotegeotype) < 0) {
00099       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00100       ISCRUTE_int(remotegeotype);SSCRUTE(jointname);goto ERROR;
00101     }
00102       strcat(_path,".");
00103       strcat(_path,_remotegeotypename);
00104   }
00105 
00106 
00107   if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0 ) {
00108     *nentitycor=0;
00109     goto SORTIE;
00110   }
00111 
00112   if ((_dataset = _MEDdatasetOuvrir(_datagroup1,MED_NOM_COR)) < 0) {
00113     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
00114     SSCRUTE(_path);
00115     goto ERROR;
00116   }
00117 
00118   if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,nentitycor) < 0) {
00119     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00120     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nentitycor);
00121     goto ERROR;
00122   }
00123 
00124  SORTIE:
00125   _ret = 0;
00126  ERROR:
00127 
00128   if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
00129     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
00130     ISCRUTE_id(_dataset);
00131   }
00132 
00133   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
00134     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00135     ISCRUTE_id(_datagroup1);
00136   }
00137 
00138   va_end(params);
00139   *fret = _ret;
00140   return;
00141 }

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