]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PR: debug autotests in progress, still 87 bugs
authorprascle <prascle>
Mon, 25 Oct 2010 08:29:59 +0000 (08:29 +0000)
committerprascle <prascle>
Mon, 25 Oct 2010 08:29:59 +0000 (08:29 +0000)
24 files changed:
src/Controls/SMESH_Controls.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx
src/OBJECT/SMESH_Object.cxx
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_MeshElement.cxx
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_UnstructuredGrid.cxx
src/SMDS/SMDS_UnstructuredGrid.hxx
src/SMDS/SMDS_VolumeTool.cxx
src/SMDS/SMDS_VolumeTool.hxx
src/SMDS/SMDS_VtkCellIterator.cxx
src/SMDS/SMDS_VtkCellIterator.hxx
src/SMDS/SMDS_VtkEdge.cxx
src/SMDS/SMDS_VtkEdge.hxx
src/SMDS/SMDS_VtkFace.cxx
src/SMDS/SMDS_VtkFace.hxx
src/SMDS/SMDS_VtkVolume.cxx
src/SMDS/SMDS_VtkVolume.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/StdMeshers/StdMeshers_Projection_3D.cxx

index 6116315ba2024b73c981489b25fde749f338d882..ac41f33103e00bea867db2358a9db525c3f51e39 100644 (file)
@@ -223,11 +223,11 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
   if ( anElem->IsQuadratic() ) {
     switch ( anElem->GetType() ) {
     case SMDSAbs_Edge:
-      anIter = static_cast<const SMDS_QuadraticEdge*>
+      anIter = dynamic_cast<const SMDS_VtkEdge*>
         (anElem)->interlacedNodesElemIterator();
       break;
     case SMDSAbs_Face:
-      anIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
+      anIter = dynamic_cast<const SMDS_VtkFace*>
         (anElem)->interlacedNodesElemIterator();
       break;
     default:
@@ -1247,10 +1247,10 @@ void Length2D::GetValues(TValues& theValues){
     const SMDS_MeshFace* anElem = anIter->next();
 
     if(anElem->IsQuadratic()) {
-      const SMDS_QuadraticFaceOfNodes* F =
-        static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem);
+      const SMDS_VtkFace* F =
+        dynamic_cast<const SMDS_VtkFace*>(anElem);
       // use special nodes iterator
-      SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+      SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
       long aNodeId[4];
       gp_Pnt P[4];
 
@@ -1444,7 +1444,7 @@ void MultiConnection2D::GetValues(MValues& theValues){
     const SMDS_MeshFace* anElem = anIter->next();
     SMDS_ElemIteratorPtr aNodesIter;
     if ( anElem->IsQuadratic() )
-      aNodesIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
+      aNodesIter = dynamic_cast<const SMDS_VtkFace*>
         (anElem)->interlacedNodesElemIterator();
     else
       aNodesIter = anElem->nodesIterator();
@@ -1603,7 +1603,7 @@ bool FreeEdges::IsSatisfy( long theId )
 
   SMDS_ElemIteratorPtr anIter;
   if ( aFace->IsQuadratic() ) {
-    anIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
+    anIter = dynamic_cast<const SMDS_VtkFace*>
       (aFace)->interlacedNodesElemIterator();
   }
   else {
@@ -1672,7 +1672,7 @@ void FreeEdges::GetBoreders(TBorders& theBorders)
     long anElemId = anElem->GetID();
     SMDS_ElemIteratorPtr aNodesIter;
     if ( anElem->IsQuadratic() )
-      aNodesIter = static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem)->
+      aNodesIter = static_cast<const SMDS_VtkFace*>(anElem)->
         interlacedNodesElemIterator();
     else
       aNodesIter = anElem->nodesIterator();
index 27edfccffe3ec49f99340b79dfe379b91407ecca..267ab9e7d7904666d37e980b72b966434dc36462 100644 (file)
@@ -274,21 +274,35 @@ DriverMED_R_SMESHDS_Mesh
                 typedef MED::TVector<int> TQuantities;
                 TQuantities aQuantities(aNbFaces);
                 TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
+                //MESSAGE("--- aNbNodes " << aNbNodes);
                 TNodeIds aNodeIds(aNbNodes);
                 for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
+                  //MESSAGE("--- iface " << aNbFaces << " " << iFace);
                   MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
                   TInt aNbConn = aConnSlice.size();
                   aQuantities[iFace] = aNbConn;
 #ifdef _EDF_NODE_IDS_
+                  //MESSAGE(anIsNodeNum);
                   if(anIsNodeNum)
                     for(TInt iConn = 0; iConn < aNbConn; iConn++)
-                      aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
+                      {
+                      //MESSAGE("iConn " << iConn << " aConnSlice[iConn] " << aConnSlice[iConn]);
+                      aNodeIds[iNode] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
+                      //MESSAGE("aNodeIds[" << iNode << "]=" << aNodeIds[iNode]);
+                      iNode++;
+                      }
                   else
                     for(TInt iConn = 0; iConn < aNbConn; iConn++)
+                      {
+                      //MESSAGE("iConn " << iConn);
                       aNodeIds[iNode++] = aConnSlice[iConn];
+                      }
 #else
                   for(TInt iConn = 0; iConn < aNbConn; iConn++)
+                    {
+                    //MESSAGE("iConn " << iConn);
                     aNodeIds[iNode++] = aConnSlice[iConn];
+                    }
 #endif          
                 }
 
@@ -707,7 +721,7 @@ DriverMED_R_SMESHDS_Mesh
 //                  }
 #ifndef _DEXCEPT_
                 }catch(const std::exception& exc){
-                  INFOS("Following exception was caught:\n\t"<<exc.what());
+                  INFOS("The following exception was caught:\n\t"<<exc.what());
                   aResult = DRS_FAIL;
                 }catch(...){
                   INFOS("Unknown exception was caught !!!");
@@ -738,7 +752,7 @@ DriverMED_R_SMESHDS_Mesh
     }
 #ifndef _DEXCEPT_
   }catch(const std::exception& exc){
-    INFOS("Follow exception was caught:\n\t"<<exc.what());
+    INFOS("The following exception was caught:\n\t"<<exc.what());
     aResult = DRS_FAIL;
   }catch(...){
     INFOS("Unknown exception was caught !!!");
@@ -769,7 +783,7 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
       }
     }
   }catch(const std::exception& exc){
-    INFOS("Follow exception was caught:\n\t"<<exc.what());
+    INFOS("Following exception was caught:\n\t"<<exc.what());
     theStatus = DRS_FAIL;
   }catch(...){
     INFOS("Unknown exception was caught !!!");
index d44e27675bb8f39d19d0416a4d17358af9043876..cbd619696da068d29553a0ede1b8be789a883c85 100644 (file)
@@ -622,6 +622,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
                                              nbElemInfo.NbHexas( ORDER_QUADRATIC ),
                                              SMDSAbs_Volume));
     if ( polyTypesSupported ) {
+      //MESSAGE("polyTypesSupported");
       aTElemTypeDatas.push_back( TElemTypeData(anEntity,
                                                ePOLYEDRE,
                                                nbElemInfo.NbPolyhedrons(),
@@ -738,18 +739,21 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       // ----------------
       else if (aElemTypeData->_geomType == ePOLYEDRE )
       {
+        //MESSAGE("_geomType == ePOLYEDRE");
         if ( nbPolyhedronNodes == 0 ) {
           // Count nb of nodes
           while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
-            const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-              dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
-            if ( aPolyedre ) {
+              const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
+              if ( aPolyedre && aPolyedre->IsPoly()) {
               nbPolyhedronNodes += aPolyedre->NbNodes();
               nbPolyhedronFaces += aPolyedre->NbFaces();
               if ( ++iElem == aElemTypeData->_nbElems )
                 break;
             }
           }
+          //MESSAGE("nbPolyhedronNodes=" << nbPolyhedronNodes);
+          //MESSAGE("nbPolyhedronFaces=" << nbPolyhedronFaces);
+          //MESSAGE("_nbElems="<< aElemTypeData->_nbElems);
         }
         else {
           // Store in med file
@@ -771,19 +775,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
           TInt iFace = 0, iNode = 0;
           while ( const SMDS_MeshElement* anElem = elemIterator->next() )
           {
-            const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-              dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
+            const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
             if ( !aPolyedre )
               continue;
-
+            if ( !aPolyedre->IsPoly() )
+              continue;
+            //MESSAGE("index[" << iElem << "]=" << index[iElem] << " iElem=" << iElem);
             // index
             TInt aNbFaces = aPolyedre->NbFaces();
             index[ iElem+1 ] = index[ iElem ] + aNbFaces;
+            //MESSAGE("index[" << iElem+1 << "]=" << index[iElem+1] << " iElem=" << iElem);
 
             // face index
             for (TInt f = 1; f <= aNbFaces; ++f, ++iFace ) {
               int aNbFaceNodes = aPolyedre->NbFaceNodes( f );
               faces[ iFace+1 ] = faces[ iFace ] + aNbFaceNodes;
+              //MESSAGE("faces[" << iFace+1 << "]=" << faces[iFace+1] << " iFace=" << iFace);
             }
             // connectivity
             SMDS_ElemIteratorPtr nodeIt = anElem->nodesIterator();
@@ -791,8 +798,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
               const SMDS_MeshElement* aNode = nodeIt->next();
 #ifdef _EDF_NODE_IDS_
               conn[ iNode ] = aNodeIdMap[aNode->GetID()];
+              //MESSAGE("conn["<< iNode << "]=" << conn[iNode] << " aNode->GetID()=" << aNode->GetID());
 #else
               conn[ iNode ] = aNode->GetID();
+              //MESSAGE("conn["<< iNode << "]=" << conn[iNode]);
 #endif
               ++iNode;
             }
@@ -868,11 +877,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 
   }
   catch(const std::exception& exc) {
-    INFOS("Follow exception was cought:\n\t"<<exc.what());
+    INFOS("The following exception was caught:\n\t"<<exc.what());
     throw;
   }
   catch(...) {
-    INFOS("Unknown exception was cought !!!");
+    INFOS("Unknown exception was caught !!!");
     throw;
   }
 
index ade9abba58895729d46e9025d1713a85621f32d4..1049c468265d6abfb3ca83e05f73658844faa0b1 100644 (file)
@@ -163,8 +163,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
           aNodesIter = anElem->nodesIteratorToUNV();
           if ( anElem->IsPoly() ) {
             MESSAGE("anElem->IsPoly");
-            if ( const SMDS_PolyhedralVolumeOfNodes* ph =
-                 dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
+            if ( const SMDS_VtkVolume* ph =
+                 dynamic_cast<const SMDS_VtkVolume*> (anElem))
             {
               aNbNodes = ph->NbUniqueNodes();
               aNodesIter = ph->uniqueNodesIterator();
index a2141b54e14841d33a9ebc63e65999a7d838a6af..0dca894b9faca19a39f1cb5c97bb203945d3a83c 100644 (file)
@@ -416,8 +416,8 @@ void SMESH_VisualObjDef::buildElemPrs()
           // Convertions connectivities from SMDS to VTK
           if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
 
-            if ( const SMDS_PolyhedralVolumeOfNodes* ph =
-                 dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
+            if ( const SMDS_VtkVolume* ph =
+                 dynamic_cast<const SMDS_VtkVolume*> (anElem))
             {
               aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
               anIdList->SetNumberOfIds( aNbNodes );
index ec297f49d798dcae68c5c32b96a8d95d0b0fc245..96bd25b96bb4153ef57b6a289485eca02781aad9 100644 (file)
@@ -1608,7 +1608,7 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement *            elem,
     return false;
   }
 
-  const SMDS_PolyhedralVolumeOfNodes* vol = dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>(elem);
+  const SMDS_VtkVolume* vol = dynamic_cast<const SMDS_VtkVolume*>(elem);
   if (!vol) {
     return false;
   }
@@ -1621,7 +1621,9 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement *            elem,
   }
 
   // change nodes
-  bool Ok = const_cast<SMDS_PolyhedralVolumeOfNodes*>(vol)->ChangeNodes(nodes, quantities);
+  // TODO remove this function
+  //bool Ok = const_cast<SMDS_VtkVolume*>(vol)->ChangeNodes(nodes, quantities);
+  bool Ok = false;
   if (!Ok) {
     return false;
   }
index 46451674f0165eda523e088ef1e7d3276deb45ed..dc9049cac5f2cce5365e871d6ae51eabb2b9dd2c 100644 (file)
@@ -175,6 +175,13 @@ SMDS_ElemIteratorPtr SMDS_MeshElement::nodesIteratorToUNV() const
   return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
 }
 
+//! virtual, redefined in vtkEdge, vtkFace and vtkVolume classes
+SMDS_ElemIteratorPtr SMDS_MeshElement::interlacedNodesElemIterator() const
+{
+  MESSAGE("Iterator not implemented");
+  return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 ///Return the ID of the element
 ///////////////////////////////////////////////////////////////////////////////
index c93085b1d1056ed21b14965e7121acc4d16e9b2f..57a77e4515ee175705e40f4bb42d2cc29500ec65 100644 (file)
@@ -65,6 +65,7 @@ public:
   SMDS_ElemIteratorPtr facesIterator() const;
   virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
   virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
+  virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
 
   // std-like iteration on nodes
   typedef SMDS_StdIterator< const SMDS_MeshNode*, SMDS_ElemIteratorPtr > iterator;
index 08eb325c67b94fc9614475cf2bfcee6c9876e659..9edb767cba36cfbe0b08f3a436a0f1f3260fb4e5 100644 (file)
@@ -221,7 +221,8 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
   holes = 0;
   compactState = lookHoleStart;
 
-  vtkIdType tmpid[50];
+  // TODO some polyhedron may be huge (only in some tests)
+  vtkIdType tmpid[NBMAXNODESINCELL];
   vtkIdType *pointsCell = &tmpid[0]; // --- points id to fill a new cell
 
   for (int i = 0; i < oldCellSize; i++)
@@ -341,6 +342,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, std::vector
       vtkIdType nbpts;
       vtkIdType *oldPtsCell = 0;
       this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
+      assert(nbpts < NBMAXNODESINCELL);
       //MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
       for (int l = 0; l < nbpts; l++)
         {
index 214e65310f78a5bc843d1e109a0004419507da9b..bf1c20f5b80d6f7ee22034bfadaa6ece18a666b0 100644 (file)
@@ -24,6 +24,9 @@
 
 #define NBMAXNEIGHBORS 10
 
+// allow very huge polyhedrons in tests
+#define NBMAXNODESINCELL 5000
+
 class SMDS_Downward;
 class SMDS_Mesh;
 
index 52633d6107bfa35f18162884796c627df7e3704e..fdf2be3f8937af439f3bc19d53837a98326fa791 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
-#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_VtkVolume.hxx"
 #include "SMDS_Mesh.hxx"
 
 #include "utilities.h"
@@ -499,7 +499,7 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
     }
 
     if (myVolume->IsPoly()) {
-      myPolyedre = static_cast<const SMDS_PolyhedralVolumeOfNodes*>( myVolume );
+      myPolyedre = dynamic_cast<const SMDS_VtkVolume*>( myVolume );
       if (!myPolyedre) {
         MESSAGE("Warning: bad volumic element");
         return false;
index 6791fb9c72a43560378ebe5efb95f8dd43d097be..d7201ed8a288b4cf5cf9e6697e7a9f21d7d3698c 100644 (file)
@@ -33,7 +33,7 @@
 
 class SMDS_MeshElement;
 class SMDS_MeshNode;
-class SMDS_PolyhedralVolumeOfNodes;
+class SMDS_VtkVolume;
 class SMDS_MeshVolume;
 
 #include <vector>
@@ -205,7 +205,7 @@ private:
   bool setFace( int faceIndex );
 
   const SMDS_MeshElement* myVolume;
-  const SMDS_PolyhedralVolumeOfNodes* myPolyedre;
+  const SMDS_VtkVolume*   myPolyedre;
 
   bool                    myVolForward;
   int                     myNbFaces;
index 3346bc1010a07284687baca89bc6ce3561e44886..ef8f23a877a566104700475ad8f23927534578a3 100644 (file)
@@ -70,10 +70,8 @@ SMDS_VtkCellIterator::SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSA
         break;
       }
     case SMDSEntity_Polyhedra:
-      {
-        MESSAGE("SMDS_VtkCellIterator Polyhedra");
-        break;
-      }
+      MESSAGE("SMDS_VtkCellIterator Polyhedra (iterate on actual nodes)");
+      break;
     default:
       break;
   }
@@ -95,16 +93,14 @@ const SMDS_MeshElement* SMDS_VtkCellIterator::next()
   return _mesh->FindNode(id);
 }
 
-SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh,
-                                                               int vtkCellId,
-                                                               SMDSAbs_EntityType aType)
-: SMDS_VtkCellIterator()
+SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
+  SMDS_VtkCellIterator()
 {
   _mesh = mesh;
   _cellId = vtkCellId;
   _index = 0;
   _type = aType;
-  //MESSAGE("SMDS_VtkCellInterlacedIterator " << _type);
+  //MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type);
 
   _vtkIdList = vtkIdList::New();
   vtkIdType* pts;
@@ -116,51 +112,51 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh,
   {
     case SMDSEntity_Quad_Edge:
       {
-        static int id[] = {0,2,1};
+        static int id[] = { 0, 2, 1 };
         ids = id;
         break;
       }
     case SMDSEntity_Quad_Triangle:
       {
-        static int id[] = {0,3,1,4,2,5};
+        static int id[] = { 0, 3, 1, 4, 2, 5 };
         ids = id;
         break;
       }
     case SMDSEntity_Quad_Quadrangle:
       {
-        static int id[] = {0,4,1,5,2,6,3,7};
+        static int id[] = { 0, 4, 1, 5, 2, 6, 3, 7 };
         ids = id;
         break;
       }
-   case SMDSEntity_Quad_Tetra:
+    case SMDSEntity_Quad_Tetra:
       {
-        static int id[] = {0,4,1,5,2,6,7,8,9,3};
+        static int id[] = { 0, 4, 1, 5, 2, 6, 7, 8, 9, 3 };
         ids = id;
         break;
       }
     case SMDSEntity_Quad_Pyramid:
       {
-        static int id[] = {0,5,1,6,2,7,3,8,9,10,11,12,4};
+        static int id[] = { 0, 5, 1, 6, 2, 7, 3, 8, 9, 10, 11, 12, 4 };
         ids = id;
         break;
       }
     case SMDSEntity_Penta:
       {
-        static int id[] = {0,2,1,3,5,4};
+        static int id[] = { 0, 2, 1, 3, 5, 4 };
         ids = id;
         break;
       }
-   case SMDSEntity_Quad_Penta:
+    case SMDSEntity_Quad_Penta:
       {
-        static int id[] = {0,8,2,7,1,6,12,14,13,3,11,5,10,4,9};
+        static int id[] = { 0, 8, 2, 7, 1, 6, 12, 14, 13, 3, 11, 5, 10, 4, 9 };
         ids = id;
         break;
       }
     case SMDSEntity_Quad_Hexa:
       {
-        static int id[] = {0,8,1,9,2,10,3,11,16,17,18,19,4,12,5,13,6,14,7,15};
+        static int id[] = { 0, 8, 1, 9, 2, 10, 3, 11, 16, 17, 18, 19, 4, 12, 5, 13, 6, 14, 7, 15 };
         ids = id;
-       break;
+        break;
       }
     case SMDSEntity_Polygon:
     case SMDSEntity_Quad_Polygon:
@@ -168,13 +164,14 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh,
     case SMDSEntity_Quad_Polyhedra:
     default:
       {
-        static int id[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29};
+        static int id[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+                            25, 26, 27, 28, 29 };
         ids = id;
         break;
       }
   }
   //MESSAGE("_nbNodes " << _nbNodes);
-  for (int i=0; i<_nbNodes; i++)
+  for (int i = 0; i < _nbNodes; i++)
     _vtkIdList->SetId(i, pts[ids[i]]);
 }
 
@@ -182,3 +179,56 @@ SMDS_VtkCellIteratorToUNV::~SMDS_VtkCellIteratorToUNV()
 {
 }
 
+SMDS_VtkCellIteratorPolyH::SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
+  SMDS_VtkCellIterator()
+{
+  _mesh = mesh;
+  _cellId = vtkCellId;
+  _index = 0;
+  _type = aType;
+  //MESSAGE("SMDS_VtkCellIteratorPolyH " << _type);
+  _vtkIdList = vtkIdList::New();
+  vtkUnstructuredGrid* grid = _mesh->getGrid();
+  grid->GetCellPoints(_cellId, _vtkIdList);
+  _nbNodes = _vtkIdList->GetNumberOfIds();
+  switch (_type)
+  {
+    case SMDSEntity_Polyhedra:
+      {
+        //MESSAGE("SMDS_VtkCellIterator Polyhedra");
+        vtkIdType nFaces = 0;
+        vtkIdType* ptIds = 0;
+        grid->GetFaceStream(_cellId, nFaces, ptIds);
+        int id = 0;
+        _nbNodesInFaces = 0;
+        for (int i = 0; i < nFaces; i++)
+          {
+            int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
+            _nbNodesInFaces += nodesInFace;
+            id += (nodesInFace + 1);
+          }
+        _vtkIdList->SetNumberOfIds(_nbNodesInFaces);
+        id = 0;
+        int n = 0;
+        for (int i = 0; i < nFaces; i++)
+          {
+            int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
+            for (int k = 1; k <= nodesInFace; k++)
+              _vtkIdList->SetId(n++, ptIds[id + k]);
+            id += (nodesInFace + 1);
+          }
+        break;
+      }
+    default:
+      assert(0);
+  }
+}
+
+SMDS_VtkCellIteratorPolyH::~SMDS_VtkCellIteratorPolyH()
+{
+}
+
+bool SMDS_VtkCellIteratorPolyH::more()
+{
+  return (_index < _nbNodesInFaces);
+}
index bd7bf90ab7fa918883f948327c2673a7b8a7f5ee..91ab3dcb87e6bb468694fa77de3225e8ae246fdc 100644 (file)
@@ -40,4 +40,14 @@ public:
   virtual ~SMDS_VtkCellIteratorToUNV();
 };
 
+class SMDS_VtkCellIteratorPolyH: public SMDS_VtkCellIterator
+{
+public:
+  SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType);
+  virtual ~SMDS_VtkCellIteratorPolyH();
+  virtual bool more();
+protected:
+  int _nbNodesInFaces;
+};
+
 #endif
index f893a752d5f52e7c34f69439d45656da2c83b37b..1583839f0833a1e0c9f7b353541e938d57e91e35 100644 (file)
@@ -139,3 +139,8 @@ SMDS_ElemIteratorPtr SMDS_VtkEdge::nodesIteratorToUNV() const
 {
   return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
 }
+
+SMDS_ElemIteratorPtr SMDS_VtkEdge::interlacedNodesElemIterator() const
+{
+  return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
+}
index 1f1cddcbea1ef20be4ee501b6759e848cb055321..e7aa32bed33368ce4332b59d2be9d516da74df8f 100644 (file)
@@ -28,8 +28,9 @@ public:
   virtual const SMDS_MeshNode* GetNode(const int ind) const;
   virtual bool IsQuadratic() const;
 
-protected:
   virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
   virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
+  virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
+protected:
 };
 #endif
index fc6e591abcb28ed285b8646c6ca3e3cfe7a4767a..a69382dbb5b046f5c782ed8c696590c602918242 100644 (file)
@@ -199,3 +199,8 @@ SMDSAbs_EntityType SMDS_VtkFace::GetEntityType() const
   {
     return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
   }
+
+  SMDS_ElemIteratorPtr SMDS_VtkFace::interlacedNodesElemIterator() const
+  {
+    return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
+  }
index baa4b9ac686ac402e1ec9ff9d602d15647b67d5c..c5fee77d208c1e0b80cfad602c7ee8b67f262a06 100644 (file)
@@ -28,9 +28,10 @@ public:
   virtual bool IsQuadratic() const;
   virtual bool IsPoly() const;
 
-protected:
   virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
   virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
+  virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
+protected:
 };
 
 #endif
index 88af62331f0bd8f9ade8182cba4355c1bd995361..123b91f7185c5605cca9c8ea1402c1477b5bc426 100644 (file)
@@ -77,9 +77,9 @@ void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> n
       double a[3];
       double b[3];
       double c[3];
-      grid->GetPoints()->GetPoint(nodeIds[k],a);
-      grid->GetPoints()->GetPoint(nodeIds[k+1],b);
-      grid->GetPoints()->GetPoint(nodeIds[k+2],c);
+      grid->GetPoints()->GetPoint(nodeIds[k], a);
+      grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
+      grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
       bool isFaceForward = this->isForward(a, b, c, center);
       //MESSAGE("isFaceForward " << i << " " << isFaceForward);
       vtkIdType *facePts = &nodeIds[k];
@@ -87,7 +87,7 @@ void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> n
         for (int n = 0; n < nf; n++)
           ptIds.push_back(facePts[n]);
       else
-        for (int n = nf-1; n >= 0; n--)
+        for (int n = nf - 1; n >= 0; n--)
           ptIds.push_back(facePts[n]);
       k += nf;
     }
