Salome HOME
IMP 23373: [CEA 1170] Optimization of a 3D mesh using MG-Tetra
authoreap <eap@opencascade.com>
Thu, 3 Nov 2016 15:55:09 +0000 (18:55 +0300)
committereap <eap@opencascade.com>
Thu, 3 Nov 2016 15:55:09 +0000 (18:55 +0300)
   SMESHGUI_* - treat an algo that can work w/o geom only

+ fix a crash at mesh modif just after visualization
   SMDS_* - assure that grid->Links exist before grid->InsertNextLinkedCell()

18 files changed:
resources/StdMeshers.xml.in
src/SMDS/SMDS_BallElement.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMDS/SMDS_MeshElementIDFactory.cxx
src/SMDS/SMDS_UnstructuredGrid.cxx
src/SMDS/SMDS_UnstructuredGrid.hxx
src/SMDS/SMDS_VtkEdge.cxx
src/SMDS/SMDS_VtkFace.cxx
src/SMDS/SMDS_VtkVolume.cxx
src/SMESH/SMESH_subMesh.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_XmlHandler.cxx
src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_PythonDump.hxx

index 3baade391a9f5e93d0526c346ce5e790dc37e82d..dc80071a7850640cc21bc69b2ab356ce5a86c978 100644 (file)
@@ -45,7 +45,8 @@
      input - geometry of elements accepted by algorithm input. Used to define compatible algos of
              different dimensions. Compatible algos have equal geometries in "input" and "output".
      need-hyp - (optional) Boolean. Does the algo require a hypothesis or not. Default is "false".
-     need-geom - (optional) Boolean. Can the algo work w/o geometry or not. Default is "true".
+     need-geom - (optional) [true, fasle, never]. Can the algo work w/o geometry or not.
+             Default is "true" "never" means that the algo can't work with geometry.
      support-submeshes - (optional) Boolean. Does an multi-dimensional algo support sub-meshes.
                          Default is "false".
      
