Salome HOME
Polygons and polyhedral volumes support
authorjfa <jfa@opencascade.com>
Fri, 18 Feb 2005 10:37:47 +0000 (10:37 +0000)
committerjfa <jfa@opencascade.com>
Fri, 18 Feb 2005 10:37:47 +0000 (10:37 +0000)
idl/SMESH_Mesh.idl
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/OBJECT/SMESH_Object.cxx
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx

index 1456a3d6b74e15596a0de17579972fbd17335b8e..fd0ad8e515de2277599998e1ce71965020fa04ea 100644 (file)
@@ -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()
index 6f44c4e8bb0e32f1f54ee72001045e906c9728dd..89a1a7bd41d5272bd0aad4826a3b4117ef70093e 100644 (file)
@@ -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<int> nodes_ids (aNbNodes);
-                for (TInt inode = 0; inode < aNbNodes; inode++) {
+                int nbNodes = aPolygoneInfo->GetNbConn(iPG);
+                std::vector<int> 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<const SMDS_MeshNode*> nodes (aNbNodes);
-                    for (int inode = 0; inode < aNbNodes; inode++) {
+                    std::vector<const SMDS_MeshNode*> 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"<<exc.what());
                 } catch (...) {
                   aResult = DRS_FAIL;
-                 INFOS("Follow unknown exception was cought!");
                 }
 
                 if (!anElement) {
@@ -326,17 +324,11 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                   }
                   if (myFamilies.find(aFamNum) != myFamilies.end()) {
                     // Save reference to this element from its family
-                   if (MYDEBUG){ 
-                     cout<<"myFamilies["<<aFamNum
-                         <<"] IsPoly()="<<anElement->IsPoly()
-                         <<"; GetType="<<anElement->GetType()
-                         <<"; aNbNodes="<<aNbNodes<<endl;                    
-                   }
                     myFamilies[aFamNum]->AddElement(anElement);
                     myFamilies[aFamNum]->SetType(anElement->GetType());
                   }
                 }
-              }
+              } // for (TInt iPG = 0; iPG < nbPolygons; iPG++)
               continue;
 
             } else if (aGeom == ePOLYEDRE) {
@@ -348,7 +340,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
               TElemNum aIndex      = aPolyedreInfo->GetIndex();
 
               TInt nbPolyedres = aPolyedreInfo->GetNbElem();
-             
+
               for (int iPE = 0; iPE < nbPolyedres; iPE++) {
                 // get faces
                 int aCurrPE_FirstFaceIndex = aIndex[iPE] - 1;
@@ -359,8 +351,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                   int aCurrFace_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex + iFa] - 1;
                   int aNextFace_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex + iFa + 1] - 1;
 
-                  int aNbNodes = aNextFace_FirstNodeIndex - aCurrFace_FirstNodeIndex;
-                  quantities[iFa] = aNbNodes;
+                  int nbNodes = aNextFace_FirstNodeIndex - aCurrFace_FirstNodeIndex;
+                  quantities[iFa] = nbNodes;
                 }
 
                 // get nodes
@@ -390,10 +382,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                   }
                 } catch (const std::exception& exc) {
                   aResult = DRS_FAIL;
-                 INFOS("Follow exception was cought:\n\t"<<exc.what());
                 } catch (...) {
                   aResult = DRS_FAIL;
-                 INFOS("Follow unknown exception was cought!");
                 }
 
                 if (!anElement) {
@@ -407,19 +397,14 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
                   }
                   if (myFamilies.find(aFamNum) != myFamilies.end()) {
                     // Save reference to this element from its family
-                   if (MYDEBUG){
-                     cout<<"myFamilies["<<aFamNum
-                         <<"] IsPoly()="<<anElement->IsPoly()
-                         <<"; GetType="<<anElement->GetType()
-                         <<"; aNbNodes="<<nbPENodes<<endl;
-                   }
                     myFamilies[aFamNum]->AddElement(anElement);
                     myFamilies[aFamNum]->SetType(anElement->GetType());
                   }
                 }
-              }
+              } // for (int iPE = 0; iPE < nbPolyedres; iPE++)
               continue;
 
+            } else {
             }
 
            PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
@@ -496,6 +481,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
              SMDS_MeshElement* anElement = NULL;
              TInt aFamNum = aCellInfo->GetFamNum(iElem);
              try{
+                //MESSAGE("Try to create element # " << iElem << " with id = "
+                //        << aCellInfo->GetElemNum(iElem));
                switch(aGeom){
                case eSEG2:
                case eSEG3:
index 5d3e5622eaa6f6c7a84a617b7cfa16e83bbb639f..a275a10b41731810d6b7c09ccddc43a2161fc98c 100644 (file)
@@ -634,33 +634,32 @@ void SMESH_VisualObjDef::buildElemPrs()
          std::vector<int> aConnectivities;
          GetConnect(aNodesIter,aConnect);
          // Convertions connectivities from SMDS to VTK
-         if (anElem->IsPoly() && aNbNodes>3){ // POLYEDRE
-           if (MYDEBUG) cout << "SMESH:Polyedre IsPoly()="<<anElem->IsPoly()<<"; aType="<<aType<<"; aNbNodes="<<aNbNodes<<endl;
-           for (int k=0; k<aNbNodes ; k++){
+         if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
+           for (int k = 0; k < aNbNodes; k++) {
              aConnectivities.push_back(k);
-             if (MYDEBUG) cout << " "<<k;
            }
-           if (MYDEBUG) cout << endl;
-         }
-         else if (aNbNodes == 4){
+
+         } 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){
+           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){
+           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){
+           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]);
-         }
+           for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+
+         } else {
+          }
 
-         if(aConnectivities.size()>0){
-           for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ )
+         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++;
       }
index e2b81ffe5b1ea05f862dd4af2563c6e3aebef20b..8b2613474f4dd349495e4f9236222263a91a2630 100644 (file)
@@ -83,9 +83,11 @@ bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode
 
   //SMDS_VolumeOfNodes::ChangeNodes(aNodes, aNbNodes);
   delete [] myNodes;
+  //myNbNodes = nodes.size();
   myNbNodes = aNbNodes;
   myNodes = new const SMDS_MeshNode* [myNbNodes];
   for (int i = 0; i < myNbNodes; i++) {
+    //myNodes[i] = nodes[i];
     myNodes[i] = aNodes[i];
   }
 
index db0c31ba115ccaa80feb5801d1dcfa3f3528aa7f..08a4d6d627a26471dae77ebb9a2afadce9cc1006 100644 (file)
@@ -833,7 +833,12 @@ int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
   int Nb = 0;
   
   SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
-  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;
 }
 
index 782be9360f8db85bab94a4ca9f761c28d4d53366..5753a5952d7fa8347333322227eac5216ed2e963 100644 (file)
@@ -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(); }
index 5421db7bc1ba01fe1741d26aea0fb185bb58bed1..eed2acc5ab4b22217dfe3ac945ecf62943694b9f 100644 (file)
@@ -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 );
index c9a347c3bbaa2144c42ba41c0ba88b6d22bae7ee..a7f0c5c74dbb2c09bb129086395c444e1be4b23c 100644 (file)
@@ -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();
 }
 
 //=============================================================================
index 0988218ed6c772976e75db6d51feed4752b4f6ff..dc3d06c57725b8447884880b1889cd9b45ecfe4b 100644 (file)
@@ -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);