From: eap Date: Mon, 1 Aug 2016 19:15:36 +0000 (+0300) Subject: IMP 23300: [EDF 12865] Independent calculation of sub-meshes X-Git-Tag: V8_1_0b1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b3cb4c5a571fe8f36ff6fa5bb90f5d9f122cafad;p=modules%2Fsmesh.git IMP 23300: [EDF 12865] Independent calculation of sub-meshes --- diff --git a/doc/salome/examples/creating_meshes_ex02.py b/doc/salome/examples/creating_meshes_ex02.py index 3980d4d74..230e67a00 100644 --- a/doc/salome/examples/creating_meshes_ex02.py +++ b/doc/salome/examples/creating_meshes_ex02.py @@ -40,11 +40,27 @@ algo_local = mesh.Segment(EdgeX) algo_local.Arithmetic1D(1, 4) # define "Propagation" hypothesis that propagates algo_local and "Arithmetic1D" hypothesis -# on all parallel edges of the box +# from EdgeX to all parallel edges algo_local.Propagation() # assign a hexahedral algorithm mesh.Hexahedron() -# compute the mesh + +# any sub-shape can be meshed individually -- +# compute mesh on two surfaces using different methods + +# get surfaces +surfaces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) + +# method 1: no sub-mesh is created +mesh.Compute( surfaces[0] ) + +# method 2: a sub-mesh is created +submesh = mesh.GetSubMesh( surfaces[2], "submesh 2" ) +submesh.Compute() + + + +# compute the whole mesh mesh.Compute() diff --git a/doc/salome/gui/SMESH/input/constructing_submeshes.doc b/doc/salome/gui/SMESH/input/constructing_submeshes.doc index 04000e582..b7fe2feee 100644 --- a/doc/salome/gui/SMESH/input/constructing_submeshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_submeshes.doc @@ -16,6 +16,10 @@ Creation of a sub-mesh allows to control individually meshing of a certain sub-shape, thus to get a locally coarser or finer mesh, to get elements of different types in the same mesh, etc. +A sub-mesh can be meshed individually. To achieve this, select a +sub-mesh and either invoke Compute Sub-mesh vai the contextual +menu in the Object Browser or invoke Mesh > Compute menu. + \section submesh_shape_section How to get a sub-shape for sub-mesh construction A sub-shape to create a sub-mesh on should be retrieved from the main shape diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index a14b72eed..075b3eb54 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -2688,7 +2688,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpCreateMesh: case SMESHOp::OpCreateSubMesh: case SMESHOp::OpEditMeshOrSubMesh: + case SMESHOp::OpEditMesh: + case SMESHOp::OpEditSubMesh: case SMESHOp::OpCompute: + case SMESHOp::OpComputeSubMesh: case SMESHOp::OpPreCompute: case SMESHOp::OpEvaluate: case SMESHOp::OpMeshOrder: @@ -3806,9 +3809,12 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpCreateMesh, "CREATE_MESH", "ICON_DLG_INIT_MESH" ); createSMESHAction( SMESHOp::OpCreateSubMesh, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" ); createSMESHAction( SMESHOp::OpEditMeshOrSubMesh, "EDIT_MESHSUBMESH", "ICON_DLG_EDIT_MESH" ); + createSMESHAction( SMESHOp::OpEditMesh, "EDIT_MESH", "ICON_DLG_EDIT_MESH" ); + createSMESHAction( SMESHOp::OpEditSubMesh, "EDIT_SUBMESH", "ICON_DLG_EDIT_MESH" ); createSMESHAction( SMESHOp::OpBuildCompoundMesh, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" ); createSMESHAction( SMESHOp::OpCopyMesh, "COPY_MESH", "ICON_COPY_MESH" ); createSMESHAction( SMESHOp::OpCompute, "COMPUTE", "ICON_COMPUTE" ); + createSMESHAction( SMESHOp::OpComputeSubMesh, "COMPUTE_SUBMESH", "ICON_COMPUTE" ); createSMESHAction( SMESHOp::OpPreCompute, "PRECOMPUTE", "ICON_PRECOMPUTE" ); createSMESHAction( SMESHOp::OpEvaluate, "EVALUATE", "ICON_EVALUATE" ); createSMESHAction( SMESHOp::OpMeshOrder, "MESH_ORDER", "ICON_MESH_ORDER"); @@ -4303,24 +4309,26 @@ void SMESHGUI::initialize( CAM_Application* app ) QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam() myRules.clear(); - QString OB = "'ObjectBrowser'", - View = "'" + SVTK_Viewer::Type() + "'", - pat = "'%1'", - mesh = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ), - group = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ), - hypo = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ), - algo = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ), - elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ), - subMesh = elems, - mesh_part = mesh + " " + subMesh + " " + group, - mesh_group = mesh + " " + group, - hyp_alg = hypo + " " + algo; + QString + OB = "'ObjectBrowser'", + View = "'" + SVTK_Viewer::Type() + "'", + pat = "'%1'", + mesh = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ), + group = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ), + hypo = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ), + algo = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ), + elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ), + subMesh = elems, + mesh_part = mesh + " " + subMesh + " " + group, + mesh_group = mesh + " " + group, + mesh_submesh = mesh + " " + subMesh, + hyp_alg = hypo + " " + algo; // popup for object browser QString @@ -4339,36 +4347,36 @@ void SMESHGUI::initialize( CAM_Application* app ) hasVolumes("({'Volume'} in elemTypes)"), hasFacesOrVolumes("(({'Face'} in elemTypes) || ({'Volume'} in elemTypes)) "); - createPopupItem( SMESHOp::OpFileInformation, OB, mesh, "&& selcount=1 && isImported" ); - createPopupItem( SMESHOp::OpCreateSubMesh, OB, mesh, "&& hasGeomReference"); - createPopupItem( SMESHOp::OpEditMeshOrSubMesh, OB, mesh ); - createPopupItem( SMESHOp::OpEditMeshOrSubMesh, OB, subMesh, "&& hasGeomReference" ); - createPopupItem( SMESHOp::OpEditGroup, OB, group ); + createPopupItem( SMESHOp::OpFileInformation, OB, mesh, "&& selcount=1 && isImported" ); + createPopupItem( SMESHOp::OpCreateSubMesh, OB, mesh, "&& hasGeomReference"); + createPopupItem( SMESHOp::OpEditMesh, OB, mesh, "&& selcount=1" ); + createPopupItem( SMESHOp::OpEditSubMesh, OB, subMesh, "&& selcount=1 && hasGeomReference" ); + createPopupItem( SMESHOp::OpEditGroup, OB, group ); createPopupItem( SMESHOp::OpEditGeomGroupAsGroup, OB, group, "&& groupType != 'Group'" ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpCompute, OB, mesh, "&& isComputable" ); - createPopupItem( SMESHOp::OpPreCompute, OB, mesh, "&& isPreComputable" ); - createPopupItem( SMESHOp::OpEvaluate, OB, mesh, "&& isComputable" ); - createPopupItem( SMESHOp::OpMeshOrder, OB, mesh, "&& isComputable && hasGeomReference" ); - createPopupItem( SMESHOp::OpUpdate, OB, mesh_part ); - createPopupItem( SMESHOp::OpMeshInformation, OB, mesh_part ); - createPopupItem( SMESHOp::OpFindElementByPoint, OB, mesh_group ); - createPopupItem( SMESHOp::OpOverallMeshQuality, OB, mesh_part ); + createPopupItem( SMESHOp::OpCompute, OB, mesh, "&& selcount=1 && isComputable" ); + createPopupItem( SMESHOp::OpComputeSubMesh, OB, subMesh, "&& selcount=1 && isComputable" ); + createPopupItem( SMESHOp::OpPreCompute, OB, mesh, "&& selcount=1 && isPreComputable" ); + createPopupItem( SMESHOp::OpEvaluate, OB, mesh, "&& selcount=1 && isComputable" ); + createPopupItem( SMESHOp::OpMeshOrder, OB, mesh, "&& selcount=1 && isComputable && hasGeomReference" ); + createPopupItem( SMESHOp::OpUpdate, OB, mesh_part ); + createPopupItem( SMESHOp::OpMeshInformation, OB, mesh_part ); + createPopupItem( SMESHOp::OpFindElementByPoint,OB, mesh_group, "&& selcount=1" ); + createPopupItem( SMESHOp::OpOverallMeshQuality,OB, mesh_part ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpCreateGroup, OB, mesh ); - createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& hasGeomReference" ); - createPopupItem( SMESHOp::OpConstructGroup, OB, subMesh ); + createPopupItem( SMESHOp::OpCreateGroup, OB, mesh, "&& selcount=1" ); + createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& selcount=1 && hasGeomReference" ); + createPopupItem( SMESHOp::OpConstructGroup, OB, subMesh ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo, "&& isEditableHyp"); - createPopupItem( SMESHOp::OpUnassign, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS + createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo, "&& isEditableHyp"); + createPopupItem( SMESHOp::OpUnassign, OB, hyp_alg ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh + " " + subMesh ); // convert to quadratic - createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh + " " + group, // create 2D mesh from 3D - "&& dim>=2"); + createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh_submesh ); + createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2"); popupMgr()->insert( separator(), -1, 0 ); createPopupItem( SMESHOp::OpClearMesh, OB, mesh ); - popupMgr()->insert( separator(), -1, 0 ); + //popupMgr()->insert( separator(), -1, 0 ); QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc ); QString multiple_non_empty = QString( " && %1>0 && numberOfNodes>0" ).arg( dc ); @@ -5489,9 +5497,12 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const op = new SMESHGUI_MeshOp( true, false ); break; case SMESHOp::OpEditMeshOrSubMesh: + case SMESHOp::OpEditMesh: + case SMESHOp::OpEditSubMesh: op = new SMESHGUI_MeshOp( false ); break; case SMESHOp::OpCompute: + case SMESHOp::OpComputeSubMesh: op = new SMESHGUI_ComputeOp(); break; case SMESHOp::OpPreCompute: @@ -6219,8 +6230,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint) if (ac->IsA("SMESH_Actor")) { SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac); if (aGeomAc->hasIO()) { - Handle(SALOME_InteractiveObject) io = - Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO()); + Handle(SALOME_InteractiveObject) io = aGeomAc->getIO(); if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) { isFound = true; vtkActors.Bind(viewIndex, aGeomAc); diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 8627f72fc..072b48175 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -683,6 +683,7 @@ void SMESHGUI_BaseComputeOp::startOperation() myMesh = SMESH::SMESH_Mesh::_nil(); myMainShape = GEOM::GEOM_Object::_nil(); + myCurShape = GEOM::GEOM_Object::_nil(); // check selection LightApp_SelectionMgr *Sel = selectionMgr(); @@ -698,7 +699,23 @@ void SMESHGUI_BaseComputeOp::startOperation() } myIObject = selected.First(); - myMesh = SMESH::GetMeshByIO(myIObject); + CORBA::Object_var anObj = SMESH::IObjectToObject( myIObject ); + + myMesh = SMESH::SMESH_Mesh::_narrow(anObj); + if ( myMesh->_is_nil() ) + { + SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj); + if ( !aSubMesh->_is_nil() ) + { + myMesh = aSubMesh->GetFather(); + myCurShape = aSubMesh->GetSubShape(); + } + } + else + { + myCurShape = myMesh->GetShapeToMesh(); + } + if (myMesh->_is_nil()) { SUIT_MessageBox::warning(desktop(), tr("SMESH_WRN_WARNING"), @@ -706,6 +723,7 @@ void SMESHGUI_BaseComputeOp::startOperation() onCancel(); return; } + myMainShape = myMesh->GetShapeToMesh(); SMESHGUI_Operation::startOperation(); @@ -882,10 +900,8 @@ void SMESHGUI_BaseComputeOp::computeMesh() myMesh->Clear(); SUIT_OverrideCursor aWaitCursor; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif - SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape); + SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myCurShape); qthreaddialog.exec(); computeFailed = !qthreaddialog.result(); } @@ -893,9 +909,7 @@ void SMESHGUI_BaseComputeOp::computeMesh() memoryLack = true; } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif aCompErrors = gen->GetComputeErrors( myMesh, myMainShape ); // check if there are memory problems for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i ) @@ -911,7 +925,8 @@ void SMESHGUI_BaseComputeOp::computeMesh() // NPAL16631: if ( !memoryLack ) { - SMESH::ModifiedMesh( aMeshSObj, + _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID(myIObject->getEntry()); + SMESH::ModifiedMesh( sobj, !computeFailed && aHypErrors.isEmpty(), myMesh->NbNodes() == 0); update( UF_ObjBrowser | UF_Model ); @@ -1245,8 +1260,9 @@ void SMESHGUI_BaseComputeOp::stopOperation() void SMESHGUI_BaseComputeOp::onPublishShape() { - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy(); + GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); + SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy(); + GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh(); QStringList entryList; QList rows; @@ -1754,14 +1770,15 @@ void SMESHGUI_PrecomputeOp::initDialog() */ //================================================================================ -void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh, +void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh, QMap& theModeMap) { if ( !theMesh ) return; + _PTR(SObject) aHypFolder; _PTR(GenericAttribute) anAttr; int aPart = SMESH::Tag_RefOnAppliedAlgorithms; - if ( theMesh->FindSubObject( aPart, aHypFolder ) ) + if ( theMesh->FindSubObject( aPart, aHypFolder )) { _PTR(ChildIterator) anIter = SMESH::GetActiveStudyDocument()->NewChildIterator( aHypFolder ); diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.h b/src/SMESHGUI/SMESHGUI_ComputeDlg.h index 759648dad..afd451c74 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.h +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.h @@ -112,6 +112,7 @@ private: protected: SMESH::SMESH_Mesh_var myMesh; GEOM::GEOM_Object_var myMainShape; + GEOM::GEOM_Object_var myCurShape; SMESH::TShapeDisplayer* myTShapeDisplayer; SMESHGUI_MeshEditPreview* myBadMeshDisplayer; Handle(SALOME_InteractiveObject) myIObject; diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index 0716cdd8e..ad2adb520 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -624,12 +624,32 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh objectWg( Mesh, Btn )->hide(); objectWg( Geom, Btn )->hide(); } + setTitile( theToCreate, theIsMesh ); } SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg() { } +//================================================================================ +/*! + * \brief Set dialog title + */ +//================================================================================ + +void SMESHGUI_MeshDlg::setTitile( const bool theToCreate, const bool theIsMesh ) +{ + if ( theToCreate ) + { + setWindowTitle( tr( theIsMesh ? "CREATE_MESH" : "CREATE_SUBMESH" )); + } + else + { + setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") ); + } + +} + //================================================================================ /*! * \brief Gets tab with given id diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.h b/src/SMESHGUI/SMESHGUI_MeshDlg.h index 37742bbe7..9c0337420 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.h @@ -78,6 +78,7 @@ public: void setAvailableMeshType(const QStringList& ); int currentMeshType(); void setCurrentMeshType( const int ); + void setTitile( const bool, const bool ); signals: void hypoSet( const QString& ); diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 30949d462..8677fad56 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -638,13 +638,14 @@ void SMESHGUI_MeshOp::selectionDone() { SMESH::SMESH_subMesh_var submeshVar = SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() ); + myIsMesh = submeshVar->_is_nil(); + myDlg->setTitile( myToCreate, myIsMesh ); myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !submeshVar->_is_nil() ); myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, true ); myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide(); myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide(); myDlg->updateGeometry(); myDlg->adjustSize(); - myIsMesh = submeshVar->_is_nil(); readMesh(); } else diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index 3d6589b0d..784940e90 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -69,12 +69,15 @@ namespace SMESHOp { OpCreateMesh = 2030, // MENU MESH - CREATE MESH OpCreateSubMesh = 2031, // MENU MESH - CREATE SUBMESH OpEditMeshOrSubMesh = 2032, // MENU MESH - EDIT MESH/SUBMESH - OpBuildCompoundMesh = 2033, // MENU MESH - BUILD COMPOUND - OpCopyMesh = 2034, // MENU MESH - COPY MESH + OpEditMesh = 2033, // POPUP - EDIT MESH + OpEditSubMesh = 2034, // POPUP - EDIT SUBMESH + OpBuildCompoundMesh = 2035, // MENU MESH - BUILD COMPOUND + OpCopyMesh = 2036, // MENU MESH - COPY MESH OpCompute = 2040, // MENU MESH - COMPUTE - OpPreCompute = 2041, // MENU MESH - PREVIEW - OpEvaluate = 2042, // MENU MESH - EVALUATE - OpMeshOrder = 2043, // MENU MESH - CHANGE SUBMESH PRIORITY + OpComputeSubMesh = 2041, // POPUP - COMPUTE SUBMESH + OpPreCompute = 2042, // MENU MESH - PREVIEW + OpEvaluate = 2043, // MENU MESH - EVALUATE + OpMeshOrder = 2044, // MENU MESH - CHANGE SUBMESH PRIORITY OpCreateGroup = 2050, // MENU MESH - CREATE GROUP OpCreateGeometryGroup = 2051, // MENU MESH - CREATE GROUPS FROM GEOMETRY OpConstructGroup = 2052, // MENU MESH - CONSTRUCT GROUP diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index ab6bad812..832c51ec1 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -518,11 +518,18 @@ int SMESHGUI_Selection::dim( int ind ) const bool SMESHGUI_Selection::isComputable( int ind ) const { - if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" ) + if ( ind >= 0 && ind < myTypes.count() && ( myTypes[ind] == "Mesh" || + myTypes[ind].startsWith("Mesh " ))) { QMap modeMap; - _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() ); - SMESHGUI_PrecomputeOp::getAssignedAlgos( so, modeMap ); + _PTR(SObject) meshSO = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() ); + + _PTR(SComponent) component = meshSO->GetFatherComponent(); + if ( meshSO->Depth() - component->Depth() > 1 ) // sub-mesh, get a mesh + while ( meshSO->Depth() - component->Depth() > 1 ) + meshSO = meshSO->GetFather(); + + SMESHGUI_PrecomputeOp::getAssignedAlgos( meshSO, modeMap ); return modeMap.size() > 0; } return false; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 6f6d0c605..5392e5504 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -256,6 +256,10 @@ MEN_COMPUTE Compute + + MEN_COMPUTE_SUBMESH + Compute Sub-mesh + MEN_PRECOMPUTE Preview @@ -420,6 +424,14 @@ MEN_EDIT_MESHSUBMESH Edit Mesh/Sub-mesh + + MEN_EDIT_MESH + Edit Mesh + + + MEN_EDIT_SUBMESH + Edit Sub-mesh + MEN_EXPORT Export @@ -2929,6 +2941,10 @@ Use Display Entity menu command to show them. STB_COMPUTE Compute + + STB_COMPUTE_SUBMESH + Compute Sub-mesh + STB_PRECOMPUTE Preview @@ -3061,6 +3077,14 @@ Use Display Entity menu command to show them. STB_EDIT_MESHSUBMESH Edit Mesh/Sub-mesh + + STB_EDIT_MESH + Edit Mesh + + + STB_EDIT_SUBMESH + Edit Sub-mesh + STB_EXPORT_DAT Export to DAT file @@ -3597,6 +3621,10 @@ Use Display Entity menu command to show them. TOP_COMPUTE Compute + + TOP_COMPUTE_SUBMESH + Compute Sub-mesh + TOP_PRECOMPUTE Preview @@ -3729,6 +3757,14 @@ Use Display Entity menu command to show them. TOP_EDIT_MESHSUBMESH Edit Mesh/Sub-mesh + + TOP_EDIT_MESH + Edit Mesh + + + TOP_EDIT_SUBMESH + Edit Sub-mesh + TOP_EXPORT_DAT Export to DAT file @@ -6132,8 +6168,12 @@ Please specify them and try again 3D - EDIT_MESH_SUBMESH - Edit mesh/sub-mesh + EDIT_MESH + Edit mesh + + + EDIT_SUBMESH + Edit sub-mesh GEOMETRY diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 757e3977f..983a3173b 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1916,8 +1916,8 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, myLocShape = SMESH_Mesh::PseudoShape(); // call implementation compute ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); - myGen.PrepareCompute( myLocMesh, myLocShape); - bool ok = myGen.Compute( myLocMesh, myLocShape); + myGen.PrepareCompute( myLocMesh, myLocShape ); + bool ok = myGen.Compute( myLocMesh, myLocShape, myLocShape != myLocMesh.GetShapeToMesh()); meshServant->CreateGroupServants(); // algos can create groups (issue 0020918) myLocMesh.GetMeshDS()->Modified(); return ok; diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index b4da6ea8e..a37bffc80 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1497,11 +1497,12 @@ class Mesh: print allReasons pass if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0: - smeshgui = salome.ImportComponentGUI("SMESH") - smeshgui.Init(self.mesh.GetStudyId()) - smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) ) - if refresh: salome.sg.updateObjBrowser(1) - pass + if not isinstance( refresh, list): # not a call from subMesh.Compute() + smeshgui = salome.ImportComponentGUI("SMESH") + smeshgui.Init(self.mesh.GetStudyId()) + smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) ) + if refresh: salome.sg.updateObjBrowser(1) + return ok ## Return a list of error messages (SMESH.ComputeError) of the last Compute() @@ -5001,7 +5002,7 @@ class Mesh: pass # end of Mesh class -## class used to compensate change of CORBA API of SMESH_Mesh for backward compatibility +## Class used to compensate change of CORBA API of SMESH_Mesh for backward compatibility # with old dump scripts which call SMESH_Mesh directly and not via smeshBuilder.Mesh # class meshProxy(SMESH._objref_SMESH_Mesh): @@ -5017,7 +5018,40 @@ class meshProxy(SMESH._objref_SMESH_Mesh): pass omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy) -## class used to compensate change of CORBA API of SMESH_MeshEditor for backward compatibility + +## Class wrapping SMESH_SubMesh in order to add Compute() +# +class submeshProxy(SMESH._objref_SMESH_subMesh): + def __init__(self): + SMESH._objref_SMESH_subMesh.__init__(self) + self.mesh = None + def __deepcopy__(self, memo=None): + new = self.__class__() + return new + + ## Computes the sub-mesh and returns the status of the computation + # @param refresh if @c True, Object browser is automatically updated (when running in GUI) + # @return True or False + # @ingroup l2_construct + def Compute(self,refresh=False): + if not self.mesh: + self.mesh = Mesh( smeshBuilder(), None, self.GetMesh()) + + ok = self.mesh.Compute( self.GetSubShape(),refresh=[] ) + + if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0: + smeshgui = salome.ImportComponentGUI("SMESH") + smeshgui.Init(self.mesh.GetStudyId()) + smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) ) + if refresh: salome.sg.updateObjBrowser(1) + pass + + return ok + pass +omniORB.registerObjref(SMESH._objref_SMESH_subMesh._NP_RepositoryId, submeshProxy) + + +## Class used to compensate change of CORBA API of SMESH_MeshEditor for backward compatibility # with old dump scripts which call SMESH_MeshEditor directly and not via smeshBuilder.Mesh # class meshEditor(SMESH._objref_SMESH_MeshEditor): @@ -5129,7 +5163,7 @@ class algoCreator: raise RuntimeError, "No class found for algo type %s" % algoType return None -# Private class used to substitute and store variable parameters of hypotheses. +## Private class used to substitute and store variable parameters of hypotheses. # class hypMethodWrapper: def __init__(self, hyp, method): @@ -5160,7 +5194,8 @@ class hypMethodWrapper: return result pass -# A helper class that call UnRegister() of SALOME.GenericObj'es stored in it +## A helper class that call UnRegister() of SALOME.GenericObj'es stored in it +# class genObjUnRegister: def __init__(self, genObj=None): @@ -5181,6 +5216,9 @@ class genObjUnRegister: if genObj and hasattr( genObj, "UnRegister" ): genObj.UnRegister() + +## Bind methods creating mesher plug-ins to the Mesh class +# for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): # #print "pluginName: ", pluginName diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx index 2cf790a34..ff3b4c871 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx @@ -1202,7 +1202,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::IsApplicable( const TopoDS_Shape & aShape for (TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next(), ++nbFoundFaces ) { StdMeshers_FaceSidePtr circSide, linSide1, linSide2; - int nbSides = analyseFace( aShape, NULL, circSide, linSide1, linSide2 ); + int nbSides = analyseFace( exp.Current(), NULL, circSide, linSide1, linSide2 ); bool ok = ( 0 < nbSides && nbSides <= 3 && isCornerInsideCircle( circSide, linSide1, linSide2 )); if( toCheckAll && !ok ) return false;