index 22d2d04078c6bc70860f0c84a19e4a1e7e5377e0..8cf426a91ae87bfe0df9a046c32fd293f01205af 100644 (file)
@@ -47,10 +47,9 @@ SMDS_BallElement::SMDS_BallElement(vtkIdType nodeId, double diameter, SMDS_Mesh*
 void SMDS_BallElement::init(vtkIdType nodeId, double diameter, SMDS_Mesh* mesh)
 {
   SMDS_MeshCell::init();
-  SMDS_UnstructuredGrid* grid = mesh->getGrid();
-  myVtkID = grid->InsertNextLinkedCell( GetVtkType(), 1, &nodeId );
   myMeshId = mesh->getMeshId();
-  grid->SetBallDiameter( myVtkID, diameter );
+  myVtkID = mesh->getGrid()->InsertNextLinkedCell( GetVtkType(), 1, &nodeId );
+  mesh->getGrid()->SetBallDiameter( myVtkID, diameter );
   mesh->setMyModified();
 }
 
index c0dc013b48c6c386db4b01ee197401a022afd749..42777ffe949fc5521a60dc8a364c9cc2dc43c64f 100644 (file)
@@ -73,8 +73,8 @@ public:
   static std::vector<SMDS_Mesh*> _meshList;
 
   //! actual nodes coordinates, cells definition and reverse connectivity are stored in a vtkUnstructuredGrid
-  inline SMDS_UnstructuredGrid* getGrid() {return myGrid; }
-  inline int getMeshId() {return myMeshId; }
+  inline SMDS_UnstructuredGrid* getGrid() { return myGrid; }
+  inline int getMeshId() { return myMeshId; }
 
   virtual SMDS_NodeIteratorPtr   nodesIterator     (bool idInceasingOrder=false) const;
   virtual SMDS_EdgeIteratorPtr   edgesIterator     (bool idInceasingOrder=false) const;
index 710be521b4ad8962c9f26aa0afcfe71cef492832..a029b101ec7324ae2e8b8f6952cb6532d0318565 100644 (file)
@@ -53,33 +53,29 @@ SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
 
 int SMDS_MeshElementIDFactory::SetInVtkGrid(SMDS_MeshElement * elem)
 {
-   // --- retrieve nodes ID
+  // --- retrieve nodes ID
 
   SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
   assert(cell);
-  vector<vtkIdType> nodeIds;
+  vector<vtkIdType> nodeIds( elem->NbNodes() );
   SMDS_ElemIteratorPtr it = elem->nodesIterator();
-  while(it->more())
+  for( int i = 0; it->more(); ++i )
   {
-      int nodeId = (static_cast<const SMDS_MeshNode*>(it->next()))->getVtkId();
-      MESSAGE("   node in cell " << cell->getVtkId() << " : " << nodeId)
-      nodeIds.push_back(nodeId);
+    int nodeId = (static_cast<const SMDS_MeshNode*>(it->next()))->getVtkId();
+    nodeIds[i] = nodeId;
   }
 
   // --- insert cell in vtkUnstructuredGrid
 
-  vtkUnstructuredGrid * grid = myMesh->getGrid();
-  //int locType = elem->GetType();
-  int typ = VTK_VERTEX;//GetVtkCellType(locType);
-  int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
-  cell->setVtkId(cellId); 
-  //MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId);
+  int typ = VTK_VERTEX;
+  int cellId = myMesh->getGrid()->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
+  cell->setVtkId(cellId);
   return cellId;
 }
 
 //=======================================================================
 //function : BindID
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
@@ -122,17 +118,16 @@ int SMDS_MeshElementIDFactory::GetFreeID()
 void SMDS_MeshElementIDFactory::ReleaseID(int ID, int vtkId)
 {
   if (ID < 1) // TODO check case ID == O
-    {
-      MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID ID = " << ID);
-      return;
-    }
-  //MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId);
+  {
+    MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID ID = " << ID);
+    return;
+  }
   if (vtkId >= 0)
-    {
-      assert(vtkId < (int)myMesh->myCellIdVtkToSmds.size());
-      myMesh->myCellIdVtkToSmds[vtkId] = -1;
-      myMesh->setMyModified();
-    }
+  {
+    assert(vtkId < (int)myMesh->myCellIdVtkToSmds.size());
+    myMesh->myCellIdVtkToSmds[vtkId] = -1;
+    myMesh->setMyModified();
+  }
   SMDS_MeshIDFactory::ReleaseID(ID);
   if (ID == myMax)
     myMax = 0;
@@ -142,7 +137,7 @@ void SMDS_MeshElementIDFactory::ReleaseID(int ID, int vtkId)
 
 //=======================================================================
 //function : updateMinMax
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMDS_MeshElementIDFactory::updateMinMax() const
@@ -150,16 +145,16 @@ void SMDS_MeshElementIDFactory::updateMinMax() const
   myMin = INT_MAX;
   myMax = 0;
   for (size_t i = 0; i < myMesh->myCells.size(); i++)
+  {
+    if (myMesh->myCells[i])
     {
-      if (myMesh->myCells[i])
-        {
-          int id = myMesh->myCells[i]->GetID();
-          if (id > myMax)
-            myMax = id;
-          if (id < myMin)
-            myMin = id;
-        }
+      int id = myMesh->myCells[i]->GetID();
+      if (id > myMax)
+        myMax = id;
+      if (id < myMin)
+        myMin = id;
     }
+  }
   if (myMin == INT_MAX)
     myMin = 0;
 }
@@ -171,12 +166,11 @@ void SMDS_MeshElementIDFactory::updateMinMax() const
 
 SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
 {
-    return myMesh->elementsIterator(SMDSAbs_All);
+  return myMesh->elementsIterator(SMDSAbs_All);
 }
 
 void SMDS_MeshElementIDFactory::Clear()
 {
-  //myMesh->myCellIdSmdsToVtk.clear();
   myMesh->myCellIdVtkToSmds.clear();
   myMin = myMax = 0;
   SMDS_MeshIDFactory::Clear();
index 1f0f799416fe2566e929f07269aa9f914f16352d..e32eb798c36abd87b71863c4853e9a88eb889048 100644 (file)
@@ -130,27 +130,18 @@ unsigned long SMDS_UnstructuredGrid::GetMTime()
   unsigned long mtime = vtkUnstructuredGrid::GetMTime();
   return mtime;
 }
-// OUV_PORTING_VTK6: seems to be useless
-/*
-void SMDS_UnstructuredGrid::Update()
-{
-  return vtkUnstructuredGrid::Update();
-}
 
-void SMDS_UnstructuredGrid::UpdateInformation()
-{
-  return vtkUnstructuredGrid::UpdateInformation();
-}
-*/
 vtkPoints* SMDS_UnstructuredGrid::GetPoints()
 {
   // TODO erreur incomprehensible de la macro vtk GetPoints apparue avec la version paraview de fin aout 2010
   return this->Points;
 }
 
-//#ifdef VTK_HAVE_POLYHEDRON
 int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *pts)
 {
+  if ( !this->Links )
+    BuildLinks();
+
   if (type != VTK_POLYHEDRON)
     return vtkUnstructuredGrid::InsertNextLinkedCell(type, npts, pts);
 
@@ -162,26 +153,25 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p
   int nbfaces = npts;
   int i = 0;
   for (int nf = 0; nf < nbfaces; nf++)
+  {
+    int nbnodes = pts[i];
+    i++;
+    for (int k = 0; k < nbnodes; k++)
     {
-      int nbnodes = pts[i];
+      setOfNodes.insert(pts[i]);
       i++;
-      for (int k = 0; k < nbnodes; k++)
-        {
-          setOfNodes.insert(pts[i]);
-          i++;
-        }
     }
+  }
 
   set<vtkIdType>::iterator it = setOfNodes.begin();
   for (; it != setOfNodes.end(); ++it)
-    {
-      this->Links->ResizeCellList(*it, 1);
-      this->Links->AddCellReference(cellid, *it);
-    }
+  {
+    this->Links->ResizeCellList(*it, 1);
+    this->Links->AddCellReference(cellid, *it);
+  }
 
   return cellid;
 }
