Salome HOME
Added support for polygones and polyhedres
authorenk <enk@opencascade.com>
Fri, 18 Feb 2005 07:32:07 +0000 (07:32 +0000)
committerenk <enk@opencascade.com>
Fri, 18 Feb 2005 07:32:07 +0000 (07:32 +0000)
28 files changed:
src/DriverMED/DriverMED_Family.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Object.cxx
src/SMDS/Makefile.in
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_MeshGroup.cxx
src/SMDS/SMDS_PolygonalFaceOfNodes.cxx [new file with mode: 0644]
src/SMDS/SMDS_PolygonalFaceOfNodes.hxx [new file with mode: 0644]
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx [new file with mode: 0644]
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx [new file with mode: 0644]
src/SMESHDS/SMESHDS_Command.cxx
src/SMESHDS/SMESHDS_Command.hxx
src/SMESHDS/SMESHDS_CommandType.hxx
src/SMESHDS/SMESHDS_Mesh.cxx
src/SMESHDS/SMESHDS_Mesh.hxx
src/SMESHDS/SMESHDS_Script.cxx
src/SMESHDS/SMESHDS_Script.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h
src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
src/SMESHGUI/SMESHGUI_MeshInfosDlg.h
src/SMESHGUI/SMESH_icons.po
src/SMESHGUI/SMESH_msg_en.po

index 2115c4e8bfce0eac2672f2c86d89deae9442c4a8..207571d5ea8ce1cf8adbbc16f1d3cd7172b5fe7b 100644 (file)
@@ -223,9 +223,12 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
 
   aValue = aStr.str();
 
-  MED::TStringVector anAttrDescs (1, "");  // 1 attribute with empty description,
-  MED::TIntVector anAttrIds (1, myId);        // Id=0,
-  MED::TIntVector anAttrVals (1, myId);       // Value=0
+  MED::TStringVector anAttrDescs;
+  MED::TIntVector anAttrIds;
+  MED::TIntVector anAttrVals;
+  //MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
+  //MED::TIntVector anAttrIds (1, myId);    // Id=0,
+  //MED::TIntVector anAttrVals (1, myId);   // Value=0
 
   MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
                                                     aValue,
index 1433e3208a970c74ef6d00e1f498552e3100d94d..6f44c4e8bb0e32f1f54ee72001045e906c9728dd 100644 (file)
@@ -268,7 +268,160 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
          MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
          for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
            const EGeometrieElement& aGeom = anTGeomIter->first;
-           if(aGeom == ePOINT1) continue;
+
+           if (aGeom == ePOINT1) {
+              continue;
+
+            } else if (aGeom == ePOLYGONE) {
+              PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
+              EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX;
+
+              TElemNum aConn  = aPolygoneInfo->GetConnectivite();
+              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++) {
+                  nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
+                }
+
+                bool isRenum = false;
+                SMDS_MeshElement* anElement = NULL;
+                TInt aFamNum = aPolygoneInfo->GetFamNum(iPG);
+
+                try {
+                  if (anIsElemNum) {
+                    anElement = myMesh->AddPolygonalFaceWithID
+                      (nodes_ids, aPolygoneInfo->GetElemNum(iPG));
+                  }
+                  if (!anElement) {
+                    std::vector<const SMDS_MeshNode*> nodes (aNbNodes);
+                    for (int inode = 0; inode < aNbNodes; 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) {
+                  aResult = DRS_WARN_SKIP_ELEM;
+                } else {
+                  if (isRenum) {
+                    anIsElemNum = eFAUX;
+                    takeNumbers = false;
+                    if (aResult < DRS_WARN_RENUMBER)
+                      aResult = DRS_WARN_RENUMBER;
+                  }
+                  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());
+                  }
+                }
+              }
+              continue;
+
+            } else if (aGeom == ePOLYEDRE) {
+              PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
+              EBooleen anIsElemNum = takeNumbers ? aPolyedreInfo->IsElemNum() : eFAUX;
+
+              TElemNum aConn       = aPolyedreInfo->GetConnectivite();
+              TElemNum aFacesIndex = aPolyedreInfo->GetFacesIndex();
+              TElemNum aIndex      = aPolyedreInfo->GetIndex();
+
+              TInt nbPolyedres = aPolyedreInfo->GetNbElem();
+             
+              for (int iPE = 0; iPE < nbPolyedres; iPE++) {
+                // get faces
+                int aCurrPE_FirstFaceIndex = aIndex[iPE] - 1;
+                int aNextPE_FirstFaceIndex = aIndex[iPE + 1] - 1;
+                int nbFaces = aNextPE_FirstFaceIndex - aCurrPE_FirstFaceIndex;
+                std::vector<int> quantities (nbFaces);
+                for (int iFa = 0; iFa < nbFaces; iFa++) {
+                  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;
+                }
+
+                // get nodes
+                int aCurrPE_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex] - 1;
+                int nbPENodes = aPolyedreInfo->GetNbConn(iPE);
+                std::vector<int> nodes_ids (nbPENodes);
+                for (int inode = 0; inode < nbPENodes; inode++) {
+                  nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
+                }
+
+                bool isRenum = false;
+                SMDS_MeshElement* anElement = NULL;
+                TInt aFamNum = aPolyedreInfo->GetFamNum(iPE);
+
+                try {
+                  if (anIsElemNum) {
+                    anElement = myMesh->AddPolyhedralVolumeWithID
+                      (nodes_ids, quantities, aPolyedreInfo->GetElemNum(iPE));
+                  }
+                  if (!anElement) {
+                    std::vector<const SMDS_MeshNode*> nodes (nbPENodes);
+                    for (int inode = 0; inode < nbPENodes; inode++) {
+                      nodes[inode] = FindNode(myMesh, nodes_ids[inode]);
+                    }
+                    anElement = myMesh->AddPolyhedralVolume(nodes, quantities);
+                    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) {
+                  aResult = DRS_WARN_SKIP_ELEM;
+                } else {
+                  if (isRenum) {
+                    anIsElemNum = eFAUX;
+                    takeNumbers = false;
+                    if (aResult < DRS_WARN_RENUMBER)
+                      aResult = DRS_WARN_RENUMBER;
+                  }
+                  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());
+                  }
+                }
+              }
+              continue;
+
+            }
+
            PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
            EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
            TInt aNbElems = aCellInfo->GetNbElem();
@@ -586,7 +739,7 @@ void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup)
       for (; anElemsIter != anElements.end(); anElemsIter++)
       {
         element = *anElemsIter;
-        theGroup->SMDSGroup().Add(element);
+       theGroup->SMDSGroup().Add(element);
       }
       if ( element )
         theGroup->SetType( element->GetType() );
index edd5418c4cb574a0b54a2924ad12c5b636e920d2..9d8e62f883b0c00f187bb955badeb105488f21e3 100644 (file)
@@ -33,6 +33,8 @@
 #include "SMESHDS_Mesh.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+
 #include "utilities.h"
 
 #include "MED_Utilities.hxx"
@@ -440,6 +442,16 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aQuadConn;
       aQuadConn.reserve(aNbElems*aNbQuadConn);
 
+      MED::TIntVector aPolygoneElemNums;
+      aPolygoneElemNums.reserve(aNbElems);
+      MED::TIntVector aPolygoneInds;
+      aPolygoneInds.reserve(aNbElems + 1);
+      aPolygoneInds.push_back(1); // reference on the first element in the connectivities
+      MED::TIntVector aPolygoneFamilyNums;
+      aPolygoneFamilyNums.reserve(aNbElems);
+      MED::TIntVector aPolygoneConn;
+      aPolygoneConn.reserve(aNbElems*aNbQuadConn);
+
       for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
        const SMDS_MeshFace* anElem = anIter->next();
        TInt aNbNodes = anElem->NbNodes();
@@ -448,41 +460,42 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        MED::TIntVector* anElemNums;
         MED::TIntVector* aFamilyNums;
        MED::TIntVector* aConnectivity;
-       switch(aNbNodes){
-       case 3:
-         aNbConnectivity = aNbTriaConn;
-         anElemNums = &anTriaElemNums;
-         aFamilyNums = &aTriaFamilyNums;
-         aConnectivity = &aTriaConn;
-         break;
-       case 4:
-         aNbConnectivity = aNbQuadConn;
-         anElemNums = &aQuadElemNums;
-         aFamilyNums = &aQuadFamilyNums;
-         aConnectivity = &aQuadConn;
-         break;
-       }
+        if (anElem->IsPoly()) {
+         aNbConnectivity = aNbNodes;
+          anElemNums = &aPolygoneElemNums;
+          aFamilyNums = &aPolygoneFamilyNums;
+          aConnectivity = &aPolygoneConn;
+        } else {
+          switch(aNbNodes){
+          case 3:
+            aNbConnectivity = aNbTriaConn;
+            anElemNums = &anTriaElemNums;
+            aFamilyNums = &aTriaFamilyNums;
+            aConnectivity = &aTriaConn;
+            break;
+          case 4:
+            aNbConnectivity = aNbQuadConn;
+            anElemNums = &aQuadElemNums;
+            aFamilyNums = &aQuadFamilyNums;
+            aConnectivity = &aQuadConn;
+            break;
+          default:
+            break;
+          }
+        }
        MED::TIntVector aVector(aNbNodes);
        for(TInt iNode = 0; aNodesIter->more(); iNode++){
          const SMDS_MeshElement* aNode = aNodesIter->next();
+#ifdef _EDF_NODE_IDS_
+         aVector[iNode] = aNodeIdMap[aNode->GetID()];
+#else
          aVector[iNode] = aNode->GetID();
+#endif
        }
 
        TInt aSize = aConnectivity->size();
        aConnectivity->resize(aSize+aNbConnectivity);
