- char* file2Read = (char*)myFile.c_str();
- myFileId = fopen(file2Read,"w+");
- if (myFileId < 0)
- {
- fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
- exit(EXIT_FAILURE);
- }
- SCRUTE(myMesh);
- /****************************************************************************
- * NOMBRES D'OBJETS *
- ****************************************************************************/
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* Combien de noeuds ? */
- nbNodes = myMesh->NbNodes();
-
- /* Combien de mailles, faces ou aretes ? */
- Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes;
- nb_of_edges = myMesh->NbEdges();
- nb_of_faces = myMesh->NbFaces();
- nb_of_volumes = myMesh->NbVolumes();
- nbCells = nb_of_edges + nb_of_faces + nb_of_volumes;
- SCRUTE(nb_of_edges);
- SCRUTE(nb_of_faces);
- SCRUTE(nb_of_volumes);
-
- fprintf(stdout,"%d %d\n",nbNodes,nbCells);
- fprintf(myFileId,"%d %d\n",nbNodes,nbCells);
-
- /****************************************************************************
- * ECRITURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout,"\n(************************)\n");
- fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout,"(************************)\n");
-
- SMDS_MeshNodesIterator itNodes(myMesh);
-
- fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
- fprintf(myFileId,"%s\n", sNODE_UNV_ID );
-
- for (;itNodes.More();itNodes.Next()) {
- const Handle(SMDS_MeshElement)& elem = itNodes.Value();
- const Handle(SMDS_MeshNode )& node = myMesh->GetNode(1, elem);
-
- fprintf(myFileId, sNODE_UNV_DESCR, node->GetID());
- fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z());
- }
- fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
-
- /****************************************************************************
- * ECRITURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout,"\n(**************************)\n");
- fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout,"(**************************)");
- /* Ecriture des connectivites, noms, numeros des mailles */
-
- fprintf(myFileId,"%s\n", sUNV_SEPARATOR);
- fprintf(myFileId,"%s\n", sELT_UNV_ID );
-
- SMDS_MeshEdgesIterator itEdges(myMesh);
- for (;itEdges.More();itEdges.Next()) {
- const Handle(SMDS_MeshElement)& elem = itEdges.Value();
-
- switch (elem->NbNodes()) {
- case 2 : {
- fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes());
- fprintf(myFileId, sELT_BEAM_DESC2);
- fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2));
- break;
- }
- case 3 : {
- fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes());
- fprintf(myFileId, sELT_BEAM_DESC2);
- fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3));
- break;
+ // ---------------------
+ // Storing SMDS Volumes
+ // ---------------------
+ if ( myMesh->NbVolumes() )
+ {
+ SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
+ while ( anIter->more() )
+ {
+ const SMDS_MeshVolume* anElem = anIter->next();
+ if ( anElem->IsPoly() )
+ continue;
+ size_t aNbNodes = anElem->NbNodes();
+ switch( aNbNodes ) {
+ case 4: aRec.fe_descriptor_id = 111; break;
+ case 6: aRec.fe_descriptor_id = 112; break;
+ case 8: aRec.fe_descriptor_id = 115; break;
+ case 10: aRec.fe_descriptor_id = 118; break;
+ case 13: aRec.fe_descriptor_id = 114; break;
+ case 15: aRec.fe_descriptor_id = 113; break;
+ case 20:
+ case 27: aRec.fe_descriptor_id = 116; aNbNodes = 20; break;
+ default:
+ continue;
+ }
+ if ( myRenumber )
+ ++aRec.label; // -- IPAL54452
+ else
+ aRec.label = anElem->GetID();
+ if ( !elemLabelByID.empty() )
+ elemLabelByID[ anElem->GetID() ] = aRec.label;
+
+ aRec.node_labels.clear();
+ SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
+ while ( aNodesIter->more() && aRec.node_labels.size() < aNbNodes )
+ {
+ const SMDS_MeshElement* aNode = aNodesIter->next();
+ if ( nodeLabelByID.empty() )
+ aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) );
+ else
+ aRec.node_labels.push_back( nodeLabelByID[ aNode->GetID() ]);
+ }
+ aDataSet2412.push_back(aRec);
+ }