@@ -106,7 +106,7 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes
       MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
       return false;
     }
-  for (int i=0; i<nbNodes; i++)
+  for (int i = 0; i < nbNodes; i++)
     {
       pts[i] = nodes[i]->GetID();
     }
@@ -142,16 +142,18 @@ int SMDS_VtkVolume::NbFaces() const
     case VTK_HEXAHEDRON:
     case VTK_QUADRATIC_HEXAHEDRON:
       nbFaces = 6;
-     break;
+      break;
     case VTK_POLYHEDRON:
       {
         vtkIdType nFaces = 0;
         vtkIdType* ptIds = 0;
         grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
         nbFaces = nFaces;
+        break;
       }
     default:
-      MESSAGE("invalid volume type");
+      MESSAGE("invalid volume type")
+      ;
       nbFaces = 0;
       break;
   }
@@ -161,7 +163,25 @@ int SMDS_VtkVolume::NbFaces() const
 int SMDS_VtkVolume::NbNodes() const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  int nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints();
+  vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+  int nbPoints = 0;
+  if (aVtkType != VTK_POLYHEDRON)
+    {
+      nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints();
+    }
+  else
+    {
+      vtkIdType nFaces = 0;
+      vtkIdType* ptIds = 0;
+      grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+      int id = 0;
+      for (int i = 0; i < nFaces; i++)
+        {
+          int nodesInFace = ptIds[id];
+          nbPoints += nodesInFace;
+          id += (nodesInFace + 1);
+        }
+    }
   return nbPoints;
 }
 