-       // There is some differnce between SMDS and MED in cells mapping
-#ifdef _EDF_NODE_IDS_
-       switch(aNbNodes){
-       case 4:
-         (*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
-         (*aConnectivity)[aSize+1] = aNodeIdMap[aVector[1]];
-         (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];  
-         (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];  
-       default:
-         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
-           (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
-       }
-#else
+       // There is some differences between SMDS and MED in cells mapping
        switch(aNbNodes){
        case 4:
          (*aConnectivity)[aSize+0] = aVector[0];
@@ -493,7 +506,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
          for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
            (*aConnectivity)[aSize+iNode] = aVector[iNode];
        }
-#endif
+
+        if (anElem->IsPoly()) {
+          // fill indices for polygonal element
+          TInt aPrevPos = aPolygoneInds.back();
+          aPolygoneInds.push_back(aPrevPos + aNbNodes);
+        }
+
        anElemNums->push_back(anElem->GetID());
 
         if (anElemFamMap.find(anElem) != anElemFamMap.end())
@@ -523,6 +542,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
        myMed->SetCellInfo(aCellInfo);
       }
+      if(TInt aNbElems = aPolygoneElemNums.size()){
+        // add one element in connectivities,
+        // referenced by the last element in indices
+        aPolygoneConn.push_back(0);
+
+       PPolygoneInfo aCellInfo = myMed->CrPolygoneInfo(aMeshInfo,
+                                                        SMDS_MED_ENTITY,
+                                                        ePOLYGONE,
+                                                        SMDS_MED_CONNECTIVITY,
+                                                        aPolygoneConn,
+                                                        aPolygoneInds,
+                                                        aPolygoneFamilyNums,
+                                                        aPolygoneElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYGONE<<"; aNbElems = "<<aNbElems);
+       myMed->SetPolygoneInfo(aCellInfo);
+      }
     }
 
     // Storing SMDS Volumes
@@ -563,74 +598,111 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       MED::TIntVector aHexaConn;
       aHexaConn.reserve(aNbElems*aNbHexaConn);
 
+      MED::TIntVector aPolyedreElemNums;
+      aPolyedreElemNums.reserve(aNbElems);
+      MED::TIntVector aPolyedreInds;
+      aPolyedreInds.reserve(aNbElems + 1);
+      aPolyedreInds.push_back(1); // reference on the first element in the faces
+      MED::TIntVector aPolyedreFaces;
+      aPolyedreFaces.reserve(aNbElems + 1);
+      aPolyedreFaces.push_back(1); // reference on the first element in the connectivities
+      MED::TIntVector aPolyedreFamilyNums;
+      aPolyedreFamilyNums.reserve(aNbElems);
+      MED::TIntVector aPolyedreConn;
+      aPolyedreConn.reserve(aNbElems*aNbHexaConn);
+
       for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
        const SMDS_MeshVolume* anElem = anIter->next();
-       TInt aNbNodes = anElem->NbNodes();
-       SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
-       TInt aNbConnectivity;
-       MED::TIntVector* anElemNums;
-       MED::TIntVector* aFamilyNums;
-       MED::TIntVector* aConnectivity;
-       switch(aNbNodes){
-       case 4:
-         aNbConnectivity = aNbTetraConn;
-         anElemNums = &anTetraElemNums;
-         aFamilyNums = &aTetraFamilyNums;
-         aConnectivity = &aTetraConn;
-         break;
-       case 5:
-         aNbConnectivity = aNbPyraConn;
-         anElemNums = &anPyraElemNums;
-         aFamilyNums = &aPyraFamilyNums;
-         aConnectivity = &aPyraConn;
-         break;
-       case 6:
-         aNbConnectivity = aNbPentaConn;
-         anElemNums = &anPentaElemNums;
-         aFamilyNums = &aPentaFamilyNums;
-         aConnectivity = &aPentaConn;
-         break;
-       case 8:
-         aNbConnectivity = aNbHexaConn;
-         anElemNums = &aHexaElemNums;
-         aFamilyNums = &aHexaFamilyNums;
-         aConnectivity = &aHexaConn;
-       }
 
-       MED::TIntVector aVector(aNbNodes);
-       for(TInt iNode = 0; aNodesIter->more(); iNode++){
-         const SMDS_MeshElement* aNode = aNodesIter->next();
-         aVector[iNode] = aNode->GetID();
-       }
-       TInt aSize = aConnectivity->size();
-       aConnectivity->resize(aSize+aNbConnectivity);
-       // There is some difference between SMDS and MED in cells mapping
+        MED::TIntVector* anElemNums;
+        MED::TIntVector* aFamilyNums;
+
+        if (anElem->IsPoly()) {
+          const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+            (const SMDS_PolyhedralVolumeOfNodes*) anElem;
+          if (!anElem) {
+            MESSAGE("Warning: bad volumic element");
+            continue;
+          }
+
+          anElemNums = &aPolyedreElemNums;
+          aFamilyNums = &aPolyedreFamilyNums;
+
+          TInt aNodeId, aNbFaces = aPolyedre->NbFaces();
+          for (int iface = 1; iface <= aNbFaces; iface++) {
+            int aNbFaceNodes = aPolyedre->NbFaceNodes(iface);
+            for (int inode = 1; inode <= aNbFaceNodes; inode++) {
+              aNodeId = aPolyedre->GetFaceNode(iface, inode)->GetID();
 #ifdef _EDF_NODE_IDS_
-       switch(aNbNodes){
-       case 5:
-         (*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
-         (*aConnectivity)[aSize+1] = aNodeIdMap[aVector[3]];
-         (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[2]];  
-         (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];  
-         (*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];  
-       default:
-         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
-           (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
-       }
+              aPolyedreConn.push_back(aNodeIdMap[aNodeId]);
 #else
-       switch(aNbNodes){
-       case 5:
-         (*aConnectivity)[aSize+0] = aVector[0];
-         (*aConnectivity)[aSize+1] = aVector[3];
-         (*aConnectivity)[aSize+2] = aVector[2];  
-         (*aConnectivity)[aSize+3] = aVector[1];  
-         (*aConnectivity)[aSize+4] = aVector[4];  
-       default:
-         for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
-           (*aConnectivity)[aSize+iNode] = aVector[iNode];
-       }
+              aPolyedreConn.push_back(aNodeId);
 #endif
-       anElemNums->push_back(anElem->GetID());
+            }
+            TInt aPrevPos = aPolyedreFaces.back();
+            aPolyedreFaces.push_back(aPrevPos + aNbFaceNodes);
+          }
+          TInt aPrevPos = aPolyedreInds.back();
+          aPolyedreInds.push_back(aPrevPos + aNbFaces);
+
+        } else {
+          TInt aNbNodes = anElem->NbNodes();
+          SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+          TInt aNbConnectivity;
+          MED::TIntVector* aConnectivity;
+          switch(aNbNodes){
+          case 4:
+            aNbConnectivity = aNbTetraConn;
+            anElemNums = &anTetraElemNums;
+            aFamilyNums = &aTetraFamilyNums;
+            aConnectivity = &aTetraConn;
+            break;
+          case 5:
+            aNbConnectivity = aNbPyraConn;
+            anElemNums = &anPyraElemNums;
+            aFamilyNums = &aPyraFamilyNums;
+            aConnectivity = &aPyraConn;
+            break;
+          case 6:
+            aNbConnectivity = aNbPentaConn;
+            anElemNums = &anPentaElemNums;
+            aFamilyNums = &aPentaFamilyNums;
+            aConnectivity = &aPentaConn;
+            break;
+          case 8:
+            aNbConnectivity = aNbHexaConn;
+            anElemNums = &aHexaElemNums;
+            aFamilyNums = &aHexaFamilyNums;
+            aConnectivity = &aHexaConn;
+          }
+
+          TInt aSize = aConnectivity->size();
+          aConnectivity->resize(aSize + aNbConnectivity);
+
+          MED::TIntVector aVector(aNbNodes);
+          for(TInt iNode = 0; aNodesIter->more(); iNode++){
+            const SMDS_MeshElement* aNode = aNodesIter->next();
+#ifdef _EDF_NODE_IDS_
+            aVector[iNode] = aNodeIdMap[aNode->GetID()];
+#else
+            aVector[iNode] = aNode->GetID();
+#endif
+          }
+          // There is some difference between SMDS and MED in cells mapping
+          switch(aNbNodes){
+          case 5:
+            (*aConnectivity)[aSize+0] = aVector[0];
+            (*aConnectivity)[aSize+1] = aVector[3];
+            (*aConnectivity)[aSize+2] = aVector[2];  
+            (*aConnectivity)[aSize+3] = aVector[1];  
+            (*aConnectivity)[aSize+4] = aVector[4];  
+          default:
+            for(TInt iNode = 0; iNode < aNbNodes; iNode++) 
+              (*aConnectivity)[aSize+iNode] = aVector[iNode];
+          }
+        }
+
+        anElemNums->push_back(anElem->GetID());
 
         if (anElemFamMap.find(anElem) != anElemFamMap.end())
           aFamilyNums->push_back(anElemFamMap[anElem]);
@@ -682,6 +754,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
        MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
        myMed->SetCellInfo(aCellInfo);
       }
+      if(TInt aNbElems = aPolyedreElemNums.size()){
+        // add one element in connectivities,
+        // referenced by the last element in faces
+        aPolyedreConn.push_back(0);
+
+       PPolyedreInfo aCellInfo = myMed->CrPolyedreInfo(aMeshInfo,
+                                                        SMDS_MED_ENTITY,
+                                                        ePOLYEDRE,
+                                                        SMDS_MED_CONNECTIVITY,
+                                                        aPolyedreConn,
+                                                        aPolyedreFaces,
+                                                        aPolyedreInds,
+                                                        aPolyedreFamilyNums,
+                                                        aPolyedreElemNums);
+       MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYEDRE<<"; aNbElems = "<<aNbElems);
+       myMed->SetPolyedreInfo(aCellInfo);
+      }
     }
   }catch(const std::exception& exc){
     INFOS("Follow exception was cought:\n\t"<<exc.what());
index d9e353c181cb00ecd3f7723857699270b409380d..8940c0fc3a706f1118ab06d27481e792dadad84e 100644 (file)
@@ -160,6 +160,7 @@ SMESH_ActorDef::SMESH_ActorDef(){
   aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
   aFilter->RegisterCellsWithType(VTK_WEDGE);
   aFilter->RegisterCellsWithType(VTK_PYRAMID);
+  aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
 
 
   //Definition 1D divice of the actor
index 4b43e56acade03d620d0d7120d01417f19b9733f..5d3e5622eaa6f6c7a84a617b7cfa16e83bbb639f 100644 (file)
@@ -160,6 +160,30 @@ namespace{
   }
 
 
+  inline void AddPolygonsWithID(SMDS_Mesh* theMesh, 
+                                SMESH::log_array_var& theSeq,
+                                CORBA::Long theId)
+  {
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number;
+
+    for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) {
+      int aFaceId = anIndexes[anIndexId++];
+
+      int aNbNodes = anIndexes[anIndexId++];
+      std::vector<int> nodes_ids (aNbNodes);
+      for (int i = 0; i < aNbNodes; i++) {
+        nodes_ids[i] = anIndexes[anIndexId++];
+      }
+
+      SMDS_MeshElement* anElem = theMesh->AddPolygonalFaceWithID(nodes_ids, aFaceId);
+      if (!anElem)
+       EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolygonalFaceWithID for ID = "
+                  << anElemId);
+    }
+  }
+
+
   inline void AddTetrasWithID(SMDS_Mesh* theMesh, 
                              SMESH::log_array_var& theSeq,
                              CORBA::Long theId)
