MED fichier
MEDsubdomainJointCr.c
Aller à la documentation de ce fichier.
1/* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2020 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
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 ) {
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) {
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
#define MED_NAME_SIZE
#define MED_COMMENT_SIZE
#define MED_ERR_(rt, r1, r2, r3)
#define SSCRUTE(chaine)
#define ISCRUTE(entier)
#define ISCRUTE_id(entier)
#define NOFINALBLANK(chaine, label)
#define ISCRUTE_int(entier)
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.
#define MED_ERR_ACCESSMODE
Definition med_err.h:104
#define MED_ERR_DATAGROUP
Definition med_err.h:99
#define MED_ERR_CLOSE
Definition med_err.h:30
#define MED_ERR_INVALID
Definition med_err.h:40
#define MED_ERR_ATTRIBUTE
Definition med_err.h:100
#define MED_ERR_CREATE
Definition med_err.h:27
#define MED_ERR_SUBDOMAINJOINT_MSG
Definition med_err.h:172
#define MED_ERR_FILE_MSG
Definition med_err.h:132
#define MED_ERR_WRITE
Definition med_err.h:29
#define MED_ERR_UNRECOGNIZED
Definition med_err.h:39
MEDC_EXPORT med_err _MEDattributeStringWr(med_idt pid, const char *const attname, const med_size attsize, const char *const val)
MEDC_EXPORT med_idt _MEDdatagroupCreer(med_idt pid, const char *const nom)
#define _MEDattributeIntWr(w, x, y)
Definition med_hdfi.h:45
MEDC_EXPORT void _MEDmodeErreurVerrouiller(void)
MEDC_EXPORT med_err _MEDdatagroupFermer(med_idt id)
MEDC_EXPORT med_idt _MEDdatagroupOuvrir(med_idt pid, const char *const nom)
MEDC_EXPORT med_err _MEDcheckVersion30(med_idt fid)
MEDC_EXPORT med_access_mode _MEDmodeAcces(med_idt oid)
#define MED_NOM_DES
Definition med_outils.h:54
#define MED_NOM_DOM
Definition med_outils.h:148
#define MED_JOINT_GRP_SIZE
Definition med_outils.h:253
#define MED_JOINT_GRP
Definition med_outils.h:252
#define MED_NOM_MAI
Definition med_outils.h:78