MED fichier
test29.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 * - Nom du fichier : test29.c
20 *
21 * - Description : ecriture d'un joint dans un maillage MED
22 *
23 *****************************************************************************/
24
25#include <med.h>
26#define MESGERR 1
27#include <med_utils.h>
28
29#ifdef DEF_LECT_ECR
30#define MODE_ACCES MED_ACC_RDWR
31#elif DEF_LECT_AJOUT
32#define MODE_ACCES MED_ACC_RDEXT
33#else
34#define MODE_ACCES MED_ACC_CREAT
35#endif
36
37int main (int argc, char **argv)
38
39
40{
41 med_idt fid;
42
43 char maa[MED_NAME_SIZE+1]= "maa1";
44 char jnt[MED_NAME_SIZE+1] = "joint";
45 char des_jnt[MED_COMMENT_SIZE+1] = "joint avec le sous-domaine 2";
46 char maa_distant[MED_NAME_SIZE+1]= "maa1";
47 med_int dom_dist = 2;
48
49 med_int mdim = 3;
50 med_int ncor = 3;
51 med_int cor[6] = {1,2,3,4,5,6};
52 med_int cor2[6] = {10,20,30,40,50,60};
53 char nomcoo[3*MED_SNAME_SIZE+1] = "x y z ";
54 char unicoo[3*MED_SNAME_SIZE+1] = "cm cm cm ";
55
56
57 /* Creation du fichier "test29.med" */
58 if ((fid = MEDfileOpen("test29.med",MODE_ACCES)) < 0) {
59 MESSAGE("Erreur a la creation du fichier test29.med");
60 return -1;
61 }
62
63 if (MEDmeshCr( fid, maa, mdim, mdim, MED_UNSTRUCTURED_MESH,
64 "un maillage pour test29","s", MED_SORT_DTIT,
65 MED_CARTESIAN, nomcoo, unicoo) < 0) {
66 MESSAGE("Erreur a la creation du maillage : "); SSCRUTE(maa);
67 return -1;
68 }
69
70 /* Creation du joint */
71 if (MEDsubdomainJointCr(fid,maa,jnt,des_jnt,dom_dist,maa_distant) < 0) {
72 MESSAGE("Erreur a la creation du joint");
73 return -1;
74 }
75
76 /* Ecriture de la correspondance Noeud, Noeud */
78 MED_NODE,MED_NONE,MED_NODE,MED_NONE,ncor,cor) < 0) {
79 MESSAGE("Erreur a l'ecriture du tableau des correspondances (noeud,noeud)");
80 return -1;
81 }
82
83 /* Ecriture de la correspondance Noeud Maille */
85 MED_NODE,MED_NONE,MED_CELL,MED_TRIA3,ncor,cor2) < 0) {
86 MESSAGE("Erreur a l'ecriture du tableau des correspondances (noeud,maille TRIA3)");
87 return -1;
88 }
89
90 /* Fermeture du fichier */
91 if (MEDfileClose(fid) < 0) {
92 MESSAGE("Erreur a la fermeture du fichier");
93 return -1;
94 }
95
96 return 0;
97}
98
99
100
101
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
MEDC_EXPORT med_err MEDmeshCr(const med_idt fid, const char *const meshname, const med_int spacedim, const med_int meshdim, const med_mesh_type meshtype, const char *const description, const char *const dtunit, const med_sorting_type sortingtype, const med_axis_type axistype, const char *const axisname, const char *const axisunit)
Cette routine permet de créer un maillage dans un fichier.
Definition: MEDmeshCr.c:45
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 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_NAME_SIZE
Definition: med.h:81
#define MED_SNAME_SIZE
Definition: med.h:82
#define MED_TRIA3
Definition: med.h:203
@ MED_CARTESIAN
Definition: med.h:258
@ MED_SORT_DTIT
Definition: med.h:300
@ MED_UNSTRUCTURED_MESH
Definition: med.h:131
int med_int
Definition: med.h:333
#define MED_NO_DT
Definition: med.h:311
#define MED_NO_IT
Definition: med.h:312
#define MED_NONE
Definition: med.h:231
@ MED_NODE
Definition: med.h:143
@ MED_CELL
Definition: med.h:143
#define MED_COMMENT_SIZE
Definition: med.h:79
hid_t med_idt
Definition: med.h:322
#define SSCRUTE(chaine)
Definition: med_utils.h:323
#define MESSAGE(chaine)
Definition: med_utils.h:324
#define MODE_ACCES
Definition: test29.c:34
int main(int argc, char **argv)
Definition: test29.c:37