MEDsubdomainJointCr.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  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 
00042 med_err
00043 MEDsubdomainJointCr(const med_idt      fid,
00044                     const char * const localmeshname,
00045                     const char * const jointname,
00046                     const char * const description,
00047                     const med_int      domainnumber,
00048                     const char * const remotemeshname)
00049 {
00050   med_access_mode _MED_ACCESS_MODE;
00051   med_idt        _root=0,_jntid=0,_meshid=0;
00052   med_err        _ret=-1;
00053   char           _path[MED_TAILLE_JNT+MED_NAME_SIZE+1]=MED_JNT;
00054 
00055   /*
00056    * On inhibe le gestionnaire d'erreur
00057    */
00058   _MEDmodeErreurVerrouiller();
00059  if (_MEDcheckVersion30(fid) < 0) goto ERROR;
00060 
00061   if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
00062     MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00063     goto ERROR;
00064   }
00065 
00066   if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
00067     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00068     ISCRUTE_int(_MED_ACCESS_MODE);
00069     goto ERROR;
00070   }
00071 
00072   /*
00073    * Si le DataGroup /JNT/ n'existe pas, on le cree
00074    */
00075   if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0)
00076     if ((_root = _MEDdatagroupCreer(fid,_path)) < 0) {
00077       MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_path);
00078      goto ERROR;
00079     }
00080 
00081   NOFINALBLANK(localmeshname,ERROR);
00082 
00083   /*
00084    * Si le DataGroup /JNT/<localmeshname> n'existe pas, on le cree
00085    */
00086   if ((_meshid = _MEDdatagroupOuvrir(_root,localmeshname)) < 0)
00087     if ((_meshid = _MEDdatagroupCreer(_root,localmeshname)) < 0) {
00088       MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,localmeshname);
00089       SSCRUTE(_path);goto ERROR;
00090     }
00091 
00092   strcat(_path,localmeshname);
00093   NOFINALBLANK(jointname,ERROR);
00094 
00095   /*
00096    * Si le Data Group "/JNT/<localmeshname>/<jointname>" n'existe pas, on le cree
00097    */
00098   if ((_jntid = _MEDdatagroupOuvrir(_meshid,jointname)) < 0)
00099     if ((_jntid = _MEDdatagroupCreer(_meshid,jointname)) < 0 ) {
00100       MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,jointname);
00101       SSCRUTE(_path);goto ERROR;
00102     }
00103 
00104  /*  if ( (_jntid = _MEDmeshAssociatedGroupCr(fid, */
00105 /*                                        MED_JNT_NOM, */
00106 /*                                        localmeshname, */
00107 /*                                        numdt, */
00108 /*                                        numit, */
00109 /*                                        -1, */
00110 /*                                        MED_FALSE, */
00111 /*                                        subdomainJointname ) ) < 0)  { */
00112 /*     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDmeshAssociatedGroupCr"); */
00113 /*     SSCRUTE(MED_JNT_NOM);SSCRUTE(localmeshname);ISCRUTE(numit);ISCRUTE(numdt); */
00114 /*     SSCRUTE(subdomainJointname); */
00115 /*     goto ERROR; */
00116 /*   } */
00117 
00118   /*
00119    * L'attribut "DES"
00120    */
00121   if ((_ret = _MEDattributeStringWr(_jntid,MED_NOM_DES,MED_COMMENT_SIZE,
00122                                    description)) < 0) {
00123     MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00124     SSCRUTE(jointname);SSCRUTE(MED_NOM_DES);SSCRUTE(description);
00125     goto ERROR;
00126   }
00127 
00128   /*
00129    * L'attribut "MAI"
00130    */
00131   if ((_ret = _MEDattributeStringWr(_jntid,MED_NOM_MAI,MED_NAME_SIZE,
00132                                    remotemeshname)) < 0) {
00133     MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00134     SSCRUTE(jointname);SSCRUTE(MED_NOM_MAI);SSCRUTE(remotemeshname);
00135     goto ERROR;
00136   }
00137 
00138   /*
00139    * L'attribut "DOM"
00140    */
00141   if ((_ret = _MEDattributeIntWr(_jntid, MED_NOM_DOM, &domainnumber)) < 0) {
00142     MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00143     SSCRUTE(jointname);SSCRUTE(MED_NOM_DOM);ISCRUTE(domainnumber);
00144     goto ERROR;
00145   }
00146 
00147 
00148   _ret=0;
00149  ERROR:
00150 
00151   if (_jntid>0)            if (_MEDdatagroupFermer(_jntid) < 0) {
00152     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,jointname);
00153     ISCRUTE_id(_jntid);SSCRUTE(_path);
00154   }
00155 
00156   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
00157     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00158     ISCRUTE_id(_jntid);
00159   }
00160 
00161   if (_root>0)            if (_MEDdatagroupFermer(_root) < 0) {
00162     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_JNT);
00163     ISCRUTE_id(_jntid);
00164   }
00165 
00166   return _ret;
00167 }
00168 
00169 
00170 

Généré le Thu Oct 8 14:26:16 2015 pour MED fichier par  doxygen 1.6.1