-//#endif
 
 void SMDS_UnstructuredGrid::setSMDS_mesh(SMDS_Mesh *mesh)
 {
@@ -191,7 +181,6 @@ void SMDS_UnstructuredGrid::setSMDS_mesh(SMDS_Mesh *mesh)
 void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int newNodeSize,
                                         std::vector<int>& idCellsOldToNew, int newCellSize)
 {
-  //MESSAGE("------------------------- compactGrid " << newNodeSize << " " << newCellSize);//CHRONO(1);
   int alreadyCopied = 0;
 
   this->DeleteLinks();
@@ -234,8 +223,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
 
   int oldCellSize = this->Types->GetNumberOfTuples();
 
-  if ( oldCellSize == newCellSize )
+  if ( oldCellSize == newCellSize ) // no holes in elements
   {
+    this->Connectivity->Squeeze();
+    this->Locations->Squeeze();
+    this->Types->Squeeze();
+    if ( this->FaceLocations )
+    {
+      this->FaceLocations->Squeeze();
+      this->Faces->Squeeze();
+    }
     for ( int i = 0; i < oldCellSize; ++i )
       idCellsOldToNew[i] = i;
     return;
@@ -352,11 +349,11 @@ void SMDS_UnstructuredGrid::copyNodes(vtkPoints *       newPoints,
   void *source = this->Points->GetVoidPointer(3 * start);
   int nbPoints = end - start;
   if (nbPoints > 0)
-    {
-      memcpy(target, source, 3 * sizeof(double) * nbPoints);
-      for (int j = start; j < end; j++)
-        idNodesOldToNew[j] = alreadyCopied++; // old vtkId --> new vtkId
-    }
+  {
+    memcpy(target, source, 3 * sizeof(double) * nbPoints);
+    for (int j = start; j < end; j++)
+      idNodesOldToNew[j] = alreadyCopied++; // old vtkId --> new vtkId
+  }
 }
 
 void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes,
@@ -370,24 +367,24 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes,
                                      int                   end)
 {
   for (int j = start; j < end; j++)
+  {
+    newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
+    idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
+    vtkIdType oldLoc = this->Locations->GetValue(j);
+    vtkIdType nbpts;
+    vtkIdType *oldPtsCell = 0;
+    this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
+    assert(nbpts < NBMAXNODESINCELL);
+    for (int l = 0; l < nbpts; l++)
     {
-      newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
-      idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
-      vtkIdType oldLoc = this->Locations->GetValue(j);
-      vtkIdType nbpts;
-      vtkIdType *oldPtsCell = 0;
-      this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
-      assert(nbpts < NBMAXNODESINCELL);
-      for (int l = 0; l < nbpts; l++)
-        {
-          int oldval = oldPtsCell[l];
-          pointsCell[l] = idNodesOldToNew[oldval];
-        }
-      /*int newcnt = */newConnectivity->InsertNextCell(nbpts, pointsCell);
-      int newLoc = newConnectivity->GetInsertLocation(nbpts);
-      newLocations->SetValue(alreadyCopied, newLoc);
-      alreadyCopied++;
+      int oldval = oldPtsCell[l];
+      pointsCell[l] = idNodesOldToNew[oldval];
     }
+    /*int newcnt = */newConnectivity->InsertNextCell(nbpts, pointsCell);
+    int newLoc = newConnectivity->GetInsertLocation(nbpts);
+    newLocations->SetValue(alreadyCopied, newLoc);
+    alreadyCopied++;
+  }
 }
 
 int SMDS_UnstructuredGrid::CellIdToDownId(int vtkCellId)
index d34095d9ae03a37346e93c76ca4ada6da57af722..67dada6c9552e03512dc09c74675f19bdc855017 100644 (file)
@@ -70,14 +70,9 @@ public:
                    std::vector<int>& idCellsOldToNew,
                    int               newCellSize);
   virtual unsigned long GetMTime();
-  // OUV_PORTING_VTK6: seems to be useless
-  //virtual void Update();
-  //virtual void UpdateInformation();
   virtual vtkPoints *GetPoints();
 
-  //#ifdef VTK_HAVE_POLYHEDRON
   int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
-  //#endif
 
   int CellIdToDownId(int vtkCellId);
   void setCellIdToDownId(int vtkCellId, int downId);
index f365a30f213d078c1d2795da8887e32fa97a8550..edf40f78feb4e1e3e0748423f82ba57a37beed9f 100644 (file)
@@ -45,14 +45,10 @@ SMDS_VtkEdge::~SMDS_VtkEdge()
 void SMDS_VtkEdge::init(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshEdge::init();
-  vtkUnstructuredGrid* grid = mesh->getGrid();
   myMeshId = mesh->getMeshId();
-  vtkIdType aType = VTK_LINE;
-  if (nodeIds.size() == 3)
-    aType = VTK_QUADRATIC_EDGE;
-  myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
+  vtkIdType aType = ( nodeIds.size() == 3 ) ? VTK_QUADRATIC_EDGE : VTK_LINE;
+  myVtkID = mesh->getGrid()->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
   mesh->setMyModified();
-  //MESSAGE("SMDS_VtkEdge::init myVtkID " << myVtkID);
 }
 
 bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2)
@@ -69,14 +65,14 @@ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   if (nbNodes != npts)
-    {
-      MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
-      return false;
-    }
+  {
+    MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
+    return false;
+  }
   for (int i = 0; i < nbNodes; i++)
-    {
-      pts[i] = nodes[i]->getVtkId();
-    }
+  {
+    pts[i] = nodes[i]->getVtkId();
+  }
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
@@ -87,7 +83,6 @@ bool SMDS_VtkEdge::IsMediumNode(const SMDS_MeshNode* node) const
   vtkIdType npts = 0;
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
-  //MESSAGE("IsMediumNode " << npts  << " " << (node->getVtkId() == pts[npts-1]));
   return ((npts == 3) && (node->getVtkId() == pts[2]));
 }
 
