#define MESGERR 1
#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;
}