#define MESGERR 1
#include <string.h>
int main (
int argc,
char **argv) {
const char meshname[
MED_NAME_SIZE+1] =
"3D Unstructured Mesh With 2 polyhedrons";
int i;
int k,ind1,ind2;
int j, jind1,jind2;
if (fid < 0) {
MESSAGE(
"ERROR : open file in READ ONLY ACCESS mode ...");
return -1;
}
if (
MEDmeshInfoByName(fid, meshname, &spacedim, &meshdim, &meshtype, meshdescription,
dtunit, &sortingtype, &nstep, &axistype, axisname, unitname) < 0) {
return -1;
}
{
MESSAGE(
"ERROR : number of nodes ...");
return -1;
}
&coordinatechangement, &geotransformation)) < 0)
{
MESSAGE(
"ERROR : read number of polyhedrons ...");
return -1;
}
npoly = faceindexsize-1;
&coordinatechangement, &geotransformation)) < 0)
{
MESSAGE(
"ERROR : read number of polyhedrons ...");
return -1;
}
&coordinatechangement, &geotransformation)) < 0)
{
MESSAGE(
"ERROR : read connectivity size ...");
return -1;
}
MESSAGE(
"ERROR : memory allocation ...");
return -1;
}
coordinates) < 0) {
MESSAGE(
"ERROR : nodes coordinates ...");
return -1;
}
for (i=0;i<nnodes*spacedim;i++)
printf("%f - ",*(coordinates+i));
printf("\n");
faceindex,nodeindex,connectivity) < 0)
{
MESSAGE(
"ERROR : read polyhedron connectivity ...");
return -1;
}
for (i=0;i<npoly;i++)
{
printf(">> MED_POLYHEDRON %d : \n",i+1);
printf("---- Face Index ----- : [\n");
ind1 = *(faceindex+i)-1;
ind2 = *(faceindex+i+1)-1;
for (k=ind1;k<ind2;k++)
printf(" ] \n");
printf("---- Connectivity ----- : [\n");
for (k=ind1;k<ind2;k++)
{
jind1 = *(nodeindex+k)-1;
jind2 = *(nodeindex+k+1)-1;
for (j=jind1;j<jind2;j++)
printf(
IFORMAT" ",*(connectivity+j));
printf(" \n");
}
printf(" ] \n");
}
return -1;
}
if (coordinates)
free(coordinates);
if (faceindex)
free(faceindex);
if (nodeindex)
free(nodeindex);
if (connectivity)
free(connectivity);
return 0;
}