index a8a9b28ffa9d2e531cec866b0b1b871bb0ff0eb7..724a7ec211588565a55d5e698bb22567c54cf1d7 100644 (file)
@@ -44,53 +44,37 @@ SMDS_VtkFace::~SMDS_VtkFace()
 void SMDS_VtkFace::init(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshFace::init();
-  vtkUnstructuredGrid* grid = mesh->getGrid();
   myMeshId = mesh->getMeshId();
   vtkIdType aType = VTK_TRIANGLE;
   switch (nodeIds.size())
   {
-    case 3:
-      aType = VTK_TRIANGLE;
-      break;
-    case 4:
-      aType = VTK_QUAD;
-      break;
-    case 6:
-      aType = VTK_QUADRATIC_TRIANGLE;
-      break;
-    case 8:
-      aType = VTK_QUADRATIC_QUAD;
-      break;
-    case 9:
-      aType = VTK_BIQUADRATIC_QUAD;
-      break;
-    case 7:
-      aType = VTK_BIQUADRATIC_TRIANGLE;
-      break;
-    default:
-      aType = VTK_POLYGON;
-      break;
+    case 3:  aType = VTK_TRIANGLE;            break;
+    case 4:  aType = VTK_QUAD;                break;
+    case 6:  aType = VTK_QUADRATIC_TRIANGLE;  break;
+    case 8:  aType = VTK_QUADRATIC_QUAD;      break;
+    case 9:  aType = VTK_BIQUADRATIC_QUAD;    break;
+    case 7:  aType = VTK_BIQUADRATIC_TRIANGLE;break;
+    default: aType = VTK_POLYGON;
   }
-  myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), (vtkIdType*) &nodeIds[0]);
+  myVtkID = mesh->getGrid()->InsertNextLinkedCell(aType, nodeIds.size(), (vtkIdType*) &nodeIds[0]);
   mesh->setMyModified();
-  //MESSAGE("SMDS_VtkFace::init myVtkID " << myVtkID);
 }
 
 void SMDS_VtkFace::initPoly(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshFace::init();
-  vtkUnstructuredGrid* grid = mesh->getGrid();
   myMeshId = mesh->getMeshId();
-  myVtkID = grid->InsertNextLinkedCell(VTK_POLYGON, nodeIds.size(), (vtkIdType*) &nodeIds[0]);
+  vtkIdType aType = VTK_POLYGON;
+  myVtkID = mesh->getGrid()->InsertNextLinkedCell(aType, nodeIds.size(), (vtkIdType*) &nodeIds[0]);
   mesh->setMyModified();
 }
 
 void SMDS_VtkFace::initQuadPoly(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshFace::init();
-  vtkUnstructuredGrid* grid = mesh->getGrid();
   myMeshId = mesh->getMeshId();
-  myVtkID = grid->InsertNextLinkedCell(VTK_QUADRATIC_POLYGON, nodeIds.size(), (vtkIdType*) &nodeIds[0]);
+  vtkIdType aType = VTK_QUADRATIC_POLYGON;
+  myVtkID = mesh->getGrid()->InsertNextLinkedCell(aType, nodeIds.size(), (vtkIdType*) &nodeIds[0]);
   mesh->setMyModified();
 }
 
@@ -101,14 +85,14 @@ bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   if (nbNodes != npts)
-    {
-      MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
-      return false;
-    }
+  {
+    MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
+    return false;
+  }
   for (int i = 0; i < nbNodes; i++)
-    {
-      pts[i] = nodes[i]->getVtkId();
-    }
+  {
+    pts[i] = nodes[i]->getVtkId();
+  }
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
index 2b717fc269954d41a8eb44899315f82ad4b8bd3f..8f66ff0846973bd929cc1d4dcebb6f0ee000e3c9 100644 (file)
@@ -41,57 +41,31 @@ SMDS_VtkVolume::SMDS_VtkVolume(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh*
 void SMDS_VtkVolume::init(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshVolume::init();
-  vtkUnstructuredGrid* grid = mesh->getGrid();
   myMeshId = mesh->getMeshId();
   vtkIdType aType = VTK_TETRA;
   switch (nodeIds.size()) // cases are in order of usage frequency
   {
-    case 4:
-      aType = VTK_TETRA;
-      break;
-    case 8:
-      aType = VTK_HEXAHEDRON;
-      break;
-    case 5:
-      aType = VTK_PYRAMID;
-      break;
-    case 6:
-      aType = VTK_WEDGE;
-      break;
-    case 10:
-      aType = VTK_QUADRATIC_TETRA;
-      break;
-    case 20:
-      aType = VTK_QUADRATIC_HEXAHEDRON;
-      break;
-    case 13:
-      aType = VTK_QUADRATIC_PYRAMID;
-      break;
-    case 15:
-      aType = VTK_QUADRATIC_WEDGE;
-      break;
-    case 12:
-      aType = VTK_HEXAGONAL_PRISM;
-      break;
-    case 27:
-      aType = VTK_TRIQUADRATIC_HEXAHEDRON;
-      break;
-    default:
-      aType = VTK_HEXAHEDRON;
-      break;
+    case 4:  aType = VTK_TETRA;                  break;
+    case 8:  aType = VTK_HEXAHEDRON;             break;
+    case 5:  aType = VTK_PYRAMID;                break;
+    case 6:  aType = VTK_WEDGE;                  break;
+    case 10: aType = VTK_QUADRATIC_TETRA;        break;
+    case 20: aType = VTK_QUADRATIC_HEXAHEDRON;   break;
+    case 13: aType = VTK_QUADRATIC_PYRAMID;      break;
+    case 15: aType = VTK_QUADRATIC_WEDGE;        break;
+    case 12: aType = VTK_HEXAGONAL_PRISM;        break;
+    case 27: aType = VTK_TRIQUADRATIC_HEXAHEDRON;break;
+    default: aType = VTK_HEXAHEDRON;
   }
-  myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), (vtkIdType *) &nodeIds[0]);
+  myVtkID = mesh->getGrid()->InsertNextLinkedCell(aType, nodeIds.size(), (vtkIdType *) &nodeIds[0]);
   mesh->setMyModified();
