]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
23352: [CEA] Order and naming of meshing algorithms
authoreap <eap@opencascade.com>
Mon, 3 Oct 2016 17:35:01 +0000 (20:35 +0300)
committereap <eap@opencascade.com>
Mon, 3 Oct 2016 17:35:01 +0000 (20:35 +0300)
   Add QtxMenu::appendGroupTitle()

23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe

src/Qtx/QtxMenu.cxx
src/Qtx/QtxMenu.h
src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx
src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index 93784a2317563476939872bdc79da0c9e21dc4e7..526965bcf9c4c2b26357b2340dd411640a171c25 100644 (file)
@@ -358,6 +358,21 @@ void QtxMenu::setTitleAlignment( const Qt::Alignment a )
   updateTitle();
 }
 
+/*!
+ * \brief Append a title to the and of the menu
+ *  \param [in] text - title text
+ */
+void QtxMenu::appendGroupTitle( const QString& text )
+{
+  Title* aTitle = new Title( this );
+  aTitle->setText( text );
+
+  QWidgetAction* anAction = new QWidgetAction( this );
+  anAction->setDefaultWidget( aTitle );
+
+  addAction( anAction );
+}
+
 /*!
   \brief Customize show/hide menu operation.
   \param on new popup menu visibility state
index ff9c5db7b0e6f2467cbf1908841e465ccfdbbe66..5ed17ed859a42c3ecada0d986a0857a5c173a279 100644 (file)
@@ -59,6 +59,8 @@ public:
   virtual void           setTitleMode( const TitleMode );
   virtual void           setTitleAlignment( const Qt::Alignment );
 
+  virtual void           appendGroupTitle( const QString& );
+
 public slots:
   virtual void           setVisible( bool );
 
index dff1b906e8e303cb231fc07d7785e26e06013052..6e696644ff56919a28c3a803609b87fe7e677153 100755 (executable)
@@ -88,12 +88,12 @@ vtkIdType VTKViewer_ExtractUnstructuredGrid::GetInputId(int theOutId) const
   return myOut2InId[theOutId];
 }
 
-vtkIdType VTKViewer_ExtractUnstructuredGrid::GetOutputId(int theInId) const{
-  if(myCellIds.empty() && myCellTypes.empty()) return theInId;
-  TMapId::const_iterator anIter = myIn2OutId.find(theInId);
-  if(anIter == myIn2OutId.end()) return -1;
-  return anIter->second;
-}
+// vtkIdType VTKViewer_ExtractUnstructuredGrid::GetOutputId(int theInId) const{
+//   if(myCellIds.empty() && myCellTypes.empty()) return theInId;
+//   TMapId::const_iterator anIter = myIn2OutId.find(theInId);
+//   if(anIter == myIn2OutId.end()) return -1;
+//   return anIter->second;
+// }
 
 
 inline int InsertCell(vtkUnstructuredGrid *theInput,
@@ -105,8 +105,8 @@ inline int InsertCell(vtkUnstructuredGrid *theInput,
                       vtkIdList *theIdList,
                       bool theStoreMapping,
                       vtkIdType theOutId,
-                      VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
-                      VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
+                      VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
+                      VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
 {
   vtkCell     *aCell = theInput->GetCell(theCellId);
   vtkIdList *aPntIds = aCell->GetPointIds();
@@ -157,7 +157,7 @@ inline int InsertCell(vtkUnstructuredGrid *theInput,
   /*vtkIdType anID = */theCellTypesArray->InsertNextValue(aCellType);
   if(theStoreMapping){
     theOut2InId.push_back( theCellId );
-    theIn2OutId.insert( theIn2OutId.end(), std::make_pair( theCellId, theOutId ));
+    //theIn2OutId.insert( theIn2OutId.end(), std::make_pair( theCellId, theOutId ));
   }
   return aCellId;
 }
