MED fichier
MEDsubdomainJointCr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2023 EDF R&D, CEA/DEN
4  * MED is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * MED is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with MED. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #include <med.h>
20 #include <med_config.h>
21 #include <med_outils.h>
22 
23 #include <string.h>
24 #include <stdlib.h>
25 
26 
42 med_err
44  const char * const localmeshname,
45  const char * const jointname,
46  const char * const description,
47  const med_int domainnumber,
48  const char * const remotemeshname)
49 {
50  med_access_mode _MED_ACCESS_MODE;
51  med_idt _root=0,_jntid=0,_meshid=0;
52  med_err _ret=-1;
54 
55  /*
56  * On inhibe le gestionnaire d'erreur
57  */
59  if (_MEDcheckVersion30(fid) < 0) goto ERROR;
60 
61  if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
63  goto ERROR;
64  }
65 
66  if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
68  ISCRUTE_int(_MED_ACCESS_MODE);
69  goto ERROR;
70  }
71 
72  /*
73  * Si le DataGroup /JNT/ n'existe pas, on le cree
74  */
75  if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0)
76  if ((_root = _MEDdatagroupCreer(fid,_path)) < 0) {
78  goto ERROR;
79  }
80 
81  NOFINALBLANK(localmeshname,ERROR);
82 
83  /*
84  * Si le DataGroup /JNT/<localmeshname> n'existe pas, on le cree
85  */
86  if ((_meshid = _MEDdatagroupOuvrir(_root,localmeshname)) < 0)
87  if ((_meshid = _MEDdatagroupCreer(_root,localmeshname)) < 0) {
88  MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,localmeshname);
89  SSCRUTE(_path);goto ERROR;
90  }
91 
92  strcat(_path,localmeshname);
93  NOFINALBLANK(jointname,ERROR);
94 
95  /*
96  * Si le Data Group "/JNT/<localmeshname>/<jointname>" n'existe pas, on le cree
97  */
98  if ((_jntid = _MEDdatagroupOuvrir(_meshid,jointname)) < 0)
99  if ((_jntid = _MEDdatagroupCreer(_meshid,jointname)) < 0 ) {
100  MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,jointname);
101  SSCRUTE(_path);goto ERROR;
102  }
103 
104  /* if ( (_jntid = _MEDmeshAssociatedGroupCr(fid, */
105 /* MED_JOINT_NAME, */
106 /* localmeshname, */
107 /* numdt, */
108 /* numit, */
109 /* -1, */
110 /* MED_FALSE, */
111 /* subdomainJointname ) ) < 0) { */
112 /* MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDmeshAssociatedGroupCr"); */
113 /* SSCRUTE(MED_JOINT_NAME);SSCRUTE(localmeshname);ISCRUTE(numit);ISCRUTE(numdt); */
114 /* SSCRUTE(subdomainJointname); */
115 /* goto ERROR; */
116 /* } */
117 
118  /*
119  * L'attribut "DES"
120  */
122  description)) < 0) {
124  SSCRUTE(jointname);SSCRUTE(MED_NOM_DES);SSCRUTE(description);
125  goto ERROR;
126  }
127 
128  /*
129  * L'attribut "MAI"
130  */
132  remotemeshname)) < 0) {
134  SSCRUTE(jointname);SSCRUTE(MED_NOM_MAI);SSCRUTE(remotemeshname);
135  goto ERROR;
136  }
137 
138  /*
139  * L'attribut "DOM"
140  */
141  if ((_ret = _MEDattributeIntWr(_jntid, MED_NOM_DOM, &domainnumber)) < 0) {
143  SSCRUTE(jointname);SSCRUTE(MED_NOM_DOM);ISCRUTE(domainnumber);
144  goto ERROR;
145  }
146 
147 
148  _ret=0;
149  ERROR:
150 
151  if (_jntid>0) if (_MEDdatagroupFermer(_jntid) < 0) {
152  MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,jointname);
153  ISCRUTE_id(_jntid);SSCRUTE(_path);
154  }
155 
156  if (_meshid>0) if (_MEDdatagroupFermer(_meshid) < 0) {
158  ISCRUTE_id(_jntid);
159  }
160 
161  if (_root>0) if (_MEDdatagroupFermer(_root) < 0) {
163  ISCRUTE_id(_jntid);
164  }
165 
166  return _ret;
167 }
168 
169 
170 
MED_ACC_RDONLY
Definition: med.h:122
MED_COMMENT_SIZE
#define MED_COMMENT_SIZE
Definition: med.h:81
MED_ERR_CREATE
#define MED_ERR_CREATE
Definition: med_err.h:27
ISCRUTE_id
#define ISCRUTE_id(entier)
Definition: med_utils.h:319
_MEDattributeIntWr
#define _MEDattributeIntWr(w, x, y)
Definition: med_hdfi.h:45
ISCRUTE_int
#define ISCRUTE_int(entier)
Definition: med_utils.h:314
_MEDmodeAcces
MEDC_EXPORT med_access_mode _MEDmodeAcces(med_idt oid)
med_idt
hid_t med_idt
Definition: med.h:333
MED_NOM_DOM
#define MED_NOM_DOM
Definition: med_outils.h:148
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:160
MED_ERR_SUBDOMAINJOINT_MSG
#define MED_ERR_SUBDOMAINJOINT_MSG
Definition: med_err.h:172
MED_ERR_ATTRIBUTE
#define MED_ERR_ATTRIBUTE
Definition: med_err.h:100
MED_ERR_INVALID
#define MED_ERR_INVALID
Definition: med_err.h:40
med_err
herr_t med_err
Definition: med.h:334
med_outils.h
MED_ERR_CLOSE
#define MED_ERR_CLOSE
Definition: med_err.h:30
MEDsubdomainJointCr
med_err MEDsubdomainJointCr(const med_idt fid, const char *const localmeshname, const char *const jointname, const char *const description, const med_int domainnumber, const char *const remotemeshname)
Cette routine permet de créer un joint dans un maillage.
Definition: MEDsubdomainJointCr.c:43
med_int
int med_int
Definition: med.h:344
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
MED_ERR_WRITE
#define MED_ERR_WRITE
Definition: med_err.h:29
med_config.h
MED_JOINT_GRP
#define MED_JOINT_GRP
Definition: med_outils.h:252
MED_ACC_UNDEF
Definition: med.h:126
med_access_mode
med_access_mode
Definition: med.h:122
MED_NOM_MAI
#define MED_NOM_MAI
Definition: med_outils.h:78
_MEDattributeStringWr
MEDC_EXPORT med_err _MEDattributeStringWr(med_idt pid, const char *const attname, const med_size attsize, const char *const val)
MED_ERR_DATAGROUP
#define MED_ERR_DATAGROUP
Definition: med_err.h:99
_MEDdatagroupCreer
MEDC_EXPORT med_idt _MEDdatagroupCreer(med_idt pid, const char *const nom)
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:323
MED_ERR_ACCESSMODE
#define MED_ERR_ACCESSMODE
Definition: med_err.h:104
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:83
_MEDcheckVersion30
MEDC_EXPORT med_err _MEDcheckVersion30(med_idt fid)
MED_NOM_DES
#define MED_NOM_DES
Definition: med_outils.h:54
med.h
NOFINALBLANK
#define NOFINALBLANK(chaine, label)
Definition: med_utils.h:311
MED_ERR_UNRECOGNIZED
#define MED_ERR_UNRECOGNIZED
Definition: med_err.h:39
_MEDdatagroupOuvrir
MEDC_EXPORT med_idt _MEDdatagroupOuvrir(med_idt pid, const char *const nom)
_MEDmodeErreurVerrouiller
MEDC_EXPORT void _MEDmodeErreurVerrouiller(void)
MED_JOINT_GRP_SIZE
#define MED_JOINT_GRP_SIZE
Definition: med_outils.h:253
MED_ERR_FILE_MSG
#define MED_ERR_FILE_MSG
Definition: med_err.h:132
_MEDdatagroupFermer
MEDC_EXPORT med_err _MEDdatagroupFermer(med_idt id)