-  //MESSAGE("SMDS_VtkVolume::init myVtkID " << myVtkID);
 }
 
-//#ifdef VTK_HAVE_POLYHEDRON
 void SMDS_VtkVolume::initPoly(const std::vector<vtkIdType>& nodeIds,
                               const std::vector<int>&       nbNodesPerFace,
                               SMDS_Mesh*                    mesh)
 {
   SMDS_MeshVolume::init();
-  //MESSAGE("SMDS_VtkVolume::initPoly");
   SMDS_UnstructuredGrid* grid = mesh->getGrid();
   //double center[3];
   //this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), &center[0]);
@@ -99,36 +73,34 @@ void SMDS_VtkVolume::initPoly(const std::vector<vtkIdType>& nodeIds,
   vtkIdType nbFaces = nbNodesPerFace.size();
   int k = 0;
   for (int i = 0; i < nbFaces; i++)
-    {
-      int nf = nbNodesPerFace[i];
-      ptIds.push_back(nf);
-      // EAP: a right approach is:
-      // - either the user should care of order of nodes or
-      // - the user should use a service method arranging nodes if he
-      //   don't want or can't to do it by him-self
-      // The method below works OK only with planar faces and convex polyhedrones
-      //
-      // 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);
-      // bool isFaceForward = this->isForward(a, b, c, center);
-      //MESSAGE("isFaceForward " << i << " " << isFaceForward);
-      const vtkIdType *facePts = &nodeIds[k];
-      //if (isFaceForward)
-        for (int n = 0; n < nf; n++)
-          ptIds.push_back(facePts[n]);
-      // else
-      //   for (int n = nf - 1; n >= 0; n--)
-      //     ptIds.push_back(facePts[n]);
-      k += nf;
-    }
+  {
+    int nf = nbNodesPerFace[i];
+    ptIds.push_back(nf);
+    // EAP: a right approach is:
+    // - either the user should care of order of nodes or
+    // - the user should use a service method arranging nodes if he
+    //   don't want or can't to do it by him-self
+    // The method below works OK only with planar faces and convex polyhedrones
+    //
+    // 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);
+    // bool isFaceForward = this->isForward(a, b, c, center);
+    const vtkIdType *facePts = &nodeIds[k];
+    //if (isFaceForward)
+    for (int n = 0; n < nf; n++)
+      ptIds.push_back(facePts[n]);
+    // else
+    //   for (int n = nf - 1; n >= 0; n--)
+    //     ptIds.push_back(facePts[n]);
+    k += nf;
+  }
   myVtkID = grid->InsertNextLinkedCell(VTK_POLYHEDRON, nbFaces, &ptIds[0]);
   mesh->setMyModified();
 }
-//#endif
 
 bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
 {
@@ -137,14 +109,14 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   if (nbNodes != npts)
-    {
-      MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
-      return false;
-    }
+  {
+    MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
+    return false;
+  }
   for (int i = 0; i < nbNodes; i++)
-    {
-      pts[i] = nodes[i]->getVtkId();
-    }
+  {
+    pts[i] = nodes[i]->getVtkId();
+  }
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
@@ -156,10 +128,10 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes
 bool SMDS_VtkVolume::vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes)
 {
   if (nbNodes != this->NbNodes())
-    {
-      MESSAGE("vtkOrder, wrong number of nodes " << nbNodes << " instead of "<< this->NbNodes());
-      return false;
-    }
+  {
+    MESSAGE("vtkOrder, wrong number of nodes " << nbNodes << " instead of "<< this->NbNodes());
+    return false;
+  }
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
   vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
   const std::vector<int>& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( aVtkType ));
@@ -230,23 +202,23 @@ int SMDS_VtkVolume::NbNodes() const
   vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
   vtkIdType nbPoints = 0;
   if (aVtkType != VTK_POLYHEDRON)
-    {
-      vtkIdType *pts;
-      grid->GetCellPoints( myVtkID, nbPoints, pts );
-    }
+  {
+    vtkIdType *pts;
+    grid->GetCellPoints( myVtkID, nbPoints, pts );
+  }
   else
+  {
+    vtkIdType nFaces = 0;
+    vtkIdType* ptIds = 0;
+    grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+    int id = 0;
+    for (int i = 0; i < nFaces; i++)
     {
-      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);
-        }
+      int nodesInFace = ptIds[id];
+      nbPoints += nodesInFace;
+      id += (nodesInFace + 1);
     }
+  }
   return nbPoints;
 }
 
@@ -311,22 +283,22 @@ int SMDS_VtkVolume::NbFaceNodes(const int face_ind) const
   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++)
     {
-      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;
-            }
-        }
+      int nodesInFace = ptIds[id];
+      id += (nodesInFace + 1);
+      if (i == face_ind - 1)
+      {
+        nbNodes = nodesInFace;
+        break;
+      }
     }
+  }
   return nbNodes;
 }
 
@@ -341,23 +313,23 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
   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++)
     {
-      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->FindNodeVtk(ptIds[id + node_ind]); // ptIds[id+1] : first node
-              break;
-            }
-          id += (nodesInFace + 1);
-        }
+      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->FindNodeVtk(ptIds[id + node_ind]); // ptIds[id+1] : first node
+        break;
+      }
+      id += (nodesInFace + 1);
     }
+  }
   return node;
 }
 
