MED fichier: Fichier source de MEDsubdomainJointCr.c

MED fichier

- Documentation MED
- Guides d'utilisation
- Guides de référence

MEDsubdomainJointCr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2019 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
43 MEDsubdomainJointCr(const med_idt fid,
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;
53 char _path[MED_JOINT_GRP_SIZE+MED_NAME_SIZE+1]=MED_JOINT_GRP;
54
55 /*
56 * On inhibe le gestionnaire d'erreur
57 */
58 _MEDmodeErreurVerrouiller();
59 if (_MEDcheckVersion30(fid) < 0) goto ERROR;
60
61 if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
62 MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
63 goto ERROR;
64 }
65
66 if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
67 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
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) {
77 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_path);
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 */
121 if ((_ret = _MEDattributeStringWr(_jntid,MED_NOM_DES,MED_COMMENT_SIZE,
122 description)) < 0) {
123 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
124 SSCRUTE(jointname);SSCRUTE(MED_NOM_DES);SSCRUTE(description);
125 goto ERROR;
126 }
127
128 /*
129 * L'attribut "MAI"
130 */
131 if ((_ret = _MEDattributeStringWr(_jntid,MED_NOM_MAI,MED_NAME_SIZE,
132 remotemeshname)) < 0) {
133 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
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) {
142 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
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) {
157 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
158 ISCRUTE_id(_jntid);
159 }
160
161 if (_root>0) if (_MEDdatagroupFermer(_root) < 0) {
162 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_JOINT_GRP);
163 ISCRUTE_id(_jntid);
164 }
165
166 return _ret;
167 }
168
169
170
MED_ERR_ATTRIBUTE
#define MED_ERR_ATTRIBUTE
Definition: med_err.h:99
med_err
herr_t med_err
Definition: med.h:327
NOFINALBLANK
#define NOFINALBLANK(chaine, label)
Definition: med_utils.h:304
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:158
MED_ERR_FILE_MSG
#define MED_ERR_FILE_MSG
Definition: med_err.h:129
MED_ERR_INVALID
#define MED_ERR_INVALID
Definition: med_err.h:37
_MEDcheckVersion30
MEDC_EXPORT med_err _MEDcheckVersion30(med_idt fid)
MED_NOM_MAI
#define MED_NOM_MAI
Definition: med_outils.h:81
_MEDmodeAcces
MEDC_EXPORT med_access_mode _MEDmodeAcces(med_idt oid)
med_access_mode
med_access_mode
Definition: med.h:118
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_JOINT_GRP
#define MED_JOINT_GRP
Definition: med_outils.h:243
_MEDattributeStringWr
MEDC_EXPORT med_err _MEDattributeStringWr(med_idt pid, const char *const attname, const med_size attsize, const char *const val)
ISCRUTE_int
#define ISCRUTE_int(entier)
Definition: med_utils.h:307
MED_ERR_ACCESSMODE
#define MED_ERR_ACCESSMODE
Definition: med_err.h:103
MED_ERR_UNRECOGNIZED
#define MED_ERR_UNRECOGNIZED
Definition: med_err.h:36
MED_ERR_SUBDOMAINJOINT_MSG
#define MED_ERR_SUBDOMAINJOINT_MSG
Definition: med_err.h:167
MED_NOM_DOM
#define MED_NOM_DOM
Definition: med_outils.h:135
MED_ERR_WRITE
#define MED_ERR_WRITE
Definition: med_err.h:26
MED_NOM_DES
#define MED_NOM_DES
Definition: med_outils.h:56
med_int
int med_int
Definition: med.h:337
med_config.h
MED_ERR_CREATE
#define MED_ERR_CREATE
Definition: med_err.h:24
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:306
MED_ERR_CLOSE
#define MED_ERR_CLOSE
Definition: med_err.h:27
_MEDattributeIntWr
#define _MEDattributeIntWr(w, x, y)
Definition: med_hdfi.h:45
MED_ACC_UNDEF
Definition: med.h:122
MED_COMMENT_SIZE
#define MED_COMMENT_SIZE
Definition: med.h:77
_MEDdatagroupOuvrir
MEDC_EXPORT med_idt _MEDdatagroupOuvrir(med_idt pid, const char *const nom)
MED_ERR_DATAGROUP
#define MED_ERR_DATAGROUP
Definition: med_err.h:98
MED_JOINT_GRP_SIZE
#define MED_JOINT_GRP_SIZE
Definition: med_outils.h:244
med_idt
hid_t med_idt
Definition: med.h:326
_MEDdatagroupFermer
MEDC_EXPORT med_err _MEDdatagroupFermer(med_idt id)
med_outils.h
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:79
med.h
ISCRUTE_id
#define ISCRUTE_id(entier)
Definition: med_utils.h:311
_MEDdatagroupCreer
MEDC_EXPORT med_idt _MEDdatagroupCreer(med_idt pid, const char *const nom)
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:315
_MEDmodeErreurVerrouiller
MEDC_EXPORT void _MEDmodeErreurVerrouiller(void)
MED_ACC_RDONLY
Definition: med.h:118