@@ -175,7 +199,7 @@ namespace{
                                                          anIndexes[anIndexId+4],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
     }
   }
 
@@ -196,7 +220,7 @@ namespace{
                                                          anIndexes[anIndexId+5],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
     }
   }
 
@@ -218,7 +242,7 @@ namespace{
                                                          anIndexes[anIndexId+6],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
     }
   }
 
@@ -242,7 +266,69 @@ namespace{
                                                          anIndexes[anIndexId+8],
                                                          anIndexes[anIndexId]);
       if(!anElem)
-       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh, 
+                                    SMESH::log_array_var& theSeq,
+                                    CORBA::Long theId)
+  {
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number;
+
+    for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) {
+      int aFaceId = anIndexes[anIndexId++];
+
+      int aNbNodes = anIndexes[anIndexId++];
+      std::vector<int> nodes_ids (aNbNodes);
+      for (int i = 0; i < aNbNodes; i++) {
+        nodes_ids[i] = anIndexes[anIndexId++];
+      }
+
+      int aNbFaces = anIndexes[anIndexId++];
+      std::vector<int> quantities (aNbFaces);
+      for (int i = 0; i < aNbFaces; i++) {
+        quantities[i] = anIndexes[anIndexId++];
+      }
+
+      SMDS_MeshElement* anElem =
+        theMesh->AddPolyhedralVolumeWithID(nodes_ids, quantities, aFaceId);
+      if (!anElem)
+       EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolyhedralVolumeWithID for ID = "
+                  << anElemId);
+    }
+  }
+
+
+  inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh, 
+                                     SMESH::log_array_var& theSeq,
+                                     CORBA::Long theId)
+  {
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long iind = 0, aNbElems = theSeq[theId].number;
+
+    for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++)
+    {
+      // find element
+      const SMDS_MeshElement* elem = FindElement(theMesh, anIndexes[iind++]);
+      // nb nodes
+      int nbNodes = anIndexes[iind++];
+      // nodes
+      std::vector<const SMDS_MeshNode*> aNodes (nbNodes);
+      for (int iNode = 0; iNode < nbNodes; iNode++) {
+        aNodes[iNode] = FindNode(theMesh, anIndexes[iind++]);
+      }
+      // nb faces
+      int nbFaces = anIndexes[iind++];
+      // quantities
+      std::vector<int> quantities (nbFaces);
+      for (int iFace = 0; iFace < nbFaces; iFace++) {
+        quantities[iFace] = anIndexes[iind++];
+      }
+      // change
+      theMesh->ChangePolyhedronNodes(elem, aNodes, quantities);
     }
   }
 
@@ -258,6 +344,7 @@ namespace{
 // purpose  : Get type of VTK cell
 //=================================================================================
 static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
+                                    const bool thePoly,
                                      const int theNbNodes )
 {
   switch( theType )
@@ -265,17 +352,19 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
     case SMDSAbs_Edge: 
       return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
 
-    case SMDSAbs_Face  : 
-      if      ( theNbNodes == 3 ) return VTK_TRIANGLE;
-      else if ( theNbNodes == 4 ) return VTK_QUAD;
-      else                        return VTK_EMPTY_CELL;
+    case SMDSAbs_Face  :
+      if (thePoly && theNbNodes>2 ) return VTK_POLYGON;
+      else if ( theNbNodes == 3 )   return VTK_TRIANGLE;
+      else if ( theNbNodes == 4 )   return VTK_QUAD;
+      else return VTK_EMPTY_CELL;
       
-    case SMDSAbs_Volume: 
-      if      ( theNbNodes == 4 ) return VTK_TETRA;
-      else if ( theNbNodes == 5 ) return VTK_PYRAMID;
-      else if ( theNbNodes == 6 ) return VTK_WEDGE;
-      else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
-      else                        return VTK_EMPTY_CELL;
+    case SMDSAbs_Volume:
+      if (thePoly && theNbNodes>3 ) return VTK_CONVEX_POINT_SET;
+      else if ( theNbNodes == 4 )   return VTK_TETRA;
+      else if ( theNbNodes == 5 )   return VTK_PYRAMID;
+      else if ( theNbNodes == 6 )   return VTK_WEDGE;
+      else if ( theNbNodes == 8 )   return VTK_HEXAHEDRON;
+      else return VTK_EMPTY_CELL;
 
     default: return VTK_EMPTY_CELL;
   }
@@ -542,35 +631,38 @@ void SMESH_VisualObjDef::buildElemPrs()
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
        switch(aType){
        case SMDSAbs_Volume:{
-         int* aConnectivities = NULL;
+         std::vector<int> aConnectivities;
          GetConnect(aNodesIter,aConnect);
          // Convertions connectivities from SMDS to VTK
-         switch(aNbNodes){
-         case 4:{
-           static int anIds[] = {0,2,1,3};
-           aConnectivities = anIds;
-           break;
+         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++){
+             aConnectivities.push_back(k);
+             if (MYDEBUG) cout << " "<<k;
+           }
+           if (MYDEBUG) cout << endl;
          }
-         case 5:{
+         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};
-           aConnectivities = anIds;
-           break;
+           for (int k=0; k<aNbNodes; k++) aConnectivities.push_back(anIds[k]);
          }
-         case 6:{
+         else if (aNbNodes == 6){
            static int anIds[] = {0,1,2,3,4,5};
-           aConnectivities = anIds;
-           break;
+           for (int k=0; k<aNbNodes; k++) aConnectivities.push_back(anIds[k]);
          }
-         case 8:{
+         else if (aNbNodes == 8){
            static int anIds[] = {0,3,2,1,4,7,6,5};
-           aConnectivities = anIds;
-           break;
-         }}
+           for (int k=0; k<aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+         }
 
-         if(aConnectivities)
+         if(aConnectivities.size()>0){
            for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ )
              SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
-         
+         }
          break;
        }
        default:
@@ -581,7 +673,7 @@ void SMESH_VisualObjDef::buildElemPrs()
        }
 
         aConnectivity->InsertNextCell( anIdList );
-        aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) );
+        aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(),aNbNodes ) );
 
         iElem++;
       }
@@ -694,25 +786,27 @@ void SMESH_MeshObj::Update( int theIsClear )
     
     if( !aLength )
       return;
