# MEDmeshNodeRd.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  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
    00043 med_err MEDmeshNodeRd(const med_idt                  fid,
    00044                       const char            * const  meshname,
    00045                       const med_int                  numdt,
    00046                       const med_int                  numit,
    00047                       const med_switch_mode          switchmode,
    00048                       med_float             * const  coordinate,
    00049                       med_bool              * const  withnodename,
    00050                       char                  * const  nodename,
    00051                       med_bool              * const  withnodenumber,
    00052                       med_int               * const  nodenumber,
    00053                       med_bool              * const  withfamnumber,
    00054                       med_int               * const  famnumber) {
    00055
    00056   med_err           _ret       = -1;
    00057   med_entity_type   _entitype  = MED_NODE;
    00058   med_geometry_type _geotype   = MED_NONE;
    00059   med_bool          _chgt=MED_FALSE, _trsf=MED_FALSE;
    00060
    00061   *withnodename    = MED_FALSE;
    00062   *withnodenumber  = MED_FALSE;
    00063   *withfamnumber   = MED_FALSE;
    00064
    00065   if ( (_ret = MEDmeshNodeCoordinateRd(fid,
    00066                                        meshname,
    00067                                        numdt,
    00068                                        numit,
    00069                                        switchmode,
    00070                                        coordinate) ) < 0 ) {
    00071     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshNodeCoordinateRd");
    00072     goto ERROR;
    00073   }
    00074
    00075
    00076   if ( MEDmeshnEntity(fid, meshname, numdt, numit,
    00077                       _entitype,_geotype,MED_NAME, MED_NO_CMODE,
    00078                       &_chgt, &_trsf) > 0) {
    00079     *withnodename=MED_TRUE;
    00080   }
    00081
    00082
    00083   if ( *withnodename )
    00084     if ( (_ret =  MEDmeshEntityNameRd(fid,
    00085                                       meshname,
    00086                                       numdt,
    00087                                       numit,
    00088                                       _entitype,
    00089                                       _geotype,
    00090                                       nodename) ) < 0 ) {
    00091       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityNameRd");
    00092       goto ERROR;
    00093     }
    00094
    00095   if ( MEDmeshnEntity(fid, meshname, numdt, numit,
    00096                       _entitype,_geotype,MED_NUMBER, MED_NO_CMODE,
    00097                       &_chgt, &_trsf) > 0) {
    00098     *withnodenumber=MED_TRUE;
    00099   }
    00100
    00101
    00102   if ( *withnodenumber )
    00103     if ( (_ret =  MEDmeshEntityNumberRd(fid,
    00104                                         meshname,
    00105                                         numdt,
    00106                                         numit,
    00107                                         _entitype,
    00108                                         _geotype,
    00109                                         nodenumber) ) < 0 ) {
    00110       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityNumberRd");
    00111       goto ERROR;
    00112     }
    00113
    00114   if ( MEDmeshnEntity(fid, meshname, numdt, numit,
    00115                       _entitype,_geotype,MED_FAMILY_NUMBER, MED_NO_CMODE,
    00116                       &_chgt, &_trsf) > 0) {
    00117     *withfamnumber=MED_TRUE;
    00118   }
    00119
    00120
    00121   if (*withfamnumber)
    00122     if ( (_ret =  MEDmeshEntityFamilyNumberRd(fid,
    00123                                               meshname,
    00124                                               numdt,
    00125                                               numit,
    00126                                               _entitype,
    00127                                               _geotype,
    00128                                               famnumber) ) < 0 ) {
    00129       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityFamilyNumberRd");
    00130       goto ERROR;
    00131     }
    00132
    00133   _ret = 0;
    00134  ERROR:
    00135   return _ret;
    00136 }