From: eap Date: Mon, 3 Oct 2016 17:35:01 +0000 (+0300) Subject: 23352: [CEA] Order and naming of meshing algorithms X-Git-Tag: V8_2_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7886ac81d15858cd6d907b8cd39dfeea5a25f2e3;p=modules%2Fgui.git 23352: [CEA] Order and naming of meshing algorithms Add QtxMenu::appendGroupTitle() 23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe --- diff --git a/src/Qtx/QtxMenu.cxx b/src/Qtx/QtxMenu.cxx index 93784a231..526965bcf 100644 --- a/src/Qtx/QtxMenu.cxx +++ b/src/Qtx/QtxMenu.cxx @@ -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 diff --git a/src/Qtx/QtxMenu.h b/src/Qtx/QtxMenu.h index ff9c5db7b..5ed17ed85 100644 --- a/src/Qtx/QtxMenu.h +++ b/src/Qtx/QtxMenu.h @@ -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 ); diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx index dff1b906e..6e696644f 100755 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx @@ -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*/); } } } diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h index a7975c209..18a029546 100755 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h @@ -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 TVectorId; typedef std::map TMapId; @@ -118,7 +118,7 @@ protected: bool myStoreMapping; TVectorId myOut2InId; - TMapId myIn2OutId; + //TMapId myIn2OutId; private: //! Not implemented. diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index 063a2eed2..4ab9a2d9a 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -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 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 )