@@ -371,18 +343,18 @@ std::vector<int> SMDS_VtkVolume::GetQuantities() const
   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++)
     {
-      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);
-        }
+      int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
+      quantities.push_back(nodesInFace);
+      id += (nodesInFace + 1);
     }
+  }
   return quantities;
 }
 
@@ -539,16 +511,15 @@ bool SMDS_VtkVolume::IsMediumNode(const SMDS_MeshNode* node) const
   grid->GetCellPoints(myVtkID, npts, pts);
   vtkIdType nodeId = node->getVtkId();
   for (int rank = 0; rank < npts; rank++)
+  {
+    if (pts[rank] == nodeId)
     {
-      if (pts[rank] == nodeId)
-        {
-          if (rank < rankFirstMedium)
-            return false;
-          else
-            return true;
-        }
+      if (rank < rankFirstMedium)
+        return false;
+      else
+        return true;
     }
-  //throw SALOME_Exception(LOCALIZED("node does not belong to this element"));
+  }
   MESSAGE("======================================================");
   MESSAGE("= IsMediumNode: node does not belong to this element =");
   MESSAGE("======================================================");
@@ -609,11 +580,9 @@ SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
     case VTK_HEXAGONAL_PRISM:
       aType = SMDSEntity_Hexagonal_Prism;
       break;
-//#ifdef VTK_HAVE_POLYHEDRON
     case VTK_POLYHEDRON:
       aType = SMDSEntity_Polyhedra;
       break;
-//#endif
     default:
       aType = SMDSEntity_Polyhedra;
       break;
@@ -649,11 +618,9 @@ SMDSAbs_GeometryType SMDS_VtkVolume::GetGeomType() const
     case VTK_HEXAGONAL_PRISM:
       aType = SMDSGeom_HEXAGONAL_PRISM;
       break;
-//#ifdef VTK_HAVE_POLYHEDRON
     case VTK_POLYHEDRON:
       aType = SMDSGeom_POLYHEDRA;
       break;
-//#endif
     default:
       aType = SMDSGeom_POLYHEDRA;
       break;
@@ -685,7 +652,6 @@ void SMDS_VtkVolume::gravityCenter(SMDS_UnstructuredGrid* grid,
     }
   for (int j = 0; j < 3; j++)
     result[j] = result[j] / nbNodes;
-  //MESSAGE("center " << result[0] << " " << result[1] << " "  << result[2]);
   return;
 }
 
@@ -693,16 +659,14 @@ 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++)
-    {
-      //MESSAGE("a,b,c,d " << a[j] << " " << b[j] << " " << c[j] << " " << d[j]);
-      u[j] = b[j] - a[j];
-      v[j] = c[j] - a[j];
-      w[j] = d[j] - a[j];
-      //MESSAGE("u,v,w " << u[j] << " " << v[j] << " " << w[j]);
-    }
-  double prodmixte = (u[1]*v[2] - u[2]*v[1]) * w[0]
-                   + (u[2]*v[0] - u[0]*v[2]) * w[1]
-                   + (u[0]*v[1] - u[1]*v[0]) * w[2];
+  {
+    u[j] = b[j] - a[j];
+    v[j] = c[j] - a[j];
+    w[j] = d[j] - a[j];
+  }
+  double prodmixte = ((u[1]*v[2] - u[2]*v[1]) * w[0]
+                      + (u[2]*v[0] - u[0]*v[2]) * w[1]
+                      + (u[0]*v[1] - u[1]*v[0]) * w[2] );
   return (prodmixte < 0);
 }
 
@@ -720,6 +684,5 @@ int SMDS_VtkVolume::NbUniqueNodes() const
  */
 SMDS_ElemIteratorPtr SMDS_VtkVolume::uniqueNodesIterator() const
 {
-  //MESSAGE("uniqueNodesIterator");
   return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
 }
index 128316dcf55c87817dbf3e556cb61bf02a660d35..8b44bcf1745de17a554a2535999912df5ebcfcf0 100644 (file)
@@ -1499,7 +1499,6 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
           MESSAGE("std::bad_alloc thrown inside algo->Compute()");
           if ( _computeError ) {
             _computeError->myName = COMPERR_MEMORY_PB;
-            //_computeError->myComment = exc.what();
           }
           cleanSubMesh( this );
           throw exc;
@@ -1508,7 +1507,6 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
           MESSAGE("Standard_OutOfMemory thrown inside algo->Compute()");
           if ( _computeError ) {
             _computeError->myName = COMPERR_MEMORY_PB;
-            //_computeError->myComment = exc.what();
           }
           cleanSubMesh( this );
           throw std::bad_alloc();
@@ -1549,7 +1547,7 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
           ret = false;
         // check if anything was built
         TopExp_Explorer subS(shape, _subShape.ShapeType());
-        if (ret)
+        if ( ret )
         {
           for (; ret && subS.More(); subS.Next())
             if ( !_father->GetSubMesh( subS.Current() )->IsMeshComputed() &&
@@ -1558,9 +1556,9 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
               ret = false;
         }
         // Set _computeError
-        if (!ret && !isComputeErrorSet)
+        if ( !ret && !isComputeErrorSet )
         {
-          for (subS.ReInit(); subS.More(); subS.Next())
+          for ( subS.ReInit(); subS.More(); subS.Next() )
           {
             SMESH_subMesh* sm = _father->GetSubMesh( subS.Current() );
             if ( !sm->IsMeshComputed() )
@@ -1574,7 +1572,7 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
             }
           }
         }