-      
+
     for ( CORBA::Long anId = 0; anId < aLength; anId++)
     {
       const SMESH::double_array& aCoords = aSeq[anId].coords;
       const SMESH::long_array& anIndexes = aSeq[anId].indexes;
       CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
       CORBA::Long aCommand = aSeq[anId].commandType;
-      
+
       switch(aCommand)
       {
-        case SMESH::ADD_NODE       : AddNodesWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_EDGE       : AddEdgesWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_TRIANGLE   : AddTriasWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_QUADRANGLE : AddQuadsWithID   ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_TETRAHEDRON: AddTetrasWithID  ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_PYRAMID    : AddPiramidsWithID( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_PRISM      : AddPrismsWithID  ( myMesh, aSeq, anId ); break;
-        case SMESH::ADD_HEXAHEDRON : AddHexasWithID   ( myMesh, aSeq, anId ); break;
-        
+        case SMESH::ADD_NODE       : AddNodesWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_EDGE       : AddEdgesWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_TRIANGLE   : AddTriasWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_QUADRANGLE : AddQuadsWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_POLYGON    : AddPolygonsWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_TETRAHEDRON: AddTetrasWithID     ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_PYRAMID    : AddPiramidsWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_PRISM      : AddPrismsWithID     ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_HEXAHEDRON : AddHexasWithID      ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_POLYHEDRON : AddPolyhedronsWithID( myMesh, aSeq, anId ); break;
+
         case SMESH::REMOVE_NODE:
           for( ; anElemId < aNbElems; anElemId++ )
             myMesh->RemoveNode( FindNode( myMesh, anIndexes[anElemId] ) );
@@ -749,6 +843,9 @@ void SMESH_MeshObj::Update( int theIsClear )
           }
           break;
 
+        case SMESH::CHANGE_POLYHEDRON_NODES:
+          ChangePolyhedronNodes(myMesh, aSeq, anId);
+          break;
         case SMESH::RENUMBER:
           for(CORBA::Long i=0; anElemId < aNbElems; anElemId++, i+=3)
           {
index d64abd6fe753a254ba54839f98d59ef05d8c88b4..e066e25e0bbb35d9cb600a6540e5f579f5f2d944 100644 (file)
@@ -55,8 +55,10 @@ LIB_SRC = \
        SMDS_IteratorOfElements.cxx \
        SMDS_VolumeOfFaces.cxx \
        SMDS_VolumeOfNodes.cxx \
+       SMDS_PolyhedralVolumeOfNodes.cxx \
        SMDS_FaceOfEdges.cxx \
        SMDS_FaceOfNodes.cxx \
+       SMDS_PolygonalFaceOfNodes.cxx \
        SMDS_VolumeTool.cxx
 #      SMDS_Tria3OfNodes.cxx \
 #      SMDS_HexahedronOfNodes.cxx
@@ -107,8 +109,10 @@ EXPORT_HEADERS= \
        SMDS_IteratorOfElements.hxx \
        SMDS_VolumeOfFaces.hxx \
        SMDS_VolumeOfNodes.hxx \
+       SMDS_PolyhedralVolumeOfNodes.hxx \
        SMDS_FaceOfEdges.hxx \
        SMDS_FaceOfNodes.hxx \
+       SMDS_PolygonalFaceOfNodes.hxx \
        SMDS_VolumeTool.hxx
 #      SMDS_Tria3OfNodes.hxx \
 #      SMDS_HexahedronOfNodes.hxx
index 763d61c47eb53d493a7a87c896eea73c3c86dd48..e6751c3f03a1bd8cec899cde21311b2f7d7ddb67 100644 (file)
@@ -29,6 +29,8 @@
 #include "SMDS_VolumeOfFaces.hxx"
 #include "SMDS_FaceOfNodes.hxx"
 #include "SMDS_FaceOfEdges.hxx"
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_PolygonalFaceOfNodes.hxx"
 
 #include <algorithm>
 #include <map>
@@ -786,6 +788,126 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
   return volume;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// Add a polygon defined by its nodes IDs
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                  const int        ID)
+{
+  int nbNodes = nodes_ids.size();
+  std::vector<const SMDS_MeshNode*> nodes (nbNodes);
+  for (int i = 0; i < nbNodes; i++) {
+    nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
+    if (!nodes[i]) return NULL;
+  }
+  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID); 
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Add a polygon defined by its nodes
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID
+                          (std::vector<const SMDS_MeshNode*> nodes,
+                           const int                         ID)
+{
+  SMDS_MeshFace * face;
+
+  if (hasConstructionEdges())
+  {
+    MESSAGE("Error : Not implemented");
+    return NULL;
+  }
+  else
+  {
+    face = new SMDS_PolygonalFaceOfNodes(nodes);
+    myFaces.Add(face);
+  }
+
+  if (!registerElement(ID, face)) {
+    RemoveElement(face, false);
+    face = NULL;
+  }
+  return face;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Add a polygon defined by its nodes.
+/// An ID is automatically affected to the created face.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshFace* SMDS_Mesh::AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes)
+{
+  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, myElementIDFactory->GetFreeID());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new polyhedral volume and add it to the mesh. 
+/// @param ID The ID of the new volume
+/// @return The created volume or NULL if an element with this ID already exists
+/// or if input nodes are not found.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID
+                             (std::vector<int> nodes_ids,
+                              std::vector<int> quantities,
+                              const int        ID)
+{
+  int nbNodes = nodes_ids.size();
+  std::vector<const SMDS_MeshNode*> nodes (nbNodes);
+  for (int i = 0; i < nbNodes; i++) {
+    nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
+    if (!nodes[i]) return NULL;
+  }
+  return SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new polyhedral volume and add it to the mesh. 
+/// @param ID The ID of the new volume
+/// @return The created  volume
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID
+                            (std::vector<const SMDS_MeshNode*> nodes,
+                             std::vector<int>                  quantities,
+                             const int                         ID)
+{
+  SMDS_MeshVolume* volume;
+  if (hasConstructionFaces()) {
+    MESSAGE("Error : Not implemented");
+    return NULL;
+  } else if (hasConstructionEdges()) {
+    MESSAGE("Error : Not implemented");
+    return NULL;
+  } else {
+    volume = new SMDS_PolyhedralVolumeOfNodes(nodes, quantities);
+    myVolumes.Add(volume);
+  }
+
+  if (!registerElement(ID, volume)) {
+    RemoveElement(volume, false);
+    volume = NULL;
+  }
+  return volume;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new polyhedral volume and add it to the mesh. 
+/// @return The created  volume
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolume
+                            (std::vector<const SMDS_MeshNode*> nodes,
+                             std::vector<int>                  quantities)
+{
+  int ID = myElementIDFactory->GetFreeID();
+  SMDS_MeshVolume * v = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
+  if (v == NULL) myElementIDFactory->ReleaseID(ID);
+  return v;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 /// Registers element with the given ID, maintains inverse connections
 ///////////////////////////////////////////////////////////////////////////////
@@ -966,10 +1088,25 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   }
   case SMDSAbs_Face: {
     const SMDS_FaceOfNodes* face = dynamic_cast<const SMDS_FaceOfNodes*>( elem );
-    if ( face )
+    if ( face ) {
       Ok = const_cast<SMDS_FaceOfNodes*>( face )->ChangeNodes( nodes, nbnodes );
+    } else {
+      /// ??? begin
+      const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
+      if (face) {
+        Ok = const_cast<SMDS_PolygonalFaceOfNodes*>(face)->ChangeNodes(nodes, nbnodes);
+      }
+      /// ??? end
+    }
     break;
   }
+  //case SMDSAbs_PolygonalFace: {
+  //  const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
+  //  if (face) {
+  //    Ok = const_cast<SMDS_PolygonalFaceOfNodes*>(face)->ChangeNodes(nodes, nbnodes);
+  //  }
+  //  break;
+  //}
   case SMDSAbs_Volume: {
     const SMDS_VolumeOfNodes* vol = dynamic_cast<const SMDS_VolumeOfNodes*>( elem );
     if ( vol )
@@ -1007,6 +1144,62 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   return Ok;
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : to change nodes of polyhedral volume
+//=======================================================================
+bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
+                                       std::vector<const SMDS_MeshNode*> nodes,
+                                       std::vector<int>                  quantities)
+{
+  if (elem->GetType() != SMDSAbs_Volume) {
+    MESSAGE("WRONG ELEM TYPE");
+    return false;
+  }
+
+  const SMDS_PolyhedralVolumeOfNodes* vol = dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>(elem);
+  if (!vol) {
+    return false;
+  }
+
+  // keep current nodes of elem
+  set<const SMDS_MeshElement*> oldNodes;
+  SMDS_ElemIteratorPtr itn = elem->nodesIterator();
+  while (itn->more()) {
+    oldNodes.insert(itn->next());
+  }
+
+  // change nodes
+  bool Ok = const_cast<SMDS_PolyhedralVolumeOfNodes*>(vol)->ChangeNodes(nodes, quantities);
+  if (!Ok) {
+    return false;
+  }
+
+  // update InverseElements
+
+  // AddInverseElement to new nodes
+  int nbnodes = nodes.size();
+  for (int i = 0; i < nbnodes; i++) {
+    if (oldNodes.find(nodes[i]) == oldNodes.end()) {
+      // new node
+      const_cast<SMDS_MeshNode*>(nodes[i])->AddInverseElement(elem);
+    } else {
+      // remove from oldNodes a node that remains in elem
+      oldNodes.erase(nodes[i]);
+    }
+  }
+
+  // RemoveInverseElement from the nodes removed from elem
+  set<const SMDS_MeshElement*>::iterator it;
+  for (it = oldNodes.begin(); it != oldNodes.end(); it++) {
+    SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
+      (const_cast<SMDS_MeshElement *>( *it ));
+    n->RemoveInverseElement(elem);
+  }
+
+  return Ok;
+}
+
 //=======================================================================
 //function : FindEdge
 //purpose  :
index 1aa9dda929b099a928470653511f18faefdef086..6f693dc57a05b8d4e272fac0a3cbd28532d1e029 100644 (file)
@@ -201,6 +201,28 @@ public:
                                      const SMDS_MeshFace * f5,
                                      const SMDS_MeshFace * f6);
 
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                 const int        ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
+                                                 const int                         ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<int> nodes_ids,
+                            std::vector<int> quantities,
+                            const int        ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities,
+                            const int                         ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolume
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities);
+
   virtual void RemoveElement(const SMDS_MeshElement *        elem,
                              std::list<const SMDS_MeshElement *>& removedElems,
                              std::list<const SMDS_MeshElement *>& removedNodes,
@@ -217,6 +239,9 @@ public:
   static bool ChangeElementNodes(const SMDS_MeshElement * elem,
                                  const SMDS_MeshNode    * nodes[],
                                  const int                nbnodes);
+  static bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
+                                    std::vector<const SMDS_MeshNode*> nodes,
+                                    std::vector<int>                  quantities);
 
   virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
   // Renumber all nodes or elements.
index 3d9d13afe40d2298918c7ccfb68d4d642f219a2b..b9f61351b37ceeff2b652c00243fe3f95be3e07c 100644 (file)
@@ -59,6 +59,8 @@ class SMDS_MeshElement:public SMDS_MeshObject
 
        ///Return the type of the current element
        virtual SMDSAbs_ElementType GetType() const = 0;
+       virtual bool IsPoly() const { return false; };
+
        friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
        friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
 
index 0acb246a8bfd32d8477fc6009e33f352ea766810..0cb481c501c0c38f13c2bd9d966c274625c271fd 100644 (file)
@@ -125,7 +125,7 @@ void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
        // the type of the group is determined by the first element added
        if (myElements.empty()) myType = theElem->GetType();
        else if (theElem->GetType() != myType)
-               MESSAGE("SMDS_MeshGroup::Add : Type Mismatch");
+         MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<<theElem->GetType()<<"!="<<myType);
        
        myElements.insert(theElem);
 }
diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.cxx
new file mode 100644 (file)
index 0000000..38abf18
--- /dev/null
@@ -0,0 +1,174 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include "SMDS_PolygonalFaceOfNodes.hxx"
+
+#include "SMDS_IteratorOfElements.hxx"
+//#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
+
+using namespace std;
+
+//=======================================================================
+//function : Constructor
+//purpose  : 
+//=======================================================================
+SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
+                          (std::vector<const SMDS_MeshNode *> nodes)
+{
+  myNodes = nodes;
+}
+
+//=======================================================================
+//function : GetType
+//purpose  : 
+//=======================================================================
+SMDSAbs_ElementType SMDS_PolygonalFaceOfNodes::GetType() const
+{
+  return SMDSAbs_Face;
+  //return SMDSAbs_PolygonalFace;
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : 
+//=======================================================================
+bool SMDS_PolygonalFaceOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes)
+{
+  if (nodes.size() < 3)
+    return false;
+
+  myNodes = nodes;
+
+  return true;
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : to support the same interface, as SMDS_FaceOfNodes
+//=======================================================================
+bool SMDS_PolygonalFaceOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
+                                             const int            nbNodes)
+{
+  if (nbNodes < 3)
+    return false;
+
+  myNodes.resize(nbNodes);
+  int i = 0;
+  for (; i < nbNodes; i++) {
+    myNodes[i] = nodes[i];
+  }
+
+  return true;
+}
+
+//=======================================================================
+//function : NbNodes
+//purpose  : 
+//=======================================================================
+int SMDS_PolygonalFaceOfNodes::NbNodes() const
+{
+  return myNodes.size();
+}
+
+//=======================================================================
+//function : NbEdges
+//purpose  : 
+//=======================================================================
+int SMDS_PolygonalFaceOfNodes::NbEdges() const
+{
+  return NbNodes();
+}
+
+//=======================================================================
+//function : NbFaces
+//purpose  : 
+//=======================================================================
+int SMDS_PolygonalFaceOfNodes::NbFaces() const
+{
+  return 1;
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
+{
+  OS << "polygonal face <" << GetID() << " > : ";
+  int i, nbNodes = myNodes.size();
+  for (i = 0; i < nbNodes - 1; i++)
+    OS << myNodes[i] << ",";
+  OS << myNodes[i] << ") " << endl;
+}
+
+//=======================================================================
+//function : elementsIterator
+//purpose  : 
+//=======================================================================
+class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator
+{
+  //const SMDS_MeshNode* const *mySet;
+  const std::vector<const SMDS_MeshNode *> mySet;
+  //int myLength;
+  int index;
+ public:
+  //SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
+  //  mySet(s),myLength(l),index(0) {}
+  SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
+    mySet(s),index(0) {}
+
+  bool more()
+  {
+    return index < mySet.size();
+  }
+
+  const SMDS_MeshElement* next()
+  {
+    index++;
+    return mySet[index-1];
+  }
+};
+
+SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
+                                         (SMDSAbs_ElementType type) const
+{
+  switch(type)
+  {
+  case SMDSAbs_Face:
+    return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
+  case SMDSAbs_Node:
+    return SMDS_ElemIteratorPtr(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes));
+  case SMDSAbs_Edge:
+    MESSAGE("Error : edge iterator for SMDS_PolygonalFaceOfNodes not implemented");
+    break;
+  default:
+    return SMDS_ElemIteratorPtr
+      (new SMDS_IteratorOfElements
+       (this,type,SMDS_ElemIteratorPtr
+        (new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes))));
+  }
+  return SMDS_ElemIteratorPtr();
+}
diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx
new file mode 100644 (file)
index 0000000..5677462
--- /dev/null
@@ -0,0 +1,60 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _SMDS_PolygonalFaceOfNodes_HeaderFile
+#define _SMDS_PolygonalFaceOfNodes_HeaderFile
+
+#include "SMDS_MeshFace.hxx"
+//#include "SMDS_FaceOfNodes.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_Iterator.hxx"
+
+#include <iostream>
+
+//class SMDS_PolygonalFaceOfNodes:public SMDS_FaceOfNodes
+class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace
+{
+ public:
+  SMDS_PolygonalFaceOfNodes (std::vector<const SMDS_MeshNode *> nodes);
+
+  virtual SMDSAbs_ElementType GetType() const;
+  virtual bool IsPoly() const { return true; };
+
+  bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes);
+
+  bool ChangeNodes (const SMDS_MeshNode* nodes[],
+                    const int            nbNodes);
+  // to support the same interface, as SMDS_FaceOfNodes
+
+  virtual int NbNodes() const;
+  virtual int NbEdges() const;
+  virtual int NbFaces() const;
+
+  virtual void Print (std::ostream & OS) const;
+
+ protected:
+  virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+
+ private:
+  std::vector<const SMDS_MeshNode *> myNodes;
+};
+
+#endif
diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
new file mode 100644 (file)
index 0000000..e2b81ff
--- /dev/null
@@ -0,0 +1,180 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "utilities.h"
+
+#include <set>
+
+using namespace std;
+
+//=======================================================================
+//function : Constructor
+//purpose  : Create a volume of many faces
+//=======================================================================
+SMDS_PolyhedralVolumeOfNodes::SMDS_PolyhedralVolumeOfNodes
+                                (std::vector<const SMDS_MeshNode *> nodes,
+                                 std::vector<int>                   quantities)
+: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
+{
+  ChangeNodes(nodes, quantities);
+}
+
+//=======================================================================
+//function : GetType
+//purpose  : 
+//=======================================================================
+SMDSAbs_ElementType SMDS_PolyhedralVolumeOfNodes::GetType() const
+{
+//  return SMDSAbs_PolyhedralVolume;
+  return SMDSAbs_Volume;
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : 
+//=======================================================================
+bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
+                                                std::vector<int>                   quantities)
+{
+  myNodesByFaces = nodes;
+  myQuantities = quantities;
+
+  // Init fields of parent class
+  int aNbNodes = 0;
+  std::set<const SMDS_MeshNode *> aSet;
+  int nodes_len = nodes.size();
+  for (int j = 0; j < nodes_len; j++) {
+    if (aSet.find(nodes[j]) == aSet.end()) {
+      aSet.insert(nodes[j]);
+      aNbNodes++;
+    }
+  }
+
+  int k = 0;
+  const SMDS_MeshNode* aNodes [aNbNodes];
+  std::set<const SMDS_MeshNode *>::iterator anIter = aSet.begin();
+  for (; anIter != aSet.end(); anIter++, k++) {
+    aNodes[k] = *anIter;
+  }
+
+  //SMDS_VolumeOfNodes::ChangeNodes(aNodes, aNbNodes);
+  delete [] myNodes;
+  myNbNodes = aNbNodes;
+  myNodes = new const SMDS_MeshNode* [myNbNodes];
+  for (int i = 0; i < myNbNodes; i++) {
+    myNodes[i] = aNodes[i];
+  }
+
+  return true;
+}
+
+//=======================================================================
+//function : NbEdges
+//purpose  : 
+//=======================================================================
+int SMDS_PolyhedralVolumeOfNodes::NbEdges() const
+{
+  int nbEdges = 0;
+
+  for (int ifa = 0; ifa < myQuantities.size(); ifa++) {
+    nbEdges += myQuantities[ifa];
+  }
+  nbEdges /= 2;
+
+  return nbEdges;
+}
+
+//=======================================================================
+//function : NbFaces
+//purpose  : 
+//=======================================================================
+int SMDS_PolyhedralVolumeOfNodes::NbFaces() const
+{
+  return myQuantities.size();
+}
+
+//=======================================================================
+//function : NbFaceNodes
+//purpose  : 
+//=======================================================================
+int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const
+{
+  if (face_ind < 1 || myQuantities.size() < face_ind)
+    return 0;
+  return myQuantities[face_ind - 1];
+}
+
+//=======================================================================
+//function : GetFaceNode
+//purpose  : 
+//=======================================================================
+const SMDS_MeshNode* SMDS_PolyhedralVolumeOfNodes::GetFaceNode (const int face_ind,
+                                                                const int node_ind) const
+{
+  if (node_ind < 1 || NbFaceNodes(face_ind) < node_ind)
+    return NULL;
+
+  int i, first_node = 0;
+  for (i = 0; i < face_ind - 1; i++) {
+    first_node += myQuantities[i];
+  }
+
+  return myNodesByFaces[first_node + node_ind - 1];
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+void SMDS_PolyhedralVolumeOfNodes::Print (ostream & OS) const
+{
+  OS << "polyhedral volume <" << GetID() << "> : ";
+
+  int faces_len = myQuantities.size();
+  //int nodes_len = myNodesByFaces.size();
+  int cur_first_node = 0;
+
+  int i, j;
+  for (i = 0; i < faces_len; i++) {
+    OS << "face_" << i << " (";
+    for (j = 0; j < myQuantities[i] - 1; j++) {
+      OS << myNodesByFaces[cur_first_node + j] << ",";
+    }
+    OS << myNodesByFaces[cur_first_node + j] << ") ";
+    cur_first_node += myQuantities[i];
+  }
+}
+
+//=======================================================================
+//function : ChangeNodes
+//purpose  : usage disabled
+//=======================================================================
+bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
+                                                const int            nbNodes)
+{
+  return false;
+}
diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
new file mode 100644 (file)
index 0000000..d7cfeee
--- /dev/null
@@ -0,0 +1,72 @@
+//  SMESH SMDS : implementaion of Salome mesh data structure
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMDS_PolyhedralVolumeOfNodes.hxx
+//  Module : SMESH
+
+#ifndef _SMDS_PolyhedralVolumeOfNodes_HeaderFile
+#define _SMDS_PolyhedralVolumeOfNodes_HeaderFile
+
+#include "SMDS_VolumeOfNodes.hxx"
+
+class SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes
+{
+ public:
+  SMDS_PolyhedralVolumeOfNodes (std::vector<const SMDS_MeshNode *> nodes,
+                                std::vector<int>                   quantities);
+
+  //virtual ~SMDS_PolyhedralVolumeOfNodes();
+
+  virtual SMDSAbs_ElementType GetType() const; 
+  virtual bool IsPoly() const { return true; };
+
+  bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
+                    std::vector<int>                   quantities);
+
+  //virtual int NbNodes() const;
+  virtual int NbEdges() const;
+  virtual int NbFaces() const;
+
+  int NbFaceNodes (const int face_ind) const;
+  // 1 <= face_ind <= NbFaces()
+
+  const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
+  // 1 <= face_ind <= NbFaces()
+  // 1 <= node_ind <= NbFaceNodes()
+
+  virtual void Print (std::ostream & OS) const;
+
+ protected:
+  //virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+
+ private:
+  // usage disabled
+  bool ChangeNodes (const SMDS_MeshNode* nodes[],
+                    const int            nbNodes);
+
+ private:
+  std::vector<const SMDS_MeshNode *> myNodesByFaces;
+  std::vector<int> myQuantities;
+};
+
+#endif
index 4e7dc3f3bfd0a89df0d86a2dc43224acecf9404f..b55b5af1c3694f09d57b5d540711f252dd094804 100644 (file)
@@ -224,6 +224,57 @@ void SMESHDS_Command::AddVolume(int NewVolID,
        myNumber++;
 }
 
