_MEDsubdomainCorrespondenceRd30.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 
00023 #include <string.h>
00024 #include <stdlib.h>
00025 
00026 void _MEDsubdomainCorrespondenceRd30(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       localmeshname  = 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          correspondence = va_arg(params,med_int * const         );
00041   med_err *                fret           = va_arg(params,med_err *);
00042 
00043 
00044   med_idt            _root=0,_eqid=0,_meshid=0,_cstpid=0,_datagroup2=0;
00045   med_idt            _dataset=0;
00046   med_err            _ret=-1;
00047   char               _path[MED_TAILLE_JNT+2*MED_NAME_SIZE+2]=MED_JNT;
00048   char               _computationstepname[2*MED_MAX_PARA+1]="";
00049   char               _datagroupname2[4*MED_TAILLE_NOM_ENTITE+4]="";
00050   char               _localgeotypename   [MED_TAILLE_NOM_ENTITE+1]="";
00051   char               _remotegeotypename   [MED_TAILLE_NOM_ENTITE+1]="";
00052   med_sorting_type   _sortingtype=0;
00053   med_filter         _filter        = MED_FILTER_INIT;
00054   med_geometry_type  _localgeotype=MED_NONE;
00055   med_geometry_type  _remotegeotype =MED_NONE;
00056   med_int            _nentity=0;
00057 
00058   if ( localentitype == MED_NODE_ELEMENT ) _localgeotype=MED_NODE ;
00059 
00060   if ( localentitype  != MED_NODE ) _localgeotype=localgeotype ;
00061   if ( remoteentitype != MED_NODE ) _remotegeotype=remotegeotype ;
00062 
00063   /*
00064    * On inhibe le gestionnaire d'erreur
00065    */
00066   _MEDmodeErreurVerrouiller();
00067 
00068  
00069   /*
00070    * Ouverture du dataGroup /JNT/
00071    */
00072   if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00073     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00074     goto ERROR;
00075   }
00076 
00077   /*
00078    * Ouverture du dataGroup <localmeshname>
00079    */
00080   if ((_meshid = _MEDdatagroupOuvrir(_root,localmeshname)) < 0) {
00081     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,localmeshname);
00082     SSCRUTE(_path);goto ERROR;
00083   }
00084 
00085   strcat(_path,localmeshname);
00086 
00087   /*
00088    * Si le Data Group "/JNT/<localmeshname>/<jointname>" n'existe pas, on le cree
00089    */
00090   if ((_eqid = _MEDdatagroupOuvrir(_meshid,jointname)) < 0) {
00091       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,jointname);
00092       SSCRUTE(_path);goto ERROR;
00093   }
00094 
00095   strcat(_path,"/");
00096   strcat(_path,jointname);
00097 
00098   if ( MEDmeshSortingTypeRd(fid,localmeshname,&_sortingtype) < 0 ) {
00099     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
00100     SSCRUTE(localmeshname);ISCRUTE_int(_sortingtype);goto ERROR;
00101   }
00102 
00103   _MEDgetComputationStepName(_sortingtype,numdt,numit,_computationstepname);
00104 
00105   if ((_cstpid = _MEDdatagroupOuvrir(_eqid,_computationstepname)) < 0) {
00106     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_computationstepname);
00107     SSCRUTE(_path);goto ERROR;
00108   }
00109 
00110 
00111   /*
00112    *  Ouverture du datagroup de niveau <localentitype>[.<localgeotype>].<remoteentitype>[.<remotegeotype>]
00113    */
00114   if (_MEDgetEntityTypeName(_datagroupname2,localentitype) < 0) {
00115     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00116     ISCRUTE_int(localentitype);SSCRUTE(jointname);goto ERROR;
00117   }
00118   if ( localentitype != MED_NODE ) {
00119     if ( _MEDgetGeometryTypeName(_localgeotypename,localgeotype) < 0) {
00120       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00121       ISCRUTE_int(localgeotype);SSCRUTE(jointname);goto ERROR;
00122     }
00123       strcat(_datagroupname2,".");
00124       strcat(_datagroupname2,_localgeotypename);
00125   }
00126 
00127   strcat(_datagroupname2,".");
00128 
00129   if (_MEDgetEntityTypeName(&_datagroupname2[strlen(_datagroupname2)],remoteentitype) < 0) {
00130     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00131     ISCRUTE_int(remoteentitype);SSCRUTE(jointname);goto ERROR;
00132   }
00133   if ( remoteentitype != MED_NODE ) {
00134     if ( _MEDgetGeometryTypeName(_remotegeotypename,remotegeotype) < 0) {
00135       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00136       ISCRUTE_int(remotegeotype);SSCRUTE(jointname);goto ERROR;
00137     }
00138       strcat(_datagroupname2,".");
00139       strcat(_datagroupname2,_remotegeotypename);
00140   }
00141 
00142 /*   SSCRUTE(_datagroupname2); */
00143   if ( (_datagroup2 = _MEDdatagroupOuvrir(_cstpid,_datagroupname2)) < 0) {
00144     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_datagroupname2);
00145     SSCRUTE(_path);SSCRUTE(jointname);goto ERROR;
00146   }
00147 
00148 
00149   if ((_dataset = _MEDdatasetOuvrir(_datagroup2,MED_NOM_COR)) < 0) {
00150     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
00151     SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
00152     goto ERROR;
00153   }
00154 
00155   if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,&_nentity) < 0) {
00156     MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00157     SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
00158     SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);goto ERROR;
00159   }
00160 
00161   if ( MEDfilterEntityCr(fid, _nentity, 1, 2, MED_ALL_CONSTITUENT,
00162                          MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00163                          MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00164     MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00165     goto ERROR;
00166   }
00167 
00168   if ( _MEDdatasetRd(_datagroup2,MED_NOM_COR,MED_INTERNAL_INT,&_filter, (unsigned char *) correspondence) < 0) {
00169     MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_COR);
00170     SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00171     goto ERROR;
00172   }
00173 
00174   if ( MEDfilterClose(&_filter) < 0 ) {
00175     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_SUBDOMAINJOINT_MSG);
00176     SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00177     goto ERROR;
00178   }
00179 
00180   _ret=0;
00181  ERROR:
00182 
00183   if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
00184     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
00185     ISCRUTE_id(_dataset);
00186   }
00187 
00188   if (_datagroup2>0)            if (_MEDdatagroupFermer(_datagroup2) < 0) {
00189     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00190     ISCRUTE_id(_datagroup2);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00191   }
00192 
00193   if (_cstpid>0)            if (_MEDdatagroupFermer(_cstpid) < 0) {
00194     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_computationstepname);
00195     ISCRUTE_id(_cstpid);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00196   }
00197 
00198   if (_eqid>0)            if (_MEDdatagroupFermer(_eqid) < 0) {
00199     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,jointname);
00200     ISCRUTE_id(_eqid);SSCRUTE(_path);
00201   }
00202 
00203   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
00204     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,localmeshname);
00205     ISCRUTE_id(_eqid);
00206   }
00207 
00208   if (_root>0)            if (_MEDdatagroupFermer(_root) < 0) {
00209     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_JNT);
00210     ISCRUTE_id(_eqid);
00211   }
00212 
00213   va_end(params);
00214   *fret = _ret;
00215   return;
00216 }

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