-        if (ret && _computeError && _computeError->myName != COMPERR_WARNING )
+        if ( ret && _computeError && _computeError->myName != COMPERR_WARNING )
         {
           _computeError.reset();
         }
index b1f0e20faa9e2ea3b49b1ec29bca6b58c9ef6349..446a9b67df166118f42a7a7ad3033f082f9c0a82 100644 (file)
@@ -742,23 +742,23 @@ void SMESHGUI_HypothesisDlg::setType( const QString& t )
   myTypeLabel->setText( t );
 }
 
-HypothesisData::HypothesisData( const QString& theTypeName,
-                                const QString& thePluginName,
-                                const QString& theServerLibName,
-                                const QString& theClientLibName,
-                                const QString& theLabel,
-                                const QString& theIconId,
-                                const QString& theContext,
-                                const int      theGroupID,
-                                const int      thePriority,
-                                const QList<int>& theDim,
-                                const bool theIsAuxOrNeedHyp,
+HypothesisData::HypothesisData( const QString&     theTypeName,
+                                const QString&     thePluginName,
+                                const QString&     theServerLibName,
+                                const QString&     theClientLibName,
+                                const QString&     theLabel,
+                                const QString&     theIconId,
+                                const QString&     theContext,
+                                const int          theGroupID,
+                                const int          thePriority,
+                                const QList<int>&  theDim,
+                                const bool         theIsAuxOrNeedHyp,
                                 const QStringList& theBasicHypos,
                                 const QStringList& theOptionalHypos,
                                 const QStringList& theInputTypes,
                                 const QStringList& theOutputTypes,
-                                const bool theIsNeedGeometry,
-                                const bool supportSub)
+                                const int          theIsNeedGeometry,
+                                const bool         theSupportSub)
   : TypeName( theTypeName ),
     PluginName( thePluginName ),
     ServerLibName( theServerLibName ),
@@ -771,7 +771,7 @@ HypothesisData::HypothesisData( const QString& theTypeName,
     Dim( theDim ),
     IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
     IsNeedGeometry( theIsNeedGeometry ),
-    IsSupportSubmeshes( supportSub ),
+    IsSupportSubmeshes( theSupportSub ),
     BasicHypos( theBasicHypos ),
     OptionalHypos( theOptionalHypos ),
     InputTypes( theInputTypes ),
index 0852bc60ea228e15d28ae09e10fe9574069bac73..f989a49ff38c872c36515794897caa319c98a419 100644 (file)
@@ -72,6 +72,9 @@ public:
   QString                      getMainShapeEntry() const { return myMainShapeEntry; }
   void                         setMainShapeEntry( const QString& theEntry ) { myMainShapeEntry = theEntry; }
 
+  void                         setNoGeomMesh( const bool noGeom ) { myNoGeomMesh = noGeom; }
+  bool                         getNoGeomMesh() const { return myNoGeomMesh; }
+
 signals:
   void                         finished( int );
 
@@ -138,6 +141,7 @@ private:
   ListOfWidgets                myParamWidgets;
   ListOfWidgets                myParamLabels;
   bool                         myIsCreate;
+  bool                         myNoGeomMesh; //!< true for a mesh not based on geometry
   QtxDialog*                   myDlg;
   QString                      myShapeEntry;
   QString                      myMainShapeEntry;
@@ -177,7 +181,7 @@ struct HypothesisData
                   const QList<int>&, const bool,
                   const QStringList&, const QStringList&,
                   const QStringList&, const QStringList&,
-                  const bool=true, const bool supportSub=false );
+                  const int, const bool supportSub );
 
   QString TypeName;        //!< hypothesis type name
   QString PluginName;      //!< plugin name
@@ -191,7 +195,9 @@ struct HypothesisData
   QList<int> Dim;          //!< list of supported dimensions (see SMESH::Dimension enumeration)
   bool IsAuxOrNeedHyp;     //!< TRUE if given HYPOTHESIS is auxiliary one, FALSE otherwise
   //!<                          TRUE if given ALGORITHM can't work w/o hypotheses
-  bool IsNeedGeometry;     //!< TRUE if the algorithm works with shapes only, FALSE otherwise
+  int  IsNeedGeometry;     //!< 1 if the algorithm works with shapes only,
+  //!<                         -1 if the algorithm works without shapes only,
+  //!<                          0 if the algorithm works in both cases
   bool IsSupportSubmeshes; //!< TRUE if the algorithm building all-dim elems supports sub-meshes
 
   // for algorithm only: dependencies algo <-> algo and algo -> hypos
index 71b8125667e593efec3c64ffebb7b0ac51bd6c9d..c1fc49bee78d6131bc95fe04ff1a9491d2ae4b1e 100644 (file)
@@ -282,14 +282,14 @@ namespace SMESH
   QStringList GetAvailableHypotheses( const bool isAlgo,
                                       const int  theDim,
                                       const bool isAux,
-                                      const bool isNeedGeometry,
+                                      const bool hasGeometry,
                                       const bool isSubMesh)
   {
     QStringList aHypList;
 
     // Init list of available hypotheses, if needed
     InitAvailableHypotheses();
-    bool checkGeometry = ( !isNeedGeometry && isAlgo );
+    bool checkGeometry = ( isAlgo );
     const char* context = isSubMesh ? "LOCAL" : "GLOBAL";
     // fill list of hypotheses/algorithms
     THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
@@ -301,7 +301,8 @@ namespace SMESH
           ( theDim < 0              || aData->Dim.contains( theDim )) &&
           ( isAlgo                  || aData->IsAuxOrNeedHyp == isAux ) &&
           ( aData->Context == "ANY" || aData->Context == context ) &&
-          ( !checkGeometry          || aData->IsNeedGeometry == isNeedGeometry ))
+          ( !checkGeometry          || (!aData->IsNeedGeometry  ||
+                                        ( aData->IsNeedGeometry > 0 ) == hasGeometry)))
       {
         aHypList.append(anIter.key());
       }