+//=======================================================================
+//function : AddPolygonalFace
+//purpose  : 
+//=======================================================================
+void SMESHDS_Command::AddPolygonalFace (const int        ElementID,
+                                        std::vector<int> nodes_ids)
+{
+  if (!myType == SMESHDS_AddPolygon) {
+    MESSAGE("SMESHDS_Command::AddPolygonalFace : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  myNumber++;
+}
+
+//=======================================================================
+//function : AddPolyhedralVolume
+//purpose  : 
+//=======================================================================
+void SMESHDS_Command::AddPolyhedralVolume (const int        ElementID,
+                                           std::vector<int> nodes_ids,
+                                           std::vector<int> quantities)
+{
+  if (!myType == SMESHDS_AddPolyhedron) {
+    MESSAGE("SMESHDS_Command::AddPolyhedralVolume : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  int nbFaces = quantities.size();
+  myIntegers.push_back(nbFaces);
+  for (i = 0; i < nbFaces; i++) {
+    myIntegers.push_back(quantities[i]);
+  }
+
+  myNumber++;
+}
+
 //=======================================================================
 //function : 
 //purpose  : 
@@ -263,7 +314,7 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes
 {
   if (!myType == SMESHDS_ChangeElementNodes)
   {
-    MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
+    MESSAGE("SMESHDS_Command::ChangeElementNodes : Bad Type");
     return;
   }
   myIntegers.push_back(ElementID);
@@ -274,6 +325,36 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes
   myNumber++;
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : 
+//=======================================================================
+void SMESHDS_Command::ChangePolyhedronNodes (const int ElementID,
+                                             std::vector<int> nodes_ids,
+                                             std::vector<int> quantities)
+{
+  if (myType != SMESHDS_ChangePolyhedronNodes)
+  {
+    MESSAGE("SMESHDS_Command::ChangePolyhedronNodes : Bad Type");
+    return;
+  }
+  myIntegers.push_back(ElementID);
+
+  int i, nbNodes = nodes_ids.size();
+  myIntegers.push_back(nbNodes);
+  for (i = 0; i < nbNodes; i++) {
+    myIntegers.push_back(nodes_ids[i]);
+  }
+
+  int nbFaces = quantities.size();
+  myIntegers.push_back(nbFaces);
+  for (i = 0; i < nbFaces; i++) {
+    myIntegers.push_back(quantities[i]);
+  }
+
+  myNumber++;
+}
+
 //=======================================================================
 //function : Renumber
 //purpose  : 
index b72b21b86b8d37693e018d145a2db3dca3495c8c..3ecd762f30cbfd8e0d8c8155a249bdb671998c52 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "SMESHDS_CommandType.hxx"
 #include <list>
+#include <vector>
 
 class SMESHDS_Command
 {
@@ -48,10 +49,18 @@ class SMESHDS_Command
                int idnode4, int idnode5, int idnode6);
        void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
                int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
+        void AddPolygonalFace (const int        ElementID,
+                               std::vector<int> nodes_ids);
+        void AddPolyhedralVolume (const int        ElementID,
+                                  std::vector<int> nodes_ids,
+                                  std::vector<int> quantities);
        void MoveNode(int NewNodeID, double x, double y, double z);
        void RemoveNode(int NodeID);
        void RemoveElement(int ElementID);
        void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
+       void ChangePolyhedronNodes(const int ElementID,
+                                   std::vector<int> nodes_ids,
+                                   std::vector<int> quantities);
        void Renumber (const bool isNodes, const int startID, const int deltaID);
        SMESHDS_CommandType GetType();
        int GetNumber();
index e906020cb34a47183f03eda4ffd5779c6e42fbad..f2c505b1f66f12444696adc8681c39b3a76244d4 100644 (file)
@@ -34,14 +34,17 @@ enum SMESHDS_CommandType {
  SMESHDS_AddEdge,
  SMESHDS_AddTriangle,
  SMESHDS_AddQuadrangle,
+ SMESHDS_AddPolygon,
  SMESHDS_AddTetrahedron,
  SMESHDS_AddPyramid,
  SMESHDS_AddPrism,
  SMESHDS_AddHexahedron,
+ SMESHDS_AddPolyhedron,
  SMESHDS_RemoveNode,
  SMESHDS_RemoveElement,
  SMESHDS_MoveNode,
  SMESHDS_ChangeElementNodes,
+ SMESHDS_ChangePolyhedronNodes,
  SMESHDS_Renumber
 };
 
index 416da54aa4193cc5765a4b2688f82cda9d5713e0..c0c758c7451c0591b13e9c977f4df0404c61988a 100644 (file)
@@ -171,8 +171,9 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
     return false;
 
-  ASSERT( nbnodes < 9 );
-  int i, IDs[ 8 ];
+  //ASSERT( nbnodes < 9 );
+  //int i, IDs[ 8 ];
+  int i, IDs[ nbnodes ];
   for ( i = 0; i < nbnodes; i++ )
     IDs [ i ] = nodes[ i ]->GetID();
   myScript->ChangeElementNodes( elem->GetID(), IDs, nbnodes);
@@ -180,6 +181,30 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
   return true;
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : 
+//=======================================================================
+bool SMESHDS_Mesh::ChangePolyhedronNodes
+                   (const SMDS_MeshElement * elem,
+                    std::vector<const SMDS_MeshNode*> nodes,
+                    std::vector<int>                  quantities)
+{
+  ASSERT(nodes.size() > 3);
+
+  if (!SMDS_Mesh::ChangePolyhedronNodes(elem, nodes, quantities))
+    return false;
+
+  int i, len = nodes.size();
+  std::vector<int> nodes_ids (len);
+  for (i = 0; i < len; i++) {
+    nodes_ids[i] = nodes[i]->GetID();
+  }
+  myScript->ChangePolyhedronNodes(elem->GetID(), nodes_ids, quantities);
+
+  return true;
+}
+
 //=======================================================================
 //function : Renumber
 //purpose  : 
@@ -472,6 +497,100 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
                                 n8->GetID());
   return anElem;
 }
+
+//=======================================================================
+//function : AddPolygonalFace
+//purpose  : 
+//=======================================================================
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                     const int        ID)
+{
+  SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes_ids, ID);
+  if (anElem) {
+    myScript->AddPolygonalFace(ID, nodes_ids);
+  }
+  return anElem;
+}
+
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID
+                             (std::vector<const SMDS_MeshNode*> nodes,
+                              const int                         ID)
+{
+  SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolygonalFace(ID, nodes_ids);
+  }
+  return anElem;
+}
+
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace
+                             (std::vector<const SMDS_MeshNode*> nodes)
+{
+  SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolygonalFace(anElem->GetID(), nodes_ids);
+  }
+  return anElem;
+}
+
+//=======================================================================
+//function : AddPolyhedralVolume
+//purpose  : 
+//=======================================================================
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (std::vector<int> nodes_ids,
+                                                          std::vector<int> quantities,
+                                                          const int        ID)
+{
+  SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes_ids, quantities, ID);
+  if (anElem) {
+    myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
+  }
+  return anElem;
+}
+
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID
+                               (std::vector<const SMDS_MeshNode*> nodes,
+                                std::vector<int>                  quantities,
+                                const int                         ID)
+{
+  SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
+  }
+  return anElem;
+}
+
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume
+                               (std::vector<const SMDS_MeshNode*> nodes,
+                                std::vector<int>                  quantities)
+{
+  SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolume(nodes, quantities);
+  if (anElem) {
+    int i, len = nodes.size();
+    std::vector<int> nodes_ids (len);
+    for (i = 0; i < len; i++) {
+      nodes_ids[i] = nodes[i]->GetID();
+    }
+    myScript->AddPolyhedralVolume(anElem->GetID(), nodes_ids, quantities);
+  }
+  return anElem;
+}
+
 //=======================================================================
 //function : removeFromContainers
 //purpose  : 
