- ret = MEDnoeudsEcr(myFileId,nommaa,mdim,coo,mode_coo,MED_CART,
- nomcoo,unicoo,nomnoe,MED_FAUX,rien,MED_FAUX,
- nufano,nnoe,MED_REMP);
- ASSERT(ret == 0);
- MESSAGE("--- Creation de " << verifienbnoeuds << " noeuds");
- ASSERT(verifienbnoeuds == nnoe);
- MESSAGE("--- Creation de " << nbFamillesNoeud << " familles de noeuds");
-
- /* liberation memoire */
- free(coo);
- free(numnoe);
- free(nufano);
-
- /****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout,"\n(**************************)\n");
- fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout,"(**************************)\n");
-
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- if (ret == 0)
- {
- int nbFamillesElts =0;
- Handle(SMESHDS_Mesh) mySMESHDSMesh = Handle(SMESHDS_Mesh)::DownCast(myMesh);
- TopTools_IndexedMapOfShape myIndexToShape;
- TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(),myIndexToShape);
-
- map < int, int > mapFamille;
-
- if (besoinfamilledemaille == 1)
- {
- int t;
- for (t =1; t <= myIndexToShape.Extent(); t++)
- {
- const TopoDS_Shape S = myIndexToShape(t);
- if (mySMESHDSMesh->HasMeshElements(S))
- {
- //MESSAGE ("********* Traitement de la Famille "<<-t);
-
- Handle(SMESHDS_SubMesh) SM = mySMESHDSMesh->MeshElements(S);
- const TColStd_ListOfInteger& indElt = SM->GetIDElements();
- TColStd_ListIteratorOfListOfInteger ite(indElt);
-
- bool plein=false;
- for (; ite.More(); ite.Next())
- {
- int eltId = ite.Value();
- mapFamille [eltId] = - t;
- plein=true;
- }
- if (plein)
- {
- nbFamillesElts++;
- char famille[MED_TAILLE_NOM+1];
- sprintf(famille,"E%d",t);
- CreateFamily(strdup(nommaa),strdup(famille),-t,attvalabs++);
- }
- }
- }
- }
-
- int indice=1;
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- {
- if (nmailles[i] > 0 && ret == 0)
- {
- MESSAGE ( " Start "<<typmai[i]);
-
- /* 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;
- //SCRUTE(nsup);
-
- taille = nsup+typmai[i]%100;
- //SCRUTE(taille);
-
- /* 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]);
- nomele="";
- nbNodes=typmai[i]%100;
-
- for (j=0;j<nmailles[i];j++)
- {
- myId = elem_Id[i][j];
- const Handle(SMDS_MeshElement)& elem = myMesh->FindElement(myId);
- //*(numele+j) = myId;
- *(numele+j) = indice ++;
-
- for (k=0; k<nbNodes; k++)
- {
- *(connectivite+j*taille+k) = mapNoeud[elem->GetConnection(k+1)];
- //SCRUTE(*(connectivite+j*taille+k));
- }
- if (nsup) *(connectivite+j*taille + nbNodes) = 0;
-
- if (besoinfamilledemaille == 1)
- {
- if (mapFamille.find(myId)!=mapFamille.end())
- {
- nufael[j]=mapFamille[myId];
- }
- else
- {
- nufael[j]=0;
- }
- }
- else
- {
- nufael[j]=0;
- }
-
- //SCRUTE(myId);
- //SCRUTE(j);
- //SCRUTE(nufael[j]);
- }
-
- /* ecriture des données */
-
- med_int* rien=0;
- ret=MEDelementsEcr( myFileId,nommaa,mdim,connectivite,mode_coo,nomele,MED_FAUX,numele,
- MED_VRAI,nufael,nmailles[i],MED_MAILLE,typmai[i],typ_con,MED_REMP);
- ASSERT(ret == 0);
- //SCRUTE(ret);
-
- if (ret < 0) MESSAGE(">> ERREUR : ecriture des mailles \n");
-
- /* liberation memoire */
- free(connectivite);
- free(numele);
- free(nufael);
- MESSAGE ( " End "<<typmai[i]);
- }
- };
- MESSAGE("--- Creation de " << nbFamillesElts << " familles d elements");