@@ -386,7 +387,7 @@ namespace SMESH
       QList<int> dummyIL; dummyIL << 1;
       QStringList dummySL;
       HypothesisData group( dummyS,dummyS,dummyS,dummyS,dummyS,dummyS,dummyS,-1,-1,
-                            dummyIL, 0, dummySL,dummySL,dummySL,dummySL );
+                            dummyIL, 0, dummySL,dummySL,dummySL,dummySL,0,0 );
       // no group
       int key = 0;
       theGroups[ key ].push_back( group );
index 8adb028046c82a5e2dac8b78137c6d4e14d5a564..52920773b97b13cffbbbc363a74c6fc4775f4fe5 100644 (file)
@@ -1192,12 +1192,9 @@ void SMESHGUI_MeshOp::initHypCreator( SMESHGUI_GenericHypothesisCreator* theCrea
   // Set shapes, of mesh and sub-mesh if any
 
   // get Entry of the Geom object
-  QString aGeomEntry = "";
-  QString aMeshEntry = "";
-  QString anObjEntry = "";
-  aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
-  aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
-  anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
+  QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
+  QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
+  QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); 
 
   if ( myToCreate && myIsMesh )
     aMeshEntry = aGeomEntry;
@@ -1242,6 +1239,8 @@ void SMESHGUI_MeshOp::initHypCreator( SMESHGUI_GenericHypothesisCreator* theCrea
   theCreator->setShapeEntry( aGeomEntry );
   if ( aMeshEntry != "" )
     theCreator->setMainShapeEntry( aMeshEntry );
+
+  theCreator->setNoGeomMesh( !myIsOnGeometry && myIsMesh && !myToCreate );
 }
 
 //================================================================================
@@ -1368,7 +1367,8 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
       aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
       dialog = true;
     }
-    else {
+    else
+    {
      SMESH::SMESH_Hypothesis_var aHyp =
        SMESH::CreateHypothesis(theTypeName, aHypName, false);
      aHyp.out();
index f164f4fe504d5269301a5e80ff1f38d3335523c1..3482d7672fd632e6f0433a016194abb9f4992a73 100644 (file)
@@ -128,10 +128,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
       bool isAuxOrNeedHyp = ( qName == "hypothesis" ?
                               atts.value("auxiliary") == "true" :
                               atts.value("need-hyp" ) == "true" );
-      bool isNeedGeom = true, isSupportSubmeshes = false;
+      int  isNeedGeom = 1;
+      bool isSupportSubmeshes = false;
       QString aNeedGeom = atts.value("need-geom");
       if ( !aNeedGeom.isEmpty() )
-        isNeedGeom = (aNeedGeom == "true");
+        isNeedGeom = (aNeedGeom == "true") ? 1 : (aNeedGeom == "never") ? -1 : 0;
       QString suppSub = atts.value("support-submeshes");
       if ( !suppSub.isEmpty() )
         isSupportSubmeshes = (suppSub == "true");
index 1beee9b4832cdd815eda785d02e1c004a73fda52..e22a87c775c723d496a38bcfa515e8a9ebc08668 100644 (file)
@@ -162,6 +162,13 @@ namespace SMESH
     return *this;
   }
 
+  TPythonDump&
+  TPythonDump::
+  operator<<(const std::string& theArg){
+    myStream<<theArg;
+    return *this;
+  }
+
   TPythonDump&
   TPythonDump::
   operator<<(const SMESH::ElementType& theArg)
index 8c44cfdd97eb76cf8c269e4b5ef9107f5e25f99b..2397c7f6c3643c565e5b1f3c4e0ca2a1f2501e2b 100644 (file)
@@ -876,10 +876,17 @@ CORBA::Boolean SMESH_Gen_i::GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr
     {
       if ( !foundMesh->_is_nil() ) // not a sole mesh
       {
-        GEOM::GEOM_Object_var s1 = mesh_i   ->GetShapeToMesh();
-        GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh();
-        if ( ! ( isSole = s1->IsSame( s2 )))
-          break;
+        if ( !foundMesh->HasShapeToMesh() ||
+             !mesh_i   ->HasShapeToMesh() )
+        {
+          isSole = ( foundMesh->HasShapeToMesh() == mesh_i->HasShapeToMesh() );
+        }
+        else
+        {
+          GEOM::GEOM_Object_var s1 = mesh_i   ->GetShapeToMesh();
+          GEOM::GEOM_Object_var s2 = foundMesh->GetShapeToMesh();
+          isSole = s1->IsSame( s2 );
+        }
       }
       foundMesh = SMESH::SMESH_Mesh::_narrow( obj );
     }
index 8f1a7971512e0db8ee75d2663ea374f3bc932c22..7fb82c5644a8a33a55c2c248af32ad69f739ec29 100644 (file)
@@ -234,6 +234,9 @@ namespace SMESH
     TPythonDump&
     operator<<(const SMESH::CoincidentFreeBorders& theCFB);
 
+    TPythonDump&
+    operator<<(const std::string& theArg);
+
     static const char* SMESHGenName() { return "smeshgen"; }
     static const char* MeshEditorName() { return "mesh_editor"; }
     static const char* NotPublishedObjectName();