index 459d30848aa5c34c7d27f0c93419ba460ad45b6e..115ab375621be7a9ef05625e4f4f3556d2d1c85d 100644 (file)
@@ -158,12 +158,37 @@ public:
                                     const SMDS_MeshNode * n7,
                                     const SMDS_MeshNode * n8);
   
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
+                                                 const int        ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
+                                                 const int                         ID);
+
+  virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<int> nodes_ids,
+                            std::vector<int> quantities,
+                            const int        ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities,
+                            const int                         ID);
+
+  virtual SMDS_MeshVolume* AddPolyhedralVolume
+                           (std::vector<const SMDS_MeshNode*> nodes,
+                            std::vector<int>                  quantities);
+
   void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
   virtual void RemoveNode(const SMDS_MeshNode *);
   void RemoveElement(const SMDS_MeshElement *);
   bool ChangeElementNodes(const SMDS_MeshElement * elem,
                           const SMDS_MeshNode    * nodes[],
                           const int                nbnodes);
+  bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
+                             std::vector<const SMDS_MeshNode*> nodes,
+                             std::vector<int>                  quantities);
   void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
 
   void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
index 97e158432d20bcfa7f5c2fbc525b29fdcf176e9c..369ab4697cbe43cb4641553849c6ec89ccc0bb3d 100644 (file)
@@ -148,6 +148,27 @@ void SMESHDS_Script::AddVolume(int NewID,
                                                idnode5, idnode6, idnode7, idnode8);
 }
 