@@ -168,15 +168,15 @@ inline void InsertPointCell(vtkCellArray *theConnectivity,
                             vtkIdList *theIdList,
                             bool theStoreMapping,
                             vtkIdType theOutId, 
-                            VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
-                            VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
+                            VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
+                            VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
 {
   theIdList->SetId(0,theCellId);
   theConnectivity->InsertNextCell(theIdList);
   theCellTypesArray->InsertNextValue(VTK_VERTEX);
   if(theStoreMapping){
     theOut2InId.push_back(theCellId);
-    theIn2OutId.insert( theIn2OutId.end(), std::make_pair( theCellId, theOutId ));
+    //theIn2OutId.insert( theIn2OutId.end(), std::make_pair( theCellId, theOutId ));
   }
 }
 
@@ -197,8 +197,8 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
 
   //vtkUnstructuredGrid *anInput = this->GetInput();
   //vtkUnstructuredGrid *anOutput = this->GetOutput();
-  
-  myOut2InId.clear();  myIn2OutId.clear();
+
+  myOut2InId.clear();  //myIn2OutId.clear();
 
   // use a vector of cellTypes to avoid searching in myCellTypes map
   // for a better performance (IPAL53103)
@@ -225,7 +225,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
         for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
           if(myStoreMapping){
             myOut2InId.push_back(aCellId);
-            myIn2OutId.insert( myIn2OutId.end(), std::make_pair( aCellId, anOutId ));
+            //myIn2OutId.insert( myIn2OutId.end(), std::make_pair( aCellId, anOutId ));
           }
         }
       }
@@ -248,7 +248,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
           for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
             if(myCellIds.find(aCellId) != myCellIds.end()){
               vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
-                                           myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                                           myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
               anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
             }
           }
@@ -256,7 +256,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
           for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
             if(myCellIds.find(aCellId) == myCellIds.end()){
               vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
-                                           myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                                           myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
               anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
             }
           }
@@ -267,7 +267,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
             vtkIdType aType = anInput->GetCellType(aCellId);
             if ( cellTypesVec[ aType ] == aType ) {
               vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
-                                           myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                                           myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
               anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
             }
           }
@@ -276,7 +276,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
             vtkIdType aType = anInput->GetCellType(aCellId);
             if ( cellTypesVec[ aType ] != aType ) {
               vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
-                                           myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                                           myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
               anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
             }
           }
@@ -288,7 +288,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
             if ( cellTypesVec[ aType ] == aType ) {
               if(myCellIds.find(aCellId) != myCellIds.end()){
                 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
-                                             myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                                             myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
                 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
               }
             }
@@ -299,7 +299,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
             if ( cellTypesVec[ aType ] != aType ) {
               if(myCellIds.find(aCellId) == myCellIds.end()){
                 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
-                                             myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                                             myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
                 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
               }
             }
@@ -344,7 +344,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
       if(myStoreMapping) myOut2InId.reserve(aNbElems);
       for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
         InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                        myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                        myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
       }
     }else if(!myCellIds.empty() && myCellTypes.empty()){
       if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
@@ -352,14 +352,14 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
         for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
           if(myCellIds.find(aCellId) != myCellIds.end()){
             InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                            myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                            myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
           }
         }
       }else{
         for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
           if(myCellIds.find(aCellId) == myCellIds.end()){
             InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                            myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                            myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
           }
         }
       }
@@ -369,7 +369,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
           vtkIdType aType = anInput->GetCellType(aCellId);
           if ( cellTypesVec[ aType ] == aType ) {
             InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                            myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                            myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
           }
         }
       }else{
@@ -377,7 +377,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
           vtkIdType aType = anInput->GetCellType(aCellId);
           if ( cellTypesVec[ aType ] != aType ) {
             InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                            myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                            myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
           }
         }
       }
@@ -388,7 +388,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
           if ( cellTypesVec[ aType ] == aType ) {
             if(myCellIds.find(aCellId) != myCellIds.end()){
               InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                              myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                              myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
             }
           }
         }
@@ -398,7 +398,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re
           if ( cellTypesVec[ aType ] != aType ) {
             if(myCellIds.find(aCellId) == myCellIds.end()){
               InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
-                              myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+                              myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
             }
           }
         }
