From 88b3dbe23b236bd1746405155ae33a76aaf59ecd Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 28 Feb 2013 15:07:35 +0000 Subject: [PATCH] Merge from V6_main 28/02/2013 --- build_cmake | 2 +- build_cmake.bat | 2 +- doc/salome/examples/Makefile.am | 50 +-- doc/salome/examples/filters_ex13.py | 2 +- doc/salome/examples/filters_ex14.py | 2 +- doc/salome/examples/filters_ex31.py | 4 +- doc/salome/examples/modifying_meshes_ex10.py | 27 +- doc/salome/examples/quality_controls_ex01.py | 2 +- doc/salome/examples/quality_controls_ex02.py | 2 +- doc/salome/examples/quality_controls_ex03.py | 2 +- doc/salome/examples/testme.py | 5 +- .../examples/transforming_meshes_ex04.py | 2 +- .../examples/transforming_meshes_ex11.py | 46 ++- doc/salome/examples/viewing_meshes_ex02.py | 2 +- doc/salome/gui/SMESH/doxyfile.in | 7 +- .../gui/SMESH/input/smeshpy_interface.doc | 3 +- .../gui/SMESH/input/tui_cartesian_algo.doc | 3 +- .../gui/SMESH/input/tui_creating_meshes.doc | 24 +- .../SMESH/input/tui_defining_hypotheses.doc | 52 +-- doc/salome/gui/SMESH/input/tui_filters.doc | 108 ++---- .../input/tui_generate_flat_elements.doc | 3 +- .../gui/SMESH/input/tui_grouping_elements.doc | 24 +- .../gui/SMESH/input/tui_measurements.doc | 6 +- .../gui/SMESH/input/tui_modifying_meshes.doc | 78 ++-- .../gui/SMESH/input/tui_notebook_smesh.doc | 3 +- .../gui/SMESH/input/tui_prism_3d_algo.doc | 3 +- .../gui/SMESH/input/tui_quality_controls.doc | 66 ++-- .../SMESH/input/tui_transforming_meshes.doc | 39 +- .../SMESH/input/tui_use_existing_faces.doc | 3 +- .../gui/SMESH/input/tui_viewing_meshes.doc | 6 +- src/DriverGMF/DriverGMF_Read.cxx | 338 +++++++++++++----- src/DriverGMF/DriverGMF_Write.cxx | 131 +++++-- src/SMDS/SMDS_Downward.cxx | 13 +- src/SMESH/SMESH_Algo.cxx | 212 +++++------ src/SMESH/SMESH_Algo.hxx | 45 ++- src/SMESH/SMESH_Gen.cxx | 108 +----- src/SMESH/SMESH_MesherHelper.cxx | 73 ++++ src/SMESH/SMESH_MesherHelper.hxx | 6 + src/SMESH/SMESH_subMesh.cxx | 252 +++++++------ src/SMESH/SMESH_subMesh.hxx | 10 +- src/SMESHDS/SMESHDS_Hypothesis.hxx | 14 +- src/SMESHGUI/SMESHGUI.cxx | 2 - src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx | 34 +- src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h | 6 +- .../SMESHGUI_AddQuadraticElementDlg.cxx | 34 +- .../SMESHGUI_AddQuadraticElementDlg.h | 6 +- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx | 33 +- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h | 6 +- src/SMESHGUI/SMESHGUI_ClippingDlg.cxx | 15 +- src/SMESHGUI/SMESHGUI_ClippingDlg.h | 4 +- src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_CopyMeshDlg.h | 6 +- src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx | 19 +- src/SMESHGUI/SMESHGUI_CreatePatternDlg.h | 3 +- .../SMESHGUI_CreatePolyhedralVolumeDlg.cxx | 36 +- .../SMESHGUI_CreatePolyhedralVolumeDlg.h | 6 +- src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx | 21 +- src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h | 5 +- src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx | 19 +- src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h | 5 +- src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx | 50 +-- src/SMESHGUI/SMESHGUI_ExtrusionDlg.h | 7 +- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 20 +- src/SMESHGUI/SMESHGUI_FilterDlg.h | 5 +- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx | 25 +- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h | 5 +- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 31 +- src/SMESHGUI/SMESHGUI_GroupDlg.h | 6 +- src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx | 20 +- src/SMESHGUI/SMESHGUI_GroupOpDlg.h | 5 +- src/SMESHGUI/SMESHGUI_MergeDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_MergeDlg.h | 6 +- src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx | 21 +- src/SMESHGUI/SMESHGUI_MeshPatternDlg.h | 5 +- src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx | 34 +- src/SMESHGUI/SMESHGUI_MultiEditDlg.h | 6 +- src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 33 +- src/SMESHGUI/SMESHGUI_NodesDlg.h | 6 +- .../SMESHGUI_Preferences_ScalarBarDlg.cxx | 26 +- .../SMESHGUI_Preferences_ScalarBarDlg.h | 5 +- src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h | 6 +- src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h | 6 +- src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_RenumberingDlg.h | 6 +- src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx | 45 +-- src/SMESHGUI/SMESHGUI_RevolutionDlg.h | 5 +- src/SMESHGUI/SMESHGUI_RotationDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_RotationDlg.h | 6 +- src/SMESHGUI/SMESHGUI_ScaleDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_ScaleDlg.h | 6 +- src/SMESHGUI/SMESHGUI_SewingDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_SewingDlg.h | 6 +- src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx | 31 +- src/SMESHGUI/SMESHGUI_SingleEditDlg.h | 4 +- src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_SmoothingDlg.h | 6 +- src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_SymmetryDlg.h | 4 +- src/SMESHGUI/SMESHGUI_TranslationDlg.cxx | 32 +- src/SMESHGUI/SMESHGUI_TranslationDlg.h | 6 +- src/SMESHUtils/SMESH_TypeDefs.hxx | 2 +- src/StdMeshers/StdMeshers_Import_1D.cxx | 2 +- src/StdMeshers/StdMeshers_Prism_3D.cxx | 75 ++-- src/StdMeshers/StdMeshers_ProjectionUtils.cxx | 201 ++++++----- src/StdMeshers/StdMeshers_ProjectionUtils.hxx | 185 +++++----- src/StdMeshers/StdMeshers_Projection_1D.cxx | 11 +- src/StdMeshers/StdMeshers_Projection_1D2D.cxx | 2 +- src/StdMeshers/StdMeshers_Projection_2D.cxx | 20 +- src/StdMeshers/StdMeshers_Projection_3D.cxx | 9 +- .../StdMeshers_QuadToTriaAdaptor.cxx | 2 +- src/StdMeshers/StdMeshers_RadialPrism_3D.cxx | 2 +- src/StdMeshers/StdMeshers_ViscousLayers.cxx | 6 +- src/StdMeshers/StdMeshers_ViscousLayers2D.cxx | 9 +- 115 files changed, 1571 insertions(+), 1800 deletions(-) diff --git a/build_cmake b/build_cmake index 01bb2ac7f..30eeb733d 100755 --- a/build_cmake +++ b/build_cmake @@ -21,7 +21,7 @@ CURRENT_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` cd ${CONF_DIR} -python $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py --smesh +python $KERNEL_ROOT_DIR/salome_adm/cmake_files/deprecated/am2cmake.py --smesh status=$? cd ${CURRENT_DIR} exit $status diff --git a/build_cmake.bat b/build_cmake.bat index 890adcdff..38e8e726b 100644 --- a/build_cmake.bat +++ b/build_cmake.bat @@ -17,4 +17,4 @@ @REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com @REM -%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --smesh +%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\deprecated\am2cmake.py --smesh diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am index 930edd9fc..6a5904b91 100644 --- a/doc/salome/examples/Makefile.am +++ b/doc/salome/examples/Makefile.am @@ -26,16 +26,34 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am pyexamplesdir = $(docdir)/examples/SMESH -BAD_TESTS = +BAD_TESTS = \ + 3dmesh.py \ + creating_meshes_ex01.py \ + creating_meshes_ex03.py \ + creating_meshes_ex05.py \ + defining_hypotheses_ex06.py \ + defining_hypotheses_ex09.py \ + defining_hypotheses_ex17.py \ + filters_ex02.py \ + filters_ex08.py \ + filters_ex23.py \ + filters_ex24.py \ + filters_ex25.py \ + filters_ex32.py \ + filters_ex35.py \ + generate_flat_elements.py \ + modifying_meshes_ex26.py \ + notebook_smesh.py \ + quality_controls_ex06.py \ + quality_controls_ex20.py \ + quality_controls_ex21.py \ + quality_controls_ex22.py \ + viewing_meshes_ex01.py GOOD_TESTS = \ - 3dmesh.py \ cartesian_algo.py \ - creating_meshes_ex01.py \ creating_meshes_ex02.py \ - creating_meshes_ex03.py \ creating_meshes_ex04.py \ - creating_meshes_ex05.py \ creating_meshes_ex06.py \ creating_meshes_ex07.py \ creating_meshes_ex08.py \ @@ -44,10 +62,8 @@ GOOD_TESTS = \ defining_hypotheses_ex03.py \ defining_hypotheses_ex04.py \ defining_hypotheses_ex05.py \ - defining_hypotheses_ex06.py \ defining_hypotheses_ex07.py \ defining_hypotheses_ex08.py \ - defining_hypotheses_ex09.py \ defining_hypotheses_ex10.py \ defining_hypotheses_ex11.py \ defining_hypotheses_ex12.py \ @@ -55,15 +71,12 @@ GOOD_TESTS = \ defining_hypotheses_ex14.py \ defining_hypotheses_ex15.py \ defining_hypotheses_ex16.py \ - defining_hypotheses_ex17.py \ filters_ex01.py \ - filters_ex02.py \ filters_ex03.py \ filters_ex04.py \ filters_ex05.py \ filters_ex06.py \ filters_ex07.py \ - filters_ex08.py \ filters_ex09.py \ filters_ex10.py \ filters_ex11.py \ @@ -78,21 +91,15 @@ GOOD_TESTS = \ filters_ex20.py \ filters_ex21.py \ filters_ex22.py \ - filters_ex23.py \ - filters_ex24.py \ - filters_ex25.py \ filters_ex26.py \ filters_ex27.py \ filters_ex28.py \ filters_ex29.py \ filters_ex30.py \ filters_ex31.py \ - filters_ex32.py \ filters_ex33.py \ filters_ex34.py \ - filters_ex35.py \ filters_ex36.py \ - generate_flat_elements.py \ grouping_elements_ex01.py \ grouping_elements_ex02.py \ grouping_elements_ex03.py \ @@ -128,15 +135,12 @@ GOOD_TESTS = \ modifying_meshes_ex23.py \ modifying_meshes_ex24.py \ modifying_meshes_ex25.py \ - modifying_meshes_ex26.py \ - notebook_smesh.py \ prism_3d_algo.py \ quality_controls_ex01.py \ quality_controls_ex02.py \ quality_controls_ex03.py \ quality_controls_ex04.py \ quality_controls_ex05.py \ - quality_controls_ex06.py \ quality_controls_ex07.py \ quality_controls_ex08.py \ quality_controls_ex09.py \ @@ -150,9 +154,6 @@ GOOD_TESTS = \ quality_controls_ex17.py \ quality_controls_ex18.py \ quality_controls_ex19.py \ - quality_controls_ex20.py \ - quality_controls_ex21.py \ - quality_controls_ex22.py \ transforming_meshes_ex01.py \ transforming_meshes_ex02.py \ transforming_meshes_ex03.py \ @@ -167,14 +168,13 @@ GOOD_TESTS = \ transforming_meshes_ex12.py \ transforming_meshes_ex13.py \ use_existing_faces.py \ - viewing_meshes_ex01.py \ viewing_meshes_ex02.py pyexamples_SCRIPTS = $(BAD_TESTS) $(GOOD_TESTS) EXTRA_DIST += $(pyexamples_SCRIPTS) testme.py -check-local: +installcheck-local: @for f in $(GOOD_TESTS) ; do \ - python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \ + env SMESH_ROOT_DIR=$(prefix) python -B $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \ done diff --git a/doc/salome/examples/filters_ex13.py b/doc/salome/examples/filters_ex13.py index d5415e20a..e20937d1b 100644 --- a/doc/salome/examples/filters_ex13.py +++ b/doc/salome/examples/filters_ex13.py @@ -3,7 +3,7 @@ # create mesh from SMESH_mechanic import * # remove some faces to have faces with bare borders -mesh.RemoveElements( mesh.GetElementsByType(FACE)[0:5] ) +mesh.RemoveElements( mesh.GetElementsByType(smesh.FACE)[0:5] ) # get all faces bare borders filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace) ids = mesh.GetIdsFromFilter(filter) diff --git a/doc/salome/examples/filters_ex14.py b/doc/salome/examples/filters_ex14.py index 45c356cdf..01ea27ab9 100644 --- a/doc/salome/examples/filters_ex14.py +++ b/doc/salome/examples/filters_ex14.py @@ -2,7 +2,7 @@ # create mesh from SMESH_mechanic import * -faceID = mesh.GetElementsByType(FACE)[0] +faceID = mesh.GetElementsByType(smesh.FACE)[0] # get all faces co-planar to the first face with tolerance 5 degrees filter = smesh.GetFilter(smesh.FACE, smesh.FT_CoplanarFaces,faceID,Tolerance=5.0) ids = mesh.GetIdsFromFilter(filter) diff --git a/doc/salome/examples/filters_ex31.py b/doc/salome/examples/filters_ex31.py index a20f7d708..4a2acbfa8 100644 --- a/doc/salome/examples/filters_ex31.py +++ b/doc/salome/examples/filters_ex31.py @@ -3,9 +3,9 @@ # create mesh from SMESH_mechanic import * # get nodes with identifiers [5-10] and [15-30] -criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Treshold="5-10",\ +criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="5-10",\ BinaryOp=smesh.FT_LogicalOR) -criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Treshold="15-30") +criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="15-30") filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion1,criterion2]) ids = mesh.GetIdsFromFilter(filter) diff --git a/doc/salome/examples/modifying_meshes_ex10.py b/doc/salome/examples/modifying_meshes_ex10.py index 7f36728c1..1d1af1942 100644 --- a/doc/salome/examples/modifying_meshes_ex10.py +++ b/doc/salome/examples/modifying_meshes_ex10.py @@ -1,6 +1,7 @@ # Add Polyhedron import salome +import smesh import math # create an empty mesh structure @@ -39,18 +40,18 @@ for i in range(5): pass # Create a polyhedral volume (12-hedron with pentagonal faces) -MeshEditor.AddPolyhedralVolume([dd[0], dd[1], dd[2], dd[3], dd[4], # top - dd[0], cc[0], bb[1], cc[1], dd[1], # - - dd[1], cc[1], bb[2], cc[2], dd[2], # - - dd[2], cc[2], bb[3], cc[3], dd[3], # - below top - dd[3], cc[3], bb[4], cc[4], dd[4], # - - dd[4], cc[4], bb[0], cc[0], dd[0], # - - aa[4], bb[4], cc[4], bb[0], aa[0], # . - aa[3], bb[3], cc[3], bb[4], aa[4], # . - aa[2], bb[2], cc[2], bb[3], aa[3], # . above bottom - aa[1], bb[1], cc[1], bb[2], aa[2], # . - aa[0], bb[0], cc[0], bb[1], aa[1], # . - aa[0], aa[1], aa[2], aa[3], aa[4]], # bottom - [5,5,5,5,5,5,5,5,5,5,5,5]) +mesh.GetMeshEditor().AddPolyhedralVolume([dd[0], dd[1], dd[2], dd[3], dd[4], # top + dd[0], cc[0], bb[1], cc[1], dd[1], # - + dd[1], cc[1], bb[2], cc[2], dd[2], # - + dd[2], cc[2], bb[3], cc[3], dd[3], # - below top + dd[3], cc[3], bb[4], cc[4], dd[4], # - + dd[4], cc[4], bb[0], cc[0], dd[0], # - + aa[4], bb[4], cc[4], bb[0], aa[0], # . + aa[3], bb[3], cc[3], bb[4], aa[4], # . + aa[2], bb[2], cc[2], bb[3], aa[3], # . above bottom + aa[1], bb[1], cc[1], bb[2], aa[2], # . + aa[0], bb[0], cc[0], bb[1], aa[1], # . + aa[0], aa[1], aa[2], aa[3], aa[4]], # bottom + [5,5,5,5,5,5,5,5,5,5,5,5]) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex01.py b/doc/salome/examples/quality_controls_ex01.py index ed4dc244e..f411d2e61 100644 --- a/doc/salome/examples/quality_controls_ex01.py +++ b/doc/salome/examples/quality_controls_ex01.py @@ -35,7 +35,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateGroup(SMESH.EDGE, "Free borders") +aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Free borders") aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex02.py b/doc/salome/examples/quality_controls_ex02.py index 7b1f55e6f..5373c4d6f 100644 --- a/doc/salome/examples/quality_controls_ex02.py +++ b/doc/salome/examples/quality_controls_ex02.py @@ -38,7 +38,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateGroup(SMESH.EDGE, "Borders at multi-connections") +aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Borders at multi-connections") aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex03.py b/doc/salome/examples/quality_controls_ex03.py index 8cb409866..eaa607b94 100644 --- a/doc/salome/examples/quality_controls_ex03.py +++ b/doc/salome/examples/quality_controls_ex03.py @@ -37,7 +37,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`) +aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Edges with length > " + `length_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py index b1328b596..c870ab656 100755 --- a/doc/salome/examples/testme.py +++ b/doc/salome/examples/testme.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import unittest, sys +import unittest, sys, os class SalomeSession(object): def __init__(self, script): @@ -10,11 +10,10 @@ class SalomeSession(object): sys.argv += ["--modules=GEOM,MED,SMESH"] sys.argv += ["--execute=%s" % script] clt, d = runSalome.main() - self.port = d['port'] return def __del__(self): - port = self.port + port = os.getenv('NSPORT') import killSalomeWithPort killSalomeWithPort.killMyPort(port) return diff --git a/doc/salome/examples/transforming_meshes_ex04.py b/doc/salome/examples/transforming_meshes_ex04.py index ea7c72f54..0bfea6188 100644 --- a/doc/salome/examples/transforming_meshes_ex04.py +++ b/doc/salome/examples/transforming_meshes_ex04.py @@ -8,6 +8,6 @@ smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # create a symmetrical copy of the mesh mirrored through a point -axis = SMESH.AxisStruct(0, 0, 0, 0, 0, 0) +axis = smesh.AxisStruct(0, 0, 0, 0, 0, 0) mesh.Mirror([], axis, smesh.POINT, 1) diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py index 55fbe8f28..f94aafeda 100644 --- a/doc/salome/examples/transforming_meshes_ex11.py +++ b/doc/salome/examples/transforming_meshes_ex11.py @@ -1,10 +1,18 @@ # Duplicate nodes import salome +import geompy import smesh -import SMESH_test1 -mesh = SMESH_test1.mesh +# Create a box + +box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) + +# Define hexa mesh on a box +mesh = smesh.Mesh(box, "Mesh") +mesh.Segment().NumberOfSegments(7) +mesh.Quadrangle() +mesh.Hexahedron() # Compute mesh mesh.Compute() @@ -13,53 +21,53 @@ mesh.Compute() # Nodes to duplicate nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' ) -nodes1.Add( [ 289, 278, 302, 285 ] ) +nodes1.Add( [ 119, 125, 131, 137 ] ) # Group of faces to replace nodes with new ones faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' ) -faces1.Add( [ 519, 556, 557 ] ) +faces1.Add( [ 144, 151, 158 ] ) # Duplicate nodes print "\nMesh before the first nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() groupOfCreatedNodes = mesh.DoubleNodeGroup(nodes1, faces1, theMakeGroup=True) print "New nodes:", groupOfCreatedNodes.GetIDs() print "\nMesh after the first nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() # With the duplication of border elements # Edges to duplicate edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' ) -edges.Add( [ 29, 30, 31 ] ) +edges.Add( [ 32, 33, 34 ] ) # Nodes not to duplicate nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' ) -nodes2.Add( [ 32, 5 ] ) +nodes2.Add( [ 35, 38 ] ) # Group of faces to replace nodes with new ones faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' ) -faces2.Add( [ 576, 578, 580 ] ) +faces2.Add( [ 141, 148, 155 ] ) # Duplicate nodes print "\nMesh before the second nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() groupOfNewEdges = mesh.DoubleNodeElemGroup( edges, nodes2, faces2, theMakeGroup=True ) print "New edges:", groupOfNewEdges.GetIDs() print "\nMesh after the second nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Triangles : ", mesh.NbTriangles() +print "Nodes : ", mesh.NbNodes() +print "Edges : ", mesh.NbEdges() +print "Quadrangles : ", mesh.NbQuadrangles() # Update object browser if salome.sg.hasDesktop(): diff --git a/doc/salome/examples/viewing_meshes_ex02.py b/doc/salome/examples/viewing_meshes_ex02.py index de345e8a3..cd096ca76 100644 --- a/doc/salome/examples/viewing_meshes_ex02.py +++ b/doc/salome/examples/viewing_meshes_ex02.py @@ -8,7 +8,7 @@ import SMESH box = geompy.MakeBoxDXDYDZ(100,100,100) # Create a mesh -mesh = Mesh(box,"Mesh") +mesh = smesh.Mesh(box,"Mesh") mesh.AutomaticHexahedralization() mesh.Compute() diff --git a/doc/salome/gui/SMESH/doxyfile.in b/doc/salome/gui/SMESH/doxyfile.in index a6a5fc1f1..6b27a0c76 100755 --- a/doc/salome/gui/SMESH/doxyfile.in +++ b/doc/salome/gui/SMESH/doxyfile.in @@ -42,7 +42,7 @@ INPUT = @srcdir@/input @top_srcdir@/src/Tools/padder/doc/input FILE_PATTERNS = *.doc EXCLUDE = IMAGE_PATH = @srcdir@/images @top_srcdir@/src/Tools/padder/doc/images -EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG @top_srcdir@/doc/salome/examples +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples @top_srcdir@/src/SMESH_SWIG #--------------------------------------------------------------------------- #HTML related options @@ -80,3 +80,8 @@ GENERATE_RTF = NO TAGFILES = smeshpy_doc.tag=../SMESH/smeshpy_doc #rnv: 07.04.2011 Workaround for the doxygen 1.7.3: #because it wrongly defines location of the html files for search. SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index 699e5c981..72d4585e1 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -36,8 +36,7 @@ An example below demonstrates usage of the Python API for 3d mesh generation. \anchor example_3d_mesh

Example of 3d mesh generation:

-\include 3dmesh.py -Download this script +\tui_script{3dmesh.py} Examples of Python scripts for Mesh operations are available by the following links: diff --git a/doc/salome/gui/SMESH/input/tui_cartesian_algo.doc b/doc/salome/gui/SMESH/input/tui_cartesian_algo.doc index 4cc1ec654..dccf68a5f 100644 --- a/doc/salome/gui/SMESH/input/tui_cartesian_algo.doc +++ b/doc/salome/gui/SMESH/input/tui_cartesian_algo.doc @@ -1,7 +1,6 @@ /*! \page tui_cartesian_algo Usage of Body Fitting algorithm -\include cartesian_algo.py -Download this script +\tui_script{cartesian_algo.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc index bdeeb8a7a..d7edad332 100644 --- a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc @@ -7,52 +7,44 @@

Construction of a Mesh

-\include creating_meshes_ex01.py -Download this script +\tui_script{creating_meshes_ex01.py}
\anchor tui_construction_submesh

Construction of a Submesh

-\include creating_meshes_ex02.py -Download this script +\tui_script{creating_meshes_ex02.py}

Change priority of submeshes in Mesh

-\include creating_meshes_ex03.py -Download this script +\tui_script{creating_meshes_ex03.py}
\anchor tui_editing_mesh

Editing of a mesh

-\include creating_meshes_ex04.py -Download this script +\tui_script{creating_meshes_ex04.py}
\anchor tui_export_mesh

Export of a Mesh

-\include creating_meshes_ex05.py -Download this script +\tui_script{creating_meshes_ex05.py}

How to mesh a cylinder with hexahedrons?

Here you can see an example of python script, creating a hexahedral mesh on a cylinder. And a picture below the source code of the script, demonstrating the resulting mesh. -\include creating_meshes_ex06.py -Download this script +\tui_script{creating_meshes_ex06.py} \image html mesh_cylinder_hexa.png
\anchor tui_building_compound

Building a compound of meshes

-\include creating_meshes_ex07.py -Download this script +\tui_script{creating_meshes_ex07.py}
\anchor tui_copy_mesh

Mesh Copying

-\include creating_meshes_ex08.py -Download this script +\tui_script{creating_meshes_ex08.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index 3f3124db3..71abf33b6 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -44,102 +44,84 @@ This page provides example codes of \ref tui_defining_meshing_algos
\anchor tui_1d_arithmetic

Arithmetic 1D

-\include defining_hypotheses_ex01.py -Download this script +\tui_script{defining_hypotheses_ex01.py}
\anchor tui_deflection_1d

Deflection 1D and Number of Segments

-\include defining_hypotheses_ex02.py -Download this script +\tui_script{defining_hypotheses_ex02.py}
\anchor tui_start_and_end_length

Start and End Length

-\include defining_hypotheses_ex03.py -Download this script +\tui_script{defining_hypotheses_ex03.py}
\anchor tui_average_length

Local Length

-\include defining_hypotheses_ex04.py -Download this script +\tui_script{defining_hypotheses_ex04.py}

Defining 2D and 3D hypotheses


\anchor tui_max_element_area

Maximum Element Area

-\include defining_hypotheses_ex05.py -Download this script +\tui_script{defining_hypotheses_ex05.py}
\anchor tui_max_element_volume

Maximum Element Volume

-\include defining_hypotheses_ex06.py -Download this script +\tui_script{defining_hypotheses_ex06.py}
\anchor tui_length_from_edges

Length from Edges

-\include defining_hypotheses_ex07.py -Download this script +\tui_script{defining_hypotheses_ex07.py}

Defining Additional Hypotheses


\anchor tui_propagation

Propagation

-\include defining_hypotheses_ex08.py -Download this script +\tui_script{defining_hypotheses_ex08.py}
\anchor tui_defining_meshing_algos

Defining Meshing Algorithms

-\include defining_hypotheses_ex09.py -Download this script +\tui_script{defining_hypotheses_ex09.py}
\anchor tui_projection

Projection Algorithms

-\include defining_hypotheses_ex10.py -Download this script +\tui_script{defining_hypotheses_ex10.py}

Projection 1D2D

-\include defining_hypotheses_ex11.py -Download this script +\tui_script{defining_hypotheses_ex11.py}
\anchor tui_fixed_points

1D Mesh with Fixed Points example

-\include defining_hypotheses_ex12.py -Download this script +\tui_script{defining_hypotheses_ex12.py} \anchor tui_radial_quadrangle

Radial Quadrangle 1D2D example

-\include defining_hypotheses_ex13.py -Download this script +\tui_script{defining_hypotheses_ex13.py} \anchor tui_quadrangle_parameters

Quadrangle Parameters example 1 (meshing a face with 3 edges)

-\include defining_hypotheses_ex14.py -Download this script +\tui_script{defining_hypotheses_ex14.py}

Quadrangle Parameters example 2 (using different types)

-\include defining_hypotheses_ex15.py -Download this script +\tui_script{defining_hypotheses_ex15.py} \anchor tui_import

"Use Existing Elements" example

-\include defining_hypotheses_ex16.py -Download this script +\tui_script{defining_hypotheses_ex16.py} \anchor tui_viscous_layers

Viscous layers construction

- -\include defining_hypotheses_ex17.py -Download this script +\tui_script{defining_hypotheses_ex17.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_filters.doc b/doc/salome/gui/SMESH/input/tui_filters.doc index 2540f52b8..eaf5d2803 100755 --- a/doc/salome/gui/SMESH/input/tui_filters.doc +++ b/doc/salome/gui/SMESH/input/tui_filters.doc @@ -27,8 +27,7 @@ Filter 2D mesh elements (faces) according to the aspect ratio value: - functor type should be \a smesh.FT_AspectRatio - threshold is floating point value (aspect ratio) -\include filters_ex01.py -Download this script +\tui_script{filters_ex01.py} \sa \ref tui_aspect_ratio @@ -39,8 +38,7 @@ Filter 3D mesh elements (volumes) according to the aspect ratio value: - functor type is \a smesh.FT_AspectRatio3D - threshold is floating point value (aspect ratio) -\include filters_ex02.py -Download this script +\tui_script{filters_ex02.py} \sa \ref tui_aspect_ratio_3d @@ -51,8 +49,7 @@ Filter 2D mesh elements (faces) according to the warping angle value: - functor type is \a smesh.FT_Warping - threshold is floating point value (warping angle) -\include filters_ex03.py -Download this script +\tui_script{filters_ex03.py} \sa \ref tui_warping @@ -63,8 +60,7 @@ Filter 2D mesh elements (faces) according to the minimum angle value: - functor type is \a smesh.FT_MinimumAngle - threshold is floating point value (minimum angle) -\include filters_ex04.py -Download this script +\tui_script{filters_ex04.py} \sa \ref tui_minimum_angle @@ -75,8 +71,7 @@ Filter 2D mesh elements (faces) according to the taper value: - functor type is \a smesh.FT_Taper - threshold is floating point value (taper) -\include filters_ex05.py -Download this script +\tui_script{filters_ex05.py} \sa \ref tui_taper @@ -87,8 +82,7 @@ Filter 2D mesh elements (faces) according to the skew value: - functor type is \a smesh.FT_Skew - threshold is floating point value (skew) -\include filters_ex06.py -Download this script +\tui_script{filters_ex06.py} \sa \ref tui_skew @@ -99,8 +93,7 @@ Filter 2D mesh elements (faces) according to the area value: - functor type is \a smesh.FT_Area - threshold is floating point value (area) -\include filters_ex07.py -Download this script +\tui_script{filters_ex07.py} \sa \ref tui_area @@ -111,8 +104,7 @@ Filter 3D mesh elements (volumes) according to the volume value: - functor type is \a smesh.FT_Volume3D - threshold is floating point value (volume) -\include filters_ex08.py -Download this script +\tui_script{filters_ex08.py} \sa \ref tui_volume @@ -123,8 +115,7 @@ Filter 1D mesh elements (edges) which represent free borders of a mesh: - functor type is \a smesh.FT_FreeBorders - threshold value is not required -\include filters_ex09.py -Download this script +\tui_script{filters_ex09.py} \sa \ref tui_free_borders @@ -136,8 +127,7 @@ element of mesh only: - functor type is \a smesh.FT_FreeEdges - threshold value is not required -\include filters_ex10.py -Download this script +\tui_script{filters_ex10.py} \sa \ref tui_free_edges @@ -148,8 +138,7 @@ Filter free nodes: - functor type is \a smesh.FT_FreeNodes - threshold value is not required -\include filters_ex11.py -Download this script +\tui_script{filters_ex11.py} \sa \ref tui_free_nodes @@ -160,8 +149,7 @@ Filter free faces: - functor type is \a smesh.FT_FreeFaces - threshold value is not required -\include filters_ex12.py -Download this script +\tui_script{filters_ex12.py} \sa \ref tui_free_faces @@ -172,8 +160,7 @@ Filter faces with bare borders: - functor type is \a smesh.FT_BareBorderFace - threshold value is not required -\include filters_ex13.py -Download this script +\tui_script{filters_ex13.py} \sa \ref tui_bare_border_faces @@ -185,8 +172,7 @@ Filter faces with bare borders: - threshold value is the face ID - tolerance is in degrees -\include filters_ex14.py -Download this script +\tui_script{filters_ex14.py} \section filter_over_constrained_faces Over-constrained faces @@ -195,8 +181,7 @@ Filter over-constrained faces: - functor type is \a smesh.FT_OverConstrainedFace - threshold value is not required -\include filters_ex15.py -Download this script +\tui_script{filters_ex15.py} \sa \ref tui_over_constrained_faces @@ -208,8 +193,7 @@ filter mesh elements basing on the same set of nodes: smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes, - threshold value is not required -\include filters_ex16.py -Download this script +\tui_script{filters_ex16.py} \section tui_double_nodes_control Double nodes @@ -220,8 +204,7 @@ filters mesh nodes which are coincident with other nodes (within a given toleran - threshold value is not required - default tolerance is 1.0e-7 -\include filters_ex17.py -Download this script +\tui_script{filters_ex17.py} \section filter_borders_multiconnection Borders at multi-connection @@ -232,8 +215,7 @@ connections (faces belonging the border edges) - functor type is \a smesh.FT_MultiConnection - threshold is integer value (number of connections) -\include filters_ex18.py -Download this script +\tui_script{filters_ex18.py} \sa \ref tui_borders_at_multiconnection @@ -245,8 +227,7 @@ to the specified number of mesh elements - functor type is \a smesh.FT_MultiConnection2D - threshold is integer value (number of connections) -\include filters_ex19.py -Download this script +\tui_script{filters_ex19.py} \sa \ref tui_borders_at_multiconnection_2d @@ -257,8 +238,7 @@ Filter 1D mesh elements (edges) according to the edge length value: - functor type should be \a smesh.FT_Length - threshold is floating point value (length) -\include filters_ex20.py -Download this script +\tui_script{filters_ex20.py} \sa \ref tui_length_1d @@ -270,8 +250,7 @@ value of its edges: - functor type should be \a smesh.FT_Length2D - threshold is floating point value (edge length) -\include filters_ex21.py -Download this script +\tui_script{filters_ex21.py} \sa \ref tui_length_2d @@ -283,8 +262,7 @@ value of its edges and diagonals: - functor type should be \a smesh.FT_MaxElementLength2D - threshold is floating point value (edge/diagonal length) -\include filters_ex22.py -Download this script +\tui_script{filters_ex22.py} \sa \ref tui_max_element_length_2d @@ -296,8 +274,7 @@ value of its edges and diagonals: - functor type should be \a smesh.FT_MaxElementLength3D - threshold is floating point value (edge/diagonal length) -\include filters_ex23.py -Download this script +\tui_script{filters_ex23.py} \sa \ref tui_max_element_length_3d @@ -308,8 +285,7 @@ Filter 3D mesh elements with bare borders: - functor type is \a smesh.FT_BareBorderVolume - threshold value is not required -\include filters_ex24.py -Download this script +\tui_script{filters_ex24.py} \sa \ref tui_bare_border_volumes @@ -320,8 +296,7 @@ Filter over-constrained volumes: - functor type is \a smesh.FT_OverConstrainedVolume - threshold value is not required -\include filters_ex25.py -Download this script +\tui_script{filters_ex25.py} \sa \ref tui_over_constrained_faces @@ -333,8 +308,7 @@ shape defined by threshold value: - functor type should be \a smesh.FT_BelongToGeom - threshold is geometrical object -\include filters_ex26.py -Download this script +\tui_script{filters_ex26.py} \section filter_lying_on_geom Lying on Geom @@ -344,8 +318,7 @@ shape defined by threshold value: - functor type should be \a smesh.FT_LyingOnGeom - threshold is geometrical object -\include filters_ex27.py -Download this script +\tui_script{filters_ex27.py} \section filter_belong_to_plane Belong to Plane @@ -356,8 +329,7 @@ plane defined by threshold value with the given tolerance: - threshold is geometrical object (plane) - default tolerance is 1.0e-7 -\include filters_ex28.py -Download this script +\tui_script{filters_ex28.py} \section filter_belong_to_cylinder Belong to Cylinder @@ -368,8 +340,7 @@ cylindrical face defined by threshold value with the given tolerance: - threshold is geometrical object (cylindrical face) - default tolerance is 1.0e-7 -\include filters_ex29.py -Download this script +\tui_script{filters_ex29.py} \section filter_belong_to_surface Belong to Surface @@ -380,8 +351,7 @@ arbitrary surface defined by threshold value with the given tolerance: - threshold is geometrical object (arbitrary surface) - default tolerance is 1.0e-7 -\include filters_ex30.py -Download this script +\tui_script{filters_ex30.py} \section filter_range_of_ids Range of IDs @@ -391,8 +361,7 @@ specified identifiers range: - functor type is \a smesh.FT_RangeOfIds - threshold is string listing required IDs and/or ranges of IDs, e.g."1,2,3,50-60,63,67,70-78" -\include filters_ex31.py -Download this script +\tui_script{filters_ex31.py} \section filter_bad_oriented_volume Badly oriented volume @@ -402,8 +371,7 @@ the point of view of MED convention. - functor type is \a smesh.FT_BadOrientedVolume - threshold is not required -\include filters_ex32.py -Download this script +\tui_script{filters_ex32.py} \section filter_linear_or_quadratic Linear / quadratic @@ -414,8 +382,7 @@ Filter linear / quadratic mesh elements: - if unary operator is set to smesh.FT_LogicalNOT, the quadratic elements are selected, otherwise (by default) linear elements are selected -\include filters_ex33.py -Download this script +\tui_script{filters_ex33.py} \section filter_group_color Group color @@ -424,8 +391,7 @@ Filter mesh entities, belonging to the group with the color defined by the thres - functor type is \a smesh.FT_GroupColor - threshold should be of SALOMEDS.Color type -\include filters_ex34.py -Download this script +\tui_script{filters_ex34.py} \section filter_geom_type Geometry type @@ -436,8 +402,7 @@ entity type. - functor type should be \a smesh.FT_ElemGeomType - threshold is of smesh.GeometryType value -\include filters_ex35.py -Download this script +\tui_script{filters_ex35.py} \section combining_filters How to combine filters with Criterion structures? @@ -445,8 +410,7 @@ Filters can be combined by making use of "criteria". Example : -\include filters_ex36.py -Download this script +\tui_script{filters_ex36.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc b/doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc index 36e13d304..7284a76b5 100644 --- a/doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc +++ b/doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc @@ -17,8 +17,7 @@ by flat elements. \n This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder). The big cylinder is defined by two geometric volumes. -\include generate_flat_elements.py -Download this script +\tui_script{generate_flat_elements.py} \n Here, the 4 groups of volumes [Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1] constitute a partition of the mesh. The flat elements on group boundaries and on faces are built with the diff --git a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc index d3113ab2c..a264f2542 100644 --- a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc +++ b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc @@ -5,29 +5,25 @@
\anchor tui_create_standalone_group

Create a Standalone Group

-\include grouping_elements_ex01.py -Download this script +\tui_script{grouping_elements_ex01.py} \image html create_group.png
\anchor tui_create_group_on_geometry

Create a Group on Geometry

-\include grouping_elements_ex02.py -Download this script +\tui_script{grouping_elements_ex02.py}
\anchor tui_create_group_on_filter

Create a Group on Filter

-\include grouping_elements_ex03.py -Download this script +\tui_script{grouping_elements_ex03.py}
\anchor tui_edit_group

Edit a Group

-\include grouping_elements_ex04.py -Download this script +\tui_script{grouping_elements_ex04.py} \image html editing_groups1.png @@ -36,8 +32,7 @@
\anchor tui_union_of_groups

Union of groups

-\include grouping_elements_ex05.py -Download this script +\tui_script{grouping_elements_ex05.py} \image html union_groups1.png @@ -48,8 +43,7 @@
\anchor tui_intersection_of_groups

Intersection of groups

-\include grouping_elements_ex06.py -Download this script +\tui_script{grouping_elements_ex06.py} \image html intersect_groups1.png @@ -60,8 +54,7 @@
\anchor tui_cut_of_groups

Cut of groups

-\include grouping_elements_ex07.py -Download this script +\tui_script{grouping_elements_ex07.py} \image html cut_groups1.png @@ -72,8 +65,7 @@
\anchor tui_create_dim_group

Creating groups of entities from existing groups of superior dimensions

-\include grouping_elements_ex08.py -Download this script +\tui_script{grouping_elements_ex08.py} \image html dimgroup_tui1.png
Source groups of faces
diff --git a/doc/salome/gui/SMESH/input/tui_measurements.doc b/doc/salome/gui/SMESH/input/tui_measurements.doc index 8ca283fc3..4d25c7358 100644 --- a/doc/salome/gui/SMESH/input/tui_measurements.doc +++ b/doc/salome/gui/SMESH/input/tui_measurements.doc @@ -3,11 +3,9 @@ \page tui_measurements_page Measurements \section tui_min_distance Minimum Distance -\include measurements_ex01.py -Download this script +\tui_script{measurements_ex01.py} \section tui_bounding_box Bounding Box -\include measurements_ex02.py -Download this script +\tui_script{measurements_ex02.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index e7844327c..7ceb5ebf7 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -9,62 +9,52 @@
\anchor tui_add_node

Add Node

-\include modifying_meshes_ex01.py -Download this script +\tui_script{modifying_meshes_ex01.py}
\anchor tui_add_0DElement

Add 0D Element

-\include modifying_meshes_ex02.py -Download this script +\tui_script{modifying_meshes_ex02.py}
\anchor tui_add_0DElement_on_all_nodes

Add 0D Element on Element Nodes

-\include modifying_meshes_ex03.py -Download this script +\tui_script{modifying_meshes_ex03.py}
\anchor tui_add_edge

Add Edge

-\include modifying_meshes_ex04.py -Download this script +\tui_script{modifying_meshes_ex04.py}
\anchor tui_add_triangle

Add Triangle

-\include modifying_meshes_ex05.py -Download this script +\tui_script{modifying_meshes_ex05.py}
\anchor tui_add_quadrangle

Add Quadrangle

-\include modifying_meshes_ex06.py -Download this script +\tui_script{modifying_meshes_ex06.py}
\anchor tui_add_tetrahedron

Add Tetrahedron

-\include modifying_meshes_ex07.py -Download this script +\tui_script{modifying_meshes_ex07.py}
\anchor tui_add_hexahedron

Add Hexahedron

-\include modifying_meshes_ex08.py -Download this script +\tui_script{modifying_meshes_ex08.py}
\anchor tui_add_polygon

Add Polygon

-\include modifying_meshes_ex09.py -Download this script +\tui_script{modifying_meshes_ex09.py}
\anchor tui_add_polyhedron

Add Polyhedron

-\include modifying_meshes_ex10.py -Download this script +\tui_script{modifying_meshes_ex10.py}
\anchor tui_removing_nodes_and_elements @@ -73,97 +63,81 @@
\anchor tui_removing_nodes

Removing Nodes

-\include modifying_meshes_ex11.py -Download this script +\tui_script{modifying_meshes_ex11.py}
\anchor tui_removing_elements

Removing Elements

-\include modifying_meshes_ex12.py -Download this script +\tui_script{modifying_meshes_ex12.py}
\anchor tui_removing_orphan_nodes

Removing Orphan Nodes

-\include modifying_meshes_ex13.py -Download this script +\tui_script{modifying_meshes_ex13.py}
\anchor tui_renumbering_nodes_and_elements

Renumbering Nodes and Elements

-\include modifying_meshes_ex14.py -Download this script +\tui_script{modifying_meshes_ex14.py}
\anchor tui_moving_nodes

Moving Nodes

-\include modifying_meshes_ex15.py -Download this script +\tui_script{modifying_meshes_ex15.py}
\anchor tui_diagonal_inversion

Diagonal Inversion

-\include modifying_meshes_ex16.py -Download this script +\tui_script{modifying_meshes_ex16.py}
\anchor tui_uniting_two_triangles

Uniting two Triangles

-\include modifying_meshes_ex17.py -Download this script +\tui_script{modifying_meshes_ex17.py}
\anchor tui_uniting_set_of_triangles

Uniting a Set of Triangles

-\include modifying_meshes_ex18.py -Download this script +\tui_script{modifying_meshes_ex18.py}
\anchor tui_orientation

Orientation

-\include modifying_meshes_ex19.py -Download this script +\tui_script{modifying_meshes_ex19.py}
\anchor tui_cutting_quadrangles

Cutting Quadrangles

-\include modifying_meshes_ex20.py -Download this script +\tui_script{modifying_meshes_ex20.py}
\anchor tui_smoothing

Smoothing

-\include modifying_meshes_ex21.py -Download this script +\tui_script{modifying_meshes_ex21.py}
\anchor tui_extrusion

Extrusion

-\include modifying_meshes_ex22.py -Download this script +\tui_script{modifying_meshes_ex22.py}
\anchor tui_extrusion_along_path

Extrusion along a Path

-\include modifying_meshes_ex23.py -Download this script +\tui_script{modifying_meshes_ex23.py}
\anchor tui_revolution

Revolution

-\include modifying_meshes_ex24.py -Download this script +\tui_script{modifying_meshes_ex24.py}
\anchor tui_pattern_mapping

Pattern Mapping

-\include modifying_meshes_ex25.py -Download this script +\tui_script{modifying_meshes_ex25.py}
\anchor tui_quadratic

Convert mesh to/from quadratic

-\include modifying_meshes_ex26.py -Download this script +\tui_script{modifying_meshes_ex26.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_notebook_smesh.doc b/doc/salome/gui/SMESH/input/tui_notebook_smesh.doc index 340359069..7f34deca9 100644 --- a/doc/salome/gui/SMESH/input/tui_notebook_smesh.doc +++ b/doc/salome/gui/SMESH/input/tui_notebook_smesh.doc @@ -3,7 +3,6 @@ \page tui_notebook_smesh_page Using SALOME NoteBook \anchor tui_notebook_smesh -\include notebook_smesh.py -Download this script +\tui_script{notebook_smesh.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc b/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc index d0234a7ab..6ba5e25d3 100644 --- a/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc +++ b/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc @@ -1,8 +1,7 @@ /*! \page tui_prism_3d_algo Use 3D extrusion meshing algorithm -\include prism_3d_algo.py -Download this script +\tui_script{prism_3d_algo.py} The result geometry and mesh is shown below \image html prism_tui_sample.png diff --git a/doc/salome/gui/SMESH/input/tui_quality_controls.doc b/doc/salome/gui/SMESH/input/tui_quality_controls.doc index e09389d3f..be849962c 100644 --- a/doc/salome/gui/SMESH/input/tui_quality_controls.doc +++ b/doc/salome/gui/SMESH/input/tui_quality_controls.doc @@ -3,91 +3,69 @@ \page tui_quality_controls_page Quality Controls \section tui_free_borders Free Borders -\include quality_controls_ex01.py -Download this script +\tui_script{quality_controls_ex01.py} \section tui_borders_at_multiconnection Borders at Multiconnection -\include quality_controls_ex02.py -Download this script +\tui_script{quality_controls_ex02.py} \section tui_length_1d Length 1D -\include quality_controls_ex03.py -Download this script +\tui_script{quality_controls_ex03.py} \section tui_free_edges Free Edges -\include quality_controls_ex04.py -Download this script +\tui_script{quality_controls_ex04.py} \section tui_free_nodes Free Nodes -\include quality_controls_ex05.py -Download this script +\tui_script{quality_controls_ex05.py} \section tui_free_faces Free Faces -\include quality_controls_ex06.py -Download this script +\tui_script{quality_controls_ex06.py} \section tui_bare_border_faces Bare border faces -\include quality_controls_ex07.py -Download this script +\tui_script{quality_controls_ex07.py} \section tui_bare_border_volumes Bare border volumes -\include quality_controls_ex08.py -Download this script +\tui_script{quality_controls_ex08.py} \section tui_over_constrained_faces Over-constrained faces -\include quality_controls_ex09.py -Download this script +\tui_script{quality_controls_ex09.py} \section tui_over_constrained_volumes Over-constrained volumes -\include quality_controls_ex10.py -Download this script +\tui_script{quality_controls_ex10.py} \section tui_length_2d Length 2D -\include quality_controls_ex11.py -Download this script +\tui_script{quality_controls_ex11.py} \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D -\include quality_controls_ex12.py -Download this script +\tui_script{quality_controls_ex12.py} \section tui_area Area -\include quality_controls_ex13.py -Download this script +\tui_script{quality_controls_ex13.py} \section tui_taper Taper -\include quality_controls_ex14.py -Download this script +\tui_script{quality_controls_ex14.py} \section tui_aspect_ratio Aspect Ratio -\include quality_controls_ex15.py -Download this script +\tui_script{quality_controls_ex15.py} \section tui_minimum_angle Minimum Angle -\include quality_controls_ex16.py -Download this script +\tui_script{quality_controls_ex16.py} \section tui_warping Warping -\include quality_controls_ex17.py -Download this script +\tui_script{quality_controls_ex17.py} \section tui_skew Skew -\include quality_controls_ex18.py -Download this script +\tui_script{quality_controls_ex18.py} \section tui_max_element_length_2d Element Diameter 2D -\include quality_controls_ex19.py -Download this script +\tui_script{quality_controls_ex19.py} \section tui_aspect_ratio_3d Aspect Ratio 3D -\include quality_controls_ex20.py -Download this script +\tui_script{quality_controls_ex20.py} \section tui_volume Volume -\include quality_controls_ex21.py -Download this script +\tui_script{quality_controls_ex21.py} \section tui_max_element_length_3d Element Diameter 3D -\include quality_controls_ex22.py -Download this script +\tui_script{quality_controls_ex22.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc index 3b77fab34..303b7cec4 100644 --- a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc @@ -7,81 +7,68 @@
\anchor tui_translation

Translation

-\include transforming_meshes_ex01.py -Download this script +\tui_script{transforming_meshes_ex01.py}
\anchor tui_rotation

Rotation

-\include transforming_meshes_ex02.py -Download this script +\tui_script{transforming_meshes_ex02.py}
\anchor tui_scale

Scale

-\include transforming_meshes_ex03.py -Download this script +\tui_script{transforming_meshes_ex03.py}
\anchor tui_symmetry

Symmetry

-\include transforming_meshes_ex04.py -Download this script +\tui_script{transforming_meshes_ex04.py}
\anchor tui_merging_nodes

Merging Nodes

-\include transforming_meshes_ex05.py -Download this script +\tui_script{transforming_meshes_ex05.py}
\anchor tui_merging_elements

Merging Elements

-\include transforming_meshes_ex06.py -Download this script +\tui_script{transforming_meshes_ex06.py}

Sewing Meshes


\anchor tui_sew_meshes_border_to_side

Sew Meshes Border to Side

-\include transforming_meshes_ex07.py -Download this script +\tui_script{transforming_meshes_ex07.py}
\anchor tui_sew_conform_free_borders

Sew Conform Free Borders

-\include transforming_meshes_ex08.py -Download this script +\tui_script{transforming_meshes_ex08.py}
\anchor tui_sew_free_borders

Sew Free Borders

-\include transforming_meshes_ex09.py -Download this script +\tui_script{transforming_meshes_ex09.py}
\anchor tui_sew_side_elements

Sew Side Elements

-\include transforming_meshes_ex10.py -Download this script +\tui_script{transforming_meshes_ex10.py}
\anchor tui_duplicate_nodes

Duplicate nodes

-\include transforming_meshes_ex11.py -Download this script +\tui_script{transforming_meshes_ex11.py}
\anchor tui_make_2dmesh_from_3d

Create boundary elements

-\include transforming_meshes_ex12.py -Download this script +\tui_script{transforming_meshes_ex12.py}
\anchor tui_reorient_faces

Reorient faces by vector

-\include transforming_meshes_ex13.py -Download this script +\tui_script{transforming_meshes_ex13.py} */ diff --git a/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc b/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc index 46dfe1e05..ddc56cb83 100644 --- a/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc +++ b/doc/salome/gui/SMESH/input/tui_use_existing_faces.doc @@ -6,8 +6,7 @@ This sample demonstrates how to use Use existing faces algorithm, which is actulally just a stub allowing to use your own 2D algoritm implemented in Python. -\include use_existing_faces.py -Download this script +\tui_script{use_existing_faces.py} Resulting mesh: \image html use_existing_face_sample_mesh.png diff --git a/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc b/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc index 06586ffea..2f3c4b404 100644 --- a/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc @@ -5,13 +5,11 @@
\anchor tui_viewing_mesh_infos

