diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 1456a3d6b..fd0ad8e51 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -378,7 +378,7 @@ module SMESH long NbQuadrangles() raises (SALOME::SALOME_Exception); - long NbPolygones() + long NbPolygons() raises (SALOME::SALOME_Exception); long NbVolumes() @@ -396,7 +396,7 @@ module SMESH long NbPrisms() raises (SALOME::SALOME_Exception); - long NbPolyhedrones() + long NbPolyhedrons() raises (SALOME::SALOME_Exception); long NbSubMesh() diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 6f44c4e8b..89a1a7bd4 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -280,12 +280,13 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() TElemNum aIndex = aPolygoneInfo->GetIndex(); TInt nbPolygons = aPolygoneInfo->GetNbElem(); + for (TInt iPG = 0; iPG < nbPolygons; iPG++) { // get nodes TInt aCurrPG_FirstNodeIndex = aIndex[iPG] - 1; - int aNbNodes = aPolygoneInfo->GetNbConn(iPG); - std::vector nodes_ids (aNbNodes); - for (TInt inode = 0; inode < aNbNodes; inode++) { + int nbNodes = aPolygoneInfo->GetNbConn(iPG); + std::vector nodes_ids (nbNodes); + for (TInt inode = 0; inode < nbNodes; inode++) { nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode]; } @@ -299,20 +300,17 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() (nodes_ids, aPolygoneInfo->GetElemNum(iPG)); } if (!anElement) { - std::vector nodes (aNbNodes); - for (int inode = 0; inode < aNbNodes; inode++) { + std::vector nodes (nbNodes); + for (int inode = 0; inode < nbNodes; inode++) { nodes[inode] = FindNode(myMesh, nodes_ids[inode]); } anElement = myMesh->AddPolygonalFace(nodes); isRenum = anIsElemNum; } - } catch (const std::exception& exc) { aResult = DRS_FAIL; - INFOS("Follow exception was cought:\n\t"<0){ - for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ ) + } else if (aNbNodes == 4) { + static int anIds[] = {0,2,1,3}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + + } else if (aNbNodes == 5) { + static int anIds[] = {0,3,2,1,4}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + + } else if (aNbNodes == 6) { + static int anIds[] = {0,1,2,3,4,5}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + + } else if (aNbNodes == 8) { + static int anIds[] = {0,3,2,1,4,7,6,5}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + + } else { + } + + if (aConnectivities.size() > 0) { + for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++) SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]); } break; @@ -673,7 +672,7 @@ void SMESH_VisualObjDef::buildElemPrs() } aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(),aNbNodes ) ); + aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) ); iElem++; } diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx index e2b81ffe5..8b2613474 100644 --- a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx +++ b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx @@ -83,9 +83,11 @@ bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vectorfacesIterator(); - while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++; + //while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++; + const SMDS_MeshFace * curFace; + while (itFaces->more()) { + curFace = itFaces->next(); + if (!curFace->IsPoly() && curFace->NbNodes() == 3) Nb++; + } return Nb; } @@ -846,20 +851,25 @@ int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception) int Nb = 0; SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator(); - while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++; + //while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++; + const SMDS_MeshFace * curFace; + while (itFaces->more()) { + curFace = itFaces->next(); + if (!curFace->IsPoly() && curFace->NbNodes() == 4) Nb++; + } return Nb; } /////////////////////////////////////////////////////////////////////////////// -/// Return the number of polygone faces in the mesh. This method run in O(n) +/// Return the number of polygonal faces in the mesh. This method run in O(n) /////////////////////////////////////////////////////////////////////////////// -int SMESH_Mesh::NbPolygones() throw(SALOME_Exception) +int SMESH_Mesh::NbPolygons() throw(SALOME_Exception) { Unexpect aCatch(SalomeException); int Nb = 0; - - SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator(); - while(itFaces->more()) if(itFaces->next()->IsPoly()) Nb++; + SMDS_FaceIteratorPtr itFaces = _myMeshDS->facesIterator(); + while (itFaces->more()) + if (itFaces->next()->IsPoly()) Nb++; return Nb; } @@ -879,7 +889,12 @@ int SMESH_Mesh::NbTetras() throw(SALOME_Exception) Unexpect aCatch(SalomeException); int Nb = 0; SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); - while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++; + //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++; + const SMDS_MeshVolume * curVolume; + while (itVolumes->more()) { + curVolume = itVolumes->next(); + if (!curVolume->IsPoly() && curVolume->NbNodes() == 4) Nb++; + } return Nb; } @@ -888,7 +903,12 @@ int SMESH_Mesh::NbHexas() throw(SALOME_Exception) Unexpect aCatch(SalomeException); int Nb = 0; SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); - while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++; + //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++; + const SMDS_MeshVolume * curVolume; + while (itVolumes->more()) { + curVolume = itVolumes->next(); + if (!curVolume->IsPoly() && curVolume->NbNodes() == 8) Nb++; + } return Nb; } @@ -897,7 +917,12 @@ int SMESH_Mesh::NbPyramids() throw(SALOME_Exception) Unexpect aCatch(SalomeException); int Nb = 0; SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); - while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++; + //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++; + const SMDS_MeshVolume * curVolume; + while (itVolumes->more()) { + curVolume = itVolumes->next(); + if (!curVolume->IsPoly() && curVolume->NbNodes() == 5) Nb++; + } return Nb; } @@ -906,16 +931,22 @@ int SMESH_Mesh::NbPrisms() throw(SALOME_Exception) Unexpect aCatch(SalomeException); int Nb = 0; SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); - while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++; + //while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++; + const SMDS_MeshVolume * curVolume; + while (itVolumes->more()) { + curVolume = itVolumes->next(); + if (!curVolume->IsPoly() && curVolume->NbNodes() == 6) Nb++; + } return Nb; } -int SMESH_Mesh::NbPolyhedrones() throw(SALOME_Exception) +int SMESH_Mesh::NbPolyhedrons() throw(SALOME_Exception) { Unexpect aCatch(SalomeException); int Nb = 0; - SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); - while(itVolumes->more()) if(itVolumes->next()->IsPoly()) Nb++; + SMDS_VolumeIteratorPtr itVolumes = _myMeshDS->volumesIterator(); + while (itVolumes->more()) + if (itVolumes->next()->IsPoly()) Nb++; return Nb; } diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 782be9360..5753a5952 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -166,7 +166,7 @@ public: int NbQuadrangles() throw(SALOME_Exception); - int NbPolygones() throw(SALOME_Exception); + int NbPolygons() throw(SALOME_Exception); int NbVolumes() throw(SALOME_Exception); @@ -176,10 +176,10 @@ public: int NbPyramids() throw(SALOME_Exception); - int NbPolyhedrones() throw(SALOME_Exception); - int NbPrisms() throw(SALOME_Exception); + int NbPolyhedrons() throw(SALOME_Exception); + int NbSubMesh() throw(SALOME_Exception); int NbGroup() const { return _mapGroup.size(); } diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx index 5421db7bc..eed2acc5a 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx @@ -405,13 +405,13 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() myMeshNbFaces->setNum( (int)aMesh->NbFaces() ); myMeshNbTriangles->setNum( (int)aMesh->NbTriangles() ); myMeshNbQuadrangles->setNum( (int)aMesh->NbQuadrangles() ); - myMeshNbPolygones->setNum( (int)aMesh->NbPolygones() ); + myMeshNbPolygones->setNum( (int)aMesh->NbPolygons() ); myMeshNbVolumes->setNum( (int)aMesh->NbVolumes() ); myMeshNbTetra->setNum( (int)aMesh->NbTetras() ); myMeshNbHexa->setNum( (int)aMesh->NbHexas() ); myMeshNbPrism->setNum( (int)aMesh->NbPrisms() ); myMeshNbPyra->setNum( (int)aMesh->NbPyramids() ); - myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrones() ); + myMeshNbPolyhedrones->setNum( (int)aMesh->NbPolyhedrons() ); return; } SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( anObject ); diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index c9a347c3b..a7f0c5c74 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -1193,10 +1193,10 @@ CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception) return _impl->NbQuadrangles(); } -CORBA::Long SMESH_Mesh_i::NbPolygones()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPolygons()throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); - return _impl->NbPolygones(); + return _impl->NbPolygons(); } //============================================================================= @@ -1234,10 +1234,10 @@ CORBA::Long SMESH_Mesh_i::NbPrisms()throw(SALOME::SALOME_Exception) return _impl->NbPrisms(); } -CORBA::Long SMESH_Mesh_i::NbPolyhedrones()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPolyhedrons()throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); - return _impl->NbPolyhedrones(); + return _impl->NbPolyhedrons(); } //============================================================================= diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 0988218ed..dc3d06c57 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -164,16 +164,16 @@ public: SALOME_MED::MESH_ptr GetMEDMesh() throw (SALOME::SALOME_Exception); - + CORBA::Long NbNodes() throw (SALOME::SALOME_Exception); - + CORBA::Long NbElements() throw (SALOME::SALOME_Exception); - + CORBA::Long NbEdges() throw (SALOME::SALOME_Exception); - + CORBA::Long NbFaces() throw (SALOME::SALOME_Exception); @@ -183,9 +183,9 @@ public: CORBA::Long NbQuadrangles() throw (SALOME::SALOME_Exception); - CORBA::Long NbPolygones() + CORBA::Long NbPolygons() throw (SALOME::SALOME_Exception); - + CORBA::Long NbVolumes() throw (SALOME::SALOME_Exception); @@ -194,16 +194,16 @@ public: CORBA::Long NbHexas() throw (SALOME::SALOME_Exception); - + CORBA::Long NbPyramids() throw (SALOME::SALOME_Exception); - + CORBA::Long NbPrisms() throw (SALOME::SALOME_Exception); - CORBA::Long NbPolyhedrones() + CORBA::Long NbPolyhedrons() throw (SALOME::SALOME_Exception); - + CORBA::Long NbSubMesh() throw (SALOME::SALOME_Exception);