test29.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
* MED is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MED is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MED. If not, see <http://www.gnu.org/licenses/>.
*/
/******************************************************************************
* - Nom du fichier : test29.c
*
* - Description : ecriture d'un joint dans un maillage MED
*
*****************************************************************************/
#include <med.h>
#define MESGERR 1
#include <med_utils.h>
#ifdef DEF_LECT_ECR
#define MODE_ACCES MED_ACC_RDWR
#elif DEF_LECT_AJOUT
#define MODE_ACCES MED_ACC_RDEXT
#else
#define MODE_ACCES MED_ACC_CREAT
#endif
int main (int argc, char **argv)
{
med_idt fid;
char maa[MED_NAME_SIZE+1]= "maa1";
char jnt[MED_NAME_SIZE+1] = "joint";
char des_jnt[MED_COMMENT_SIZE+1] = "joint avec le sous-domaine 2";
char maa_distant[MED_NAME_SIZE+1]= "maa1";
med_int dom_dist = 2;
med_int mdim = 3;
med_int ncor = 3;
med_int cor[6] = {1,2,3,4,5,6};
med_int cor2[6] = {10,20,30,40,50,60};
char nomcoo[3*MED_SNAME_SIZE+1] = "x y z ";
char unicoo[3*MED_SNAME_SIZE+1] = "cm cm cm ";
/* Creation du fichier "test29.med" */
if ((fid = MEDfileOpen("test29.med",MODE_ACCES)) < 0) {
MESSAGE("Erreur a la creation du fichier test29.med");
return -1;
}
if (MEDmeshCr( fid, maa, mdim, mdim, MED_UNSTRUCTURED_MESH,
"un maillage pour test29","s", MED_SORT_DTIT,
MED_CARTESIAN, nomcoo, unicoo) < 0) {
MESSAGE("Erreur a la creation du maillage : "); SSCRUTE(maa);
return -1;
}
/* Creation du joint */
if (MEDsubdomainJointCr(fid,maa,jnt,des_jnt,dom_dist,maa_distant) < 0) {
MESSAGE("Erreur a la creation du joint");
return -1;
}
/* Ecriture de la correspondance Noeud, Noeud */
if (MEDsubdomainCorrespondenceWr(fid,maa,jnt,MED_NO_DT,MED_NO_IT,
MED_NODE,MED_NONE,MED_NODE,MED_NONE,ncor,cor) < 0) {
MESSAGE("Erreur a l'ecriture du tableau des correspondances (noeud,noeud)");
return -1;
}
/* Ecriture de la correspondance Noeud Maille */
if (MEDsubdomainCorrespondenceWr(fid,maa,jnt,MED_NO_DT,MED_NO_IT,
MED_NODE,MED_NONE,MED_CELL,MED_TRIA3,ncor,cor2) < 0) {
MESSAGE("Erreur a l'ecriture du tableau des correspondances (noeud,maille TRIA3)");
return -1;
}
/* Fermeture du fichier */
if (MEDfileClose(fid) < 0) {
MESSAGE("Erreur a la fermeture du fichier");
return -1;
}
return 0;
}
MODE_ACCES
#define MODE_ACCES
Definition 3.0.8/test10.c:35
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition MEDfileClose.c:30
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition MEDfileOpen.c:42
MEDmeshCr
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
MEDsubdomainCorrespondenceWr
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...
Definition MEDsubdomainCorrespondenceWr.c:47
MEDsubdomainJointCr
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.
Definition MEDsubdomainJointCr.c:43
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition med.h:81
MED_SNAME_SIZE
#define MED_SNAME_SIZE
Definition med.h:82
MED_TRIA3
#define MED_TRIA3
Definition med.h:203
MED_CARTESIAN
@ MED_CARTESIAN
Definition med.h:258
MED_SORT_DTIT
@ MED_SORT_DTIT
Definition med.h:300
MED_UNSTRUCTURED_MESH
@ MED_UNSTRUCTURED_MESH
Definition med.h:131
med_int
int med_int
Definition med.h:333
MED_NO_DT
#define MED_NO_DT
Definition med.h:311
MED_NO_IT
#define MED_NO_IT
Definition med.h:312
MED_NONE
#define MED_NONE
Definition med.h:231
MED_NODE
@ MED_NODE
Definition med.h:143
MED_CELL
@ MED_CELL
Definition med.h:143
MED_COMMENT_SIZE
#define MED_COMMENT_SIZE
Definition med.h:79
med_idt
hid_t med_idt
Definition med.h:322
med.h
SSCRUTE
#define SSCRUTE(chaine)
Definition med_utils.h:323
MESSAGE
#define MESSAGE(chaine)
Definition med_utils.h:324
med_utils.h
main
int main(int argc, char **argv)
Definition test29.c:37