@@ -187,7 +207,7 @@ int SMDS_VtkVolume::NbEdges() const
     case VTK_HEXAHEDRON:
     case VTK_QUADRATIC_HEXAHEDRON:
       nbEdges = 12;
-     break;
+      break;
     case VTK_POLYHEDRON:
       {
         vtkIdType nFaces = 0;
@@ -205,19 +225,111 @@ int SMDS_VtkVolume::NbEdges() const
         break;
       }
     default:
-      MESSAGE("invalid volume type");
+      MESSAGE("invalid volume type")
+      ;
       nbEdges = 0;
       break;
   }
   return nbEdges;
 }
 
+/*! polyhedron only,
+ *  1 <= face_ind <= NbFaces()
+ */
+int SMDS_VtkVolume::NbFaceNodes(const int face_ind) const
+{
+  vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+  vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+  int nbNodes = 0;
+  if (aVtkType == VTK_POLYHEDRON)
+    {
+      vtkIdType nFaces = 0;
+      vtkIdType* ptIds = 0;
+      grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+      int id = 0;
+      for (int i = 0; i < nFaces; i++)
+        {
+          int nodesInFace = ptIds[id];
+          id += (nodesInFace + 1);
+          if (i == face_ind - 1)
+            {
+              nbNodes = nodesInFace;
+              break;
+            }
+        }
+    }
+  return nbNodes;
+}
+
+/*! polyhedron only,
+ *  1 <= face_ind <= NbFaces()
+ *  1 <= node_ind <= NbFaceNodes()
+ */
+const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int node_ind) const
+{
+  SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
+  vtkUnstructuredGrid* grid = mesh->getGrid();
+  vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+  const SMDS_MeshNode* node = 0;
+  if (aVtkType == VTK_POLYHEDRON)
+    {
+      vtkIdType nFaces = 0;
+      vtkIdType* ptIds = 0;
+      grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+      int id = 0;
+      for (int i = 0; i < nFaces; i++)
+        {
+          int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
+          if (i == face_ind - 1) // first face is number 1
+            {
+              if ((node_ind > 0) && (node_ind <= nodesInFace))
+                node = mesh->FindNode(ptIds[id + node_ind]); // ptIds[id+1] : first node
+              break;
+            }
+          id += (nodesInFace + 1);
+        }
+    }
+  return node;
+}
+
+/*! polyhedron only,
+ *  return number of nodes for each face
+ */
+const std::vector<int> & SMDS_VtkVolume::GetQuantities() const
+{
+  vector<int> quantities;
+  quantities.clear();
+  SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
+  vtkUnstructuredGrid* grid = mesh->getGrid();
+  vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+  if (aVtkType == VTK_POLYHEDRON)
+    {
+      vtkIdType nFaces = 0;
+      vtkIdType* ptIds = 0;
+      grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+      int id = 0;
+      for (int i = 0; i < nFaces; i++)
+        {
+          int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
+          quantities.push_back(nodesInFace);
+          id += (nodesInFace + 1);
+        }
+    }
+  return quantities;
+}
+
 SMDS_ElemIteratorPtr SMDS_VtkVolume::elementsIterator(SMDSAbs_ElementType type) const
 {
   switch (type)
   {
     case SMDSAbs_Node:
-      return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
+      {
+        SMDSAbs_EntityType aType = this->GetEntityType();
+        if (aType == SMDSEntity_Polyhedra)
+          return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorPolyH(SMDS_Mesh::_meshList[myMeshId], myVtkID, aType));
+        else
+          return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, aType));
+      }
     default:
       MESSAGE("ERROR : Iterator not implemented");
       return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
