From: eap Date: Mon, 15 Nov 2010 11:51:29 +0000 (+0000) Subject: 0020943: EDF 1463 SMESH: additional fonctionnality to the feature 20749 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b2ddf07cc0db4ef2adbf96c23855ea516840289;p=modules%2Fsmesh.git 0020943: EDF 1463 SMESH: additional fonctionnality to the feature 20749 + class BareBorderVolume: public Predicate + class BareBorderFace: public Predicate --- diff --git a/doc/salome/gui/SMESH/images/bare_border_faces_smpl.png b/doc/salome/gui/SMESH/images/bare_border_faces_smpl.png new file mode 100644 index 000000000..6b7ead85e Binary files /dev/null and b/doc/salome/gui/SMESH/images/bare_border_faces_smpl.png differ diff --git a/doc/salome/gui/SMESH/images/bare_border_volumes_smpl.png b/doc/salome/gui/SMESH/images/bare_border_volumes_smpl.png new file mode 100644 index 000000000..a1e799aa2 Binary files /dev/null and b/doc/salome/gui/SMESH/images/bare_border_volumes_smpl.png differ diff --git a/doc/salome/gui/SMESH/input/about_quality_controls.doc b/doc/salome/gui/SMESH/input/about_quality_controls.doc index 8f78c38c5..6eea80601 100644 --- a/doc/salome/gui/SMESH/input/about_quality_controls.doc +++ b/doc/salome/gui/SMESH/input/about_quality_controls.doc @@ -32,6 +32,7 @@ Edge quality controls: Face quality controls: */ diff --git a/doc/salome/gui/SMESH/input/bare_border_face.doc b/doc/salome/gui/SMESH/input/bare_border_face.doc new file mode 100644 index 000000000..2115d3249 --- /dev/null +++ b/doc/salome/gui/SMESH/input/bare_border_face.doc @@ -0,0 +1,15 @@ +/*! + +\page bare_border_faces_page Bare border faces + +This mesh quality control highlights the faces having the border not +shared with other faces (free border) and missing an edge based on +nodes of the free border. The faces with bare border are shown with a +color different from the color of shared faces. + +\image html bare_border_faces_smpl.png + +\sa A sample TUI Script making a group of faces highlighted in the +picture is \ref tui_bare_border_faces "Bare border faces Control". + +*/ diff --git a/doc/salome/gui/SMESH/input/bare_border_volumes.doc b/doc/salome/gui/SMESH/input/bare_border_volumes.doc new file mode 100644 index 000000000..d0dd894ba --- /dev/null +++ b/doc/salome/gui/SMESH/input/bare_border_volumes.doc @@ -0,0 +1,15 @@ +/*! + +\page bare_border_volumes_page Bare border volumes + +This mesh quality control highlights the volumes having the border not +shared with other volumes (free border) and missing a face based on +nodes of the free border. The volumes with bare border are shown with a +color different from the color of shared volumes. + +\image html bare_border_volumes_smpl.png + +\sa A sample TUI Script making a group of volumes highlighted in the +picture is \ref tui_bare_border_volumes "Bare border volumes Control". + +*/ diff --git a/doc/salome/gui/SMESH/input/selection_filter_library.doc b/doc/salome/gui/SMESH/input/selection_filter_library.doc index ab88e0eda..29c740c65 100644 --- a/doc/salome/gui/SMESH/input/selection_filter_library.doc +++ b/doc/salome/gui/SMESH/input/selection_filter_library.doc @@ -144,7 +144,10 @@ Additional criteria to select mesh Faces are the following: one element of mesh only. See also a \ref free_edges_page "Free Edges quality control".
  • -Free faces selects 3D mesh elements wich belong to less than two volumes. +Free faces selects 2D mesh elements wich belong to less than two volumes. +
  • +Faces with bare border selects 2D mesh elements having a free border without an edge on it. +See also \ref bare_border_faces_page "Bare border faces quality control".
  • Borders at Multi-Connections 2D selects cells consisting of edges belonging to several elements of mesh. The number of mesh elements should be more, less or equal @@ -181,6 +184,9 @@ diagonals with a value of length, which is more, less or equal
  • Bad oriented volume selects mesh volumes, which are incorrectly oriented from the point of view of MED convention. +
  • +Volumes with bare border selects 3D mesh elements having a free border without a face on it. +See also \ref bare_border_volumes_page "Bare border volumes quality control".
  • diff --git a/doc/salome/gui/SMESH/input/tui_quality_controls.doc b/doc/salome/gui/SMESH/input/tui_quality_controls.doc index acbf89198..18370b7b5 100644 --- a/doc/salome/gui/SMESH/input/tui_quality_controls.doc +++ b/doc/salome/gui/SMESH/input/tui_quality_controls.doc @@ -309,6 +309,54 @@ aGroup.Add(aFaceIds) salome.sg.updateObjBrowser(1) \endcode +\section tui_bare_border_faces Bare border faces + +\code +from smesh import * +SetCurrentStudy(salome.myStudy) + +box = geompy.MakeBoxDXDYDZ(100, 100, 100) +geompy.addToStudy( box, "box" ) + +mesh = smesh.Mesh(box) +mesh.Segment().NumberOfSegments(3) +mesh.Quadrangle() +mesh.Compute() + +# remove 2 faces +allFaces = mesh.GetElementsByType(FACE) +mesh.RemoveElements( allFaces[0:2]) + +bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace) +assert(bareGroup.Size() == 3) +\endcode + +\section tui_bare_border_volumes Bare border volumes + +\code +from smesh import * +SetCurrentStudy(salome.myStudy) + +box = geompy.MakeBoxDXDYDZ(100, 30, 10) +# the smallest face of the box +face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0] + +geompy.addToStudy( box, "box" ) +geompy.addToStudyInFather( box, face, "face" ) + +mesh = Mesh(box) +mesh.AutomaticHexahedralization(); + +# remove half of mesh faces from the smallest face +faceFaces = mesh.GetSubMeshElementsId(face) +faceToRemove = faceFaces[: len(faceFaces)/2] +mesh.RemoveElements( faceToRemove ) + +# make a group of volumes missing the removed faces +bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume) +assert(bareGroup.Size() == len( faceToRemove)) +\endcode + \section tui_length_2d Length 2D \code diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl index 50526cf03..488356bd8 100644 --- a/idl/SMESH_Filter.idl +++ b/idl/SMESH_Filter.idl @@ -64,6 +64,8 @@ module SMESH FT_LyingOnGeom, FT_RangeOfIds, FT_BadOrientedVolume, + FT_BareBorderVolume, + FT_BareBorderFace, FT_LinearOrQuadratic, FT_GroupColor, FT_ElemGeomType, @@ -87,6 +89,7 @@ module SMESH }; typedef sequence Histogram; + /*! * Base interface for all functors ( i.e. numerical functors and predicates ) */ @@ -97,8 +100,6 @@ module SMESH ElementType GetElementType(); }; - - /*! * Numerical functors are intended for calculating value by Id of mesh entity */ @@ -149,6 +150,7 @@ module SMESH Values GetValues(); }; + /*! * Predicates are intended for verification of criteria, * must return bool value by mesh id @@ -165,6 +167,18 @@ module SMESH */ interface BadOrientedVolume: Predicate {}; + /*! + * Logical functor (predicate) "Volumes with bare border" and "Faces with bare border". + * Verify whether a mesh volume has a free facet without a mesh face on it + */ + interface BareBorderVolume: Predicate {}; + /*! + * Logical functor (predicate) "Faces with bare border". + * Verify whether a mesh face has a side not shared with another face + * and without a mesh edge on it + */ + interface BareBorderFace: Predicate {}; + /*! * Logical functor (predicate) "Belong To Geometry". * Verify whether mesh element or node belong to pointed Geom Object @@ -492,6 +506,8 @@ module SMESH RangeOfIds CreateRangeOfIds(); BadOrientedVolume CreateBadOrientedVolume(); + BareBorderVolume CreateBareBorderVolume(); + BareBorderFace CreateBareBorderFace(); LinearOrQuadratic CreateLinearOrQuadratic(); GroupColor CreateGroupColor(); diff --git a/resources/Makefile.am b/resources/Makefile.am index da21b6088..35964e3d3 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -102,6 +102,8 @@ dist_salomeres_DATA = \ mesh_vertex_n.png \ mesh_vertex.png \ mesh_volume_3d.png \ + bare_border_volume.png \ + bare_border_face.png \ mesh_wireframe.png \ mesh_points.png \ mesh_wrap.png \ diff --git a/resources/bare_border_face.png b/resources/bare_border_face.png new file mode 100644 index 000000000..1993f2087 Binary files /dev/null and b/resources/bare_border_face.png differ diff --git a/resources/bare_border_volume.png b/resources/bare_border_volume.png new file mode 100644 index 000000000..3ef6e6a46 Binary files /dev/null and b/resources/bare_border_volume.png differ diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 4afc7f4ca..b8d11ee95 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -199,6 +199,25 @@ SMESH_ActorDef::SMESH_ActorDef() aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); + my3DExtActor = SMESH_DeviceActor::New(); + my3DExtActor->SetUserMatrix(aMatrix); + my3DExtActor->PickableOff(); + my3DExtActor->SetProperty(my2DExtProp); + my3DExtActor->SetBackfaceProperty(my2DExtProp); + my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface); + aFilter = my3DExtActor->GetExtractUnstructuredGrid(); + aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); + aFilter->RegisterCellsWithType(VTK_TETRA); + aFilter->RegisterCellsWithType(VTK_VOXEL); + aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_WEDGE); + aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); + aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); + //Definition 1D device of the actor //--------------------------------- myEdgeProp = vtkProperty::New(); @@ -532,6 +551,7 @@ SMESH_ActorDef::~SMESH_ActorDef() my2DExtProp->Delete(); my2DExtActor->Delete(); my3DActor->Delete(); + my3DExtActor->Delete(); myNodeActor->Delete(); myBaseActor->Delete(); @@ -723,8 +743,8 @@ SetControlMode(eControl theMode, bool anIsScalarVisible = theMode > eNone; - if(anIsScalarVisible){ - switch(theMode){ + if(anIsScalarVisible) { + switch(theMode) { case eLength: { SMESH::Controls::Length* aControl = new SMESH::Controls::Length(); @@ -755,6 +775,10 @@ SetControlMode(eControl theMode, myFunctor.reset(new SMESH::Controls::FreeFaces()); myControlActor = my2DActor; break; + case eBareBorderFace: + myFunctor.reset(new SMESH::Controls::BareBorderFace()); + myControlActor = my2DActor; + break; case eMultiConnection: myFunctor.reset(new SMESH::Controls::MultiConnection()); myControlActor = my1DActor; @@ -819,6 +843,12 @@ SetControlMode(eControl theMode, myControlActor = my3DActor; break; } + case eBareBorderVolume: + { + myFunctor.reset(new SMESH::Controls::BareBorderVolume()); + myControlActor = my3DActor; + break; + } case eMinimumAngle: { SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle(); @@ -862,6 +892,12 @@ SetControlMode(eControl theMode, case eFreeFaces: my2DExtActor->SetExtControlMode(myFunctor); break; + case eBareBorderFace: + my2DExtActor->SetExtControlMode(myFunctor); + break; + case eBareBorderVolume: + my3DExtActor->SetExtControlMode(myFunctor); + break; case eLength2D: case eMultiConnection2D: my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable); @@ -911,6 +947,7 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ theRenderer->AddActor(myNodeExtActor); my3DActor->AddToRender(theRenderer); + my3DExtActor->AddToRender(theRenderer); my2DActor->AddToRender(theRenderer); my2DExtActor->AddToRender(theRenderer); @@ -954,6 +991,7 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){ my2DActor->RemoveFromRender(theRenderer); my2DExtActor->RemoveFromRender(theRenderer); my3DActor->RemoveFromRender(theRenderer); + my3DExtActor->RemoveFromRender(theRenderer); theRenderer->RemoveActor(myScalarBarActor); theRenderer->RemoveActor(myPointLabels); @@ -989,6 +1027,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, my2DActor->Init(myVisualObj,myImplicitBoolean); my2DExtActor->Init(myVisualObj,myImplicitBoolean); my3DActor->Init(myVisualObj,myImplicitBoolean); + my3DExtActor->Init(myVisualObj,myImplicitBoolean); my0DActor->GetMapper()->SetLookupTable(myLookupTable); //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable); @@ -999,6 +1038,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, my2DActor->GetMapper()->SetLookupTable(myLookupTable); my2DExtActor->GetMapper()->SetLookupTable(myLookupTable); my3DActor->GetMapper()->SetLookupTable(myLookupTable); + my3DExtActor->GetMapper()->SetLookupTable(myLookupTable); vtkFloatingPointType aFactor, aUnits; my2DActor->GetPolygonOffsetParameters(aFactor,aUnits); @@ -1071,6 +1111,7 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){ my2DActor->SetTransform(theTransform); my2DExtActor->SetTransform(theTransform); my3DActor->SetTransform(theTransform); + my3DExtActor->SetTransform(theTransform); Modified(); } @@ -1126,6 +1167,7 @@ void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){ my2DActor->SetShrinkFactor(theValue); my2DExtActor->SetShrinkFactor(theValue); my3DActor->SetShrinkFactor(theValue); + my3DExtActor->SetShrinkFactor(theValue); Modified(); } @@ -1141,6 +1183,7 @@ void SMESH_ActorDef::SetShrink(){ my2DActor->SetShrink(); my2DExtActor->SetShrink(); my3DActor->SetShrink(); + my3DExtActor->SetShrink(); myIsShrunk = true; Modified(); @@ -1157,6 +1200,7 @@ void SMESH_ActorDef::UnShrink(){ my2DActor->UnShrink(); my2DExtActor->UnShrink(); my3DActor->UnShrink(); + my3DExtActor->UnShrink(); myIsShrunk = false; Modified(); @@ -1203,6 +1247,7 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ my2DActor->VisibilityOff(); my2DExtActor->VisibilityOff(); my3DActor->VisibilityOff(); + my3DExtActor->VisibilityOff(); myScalarBarActor->VisibilityOff(); myPointLabels->VisibilityOff(); @@ -1222,8 +1267,12 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ my1DExtActor->VisibilityOn(); break; case eFreeFaces: + case eBareBorderFace: my2DExtActor->VisibilityOn(); break; + case eBareBorderVolume: + my3DExtActor->VisibilityOn(); + break; case eLength2D: case eMultiConnection2D: my1DExtActor->VisibilityOn(); @@ -1456,6 +1505,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode) //my0DExtActor->SetVisibility(false); my1DExtActor->SetVisibility(false); my2DExtActor->SetVisibility(false); + my3DExtActor->SetVisibility(false); // ??? //my0DActor->SetProperty(aProp); @@ -1786,6 +1836,7 @@ SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); + my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); } vtkIdType diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 24a57a00a..c44189e8b 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -123,7 +123,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes, eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D, - eMaxElementLength2D, eMaxElementLength3D}; + eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume}; virtual void SetControlMode(eControl theMode) = 0; virtual eControl GetControlMode() = 0; virtual SMESH::Controls::FunctorPtr GetFunctor() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 09b2232f0..c06d3281c 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -234,6 +234,7 @@ class SMESH_ActorDef : public SMESH_Actor SMESH_DeviceActor* my2DActor; SMESH_DeviceActor* my2DExtActor; SMESH_DeviceActor* my3DActor; + SMESH_DeviceActor* my3DExtActor; SMESH_DeviceActor* myControlActor; vtkProperty* myNodeExtProp; diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 600a4987c..e0d754cf8 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -501,7 +501,10 @@ SMESH_DeviceActor using namespace SMESH::Controls; if ( dynamic_cast(theFunctor.get()) || - dynamic_cast(theFunctor.get()) ) { + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get())|| + dynamic_cast(theFunctor.get())) + { Predicate* aFreePredicate = dynamic_cast(theFunctor.get()); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid(); @@ -514,7 +517,9 @@ SMESH_DeviceActor if(!myExtractUnstructuredGrid->IsCellsRegistered()) myExtractUnstructuredGrid->RegisterCell(-1); SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); - }else if(FreeEdges* aFreeEdges = dynamic_cast(theFunctor.get())){ + } + else if(FreeEdges* aFreeEdges = dynamic_cast(theFunctor.get())) + { SMESH::Controls::FreeEdges::TBorders aBorders; aFreeEdges->GetBoreders(aBorders); vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New(); @@ -561,7 +566,9 @@ SMESH_DeviceActor SetUnstructuredGrid(aDataSet); aDataSet->Delete(); - }else if(FreeNodes* aFreeNodes = dynamic_cast(theFunctor.get())){ + } + else if(FreeNodes* aFreeNodes = dynamic_cast(theFunctor.get())) + { myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node); for( vtkIdType i = 0; i < aNbNodes; i++ ){ diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 46876d3d7..aac1477f3 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -757,6 +757,10 @@ type = QObject::tr( "FREE_BORDERS" ); else if ( dynamic_cast< SMESH::Controls::FreeFaces* >( f.get() ) ) type = QObject::tr( "FREE_FACES" ); + else if ( dynamic_cast< SMESH::Controls::BareBorderVolume* >( f.get() ) ) + type = QObject::tr( "BARE_BORDER_VOLUME" ); + else if ( dynamic_cast< SMESH::Controls::BareBorderFace* >( f.get() ) ) + type = QObject::tr( "BARE_BORDER_FACE" ); return type; } @@ -1176,6 +1180,12 @@ case 6023: aControl = SMESH_Actor::eMaxElementLength3D; break; + case 6024: + aControl = SMESH_Actor::eBareBorderVolume; + break; + case 6025: + aControl = SMESH_Actor::eBareBorderFace; + break; } anActor->SetControlMode(aControl); anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() ); @@ -2951,6 +2961,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 6021: case 6022: case 6023: + case 6024: + case 6025: if ( vtkwnd ) { LightApp_SelectionMgr* mgr = selectionMgr(); @@ -3192,6 +3204,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 6021, "FREE_FACES", "ICON_FREE_FACES", 0, true ); createSMESHAction( 6022, "MAX_ELEMENT_LENGTH_2D", "ICON_MAX_ELEMENT_LENGTH_2D", 0, true ); createSMESHAction( 6023, "MAX_ELEMENT_LENGTH_3D", "ICON_MAX_ELEMENT_LENGTH_3D", 0, true ); + createSMESHAction( 6024, "BARE_BORDER_VOLUME","ICON_BARE_BORDER_VOLUME", 0, true ); + createSMESHAction( 6025, "BARE_BORDER_FACE","ICON_BARE_BORDER_FACE", 0, true ); createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true ); createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true ); createSMESHAction( 6005, "FREE_NODE", "ICON_FREE_NODE", 0, true ); @@ -3363,6 +3377,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 6001, edgeId, -1 ); createMenu( 6004, edgeId, -1 ); createMenu( 6021, faceId, -1 ); + createMenu( 6025, faceId, -1 ); createMenu( 6018, faceId, -1 ); createMenu( 6019, faceId, -1 ); createMenu( 6011, faceId, -1 ); @@ -3375,6 +3390,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 6017, volumeId, -1 ); createMenu( 6009, volumeId, -1 ); createMenu( 6023, volumeId, -1 ); + createMenu( 6024, volumeId, -1 ); createMenu( 4000, addId, -1 ); createMenu( 4009, addId, -1 ); @@ -3468,6 +3484,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 6004, ctrlTb ); createTool( separator(), ctrlTb ); createTool( 6021, ctrlTb ); + createTool( 6025, ctrlTb ); createTool( 6018, ctrlTb ); createTool( 6019, ctrlTb ); createTool( 6011, ctrlTb ); @@ -3481,6 +3498,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 6017, ctrlTb ); createTool( 6009, ctrlTb ); createTool( 6023, ctrlTb ); + createTool( 6024, ctrlTb ); createTool( separator(), ctrlTb ); createTool( 4000, addRemTb ); @@ -3783,50 +3801,54 @@ void SMESHGUI::initialize( CAM_Application* app ) aSubId = popupMgr()->insert( tr( "MEN_FACE_CTRL" ), anId, -1 ); // FACE CONTROLS - popupMgr()->insert( action( 6021 ), aSubId, -1 ); // FREE_FACE + popupMgr()->insert ( action( 6021 ), aSubId, -1 ); // FREE_FACE popupMgr()->setRule( action( 6021 ), aMeshInVtkHasFaces /*aMeshInVtkHasVolumes*/, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6021 ), "controlMode = 'eFreeFaces'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6018 ), aSubId, -1 ); // LENGTH_2D + popupMgr()->insert ( action( 6018 ), aSubId, -1 ); // LENGTH_2D popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6019 ), aSubId, -1 ); // CONNECTION_2D + popupMgr()->insert ( action( 6019 ), aSubId, -1 ); // CONNECTION_2D popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6011 ), aSubId, -1 ); // AREA + popupMgr()->insert ( action( 6011 ), aSubId, -1 ); // AREA popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6012 ), aSubId, -1 ); // TAPER + popupMgr()->insert ( action( 6012 ), aSubId, -1 ); // TAPER popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6013 ), aSubId, -1 ); // ASPECT + popupMgr()->insert ( action( 6013 ), aSubId, -1 ); // ASPECT popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6014 ), aSubId, -1 ); // MIN_ANG + popupMgr()->insert ( action( 6014 ), aSubId, -1 ); // MIN_ANG popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6015 ), aSubId, -1 ); // WARP + popupMgr()->insert ( action( 6015 ), aSubId, -1 ); // WARP popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6016 ), aSubId, -1 ); // SKEW + popupMgr()->insert ( action( 6016 ), aSubId, -1 ); // SKEW popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6022 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_2D + popupMgr()->insert ( action( 6022 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_2D popupMgr()->setRule( action( 6022 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6022 ), "controlMode = 'eMaxElementLength2D'", QtxPopupMgr::ToggleRule ); + popupMgr()->insert ( action( 6025 ), aSubId, -1 ); // BARE_BORDER_FACE + popupMgr()->setRule( action( 6025 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6025 ), "controlMode = 'eBareBorderFace'", QtxPopupMgr::ToggleRule ); + aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS - popupMgr()->insert( action( 6017 ), aSubId, -1 ); // ASPECT_3D + popupMgr()->insert ( action( 6017 ), aSubId, -1 ); // ASPECT_3D popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule ); @@ -3834,10 +3856,14 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule ); - popupMgr()->insert( action( 6023 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_3D + popupMgr()->insert ( action( 6023 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_3D popupMgr()->setRule( action( 6023 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6023 ), "controlMode = 'eMaxElementLength3D'", QtxPopupMgr::ToggleRule ); + popupMgr()->insert ( action( 6024 ), aSubId, -1 ); // BARE_BORDER_VOLUME + popupMgr()->setRule( action( 6024 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6024 ), "controlMode = 'eBareBorderVolume'", QtxPopupMgr::ToggleRule ); + popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index bf1e387ea..7e5030f4a 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1170,6 +1170,8 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow, theCriterion.Type != SMESH::FT_FreeNodes && theCriterion.Type != SMESH::FT_FreeFaces && theCriterion.Type != SMESH::FT_BadOrientedVolume && + theCriterion.Type != SMESH::FT_BareBorderFace && + theCriterion.Type != SMESH::FT_BareBorderVolume && theCriterion.Type != SMESH::FT_LinearOrQuadratic) aTable->item( theRow, 2 )->setText(QString("%1").arg(theCriterion.Threshold, 0, 'g', 15)); else @@ -1324,11 +1326,13 @@ void SMESHGUI_FilterTable::updateAdditionalWidget() ComboItem* anItem = ((ComboItem*)aTable->item(aRow, 0)); int aCriterion = GetCriterionType(aRow); - bool toEnable = ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo && - aCriterion != SMESH::FT_RangeOfIds && - aCriterion != SMESH::FT_FreeEdges && - aCriterion != SMESH::FT_FreeFaces && - aCriterion != SMESH::FT_BadOrientedVolume; + bool toEnable = (((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo && + aCriterion != SMESH::FT_RangeOfIds && + aCriterion != SMESH::FT_FreeEdges && + aCriterion != SMESH::FT_FreeFaces && + aCriterion != SMESH::FT_BadOrientedVolume && + aCriterion != SMESH::FT_BareBorderFace && + aCriterion != SMESH::FT_BareBorderVolume); if (!myAddWidgets.contains(anItem)) { @@ -1504,9 +1508,11 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con if (aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes || aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders || - aType == SMESH::FACE && (aCriterionType == SMESH::FT_FreeEdges || + aType == SMESH::FACE && (aCriterionType == SMESH::FT_BareBorderFace || + aCriterionType == SMESH::FT_FreeEdges || aCriterionType == SMESH::FT_FreeFaces) || - aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume || + aType == SMESH::VOLUME && (aCriterionType == SMESH::FT_BadOrientedVolume || + aCriterionType == SMESH::FT_BareBorderVolume) || aCriterionType == SMESH::FT_LinearOrQuadratic || aCriterionType == SMESH::FT_GroupColor || aCriterionType == SMESH::FT_ElemGeomType) @@ -1789,6 +1795,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D"); aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS"); aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES"); + aCriteria[ SMESH::FT_BareBorderFace ] = tr("BARE_BORDER_FACE"); aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); @@ -1805,6 +1812,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME"); + aCriteria[ SMESH::FT_BareBorderVolume ] = tr("BARE_BORDER_VOLUME"); aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D"); aCriteria[ SMESH::FT_MaxElementLength3D ] = tr("MAX_ELEMENT_LENGTH_3D"); aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR"); diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 856e88f32..d7373ad92 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -457,6 +457,14 @@ ICON_VOLUME_3D mesh_volume_3d.png + + ICON_BARE_BORDER_VOLUME + bare_border_volume.png + + + ICON_BARE_BORDER_FACE + bare_border_face.png + ICON_WARP mesh_wrap.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 189c5c1b3..ce8bed27b 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -391,6 +391,14 @@ TOP_FIND_ELEM Find Element by Point + + MEN_BARE_BORDER_VOLUME + Volumes with bare border + + + MEN_BARE_BORDER_FACE + Faces with bare border + MEN_FREE_BORDER Free Borders @@ -2424,6 +2432,14 @@ Consider saving your work before application crash STB_FACES Faces + + STB_BARE_BORDER_VOLUME + Volumes with bare border + + + STB_BARE_BORDER_FACE + Faces with bare border + STB_FREE_BORDER Free Borders @@ -2960,6 +2976,14 @@ Consider saving your work before application crash TOP_FACES Faces + + TOP_BARE_BORDER_VOLUME + Volumes with bare border + + + TOP_BARE_BORDER_FACE + Faces with bare border + TOP_FREE_BORDER Free Borders @@ -4299,6 +4323,14 @@ Please check input data and try again BAD_ORIENTED_VOLUME Bad oriented volume + + BARE_BORDER_VOLUME + Volumes with bare border + + + BARE_BORDER_FACE + Faces with bare border + BELONG_TO_CYLINDER Belong to Cylinder diff --git a/src/StdMeshers/StdMeshers_Import_1D.cxx b/src/StdMeshers/StdMeshers_Import_1D.cxx index fe0f05476..29b428788 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D.cxx @@ -120,6 +120,7 @@ namespace // INTERNAL STUFF enum _ListenerDataType { WAIT_HYP_MODIF=1, // data indicating awaiting for valid parameters of src hyp + LISTEN_SRC_MESH, // data storing submesh depending on source mesh state SRC_HYP // data storing ImportSource hyp }; //================================================================================ @@ -130,10 +131,10 @@ namespace // INTERNAL STUFF struct _ListenerData : public SMESH_subMeshEventListenerData { const StdMeshers_ImportSource1D* _srcHyp; - _ListenerData(const StdMeshers_ImportSource1D* h): + _ListenerData(const StdMeshers_ImportSource1D* h, _ListenerDataType type=SRC_HYP): SMESH_subMeshEventListenerData(/*isDeletable=*/true), _srcHyp(h) { - myType = SRC_HYP; + myType = type; } }; //================================================================================ @@ -246,10 +247,9 @@ namespace // INTERNAL STUFF // set a listener to hear events of the source mesh SMESH_subMesh* smToNotify = importSub; SMESH_subMesh* smToListen = srcMesh->GetSubMeshContaining(1); - importSub->SetEventListener - ( new SMESH_subMeshEventListener(/*isDeletable=*/true), - SMESH_subMeshEventListenerData::MakeData( smToNotify ), - smToListen ); + SMESH_subMeshEventListenerData* data = new _ListenerData(srcHyp, LISTEN_SRC_MESH); + data->mySubMeshes.push_back( smToNotify ); + importSub->SetEventListener( get(), data, smToListen ); // remeber the submesh _ImportData* iData = _Listener::getImportData( srcMesh, importSub->GetFather()); @@ -320,6 +320,12 @@ namespace // INTERNAL STUFF bool copyMesh = !d->_copyMeshSubM.empty(); if ( copyMesh ) { + // remove imported mesh and groups + d->removeImportedMesh( sm->GetFather()->GetMeshDS() ); + + if ( data ) + d->removeGroups( sm, data->_srcHyp ); + // clear submeshes if ( !d->_computedSubM.empty() ) { @@ -335,11 +341,10 @@ namespace // INTERNAL STUFF subM->ComputeStateEngine( SMESH_subMesh::CLEAN ); } } - // remove imported mesh and groups - d->removeImportedMesh( sm->GetFather()->GetMeshDS() ); - - if ( data ) - d->removeGroups( sm, data->_srcHyp ); + } + else + { + sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); } } if ( data ) @@ -360,6 +365,7 @@ namespace // INTERNAL STUFF { if ( data && data->myType == WAIT_HYP_MODIF ) { + // event of Import submesh if ( SMESH_subMesh::MODIF_HYP == event && SMESH_subMesh::ALGO_EVENT == eventType ) { @@ -368,13 +374,39 @@ namespace // INTERNAL STUFF algo->SetEventListener( subMesh ); } } - else + else if ( data && data->myType == LISTEN_SRC_MESH ) { - SMESH_Gen* gen = subMesh->GetFather()->GetGen(); - SMESH_Algo* algo = gen->GetAlgo(*subMesh->GetFather(),subMesh->GetSubShape() ); + // event of source mesh + if ( SMESH_subMesh::COMPUTE_EVENT == eventType ) + { + switch ( event ) { + case SMESH_subMesh::CLEAN: + clearSubmesh( data->mySubMeshes.front(), (_ListenerData*) data ); + break; + case SMESH_subMesh::COMPUTE: + if ( subMesh->GetComputeState() == SMESH_subMesh::COMPUTE_OK ) + data->mySubMeshes.front()->ComputeStateEngine( SMESH_subMesh::SUBMESH_COMPUTED ); + break; + default:; + } + } + } + else // event of Import submesh + { + bool removeImport = false; + if ( subMesh->GetAlgoState() != SMESH_subMesh::HYP_OK ) + { + removeImport = true; + } + else if ( SMESH_subMesh::REMOVE_ALGO == event || + SMESH_subMesh::REMOVE_FATHER_ALGO == event ) + { + SMESH_Gen* gen = subMesh->GetFather()->GetGen(); + SMESH_Algo* algo = gen->GetAlgo(*subMesh->GetFather(),subMesh->GetSubShape() ); + removeImport = ( strncmp( "Import", algo->GetName(), 6 ) != 0 ); + } - if ( subMesh->GetAlgoState() != SMESH_subMesh::HYP_OK || - strncmp( "Import", algo->GetName(), 6 ) != 0 ) + if ( removeImport ) { // treate removal of Import algo from subMesh removeSubmesh( subMesh, (_ListenerData*) data ); @@ -543,8 +575,8 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th subShapeIDs.insert( shapeID ); // get nodes on vertices - list < SMESH_MeshEditor::TNodeXYZ > vertexNodes; - list < SMESH_MeshEditor::TNodeXYZ >::iterator vNIt; + list < SMESH_MeshEditor::TNodeXYZ > vertexNodes; + list < SMESH_MeshEditor::TNodeXYZ >::iterator vNIt; TopExp_Explorer vExp( theShape, TopAbs_VERTEX ); for ( ; vExp.More(); vExp.Next() ) { @@ -797,6 +829,17 @@ void StdMeshers_Import_1D::importMesh(const SMESH_Mesh* srcMesh, n2n->clear(); e2e->clear(); + { + cout << "IMPORT SubMesh " << endl << " Elems:"; + SMDS_ElemIteratorPtr eIt = tgtSubMesh->GetElements(); + while ( eIt->more() ) + cout << " " << eIt->next()->GetID(); + cout << endl << " Nodes:"; + SMDS_NodeIteratorPtr nIt = tgtSubMesh->GetNodes(); + while ( nIt->more() ) + cout << " " << nIt->next()->GetID(); + cout << endl; + } // Remember created groups in order to remove them as soon as the srcHyp is // modified or something other similar happens. Store them in a hypothesis // as it stores its values anyway diff --git a/src/StdMeshers/StdMeshers_Import_1D2D.cxx b/src/StdMeshers/StdMeshers_Import_1D2D.cxx index 0062de31d..cca605bd4 100644 --- a/src/StdMeshers/StdMeshers_Import_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D2D.cxx @@ -153,8 +153,8 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & const bool toCheckOri = (helper.NbAncestors( geomFace, theMesh, TopAbs_SOLID ) == 1 ); Handle(Geom_Surface) surface = BRep_Tool::Surface( geomFace ); - if ( helper.GetSubShapeOri( tgtMesh->ShapeToMesh(), geomFace) == TopAbs_REVERSED ) - surface->UReverse(); + const bool reverse = + ( helper.GetSubShapeOri( tgtMesh->ShapeToMesh(), geomFace) == TopAbs_REVERSED ); gp_Pnt p; gp_Vec du, dv; set subShapeIDs; @@ -262,7 +262,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & { uv = helper.GetNodeUV( geomFace, newNodes[++iNode] ); surface->D1( uv.X(),uv.Y(), p, du,dv ); - geomNorm = du ^ dv; + geomNorm = reverse ? dv^du : du^dv; } while ( geomNorm.SquareMagnitude() < 1e-6 && iNode+1 < face->NbCornerNodes()); @@ -458,6 +458,25 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & for ( unsigned iE = 0; iE < edges.size(); ++iE ) theMesh.GetSubMesh( edges[iE] )->ComputeStateEngine(SMESH_subMesh::CHECK_COMPUTE_STATE); + SMESH_subMesh* sm = theMesh.GetSubMesh(theShape); + SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(true,false); + cout << endl << string(80,'=') << endl + << "Compute( face " << tgtMesh->ShapeToIndex(theShape) << endl; + while ( smIt->more() ) + { + sm = smIt->next(); + TopAbs::Print(sm->GetSubShape().ShapeType(), cout); + cout << " " << sm->GetId() << endl << " Elems:"; + SMDS_ElemIteratorPtr eIt = sm->GetSubMeshDS()->GetElements(); + while ( eIt->more() ) + cout << " " << eIt->next()->GetID(); + cout << endl << " Nodes:"; + SMDS_NodeIteratorPtr nIt = sm->GetSubMeshDS()->GetNodes(); + while ( nIt->more() ) + cout << " " << nIt->next()->GetID(); + cout << endl; + } + // ============ // Copy meshes // ============