# MEDmeshPolygonWr.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
    00044 med_err
    00045 MEDmeshPolygonWr(const med_idt               fid,
    00046                  const char*  const          meshname,
    00047                  const med_int               numdt,
    00048                  const med_int               numit,
    00049                  const med_float             dt,
    00050                  const med_entity_type       entitype,
    00051                  const med_connectivity_mode cmode,
    00052                  const med_int               indexsize,
    00053                  const med_int * const       polyindex,
    00054                  const med_int * const       connectivity )
    00055 {
    00056   med_access_mode _MED_ACCESS_MODE;
    00057   med_idt         _meshid=0;
    00058   med_err         _ret         = -1;
    00059   med_data_type   _datatype    = MED_UNDEF_DATATYPE;
    00060
    00061   /*
    00062    * On inhibe le gestionnaire d'erreur HDF 5
    00063    */
    00064   _MEDmodeErreurVerrouiller();
    00065  if (_MEDcheckVersion30(fid) < 0) goto ERROR;
    00066
    00067   if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
    00068     MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
    00069     goto ERROR;
    00070   }
    00071
    00072   if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
    00073     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
    00074     ISCRUTE_int(_MED_ACCESS_MODE);
    00075     goto ERROR;
    00076   }
    00077
    00078
    00079   /* Tester le type d'entité ?
    00080    * MAILLE Ok
    00081    * FACE   OK
    00082    * ARETE  ?
    00083    * NOEUD  KO
    00084    * NOEUD_MAILLE  ?
    00085    */
    00086
    00087 /*   ISCRUTE(indexsize); */
    00088
    00089 /*   ISCRUTE(polyindex[indexsize-1] - polyindex[0]); */
    00090
    00091   if (_MEDmeshAdvancedWr(fid,
    00092                          meshname,
    00093                          MED_CONNECTIVITY,
    00094                          MED_NO_NAME,
    00095                          MED_INTERNAL_UNDEF,
    00096                          numdt,
    00097                          numit,
    00098                          dt,
    00099                          entitype,
    00100                          MED_POLYGON,
    00101                          cmode,
    00102                          MED_UNDEF_PFLMODE,
    00103                          MED_NO_PROFILE,
    00104                          MED_FULL_INTERLACE,
    00105                          MED_ALL_CONSTITUENT,
    00106                          NULL,
    00107                          polyindex[indexsize-1] - polyindex[0],
    00108                          connectivity) < 0 ) {
    00109     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDmeshAdvancedWr (MED_CONNECTIVITY) ");
    00110     goto ERROR;
    00111   }
    00112
    00113   if (_MEDmeshAdvancedWr(fid,
    00114                          meshname,
    00115                          MED_INDEX_NODE,
    00116                          MED_NO_NAME,
    00117                          MED_INTERNAL_UNDEF,
    00118                          numdt,
    00119                          numit,
    00120                          dt,
    00121                          entitype,
    00122                          MED_POLYGON,
    00123                          cmode,
    00124                          MED_UNDEF_PFLMODE,
    00125                          MED_NO_PROFILE,
    00126                          MED_FULL_INTERLACE,
    00127                          MED_ALL_CONSTITUENT,
    00128                          NULL,
    00129                          indexsize,
    00130                          polyindex) < 0 ) {
    00131     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDmeshAdvancedWr (MED_INDEX_NODES) ");
    00132     goto ERROR;
    00133   }
    00134
    00135   _ret = 0;
    00136
    00137  ERROR:
    00138
    00139   return _ret;
    00140
    00141 }