+//=======================================================================
+//function : AddPolygonalFace
+//purpose  : 
+//=======================================================================
+void SMESHDS_Script::AddPolygonalFace (int NewFaceID, std::vector<int> nodes_ids)
+{
+  getCommand(SMESHDS_AddPolygon)->AddPolygonalFace(NewFaceID, nodes_ids);
+}
+
+//=======================================================================
+//function : AddPolyhedralVolume
+//purpose  : 
+//=======================================================================
+void SMESHDS_Script::AddPolyhedralVolume (int NewID,
+                                          std::vector<int> nodes_ids,
+                                          std::vector<int> quantities)
+{
+  getCommand(SMESHDS_AddPolyhedron)->AddPolyhedralVolume
+    (NewID, nodes_ids, quantities);
+}
+
 //=======================================================================
 //function : 
 //purpose  : 
@@ -185,6 +206,18 @@ void SMESHDS_Script::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
   getCommand(SMESHDS_ChangeElementNodes)->ChangeElementNodes( ElementID, nodes, nbnodes );
 }
 
+//=======================================================================
+//function : ChangePolyhedronNodes
+//purpose  : 
+//=======================================================================
+void SMESHDS_Script::ChangePolyhedronNodes (const int        ElementID,
+                                            std::vector<int> nodes_ids,
+                                            std::vector<int> quantities)
+{
+  getCommand(SMESHDS_ChangePolyhedronNodes)->ChangePolyhedronNodes
+    (ElementID, nodes_ids, quantities);
+}
+
 //=======================================================================
 //function : Renumber
 //purpose  : 
index e51d3ec98d3da2e2901b4a596c3b789c23b7c9d6..3874facfcecdc9f895d2eaea615967df5a906035 100644 (file)
@@ -30,6 +30,7 @@
 #include "SMESHDS_Command.hxx"
 
 #include <list>
+#include <vector>
 
 
 class SMESHDS_Script
@@ -48,10 +49,20 @@ class SMESHDS_Script
                int idnode4, int idnode5, int idnode6);
        void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
                int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
-       void MoveNode(int NewNodeID, double x, double y, double z);
+
+        void AddPolygonalFace (const int NewFaceID,
+                               std::vector<int> nodes_ids);
+       void AddPolyhedralVolume (const int NewVolID,
+                                  std::vector<int> nodes_ids,
+                                  std::vector<int> quantities);
+
+        void MoveNode(int NewNodeID, double x, double y, double z);
        void RemoveNode(int NodeID);
        void RemoveElement(int ElementID);
        void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
+       void ChangePolyhedronNodes(const int        ElementID,
+                                   std::vector<int> nodes_ids,
+                                   std::vector<int> quantities);
        void Renumber (const bool isNodes, const int startID, const int deltaID);
        void Clear();
        const std::list<SMESHDS_Command*> & GetCommands();
index bf4ae7f7639f1347e013a15e41f1664fe4e0d69a..3c0830dbe376548decd83a1e186d42c95572646c 100644 (file)
@@ -1915,8 +1915,10 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 401:                                    // GEOM::EDGE
   case 4021:                                   // TRIANGLE
   case 4022:                                   // QUAD
+  case 4023:                                   // POLYGON
   case 4031:                                   // TETRA
   case 4032:                                   // HEXA
+  case 4033:                                   // POLYHEDRON
     {
       if(checkLock(aStudy)) break;
       if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
@@ -1929,10 +1931,14 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
           type = SMDSAbs_Face; nbNodes = 3; break;
         case 4022:                                      // QUAD
           type = SMDSAbs_Face; nbNodes = 4; break;
+       case 4023:                                      // POLYGON
+         type = SMDSAbs_Face; nbNodes = 5; break;     // 5 - identificator for POLYGON
         case 4031:                                      // TETRA
           type = SMDSAbs_Volume; nbNodes = 4; break;
         case 4032:                                      // HEXA
           type = SMDSAbs_Volume; nbNodes = 8; break;
+       case 4033:                                      // POLYHEDRE
+         type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
         default:;
         }
        new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
index 792ca5c46c54961ef220b328dff1567a2c250550..ffdfb5113920c58200e0f37de5e05274bfdf975e 100644 (file)
@@ -203,19 +203,15 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
               Qt::WDestructiveClose)
 {
+  myIsPoly = false;
   mySimulation = new SMESH::TElementSimulation(SMESH::GetActiveStudy());
-
+  
   // verify nb nodes and type
   myNbNodes = nbNodes;
   myElementType = ElementType;
   switch ( ElementType ) {
   case SMDSAbs_Face:
-    if ( myNbNodes != 3 && myNbNodes != 4 )
-      myNbNodes = 3;
-    break;
   case SMDSAbs_Volume:
-    if ( myNbNodes != 4 && myNbNodes != 8 ) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
-      myNbNodes = 4;
     break;
   default:
     myElementType = SMDSAbs_Edge;
@@ -223,16 +219,26 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
   }
 
   QString elemName;
-  switch ( myNbNodes ) {
-  case 2: elemName = "EDGE"; break;
-  case 3: elemName = "TRIANGLE"; break;
-  case 4: elemName =
-    myElementType == SMDSAbs_Face ? elemName = "QUADRANGLE" : elemName = "TETRAS"; break;
-//   case 5:
-//   case 6:
-  default: // 8
+  if (myNbNodes == 2)
+    elemName = "EDGE";
+  else if (myNbNodes == 3)
+    elemName = "TRIANGLE";
+  else if (myNbNodes == 4)
+    if (myElementType == SMDSAbs_Face)
+      elemName = "QUADRANGLE";
+    else
+      elemName = "TETRAS";
+  else if (myNbNodes == 8)
     elemName = "HEXAS";
+  else if (myElementType == SMDSAbs_Face){
+    elemName = "POLYGON";
+    myIsPoly = true;
   }
+  else {
+    elemName = "POLYHEDRON";
+    myIsPoly = true;
+  }
+
   QString iconName      = tr( QString("ICON_DLG_%1").arg(elemName) );
   QString buttonGrTitle = tr( QString("SMESH_%1").arg(elemName) );
   QString caption       = tr( QString("SMESH_ADD_%1_TITLE").arg(elemName) );
@@ -329,7 +335,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
   GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
   LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
 //  LineEditC1A1->setReadOnly( TRUE );
-  LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes ));
+  if (elemName != "POLYGON" && elemName != "POLYHEDRON")
+    LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes));
   GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
 
   if ( myElementType == SMDSAbs_Face ) {
@@ -514,7 +521,20 @@ void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText)
       else
         allOk = false;
     }
