- fprintf(stdout, "\n- Numeros des familles des noeuds : \n");
- for (i = 0; i < nnoe; i++)
- fprintf(stdout, " %d ", *(nufano + i));
- fprintf(stdout, "\n");
-
- /* liberation memoire */
- free(coo);
- free(nomnoe);
- free(numnoe);
- free(nufano);
-
- /****************************************************************************
- * LECTURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout, "\n(**************************)\n");
- fprintf(stdout, "(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout, "(**************************)");
- //fprintf(Out,"CELLS\n");
- /* Lecture des connectivites, noms, numeros des mailles */
- //printf("%d %d %d %d\n",nmailles[3],nmailles[4],nmailles[5],nmailles[9]);
-
- 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_TETRA4:
- {
- 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),
- 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 = mySMESHDSMesh->AddVolumeWithID(*(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);
- }
- }
-
- /****************************************************************************
- * LECTURE DES FAMILLES *
- ****************************************************************************/
- printf("\n(*************************)\n");
- printf("(* FAMILLES DU MAILLAGE : *)\n");
- printf("(*************************)\n");
- if (ret == 0)
- for (i = 0; i < nfam; i++)
- {
-
- /* nombre de groupes */
- ngro = MEDnFam(myFileId, nommaa, i + 1, MED_GROUPE);
- if (ngro < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre de groupes d'une famille \n");
- }
-
- /* nombre d'attributs */
- if (ret == 0)
- {
- natt = MEDnFam(myFileId, nommaa, i + 1, MED_ATTR);
- if (natt < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
- }
- }
-
- if (ret == 0)
- fprintf(stdout, "- Famille %d a %d attributs et %d groupes \n",
- i + 1, natt, ngro);
-
- /* nom,numero,attributs,groupes */
- if (ret == 0)
- {
- attide = (med_int *) malloc(sizeof(med_int) * natt);
- attval = (med_int *) malloc(sizeof(med_int) * natt);
- attdes = (char *)malloc(MED_TAILLE_DESC * natt + 1);
- gro = (char *)malloc(MED_TAILLE_LNOM * ngro + 1);
- ret =
- MEDfamInfo(myFileId, nommaa, i + 1, nomfam, &numfam, attide,
- attval, attdes, &natt, gro, &ngro);
-
- fam = string(nomfam);
- fam_type = fam.substr(1, 1);
- fam_id = fam.substr(2, 1);
- if ((fam_type == string("V")) || (fam_type == string("A")) ||
- (fam_type == string("F")))
- LinkMeshToShape(fam_type, fam_id, family[i]);
-
- fprintf(stdout, " - Famille de nom %s et de numero %d : \n",
- nomfam, numfam);
- fprintf(stdout, " - Attributs : \n");
- for (j = 0; j < natt; j++)
- {
- strncpy(str1, attdes + j * MED_TAILLE_DESC,
- MED_TAILLE_DESC);
- str1[MED_TAILLE_DESC] = '\0';
- fprintf(stdout, " ide = %d - val = %d - des = %s\n",
- *(attide + j), *(attval + j), str1);
- }
- free(attide);
- free(attval);
- free(attdes);
- fprintf(stdout, " - Groupes :\n");
- for (j = 0; j < ngro; j++)
- {
- strncpy(str2, gro + j * MED_TAILLE_LNOM, MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM] = '\0';
- fprintf(stdout, " gro = %s\n", str2);
- }
- free(gro);
- }
- }
-
- if (locally_managed)
- ret = MEDfermer(myFileId);
-