#include <med.h>
#define MESGERR 1
#include <med_utils.h>
#include <string.h>
int main (
int argc,
char **argv) {
const med_float ballmeshnodescoo[3] = {0.0, 0.0, 0.0 };
const med_float beammeshnodescoo[3*7] = {0.0,0.0,0.0,
0.0,0.0,2.0,
0.0,0.0,4.0,
0.0,0.0,5.0,
0.0,0.0,7.0,
0.0,0.0,10.0,
0.0,0.0,11.0 };
const med_float beamsectioncoo[9*3] = {-0.2,-0.2,0.0,
0.0,-0.2,0.0,
0.2,-0.2,0.0,
-0.2, 0.0,0.0,
0.0, 0.0,0.0,
0.2, 0.0,0.0,
-0.2, 0.2,0.0,
0.0, 0.2,0.0,
0.2, 0.2,0.0 };
const med_int seg2connectivity[2*6] = {1,2, 2,3, 3,4, 4,5, 5,6, 6,7};
const med_float attvalue[6] = {0.2,0.3,0.4,0.4,0.3,0.2};
const char attprovalue[2*
MED_NAME_SIZE+1] = {
"EXTREMITY_1_____________________________________________________" \
"EXTREMITY_2_____________________________________________________" };
const char profilename[
MED_NAME_SIZE+1] =
"EXTREMITY_PROFILE_NAME";
const med_float meshcoo[3*12] = { 0.0, 0.0, 0.0,
1.1, 1.1, 1.1,
2.2, 2.2, 2.2,
10., 10., 10.,
12., 12., 12.,
60., 20., 20.,
70., 20., 20.,
80., 20., 20.,
90., 20., 20.,
100., 20., 20.,
110., 20., 20.,
120., 20., 20.
};
const med_int beamconnectivity[12] = { 6,7,
7,8,
8,9,
9,10,
10,11,
11,12 };
const med_int labels[3] = { 1, 2, 3 };
const med_int ballconnectivity[2] = { 4, 5 };
const med_float balldiameter[2] = { 2.0, 5.8 };
const med_int beamsectionconnectivity[4*4] = { 4,5,2,1,
5,6,3,2,
7,8,5,4,
8,9,6,5};
int ret=-1;
if (fid < 0) {
goto ERROR;
}
spacedim = 3;
meshdim = 3;
if (
MEDsupportMeshCr(fid, ballsupportname, spacedim, meshdim,
"Support mesh for a ball model",
MESSAGE(
"ERROR : creating a support mesh ...");
goto ERROR;
}
nnode = 1;
MESSAGE(
"ERROR : write nodes coordinates ...");
goto ERROR;
}
if (
MEDsupportMeshCr(fid, beamsupportname, spacedim, meshdim,
"Support mesh for a beam model",
MESSAGE(
"ERROR : creating a support mesh ...");
goto ERROR;
}
nnode = 7;
MESSAGE(
"ERROR : write nodes coordinates ...");
goto ERROR;
}
nseg2 = 6;
MESSAGE(
"ERROR : write cells connectivity ...");
goto ERROR;
}
if (
MEDsupportMeshCr(fid, beamsectionname, spacedim, meshdim,
"Support mesh for a section of the beam model",
MESSAGE(
"ERROR : creating a support mesh ...");
goto ERROR;
}
nnode = 9;
MESSAGE(
"ERROR : write nodes coordinates ...");
goto ERROR;
}
MESSAGE(
"ERROR : write cells connectivity ...");
goto ERROR;
}
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
ncomp=1;
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
ncomp=1;
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
ncomp=1;
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
if (
MEDprofileWr(fid, profilename, profilesize, profile ) < 0) {
MESSAGE(
"ERROR : create profile ...");
goto ERROR;
}
elementname,
"BEAM_EXTREMITIES_LABELS",
ncomp,
profilename,
(void*) attprovalue) < 0) {
MESSAGE(
"ERROR : creating struct element");
goto ERROR;
}
MESSAGE(
"ERROR : creating computation mesh ...");
goto ERROR;
}
nnode = 12;
MESSAGE(
"ERROR : writing nodes coordinates ...");
goto ERROR;
}
nentity = 1;
MESSAGE(
"ERROR : beam connectivity ...");
goto ERROR;
}
nentity = 3;
nentity, 0) < 0) {
MESSAGE(
"ERROR : writing particles connectivity ...");
goto ERROR;
}
nentity, labels) < 0 ) {
MESSAGE(
"ERROR : writing variable attributes ...");
goto ERROR;
}
nentity = 2;
MESSAGE(
"ERROR : writing balls connectivity");
goto ERROR;
}
nentity, balldiameter) < 0 ) {
MESSAGE(
"ERROR : writing variable attributes ...");
goto ERROR;
}
ret=0;
ERROR:
ret=-1;
}
return ret;
}
int main(int argc, char **argv)
#define MED_BALL_DIAMETER
#define MED_PARTICLE_LABEL
#define MED_PARTICLE_NAME
#define MED_BEAM_THICKNESS
#define ISCRUTE_int(entier)
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
MEDC_EXPORT med_err MEDmeshElementConnectivityWr(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_float dt, const med_entity_type entitype, const med_geometry_type geotype, const med_connectivity_mode cmode, const med_switch_mode switchmode, const med_int nentity, const med_int *const connectivity)
Cette routine permet d'écrire dans un maillage le tableau des connectivités pour un type géométrique ...
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.
MEDC_EXPORT med_err MEDmeshNodeCoordinateWr(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_float dt, const med_switch_mode switchmode, const med_int nentity, const med_float *const coordinates)
Cette routine permet d'écrire dans un maillage le tableau des coordonnées des noeuds,...
MEDC_EXPORT med_err MEDprofileWr(const med_idt fid, const char *const profilename, const med_int profilesize, const med_int *const profilearray)
Cette routine permet d'écrire un profil dans un fichier MED.
MEDC_EXPORT med_geometry_type MEDstructElementCr(const med_idt fid, const char *const modelname, const med_int modeldim, const char *const supportmeshname, const med_entity_type sentitytype, const med_geometry_type sgeotype)
Cette routine permet de créer un nouveau modèle d'éléments de structure dans un fichier MED.
MEDC_EXPORT med_err MEDstructElementConstAttWithProfileWr(const med_idt fid, const char *const modelname, const char *const constattname, const med_attribute_type constatttype, const med_int ncomponent, const med_entity_type sentitytype, const char *const profilename, const void *const value)
Cette routine définit un attribut caractéristique constant d'un modèle d'éléments de structure.
MEDC_EXPORT med_err MEDstructElementConstAttWr(const med_idt fid, const char *const modelname, const char *const constattname, const med_attribute_type constatttype, const med_int ncomponent, const med_entity_type sentitytype, const void *const value)
Cette routine définit un attribut caractéristique constant d'un modèle d'éléments de structure.
MEDC_EXPORT med_err MEDstructElementVarAttCr(const med_idt fid, const char *const modelname, const char *const varattname, const med_attribute_type varatttype, const med_int ncomponent)
Cette routine déclare la présence d'un attribut caractéristique variable attaché aux éléments de type...
MEDC_EXPORT med_err MEDmeshStructElementVarAttWr(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_geometry_type mgeotype, const char *const varattname, const med_int nentity, const void *const value)
Cette routine écrit les valeurs d'un attribut caractéristique variable sur les éléments de structure ...
MEDC_EXPORT med_geometry_type MEDstructElementGeotype(const med_idt fid, const char *const modelname)
Cette routine renvoie le type géométrique mgeotype associé au modèle d'éléments de structure de nom m...
MEDC_EXPORT med_err MEDsupportMeshCr(const med_idt fid, const char *const supportmeshname, const med_int spacedim, const med_int meshdim, const char *const description, const med_axis_type axistype, const char *const axisname, const char *const axisunit)
Cette routine permet de créer un maillage support.