-    myOkNodes = (allOk && myNbNodes == aListId.count() );
+
+    bool aNodesOK = false;
+    if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){
+      myNbNodes = aListId.count();
+      cout << __LINE__<<": ENK::DEBUG myNbNodes" << myNbNodes << endl;
+      aNodesOK = true;
+    } else if (myIsPoly && myElementType == SMDSAbs_Volume && aListId.count() >=4 ){
+      myNbNodes = aListId.count();
+      cout << __LINE__<<": ENK::DEBUG myNbNodes" << myNbNodes << endl;
+      aNodesOK = true;
+    } else if (!myIsPoly){
+      aNodesOK = (myNbNodes == aListId.count());
+    }
+    myOkNodes = (allOk && aNodesOK);//myNbNodes == aListId.count() );
 
     if ( myOkNodes ) {
       buttonOk->setEnabled( true );
@@ -573,7 +593,9 @@ void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
   myBusy = true;
   myEditCurrentArgument->setText( aString );
   myBusy = false;
-  if ( myNbNodes != nbNodes )
+  if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes>=3 ) {
+  } else if (myIsPoly && myElementType == SMDSAbs_Volume && nbNodes>=4){
+  } else if (myNbNodes != nbNodes)
     return;
 
   // OK
@@ -604,12 +626,20 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation()
       reverse(anIds.begin(),anIds.end());
 
     vtkIdType aType = 0;
-    switch ( myNbNodes ) {
-    case 2: aType = VTK_LINE; break;
-    case 3: aType = VTK_TRIANGLE; break;
-    case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
-    case 8: aType = VTK_HEXAHEDRON; break;
-    default: return;
+    if (myIsPoly)
+      switch ( myElementType ) {
+      case SMDSAbs_Face  : aType = VTK_POLYGON; break;
+      case SMDSAbs_Volume: aType = VTK_CONVEX_POINT_SET; break;
+      default: return;
+      }
+    else {
+      switch ( myNbNodes ) {
+      case 2: aType = VTK_LINE; break;
+      case 3: aType = VTK_TRIANGLE; break;
+      case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
+      case 8: aType = VTK_HEXAHEDRON; break;
+      default: return;
+      }
     }
       
     mySimulation->SetPosition(myActor,aType,anIds);
index 4a785bbc57009c607117c17a6a806804c9d48801..fb4df30301f2a235eead97d736129006c166b100 100644 (file)
@@ -92,6 +92,7 @@ private:
 
     int                             myElementType ;
     int                             myNbNodes;
+    bool                            myIsPoly;
 
     SMESH::SMESH_Mesh_var           myMesh;
     SMESH_Actor*                    myActor;
index dd130b2fe63aa688ee7a2d4ccda4cc192ec6a131..5421db7bc1ba01fe1741d26aea0fb185bb58bed1 100644 (file)
@@ -150,6 +150,11 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent,  const char* name
   QLabel* myMeshNbQuadranglesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_QUADRANGLES" ) ), myMeshFacesGroup, "myMeshNbQuadranglesLab" );
   myMeshNbQuadrangles    = new QLabel( myMeshFacesGroup, "myMeshNbQuadrangles" );
   myMeshNbQuadrangles->setMinimumWidth( 100 );
+
+  // --> faces --> quadrangles
+  QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" );
+  myMeshNbPolygones      = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" );
+  myMeshNbPolygones->setMinimumWidth( 100 );
   
   myMeshFacesGroupLayout->addWidget( myMeshNbFacesLab,       0, 0 );
   myMeshFacesGroupLayout->addWidget( myMeshNbFaces,          0, 1 );
@@ -157,6 +162,8 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent,  const char* name
   myMeshFacesGroupLayout->addWidget( myMeshNbTriangles,      1, 1 );
   myMeshFacesGroupLayout->addWidget( myMeshNbQuadranglesLab, 2, 0 );
   myMeshFacesGroupLayout->addWidget( myMeshNbQuadrangles,    2, 1 );
+  myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab,   3, 0 );
+  myMeshFacesGroupLayout->addWidget( myMeshNbPolygones,      3, 1 );
   
   // --> volumes
   myMeshVolumesGroup = new QGroupBox( tr( "SMESH_MESHINFO_VOLUMES" ), myMeshWidget, "myMeshVolumesGroup" );
@@ -192,6 +199,11 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent,  const char* name
   QLabel* myMeshNbPyraLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_PYRAS" ) ), myMeshVolumesGroup, "myMeshNbPyraLab" );
   myMeshNbPyra    = new QLabel( myMeshVolumesGroup, "myMeshNbPyra" );
   myMeshNbPyra->setMinimumWidth( 100 );
+
+  // --> volumes --> polyherones
+  QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" );
+  myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" );
+  myMeshNbPolyhedrones->setMinimumWidth( 100 );
   
   myMeshVolumesGroupLayout->addWidget( myMeshNbVolumesLab, 0, 0 );
   myMeshVolumesGroupLayout->addWidget( myMeshNbVolumes,    0, 1 );
@@ -203,6 +215,8 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent,  const char* name
   myMeshVolumesGroupLayout->addWidget( myMeshNbPrism,      3, 1 );
   myMeshVolumesGroupLayout->addWidget( myMeshNbPyraLab,    4, 0 );
   myMeshVolumesGroupLayout->addWidget( myMeshNbPyra,       4, 1 );
+  myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab,    5, 0 );
+  myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones,       5, 1 );
   
   aMeshLayout->addWidget( myMeshNameLab,          0, 0 );
   aMeshLayout->addWidget( myMeshName,             0, 1 );
@@ -391,11 +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() );
          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() );
          return;
        }
        SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( anObject );
index c8123d8c0ff8c6c4b7a2937a5d8b024181215e44..2166619516e51404dc7fd4e13fdc361a2adbbd75 100644 (file)
@@ -75,12 +75,14 @@ private:
     QLabel*       myMeshNbFaces;
     QLabel*       myMeshNbTriangles;
     QLabel*       myMeshNbQuadrangles;
+    QLabel*       myMeshNbPolygones;
     QGroupBox*    myMeshVolumesGroup;
     QLabel*       myMeshNbVolumes;
     QLabel*       myMeshNbTetra;
     QLabel*       myMeshNbHexa;
     QLabel*       myMeshNbPyra;
     QLabel*       myMeshNbPrism;
+    QLabel*       myMeshNbPolyhedrones;
     
     QWidget*      mySubMeshWidget;
     QLabel*       mySubMeshName;
index 60dff5a19bca3c6cbe91cf333066fe5018a4f701..1275f600e59d7ff98192e98b62484182c0d5def0 100644 (file)
@@ -147,6 +147,10 @@ msgstr "mesh_triangle.png"
 msgid "ICON_DLG_QUADRANGLE"
 msgstr "mesh_quad.png"
 
+#Polygone
+msgid "ICON_DLG_POLYGON"
+msgstr "mesh_polygon.png"
+
 #triangle
 msgid "ICON_DLG_TETRAS"
 msgstr "mesh_tetra.png"
@@ -155,6 +159,10 @@ msgstr "mesh_tetra.png"
 msgid "ICON_DLG_HEXAS"
 msgstr "mesh_hexa.png"
 
+#Polyhedre
+msgid "ICON_DLG_POLYHEDRON"
+msgstr "mesh_polyhedron.png"
+
 
 #-----------------------------------------------------------
 # ObjectBrowser
index a58c6a758c705591588dd6415f7bdcc474b1f81d..c1d150b0591745bba2b62e2cc875142ebf3c8356 100644 (file)
@@ -444,6 +444,14 @@ msgstr "Add Edge"
 msgid "SMESH_ADD_TETRAS"
 msgstr "Add Tetrahedron"
 
+#Add Polygone
+msgid "SMESH_ADD_POLYGONE"
+msgstr "Add Polygone"
+
+#Add Polyedre
+msgid "SMESH_ADD_POLYEDRE"
+msgstr "Add Polyedre"
+
 #Add Hexahedron
 msgid "SMESH_ADD_HEXAS"
 msgstr "Add Hexahedron"
@@ -774,6 +782,14 @@ msgstr "Hexahedrons"
 msgid "SMESH_MESHINFO_PYRAS"
 msgstr "Pyramids"
 
+#Polygones :
+msgid "SMESH_MESHINFO_POLYGONES"
+msgstr "Polygones"
+
+#Polyedres :
+msgid "SMESH_MESHINFO_POLYEDRES"
+msgstr "Polyedres"
+
 #Prisms :
 msgid "SMESH_MESHINFO_PRISMS"
 msgstr "Prisms"