#define MESGERR 1
#include <string.h>
int main (
int argc,
char **argv) {
int i;
char *groupname=NULL;
int ret=-1;
if (fid < 0) {
MESSAGE(
"ERROR : open file in READ ONLY ACCESS mode ...");
goto ERROR;
}
if (
MEDmeshInfoByName(fid, meshname, &spacedim, &meshdim, &meshtype, meshdescription,
dtunit, &sortingtype, &nstep, &axistype, axisname, unitname) < 0) {
goto ERROR;
}
&geotransformation)) < 0) {
MESSAGE(
"ERROR : number of nodes ...");
goto ERROR;
}
&geotransformation)) < 0) {
MESSAGE(
"ERROR : number of MED_TRIA3 ...");
goto ERROR;
}
&geotransformation)) < 0) {
MESSAGE(
"ERROR : number of MED_QUAD4 ...");
goto ERROR;
}
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
coordinates) < 0) {
MESSAGE(
"ERROR : nodes coordinates ...");
free(coordinates);
goto ERROR;
}
free(coordinates);
if ((triaconnectivity = (
med_int *) malloc(
sizeof(
med_int)*ntria3*3)) == NULL) {
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
MESSAGE(
"ERROR : MED_TRIA3 connectivity ...");
free(triaconnectivity);
goto ERROR;
}
free(triaconnectivity);
if ((quadconnectivity = (
med_int *) malloc(
sizeof(
med_int)*nquad4*4)) == NULL) {
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
MESSAGE(
"ERROR : MED_TRIA3 connectivity ...");
free(quadconnectivity);
goto ERROR;
}
free(quadconnectivity);
MESSAGE(
"ERROR : read number of family ...");
goto ERROR;
}
for (i=0; i<nfamily ; i++) {
MESSAGE(
"ERROR : read number of group in a family ...");
goto ERROR;
}
if (ngroup > 0) {
if ((groupname = (
char*) malloc(
sizeof(
char)*
MED_LNAME_SIZE*ngroup+1)) == NULL) {
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
if (
MEDfamilyInfo(fid, meshname, i+1, familyname, &familynumber, groupname) < 0) {
MESSAGE(
"ERROR : family info ...");
free(groupname);
goto ERROR;
}
free(groupname);
}
}
if ((familynumbers = (
med_int *) malloc(
sizeof(
med_int)*nnodes)) == NULL) {
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
for (i=0; i<nnodes; i++) *(familynumbers+i) = 0;
for (i=0; i<nnodes; i++) printf("%d - ", *(familynumbers+i));
if (familynumbers)
free (familynumbers);
if ((familynumbers = (
med_int *) malloc(
sizeof(
med_int)*ntria3)) == NULL) {
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
for (i=0; i<ntria3; i++) *(familynumbers+i) = 0;
free (familynumbers);
if ((familynumbers = (
med_int *) malloc(
sizeof(
med_int)*nquad4)) == NULL) {
MESSAGE(
"ERROR : memory allocation ...");
goto ERROR;
}
for (i=0; i<nquad4; i++) *(familynumbers+i) = 0;
free (familynumbers);
ret=0;
ERROR:
ret= -1;
}
return ret;
}