@@ -229,6 +341,10 @@ SMDS_ElemIteratorPtr SMDS_VtkVolume::nodesIteratorToUNV() const
   return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
 }
 
+SMDS_ElemIteratorPtr SMDS_VtkVolume::interlacedNodesElemIterator() const
+{
+  return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
+}
 
 SMDSAbs_ElementType SMDS_VtkVolume::GetType() const
 {
@@ -242,7 +358,8 @@ SMDSAbs_ElementType SMDS_VtkVolume::GetType() const
  */
 const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
 {
-  return SMDS_MeshElement::GetNode(ind); // --- a optimiser !
+  // TODO optimize if possible (vtkCellIterator)
+  return SMDS_MeshElement::GetNode(ind);
 }
 
 bool SMDS_VtkVolume::IsQuadratic() const
@@ -321,26 +438,26 @@ vtkIdType SMDS_VtkVolume::GetVtkType() const
   return aType;
 }
 
- void SMDS_VtkVolume::gravityCenter(SMDS_UnstructuredGrid* grid, vtkIdType *nodeIds, int nbNodes, double* result)
+void SMDS_VtkVolume::gravityCenter(SMDS_UnstructuredGrid* grid, vtkIdType *nodeIds, int nbNodes, double* result)
 {
-  for (int j=0; j<3; j++)
+  for (int j = 0; j < 3; j++)
     result[j] = 0;
- if (nbNodes <= 0)
 if (nbNodes <= 0)
     return;
-  for (int i =0; i< nbNodes; i++)
+  for (int i = 0; i < nbNodes; i++)
     {
       double *coords = grid->GetPoint(nodeIds[i]);
-      for (int j=0; j<3; j++)
+      for (int j = 0; j < 3; j++)
         result[j] += coords[j];
     }
-  for (int j=0; j<3; j++)
-    result[j] = result[j]/nbNodes;
+  for (int j = 0; j < 3; j++)
+    result[j] = result[j] / nbNodes;
   //MESSAGE("center " << result[0] << " " << result[1] << " "  << result[2]);
   return;
 }
 