index a7975c20960ce9f585b5ff544f1fed70cad69d1d..18a02954699cd617e3a1762feee4714707e5f836 100755 (executable)
@@ -98,7 +98,7 @@ public:
   //! Gets the input id by output id.
   vtkIdType GetInputId(int theOutId) const;
   //! Gets the output id by input id.
-  vtkIdType GetOutputId(int theInId) const;
+  //vtkIdType GetOutputId(int theInId) const;
 
   typedef std::vector<vtkIdType> TVectorId;
   typedef std::map<vtkIdType,vtkIdType> TMapId;
@@ -118,7 +118,7 @@ protected:
 
   bool myStoreMapping;
   TVectorId myOut2InId;
-  TMapId myIn2OutId;
+  //TMapId myIn2OutId;
 
 private:
   //! Not implemented.
index 063a2eed2269b2cdd6dbb114a2830b3b460446be..4ab9a2d9a4204bbabbb42ef8509c1f27119c1bef 100755 (executable)
@@ -97,10 +97,10 @@ VTKViewer_GeometryFilter
 ::VTKViewer_GeometryFilter():
   myShowInside(0),
   myStoreMapping(0),
-  myAppendCoincident3D(0),
   myIsWireframeMode(0),
-  myIsBuildArc(false),
-  myMaxArcAngle(2)
+  myAppendCoincident3D(0),
+  myMaxArcAngle(2),
+  myIsBuildArc(false)
 {}
 
 
@@ -227,12 +227,39 @@ VTKViewer_GeometryFilter
     cellVis = new char[numCells];
     }
 
-  // Issue 0020115: [CEA 308] Quadratic elements visualization
-  // Fix of remark described in note 0005222 - SIGSEGV
-  vtkPoints* outputPoints = vtkPoints::New();
-  outputPoints->DeepCopy(input->GetPoints());
-  output->SetPoints(outputPoints);
-  outputPoints->Delete();
+  bool buildArcs = false;
+  if ( myIsBuildArc )
+  {
+    // check if there are quadratic 1D or 2D elements
+    bool hasQuad1D2D = false;
+    if ( vtkUnsignedCharArray* types = input->GetCellTypesArray() )
+    {
+      std::set<vtkIdType> quad1D2DTypes;
+      quad1D2DTypes.insert( VTK_QUADRATIC_EDGE );
+      quad1D2DTypes.insert( VTK_QUADRATIC_TRIANGLE );
+      quad1D2DTypes.insert( VTK_BIQUADRATIC_TRIANGLE );
+      quad1D2DTypes.insert( VTK_QUADRATIC_QUAD );
+      quad1D2DTypes.insert( VTK_BIQUADRATIC_QUAD );
+      quad1D2DTypes.insert( VTK_QUADRATIC_POLYGON );
+
+      for ( int i = 0; i < types->GetNumberOfTuples() && !hasQuad1D2D; ++i )
+        hasQuad1D2D = quad1D2DTypes.count( types->GetValue(i) );
+    }
+    buildArcs = hasQuad1D2D;
+  }
+  if ( buildArcs )
+  {
+    // Issue 0020115: [CEA 308] Quadratic elements visualization
+    // Fix of remark described in note 0005222 - SIGSEGV
+    vtkPoints* outputPoints = vtkPoints::New();
+    outputPoints->DeepCopy(input->GetPoints());
+    output->SetPoints(outputPoints);
+    outputPoints->Delete();
+  }
+  else
+  {
+    output->SetPoints(input->GetPoints());
+  }
 
   outputPD->PassData(pd);
 
@@ -242,11 +269,11 @@ VTKViewer_GeometryFilter
 
   // Loop over the cells determining what's visible
   if (!allVisible)
-    {
+  {
     for (cellId=0, Connectivity->InitTraversal();
          Connectivity->GetNextCell(npts,pts);
          cellId++)
-      {
+    {
       cellVis[cellId] = 1;
       if ( ( this->CellClipping && cellId < this->CellMinimum ) ||
            cellId > this->CellMaximum )