# MEDmeshElementRd.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
    00047 med_err MEDmeshElementRd(const med_idt                  fid,
    00048                       const char            * const  meshname,
    00049                       const med_int                  numdt,
    00050                       const med_int                  numit,
    00051                       const med_entity_type          entitype,
    00052                       const med_geometry_type        geotype,
    00053                       const med_connectivity_mode    cmode,
    00054                       const med_switch_mode          switchmode,
    00055                       med_int               * const  connectivity,
    00056                       med_bool              * const  withelementname,
    00057                       char                  * const  elementname,
    00058                       med_bool              * const  withelementnumber,
    00059                       med_int               * const  elementnumber,
    00060                       med_bool              * const  withfamnumber,
    00061                       med_int               * const  famnumber) {
    00062
    00063   med_err           _ret       = -1;
    00064   med_bool          _chgt=MED_FALSE, _trsf=MED_FALSE;
    00065
    00066   *withelementname   =MED_FALSE;
    00067   *withelementnumber =MED_FALSE;
    00068   *withfamnumber     =MED_FALSE;
    00069
    00070   if ( (_ret = MEDmeshElementConnectivityRd(fid,
    00071                                             meshname,
    00072                                             numdt,
    00073                                             numit,
    00074                                             entitype,
    00075                                             geotype,
    00076                                             cmode,
    00077                                             switchmode,
    00078                                             connectivity) ) < 0 ) {
    00079     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshElementConnectivityRd");
    00080     goto ERROR;
    00081   }
    00082
    00083
    00084   if ( MEDmeshnEntity(fid, meshname, numdt, numit,
    00085                       entitype,geotype,MED_NAME, cmode,
    00086                       &_chgt, &_trsf) > 0) {
    00087     *withelementname=MED_TRUE;
    00088   }
    00089
    00090   if ( *withelementname )
    00091     if ( (_ret =  MEDmeshEntityNameRd(fid,
    00092                                       meshname,
    00093                                       numdt,
    00094                                       numit,
    00095                                       entitype,
    00096                                       geotype,
    00097                                       elementname) ) < 0 ) {
    00098       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityNameRd");
    00099       goto ERROR;
    00100     }
    00101
    00102   if ( MEDmeshnEntity(fid, meshname, numdt, numit,
    00103                       entitype,geotype,MED_NUMBER, cmode,
    00104                       &_chgt, &_trsf) > 0) {
    00105     *withelementnumber=MED_TRUE;
    00106   }
    00107
    00108
    00109   if ( *withelementnumber )
    00110     if ( (_ret =  MEDmeshEntityNumberRd(fid,
    00111                                         meshname,
    00112                                         numdt,
    00113                                         numit,
    00114                                         entitype,
    00115                                         geotype,
    00116                                         elementnumber) ) < 0 ) {
    00117       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityNumberRd");
    00118       goto ERROR;
    00119     }
    00120
    00121   if ( MEDmeshnEntity(fid, meshname, numdt, numit,
    00122                       entitype,geotype,MED_FAMILY_NUMBER, cmode,
    00123                       &_chgt, &_trsf) > 0) {
    00124     *withfamnumber=MED_TRUE;
    00125   }
    00126
    00127   if (*withfamnumber)
    00128     if ( (_ret =  MEDmeshEntityFamilyNumberRd(fid,
    00129                                               meshname,
    00130                                               numdt,
    00131                                               numit,
    00132                                               entitype,
    00133                                               geotype,
    00134                                               famnumber) ) < 0 ) {
    00135       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityFamilyNumberRd");
    00136       goto ERROR;
    00137     }
    00138
    00139   _ret = 0;
    00140  ERROR:
    00141   return _ret;
    00142 }