From: eap Date: Thu, 11 Aug 2016 13:44:16 +0000 (+0300) Subject: 23303: [EDF 12024] Filter for nodes connectivity X-Git-Tag: V8_1_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;ds=inline;h=5c5e1f2368ca2b3388f657ae028b2a6b5ce8ae36;p=modules%2Fsmesh.git 23303: [EDF 12024] Filter for nodes connectivity --- diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index 3bafa17c6..4e35dc496 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -98,6 +98,7 @@ SET(GOOD_TESTS filters_ex37.py filters_ex38.py filters_ex39.py + filters_node_nb_conn.py filters_belong2group.py grouping_elements_ex01.py grouping_elements_ex02.py diff --git a/doc/salome/examples/filters_node_nb_conn.py b/doc/salome/examples/filters_node_nb_conn.py new file mode 100644 index 000000000..c7f73f13d --- /dev/null +++ b/doc/salome/examples/filters_node_nb_conn.py @@ -0,0 +1,9 @@ +# Number of connectivities of a node + +# create a mesh +from SMESH_mechanic import * + +# get nodes connected to more than 6 tetrahedra +conn_nb_filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_NodeConnectivityNumber,'>', 6 ) +ids = mesh.GetIdsFromFilter( conn_nb_filter ) +print "Number of nodes connected to more than 6 tetrahedra:", len(ids) diff --git a/doc/salome/gui/SMESH/images/ctrlinfo.png b/doc/salome/gui/SMESH/images/ctrlinfo.png index 9cdad0ac8..497adcd95 100644 Binary files a/doc/salome/gui/SMESH/images/ctrlinfo.png and b/doc/salome/gui/SMESH/images/ctrlinfo.png differ diff --git a/doc/salome/gui/SMESH/input/mesh_infos.doc b/doc/salome/gui/SMESH/input/mesh_infos.doc index 929deb8f3..fd09d0d8d 100644 --- a/doc/salome/gui/SMESH/input/mesh_infos.doc +++ b/doc/salome/gui/SMESH/input/mesh_infos.doc @@ -7,7 +7,7 @@ The user can obtain information about the selected mesh object To view the Mesh Information, select your mesh, sub-mesh or group in the Object Browser and invoke Mesh Information -item from the \b Mesh menu or click "Mesh Information" button +item from the \b Mesh menu or from the context menu, or click "Mesh Information" button in the toolbar.
\image html image49.png @@ -60,7 +60,7 @@ information about the selected mesh node(s) or element(s), namely: - Gravity center (X, Y, Z coordinates); - Connectivity information (connected nodes); double click in a line of a node reveals the information about this node; - - Quality controls (area, aspect ration, volume, etc.); + - Quality controls (area, aspect ratio, volume, etc.); - Position on a shape (for meshes built on a geometry); - Groups information (names of groups the element belongs to). @@ -132,6 +132,7 @@ The Quality Info tab provides overall information about mesh quality cont - Name; - Nodes information: - Number of free nodes; + - Maximal number of elements connected to a node; - Number of double nodes; - Edges information: - Number of double edges; @@ -161,9 +162,6 @@ via the "Mesh information" preferences (zero value means that there is no limit) The button \b "Dump" allows printing the information displayed in the dialog box to a .txt file. -In case you get Mesh Information via a TUI script, the information is -displayed in the Python Console. - See the \ref tui_viewing_mesh_infos "TUI Example". */ diff --git a/doc/salome/gui/SMESH/input/selection_filter_library.doc b/doc/salome/gui/SMESH/input/selection_filter_library.doc index 145c48fec..03438c490 100644 --- a/doc/salome/gui/SMESH/input/selection_filter_library.doc +++ b/doc/salome/gui/SMESH/input/selection_filter_library.doc @@ -144,6 +144,10 @@ The following criteria allow selecting mesh Nodes: Double nodes selects a node coincident with other nodes (within a given Tolerance). See also \ref tui_double_nodes_control "Double Nodes quality control". +
  • +Connectivity number selects nodes with a number of connected +elements, which is more, less or equal to the predefined Threshold + Value. Elements of the highest dimension are countered only.
  • diff --git a/doc/salome/gui/SMESH/input/tui_filters.doc b/doc/salome/gui/SMESH/input/tui_filters.doc index 5a958d9a2..3c115293e 100755 --- a/doc/salome/gui/SMESH/input/tui_filters.doc +++ b/doc/salome/gui/SMESH/input/tui_filters.doc @@ -209,6 +209,16 @@ filters mesh nodes which are coincident with other nodes (within a given toleran \tui_script{filters_ex17.py} +\section filter_node_nb_conn Node connectivity number + +filters nodes according to a number of elements of highest dimension connected to a node: +- element type should be \a SMESH.NODE +- functor type should be \a SMESH.FT_NodeConnectivityNumber +- threshold is an integer value (number of elements) + +\tui_script{filters_node_nb_conn.py} + + \section filter_borders_multiconnection Borders at multi-connection filters 1D mesh elements (segments) according to the specified number of diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl index 7625bba24..f5c564522 100644 --- a/idl/SMESH_Filter.idl +++ b/idl/SMESH_Filter.idl @@ -61,6 +61,7 @@ module SMESH FT_MultiConnection2D, FT_Length, FT_Length2D, + FT_NodeConnectivityNumber, FT_BelongToMeshGroup, FT_BelongToGeom, FT_BelongToPlane, @@ -162,6 +163,7 @@ module SMESH Values GetValues(); }; interface BallDiameter : NumericalFunctor{}; + interface NodeConnectivityNumber : NumericalFunctor{}; /*! @@ -586,6 +588,7 @@ module SMESH MultiConnection CreateMultiConnection(); MultiConnection2D CreateMultiConnection2D(); BallDiameter CreateBallDiameter(); + NodeConnectivityNumber CreateNodeConnectivityNumber(); /*! * Create logical functors ( predicates ) */ diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 9a8589d92..bf8c097c0 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -2116,6 +2116,42 @@ SMDSAbs_ElementType BallDiameter::GetType() const return SMDSAbs_Ball; } +//================================================================================ +/* + Class : NodeConnectivityNumber + Description : Functor returning number of elements connected to a node +*/ +//================================================================================ + +double NodeConnectivityNumber::GetValue( long theId ) +{ + double nb = 0; + + if ( const SMDS_MeshNode* node = myMesh->FindNode( theId )) + { + SMDSAbs_ElementType type; + if ( myMesh->NbVolumes() > 0 ) + type = SMDSAbs_Volume; + else if ( myMesh->NbFaces() > 0 ) + type = SMDSAbs_Face; + else if ( myMesh->NbEdges() > 0 ) + type = SMDSAbs_Edge; + else + return 0; + nb = node->NbInverseElements( type ); + } + return nb; +} + +double NodeConnectivityNumber::GetBadRate( double Value, int /*nbNodes*/ ) const +{ + return Value; +} + +SMDSAbs_ElementType NodeConnectivityNumber::GetType() const +{ + return SMDSAbs_Node; +} /* PREDICATES diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx index 97b135048..830d43b81 100644 --- a/src/Controls/SMESH_ControlsDef.hxx +++ b/src/Controls/SMESH_ControlsDef.hxx @@ -351,6 +351,17 @@ namespace SMESH{ virtual SMDSAbs_ElementType GetType() const; }; + /* + Class : NodeConnectivityNumber + Description : Functor returning number of elements connected to a node + */ + class SMESHCONTROLS_EXPORT NodeConnectivityNumber: public virtual NumericalFunctor{ + public: + virtual double GetValue( long theNodeId ); + virtual double GetBadRate( double Value, int nbNodes ) const; + virtual SMDSAbs_ElementType GetType() const; + }; + /* PREDICATES diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 4006b506d..34c956b5c 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -694,7 +694,8 @@ void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int the } } -bool SMESH_ActorDef::GetPointsLabeled() { +bool SMESH_ActorDef::GetPointsLabeled() +{ return myNodeActor && myNodeActor->GetPointsLabeled(); } @@ -719,7 +720,8 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled) } -bool SMESH_ActorDef::GetCellsLabeled() { +bool SMESH_ActorDef::GetCellsLabeled() +{ bool result = false; if(my3DActor) result = result || my3DActor->GetCellsLabeled(); @@ -789,17 +791,13 @@ bool SMESH_ActorDef::GetFacesOrientation3DVectors() } -void -SMESH_ActorDef:: -SetControlMode(eControl theMode) +void SMESH_ActorDef::SetControlMode(eControl theMode) { SetControlMode(theMode,true); } -void -SMESH_ActorDef:: -SetControlMode( eControl theMode, bool theCheckEntityMode ) +void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) { vtkLookupTable* lookupTable = static_cast(myScalarBarActor->GetLookupTable()); bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10; @@ -982,6 +980,12 @@ SetControlMode( eControl theMode, bool theCheckEntityMode ) myControlActor = my2DActor; break; } + case eNodeConnectivityNb: + { + myFunctor.reset( new SMESH::Controls::NodeConnectivityNumber() ); + myControlActor = myNodeActor; + break; + } default: return; } @@ -989,7 +993,7 @@ SetControlMode( eControl theMode, bool theCheckEntityMode ) vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid(); vtkIdType aNbCells = aGrid->GetNumberOfCells(); bool aShowOnlyScalarBarTitle = false; - if(aNbCells){ + if(aNbCells) { myControlMode = theMode; switch(myControlMode){ case eFreeNodes: @@ -1029,6 +1033,15 @@ SetControlMode( eControl theMode, bool theCheckEntityMode ) } if(theCheckEntityMode) { + // if(myControlActor == myNodeActor) { + // if ( myControlMode == eNodeConnectivityNb ) { + // if (!myIsEntityModeCache){ + // myEntityModeCache = GetEntityMode(); + // myIsEntityModeCache=true; + // } + // SetEntityMode(0); + // } + // } if(myControlActor == my1DActor) { if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); @@ -1090,9 +1103,8 @@ SetControlMode( eControl theMode, bool theCheckEntityMode ) Update(); } -int -SMESH_ActorDef:: -GetNumberControlEntities(){ +int SMESH_ActorDef::GetNumberControlEntities() +{ SMESH_DeviceActor* anAct = NULL; switch(myControlMode){ case eFreeNodes: @@ -1115,12 +1127,13 @@ GetNumberControlEntities(){ case eCoincidentElems3D: anAct = my3DExtActor; break; + default:; } return (anAct) ? anAct->GetUnstructuredGrid()->GetNumberOfCells() : -1; } -void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ - +void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer) +{ theRenderer->AddActor(myBaseActor); theRenderer->AddActor(myNodeExtActor); theRenderer->AddActor(my1DExtActor); @@ -1143,7 +1156,8 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ SALOME_Actor::AddToRender(theRenderer); } -void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){ +void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer) +{ SALOME_Actor::RemoveFromRender(theRenderer); theRenderer->RemoveActor(myBaseActor); @@ -1170,9 +1184,9 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, - const char* theEntry, - const char* theName, - int theIsClear) + const char* theEntry, + const char* theName, + int theIsClear) { Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName); setIO(anIO); @@ -1258,17 +1272,20 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, } -double* SMESH_ActorDef::GetBounds(){ +double* SMESH_ActorDef::GetBounds() +{ return myNodeActor->GetBounds(); } -vtkDataSet* SMESH_ActorDef::GetInput(){ +vtkDataSet* SMESH_ActorDef::GetInput() +{ return GetUnstructuredGrid(); } -void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){ +void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform) +{ Superclass::SetTransform(theTransform); myNodeActor->SetTransform(theTransform); @@ -1294,27 +1311,32 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){ } -void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){ +void SMESH_ActorDef::SetMapper(vtkMapper* theMapper) +{ vtkLODActor::SetMapper(theMapper); } -void SMESH_ActorDef::ShallowCopy(vtkProp *prop){ +void SMESH_ActorDef::ShallowCopy(vtkProp *prop) +{ SALOME_Actor::ShallowCopy(prop); } -vtkMapper* SMESH_ActorDef::GetMapper(){ +vtkMapper* SMESH_ActorDef::GetMapper() +{ return myPickableActor->GetMapper(); } -vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){ +vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid() +{ return myVisualObj->GetUnstructuredGrid(); } -bool SMESH_ActorDef::IsInfinitive(){ +bool SMESH_ActorDef::IsInfinitive() +{ vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid(); myIsInfinite = aDataSet->GetNumberOfCells() == 0 || ( aDataSet->GetNumberOfCells() == 1 && @@ -1323,18 +1345,21 @@ bool SMESH_ActorDef::IsInfinitive(){ } -void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){ +void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable) +{ if ( myIsShrinkable == theShrunkable ) return; myIsShrinkable = theShrunkable; Modified(); } -double SMESH_ActorDef::GetShrinkFactor(){ +double SMESH_ActorDef::GetShrinkFactor() +{ return myBaseActor->GetShrinkFactor(); } -void SMESH_ActorDef::SetShrinkFactor(double theValue){ +void SMESH_ActorDef::SetShrinkFactor(double theValue) +{ myBaseActor->SetShrinkFactor(theValue); my1DActor->SetShrinkFactor(theValue); @@ -1350,7 +1375,8 @@ void SMESH_ActorDef::SetShrinkFactor(double theValue){ Modified(); } -void SMESH_ActorDef::SetShrink() { +void SMESH_ActorDef::SetShrink() +{ if(!myIsShrinkable) return; myBaseActor->SetShrink(); @@ -1368,7 +1394,8 @@ void SMESH_ActorDef::SetShrink() { Modified(); } -void SMESH_ActorDef::UnShrink(){ +void SMESH_ActorDef::UnShrink() +{ if(!myIsShrunk) return; myBaseActor->UnShrink(); @@ -1387,30 +1414,36 @@ void SMESH_ActorDef::UnShrink(){ } -int SMESH_ActorDef::GetNodeObjId(int theVtkID){ +int SMESH_ActorDef::GetNodeObjId(int theVtkID) +{ return myPickableActor->GetNodeObjId(theVtkID); } -double* SMESH_ActorDef::GetNodeCoord(int theObjID){ +double* SMESH_ActorDef::GetNodeCoord(int theObjID) +{ return myPickableActor->GetNodeCoord(theObjID); } -int SMESH_ActorDef::GetElemObjId(int theVtkID){ +int SMESH_ActorDef::GetElemObjId(int theVtkID) +{ return myPickableActor->GetElemObjId(theVtkID); } -vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){ +vtkCell* SMESH_ActorDef::GetElemCell(int theObjID) +{ return myPickableActor->GetElemCell(theObjID); } -void SMESH_ActorDef::SetVisibility(int theMode){ +void SMESH_ActorDef::SetVisibility(int theMode) +{ SetVisibility(theMode,true); } -void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ +void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) +{ SALOME_Actor::SetVisibility(theMode); myNodeActor->VisibilityOff(); @@ -1436,8 +1469,8 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ if(theIsUpdateRepersentation) SetRepresentation(GetRepresentation()); - if(myControlMode != eNone){ - switch(myControlMode){ + if(myControlMode != eNone) { + switch(myControlMode) { case eFreeNodes: case eCoincidentNodes: myNodeExtActor->VisibilityOn(); @@ -1462,6 +1495,7 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ case eMultiConnection2D: my1DExtActor->VisibilityOn(); break; + default:; } if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) myScalarBarActor->VisibilityOn(); @@ -1777,19 +1811,22 @@ void SMESH_ActorDef::SetRepresentation (int theMode) } -void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){ +void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible) +{ if ( myIsPointsVisible == theIsPointsVisible ) return; myIsPointsVisible = theIsPointsVisible; SetRepresentation(GetRepresentation()); } -bool SMESH_ActorDef::GetPointRepresentation(){ +bool SMESH_ActorDef::GetPointRepresentation() +{ return myIsPointsVisible || myNodeActor->GetPointsLabeled(); } -void SMESH_ActorDef::UpdateHighlight(){ +void SMESH_ActorDef::UpdateHighlight() +{ myHighlitableActor->SetHighlited(false); myHighlitableActor->SetVisibility(false); bool anIsVisible = GetVisibility(); @@ -1832,7 +1869,8 @@ void SMESH_ActorDef::UpdateHighlight(){ } -void SMESH_ActorDef::highlight(bool theHighlight){ +void SMESH_ActorDef::highlight(bool theHighlight) +{ if ( myIsHighlighted == theHighlight ) return; myIsHighlighted = theHighlight; @@ -1840,7 +1878,8 @@ void SMESH_ActorDef::highlight(bool theHighlight){ } -void SMESH_ActorDef::SetPreSelected(bool thePreselect){ +void SMESH_ActorDef::SetPreSelected(bool thePreselect) +{ if ( myIsPreselected == thePreselect ) return; myIsPreselected = thePreselect; @@ -1873,7 +1912,8 @@ int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp) } -void SMESH_ActorDef::Render(vtkRenderer *ren){ +void SMESH_ActorDef::Render(vtkRenderer *ren) +{ unsigned long aTime = myTimeStamp->GetMTime(); unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); unsigned long aClippingTime = myImplicitBoolean->GetMTime(); @@ -1882,7 +1922,8 @@ void SMESH_ActorDef::Render(vtkRenderer *ren){ } -void SMESH_ActorDef::Update(){ +void SMESH_ActorDef::Update() +{ if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update"); if(GetControlMode() != eNone) { @@ -1926,14 +1967,16 @@ void SMESH_ActorDef::Update(){ } -void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){ +void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin) +{ SALOME_Actor::ReleaseGraphicsResources(renWin); myPickableActor->ReleaseGraphicsResources(renWin); } -static void GetColor(vtkProperty *theProperty, double& r,double& g,double& b){ +static void GetColor(vtkProperty *theProperty, double& r,double& g,double& b) +{ double* aColor = theProperty->GetColor(); r = aColor[0]; g = aColor[1]; @@ -1941,7 +1984,8 @@ static void GetColor(vtkProperty *theProperty, double& r,double& g,double& b){ } -void SMESH_ActorDef::SetOpacity(double theValue){ +void SMESH_ActorDef::SetOpacity(double theValue) +{ mySurfaceProp->SetOpacity(theValue); myBackSurfaceProp->SetOpacity(theValue); myNormalVProp->SetOpacity(theValue); @@ -1956,12 +2000,14 @@ void SMESH_ActorDef::SetOpacity(double theValue){ } -double SMESH_ActorDef::GetOpacity(){ +double SMESH_ActorDef::GetOpacity() +{ return mySurfaceProp->GetOpacity(); } -void SMESH_ActorDef::SetSufaceColor(double r,double g,double b, int delta){ +void SMESH_ActorDef::SetSufaceColor(double r,double g,double b, int delta) +{ mySurfaceProp->SetColor(r,g,b); my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b); if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) ) @@ -1974,12 +2020,14 @@ void SMESH_ActorDef::SetSufaceColor(double r,double g,double b, int delta){ Modified(); } -void SMESH_ActorDef::GetSufaceColor(double& r,double& g,double& b, int& delta){ +void SMESH_ActorDef::GetSufaceColor(double& r,double& g,double& b, int& delta) +{ ::GetColor(mySurfaceProp,r,g,b); delta = myDeltaBrightness; } -void SMESH_ActorDef::SetVolumeColor(double r,double g,double b, int delta){ +void SMESH_ActorDef::SetVolumeColor(double r,double g,double b, int delta) +{ myNormalVProp->SetColor(r,g,b); my3DExtProp->SetColor(1.0-r,1.0-g,1.0-b); if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) ) @@ -1992,12 +2040,14 @@ void SMESH_ActorDef::SetVolumeColor(double r,double g,double b, int delta){ Modified(); } -void SMESH_ActorDef::GetVolumeColor(double& r,double& g,double& b, int& delta){ +void SMESH_ActorDef::GetVolumeColor(double& r,double& g,double& b, int& delta) +{ ::GetColor(myNormalVProp,r,g,b); delta = myDeltaVBrightness; } -void SMESH_ActorDef::SetEdgeColor(double r,double g,double b){ +void SMESH_ActorDef::SetEdgeColor(double r,double g,double b) +{ myEdgeProp->SetColor(r,g,b); my1DProp->SetColor(r,g,b); my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b); @@ -2007,21 +2057,25 @@ void SMESH_ActorDef::SetEdgeColor(double r,double g,double b){ Modified(); } -void SMESH_ActorDef::GetEdgeColor(double& r,double& g,double& b){ +void SMESH_ActorDef::GetEdgeColor(double& r,double& g,double& b) +{ ::GetColor(myEdgeProp,r,g,b); } -void SMESH_ActorDef::SetOutlineColor(double r,double g,double b){ +void SMESH_ActorDef::SetOutlineColor(double r,double g,double b) +{ myOutLineProp->SetColor(r,g,b); Modified(); } -void SMESH_ActorDef::GetOutlineColor(double& r,double& g,double& b){ +void SMESH_ActorDef::GetOutlineColor(double& r,double& g,double& b) +{ ::GetColor(myOutLineProp,r,g,b); } -void SMESH_ActorDef::SetNodeColor(double r,double g,double b){ +void SMESH_ActorDef::SetNodeColor(double r,double g,double b) +{ myNodeProp->SetColor(r,g,b); myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b); if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) ) @@ -2030,11 +2084,13 @@ void SMESH_ActorDef::SetNodeColor(double r,double g,double b){ Modified(); } -void SMESH_ActorDef::GetNodeColor(double& r,double& g,double& b){ +void SMESH_ActorDef::GetNodeColor(double& r,double& g,double& b) +{ ::GetColor(myNodeProp,r,g,b); } -void SMESH_ActorDef::Set0DColor(double r,double g,double b){ +void SMESH_ActorDef::Set0DColor(double r,double g,double b) +{ my0DProp->SetColor(r,g,b); if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) ) if( aGroupObj->GetElementType() == SMDSAbs_0DElement ) @@ -2042,11 +2098,13 @@ void SMESH_ActorDef::Set0DColor(double r,double g,double b){ Modified(); } -void SMESH_ActorDef::Get0DColor(double& r,double& g,double& b){ +void SMESH_ActorDef::Get0DColor(double& r,double& g,double& b) +{ ::GetColor(my0DProp,r,g,b); } -void SMESH_ActorDef::SetBallColor(double r,double g,double b){ +void SMESH_ActorDef::SetBallColor(double r,double g,double b) +{ myBallProp->SetColor(r,g,b); if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) ) if( aGroupObj->GetElementType() == SMDSAbs_Ball ) @@ -2054,35 +2112,42 @@ void SMESH_ActorDef::SetBallColor(double r,double g,double b){ Modified(); } -void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b){ +void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b) +{ ::GetColor(myBallProp,r,g,b); } -void SMESH_ActorDef::SetHighlightColor(double r,double g,double b){ +void SMESH_ActorDef::SetHighlightColor(double r,double g,double b) +{ myHighlightProp->SetColor(r,g,b); Modified(); } -void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b){ +void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b) +{ ::GetColor(myHighlightProp,r,g,b); } -void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b){ +void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b) +{ myPreselectProp->SetColor(r,g,b); Modified(); } -void SMESH_ActorDef::GetPreHighlightColor(double& r,double& g,double& b){ +void SMESH_ActorDef::GetPreHighlightColor(double& r,double& g,double& b) +{ ::GetColor(myPreselectProp,r,g,b); } -double SMESH_ActorDef::GetLineWidth(){ +double SMESH_ActorDef::GetLineWidth() +{ return myEdgeProp->GetLineWidth(); } -void SMESH_ActorDef::SetLineWidth(double theVal){ +void SMESH_ActorDef::SetLineWidth(double theVal) +{ myEdgeProp->SetLineWidth(theVal); my1DProp->SetLineWidth(theVal + aLineWidthInc); @@ -2106,7 +2171,8 @@ void SMESH_ActorDef::SetOutlineWidth(double theVal) Modified(); } -void SMESH_ActorDef::Set0DSize(double theVal){ +void SMESH_ActorDef::Set0DSize(double theVal) +{ my0DProp->SetPointSize(theVal); myHighlightProp->SetPointSize(theVal); myPreselectProp->SetPointSize(theVal); @@ -2121,11 +2187,13 @@ void SMESH_ActorDef::Set0DSize(double theVal){ Modified(); } -double SMESH_ActorDef::Get0DSize(){ +double SMESH_ActorDef::Get0DSize() +{ return my0DProp->GetPointSize(); } -void SMESH_ActorDef::SetBallSize(double theVal){ +void SMESH_ActorDef::SetBallSize(double theVal) +{ myBallProp->SetPointSize(theVal); if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) { @@ -2138,7 +2206,8 @@ void SMESH_ActorDef::SetBallSize(double theVal){ Modified(); } -double SMESH_ActorDef::GetBallSize(){ +double SMESH_ActorDef::GetBallSize() +{ return myBallProp->GetPointSize(); } @@ -2165,15 +2234,12 @@ int SMESH_ActorDef::GetObjDimension( const int theObjId ) return myVisualObj->GetElemDimension( theObjId ); } -bool -SMESH_ActorDef:: -IsImplicitFunctionUsed() const +bool SMESH_ActorDef::IsImplicitFunctionUsed() const { return myBaseActor->IsImplicitFunctionUsed(); } -void -SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) +void SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) { myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); @@ -2195,8 +2261,7 @@ SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); } -vtkIdType -SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane) +vtkIdType SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane) { if(thePlane){ myImplicitBoolean->GetFunction()->AddItem(thePlane); @@ -2208,15 +2273,13 @@ SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane) return myCippingPlaneCont.size(); } -void -SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane) +void SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane) { if(thePlane) myPlaneCollection->AddItem( thePlane ); } -void -SMESH_ActorDef::SetOpenGLClippingPlane() +void SMESH_ActorDef::SetOpenGLClippingPlane() { // before use this method you must add clipping planes using method // SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane) @@ -2267,9 +2330,7 @@ SMESH_ActorDef::SetOpenGLClippingPlane() Modified(); } -void -SMESH_ActorDef:: -RemoveAllClippingPlanes() +void SMESH_ActorDef::RemoveAllClippingPlanes() { myPlaneCollection->RemoveAllItems(); myImplicitBoolean->GetFunction()->RemoveAllItems(); @@ -2279,16 +2340,12 @@ RemoveAllClippingPlanes() myNodeActor->UpdateLabels(); } -vtkIdType -SMESH_ActorDef:: -GetNumberOfClippingPlanes() +vtkIdType SMESH_ActorDef::GetNumberOfClippingPlanes() { return myCippingPlaneCont.size(); } -vtkPlane* -SMESH_ActorDef:: -GetClippingPlane(vtkIdType theID) +vtkPlane* SMESH_ActorDef::GetClippingPlane(vtkIdType theID) { if ( theID >= (vtkIdType)myCippingPlaneCont.size() ) return NULL; @@ -2437,7 +2494,7 @@ void SMESH_ActorDef::UpdateDistribution() SMESH_VisualObjDef::TEntityList elems; if ( ! dynamic_cast(myVisualObj.get())) dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems ); - std::vector elemIds; + std::vector elemIds; elemIds.reserve( elems.size() ); for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e) elemIds.push_back( (*e)->GetID()); vtkLookupTable* lookupTable = static_cast(myScalarBarActor->GetLookupTable()); @@ -2493,8 +2550,8 @@ void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMa } #ifndef DISABLE_PLOT2DVIEWER -SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() { - +SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() +{ if(my2dHistogram) my2dHistogram->clearAllPoints(); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index abe27bb4e..f49d55cbb 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -146,7 +146,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D, eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume, eOverConstrainedFace, eOverConstrainedVolume, eCoincidentNodes, - eCoincidentElems1D, eCoincidentElems2D, eCoincidentElems3D }; + eCoincidentElems1D, eCoincidentElems2D, eCoincidentElems3D, eNodeConnectivityNb }; virtual void SetControlMode(eControl theMode) = 0; virtual eControl GetControlMode() = 0; virtual SMESH::Controls::FunctorPtr GetFunctor() = 0; diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 701fc9127..4c7911769 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1142,6 +1142,8 @@ namespace type = QObject::tr( "EQUAL_FACE" ); else if ( dynamic_cast< SMESH::Controls::CoincidentElements3D* >( f.get() ) ) type = QObject::tr( "EQUAL_VOLUME" ); + else if ( dynamic_cast< SMESH::Controls::NodeConnectivityNumber* >( f.get() ) ) + type = QObject::tr( "NODE_CONNECTIVITY_NB" ); return type; } @@ -1636,6 +1638,7 @@ namespace ActionControl.Bind( 0, SMESH_Actor::eNone ); ActionControl.Bind( SMESHOp::OpFreeNode, SMESH_Actor::eFreeNodes ); ActionControl.Bind( SMESHOp::OpEqualNode, SMESH_Actor::eCoincidentNodes ); + ActionControl.Bind( SMESHOp::OpNodeConnectivityNb, SMESH_Actor::eNodeConnectivityNb ); ActionControl.Bind( SMESHOp::OpFreeEdge, SMESH_Actor::eFreeEdges ); ActionControl.Bind( SMESHOp::OpFreeBorder, SMESH_Actor::eFreeBorders ); ActionControl.Bind( SMESHOp::OpLength, SMESH_Actor::eLength ); @@ -3577,6 +3580,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) // CONTROLS case SMESHOp::OpFreeNode: case SMESHOp::OpEqualNode: + case SMESHOp::OpNodeConnectivityNb: case SMESHOp::OpFreeEdge: case SMESHOp::OpFreeBorder: case SMESHOp::OpLength: @@ -3869,6 +3873,7 @@ void SMESHGUI::initialize( CAM_Application* app ) //update createSMESHAction( SMESHOp::OpFreeNode, "FREE_NODE", "ICON_FREE_NODE", 0, true ); createSMESHAction( SMESHOp::OpEqualNode, "EQUAL_NODE", "ICON_EQUAL_NODE", 0, true ); + createSMESHAction( SMESHOp::OpNodeConnectivityNb, "NODE_CONNECTIVITY_NB", "ICON_NODE_CONN_NB", 0, true ); createSMESHAction( SMESHOp::OpFreeEdge, "FREE_EDGE", "ICON_FREE_EDGE", 0, true ); createSMESHAction( SMESHOp::OpFreeBorder, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true ); createSMESHAction( SMESHOp::OpLength, "LENGTH", "ICON_LENGTH", 0, true ); @@ -4002,7 +4007,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); QList aCtrlActions; - aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode // node controls + aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode + << SMESHOp::OpNodeConnectivityNb // node controls << SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder << SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls << SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D @@ -4099,6 +4105,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( SMESHOp::OpFreeNode, nodeId, -1 ); createMenu( SMESHOp::OpEqualNode, nodeId, -1 ); + //createMenu( SMESHOp::OpNodeConnectivityNb, nodeId, -1 ); createMenu( SMESHOp::OpFreeBorder, edgeId, -1 ); createMenu( SMESHOp::OpLength, edgeId, -1 ); createMenu( SMESHOp::OpConnection, edgeId, -1 ); @@ -4244,6 +4251,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( SMESHOp::OpFreeNode, ctrl0dTb ); createTool( SMESHOp::OpEqualNode, ctrl0dTb ); + //createTool( SMESHOp::OpNodeConnectivityNb, ctrl0dTb ); createTool( SMESHOp::OpFreeBorder, ctrl1dTb ); createTool( SMESHOp::OpLength, ctrl1dTb ); @@ -4586,6 +4594,10 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( SMESHOp::OpEqualNode ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpEqualNode ), "controlMode = 'eCoincidentNodes'", QtxPopupMgr::ToggleRule); + // popupMgr()->insert( action( SMESHOp::OpNodeConnectivityNb ), aSubId, -1 ); + // popupMgr()->setRule( action( SMESHOp::OpNodeConnectivityNb ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule ); + // popupMgr()->setRule( action( SMESHOp::OpNodeConnectivityNb ), "controlMode = 'eNodeConnectivityNb'", QtxPopupMgr::ToggleRule ); + aSubId = popupMgr()->insert( tr( "MEN_EDGE_CTRL" ), anId, -1 ); // EDGE CONTROLS popupMgr()->insert( action( SMESHOp::OpFreeBorder ), aSubId, -1 ); diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index b55632f0a..240523d4c 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1823,6 +1823,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con case SMESH::FT_EqualFaces: case SMESH::FT_EqualVolumes: break; + case SMESH::FT_NodeConnectivityNumber: case SMESH::FT_MultiConnection: case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; nbCompareSigns = 3; break; @@ -2190,6 +2191,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_EqualNodes ] = tr("EQUAL_NODE"); aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS"); + aCriteria[ SMESH::FT_NodeConnectivityNumber ] = tr("NODE_CONN_NUMBER"); } return aCriteria; } diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index b0b1a6ed7..4d7f87a98 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -3225,6 +3225,11 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent ) myWidgets << aNodesFree; myPredicates << aFilterMgr->CreateFreeNodes(); // + QLabel* aNodesNbConnLab = new QLabel( tr( "MAX_NODE_CONNECTIVITY" ), this ); + QLabel* aNodesNbConn = createField(); + myWidgets << aNodesNbConn; + myNodeConnFunctor = aFilterMgr->CreateNodeConnectivityNumber(); + // QLabel* aNodesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_NODES" ), this ); QLabel* aNodesDouble = createField(); myWidgets << aNodesDouble; @@ -3274,47 +3279,52 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent ) aFreeNodesBtn->setIcon(aComputeIcon); myButtons << aFreeNodesBtn; //0 + QToolButton* aNodesNbConnBtn = new QToolButton( this ); + aNodesNbConnBtn->setIcon(aComputeIcon); + myButtons << aNodesNbConnBtn; //1 + QToolButton* aDoubleNodesBtn = new QToolButton( this ); aDoubleNodesBtn->setIcon(aComputeIcon); - myButtons << aDoubleNodesBtn; //1 + myButtons << aDoubleNodesBtn; //2 QToolButton* aDoubleEdgesBtn = new QToolButton( this ); aDoubleEdgesBtn->setIcon(aComputeIcon); - myButtons << aDoubleEdgesBtn; //2 + myButtons << aDoubleEdgesBtn; //3 QToolButton* aDoubleFacesBtn = new QToolButton( this ); aDoubleFacesBtn->setIcon(aComputeIcon); - myButtons << aDoubleFacesBtn; //3 + myButtons << aDoubleFacesBtn; //4 QToolButton* aOverContFacesBtn = new QToolButton( this ); aOverContFacesBtn->setIcon(aComputeIcon); - myButtons << aOverContFacesBtn; //4 + myButtons << aOverContFacesBtn; //5 QToolButton* aComputeFaceBtn = new QToolButton( this ); aComputeFaceBtn->setIcon(aComputeIcon); - myButtons << aComputeFaceBtn; //5 + myButtons << aComputeFaceBtn; //6 QToolButton* aDoubleVolumesBtn = new QToolButton( this ); aDoubleVolumesBtn->setIcon(aComputeIcon); - myButtons << aDoubleVolumesBtn; //6 + myButtons << aDoubleVolumesBtn; //7 QToolButton* aOverContVolumesBtn = new QToolButton( this ); aOverContVolumesBtn->setIcon(aComputeIcon); - myButtons << aOverContVolumesBtn; //7 + myButtons << aOverContVolumesBtn; //8 QToolButton* aComputeVolumeBtn = new QToolButton( this ); aComputeVolumeBtn->setIcon(aComputeIcon); - myButtons << aComputeVolumeBtn; //8 + myButtons << aComputeVolumeBtn; //9 connect( aComputeFaceBtn, SIGNAL( clicked() ), this, SLOT( computeAspectRatio() ) ); connect( aComputeVolumeBtn, SIGNAL( clicked() ), this, SLOT( computeAspectRatio3D() ) ); - connect( aFreeNodesBtn, SIGNAL( clicked() ), this, SLOT( computeFreeNodesInfo() ) ); - connect( aDoubleNodesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleNodesInfo() ) ); - connect( aDoubleEdgesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleEdgesInfo() ) ); - connect( aDoubleFacesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleFacesInfo() ) ); + connect( aFreeNodesBtn, SIGNAL( clicked() ), this, SLOT( computeFreeNodesInfo() ) ); + connect( aNodesNbConnBtn, SIGNAL( clicked() ), this, SLOT( computeNodesNbConnInfo() ) ); + connect( aDoubleNodesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleNodesInfo() ) ); + connect( aDoubleEdgesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleEdgesInfo() ) ); + connect( aDoubleFacesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleFacesInfo() ) ); connect( aOverContFacesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedFacesInfo() ) ); connect( aDoubleVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleVolumesInfo() ) ); - connect( aOverContVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ) ); + connect( aOverContVolumesBtn,SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ) ); connect( myToleranceWidget, SIGNAL(valueChanged(double)), this, SLOT( setTolerance( double ))); setFontAttributes( aNameLab ); @@ -3329,35 +3339,38 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent ) myMainLayout->addWidget( aNodesFreeLab, 2, 0 ); //3 myMainLayout->addWidget( aNodesFree, 2, 1 ); //4 myMainLayout->addWidget( aFreeNodesBtn, 2, 2 ); //5 - myMainLayout->addWidget( aNodesDoubleLab, 3, 0 ); //6 - myMainLayout->addWidget( aNodesDouble, 3, 1 ); //7 - myMainLayout->addWidget( aDoubleNodesBtn, 3, 2 ); //8 - myMainLayout->addWidget( aToleranceLab, 4, 0 ); //9 - myMainLayout->addWidget( myToleranceWidget, 4, 1 ); //10 - myMainLayout->addWidget( anEdgesLab, 5, 0, 1, 3 ); //11 - myMainLayout->addWidget( anEdgesDoubleLab, 6, 0 ); //12 - myMainLayout->addWidget( anEdgesDouble, 6, 1 ); //13 - myMainLayout->addWidget( aDoubleEdgesBtn, 6, 2 ); //14 - myMainLayout->addWidget( aFacesLab, 7, 0, 1, 3 ); //15 - myMainLayout->addWidget( aFacesDoubleLab, 8, 0 ); //16 - myMainLayout->addWidget( aFacesDouble, 8, 1 ); //17 - myMainLayout->addWidget( aDoubleFacesBtn, 8, 2 ); //18 - myMainLayout->addWidget( aFacesOverLab, 9, 0 ); //19 - myMainLayout->addWidget( aFacesOver, 9, 1 ); //20 - myMainLayout->addWidget( aOverContFacesBtn, 9, 2 ); //21 - myMainLayout->addWidget( anAspectRatioLab, 10, 0 ); //22 - myMainLayout->addWidget( aComputeFaceBtn, 10, 2 ); //23 - myMainLayout->addWidget( myPlot, 11, 0, 1, 3 );//24 - myMainLayout->addWidget( aVolumesLab, 12, 0, 1, 3 );//25 - myMainLayout->addWidget( aVolumesDoubleLab, 13, 0 ); //26 - myMainLayout->addWidget( aVolumesDouble, 13, 1 ); //27 - myMainLayout->addWidget( aDoubleVolumesBtn, 13, 2 ); //28 - myMainLayout->addWidget( aVolumesOverLab, 14, 0 ); //28 - myMainLayout->addWidget( aVolumesOver, 14, 1 ); //30 - myMainLayout->addWidget( aOverContVolumesBtn,14, 2 ); //31 - myMainLayout->addWidget( anAspectRatio3DLab, 15, 0 ); //32 - myMainLayout->addWidget( aComputeVolumeBtn, 15, 2 ); //33 - myMainLayout->addWidget( myPlot3D, 16, 0, 1, 3 );//34 + myMainLayout->addWidget( aNodesNbConnLab, 3, 0 ); //6 + myMainLayout->addWidget( aNodesNbConn, 3, 1 ); //7 + myMainLayout->addWidget( aNodesNbConnBtn, 3, 2 ); //8 + myMainLayout->addWidget( aNodesDoubleLab, 4, 0 ); //9 + myMainLayout->addWidget( aNodesDouble, 4, 1 ); //10 + myMainLayout->addWidget( aDoubleNodesBtn, 4, 2 ); //11 + myMainLayout->addWidget( aToleranceLab, 5, 0 ); //12 + myMainLayout->addWidget( myToleranceWidget, 5, 1 ); //13 + myMainLayout->addWidget( anEdgesLab, 6, 0, 1, 3 ); //14 + myMainLayout->addWidget( anEdgesDoubleLab, 7, 0 ); //15 + myMainLayout->addWidget( anEdgesDouble, 7, 1 ); //16 + myMainLayout->addWidget( aDoubleEdgesBtn, 7, 2 ); //17 + myMainLayout->addWidget( aFacesLab, 8, 0, 1, 3 ); //18 + myMainLayout->addWidget( aFacesDoubleLab, 9, 0 ); //19 + myMainLayout->addWidget( aFacesDouble, 9, 1 ); //20 + myMainLayout->addWidget( aDoubleFacesBtn, 9, 2 ); //21 + myMainLayout->addWidget( aFacesOverLab, 10, 0 ); //22 + myMainLayout->addWidget( aFacesOver, 10, 1 ); //23 + myMainLayout->addWidget( aOverContFacesBtn, 10, 2 ); //24 + myMainLayout->addWidget( anAspectRatioLab, 11, 0 ); //25 + myMainLayout->addWidget( aComputeFaceBtn, 11, 2 ); //26 + myMainLayout->addWidget( myPlot, 12, 0, 1, 3 );//27 + myMainLayout->addWidget( aVolumesLab, 13, 0, 1, 3 );//28 + myMainLayout->addWidget( aVolumesDoubleLab, 14, 0 ); //29 + myMainLayout->addWidget( aVolumesDouble, 14, 1 ); //30 + myMainLayout->addWidget( aDoubleVolumesBtn, 14, 2 ); //31 + myMainLayout->addWidget( aVolumesOverLab, 15, 0 ); //32 + myMainLayout->addWidget( aVolumesOver, 15, 1 ); //33 + myMainLayout->addWidget( aOverContVolumesBtn,15, 2 ); //34 + myMainLayout->addWidget( anAspectRatio3DLab, 16, 0 ); //35 + myMainLayout->addWidget( aComputeVolumeBtn, 16, 2 ); //36 + myMainLayout->addWidget( myPlot3D, 17, 0, 1, 3 );//37 myMainLayout->setColumnStretch( 0, 0 ); myMainLayout->setColumnStretch( 1, 5 ); @@ -3460,6 +3473,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) if ( Max( (int)nbNodes, (int)nbElems ) <= ctrlLimit ) { // free nodes computeFreeNodesInfo(); + computeNodesNbConnInfo(); // double nodes if ( Max( (int)mesh->NbNodes(), (int)mesh->NbElements() ) <= ctrlLimit ) computeDoubleNodesInfo(); @@ -3467,10 +3481,11 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) else { myButtons[0]->setEnabled( true ); myButtons[1]->setEnabled( true ); + myButtons[2]->setEnabled( true ); } } else { - for( int i=2; i<=10; i++) + for( int i=2; i<=11; i++) myMainLayout->itemAt(i)->widget()->setVisible( false ); } @@ -3480,7 +3495,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) if( nbElemsByType[ SMESH::EDGE ] <= ctrlLimit ) computeDoubleEdgesInfo(); else - myButtons[2]->setEnabled( true ); + myButtons[3]->setEnabled( true ); } else { for( int i=11; i<=14; i++) @@ -3498,19 +3513,19 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) computeAspectRatio(); } else { - myButtons[3]->setEnabled( true ); myButtons[4]->setEnabled( true ); myButtons[5]->setEnabled( true ); + myButtons[6]->setEnabled( true ); } #ifdef DISABLE_PLOT2DVIEWER - myMainLayout->setRowStretch(11,0); - for( int i=22; i<=24; i++) + myMainLayout->setRowStretch(12,0); + for( int i=25; i<=27; i++) myMainLayout->itemAt(i)->widget()->setVisible( false ); #endif } else { - myMainLayout->setRowStretch(11,0); - for( int i=15; i<=24; i++) + myMainLayout->setRowStretch(12,0); + for( int i=18; i<=27; i++) myMainLayout->itemAt(i)->widget()->setVisible( false ); } @@ -3525,19 +3540,19 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) computeAspectRatio3D(); } else { - myButtons[6]->setEnabled( true ); myButtons[7]->setEnabled( true ); myButtons[8]->setEnabled( true ); + myButtons[9]->setEnabled( true ); } #ifdef DISABLE_PLOT2DVIEWER - myMainLayout->setRowStretch(16,0); - for( int i=32; i<=34; i++) + myMainLayout->setRowStretch(17,0); + for( int i=35; i<=37; i++) myMainLayout->itemAt(i)->widget()->setVisible( false ); #endif } else { - myMainLayout->setRowStretch(16,0); - for( int i=25; i<=34; i++) + myMainLayout->setRowStretch(17,0); + for( int i=28; i<=37; i++) myMainLayout->itemAt(i)->widget()->setVisible( false ); } } @@ -3583,38 +3598,58 @@ void SMESHGUI_CtrlInfo::computeFreeNodesInfo() void SMESHGUI_CtrlInfo::computeDoubleNodesInfo() { - computeNb( SMESH::FT_EqualNodes, 1, 2 ); + computeNb( SMESH::FT_EqualNodes, 2, 3 ); } void SMESHGUI_CtrlInfo::computeDoubleEdgesInfo() { - computeNb( SMESH::FT_EqualEdges, 2, 3 ); + computeNb( SMESH::FT_EqualEdges, 3, 4 ); } void SMESHGUI_CtrlInfo::computeDoubleFacesInfo() { - computeNb( SMESH::FT_EqualFaces, 3, 4 ); + computeNb( SMESH::FT_EqualFaces, 4, 5 ); } void SMESHGUI_CtrlInfo::computeOverConstrainedFacesInfo() { - computeNb( SMESH::FT_OverConstrainedFace, 4, 5 ); + computeNb( SMESH::FT_OverConstrainedFace, 5, 6 ); } void SMESHGUI_CtrlInfo::computeDoubleVolumesInfo() { - computeNb( SMESH::FT_EqualVolumes, 6, 6 ); + computeNb( SMESH::FT_EqualVolumes, 7, 7 ); } void SMESHGUI_CtrlInfo::computeOverConstrainedVolumesInfo() { - computeNb( SMESH::FT_OverConstrainedVolume, 7, 7 ); + computeNb( SMESH::FT_OverConstrainedVolume, 8, 8 ); +} + +void SMESHGUI_CtrlInfo::computeNodesNbConnInfo() +{ + myButtons[ 1 ]->setEnabled( false ); + myWidgets[ 2 ]->setText( "" ); + SMESH::SMESH_Mesh_var mesh = myObject->GetMesh(); + if ( mesh->_is_nil() ) return; + if ( !mesh->IsLoaded() ) + { + mesh->Load(); + this->showInfo( myObject ); // try to show all values + if ( !myWidgets[ 2 ]->text().isEmpty() ) + return; // already computed + } + myNodeConnFunctor->SetMesh( mesh ); + SMESH::Histogram_var histogram = + myNodeConnFunctor->GetLocalHistogram( 1, /*isLogarithmic=*/false, myObject ); + + myWidgets[ 2 ]->setText( QString::number( histogram[0].max )); } void SMESHGUI_CtrlInfo::computeAspectRatio() { #ifndef DISABLE_PLOT2DVIEWER - myButtons[5]->setEnabled( false ); + myButtons[6]->setEnabled( false ); if ( myObject->_is_nil() ) return; @@ -3633,7 +3668,7 @@ void SMESHGUI_CtrlInfo::computeAspectRatio() void SMESHGUI_CtrlInfo::computeAspectRatio3D() { #ifndef DISABLE_PLOT2DVIEWER - myButtons[8]->setEnabled( false ); + myButtons[9]->setEnabled( false ); if ( myObject->_is_nil() ) return; @@ -3654,9 +3689,9 @@ void SMESHGUI_CtrlInfo::computeAspectRatio3D() */ void SMESHGUI_CtrlInfo::clearInternal() { - for( int i=0; i<=34; i++) + for( int i=0; i<=35; i++) myMainLayout->itemAt(i)->widget()->setVisible( true ); - for( int i=0; i<=8; i++) + for( int i=0; i<=9; i++) myButtons[i]->setEnabled( false ); myPlot->detachItems(); myPlot3D->detachItems(); @@ -3734,7 +3769,6 @@ void SMESHGUI_CtrlInfo::saveInfo( QTextStream &out ) { /*! \brief Constructor \param parent parent widget - \param page specifies the dialog page to be shown at the start-up */ SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent ) : QDialog( parent ) diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.h b/src/SMESHGUI/SMESHGUI_MeshInfo.h index c8f8108f4..dd1af5c02 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.h @@ -324,6 +324,7 @@ private slots: void computeAspectRatio(); void computeAspectRatio3D(); void computeFreeNodesInfo(); + void computeNodesNbConnInfo(); void computeDoubleNodesInfo(); void computeDoubleEdgesInfo(); void computeDoubleFacesInfo(); @@ -345,7 +346,7 @@ private: QwtPlot* myPlot3D; QList myButtons; QList myPredicates; - TNumFunctor myAspectRatio, myAspectRatio3D; + TNumFunctor myAspectRatio, myAspectRatio3D, myNodeConnFunctor; }; class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index 784940e90..df810f7df 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -98,6 +98,7 @@ namespace SMESHOp { // Controls -----------------------//-------------------------------- OpFreeNode = 3000, // MENU CONTROLS - FREE NODES OpEqualNode = 3001, // MENU CONTROLS - DOUBLE NODES + OpNodeConnectivityNb = 3002, // MENU CONTROLS - NODE CONNECTIVITY NUMBER OpFreeEdge = 3100, // MENU CONTROLS - FREE EDGES OpFreeBorder = 3101, // MENU CONTROLS - FREE BORDERS OpLength = 3102, // MENU CONTROLS - LENGTH diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 648dcbc20..55a8f48b0 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -67,6 +67,10 @@ FREE_NODES Free nodes + + NODE_CONNECTIVITY_NB + Node connectivity number + FREE_EDGES Free edges @@ -624,6 +628,10 @@ MEN_FREE_NODE Free Nodes + + MEN_NODE_CONNECTIVITY_NB + Node connectivity number + MEN_FREE_FACES Free Faces @@ -3190,6 +3198,10 @@ Use Display Entity menu command to show them. STB_FREE_NODE Free Nodes + + STB_NODE_CONNECTIVITY_NB + Node connectivity number + STB_FREE_FACES Free Faces @@ -3862,6 +3874,10 @@ Use Display Entity menu command to show them. TOP_FREE_NODE Free Nodes + + TOP_NODE_CONNECTIVITY_NB + Node connectivity number + TOP_FREE_FACES Free Faces @@ -5664,6 +5680,10 @@ Please check input data and try again CONNECTED_ELEMS Elements of a domain + + NODE_CONN_NUMBER + Connectivity number + NUMBEROFNODESINELEMENT Number Of Nodes In Element @@ -7714,6 +7734,10 @@ as they are of improper type: NUMBER_OF_THE_FREE_NODES Number of the free nodes + + MAX_NODE_CONNECTIVITY + Max. number of connected elements + DOUBLE_NODES_TOLERANCE Double nodes tolerance diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 416f43b6f..d5dadd0e1 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -292,6 +292,8 @@ namespace { // - FT_ConnectedElements = 39 // v 7.6.0: FT_Undefined == 47, new items: // - FT_BelongToMeshGroup = 22 + // v 8.1.0: FT_Undefined == 48, new items: + // - FT_NodeConnectivityNumber= 22 // // It's necessary to continue recording this history and to fill // undef2newItems (see below) accordingly. @@ -313,6 +315,7 @@ namespace { undef2newItems[ 45 ].push_back( 36 ); undef2newItems[ 46 ].push_back( 39 ); undef2newItems[ 47 ].push_back( 22 ); + undef2newItems[ 48 ].push_back( 22 ); ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined ); } @@ -1564,7 +1567,7 @@ void _pyGen::CheckObjectIsReCreated( Handle(_pyObject)& theObj ) const bool isHyp = theObj->IsKind( STANDARD_TYPE( _pyHypothesis )); Handle(_pyObject) existing; if( isHyp ) - existing = Handle(_pyObject)::DownCast( FindHyp( theObj->GetID() ) ); + existing = FindHyp( theObj->GetID() ); else existing = FindObject( theObj->GetID() ); if ( !existing.IsNull() && existing != theObj ) @@ -1622,9 +1625,10 @@ Handle(_pyObject) _pyGen::FindObject( const _pyID& theObjID ) const return id_obj->second; } { - map< _pyID, Handle(_pyMesh) >::const_iterator id_obj = myMeshes.find( theObjID ); + _pyGen* me = const_cast< _pyGen* >( this ); + map< _pyID, Handle(_pyMesh) >::iterator id_obj = me->myMeshes.find( theObjID ); if ( id_obj != myMeshes.end() ) - return Handle(_pyObject)::DownCast( id_obj->second ); + return id_obj->second; } // { // map< _pyID, Handle(_pyMeshEditor) >::const_iterator id_obj = myMeshEditors.find( theObjID ); diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 599c51e4e..540144b66 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -423,6 +423,7 @@ namespace SMESH case FT_MultiConnection2D: myStream<< "aMultiConnection2D"; break; case FT_Length: myStream<< "aLength"; break; case FT_Length2D: myStream<< "aLength2D"; break; + case FT_NodeConnectivityNumber:myStream<< "aNodeConnectivityNumber";break; case FT_BelongToMeshGroup: myStream<< "aBelongToMeshGroup"; break; case FT_BelongToGeom: myStream<< "aBelongToGeom"; break; case FT_BelongToPlane: myStream<< "aBelongToPlane"; break; @@ -448,8 +449,8 @@ namespace SMESH case FT_LogicalNOT: myStream<< "aLogicalNOT"; break; case FT_LogicalAND: myStream<< "aLogicalAND"; break; case FT_LogicalOR: myStream<< "aLogicalOR"; break; - case FT_Undefined: - default: myStream<< "anUndefined"; break; + case FT_Undefined: myStream<< "anUndefined"; break; + //default: -- commented to have a compilation warning } myStream<_this(); + TPythonDump()<CreateBallDiameter(); break; + case SMESH::FT_NodeConnectivityNumber: + aFunctor = aFilterMgr->CreateNodeConnectivityNumber(); + break; // Predicates @@ -4052,6 +4078,7 @@ static const char** getFunctNames() "FT_MultiConnection2D", "FT_Length", "FT_Length2D", + "FT_NodeConnectivityNumber", "FT_BelongToMeshGroup", "FT_BelongToGeom", "FT_BelongToPlane", diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx index feaca7cb0..b9d290c47 100644 --- a/src/SMESH_I/SMESH_Filter_i.hxx +++ b/src/SMESH_I/SMESH_Filter_i.hxx @@ -311,6 +311,18 @@ namespace SMESH FunctorType GetFunctorType(); }; + /* + Class : NodeConnectivityNumber_i + Description : Functor returning diameter of a ball element + */ + class SMESH_I_EXPORT NodeConnectivityNumber_i: public virtual POA_SMESH::NodeConnectivityNumber, + public virtual NumericalFunctor_i + { + public: + NodeConnectivityNumber_i(); + FunctorType GetFunctorType(); + }; + /* PREDICATES @@ -1075,6 +1087,7 @@ namespace SMESH MaxElementLength3D_ptr CreateMaxElementLength3D(); Length_ptr CreateLength(); Length2D_ptr CreateLength2D(); + NodeConnectivityNumber_ptr CreateNodeConnectivityNumber(); MultiConnection_ptr CreateMultiConnection(); MultiConnection2D_ptr CreateMultiConnection2D(); BallDiameter_ptr CreateBallDiameter(); diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index a37bffc80..e257a4d6b 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -964,6 +964,10 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): functor = aFilterMgr.CreateLength() elif theCriterion == FT_Length2D: functor = aFilterMgr.CreateLength2D() + elif theCriterion == FT_NodeConnectivityNumber: + functor = aFilterMgr.CreateNodeConnectivityNumber() + elif theCriterion == FT_BallDiameter: + functor = aFilterMgr.CreateBallDiameter() else: print "Error: given parameter is not numerical functor type." aFilterMgr.UnRegister()