Viewing Mesh Infos

-\include viewing_meshes_ex01.py -Download this script +\tui_script{viewing_meshes_ex01.py}
\anchor tui_find_element_by_point

Find Element by Point

-\include viewing_meshes_ex02.py -Download this script +\tui_script{viewing_meshes_ex02.py} */ diff --git a/src/DriverGMF/DriverGMF_Read.cxx b/src/DriverGMF/DriverGMF_Read.cxx index 9cf599fee..e3fc5d76b 100644 --- a/src/DriverGMF/DriverGMF_Read.cxx +++ b/src/DriverGMF/DriverGMF_Read.cxx @@ -107,113 +107,214 @@ Driver_Mesh::Status DriverGMF_Read::Perform() // Read elements - int iN[28]; + int iN[28]; // 28 - nb nodes in HEX27 (+ 1 for safety :) + + /* Read extra vertices for quadratic edges */ + std::vector quadNodesAtEdges; + int nbQuadEdges = 0; + if ( (nbQuadEdges = GmfStatKwd(meshID, GmfExtraVerticesAtEdges)) ) + { + quadNodesAtEdges.reserve( nbQuadEdges ); + GmfGotoKwd(meshID, GmfExtraVerticesAtEdges); + for ( int i = 1; i <= nbQuadEdges; ++i ) + { + GmfGetLin(meshID, GmfExtraVerticesAtEdges, &iN[0], &iN[1], &iN[2]); + quadNodesAtEdges.push_back(iN[2]); + } + } /* Read edges */ const int edgeIDShift = myMesh->GetMeshInfo().NbElements(); if ( int nbEdges = GmfStatKwd(meshID, GmfEdges)) { + const bool readQuadNodes = ( nbQuadEdges == nbEdges ); GmfGotoKwd(meshID, GmfEdges); for ( int i = 1; i <= nbEdges; ++i ) { GmfGetLin(meshID, GmfEdges, &iN[0], &iN[1], &ref); - if ( !myMesh->AddEdgeWithID( iN[0], iN[1], edgeIDShift + i )) - status = storeBadNodeIds( "GmfEdges",i, 2, iN[0], iN[1] ); + if ( readQuadNodes ) + { + const int midN = quadNodesAtEdges[i-1]; + if ( !myMesh->AddEdgeWithID( iN[0], iN[1], midN, edgeIDShift + i )) + status = storeBadNodeIds( "GmfEdges + GmfExtraVerticesAtEdges",i, 3, iN[0],iN[1],midN); + } + else + { + if ( !myMesh->AddEdgeWithID( iN[0], iN[1], edgeIDShift + i )) + status = storeBadNodeIds( "GmfEdges",i, 2, iN[0], iN[1] ); + } } } - /* Read quadratic edges */ - const int edge2IDShift = myMesh->GetMeshInfo().NbElements(); - if ( int nbEdges = GmfStatKwd(meshID, GmfEdgesP2)) + // the vector of extra vertices at edges won't be used anymore so it is cleared + quadNodesAtEdges.clear(); + + /* Read extra vertices for quadratic triangles */ + std::vector< std::vector > quadNodesAtTriangles; + int nbQuadTria = 0; + if ( (nbQuadTria = GmfStatKwd(meshID, GmfExtraVerticesAtTriangles)) ) { - GmfGotoKwd(meshID, GmfEdgesP2); - for ( int i = 1; i <= nbEdges; ++i ) + GmfGotoKwd(meshID, GmfExtraVerticesAtTriangles); + quadNodesAtTriangles.reserve( nbQuadTria ); + std::vector nodes(4); + for ( int i = 1; i <= nbQuadTria; ++i ) { - GmfGetLin(meshID, GmfEdgesP2, &iN[0], &iN[1], &iN[2], &ref); - if ( !myMesh->AddEdgeWithID( iN[0], iN[1], iN[2], edge2IDShift + i )) - status = storeBadNodeIds( "GmfEdgesP2",i, 3, iN[0], iN[1], iN[2] ); + GmfGetLin(meshID, GmfExtraVerticesAtTriangles, + &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], + &iN[5]); // iN[5] - preview TRIA7 + nodes.clear(); + nodes.push_back(iN[2]); + nodes.push_back(iN[3]); + nodes.push_back(iN[4]); + nodes.push_back(iN[5]); + nodes.resize( iN[1] ); + + quadNodesAtTriangles.push_back(nodes); } } + /* Read triangles */ const int triaIDShift = myMesh->GetMeshInfo().NbElements(); if ( int nbTria = GmfStatKwd(meshID, GmfTriangles)) { + const bool readQuadNodes = (nbQuadTria == nbTria); GmfGotoKwd(meshID, GmfTriangles); for ( int i = 1; i <= nbTria; ++i ) { GmfGetLin(meshID, GmfTriangles, &iN[0], &iN[1], &iN[2], &ref); - if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], triaIDShift + i )) - status = storeBadNodeIds( "GmfTriangles",i, 3, iN[0], iN[1], iN[2] ); + if ( readQuadNodes ) + { + const std::vector& midN = quadNodesAtTriangles[ i-1 ]; + if ( !myMesh->AddFaceWithID( iN[0],iN[1],iN[2], midN[0],midN[1],midN[2], triaIDShift + i )) + status = storeBadNodeIds( "GmfTriangles + GmfExtraVerticesAtTriangles",i, 6, + iN[0],iN[1],iN[2], midN[0],midN[1],midN[2] ); + } + else + { + if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], triaIDShift + i )) + status = storeBadNodeIds( "GmfTriangles",i, 3, iN[0], iN[1], iN[2] ); + } } } - /* Read quadratic triangles */ - const int tria2IDShift = myMesh->GetMeshInfo().NbElements(); - if ( int nbTria = GmfStatKwd(meshID, GmfTrianglesP2)) + // the vector of extra vertices at triangles won't be used anymore so it is cleared + quadNodesAtTriangles.clear(); + + /* Read extra vertices for quadratic quadrangles */ + std::vector< std::vector > quadNodesAtQuadrilaterals; + int nbQuadQuad = 0; + if ( (nbQuadQuad = GmfStatKwd(meshID, GmfExtraVerticesAtQuadrilaterals)) ) { - GmfGotoKwd(meshID, GmfTrianglesP2); - for ( int i = 1; i <= nbTria; ++i ) + GmfGotoKwd(meshID, GmfExtraVerticesAtQuadrilaterals); + quadNodesAtQuadrilaterals.reserve( nbQuadQuad ); + std::vector nodes( 5 ); + for ( int i = 1; i <= nbQuadQuad; ++i ) { - GmfGetLin(meshID, GmfTrianglesP2, - &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &ref); - if ( !myMesh->AddFaceWithID( iN[0],iN[1],iN[2],iN[3],iN[4],iN[5], - tria2IDShift + i )) - status = storeBadNodeIds( "GmfTrianglesP2",i, 6, iN[0],iN[1],iN[2],iN[3],iN[4],iN[5] ); + GmfGetLin(meshID, GmfExtraVerticesAtQuadrilaterals, + &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &iN[6]); + nodes.clear(); + nodes.push_back(iN[2]); + nodes.push_back(iN[3]); + nodes.push_back(iN[4]); + nodes.push_back(iN[5]); + nodes.push_back(iN[6]); + nodes.resize( iN[1] ); + + quadNodesAtQuadrilaterals.push_back(nodes); } } - /* Read quadrangles */ + + /* Read quadrangles */ const int quadIDShift = myMesh->GetMeshInfo().NbElements(); if ( int nbQuad = GmfStatKwd(meshID, GmfQuadrilaterals)) { + const bool readQuadNodes = (nbQuadQuad == nbQuad); GmfGotoKwd(meshID, GmfQuadrilaterals); for ( int i = 1; i <= nbQuad; ++i ) { GmfGetLin(meshID, GmfQuadrilaterals, &iN[0], &iN[1], &iN[2], &iN[3], &ref); - if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], iN[3], quadIDShift + i )) - status = storeBadNodeIds( "GmfQuadrilaterals",i, 4, iN[0], iN[1],iN[2], iN[3] ); + if ( readQuadNodes ) + { + const std::vector& midN = quadNodesAtQuadrilaterals[ i-1 ]; + if ( midN.size() == 4 ) + { + if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], iN[3], + midN[0], midN[1], midN[2], midN[3], + quadIDShift + i )) + status = storeBadNodeIds( "GmfQuadrilaterals + GmfExtraVerticesAtQuadrilaterals",i, 8, + iN[0], iN[1],iN[2], iN[3], + midN[0], midN[1], midN[2], midN[3]); + } + else + { + if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], iN[3], + midN[0], midN[1], midN[2], midN[3], midN[4], + quadIDShift + i )) + status = storeBadNodeIds( "GmfQuadrilaterals + GmfExtraVerticesAtQuadrilaterals",i, 9, + iN[0], iN[1],iN[2], iN[3], + midN[0], midN[1], midN[2], midN[3], midN[4]); + } + } + else + { + if ( !myMesh->AddFaceWithID( iN[0], iN[1], iN[2], iN[3], quadIDShift + i )) + status = storeBadNodeIds( "GmfQuadrilaterals",i, 4, iN[0], iN[1],iN[2], iN[3] ); + } } } - /* Read bi-quadratic quadrangles */ - const int quad2IDShift = myMesh->GetMeshInfo().NbElements(); - if ( int nbQuad = GmfStatKwd(meshID, GmfQuadrilateralsQ2)) + // the vector of extra vertices at quadrilaterals won't be used anymore so it is cleared + quadNodesAtQuadrilaterals.clear(); + + /* Read extra vertices for quadratic tetrahedra */ + std::vector< std::vector > quadNodesAtTetrahedra; + int nbQuadTetra = 0; + if ( (nbQuadTetra = GmfStatKwd(meshID, GmfExtraVerticesAtTetrahedra)) ) { - GmfGotoKwd(meshID, GmfQuadrilateralsQ2); - for ( int i = 1; i <= nbQuad; ++i ) + GmfGotoKwd(meshID, GmfExtraVerticesAtTetrahedra); + quadNodesAtTetrahedra.reserve( nbQuadTetra ); + std::vector nodes( 6 ); + for ( int i = 1; i <= nbQuadTetra; ++i ) { - GmfGetLin(meshID, GmfQuadrilateralsQ2, - &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &iN[6], &iN[7], &iN[8], &ref); - if ( !myMesh->AddFaceWithID( iN[0],iN[1],iN[2],iN[3],iN[4],iN[5],iN[6],iN[7],iN[8], - quad2IDShift + i )) - status = storeBadNodeIds( "GmfQuadrilateralsQ2",i, - 9, iN[0],iN[1],iN[2],iN[3],iN[4],iN[5],iN[6],iN[7],iN[8] ); + GmfGetLin(meshID, GmfExtraVerticesAtTetrahedra, + &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &iN[6], &iN[7]); + nodes.clear(); + nodes.push_back(iN[2]); + nodes.push_back(iN[3]); + nodes.push_back(iN[4]); + nodes.push_back(iN[5]); + nodes.push_back(iN[6]); + nodes.push_back(iN[7]); + nodes.resize( iN[1] ); + + quadNodesAtTetrahedra.push_back(nodes); } } + /* Read terahedra */ const int tetIDShift = myMesh->GetMeshInfo().NbElements(); if ( int nbTet = GmfStatKwd(meshID, GmfTetrahedra)) { + const bool readQuadNodes = (nbQuadTetra == nbTet); GmfGotoKwd(meshID, GmfTetrahedra); for ( int i = 1; i <= nbTet; ++i ) { GmfGetLin(meshID, GmfTetrahedra, &iN[0], &iN[1], &iN[2], &iN[3], &ref); - if ( !myMesh->AddVolumeWithID( iN[0], iN[2], iN[1], iN[3], tetIDShift + i )) - status = storeBadNodeIds( "GmfTetrahedra",i, 4, iN[0], iN[1],iN[2], iN[3] ); - } - } - /* Read quadratic terahedra */ - const int tet2IDShift = myMesh->GetMeshInfo().NbElements(); - if ( int nbTet = GmfStatKwd(meshID, GmfTetrahedraP2)) - { - GmfGotoKwd(meshID, GmfTetrahedraP2); - for ( int i = 1; i <= nbTet; ++i ) - { - GmfGetLin(meshID, GmfTetrahedraP2, &iN[0], &iN[1], &iN[2], - &iN[3], &iN[4], &iN[5], &iN[6], &iN[7], &iN[8], &iN[9], &ref); - if ( !myMesh->AddVolumeWithID( iN[0],iN[2],iN[1],iN[3], - iN[6],iN[5],iN[4], - iN[7],iN[9],iN[8], tet2IDShift + i )) - status = storeBadNodeIds( "GmfTetrahedraP2",i, 10, iN[0],iN[1],iN[2],iN[3], - iN[4],iN[5],iN[6],iN[7],iN[8],iN[9] ); + if ( readQuadNodes ) + { + const std::vector& midN = quadNodesAtTetrahedra[ i-1 ]; + if ( !myMesh->AddVolumeWithID( iN[0], iN[2], iN[1], iN[3], + midN[2], midN[1], midN[0], midN[3], midN[5], midN[4], tetIDShift + i )) + status = storeBadNodeIds( "GmfTetrahedra + GmfExtraVerticesAtTetrahedra",i, 10, iN[0], iN[2], iN[1], iN[3], + midN[2], midN[1], midN[0], midN[3], midN[5], midN[4] ); + } + else + { + if ( !myMesh->AddVolumeWithID( iN[0], iN[2], iN[1], iN[3], tetIDShift + i ) ) + status = storeBadNodeIds( "GmfTetrahedra" ,i, 4, iN[0], iN[2], iN[1], iN[3] ); + } } } + // the vector of extra vertices at tetrahedra won't be used anymore so it is cleared + quadNodesAtTetrahedra.clear(); + /* Read pyramids */ const int pyrIDShift = myMesh->GetMeshInfo().NbElements(); if ( int nbPyr = GmfStatKwd(meshID, GmfPyramids)) @@ -226,42 +327,115 @@ Driver_Mesh::Status DriverGMF_Read::Perform() status = storeBadNodeIds( "GmfPyramids",i, 5, iN[0], iN[1],iN[2], iN[3], iN[4] ); } } - /* Read hexahedra */ - const int hexIDShift = myMesh->GetMeshInfo().NbElements(); - if ( int nbHex = GmfStatKwd(meshID, GmfHexahedra)) + + /* Read extra vertices for quadratic hexahedra */ + std::vector< std::vector > quadNodesAtHexahedra; + int nbQuadHexa = 0; + if ( (nbQuadHexa = GmfStatKwd(meshID, GmfExtraVerticesAtHexahedra)) ) { - GmfGotoKwd(meshID, GmfHexahedra); - for ( int i = 1; i <= nbHex; ++i ) + GmfGotoKwd(meshID, GmfExtraVerticesAtHexahedra); + quadNodesAtHexahedra.reserve( nbQuadHexa ); + std::vector nodes( 19 ); + for ( int i = 1; i <= nbQuadHexa; ++i ) { - GmfGetLin(meshID, GmfHexahedra, - &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], &iN[6], &iN[7], &ref); - if ( !myMesh->AddVolumeWithID( iN[0], iN[3], iN[2], iN[1], iN[4], iN[7], iN[6], iN[5], - hexIDShift + i)) - status = storeBadNodeIds( "GmfHexahedra",i, - 8, iN[0], iN[1],iN[2], iN[3], iN[4], iN[7], iN[6], iN[5] ); + GmfGetLin(meshID, GmfExtraVerticesAtHexahedra, &iN[0], &iN[1], // Hexa Id, Nb of extra vertices + &iN[2], &iN[3], &iN[4], &iN[5], + &iN[6], &iN[7], &iN[8], &iN[9], + &iN[10], &iN[11], &iN[12], &iN[13], // HEXA20 + &iN[14], + &iN[15], &iN[16], &iN[17], &iN[18], + &iN[19], + &iN[20]); // HEXA27 + nodes.clear(); + nodes.push_back(iN[2]); + nodes.push_back(iN[3]); + nodes.push_back(iN[4]); + nodes.push_back(iN[5]); + nodes.push_back(iN[6]); + nodes.push_back(iN[7]); + nodes.push_back(iN[8]); + nodes.push_back(iN[9]); + nodes.push_back(iN[10]); + nodes.push_back(iN[11]); + nodes.push_back(iN[12]); + nodes.push_back(iN[13]); + nodes.push_back(iN[14]); + nodes.push_back(iN[15]); + nodes.push_back(iN[16]); + nodes.push_back(iN[17]); + nodes.push_back(iN[18]); + nodes.push_back(iN[19]); + nodes.push_back(iN[20]); + nodes.resize( iN[1] ); + + quadNodesAtHexahedra.push_back(nodes); } } - /* Read tri-quadratic hexahedra */ - const int hex2IDShift = myMesh->GetMeshInfo().NbElements(); - if ( int nbHex = GmfStatKwd(meshID, GmfHexahedraQ2)) + + /* Read hexahedra */ + const int hexIDShift = myMesh->GetMeshInfo().NbElements(); + if ( int nbHex = GmfStatKwd(meshID, GmfHexahedra)) { - GmfGotoKwd(meshID, GmfHexahedraQ2); + const bool readQuadNodes = (nbQuadHexa == nbHex); + GmfGotoKwd(meshID, GmfHexahedra); for ( int i = 1; i <= nbHex; ++i ) { - GmfGetLin(meshID, GmfHexahedraQ2, &iN[0], &iN[1], &iN[2], &iN[3], &iN[4], &iN[5], - &iN[6], &iN[7], &iN[8],&iN[9],&iN[10],&iN[11],&iN[12],&iN[13],&iN[14], - &iN[15],&iN[16],&iN[17],&iN[18],&iN[19],&iN[20],&iN[21],&iN[22],&iN[23], - &iN[24],&iN[25],&iN[26], &ref); - if ( !myMesh->AddVolumeWithID( iN[0],iN[3],iN[2],iN[1],iN[4],iN[7],iN[6],iN[5],iN[11],iN[10], - iN[9],iN[8],iN[12],iN[15],iN[14], iN[13],iN[19],iN[18],iN[17], - iN[16],iN[20],iN[24],iN[23],iN[22],iN[21], iN[25],iN[26], - hex2IDShift + i )) - status = storeBadNodeIds( "GmfHexahedraQ2",i, 27, - iN[0],iN[3],iN[2],iN[1],iN[4], iN[7],iN[6],iN[5],iN[11],iN[10], - iN[9],iN[8],iN[12],iN[15],iN[14], iN[13],iN[19],iN[18],iN[17], - iN[16],iN[20],iN[24],iN[23],iN[22],iN[21], iN[25],iN[26]); + GmfGetLin(meshID, GmfHexahedra, &iN[0], &iN[1], &iN[2], &iN[3], + &iN[4], &iN[5], &iN[6], &iN[7],&ref); + if ( readQuadNodes ) + { + const std::vector& midN = quadNodesAtHexahedra[ i-1 ]; + if ( midN.size() == 12 ) // HEXA20 + { + if ( !myMesh->AddVolumeWithID( iN[0], iN[3], iN[2], iN[1], + iN[4], iN[7], iN[6], iN[5], + midN[3], midN[2], midN[1], midN[0], + midN[7], midN[6], midN[5], midN[4], + midN[8], midN[11], midN[10], midN[9], + tetIDShift + i )) + status = storeBadNodeIds( "GmfHexahedra + GmfExtraVerticesAtHexahedra",i, 20, + iN[0], iN[3], iN[2], iN[1], + iN[4], iN[7], iN[6], iN[5], + midN[3], midN[2], midN[1], midN[0], + midN[7], midN[6], midN[5], midN[4], + midN[8], midN[11], midN[10], midN[9]); + } + else // HEXA27 + { + if ( !myMesh->AddVolumeWithID( iN[0], iN[3], iN[2], iN[1], + iN[4], iN[7], iN[6], iN[5], + midN[3], midN[2], midN[1], midN[0], + midN[7], midN[6], midN[5], midN[4], + midN[8], midN[11], midN[10], midN[9], + midN[12], + midN[16], midN[15], midN[14], midN[13], + midN[17], + midN[18], + tetIDShift + i )) + status = storeBadNodeIds( "GmfHexahedra + GmfExtraVerticesAtHexahedra",i, 27, + iN[0], iN[3], iN[2], iN[1], + iN[4], iN[7], iN[6], iN[5], + midN[3], midN[2], midN[1], midN[0], + midN[7], midN[6], midN[5], midN[4], + midN[8], midN[11], midN[10], midN[9], + midN[12], + midN[16], midN[15], midN[14], midN[13], + midN[17], + midN[18]); + } + } + else + { + if ( !myMesh->AddVolumeWithID( iN[0], iN[3], iN[2], iN[1], + iN[4], iN[7], iN[6], iN[5], hexIDShift + i ) ) + status = storeBadNodeIds( "GmfHexahedra" ,i, 8, iN[0], iN[3], iN[2], iN[1], + iN[4], iN[7], iN[6], iN[5] ); + } } } + // the vector of extra vertices at tetrahedra won't be used anymore so it is cleared + quadNodesAtHexahedra.clear(); + /* Read prism */ const int prismIDShift = myMesh->GetMeshInfo().NbElements(); if ( int nbPrism = GmfStatKwd(meshID, GmfPrisms)) diff --git a/src/DriverGMF/DriverGMF_Write.cxx b/src/DriverGMF/DriverGMF_Write.cxx index 926f7f4c3..432551e79 100644 --- a/src/DriverGMF/DriverGMF_Write.cxx +++ b/src/DriverGMF/DriverGMF_Write.cxx @@ -49,6 +49,16 @@ extern "C" const SMDS_MeshElement* elem = elemIt->next(); \ GmfSetLin(meshID, GmfKwd, +#define BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity, GmfKwd, elem, nbVertices ) \ + elemIt = myMesh->elementEntityIterator( SMDSEntity ); \ + if ( elemIt->more() ) \ + { \ + GmfSetKwd(meshID, GmfKwd, myMesh->GetMeshInfo().NbEntities( SMDSEntity )); \ + for ( int gmfID = 1; elemIt->more(); ++gmfID ) \ + { \ + const SMDS_MeshElement* elem = elemIt->next(); \ + GmfSetLin(meshID, GmfKwd, gmfID, nbVertices, + #define END_ELEM_WRITE( elem ) \ elem->getshapeId() ); \ }} \ @@ -58,6 +68,10 @@ extern "C" e2id.insert( e2id.end(), make_pair( elem, gmfID )); \ }} \ +#define END_EXTRA_VERTICES_WRITE() \ + ); \ + }} \ + DriverGMF_Write::DriverGMF_Write(): Driver_SMESHDS_Mesh(), _exportRequiredGroups( true ) @@ -67,6 +81,12 @@ DriverGMF_Write::~DriverGMF_Write() { } +//================================================================================ +/*! + * \brief Reads a GMF file + */ +//================================================================================ + Driver_Mesh::Status DriverGMF_Write::Perform() { Kernel_Utils::Localizer loc; @@ -110,14 +130,17 @@ Driver_Mesh::Status DriverGMF_Write::Perform() node2IdMap[ edge->GetNode( 0 )], node2IdMap[ edge->GetNode( 1 )], END_ELEM_WRITE_ADD_TO_MAP( edge, edge2IDMap ); - + // quadratic edges - BEGIN_ELEM_WRITE( SMDSEntity_Quad_Edge, GmfEdgesP2, edge ) + BEGIN_ELEM_WRITE( SMDSEntity_Quad_Edge, GmfEdges, edge ) node2IdMap[ edge->GetNode( 0 )], node2IdMap[ edge->GetNode( 1 )], - node2IdMap[ edge->GetNode( 2 )], END_ELEM_WRITE( edge ); - + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_Quad_Edge, GmfExtraVerticesAtEdges, edge, 1 ) + node2IdMap[ edge->GetNode( 2 )] + END_EXTRA_VERTICES_WRITE(); + // triangles TElem2IDMap tria2IDMap; BEGIN_ELEM_WRITE( SMDSEntity_Triangle, GmfTriangles, tria ) @@ -125,17 +148,20 @@ Driver_Mesh::Status DriverGMF_Write::Perform() node2IdMap[ tria->GetNode( 1 )], node2IdMap[ tria->GetNode( 2 )], END_ELEM_WRITE_ADD_TO_MAP( tria, tria2IDMap ); - + // quadratic triangles - BEGIN_ELEM_WRITE( SMDSEntity_Quad_Triangle, GmfTrianglesP2, tria ) + BEGIN_ELEM_WRITE( SMDSEntity_Quad_Triangle, GmfTriangles, tria ) node2IdMap[ tria->GetNode( 0 )], node2IdMap[ tria->GetNode( 1 )], node2IdMap[ tria->GetNode( 2 )], + END_ELEM_WRITE( tria ); + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_Quad_Triangle, GmfExtraVerticesAtTriangles, tria, 3 ) node2IdMap[ tria->GetNode( 3 )], node2IdMap[ tria->GetNode( 4 )], - node2IdMap[ tria->GetNode( 5 )], - END_ELEM_WRITE( tria ); - + node2IdMap[ tria->GetNode( 5 )] + END_EXTRA_VERTICES_WRITE(); + // quadrangles TElem2IDMap quad2IDMap; BEGIN_ELEM_WRITE( SMDSEntity_Quadrangle, GmfQuadrilaterals, quad ) @@ -145,19 +171,37 @@ Driver_Mesh::Status DriverGMF_Write::Perform() node2IdMap[ quad->GetNode( 3 )], END_ELEM_WRITE_ADD_TO_MAP( quad, quad2IDMap ); - // bi-quadratic quadrangles - BEGIN_ELEM_WRITE( SMDSEntity_BiQuad_Quadrangle, GmfQuadrilateralsQ2, quad ) + // quadratic quadrangles + BEGIN_ELEM_WRITE( SMDSEntity_Quad_Quadrangle, GmfQuadrilaterals, quad ) node2IdMap[ quad->GetNode( 0 )], - node2IdMap[ quad->GetNode( 3 )], - node2IdMap[ quad->GetNode( 2 )], node2IdMap[ quad->GetNode( 1 )], - node2IdMap[ quad->GetNode( 7 )], - node2IdMap[ quad->GetNode( 6 )], - node2IdMap[ quad->GetNode( 5 )], + node2IdMap[ quad->GetNode( 2 )], + node2IdMap[ quad->GetNode( 3 )], + END_ELEM_WRITE( quad ); + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_Quad_Quadrangle, GmfExtraVerticesAtQuadrilaterals, quad, 4 ) node2IdMap[ quad->GetNode( 4 )], - node2IdMap[ quad->GetNode( 8 )], + node2IdMap[ quad->GetNode( 5 )], + node2IdMap[ quad->GetNode( 6 )], + node2IdMap[ quad->GetNode( 7 )] + END_EXTRA_VERTICES_WRITE(); + + // bi-quadratic quadrangles + BEGIN_ELEM_WRITE( SMDSEntity_BiQuad_Quadrangle, GmfQuadrilaterals, quad ) + node2IdMap[ quad->GetNode( 0 )], + node2IdMap[ quad->GetNode( 1 )], + node2IdMap[ quad->GetNode( 2 )], + node2IdMap[ quad->GetNode( 3 )], END_ELEM_WRITE( quad ); - + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_BiQuad_Quadrangle, GmfExtraVerticesAtQuadrilaterals, quad, 5 ) + node2IdMap[ quad->GetNode( 4 )], + node2IdMap[ quad->GetNode( 5 )], + node2IdMap[ quad->GetNode( 6 )], + node2IdMap[ quad->GetNode( 7 )], + node2IdMap[ quad->GetNode( 8 )] + END_EXTRA_VERTICES_WRITE(); + // terahedra BEGIN_ELEM_WRITE( SMDSEntity_Tetra, GmfTetrahedra, tetra ) node2IdMap[ tetra->GetNode( 0 )], @@ -165,20 +209,23 @@ Driver_Mesh::Status DriverGMF_Write::Perform() node2IdMap[ tetra->GetNode( 1 )], node2IdMap[ tetra->GetNode( 3 )], END_ELEM_WRITE( tetra ); - + // quadratic terahedra - BEGIN_ELEM_WRITE( SMDSEntity_Quad_Tetra, GmfTetrahedraP2, tetra ) + BEGIN_ELEM_WRITE( SMDSEntity_Quad_Tetra, GmfTetrahedra, tetra ) node2IdMap[ tetra->GetNode( 0 )], node2IdMap[ tetra->GetNode( 2 )], node2IdMap[ tetra->GetNode( 1 )], node2IdMap[ tetra->GetNode( 3 )], + END_ELEM_WRITE( tetra ); + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_Quad_Tetra, GmfExtraVerticesAtTetrahedra, tetra, 6 ) node2IdMap[ tetra->GetNode( 6 )], node2IdMap[ tetra->GetNode( 5 )], node2IdMap[ tetra->GetNode( 4 )], node2IdMap[ tetra->GetNode( 7 )], node2IdMap[ tetra->GetNode( 9 )], - node2IdMap[ tetra->GetNode( 8 )], - END_ELEM_WRITE( tetra ); + node2IdMap[ tetra->GetNode( 8 )] + END_EXTRA_VERTICES_WRITE(); // pyramids BEGIN_ELEM_WRITE( SMDSEntity_Pyramid, GmfPyramids, pyra ) @@ -201,8 +248,8 @@ Driver_Mesh::Status DriverGMF_Write::Perform() node2IdMap[ hexa->GetNode( 5 )], END_ELEM_WRITE( hexa ); - // tri-quadratic hexahedra - BEGIN_ELEM_WRITE( SMDSEntity_TriQuad_Hexa, GmfHexahedraQ2, hexa ) + // quadratic hexahedra + BEGIN_ELEM_WRITE( SMDSEntity_Quad_Hexa, GmfHexahedra, hexa ) node2IdMap[ hexa->GetNode( 0 )], node2IdMap[ hexa->GetNode( 3 )], node2IdMap[ hexa->GetNode( 2 )], @@ -211,26 +258,56 @@ Driver_Mesh::Status DriverGMF_Write::Perform() node2IdMap[ hexa->GetNode( 7 )], node2IdMap[ hexa->GetNode( 6 )], node2IdMap[ hexa->GetNode( 5 )], + END_ELEM_WRITE( hexa ); + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_Quad_Hexa, GmfExtraVerticesAtHexahedra, hexa, 12 ) node2IdMap[ hexa->GetNode( 11 )], node2IdMap[ hexa->GetNode( 10 )], node2IdMap[ hexa->GetNode( 9 )], node2IdMap[ hexa->GetNode( 8 )], + node2IdMap[ hexa->GetNode( 15 )], + node2IdMap[ hexa->GetNode( 14 )], + node2IdMap[ hexa->GetNode( 13 )], node2IdMap[ hexa->GetNode( 12 )], + node2IdMap[ hexa->GetNode( 16 )], + node2IdMap[ hexa->GetNode( 19 )], + node2IdMap[ hexa->GetNode( 18 )], + node2IdMap[ hexa->GetNode( 17 )] + END_EXTRA_VERTICES_WRITE(); + + // tri-quadratic hexahedra + BEGIN_ELEM_WRITE( SMDSEntity_TriQuad_Hexa, GmfHexahedra, hexa ) + node2IdMap[ hexa->GetNode( 0 )], + node2IdMap[ hexa->GetNode( 3 )], + node2IdMap[ hexa->GetNode( 2 )], + node2IdMap[ hexa->GetNode( 1 )], + node2IdMap[ hexa->GetNode( 4 )], + node2IdMap[ hexa->GetNode( 7 )], + node2IdMap[ hexa->GetNode( 6 )], + node2IdMap[ hexa->GetNode( 5 )], + END_ELEM_WRITE( hexa ); + + BEGIN_EXTRA_VERTICES_WRITE( SMDSEntity_TriQuad_Hexa, GmfExtraVerticesAtHexahedra, hexa, 19 ) + node2IdMap[ hexa->GetNode( 11 )], + node2IdMap[ hexa->GetNode( 10 )], + node2IdMap[ hexa->GetNode( 9 )], + node2IdMap[ hexa->GetNode( 8 )], node2IdMap[ hexa->GetNode( 15 )], node2IdMap[ hexa->GetNode( 14 )], node2IdMap[ hexa->GetNode( 13 )], + node2IdMap[ hexa->GetNode( 12 )], + node2IdMap[ hexa->GetNode( 16 )], node2IdMap[ hexa->GetNode( 19 )], node2IdMap[ hexa->GetNode( 18 )], node2IdMap[ hexa->GetNode( 17 )], - node2IdMap[ hexa->GetNode( 16 )], node2IdMap[ hexa->GetNode( 20 )], node2IdMap[ hexa->GetNode( 24 )], node2IdMap[ hexa->GetNode( 23 )], node2IdMap[ hexa->GetNode( 22 )], node2IdMap[ hexa->GetNode( 21 )], node2IdMap[ hexa->GetNode( 25 )], - node2IdMap[ hexa->GetNode( 26 )], - END_ELEM_WRITE( hexa ); + node2IdMap[ hexa->GetNode( 26 )] + END_EXTRA_VERTICES_WRITE(); // prism BEGIN_ELEM_WRITE( SMDSEntity_Penta, GmfPrisms, prism ) diff --git a/src/SMDS/SMDS_Downward.cxx b/src/SMDS/SMDS_Downward.cxx index 67ff05ffc..20a7c81d9 100644 --- a/src/SMDS/SMDS_Downward.cxx +++ b/src/SMDS/SMDS_Downward.cxx @@ -1362,6 +1362,7 @@ void SMDS_DownPyramid::getOrderedNodesOfFace(int cellId, std::vector& set tofind; int ids[16] = { 0, 1, 2, 3, 0, 3, 4, 3, 2, 4, 2, 1, 4, 1, 0, 4 }; + // Quadrangular face tofind.clear(); for (int i = 0; i < 4; i++) tofind.insert(nodes[ids[i]]); @@ -1371,6 +1372,7 @@ void SMDS_DownPyramid::getOrderedNodesOfFace(int cellId, std::vector& orderedNodes[i] = nodes[ids[i]]; return; } + // Triangular faces for (int k = 0; k < 4; k++) { tofind.clear(); @@ -1489,6 +1491,7 @@ SMDS_DownQuadPyramid::~SMDS_DownQuadPyramid() void SMDS_DownQuadPyramid::getOrderedNodesOfFace(int cellId, std::vector& orderedNodes) { +// MESSAGE("SMDS_DownQuadPyramid::getOrderedNodesOfFace cellId = " << cellId); set setNodes; setNodes.clear(); for (int i = 0; i < orderedNodes.size(); i++) @@ -1503,8 +1506,9 @@ void SMDS_DownQuadPyramid::getOrderedNodesOfFace(int cellId, std::vector_mesh->fromVtkToSmds(_vtkCellIds[cellId])); - MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]); + MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]); MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]); } @@ -1661,6 +1666,7 @@ void SMDS_DownPenta::getOrderedNodesOfFace(int cellId, std::vector& o //int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 }; int ids[18] = { 0, 1, 2, 3, 5, 4, 0, 3, 4, 1, 1, 4, 5, 2, 2, 5, 3, 0 }; + // Triangular faces for (int k = 0; k < 2; k++) { tofind.clear(); @@ -1673,6 +1679,7 @@ void SMDS_DownPenta::getOrderedNodesOfFace(int cellId, std::vector& o return; } } + // Quadrangular faces for (int k = 0; k < 3; k++) { tofind.clear(); @@ -1810,6 +1817,7 @@ void SMDS_DownQuadPenta::getOrderedNodesOfFace(int cellId, std::vector #include #include +#include #include #include #include @@ -73,6 +74,98 @@ using namespace std; +//================================================================================ +/*! + * \brief Returns \a true if two algorithms (described by \a this and the given + * algo data) are compatible by their output and input types of elements. + */ +//================================================================================ + +bool SMESH_Algo::Features::IsCompatible( const SMESH_Algo::Features& algo2 ) const +{ + if ( _dim > algo2._dim ) return algo2.IsCompatible( *this ); + // algo2 is of highter dimension + if ( _outElemTypes.empty() || algo2._inElemTypes.empty() ) + return false; + bool compatible = true; + set::const_iterator myOutType = _outElemTypes.begin(); + for ( ; myOutType != _outElemTypes.end() && compatible; ++myOutType ) + compatible = algo2._inElemTypes.count( *myOutType ); + return compatible; +} + +//================================================================================ +/*! + * \brief Return Data of the algorithm + */ +//================================================================================ + +const SMESH_Algo::Features& SMESH_Algo::GetFeatures( const std::string& algoType ) +{ + static map< string, SMESH_Algo::Features > theFeaturesByName; + if ( theFeaturesByName.empty() ) + { + // Read Plugin.xml files + vector< string > xmlPaths = SMESH_Gen::GetPluginXMLPaths(); + LDOMParser xmlParser; + for ( size_t iXML = 0; iXML < xmlPaths.size(); ++iXML ) + { + bool error = xmlParser.parse( xmlPaths[iXML].c_str() ); + if ( error ) + { + TCollection_AsciiString data; + INFOS( xmlParser.GetError(data) ); + continue; + } + // + // + LDOM_Document xmlDoc = xmlParser.getDocument(); + LDOM_NodeList algoNodeList = xmlDoc.getElementsByTagName( "algorithm" ); + for ( int i = 0; i < algoNodeList.getLength(); ++i ) + { + LDOM_Node algoNode = algoNodeList.item( i ); + LDOM_Element& algoElem = (LDOM_Element&) algoNode; + TCollection_AsciiString algoType = algoElem.getAttribute("type"); + TCollection_AsciiString input = algoElem.getAttribute("input"); + TCollection_AsciiString output = algoElem.getAttribute("output"); + TCollection_AsciiString dim = algoElem.getAttribute("dim"); + TCollection_AsciiString label = algoElem.getAttribute("label-id"); + if ( algoType.IsEmpty() ) continue; + + Features & data = theFeaturesByName[ algoType.ToCString() ]; + data._dim = dim.IntegerValue(); + data._label = label.ToCString(); + for ( int isInput = 0; isInput < 2; ++isInput ) + { + TCollection_AsciiString& typeStr = isInput ? input : output; + set& typeSet = isInput ? data._inElemTypes : data._outElemTypes; + int beg = 1, end; + while ( beg <= typeStr.Length() ) + { + while ( beg < typeStr.Length() && !isalpha( typeStr.Value( beg ) )) + ++beg; + end = beg; + while ( end < typeStr.Length() && isalpha( typeStr.Value( end + 1 ) )) + ++end; + if ( end > beg ) + { + TCollection_AsciiString typeName = typeStr.SubString( beg, end ); + if ( typeName == "EDGE" ) typeSet.insert( SMDSGeom_EDGE ); + else if ( typeName == "TRIA" ) typeSet.insert( SMDSGeom_TRIANGLE ); + else if ( typeName == "QUAD" ) typeSet.insert( SMDSGeom_QUADRANGLE ); + } + beg = end + 1; + } + } + } + } + } + return theFeaturesByName[ algoType ]; +} + //============================================================================= /*! * @@ -252,120 +345,13 @@ bool SMESH_Algo::FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool norm return ok; } -//================================================================================ -/*! - * \brief Find out elements orientation on a geometrical face - * \param theFace - The face correctly oriented in the shape being meshed - * \param theMeshDS - The mesh data structure - * \retval bool - true if the face normal and the normal of first element - * in the correspoding submesh point in different directions +/* + * Moved to SMESH_MesherHelper */ -//================================================================================ - -bool SMESH_Algo::IsReversedSubMesh (const TopoDS_Face& theFace, - SMESHDS_Mesh* theMeshDS) -{ - if ( theFace.IsNull() || !theMeshDS ) - return false; - - // find out orientation of a meshed face - int faceID = theMeshDS->ShapeToIndex( theFace ); - TopoDS_Shape aMeshedFace = theMeshDS->IndexToShape( faceID ); - bool isReversed = ( theFace.Orientation() != aMeshedFace.Orientation() ); - - const SMESHDS_SubMesh * aSubMeshDSFace = theMeshDS->MeshElements( faceID ); - if ( !aSubMeshDSFace ) - return isReversed; - - // find element with node located on face and get its normal - const SMDS_FacePosition* facePos = 0; - int vertexID = 0; - gp_Pnt nPnt[3]; - gp_Vec Ne; - bool normalOK = false; - SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); - while ( iteratorElem->more() ) // loop on elements on theFace - { - const SMDS_MeshElement* elem = iteratorElem->next(); - if ( elem && elem->NbNodes() > 2 ) { - SMDS_ElemIteratorPtr nodesIt = elem->nodesIterator(); - const SMDS_FacePosition* fPos = 0; - int i = 0, vID = 0; - while ( nodesIt->more() ) { // loop on nodes - const SMDS_MeshNode* node - = static_cast(nodesIt->next()); - if ( i == 3 ) i = 2; - nPnt[ i++ ].SetCoord( node->X(), node->Y(), node->Z() ); - // check position - const SMDS_PositionPtr& pos = node->GetPosition(); - if ( !pos ) continue; - if ( pos->GetTypeOfPosition() == SMDS_TOP_FACE ) { - fPos = dynamic_cast< const SMDS_FacePosition* >( pos ); - } - else if ( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) { - vID = node->getshapeId(); - } - } - if ( fPos || ( !normalOK && vID )) { - // compute normal - gp_Vec v01( nPnt[0], nPnt[1] ), v02( nPnt[0], nPnt[2] ); - if ( v01.SquareMagnitude() > RealSmall() && - v02.SquareMagnitude() > RealSmall() ) - { - Ne = v01 ^ v02; - normalOK = ( Ne.SquareMagnitude() > RealSmall() ); - } - // we need position on theFace or at least on vertex - if ( normalOK ) { - vertexID = vID; - if ((facePos = fPos)) - break; - } - } - } - } - if ( !normalOK ) - return isReversed; - - // node position on face - double u,v; - if ( facePos ) { - u = facePos->GetUParameter(); - v = facePos->GetVParameter(); - } - else if ( vertexID ) { - TopoDS_Shape V = theMeshDS->IndexToShape( vertexID ); - if ( V.IsNull() || V.ShapeType() != TopAbs_VERTEX ) - return isReversed; - gp_Pnt2d uv = BRep_Tool::Parameters( TopoDS::Vertex( V ), theFace ); - u = uv.X(); - v = uv.Y(); - } - else - { - return isReversed; - } - - // face normal at node position - TopLoc_Location loc; - Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc ); - // if ( surf.IsNull() || surf->Continuity() < GeomAbs_C1 ) - // some surfaces not detected as GeomAbs_C1 are nevertheless correct for meshing - if ( surf.IsNull() || surf->Continuity() < GeomAbs_C0 ) - { - if (!surf.IsNull()) - MESSAGE("surf->Continuity() < GeomAbs_C1 " << (surf->Continuity() < GeomAbs_C1)); - return isReversed; - } - gp_Vec d1u, d1v; - surf->D1( u, v, nPnt[0], d1u, d1v ); - gp_Vec Nf = (d1u ^ d1v).Transformed( loc ); - - if ( theFace.Orientation() == TopAbs_REVERSED ) - Nf.Reverse(); - - return Ne * Nf < 0.; -} +// bool SMESH_Algo::IsReversedSubMesh (const TopoDS_Face& theFace, +// SMESHDS_Mesh* theMeshDS) +// { +// } //================================================================================ /*! diff --git a/src/SMESH/SMESH_Algo.hxx b/src/SMESH/SMESH_Algo.hxx index 76f6de979..8a9fad6c9 100644 --- a/src/SMESH/SMESH_Algo.hxx +++ b/src/SMESH/SMESH_Algo.hxx @@ -30,9 +30,10 @@ #include "SMESH_SMESH.hxx" -#include "SMESH_Hypothesis.hxx" -#include "SMESH_ComputeError.hxx" +#include "SMDSAbs_ElementType.hxx" #include "SMESH_Comment.hxx" +#include "SMESH_ComputeError.hxx" +#include "SMESH_Hypothesis.hxx" #include #include @@ -42,6 +43,7 @@ #include #include #include +#include class SMDS_MeshNode; class SMESHDS_Mesh; @@ -60,6 +62,7 @@ class gp_XYZ; typedef std::map< SMESH_subMesh*, std::vector > MapShapeNbElems; typedef std::map< SMESH_subMesh*, std::vector >::iterator MapShapeNbElemsItr; +// ================================================================================== /*! * \brief Root of all algorithms * @@ -69,9 +72,33 @@ typedef std::map< SMESH_subMesh*, std::vector >::iterator MapShapeNbElemsIt * - methods related to dependencies between sub-meshes imposed by the algorith * - static utilities, like EdgeLength() */ -class SMESH_EXPORT SMESH_Algo:public SMESH_Hypothesis +// ================================================================================== + +class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis { -public: + public: + //================================================================================== + /*! + * \brief Structure describing algorithm features + */ + // -------------------------------------------------------------------------------- + struct Features + { + int _dim; + std::set _inElemTypes; // acceptable types of input mesh element + std::set _outElemTypes; // produced types of mesh elements + std::string _label; // GUI type name + + bool IsCompatible( const Features& algo2 ) const; + }; + /*! + * \brief Returns a structure describing algorithm features + */ + static const Features& GetFeatures( const std::string& algoType ); + const Features& GetFeatures() const { return GetFeatures( _name ); } + + public: + //================================================================================== /*! * \brief Creates algorithm * \param hypId - algorithm ID @@ -287,14 +314,10 @@ public: const bool ignoreMediumNodes, std::map< double, const SMDS_MeshNode* > & theNodes); /*! - * \brief Find out elements orientation on a geometrical face - * \param theFace - The face correctly oriented in the shape being meshed - * \param theMeshDS - The mesh data structure - * \retval bool - true if the face normal and the normal of first element - * in the correspoding submesh point in different directions + * Moved to SMESH_MesherHelper */ - static bool IsReversedSubMesh (const TopoDS_Face& theFace, - SMESHDS_Mesh* theMeshDS); + // static bool IsReversedSubMesh (const TopoDS_Face& theFace, + // SMESHDS_Mesh* theMeshDS); /*! * \brief Compute length of an edge * \param E - the edge diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index a9ef17d1e..2e8a96307 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -43,13 +43,12 @@ #include "Utils_ExceptHandlers.hxx" #include -#include #include "memoire.h" #ifdef WNT #include -#endif +#endif using namespace std; @@ -523,6 +522,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, .And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh )); if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) { + if ( ! subAlgo->NeedDiscreteBoundary() ) continue; SMESH_Hypothesis::Hypothesis_Status status; if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status )) // mesh a lower smToCompute starting from vertices @@ -998,100 +998,6 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths() return xmlPaths; } -//======================================================================= -namespace // Access to type of input and output of an algorithm -//======================================================================= -{ - struct AlgoData - { - int _dim; - set _inElemTypes; // acceptable types of input mesh element - set _outElemTypes; // produced types of mesh elements - - bool IsCompatible( const AlgoData& algo2 ) const - { - if ( _dim > algo2._dim ) return algo2.IsCompatible( *this ); - // algo2 is of highter dimension - if ( _outElemTypes.empty() || algo2._inElemTypes.empty() ) - return false; - bool compatible = true; - set::const_iterator myOutType = _outElemTypes.begin(); - for ( ; myOutType != _outElemTypes.end() && compatible; ++myOutType ) - compatible = algo2._inElemTypes.count( *myOutType ); - return compatible; - } - }; - - //================================================================================ - /*! - * \brief Return AlgoData of the algorithm - */ - //================================================================================ - - const AlgoData& getAlgoData( const SMESH_Algo* algo ) - { - static map< string, AlgoData > theDataByName; - if ( theDataByName.empty() ) - { - // Read Plugin.xml files - vector< string > xmlPaths = SMESH_Gen::GetPluginXMLPaths(); - LDOMParser xmlParser; - for ( size_t iXML = 0; iXML < xmlPaths.size(); ++iXML ) - { - bool error = xmlParser.parse( xmlPaths[iXML].c_str() ); - if ( error ) - { - TCollection_AsciiString data; - INFOS( xmlParser.GetError(data) ); - continue; - } - // - // - LDOM_Document xmlDoc = xmlParser.getDocument(); - LDOM_NodeList algoNodeList = xmlDoc.getElementsByTagName( "algorithm" ); - for ( int i = 0; i < algoNodeList.getLength(); ++i ) - { - LDOM_Node algoNode = algoNodeList.item( i ); - LDOM_Element& algoElem = (LDOM_Element&) algoNode; - TCollection_AsciiString algoType = algoElem.getAttribute("type"); - TCollection_AsciiString input = algoElem.getAttribute("input"); - TCollection_AsciiString output = algoElem.getAttribute("output"); - TCollection_AsciiString dim = algoElem.getAttribute("dim"); - if ( algoType.IsEmpty() ) continue; - AlgoData & data = theDataByName[ algoType.ToCString() ]; - data._dim = dim.IntegerValue(); - for ( int isInput = 0; isInput < 2; ++isInput ) - { - TCollection_AsciiString& typeStr = isInput ? input : output; - set& typeSet = isInput ? data._inElemTypes : data._outElemTypes; - int beg = 1, end; - while ( beg <= typeStr.Length() ) - { - while ( beg < typeStr.Length() && !isalpha( typeStr.Value( beg ) )) - ++beg; - end = beg; - while ( end < typeStr.Length() && isalpha( typeStr.Value( end + 1 ) )) - ++end; - if ( end > beg ) - { - TCollection_AsciiString typeName = typeStr.SubString( beg, end ); - if ( typeName == "EDGE" ) typeSet.insert( SMDSGeom_EDGE ); - else if ( typeName == "TRIA" ) typeSet.insert( SMDSGeom_TRIANGLE ); - else if ( typeName == "QUAD" ) typeSet.insert( SMDSGeom_QUADRANGLE ); - } - beg = end + 1; - } - } - } - } - } - return theDataByName[ algo->GetName() ]; - } -} - //============================================================================= /*! * Finds algo to mesh a shape. Optionally returns a shape the found algo is bound to @@ -1105,6 +1011,8 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); filter.And( filter.IsApplicableTo( aShape )); + typedef SMESH_Algo::Features AlgoData; + TopoDS_Shape assignedToShape; SMESH_Algo* algo = (SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, &assignedToShape ); @@ -1144,10 +1052,10 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, // check compatibility of algos if ( algos3D.size() > 1 ) { - const AlgoData& algoData = getAlgoData( algo ); - const AlgoData& algoData2 = getAlgoData( algo2 ); - const AlgoData& algoData3d0 = getAlgoData( algos3D[0] ); - const AlgoData& algoData3d1 = getAlgoData( algos3D[1] ); + const AlgoData& algoData = algo->SMESH_Algo::GetFeatures(); + const AlgoData& algoData2 = algo2->SMESH_Algo::GetFeatures(); + const AlgoData& algoData3d0 = algos3D[0]->SMESH_Algo::GetFeatures(); + const AlgoData& algoData3d1 = algos3D[1]->SMESH_Algo::GetFeatures(); if (( algoData2.IsCompatible( algoData3d0 ) && algoData2.IsCompatible( algoData3d1 )) && diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 668b33232..4f732effc 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -2002,6 +2002,79 @@ bool SMESH_MesherHelper::IsStructured( SMESH_subMesh* faceSM ) return true; } +//================================================================================ +/*! + * \brief Find out elements orientation on a geometrical face + * \param theFace - The face correctly oriented in the shape being meshed + * \retval bool - true if the face normal and the normal of first element + * in the correspoding submesh point in different directions + */ +//================================================================================ + +bool SMESH_MesherHelper::IsReversedSubMesh (const TopoDS_Face& theFace) +{ + if ( theFace.IsNull() ) + return false; + + // find out orientation of a meshed face + int faceID = GetMeshDS()->ShapeToIndex( theFace ); + TopoDS_Shape aMeshedFace = GetMeshDS()->IndexToShape( faceID ); + bool isReversed = ( theFace.Orientation() != aMeshedFace.Orientation() ); + + const SMESHDS_SubMesh * aSubMeshDSFace = GetMeshDS()->MeshElements( faceID ); + if ( !aSubMeshDSFace ) + return isReversed; + + // find an element with a good normal + gp_Vec Ne; + bool normalOK = false; + gp_XY uv; + SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); + while ( !normalOK && iteratorElem->more() ) // loop on elements on theFace + { + const SMDS_MeshElement* elem = iteratorElem->next(); + if ( elem && elem->NbCornerNodes() > 2 ) + { + SMESH_TNodeXYZ nPnt[3]; + SMDS_ElemIteratorPtr nodesIt = elem->nodesIterator(); + for ( int iN = 0; nodesIt->more() && iN < 3; ++iN) // loop on nodes + nPnt[ iN ] = nodesIt->next(); + + // compute normal + gp_Vec v01( nPnt[0], nPnt[1] ), v02( nPnt[0], nPnt[2] ); + if ( v01.SquareMagnitude() > RealSmall() && + v02.SquareMagnitude() > RealSmall() ) + { + Ne = v01 ^ v02; + if (( normalOK = ( Ne.SquareMagnitude() > RealSmall() ))) + uv = GetNodeUV( theFace, nPnt[0]._node, nPnt[2]._node, &normalOK ); + } + } + } + if ( !normalOK ) + return isReversed; + + // face normal at node position + TopLoc_Location loc; + Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc ); + // if ( surf.IsNull() || surf->Continuity() < GeomAbs_C1 ) + // some surfaces not detected as GeomAbs_C1 are nevertheless correct for meshing + if ( surf.IsNull() || surf->Continuity() < GeomAbs_C0 ) + { + if (!surf.IsNull()) + MESSAGE("surf->Continuity() < GeomAbs_C1 " << (surf->Continuity() < GeomAbs_C1)); + return isReversed; + } + gp_Vec d1u, d1v; gp_Pnt p; + surf->D1( uv.X(), uv.Y(), p, d1u, d1v ); + gp_Vec Nf = (d1u ^ d1v).Transformed( loc ); + + if ( theFace.Orientation() == TopAbs_REVERSED ) + Nf.Reverse(); + + return Ne * Nf < 0.; +} + //======================================================================= //function : Count //purpose : Count nb of sub-shapes diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index af5e10673..cf515dfba 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -221,6 +221,11 @@ public: */ bool GetIsQuadratic() const { return myCreateQuadratic; } + /* + * \brief Find out elements orientation on a geometrical face + */ + bool IsReversedSubMesh (const TopoDS_Face& theFace); + /*! * \brief Move medium nodes of faces and volumes to fix distorted elements * \param error - container of fixed distorted elements @@ -373,6 +378,7 @@ public: /*! * \brief Return node UV on face * \param inFaceNode - a node of element being created located inside a face + * \param check - if provided, returns result of UV check that it enforces */ gp_XY GetNodeUV(const TopoDS_Face& F, const SMDS_MeshNode* n, diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 1c03f3fc3..d015be18d 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -88,22 +88,22 @@ SMESH_subMesh::SMESH_subMesh(int Id, SMESHDS_Mesh * meshDS, const TopoDS_Shape & aSubShape) { - _subShape = aSubShape; - _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... - _father = father; - _Id = Id; - _dependenceAnalysed = _alwaysComputed = false; - - if (_subShape.ShapeType() == TopAbs_VERTEX) - { - _algoState = HYP_OK; - _computeState = READY_TO_COMPUTE; - } - else - { - _algoState = NO_ALGO; - _computeState = NOT_READY; - } + _subShape = aSubShape; + _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... + _father = father; + _Id = Id; + _dependenceAnalysed = _alwaysComputed = false; + _algo = 0; + if (_subShape.ShapeType() == TopAbs_VERTEX) + { + _algoState = HYP_OK; + _computeState = READY_TO_COMPUTE; + } + else + { + _algoState = NO_ALGO; + _computeState = NOT_READY; + } } //============================================================================= @@ -194,7 +194,9 @@ SMESH_subMesh *SMESH_subMesh::GetFirstToCompute() SMESH_Algo* SMESH_subMesh::GetAlgo() const { - return _father->GetGen()->GetAlgo(*_father, _subShape); + if ( !_algo ) + ((SMESH_subMesh*)this)->_algo = _father->GetGen()->GetAlgo(*_father, _subShape); + return _algo; } //================================================================================ @@ -268,11 +270,12 @@ bool SMESH_subMesh::IsMeshComputed() const */ //============================================================================= -bool SMESH_subMesh::SubMeshesComputed() const +bool SMESH_subMesh::SubMeshesComputed(bool * isFailedToCompute/*=0*/) const { int myDim = SMESH_Gen::GetShapeDim( _subShape ); int dimToCheck = myDim - 1; bool subMeshesComputed = true; + if ( isFailedToCompute ) *isFailedToCompute = false; // check subMeshes with upper dimension => reverse iteration SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,true); while ( smIt->more() ) @@ -281,66 +284,72 @@ bool SMESH_subMesh::SubMeshesComputed() const if ( sm->_alwaysComputed ) continue; const TopoDS_Shape & ss = sm->GetSubShape(); + // MSV 07.04.2006: restrict checking to myDim-1 only. Ex., there is no sense // in checking of existence of edges if the algo needs only faces. Moreover, // degenerated edges may have no submesh, as after computing NETGEN_2D. - int dim = SMESH_Gen::GetShapeDim( ss ); - if (dim < dimToCheck) - break; // the rest subMeshes are all of less dimension + if ( !_algo || _algo->NeedDiscreteBoundary() ) { + int dim = SMESH_Gen::GetShapeDim( ss ); + if (dim < dimToCheck) + break; // the rest subMeshes are all of less dimension + } SMESHDS_SubMesh * ds = sm->GetSubMeshDS(); bool computeOk = (sm->GetComputeState() == COMPUTE_OK || (ds && ( dimToCheck ? ds->NbElements() : ds->NbNodes() ))); if (!computeOk) { - int type = ss.ShapeType(); - subMeshesComputed = false; - - switch (type) - { - case TopAbs_COMPOUND: - { - MESSAGE("The not computed sub mesh is a COMPOUND"); - break; - } - case TopAbs_COMPSOLID: - { - MESSAGE("The not computed sub mesh is a COMPSOLID"); - break; - } - case TopAbs_SHELL: - { - MESSAGE("The not computed sub mesh is a SHEL"); - break; - } - case TopAbs_WIRE: - { - MESSAGE("The not computed sub mesh is a WIRE"); - break; - } - case TopAbs_SOLID: - { - MESSAGE("The not computed sub mesh is a SOLID"); - break; - } - case TopAbs_FACE: - { - MESSAGE("The not computed sub mesh is a FACE"); - break; - } - case TopAbs_EDGE: - { - MESSAGE("The not computed sub mesh is a EDGE"); - break; - } - default: - { - MESSAGE("The not computed sub mesh is of unknown type"); - break; - } - } - - break; + if ( isFailedToCompute && !(*isFailedToCompute) ) + *isFailedToCompute = ( sm->GetComputeState() == FAILED_TO_COMPUTE ); + + // int type = ss.ShapeType(); + + // switch (type) + // { + // case TopAbs_COMPOUND: + // { + // MESSAGE("The not computed sub mesh is a COMPOUND"); + // break; + // } + // case TopAbs_COMPSOLID: + // { + // MESSAGE("The not computed sub mesh is a COMPSOLID"); + // break; + // } + // case TopAbs_SHELL: + // { + // MESSAGE("The not computed sub mesh is a SHEL"); + // break; + // } + // case TopAbs_WIRE: + // { + // MESSAGE("The not computed sub mesh is a WIRE"); + // break; + // } + // case TopAbs_SOLID: + // { + // MESSAGE("The not computed sub mesh is a SOLID"); + // break; + // } + // case TopAbs_FACE: + // { + // MESSAGE("The not computed sub mesh is a FACE"); + // break; + // } + // case TopAbs_EDGE: + // { + // MESSAGE("The not computed sub mesh is a EDGE"); + // break; + // } + // default: + // { + // MESSAGE("The not computed sub mesh is of unknown type"); + // break; + // } + // } + + if ( !isFailedToCompute ) + break; } } return subMeshesComputed; @@ -601,10 +610,6 @@ bool SMESH_subMesh::IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis, SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::AlgoStateEngine(int event, SMESH_Hypothesis * anHyp) { - // MESSAGE("SMESH_subMesh::AlgoStateEngine"); - //SCRUTE(_algoState); - //SCRUTE(event); - // **** les retour des evenement shape sont significatifs // (add ou remove fait ou non) // le retour des evenement father n'indiquent pas que add ou remove fait @@ -612,8 +617,8 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Hypothesis::Hypothesis_Status aux_ret, ret = SMESH_Hypothesis::HYP_OK; SMESHDS_Mesh* meshDS =_father->GetMeshDS(); - //SMESH_Gen* gen =_father->GetGen(); SMESH_Algo* algo = 0; + _algo = 0; if (_subShape.ShapeType() == TopAbs_VERTEX ) { @@ -642,7 +647,7 @@ SMESH_Hypothesis::Hypothesis_Status int oldAlgoState = _algoState; bool modifiedHyp = (event == MODIF_HYP); // if set to true, force event MODIF_ALGO_STATE - bool needFullClean = false; + bool needFullClean = false, subMeshesSupported = false; bool isApplicableHyp = IsApplicableHypotesis( anHyp ); @@ -665,7 +670,7 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_HypoFilter filter( SMESH_HypoFilter::HasType( algo->GetType() )); filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+1 )); filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+2 )); - if ( SMESH_Algo * curAlgo = (SMESH_Algo*) _father->GetHypothesis( _subShape, filter, true )) + if ( SMESH_Algo * curAlgo = (SMESH_Algo*)_father->GetHypothesis(_subShape, filter, true )) needFullClean = ( !curAlgo->NeedDiscreteBoundary() ); } } @@ -702,6 +707,7 @@ SMESH_Hypothesis::Hypothesis_Status // we must perform it now because later // we will have no information about the type of the removed algo needFullClean = true; + subMeshesSupported = algo->SupportSubmeshes(); } } } @@ -984,8 +990,10 @@ SMESH_Hypothesis::Hypothesis_Status // CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID. algo = dynamic_cast (anHyp); if (!algo->NeedDiscreteBoundary()) + { needFullClean = true; - + subMeshesSupported = algo->SupportSubmeshes(); + } algo = GetAlgo(); if (algo == NULL) // no more applying algo on father { @@ -1064,7 +1072,7 @@ SMESH_Hypothesis::Hypothesis_Status if ( needFullClean ) { // added or removed algo is all-dimensional ComputeStateEngine( CLEAN ); - cleanDependsOn(); + cleanDependsOn( subMeshesSupported ); ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE ); } @@ -1163,17 +1171,59 @@ SMESH_Hypothesis::Hypothesis_Status return ret; } -//============================================================================= +//================================================================================ /*! - * + * \brief Remove elements from sub-meshes. + * \param keepSupportedsubMeshes - if true, the sub-meshes computed using more + * local algorithms are not cleaned */ -//============================================================================= +//================================================================================ -void SMESH_subMesh::cleanDependsOn() +void SMESH_subMesh::cleanDependsOn( bool keepSupportedsubMeshes ) { - SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,false); - while ( smIt->more() ) - smIt->next()->ComputeStateEngine(CLEAN); + if ( _father->NbNodes() == 0 ) return; + + SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false, + /*complexShapeFirst=*/true); + if ( !keepSupportedsubMeshes ) + { + while ( smIt->more() ) + smIt->next()->ComputeStateEngine(CLEAN); + } + else + { + // find sub-meshes to keep elements on + set< SMESH_subMesh* > smToKeep; + SMESHDS_Mesh* meshDS = _father->GetMeshDS(); + while ( smIt->more() ) + { + SMESH_subMesh* sm = smIt->next(); + if ( sm->IsEmpty() ) continue; + + // look for an algo assigned to sm + bool algoFound = false; + const list& hyps = meshDS->GetHypothesis( sm->_subShape ); + list::const_iterator h = hyps.begin(); + for ( ; ( !algoFound && h != hyps.end() ); ++h ) + algoFound = ((*h)->GetType() != SMESHDS_Hypothesis::PARAM_ALGO ); + + // remember all sub-meshes of sm + if ( algoFound ) + { + SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false,true); + while ( smIt2->more() ) + smToKeep.insert( smIt2->next() ); + } + } + // remove elements + SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,true); + while ( smIt->more() ) + { + SMESH_subMesh* sm = smIt->next(); + if ( !smToKeep.count( sm )) + sm->ComputeStateEngine(CLEAN); + } + } } //============================================================================= @@ -1283,10 +1333,6 @@ bool SMESH_subMesh::ComputeStateEngine(int event) default:; } - //MESSAGE("SMESH_subMesh::ComputeStateEngine"); - //SCRUTE(_computeState); - //SCRUTE(event); - if (_subShape.ShapeType() == TopAbs_VERTEX) { _computeState = READY_TO_COMPUTE; @@ -1328,7 +1374,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) case MODIF_ALGO_STATE: algo = GetAlgo(); if (algo && !algo->NeedDiscreteBoundary()) - cleanDependsOn(); // clean sub-meshes with event CLEAN + cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN if ( _algoState == HYP_OK ) _computeState = READY_TO_COMPUTE; break; @@ -1374,7 +1420,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) if (algo) { if (!algo->NeedDiscreteBoundary()) - cleanDependsOn(); // clean sub-meshes with event CLEAN + cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN if ( _algoState == HYP_OK ) _computeState = READY_TO_COMPUTE; } @@ -1394,21 +1440,22 @@ bool SMESH_subMesh::ComputeStateEngine(int event) TopoDS_Shape shape = _subShape; // check submeshes needed if (_father->HasShapeToMesh() ) { - bool subComputed = false; + bool subComputed = false, subFailed = false; if (!algo->OnlyUnaryInput()) - shape = getCollection( gen, algo, subComputed ); + shape = getCollection( gen, algo, subComputed, subFailed ); else subComputed = SubMeshesComputed(); ret = ( algo->NeedDiscreteBoundary() ? subComputed : - algo->SupportSubmeshes() ? true : + algo->SupportSubmeshes() ? !subFailed : ( !subComputed || _father->IsNotConformAllowed() )); - if (!ret) { + if (!ret) + { _computeState = FAILED_TO_COMPUTE; - if ( !algo->NeedDiscreteBoundary() ) + if ( !algo->NeedDiscreteBoundary() && !subFailed ) _computeError = SMESH_ComputeError::New(COMPERR_BAD_INPUT_MESH, "Unexpected computed submesh",algo); - break; + break; // goto exit } } // Compute @@ -1494,6 +1541,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event) } // check if an error reported on any sub-shape bool isComputeErrorSet = !checkComputeError( algo, ret, shape ); + if ( isComputeErrorSet ) + ret = false; // check if anything was built TopExp_Explorer subS(shape, _subShape.ShapeType()); if (ret) @@ -1597,7 +1646,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) ComputeStateEngine( CLEAN ); algo = GetAlgo(); if (algo && !algo->NeedDiscreteBoundary()) - cleanDependsOn(); // clean sub-meshes with event CLEAN + cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN break; case COMPUTE: // nothing to do break; @@ -1652,7 +1701,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) ComputeStateEngine( CLEAN ); algo = GetAlgo(); if (algo && !algo->NeedDiscreteBoundary()) - cleanDependsOn(); // clean sub-meshes with event CLEAN + cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN if (_algoState == HYP_OK) _computeState = READY_TO_COMPUTE; else @@ -1951,9 +2000,10 @@ void SMESH_subMesh::removeSubMeshElementsAndNodes() TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo, - bool & theSubComputed) + bool & theSubComputed, + bool & theSubFailed) { - theSubComputed = SubMeshesComputed(); + theSubComputed = SubMeshesComputed( & theSubFailed ); TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh(); diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 0c956cea6..a1b3a8568 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -253,7 +253,7 @@ public: void SetIsAlwaysComputed(bool isAlCo); bool IsAlwaysComputed() { return _alwaysComputed; } - bool SubMeshesComputed() const; + bool SubMeshesComputed(bool * isFailedToCompute=0) const; /*! @@ -273,7 +273,7 @@ protected: void updateDependantsState(const compute_event theEvent); void updateSubMeshState(const compute_state theState); void cleanDependants(); - void cleanDependsOn(); + void cleanDependsOn( bool keepSupportedsubMeshes = false ); void setAlgoState(algo_state state); /*! @@ -282,7 +282,8 @@ protected: */ TopoDS_Shape getCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo, - bool & theSubComputed); + bool & theSubComputed, + bool & theSubFailed); /*! * \brief Update compute_state by _computeError * \retval bool - false if there are errors @@ -313,11 +314,12 @@ protected: std::map < int, SMESH_subMesh * >_mapDepend; bool _dependenceAnalysed; + SMESH_Algo * _algo; // the algorithm found by last *StateEngine() call algo_state _algoState; compute_state _computeState; SMESH_ComputeErrorPtr _computeError; - // allow algo->Compute() if a subshape of lower dim is meshed but + // allow algo->Compute() if a sub-shape of lower dim is meshed but // none mesh entity is bound to it. Eg StdMeshers_CompositeSegment_1D can // mesh several edges as a whole and leave some of them without mesh entities bool _alwaysComputed; diff --git a/src/SMESHDS/SMESHDS_Hypothesis.hxx b/src/SMESHDS/SMESHDS_Hypothesis.hxx index 85e115c05..32705efae 100644 --- a/src/SMESHDS/SMESHDS_Hypothesis.hxx +++ b/src/SMESHDS/SMESHDS_Hypothesis.hxx @@ -39,9 +39,11 @@ class SMESHDS_EXPORT SMESHDS_Hypothesis SMESHDS_Hypothesis(int hypId); virtual ~SMESHDS_Hypothesis(); + enum hypothesis_type { PARAM_ALGO, ALGO_0D, ALGO_1D, ALGO_2D, ALGO_3D }; + const char* GetName() const; - int GetID() const; - int GetType() const; + int GetID() const; + int GetType() const; virtual std::ostream & SaveTo(std::ostream & save)=0; virtual std::istream & LoadFrom(std::istream & load)=0; @@ -49,12 +51,10 @@ class SMESHDS_EXPORT SMESHDS_Hypothesis virtual bool operator==(const SMESHDS_Hypothesis& other) const; bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); } - enum hypothesis_type { PARAM_ALGO, ALGO_0D, ALGO_1D, ALGO_2D, ALGO_3D }; - protected: - std::string _name; // identifier if hypothesis type - int _hypId; // ID unique within application session - int _type; // enum hypothesis_type + std::string _name; // identifier of hypothesis type + int _hypId; // ID unique within application session + hypothesis_type _type; // enum hypothesis_type }; #endif diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 5c87d1c2c..47f42b997 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -543,11 +543,9 @@ { format = "GMF"; notSupportedElemTypes.push_back( SMESH::Entity_0D ); - notSupportedElemTypes.push_back( SMESH::Entity_Quad_Quadrangle ); notSupportedElemTypes.push_back( SMESH::Entity_Polygon ); notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon ); notSupportedElemTypes.push_back( SMESH::Entity_Quad_Pyramid ); - notSupportedElemTypes.push_back( SMESH::Entity_Quad_Hexa ); notSupportedElemTypes.push_back( SMESH::Entity_Quad_Penta ); notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism ); notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra ); diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 8d77bc357..ce220e259 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -441,7 +441,7 @@ void SMESHGUI_AddMeshElementDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp())); @@ -450,8 +450,8 @@ void SMESHGUI_AddMeshElementDlg::Init() connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()),SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument())); /* to close dialog if study frame change */ - connect(mySMESHGUI, SIGNAL(SignalStudyFrameChanged()), SLOT(ClickOnCancel())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalStudyFrameChanged()), SLOT(reject())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); if (Reverse) connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int))); @@ -599,14 +599,14 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() void SMESHGUI_AddMeshElementDlg::ClickOnOk() { ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_AddMeshElementDlg::ClickOnCancel() +void SMESHGUI_AddMeshElementDlg::reject() { //mySelectionMgr->clearSelected(); mySimulation->SetVisibility(false); @@ -615,7 +615,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnCancel() aViewWindow->SetSelectionMode( ActorSelection ); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -874,26 +874,6 @@ void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//================================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//================================================================================= -void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : CheckBox() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h index 72ad06d93..d5f420eb1 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h @@ -71,8 +71,6 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); - void hideEvent( QHideEvent* ); /* ESC key */ void enterEvent( QEvent* ); /* mouse enter the QWidget */ void keyPressEvent( QKeyEvent* ); void displaySimulation(); @@ -119,9 +117,11 @@ private: QString myHelpFileName; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index c4bc516ad..3a72de152 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -628,13 +628,13 @@ void SMESHGUI_AddQuadraticElementDlg::Init() connect(myReverseCB, SIGNAL(stateChanged(int)), SLOT(onReverse(int))); connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); - connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(reject())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), SLOT(reject())); myCurrentLineEdit = myCornerNodes; @@ -803,14 +803,14 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() void SMESHGUI_AddQuadraticElementDlg::ClickOnOk() { ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_AddQuadraticElementDlg::ClickOnCancel() +void SMESHGUI_AddQuadraticElementDlg::reject() { mySelectionMgr->clearSelected(); mySimulation->SetVisibility(false); @@ -819,7 +819,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnCancel() aViewWindow->SetSelectionMode( ActorSelection ); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -1134,26 +1134,6 @@ void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_AddQuadraticElementDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//================================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//================================================================================= -void SMESHGUI_AddQuadraticElementDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : onReverse() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h index 3b2c360b2..7ef580022 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h @@ -73,8 +73,6 @@ private: typedef QList GrpList; void Init(); - void closeEvent( QCloseEvent* ); - void hideEvent( QHideEvent* ); /* ESC key */ void enterEvent( QEvent* ); /* mouse enter the QWidget */ void keyPressEvent( QKeyEvent* ); void displaySimulation(); @@ -128,6 +126,9 @@ private: QString myHelpFileName; +protected slots: + virtual void reject(); + private slots: void onTextChange( const QString& ); void onCellTextChange( int, int ); @@ -135,7 +136,6 @@ private slots: void onCellDoubleClicked( int, int ); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); void SetCurrentSelection(); diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index cadd4593f..3ca0fff25 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -212,7 +212,7 @@ void SMESHGUI_BuildCompoundDlg::Init() // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -223,7 +223,7 @@ void SMESHGUI_BuildCompoundDlg::Init() connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); LineEditName->setText(GetDefaultName(tr("COMPOUND_MESH"))); LineEditMeshes->setFocus(); @@ -366,20 +366,20 @@ void SMESHGUI_BuildCompoundDlg::ClickOnOk() { setIsApplyAndClose( true ); if (ClickOnApply()) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_BuildCompoundDlg::ClickOnCancel() +void SMESHGUI_BuildCompoundDlg::reject() { //mySelectionMgr->clearSelected(); mySelectionMgr->clearFilters(); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -480,27 +480,6 @@ void SMESHGUI_BuildCompoundDlg::enterEvent( QEvent* ) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_BuildCompoundDlg::closeEvent( QCloseEvent* ) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_BuildCompoundDlg::hideEvent( QHideEvent* ) -{ - if (!isMinimized()) - ClickOnCancel(); -} - - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h index 6230022e8..a5890252c 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h @@ -68,9 +68,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); bool isValid(); @@ -115,9 +113,11 @@ private: bool myIsApplyAndClose; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SelectionIntoArgument(); diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index 993f69f28..c359f18a6 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -479,12 +479,12 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool))); connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(onAutoApply(bool))); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); /* to close dialog if study frame change */ - connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), this, SLOT(reject())); this->show(); } @@ -589,16 +589,17 @@ void SMESHGUI_ClippingDlg::ClickOnApply() void SMESHGUI_ClippingDlg::ClickOnOk() { ClickOnApply(); - ClickOnCancel(); + reject(); } //======================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //======================================================================= -void SMESHGUI_ClippingDlg::ClickOnCancel() +void SMESHGUI_ClippingDlg::reject() { - close(); + //here we can insert actions to do at close. + QDialog::reject(); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.h b/src/SMESHGUI/SMESHGUI_ClippingDlg.h index e8cb095f8..3ade2c9c7 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.h +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.h @@ -192,6 +192,9 @@ private: bool myIsSelectPlane; QString myHelpFileName; +protected slots: + virtual void reject(); + public slots: void onSelectPlane( int ); void ClickOnNew(); @@ -203,7 +206,6 @@ public slots: void OnPreviewToggle( bool ); void onAutoApply(bool); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); }; diff --git a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx index dab7a224c..6a3b9038b 100644 --- a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx @@ -227,7 +227,7 @@ SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( SMESHGUI* theModule ) /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -236,7 +236,7 @@ SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( SMESHGUI* theModule ) connect(mySelectionMgr, SIGNAL (currentSelectionChanged()), this, SLOT (SelectionIntoArgument())); connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()),/* to close dialog if study change */ - this, SLOT (ClickOnCancel())); + this, SLOT (reject())); connect(myLineEditElements, SIGNAL(textChanged(const QString&)), this, SLOT (onTextChange(const QString&))); @@ -369,14 +369,14 @@ void SMESHGUI_CopyMeshDlg::ClickOnOk() { setIsApplyAndClose( true ); if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_CopyMeshDlg::ClickOnCancel() +void SMESHGUI_CopyMeshDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); if ( mySelectionMgr ) @@ -384,7 +384,7 @@ void SMESHGUI_CopyMeshDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( ActorSelection ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -618,26 +618,6 @@ void SMESHGUI_CopyMeshDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_CopyMeshDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_CopyMeshDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h index b0c3b9338..d39f9cc5c 100644 --- a/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_CopyMeshDlg.h @@ -65,9 +65,7 @@ public: private: void Init( bool = true ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); void setNewMeshName(); @@ -114,9 +112,11 @@ private: bool myIsApplyAndClose; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SelectionIntoArgument(); diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index ac3c71931..9413696e9 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -230,7 +230,7 @@ QWidget* SMESHGUI_CreatePatternDlg::createButtonFrame( QWidget* theParent ) aLay->addWidget( myHelpBtn ); connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) ); - connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( mySaveBtn, SIGNAL( clicked() ), this, SLOT( onSave() ) ); connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); @@ -279,7 +279,7 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), - this, SLOT( onClose() ) ); + this, SLOT( reject() ) ); mySwitch2d->setEnabled( theType == Type_2d ); mySwitch3d->setEnabled( theType == Type_3d ); @@ -482,17 +482,17 @@ void SMESHGUI_CreatePatternDlg::onOk() } //======================================================================= -// function : onClose() +// function : reject() // purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_CreatePatternDlg::onClose() +void SMESHGUI_CreatePatternDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); emit Close(); } @@ -648,15 +648,6 @@ void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* ) } } -//================================================================================= -// function : closeEvent() -// purpose : Close dialog box -//================================================================================= -void SMESHGUI_CreatePatternDlg::closeEvent( QCloseEvent* ) -{ - onClose(); -} - //======================================================================= // function : onSelBtnClicked() // purpose : SLOT. Called when -> button clicked. diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h index 0a03e1061..096ce40fc 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h @@ -74,14 +74,13 @@ signals: void Close(); private: - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); private slots: void onOk(); void onSave(); - void onClose(); + void reject(); void onHelp(); void onDeactivate(); diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 73eae4dd2..8fdd03e6f 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -335,7 +335,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL( clicked() ), SLOT( ClickOnOk() ) ); - connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ); + connect(buttonCancel, SIGNAL( clicked() ), SLOT( reject() ) ); connect(buttonApply, SIGNAL( clicked() ), SLOT( ClickOnApply() ) ); connect(buttonHelp, SIGNAL( clicked() ), SLOT( ClickOnHelp() ) ); @@ -351,7 +351,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init() connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( Preview, SIGNAL(toggled(bool)), this, SLOT(ClickOnPreview(bool))); /* to close dialog if study change */ - connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( reject() ) ); ConstructorsClicked(0); SelectionIntoArgument(); @@ -589,15 +589,15 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnOk() { if(checkEditLine(false) == -1) {return;} ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel() +void SMESHGUI_CreatePolyhedralVolumeDlg::reject() { mySelectionMgr->clearFilters(); //SALOME_ListIO aList; @@ -608,7 +608,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel() aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -1037,30 +1037,6 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent(QEvent* e) ActivateThisDialog(); } - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_CreatePolyhedralVolumeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= - -void SMESHGUI_CreatePolyhedralVolumeDlg::hideEvent ( QHideEvent * e ) -{ - if ( !isMinimized() ) - ClickOnCancel(); -} - - //================================================================================= // function : GetConstructorId() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h index 44dd3ab5d..f0c2e77f3 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h @@ -72,9 +72,7 @@ private: typedef QList GrpList; void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); void displaySimulation(); @@ -125,11 +123,13 @@ public slots: void onAdd(); void onRemove(); +protected slots: + virtual void reject(); + private slots: void ConstructorsClicked( int ); void ClickOnPreview( bool ); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx index 7b2c6e27a..3200bc02f 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx @@ -146,7 +146,7 @@ QWidget* SMESHGUI_DeleteGroupDlg::createButtonFrame (QWidget* theParent) // connect signals and slots connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(reject())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); @@ -173,7 +173,7 @@ void SMESHGUI_DeleteGroupDlg::Init () // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); // set selection mode mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP)); @@ -239,14 +239,14 @@ bool SMESHGUI_DeleteGroupDlg::onApply() void SMESHGUI_DeleteGroupDlg::onOk() { if (onApply()) - onClose(); + reject(); } //================================================================================= -// function : onClose() +// function : reject() // purpose : SLOT called when "Close" button pressed. Close dialog //================================================================================= -void SMESHGUI_DeleteGroupDlg::onClose() +void SMESHGUI_DeleteGroupDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); @@ -254,7 +254,7 @@ void SMESHGUI_DeleteGroupDlg::onClose() disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); mySelectionMgr->clearFilters(); - reject(); + QDialog::reject(); } //================================================================================= @@ -334,15 +334,6 @@ void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*) mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP)); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_DeleteGroupDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h index 76f6bd5b0..12ccb0023 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h @@ -59,14 +59,15 @@ public: void Init (); private: - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); +protected slots: + virtual void reject(); + private slots: void onOk(); bool onApply(); - void onClose(); void onHelp(); void onDeactivate(); diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx index 1ee5ab8c9..0c49d152e 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx @@ -214,14 +214,14 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) connect(mySelectButton3, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument())); connect(myButtonOk, SIGNAL(clicked()), this, SLOT(onOk())); - connect(myButtonClose, SIGNAL(clicked()), this, SLOT(onClose())); + connect(myButtonClose, SIGNAL(clicked()), this, SLOT(reject())); connect(myButtonApply, SIGNAL(clicked()), this, SLOT(onApply())); connect(myButtonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionChanged())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(onClose())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); } /*! @@ -425,19 +425,19 @@ bool SMESHGUI_DuplicateNodesDlg::onApply() void SMESHGUI_DuplicateNodesDlg::onOk() { if (onApply()) - onClose(); + reject(); } /*! \brief SLOT called to close the dialog. */ -void SMESHGUI_DuplicateNodesDlg::onClose() +void SMESHGUI_DuplicateNodesDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); mySelectionMgr->clearFilters(); - reject(); + QDialog::reject(); } /*! @@ -575,15 +575,6 @@ void SMESHGUI_DuplicateNodesDlg::enterEvent (QEvent*) } } -/*! - \brief Receive close events. - Reimplemented from QWidget class. -*/ -void SMESHGUI_DuplicateNodesDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} - /*! \brief Receive key press events. Reimplemented from QWidget class. diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h index 2714ba093..ac91720b6 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h @@ -65,15 +65,16 @@ private: bool isValid(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); +protected slots: + virtual void reject(); + private slots: void onConstructorsClicked( int ); void onOk(); - void onClose(); bool onApply(); void onHelp(); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index d23c6dc33..5a2c3eba6 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -305,7 +305,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) /***************************************************************/ // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -326,7 +326,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); @@ -664,16 +664,28 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() void SMESHGUI_ExtrusionDlg::ClickOnOk() { if (ClickOnApply()) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : Called when dialog box is closed //================================================================================= -void SMESHGUI_ExtrusionDlg::ClickOnCancel() +void SMESHGUI_ExtrusionDlg::reject() { - reject(); + disconnect(mySelectionMgr, 0, this, 0); + mySelectionMgr->clearFilters(); + //mySelectionMgr->clearSelected(); + if (SMESH::GetCurrentVtkView()) { + SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters + SMESH::SetPointRepresentation(false); + SMESH::SetPickable(); + } + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySMESHGUI->ResetState(); + + QDialog::reject(); } //================================================================================= @@ -998,32 +1010,6 @@ void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_ExtrusionDlg::closeEvent( QCloseEvent* ) -{ - /* same than click on cancel button */ - disconnect(mySelectionMgr, 0, this, 0); - mySelectionMgr->clearFilters(); - //mySelectionMgr->clearSelected(); - if (SMESH::GetCurrentVtkView()) { - SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters - SMESH::SetPointRepresentation(false); - SMESH::SetPickable(); - } - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - mySMESHGUI->ResetState(); -} - -void SMESHGUI_ExtrusionDlg::reject() -{ - QDialog::reject(); - close(); -} - //================================================================================= // function : onSelectMesh() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h index 330951397..71d20ece0 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h @@ -68,12 +68,9 @@ public: SMESHGUI_ExtrusionDlg( SMESHGUI* ); ~SMESHGUI_ExtrusionDlg(); - void reject(); - private: void Init( bool = true ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void closeEvent( QCloseEvent* ); void keyPressEvent( QKeyEvent* ); int GetConstructorId(); void getExtrusionVector(SMESH::DirStruct& aVector); @@ -147,14 +144,14 @@ private: SMESHGUI_FilterDlg* myFilterDlg; protected slots: - virtual void onDisplaySimulation( bool ); + virtual void onDisplaySimulation( bool ); + virtual void reject(); private slots: void ConstructorsClicked( int ); void CheckIsEnable(); void ClickOnOk(); bool ClickOnApply(); - void ClickOnCancel(); void ClickOnHelp(); void ClickOnRadio(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 108f7bed5..f1097018a 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -2653,7 +2653,7 @@ QWidget* SMESHGUI_FilterDlg::createButtonFrame (QWidget* theParent) aLay->addWidget(myButtons[ BTN_Help ]); connect(myButtons[ BTN_OK ], SIGNAL(clicked()), SLOT(onOk())); - connect(myButtons[ BTN_Close ], SIGNAL(clicked()), SLOT(onClose())); + connect(myButtons[ BTN_Close ], SIGNAL(clicked()), SLOT(reject())); connect(myButtons[ BTN_Apply ], SIGNAL(clicked()), SLOT(onApply())); connect(myButtons[ BTN_Help ], SIGNAL(clicked()), SLOT(onHelp())); @@ -2718,7 +2718,7 @@ void SMESHGUI_FilterDlg::Init (const QList& theTypes, const bool setInViewe mySMESHGUI->SetActiveDialogBox((QDialog*)this); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); updateMainButtons(); updateSelection(); @@ -2768,10 +2768,10 @@ void SMESHGUI_FilterDlg::onOk() } //======================================================================= -// name : SMESHGUI_FilterDlg::onClose +// name : SMESHGUI_FilterDlg::reject // Purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_FilterDlg::onClose() +void SMESHGUI_FilterDlg::reject() { // Restore previously selected object if (mySelectionMgr) @@ -2799,8 +2799,7 @@ void SMESHGUI_FilterDlg::onClose() disconnect(mySMESHGUI, 0, this, 0); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); - reject(); - return; + QDialog::reject(); } //================================================================================= @@ -2848,15 +2847,6 @@ void SMESHGUI_FilterDlg::enterEvent (QEvent*) setEnabled(true); } -//======================================================================= -// name : closeEvent() -// Purpose : -//======================================================================= -void SMESHGUI_FilterDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} - //======================================================================= // name : SMESHGUI_FilterDlg::getIdsFromWg // Purpose : Retrieve list of ids from given widget diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index 4501a9d37..8081aec69 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -238,11 +238,13 @@ signals: void Accepted(); +protected slots: + virtual void reject(); + private slots: void onOk(); bool onApply(); - void onClose(); void onHelp(); void onDeactivate(); void onSelectionDone(); @@ -253,7 +255,6 @@ private: void construct( const QList& ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index c17dde1fa..0a2ec7b66 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -269,7 +269,7 @@ QWidget* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent) aLay->addWidget(myButtons[ BTN_Help ]); connect(myButtons[ BTN_OK ], SIGNAL(clicked()), SLOT(onOk())); - connect(myButtons[ BTN_Close ], SIGNAL(clicked()), SLOT(onClose())); + connect(myButtons[ BTN_Close ], SIGNAL(clicked()), SLOT(reject())); connect(myButtons[ BTN_Apply ], SIGNAL(clicked()), SLOT(onApply())); connect(myButtons[ BTN_Help ], SIGNAL(clicked()), SLOT(onHelp())); @@ -337,7 +337,7 @@ void SMESHGUI_FilterLibraryDlg::Init (const QList& theTypes, setEnabled(true); connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); if (myMode == ADD_TO) { @@ -467,22 +467,18 @@ bool SMESHGUI_FilterLibraryDlg::onApply() void SMESHGUI_FilterLibraryDlg::onOk() { if (onApply()) - { - disconnect( mySMESHGUI, 0, this, 0); - mySMESHGUI->ResetState(); - accept(); - } + reject(); } //======================================================================= -// name : SMESHGUI_FilterLibraryDlg::onClose +// name : SMESHGUI_FilterLibraryDlg::reject // Purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_FilterLibraryDlg::onClose() +void SMESHGUI_FilterLibraryDlg::reject() { disconnect( mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -527,15 +523,6 @@ void SMESHGUI_FilterLibraryDlg::enterEvent(QEvent*) setEnabled(true); } -//================================================================================= -// function : closeEvent() -// purpose : Close dialog -//================================================================================= -void SMESHGUI_FilterLibraryDlg::closeEvent(QCloseEvent* e) -{ - onClose(); -} - //======================================================================= // name : SMESHGUI_FilterLibraryDlg::getFileName // Purpose : Get file name diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h index 5b5af4fd0..539faab46 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h @@ -77,14 +77,15 @@ public: void SetTable( const SMESHGUI_FilterTable* ); private: - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); +protected slots: + virtual void reject(); + private slots: void onOk(); bool onApply(); - void onClose(); void onHelp(); void onDeactivate(); diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 03ebc2731..be401f774 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -439,7 +439,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create) connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK())); connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply())); - connect(myCloseBtn, SIGNAL(clicked()), this, SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), this, SLOT(reject())); connect(myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); /* Init selection */ @@ -458,7 +458,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create) myGeomFilter = new GEOM_SelectionFilter( aStudy, true ); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged())); connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()), this, SLOT(onVisibilityChanged())); @@ -1189,7 +1189,7 @@ void SMESHGUI_GroupDlg::onOK() { setIsApplyAndClose( true ); if ( onApply() ) - onClose(); + reject(); setIsApplyAndClose( false ); } @@ -2165,15 +2165,6 @@ void SMESHGUI_GroupDlg::onSort() } } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} - //================================================================================= // function : onVisibilityChanged() // purpose : @@ -2184,10 +2175,10 @@ void SMESHGUI_GroupDlg::onVisibilityChanged() } //================================================================================= -// function : SMESHGUI_GroupDlg::onClose +// function : SMESHGUI_GroupDlg::reject // purpose : SLOT called when "Close" button pressed. Close dialog //================================================================================= -void SMESHGUI_GroupDlg::onClose() +void SMESHGUI_GroupDlg::reject() { if (SMESH::GetCurrentVtkView()) { SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters @@ -2208,7 +2199,7 @@ void SMESHGUI_GroupDlg::onClose() mySelectionMgr->clearFilters(); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -2262,16 +2253,6 @@ void SMESHGUI_GroupDlg::enterEvent (QEvent*) } } -//================================================================================= -// function : hideEvent -// purpose : caused by ESC key -//================================================================================= -void SMESHGUI_GroupDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized() && !myIsBusy) - onClose(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index f3cb58f0f..638699e19 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -85,13 +85,15 @@ public slots: void onAdd(); void onRemove(); +protected slots: + virtual void reject(); + private slots: void onTypeChanged( int ); void onGrpTypeChanged( int ); void onColorChanged( QColor ); void onOK(); - void onClose(); bool onApply(); void onHelp(); void onDeactivate(); @@ -123,9 +125,7 @@ private: void init( SMESH::SMESH_Mesh_ptr ); void init( SMESH::SMESH_GroupBase_ptr, const bool theIsConvert = false ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); void setSelectionMode( int ); void updateButtons(); diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx index 87b3ed7cd..2aeeea586 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx @@ -204,7 +204,7 @@ QWidget* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent) // connect signals and slots connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(reject())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); @@ -228,7 +228,7 @@ void SMESHGUI_GroupOpDlg::Init() // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); // set selection mode if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -315,14 +315,14 @@ void SMESHGUI_GroupOpDlg::onOk() { setIsApplyAndClose( true ); if ( onApply() ) - onClose(); + reject(); setIsApplyAndClose( false ); } /*! - \brief SLOT called when "Close" button pressed closes dialog + \brief SLOT called when dialog is closed */ -void SMESHGUI_GroupOpDlg::onClose() +void SMESHGUI_GroupOpDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); @@ -331,7 +331,7 @@ void SMESHGUI_GroupOpDlg::onClose() mySMESHGUI->ResetState(); mySelectionMgr->clearFilters(); reset(); - reject(); + QDialog::reject(); } /*! @@ -467,14 +467,6 @@ void SMESHGUI_GroupOpDlg::enterEvent(QEvent*) mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP)); } -/*! - \brief Provides reaction on close event, closes the dialog box -*/ -void SMESHGUI_GroupOpDlg::closeEvent(QCloseEvent*) -{ - onClose(); -} - /*! \brief Resets state of the dialog, initializes its fields with default value, etc. Usually called by onApply() slot to reinitialize dialog fields. This virtual method diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.h b/src/SMESHGUI/SMESHGUI_GroupOpDlg.h index ec3b4c2f5..bf4c2c473 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.h @@ -92,13 +92,14 @@ protected: bool isApplyAndClose() const; private: - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); +protected slots: + virtual void reject(); + private slots: void onOk(); - void onClose(); void onHelp(); void onDeactivate(); diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx index b1345a00a..82884701f 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx @@ -552,7 +552,7 @@ void SMESHGUI_MergeDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -571,7 +571,7 @@ void SMESHGUI_MergeDlg::Init() connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); // Init Mesh field from selection SelectionIntoArgument(); @@ -697,14 +697,14 @@ bool SMESHGUI_MergeDlg::ClickOnApply() void SMESHGUI_MergeDlg::ClickOnOk() { if (ClickOnApply()) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_MergeDlg::ClickOnCancel() +void SMESHGUI_MergeDlg::reject() { myIdPreview->SetPointsLabeled(false); SMESH::SetPointRepresentation(false); @@ -718,7 +718,7 @@ void SMESHGUI_MergeDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); - reject(); + QDialog::reject(); } //================================================================================= @@ -1226,26 +1226,6 @@ void SMESHGUI_MergeDlg::enterEvent(QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_MergeDlg::closeEvent(QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_MergeDlg::hideEvent (QHideEvent *) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.h b/src/SMESHGUI/SMESHGUI_MergeDlg.h index dd9458d61..9ec0dcb23 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.h +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.h @@ -78,9 +78,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); void onEditGroup(); @@ -150,9 +148,11 @@ private: QString myEntry; GrpList myGroups; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void updateControls(); diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index cfb1f0e64..48b0a82b9 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -352,7 +352,7 @@ QWidget* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) aLay->addWidget(myHelpBtn); connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(reject())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); @@ -390,7 +390,7 @@ void SMESHGUI_MeshPatternDlg::Init() // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); myTypeGrp->button(Type_2d)->setChecked(true); onTypeChanged(Type_2d); @@ -538,14 +538,14 @@ bool SMESHGUI_MeshPatternDlg::onApply() void SMESHGUI_MeshPatternDlg::onOk() { if (onApply()) - onClose(); + reject(); } //======================================================================= -// name : SMESHGUI_MeshPatternDlg::onClose +// name : SMESHGUI_MeshPatternDlg::reject // Purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_MeshPatternDlg::onClose() +void SMESHGUI_MeshPatternDlg::reject() { mySelectionMgr->clearFilters(); SMESH::SetPickable(); @@ -555,7 +555,7 @@ void SMESHGUI_MeshPatternDlg::onClose() disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); erasePreview(); - reject(); + QDialog::reject(); } //================================================================================= @@ -724,15 +724,6 @@ void SMESHGUI_MeshPatternDlg::enterEvent (QEvent*) onTextChanged(mySelEdit[Ids]->text()); } -//======================================================================= -// name : SMESHGUI_MeshPatternDlg::closeEvent -// Purpose : -//======================================================================= -void SMESHGUI_MeshPatternDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} - //======================================================================= // name : SMESHGUI_MeshPatternDlg::onSelInputChanged // Purpose : SLOT. Called when -> button clicked. diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h index 76e6aca77..ee1053f2a 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h @@ -75,10 +75,12 @@ public: void Init(); +protected slots: + virtual void reject(); + private slots: void onOk(); bool onApply(); - void onClose(); void onHelp(); void onDeactivate(); @@ -108,7 +110,6 @@ private: void activateSelection(); QStringList prepareFilters() const; QString autoExtension( const QString& ) const; - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); void keyPressEvent( QKeyEvent* ); bool isValid( const bool = true ); diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index b87346e63..1d3a35fc3 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -384,14 +384,14 @@ void SMESHGUI_MultiEditDlg::Init() // main buttons connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(reject())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); // dialog controls connect(myFilterBtn, SIGNAL(clicked()), SLOT(onFilterBtn() )); @@ -423,7 +423,7 @@ void SMESHGUI_MultiEditDlg::Init() void SMESHGUI_MultiEditDlg::onOk() { if (onApply()) - onClose(); + reject(); } //======================================================================= @@ -510,10 +510,10 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds(SMESH::SMESH_IDSource_var& o } //======================================================================= -// name : SMESHGUI_MultiEditDlg::onClose +// name : SMESHGUI_MultiEditDlg::reject // Purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_MultiEditDlg::onClose() +void SMESHGUI_MultiEditDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); @@ -527,7 +527,7 @@ void SMESHGUI_MultiEditDlg::onClose() //mySelectionMgr->clearSelected(); mySelectionMgr->clearFilters(); - reject(); + QDialog::reject(); } //================================================================================= @@ -646,24 +646,6 @@ void SMESHGUI_MultiEditDlg::enterEvent (QEvent*) } } -//======================================================================= -// name : SMESHGUI_MultiEditDlg::closeEvent -// Purpose : -//======================================================================= -void SMESHGUI_MultiEditDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} -//======================================================================= -// name : SMESHGUI_MultiEditDlg::hideEvent -// Purpose : caused by ESC key -//======================================================================= -void SMESHGUI_MultiEditDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - onClose(); -} - //======================================================================= // name : SMESHGUI_MultiEditDlg::onFilterBtn // Purpose : SLOT. Called when "Filter" button pressed. @@ -1259,10 +1241,10 @@ SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg() { } -void SMESHGUI_CuttingOfQuadsDlg::onClose() +void SMESHGUI_CuttingOfQuadsDlg::reject() { erasePreview(); - SMESHGUI_MultiEditDlg::onClose(); + SMESHGUI_MultiEditDlg::reject(); } bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h index de9b0b67f..4c0aa432c 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h @@ -82,7 +82,7 @@ signals: protected slots: void onOk(); virtual bool onApply(); - virtual void onClose(); + virtual void reject(); void onHelp(); void onDeactivate(); @@ -102,9 +102,7 @@ protected slots: SMESH::NumericalFunctor_ptr getNumericalFunctor(); protected: - void closeEvent( QCloseEvent* ); void enterEvent( QEvent * ); - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); QWidget* createButtonFrame( QWidget* ); QWidget* createMainFrame( QWidget*, const bool ); @@ -221,7 +219,7 @@ protected: SMESH::SMESH_IDSource_ptr obj); protected slots: - virtual void onClose(); + virtual void reject(); void onCriterionRB(); void onPreviewChk(); diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index d82ec9c1d..e4010b893 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -370,7 +370,7 @@ void SMESHGUI_NodesDlg::Init() /* signals and slots connections */ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); @@ -381,8 +381,8 @@ void SMESHGUI_NodesDlg::Init() connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) ); connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) ); /* to close dialog if study frame change */ - connect( mySMESHGUI, SIGNAL( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnCancel())); + connect( mySMESHGUI, SIGNAL( SignalStudyFrameChanged() ), SLOT( reject() ) ); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); // set selection mode SMESH::SetPointRepresentation( true ); @@ -414,7 +414,7 @@ void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue ) void SMESHGUI_NodesDlg::ClickOnOk() { if ( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= @@ -539,10 +539,10 @@ bool SMESHGUI_NodesDlg::ClickOnApply() } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_NodesDlg::ClickOnCancel() +void SMESHGUI_NodesDlg::reject() { disconnect( mySelectionMgr, 0, this, 0 ); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) @@ -552,7 +552,7 @@ void SMESHGUI_NodesDlg::ClickOnCancel() SMESH::SetPointRepresentation( false ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -638,25 +638,6 @@ void SMESHGUI_NodesDlg::SelectionIntoArgument() } } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_NodesDlg::closeEvent( QCloseEvent* ) -{ - this->ClickOnCancel(); /* same than click on cancel button */ -} - -//================================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//================================================================================= -void SMESHGUI_NodesDlg::hideEvent( QHideEvent* ) -{ - if ( !isMinimized() ) - ClickOnCancel(); -} - //================================================================================= // function : enterEvent() // purpose : to reactivate this dialog box when mouse enter onto the window diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.h b/src/SMESHGUI/SMESHGUI_NodesDlg.h index de2058f5a..7e4bca1ce 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.h @@ -79,8 +79,6 @@ private: void Init(); void enterEvent( QEvent* ); - void closeEvent( QCloseEvent* ); - void hideEvent ( QHideEvent* ); void keyPressEvent( QKeyEvent* ); bool isValid(); @@ -108,9 +106,11 @@ private: QString myHelpFileName; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void DeactivateActiveDialog(); diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index 4e3f3d5b5..bdb954b6b 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -435,7 +435,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* // Connect section connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) ); connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) ); - connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( onCancel() ) ); + connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( myHelpBtn, SIGNAL(clicked()), this, SLOT( onHelp() ) ); connect( myMinEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( onMinMaxChanged() ) ); connect( myMaxEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( onMinMaxChanged() ) ); @@ -445,7 +445,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* connect( myDistributionGrp, SIGNAL( toggled(bool) ), this, SLOT(onDistributionActivated(bool)) ); connect( myDistribColorGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onDistributionChanged( int ) ) ); connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); - connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ); + connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) ); myHelpFileName = "quality_page.html"; } @@ -471,7 +471,7 @@ SMESHGUI_Preferences_ScalarBarDlg::~SMESHGUI_Preferences_ScalarBarDlg() void SMESHGUI_Preferences_ScalarBarDlg::onOk() { if ( onApply() ) - onCancel(); + reject(); } //================================================================================================= @@ -588,14 +588,15 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply() //================================================================================================= /*! - * SMESHGUI_Preferences_ScalarBarDlg::onCancel + * SMESHGUI_Preferences_ScalarBarDlg::reject * * Cancel button slot */ //================================================================================================= -void SMESHGUI_Preferences_ScalarBarDlg::onCancel() +void SMESHGUI_Preferences_ScalarBarDlg::reject() { - close(); + myDlg = 0; + QDialog::reject(); } //================================================================================================= @@ -724,19 +725,6 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged() myDistributionGrp->setEnabled( false ); } -//================================================================================================= -/*! - * SMESHGUI_Preferences_ScalarBarDlg::closeEvent - * - * Close event handler - */ -//================================================================================================= -void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e ) -{ - myDlg = 0; - QDialog::closeEvent( e ); -} - //================================================================================================= /*! * SMESHGUI_Preferences_ScalarBarDlg::onMinMaxChanged diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index 05dea0f59..6b3196e4c 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -64,17 +64,18 @@ public: static void ScalarBarProperties( SMESHGUI* ); - void closeEvent( QCloseEvent* ); void setOriginAndSize( const double, const double, const double, const double ); void initScalarBarFromResources(); +protected slots: + virtual void reject(); + protected slots: void onOk(); bool onApply(); - void onCancel(); void onHelp(); void onSelectionChanged(); void onXYChanged(); diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index 6a5cedd86..4bccb68c4 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -196,7 +196,7 @@ void SMESHGUI_RemoveElementsDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -204,7 +204,7 @@ void SMESHGUI_RemoveElementsDlg::Init() connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); @@ -257,14 +257,14 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() void SMESHGUI_RemoveElementsDlg::ClickOnOk() { ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_RemoveElementsDlg::ClickOnCancel() +void SMESHGUI_RemoveElementsDlg::reject() { if (SMESH::GetCurrentVtkView()) SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters @@ -274,7 +274,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnCancel() disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -457,26 +457,6 @@ void SMESHGUI_RemoveElementsDlg::enterEvent(QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_RemoveElementsDlg::closeEvent(QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_RemoveElementsDlg::hideEvent( QHideEvent* ) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h index 6cc8d5ae4..5c179e7ed 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h @@ -63,9 +63,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); LightApp_SelectionMgr* mySelectionMgr; @@ -96,9 +94,11 @@ private: SMESHGUI_FilterDlg* myFilterDlg; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx index 303aee6f6..19103ebca 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -196,7 +196,7 @@ void SMESHGUI_RemoveNodesDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -204,7 +204,7 @@ void SMESHGUI_RemoveNodesDlg::Init() connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); @@ -261,14 +261,14 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply() void SMESHGUI_RemoveNodesDlg::ClickOnOk() { ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_RemoveNodesDlg::ClickOnCancel() +void SMESHGUI_RemoveNodesDlg::reject() { //mySelectionMgr->clearSelected(); if (SMESH::GetCurrentVtkView()) { @@ -280,7 +280,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnCancel() disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -463,26 +463,6 @@ void SMESHGUI_RemoveNodesDlg::enterEvent(QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_RemoveNodesDlg::closeEvent(QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_RemoveNodesDlg::hideEvent( QHideEvent* ) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h index 75a7afed3..77a2378f1 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h @@ -63,9 +63,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); LightApp_SelectionMgr* mySelectionMgr; @@ -96,9 +94,11 @@ private: SMESHGUI_FilterDlg* myFilterDlg; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx index 96d061cc6..923688cdd 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx @@ -186,7 +186,7 @@ void SMESHGUI_RenumberingDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -194,7 +194,7 @@ void SMESHGUI_RenumberingDlg::Init() connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); myEditCurrentArgument = LineEditMesh; LineEditMesh->setFocus(); @@ -254,20 +254,20 @@ void SMESHGUI_RenumberingDlg::ClickOnApply() void SMESHGUI_RenumberingDlg::ClickOnOk() { ClickOnApply(); - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_RenumberingDlg::ClickOnCancel() +void SMESHGUI_RenumberingDlg::reject() { //mySelectionMgr->clearSelected(); mySelectionMgr->clearFilters(); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -392,26 +392,6 @@ void SMESHGUI_RenumberingDlg::enterEvent(QEvent* e) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_RenumberingDlg::closeEvent(QCloseEvent* e) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_RenumberingDlg::hideEvent (QHideEvent * e) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : keyPressEvent() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.h b/src/SMESHGUI/SMESHGUI_RenumberingDlg.h index 5ebbe6ca3..bb0a9232b 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.h +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.h @@ -60,9 +60,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ @@ -89,9 +87,11 @@ private: QString myHelpFileName; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index f85e4eade..6baa81109 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -323,7 +323,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); @@ -343,7 +343,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); @@ -574,21 +574,27 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply() void SMESHGUI_RevolutionDlg::ClickOnOk() { if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_RevolutionDlg::ClickOnCancel() -{ - reject(); -} - void SMESHGUI_RevolutionDlg::reject() { - close(); + disconnect(mySelectionMgr, 0, this, 0); + mySelectionMgr->clearFilters(); + //mySelectionMgr->clearSelected(); + if (SMESH::GetCurrentVtkView()) { + SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters + SMESH::SetPointRepresentation(false); + } + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySMESHGUI->ResetState(); + + QDialog::reject(); } //================================================================================= @@ -910,25 +916,6 @@ void SMESHGUI_RevolutionDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - disconnect(mySelectionMgr, 0, this, 0); - mySelectionMgr->clearFilters(); - //mySelectionMgr->clearSelected(); - if (SMESH::GetCurrentVtkView()) { - SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters - SMESH::SetPointRepresentation(false); - } - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - mySMESHGUI->ResetState(); -} - //======================================================================= //function : onSelectMesh //purpose : diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index 91d1e4268..cfb9e1fc9 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -74,13 +74,10 @@ public: SMESHGUI_RevolutionDlg( SMESHGUI* ); ~SMESHGUI_RevolutionDlg(); - void reject(); - private: enum {NONE_SELECT, POINT_SELECT, FACE_SELECT}; void Init( bool = true); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); @@ -163,11 +160,11 @@ private: protected slots: virtual void onDisplaySimulation( bool ); + virtual void reject(); private slots: void ConstructorsClicked( int ); void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index 0e0690c01..e737712df 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -297,7 +297,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) : /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -312,7 +312,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) : connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); @@ -508,14 +508,14 @@ void SMESHGUI_RotationDlg::ClickOnOk() { setIsApplyAndClose( true ); if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_RotationDlg::ClickOnCancel() +void SMESHGUI_RotationDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); @@ -527,7 +527,7 @@ void SMESHGUI_RotationDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -857,26 +857,6 @@ void SMESHGUI_RotationDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_RotationDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//================================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//================================================================================= -void SMESHGUI_RotationDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : onSelectMesh() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.h b/src/SMESHGUI/SMESHGUI_RotationDlg.h index a4e6b4af2..e52f59c12 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.h +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.h @@ -66,9 +66,7 @@ public: private: void Init( bool = true ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); bool IsAxisOk(); void setNewMeshName(); @@ -134,11 +132,11 @@ private: SMESHGUI_FilterDlg* myFilterDlg; protected slots: - virtual void onDisplaySimulation( bool ); + virtual void onDisplaySimulation( bool ); + virtual void reject(); private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx index b74a31f12..8dd25d87c 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx @@ -301,7 +301,7 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule ) : /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); @@ -312,7 +312,7 @@ SMESHGUI_ScaleDlg::SMESHGUI_ScaleDlg( SMESHGUI* theModule ) : connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); @@ -545,14 +545,14 @@ void SMESHGUI_ScaleDlg::ClickOnOk() { setIsApplyAndClose( true ); if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_ScaleDlg::ClickOnCancel() +void SMESHGUI_ScaleDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); @@ -564,7 +564,7 @@ void SMESHGUI_ScaleDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( ActorSelection ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -881,26 +881,6 @@ void SMESHGUI_ScaleDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_ScaleDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_ScaleDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //======================================================================= //function : onSelectMesh //purpose : diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.h b/src/SMESHGUI/SMESHGUI_ScaleDlg.h index 7293a99e7..55bf4acc6 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.h +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.h @@ -62,9 +62,7 @@ public: private: void Init( bool = true ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); void setNewMeshName(); @@ -129,12 +127,12 @@ private: protected slots: - virtual void onDisplaySimulation( bool ); + virtual void onDisplaySimulation( bool ); + virtual void reject(); private slots: void ConstructorsClicked( int ); void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index 24d85f012..60ee92301 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -257,7 +257,7 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule ) /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); @@ -272,7 +272,7 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule ) connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEdit1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(LineEdit2, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); @@ -548,14 +548,14 @@ bool SMESHGUI_SewingDlg::ClickOnApply() void SMESHGUI_SewingDlg::ClickOnOk() { if (ClickOnApply()) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_SewingDlg::ClickOnCancel() +void SMESHGUI_SewingDlg::reject() { //mySelectionMgr->clearSelected(); SMESH::SetPointRepresentation(false); @@ -563,7 +563,7 @@ void SMESHGUI_SewingDlg::ClickOnCancel() aViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -873,26 +873,6 @@ void SMESHGUI_SewingDlg::enterEvent (QEvent* e) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_SewingDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_SewingDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //================================================================================= // function : GetConstructorId() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.h b/src/SMESHGUI/SMESHGUI_SewingDlg.h index f8ff617d0..3d9402714 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.h @@ -63,9 +63,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); bool IsValid(); @@ -118,10 +116,12 @@ private: QString myHelpFileName; +protected slots: + virtual void reject(); + private slots: void ConstructorsClicked( int ); void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index f93ce9556..ef9bf0014 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -215,14 +215,14 @@ void SMESHGUI_SingleEditDlg::Init() // main buttons connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(reject())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); connect(myEdge, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); myOkBtn->setEnabled(false); @@ -244,14 +244,14 @@ void SMESHGUI_SingleEditDlg::Init() void SMESHGUI_SingleEditDlg::onOk() { if (onApply()) - onClose(); + reject(); } //======================================================================= -// name : onClose() +// name : reject() // Purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_SingleEditDlg::onClose() +void SMESHGUI_SingleEditDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); @@ -259,7 +259,7 @@ void SMESHGUI_SingleEditDlg::onClose() disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -458,25 +458,6 @@ void SMESHGUI_SingleEditDlg::enterEvent (QEvent*) } } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_SingleEditDlg::closeEvent (QCloseEvent*) -{ - onClose(); -} - -//======================================================================= -//function : hideEvent() -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_SingleEditDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - onClose(); -} - //================================================================================= // function : onApply() // purpose : SLOT. Called when apply button is pressed diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.h b/src/SMESHGUI/SMESHGUI_SingleEditDlg.h index cc04610ac..bf88ec684 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.h @@ -62,7 +62,7 @@ public: protected slots: void onOk(); virtual bool onApply(); - void onClose(); + virtual void reject(); void onHelp(); void onDeactivate(); @@ -71,9 +71,7 @@ protected slots: void onTextChange( const QString& ); protected: - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); QWidget* createButtonFrame( QWidget* ); QWidget* createMainFrame( QWidget* ); diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index 61aaae845..e31d5c79b 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -275,7 +275,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) /***************************************************************/ // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); @@ -284,7 +284,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(LineEditNodes, SIGNAL(textChanged(const QString&)), @@ -421,14 +421,14 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply() void SMESHGUI_SmoothingDlg::ClickOnOk() { if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : Called when dialog box is closed //================================================================================= -void SMESHGUI_SmoothingDlg::ClickOnCancel() +void SMESHGUI_SmoothingDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); @@ -441,7 +441,7 @@ void SMESHGUI_SmoothingDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -704,26 +704,6 @@ void SMESHGUI_SmoothingDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_SmoothingDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//======================================================================= -void SMESHGUI_SmoothingDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //======================================================================= // function : onSelectMesh() // purpose : diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h index efb9723a6..78c4b2a6b 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h @@ -71,9 +71,7 @@ public: private: void Init(); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); void setFilters( const bool theIsElem ); @@ -124,9 +122,11 @@ private: QPushButton* myElemFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; +protected slots: + virtual void reject(); + private slots: void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 5ab4f3f22..532e327ce 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -300,7 +300,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); @@ -316,7 +316,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); @@ -573,14 +573,14 @@ void SMESHGUI_SymmetryDlg::ClickOnOk() { setIsApplyAndClose( true ); if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_SymmetryDlg::ClickOnCancel() +void SMESHGUI_SymmetryDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); @@ -592,7 +592,7 @@ void SMESHGUI_SymmetryDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -917,26 +917,6 @@ void SMESHGUI_SymmetryDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_SymmetryDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//======================================================================= -void SMESHGUI_SymmetryDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //======================================================================= //function : onSelectMesh //purpose : diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h index a039ac27f..660d946fe 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h @@ -66,9 +66,7 @@ public: private: void Init( bool = true ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); bool IsMirrorOk(); @@ -139,11 +137,11 @@ private: protected slots: virtual void onDisplaySimulation( bool ); + virtual void reject(); private slots: void ConstructorsClicked( int ); void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index eaee51409..08305f678 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -304,7 +304,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) : /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); @@ -316,7 +316,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) : connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); @@ -578,14 +578,14 @@ void SMESHGUI_TranslationDlg::ClickOnOk() { setIsApplyAndClose( true ); if( ClickOnApply() ) - ClickOnCancel(); + reject(); } //================================================================================= -// function : ClickOnCancel() +// function : reject() // purpose : //================================================================================= -void SMESHGUI_TranslationDlg::ClickOnCancel() +void SMESHGUI_TranslationDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); @@ -597,7 +597,7 @@ void SMESHGUI_TranslationDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( ActorSelection ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -883,26 +883,6 @@ void SMESHGUI_TranslationDlg::enterEvent (QEvent*) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_TranslationDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_TranslationDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - //======================================================================= //function : onSelectMesh //purpose : diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.h b/src/SMESHGUI/SMESHGUI_TranslationDlg.h index 2c7294378..61a86afee 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.h +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.h @@ -65,9 +65,7 @@ public: private: void Init( bool = true ); - void closeEvent( QCloseEvent* ); void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); int GetConstructorId(); void setNewMeshName(); @@ -132,12 +130,12 @@ private: SMESHGUI_FilterDlg* myFilterDlg; protected slots: - virtual void onDisplaySimulation( bool ); + virtual void onDisplaySimulation( bool ); + virtual void reject(); private slots: void ConstructorsClicked( int ); void ClickOnOk(); - void ClickOnCancel(); bool ClickOnApply(); void ClickOnHelp(); void SetEditCurrentArgument(); diff --git a/src/SMESHUtils/SMESH_TypeDefs.hxx b/src/SMESHUtils/SMESH_TypeDefs.hxx index daadb673c..711335eac 100644 --- a/src/SMESHUtils/SMESH_TypeDefs.hxx +++ b/src/SMESHUtils/SMESH_TypeDefs.hxx @@ -109,7 +109,7 @@ struct SMESH_TNodeXYZ : public gp_XYZ { const SMDS_MeshNode* _node; double _xyz[3]; - SMESH_TNodeXYZ( const SMDS_MeshElement* e):gp_XYZ(0,0,0),_node(0) { + SMESH_TNodeXYZ( const SMDS_MeshElement* e=0):gp_XYZ(0,0,0),_node(0) { if (e) { assert( e->GetType() == SMDSAbs_Node ); _node = static_cast(e); diff --git a/src/StdMeshers/StdMeshers_Import_1D.cxx b/src/StdMeshers/StdMeshers_Import_1D.cxx index a85647120..760a14a8c 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D.cxx @@ -521,7 +521,7 @@ namespace // INTERNAL STUFF TopExp::MapShapes( SMESH_Mesh::PseudoShape(), pseudoSubShapes ); // index of pseudoSubShapes corresponding to srcMeshDS - int subIndex = srcMeshDS->GetPersistentId() % pseudoSubShapes.Extent(); + int subIndex = 1 + srcMeshDS->GetPersistentId() % pseudoSubShapes.Extent(); int nbSubShapes = 1 + srcMeshDS->GetPersistentId() / pseudoSubShapes.Extent(); // try to find already present shapeForSrcMesh diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 00a536105..6584b1665 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -69,8 +69,9 @@ using namespace std; // cout << msg << " ("<< p.X() << "; " < meshedFaces;//, notQuadMeshedFaces, notQuadFaces; + list< TopoDS_Face > meshedFaces, notQuadMeshedFaces, notQuadFaces; const bool meshHasQuads = ( theMesh.NbQuadrangles() > 0 ); for ( int iF = 1; iF < faceToSolids.Extent(); ++iF ) { @@ -479,17 +472,33 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh { if ( !meshHasQuads || !helper.IsSameElemGeometry( faceSM->GetSubMeshDS(), SMDSGeom_QUADRANGLE ) || - !helper.IsStructured( faceSM )) - // notQuadMeshedFaces are of higher priority + !helper.IsStructured( faceSM ) + ) + notQuadMeshedFaces.push_front( face ); + else if ( myHelper->Count( face, TopAbs_EDGE, /*ignoreSame=*/false ) != 4 ) meshedFaces.push_front( face ); else meshedFaces.push_back( face ); } + else if ( myHelper->Count( face, TopAbs_EDGE, /*ignoreSame=*/false ) != 4 ) + { + notQuadFaces.push_back( face ); + } } - //meshedFaces.splice( meshedFaces.begin(), notQuadMeshedFaces ); + // notQuadFaces are of medium priority, put them before ordinary meshed faces + meshedFaces.splice( meshedFaces.begin(), notQuadFaces ); + // notQuadMeshedFaces are of highest priority, put them before notQuadFaces + meshedFaces.splice( meshedFaces.begin(), notQuadMeshedFaces ); - // if ( meshedFaces.empty() ) - // return error( COMPERR_BAD_INPUT_MESH, "No meshed source faces found" ); + Prism_3D::TPrismTopo prism; + + if ( nbSolids == 1 ) + { + if ( !meshedFaces.empty() ) + prism.myBottom = meshedFaces.front(); + return ( initPrism( prism, TopExp_Explorer( theShape, TopAbs_SOLID ).Current() ) && + compute( prism )); + } TopTools_MapOfShape meshedSolids; list< Prism_3D::TPrismTopo > meshedPrism; @@ -619,6 +628,27 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh // TODO. there are other ways to find out the source FACE: // propagation, topological similarity, ect. + // simply try to mesh all not meshed SOLIDs + if ( meshedFaces.empty() ) + { + for ( TopExp_Explorer solid( theShape, TopAbs_SOLID ); solid.More(); solid.Next() ) + { + mySetErrorToSM = false; + prism.Clear(); + if ( !meshedSolids.Contains( solid.Current() ) && + initPrism( prism, solid.Current() )) + { + mySetErrorToSM = true; + if ( !compute( prism )) + return false; + meshedFaces.push_front( prism.myTop ); + meshedFaces.push_front( prism.myBottom ); + meshedPrism.push_back( prism ); + meshedSolids.Add( solid.Current() ); + } + mySetErrorToSM = true; + } + } if ( meshedFaces.empty() ) // set same error to 10 not-computed solids { @@ -633,7 +663,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh SMESH_subMesh* sm = theMesh.GetSubMesh( solid.Current() ); sm->GetComputeError() = err; } - return false; + return error( err ); } } return true; @@ -708,7 +738,7 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism, // ------------------------- // Compose a vector of indixes of right neighbour FACE for each wall FACE - // that is not so evident in case of several WIREs + // that is not so evident in case of several WIREs in the bottom FACE thePrism.myRightQuadIndex.clear(); for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i ) thePrism.myRightQuadIndex.push_back( i+1 ); @@ -1511,7 +1541,12 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top() SMESHDS_SubMesh * topSMDS = topSM->GetSubMeshDS(); if ( !botSMDS || botSMDS->NbElements() == 0 ) - return toSM( error(TCom("No elememts on face #") << botSM->GetId() )); + { + _gen->Compute( *myHelper->GetMesh(), botSM->GetSubShape() ); + botSMDS = botSM->GetSubMeshDS(); + if ( !botSMDS || botSMDS->NbElements() == 0 ) + return toSM( error(TCom("No elememts on face #") << botSM->GetId() )); + } bool needProject = !topSM->IsMeshComputed(); if ( !needProject && @@ -1646,7 +1681,7 @@ bool StdMeshers_Prism_3D::projectBottomToTop() // if the bottom faces is orienetd OK then top faces must be reversed bool reverseTop = true; if ( myHelper->NbAncestors( botFace, *myBlock.Mesh(), TopAbs_SOLID ) > 1 ) - reverseTop = ! SMESH_Algo::IsReversedSubMesh( TopoDS::Face( botFace ), meshDS ); + reverseTop = ! myHelper->IsReversedSubMesh( TopoDS::Face( botFace )); int iFrw, iRev, *iPtr = &( reverseTop ? iRev : iFrw ); // loop on bottom mesh faces diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index 805915b56..0fddea3c7 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -31,15 +31,16 @@ #include "StdMeshers_ProjectionSource2D.hxx" #include "StdMeshers_ProjectionSource3D.hxx" +#include "SMDS_EdgePosition.hxx" #include "SMESH_Algo.hxx" #include "SMESH_Block.hxx" #include "SMESH_Gen.hxx" +#include "SMESH_HypoFilter.hxx" #include "SMESH_Hypothesis.hxx" #include "SMESH_Mesh.hxx" #include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" #include "SMESH_subMeshEventListener.hxx" -#include "SMDS_EdgePosition.hxx" #include "utilities.h" @@ -417,15 +418,15 @@ namespace { } // namespace //======================================================================= -/*! - * \brief Looks for association of all sub-shapes of two shapes - * \param theShape1 - target shape - * \param theMesh1 - mesh built on shape 1 - * \param theShape2 - source shape - * \param theMesh2 - mesh built on shape 2 - * \param theAssociation - association map to be filled that may - * contain association of one or two pairs of vertices - * \retval bool - true if association found +/* + * Looks for association of all sub-shapes of two shapes + * \param theShape1 - target shape + * \param theMesh1 - mesh built on shape 1 + * \param theShape2 - source shape + * \param theMesh2 - mesh built on shape 2 + * \param theAssociation - association map to be filled that may + * contain association of one or two pairs of vertices + * \retval bool - true if association found */ //======================================================================= @@ -1263,15 +1264,15 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the } //================================================================================ -/*! - * \brief Find association of edges of faces - * \param face1 - face 1 - * \param VV1 - vertices of face 1 - * \param face2 - face 2 - * \param VV2 - vertices of face 2 associated with ones of face 1 - * \param edges1 - out list of edges of face 1 - * \param edges2 - out list of edges of face 2 - * \retval int - nb of edges in an outer wire in a success case, else zero +/* + * Find association of edges of faces + * \param face1 - face 1 + * \param VV1 - vertices of face 1 + * \param face2 - face 2 + * \param VV2 - vertices of face 2 associated with ones of face 1 + * \param edges1 - out list of edges of face 1 + * \param edges2 - out list of edges of face 2 + * \retval int - nb of edges in an outer wire in a success case, else zero */ //================================================================================ @@ -1500,12 +1501,12 @@ void StdMeshers_ProjectionUtils::InitVertexAssociation( const SMESH_Hypothesis* } //======================================================================= -/*! - * \brief Inserts association theShape1 <-> theShape2 to TShapeShapeMap - * \param theShape1 - target shape - * \param theShape2 - source shape - * \param theAssociationMap - association map - * \retval bool - true if there was no association for these shapes before +/* + * Inserts association theShape1 <-> theShape2 to TShapeShapeMap + * \param theShape1 - target shape + * \param theShape2 - source shape + * \param theAssociationMap - association map + * \retval bool - true if there was no association for these shapes before */ //======================================================================= @@ -1526,12 +1527,12 @@ bool StdMeshers_ProjectionUtils::InsertAssociation( const TopoDS_Shape& theShape } //======================================================================= -/*! - * \brief Finds an edge by its vertices in a main shape of the mesh - * \param aMesh - the mesh - * \param V1 - vertex 1 - * \param V2 - vertex 2 - * \retval TopoDS_Edge - found edge +/* + * Finds an edge by its vertices in a main shape of the mesh + * \param aMesh - the mesh + * \param V1 - vertex 1 + * \param V2 - vertex 2 + * \retval TopoDS_Edge - found edge */ //======================================================================= @@ -1554,12 +1555,12 @@ TopoDS_Edge StdMeshers_ProjectionUtils::GetEdgeByVertices( SMESH_Mesh* } //================================================================================ -/*! - * \brief Return another face sharing an edge - * \param edgeToFaces - data map of descendants to ancestors - * \param edge - edge - * \param face - face - * \retval TopoDS_Face - found face +/* + * Return another face sharing an edge + * \param edgeToFaces - data map of descendants to ancestors + * \param edge - edge + * \param face - face + * \retval TopoDS_Face - found face */ //================================================================================ @@ -1580,8 +1581,8 @@ TopoDS_Face StdMeshers_ProjectionUtils::GetNextFace( const TAncestorMap& edgeToF } //================================================================================ -/*! - * \brief Return other vertex of an edge +/* + * Return other vertex of an edge */ //================================================================================ @@ -1596,12 +1597,12 @@ TopoDS_Vertex StdMeshers_ProjectionUtils::GetNextVertex(const TopoDS_Edge& edg } //================================================================================ -/*! - * \brief Return a propagation edge - * \param aMesh - mesh - * \param theEdge - edge to find by propagation - * \param fromEdge - start edge for propagation - * \retval pair - propagation step and found edge +/* + * Return a propagation edge + * \param aMesh - mesh + * \param theEdge - edge to find by propagation + * \param fromEdge - start edge for propagation + * \retval pair - propagation step and found edge */ //================================================================================ @@ -1680,16 +1681,16 @@ StdMeshers_ProjectionUtils::GetPropagationEdge( SMESH_Mesh* aMesh, } //================================================================================ - /*! - * \brief Find corresponding nodes on two faces - * \param face1 - the first face - * \param mesh1 - mesh containing elements on the first face - * \param face2 - the second face - * \param mesh2 - mesh containing elements on the second face - * \param assocMap - map associating sub-shapes of the faces - * \param node1To2Map - map containing found matching nodes - * \retval bool - is a success - */ +/* + * Find corresponding nodes on two faces + * \param face1 - the first face + * \param mesh1 - mesh containing elements on the first face + * \param face2 - the second face + * \param mesh2 - mesh containing elements on the second face + * \param assocMap - map associating sub-shapes of the faces + * \param node1To2Map - map containing found matching nodes + * \retval bool - is a success + */ //================================================================================ bool StdMeshers_ProjectionUtils:: @@ -1702,7 +1703,7 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1, { SMESHDS_Mesh* meshDS1 = mesh1->GetMeshDS(); SMESHDS_Mesh* meshDS2 = mesh2->GetMeshDS(); - + SMESH_MesherHelper helper1( *mesh1 ); SMESH_MesherHelper helper2( *mesh2 ); @@ -1996,23 +1997,23 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1, node1To2Map.insert( make_pair( vNode1, vNode2 )); } -// don't know why this condition is usually true :( -// if ( node1To2Map.size() * quadFactor < SM1->NbNodes() ) -// MESSAGE("FindMatchingNodes() found too few node pairs starting from nodes (" -// << vNode1->GetID() << " - " << eNode1[0]->GetID() << ") (" -// << vNode2->GetID() << " - " << eNode2[0]->GetID() << "):" -// << node1To2Map.size() * quadFactor << " < " << SM1->NbNodes()); - + // don't know why this condition is usually true :( + // if ( node1To2Map.size() * quadFactor < SM1->NbNodes() ) + // MESSAGE("FindMatchingNodes() found too few node pairs starting from nodes (" + // << vNode1->GetID() << " - " << eNode1[0]->GetID() << ") (" + // << vNode2->GetID() << " - " << eNode2[0]->GetID() << "):" + // << node1To2Map.size() * quadFactor << " < " << SM1->NbNodes()); + return true; } //================================================================================ - /*! - * \brief Return any sub-shape of a face belonging to the outer wire - * \param face - the face - * \param type - type of sub-shape to return - * \retval TopoDS_Shape - the found sub-shape - */ +/* + * Return any sub-shape of a face belonging to the outer wire + * \param face - the face + * \param type - type of sub-shape to return + * \retval TopoDS_Shape - the found sub-shape + */ //================================================================================ TopoDS_Shape StdMeshers_ProjectionUtils::OuterShape( const TopoDS_Face& face, @@ -2025,12 +2026,12 @@ TopoDS_Shape StdMeshers_ProjectionUtils::OuterShape( const TopoDS_Face& face, } //================================================================================ - /*! - * \brief Check that submesh is computed and try to compute it if is not - * \param sm - submesh to compute - * \param iterationNb - int used to stop infinite recursive call - * \retval bool - true if computed - */ +/* + * Check that submesh is computed and try to compute it if is not + * \param sm - submesh to compute + * \param iterationNb - int used to stop infinite recursive call + * \retval bool - true if computed + */ //================================================================================ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iterationNb) @@ -2107,9 +2108,45 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter return false; } + +//================================================================================ +/* + * Returns an error message to show in case if MakeComputed( sm ) fails. + */ +//================================================================================ + +std::string StdMeshers_ProjectionUtils::SourceNotComputedError( SMESH_subMesh * sm, + SMESH_Algo* projAlgo ) +{ + const char usualMessage [] = "Source mesh not computed"; + if ( !projAlgo ) + return usualMessage; + if ( !sm || sm->GetAlgoState() != SMESH_subMesh::NO_ALGO ) + return usualMessage; // algo is OK, anything else is KO. + + // Try to find a type of all-dimentional algorithm that would compute the + // given sub-mesh if it could be launched before projection + const TopoDS_Shape shape = sm->GetSubShape(); + const int shapeDim = SMESH_Gen::GetShapeDim( shape ); + + for ( int dimIncrement = 1; shapeDim + dimIncrement < 4; ++dimIncrement ) + { + SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); + filter.And( filter.HasDim( shapeDim + dimIncrement )); + + SMESH_Algo* algo = (SMESH_Algo*) sm->GetFather()->GetHypothesis( shape, filter, true ); + if ( algo && !algo->NeedDiscreteBoundary() ) + return SMESH_Comment("\"") + << algo->GetFeatures()._label << "\"" + << " can't be used to compute the source mesh for \"" + << projAlgo->GetFeatures()._label << "\" in this case"; + } + return usualMessage; +} + //================================================================================ -/*! - * \brief Return a boundary EDGE (or all boundary EDGEs) of edgeContainer +/* + * Return a boundary EDGE (or all boundary EDGEs) of edgeContainer */ //================================================================================ @@ -2195,11 +2232,11 @@ namespace { // Definition of event listeners } //================================================================================ -/*! - * \brief Set event listeners to submesh with projection algo - * \param subMesh - submesh with projection algo - * \param srcShape - source shape - * \param srcMesh - source mesh +/* + * Set event listeners to submesh with projection algo + * \param subMesh - submesh with projection algo + * \param srcShape - source shape + * \param srcMesh - source mesh */ //================================================================================ diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx index 97d55ba22..6e57ecc81 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.hxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.hxx @@ -38,12 +38,13 @@ #include #include -class TopoDS_Shape; class SMDS_MeshNode; -class SMESH_Mesh; +class SMESH_Algo; class SMESH_Hypothesis; +class SMESH_Mesh; class SMESH_subMesh; class TopTools_IndexedDataMapOfShapeListOfShape; +class TopoDS_Shape; /*! * \brief Struct used instead of a sole TopTools_DataMapOfShapeShape to avoid @@ -69,149 +70,153 @@ struct StdMeshers_ShapeShapeBiDirectionMap }; /*! - * \brief Class encapsulating methods common to Projection algorithms + * \brief Methods common to Projection algorithms */ -class StdMeshers_ProjectionUtils +namespace StdMeshers_ProjectionUtils { - public: - typedef StdMeshers_ShapeShapeBiDirectionMap TShapeShapeMap; typedef TopTools_IndexedDataMapOfShapeListOfShape TAncestorMap; typedef std::map TNodeNodeMap; /*! * \brief Looks for association of all sub-shapes of two shapes - * \param theShape1 - shape 1 - * \param theMesh1 - mesh built on shape 1 - * \param theShape2 - shape 2 - * \param theMesh2 - mesh built on shape 2 - * \param theAssociation - association map to be filled that may - * contain association of one or two pairs of vertices - * \retval bool - true if association found + * \param theShape1 - shape 1 + * \param theMesh1 - mesh built on shape 1 + * \param theShape2 - shape 2 + * \param theMesh2 - mesh built on shape 2 + * \param theAssociation - association map to be filled that may + * contain association of one or two pairs of vertices + * \retval bool - true if association found */ - static bool FindSubShapeAssociation(const TopoDS_Shape& theShape1, - SMESH_Mesh* theMesh1, - const TopoDS_Shape& theShape2, - SMESH_Mesh* theMesh2, - TShapeShapeMap & theAssociationMap); + bool FindSubShapeAssociation(const TopoDS_Shape& theShape1, + SMESH_Mesh* theMesh1, + const TopoDS_Shape& theShape2, + SMESH_Mesh* theMesh2, + TShapeShapeMap & theAssociationMap); /*! * \brief Find association of edges of faces - * \param face1 - face 1 - * \param VV1 - vertices of face 1 - * \param face2 - face 2 - * \param VV2 - vertices of face 2 associated with oned of face 1 - * \param edges1 - out list of edges of face 1 - * \param edges2 - out list of edges of face 2 - * \retval int - nb of edges in an outer wire in a success case, else zero + * \param face1 - face 1 + * \param VV1 - vertices of face 1 + * \param face2 - face 2 + * \param VV2 - vertices of face 2 associated with oned of face 1 + * \param edges1 - out list of edges of face 1 + * \param edges2 - out list of edges of face 2 + * \retval int - nb of edges in an outer wire in a success case, else zero */ - static int FindFaceAssociation(const TopoDS_Face& face1, - TopoDS_Vertex VV1[2], - const TopoDS_Face& face2, - TopoDS_Vertex VV2[2], - std::list< TopoDS_Edge > & edges1, - std::list< TopoDS_Edge > & edges2); + int FindFaceAssociation(const TopoDS_Face& face1, + TopoDS_Vertex VV1[2], + const TopoDS_Face& face2, + TopoDS_Vertex VV2[2], + std::list< TopoDS_Edge > & edges1, + std::list< TopoDS_Edge > & edges2); /*! * \brief Insert vertex association defined by a hypothesis into a map - * \param theHyp - hypothesis - * \param theAssociationMap - association map - * \param theTargetShape - the shape theHyp assigned to + * \param theHyp - hypothesis + * \param theAssociationMap - association map + * \param theTargetShape - the shape theHyp assigned to */ - static void InitVertexAssociation( const SMESH_Hypothesis* theHyp, - TShapeShapeMap & theAssociationMap); + void InitVertexAssociation( const SMESH_Hypothesis* theHyp, + TShapeShapeMap & theAssociationMap); /*! * \brief Inserts association theShape1 <-> theShape2 to TShapeShapeMap - * \param theShape1 - target shape - * \param theShape2 - source shape - * \param theAssociationMap - association map - * \param theBidirectional - if false, inserts theShape1 -> theShape2 association - * \retval bool - true if there was no association for these shapes before + * \param theShape1 - target shape + * \param theShape2 - source shape + * \param theAssociationMap - association map + * \param theBidirectional - if false, inserts theShape1 -> theShape2 association + * \retval bool - true if there was no association for these shapes before */ - static bool InsertAssociation( const TopoDS_Shape& theShape1, // target - const TopoDS_Shape& theShape2, // source - TShapeShapeMap & theAssociationMap); + bool InsertAssociation( const TopoDS_Shape& theShape1, // target + const TopoDS_Shape& theShape2, // source + TShapeShapeMap & theAssociationMap); /*! * \brief Finds an edge by its vertices in a main shape of the mesh */ - static TopoDS_Edge GetEdgeByVertices( SMESH_Mesh* aMesh, - const TopoDS_Vertex& V1, - const TopoDS_Vertex& V2); - + TopoDS_Edge GetEdgeByVertices( SMESH_Mesh* aMesh, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2); + /*! * \brief Return another face sharing an edge * \param edgeToFaces - data map of descendants to ancestors */ - static TopoDS_Face GetNextFace( const TAncestorMap& edgeToFaces, - const TopoDS_Edge& edge, - const TopoDS_Face& face); + TopoDS_Face GetNextFace( const TAncestorMap& edgeToFaces, + const TopoDS_Edge& edge, + const TopoDS_Face& face); /*! * \brief Return other vertex of an edge */ - static TopoDS_Vertex GetNextVertex(const TopoDS_Edge& edge, - const TopoDS_Vertex& vertex); + TopoDS_Vertex GetNextVertex(const TopoDS_Edge& edge, + const TopoDS_Vertex& vertex); /*! * \brief Return an oriented propagation edge - * \param aMesh - mesh - * \param fromEdge - start edge for propagation - * \retval pair - propagation step and found edge + * \param aMesh - mesh + * \param fromEdge - start edge for propagation + * \retval pair - propagation step and found edge */ - static std::pair GetPropagationEdge( SMESH_Mesh* aMesh, - const TopoDS_Edge& anEdge, - const TopoDS_Edge& fromEdge); + std::pair GetPropagationEdge( SMESH_Mesh* aMesh, + const TopoDS_Edge& anEdge, + const TopoDS_Edge& fromEdge); /*! * \brief Find corresponding nodes on two faces - * \param face1 - the first face - * \param mesh1 - mesh containing elements on the first face - * \param face2 - the second face - * \param mesh2 - mesh containing elements on the second face - * \param assocMap - map associating sub-shapes of the faces - * \param nodeIn2OutMap - map containing found matching nodes - * \retval bool - is a success + * \param face1 - the first face + * \param mesh1 - mesh containing elements on the first face + * \param face2 - the second face + * \param mesh2 - mesh containing elements on the second face + * \param assocMap - map associating sub-shapes of the faces + * \param nodeIn2OutMap - map containing found matching nodes + * \retval bool - is a success */ - static bool FindMatchingNodesOnFaces( const TopoDS_Face& face1, - SMESH_Mesh* mesh1, - const TopoDS_Face& face2, - SMESH_Mesh* mesh2, - const TShapeShapeMap & assocMap, - TNodeNodeMap & nodeIn2OutMap); + bool FindMatchingNodesOnFaces( const TopoDS_Face& face1, + SMESH_Mesh* mesh1, + const TopoDS_Face& face2, + SMESH_Mesh* mesh2, + const TShapeShapeMap & assocMap, + TNodeNodeMap & nodeIn2OutMap); /*! * \brief Return any sub-shape of a face belonging to the outer wire - * \param face - the face - * \param type - type of sub-shape to return - * \retval TopoDS_Shape - the found sub-shape + * \param face - the face + * \param type - type of sub-shape to return + * \retval TopoDS_Shape - the found sub-shape */ - static TopoDS_Shape OuterShape( const TopoDS_Face& face, - TopAbs_ShapeEnum type); + TopoDS_Shape OuterShape( const TopoDS_Face& face, + TopAbs_ShapeEnum type); /*! * \brief Check that submeshis is computed and try to compute it if is not - * \param sm - submesh to compute - * \param iterationNb - int used to stop infinite recursive call - * \retval bool - true if computed + * \param sm - submesh to compute + * \param iterationNb - int used to stop infinite recursive call + * \retval bool - true if computed + */ + bool MakeComputed(SMESH_subMesh * sm, const int iterationNb = 0); + + /*! + * \brief Returns an error message to show in case if MakeComputed( sm ) fails. */ - static bool MakeComputed(SMESH_subMesh * sm, const int iterationNb = 0); + std::string SourceNotComputedError( SMESH_subMesh * sm = 0, + SMESH_Algo* projAlgo=0); /*! * \brief Set event listeners to submesh with projection algo - * \param subMesh - submesh with projection algo - * \param srcShape - source shape - * \param srcMesh - source mesh + * \param subMesh - submesh with projection algo + * \param srcShape - source shape + * \param srcMesh - source mesh */ - static void SetEventListener(SMESH_subMesh* subMesh, - TopoDS_Shape srcShape, - SMESH_Mesh* srcMesh); + void SetEventListener(SMESH_subMesh* subMesh, + TopoDS_Shape srcShape, + SMESH_Mesh* srcMesh); /*! * \brief Return a boundary EDGE (or all boundary EDGEs) of edgeContainer */ - static TopoDS_Edge GetBoundaryEdge(const TopoDS_Shape& edgeContainer, - const SMESH_Mesh& mesh, - std::list< TopoDS_Edge >* allBndEdges = 0 ); + TopoDS_Edge GetBoundaryEdge(const TopoDS_Shape& edgeContainer, + const SMESH_Mesh& mesh, + std::list< TopoDS_Edge >* allBndEdges = 0 ); }; #endif diff --git a/src/StdMeshers/StdMeshers_Projection_1D.cxx b/src/StdMeshers/StdMeshers_Projection_1D.cxx index 778b57c0e..a52ffe661 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D.cxx @@ -57,7 +57,8 @@ using namespace std; #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } -typedef StdMeshers_ProjectionUtils TAssocTool; +//typedef StdMeshers_ProjectionUtils TAssocTool; +namespace TAssocTool = StdMeshers_ProjectionUtils; //======================================================================= //function : StdMeshers_Projection_1D @@ -238,14 +239,18 @@ bool StdMeshers_Projection_1D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcEdge ); //SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( tgtEdge ); + string srcMeshError; if ( tgtMesh == srcMesh ) { if ( !TAssocTool::MakeComputed( srcSubMesh )) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); + srcMeshError = TAssocTool::SourceNotComputedError( srcSubMesh, this ); } else { if ( !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); + srcMeshError = TAssocTool::SourceNotComputedError(); } + if ( !srcMeshError.empty() ) + return error(COMPERR_BAD_INPUT_MESH, srcMeshError ); + // ----------------------------------------------- // Find out nodes distribution on the source edge // ----------------------------------------------- diff --git a/src/StdMeshers/StdMeshers_Projection_1D2D.cxx b/src/StdMeshers/StdMeshers_Projection_1D2D.cxx index f9fe63dc3..73feed3cc 100644 --- a/src/StdMeshers/StdMeshers_Projection_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_1D2D.cxx @@ -199,7 +199,7 @@ bool StdMeshers_Projection_1D2D::Evaluate(SMESH_Mesh& theMesh, if ( !srcMesh ) srcMesh = & theMesh; SMESH_subMesh* srcFaceSM = srcMesh->GetSubMesh( srcFace ); - typedef StdMeshers_ProjectionUtils SPU; + namespace SPU = StdMeshers_ProjectionUtils; SPU::TShapeShapeMap shape2ShapeMap; SPU::InitVertexAssociation( _sourceHypo, shape2ShapeMap ); if ( !SPU::FindSubShapeAssociation( theShape, &theMesh, srcFace, srcMesh, shape2ShapeMap)) diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 7467a19f9..9f1c2fcf6 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -62,7 +62,8 @@ using namespace std; #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } -typedef StdMeshers_ProjectionUtils TAssocTool; +namespace TAssocTool = StdMeshers_ProjectionUtils; +//typedef StdMeshers_ProjectionUtils TAssocTool; //======================================================================= //function : StdMeshers_Projection_2D @@ -824,14 +825,17 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcFace ); SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( tgtFace ); + string srcMeshError; if ( tgtMesh == srcMesh ) { - if ( !TAssocTool::MakeComputed( srcSubMesh ) || !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); + if ( !TAssocTool::MakeComputed( srcSubMesh )) + srcMeshError = TAssocTool::SourceNotComputedError( srcSubMesh, this ); } else { if ( !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); + srcMeshError = TAssocTool::SourceNotComputedError(); } + if ( !srcMeshError.empty() ) + return error(COMPERR_BAD_INPUT_MESH, srcMeshError ); // =========== // Projection @@ -861,15 +865,15 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& done = projectBy2DSimilarity( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap, is1DComputed); } + SMESH_MesherHelper helper( theMesh ); + helper.SetSubShape( tgtFace ); + if ( !done ) { // -------------------- // Prepare to mapping // -------------------- - SMESH_MesherHelper helper( theMesh ); - helper.SetSubShape( tgtFace ); - // Check if node projection to a face is needed Bnd_B2d uvBox; SMDS_ElemIteratorPtr faceIt = srcSubMesh->GetSubMeshDS()->GetElements(); @@ -1182,7 +1186,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& } } // Fix orientation - if ( SMESH_Algo::IsReversedSubMesh( face, meshDS )) + if ( helper.IsReversedSubMesh( face )) { SMESH_MeshEditor editor( tgtMesh ); SMDS_ElemIteratorPtr eIt = meshDS->MeshElements( face )->GetElements(); diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index 7c07b40f3..cf42d5d41 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -57,7 +57,7 @@ // cout << msg << " ("<< p.X() << "; " <GetSubMesh( _sourceHypo->GetSource3DShape() ); //SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( aShape ); - if ( tgtMesh == srcMesh && !aShape.IsSame( _sourceHypo->GetSource3DShape() )) { + string srcMeshError; + if ( tgtMesh == srcMesh && !aShape.IsSame( _sourceHypo->GetSource3DShape() )) { if ( !TAssocTool::MakeComputed( srcSubMesh )) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); + srcMeshError = TAssocTool::SourceNotComputedError( srcSubMesh, this ); } else { if ( !srcSubMesh->IsMeshComputed() ) - return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); + srcMeshError = TAssocTool::SourceNotComputedError(); } // Find 2 pairs of corresponding vertices diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index 4c96220ea..54c3b7609 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -756,7 +756,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, { bool isRev = false; if ( helper.NbAncestors( aShapeFace, aMesh, aShape.ShapeType() ) > 1 ) - isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS ); + isRev = helper.IsReversedSubMesh( TopoDS::Face(aShapeFace) ); SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); while ( iteratorElem->more() ) // loop on elements on a geometrical face diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index ec34a041c..143f58e7a 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -67,7 +67,7 @@ using namespace std; #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } #define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z()) -typedef StdMeshers_ProjectionUtils TAssocTool; +namespace TAssocTool = StdMeshers_ProjectionUtils; //======================================================================= //function : StdMeshers_RadialPrism_3D diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index a855c24a3..124b61e1e 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -1096,7 +1096,7 @@ bool _ViscousBuilder::findFacesWithLayers() { _ignoreShapeIds.insert( faceInd ); ignoreFaces.push_back( exp.Current() ); - if ( SMESH_Algo::IsReversedSubMesh( TopoDS::Face( exp.Current() ), getMeshDS())) + if ( helper.IsReversedSubMesh( TopoDS::Face( exp.Current() ))) _sdVec[i]._reversedFaceIds.insert( faceInd ); } } @@ -2074,7 +2074,7 @@ bool _ViscousBuilder::inflate(_SolidData& data) { if ( data._edges[i]->IsOnEdge() ) continue; data._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon ); - if ( geomSize > intersecDist ) + if ( geomSize > intersecDist && intersecDist > 0 ) geomSize = intersecDist; } if ( data._stepSize > 0.3 * geomSize ) @@ -4480,7 +4480,7 @@ bool _ViscousBuilder::addBoundaryElements() reverse = ( helper.GetSubShapeOri( F, E ) == TopAbs_REVERSED ); if ( helper.GetSubShapeOri( data._solid, F ) == TopAbs_REVERSED ) reverse = !reverse, F.Reverse(); - if ( SMESH_Algo::IsReversedSubMesh( TopoDS::Face(F), getMeshDS() )) + if ( helper.IsReversedSubMesh( TopoDS::Face(F) )) reverse = !reverse; } else diff --git a/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx b/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx index 4e4d0ed8e..af1dcae60 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx @@ -442,7 +442,7 @@ StdMeshers_ViscousLayers2D::Compute(SMESH_Mesh& theMesh, theMesh.GetSubMesh( theFace )->GetComputeError() = error; else if ( !pm ) pm.reset( new SMESH_ProxyMesh( theMesh )); - if ( getenv("ONLY_VL2D")) + if ( getenv("__ONLY__VL2D__")) pm.reset(); } else @@ -1834,13 +1834,14 @@ bool _ViscousBuilder2D::refine() normPar[ i - L._firstPntInd ] = ( points[i].normParam - normF ) / normDist; // Create layers of faces - + bool hasLeftNode = ( !L._leftLine->_rightNodes.empty() && leftEdgeShared ); bool hasRightNode = ( !L._rightLine->_leftNodes.empty() && rightEdgeShared ); bool hasOwnLeftNode = ( !L._leftNodes.empty() ); bool hasOwnRightNode = ( !L._rightNodes.empty() ); + bool isClosedEdge = ( outerNodes.front() == outerNodes.back() ); size_t iS, - iN0 = ( hasLeftNode || hasOwnLeftNode || _polyLineVec.size() == 1 ), + iN0 = ( hasLeftNode || hasOwnLeftNode || isClosedEdge ), nbN = innerNodes.size() - ( hasRightNode || hasOwnRightNode ); L._leftNodes .reserve( _hyp->GetNumberLayers() ); L._rightNodes.reserve( _hyp->GetNumberLayers() ); @@ -1872,7 +1873,7 @@ bool _ViscousBuilder2D::refine() else if ( hasLeftNode ) innerNodes.front() = L._leftLine->_rightNodes[ iF ]; if ( hasOwnRightNode ) innerNodes.back() = L._rightNodes[ iF ]; else if ( hasRightNode ) innerNodes.back() = L._rightLine->_leftNodes[ iF ]; - if ( _polyLineVec.size() == 1 ) innerNodes.front() = innerNodes.back(); // circle + if ( isClosedEdge ) innerNodes.front() = innerNodes.back(); // circle if ( !hasOwnLeftNode ) L._leftNodes.push_back( innerNodes.front() ); if ( !hasOwnRightNode ) L._rightNodes.push_back( innerNodes.back() ); -- 2.39.2