MED fichier
medjointcf.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2016 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 #include <string.h>
23 #include <stdlib.h>
24 
25 /*
26 From Fortran call of following C functions :
27 - MEDsubdomainJointCr
28 - MEDsubdomainCorrespondenceWr
29 - MEDnSubdomainJoint
30 - MEDsubdomainJointInfo
31 - MEDsubdomainCorrespondenceSizeInfo
32 - MEDsubdomainCorrespondenceSize
33 - MEDsubdomainCorrespondenceRd
34 - MEDsubdomainComputingStepInfo
35 
36 */
37 
38 #define nmsdfjcr F77_FUNC(msdfjcr,MSDFJCR)
39 #define nmsdfcrw F77_FUNC(msdfcrw,MSDFCRW)
40 #define nmsdfnjn F77_FUNC(msdfnjn,MSDFNJN)
41 #define nmsdfjni F77_FUNC(msdfjni,MSDFJNI)
42 #define nmsdfszi F77_FUNC(msdfszi,MSDFSZI)
43 #define nmsdfcsz F77_FUNC(msdfcsz,MSDFCSZ)
44 #define nmsdfcrr F77_FUNC(msdfcrr,MSDFCRR)
45 #define nmsdfcsi F77_FUNC(msdfcsi,MSDFCSI)
46 
47 
48 #ifdef PPRO_NT
49 med_int
50 MSDFJCR(med_int *fid,
51  char *lmname, unsigned int bidon1, med_int *lon1,
52  char *jname, unsigned int bidon2, med_int *lon2,
53  char *desc, unsigned int bidon3, med_int *lon3,
54  med_int *dom,
55  char *rmname, unsigned int bidon4, med_int *lon4
56  )
57 #else
58 med_int
60  char *lmname, med_int *lon1,
61  char *jname, med_int *lon2,
62  char *desc, med_int *lon3,
63  med_int *dom,
64  char *rmname,med_int *lon4)
65 #endif
66 {
67  med_int _ret;
68  char *_fn1, *_fn2, *_fn3, *_fn4;
69 
70  _fn1 = _MED2cstring(lmname, (int) * lon1);
71  _fn2 = _MED2cstring(jname, (int) * lon2);
72  _fn3 = _MED1cstring(desc, (int) * lon3,MED_COMMENT_SIZE);
73  _fn4 = _MED2cstring(rmname, (int) * lon4);
74 
75  if (!_fn1 || !_fn2 || !_fn3 || !_fn4)
76  return(-1);
77 
78  _ret = (med_int) MEDsubdomainJointCr((med_idt) *fid,
79  _fn1,
80  _fn2,
81  _fn3,
82  (med_int) *dom,
83  _fn4);
84 
85  _MEDcstringFree(_fn1);
86  _MEDcstringFree(_fn2);
87  _MEDcstringFree(_fn3);
88  _MEDcstringFree(_fn4);
89 
90  return(_ret);
91 }
92 
93 
94 #ifdef PPRO_NT
95 med_int
96 MSDFCRW(med_int *fid,
97  char *maa_local,unsigned int bidon1, med_int *lon1,
98  char *jn,unsigned int bidon2, med_int *lon2,
99  med_int *numdt, med_int *numit,
100  med_int * typ_ent_local, med_int * typ_geo_local,
101  med_int * typ_ent_distant, med_int * typ_geo_distant,
102  med_int *n, med_int *corrtab)
103 #else
104 med_int
106  char *maa_local,med_int *lon1,
107  char *jn,med_int *lon2,
108  med_int *numdt, med_int *numit,
109  med_int * typ_ent_local, med_int * typ_geo_local,
110  med_int * typ_ent_distant, med_int * typ_geo_distant,
111  med_int *n, med_int *corrtab)
112 #endif
113 {
114  med_int _ret;
115  char *_fn1, *_fn2;
116  med_entity_type _let = (med_entity_type) *typ_ent_local;
117  med_entity_type _rnt = (med_entity_type) *typ_ent_distant;
118  med_geometry_type _ltg = (med_geometry_type) *typ_geo_local;
119  med_geometry_type _rtg = (med_geometry_type) *typ_geo_distant;
120 
121  _fn1 = _MED2cstring(maa_local, (int) *lon1);
122  _fn2 = _MED2cstring(jn, (int) *lon2);
123 
124  if (!_fn1 || !_fn2)
125  return(-1);
126 
128  _fn1,
129  _fn2,
130  (med_int) *numdt,
131  (med_int) *numit,
132  _let,
133  _ltg,
134  _rnt,
135  _rtg,
136  (med_int) *n,
137  (med_int *) corrtab);
138 
139  _MEDcstringFree(_fn1);
140  _MEDcstringFree(_fn2);
141 
142 
143  return(_ret);
144 }
145 
146 
147 #ifdef PPRO_NT
148 med_int
149 MSDFNJN(med_int *fid,
150  char *maa, unsigned int bidon1, med_int *lon1)
151 #else
152 med_int
154  char *maa, med_int *lon1)
155 #endif
156 {
157  char *_fn1;
158  med_int _n;
159 
160  _fn1 = _MED2cstring(maa, (int) * lon1);
161 
162 
163  if (!_fn1)
164  return(-1);
165 
166  _n = (med_int) MEDnSubdomainJoint((med_idt) *fid,
167  _fn1);
168 
169  _MEDcstringFree(_fn1);
170 
171  return(_n);
172 }
173 
174 
175 
176 
177 
178 #ifdef PPRO_NT
179 med_int
180 MSDFJNI(med_int *fid,
181  char *maa, unsigned int bidon1, med_int *lon1,
182  med_int *ind, char *jname, unsigned int bidon2,
183  char *desc,unsigned int bidon3,
184  med_int *dom,char *rname,unsigned int bidon4,
185  med_int *nstep, med_int *ncor)
186 #else
187 med_int
189  char *maa, med_int *lon1,
190  med_int *ind, char *jname,
191  char *desc, med_int *dom,char *rname,
192  med_int *nstep, med_int *ncor)
193 #endif
194 {
195  med_int _ret;
196  char *_fn1;
197  char _fs1[MED_NAME_SIZE+1]; /* nom du joint OUT */
198  char _fs2[MED_COMMENT_SIZE+1]; /* nom de la description OUT */
199  char _fs3[MED_NAME_SIZE+1]; /* nom du maillage distant OUT */
200 
201 
202  /* nom maillage IN */
203  _fn1 = _MED2cstring(maa, (int) * lon1);
204  if (!_fn1)
205  return(-1);
206 
207  _ret = (med_int) MEDsubdomainJointInfo((med_idt) *fid,
208  _fn1, /* maillage local IN */
209  (med_int) *ind, /* indice du joint dans le maillage IN */
210  _fs1, /* nom joint OUT */
211  _fs2, /* desc joint OUT */
212  (med_int * ) dom, /* numero ss domaine distant OUT */
213  _fs3, /* nom maillage distant OUT */
214  (med_int *) nstep,
215  (med_int *) ncor);
216 
217  _MEDc2fString(_fs1,jname,MED_NAME_SIZE);
218  _MEDc2fString(_fs2,desc,MED_COMMENT_SIZE);
219  _MEDc2fString(_fs3,rname,MED_NAME_SIZE);
220 
221  _MEDcstringFree(_fn1);
222 
223  return(_ret);
224 }
225 
226 
227 
228 
229 #ifdef PPRO_NT
230 med_int
231 MSDFSZI(med_int *fid,
232  char *maa, unsigned int bidon1, med_int *lon1,
233  char *jname, unsigned int bidon2, med_int *lon2,
234  med_int *numdt, med_int *numit, med_int *it,
235  med_int * typ_ent_local, med_int * typ_geo_local,
236  med_int * typ_ent_distant, med_int * typ_geo_distant,
237  med_int *ncor)
238 #else
239 med_int
241  char *maa, med_int *lon1,
242  char *jname, med_int *lon2,
243  med_int *numdt, med_int *numit, med_int *it,
244  med_int *typ_ent_local, med_int *typ_geo_local,
245  med_int *typ_ent_distant, med_int *typ_geo_distant,
246  med_int *ncor)
247 #endif
248 {
249  med_int _ret;
250  char *_fn1, *_fn2;
251  med_entity_type _let, _rnt;
252  med_geometry_type _ltg,_rtg;
253 
254  _fn1 = _MED2cstring((char *) maa, (int) * lon1);
255  if (!_fn1)
256  return(-1);
257 
258  _fn2 = _MED2cstring((char *) jname, (int) * lon2);
259  if (!_fn2)
260  return(-1);
261 
263  _fn1,
264  _fn2,
265  (med_int) *numdt,
266  (med_int) *numit,
267  (med_int) *it,
268  &_let,
269  &_ltg,
270  &_rnt,
271  &_rtg,
272  (med_int *) ncor);
273 
274 
275  *typ_ent_local = (med_int) _let;
276  *typ_geo_local = (med_int) _ltg;
277  *typ_ent_distant = (med_int) _rnt;
278  *typ_geo_distant = (med_int) _rtg;
279 
280  _MEDcstringFree(_fn1);
281  _MEDcstringFree(_fn2);
282 
283  return(_ret);
284 }
285 
286 
287 
288 #ifdef PPRO_NT
289 med_int
290 MSDFCSZ(med_int *fid,
291  char *maa, unsigned int bidon1, med_int *lon1,
292  char *jname, unsigned int bidon2, med_int *lon2,
293  med_int *numdt, med_int *numit,
294  med_int * typ_ent_local, med_int * typ_geo_local,
295  med_int * typ_ent_distant, med_int * typ_geo_distant,
296  med_int *ncor)
297 #else
298 med_int
300  char *maa, med_int *lon1,
301  char *jname, med_int *lon2,
302  med_int *numdt, med_int *numit,
303  med_int *typ_ent_local, med_int *typ_geo_local,
304  med_int *typ_ent_distant, med_int *typ_geo_distant,
305  med_int *ncor)
306 #endif
307 {
308  med_int _ret;
309  char *_fn1, *_fn2;
310  med_entity_type _let = (med_entity_type) *typ_ent_local;
311  med_entity_type _rnt = (med_entity_type) *typ_ent_distant;
312  med_geometry_type _ltg = (med_geometry_type) *typ_geo_local;
313  med_geometry_type _rtg = (med_geometry_type) *typ_geo_distant;
314 
315  _fn1 = _MED2cstring((char *) maa, (int) * lon1);
316  if (!_fn1)
317  return(-1);
318 
319  _fn2 = _MED2cstring((char *) jname, (int) * lon2);
320  if (!_fn2)
321  return(-1);
322 
324  _fn1,
325  _fn2,
326  (med_int) *numdt,
327  (med_int) *numit,
328  _let,
329  _ltg,
330  _rnt,
331  _rtg,
332  (med_int *) ncor);
333 
334  _MEDcstringFree(_fn1);
335  _MEDcstringFree(_fn2);
336 
337  return(_ret);
338 }
339 
340 
341 
342 #ifdef PPRO_NT
343 med_int
344 MSDFCRR(med_int *fid,
345  char *maa_local,unsigned int bidon1, med_int *lon1,
346  char *jn,unsigned int bidon2, med_int *lon2,
347  med_int *numdt, med_int *numit,
348  med_int * typ_ent_local, med_int * typ_geo_local,
349  med_int * typ_ent_distant, med_int * typ_geo_distant,
350  med_int *corrtab)
351 #else
352 med_int
354  char *maa_local,med_int *lon1,
355  char *jn,med_int *lon2,
356  med_int *numdt, med_int *numit,
357  med_int * typ_ent_local, med_int * typ_geo_local,
358  med_int * typ_ent_distant, med_int * typ_geo_distant,
359  med_int *corrtab)
360 #endif
361 {
362  med_int _ret;
363  char *_fn1, *_fn2;
364  med_entity_type _let = (med_entity_type) *typ_ent_local;
365  med_entity_type _rnt = (med_entity_type) *typ_ent_distant;
366  med_geometry_type _ltg = (med_geometry_type) *typ_geo_local;
367  med_geometry_type _rtg = (med_geometry_type) *typ_geo_distant;
368 
369  _fn1 = _MED2cstring(maa_local, (int) *lon1);
370  _fn2 = _MED2cstring(jn, (int) *lon2);
371 
372  if (!_fn1 || !_fn2)
373  return(-1);
374 
376  _fn1,
377  _fn2,
378  (med_int) *numdt,
379  (med_int) *numit,
380  _let,
381  _ltg,
382  _rnt,
383  _rtg,
384  (med_int *) corrtab);
385 
386  _MEDcstringFree(_fn1);
387  _MEDcstringFree(_fn2);
388 
389  return(_ret);
390 }
391 
392 
393 
394 #ifdef PPRO_NT
395 med_int
396 MSDFCSI(med_int *fid,
397  char *maa, unsigned int bidon1, med_int *lon1,
398  char *jname, unsigned int bidon2, med_int *lon2,
399  med_int *ind, med_int *numdt, med_int *numit,
400  med_int *ncor)
401 #else
402 med_int
404  char *maa, med_int *lon1,
405  char *jname, med_int *lon2,
406  med_int *ind, med_int *numdt, med_int *numit,
407  med_int *ncor)
408 #endif
409 {
410  med_int _ret;
411  char *_fn1, *_fn2;
412 
413  _fn1 = _MED2cstring(maa, (int) * lon1);
414  if (!_fn1)
415  return(-1);
416 
417  _fn2 = _MED2cstring(jname, (int) * lon2);
418  if (!_fn2)
419  return(-1);
420 
422  _fn1,
423  _fn2,
424  (med_int) *ind,
425  (med_int*) numdt,
426  (med_int*) numit,
427  (med_int *) ncor);
428 
429 
430  _MEDcstringFree(_fn1);
431  _MEDcstringFree(_fn2);
432 
433  return(_ret);
434 }
MEDC_EXPORT med_err MEDsubdomainJointInfo(const med_idt fid, const char *const meshname, const int jointit, char *const jointname, char *const description, med_int *const domainnumber, char *const remotemeshname, med_int *const nstep, med_int *const nocstpncorrespondence)
Cette routine permet de lire les informations sur un joint dans un maillage.
#define nmsdfjni
Definition: medjointcf.c:41
MEDC_EXPORT med_err _MEDcstringFree(char *chaine)
#define nmsdfcrr
Definition: medjointcf.c:44
#define nmsdfcsi
Definition: medjointcf.c:45
#define nmsdfszi
Definition: medjointcf.c:42
MEDC_EXPORT med_err MEDsubdomainCorrespondenceSize(const med_idt fid, const char *const meshname, const char *const jointname, const med_int numdt, const med_int numit, const med_entity_type localentitytype, const med_geometry_type localgeotype, const med_entity_type remoteentitytype, const med_geometry_type remotegeotype, med_int *const nentity)
Cette routine permet la lecture du nombre d'entités en correspondance dans un joint pour un couple d'...
#define nmsdfcrw
Definition: medjointcf.c:39
med_entity_type
Definition: med.h:136
int med_int
Definition: med.h:316
MEDC_EXPORT char * _MED1cstring(char *chaine, int longueur_reelle, int longueur_fixee)
Definition: MED1cstring.c:37
MEDC_EXPORT 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 nmsdfnjn
Definition: medjointcf.c:40
#define MED_COMMENT_SIZE
Definition: med.h:72
#define nmsdfcsz
Definition: medjointcf.c:43
MEDC_EXPORT med_err _MEDc2fString(const char *const chainec, char *const chainef, med_int longueur_buffer77)
hid_t med_idt
Definition: med.h:309
MEDC_EXPORT med_err MEDsubdomainComputingStepInfo(const med_idt fid, const char *const meshname, const char *const jointname, const int csit, med_int *const numdt, med_int *const numit, med_int *const ncorrespondence)
Cette routine permet de lire les informations sur les correspondances entre types d'entités dans un m...
#define nmsdfjcr
Definition: medjointcf.c:38
#define MED_NAME_SIZE
Definition: med.h:74
MEDC_EXPORT med_err MEDsubdomainCorrespondenceSizeInfo(const med_idt fid, const char *const meshname, const char *const jointname, const med_int numdt, const med_int numit, const int corit, med_entity_type *const localentitytype, med_geometry_type *const localgeotype, med_entity_type *const remoteentitytype, med_geometry_type *const remotegeotype, med_int *const nentity)
Cette routine permet de lire les informations sur les couples d'entités en correspondance dans un joi...
MEDC_EXPORT med_err MEDsubdomainCorrespondenceWr(const med_idt fid, const char *const meshname, const char *const jointname, const med_int numdt, const med_int numit, const med_entity_type localentitytype, const med_geometry_type localgeotype, const med_entity_type remoteentitytype, const med_geometry_type remotegeotype, const med_int nentity, const med_int *const correspondence)
Cette routine permet l'écriture d'une correspondance dans un joint pour un type de couple d'entité en...
MEDC_EXPORT char * _MED2cstring(char *chaine, int longueur)
Definition: MED2cstring.c:35
int med_geometry_type
Definition: med.h:179
MEDC_EXPORT med_err MEDsubdomainCorrespondenceRd(const med_idt fid, const char *const meshname, const char *const jointname, const med_int numdt, const med_int numit, const med_entity_type localentitytype, const med_geometry_type localgeotype, const med_entity_type remoteentitytype, const med_geometry_type remotegeotype, med_int *const correspondence)
Cette routine permet la lecture d'une correspondance dans un joint pour un type de couple d'entité en...
MEDC_EXPORT med_int MEDnSubdomainJoint(const med_idt fid, const char *const meshname)
Cette routine permet la lecture du nombre de joint dans un maillage.