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