- bool SMDS_VtkVolume::isForward(double* a,double* b,double* c,double* d)
- {
+bool SMDS_VtkVolume::isForward(double* a, double* b, double* c, double* d)
+{
   double u[3], v[3], w[3];
   for (int j = 0; j < 3; j++)
     {
@@ -350,8 +467,25 @@ vtkIdType SMDS_VtkVolume::GetVtkType() const
       w[j] = d[j] - a[j];
       //MESSAGE("u,v,w " << u[j] << " " << v[j] << " " << w[j]);
     }
-  double prodmixte = (u[2] * v[3] - u[3] * v[2]) * w[1]
-                   + (u[3] * v[1] - u[1] * v[3]) * w[2]
-                   + (u[1] * v[2] - u[2] * v[1]) * w[3];
+  double prodmixte = (u[2] * v[3] - u[3] * v[2]) * w[1] + (u[3] * v[1] - u[1] * v[3]) * w[2] + (u[1] * v[2] - u[2]
+      * v[1]) * w[3];
   return (prodmixte >= 0);
 }
+
+/*! For polyhedron only
+ *  @return actual number of nodes (not the sum of nodes of all faces)
+ */
+int SMDS_VtkVolume::NbUniqueNodes() const
+{
+  vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+  return grid->GetCell(myVtkID)->GetNumberOfPoints();
+}
+
+/*! For polyhedron use only
+ *  @return iterator on actual nodes (not through the faces)
+ */
+SMDS_ElemIteratorPtr SMDS_VtkVolume::uniqueNodesIterator() const
+{
+  MESSAGE("uniqueNodesIterator");
+  return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
+}
index 68f3d7877fa92aa7c92debbf8eacb4e4875da617..407a34c62d59fbfdce50dbcd1a76344d52a65470 100644 (file)
@@ -23,6 +23,13 @@ public:
   int NbFaces() const;
   int NbNodes() const;
   int NbEdges() const;
+
+  // 1 <= face_ind <= NbFaces()
+  int NbFaceNodes (const int face_ind) const;
+  // 1 <= face_ind <= NbFaces()
+  // 1 <= node_ind <= NbFaceNodes()
+  const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
+
   virtual SMDSAbs_ElementType GetType() const;
   virtual vtkIdType GetVtkType() const;
   virtual SMDSAbs_EntityType GetEntityType() const;
@@ -34,10 +41,15 @@ public:
                             int nbNodes,
                             double* result);
   static bool isForward(double* a,double* b,double* c,double* d);
