- break;
- }
- case MED_QUAD4 : {
- if (inuele) {
- for (j=0;j<nmailles[i];j++) {
- elem_id=*(numele+j);
- ok = mySMESHDSMesh->AddFaceWithID(*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),elem_id);
- //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
- }
- }
- else {
- for (j=0;j<nmailles[i];j++) {
- cmpt++;
- ok = myMesh->AddFaceWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),cmpt);
- //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
- }
- }
- break;
- }
- case MED_HEXA8 : {
- if (inuele) {
- for (j=0;j<nmailles[i];j++) {
- elem_id=*(numele+j);
- ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7),elem_id);
- //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
- }
- }
- else {
- for (j=0;j<nmailles[i];j++) {
- cmpt++;
- ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7),cmpt);
- //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
- }
+ if (ret == 0)
+ for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
+ {
+ if (nmailles[i] > 0 && ret == 0)
+ {
+ /* dimension de la maille */
+ edim = typmai[i] / 100;
+ nsup = 0;
+ if (mdim == 2 || mdim == 3)
+ if (edim == 1)
+ nsup = 1;
+ if (mdim == 3)
+ if (edim == 2)
+ nsup = 1;
+
+ taille = nsup + typmai[i] % 100;
+ //taille = typmai[i]%100;
+
+ /* allocation memoire */
+ connectivite = (med_int *) malloc(sizeof(med_int) *
+ taille * nmailles[i]);
+ nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
+ nmailles[i] + 1);
+ numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+ nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
+
+ /* lecture des données */
+ ret =
+ MEDelementsLire(myFileId, nommaa, mdim, connectivite,
+ mode_coo, nomele, &inoele, numele, &inuele, nufael,
+ nmailles[i], MED_MAILLE, typmai[i], typ_con);
+
+ switch (typmai[i])
+ {
+ case MED_TRIA3:
+ {
+ if (inuele)
+ {
+ for (j = 0; j < nmailles[i]; j++)
+ {
+ elem_id = *(numele + j);
+ ok = mySMESHDSMesh->AddFaceWithID(*(connectivite +
+ j * (taille - nsup)),
+ *(connectivite + j * (taille - nsup) + 1),
+ *(connectivite + j * (taille - nsup) + 2),
+ elem_id);
+ //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2));
+ }
+ }
+ else
+ {
+ for (j = 0; j < nmailles[i]; j++)
+ {
+ cmpt++;
+ ok = mySMESHDSMesh->AddFaceWithID(*(connectivite +
+ j * (taille)),
+ *(connectivite + j * (taille) + 1),
+ *(connectivite + j * (taille) + 2), cmpt);
+ //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2));
+ }
+ }
+
+ break;
+ }
+ case MED_QUAD4:
+ {
+ if (inuele)
+ {
+ for (j = 0; j < nmailles[i]; j++)
+ {
+ elem_id = *(numele + j);
+ ok = mySMESHDSMesh->AddFaceWithID(*(connectivite +
+ j * (taille - nsup)),
+ *(connectivite + j * (taille - nsup) + 1),
+ *(connectivite + j * (taille - nsup) + 2),
+ *(connectivite + j * (taille - nsup) + 3),
+ elem_id);
+ //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
+ }
+ }
+ else
+ {
+ for (j = 0; j < nmailles[i]; j++)
+ {
+ cmpt++;
+ ok = myMesh->AddFaceWithID(*(connectivite +
+ j * (taille)),
+ *(connectivite + j * (taille) + 1),
+ *(connectivite + j * (taille) + 2),
+ *(connectivite + j * (taille) + 3), cmpt);
+ //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
+ }
+ }
+ break;
+ }
+ case MED_HEXA8:
+ {
+ if (inuele)
+ {
+ for (j = 0; j < nmailles[i]; j++)
+ {
+ elem_id = *(numele + j);
+ ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite +
+ j * (taille - nsup)),
+ *(connectivite + j * (taille - nsup) + 1),
+ *(connectivite + j * (taille - nsup) + 2),
+ *(connectivite + j * (taille - nsup) + 3),
+ *(connectivite + j * (taille - nsup) + 4),
+ *(connectivite + j * (taille - nsup) + 5),
+ *(connectivite + j * (taille - nsup) + 6),
+ *(connectivite + j * (taille - nsup) + 7),
+ elem_id);
+ //fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3),*(connectivite+j*(taille-nsup)+4),*(connectivite+j*(taille-nsup)+5),*(connectivite+j*(taille-nsup)+6),*(connectivite+j*(taille-nsup)+7));
+ }
+ }
+ else
+ {
+ for (j = 0; j < nmailles[i]; j++)
+ {
+ cmpt++;
+ ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite +
+ j * (taille)),
+ *(connectivite + j * (taille) + 1),
+ *(connectivite + j * (taille) + 2),
+ *(connectivite + j * (taille) + 3),
+ *(connectivite + j * (taille) + 4),
+ *(connectivite + j * (taille) + 5),
+ *(connectivite + j * (taille) + 6),
+ *(connectivite + j * (taille) + 7), cmpt);
+ //fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3),*(connectivite+j*(taille)+4),*(connectivite+j*(taille)+5),*(connectivite+j*(taille)+6),*(connectivite+j*(taille)+7));
+ }
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ fprintf(stdout, "\n - Numéros de familles : \n");
+ for (j = 0; j < nmailles[i]; j++)
+ fprintf(stdout, " %d ", *(nufael + j));
+
+ /* liberation memoire */
+ free(connectivite);
+ free(nomele);
+ free(numele);
+ free(nufael);
+ }