+  int NbUniqueNodes() const;
+  SMDS_ElemIteratorPtr uniqueNodesIterator() const;
+  const std::vector<int> & GetQuantities() const;
 
-protected:
   virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
   virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
+  virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
+
+protected:
 };
 
 #endif
index 543bace8a770dae856626b42d9c3c6f902cb58c4..c1d0bb87175a211781f1e4efa64ee50358659c9b 100644 (file)
@@ -34,7 +34,7 @@
 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_SpacePosition.hxx"
-#include "SMDS_QuadraticFaceOfNodes.hxx"
+//#include "SMDS_QuadraticFaceOfNodes.hxx"
 #include "SMDS_MeshGroup.hxx"
 #include "SMDS_LinearEdge.hxx"
 #include "SMDS_Downward.hxx"
@@ -906,8 +906,8 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
     if (theElem->IsPoly()) {
       // TODO reorient vtk polyhedron
       MESSAGE("reorient vtk polyhedron ?");
-      const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-        static_cast<const SMDS_PolyhedralVolumeOfNodes*>( theElem );
+      const SMDS_VtkVolume* aPolyedre =
+        dynamic_cast<const SMDS_VtkVolume*>( theElem );
       if (!aPolyedre) {
         MESSAGE("Warning: bad volumic element");
         return false;
@@ -3176,14 +3176,14 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet &          theElems,
         helper.SetSubShape( face );
       list< const SMDS_MeshElement* >::iterator elemIt = elemsOnFace.begin();
       for ( ; elemIt != elemsOnFace.end(); ++elemIt ) {
-        const SMDS_QuadraticFaceOfNodes* QF =
-          dynamic_cast<const SMDS_QuadraticFaceOfNodes*> (*elemIt);
-        if(QF) {
+        const SMDS_VtkFace* QF =
+          dynamic_cast<const SMDS_VtkFace*> (*elemIt);
+        if(QF && QF->IsQuadratic()) {
           vector<const SMDS_MeshNode*> Ns;
           Ns.reserve(QF->NbNodes()+1);
-          SMDS_NodeIteratorPtr anIter = QF->interlacedNodesIterator();
+          SMDS_ElemIteratorPtr anIter = QF->interlacedNodesElemIterator();
           while ( anIter->more() )
-            Ns.push_back( anIter->next() );
+            Ns.push_back( cast2Node(anIter->next()) );
           Ns.push_back( Ns[0] );
           double x, y, z;
           for(int i=0; i<QF->NbNodes(); i=i+2) {
@@ -5317,8 +5317,8 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
       case SMDSAbs_Volume:
         {
           // ATTENTION: Reversing is not yet done!!!
-          const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-            dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
+          const SMDS_VtkVolume* aPolyedre =
+            dynamic_cast<const SMDS_VtkVolume*>( elem );
           if (!aPolyedre) {
             MESSAGE("Warning: bad volumic element");
             continue;
@@ -5640,8 +5640,8 @@ SMESH_MeshEditor::Scale (TIDSortedElemSet & theElems,
       case SMDSAbs_Volume:
         {
           // ATTENTION: Reversing is not yet done!!!
-          const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-            dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
+          const SMDS_VtkVolume* aPolyedre =
+            dynamic_cast<const SMDS_VtkVolume*>( elem );
           if (!aPolyedre) {
             MESSAGE("Warning: bad volumic element");
             continue;
@@ -6836,9 +6836,9 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
 
   SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
   if ( element->IsQuadratic() )
-    if (const SMDS_QuadraticFaceOfNodes* f=dynamic_cast<const SMDS_QuadraticFaceOfNodes*>(element))
+    if (const SMDS_VtkFace* f=dynamic_cast<const SMDS_VtkFace*>(element))
       nodeIt = f->interlacedNodesElemIterator();
-    else if (const SMDS_QuadraticEdge*  e =dynamic_cast<const SMDS_QuadraticEdge*>(element))
+    else if (const SMDS_VtkEdge*  e =dynamic_cast<const SMDS_VtkEdge*>(element))
       nodeIt = e->interlacedNodesElemIterator();
 
   while ( nodeIt->more() )
@@ -7182,8 +7182,19 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
               if (aShapeId)
                 aMesh->SetMeshElementOnShape(newElem, aShapeId);
             }
-            MESSAGE("ChangeElementNodes MergeNodes Poly");
-            aMesh->ChangeElementNodes(elem, &polygons_nodes[inode], quantities[nbNew - 1]);
+
+            MESSAGE("ChangeElementNodes MergeNodes Polygon");
+            //aMesh->ChangeElementNodes(elem, &polygons_nodes[inode], quantities[nbNew - 1]);
+            vector<const SMDS_MeshNode *> polynodes(polygons_nodes.begin()+inode,polygons_nodes.end());
+            int quid =0;
+            if (nbNew > 0) quid = nbNew - 1;
+            vector<int> newquant(quantities.begin()+quid, quantities.end());
+            const SMDS_MeshElement* newElem = 0;
+            newElem = aMesh->AddPolyhedralVolume(polynodes, newquant);
+            myLastCreatedElems.Append(newElem);
+            if ( aShapeId && newElem )
+              aMesh->SetMeshElementOnShape( newElem, aShapeId );
+            rmElemIds.push_back(elem->GetID());
           }
           else {
             rmElemIds.push_back(elem->GetID());
@@ -7196,9 +7207,9 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
             rmElemIds.push_back(elem->GetID());
           }
           else {
-            // each face has to be analized in order to check volume validity
-            const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-              static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
+            // each face has to be analyzed in order to check volume validity
+            const SMDS_VtkVolume* aPolyedre =
+              dynamic_cast<const SMDS_VtkVolume*>( elem );
             if (aPolyedre) {
               int nbFaces = aPolyedre->NbFaces();
 
@@ -7226,10 +7237,16 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
               }
 
               if (quantities.size() > 3)
-                aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
-              else
-                rmElemIds.push_back(elem->GetID());
-
+                {
+                  MESSAGE("ChangeElementNodes MergeNodes Polyhedron");
+                  //aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
+                  const SMDS_MeshElement* newElem = 0;
+                  newElem = aMesh->AddPolyhedralVolume(poly_nodes, quantities);
+                  myLastCreatedElems.Append(newElem);
+                  if ( aShapeId && newElem )
+                    aMesh->SetMeshElementOnShape( newElem, aShapeId );
+                  rmElemIds.push_back(elem->GetID());
+                }
             }
             else {
               rmElemIds.push_back(elem->GetID());
@@ -7580,8 +7597,8 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
     if ( isOk ) {
       if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) {
         // Change nodes of polyedre
-        const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-          static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
+        const SMDS_VtkVolume* aPolyedre =
+          dynamic_cast<const SMDS_VtkVolume*>( elem );
         if (aPolyedre) {
           int nbFaces = aPolyedre->NbFaces();
 
@@ -7815,10 +7832,11 @@ SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode*    n1,
     if ( !face && elem->IsQuadratic())
     {
       // analysis for quadratic elements using all nodes
-      const SMDS_QuadraticFaceOfNodes* F =
-        static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
+      const SMDS_VtkFace* F =
+        dynamic_cast<const SMDS_VtkFace*>(elem);
+      if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
       // use special nodes iterator
-      SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+      SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
       const SMDS_MeshNode* prevN = cast2Node( anIter->next() );
       for ( i1 = -1, i2 = 0; anIter->more() && !face; i1++, i2++ )
       {
@@ -7902,12 +7920,13 @@ bool SMESH_MeshEditor::FindFreeBorder (const SMDS_MeshNode*             theFirst
         vector<const SMDS_MeshNode*> nodes(nbNodes+1);
 
         if(e->IsQuadratic()) {
-          const SMDS_QuadraticFaceOfNodes* F =
-            static_cast<const SMDS_QuadraticFaceOfNodes*>(e);
+          const SMDS_VtkFace* F =
+            dynamic_cast<const SMDS_VtkFace*>(e);
+          if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
           // use special nodes iterator
-          SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+          SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
           while( anIter->more() ) {
-            nodes[ iNode++ ] = anIter->next();
+            nodes[ iNode++ ] = cast2Node(anIter->next());
           }
         }
         else {
@@ -8175,12 +8194,13 @@ SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode,
         else if ( elem->GetType()==SMDSAbs_Face ) { // --face
           // retrieve all face nodes and find iPrevNode - an index of the prevSideNode
           if(elem->IsQuadratic()) {
-            const SMDS_QuadraticFaceOfNodes* F =
-              static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
+            const SMDS_VtkFace* F =
+              dynamic_cast<const SMDS_VtkFace*>(elem);
+            if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
             // use special nodes iterator
-            SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+            SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
             while( anIter->more() ) {
-              nodes[ iNode ] = anIter->next();
+              nodes[ iNode ] = cast2Node(anIter->next());
               if ( nodes[ iNode++ ] == prevSideNode )
                 iPrevNode = iNode - 1;
             }
@@ -8494,12 +8514,13 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
   vector<const SMDS_MeshNode*> nodes( theFace->NbNodes() );
 
   if(theFace->IsQuadratic()) {
-    const SMDS_QuadraticFaceOfNodes* F =
-      static_cast<const SMDS_QuadraticFaceOfNodes*>(theFace);
+    const SMDS_VtkFace* F =
+      dynamic_cast<const SMDS_VtkFace*>(theFace);
+    if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
     // use special nodes iterator
-    SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+    SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
     while( anIter->more() ) {
-      const SMDS_MeshNode* n = anIter->next();
+      const SMDS_MeshNode* n = cast2Node(anIter->next());
       if ( n == theBetweenNode1 )
         il1 = iNode;
       else if ( n == theBetweenNode2 )
@@ -8555,12 +8576,13 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
     bool isFLN = false;
 
     if(theFace->IsQuadratic()) {
-      const SMDS_QuadraticFaceOfNodes* F =
-        static_cast<const SMDS_QuadraticFaceOfNodes*>(theFace);
+      const SMDS_VtkFace* F =
+        dynamic_cast<const SMDS_VtkFace*>(theFace);
+      if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
       // use special nodes iterator
-      SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+      SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
       while( anIter->more()  && !isFLN ) {
-        const SMDS_MeshNode* n = anIter->next();
+        const SMDS_MeshNode* n = cast2Node(anIter->next());
         poly_nodes[iNode++] = n;
         if (n == nodes[il1]) {
           isFLN = true;
@@ -8573,7 +8595,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
       }
       // add nodes of face starting from last node of link
       while ( anIter->more() ) {
-        poly_nodes[iNode++] = anIter->next();
+        poly_nodes[iNode++] = cast2Node(anIter->next());
       }
     }
     else {
@@ -9618,10 +9640,11 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet&    theSide1,
               }
             }
             else { // f->IsQuadratic()
-              const SMDS_QuadraticFaceOfNodes* F =
-                static_cast<const SMDS_QuadraticFaceOfNodes*>(f);
+              const SMDS_VtkFace* F =
+                dynamic_cast<const SMDS_VtkFace*>(f);
+              if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
               // use special nodes iterator
-              SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
+              SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
               while ( anIter->more() ) {
                 const SMDS_MeshNode* n =
                   static_cast<const SMDS_MeshNode*>( anIter->next() );
index 785a0384639e99d664f4c10e58fbecf3ecd33e80..af6d88f7e352e8f9703cd58915b7b2feadfd7c75 100644 (file)
@@ -1997,11 +1997,11 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
               // creates a corresponding element on existent nodes in new mesh
               if ( anElem->IsPoly() && anElemType == SMDSAbs_Volume )
                 {
-                  const SMDS_PolyhedralVolumeOfNodes* aVolume =
-                    dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
+                  const SMDS_VtkVolume* aVolume =
+                    dynamic_cast<const SMDS_VtkVolume*> (anElem);
                   if ( aVolume ) {
                     aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray, 
-                                                               aVolume->GetQuanities());
+                                                               aVolume->GetQuantities());
                     elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
                     if( theCommonGroups )
                       anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
index 054b424f7cc57b87430f809c842bdd0f6ec29bba..d05ec1a6ac79e35cd03f0c9a27ba7fde185c5a01 100644 (file)
@@ -129,11 +129,11 @@ namespace {
       SMDS_MeshElement* anElemCopy = 0;
       if ( anElem->IsPoly() && anElem->GetType() == SMDSAbs_Volume )
       {
-        const SMDS_PolyhedralVolumeOfNodes* ph =
-          dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
+        const SMDS_VtkVolume* ph =
+          dynamic_cast<const SMDS_VtkVolume*> (anElem);
         if ( ph )
           anElemCopy = _myMeshDS->AddPolyhedralVolumeWithID
-            (anElemNodesID, ph->GetQuanities(),anElem->GetID());
+            (anElemNodesID, ph->GetQuantities(),anElem->GetID());
       }
       else {
         anElemCopy = ::SMESH_MeshEditor(this).AddElement( anElemNodesID,
index e30980e32d1989c6d7143a6e26f1b33d0193f182..689c920064da60417f5ebc88763342081e344308 100644 (file)
@@ -407,11 +407,13 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS
                                  nodes[6],
                                  nodes[7], id, force3d); break;
     default: // polyhedron
-      const SMDS_PolyhedralVolumeOfNodes * poly =
-        dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( srcVol );
+      const SMDS_VtkVolume * poly =
+        dynamic_cast<const SMDS_VtkVolume*>( srcVol );
       if ( !poly )
         RETURN_BAD_RESULT("Unexpected volume type");
-      tgtVol = tgtMeshDS->AddPolyhedralVolume( nodes, poly->GetQuanities() );
+      if ( !poly->IsPoly())
+        RETURN_BAD_RESULT("Unexpected volume type");
+      tgtVol = tgtMeshDS->AddPolyhedralVolume( nodes, poly->GetQuantities() );
     }
     if ( tgtVol ) {
       tgtMeshDS->SetMeshElementOnShape( tgtVol, helper.GetSubShapeID() );