]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Merge from V6_main 11/02/2013
authorvsr <vsr@opencascade.com>
Tue, 12 Feb 2013 14:37:44 +0000 (14:37 +0000)
committervsr <vsr@opencascade.com>
Tue, 12 Feb 2013 14:37:44 +0000 (14:37 +0000)
319 files changed:
configure.ac
doc/salome/Makefile.am
doc/salome/examples/3dmesh.py [new file with mode: 0644]
doc/salome/examples/Makefile.am [new file with mode: 0644]
doc/salome/examples/cartesian_algo.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex02.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex03.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex04.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex05.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex06.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex07.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex08.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex01.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex02.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex03.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex04.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex05.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex06.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex07.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex08.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex09.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex10.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex11.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex12.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex13.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex14.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex15.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex16.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex17.py [new file with mode: 0644]
doc/salome/examples/filters_ex01.py [new file with mode: 0644]
doc/salome/examples/filters_ex02.py [new file with mode: 0644]
doc/salome/examples/filters_ex03.py [new file with mode: 0644]
doc/salome/examples/filters_ex04.py [new file with mode: 0644]
doc/salome/examples/filters_ex05.py [new file with mode: 0644]
doc/salome/examples/filters_ex06.py [new file with mode: 0644]
doc/salome/examples/filters_ex07.py [new file with mode: 0644]
doc/salome/examples/filters_ex08.py [new file with mode: 0644]
doc/salome/examples/filters_ex09.py [new file with mode: 0644]
doc/salome/examples/filters_ex10.py [new file with mode: 0644]
doc/salome/examples/filters_ex11.py [new file with mode: 0644]
doc/salome/examples/filters_ex12.py [new file with mode: 0644]
doc/salome/examples/filters_ex13.py [new file with mode: 0644]
doc/salome/examples/filters_ex14.py [new file with mode: 0644]
doc/salome/examples/filters_ex15.py [new file with mode: 0644]
doc/salome/examples/filters_ex16.py [new file with mode: 0644]
doc/salome/examples/filters_ex17.py [new file with mode: 0644]
doc/salome/examples/filters_ex18.py [new file with mode: 0644]
doc/salome/examples/filters_ex19.py [new file with mode: 0644]
doc/salome/examples/filters_ex20.py [new file with mode: 0644]
doc/salome/examples/filters_ex21.py [new file with mode: 0644]
doc/salome/examples/filters_ex22.py [new file with mode: 0644]
doc/salome/examples/filters_ex23.py [new file with mode: 0644]
doc/salome/examples/filters_ex24.py [new file with mode: 0644]
doc/salome/examples/filters_ex25.py [new file with mode: 0644]
doc/salome/examples/filters_ex26.py [new file with mode: 0644]
doc/salome/examples/filters_ex27.py [new file with mode: 0644]
doc/salome/examples/filters_ex28.py [new file with mode: 0644]
doc/salome/examples/filters_ex29.py [new file with mode: 0644]
doc/salome/examples/filters_ex30.py [new file with mode: 0644]
doc/salome/examples/filters_ex31.py [new file with mode: 0644]
doc/salome/examples/filters_ex32.py [new file with mode: 0644]
doc/salome/examples/filters_ex33.py [new file with mode: 0644]
doc/salome/examples/filters_ex34.py [new file with mode: 0644]
doc/salome/examples/filters_ex35.py [new file with mode: 0644]
doc/salome/examples/filters_ex36.py [new file with mode: 0644]
doc/salome/examples/generate_flat_elements.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex01.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex02.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex03.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex04.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex05.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex06.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex07.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex08.py [new file with mode: 0644]
doc/salome/examples/measurements_ex01.py [new file with mode: 0644]
doc/salome/examples/measurements_ex02.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex02.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex03.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex04.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex05.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex06.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex07.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex08.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex09.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex10.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex11.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex12.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex13.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex14.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex15.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex16.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex17.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex18.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex19.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex20.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex21.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex22.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex23.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex24.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex25.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex26.py [new file with mode: 0644]
doc/salome/examples/notebook_smesh.py [new file with mode: 0644]
doc/salome/examples/prism_3d_algo.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex01.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex02.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex03.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex04.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex05.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex06.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex07.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex08.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex09.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex10.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex11.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex12.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex13.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex14.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex15.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex16.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex17.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex18.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex19.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex20.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex21.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex22.py [new file with mode: 0644]
doc/salome/examples/testme.py [new file with mode: 0755]
doc/salome/examples/transforming_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex02.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex03.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex04.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex05.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex06.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex07.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex08.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex09.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex10.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex11.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex12.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex13.py [new file with mode: 0644]
doc/salome/examples/use_existing_faces.py [new file with mode: 0644]
doc/salome/examples/viewing_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/viewing_meshes_ex02.py [new file with mode: 0644]
doc/salome/gui/SMESH/doxyfile.in
doc/salome/gui/SMESH/images/addinfo_group.png
doc/salome/gui/SMESH/images/addinfo_mesh.png
doc/salome/gui/SMESH/images/addinfo_submesh.png
doc/salome/gui/SMESH/images/advanced_mesh_infos.png
doc/salome/gui/SMESH/images/eleminfo1.png
doc/salome/gui/SMESH/images/eleminfo2.png
doc/salome/gui/SMESH/images/pref21.png
doc/salome/gui/SMESH/images/prism_needs_hyps.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/prism_ok_ko.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/prism_stack.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/prism_tui_sample.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/scalar_bar_dlg.png
doc/salome/gui/SMESH/input/about_hypo.doc
doc/salome/gui/SMESH/input/about_meshes.doc
doc/salome/gui/SMESH/input/basic_meshing_algos.doc
doc/salome/gui/SMESH/input/constructing_submeshes.doc
doc/salome/gui/SMESH/input/extrusion.doc
doc/salome/gui/SMESH/input/mesh_infos.doc
doc/salome/gui/SMESH/input/mesh_preferences.doc
doc/salome/gui/SMESH/input/prism_3d_algo.doc
doc/salome/gui/SMESH/input/projection_algos.doc
doc/salome/gui/SMESH/input/scalar_bar.doc
doc/salome/gui/SMESH/input/smeshpy_interface.doc
doc/salome/gui/SMESH/input/tui_cartesian_algo.doc
doc/salome/gui/SMESH/input/tui_creating_meshes.doc
doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc
doc/salome/gui/SMESH/input/tui_filters.doc
doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc
doc/salome/gui/SMESH/input/tui_grouping_elements.doc
doc/salome/gui/SMESH/input/tui_measurements.doc
doc/salome/gui/SMESH/input/tui_modifying_meshes.doc
doc/salome/gui/SMESH/input/tui_notebook_smesh.doc
doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc [new file with mode: 0644]
doc/salome/gui/SMESH/input/tui_quality_controls.doc
doc/salome/gui/SMESH/input/tui_transforming_meshes.doc
doc/salome/gui/SMESH/input/tui_use_existing_faces.doc
doc/salome/gui/SMESH/input/tui_viewing_meshes.doc
doc/salome/gui/SMESH/input/use_existing_algos.doc
idl/SMESH_Filter.idl
idl/SMESH_Mesh.idl
resources/SalomeApp.xml.in
src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_ControlsDef.hxx
src/Driver/Driver_Mesh.h
src/DriverGMF/libmesh5.c
src/DriverGMF/libmesh5.h
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/Makefile.am
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_ActorUtils.cxx
src/OBJECT/SMESH_ActorUtils.h
src/OBJECT/SMESH_CellLabelActor.cxx
src/OBJECT/SMESH_CellLabelActor.h
src/OBJECT/SMESH_DeviceActor.cxx
src/OBJECT/SMESH_NodeLabelActor.cxx
src/OBJECT/SMESH_NodeLabelActor.h
src/OBJECT/SMESH_Object.cxx
src/OBJECT/SMESH_Object.h
src/OBJECT/SMESH_ObjectDef.h
src/OBJECT/SMESH_PreviewActorsCollection.cxx
src/OBJECT/SMESH_SVTKActor.cxx
src/PluginUtils/GeomSelectionTools.cxx
src/SMDS/ObjectPool.hxx
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_MeshGroup.cxx
src/SMDS/SMDS_MeshGroup.hxx
src/SMDS/SMDS_MeshNode.cxx
src/SMDS/SMDS_UnstructuredGrid.cxx
src/SMDS/SMDS_UnstructuredGrid.hxx
src/SMDS/SMDS_VtkEdge.cxx
src/SMDS/SMDS_VtkEdge.hxx
src/SMESH/Makefile.am
src/SMESH/SMESH_Algo.cxx
src/SMESH/SMESH_Algo.hxx
src/SMESH/SMESH_Gen.cxx
src/SMESH/SMESH_Hypothesis.cxx
src/SMESH/SMESH_Hypothesis.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx
src/SMESH/SMESH_Pattern.cxx
src/SMESH/SMESH_Pattern.hxx
src/SMESH/SMESH_subMesh.cxx
src/SMESH/SMESH_subMesh.hxx
src/SMESH/memoire.h
src/SMESHDS/SMESHDS_Document.cxx
src/SMESHDS/SMESHDS_Document.hxx
src/SMESHDS/SMESHDS_GroupOnFilter.cxx
src/SMESHDS/SMESHDS_GroupOnFilter.hxx
src/SMESHDS/SMESHDS_SubMesh.cxx
src/SMESHDS/SMESH_Controls.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h
src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_MergeDlg.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx
src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts
src/SMESHUtils/Makefile.am
src/SMESHUtils/SMESH_Block.cxx
src/SMESHUtils/SMESH_Block.hxx
src/SMESHUtils/SMESH_TryCatch.cxx [new file with mode: 0644]
src/SMESHUtils/SMESH_TryCatch.hxx [new file with mode: 0644]
src/SMESHUtils/SMESH_TypeDefs.hxx
src/SMESH_I/Makefile.am
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_Group_i.cxx
src/SMESH_I/SMESH_Group_i.hxx
src/SMESH_I/SMESH_Hypothesis_i.cxx
src/SMESH_I/SMESH_MEDMesh_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_NoteBook.cxx
src/SMESH_I/SMESH_PreMeshInfo.cxx
src/SMESH_I/SMESH_PreMeshInfo.hxx
src/SMESH_I/smeshpy.py [deleted file]
src/SMESH_SWIG/smeshDC.py
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx
src/StdMeshers/StdMeshers_Cartesian_3D.cxx
src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx
src/StdMeshers/StdMeshers_FaceSide.cxx
src/StdMeshers/StdMeshers_FaceSide.hxx
src/StdMeshers/StdMeshers_Hexa_3D.cxx
src/StdMeshers/StdMeshers_Prism_3D.cxx
src/StdMeshers/StdMeshers_Prism_3D.hxx
src/StdMeshers/StdMeshers_ProjectionSource2D.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.hxx
src/StdMeshers/StdMeshers_Projection_1D2D.cxx
src/StdMeshers/StdMeshers_Projection_2D.cxx
src/StdMeshers/StdMeshers_Projection_3D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.hxx
src/StdMeshers/StdMeshers_RadialPrism_3D.cxx
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx
src/StdMeshers_I/StdMeshers_ImportSource1D_i.cxx
src/StdMeshers_I/StdMeshers_ImportSource2D_i.cxx
src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx
src/StdMeshers_I/StdMeshers_ObjRefUlils.cxx
src/Tools/MeshCut/MeshCut_Maillage.cxx
src/Tools/YamsPlug/monYamsPlugDialog.py
src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx
src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx
src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx

index c45c59f18cbc99bca270feb7652dfb9ae35b8cfd..98147ad5870864b28081da3d3db898c7e81c1e55 100644 (file)
@@ -537,6 +537,7 @@ AC_OUTPUT([ \
   doc/docutils/Makefile \
   doc/docutils/conf.py \
   doc/salome/Makefile \
+  doc/salome/examples/Makefile \
   doc/salome/gui/Makefile \
   doc/salome/gui/SMESH/Makefile \
   doc/salome/gui/SMESH/doxyfile \
index 8bf9f392d938f95a5f3a183a5526b993547d42d4..10bcc3f2528a8488e8c94a6ccb5fc4aad204b46b 100644 (file)
@@ -23,7 +23,7 @@
 #  Modified by : Alexander BORODIN (OCN) - autotools usage
 # $Header:
 #
-SUBDIRS = tui gui
+SUBDIRS = tui gui examples
 SUBDIRSTUI = tui
 SUBDIRSGUI = gui
 
diff --git a/doc/salome/examples/3dmesh.py b/doc/salome/examples/3dmesh.py
new file mode 100644 (file)
index 0000000..bd6d3b4
--- /dev/null
@@ -0,0 +1,72 @@
+# 3d mesh generation
+
+from geompy import * 
+import smesh 
+
+###
+# Geometry: an assembly of a box, a cylinder and a truncated cone
+# meshed with tetrahedral 
+###
+
+# Define values
+name = "ex21_lamp" 
+cote = 60 
+section = 20 
+size = 200 
+radius_1 = 80 
+radius_2 = 40 
+height = 100 
+
+# Build a box
+box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) 
+
+# Build a cylinder
+pt1 = MakeVertex(0, 0, cote/3) 
+di1 = MakeVectorDXDYDZ(0, 0, 1) 
+cyl = MakeCylinder(pt1, di1, section, size) 
+
+# Build a truncated cone
+pt2 = MakeVertex(0, 0, size) 
+cone = MakeCone(pt2, di1, radius_1, radius_2, height) 
+
+# Fuse
+box_cyl = MakeFuse(box, cyl) 
+piece = MakeFuse(box_cyl, cone) 
+
+# Add to the study
+addToStudy(piece, name) 
+
+# Create a group of faces
+group = CreateGroup(piece, ShapeType["FACE"]) 
+group_name = name + "_grp" 
+addToStudy(group, group_name) 
+group.SetName(group_name) 
+
+# Add faces to the group
+faces = SubShapeAllIDs(piece, ShapeType["FACE"]) 
+UnionIDs(group, faces) 
+
+###
+# Create a mesh
+###
+
+# Define a mesh on a geometry
+tetra = smesh.Mesh(piece, name) 
+
+# Define 1D hypothesis
+algo1d = tetra.Segment() 
+algo1d.LocalLength(10) 
+
+# Define 2D hypothesis
+algo2d = tetra.Triangle() 
+algo2d.LengthFromEdges() 
+
+# Define 3D hypothesis
+algo3d = tetra.Tetrahedron()
+algo3d.MaxElementVolume(100) 
+
+# Compute the mesh
+tetra.Compute() 
+
+# Create a groupe of faces
+tetra.Group(group)
diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am
new file mode 100644 (file)
index 0000000..930edd9
--- /dev/null
@@ -0,0 +1,180 @@
+# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#  File   : Makefile
+#  Author : Alexander KOVALEV (Open Cascade NN)
+#  Modified by : 
+#  Module : doc
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+pyexamplesdir = $(docdir)/examples/SMESH
+
+BAD_TESTS = 
+
+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 \
+       defining_hypotheses_ex01.py \
+       defining_hypotheses_ex02.py \
+       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 \
+       defining_hypotheses_ex13.py \
+       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 \
+       filters_ex12.py \
+       filters_ex13.py \
+       filters_ex14.py \
+       filters_ex15.py \
+       filters_ex16.py \
+       filters_ex17.py \
+       filters_ex18.py \
+       filters_ex19.py \
+       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 \
+       grouping_elements_ex04.py \
+       grouping_elements_ex05.py \
+       grouping_elements_ex06.py \
+       grouping_elements_ex07.py \
+       grouping_elements_ex08.py \
+       measurements_ex01.py \
+       measurements_ex02.py \
+       modifying_meshes_ex01.py \
+       modifying_meshes_ex02.py \
+       modifying_meshes_ex03.py \
+       modifying_meshes_ex04.py \
+       modifying_meshes_ex05.py \
+       modifying_meshes_ex06.py \
+       modifying_meshes_ex07.py \
+       modifying_meshes_ex08.py \
+       modifying_meshes_ex09.py \
+       modifying_meshes_ex10.py \
+       modifying_meshes_ex11.py \
+       modifying_meshes_ex12.py \
+       modifying_meshes_ex13.py \
+       modifying_meshes_ex14.py \
+       modifying_meshes_ex15.py \
+       modifying_meshes_ex16.py \
+       modifying_meshes_ex17.py \
+       modifying_meshes_ex18.py \
+       modifying_meshes_ex19.py \
+       modifying_meshes_ex20.py \
+       modifying_meshes_ex21.py \
+       modifying_meshes_ex22.py \
+       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 \
+       quality_controls_ex10.py \
+       quality_controls_ex11.py \
+       quality_controls_ex12.py \
+       quality_controls_ex13.py \
+       quality_controls_ex14.py \
+       quality_controls_ex15.py \
+       quality_controls_ex16.py \
+       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 \
+       transforming_meshes_ex04.py \
+       transforming_meshes_ex05.py \
+       transforming_meshes_ex06.py \
+       transforming_meshes_ex07.py \
+       transforming_meshes_ex08.py \
+       transforming_meshes_ex09.py \
+       transforming_meshes_ex10.py \
+       transforming_meshes_ex11.py \
+       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:
+       @for f in $(GOOD_TESTS) ; do \
+         python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \
+       done
diff --git a/doc/salome/examples/cartesian_algo.py b/doc/salome/examples/cartesian_algo.py
new file mode 100644 (file)
index 0000000..b15455f
--- /dev/null
@@ -0,0 +1,42 @@
+# Usage of Body Fitting algorithm
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# create a sphere
+sphere = geompy.MakeSphereR( 50 )
+geompy.addToStudy( sphere, "sphere" )
+
+# create a mesh and assign a "Body Fitting" algo
+mesh = Mesh( sphere )
+cartAlgo = mesh.BodyFitted()
+
+# define a cartesian grid using Coordinates
+coords = range(-100,100,10)
+cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
+
+# compute the mesh
+mesh.Compute()
+print "nb hexahedra",mesh.NbHexas()
+print "nb tetrahedra",mesh.NbTetras()
+print "nb polyhedra",mesh.NbPolyhedrons()
+print
+
+# define the grid by setting constant spacing
+cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
+
+mesh.Compute()
+print "nb hexahedra",mesh.NbHexas()
+print "nb tetrahedra",mesh.NbTetras()
+print "nb polyhedra",mesh.NbPolyhedrons()
+
+
+# define the grid by setting different spacing in 2 sub-ranges of geometry
+spaceFuns = ["5","10+10*t"]
+cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
+
+mesh.Compute()
+print "nb hexahedra",mesh.NbHexas()
+print "nb tetrahedra",mesh.NbTetras()
+print "nb polyhedra",mesh.NbPolyhedrons()
+print
diff --git a/doc/salome/examples/creating_meshes_ex01.py b/doc/salome/examples/creating_meshes_ex01.py
new file mode 100644 (file)
index 0000000..0b93356
--- /dev/null
@@ -0,0 +1,28 @@
+# Construction of a Mesh
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments(7)
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea(800.)
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume(900.)
+
+# compute the mesh
+ret = tetra.Compute()
+if ret == 0:
+    print "problem when computing the mesh"
+else:
+    print "mesh computed"
+    pass
diff --git a/doc/salome/examples/creating_meshes_ex02.py b/doc/salome/examples/creating_meshes_ex02.py
new file mode 100644 (file)
index 0000000..c541b4a
--- /dev/null
@@ -0,0 +1,39 @@
+# Construction of a Submesh
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# select one edge of the box for definition of a local hypothesis
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
+
+# create a regular 1D algorithm for the faces
+algo1D = quadra.Segment()
+
+# define "NumberOfSegments" hypothesis to cut
+# all the edges in a fixed number of segments
+algo1D.NumberOfSegments(4)
+
+# create a quadrangle 2D algorithm for the faces
+quadra.Quadrangle()
+
+# construct a submesh on the edge with a local hypothesis
+algo_local = quadra.Segment(EdgeX)
+
+# define "Arithmetic1D" hypothesis to cut the edge in several segments with increasing arithmetic length
+algo_local.Arithmetic1D(1, 4)
+
+# define "Propagation" hypothesis that propagates all other hypotheses
+# on all edges of the opposite side in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+quadra.Compute()
diff --git a/doc/salome/examples/creating_meshes_ex03.py b/doc/salome/examples/creating_meshes_ex03.py
new file mode 100644 (file)
index 0000000..7b219f3
--- /dev/null
@@ -0,0 +1,57 @@
+# Change priority of submeshes in Mesh
+
+import salome
+import geompy
+import smesh
+import SMESH
+
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
+
+# create Mesh object on Box shape
+Mesh_1 = smesh.Mesh(Box_1)
+
+# assign mesh algorithms
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
+Nb_Segments_1.SetDistrType( 0 )
+MEFISTO_2D = Mesh_1.Triangle()
+Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200)
+Tetrahedron = Mesh_1.Tetrahedron()
+Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
+
+# create submesh and assign algorithms on Face_1
+Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
+Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
+Nb_Segments_2.SetDistrType( 0 )
+MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
+Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
+SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
+
+# create submesh and assign algorithms on Face_2
+Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
+Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
+Nb_Segments_3.SetDistrType( 0 )
+MEFISTO_2D_2 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_2)
+Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
+SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
+
+# create submesh and assign algorithms on Face_3
+Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
+Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
+Nb_Segments_4.SetDistrType( 0 )
+MEFISTO_2D_3 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_3)
+Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
+SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
+
+# check exisiting submesh priority order
+[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
+# set new submesh order
+isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
+# compute mesh
+isDone = Mesh_1.Compute()
+
+# clear mesh result and compute with other submesh order
+Mesh_1.Clear()
+isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
+isDone = Mesh_1.Compute()
diff --git a/doc/salome/examples/creating_meshes_ex04.py b/doc/salome/examples/creating_meshes_ex04.py
new file mode 100644 (file)
index 0000000..33106c7
--- /dev/null
@@ -0,0 +1,54 @@
+# Editing of a mesh
+
+import geompy
+import smesh
+
+def PrintMeshInfo(theMesh):
+    aMesh = theMesh.GetMesh()
+    print "Information about mesh:"
+    print "Number of nodes       : ", aMesh.NbNodes()
+    print "Number of edges       : ", aMesh.NbEdges()
+    print "Number of faces       : ", aMesh.NbFaces()
+    print "Number of volumes     : ", aMesh.NbVolumes()
+    pass
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
+geompy.addToStudy(box, "box")
+
+# select one edge of the box for definition of a local hypothesis
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
+edge = subShapeList[0]
+name = geompy.SubShapeName(edge, box)
+geompy.addToStudyInFather(box, edge, name)
+
+# create a mesh
+tria = smesh.Mesh(box, "Mesh 2D")
+algo1D = tria.Segment()
+hyp1 = algo1D.NumberOfSegments(3)
+algo2D = tria.Triangle()
+hyp2 = algo2D.MaxElementArea(10.)
+
+# create a sub-mesh
+algo_local = tria.Segment(edge)
+hyp3 = algo_local.Arithmetic1D(1, 6)
+hyp4 = algo_local.Propagation()
+
+# compute the mesh
+tria.Compute()
+PrintMeshInfo(tria)
+
+# remove a local hypothesis
+mesh = tria.GetMesh()
+mesh.RemoveHypothesis(edge, hyp4)
+
+# compute the mesh
+tria.Compute()
+PrintMeshInfo(tria)
+
+# change the value of the 2D hypothesis
+hyp2.SetMaxElementArea(2.)
+
+# compute the mesh
+tria.Compute()
+PrintMeshInfo(tria)
diff --git a/doc/salome/examples/creating_meshes_ex05.py b/doc/salome/examples/creating_meshes_ex05.py
new file mode 100644 (file)
index 0000000..6ba4103
--- /dev/null
@@ -0,0 +1,31 @@
+# Export of a Mesh
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments(7)
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea(800.)
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume(900.)
+
+# compute the mesh
+tetra.Compute()
+
+# export the mesh in a MED file
+tetra.ExportMED("/tmp/meshMED.med", 0)
+
+# export a group in a MED file
+face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
+group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
+tetra.ExportMED("/tmp/groupMED.med", meshPart=group)
diff --git a/doc/salome/examples/creating_meshes_ex06.py b/doc/salome/examples/creating_meshes_ex06.py
new file mode 100644 (file)
index 0000000..96b2a29
--- /dev/null
@@ -0,0 +1,106 @@
+# Creating a hexahedral mesh on a cylinder.
+# Note: it is a copy of 'ex24_cylinder.py' from SMESH_SWIG
+
+import math
+
+import geompy
+import smesh
+import salome
+geo = geompy
+
+# Parameters
+# ----------
+
+radius =  50
+height = 200
+
+# Build a cylinder
+# ----------------
+
+base = geo.MakeVertex(0, 0, 0)
+direction = geo.MakeVectorDXDYDZ(0, 0, 1)
+
+cylinder = geo.MakeCylinder(base, direction, radius, height)
+
+geo.addToStudy(cylinder, "cylinder")
+
+# Build blocks
+# ------------
+
+size = radius/2.0
+
+box_rot = geo.MakeBox(-size, -size, 0,  +size, +size, height)
+box_axis = geo.MakeLine(base, direction)
+box = geo.MakeRotation(box_rot, box_axis, math.pi/4)
+
+hole = geo.MakeCut(cylinder, box)
+
+plane_trim = 2000
+
+plane_a = geo.MakePlane(base, geo.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
+plane_b = geo.MakePlane(base, geo.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
+
+blocks_part = geo.MakePartition([hole], [plane_a, plane_b], [], [], geo.ShapeType["SOLID"])
+blocks_list = [box] + geo.SubShapeAll(blocks_part, geo.ShapeType["SOLID"])
+blocks_all = geo.MakeCompound(blocks_list)
+blocks = geo.MakeGlueFaces(blocks_all, 0.0001)
+
+geo.addToStudy(blocks, "cylinder:blocks")
+
+# Build geometric groups
+# ----------------------
+
+def group(name, shape, type, base=None, direction=None):
+    t = geo.ShapeType[type]
+    g = geo.CreateGroup(shape, t)
+
+    geo.addToStudy(g, name)
+    g.SetName(name)
+
+    if base!=None:
+        l = geo.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, geo.GEOM.ST_ON)
+        geo.UnionIDs(g, l)
+
+    return g
+
+group_a = group("baseA", blocks, "FACE", base, direction)
+
+base_b  = geo.MakeVertex(0, 0, height)
+group_b = group("baseB", blocks, "FACE", base_b, direction)
+
+group_1 = group("limit", blocks, "SOLID")
+group_1_all = geo.SubShapeAllIDs(blocks, geo.ShapeType["SOLID"])
+geo.UnionIDs(group_1, group_1_all)
+group_1_box = geo.GetBlockNearPoint(blocks, base)
+geo.DifferenceList(group_1, [group_1_box])
+
+# Mesh the blocks with hexahedral
+# -------------------------------
+
+smesh.SetCurrentStudy(salome.myStudy)
+
+def discretize(x, y, z,  n, s=blocks):
+    p = geo.MakeVertex(x, y, z)
+    e = geo.GetEdgeNearPoint(s, p)
+    a = hexa.Segment(e)
+    a.NumberOfSegments(n)
+    a.Propagation()
+
+hexa = smesh.Mesh(blocks)
+
+hexa_1d = hexa.Segment()
+hexa_1d.NumberOfSegments(1)
+
+discretize(+radius        , +radius,        0,   5)
+discretize(-radius        , +radius,        0,   8)
+discretize((radius+size)/2,       0,        0,  10)
+discretize(        +radius,       0, height/2,  20)
+
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+hexa.Compute()
+
+hexa.Group(group_a)
+hexa.Group(group_b)
+hexa.Group(group_1)
diff --git a/doc/salome/examples/creating_meshes_ex07.py b/doc/salome/examples/creating_meshes_ex07.py
new file mode 100644 (file)
index 0000000..3140ace
--- /dev/null
@@ -0,0 +1,73 @@
+# Building a compound of meshes
+# Note: it is a copy of 'SMESH_BuildCompound.py' from SMESH_SWIG
+
+import salome
+import geompy
+import smesh
+
+## create a bottom box
+Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
+
+# get a top face
+Psup1=geompy.MakeVertex(100., 100., 50.)
+Fsup1=geompy.GetFaceNearPoint(Box_inf, Psup1)
+# get a bottom face
+Pinf1=geompy.MakeVertex(100., 100., 0.)
+Finf1=geompy.GetFaceNearPoint(Box_inf, Pinf1)
+
+## create a top box
+Box_sup = geompy.MakeBox(100., 100., 50., 200., 200., 100.)
+
+# get a top face
+Psup2=geompy.MakeVertex(150., 150., 100.)
+Fsup2=geompy.GetFaceNearPoint(Box_sup, Psup2)
+# get a bottom face
+Pinf2=geompy.MakeVertex(150., 150., 50.)
+Finf2=geompy.GetFaceNearPoint(Box_sup, Pinf2)
+
+## Publish in the study
+geompy.addToStudy(Box_inf, "Box_inf")
+geompy.addToStudyInFather(Box_inf, Fsup1, "Fsup")
+geompy.addToStudyInFather(Box_inf, Finf1, "Finf")
+
+geompy.addToStudy(Box_sup, "Box_sup")
+geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup")
+geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
+
+smesh.SetCurrentStudy(salome.myStudy)
+
+## create a bottom mesh
+Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
+algo1D_1=Mesh_inf.Segment()
+algo1D_1.NumberOfSegments(10)
+algo2D_1=Mesh_inf.Quadrangle()
+algo3D_1=Mesh_inf.Hexahedron()
+Mesh_inf.Compute()
+
+# create a group on the top face
+Gsup1=Mesh_inf.Group(Fsup1, "Sup")
+# create a group on the bottom face
+Ginf1=Mesh_inf.Group(Finf1, "Inf")
+
+## create a top mesh
+Mesh_sup = smesh.Mesh(Box_sup, "Mesh_sup")
+algo1D_2=Mesh_sup.Segment()
+algo1D_2.NumberOfSegments(5)
+algo2D_2=Mesh_sup.Quadrangle()
+algo3D_2=Mesh_sup.Hexahedron()
+Mesh_sup.Compute()
+
+# create a group on the top face
+Gsup2=Mesh_sup.Group(Fsup2, "Sup")
+# create a group on the bottom face
+Ginf2=Mesh_sup.Group(Finf2, "Inf")
+
+## create compounds
+# create a compound of two meshes with renaming groups with the same names and
+# merging of elements with the given tolerance
+Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
+smesh.SetName(Compound1, 'Compound_with_RenamedGrps_and_MergeElems')
+# create a compound of two meshes with uniting groups with the same names and
+# creating groups of all elements
+Compound2 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
+smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
diff --git a/doc/salome/examples/creating_meshes_ex08.py b/doc/salome/examples/creating_meshes_ex08.py
new file mode 100644 (file)
index 0000000..a76e8d1
--- /dev/null
@@ -0,0 +1,40 @@
+# Mesh Copying
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# make geometry of a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
+
+# generate 3D mesh
+mesh = Mesh(box)
+localAlgo = mesh.Triangle(face)
+mesh.AutomaticHexahedralization()
+
+# objects to copy
+fGroup = mesh.GroupOnGeom( face, "2D on face")
+nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
+subMesh = localAlgo.GetSubMesh()
+
+# make a new mesh by copying different parts of the mesh
+
+# 1. copy the whole mesh
+newMesh = CopyMesh( mesh, "whole mesh copy")
+
+# 2. copy a group of 2D elements along with groups
+newMesh = CopyMesh( fGroup,  "face group copy with groups",toCopyGroups=True)
+
+# 3. copy a group of nodes with preseving their ids
+newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
+
+# 4. copy some faces
+faceIds = fGroup.GetIDs()[-10:]
+newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
+
+# 5. copy some nodes
+nodeIds = nGroup.GetIDs()[-10:]
+newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
+
+# 6. copy a sub-mesh
+newMesh = CopyMesh( subMesh, "submesh copy" )
diff --git a/doc/salome/examples/defining_hypotheses_ex01.py b/doc/salome/examples/defining_hypotheses_ex01.py
new file mode 100644 (file)
index 0000000..6efb1cf
--- /dev/null
@@ -0,0 +1,30 @@
+# Arithmetic 1D
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# create a Regular 1D algorithm for edges
+algo1D = hexa.Segment()
+
+# optionally reverse node distribution on certain edges
+allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
+reversedEdges = [ allEdges[0], allEdges[4] ]
+
+# define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
+algo1D.Arithmetic1D(1, 4, reversedEdges)
+
+# create a quadrangle 2D algorithm for faces
+hexa.Quadrangle()
+
+# create a hexahedron 3D algorithm for solids
+hexa.Hexahedron()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex02.py b/doc/salome/examples/defining_hypotheses_ex02.py
new file mode 100644 (file)
index 0000000..b0726a1
--- /dev/null
@@ -0,0 +1,40 @@
+# Deflection 1D and Number of Segments
+
+import geompy
+import smesh
+
+# create a face from arc and straight segment
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+exy = geompy.MakeEdge(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+wire = geompy.MakeWire([exy, arc])
+
+isPlanarFace = 1
+face1 = geompy.MakeFace(wire, isPlanarFace)
+geompy.addToStudy(face1,"Face1")
+
+# get edges from the face
+e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
+geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
+
+# create hexahedral mesh
+hexa = smesh.Mesh(face1, "Face : triangle mesh")
+
+# define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
+algo1D = hexa.Segment()
+algo1D.NumberOfSegments(6)
+
+# define "MaxElementArea" hypothesis
+algo2D = hexa.Triangle()
+algo2D.MaxElementArea(70.0)
+
+# define a local "Deflection1D" hypothesis on the arc
+algo_local = hexa.Segment(e_arc)
+algo_local.Deflection1D(1.0)
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex03.py b/doc/salome/examples/defining_hypotheses_ex03.py
new file mode 100644 (file)
index 0000000..cfb1ca8
--- /dev/null
@@ -0,0 +1,37 @@
+# Start and End Length
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# get one edge of the box to put local hypothesis on
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# set algorithms
+algo1D = hexa.Segment()
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+# define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
+algo1D.NumberOfSegments(4)
+
+# create a local hypothesis
+algo_local = hexa.Segment(EdgeX)
+
+# define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
+algo_local.StartEndLength(1, 6)
+
+# define "Propagation" hypothesis that propagates all other hypothesis
+# on all edges on the opposite side in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex04.py b/doc/salome/examples/defining_hypotheses_ex04.py
new file mode 100644 (file)
index 0000000..0a17f5c
--- /dev/null
@@ -0,0 +1,37 @@
+# Local Length
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# get one edge of the box to put local hypothesis on
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# set algorithms
+algo1D = hexa.Segment()
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+# define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
+algo1D.NumberOfSegments(4)
+
+# create a sub-mesh
+algo_local = hexa.Segment(EdgeX)
+
+# define "LocalLength" hypothesis to cut an edge in several segments with the same length
+algo_local.LocalLength(2.)
+
+# define "Propagation" hypothesis that propagates all other hypothesis
+# on all edges on the opposite side in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex05.py b/doc/salome/examples/defining_hypotheses_ex05.py
new file mode 100644 (file)
index 0000000..fcf03d0
--- /dev/null
@@ -0,0 +1,38 @@
+# Maximum Element Area
+
+import geompy
+import smesh
+import salome 
+
+# create a face
+px   = geompy.MakeVertex(100., 0.  , 0.  )
+py   = geompy.MakeVertex(0.  , 100., 0.  )
+pz   = geompy.MakeVertex(0.  , 0.  , 100.)
+
+vxy = geompy.MakeVector(px, py)
+arc = geompy.MakeArc(py, pz, px)
+wire = geompy.MakeWire([vxy, arc])
+
+isPlanarFace = 1
+face = geompy.MakeFace(wire, isPlanarFace)
+
+# add the face in the study
+id_face = geompy.addToStudy(face, "Face to be meshed")
+
+# create a mesh
+tria_mesh = smesh.Mesh(face, "Face : triangulation")
+
+# define 1D meshing:
+algo = tria_mesh.Segment()
+algo.NumberOfSegments(20)
+
+# define 2D meshing:
+
+# assign triangulation algorithm
+algo = tria_mesh.Triangle()
+
+# apply "Max Element Area" hypothesis to each triangle
+algo.MaxElementArea(100)
+
+# compute the mesh
+tria_mesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex06.py b/doc/salome/examples/defining_hypotheses_ex06.py
new file mode 100644 (file)
index 0000000..24bc4da
--- /dev/null
@@ -0,0 +1,30 @@
+# Maximum Element Volume
+
+import geompy
+import smesh
+
+# create a cylinder
+cyl = geompy.MakeCylinderRH(30., 50.)
+geompy.addToStudy(cyl, "cyl")
+
+# create a mesh on the cylinder
+tetra = smesh.Mesh(cyl, "Cylinder : tetrahedrical mesh")
+
+# assign algorithms
+algo1D = tetra.Segment()
+algo2D = tetra.Triangle()
+algo3D = tetra.Tetrahedron()
+
+# assign 1D and 2D hypotheses
+algo1D.NumberOfSegments(7)
+algo2D.MaxElementArea(150.)
+
+# assign Max Element Volume hypothesis
+algo3D.MaxElementVolume(200.)
+
+# compute the mesh
+ret = tetra.Compute()
+if ret == 0:
+    print "probleme when computing the mesh"
+else:
+    print "Computation succeded"
diff --git a/doc/salome/examples/defining_hypotheses_ex07.py b/doc/salome/examples/defining_hypotheses_ex07.py
new file mode 100644 (file)
index 0000000..59d7521
--- /dev/null
@@ -0,0 +1,29 @@
+# Length from Edges
+
+import geompy
+import smesh
+
+# create sketchers
+sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
+sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
+
+# create a face from two wires
+isPlanarFace = 1
+face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
+geompy.addToStudy(face1, "Face1")
+
+# create a mesh
+tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
+
+# Define 1D meshing
+algo1D = tria.Segment()
+algo1D.NumberOfSegments(2)
+
+# create and assign the algorithm for 2D meshing with triangles
+algo2D = tria.Triangle()
+
+# create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
+algo2D.LengthFromEdges()
+
+# compute the mesh
+tria.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex08.py b/doc/salome/examples/defining_hypotheses_ex08.py
new file mode 100644 (file)
index 0000000..4387734
--- /dev/null
@@ -0,0 +1,35 @@
+# Propagation
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# get one edge of the box to put local hypothesis on
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# set global algorithms and hypotheses
+algo1D = hexa.Segment()
+hexa.Quadrangle()
+hexa.Hexahedron()
+algo1D.NumberOfSegments(4)
+
+# create a sub-mesh with local 1D hypothesis and propagation
+algo_local = hexa.Segment(EdgeX)
+
+# define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
+algo_local.Arithmetic1D(1, 4)
+
+# define "Propagation" hypothesis that propagates all other 1D hypotheses
+# from all edges on the opposite side of a face in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex09.py b/doc/salome/examples/defining_hypotheses_ex09.py
new file mode 100644 (file)
index 0000000..9956e4b
--- /dev/null
@@ -0,0 +1,45 @@
+# Defining Meshing Algorithms
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
+
+# 1. Create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# create a Regular 1D algorithm for edges
+algo1D = hexa.Segment()
+
+# create a quadrangle 2D algorithm for faces
+algo2D = hexa.Quadrangle()
+
+# create a hexahedron 3D algorithm for solids
+algo3D = hexa.Hexahedron()
+
+# define hypotheses
+algo1D.Arithmetic1D(1, 4)
+
+# compute the mesh
+hexa.Compute()
+
+# 2. Create a tetrahedral mesh on the box
+tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
+
+# create a Regular 1D algorithm for edges
+algo1D = tetra.Segment()
+
+# create a Mefisto 2D algorithm for faces
+algo2D = tetra.Triangle()
+
+# create a 3D algorithm for solids
+algo3D = tetra.Tetrahedron()
+
+# define hypotheses
+algo1D.Arithmetic1D(1, 4)
+algo2D.LengthFromEdges()
+
+# compute the mesh
+tetra.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex10.py b/doc/salome/examples/defining_hypotheses_ex10.py
new file mode 100644 (file)
index 0000000..644908b
--- /dev/null
@@ -0,0 +1,76 @@
+# Projection Algorithms
+
+# Project prisms from one meshed box to another mesh on the same box
+
+from smesh import *
+
+# Prepare geometry
+
+# Create a parallelepiped
+box = geompy.MakeBoxDXDYDZ(200, 100, 70)
+geompy.addToStudy( box, "box" )
+
+# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
+faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+# 2 adjacent faces of the box
+f1 = faces[2]
+f2 = faces[0]
+# face opposite to f2
+f2opp = faces[1]
+
+# Get vertices used to specify how to associate sides of faces at projection
+[v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType["VERTEX"])[:2]
+[v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType["VERTEX"])[:2]
+geompy.addToStudyInFather( box, v1F1, "v1F1" )
+geompy.addToStudyInFather( box, v2F1, "v2F1" )
+geompy.addToStudyInFather( box, v1F2, "v1F2" )
+geompy.addToStudyInFather( box, v2F2, "v2F2" )
+
+# Make group of 3 edges of f1 and f2
+edgesF1 = geompy.CreateGroup(f1, geompy.ShapeType["EDGE"])
+geompy.UnionList( edgesF1, geompy.SubShapeAll(f1, geompy.ShapeType["EDGE"])[:3])
+edgesF2 = geompy.CreateGroup(f2, geompy.ShapeType["EDGE"])
+geompy.UnionList( edgesF2, geompy.SubShapeAll(f2, geompy.ShapeType["EDGE"])[:3])
+geompy.addToStudyInFather( box, edgesF1, "edgesF1" )
+geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
+
+
+# Make the source mesh with prisms
+src_mesh = Mesh(box, "Source mesh")
+src_mesh.Segment().NumberOfSegments(9,10)
+src_mesh.Quadrangle()
+src_mesh.Hexahedron()
+src_mesh.Triangle(f1) # triangular sumbesh 
+src_mesh.Compute()
+
+
+# Mesh the box using projection algoritms
+
+# Define the same global 1D and 2D hypotheses
+tgt_mesh = Mesh(box, "Target mesh")
+tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
+tgt_mesh.Quadrangle()
+
+# Define Projection 1D algorithm to project 1d mesh elements from group edgesF2 to edgesF1
+# It is actually not needed, just a demonstration
+proj1D = tgt_mesh.Projection1D( edgesF1 )
+# each vertex must be at the end of a connected group of edges (or a sole edge)
+proj1D.SourceEdge( edgesF2, src_mesh, v2F1, v2F2 )
+
+# Define 2D hypotheses to project triangles from f1 face of the source mesh to
+# f2 face in the target mesh. Vertices specify how to associate sides of faces
+proj2D = tgt_mesh.Projection2D( f2 )
+proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 )
+
+# 2D hypotheses to project triangles from f2 of target mesh to the face opposite to f2.
+# Association of face sides is default
+proj2D = tgt_mesh.Projection2D( f2opp )
+proj2D.SourceFace( f2 )
+
+# 3D hypotheses to project prisms from the source to the target mesh
+proj3D = tgt_mesh.Projection3D()
+proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
+tgt_mesh.Compute()
+
+# Move the source mesh to visualy compare the two meshes
+src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
diff --git a/doc/salome/examples/defining_hypotheses_ex11.py b/doc/salome/examples/defining_hypotheses_ex11.py
new file mode 100644 (file)
index 0000000..be55047
--- /dev/null
@@ -0,0 +1,31 @@
+# Projection 1D2D
+
+# Project triangles from one meshed face to another mesh on the same box
+
+from smesh import *
+
+# Prepare geometry
+
+# Create a box
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
+faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+# 2 adjacent faces of the box
+Face_1 = faces[2]
+Face_2 = faces[0]
+
+geompy.addToStudy( box, 'box' )
+geompy.addToStudyInFather( box, Face_1, 'Face_1' )
+geompy.addToStudyInFather( box, Face_2, 'Face_2' )
+
+# Make the source mesh with Netgem2D
+src_mesh = Mesh(Face_1, "Source mesh")
+src_mesh.Segment().NumberOfSegments(15)
+src_mesh.Triangle()
+src_mesh.Compute()
+
+# Mesh the target mesh using the algoritm Projection1D2D
+tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
+tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
+tgt_mesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex12.py b/doc/salome/examples/defining_hypotheses_ex12.py
new file mode 100644 (file)
index 0000000..dd891a7
--- /dev/null
@@ -0,0 +1,36 @@
+# 1D Mesh with Fixed Points example
+
+import salome
+import geompy
+import smesh
+import StdMeshers
+
+# Create face and explode it on edges
+face = geompy.MakeFaceHW(100, 100, 1)
+edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
+geompy.addToStudy( face, "Face" )
+
+# get the first edge from exploded result
+edge1 = geompy.GetSubShapeID(face, edges[0])
+
+# Define Mesh on previously created face
+Mesh_1 = smesh.Mesh(face)
+
+# Create Fixed Point 1D hypothesis and define parameters.
+# Note: values greater than 1.0 and less than 0.0 are not taken into account;
+# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
+# add added automatically.
+# The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
+# extra values of segments splitting parameter are not taken into account,
+# while missing values are considered to be equal to 1.
+Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
+Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
+Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
+Fixed_points_1D_1.SetReversedEdges( [edge1] )
+
+# Add hypothesis to mesh and define 2D parameters
+Mesh_1.AddHypothesis(Fixed_points_1D_1)
+Regular_1D = Mesh_1.Segment()
+Quadrangle_2D = Mesh_1.Quadrangle()
+# Compute mesh
+Mesh_1.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex13.py b/doc/salome/examples/defining_hypotheses_ex13.py
new file mode 100644 (file)
index 0000000..2839849
--- /dev/null
@@ -0,0 +1,34 @@
+# Radial Quadrangle 1D2D example
+
+from smesh import *
+
+SetCurrentStudy(salome.myStudy)
+
+# Create face from the wire and add to study
+Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
+geompy.addToStudy(Face,"Face")
+edges = geompy.SubShapeAllSorted(Face, geompy.ShapeType["EDGE"])
+circle, radius1, radius2 = edges
+geompy.addToStudyInFather(Face, radius1,"radius1")
+geompy.addToStudyInFather(Face, radius2,"radius2")
+geompy.addToStudyInFather(Face, circle,"circle")
+
+
+# Define geometry for mesh, and Radial Quadrange algorithm
+mesh = smesh.Mesh(Face)
+radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
+
+# The Radial Quadrange algorithm can work without any hypothesis
+# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
+mesh.Compute()
+
+# The Radial Quadrange uses global or local 1d hypotheses if it does
+# not have its own hypotheses.
+# Define global hypotheses to discretize radial edges and a local one for circular edge
+global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
+local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
+mesh.Compute()
+
+# Define own parameters of Radial Quadrange algorithm
+radial_Quad_algo.NumberOfLayers( 4 )
+mesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex14.py b/doc/salome/examples/defining_hypotheses_ex14.py
new file mode 100644 (file)
index 0000000..6c93e3d
--- /dev/null
@@ -0,0 +1,26 @@
+# Quadrangle Parameters example 1 (meshing a face with 3 edges)
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# Get 1/4 part from the disk face.
+Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
+Disk_1 = geompy.MakeDiskR(100, 1)
+Common_1 = geompy.MakeCommon(Disk_1, Box_1)
+geompy.addToStudy( Disk_1, "Disk_1" )
+geompy.addToStudy( Box_1, "Box_1" )
+geompy.addToStudy( Common_1, "Common_1" )
+
+# Set the Geometry for meshing
+Mesh_1 = smesh.Mesh(Common_1)
+
+
+# Define 1D hypothesis and compute the mesh
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
+Nb_Segments_1.SetDistrType( 0 )
+
+# Create Quadrangle parameters and define the Base Vertex.
+Quadrangle_2D = Mesh_1.Quadrangle().TriangleVertex( 8 )
+
+Mesh_1.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex15.py b/doc/salome/examples/defining_hypotheses_ex15.py
new file mode 100644 (file)
index 0000000..a08dfbf
--- /dev/null
@@ -0,0 +1,47 @@
+# Quadrangle Parameters example 2 (using different types)
+
+import geompy
+import smesh
+import StdMeshers
+
+# Make quadrangle face and explode it on edges.
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(40, 0, 0)
+Vertex_3 = geompy.MakeVertex(40, 30, 0)
+Vertex_4 = geompy.MakeVertex(0, 30, 0)
+Quadrangle_Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
+[Edge_1,Edge_2,Edge_3,Edge_4] = geompy.SubShapeAllSorted(Quadrangle_Face_1, geompy.ShapeType["EDGE"])
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Vertex_4, "Vertex_4" )
+geompy.addToStudy( Quadrangle_Face_1, "Quadrangle Face_1" )
+geompy.addToStudyInFather( Quadrangle_Face_1, Edge_2, "Edge_2" )
+
+# Set the Geometry for meshing
+Mesh_1 = smesh.Mesh(Quadrangle_Face_1)
+
+# Create Quadrangle parameters and
+# define the Type as Quadrangle Preference
+Quadrangle_Parameters_1 = smesh.CreateHypothesis('QuadrangleParams')
+Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_QUADRANGLE_PREF )
+
+# Define other hypotheses and algorithms
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
+Nb_Segments_1.SetDistrType( 0 )
+status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1)
+Quadrangle_2D = Mesh_1.Quadrangle()
+
+# Define submesh on one edge to provide different number of segments
+Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
+Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
+Nb_Segments_2.SetDistrType( 0 )
+SubMesh_1 = Regular_1D_1.GetSubMesh()
+
+# Compute mesh (with Quadrangle Preference type)
+isDone = Mesh_1.Compute()
+
+# Change type to Reduced and compute again
+Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_REDUCED )
+isDone = Mesh_1.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex16.py b/doc/salome/examples/defining_hypotheses_ex16.py
new file mode 100644 (file)
index 0000000..4930340
--- /dev/null
@@ -0,0 +1,43 @@
+# "Use Existing Elements" example
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# Make a patritioned box
+
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+
+N = geompy.MakeVectorDXDYDZ( 1,0,0 )
+O = geompy.MakeVertex( 50,0,0 )
+plane = geompy.MakePlane( O, N, 200 ) # plane YOZ
+
+shape2boxes = geompy.MakeHalfPartition( box, plane )
+boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType["SOLID"])
+
+geompy.addToStudy( boxes[0], "boxes[0]")
+geompy.addToStudy( boxes[1], "boxes[1]")
+midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType["FACE"])[5]
+geompy.addToStudyInFather( boxes[0], midFace0, "middle Face")
+midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType["FACE"])[0]
+geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
+
+# Mesh one of boxes with quadrangles. It is a source mesh
+
+srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
+nSeg1 = srcMesh.Segment().NumberOfSegments(4)
+srcMesh.Quadrangle()
+srcMesh.Compute()
+srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
+
+# Import faces from midFace0 to the target mesh
+
+tgtMesh = Mesh(boxes[1], "target mesh")
+importAlgo = tgtMesh.UseExisting2DElements(midFace1)
+import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
+tgtMesh.Segment().NumberOfSegments(3)
+tgtMesh.Quadrangle()
+tgtMesh.Compute()
+
+# Import the whole source mesh with groups
+import2hyp.SetCopySourceMesh(True,True)
+tgtMesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex17.py b/doc/salome/examples/defining_hypotheses_ex17.py
new file mode 100644 (file)
index 0000000..dc3ee9b
--- /dev/null
@@ -0,0 +1,40 @@
+# Viscous layers construction
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+X = geompy.MakeVectorDXDYDZ( 1,0,0 )
+O = geompy.MakeVertex( 100,50,50 )
+plane = geompy.MakePlane( O, X, 200 ) # plane YZ
+
+box = geompy.MakeBoxDXDYDZ(200,100,100)
+
+shape = geompy.MakeHalfPartition( box, plane )
+
+faces = geompy.SubShapeAllSorted(shape, geompy.ShapeType["FACE"])
+face1 = faces[1]
+ignoreFaces = [ faces[0], faces[-1]]
+
+geompy.addToStudy( shape, "shape" )
+geompy.addToStudyInFather( shape, face1, "face1")
+
+
+mesh = Mesh(shape, "CFD")
+
+mesh.Segment().NumberOfSegments( 4 )
+
+mesh.Triangle()
+mesh.Quadrangle(face1)
+mesh.Compute()
+algo3D = mesh.Tetrahedron()
+
+thickness = 20
+numberOfLayers = 10
+stretchFactor = 1.5
+layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces)
+
+mesh.Compute()
+
+mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
+mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
+mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
diff --git a/doc/salome/examples/filters_ex01.py b/doc/salome/examples/filters_ex01.py
new file mode 100644 (file)
index 0000000..9869047
--- /dev/null
@@ -0,0 +1,8 @@
+# Aspect ratio
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with aspect ratio > 6.5
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with aspect ratio > 6.5:", len(ids)
diff --git a/doc/salome/examples/filters_ex02.py b/doc/salome/examples/filters_ex02.py
new file mode 100644 (file)
index 0000000..f692173
--- /dev/null
@@ -0,0 +1,10 @@
+# Aspect ratio 3D
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get volumes with aspect ratio < 2.0
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of volumes with aspect ratio < 2.0:", len(ids)
diff --git a/doc/salome/examples/filters_ex03.py b/doc/salome/examples/filters_ex03.py
new file mode 100644 (file)
index 0000000..5afe3a4
--- /dev/null
@@ -0,0 +1,11 @@
+# Warping angle
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
+criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13)
+criterion.Tolerance = 5.0e-14
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion])
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
diff --git a/doc/salome/examples/filters_ex04.py b/doc/salome/examples/filters_ex04.py
new file mode 100644 (file)
index 0000000..d4d31a7
--- /dev/null
@@ -0,0 +1,8 @@
+# Minimum angle
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with minimum angle > 75
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with minimum angle > 75:", len(ids)
diff --git a/doc/salome/examples/filters_ex05.py b/doc/salome/examples/filters_ex05.py
new file mode 100644 (file)
index 0000000..b152251
--- /dev/null
@@ -0,0 +1,8 @@
+# Taper
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with taper < 1.e-15
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_LessThan, 1.e-15)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with taper < 1.e-15:", len(ids)
diff --git a/doc/salome/examples/filters_ex06.py b/doc/salome/examples/filters_ex06.py
new file mode 100644 (file)
index 0000000..0f609a5
--- /dev/null
@@ -0,0 +1,8 @@
+# Skew
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with skew > 50
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 50)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with skew > 50:", len(ids)
diff --git a/doc/salome/examples/filters_ex07.py b/doc/salome/examples/filters_ex07.py
new file mode 100644 (file)
index 0000000..723d8d2
--- /dev/null
@@ -0,0 +1,12 @@
+# Area
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with area > 60 and < 90
+criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\
+                                smesh.FT_Undefined, smesh.FT_LogicalAND)
+criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90)
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with area in range (60,90):", len(ids)
diff --git a/doc/salome/examples/filters_ex08.py b/doc/salome/examples/filters_ex08.py
new file mode 100644 (file)
index 0000000..2bc96b6
--- /dev/null
@@ -0,0 +1,10 @@
+# Volume
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get volumes faces with volume > 100
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of volumes with volume > 100:", len(ids)
diff --git a/doc/salome/examples/filters_ex09.py b/doc/salome/examples/filters_ex09.py
new file mode 100644 (file)
index 0000000..0d045b7
--- /dev/null
@@ -0,0 +1,14 @@
+# Free borders
+
+# create mesh
+import geompy, smesh, StdMeshers
+face = geompy.MakeFaceHW(100, 100, 1)
+geompy.addToStudy( face, "quadrangle" )
+mesh = smesh.Mesh(face)
+mesh.Segment().NumberOfSegments(10)
+mesh.Triangle().MaxElementArea(25)
+mesh.Compute()
+# get all free borders
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of edges on free borders:", len(ids)
diff --git a/doc/salome/examples/filters_ex10.py b/doc/salome/examples/filters_ex10.py
new file mode 100644 (file)
index 0000000..bbbdd98
--- /dev/null
@@ -0,0 +1,14 @@
+# Free edges
+
+# create mesh
+import geompy, smesh, StdMeshers
+face = geompy.MakeFaceHW(100, 100, 1)
+geompy.addToStudy( face, "quadrangle" )
+mesh = smesh.Mesh(face)
+mesh.Segment().NumberOfSegments(10)
+mesh.Triangle().MaxElementArea(25)
+mesh.Compute()
+# get all faces with free edges
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with free edges:", len(ids)
diff --git a/doc/salome/examples/filters_ex11.py b/doc/salome/examples/filters_ex11.py
new file mode 100644 (file)
index 0000000..4d754bc
--- /dev/null
@@ -0,0 +1,10 @@
+# Free nodes
+
+# create mesh
+from SMESH_mechanic import *
+# add node
+mesh.AddNode(0,0,0)
+# get all free nodes
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of free nodes:", len(ids)
diff --git a/doc/salome/examples/filters_ex12.py b/doc/salome/examples/filters_ex12.py
new file mode 100644 (file)
index 0000000..dfb0f40
--- /dev/null
@@ -0,0 +1,8 @@
+# Free faces
+
+# create mesh
+from SMESH_mechanic import *
+# get all free faces
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of free faces:", len(ids)
diff --git a/doc/salome/examples/filters_ex13.py b/doc/salome/examples/filters_ex13.py
new file mode 100644 (file)
index 0000000..d5415e2
--- /dev/null
@@ -0,0 +1,10 @@
+# Bare border faces
+
+# create mesh
+from SMESH_mechanic import *
+# remove some faces to have faces with bare borders
+mesh.RemoveElements( mesh.GetElementsByType(FACE)[0:5] )
+# get all faces bare borders
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
+ids = mesh.GetIdsFromFilter(filter)
+print "Faces with bare borders:", ids
diff --git a/doc/salome/examples/filters_ex14.py b/doc/salome/examples/filters_ex14.py
new file mode 100644 (file)
index 0000000..45c356c
--- /dev/null
@@ -0,0 +1,9 @@
+# Coplanar faces
+
+# create mesh
+from SMESH_mechanic import *
+faceID = mesh.GetElementsByType(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)
+print "Number of faces coplanar with the first one:", len(ids)
diff --git a/doc/salome/examples/filters_ex15.py b/doc/salome/examples/filters_ex15.py
new file mode 100644 (file)
index 0000000..2044c60
--- /dev/null
@@ -0,0 +1,7 @@
+# Over-constrained faces
+# create mesh
+from SMESH_mechanic import *
+# get all over-constrained faces
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace)
+ids = mesh.GetIdsFromFilter(filter)
+print "Over-constrained faces:", ids
diff --git a/doc/salome/examples/filters_ex16.py b/doc/salome/examples/filters_ex16.py
new file mode 100644 (file)
index 0000000..3c7159d
--- /dev/null
@@ -0,0 +1,21 @@
+# Double edges, Double faces, Double volumes
+
+from smesh import *
+# make a mesh on a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+mesh = Mesh( box, "Box" )
+mesh.Segment().NumberOfSegments(10)
+mesh.Quadrangle()
+mesh.Hexahedron()
+mesh.Compute()
+# copy all elements with translation and Merge nodes
+mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
+# create filters to find equal elements
+equalEdgesFilter   = GetFilter(SMESH.EDGE, FT_EqualEdges)
+equalFacesFilter   = GetFilter(SMESH.FACE, FT_EqualFaces)
+equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes)
+# get equal elements
+print "Number of equal edges:",   len( mesh.GetIdsFromFilter( equalEdgesFilter ))
+print "Number of equal faces:",   len( mesh.GetIdsFromFilter( equalFacesFilter ))
+print "Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter ))
diff --git a/doc/salome/examples/filters_ex17.py b/doc/salome/examples/filters_ex17.py
new file mode 100644 (file)
index 0000000..b79f4a7
--- /dev/null
@@ -0,0 +1,16 @@
+# Double nodes
+
+from smesh import *
+# make a mesh on a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+mesh = Mesh( box, "Box" )
+mesh.Segment().NumberOfSegments(10)
+mesh.Quadrangle()
+mesh.Hexahedron()
+mesh.Compute()
+# copy all elements with translation
+mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+# create filters to find nodes equal within tolerance of 1e-5
+filter = GetFilter(SMESH.NODE, FT_EqualNodes, Tolerance=1e-5)
+# get equal nodes
+print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
diff --git a/doc/salome/examples/filters_ex18.py b/doc/salome/examples/filters_ex18.py
new file mode 100644 (file)
index 0000000..30158e2
--- /dev/null
@@ -0,0 +1,8 @@
+# Borders at multi-connection
+
+# create mesh
+from SMESH_mechanic import *
+# get border edges with number of connected faces = 5
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 5)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of border edges with 5 faces connected:", len(ids)
diff --git a/doc/salome/examples/filters_ex19.py b/doc/salome/examples/filters_ex19.py
new file mode 100644 (file)
index 0000000..41b7cc7
--- /dev/null
@@ -0,0 +1,8 @@
+# Borders at multi-connection 2D
+
+# create mesh
+from SMESH_mechanic import *
+# get faces which consist of edges belonging to 2 mesh elements
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, 2)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces consisting of edges belonging to 2 faces:", len(ids)
diff --git a/doc/salome/examples/filters_ex20.py b/doc/salome/examples/filters_ex20.py
new file mode 100644 (file)
index 0000000..37227c4
--- /dev/null
@@ -0,0 +1,8 @@
+# Length
+
+# create mesh
+from SMESH_mechanic import *
+# get edges with length > 14
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 14)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of edges with length > 14:", len(ids)
diff --git a/doc/salome/examples/filters_ex21.py b/doc/salome/examples/filters_ex21.py
new file mode 100644 (file)
index 0000000..0882fe2
--- /dev/null
@@ -0,0 +1,8 @@
+# Length 2D
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces that have edges with length > 14
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, 14)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with maximum edge length > 14:", len(ids)
diff --git a/doc/salome/examples/filters_ex22.py b/doc/salome/examples/filters_ex22.py
new file mode 100644 (file)
index 0000000..f654217
--- /dev/null
@@ -0,0 +1,8 @@
+# Element Diameter 2D
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces that have elements with length > 10
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with maximum element length > 10:", len(ids)
diff --git a/doc/salome/examples/filters_ex23.py b/doc/salome/examples/filters_ex23.py
new file mode 100644 (file)
index 0000000..848f8d9
--- /dev/null
@@ -0,0 +1,10 @@
+# Element Diameter 3D
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all volumes that have elements with length > 10
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of volumes with maximum element length > 10:", len(ids)
diff --git a/doc/salome/examples/filters_ex24.py b/doc/salome/examples/filters_ex24.py
new file mode 100644 (file)
index 0000000..036ba03
--- /dev/null
@@ -0,0 +1,12 @@
+# Bare border volumes
+
+# create mesh
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# remove some volumes to have volumes with bare borders
+mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
+# get all volumes with bare borders
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Volumes with bare borders:", ids
diff --git a/doc/salome/examples/filters_ex25.py b/doc/salome/examples/filters_ex25.py
new file mode 100644 (file)
index 0000000..7e44898
--- /dev/null
@@ -0,0 +1,10 @@
+# Over-constrained volumes
+
+# create mesh
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all over-constrained volumes
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Over-constrained volumes:", ids
diff --git a/doc/salome/examples/filters_ex26.py b/doc/salome/examples/filters_ex26.py
new file mode 100644 (file)
index 0000000..3c5ce29
--- /dev/null
@@ -0,0 +1,8 @@
+# Belong to Geom
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces which nodes lie on the face sub_face3
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToGeom, sub_face3)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces which nodes lie on sub_face3:", len(ids)
diff --git a/doc/salome/examples/filters_ex27.py b/doc/salome/examples/filters_ex27.py
new file mode 100644 (file)
index 0000000..10067ea
--- /dev/null
@@ -0,0 +1,8 @@
+# Lying on Geom
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces at least one node of each lies on the face sub_face3
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_LyingOnGeom, sub_face3)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces at least one node of each lies on sub_face3:", len(ids)
diff --git a/doc/salome/examples/filters_ex28.py b/doc/salome/examples/filters_ex28.py
new file mode 100644 (file)
index 0000000..032b966
--- /dev/null
@@ -0,0 +1,12 @@
+# Belong to Plane
+
+# create mesh
+from SMESH_mechanic import *
+# create plane
+import geompy
+plane_1 = geompy.MakePlane(p3,seg1,2000)
+geompy.addToStudy(plane_1, "plane_1")
+# get all nodes which lie on the plane \a plane_1
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToPlane, plane_1)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of nodes which lie on the plane plane_1:", len(ids)
diff --git a/doc/salome/examples/filters_ex29.py b/doc/salome/examples/filters_ex29.py
new file mode 100644 (file)
index 0000000..c256724
--- /dev/null
@@ -0,0 +1,8 @@
+# Belong to Cylinder
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces which lie on the cylindrical face \a sub_face1
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToCylinder, sub_face1)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)
diff --git a/doc/salome/examples/filters_ex30.py b/doc/salome/examples/filters_ex30.py
new file mode 100644 (file)
index 0000000..19c2138
--- /dev/null
@@ -0,0 +1,12 @@
+# Belong to Surface
+
+# create mesh
+from SMESH_mechanic import *
+# create b-spline
+spline_1 = geompy.MakeInterpol([p4,p6,p3,p1])
+surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 )
+geompy.addToStudy(surface_1, "surface_1")
+# get all nodes which lie on the surface \a surface_1
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToGenSurface, surface_1)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of nodes which lie on the surface surface_1:", len(ids)
diff --git a/doc/salome/examples/filters_ex31.py b/doc/salome/examples/filters_ex31.py
new file mode 100644 (file)
index 0000000..a20f7d7
--- /dev/null
@@ -0,0 +1,12 @@
+# Range of IDs
+
+# 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",\
+                                BinaryOp=smesh.FT_LogicalOR)
+criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Treshold="15-30")
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of nodes in ranges [5-10] and [15-30]:", len(ids)
diff --git a/doc/salome/examples/filters_ex32.py b/doc/salome/examples/filters_ex32.py
new file mode 100644 (file)
index 0000000..726ca15
--- /dev/null
@@ -0,0 +1,10 @@
+# Badly oriented volume
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all badly oriented volumes
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of badly oriented volumes:", len(ids)
diff --git a/doc/salome/examples/filters_ex33.py b/doc/salome/examples/filters_ex33.py
new file mode 100644 (file)
index 0000000..2fbaab0
--- /dev/null
@@ -0,0 +1,17 @@
+# Linear / quadratic
+
+# create mesh
+from SMESH_mechanic import *
+# get number of linear and quadratic edges
+filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic)
+filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT)
+ids_linear = mesh.GetIdsFromFilter(filter_linear)
+ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
+print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
+# convert mesh to quadratic
+print "Convert to quadratic..."
+mesh.ConvertToQuadratic(True)
+# get number of linear and quadratic edges
+ids_linear = mesh.GetIdsFromFilter(filter_linear)
+ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
+print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
diff --git a/doc/salome/examples/filters_ex34.py b/doc/salome/examples/filters_ex34.py
new file mode 100644 (file)
index 0000000..8e63056
--- /dev/null
@@ -0,0 +1,14 @@
+# Group color
+
+# create mesh
+from SMESH_mechanic import *
+# create group of edges
+all_edges = mesh.GetElementsByType(smesh.EDGE)
+grp = mesh.MakeGroupByIds("edges group", smesh.EDGE, all_edges[:len(all_edges)/4])
+import SALOMEDS
+c = SALOMEDS.Color(0.1, 0.5, 1.0)
+grp.SetColor(c)
+# get number of the edges not belonging to the group with the given color
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_GroupColor, c, smesh.FT_LogicalNOT)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)
diff --git a/doc/salome/examples/filters_ex35.py b/doc/salome/examples/filters_ex35.py
new file mode 100644 (file)
index 0000000..369d732
--- /dev/null
@@ -0,0 +1,19 @@
+# Geometry type
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all triangles, quadrangles, tetrahedrons, pyramids
+filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE)
+filter_qua = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
+filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA)
+filter_pyr = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_PYRAMID)
+ids_tri = mesh.GetIdsFromFilter(filter_tri)
+ids_qua = mesh.GetIdsFromFilter(filter_qua)
+ids_tet = mesh.GetIdsFromFilter(filter_tet)
+ids_pyr = mesh.GetIdsFromFilter(filter_pyr)
+print "Number of triangles:", len(ids_tri)
+print "Number of quadrangles:", len(ids_qua)
+print "Number of tetrahedrons:", len(ids_tet)
+print "Number of pyramids:", len(ids_pyr)
diff --git a/doc/salome/examples/filters_ex36.py b/doc/salome/examples/filters_ex36.py
new file mode 100644 (file)
index 0000000..7675bc9
--- /dev/null
@@ -0,0 +1,13 @@
+# Combine filters with Criterion structures using of "criteria".
+
+# create mesh
+from SMESH_mechanic import *
+# get all the quadrangle faces ...
+criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE, smesh.FT_LogicalAND)
+# ... AND do NOT get those from sub_face3
+criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_BelongToGeom, sub_face3, smesh.FT_LogicalNOT)
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+
+myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids)
diff --git a/doc/salome/examples/generate_flat_elements.py b/doc/salome/examples/generate_flat_elements.py
new file mode 100644 (file)
index 0000000..a23c200
--- /dev/null
@@ -0,0 +1,57 @@
+# Double nodes on groups boundaries
+
+# 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.
+
+import geompy
+import smesh
+import SMESH
+
+# geometry 
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Vertex_1 = geompy.MakeVertex(50, 0, 0)
+Cylinder_1 = geompy.MakeCylinder(O, OX, 10, 500)
+Cylinder_2 = geompy.MakeCylinder(Vertex_1, OX, 100, 400)
+Vertex_2 = geompy.MakeVertex(-200, -200, -200)
+Vertex_3 = geompy.MakeVertex(250, 200, 200)
+Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
+Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
+Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
+[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
+Vertex_4 = geompy.MakeVertex(450, 0, 0)
+Vertex_5 = geompy.MakeVertex(500, 0, 0)
+Vertex_6 = geompy.MakeVertex(550, 0, 0)
+vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
+vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
+[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON)
+[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON)
+
+# meshing (we have linear tetrahedrons here, but other elements are OK)
+
+Mesh_1 = smesh.Mesh(Partition_1)
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
+MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO)
+Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
+ALGO3D = Mesh_1.Tetrahedron()
+isDone = Mesh_1.Compute()
+
+# relevant groups of volumes and faces
+
+Solid_1_1 = Mesh_1.GroupOnGeom(Solid_1,'Solid_1',SMESH.VOLUME)
+Solid_2_1 = Mesh_1.GroupOnGeom(Solid_2,'Solid_2',SMESH.VOLUME)
+Solid_3_1 = Mesh_1.GroupOnGeom(Solid_3,'Solid_3',SMESH.VOLUME)
+Solid_4_1 = Mesh_1.GroupOnGeom(Solid_4,'Solid_4',SMESH.VOLUME)
+Face_1_1 = Mesh_1.GroupOnGeom(Face_1,'Face_1',SMESH.FACE)
+Face_2_1 = Mesh_1.GroupOnGeom(Face_2,'Face_2',SMESH.FACE)
+
+# Building of flat elements
+
+Mesh_1.DoubleNodesOnGroupBoundaries([Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1], 1)
+
+Mesh_1.CreateFlatElementsOnFacesGroups([Face_1_1, Face_2_1])
diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py
new file mode 100644 (file)
index 0000000..d0971d6
--- /dev/null
@@ -0,0 +1,21 @@
+# Create a Standalone Group
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Get ids of all faces with area > 100 
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# create a group consisting of faces with area > 100
+aGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
+
+# create a group that contains all nodes from the mesh
+aGroup2 = mesh.CreateEmptyGroup(smesh.NODE, "all nodes")
+aGroup2.AddFrom(mesh.mesh)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex02.py b/doc/salome/examples/grouping_elements_ex02.py
new file mode 100644 (file)
index 0000000..228248d
--- /dev/null
@@ -0,0 +1,39 @@
+# Create a Group on Geometry
+
+import salome
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
+geompy.addToStudy(box, "box")
+
+# add the first face of the box to the study
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+geompy.addToStudyInFather(box, face, "face 1") 
+
+# create group of edges on the face
+aGeomGroupE = geompy.CreateGroup(face, geompy.ShapeType["EDGE"])
+geompy.AddObject(aGeomGroupE, 3)
+geompy.AddObject(aGeomGroupE, 6)
+geompy.AddObject(aGeomGroupE, 8)
+geompy.AddObject(aGeomGroupE, 10)
+geompy.addToStudyInFather(face, aGeomGroupE, "Group of Edges")
+
+# create quadrangle 2D mesh on the box
+quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
+algo1D = quadra.Segment()
+quadra.Quadrangle()
+algo1D.NumberOfSegments(7) 
+
+# compute the mesh
+quadra.Compute()
+
+# create SMESH group on the face with name "SMESHGroup1"
+aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1")
+
+# create SMESH group on <aGeomGroupE> with default name
+aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE) 
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex03.py b/doc/salome/examples/grouping_elements_ex03.py
new file mode 100644 (file)
index 0000000..05fb69d
--- /dev/null
@@ -0,0 +1,39 @@
+# Create a Group on Filter
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(10,10,10)
+
+# make a mesh with quadrangles of different area in range [1,16]
+mesh = Mesh(box,"Quad mesh")
+hyp1D = mesh.Segment().StartEndLength( 1, 4 )
+mesh.Quadrangle()
+mesh.Compute()
+
+# create a group on filter selecting faces of medium size
+critaria = [ \
+    GetCriterion(FACE, FT_Area, ">", 1.1, BinaryOp=FT_LogicalAND ),
+    GetCriterion(FACE, FT_Area, "<", 15.0 )
+    ]
+filt = GetFilterFromCriteria( critaria )
+filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt )
+print "Group on filter contains %s elemens" % filtGroup.Size()
+
+# group on filter is updated if the mesh is modified
+hyp1D.SetStartLength( 2.5 )
+hyp1D.SetEndLength( 2.5 )
+mesh.Compute()
+print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
+
+# set a new filter defining the group
+filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" )
+filtGroup.SetFilter( filt2 )
+print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
+
+# group is updated at modification of the filter
+filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )])
+filtIDs3 = filtGroup.GetIDs()
+print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex04.py b/doc/salome/examples/grouping_elements_ex04.py
new file mode 100644 (file)
index 0000000..730a2ca
--- /dev/null
@@ -0,0 +1,43 @@
+# Edit a Group
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Get ids of all faces with area > 35
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+print "Criterion: Area > 35, Nb = ", len(anIds)
+
+# create a group by adding elements with area > 35
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")
+aGroup.Add(anIds) 
+
+# Get ids of all faces with area > 40
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 40, Nb = ", len(anIds) 
+
+# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
+aGroup.Remove(anIds) 
+
+# print the result
+aGroupElemIDs = aGroup.GetListOfID()
+
+print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)
+
+j = 1
+for i in range(len(aGroupElemIDs)):
+  if j > 20: j = 1; print ""
+  print aGroupElemIDs[i],
+  j = j + 1
+  pass
+print ""
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex05.py b/doc/salome/examples/grouping_elements_ex05.py
new file mode 100644 (file)
index 0000000..90453fe
--- /dev/null
@@ -0,0 +1,52 @@
+# Union of groups
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 20, Nb = ", len( anIds ) 
+
+# create a group by adding elements with area > 20
+aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
+aGroup1.Add(anIds)
+
+# Criterion : AREA = 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area = 20, Nb = ", len( anIds ) 
+
+# create a group by adding elements with area = 20
+aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
+
+aGroup2.Add(anIds)
+
+# create union group : area >= 20
+aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
+print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
+# Please note that also there is UnionGroups() method which works with two groups only
+
+# Criterion : AREA < 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 20, Nb = ", len(anIds)
+
+# create a group by adding elements with area < 20
+aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
+aGroup4.Add(anIds)
+
+# create union group : area >= 20 and area < 20
+aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
+print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex06.py b/doc/salome/examples/grouping_elements_ex06.py
new file mode 100644 (file)
index 0000000..cc8146f
--- /dev/null
@@ -0,0 +1,36 @@
+# Intersection of groups
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 20, Nb = ", len(anIds) 
+
+# create a group by adding elements with area > 20
+aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
+aGroup1.Add(anIds)
+
+# Criterion : AREA < 60
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 60, Nb = ", len(anIds) 
+
+# create a group by adding elements with area < 60
+aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60")
+aGroup2.Add(anIds)
+
+# create an intersection of groups : 20 < area < 60
+aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
+print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
+# Please note that also there is IntersectGroups() method which works with two groups only
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex07.py b/doc/salome/examples/grouping_elements_ex07.py
new file mode 100644 (file)
index 0000000..5bcccd0
--- /dev/null
@@ -0,0 +1,34 @@
+# Cut of groups
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 20, Nb = ", len(anIds) 
+
+# create a group by adding elements with area > 20
+aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
+
+# Criterion : AREA < 60
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 60, Nb = ", len(anIds) 
+
+# create a group by adding elements with area < 60
+aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
+# create a cut of groups : area >= 60
+aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
+print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
+# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex08.py b/doc/salome/examples/grouping_elements_ex08.py
new file mode 100644 (file)
index 0000000..a86ec63
--- /dev/null
@@ -0,0 +1,35 @@
+# Creating groups of entities from existing groups of superior dimensions
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 100
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 100, Nb = ", len(anIds) 
+
+# create a group by adding elements with area > 100
+aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
+
+# Criterion : AREA < 30
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 30, Nb = ", len(anIds) 
+
+# create a group by adding elements with area < 30
+aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds)
+
+# Create group of edges using source groups of faces
+aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" )
+
+# Create group of nodes using source groups of faces
+aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" )
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/measurements_ex01.py b/doc/salome/examples/measurements_ex01.py
new file mode 100644 (file)
index 0000000..9677547
--- /dev/null
@@ -0,0 +1,48 @@
+# Minimum Distance
+
+import smesh
+from SMESH_mechanic import mesh as mesh1
+from SMESH_test1 import mesh as mesh2
+
+mesh1.Compute()
+mesh2.Compute()
+
+# compute min distance from mesh1 to the origin (not available yet)
+smesh.MinDistance(mesh1)
+
+# compute min distance from node 10 of mesh1 to the origin
+smesh.MinDistance(mesh1, id1=10)
+# ... or
+mesh1.MinDistance(10)
+
+# compute min distance between nodes 10 and 20 of mesh1
+smesh.MinDistance(mesh1, id1=10, id2=20)
+# ... or
+mesh1.MinDistance(10, 20)
+
+# compute min distance from element 100 of mesh1 to the origin (not available yet)
+smesh.MinDistance(mesh1, id1=100, isElem1=True)
+# ... or
+mesh1.MinDistance(100, isElem1=True)
+
+# compute min distance between elements 100 and 200 of mesh1 (not available yet)
+smesh.MinDistance(mesh1, id1=100, id2=200, isElem1=True, isElem2=True)
+# ... or
+mesh1.MinDistance(100, 200, True, True)
+
+# compute min distance from element 100 to node 20 of mesh1 (not available yet)
+smesh.MinDistance(mesh1, id1=100, id2=20, isElem1=True)
+# ... or
+mesh1.MinDistance(100, 20, True)
+
+# compute min distance from mesh1 to mesh2 (not available yet)
+smesh.MinDistance(mesh1, mesh2)
+
+# compute min distance from node 10 of mesh1 to node 20 of mesh2
+smesh.MinDistance(mesh1, mesh2, 10, 20)
+
+# compute min distance from node 10 of mesh1 to element 200 of mesh2 (not available yet)
+smesh.MinDistance(mesh1, mesh2, 10, 200, isElem2=True)
+
+# etc...
+
diff --git a/doc/salome/examples/measurements_ex02.py b/doc/salome/examples/measurements_ex02.py
new file mode 100644 (file)
index 0000000..3333bc0
--- /dev/null
@@ -0,0 +1,22 @@
+# Bounding Box
+
+import smesh
+from SMESH_mechanic import mesh as mesh1
+from SMESH_test1 import mesh as mesh2
+
+mesh1.Compute()
+mesh2.Compute()
+
+# compute bounding box for mesh1
+mesh1.BoundingBox()
+
+# compute bounding box for list of nodes of mesh1
+mesh1.BoundingBox([363, 364, 370, 371, 372, 373, 379, 380, 381])
+
+# compute bounding box for list of elements of mesh1
+mesh1.BoundingBox([363, 364, 370, 371, 372, 373, 379, 380, 381], isElem=True)
+
+# compute common bounding box of mesh1 and mesh2
+smesh.BoundingBox([mesh1, mesh2])
+
+# etc...
diff --git a/doc/salome/examples/modifying_meshes_ex01.py b/doc/salome/examples/modifying_meshes_ex01.py
new file mode 100644 (file)
index 0000000..ee183d7
--- /dev/null
@@ -0,0 +1,11 @@
+# Add Node
+
+import smesh
+
+mesh = smesh.Mesh()
+
+# add node
+new_id = mesh.AddNode(50, 10, 0)
+print ""
+if new_id == 0: print "KO node addition."
+else:           print "New Node has been added with ID ", new_id
diff --git a/doc/salome/examples/modifying_meshes_ex02.py b/doc/salome/examples/modifying_meshes_ex02.py
new file mode 100644 (file)
index 0000000..c99bf2a
--- /dev/null
@@ -0,0 +1,15 @@
+# Add 0D Element
+
+import smesh
+
+mesh = smesh.Mesh()
+
+# add node
+node_id = mesh.AddNode(50, 10, 0)
+
+# add 0D Element
+new_id = mesh.Add0DElement(node_id)
+
+print ""
+if new_id == 0: print "KO node addition."
+else:           print "New 0D Element has been added with ID ", new_id
diff --git a/doc/salome/examples/modifying_meshes_ex03.py b/doc/salome/examples/modifying_meshes_ex03.py
new file mode 100644 (file)
index 0000000..19b423e
--- /dev/null
@@ -0,0 +1,42 @@
+# Add 0D Element on Element Nodes
+
+import smesh, SMESH, geompy
+
+# create a geometry
+box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
+face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
+
+# make 3D mesh
+mesh = smesh.Mesh( box )
+mesh.AutomaticHexahedralization(0)
+
+# create 0D elements on all nodes of the mesh
+res = mesh.Add0DElementsToAllNodes( mesh )
+
+# find 0D elements on all nodes of the mesh, all found nodes are added to a new group
+groupName = "0Dmesh"
+res = mesh.Add0DElementsToAllNodes( mesh, groupName )
+mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
+
+# create 0D elements on all nodes of a sub-mesh, with group creation
+groupName = "0Dsubmesh"
+submesh = mesh.GetSubMesh( face, "faceSM")
+res = mesh.Add0DElementsToAllNodes( submesh, groupName )
+
+# create 0D elements on all nodes of a group
+group = mesh.Group( face, "faceGroup" )
+res = mesh.Add0DElementsToAllNodes( group )
+
+# remove all 0D elements
+mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
+                                                             SMESH.FT_ElemGeomType,
+                                                             "=",SMESH.Geom_POINT )))
+
+# create 0D elements on all nodes of some elements
+res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
+
+mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
+
+# create 0D elements on some nodes
+nodes = range(1,10)
+res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))
diff --git a/doc/salome/examples/modifying_meshes_ex04.py b/doc/salome/examples/modifying_meshes_ex04.py
new file mode 100644 (file)
index 0000000..5aad0f5
--- /dev/null
@@ -0,0 +1,15 @@
+# Add Edge
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition." 
+
+# add edge
+e1 = mesh.AddEdge([n1, 38])
+if e1 == 0: print "KO edge addition."
+else:       print "New Edge has been added with ID ", e1
diff --git a/doc/salome/examples/modifying_meshes_ex05.py b/doc/salome/examples/modifying_meshes_ex05.py
new file mode 100644 (file)
index 0000000..bd1e143
--- /dev/null
@@ -0,0 +1,15 @@
+# Add Triangle
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition."
+
+# add triangle
+t1 = mesh.AddFace([n1, 38, 39])
+if t1 == 0: print "KO triangle addition."
+else:       print "New Triangle has been added with ID ", t1
diff --git a/doc/salome/examples/modifying_meshes_ex06.py b/doc/salome/examples/modifying_meshes_ex06.py
new file mode 100644 (file)
index 0000000..b05c880
--- /dev/null
@@ -0,0 +1,18 @@
+# Add Quadrangle
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition."
+
+n2 = mesh.AddNode(40, 20, 0)
+if n2 == 0: print "KO node addition."
+
+# add quadrangle
+q1 = mesh.AddFace([n2, n1, 38, 39])
+if q1 == 0: print "KO quadrangle addition."
+else:       print "New Quadrangle has been added with ID ", q1
diff --git a/doc/salome/examples/modifying_meshes_ex07.py b/doc/salome/examples/modifying_meshes_ex07.py
new file mode 100644 (file)
index 0000000..5dfa8da
--- /dev/null
@@ -0,0 +1,15 @@
+# Add Tetrahedron
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition."
+
+# add tetrahedron
+t1 = mesh.AddVolume([n1, 38, 39, 246])
+if t1 == 0: print "KO tetrahedron addition."
+else:       print "New Tetrahedron has been added with ID ", t1
diff --git a/doc/salome/examples/modifying_meshes_ex08.py b/doc/salome/examples/modifying_meshes_ex08.py
new file mode 100644 (file)
index 0000000..4cfa89e
--- /dev/null
@@ -0,0 +1,19 @@
+# Add Hexahedron
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add nodes
+nId1 = mesh.AddNode(50, 10, 0)
+nId2 = mesh.AddNode(47, 12, 0)
+nId3 = mesh.AddNode(50, 10, 10)
+nId4 = mesh.AddNode(47, 12, 10)
+
+if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print "KO node addition."
+
+# add hexahedron
+vId = mesh.AddVolume([nId2, nId1, 38, 39, nId4, nId3, 245, 246])
+if vId == 0: print "KO Hexahedron addition."
+else:        print "New Hexahedron has been added with ID ", vId
diff --git a/doc/salome/examples/modifying_meshes_ex09.py b/doc/salome/examples/modifying_meshes_ex09.py
new file mode 100644 (file)
index 0000000..2fd9111
--- /dev/null
@@ -0,0 +1,32 @@
+# Add Polygon
+
+import math
+import salome
+
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# a method to build a polygonal mesh element with <nb_vert> angles:
+def MakePolygon (a_mesh, x0, y0, z0, radius, nb_vert):
+    al = 2.0 * math.pi / nb_vert
+    node_ids = []
+
+    # Create nodes for a polygon
+    for ii in range(nb_vert):
+        nid = mesh.AddNode(x0 + radius * math.cos(ii*al),
+                           y0 + radius * math.sin(ii*al),
+                                                     z0)
+        node_ids.append(nid)
+        pass
+
+    # Create a polygon
+    return mesh.AddPolygonalFace(node_ids)
+
+# Create three polygons
+f1 = MakePolygon(mesh, 0, 0,  0, 30, 13)
+f2 = MakePolygon(mesh, 0, 0, 10, 21,  9)
+f3 = MakePolygon(mesh, 0, 0, 20, 13,  6)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex10.py b/doc/salome/examples/modifying_meshes_ex10.py
new file mode 100644 (file)
index 0000000..7f36728
--- /dev/null
@@ -0,0 +1,56 @@
+# Add Polyhedron
+
+import salome
+import math
+
+# create an empty mesh structure
+mesh = smesh.Mesh()  
+
+# Create nodes for 12-hedron with pentagonal faces
+al = 2 * math.pi / 5.0
+cosal = math.cos(al)
+aa = 13
+rr = aa / (2.0 * math.sin(al/2.0))
+dr = 2.0 * rr * cosal
+r1 = rr + dr
+dh = rr * math.sqrt(2.0 * (1.0 - cosal * (1.0 + 2.0 * cosal)))
+hh = 2.0 * dh - dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh
+
+dd = [] # top
+cc = [] # below top
+bb = [] # above bottom
+aa = [] # bottom
+
+for i in range(5):
+    cos_bot = math.cos(i*al)
+    sin_bot = math.sin(i*al)
+
+    cos_top = math.cos(i*al + al/2.0)
+    sin_top = math.sin(i*al + al/2.0)
+
+    nd = mesh.AddNode(rr * cos_top, rr * sin_top, hh     ) # top
+    nc = mesh.AddNode(r1 * cos_top, r1 * sin_top, hh - dh) # below top
+    nb = mesh.AddNode(r1 * cos_bot, r1 * sin_bot,      dh) # above bottom
+    na = mesh.AddNode(rr * cos_bot, rr * sin_bot,       0) # bottom
+    dd.append(nd) # top
+    cc.append(nc) # below top
+    bb.append(nb) # above bottom
+    aa.append(na) # bottom
+    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])
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex11.py b/doc/salome/examples/modifying_meshes_ex11.py
new file mode 100644 (file)
index 0000000..6ba78c3
--- /dev/null
@@ -0,0 +1,10 @@
+# Removing Nodes
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# remove nodes #246 and #255
+res = mesh.RemoveNodes([246, 255])
+if res == 1: print "Nodes removing is OK!"
+else:        print "KO nodes removing."
diff --git a/doc/salome/examples/modifying_meshes_ex12.py b/doc/salome/examples/modifying_meshes_ex12.py
new file mode 100644 (file)
index 0000000..5437b38
--- /dev/null
@@ -0,0 +1,10 @@
+# Removing Elements
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# remove three elements: #850, #859 and #814
+res = mesh.RemoveElements([850, 859, 814])
+if res == 1: print "Elements removing is OK!"
+else:        print "KO Elements removing."
diff --git a/doc/salome/examples/modifying_meshes_ex13.py b/doc/salome/examples/modifying_meshes_ex13.py
new file mode 100644 (file)
index 0000000..4189b85
--- /dev/null
@@ -0,0 +1,13 @@
+# Removing Orphan Nodes
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# add orphan nodes
+mesh.AddNode(0,0,0)
+mesh.AddNode(1,1,1)
+# remove just created orphan nodes
+res = mesh.RemoveOrphanNodes()
+if res == 1: print "Removed %d nodes!" % res
+else:        print "KO nodes removing."
diff --git a/doc/salome/examples/modifying_meshes_ex14.py b/doc/salome/examples/modifying_meshes_ex14.py
new file mode 100644 (file)
index 0000000..7bb10fd
--- /dev/null
@@ -0,0 +1,9 @@
+# Renumbering Nodes and Elements
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+mesh.RenumberNodes()
+
+mesh.RenumberElements()
diff --git a/doc/salome/examples/modifying_meshes_ex15.py b/doc/salome/examples/modifying_meshes_ex15.py
new file mode 100644 (file)
index 0000000..49676d0
--- /dev/null
@@ -0,0 +1,43 @@
+# Moving Nodes
+
+from geompy import *
+from smesh import *
+
+box = MakeBoxDXDYDZ(200, 200, 200)
+
+mesh = Mesh( box )
+mesh.Segment().AutomaticLength(0.1)
+mesh.Quadrangle()
+mesh.Compute()
+
+# find node at (0,0,0)
+node000 = None
+for vId in SubShapeAllIDs( box, ShapeType["VERTEX"]):
+    if node000: break
+    nodeIds = mesh.GetSubMeshNodesId( vId, True )
+    for node in nodeIds:
+        xyz = mesh.GetNodeXYZ( node )
+        if xyz[0] == 0 and xyz[1] == 0 and xyz[2] == 0 :
+            node000 = node
+            pass
+        pass
+    pass
+
+if not node000:
+    raise "node000 not found"
+
+# find node000 using the tested function 
+n = mesh.FindNodeClosestTo( -1,-1,-1 )
+if not n == node000:
+    raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )
+
+# move node000 to a new location
+x,y,z = -10, -10, -10
+n = mesh.MoveNode( n,x,y,z )
+if not n:
+    raise "MoveNode() returns " + n
+
+# check the coordinates of the node000
+xyz = mesh.GetNodeXYZ( node000 )
+if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) :
+    raise "Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] )
diff --git a/doc/salome/examples/modifying_meshes_ex16.py b/doc/salome/examples/modifying_meshes_ex16.py
new file mode 100644 (file)
index 0000000..6567dff
--- /dev/null
@@ -0,0 +1,44 @@
+# Diagonal Inversion
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# create the following mesh:
+# .----.----.----.
+# |   /|   /|   /|
+# |  / |  / |  / |
+# | /  | /  | /  |
+# |/   |/   |/   |
+# .----.----.----.
+
+bb = [0, 0, 0, 0]
+tt = [0, 0, 0, 0]
+ff = [0, 0, 0, 0, 0, 0]
+
+bb[0] = mesh.AddNode( 0., 0., 0.)
+bb[1] = mesh.AddNode(10., 0., 0.)
+bb[2] = mesh.AddNode(20., 0., 0.)
+bb[3] = mesh.AddNode(30., 0., 0.)
+
+tt[0] = mesh.AddNode( 0., 15., 0.)
+tt[1] = mesh.AddNode(10., 15., 0.)
+tt[2] = mesh.AddNode(20., 15., 0.)
+tt[3] = mesh.AddNode(30., 15., 0.)
+
+ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
+ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
+ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
+ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
+ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
+ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
+
+# inverse the diagonal bb[1] - tt[2]
+print "\nDiagonal inversion ... ",
+res = mesh.InverseDiag(bb[1], tt[2])
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex17.py b/doc/salome/examples/modifying_meshes_ex17.py
new file mode 100644 (file)
index 0000000..732953a
--- /dev/null
@@ -0,0 +1,44 @@
+# Uniting two Triangles
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# create the following mesh:
+# .----.----.----.
+# |   /|   /|   /|
+# |  / |  / |  / |
+# | /  | /  | /  |
+# |/   |/   |/   |
+# .----.----.----.
+
+bb = [0, 0, 0, 0]
+tt = [0, 0, 0, 0]
+ff = [0, 0, 0, 0, 0, 0]
+
+bb[0] = mesh.AddNode( 0., 0., 0.)
+bb[1] = mesh.AddNode(10., 0., 0.)
+bb[2] = mesh.AddNode(20., 0., 0.)
+bb[3] = mesh.AddNode(30., 0., 0.)
+
+tt[0] = mesh.AddNode( 0., 15., 0.)
+tt[1] = mesh.AddNode(10., 15., 0.)
+tt[2] = mesh.AddNode(20., 15., 0.)
+tt[3] = mesh.AddNode(30., 15., 0.)
+
+ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
+ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
+ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
+ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
+ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
+ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) 
+
+# delete the diagonal bb[1] - tt[2]
+print "\nUnite two triangles ... ",
+res = mesh.DeleteDiag(bb[1], tt[2])
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex18.py b/doc/salome/examples/modifying_meshes_ex18.py
new file mode 100644 (file)
index 0000000..9f73930
--- /dev/null
@@ -0,0 +1,44 @@
+# Uniting a Set of Triangles
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# create the following mesh:
+# .----.----.----.
+# |   /|   /|   /|
+# |  / |  / |  / |
+# | /  | /  | /  |
+# |/   |/   |/   |
+# .----.----.----.
+
+bb = [0, 0, 0, 0]
+tt = [0, 0, 0, 0]
+ff = [0, 0, 0, 0, 0, 0]
+
+bb[0] = mesh.AddNode( 0., 0., 0.)
+bb[1] = mesh.AddNode(10., 0., 0.)
+bb[2] = mesh.AddNode(20., 0., 0.)
+bb[3] = mesh.AddNode(30., 0., 0.)
+
+tt[0] = mesh.AddNode( 0., 15., 0.)
+tt[1] = mesh.AddNode(10., 15., 0.)
+tt[2] = mesh.AddNode(20., 15., 0.)
+tt[3] = mesh.AddNode(30., 15., 0.)
+
+ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
+ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
+ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
+ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
+ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
+ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
+
+# unite a set of triangles
+print "\nUnite a set of triangles ... ",
+res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], smesh.FT_MinimumAngle, 60.)
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex19.py b/doc/salome/examples/modifying_meshes_ex19.py
new file mode 100644 (file)
index 0000000..c3eaf49
--- /dev/null
@@ -0,0 +1,35 @@
+# Orientation
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# build five quadrangles:
+dx = 10
+dy = 20
+
+n1  = mesh.AddNode(0.0 * dx, 0, 0)
+n2  = mesh.AddNode(1.0 * dx, 0, 0)
+n3  = mesh.AddNode(2.0 * dx, 0, 0)
+n4  = mesh.AddNode(3.0 * dx, 0, 0)
+n5  = mesh.AddNode(4.0 * dx, 0, 0)
+n6  = mesh.AddNode(5.0 * dx, 0, 0)
+n7  = mesh.AddNode(0.0 * dx, dy, 0)
+n8  = mesh.AddNode(1.0 * dx, dy, 0)
+n9  = mesh.AddNode(2.0 * dx, dy, 0)
+n10 = mesh.AddNode(3.0 * dx, dy, 0)
+n11 = mesh.AddNode(4.0 * dx, dy, 0)
+n12 = mesh.AddNode(5.0 * dx, dy, 0)
+
+f1 = mesh.AddFace([n1, n2, n8 , n7 ])
+f2 = mesh.AddFace([n2, n3, n9 , n8 ])
+f3 = mesh.AddFace([n3, n4, n10, n9 ])
+f4 = mesh.AddFace([n4, n5, n11, n10])
+f5 = mesh.AddFace([n5, n6, n12, n11]) 
+
+# Change the orientation of the second and the fourth faces.
+mesh.Reorient([2, 4])
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex20.py b/doc/salome/examples/modifying_meshes_ex20.py
new file mode 100644 (file)
index 0000000..aa52da7
--- /dev/null
@@ -0,0 +1,9 @@
+# Cutting Quadrangles
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh  = SMESH_mechanic.mesh
+
+# cut two quadrangles: 405 and 406
+mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle)
diff --git a/doc/salome/examples/modifying_meshes_ex21.py b/doc/salome/examples/modifying_meshes_ex21.py
new file mode 100644 (file)
index 0000000..ece705c
--- /dev/null
@@ -0,0 +1,27 @@
+# Smoothing
+
+import salome
+import geompy
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh
+
+# select the top face
+faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
+face = faces[3]
+geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
+
+# create a group of faces to be smoothed
+GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", smesh.FACE)
+
+# perform smoothing
+
+# boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
+res = mesh.SmoothObject(GroupSmooth, [], 20, 2., smesh.CENTROIDAL_SMOOTH)
+print "\nSmoothing ... ",
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/modifying_meshes_ex22.py b/doc/salome/examples/modifying_meshes_ex22.py
new file mode 100644 (file)
index 0000000..e9dcb3c
--- /dev/null
@@ -0,0 +1,26 @@
+# Extrusion
+
+import salome
+import geompy
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh 
+
+# select the top face
+faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
+face = faces[7]
+geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face circular top")
+
+# create a vector for extrusion
+point = smesh.PointStruct(0., 0., 5.)
+vector = smesh.DirStruct(point)
+
+# create a group to be extruded
+GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", smesh.FACE)
+
+# perform extrusion of the group
+mesh.ExtrusionSweepObject(GroupTri, vector, 5)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex23.py b/doc/salome/examples/modifying_meshes_ex23.py
new file mode 100644 (file)
index 0000000..a789b76
--- /dev/null
@@ -0,0 +1,126 @@
+# Extrusion along a Path
+
+import math
+import salome
+
+# Geometry
+import geompy
+
+# 1. Create points
+points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]
+
+iv = 1
+vertices = []
+for point in points:
+    vert = geompy.MakeVertex(point[0], point[1], 0)
+    geompy.addToStudy(vert, "Vertex_" + `iv`)
+    vertices.append(vert)
+    iv += 1
+    pass
+
+# 2. Create edges and wires
+Edge_straight = geompy.MakeEdge(vertices[0], vertices[4])
+Edge_bezierrr = geompy.MakeBezier(vertices)
+Wire_polyline = geompy.MakePolyline(vertices)
+Edge_Circle   = geompy.MakeCircleThreePnt(vertices[0], vertices[1], vertices[2])
+
+geompy.addToStudy(Edge_straight, "Edge_straight")
+geompy.addToStudy(Edge_bezierrr, "Edge_bezierrr")
+geompy.addToStudy(Wire_polyline, "Wire_polyline")
+geompy.addToStudy(Edge_Circle  , "Edge_Circle")
+
+# 3. Explode wire on edges, as they will be used for mesh extrusion
+Wire_polyline_edges = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"])
+for ii in range(len(Wire_polyline_edges)):
+    geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + `ii + 1`)
+    pass
+
+# Mesh
+import smesh
+
+# Mesh the given shape with the given 1d hypothesis
+def Mesh1D(shape1d, nbSeg, name):
+  mesh1d_tool = smesh.Mesh(shape1d, name)
+  algo = mesh1d_tool.Segment()
+  hyp  = algo.NumberOfSegments(nbSeg)
+  isDone = mesh1d_tool.Compute()
+  if not isDone: print 'Mesh ', name, ': computation failed'
+  return mesh1d_tool
+
+# Create a mesh with six nodes, seven edges and two quadrangle faces
+def MakeQuadMesh2(mesh_name):
+  quad_1 = smesh.Mesh(name = mesh_name)
+  
+  # six nodes
+  n1 = quad_1.AddNode(0, 20, 10)
+  n2 = quad_1.AddNode(0, 40, 10)
+  n3 = quad_1.AddNode(0, 40, 30)
+  n4 = quad_1.AddNode(0, 20, 30)
+  n5 = quad_1.AddNode(0,  0, 30)
+  n6 = quad_1.AddNode(0,  0, 10)
+
+  # seven edges
+  quad_1.AddEdge([n1, n2]) # 1
+  quad_1.AddEdge([n2, n3]) # 2
+  quad_1.AddEdge([n3, n4]) # 3
+  quad_1.AddEdge([n4, n1]) # 4
+  quad_1.AddEdge([n4, n5]) # 5
+  quad_1.AddEdge([n5, n6]) # 6
+  quad_1.AddEdge([n6, n1]) # 7
+
+  # two quadrangle faces
+  quad_1.AddFace([n1, n2, n3, n4]) # 8
+  quad_1.AddFace([n1, n4, n5, n6]) # 9
+  return [quad_1, [1,2,3,4,5,6,7], [8,9]]
+
+# Path meshes
+Edge_straight_mesh = Mesh1D(Edge_straight, 7, "Edge_straight")
+Edge_bezierrr_mesh = Mesh1D(Edge_bezierrr, 7, "Edge_bezierrr")
+Wire_polyline_mesh = Mesh1D(Wire_polyline, 3, "Wire_polyline")
+Edge_Circle_mesh   = Mesh1D(Edge_Circle  , 8, "Edge_Circle")
+
+# Initial meshes (to be extruded)
+[quad_1, ee_1, ff_1] = MakeQuadMesh2("quad_1")
+[quad_2, ee_2, ff_2] = MakeQuadMesh2("quad_2")
+[quad_3, ee_3, ff_3] = MakeQuadMesh2("quad_3")
+[quad_4, ee_4, ff_4] = MakeQuadMesh2("quad_4")
+[quad_5, ee_5, ff_5] = MakeQuadMesh2("quad_5")
+[quad_6, ee_6, ff_6] = MakeQuadMesh2("quad_6")
+[quad_7, ee_7, ff_7] = MakeQuadMesh2("quad_7")
+
+# ExtrusionAlongPath
+# IDsOfElements, PathMesh, PathShape, NodeStart,
+# HasAngles, Angles, HasRefPoint, RefPoint
+refPoint = smesh.PointStruct(0, 0, 0)
+a10 = 10.0*math.pi/180.0
+a45 = 45.0*math.pi/180.0
+
+# 1. Extrusion of two mesh edges along a straight path
+error = quad_1.ExtrusionAlongPath([1,2], Edge_straight_mesh, Edge_straight, 1,
+                                  0, [], 0, refPoint)
+
+# 2. Extrusion of one mesh edge along a curved path
+error = quad_2.ExtrusionAlongPath([2], Edge_bezierrr_mesh, Edge_bezierrr, 1,
+                                  0, [], 0, refPoint)
+
+# 3. Extrusion of one mesh edge along a curved path with usage of angles
+error = quad_3.ExtrusionAlongPath([2], Edge_bezierrr_mesh, Edge_bezierrr, 1,
+                                  1, [a45, a45, a45, 0, -a45, -a45, -a45], 0, refPoint)
+
+# 4. Extrusion of one mesh edge along the path, which is a part of a meshed wire
+error = quad_4.ExtrusionAlongPath([4], Wire_polyline_mesh, Wire_polyline_edges[0], 1,
+                                  1, [a10, a10, a10], 0, refPoint)
+
+# 5. Extrusion of two mesh faces along the path, which is a part of a meshed wire
+error = quad_5.ExtrusionAlongPath(ff_5 , Wire_polyline_mesh, Wire_polyline_edges[2], 4,
+                                  0, [], 0, refPoint)
+
+# 6. Extrusion of two mesh faces along a closed path
+error = quad_6.ExtrusionAlongPath(ff_6 , Edge_Circle_mesh, Edge_Circle, 1,
+                                  0, [], 0, refPoint)
+
+# 7. Extrusion of two mesh faces along a closed path with usage of angles
+error = quad_7.ExtrusionAlongPath(ff_7, Edge_Circle_mesh, Edge_Circle, 1,
+                                  1, [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex24.py b/doc/salome/examples/modifying_meshes_ex24.py
new file mode 100644 (file)
index 0000000..d07a7ca
--- /dev/null
@@ -0,0 +1,21 @@
+# Revolution
+
+import math
+import SMESH
+
+import SMESH_mechanic
+
+mesh  = SMESH_mechanic.mesh
+smesh = SMESH_mechanic.smesh
+
+# create a group of faces to be revolved
+FacesRotate = [492, 493, 502, 503]
+GroupRotate = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces (rotate)")
+GroupRotate.Add(FacesRotate)
+
+# define revolution angle and axis
+angle45 = 45 * math.pi / 180
+axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -23.321, -13.3402, -13.3265, 6.66632)
+
+# perform revolution of an object
+mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) 
diff --git a/doc/salome/examples/modifying_meshes_ex25.py b/doc/salome/examples/modifying_meshes_ex25.py
new file mode 100644 (file)
index 0000000..e8801e0
--- /dev/null
@@ -0,0 +1,130 @@
+# Pattern Mapping
+
+import geompy
+import smesh
+
+# define the geometry
+Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(Box_1, "Box_1")
+
+faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
+Face_1 = faces[0]
+Face_2 = faces[1]
+
+geompy.addToStudyInFather(Box_1, Face_1, "Face_1")
+geompy.addToStudyInFather(Box_1, Face_2, "Face_2")
+
+# build a quadrangle mesh 3x3 on Face_1
+Mesh_1 = smesh.Mesh(Face_1)
+algo1D = Mesh_1.Segment()
+algo1D.NumberOfSegments(3)
+Mesh_1.Quadrangle()
+
+isDone = Mesh_1.Compute()
+if not isDone: print 'Mesh Mesh_1 : computation failed'
+
+# build a triangle mesh on Face_2
+Mesh_2 = smesh.Mesh(Face_2)
+
+algo1D = Mesh_2.Segment()
+algo1D.NumberOfSegments(1)
+algo2D = Mesh_2.Triangle()
+algo2D.MaxElementArea(240)
+
+isDone = Mesh_2.Compute()
+if not isDone: print 'Mesh Mesh_2 : computation failed'
+
+# create a 2d pattern
+pattern = smesh.GetPattern()
+
+isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0)
+if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode()
+
+# apply the pattern to a face of the first mesh
+facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE)
+print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))
+pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0)
+isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
+if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()  
+
+# create quadrangle mesh
+Mesh_3 = smesh.Mesh(Box_1)
+Mesh_3.Segment().NumberOfSegments(1)
+Mesh_3.Quadrangle()
+Mesh_3.Hexahedron()
+isDone = Mesh_3.Compute()
+if not isDone: print 'Mesh Mesh_3 : computation failed'
+
+# create a 3d pattern (hexahedrons)
+pattern_hexa = smesh.GetPattern()
+
+smp_hexa = """!!! Nb of points:
+15
+      0        0        0   !- 0
+      1        0        0   !- 1
+      0        1        0   !- 2
+      1        1        0   !- 3
+      0        0        1   !- 4
+      1        0        1   !- 5
+      0        1        1   !- 6
+      1        1        1   !- 7
+    0.5        0      0.5   !- 8
+    0.5        0        1   !- 9
+    0.5      0.5      0.5   !- 10
+    0.5      0.5        1   !- 11
+      1        0      0.5   !- 12
+      1      0.5      0.5   !- 13
+      1      0.5        1   !- 14
+  !!! Indices of points of 4 elements:
+  8 12 5 9 10 13 14 11
+  0 8 9 4 2 10 11 6
+  2 10 11 6 3 13 14 7
+  0 1 12 8 2 3 13 10"""
+
+pattern_hexa.LoadFromFile(smp_hexa)
+
+# apply the pattern to a mesh
+volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME)
+print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))
+pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3)
+isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True)
+if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode()  
+
+# create one more quadrangle mesh
+Mesh_4 = smesh.Mesh(Box_1)
+Mesh_4.Segment().NumberOfSegments(1)
+Mesh_4.Quadrangle()
+Mesh_4.Hexahedron()
+isDone = Mesh_4.Compute()
+if not isDone: print 'Mesh Mesh_4 : computation failed'
+
+# create another 3d pattern (pyramids)
+pattern_pyra = smesh.GetPattern()
+
+smp_pyra = """!!! Nb of points:
+9
+        0        0        0   !- 0
+        1        0        0   !- 1
+        0        1        0   !- 2
+        1        1        0   !- 3
+        0        0        1   !- 4
+        1        0        1   !- 5
+        0        1        1   !- 6
+        1        1        1   !- 7
+      0.5      0.5      0.5   !- 8
+  !!! Indices of points of 6 elements:
+  0 1 5 4 8
+  7 5 1 3 8
+  3 2 6 7 8
+  2 0 4 6 8
+  0 2 3 1 8
+  4 5 7 6 8"""
+
+pattern_pyra.LoadFromFile(smp_pyra)
+
+# apply the pattern to a face mesh
+volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME)
+print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))
+pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0)
+isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True)
+if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode()  
diff --git a/doc/salome/examples/modifying_meshes_ex26.py b/doc/salome/examples/modifying_meshes_ex26.py
new file mode 100644 (file)
index 0000000..aa8cb43
--- /dev/null
@@ -0,0 +1,45 @@
+# Convert mesh to/from quadratic
+
+import geompy
+import smesh
+
+# create sphere of radius 100
+
+Sphere = geompy.MakeSphereR( 100 )
+geompy.addToStudy( Sphere, "Sphere" )
+
+# create simple trihedral mesh
+
+Mesh = smesh.Mesh(Sphere)
+Regular_1D = Mesh.Segment()
+Nb_Segments = Regular_1D.NumberOfSegments(5)
+MEFISTO_2D = Mesh.Triangle()
+Tetrahedron = Mesh.Tetrahedron()
+
+# compute mesh
+
+isDone = Mesh.Compute()
+
+# convert to quadratic
+# theForce3d = 1; this results in the medium node lying at the
+# middle of the line segments connecting start and end node of a mesh
+# element
+
+Mesh.ConvertToQuadratic( theForce3d=1 )
+
+# revert back to the non-quadratic mesh
+
+Mesh.ConvertFromQuadratic()
+
+# convert to quadratic
+# theForce3d = 0; this results in the medium node lying at the
+# geometrical edge from which the mesh element is built
+
+Mesh.ConvertToQuadratic( theForce3d=0 )
+
+# to convert not the whole mesh but a sub-mesh, provide it as 
+# an additional argument to the functions:
+# Mesh.ConvertToQuadratic( 0, subMesh )
+# Mesh.ConvertFromQuadratic( subMesh )
+#
+# Note that the mesh becomes non-conformal at conversion of sub-mesh.
diff --git a/doc/salome/examples/notebook_smesh.py b/doc/salome/examples/notebook_smesh.py
new file mode 100644 (file)
index 0000000..9cccc7b
--- /dev/null
@@ -0,0 +1,39 @@
+# Using SALOME NoteBook
+
+import geompy
+import smesh
+import salome_notebook
+
+# set variables
+notebook = salome_notebook.notebook
+notebook.set("Length", 100)
+notebook.set("Width", 200)
+notebook.set("Offset", 50)
+
+notebook.set("NbSegments", 7)
+notebook.set("MaxElementArea", 800)
+notebook.set("MaxElementVolume", 900)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ("Length", "Width", 300)
+idbox = geompy.addToStudy(box, "Box")
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments("NbSegments")
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea("MaxElementArea")
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume("MaxElementVolume")
+
+# compute the mesh
+ret = tetra.Compute()
+
+# translate the mesh
+point = smesh.PointStruct("Offset", 0., 0.)
+vector = smesh.DirStruct(point) 
+tetra.TranslateObject(tetra, vector, 0)
diff --git a/doc/salome/examples/prism_3d_algo.py b/doc/salome/examples/prism_3d_algo.py
new file mode 100644 (file)
index 0000000..df18d0f
--- /dev/null
@@ -0,0 +1,73 @@
+# Use 3D extrusion meshing algorithm
+
+import salome, smesh, SMESH, geompy
+
+salome.salome_init()
+smesh.SetCurrentStudy( salome.myStudy )
+
+OX = geompy.MakeVectorDXDYDZ(1,0,0)
+OY = geompy.MakeVectorDXDYDZ(0,1,0)
+OZ = geompy.MakeVectorDXDYDZ(0,0,1)
+
+#  Y ^       Make geometry of a "pipe" with the following base (cross section).
+#    |       Big central quadrangles will be meshed with triangles, walls
+#                         of the pipe will be meshed with quadrilaterals
+#   +--+--+--+--+--+--+
+#   |  |  |  |  |  |  |
+#   +--+--+--+--+--+--+
+#   |  |     |     |  |
+#   +--+     |     +--+
+#   |  |     |     |  |
+#   +--+-----+-----+--+
+#   |  |     |     |  |
+#   +--+     |     +--+
+#   |  |     |     |  |
+#   +--+--+--+--+--+--+
+#   |  |  |  |  |  |  |  -->
+#   +--+--+--+--+--+--+   X
+
+quadBig   = geompy.MakeFaceHW( 20,20, 1 )
+quadBig   = geompy.MakeTranslation( quadBig, 15,15,0 )
+quadSmall = geompy.MakeFaceHW( 10,10, 1 )
+smallQuads1 = geompy.MakeMultiTranslation1D( quadSmall, OX, 10, 3 )
+smallQuads2 = geompy.MakeMultiTranslation1D( quadSmall, OY, 10, 3 )
+smallQuads2 = geompy.SubShapeAllSortedCentres( smallQuads2, geompy.ShapeType["FACE"])[1:]
+
+base = geompy.MakeCompound( smallQuads2 + [smallQuads1, quadBig])
+axis = geompy.MakeLine( geompy.MakeVertex( 25,25,0), OZ )
+base = geompy.MultiRotate1DNbTimes( base, axis, 4)
+base = geompy.MakePartition( [base], theName="base")
+path = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 100:R 0:C -90 180:T 0 -150",[0,0,0, 0,-1,0, 1,0,0])
+
+# Make the pipe, each quadrangle of the base turns into a prism with composite wall faces
+pipe   = geompy.MakePipe( base, path )
+prisms = geompy.MakePartition( [pipe], theName="prisms")
+
+
+# get base faces of the prism to define sub-mesh on them
+smallQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 0,0,0 ), "smallQuad")
+bigQuad   = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 15,15,0 ), "bigQuad")
+
+
+mesh = smesh.Mesh( prisms )
+
+# assign Global hypotheses
+
+# 1D algorithm and hypothesis for vertical division
+mesh.Segment().NumberOfSegments(15)
+
+# Extrusion 3D algo
+mesh.Prism()
+
+# assign Local hypotheses
+
+# 1D and 2D algos and hyps to mesh smallQuad with quadrilaterals
+mesh.Segment(smallQuad).LocalLength( 3 )
+mesh.Quadrangle(smallQuad)
+
+# 1D and 2D algos and hyps to mesh bigQuad with triangles
+mesh.Segment(bigQuad).LocalLength( 3 )
+mesh.Triangle(bigQuad)
+
+# compute the mesh
+mesh.Compute()
diff --git a/doc/salome/examples/quality_controls_ex01.py b/doc/salome/examples/quality_controls_ex01.py
new file mode 100644 (file)
index 0000000..ed4dc24
--- /dev/null
@@ -0,0 +1,41 @@
+# Free Borders
+
+import salome
+import geompy
+
+import smesh
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_free_borders")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# criterion : free borders
+aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) 
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Free borders Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.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
new file mode 100644 (file)
index 0000000..7b1f55e
--- /dev/null
@@ -0,0 +1,44 @@
+# Borders at Multiconnection
+
+import salome
+import geompy
+
+import smesh
+import SMESH
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# Criterion : Borders at multi-connection
+nb_conn = 2
+
+aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Borders at multi-connections Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.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
new file mode 100644 (file)
index 0000000..8cb4098
--- /dev/null
@@ -0,0 +1,43 @@
+# Length 1D
+
+import salome
+import geompy
+
+import smesh
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_Length_1D")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# Criterion : Length > 3.
+length_margin = 3.
+
+aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex04.py b/doc/salome/examples/quality_controls_ex04.py
new file mode 100644 (file)
index 0000000..d26eb4d
--- /dev/null
@@ -0,0 +1,39 @@
+# Free Edges
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+aFilterMgr = smesh.CreateFilterManager()
+
+# Remove some elements to obtain free edges
+# Criterion : AREA > 95.
+area_margin = 95.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+mesh.RemoveElements(anIds)
+
+# Criterion : Free Edges
+aBorders = mesh.GetFreeBorders() 
+
+# create groups
+aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges")
+aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges")
+
+# fill groups with elements, corresponding to the criterion
+print ""
+print "Criterion: Free edges Nb = ", len(aBorders)
+for i in range(len(aBorders)):
+  aBorder = aBorders[i]
+  print "Face # ", aBorder.myElemId, " : Edge between nodes (",
+  print aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
+
+  aGroupF.Add([aBorder.myElemId])
+  aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex05.py b/doc/salome/examples/quality_controls_ex05.py
new file mode 100644 (file)
index 0000000..90c7c04
--- /dev/null
@@ -0,0 +1,48 @@
+# Free Nodes
+
+import salome
+import geompy
+
+import smesh
+
+# create box
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_free_nodes")
+algo = mesh.Segment()
+algo.NumberOfSegments(10)
+algo = mesh.Triangle(smesh.MEFISTO)
+algo.MaxElementArea(150.)
+mesh.Compute() 
+
+# Remove some elements to obtain free nodes
+# Criterion : AREA < 80.
+area_margin = 80.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+mesh.RemoveElements(anIds)
+
+# criterion : free nodes
+aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) 
+anNodeIds = mesh.GetIdsFromFilter(aFilter)
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
+aGroup.Add(anNodeIds)
+
+# print the result
+print "Criterion: Free nodes Nb = ", len(anNodeIds)
+j = 1
+for i in range(len(anNodeIds)):
+  if j > 20: j = 1; print ""
+  print anNodeIds[i],
+  j = j + 1
+  pass
+print ""
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex06.py b/doc/salome/examples/quality_controls_ex06.py
new file mode 100644 (file)
index 0000000..2fe67ab
--- /dev/null
@@ -0,0 +1,73 @@
+# Free Faces
+
+import salome
+import geompy
+
+####### GEOM part ########
+
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Box_1_vertex_6 = geompy.GetSubShape(Box_1, [6])
+Box_1 = geompy.GetMainShape(Box_1_vertex_6)
+Box_1_vertex_16 = geompy.GetSubShape(Box_1, [16])
+Box_1 = geompy.GetMainShape(Box_1_vertex_16)
+Box_1_vertex_11 = geompy.GetSubShape(Box_1, [11])
+Box_1 = geompy.GetMainShape(Box_1_vertex_11)
+Plane_1 = geompy.MakePlaneThreePnt(Box_1_vertex_6, Box_1_vertex_16, Box_1_vertex_11, 2000)
+Partition_1 = geompy.MakePartition([Box_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+
+Box_1_vertex_19 = geompy.GetSubShape(Box_1, [19])
+Box_1_vertex_21 = geompy.GetSubShape(Box_1, [21])
+Plane_2 = geompy.MakePlaneThreePnt(Box_1_vertex_16, Box_1_vertex_19, Box_1_vertex_21, 2000)
+
+geompy.addToStudy( Box_1, "Box_1" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_6, "Box_1:vertex_6" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_16, "Box_1:vertex_16" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_11, "Box_1:vertex_11" )
+geompy.addToStudy( Plane_1, "Plane_1" )
+geompy.addToStudy( Partition_1, "Partition_1" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_19, "Box_1:vertex_19" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
+geompy.addToStudy( Plane_2, "Plane_2" )
+
+###### SMESH part ######
+import smesh
+
+import StdMeshers
+
+Mesh_1 = smesh.Mesh(Partition_1)
+Regular_1D = Mesh_1.Segment()
+Max_Size_1 = Regular_1D.MaxSize(34.641)
+MEFISTO_2D = Mesh_1.Triangle()
+Tetrahedronn = Mesh_1.Tetrahedron()
+isDone = Mesh_1.Compute()
+
+# create a group of free faces
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
+aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
+
+aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
+aGroup.Add(aFaceIds)
+
+# print the result
+print "Criterion: Free faces Nb = ", len(aFaceIds)
+j = 1
+for i in range(len(aFaceIds)):
+  if j > 20: j = 1; print ""
+  print aFaceIds[i],
+  j = j + 1
+  pass
+print ""
+
+#filter faces from plane 2
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
+aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
+aGroup.Remove(aFaceIds)
+
+# create a group of shared faces (located on partition boundary inside box)
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
+aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
+
+aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
+aGroup.Add(aFaceIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex07.py b/doc/salome/examples/quality_controls_ex07.py
new file mode 100644 (file)
index 0000000..a2be029
--- /dev/null
@@ -0,0 +1,19 @@
+# Bare border faces
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+geompy.addToStudy( box, "box" )
+
+mesh = smesh.Mesh(box)
+mesh.Segment().NumberOfSegments(3)
+mesh.Quadrangle()
+mesh.Compute()
+
+# remove 2 faces
+allFaces = mesh.GetElementsByType(FACE)
+mesh.RemoveElements( allFaces[0:2])
+
+bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
+assert(bareGroup.Size() == 3)
diff --git a/doc/salome/examples/quality_controls_ex08.py b/doc/salome/examples/quality_controls_ex08.py
new file mode 100644 (file)
index 0000000..77e7e4c
--- /dev/null
@@ -0,0 +1,23 @@
+# Bare border volumes
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(100, 30, 10)
+# the smallest face of the box
+face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
+
+geompy.addToStudy( box, "box" )
+geompy.addToStudyInFather( box, face, "face" )
+
+mesh = Mesh(box)
+mesh.AutomaticHexahedralization();
+
+# remove half of mesh faces from the smallest face
+faceFaces = mesh.GetSubMeshElementsId(face)
+faceToRemove = faceFaces[: len(faceFaces)/2]
+mesh.RemoveElements( faceToRemove )
+
+# make a group of volumes missing the removed faces
+bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
+assert(bareGroup.Size() == len( faceToRemove))
diff --git a/doc/salome/examples/quality_controls_ex09.py b/doc/salome/examples/quality_controls_ex09.py
new file mode 100644 (file)
index 0000000..c4ca44e
--- /dev/null
@@ -0,0 +1,17 @@
+# Over-constrained faces
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+mesh = Mesh()
+faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
+
+#make an edge
+n1 = mesh.AddNode(0,0,0)
+n2 = mesh.AddNode(10,0,0)
+edge = mesh.AddEdge([n1,n2])
+assert( not mesh.GetIdsFromFilter( faceFilter ))
+
+# make faces 
+mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
+assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
diff --git a/doc/salome/examples/quality_controls_ex10.py b/doc/salome/examples/quality_controls_ex10.py
new file mode 100644 (file)
index 0000000..49ef2e7
--- /dev/null
@@ -0,0 +1,15 @@
+# Over-constrained volumes
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+mesh = Mesh()
+volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
+
+# make volumes by extrusion of one face
+n1 = mesh.AddNode(0,0,0)
+n2 = mesh.AddNode(10,0,0)
+edge = mesh.AddEdge([n1,n2])
+mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 1)
+mesh.ExtrusionSweep( mesh.GetElementsByType(FACE), MakeDirStruct(0,0,5), 7)
+assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
diff --git a/doc/salome/examples/quality_controls_ex11.py b/doc/salome/examples/quality_controls_ex11.py
new file mode 100644 (file)
index 0000000..ca955b6
--- /dev/null
@@ -0,0 +1,44 @@
+# Length 2D
+
+import salome
+import geompy
+
+import smesh
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_Length_2D")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute()
+
+# Criterion : Length 2D > 5.7
+length_margin = 5.7
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex12.py b/doc/salome/examples/quality_controls_ex12.py
new file mode 100644 (file)
index 0000000..28a0192
--- /dev/null
@@ -0,0 +1,44 @@
+# Borders at Multiconnection 2D
+
+import salome
+import geompy
+
+import smesh
+
+# create a compound of two glued boxes
+box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+box2 = geompy.MakeTranslation(box1, 0., 20., 0)
+comp = geompy.MakeCompound([box1, box2])
+box = geompy.MakeGlueFaces(comp, 0.000001)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# Criterion : MULTI-CONNECTION 2D = 3
+nb_conn = 3
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex13.py b/doc/salome/examples/quality_controls_ex13.py
new file mode 100644 (file)
index 0000000..1673fc7
--- /dev/null
@@ -0,0 +1,30 @@
+# Area
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 100.
+area_margin = 100.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)  
diff --git a/doc/salome/examples/quality_controls_ex14.py b/doc/salome/examples/quality_controls_ex14.py
new file mode 100644 (file)
index 0000000..379affd
--- /dev/null
@@ -0,0 +1,30 @@
+# Taper
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : Taper > 3e-20
+taper_margin = 3e-20
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex15.py b/doc/salome/examples/quality_controls_ex15.py
new file mode 100644 (file)
index 0000000..5ca56db
--- /dev/null
@@ -0,0 +1,30 @@
+# Aspect Ratio
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : ASPECT RATIO > 1.8
+ar_margin = 1.8
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex16.py b/doc/salome/examples/quality_controls_ex16.py
new file mode 100644 (file)
index 0000000..a20f38f
--- /dev/null
@@ -0,0 +1,31 @@
+# Minimum Angle
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : MINIMUM ANGLE < 35.
+min_angle = 35.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex17.py b/doc/salome/examples/quality_controls_ex17.py
new file mode 100644 (file)
index 0000000..fcc596c
--- /dev/null
@@ -0,0 +1,31 @@
+# Warping
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : WARP ANGLE > 1e-15
+wa_margin = 1e-15
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/quality_controls_ex18.py b/doc/salome/examples/quality_controls_ex18.py
new file mode 100644 (file)
index 0000000..42e4b30
--- /dev/null
@@ -0,0 +1,30 @@
+# Skew
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : Skew > 38.
+skew_margin = 38.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex19.py b/doc/salome/examples/quality_controls_ex19.py
new file mode 100644 (file)
index 0000000..abe1952
--- /dev/null
@@ -0,0 +1,30 @@
+# Element Diameter 2D
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : ELEMENT DIAMETER 2D > 10
+mel_2d_margin = 10
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex20.py b/doc/salome/examples/quality_controls_ex20.py
new file mode 100644 (file)
index 0000000..9e332e0
--- /dev/null
@@ -0,0 +1,31 @@
+# Aspect Ratio 3D
+
+import SMESH_mechanic_tetra 
+
+smesh  = SMESH_mechanic_tetra.smesh
+mesh   = SMESH_mechanic_tetra.mesh
+salome = SMESH_mechanic_tetra.salome
+
+# Criterion : ASPECT RATIO 3D > 4.5
+ar_margin = 4.5
+
+aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex21.py b/doc/salome/examples/quality_controls_ex21.py
new file mode 100644 (file)
index 0000000..833ffff
--- /dev/null
@@ -0,0 +1,32 @@
+# Volume
+
+import SMESH_mechanic_tetra
+
+smesh  = SMESH_mechanic_tetra.smesh
+mesh   = SMESH_mechanic_tetra.mesh
+salome = SMESH_mechanic_tetra.salome
+
+# Criterion : VOLUME < 7.
+volume_margin = 7.
+
+aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print ""
+print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/quality_controls_ex22.py b/doc/salome/examples/quality_controls_ex22.py
new file mode 100644 (file)
index 0000000..5264b1a
--- /dev/null
@@ -0,0 +1,30 @@
+# Element Diameter 3D
+
+import SMESH_mechanic_tetra
+
+smesh  = SMESH_mechanic_tetra.smesh
+mesh   = SMESH_mechanic_tetra.mesh
+salome = SMESH_mechanic_tetra.salome
+
+# Criterion : ELEMENT DIAMETER 3D > 10
+mel_3d_margin = 10
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py
new file mode 100755 (executable)
index 0000000..b1328b5
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import unittest, sys
+
+class SalomeSession(object):
+    def __init__(self, script):
+        import runSalome
+        sys.argv  = ["runSalome.py"]
+        sys.argv += ["--terminal"]
+        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
+        import killSalomeWithPort
+        killSalomeWithPort.killMyPort(port)
+        return
+    pass
+
+class MyTest(unittest.TestCase):
+    def testFunction(self):
+        SalomeSession(sys.argv[1])
+    pass
+
+unittest.main(argv=sys.argv[:1])
diff --git a/doc/salome/examples/transforming_meshes_ex01.py b/doc/salome/examples/transforming_meshes_ex01.py
new file mode 100644 (file)
index 0000000..0ea75cc
--- /dev/null
@@ -0,0 +1,15 @@
+# Translation
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh 
+mesh = SMESH_mechanic.mesh 
+
+# define translation vector
+point = smesh.PointStruct(-150., -150., 0.)
+vector =smesh.DirStruct(point) 
+
+# translate a mesh
+doCopy = 1
+
+mesh.Translate([], vector, doCopy)
diff --git a/doc/salome/examples/transforming_meshes_ex02.py b/doc/salome/examples/transforming_meshes_ex02.py
new file mode 100644 (file)
index 0000000..f96a6bb
--- /dev/null
@@ -0,0 +1,15 @@
+# Rotation
+
+import math
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh 
+
+# define rotation axis and angle
+axisXYZ = smesh.AxisStruct(0., 0., 0., 5., 5., 20.)
+angle270 = 1.5 * math.pi
+
+# rotate a mesh
+mesh.Rotate([], axisXYZ, angle270, 1)  
diff --git a/doc/salome/examples/transforming_meshes_ex03.py b/doc/salome/examples/transforming_meshes_ex03.py
new file mode 100644 (file)
index 0000000..da8105a
--- /dev/null
@@ -0,0 +1,26 @@
+# Scale
+
+import geompy
+Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
+
+import smesh,SMESH
+import StdMeshers
+Mesh1 = smesh.Mesh(f[0])
+Regular_1D = Mesh1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(3)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Mesh1.Quadrangle()
+isDone = Mesh1.Compute()
+
+#Perform scale opration for the whole mesh and creation of a new mesh
+newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh")
+
+#Perform scale operation for the whole mesh and copy elements
+Mesh1.Scale(Mesh1,SMESH.PointStruct(200,100,100),[0.5,0.5,0.5],True,True)
+
+#Perform scale opration for two edges and move elements
+Mesh1.Scale([1,2],SMESH.PointStruct(-100,100,100),[0.8,1.0,0.7],False)
+
+#Perform scale opration for one face and move elements
+Mesh1.Scale([21],SMESH.PointStruct(0,200,200),[0.7,0.7,0.7],False)
diff --git a/doc/salome/examples/transforming_meshes_ex04.py b/doc/salome/examples/transforming_meshes_ex04.py
new file mode 100644 (file)
index 0000000..ea7c72f
--- /dev/null
@@ -0,0 +1,13 @@
+# Symmetry
+
+import math
+
+import SMESH_mechanic
+
+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)
+
+mesh.Mirror([], axis, smesh.POINT, 1)
diff --git a/doc/salome/examples/transforming_meshes_ex05.py b/doc/salome/examples/transforming_meshes_ex05.py
new file mode 100644 (file)
index 0000000..f99d50b
--- /dev/null
@@ -0,0 +1,10 @@
+# Merging Nodes
+
+import SMESH_mechanic
+mesh = SMESH_mechanic.mesh
+
+# merge nodes
+Tolerance = 25.0
+
+GroupsOfNodes =  mesh.FindCoincidentNodes(Tolerance)
+mesh.MergeNodes(GroupsOfNodes)  
diff --git a/doc/salome/examples/transforming_meshes_ex06.py b/doc/salome/examples/transforming_meshes_ex06.py
new file mode 100644 (file)
index 0000000..fe8c91d
--- /dev/null
@@ -0,0 +1,73 @@
+# Merging Elements
+
+import salome
+import geompy
+import smesh
+
+# create a face to be meshed
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+vxy = geompy.MakeVector(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+wire = geompy.MakeWire([vxy, arc])
+isPlanarFace = 1
+
+face1 = geompy.MakeFace(wire, isPlanarFace)
+id_face1 = geompy.addToStudy(face1, "Face1")
+
+# create a circle to be an extrusion path
+px1 = geompy.MakeVertex( 100.,  100.,  0.)
+py1 = geompy.MakeVertex(-100., -100.,  0.)
+pz1 = geompy.MakeVertex(   0.,    0., 50.)
+
+circle = geompy.MakeCircleThreePnt(py1, pz1, px1)
+id_circle = geompy.addToStudy(circle, "Path")
+# create a 2D mesh on the face
+trias = smesh.Mesh(face1, "Face : 2D mesh")
+
+algo1D = trias.Segment()
+algo1D.NumberOfSegments(6)
+algo2D = trias.Triangle()
+algo2D.LengthFromEdges()
+
+trias.Compute()
+
+# create a path mesh
+circlemesh = smesh.Mesh(circle, "Path mesh")
+algo = circlemesh.Segment()
+algo.NumberOfSegments(10)
+circlemesh.Compute()
+
+# extrusion of the mesh
+trias.ExtrusionAlongPath([], circlemesh, circle,
+                         1, 0, [], 0, smesh.PointStruct(0, 0, 0))
+
+# merge nodes
+print "Number of nodes before MergeNodes:", 
+trias.NbNodes()
+tolerance = 0.001
+array_of_nodes_groups = trias.FindCoincidentNodes(tolerance)
+
+trias.MergeNodes(array_of_nodes_groups)
+
+print "Number of nodes after MergeNodes:", trias.NbNodes()
+print ""
+print "Number of elements before MergeEqualElements:"
+print "Edges      : ", trias.NbEdges()
+print "Triangles  : ", trias.NbTriangles()
+print "Quadrangles: ", trias.NbQuadrangles()
+print "Volumes    : ", trias.NbVolumes()
+
+# merge elements
+trias.MergeEqualElements()
+print "Number of elements after MergeEqualElements:"
+print "Edges      : ", trias.NbEdges()
+print "Triangles  : ", trias.NbTriangles()
+print "Quadrangles: ", trias.NbQuadrangles()
+print "Volumes    : ", trias.NbVolumes()
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/transforming_meshes_ex07.py b/doc/salome/examples/transforming_meshes_ex07.py
new file mode 100644 (file)
index 0000000..bb42d33
--- /dev/null
@@ -0,0 +1,38 @@
+# Sew Meshes Border to Side
+
+import geompy
+import smesh
+
+# create two faces of a box
+box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.)
+facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+face1 = facesList1[2]
+
+box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
+facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+face2 = facesList2[1]
+
+edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
+edge1 = edgesList[2]
+
+aComp = geompy.MakeCompound([face1, face2])
+geompy.addToStudy(aComp, "Two faces")
+
+# create a mesh on two faces
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(9)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(edge1)
+algo_local.Arithmetic1D(1, 4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew border to side
+# FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
+# FirstNodeIDOnSide, LastNodeIDOnSide,
+# CreatePolygons, CreatePolyedrs
+mesh.SewBorderToSide(5, 45, 6, 113, 109, 0, 0)
diff --git a/doc/salome/examples/transforming_meshes_ex08.py b/doc/salome/examples/transforming_meshes_ex08.py
new file mode 100644 (file)
index 0000000..e028735
--- /dev/null
@@ -0,0 +1,36 @@
+# Sew Conform Free Borders
+
+import geompy
+import smesh
+
+# create two faces of the box
+box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.)
+facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+face1 = facesList1[2]
+
+box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
+facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+face2 = facesList2[1]
+
+edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
+edge1 = edgesList[2]
+
+aComp = geompy.MakeCompound([face1, face2])
+geompy.addToStudy(aComp, "Two faces")
+
+# create a mesh on two faces
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(9)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(edge1)
+algo_local.Arithmetic1D(1, 4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew conform free borders
+# FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2
+mesh.SewConformFreeBorders(5, 45, 6, 3, 24) 
diff --git a/doc/salome/examples/transforming_meshes_ex09.py b/doc/salome/examples/transforming_meshes_ex09.py
new file mode 100644 (file)
index 0000000..5f92fd1
--- /dev/null
@@ -0,0 +1,37 @@
+# Sew Free Borders
+
+import geompy
+import smesh
+
+# create two faces of the box
+box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+face1 = facesList1[2]
+
+box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
+facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+face2 = facesList2[1]
+
+edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
+edge1 = edgesList[2]
+
+aComp = geompy.MakeCompound([face1, face2])
+geompy.addToStudy(aComp, "Two faces")
+
+# create a mesh on two faces
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(4)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(edge1)
+algo_local.Arithmetic1D(1, 4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew free borders
+# FirstNodeID1, SecondNodeID1, LastNodeID1,
+# FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs
+mesh.SewFreeBorders(6, 21, 5, 1, 12, 3, 0, 0)
diff --git a/doc/salome/examples/transforming_meshes_ex10.py b/doc/salome/examples/transforming_meshes_ex10.py
new file mode 100644 (file)
index 0000000..c54aca6
--- /dev/null
@@ -0,0 +1,31 @@
+# Sew Side Elements
+
+import geompy
+import smesh
+
+# create two boxes
+box1 = geompy.MakeBox(0.,  0., 0., 10., 10., 10.)
+box2 = geompy.MakeBox(0., 15., 0., 20., 25., 10.)
+
+EdgesList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
+
+aComp = geompy.MakeCompound([box1, box2])
+geompy.addToStudy(aComp, "Two boxes")
+
+# create a mesh on two boxes
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(2)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(EdgesList[8])
+algo_local.NumberOfSegments(4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew side elements
+# IDsOfSide1Elements, IDsOfSide2Elements,
+# NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge
+mesh.SewSideElements([69, 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)
diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py
new file mode 100644 (file)
index 0000000..55fbe8f
--- /dev/null
@@ -0,0 +1,66 @@
+# Duplicate nodes
+
+import salome
+import smesh
+import SMESH_test1
+
+mesh = SMESH_test1.mesh
+
+# Compute mesh
+mesh.Compute()
+
+# Without the duplication of border elements
+
+# Nodes to duplicate
+nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' )
+nodes1.Add( [ 289, 278, 302, 285 ] )
+
+# Group of faces to replace nodes with new ones 
+faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' )
+faces1.Add( [ 519, 556, 557 ] )
+
+# Duplicate nodes
+print "\nMesh before the first nodes duplication:"
+print "Nodes      : ", mesh.NbNodes()
+print "Edges      : ", mesh.NbEdges()
+print "Triangles  : ", mesh.NbTriangles()
+
+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()
+
+# With the duplication of border elements
+
+# Edges to duplicate
+edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' )
+edges.Add( [ 29, 30, 31 ] )
+
+# Nodes not to duplicate
+nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' )
+nodes2.Add( [ 32, 5 ] )
+
+# Group of faces to replace nodes with new ones 
+faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' )
+faces2.Add( [ 576, 578, 580 ] )
+
+# Duplicate nodes
+print "\nMesh before the second nodes duplication:"
+print "Nodes      : ", mesh.NbNodes()
+print "Edges      : ", mesh.NbEdges()
+print "Triangles  : ", mesh.NbTriangles()
+
+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()
+
+# Update object browser
+if salome.sg.hasDesktop():
+    salome.sg.updateObjBrowser(0)
diff --git a/doc/salome/examples/transforming_meshes_ex12.py b/doc/salome/examples/transforming_meshes_ex12.py
new file mode 100644 (file)
index 0000000..0380cc3
--- /dev/null
@@ -0,0 +1,108 @@
+# Create boundary elements
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
+f1,f2 = gFaces[0],gFaces[1]
+geompy.addToStudy(box,"box")
+geompy.addToStudyInFather(box,f1,"face1")
+geompy.addToStudyInFather(box,f2,"face2")
+
+twoFaces = geompy.MakeCompound([f1,f2])
+
+## -----------
+##
+## 2D from 3D
+##
+## -----------
+dim = SMESH.BND_2DFROM3D
+
+init_mesh = Mesh(box, "box")
+init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
+
+# remove some faces
+faces = init_mesh.GetElementsByType( SMESH.FACE )
+nb_faces = len( faces )
+rm_face = faces[ : nb_faces/2]
+init_mesh.RemoveElements( rm_face )
+
+# restore boundary in this mesh
+mesh = CopyMesh( init_mesh, "2D from 3D")
+groupName = "bnd 2D"
+nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
+
+# restore boundary (only) in other mesh
+meshName = "2D boundary of " + init_mesh.GetName()
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName)
+
+# restore boundary in mesh copy
+meshName = init_mesh.GetName() + " + boundary"
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName, toCopyAll=True)
+
+
+## -----------
+##
+## 1D from 2D
+##
+## -----------
+dim = SMESH.BND_1DFROM2D
+
+init_mesh = Mesh(f1, "2D mesh")
+init_mesh.AutomaticHexahedralization()
+
+# remove some edges
+edges = init_mesh.GetElementsByType( SMESH.EDGE )
+nb_edges = len( edges )
+rm_edge = edges[ : nb_edges/2]
+init_mesh.RemoveElements( rm_edge )
+
+
+# restore boundary edges in this mesh
+mesh = CopyMesh( init_mesh, "1D from 2D")
+groupName = "bnd 1D"
+nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
+
+# restore boundary edges (only) in other mesh
+meshName = "1D boundary of " + init_mesh.GetName()
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName)
+
+# restore boundary edges in mesh copy
+meshName = init_mesh.GetName() + " + boundary"
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName, toCopyAll=True)
+
+
+
+## ------------------
+##
+## 1D from 2D GROUPS
+##
+## ------------------
+dim = SMESH.BND_1DFROM3D
+
+init_mesh = Mesh(box, "box")
+init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
+# remove all edges
+rm_edges = init_mesh.GetElementsByType( SMESH.EDGE )
+init_mesh.RemoveElements( rm_edges )
+
+# make groups of faces
+fGroup1 = init_mesh.Group( f1, "f1" )
+fGroup2 = init_mesh.Group( f2, "f2" )
+
+# make 1D boundary around groups in this mesh
+mesh = CopyMesh( init_mesh, "1D from 2D groups", toCopyGroups=True)
+groups = mesh.GetGroups()
+nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName,groups=groups)
+
+# make 1D boundary (only) in other mesh
+meshName =  "boundary from groups of " + init_mesh.GetName()
+groups = init_mesh.GetGroups()
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName,groups=groups)
+
+# make 1D boundary in mesh copy
+meshName = init_mesh.GetName() + " + boundary from groups"
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName,
+                                                         groups=groups, toCopyAll=True)
+
diff --git a/doc/salome/examples/transforming_meshes_ex13.py b/doc/salome/examples/transforming_meshes_ex13.py
new file mode 100644 (file)
index 0000000..0126b71
--- /dev/null
@@ -0,0 +1,43 @@
+# Reorient faces by vector
+
+import smesh, geompy, SMESH
+
+# create a geometry consisting of two faces
+box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
+faces = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])
+
+shape = geompy.MakeCompound( faces[:2] )
+faces = geompy.SubShapeAll( shape, geompy.ShapeType["FACE"] )
+geompy.addToStudy( shape, "shape")
+geompy.addToStudyInFather( shape, faces[0], "faces[0]")
+geompy.addToStudyInFather( shape, faces[1], "faces[1]")
+
+# create a 2D mesh
+mesh = smesh.Mesh( shape, "test_Reorient2D")
+mesh.AutomaticHexahedralization(0.5)
+localAlgo = mesh.Segment(faces[0])
+localAlgo.NumberOfSegments( 11 )
+mesh.Compute()
+group = mesh.Group( faces[1] )
+
+vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
+
+# Each of arguments of Reorient2D() function can be of different types:
+#
+# 2DObject    - the whole mesh
+# Direction   - a GEOM object (vector)
+# FaceOrPoint - an ID of face
+mesh.Reorient2D( mesh, vec, mesh.NbElements() )
+#
+# 2DObject    - a sub-mesh
+# Direction   - components of a vector
+# FaceOrPoint - a GEOM object (vertex)
+mesh.Reorient2D( localAlgo.GetSubMesh(), [ 1, -1, 1 ], geompy.GetFirstVertex( vec ))
+#
+# 2DObject    - a group of faces
+# Direction   - a SMESH.DirStruct structure
+# FaceOrPoint - coordinates of a point
+mesh.Reorient2D( group, smesh.MakeDirStruct( -10, 1, 10 ), [0,0,0])
+#
+# FaceOrPoint - a SMESH.PointStruct structure
+mesh.Reorient2D( localAlgo.GetSubMesh().GetIDs(), [10,1,0], SMESH.PointStruct(0,0,0))
diff --git a/doc/salome/examples/use_existing_faces.py b/doc/salome/examples/use_existing_faces.py
new file mode 100644 (file)
index 0000000..12b5a9a
--- /dev/null
@@ -0,0 +1,109 @@
+# Use existing faces algorithm
+
+import smesh, geompy
+import numpy as np
+
+# define my 2D algorithm
+def my2DMeshing( geomFace ):
+
+    # find gravity center of geomFace
+    gcXYZ = geompy.PointCoordinates( geompy.MakeCDG( geomFace ))
+
+    # define order and orientation of edges
+    sortedEdges = []
+    geomEdges = geompy.SubShapeAll( geomFace, geompy.ShapeType["EDGE"])
+    sortedEdges.append(( geomEdges.pop(0), True ))
+    while geomEdges:
+        prevEdge_rev = sortedEdges[ -1 ]
+        prevVV = geompy.SubShapeAll( prevEdge_rev[0], geompy.ShapeType["VERTEX"])
+        prevV2 = prevVV[ prevEdge_rev[1] ]
+        found = False
+        for iE in range( len( geomEdges )):
+            v1,v2 = geompy.SubShapeAll( geomEdges[ iE ], geompy.ShapeType["VERTEX"])
+            same1,same2 = [( geompy.MinDistance( prevV2, v ) < 1e-7 ) for v in [v1,v2] ]
+            if not same1 and not same2: continue
+            sortedEdges.append(( geomEdges.pop( iE ), same1 ))
+            found = True
+            break
+        assert found
+    sortedEdges.reverse()
+
+    # put nodes on edges in a right order
+    nodes = []
+    for edge, isForward in sortedEdges:
+        v1,v2 = geompy.SubShapeAll( edge, geompy.ShapeType["VERTEX"])
+        edgeNodes = mesh.GetSubMeshNodesId( v2,   all=False ) + \
+                    mesh.GetSubMeshNodesId( edge, all=False ) + \
+                    mesh.GetSubMeshNodesId( v1,   all=False )
+        if not isForward: edgeNodes.reverse()
+        nodes.extend( edgeNodes[:-1] )
+
+    # create nodes inside the geomFace
+    r1 = 0.6
+    r2 = 1 - r1
+    nodesInside = []
+    for n in nodes:
+        nXYZ = mesh.GetNodeXYZ( n )
+        newXYZ = np.add( np.multiply( r1, gcXYZ ), np.multiply( r2, nXYZ ))
+        nodesInside.append( mesh.AddNode( newXYZ[0], newXYZ[1], newXYZ[2] ))
+        mesh.SetNodeOnFace( nodesInside[-1], geomFace, 0, 0 )
+
+    # find out orientation of faces to create
+    #    geomFace normal
+    faceNorm = geompy.GetNormal( geomFace )
+    v1,v2 = [ geompy.PointCoordinates( v ) \
+              for v in geompy.SubShapeAll( faceNorm, geompy.ShapeType["VERTEX"]) ]
+    faceNormXYZ = np.subtract( v2, v1 )
+    outDirXYZ   = np.subtract( v1, [ 50, 50, 50 ] )
+    if np.dot( faceNormXYZ, outDirXYZ ) < 0: # reversed face
+        faceNormXYZ = np.multiply( -1., faceNormXYZ )
+    #   mesh face normal
+    e1 = np.subtract( mesh.GetNodeXYZ( nodes[0] ), mesh.GetNodeXYZ( nodes[1] ))
+    e2 = np.subtract( mesh.GetNodeXYZ( nodes[0] ), mesh.GetNodeXYZ( nodesInside[0] ))
+    meshNorm = np.cross( e1, e2 )
+    #   faces orientation
+    reverse = ( np.dot( faceNormXYZ, meshNorm ) < 0 )
+
+    # create mesh faces
+    iN = len( nodes )
+    while iN:
+        n1, n2, n3, n4 = nodes[iN-1], nodes[iN-2], nodesInside[iN-2], nodesInside[iN-1]
+        iN -= 1
+        if reverse:
+            f = mesh.AddFace( [n1, n2, n3, n4] )
+        else:
+            f = mesh.AddFace( [n4, n3, n2, n1] )
+        # new faces must be assigned to geometry to allow 3D algorithm finding them
+        mesh.SetMeshElementOnShape( f, geomFace )
+
+    if reverse:
+        nodesInside.reverse()
+    polygon = mesh.AddPolygonalFace( nodesInside )
+    mesh.SetMeshElementOnShape( polygon, geomFace )
+
+    return
+
+# create geometry and get faces to mesh with my2DMeshing()
+box = geompy.MakeBoxDXDYDZ( 100, 100, 100 )
+f1 = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
+f2 = geompy.GetOppositeFace( box, f1 )
+geompy.addToStudy( box, "box" )
+geompy.addToStudy( f1, "f1" )
+geompy.addToStudy( f2, "f2" )
+
+# compute 1D mesh
+mesh = smesh.Mesh( box )
+mesh.Segment().NumberOfSegments( 5 )
+mesh.Compute()
+
+# compute 2D mesh
+mesh.Quadrangle()
+mesh.UseExistingFaces(f1) # UseExistingFaces() allows using my2DMeshing()
+mesh.UseExistingFaces(f2)
+my2DMeshing( f1 )
+my2DMeshing( f2 )
+assert mesh.Compute()
+
+# compute 3D mesh
+mesh.Prism()
+assert mesh.Compute()
diff --git a/doc/salome/examples/viewing_meshes_ex01.py b/doc/salome/examples/viewing_meshes_ex01.py
new file mode 100644 (file)
index 0000000..b2fa7df
--- /dev/null
@@ -0,0 +1,76 @@
+# Viewing Mesh Infos
+
+import geompy
+import smesh
+import SMESH
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
+geompy.addToStudy(box, "box")
+[Face_1,Face_2,Face_3,Face_4,Face_5,Face_5] = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments(3)
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea(10.)
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume(900.)
+
+# Creation of SubMesh
+Regular_1D_1_1 = tetra.Segment(geom=Face_1)
+Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = tetra.Quadrangle(geom=Face_1)
+isDone = tetra.Compute()
+submesh = Regular_1D_1_1.GetSubMesh()
+
+# compute the mesh
+tetra.Compute()
+
+# Creation of group
+group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' )
+nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] )
+
+# Print information about the mesh
+print "Information about mesh:" 
+print "Number of nodes       : ", tetra.NbNodes()
+print "Number of edges       : ", tetra.NbEdges()
+print "Number of faces       : ", tetra.NbFaces()
+print "          triangles   : ", tetra.NbTriangles()
+print "          quadrangles : ", tetra.NbQuadrangles()
+print "          polygons    : ", tetra.NbPolygons()
+print "Number of volumes     : ", tetra.NbVolumes()
+print "          tetrahedrons: ", tetra.NbTetras()
+print "          hexahedrons : ", tetra.NbHexas()
+print "          prisms      : ", tetra.NbPrisms()
+print "          pyramids    : ", tetra.NbPyramids()
+print "          polyhedrons : ", tetra.NbPolyhedrons() 
+
+# Get Information About Mesh by GetMeshInfo
+print "\nInformation about mesh by GetMeshInfo:"
+info = smesh.GetMeshInfo(tetra)
+keys = info.keys(); keys.sort()
+for i in keys:
+  print "  %s   :  %d" % ( i, info[i] )
+  pass
+
+# Get Information About Group by GetMeshInfo
+print "\nInformation about group by GetMeshInfo:"
+info = smesh.GetMeshInfo(group)
+keys = info.keys(); keys.sort()
+for i in keys:
+  print "  %s  :  %d" % ( i, info[i] )
+  pass
+
+# Get Information About SubMesh by GetMeshInfo
+print "\nInformation about Submesh by GetMeshInfo:"
+info = smesh.GetMeshInfo(submesh)
+keys = info.keys(); keys.sort()
+for i in keys:
+  print "  %s  :  %d" % ( i, info[i] )
+  pass
diff --git a/doc/salome/examples/viewing_meshes_ex02.py b/doc/salome/examples/viewing_meshes_ex02.py
new file mode 100644 (file)
index 0000000..de345e8
--- /dev/null
@@ -0,0 +1,45 @@
+# Find Element by Point
+
+import geompy
+import smesh
+import SMESH
+
+# Create a geometry to mesh
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+
+# Create a mesh
+mesh = Mesh(box,"Mesh")
+mesh.AutomaticHexahedralization()
+mesh.Compute()
+
+# Create a point
+x,y,z = 0, 0, 1
+
+# Find all elements (except 0D ones) located at the point
+all_elems_except_0D = mesh.FindElementsByPoint(x,y,z)
+assert( len(all_elems_except_0D) == 4)
+
+# Find nodes at the point
+nodes = mesh.FindElementsByPoint(x,y,z, SMESH.NODE )
+assert( len(nodes) == 0)
+assert( len( mesh.FindElementsByPoint(x,y,0, SMESH.NODE)) == 1)
+
+# Find an edge at the point
+edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE )
+assert( len(edges) == 1)
+
+# Find faces at the point
+edges = mesh.FindElementsByPoint(x,y,z, SMESH.FACE )
+assert( len(edges) == 2)
+
+# Find a volume at the point
+vols = mesh.FindElementsByPoint(x,y,z, SMESH.VOLUME )
+assert( len(vols) == 1)
+
+# Find 0D elements at the point
+elems0d = mesh.FindElementsByPoint(x,y,z, SMESH.ELEM0D )
+assert( len(elems0d) == 0)
+
+# Find edges within a group
+group1D = mesh.MakeGroupByIds("1D", SMESH.EDGE, [1,2] )
+edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE, group1D )
index bceb23d558bfcce3546ecb40f5791aaadf5786f7..a6a5fc1f1e4a46de9129e8597832b1f22b949b99 100755 (executable)
@@ -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
+EXAMPLE_PATH      = @top_srcdir@/src/SMESH_SWIG @top_srcdir@/doc/salome/examples
 
 #---------------------------------------------------------------------------
 #HTML related options
index 9f26c9af88f70617eaee9ac2522efc44905e36f0..c9ac74a06414ad4abc493fdb87dff660332798d0 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/addinfo_group.png and b/doc/salome/gui/SMESH/images/addinfo_group.png differ
index 91fbc38ad8864e5a64aa974194220c6c094f6cd6..42d88c6384c6d023501c4d7a81d01a84f9f2d2b6 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/addinfo_mesh.png and b/doc/salome/gui/SMESH/images/addinfo_mesh.png differ
index 4811c9902d3052cd6896c47741feabf980dd6d73..f41ba29049495b47e81035e392562814c8363c3b 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/addinfo_submesh.png and b/doc/salome/gui/SMESH/images/addinfo_submesh.png differ
index ddd305f587eea02b9848081d71b84d483cc3c9f4..3471144a1b068ab6de1db00ad7b3def1722ece3b 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/advanced_mesh_infos.png and b/doc/salome/gui/SMESH/images/advanced_mesh_infos.png differ
index 3cd439b76df0733f11f26e61b02a9d9a971e318d..3e1888ff2b8fc83798dc08683e5806637233107f 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/eleminfo1.png and b/doc/salome/gui/SMESH/images/eleminfo1.png differ
index 54fe12df8603d679a5549f3e4e7f1b5f1fb434c5..ea73500bd0e4293e6c4479af4f643ddc5fef4447 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/eleminfo2.png and b/doc/salome/gui/SMESH/images/eleminfo2.png differ
index d30add41694f180a71e86ade80aaaa97a38877e6..d39efb580c5210d6c9bf532850c8168b05fb15c3 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref21.png and b/doc/salome/gui/SMESH/images/pref21.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_needs_hyps.png b/doc/salome/gui/SMESH/images/prism_needs_hyps.png
new file mode 100644 (file)
index 0000000..8c56780
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_needs_hyps.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_ok_ko.png b/doc/salome/gui/SMESH/images/prism_ok_ko.png
new file mode 100644 (file)
index 0000000..0394985
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_ok_ko.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_stack.png b/doc/salome/gui/SMESH/images/prism_stack.png
new file mode 100644 (file)
index 0000000..bba6334
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_stack.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_tui_sample.png b/doc/salome/gui/SMESH/images/prism_tui_sample.png
new file mode 100644 (file)
index 0000000..0df7e48
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_tui_sample.png differ
index 59ca53065b9a06a53ae289a6b6e469f67f20bc99..564689ad96ef81e321572bb7e4a84e2d156e4f28 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/scalar_bar_dlg.png and b/doc/salome/gui/SMESH/images/scalar_bar_dlg.png differ
index 5690ff36c3c88a5473aff669c4d9941a9294b9e5..4453a7b8dcf8b29c5c054280ce75b9415606d340 100644 (file)
@@ -2,13 +2,13 @@
 
 \page about_hypo_page About Hypotheses
 
-\n \b Hypotheses represent boundary conditions which will be taken into
-account at calculations of meshes or submeshes basing on geometrical
+\b Hypotheses represent boundary conditions which will be taken into
+account at calculations of meshes or sub-meshes basing on geometrical
 objects. These hypotheses allow you to manage the level of detail of
 the resulting meshes or submeshes: when applying different hypotheses
 with different parameters you can preset the quantity of meshing
 elements which will compose your mesh. So, it will be possible to
-generate a rough or a more refined mesh or submesh.
+generate a coarse or a more refined mesh or sub-mesh.
 
 In \b MESH there are the following Basic Hypotheses (to introduce
 them, you operate numerical values):
index dc68cff59c883975fd4346dd52875ce32d26b764..97d14a3ec8892b9b1983fbdb31d5183c4572bab8 100644 (file)
@@ -11,10 +11,9 @@ Meshes are stored in DAT, MED, UNV, STL, CGNS, GMF and SAUVE formats and can be
 
 It is possible to \subpage constructing_meshes_page "construct meshes" 
 on the basis of geometrical shapes produced in the GEOM module.
-It is also possible to \subpage constructing_submeshes_page "construct
-mesh on a part of the geometrical object", for example, a face, with
-different meshing parameters than the whole mesh.
-
+It is also possible to 
+\subpage constructing_submeshes_page "construct mesh on a part of the geometrical object", 
+for example, a face, with different meshing parameters than the whole mesh.
 
 Several created meshes can be \subpage building_compounds_page "combined into another mesh".
 
index ff225d080245f29702cec29551278983e0a36396..82ee9d824d06771d6cf2f28ab8ee038cce41b263 100644 (file)
@@ -36,7 +36,7 @@ quadrangular elements.</li>
 <li>Hexahedron meshing algorithm (i,j,k) - 6-sided Volumes are split into
 hexahedral (cubic) elements.</li>
 <li>\subpage cartesian_algo_page</li>
-internal parts of Volumes are split into hexahedral elements forming a
+internal parts of Volumes are split into hexahedral elements forming a
 Cartesian grid; polyhedra and other types of elements are generated
 where the geometrical boundary intersects Cartesian cells.</li>
 </ul>
@@ -47,7 +47,7 @@ where the geometrical boundary intersects Cartesian cells.</li>
 </ul>
 
 Some of 3D meshing algorithms also can generate 3D meshes from 2D meshes, working without
-geometrical objects. Such algorithms are
+geometrical objects. Such algorithms is
 <ul>
 <li>Hexahedron meshing algorithm (i,j,k),</li>
 <!-- <li>GHS3D meshing algorithm (commercial)</li> -->
index 060adae0319fa2d878dd446c71b4d81b5899c63a..917fd5f65e434515d46350c874b401e55705569d 100644 (file)
@@ -4,8 +4,8 @@
 
 Sub-mesh is a mesh on a geometrical sub-object created with algorithms
 and/or hypotheses other than the algorithms and hypotheses assigned to
-the parent mesh on the parent object.
-<br><br>
+the parent mesh on the parent geometrical object.
+
 If a geometrical sub-object belongs to several geometrical objects
 having different meshes or sub-meshes, it will be meshed with the
 hypotheses of a sub-mesh of a lower dimension.<br>
index cb061b314fabd3de22c4f883875429f563aea733..4813eee5cae4badc998966fc2ca7b2c7f0dc6d55 100644 (file)
@@ -64,7 +64,7 @@ The following dialog common for line and planar elements will appear:
   <li>Specify the number of steps.</li>
   <li>If you activate <b>Generate Groups</b> check-box, the created
     elements contained in groups will be included into new groups named
-    by pattern "<old group name>_extruded"</li>
+    by pattern "<old group name>_extruded" and "<old group name>_top".</li>
 </ul>
 
 <li>Click \b Apply or <b> Apply and Close</b>  button to confirm the operation.</li>
index 06a02d2cc1d90d5d356fe5badf49f6016df7b5a7..5c526af674870b08de16873ed71f0021c68af351 100644 (file)
@@ -10,8 +10,8 @@ group in the <b>Object Browser</b> and invoke <b>Mesh Information</b>
 item from the \b Mesh menu or click <em>"Mesh Information"</em> button
 in the toolbar. 
 
-\image html image49.png
-<center><em>"Mesh Information" button</em></center>
+<center>\image html image49.png
+<em>"Mesh Information" button</em></center>
 
 The <b>Mesh Information</b> dialog box provides three tab pages:
 - <b>\ref advanced_mesh_infos_anchor "Base Info"</b> - to show base
@@ -27,28 +27,50 @@ for the selected mesh, sub-mesh or group object.
 The <b>Base Info</b> tab page of the dialog box provides general
 information on the selected object - mesh, sub-mesh or mesh group:
 name, type, total number of nodes and elements separately for each
-type: 0D elements, edges, faces and volumes.
+type: 0D elements, edges, faces, volumes, balls.
 
-\image html advanced_mesh_infos.png
-<center><em>"Base Info" page</em></center>
+<center>\image html advanced_mesh_infos.png
+<em>"Base Info" page</em></center>
 
 \anchor mesh_element_info_anchor
 <h2>Mesh Element Information</h2> 
 
-The <b>Element Info</b> tab page of the dialog box gives basic
-information about the type, coordinates and connectivity of the
-selected mesh node or element.
+The <b>Element Info</b> tab page of the dialog box gives detail
+information about selected mesh node(s) or element(s), namely:
 
-\image html eleminfo1.png
-<center><em>"Element Info" page, node information</em></center>
+- For node:
+  - Node ID
+  - Coordinates (X, Y, Z)
+  - Connectivity information (connected elements)
+  - Position on a shape (for meshes built on geometry)
+  - Groups information (names of groups the node belongs to)
+
+<center>\image html eleminfo1.png
+<em>"Element Info" page, node information</em></center>
 <br>
-\image html eleminfo2.png 
-<center><em>"Element Info" page, element information</em></center>
+
+- For element:
+  - Element ID
+  - Type (triangle, quadrangle, etc...)
+  - Gravity center (X, Y, Z coordinates)
+  - Connectivity information (connected nodes)
+  - Quality controls (area, aspect ration, volume, etc)
+  - Position on a shape (for meshes built on geometry)
+  - Groups information (names of groups the element belongs to)
+
+<center>\image html eleminfo2.png 
+<em>"Element Info" page, element information</em></center>
 
 The use can either input the ID of a node or element he wants to
-analyze directly in the dialog box or select the node or element in
+analyze directly in the dialog box or select the node(s) or element(s) in
 the 3D viewer.
 
+\note The information about the groups, the node or element belongs
+to, can be shown in short or detail form. By default, for performance
+reasons, this information is show in short form (group names
+only). Detail information on groups can be switched on via the user
+preferences, see \ref mesh_preferences_page.
+
 \anchor mesh_addition_info_anchor
 <h2>Additional Information</h2> 
 
@@ -64,8 +86,8 @@ For a mesh object, the following information is shown:
 - Groups
 - Sub-meshes
 
-\image html addinfo_mesh.png
-<center><em>"Additional Info" page, mesh information</em></center>
+<center>\image html addinfo_mesh.png
+<em>"Additional Info" page, mesh information</em></center>
 <br>
 
 For a sub-mesh object, the following information is shown:
@@ -73,8 +95,8 @@ For a sub-mesh object, the following information is shown:
 - Parent mesh
 - Shape
 
-\image html addinfo_submesh.png
-<center><em>"Additional Info" page, sub-mesh information</em></center>
+<center>\image html addinfo_submesh.png
+<em>"Additional Info" page, sub-mesh information</em></center>
 <br>
 
 For a group object, the following information is shown:
@@ -86,8 +108,8 @@ For a group object, the following information is shown:
 - Color
 - Number of underlying nodes (for non-nodal groups)
 
-\image html addinfo_group.png
-<center><em>"Additional Info" page, group information</em></center>
+<center>\image html addinfo_group.png
+<em>"Additional Info" page, group information</em></center>
 <br>
 
 \note For the performance reasons, the number of underlying nodes is
@@ -97,6 +119,9 @@ automatically calculated if the size of the group does not exceed
 the "Automatic nodes compute limit" set via the  "Mesh information"
 preferences (zero value means no limit).
 
+The button \b "Dump" allows printing the information displayed in the
+dialog box to the txt file.
+
 In case you get <b>Mesh Information</b> via a TUI script, the information is
 displayed in the Python Console. 
 <b>See the</b> \ref tui_viewing_mesh_infos "TUI Example".
index d2a6eb41fad65a18e0a72404da2ba8a6e3ec52fc..a9d7f87de6acef340cbe282118481461cef1c095 100644 (file)
@@ -73,7 +73,19 @@ mesh groups for which the number of underlying nodes is calculated
 automatically. If the group size exceeds the value set in the preferences,
 the user will have to press \em Compute button explicitly. Zero value
 means "no limit". By default the value is set to 100 000 mesh elements.
-</li></ul>
+</li>
+<li><b>Show details on groups in element information tab</b> - when
+this option is switched off (default), only names of groups, the node
+or element belongs to, are shown in the \ref mesh_element_info_anchor "Info Tab"
+tab of "Mesh Information" dialog box. If this option is
+switched on, the detail information on groups is shown.</li>
+<li><b>Dump base information</b> - Dump base mesh information to the
+file, see \ref mesh_infos_page.</li>
+<li><b>Dump element information</b> - Dump element information to the
+file, see \ref mesh_infos_page.</li>
+<li><b>Dump additional information</b> - Dump additional mesh
+information to the file, see \ref mesh_infos_page.</li>
+</ul>
 <li><b>Automatic Parameters</b></li>
 <ul>
 <li><b>Ratio Bounding Box Diagonal / Max Size</b> - this parameter is
index 5589ba3a761c8199ea4716deab69ce9cacb9ad88..d689028698952d49a49db35524f77840a9889b72 100644 (file)
@@ -2,23 +2,73 @@
 
 \page prism_3d_algo_page 3D extrusion meshing algorithm
 
-3D extrusion algorithm can be used for meshing prisms, i.e. <b>3D Shapes</b>
+3D extrusion algorithm can be used for meshing prisms, i.e. 3D shapes
 defined by two opposing faces having the same number of vertices and
-edges and meshed using, for example,  the \ref projection_algos_page
-"2D Projection" algorithm. These two faces should be connected by
-quadrangle "side" faces.
+edges. These two faces should be connected by quadrangle "side" faces.
 
-The opposing faces can be meshed with either quadrangles or triangles,
-while the side faces should be meshed with quadrangles only.
+The prism is allowed to have sides composed of several faces. (A prism
+side is a row of faces (or one face) connecting corresponding edges of
+the top and base faces). But there is a limitation that a prism 
+side is allowed to be split only vertically as indicated in the
+picture below. 
 
-\image html image157.gif "Prism with 3D extrusion meshing".
+\image html prism_ok_ko.png
+In this picture, the left prism is suitable for meshing with 3D
+extrusion algorithm; it has six sides two of which are split
+vertically. And the right prism can't be meshed with this
+algorithm because one of the prism sides is split horizontally (a
+splitting edge is highlighted).
 
-As you can see, the <b>3D extrusion</b> algorithm permits to build and to
-have in the same 3D mesh such elements as hexahedrons, prisms and
-polyhedrons.
+The algorithm can propagate 2D mesh not only between horizontal
+(i.e. base and top) faces of one prism but also between faces of prisms
+organized in a stack and between stacks sharing prism sides.
 
-\note This algorithm works correctly only if the opposing faces have
-the same (or similar) meshing topography. Otherwise, 3D extrusion
-algorithm can fail to build mesh volumes.
+\image html prism_stack.png
+In this picture, four neighboring prism stacks, each comprising two prisms,
+are shown. The shown sub-mesh is used by the algorithm to mesh
+all the eight prisms in the stacks.
+
+To use <em>3D extrusion</em> algorithm you need to assign algorithms
+and hypotheses of lower dimension as follows.
+(A sample picture below shows algorithms and hypotheses used to
+mesh a cylinder with prismatic volumes).
+
+\image html prism_needs_hyps.png
+
+\b Global algorithms and hypotheses to be chosen at 
+\ref create_mesh_anchor "Creation of a mesh object" are:
+<ul>
+<li> 1D algorithm and hypothesis that will be applied for meshing
+  (logically) vertical edges of the prism (these edges connect the top and
+  base faces of prism). In the sample picture above these are
+  "Regular_1D" algorithm and "Nb. Segments_1" hypothesis.</li>
+</ul>
+
+\b Local algorithms and hypotheses to be chosen at 
+\ref constructing_submeshes_page "Constructing sub-meshes" are:
+<ul>
+  <li> 1D and 2D algorithms and hypotheses that will be applied for
+    meshing the top and base prism faces. These faces can be meshed
+    with any type of 2D elements: quadrangles, triangles, polygons or
+    their mix. It's enough to define a sub-mesh on either top or base
+    face. In the sample picture above, "BLSURF" algorithm meshes
+    "Face_1" base surface with triangles. (1D algorithm is not
+    assigned as "BLSURF" does not require divided edges to create 2D mesh.)
+  </li>
+  <li> Optionally you can define an 1D sub-mesh on some vertical edges
+    of stacked prisms, which will override the global 1D hypothesis mentioned
+    above. In the picture above the picture of Object Browser, the
+    vertical division is not equidistant on all the length because of
+    a "Number Of Segments" hypothesis with Scale Factor=3 assigned to
+    the highlighted edge. 
+</li></ul>
+
+\image html image157.gif 
+
+Prism with 3D extrusion meshing. "Vertical" division is different on
+neighbor edges due to local 1D hypotheses assigned.
+
+\sa a sample TUI Script of
+\ref tui_prism_3d_algo "Use 3D extrusion meshing algorithm".
 
 */
index dcbae8db4056b95ac68be47f352b383f4e82feb9..4cd8b81faf12e0adbabbae19d29b3bc7013148b0 100644 (file)
@@ -16,44 +16,51 @@ The following dialog box will appear:
 
 \image html projection_1d.png
 
-In this menu you can define the \b Name of the algorithm, the already
-meshed source \b Edge and the \b Mesh  (It can be omitted only when 
-projecting a submesh on another one from the same global Mesh). 
-It could also be necessary to define the orientation of edges, 
-which is done by indicating the <b>Source Vertex</b> being the first point 
-of the Source Edge and the <b>Target Vertex</b> being the first point of 
-the created \b Edge. 
+In this dialog you can define
+<ul>
+  <li> the \b Name of the algorithm,</li>
+  <li> the already meshed <b> Source Edge</b> and </li>
+  <li> the <b>Source Mesh </b> (It can be omitted only when projecting
+    a sub-mesh on another one of the same Mesh).</li>
+  <li> It could also be necessary to define the orientation of edges, 
+    which is done by indicating the <b>Source Vertex</b> being the
+    first point of the <b>Source Edge </b>and the <b>Target Vertex</b> being
+    the first point of the edge being meshed.</li>
+</ul>
 <br>
 For a group of edges, <b>Source</b> and <b>Target</b> vertices should be
-shared by one edge of the group. If <b>Source</b> and <b>Target</b>
-vertices are specified, the elements of the group must be adjacent.
+shared by only one edge of the group. If <b>Source</b> and <b>Target</b>
+vertices are specified, the edges in the group must be connected.
 The source and target groups must contain equal number of edges
 and they must form topologically equal structures.
 
 \n <b>Projection 2D</b> algorithm allows to define the mesh of a face
-(or group of faces) by the
-projection of another already meshed face (or group of faces). This
-algorithm works only
-if all edges of the target face have been meshed as 1D Projections of
-the edges of the source face.
+(or group of faces) by the projection of another already meshed face
+(or group of faces). This algorithm works only if all edges of the
+target face have been discretized into the same number of
+segments as corresponding edges of the source face.
 
 To apply this algorithm select the face to be meshed (indicated in the
 field \b Geometry of <b>Create mesh</b> dialog box), <b>Projection
-2D</b> in the list
-of 2D algorithms and click the <em>"Add Hypothesis"</em> button. The
-following dialog box will appear:
+2D</b> in the list of 2D algorithms and click the <em> "Add
+Hypothesis"</em> button. The following dialog box will appear:
 
 \image html projection_2d.png
 
-In this menu you can define the \b Name of the algorithm, the already
-meshed source \b Face and the \b Mesh (It can be omitted only when 
-projecting a submesh on another one from the same global Mesh). 
-It could also be necessary to define the orientation of mesh on the
-face, which is done by indicating two <b>Source Vertices</b>, which
-belong to the same edge of the source face, and two <b>Target
-Vertices</b>, which belong to the same edge of the created \b Face.
-For groups of face, they must contain equal number of faces
-and they must form topologically equal structures.
+In this dialog you can define 
+<ul>
+  <li> the \b Name of the algorithm, </li>
+  <li> the already meshed <b> Source Face </b> and </li>
+  <li> the <b> Source Mesh </b> (It can be omitted only when 
+    projecting a submesh on another one of the same Mesh). </li>
+  <li> It could also be necessary to define the orientation of mesh on
+    the face, which is done by indicating two <b>Source Vertices</b>,
+    which belong to the same edge of the <b>Source Face</b>, and
+    two <b>Target Vertices</b>, which belong to the same edge of the
+    face being meshed.</li>
+</ul>
+For groups of face, the groups must contain equal number of faces and
+they must form topologically equal structures. 
 
 \n <b>Projection 1D-2D</b> algorithm differs from <b>Projection 2D</b>
 algorithm in one aspect: it generates mesh segments on edges of
index 146a7fa7881db76f0667e83b215b1107d2e5d215..7ef8da51d88744b831307b1d08a14975dddfb83e 100755 (executable)
@@ -7,8 +7,12 @@ In this dialog you can specify the properties of the scalar bar
 \image html scalar_bar_dlg.png
 
 <ul>
-<li><b>Scalar Range</b> in this menu you can specify 
-<b>Min value</b> and <b>Max value</b> of the <b>Scalar Bar</b> </li>
+<li><b>Scalar Range</b> - in this menu you can specify 
+<b>Min value</b> and <b>Max value</b> of the <b>Scalar Bar</b>, and
+also you can turn on/off <b>Logarithmic</b> scaling of the scalar bar.</li>
+
+\note <b>Logarithmic scale</b> is not applicable in case of
+negative and zero values in the range. In such cases it is disabled.
 
 <li><b>Font</b> - in this menu you can set type, face and color for
 the font of <b>Title</b> and <b>Labels</b> of the <b>Scalar
@@ -29,7 +33,7 @@ location (<b>X</b> and <b>Y</b>) and size (<b>Width</b> and
 side)</li>
 <li><b>Y</b>: ordinate of the origin (from the bottom)</li>
 </ul>
-<li><b>Distribution</b> in this menu you can Show/Hide distribution histogram of the values of the <b>Scalar Bar</b> and specify histogram properties</li>
+<li><b>Distribution</b> in this menu you can Show/Hide distribution histogram of the values of the <b>Scalar Bar</b> and specify histogram properties</li>
 <ul>
 <li><b>Multicolor</b> the histogram is colored as <b>Scalar Bar</b></li>
 <li><b>Monocolor</b> the histogram is colored as selected with <b>Distribution color</b> selector</li>
index b2b48795433139e409648bd3b7b45957bb352437..699e5c981ee9fe8046286bfafd5f5073b2316f8f 100644 (file)
@@ -36,80 +36,8 @@ An example below demonstrates usage of the Python API for 3d mesh generation.
 
 \anchor example_3d_mesh
 <h2>Example of 3d mesh generation:</h2>
-
-\code
-from geompy import * 
-import smesh 
-
-###
-# Geometry: an assembly of a box, a cylinder and a truncated cone
-# meshed with tetrahedral 
-###
-
-# Define values
-name = "ex21_lamp" 
-cote = 60 
-section = 20 
-size = 200 
-radius_1 = 80 
-radius_2 = 40 
-height = 100 
-
-# Build a box
-box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) 
-
-# Build a cylinder
-pt1 = MakeVertex(0, 0, cote/3) 
-di1 = MakeVectorDXDYDZ(0, 0, 1) 
-cyl = MakeCylinder(pt1, di1, section, size) 
-
-# Build a truncated cone
-pt2 = MakeVertex(0, 0, size) 
-cone = MakeCone(pt2, di1, radius_1, radius_2, height) 
-
-# Fuse
-box_cyl = MakeFuse(box, cyl) 
-piece = MakeFuse(box_cyl, cone) 
-
-# Add to the study
-addToStudy(piece, name) 
-
-# Create a group of faces
-group = CreateGroup(piece, ShapeType["FACE"]) 
-group_name = name + "_grp" 
-addToStudy(group, group_name) 
-group.SetName(group_name) 
-
-# Add faces to the group
-faces = SubShapeAllIDs(piece, ShapeType["FACE"]) 
-UnionIDs(group, faces) 
-
-###
-# Create a mesh
-###
-
-# Define a mesh on a geometry
-tetra = smesh.Mesh(piece, name) 
-
-# Define 1D hypothesis
-algo1d = tetra.Segment() 
-algo1d.LocalLength(10) 
-
-# Define 2D hypothesis
-algo2d = tetra.Triangle() 
-algo2d.LengthFromEdges() 
-
-# Define 3D hypothesis
-algo3d = tetra.Tetrahedron()
-algo3d.MaxElementVolume(100) 
-
-# Compute the mesh
-tetra.Compute() 
-
-# Create a groupe of faces
-tetra.Group(group)
-
-\endcode
+\include 3dmesh.py
+<a href="../../examples/SMESH/3dmesh.py">Download this script</a>
 
 Examples of Python scripts for Mesh operations are available by
 the following links:
@@ -128,5 +56,6 @@ the following links:
 - \subpage tui_measurements_page
 - \subpage tui_generate_flat_elements_page
 - \subpage tui_work_on_objects_from_gui
+- \subpage tui_prism_3d_algo
 
 */
index 3eb7f0fe2f16756effd5dcdb397534fe95c4c3b4..4cc1ec654f4103892bc67e3a6e74df69ac39fa84 100644 (file)
@@ -1,49 +1,7 @@
 /*!
 
 \page tui_cartesian_algo Usage of Body Fitting algorithm
-
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# create a sphere
-sphere = geompy.MakeSphereR( 50 )
-geompy.addToStudy( sphere, "sphere" )
-
-# create a mesh and assign a "Body Fitting" algo
-mesh = Mesh( sphere )
-cartAlgo = mesh.BodyFitted()
-
-# define a cartesian grid using Coordinates
-coords = range(-100,100,10)
-cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
-
-# compute the mesh
-mesh.Compute()
-print "nb hexahedra",mesh.NbHexas()
-print "nb tetrahedra",mesh.NbTetras()
-print "nb polyhedra",mesh.NbPolyhedrons()
-print
-
-# define the grid by setting constant spacing
-cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
-
-mesh.Compute()
-print "nb hexahedra",mesh.NbHexas()
-print "nb tetrahedra",mesh.NbTetras()
-print "nb polyhedra",mesh.NbPolyhedrons()
-
-
-# define the grid by setting different spacing in 2 sub-ranges of geometry
-spaceFuns = ["5","10+10*t"]
-cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
-
-mesh.Compute()
-print "nb hexahedra",mesh.NbHexas()
-print "nb tetrahedra",mesh.NbTetras()
-print "nb polyhedra",mesh.NbPolyhedrons()
-print
-
-\endcode
+\include cartesian_algo.py
+<a href="../../examples/SMESH/cartesian_algo.py">Download this script</a>
 
 */
index 24161d483df084fb02a673ffa9d7d38b647bad91..bdeeb8a7a9957243e1f5d20dc26e9853b66c9fc6 100644 (file)
 
 <br>
 <h2>Construction of a Mesh</h2>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments(7)
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea(800.)
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume(900.)
-
-# compute the mesh
-ret = tetra.Compute()
-if ret == 0:
-    print "problem when computing the mesh"
-else:
-    print "mesh computed"
-    pass
-\endcode
+\include creating_meshes_ex01.py
+<a href="../../examples/SMESH/creating_meshes_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_construction_submesh
 <h2>Construction of a Submesh</h2>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# select one edge of the box for definition of a local hypothesis
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
-
-# create a regular 1D algorithm for the faces
-algo1D = quadra.Segment()
-
-# define "NumberOfSegments" hypothesis to cut
-# all the edges in a fixed number of segments
-algo1D.NumberOfSegments(4)
-
-# create a quadrangle 2D algorithm for the faces
-quadra.Quadrangle()
-
-# construct a submesh on the edge with a local hypothesis
-algo_local = quadra.Segment(EdgeX)
-
-# define "Arithmetic1D" hypothesis to cut the edge in several segments with increasing arithmetic length
-algo_local.Arithmetic1D(1, 4)
-
-# define "Propagation" hypothesis that propagates all other hypotheses
-# on all edges of the opposite side in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-quadra.Compute()
-
-\endcode
+\include creating_meshes_ex02.py
+<a href="../../examples/SMESH/creating_meshes_ex02.py">Download this script</a>
 
 <br>
 <h2>Change priority of submeshes in Mesh</h2>
-
-\code
-import salome
-import geompy
-import smesh
-import SMESH
-
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
-
-# create Mesh object on Box shape
-Mesh_1 = smesh.Mesh(Box_1)
-
-# assign mesh algorithms
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
-Nb_Segments_1.SetDistrType( 0 )
-MEFISTO_2D = Mesh_1.Triangle()
-Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200)
-Tetrahedron = Mesh_1.Tetrahedron()
-Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
-
-# create submesh and assign algorithms on Face_1
-Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
-Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
-Nb_Segments_2.SetDistrType( 0 )
-MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
-Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
-SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
-
-# create submesh and assign algorithms on Face_2
-Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
-Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
-Nb_Segments_3.SetDistrType( 0 )
-MEFISTO_2D_2 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_2)
-Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
-SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
-
-# create submesh and assign algorithms on Face_3
-Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
-Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
-Nb_Segments_4.SetDistrType( 0 )
-MEFISTO_2D_3 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_3)
-Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
-SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
-
-# check exisiting submesh priority order
-[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
-# set new submesh order
-isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
-# compute mesh
-isDone = Mesh_1.Compute()
-
-# clear mesh result and compute with other submesh order
-Mesh_1.Clear()
-isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
-isDone = Mesh_1.Compute()
-
-\endcode
+\include creating_meshes_ex03.py
+<a href="../../examples/SMESH/creating_meshes_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_editing_mesh
 <h2>Editing of a mesh</h2>
-
-\code
-import geompy
-import smesh
-
-def PrintMeshInfo(theMesh):
-    aMesh = theMesh.GetMesh()
-    print "Information about mesh:"
-    print "Number of nodes       : ", aMesh.NbNodes()
-    print "Number of edges       : ", aMesh.NbEdges()
-    print "Number of faces       : ", aMesh.NbFaces()
-    print "Number of volumes     : ", aMesh.NbVolumes()
-    pass
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
-geompy.addToStudy(box, "box")
-
-# select one edge of the box for definition of a local hypothesis
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
-edge = subShapeList[0]
-name = geompy.SubShapeName(edge, box)
-geompy.addToStudyInFather(box, edge, name)
-
-# create a mesh
-tria = smesh.Mesh(box, "Mesh 2D")
-algo1D = tria.Segment()
-hyp1 = algo1D.NumberOfSegments(3)
-algo2D = tria.Triangle()
-hyp2 = algo2D.MaxElementArea(10.)
-
-# create a sub-mesh
-algo_local = tria.Segment(edge)
-hyp3 = algo_local.Arithmetic1D(1, 6)
-hyp4 = algo_local.Propagation()
-
-# compute the mesh
-tria.Compute()
-PrintMeshInfo(tria)
-
-# remove a local hypothesis
-mesh = tria.GetMesh()
-mesh.RemoveHypothesis(edge, hyp4)
-
-# compute the mesh
-tria.Compute()
-PrintMeshInfo(tria)
-
-# change the value of the 2D hypothesis
-hyp2.SetMaxElementArea(2.)
-
-# compute the mesh
-tria.Compute()
-PrintMeshInfo(tria)
-\endcode
+\include creating_meshes_ex04.py
+<a href="../../examples/SMESH/creating_meshes_ex04.py">Download this script</a>
 
 <br>
 \anchor tui_export_mesh
 <h2>Export of a Mesh</h2>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments(7)
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea(800.)
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume(900.)
-
-# compute the mesh
-tetra.Compute()
-
-# export the mesh in a MED file
-tetra.ExportMED("/tmp/meshMED.med", 0)
-
-# export a group in a MED file
-face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
-group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
-tetra.ExportMED("/tmp/groupMED.med", meshPart=group)
-\endcode
+\include creating_meshes_ex05.py
+<a href="../../examples/SMESH/creating_meshes_ex05.py">Download this script</a>
 
 <br>
 <h2>How to mesh a cylinder with hexahedrons?</h2>
 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 ex24_cylinder.py
+\include creating_meshes_ex06.py
+<a href="../../examples/SMESH/creating_meshes_ex06.py">Download this script</a>
 
 \image html mesh_cylinder_hexa.png
 
 <br>
 \anchor tui_building_compound
 <h2>Building a compound of meshes</h2>
-\dontinclude SMESH_BuildCompound.py
-\skipline import geompy
-\until #end
+\include creating_meshes_ex07.py
+<a href="../../examples/SMESH/creating_meshes_ex07.py">Download this script</a>
 
 <br>
 \anchor tui_copy_mesh
 <h2>Mesh Copying</h2>
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# make geometry of a box
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
-
-# generate 3D mesh
-mesh = Mesh(box)
-localAlgo = mesh.Triangle(face)
-mesh.AutomaticHexahedralization()
-
-# objects to copy
-fGroup = mesh.GroupOnGeom( face, "2D on face")
-nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
-subMesh = localAlgo.GetSubMesh()
-
-# make a new mesh by copying different parts of the mesh
-
-# 1. copy the whole mesh
-newMesh = CopyMesh( mesh, "whole mesh copy")
-
-# 2. copy a group of 2D elements along with groups
-newMesh = CopyMesh( fGroup,  "face group copy with groups",toCopyGroups=True)
-
-# 3. copy a group of nodes with preseving their ids
-newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
-
-# 4. copy some faces
-faceIds = fGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
-
-# 5. copy some nodes
-nodeIds = nGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
-
-# 6. copy a sub-mesh
-newMesh = CopyMesh( subMesh, "submesh copy" )
-\endcode
+\include creating_meshes_ex08.py
+<a href="../../examples/SMESH/creating_meshes_ex08.py">Download this script</a>
 
 */
index d9e2b31f9cc56400922037e515cb0fbe7d7743de..3f3124db3df216755c23b75fafa5ed511dd2cfe4 100644 (file)
@@ -44,738 +44,102 @@ This page provides example codes of \ref tui_defining_meshing_algos
 <br>
 \anchor tui_1d_arithmetic
 <h3>Arithmetic 1D</h3>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
-geompy.addToStudy(box, "Box")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# create a Regular 1D algorithm for edges
-algo1D = hexa.Segment()
-
-# optionally reverse node distribution on certain edges
-allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
-reversedEdges = [ allEdges[0], allEdges[4] ]
-
-# define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
-algo1D.Arithmetic1D(1, 4, reversedEdges)
-
-# create a quadrangle 2D algorithm for faces
-hexa.Quadrangle()
-
-# create a hexahedron 3D algorithm for solids
-hexa.Hexahedron()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex01.py
+<a href="../../examples/SMESH/defining_hypotheses_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_deflection_1d
 <h3>Deflection 1D and Number of Segments</h3>
-
-\code
-import geompy
-import smesh
-
-# create a face from arc and straight segment
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-pz = geompy.MakeVertex(0.  , 0.  , 100.)
-
-exy = geompy.MakeEdge(px, py)
-arc = geompy.MakeArc(py, pz, px)
-
-wire = geompy.MakeWire([exy, arc])
-
-isPlanarFace = 1
-face1 = geompy.MakeFace(wire, isPlanarFace)
-geompy.addToStudy(face1,"Face1")
-
-# get edges from the face
-e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
-geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
-
-# create hexahedral mesh
-hexa = smesh.Mesh(face1, "Face : triangle mesh")
-
-# define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
-algo1D = hexa.Segment()
-algo1D.NumberOfSegments(6)
-
-# define "MaxElementArea" hypothesis
-algo2D = hexa.Triangle()
-algo2D.MaxElementArea(70.0)
-
-# define a local "Deflection1D" hypothesis on the arc
-algo_local = hexa.Segment(e_arc)
-algo_local.Deflection1D(1.0)
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex02.py
+<a href="../../examples/SMESH/defining_hypotheses_ex02.py">Download this script</a>
 
 <br>
 \anchor tui_start_and_end_length
 <h3>Start and End Length</h3>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# set algorithms
-algo1D = hexa.Segment()
-hexa.Quadrangle()
-hexa.Hexahedron()
-
-# define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
-algo1D.NumberOfSegments(4)
-
-# create a local hypothesis
-algo_local = hexa.Segment(EdgeX)
-
-# define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
-algo_local.StartEndLength(1, 6)
-
-# define "Propagation" hypothesis that propagates all other hypothesis
-# on all edges on the opposite side in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex03.py
+<a href="../../examples/SMESH/defining_hypotheses_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_average_length
 <h3>Local Length</h3>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# set algorithms
-algo1D = hexa.Segment()
-hexa.Quadrangle()
-hexa.Hexahedron()
-
-# define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
-algo1D.NumberOfSegments(4)
-
-# create a sub-mesh
-algo_local = hexa.Segment(EdgeX)
-
-# define "LocalLength" hypothesis to cut an edge in several segments with the same length
-algo_local.LocalLength(2.)
-
-# define "Propagation" hypothesis that propagates all other hypothesis
-# on all edges on the opposite side in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex04.py
+<a href="../../examples/SMESH/defining_hypotheses_ex04.py">Download this script</a>
 
 <br><h2>Defining 2D and 3D hypotheses</h2>
 
 <br>
 \anchor tui_max_element_area
 <h3>Maximum Element Area</h3>
-
-\code
-import geompy
-import smesh
-import salome 
-
-# create a face
-px   = geompy.MakeVertex(100., 0.  , 0.  )
-py   = geompy.MakeVertex(0.  , 100., 0.  )
-pz   = geompy.MakeVertex(0.  , 0.  , 100.)
-
-vxy = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, pz, px)
-wire = geompy.MakeWire([vxy, arc])
-
-isPlanarFace = 1
-face = geompy.MakeFace(wire, isPlanarFace)
-
-# add the face in the study
-id_face = geompy.addToStudy(face, "Face to be meshed")
-
-# create a mesh
-tria_mesh = smesh.Mesh(face, "Face : triangulation")
-
-# define 1D meshing:
-algo = tria_mesh.Segment()
-algo.NumberOfSegments(20)
-
-# define 2D meshing:
-
-# assign triangulation algorithm
-algo = tria_mesh.Triangle()
-
-# apply "Max Element Area" hypothesis to each triangle
-algo.MaxElementArea(100)
-
-# compute the mesh
-tria_mesh.Compute()
-\endcode
+\include defining_hypotheses_ex05.py
+<a href="../../examples/SMESH/defining_hypotheses_ex05.py">Download this script</a>
 
 <br>
 \anchor tui_max_element_volume
 <h3>Maximum Element Volume</h3>
-
-\code
-import geompy
-import smesh
-
-# create a cylinder
-cyl = geompy.MakeCylinderRH(30., 50.)
-geompy.addToStudy(cyl, "cyl")
-
-# create a mesh on the cylinder
-tetra = smesh.Mesh(cyl, "Cylinder : tetrahedrical mesh")
-
-# assign algorithms
-algo1D = tetra.Segment()
-algo2D = tetra.Triangle()
-algo3D = tetra.Tetrahedron()
-
-# assign 1D and 2D hypotheses
-algo1D.NumberOfSegments(7)
-algo2D.MaxElementArea(150.)
-
-# assign Max Element Volume hypothesis
-algo3D.MaxElementVolume(200.)
-
-# compute the mesh
-ret = tetra.Compute()
-if ret == 0:
-    print "probleme when computing the mesh"
-else:
-    print "Computation succeded"
-\endcode
+\include defining_hypotheses_ex06.py
+<a href="../../examples/SMESH/defining_hypotheses_ex06.py">Download this script</a>
 
 <br>
 \anchor tui_length_from_edges
 <h3>Length from Edges</h3>
-
-\code
-import geompy
-import smesh
-
-# create sketchers
-sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
-sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
-
-# create a face from two wires
-isPlanarFace = 1
-face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
-geompy.addToStudy(face1, "Face1")
-
-# create a mesh
-tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
-
-# Define 1D meshing
-algo1D = tria.Segment()
-algo1D.NumberOfSegments(2)
-
-# create and assign the algorithm for 2D meshing with triangles
-algo2D = tria.Triangle()
-
-# create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
-algo2D.LengthFromEdges()
-
-# compute the mesh
-tria.Compute()
-\endcode
+\include defining_hypotheses_ex07.py
+<a href="../../examples/SMESH/defining_hypotheses_ex07.py">Download this script</a>
 
 <br><h2>Defining Additional Hypotheses</h2>
 
 <br>
 \anchor tui_propagation
 <h3>Propagation</h3>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# set global algorithms and hypotheses
-algo1D = hexa.Segment()
-hexa.Quadrangle()
-hexa.Hexahedron()
-algo1D.NumberOfSegments(4)
-
-# create a sub-mesh with local 1D hypothesis and propagation
-algo_local = hexa.Segment(EdgeX)
-
-# define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
-algo_local.Arithmetic1D(1, 4)
-
-# define "Propagation" hypothesis that propagates all other 1D hypotheses
-# from all edges on the opposite side of a face in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex08.py
+<a href="../../examples/SMESH/defining_hypotheses_ex08.py">Download this script</a>
 
 <br>
 \anchor tui_defining_meshing_algos
 <h2>Defining Meshing Algorithms</h2>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
-geompy.addToStudy(box, "Box")
-
-# 1. Create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# create a Regular 1D algorithm for edges
-algo1D = hexa.Segment()
-
-# create a quadrangle 2D algorithm for faces
-algo2D = hexa.Quadrangle()
-
-# create a hexahedron 3D algorithm for solids
-algo3D = hexa.Hexahedron()
-
-# define hypotheses
-algo1D.Arithmetic1D(1, 4)
-
-# compute the mesh
-hexa.Compute()
-
-# 2. Create a tetrahedral mesh on the box
-tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
-
-# create a Regular 1D algorithm for edges
-algo1D = tetra.Segment()
-
-# create a Mefisto 2D algorithm for faces
-algo2D = tetra.Triangle()
-
-# create a 3D algorithm for solids
-algo3D = tetra.Tetrahedron()
-
-# define hypotheses
-algo1D.Arithmetic1D(1, 4)
-algo2D.LengthFromEdges()
-
-# compute the mesh
-tetra.Compute()
-
-\endcode
+\include defining_hypotheses_ex09.py
+<a href="../../examples/SMESH/defining_hypotheses_ex09.py">Download this script</a>
 
 <br>
 \anchor tui_projection
 <h3>Projection Algorithms</h3>
-
-\code
-# Project prisms from one meshed box to another mesh on the same box
-
-from smesh import *
-
-# Prepare geometry
-
-# Create a parallelepiped
-box = geompy.MakeBoxDXDYDZ(200, 100, 70)
-geompy.addToStudy( box, "box" )
-
-# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
-faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-# 2 adjacent faces of the box
-f1 = faces[2]
-f2 = faces[0]
-# face opposite to f2
-f2opp = faces[1]
-
-# Get vertices used to specify how to associate sides of faces at projection
-[v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType["VERTEX"])[:2]
-[v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType["VERTEX"])[:2]
-geompy.addToStudyInFather( box, v1F1, "v1F1" )
-geompy.addToStudyInFather( box, v2F1, "v2F1" )
-geompy.addToStudyInFather( box, v1F2, "v1F2" )
-geompy.addToStudyInFather( box, v2F2, "v2F2" )
-
-# Make group of 3 edges of f1 and f2
-edgesF1 = geompy.CreateGroup(f1, geompy.ShapeType["EDGE"])
-geompy.UnionList( edgesF1, geompy.SubShapeAll(f1, geompy.ShapeType["EDGE"])[:3])
-edgesF2 = geompy.CreateGroup(f2, geompy.ShapeType["EDGE"])
-geompy.UnionList( edgesF2, geompy.SubShapeAll(f2, geompy.ShapeType["EDGE"])[:3])
-geompy.addToStudyInFather( box, edgesF1, "edgesF1" )
-geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
-
-
-# Make the source mesh with prisms
-src_mesh = Mesh(box, "Source mesh")
-src_mesh.Segment().NumberOfSegments(9,10)
-src_mesh.Quadrangle()
-src_mesh.Hexahedron()
-src_mesh.Triangle(f1) # triangular sumbesh 
-src_mesh.Compute()
-
-
-# Mesh the box using projection algoritms
-
-# Define the same global 1D and 2D hypotheses
-tgt_mesh = Mesh(box, "Target mesh")
-tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
-tgt_mesh.Quadrangle()
-
-# Define Projection 1D algorithm to project 1d mesh elements from group edgesF2 to edgesF1
-# It is actually not needed, just a demonstration
-proj1D = tgt_mesh.Projection1D( edgesF1 )
-# each vertex must be at the end of a connected group of edges (or a sole edge)
-proj1D.SourceEdge( edgesF2, src_mesh, v2F1, v2F2 )
-
-# Define 2D hypotheses to project triangles from f1 face of the source mesh to
-# f2 face in the target mesh. Vertices specify how to associate sides of faces
-proj2D = tgt_mesh.Projection2D( f2 )
-proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 )
-
-# 2D hypotheses to project triangles from f2 of target mesh to the face opposite to f2.
-# Association of face sides is default
-proj2D = tgt_mesh.Projection2D( f2opp )
-proj2D.SourceFace( f2 )
-
-# 3D hypotheses to project prisms from the source to the target mesh
-proj3D = tgt_mesh.Projection3D()
-proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
-tgt_mesh.Compute()
-
-# Move the source mesh to visualy compare the two meshes
-src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
-
-\endcode
+\include defining_hypotheses_ex10.py
+<a href="../../examples/SMESH/defining_hypotheses_ex10.py">Download this script</a>
 
 <h3>Projection 1D2D</h3>
-
-\code
-# Project triangles from one meshed face to another mesh on the same box
-
-from smesh import *
-
-# Prepare geometry
-
-# Create a box
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-
-# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
-faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-# 2 adjacent faces of the box
-Face_1 = faces[2]
-Face_2 = faces[0]
-
-geompy.addToStudy( box, 'box' )
-geompy.addToStudyInFather( box, Face_1, 'Face_1' )
-geompy.addToStudyInFather( box, Face_2, 'Face_2' )
-
-# Make the source mesh with Netgem2D
-src_mesh = Mesh(Face_1, "Source mesh")
-src_mesh.Segment().NumberOfSegments(15)
-src_mesh.Triangle()
-src_mesh.Compute()
-
-# Mesh the target mesh using the algoritm Projection1D2D
-tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
-tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
-tgt_mesh.Compute()
-\endcode
+\include defining_hypotheses_ex11.py
+<a href="../../examples/SMESH/defining_hypotheses_ex11.py">Download this script</a>
 
 <br>
 
 \anchor tui_fixed_points
 
 <h2>1D Mesh with Fixed Points example</h2>
-
-\code
-import salome
-import geompy
-import smesh
-import StdMeshers
-
-# Create face and explode it on edges
-face = geompy.MakeFaceHW(100, 100, 1)
-edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
-geompy.addToStudy( face, "Face" )
-
-# get the first edge from exploded result
-edge1 = geompy.GetSubShapeID(face, edges[0])
-
-# Define Mesh on previously created face
-Mesh_1 = smesh.Mesh(face)
-
-# Create Fixed Point 1D hypothesis and define parameters.
-# Note: values greater than 1.0 and less than 0.0 are not taken into account;
-# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
-# add added automatically.
-# The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
-# extra values of segments splitting parameter are not taken into account,
-# while missing values are considered to be equal to 1.
-Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
-Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
-Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
-Fixed_points_1D_1.SetReversedEdges( [edge1] )
-
-# Add hypothesis to mesh and define 2D parameters
-Mesh_1.AddHypothesis(Fixed_points_1D_1)
-Regular_1D = Mesh_1.Segment()
-Quadrangle_2D = Mesh_1.Quadrangle()
-# Compute mesh
-Mesh_1.Compute()
-\endcode
+\include defining_hypotheses_ex12.py
+<a href="../../examples/SMESH/defining_hypotheses_ex12.py">Download this script</a>
 
 \anchor tui_radial_quadrangle
 <h2> Radial Quadrangle 1D2D example </h2>
-\code
-from smesh import *
-
-SetCurrentStudy(salome.myStudy)
-
-# Create face from the wire and add to study
-Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
-geompy.addToStudy(Face,"Face")
-edges = geompy.SubShapeAllSorted(Face, geompy.ShapeType["EDGE"])
-circle, radius1, radius2 = edges
-geompy.addToStudyInFather(Face, radius1,"radius1")
-geompy.addToStudyInFather(Face, radius2,"radius2")
-geompy.addToStudyInFather(Face, circle,"circle")
-
-
-# Define geometry for mesh, and Radial Quadrange algorithm
-mesh = smesh.Mesh(Face)
-radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
-
-# The Radial Quadrange algorithm can work without any hypothesis
-# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
-mesh.Compute()
-
-# The Radial Quadrange uses global or local 1d hypotheses if it does
-# not have its own hypotheses.
-# Define global hypotheses to discretize radial edges and a local one for circular edge
-global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
-local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
-mesh.Compute()
-
-# Define own parameters of Radial Quadrange algorithm
-radial_Quad_algo.NumberOfLayers( 4 )
-mesh.Compute()
-\endcode
+\include defining_hypotheses_ex13.py
+<a href="../../examples/SMESH/defining_hypotheses_ex13.py">Download this script</a>
 
 \anchor tui_quadrangle_parameters
 <h2>Quadrangle Parameters example 1 (meshing a face with 3 edges) </h2>
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# Get 1/4 part from the disk face.
-Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
-Disk_1 = geompy.MakeDiskR(100, 1)
-Common_1 = geompy.MakeCommon(Disk_1, Box_1)
-geompy.addToStudy( Disk_1, "Disk_1" )
-geompy.addToStudy( Box_1, "Box_1" )
-geompy.addToStudy( Common_1, "Common_1" )
-
-# Set the Geometry for meshing
-Mesh_1 = smesh.Mesh(Common_1)
-
-
-# Define 1D hypothesis and compute the mesh
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
-Nb_Segments_1.SetDistrType( 0 )
-
-# Create Quadrangle parameters and define the Base Vertex.
-Quadrangle_2D = Mesh_1.Quadrangle().TriangleVertex( 8 )
-
-Mesh_1.Compute()
-\endcode
+\include defining_hypotheses_ex14.py
+<a href="../../examples/SMESH/defining_hypotheses_ex14.py">Download this script</a>
 
 <h2>Quadrangle Parameters example 2 (using different types) </h2>
-\code
-import geompy
-import smesh
-import StdMeshers
-
-# Make quadrangle face and explode it on edges.
-Vertex_1 = geompy.MakeVertex(0, 0, 0)
-Vertex_2 = geompy.MakeVertex(40, 0, 0)
-Vertex_3 = geompy.MakeVertex(40, 30, 0)
-Vertex_4 = geompy.MakeVertex(0, 30, 0)
-Quadrangle_Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
-[Edge_1,Edge_2,Edge_3,Edge_4] = geompy.SubShapeAllSorted(Quadrangle_Face_1, geompy.ShapeType["EDGE"])
-geompy.addToStudy( Vertex_1, "Vertex_1" )
-geompy.addToStudy( Vertex_2, "Vertex_2" )
-geompy.addToStudy( Vertex_3, "Vertex_3" )
-geompy.addToStudy( Vertex_4, "Vertex_4" )
-geompy.addToStudy( Quadrangle_Face_1, "Quadrangle Face_1" )
-geompy.addToStudyInFather( Quadrangle_Face_1, Edge_2, "Edge_2" )
-
-# Set the Geometry for meshing
-Mesh_1 = smesh.Mesh(Quadrangle_Face_1)
-
-# Create Quadrangle parameters and
-# define the Type as Quadrangle Preference
-Quadrangle_Parameters_1 = smesh.CreateHypothesis('QuadrangleParams')
-Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_QUADRANGLE_PREF )
-
-# Define other hypotheses and algorithms
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
-Nb_Segments_1.SetDistrType( 0 )
-status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1)
-Quadrangle_2D = Mesh_1.Quadrangle()
-
-# Define submesh on one edge to provide different number of segments
-Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
-Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
-Nb_Segments_2.SetDistrType( 0 )
-SubMesh_1 = Regular_1D_1.GetSubMesh()
-
-# Compute mesh (with Quadrangle Preference type)
-isDone = Mesh_1.Compute()
-
-# Change type to Reduced and compute again
-Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_REDUCED )
-isDone = Mesh_1.Compute()
-\endcode
+\include defining_hypotheses_ex15.py
+<a href="../../examples/SMESH/defining_hypotheses_ex15.py">Download this script</a>
 
 \anchor tui_import
 <h2>"Use Existing Elements" example </h2>
-\code
-
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# Make a patritioned box
-
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-
-N = geompy.MakeVectorDXDYDZ( 1,0,0 )
-O = geompy.MakeVertex( 50,0,0 )
-plane = geompy.MakePlane( O, N, 200 ) # plane YOZ
-
-shape2boxes = geompy.MakeHalfPartition( box, plane )
-boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType["SOLID"])
-
-geompy.addToStudy( boxes[0], "boxes[0]")
-geompy.addToStudy( boxes[1], "boxes[1]")
-midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType["FACE"])[5]
-geompy.addToStudyInFather( boxes[0], midFace0, "middle Face")
-midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType["FACE"])[0]
-geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
-
-# Mesh one of boxes with quadrangles. It is a source mesh
-
-srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
-nSeg1 = srcMesh.Segment().NumberOfSegments(4)
-srcMesh.Quadrangle()
-srcMesh.Compute()
-srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
-
-# Import faces from midFace0 to the target mesh
-
-tgtMesh = Mesh(boxes[1], "target mesh")
-importAlgo = tgtMesh.UseExisting2DElements(midFace1)
-import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
-tgtMesh.Segment().NumberOfSegments(3)
-tgtMesh.Quadrangle()
-tgtMesh.Compute()
-
-# Import the whole source mesh with groups
-import2hyp.SetCopySourceMesh(True,True)
-tgtMesh.Compute()
-\endcode
+\include defining_hypotheses_ex16.py
+<a href="../../examples/SMESH/defining_hypotheses_ex16.py">Download this script</a>
 
 \anchor tui_viscous_layers
 <h2>Viscous layers construction</h2>
 
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-X = geompy.MakeVectorDXDYDZ( 1,0,0 )
-O = geompy.MakeVertex( 100,50,50 )
-plane = geompy.MakePlane( O, X, 200 ) # plane YZ
-
-box = geompy.MakeBoxDXDYDZ(200,100,100)
-
-shape = geompy.MakeHalfPartition( box, plane )
-
-faces = geompy.SubShapeAllSorted(shape, geompy.ShapeType["FACE"])
-face1 = faces[1]
-ignoreFaces = [ faces[0], faces[-1]]
-
-geompy.addToStudy( shape, "shape" )
-geompy.addToStudyInFather( shape, face1, "face1")
-
-
-mesh = Mesh(shape, "CFD")
-
-mesh.Segment().NumberOfSegments( 4 )
-
-mesh.Triangle()
-mesh.Quadrangle(face1)
-mesh.Compute()
-algo3D = mesh.Tetrahedron()
-
-thickness = 20
-numberOfLayers = 10
-stretchFactor = 1.5
-layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces)
-
-mesh.Compute()
-
-mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
-mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
-mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
-
-\endcode
+\include defining_hypotheses_ex17.py
+<a href="../../examples/SMESH/defining_hypotheses_ex17.py">Download this script</a>
 
 */
index 0eb41dd285ab53febe4c9b5e64c4dbac2e34d826..2540f52b87f44e11d477fd814aea66e7d8317aca 100755 (executable)
@@ -27,14 +27,8 @@ 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)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with aspect ratio > 6.5
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with aspect ratio > 6.5:", len(ids)
-\endcode
+\include filters_ex01.py
+<a href="../../examples/SMESH/filters_ex01.py">Download this script</a>
 
 \sa \ref tui_aspect_ratio
 
@@ -45,16 +39,8 @@ 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)
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get volumes with aspect ratio < 2.0
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of volumes with aspect ratio < 2.0:", len(ids)
-\endcode
+\include filters_ex02.py
+<a href="../../examples/SMESH/filters_ex02.py">Download this script</a>
 
 \sa \ref tui_aspect_ratio_3d
 
@@ -65,17 +51,8 @@ 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)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
-criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13)
-criterion.Tolerance = 5.0e-14
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion])
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
-\endcode
+\include filters_ex03.py
+<a href="../../examples/SMESH/filters_ex03.py">Download this script</a>
 
 \sa \ref tui_warping
 
@@ -86,14 +63,8 @@ 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)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with minimum angle > 75
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with minimum angle > 75:", len(ids)
-\endcode
+\include filters_ex04.py
+<a href="../../examples/SMESH/filters_ex04.py">Download this script</a>
 
 \sa \ref tui_minimum_angle
 
@@ -104,14 +75,8 @@ Filter 2D mesh elements (faces) according to the taper value:
 - functor type is \a smesh.FT_Taper
 - threshold is floating point value (taper)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with taper < 1.e-15
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_LessThan, 1.e-15)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with taper < 1.e-15:", len(ids)
-\endcode
+\include filters_ex05.py
+<a href="../../examples/SMESH/filters_ex05.py">Download this script</a>
 
 \sa \ref tui_taper
 
@@ -122,14 +87,8 @@ Filter 2D mesh elements (faces) according to the skew value:
 - functor type is \a smesh.FT_Skew
 - threshold is floating point value (skew)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with skew > 50
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 50)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with skew > 50:", len(ids)
-\endcode
+\include filters_ex06.py
+<a href="../../examples/SMESH/filters_ex06.py">Download this script</a>
 
 \sa \ref tui_skew
 
@@ -140,18 +99,8 @@ Filter 2D mesh elements (faces) according to the area value:
 - functor type is \a smesh.FT_Area
 - threshold is floating point value (area)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with area > 60 and < 90
-criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\
-                                smesh.FT_Undefined, smesh.FT_LogicalAND)
-criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90)
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion1,criterion2])
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with area in range (60,90):", len(ids)
-\endcode
+\include filters_ex07.py
+<a href="../../examples/SMESH/filters_ex07.py">Download this script</a>
 
 \sa \ref tui_area
 
@@ -162,16 +111,8 @@ Filter 3D mesh elements (volumes) according to the volume value:
 - functor type is \a smesh.FT_Volume3D
 - threshold is floating point value (volume)
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get volumes faces with volume > 100
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of volumes with volume > 100:", len(ids)
-\endcode
+\include filters_ex08.py
+<a href="../../examples/SMESH/filters_ex08.py">Download this script</a>
 
 \sa \ref tui_volume
 
@@ -182,20 +123,8 @@ Filter 1D mesh elements (edges) which represent free borders of a mesh:
 - functor type is \a smesh.FT_FreeBorders
 - threshold value is not required
 
-\code
-# create mesh
-import geompy, smesh, StdMeshers
-face = geompy.MakeFaceHW(100, 100, 1)
-geompy.addToStudy( face, "quadrangle" )
-mesh = smesh.Mesh(face)
-mesh.Segment().NumberOfSegments(10)
-mesh.Triangle().MaxElementArea(25)
-mesh.Compute()
-# get all free borders
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of edges on free borders:", len(ids)
-\endcode
+\include filters_ex09.py
+<a href="../../examples/SMESH/filters_ex09.py">Download this script</a>
 
 \sa \ref tui_free_borders
 
@@ -207,20 +136,8 @@ element of mesh only:
 - functor type is \a smesh.FT_FreeEdges
 - threshold value is not required
 
-\code
-# create mesh
-import geompy, smesh, StdMeshers
-face = geompy.MakeFaceHW(100, 100, 1)
-geompy.addToStudy( face, "quadrangle" )
-mesh = smesh.Mesh(face)
-mesh.Segment().NumberOfSegments(10)
-mesh.Triangle().MaxElementArea(25)
-mesh.Compute()
-# get all faces with free edges
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with free edges:", len(ids)
-\endcode
+\include filters_ex10.py
+<a href="../../examples/SMESH/filters_ex10.py">Download this script</a>
 
 \sa \ref tui_free_edges
 
@@ -231,16 +148,8 @@ Filter free nodes:
 - functor type is \a smesh.FT_FreeNodes
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# add node
-mesh.AddNode(0,0,0)
-# get all free nodes
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of free nodes:", len(ids)
-\endcode
+\include filters_ex11.py
+<a href="../../examples/SMESH/filters_ex11.py">Download this script</a>
 
 \sa \ref tui_free_nodes
 
@@ -251,14 +160,8 @@ Filter free faces:
 - functor type is \a smesh.FT_FreeFaces
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all free faces
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of free faces:", len(ids)
-\endcode
+\include filters_ex12.py
+<a href="../../examples/SMESH/filters_ex12.py">Download this script</a>
 
 \sa \ref tui_free_faces
 
@@ -269,16 +172,8 @@ Filter faces with bare borders:
 - functor type is \a smesh.FT_BareBorderFace
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# remove some faces to have faces with bare borders
-mesh.RemoveElements( mesh.GetElementsByType(FACE)[0:5] )
-# get all faces bare borders
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
-ids = mesh.GetIdsFromFilter(filter)
-print "Faces with bare borders:", ids
-\endcode
+\include filters_ex13.py
+<a href="../../examples/SMESH/filters_ex13.py">Download this script</a>
 
 \sa \ref tui_bare_border_faces
 
@@ -290,15 +185,8 @@ Filter faces with bare borders:
 - threshold value is the face ID
 - tolerance is in degrees
 
-\code
-# create mesh
-from SMESH_mechanic import *
-faceID = mesh.GetElementsByType(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)
-print "Number of faces coplanar with the first one:", len(ids)
-\endcode
+\include filters_ex14.py
+<a href="../../examples/SMESH/filters_ex14.py">Download this script</a>
 
 \section filter_over_constrained_faces Over-constrained faces
 
@@ -307,14 +195,8 @@ Filter over-constrained faces:
 - functor type is \a smesh.FT_OverConstrainedFace
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all over-constrained faces
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace)
-ids = mesh.GetIdsFromFilter(filter)
-print "Over-constrained faces:", ids
-\endcode
+\include filters_ex15.py
+<a href="../../examples/SMESH/filters_ex15.py">Download this script</a>
 
 \sa \ref tui_over_constrained_faces
 
@@ -326,27 +208,8 @@ filter mesh elements basing on the same set of nodes:
           smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes, 
 - threshold value is not required
 
-\code
-from smesh import *
-# make a mesh on a box
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-mesh = Mesh( box, "Box" )
-mesh.Segment().NumberOfSegments(10)
-mesh.Quadrangle()
-mesh.Hexahedron()
-mesh.Compute()
-# copy all elements with translation and Merge nodes
-mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
-mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
-# create filters to find equal elements
-equalEdgesFilter   = GetFilter(SMESH.EDGE, FT_EqualEdges)
-equalFacesFilter   = GetFilter(SMESH.FACE, FT_EqualFaces)
-equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes)
-# get equal elements
-print "Number of equal edges:",   len( mesh.GetIdsFromFilter( equalEdgesFilter ))
-print "Number of equal faces:",   len( mesh.GetIdsFromFilter( equalFacesFilter ))
-print "Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter ))
-\endcode
+\include filters_ex16.py
+<a href="../../examples/SMESH/filters_ex16.py">Download this script</a>
 
 
 \section tui_double_nodes_control Double nodes
@@ -357,22 +220,8 @@ filters mesh nodes which are coincident with other nodes (within a given toleran
 - threshold value is not required
 - default tolerance is 1.0e-7
 
-\code
-from smesh import *
-# make a mesh on a box
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-mesh = Mesh( box, "Box" )
-mesh.Segment().NumberOfSegments(10)
-mesh.Quadrangle()
-mesh.Hexahedron()
-mesh.Compute()
-# copy all elements with translation
-mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
-# create filters to find nodes equal within tolerance of 1e-5
-filter = GetFilter(SMESH.NODE, FT_EqualNodes, Tolerance=1e-5)
-# get equal nodes
-print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
-\endcode
+\include filters_ex17.py
+<a href="../../examples/SMESH/filters_ex17.py">Download this script</a>
 
 
 \section filter_borders_multiconnection Borders at multi-connection
@@ -383,14 +232,8 @@ connections (faces belonging the border edges)
 - functor type is \a smesh.FT_MultiConnection
 - threshold is integer value (number of connections)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get border edges with number of connected faces = 5
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 5)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of border edges with 5 faces connected:", len(ids)
-\endcode
+\include filters_ex18.py
+<a href="../../examples/SMESH/filters_ex18.py">Download this script</a>
 
 \sa \ref tui_borders_at_multiconnection
 
@@ -402,14 +245,8 @@ to the specified number of mesh elements
 - functor type is \a smesh.FT_MultiConnection2D
 - threshold is integer value (number of connections)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces which consist of edges belonging to 2 mesh elements
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, 2)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces consisting of edges belonging to 2 faces:", len(ids)
-\endcode
+\include filters_ex19.py
+<a href="../../examples/SMESH/filters_ex19.py">Download this script</a>
 
 \sa \ref tui_borders_at_multiconnection_2d
 
@@ -420,14 +257,8 @@ 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)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get edges with length > 14
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 14)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of edges with length > 14:", len(ids)
-\endcode
+\include filters_ex20.py
+<a href="../../examples/SMESH/filters_ex20.py">Download this script</a>
 
 \sa \ref tui_length_1d
 
@@ -439,14 +270,8 @@ value of its edges:
 - functor type should be \a smesh.FT_Length2D
 - threshold is floating point value (edge length)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all faces that have edges with length > 14
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, 14)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with maximum edge length > 14:", len(ids)
-\endcode
+\include filters_ex21.py
+<a href="../../examples/SMESH/filters_ex21.py">Download this script</a>
 
 \sa \ref tui_length_2d
 
@@ -458,14 +283,8 @@ value of its edges and diagonals:
 - functor type should be \a smesh.FT_MaxElementLength2D
 - threshold is floating point value (edge/diagonal length)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all faces that have elements with length > 10
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with maximum element length > 10:", len(ids)
-\endcode
+\include filters_ex22.py
+<a href="../../examples/SMESH/filters_ex22.py">Download this script</a>
 
 \sa \ref tui_max_element_length_2d
 
@@ -477,16 +296,8 @@ value of its edges and diagonals:
 - functor type should be \a smesh.FT_MaxElementLength3D
 - threshold is floating point value (edge/diagonal length)
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get all volumes that have elements with length > 10
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of volumes with maximum element length > 10:", len(ids)
-\endcode
+\include filters_ex23.py
+<a href="../../examples/SMESH/filters_ex23.py">Download this script</a>
 
 \sa \ref tui_max_element_length_3d
 
@@ -497,18 +308,8 @@ Filter 3D mesh elements with bare borders:
 - functor type is \a smesh.FT_BareBorderVolume
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# remove some volumes to have volumes with bare borders
-mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
-# get all volumes with bare borders
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume)
-ids = mesh.GetIdsFromFilter(filter)
-print "Volumes with bare borders:", ids
-\endcode
+\include filters_ex24.py
+<a href="../../examples/SMESH/filters_ex24.py">Download this script</a>
 
 \sa \ref tui_bare_border_volumes
 
@@ -519,16 +320,8 @@ Filter over-constrained volumes:
 - functor type is \a smesh.FT_OverConstrainedVolume
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get all over-constrained volumes
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume)
-ids = mesh.GetIdsFromFilter(filter)
-print "Over-constrained volumes:", ids
-\endcode
+\include filters_ex25.py
+<a href="../../examples/SMESH/filters_ex25.py">Download this script</a>
 
 \sa \ref tui_over_constrained_faces
 
@@ -540,14 +333,8 @@ shape defined by threshold value:
 - functor type should be \a smesh.FT_BelongToGeom
 - threshold is geometrical object
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all faces which nodes lie on the face sub_face3
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToGeom, sub_face3)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces which nodes lie on sub_face3:", len(ids)
-\endcode
+\include filters_ex26.py
+<a href="../../examples/SMESH/filters_ex26.py">Download this script</a>
 
 \section filter_lying_on_geom Lying on Geom
 
@@ -557,14 +344,8 @@ shape defined by threshold value:
 - functor type should be \a smesh.FT_LyingOnGeom
 - threshold is geometrical object
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all faces at least one node of each lies on the face sub_face3
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_LyingOnGeom, sub_face3)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces at least one node of each lies on sub_face3:", len(ids)
-\endcode
+\include filters_ex27.py
+<a href="../../examples/SMESH/filters_ex27.py">Download this script</a>
 
 \section filter_belong_to_plane Belong to Plane
 
@@ -575,18 +356,8 @@ plane defined by threshold value with the given tolerance:
 - threshold is geometrical object (plane)
 - default tolerance is 1.0e-7
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# create plane
-import geompy
-plane_1 = geompy.MakePlane(p3,seg1,2000)
-geompy.addToStudy(plane_1, "plane_1")
-# get all nodes which lie on the plane \a plane_1
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToPlane, plane_1)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of nodes which lie on the plane plane_1:", len(ids)
-\endcode
+\include filters_ex28.py
+<a href="../../examples/SMESH/filters_ex28.py">Download this script</a>
 
 \section filter_belong_to_cylinder Belong to Cylinder
 
@@ -597,14 +368,8 @@ cylindrical face defined by threshold value with the given tolerance:
 - threshold is geometrical object (cylindrical face)
 - default tolerance is 1.0e-7
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all faces which lie on the cylindrical face \a sub_face1
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToCylinder, sub_face1)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)
-\endcode
+\include filters_ex29.py
+<a href="../../examples/SMESH/filters_ex29.py">Download this script</a>
 
 \section filter_belong_to_surface Belong to Surface
 
@@ -615,18 +380,8 @@ arbitrary surface defined by threshold value with the given tolerance:
 - threshold is geometrical object (arbitrary surface)
 - default tolerance is 1.0e-7
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# create b-spline
-spline_1 = geompy.MakeInterpol([p4,p6,p3,p1])
-surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 )
-geompy.addToStudy(surface_1, "surface_1")
-# get all nodes which lie on the surface \a surface_1
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToGenSurface, surface_1)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of nodes which lie on the surface surface_1:", len(ids)
-\endcode
+\include filters_ex30.py
+<a href="../../examples/SMESH/filters_ex30.py">Download this script</a>
 
 \section filter_range_of_ids Range of IDs
 
@@ -636,18 +391,8 @@ 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" 
 
-\code
-# 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",\
-                                BinaryOp=smesh.FT_LogicalOR)
-criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Treshold="15-30")
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion1,criterion2])
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of nodes in ranges [5-10] and [15-30]:", len(ids)
-\endcode
+\include filters_ex31.py
+<a href="../../examples/SMESH/filters_ex31.py">Download this script</a>
 
 \section filter_bad_oriented_volume Badly oriented volume
 
@@ -657,16 +402,8 @@ the point of view of MED convention.
 - functor type is \a smesh.FT_BadOrientedVolume
 - threshold is not required
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get all badly oriented volumes
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of badly oriented volumes:", len(ids)
-\endcode
+\include filters_ex32.py
+<a href="../../examples/SMESH/filters_ex32.py">Download this script</a>
 
 \section filter_linear_or_quadratic Linear / quadratic
 
@@ -677,23 +414,8 @@ 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
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get number of linear and quadratic edges
-filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic)
-filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT)
-ids_linear = mesh.GetIdsFromFilter(filter_linear)
-ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
-print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
-# convert mesh to quadratic
-print "Convert to quadratic..."
-mesh.ConvertToQuadratic(True)
-# get number of linear and quadratic edges
-ids_linear = mesh.GetIdsFromFilter(filter_linear)
-ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
-print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
-\endcode
+\include filters_ex33.py
+<a href="../../examples/SMESH/filters_ex33.py">Download this script</a>
 
 \section filter_group_color Group color
 
@@ -702,20 +424,8 @@ 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
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# create group of edges
-all_edges = mesh.GetElementsByType(smesh.EDGE)
-grp = mesh.MakeGroupByIds("edges group", smesh.EDGE, all_edges[:len(all_edges)/4])
-import SALOMEDS
-c = SALOMEDS.Color(0.1, 0.5, 1.0)
-grp.SetColor(c)
-# get number of the edges not belonging to the group with the given color
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_GroupColor, c, smesh.FT_LogicalNOT)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)
-\endcode
+\include filters_ex34.py
+<a href="../../examples/SMESH/filters_ex34.py">Download this script</a>
 
 \section filter_geom_type Geometry type
 
@@ -726,25 +436,8 @@ entity type.
 - functor type should be \a smesh.FT_ElemGeomType
 - threshold is of smesh.GeometryType value
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get all triangles, quadrangles, tetrahedrons, pyramids
-filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE)
-filter_qua = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
-filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA)
-filter_pyr = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_PYRAMID)
-ids_tri = mesh.GetIdsFromFilter(filter_tri)
-ids_qua = mesh.GetIdsFromFilter(filter_qua)
-ids_tet = mesh.GetIdsFromFilter(filter_tet)
-ids_pyr = mesh.GetIdsFromFilter(filter_pyr)
-print "Number of triangles:", len(ids_tri)
-print "Number of quadrangles:", len(ids_qua)
-print "Number of tetrahedrons:", len(ids_tet)
-print "Number of pyramids:", len(ids_pyr)
-\endcode
+\include filters_ex35.py
+<a href="../../examples/SMESH/filters_ex35.py">Download this script</a>
 
 \section combining_filters How to combine filters with Criterion structures?
 
@@ -752,19 +445,8 @@ Filters can be combined by making use of "criteria".
 
 Example :
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all the quadrangle faces ...
-criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE, smesh.FT_LogicalAND)
-# ... AND do NOT get those from sub_face3
-criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_BelongToGeom, sub_face3, smesh.FT_LogicalNOT)
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion1,criterion2])
-ids = mesh.GetIdsFromFilter(filter)
-
-myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids)
-\endcode
+\include filters_ex36.py
+<a href="../../examples/SMESH/filters_ex36.py">Download this script</a>
 
 
 */
index eaf544556d83eb969f75b83b906d1b70cd82cad2..36e13d30424ac6b62366d8da9a5b151e08725cbc 100644 (file)
@@ -17,66 +17,15 @@ 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.
 
-\code
-import geompy
-import smesh
-import SMESH
-# geometry 
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-Vertex_1 = geompy.MakeVertex(50, 0, 0)
-Cylinder_1 = geompy.MakeCylinder(O, OX, 10, 500)
-Cylinder_2 = geompy.MakeCylinder(Vertex_1, OX, 100, 400)
-Vertex_2 = geompy.MakeVertex(-200, -200, -200)
-Vertex_3 = geompy.MakeVertex(250, 200, 200)
-Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
-Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
-Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
-[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
-[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
-Vertex_4 = geompy.MakeVertex(450, 0, 0)
-Vertex_5 = geompy.MakeVertex(500, 0, 0)
-Vertex_6 = geompy.MakeVertex(550, 0, 0)
-vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
-vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
-[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON)
-[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON)
-
-# meshing (we have linear tetrahedrons here, but other elements are OK)
-
-Mesh_1 = smesh.Mesh(Partition_1)
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
-MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO)
-Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
-ALGO3D = Mesh_1.Tetrahedron()
-isDone = Mesh_1.Compute()
-
-# relevant groups of volumes and faces
-
-Solid_1_1 = Mesh_1.GroupOnGeom(Solid_1,'Solid_1',SMESH.VOLUME)
-Solid_2_1 = Mesh_1.GroupOnGeom(Solid_2,'Solid_2',SMESH.VOLUME)
-Solid_3_1 = Mesh_1.GroupOnGeom(Solid_3,'Solid_3',SMESH.VOLUME)
-Solid_4_1 = Mesh_1.GroupOnGeom(Solid_4,'Solid_4',SMESH.VOLUME)
-Face_1_1 = Mesh_1.GroupOnGeom(Face_1,'Face_1',SMESH.FACE)
-Face_2_1 = Mesh_1.GroupOnGeom(Face_2,'Face_2',SMESH.FACE)
-
-\endcode
+\include generate_flat_elements.py
+<a href="../../examples/SMESH/generate_flat_elements.py">Download this script</a>
 
 \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 following code.
+The flat elements on group boundaries and on faces are built with the
+2 last lines of the code above.
 \n If the last argument (Boolean) in DoubleNodesOnGroupBoundaries is set to 1,
 the flat elements are built, otherwise, there is only a duplication of the nodes.
 
-\code
-Mesh_1.DoubleNodesOnGroupBoundaries([Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1], 1)
-
-Mesh_1.CreateFlatElementsOnFacesGroups([Face_1_1, Face_2_1])
-\endcode
-
 \n To observe flat element groups, save the resulting mesh on a MED file and reload it.
 
 */
index 3b769060a0599551902f575523467b7573c2b5a2..d3113ab2c26997d7d392a238c1bcd85bbf7d0af3 100644 (file)
 <br>
 \anchor tui_create_standalone_group
 <h2>Create a Standalone Group</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Get ids of all faces with area > 100 
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# create a group consisting of faces with area > 100
-aGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
-
-# create a group that contains all nodes from the mesh
-aGroup2 = mesh.CreateEmptyGroup(smesh.NODE, "all nodes")
-aGroup2.AddFrom(mesh.mesh)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex01.py
+<a href="../../examples/SMESH/grouping_elements_ex01.py">Download this script</a>
 
 \image html create_group.png
 
 <br>
 \anchor tui_create_group_on_geometry
 <h2>Create a Group on Geometry</h2>
-
-\code
-import salome
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
-geompy.addToStudy(box, "box")
-
-# add the first face of the box to the study
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-geompy.addToStudyInFather(box, face, "face 1") 
-
-# create group of edges on the face
-aGeomGroupE = geompy.CreateGroup(face, geompy.ShapeType["EDGE"])
-geompy.AddObject(aGeomGroupE, 3)
-geompy.AddObject(aGeomGroupE, 6)
-geompy.AddObject(aGeomGroupE, 8)
-geompy.AddObject(aGeomGroupE, 10)
-geompy.addToStudyInFather(face, aGeomGroupE, "Group of Edges")
-
-# create quadrangle 2D mesh on the box
-quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
-algo1D = quadra.Segment()
-quadra.Quadrangle()
-algo1D.NumberOfSegments(7) 
-
-# compute the mesh
-quadra.Compute()
-
-# create SMESH group on the face with name "SMESHGroup1"
-aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1")
-
-# create SMESH group on <aGeomGroupE> with default name
-aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE) 
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex02.py
+<a href="../../examples/SMESH/grouping_elements_ex02.py">Download this script</a>
 
 <br>
 \anchor tui_create_group_on_filter
 
 <h2>Create a Group on Filter</h2>
-
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-box = geompy.MakeBoxDXDYDZ(10,10,10)
-
-# make a mesh with quadrangles of different area in range [1,16]
-mesh = Mesh(box,"Quad mesh")
-hyp1D = mesh.Segment().StartEndLength( 1, 4 )
-mesh.Quadrangle()
-mesh.Compute()
-
-# create a group on filter selecting faces of medium size
-critaria = [ \
-    GetCriterion(FACE, FT_Area, ">", 1.1, BinaryOp=FT_LogicalAND ),
-    GetCriterion(FACE, FT_Area, "<", 15.0 )
-    ]
-filt = GetFilterFromCriteria( critaria )
-filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt )
-print "Group on filter contains %s elemens" % filtGroup.Size()
-
-# group on filter is updated if the mesh is modified
-hyp1D.SetStartLength( 2.5 )
-hyp1D.SetEndLength( 2.5 )
-mesh.Compute()
-print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
-
-# set a new filter defining the group
-filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" )
-filtGroup.SetFilter( filt2 )
-print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
-
-# group is updated at modification of the filter
-filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )])
-filtIDs3 = filtGroup.GetIDs()
-print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex03.py
+<a href="../../examples/SMESH/grouping_elements_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_edit_group
 <h2>Edit a Group</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Get ids of all faces with area > 35
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-print "Criterion: Area > 35, Nb = ", len(anIds)
-
-# create a group by adding elements with area > 35
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")
-aGroup.Add(anIds) 
-
-# Get ids of all faces with area > 40
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 40, Nb = ", len(anIds) 
-
-# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
-aGroup.Remove(anIds) 
-
-# print the result
-aGroupElemIDs = aGroup.GetListOfID()
-
-print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)
-
-j = 1
-for i in range(len(aGroupElemIDs)):
-  if j > 20: j = 1; print ""
-  print aGroupElemIDs[i],
-  j = j + 1
-  pass
-print ""
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex04.py
+<a href="../../examples/SMESH/grouping_elements_ex04.py">Download this script</a>
 
 \image html editing_groups1.png
 
@@ -174,59 +36,8 @@ salome.sg.updateObjBrowser(1)
 <br>
 \anchor tui_union_of_groups
 <h2>Union of groups</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 20, Nb = ", len( anIds ) 
-
-# create a group by adding elements with area > 20
-aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
-aGroup1.Add(anIds)
-
-# Criterion : AREA = 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area = 20, Nb = ", len( anIds ) 
-
-# create a group by adding elements with area = 20
-aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
-
-aGroup2.Add(anIds)
-
-# create union group : area >= 20
-aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
-print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
-# Please note that also there is UnionGroups() method which works with two groups only
-
-# Criterion : AREA < 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area < 20, Nb = ", len(anIds)
-
-# create a group by adding elements with area < 20
-aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
-aGroup4.Add(anIds)
-
-# create union group : area >= 20 and area < 20
-aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
-print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex05.py
+<a href="../../examples/SMESH/grouping_elements_ex05.py">Download this script</a>
 
 \image html union_groups1.png
 
@@ -237,43 +48,8 @@ salome.sg.updateObjBrowser(1)
 <br>
 \anchor tui_intersection_of_groups
 <h2>Intersection of groups</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 20, Nb = ", len(anIds) 
-
-# create a group by adding elements with area > 20
-aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
-aGroup1.Add(anIds)
-
-# Criterion : AREA < 60
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area < 60, Nb = ", len(anIds) 
-
-# create a group by adding elements with area < 60
-aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60")
-aGroup2.Add(anIds)
-
-# create an intersection of groups : 20 < area < 60
-aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
-print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
-# Please note that also there is IntersectGroups() method which works with two groups only
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex06.py
+<a href="../../examples/SMESH/grouping_elements_ex06.py">Download this script</a>
 
 \image html intersect_groups1.png
 
@@ -284,41 +60,8 @@ salome.sg.updateObjBrowser(1)
 <br>
 \anchor tui_cut_of_groups
 <h2>Cut of groups</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 20, Nb = ", len(anIds) 
-
-# create a group by adding elements with area > 20
-aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
-
-# Criterion : AREA < 60
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area < 60, Nb = ", len(anIds) 
-
-# create a group by adding elements with area < 60
-aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
-# create a cut of groups : area >= 60
-aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
-print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
-# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex07.py
+<a href="../../examples/SMESH/grouping_elements_ex07.py">Download this script</a>
 
 \image html cut_groups1.png
 
@@ -329,42 +72,8 @@ salome.sg.updateObjBrowser(1)
 <br>
 \anchor tui_create_dim_group
 <h2>Creating groups of entities from existing groups of superior dimensions</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 100
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 100, Nb = ", len(anIds) 
-
-# create a group by adding elements with area > 100
-aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
-
-# Criterion : AREA < 30
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area < 30, Nb = ", len(anIds) 
-
-# create a group by adding elements with area < 30
-aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds)
-
-# Create group of edges using source groups of faces
-aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" )
-
-# Create group of nodes using source groups of faces
-aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" )
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include grouping_elements_ex08.py
+<a href="../../examples/SMESH/grouping_elements_ex08.py">Download this script</a>
 
 \image html dimgroup_tui1.png
 <center>Source groups of faces</center>
index aabf0b3176e24be7eeed5e0a2ecbba2ad451dd7c..8ca283fc37020b5005a439ea2023c8299e85da1d 100644 (file)
@@ -3,82 +3,11 @@
 \page tui_measurements_page Measurements
 
 \section tui_min_distance Minimum Distance
-
-\code
-
-import smesh
-from SMESH_mechanic import mesh as mesh1
-from SMESH_test1 import mesh as mesh2
-
-mesh1.Compute()
-mesh2.Compute()
-
-# compute min distance from mesh1 to the origin (not available yet)
-smesh.MinDistance(mesh1)
-
-# compute min distance from node 10 of mesh1 to the origin
-smesh.MinDistance(mesh1, id1=10)
-# ... or
-mesh1.MinDistance(10)
-
-# compute min distance between nodes 10 and 20 of mesh1
-smesh.MinDistance(mesh1, id1=10, id2=20)
-# ... or
-mesh1.MinDistance(10, 20)
-
-# compute min distance from element 100 of mesh1 to the origin (not available yet)
-smesh.MinDistance(mesh1, id1=100, isElem1=True)
-# ... or
-mesh1.MinDistance(100, isElem1=True)
-
-# compute min distance between elements 100 and 200 of mesh1 (not available yet)
-smesh.MinDistance(mesh1, id1=100, id2=200, isElem1=True, isElem2=True)
-# ... or
-mesh1.MinDistance(100, 200, True, True)
-
-# compute min distance from element 100 to node 20 of mesh1 (not available yet)
-smesh.MinDistance(mesh1, id1=100, id2=20, isElem1=True)
-# ... or
-mesh1.MinDistance(100, 20, True)
-
-# compute min distance from mesh1 to mesh2 (not available yet)
-smesh.MinDistance(mesh1, mesh2)
-
-# compute min distance from node 10 of mesh1 to node 20 of mesh2
-smesh.MinDistance(mesh1, mesh2, 10, 20)
-
-# compute min distance from node 10 of mesh1 to element 200 of mesh2 (not available yet)
-smesh.MinDistance(mesh1, mesh2, 10, 200, isElem2=True)
-
-# etc...
-
-\endcode
+\include measurements_ex01.py
+<a href="../../examples/SMESH/measurements_ex01.py">Download this script</a>
 
 \section tui_bounding_box Bounding Box
-
-\code
-
-import smesh
-from SMESH_mechanic import mesh as mesh1
-from SMESH_test1 import mesh as mesh2
-
-mesh1.Compute()
-mesh2.Compute()
-
-# compute bounding box for mesh1
-mesh1.BoundingBox()
-
-# compute bounding box for list of nodes of mesh1
-mesh1.BoundingBox([363, 364, 370, 371, 372, 373, 379, 380, 381])
-
-# compute bounding box for list of elements of mesh1
-mesh1.BoundingBox([363, 364, 370, 371, 372, 373, 379, 380, 381], isElem=True)
-
-# compute common bounding box of mesh1 and mesh2
-smesh.BoundingBox([mesh1, mesh2])
-
-# etc...
-
-\endcode
+\include measurements_ex02.py
+<a href="../../examples/SMESH/measurements_ex02.py">Download this script</a>
 
 */
index 977ff6e86f1ca717667e514120655c425dde5690..e7844327c721e01c7c781ab9b0c67eed9bd45b28 100644 (file)
 <br>
 \anchor tui_add_node
 <h3>Add Node</h3>
-
-\code
-import smesh
-
-mesh = smesh.Mesh()
-
-# add node
-new_id = mesh.AddNode(50, 10, 0)
-print ""
-if new_id == 0: print "KO node addition."
-else:           print "New Node has been added with ID ", new_id
-\endcode
+\include modifying_meshes_ex01.py
+<a href="../../examples/SMESH/modifying_meshes_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_add_0DElement
 <h3>Add 0D Element</h3>
-
-\code
-import smesh
-
-mesh = smesh.Mesh()
-
-# add node
-node_id = mesh.AddNode(50, 10, 0)
-
-# add 0D Element
-new_id = mesh.Add0DElement(node_id)
-
-print ""
-if new_id == 0: print "KO node addition."
-else:           print "New 0D Element has been added with ID ", new_id
-\endcode
+\include modifying_meshes_ex02.py
+<a href="../../examples/SMESH/modifying_meshes_ex02.py">Download this script</a>
 
 <br>
 \anchor tui_add_0DElement_on_all_nodes
 <h3>Add 0D Element on Element Nodes</h3>
-
-\code
-import smesh, SMESH, geompy
-
-# create a geometry
-box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
-face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
-
-# make 3D mesh
-mesh = smesh.Mesh( box )
-mesh.AutomaticHexahedralization(0)
-
-# create 0D elements on all nodes of the mesh
-res = mesh.Add0DElementsToAllNodes( mesh )
-
-# find 0D elements on all nodes of the mesh, all found nodes are added to a new group
-groupName = "0Dmesh"
-res = mesh.Add0DElementsToAllNodes( mesh, groupName )
-mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
-
-# create 0D elements on all nodes of a sub-mesh, with group creation
-groupName = "0Dsubmesh"
-submesh = mesh.GetSubMesh( face, "faceSM")
-res = mesh.Add0DElementsToAllNodes( submesh, groupName )
-
-# create 0D elements on all nodes of a group
-group = mesh.Group( face, "faceGroup" )
-res = mesh.Add0DElementsToAllNodes( group )
-
-# remove all 0D elements
-mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
-                                                             SMESH.FT_ElemGeomType,
-                                                             "=",SMESH.Geom_POINT )))
-
-# create 0D elements on all nodes of some elements
-res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
-
-mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
-
-# create 0D elements on some nodes
-nodes = range(1,10)
-res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))
-
-\endcode
+\include modifying_meshes_ex03.py
+<a href="../../examples/SMESH/modifying_meshes_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_add_edge
 <h3>Add Edge</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-print ""
-
-# add node
-n1 = mesh.AddNode(50, 10, 0)
-if n1 == 0: print "KO node addition." 
-
-# add edge
-e1 = mesh.AddEdge([n1, 38])
-if e1 == 0: print "KO edge addition."
-else:       print "New Edge has been added with ID ", e1
-\endcode
+\include modifying_meshes_ex04.py
+<a href="../../examples/SMESH/modifying_meshes_ex04.py">Download this script</a>
 
 <br>
 \anchor tui_add_triangle
 <h3>Add Triangle</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-print ""
-
-# add node
-n1 = mesh.AddNode(50, 10, 0)
-if n1 == 0: print "KO node addition."
-
-# add triangle
-t1 = mesh.AddFace([n1, 38, 39])
-if t1 == 0: print "KO triangle addition."
-else:       print "New Triangle has been added with ID ", t1
-\endcode
+\include modifying_meshes_ex05.py
+<a href="../../examples/SMESH/modifying_meshes_ex05.py">Download this script</a>
 
 <br>
 \anchor tui_add_quadrangle
 <h3>Add Quadrangle</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-print ""
-
-# add node
-n1 = mesh.AddNode(50, 10, 0)
-if n1 == 0: print "KO node addition."
-
-n2 = mesh.AddNode(40, 20, 0)
-if n2 == 0: print "KO node addition."
-
-# add quadrangle
-q1 = mesh.AddFace([n2, n1, 38, 39])
-if q1 == 0: print "KO quadrangle addition."
-else:       print "New Quadrangle has been added with ID ", q1
-\endcode
+\include modifying_meshes_ex06.py
+<a href="../../examples/SMESH/modifying_meshes_ex06.py">Download this script</a>
 
 <br>
 \anchor tui_add_tetrahedron
 <h3>Add Tetrahedron</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-print ""
-
-# add node
-n1 = mesh.AddNode(50, 10, 0)
-if n1 == 0: print "KO node addition."
-
-# add tetrahedron
-t1 = mesh.AddVolume([n1, 38, 39, 246])
-if t1 == 0: print "KO tetrahedron addition."
-else:       print "New Tetrahedron has been added with ID ", t1
-\endcode
+\include modifying_meshes_ex07.py
+<a href="../../examples/SMESH/modifying_meshes_ex07.py">Download this script</a>
 
 <br>
 \anchor tui_add_hexahedron
 <h3>Add Hexahedron</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-print ""
-
-# add nodes
-nId1 = mesh.AddNode(50, 10, 0)
-nId2 = mesh.AddNode(47, 12, 0)
-nId3 = mesh.AddNode(50, 10, 10)
-nId4 = mesh.AddNode(47, 12, 10)
-
-if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print "KO node addition."
-
-# add hexahedron
-vId = mesh.AddVolume([nId2, nId1, 38, 39, nId4, nId3, 245, 246])
-if vId == 0: print "KO Hexahedron addition."
-else:        print "New Hexahedron has been added with ID ", vId
-\endcode
+\include modifying_meshes_ex08.py
+<a href="../../examples/SMESH/modifying_meshes_ex08.py">Download this script</a>
 
 <br>
 \anchor tui_add_polygon
 <h3>Add Polygon</h3>
-
-\code
-import math
-import salome
-
-import smesh
-
-# create an empty mesh structure
-mesh = smesh.Mesh() 
-
-# a method to build a polygonal mesh element with <nb_vert> angles:
-def MakePolygon (a_mesh, x0, y0, z0, radius, nb_vert):
-    al = 2.0 * math.pi / nb_vert
-    node_ids = []
-
-    # Create nodes for a polygon
-    for ii in range(nb_vert):
-        nid = mesh.AddNode(x0 + radius * math.cos(ii*al),
-                           y0 + radius * math.sin(ii*al),
-                                                     z0)
-        node_ids.append(nid)
-        pass
-
-    # Create a polygon
-    return mesh.AddPolygonalFace(node_ids)
-
-# Create three polygons
-f1 = MakePolygon(mesh, 0, 0,  0, 30, 13)
-f2 = MakePolygon(mesh, 0, 0, 10, 21,  9)
-f3 = MakePolygon(mesh, 0, 0, 20, 13,  6)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex09.py
+<a href="../../examples/SMESH/modifying_meshes_ex09.py">Download this script</a>
 
 <br>
 \anchor tui_add_polyhedron
 <h3>Add Polyhedron</h3>
-
-\code
-import salome
-import math
-
-# create an empty mesh structure
-mesh = smesh.Mesh()  
-
-# Create nodes for 12-hedron with pentagonal faces
-al = 2 * math.pi / 5.0
-cosal = math.cos(al)
-aa = 13
-rr = aa / (2.0 * math.sin(al/2.0))
-dr = 2.0 * rr * cosal
-r1 = rr + dr
-dh = rr * math.sqrt(2.0 * (1.0 - cosal * (1.0 + 2.0 * cosal)))
-hh = 2.0 * dh - dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh
-
-dd = [] # top
-cc = [] # below top
-bb = [] # above bottom
-aa = [] # bottom
-
-for i in range(5):
-    cos_bot = math.cos(i*al)
-    sin_bot = math.sin(i*al)
-
-    cos_top = math.cos(i*al + al/2.0)
-    sin_top = math.sin(i*al + al/2.0)
-
-    nd = mesh.AddNode(rr * cos_top, rr * sin_top, hh     ) # top
-    nc = mesh.AddNode(r1 * cos_top, r1 * sin_top, hh - dh) # below top
-    nb = mesh.AddNode(r1 * cos_bot, r1 * sin_bot,      dh) # above bottom
-    na = mesh.AddNode(rr * cos_bot, rr * sin_bot,       0) # bottom
-    dd.append(nd) # top
-    cc.append(nc) # below top
-    bb.append(nb) # above bottom
-    aa.append(na) # bottom
-    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])
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex10.py
+<a href="../../examples/SMESH/modifying_meshes_ex10.py">Download this script</a>
 
 <br>
 \anchor tui_removing_nodes_and_elements
@@ -302,718 +73,97 @@ salome.sg.updateObjBrowser(1)
 <br>
 \anchor tui_removing_nodes
 <h3>Removing Nodes</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-
-# remove nodes #246 and #255
-res = mesh.RemoveNodes([246, 255])
-if res == 1: print "Nodes removing is OK!"
-else:        print "KO nodes removing."
-\endcode
+\include modifying_meshes_ex11.py
+<a href="../../examples/SMESH/modifying_meshes_ex11.py">Download this script</a>
 
 <br>
 \anchor tui_removing_elements
 <h3>Removing Elements</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-
-# remove three elements: #850, #859 and #814
-res = mesh.RemoveElements([850, 859, 814])
-if res == 1: print "Elements removing is OK!"
-else:        print "KO Elements removing."
-\endcode
+\include modifying_meshes_ex12.py
+<a href="../../examples/SMESH/modifying_meshes_ex12.py">Download this script</a>
 
 <br>
 \anchor tui_removing_orphan_nodes
 <h3>Removing Orphan Nodes</h3>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-
-# add orphan nodes
-mesh.AddNode(0,0,0)
-mesh.AddNode(1,1,1)
-# remove just created orphan nodes
-res = mesh.RemoveOrphanNodes()
-if res == 1: print "Removed %d nodes!" % res
-else:        print "KO nodes removing."
-\endcode
+\include modifying_meshes_ex13.py
+<a href="../../examples/SMESH/modifying_meshes_ex13.py">Download this script</a>
 
 <br>
 \anchor tui_renumbering_nodes_and_elements
 <h2>Renumbering Nodes and Elements</h2>
-
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-
-mesh.RenumberNodes()
-
-mesh.RenumberElements()
-\endcode
+\include modifying_meshes_ex14.py
+<a href="../../examples/SMESH/modifying_meshes_ex14.py">Download this script</a>
 
 <br>
 \anchor tui_moving_nodes
 <h2>Moving Nodes</h2>
-
-\code
-from geompy import *
-from smesh import *
-
-box = MakeBoxDXDYDZ(200, 200, 200)
-
-mesh = Mesh( box )
-mesh.Segment().AutomaticLength(0.1)
-mesh.Quadrangle()
-mesh.Compute()
-
-# find node at (0,0,0)
-node000 = None
-for vId in SubShapeAllIDs( box, ShapeType["VERTEX"]):
-    if node000: break
-    nodeIds = mesh.GetSubMeshNodesId( vId, True )
-    for node in nodeIds:
-        xyz = mesh.GetNodeXYZ( node )
-        if xyz[0] == 0 and xyz[1] == 0 and xyz[2] == 0 :
-            node000 = node
-            pass
-        pass
-    pass
-
-if not node000:
-    raise "node000 not found"
-
-# find node000 using the tested function 
-n = mesh.FindNodeClosestTo( -1,-1,-1 )
-if not n == node000:
-    raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )
-
-# move node000 to a new location
-x,y,z = -10, -10, -10
-n = mesh.MoveNode( n,x,y,z )
-if not n:
-    raise "MoveNode() returns " + n
-
-# check the coordinates of the node000
-xyz = mesh.GetNodeXYZ( node000 )
-if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) :
-    raise "Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] )
-\endcode
+\include modifying_meshes_ex15.py
+<a href="../../examples/SMESH/modifying_meshes_ex15.py">Download this script</a>
 
 <br>
 \anchor tui_diagonal_inversion
 <h2>Diagonal Inversion</h2>
-
-\code
-import salome
-import smesh
-
-# create an empty mesh structure
-mesh = smesh.Mesh() 
-
-# create the following mesh:
-# .----.----.----.
-# |   /|   /|   /|
-# |  / |  / |  / |
-# | /  | /  | /  |
-# |/   |/   |/   |
-# .----.----.----.
-
-bb = [0, 0, 0, 0]
-tt = [0, 0, 0, 0]
-ff = [0, 0, 0, 0, 0, 0]
-
-bb[0] = mesh.AddNode( 0., 0., 0.)
-bb[1] = mesh.AddNode(10., 0., 0.)
-bb[2] = mesh.AddNode(20., 0., 0.)
-bb[3] = mesh.AddNode(30., 0., 0.)
-
-tt[0] = mesh.AddNode( 0., 15., 0.)
-tt[1] = mesh.AddNode(10., 15., 0.)
-tt[2] = mesh.AddNode(20., 15., 0.)
-tt[3] = mesh.AddNode(30., 15., 0.)
-
-ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
-ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
-ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
-ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
-ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
-ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
-
-# inverse the diagonal bb[1] - tt[2]
-print "\nDiagonal inversion ... ",
-res = mesh.InverseDiag(bb[1], tt[2])
-if not res: print "failed!"
-else:       print "done."
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex16.py
+<a href="../../examples/SMESH/modifying_meshes_ex16.py">Download this script</a>
 
 <br>
 \anchor tui_uniting_two_triangles
 <h2>Uniting two Triangles</h2>
-
-\code
-import salome
-import smesh
-
-# create an empty mesh structure
-mesh = smesh.Mesh() 
-
-# create the following mesh:
-# .----.----.----.
-# |   /|   /|   /|
-# |  / |  / |  / |
-# | /  | /  | /  |
-# |/   |/   |/   |
-# .----.----.----.
-
-bb = [0, 0, 0, 0]
-tt = [0, 0, 0, 0]
-ff = [0, 0, 0, 0, 0, 0]
-
-bb[0] = mesh.AddNode( 0., 0., 0.)
-bb[1] = mesh.AddNode(10., 0., 0.)
-bb[2] = mesh.AddNode(20., 0., 0.)
-bb[3] = mesh.AddNode(30., 0., 0.)
-
-tt[0] = mesh.AddNode( 0., 15., 0.)
-tt[1] = mesh.AddNode(10., 15., 0.)
-tt[2] = mesh.AddNode(20., 15., 0.)
-tt[3] = mesh.AddNode(30., 15., 0.)
-
-ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
-ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
-ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
-ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
-ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
-ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) 
-
-# delete the diagonal bb[1] - tt[2]
-print "\nUnite two triangles ... ",
-res = mesh.DeleteDiag(bb[1], tt[2])
-if not res: print "failed!"
-else:       print "done."
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex17.py
+<a href="../../examples/SMESH/modifying_meshes_ex17.py">Download this script</a>
 
 <br>
 \anchor tui_uniting_set_of_triangles
 <h2>Uniting a Set of Triangles</h2>
-
-\code
-import salome
-import smesh
-
-# create an empty mesh structure
-mesh = smesh.Mesh() 
-
-# create the following mesh:
-# .----.----.----.
-# |   /|   /|   /|
-# |  / |  / |  / |
-# | /  | /  | /  |
-# |/   |/   |/   |
-# .----.----.----.
-
-bb = [0, 0, 0, 0]
-tt = [0, 0, 0, 0]
-ff = [0, 0, 0, 0, 0, 0]
-
-bb[0] = mesh.AddNode( 0., 0., 0.)
-bb[1] = mesh.AddNode(10., 0., 0.)
-bb[2] = mesh.AddNode(20., 0., 0.)
-bb[3] = mesh.AddNode(30., 0., 0.)
-
-tt[0] = mesh.AddNode( 0., 15., 0.)
-tt[1] = mesh.AddNode(10., 15., 0.)
-tt[2] = mesh.AddNode(20., 15., 0.)
-tt[3] = mesh.AddNode(30., 15., 0.)
-
-ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
-ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
-ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
-ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
-ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
-ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
-
-# unite a set of triangles
-print "\nUnite a set of triangles ... ",
-res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], smesh.FT_MinimumAngle, 60.)
-if not res: print "failed!"
-else:       print "done."
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex18.py
+<a href="../../examples/SMESH/modifying_meshes_ex18.py">Download this script</a>
 
 <br>
 \anchor tui_orientation
 <h2>Orientation</h2>
-
-\code
-import salome
-import smesh
-
-# create an empty mesh structure
-mesh = smesh.Mesh() 
-
-# build five quadrangles:
-dx = 10
-dy = 20
-
-n1  = mesh.AddNode(0.0 * dx, 0, 0)
-n2  = mesh.AddNode(1.0 * dx, 0, 0)
-n3  = mesh.AddNode(2.0 * dx, 0, 0)
-n4  = mesh.AddNode(3.0 * dx, 0, 0)
-n5  = mesh.AddNode(4.0 * dx, 0, 0)
-n6  = mesh.AddNode(5.0 * dx, 0, 0)
-n7  = mesh.AddNode(0.0 * dx, dy, 0)
-n8  = mesh.AddNode(1.0 * dx, dy, 0)
-n9  = mesh.AddNode(2.0 * dx, dy, 0)
-n10 = mesh.AddNode(3.0 * dx, dy, 0)
-n11 = mesh.AddNode(4.0 * dx, dy, 0)
-n12 = mesh.AddNode(5.0 * dx, dy, 0)
-
-f1 = mesh.AddFace([n1, n2, n8 , n7 ])
-f2 = mesh.AddFace([n2, n3, n9 , n8 ])
-f3 = mesh.AddFace([n3, n4, n10, n9 ])
-f4 = mesh.AddFace([n4, n5, n11, n10])
-f5 = mesh.AddFace([n5, n6, n12, n11]) 
-
-# Change the orientation of the second and the fourth faces.
-mesh.Reorient([2, 4])
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex19.py
+<a href="../../examples/SMESH/modifying_meshes_ex19.py">Download this script</a>
 
 <br>
 \anchor tui_cutting_quadrangles
 <h2>Cutting Quadrangles</h2>
-
-\code
-import SMESH_mechanic
-
-smesh = SMESH_mechanic.smesh
-mesh  = SMESH_mechanic.mesh
-
-# cut two quadrangles: 405 and 406
-mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle)
-\endcode
+\include modifying_meshes_ex20.py
+<a href="../../examples/SMESH/modifying_meshes_ex20.py">Download this script</a>
 
 <br>
 \anchor tui_smoothing
 <h2>Smoothing</h2>
-
-\code
-import salome
-import geompy
-
-import SMESH_mechanic
-
-smesh = SMESH_mechanic.smesh
-mesh = SMESH_mechanic.mesh
-
-# select the top face
-faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
-face = faces[3]
-geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
-
-# create a group of faces to be smoothed
-GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", smesh.FACE)
-
-# perform smoothing
-
-# boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
-res = mesh.SmoothObject(GroupSmooth, [], 20, 2., smesh.CENTROIDAL_SMOOTH)
-print "\nSmoothing ... ",
-if not res: print "failed!"
-else:       print "done."
-
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include modifying_meshes_ex21.py
+<a href="../../examples/SMESH/modifying_meshes_ex21.py">Download this script</a>
 
 <br>
 \anchor tui_extrusion
 <h2>Extrusion</h2>
-
-\code
-import salome
-import geompy
-
-import SMESH_mechanic
-
-smesh = SMESH_mechanic.smesh
-mesh = SMESH_mechanic.mesh 
-
-# select the top face
-faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
-face = faces[7]
-geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face circular top")
-
-# create a vector for extrusion
-point = smesh.PointStruct(0., 0., 5.)
-vector = smesh.DirStruct(point)
-
-# create a group to be extruded
-GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", smesh.FACE)
-
-# perform extrusion of the group
-mesh.ExtrusionSweepObject(GroupTri, vector, 5)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex22.py
+<a href="../../examples/SMESH/modifying_meshes_ex22.py">Download this script</a>
 
 <br>
 \anchor tui_extrusion_along_path
 <h2>Extrusion along a Path</h2>
-
-\code
-import math
-import salome
-
-# Geometry
-import geompy
-
-# 1. Create points
-points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]
-
-iv = 1
-vertices = []
-for point in points:
-    vert = geompy.MakeVertex(point[0], point[1], 0)
-    geompy.addToStudy(vert, "Vertex_" + `iv`)
-    vertices.append(vert)
-    iv += 1
-    pass
-
-# 2. Create edges and wires
-Edge_straight = geompy.MakeEdge(vertices[0], vertices[4])
-Edge_bezierrr = geompy.MakeBezier(vertices)
-Wire_polyline = geompy.MakePolyline(vertices)
-Edge_Circle   = geompy.MakeCircleThreePnt(vertices[0], vertices[1], vertices[2])
-
-geompy.addToStudy(Edge_straight, "Edge_straight")
-geompy.addToStudy(Edge_bezierrr, "Edge_bezierrr")
-geompy.addToStudy(Wire_polyline, "Wire_polyline")
-geompy.addToStudy(Edge_Circle  , "Edge_Circle")
-
-# 3. Explode wire on edges, as they will be used for mesh extrusion
-Wire_polyline_edges = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"])
-for ii in range(len(Wire_polyline_edges)):
-    geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + `ii + 1`)
-    pass
-
-# Mesh
-import smesh
-
-# Mesh the given shape with the given 1d hypothesis
-def Mesh1D(shape1d, nbSeg, name):
-  mesh1d_tool = smesh.Mesh(shape1d, name)
-  algo = mesh1d_tool.Segment()
-  hyp  = algo.NumberOfSegments(nbSeg)
-  isDone = mesh1d_tool.Compute()
-  if not isDone: print 'Mesh ', name, ': computation failed'
-  return mesh1d_tool
-
-# Create a mesh with six nodes, seven edges and two quadrangle faces
-def MakeQuadMesh2(mesh_name):
-  quad_1 = smesh.Mesh(name = mesh_name)
-  
-  # six nodes
-  n1 = quad_1.AddNode(0, 20, 10)
-  n2 = quad_1.AddNode(0, 40, 10)
-  n3 = quad_1.AddNode(0, 40, 30)
-  n4 = quad_1.AddNode(0, 20, 30)
-  n5 = quad_1.AddNode(0,  0, 30)
-  n6 = quad_1.AddNode(0,  0, 10)
-
-  # seven edges
-  quad_1.AddEdge([n1, n2]) # 1
-  quad_1.AddEdge([n2, n3]) # 2
-  quad_1.AddEdge([n3, n4]) # 3
-  quad_1.AddEdge([n4, n1]) # 4
-  quad_1.AddEdge([n4, n5]) # 5
-  quad_1.AddEdge([n5, n6]) # 6
-  quad_1.AddEdge([n6, n1]) # 7
-
-  # two quadrangle faces
-  quad_1.AddFace([n1, n2, n3, n4]) # 8
-  quad_1.AddFace([n1, n4, n5, n6]) # 9
-  return [quad_1, [1,2,3,4,5,6,7], [8,9]]
-
-# Path meshes
-Edge_straight_mesh = Mesh1D(Edge_straight, 7, "Edge_straight")
-Edge_bezierrr_mesh = Mesh1D(Edge_bezierrr, 7, "Edge_bezierrr")
-Wire_polyline_mesh = Mesh1D(Wire_polyline, 3, "Wire_polyline")
-Edge_Circle_mesh   = Mesh1D(Edge_Circle  , 8, "Edge_Circle")
-
-# Initial meshes (to be extruded)
-[quad_1, ee_1, ff_1] = MakeQuadMesh2("quad_1")
-[quad_2, ee_2, ff_2] = MakeQuadMesh2("quad_2")
-[quad_3, ee_3, ff_3] = MakeQuadMesh2("quad_3")
-[quad_4, ee_4, ff_4] = MakeQuadMesh2("quad_4")
-[quad_5, ee_5, ff_5] = MakeQuadMesh2("quad_5")
-[quad_6, ee_6, ff_6] = MakeQuadMesh2("quad_6")
-[quad_7, ee_7, ff_7] = MakeQuadMesh2("quad_7")
-
-# ExtrusionAlongPath
-# IDsOfElements, PathMesh, PathShape, NodeStart,
-# HasAngles, Angles, HasRefPoint, RefPoint
-refPoint = smesh.PointStruct(0, 0, 0)
-a10 = 10.0*math.pi/180.0
-a45 = 45.0*math.pi/180.0
-
-# 1. Extrusion of two mesh edges along a straight path
-error = quad_1.ExtrusionAlongPath([1,2], Edge_straight_mesh, Edge_straight, 1,
-                                  0, [], 0, refPoint)
-
-# 2. Extrusion of one mesh edge along a curved path
-error = quad_2.ExtrusionAlongPath([2], Edge_bezierrr_mesh, Edge_bezierrr, 1,
-                                  0, [], 0, refPoint)
-
-# 3. Extrusion of one mesh edge along a curved path with usage of angles
-error = quad_3.ExtrusionAlongPath([2], Edge_bezierrr_mesh, Edge_bezierrr, 1,
-                                  1, [a45, a45, a45, 0, -a45, -a45, -a45], 0, refPoint)
-
-# 4. Extrusion of one mesh edge along the path, which is a part of a meshed wire
-error = quad_4.ExtrusionAlongPath([4], Wire_polyline_mesh, Wire_polyline_edges[0], 1,
-                                  1, [a10, a10, a10], 0, refPoint)
-
-# 5. Extrusion of two mesh faces along the path, which is a part of a meshed wire
-error = quad_5.ExtrusionAlongPath(ff_5 , Wire_polyline_mesh, Wire_polyline_edges[2], 4,
-                                  0, [], 0, refPoint)
-
-# 6. Extrusion of two mesh faces along a closed path
-error = quad_6.ExtrusionAlongPath(ff_6 , Edge_Circle_mesh, Edge_Circle, 1,
-                                  0, [], 0, refPoint)
-
-# 7. Extrusion of two mesh faces along a closed path with usage of angles
-error = quad_7.ExtrusionAlongPath(ff_7, Edge_Circle_mesh, Edge_Circle, 1,
-                                  1, [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include modifying_meshes_ex23.py
+<a href="../../examples/SMESH/modifying_meshes_ex23.py">Download this script</a>
 
 <br>
 \anchor tui_revolution
 <h2>Revolution</h2>
-
-\code
-import math
-import SMESH
-
-import SMESH_mechanic
-
-mesh  = SMESH_mechanic.mesh
-smesh = SMESH_mechanic.smesh
-
-# create a group of faces to be revolved
-FacesRotate = [492, 493, 502, 503]
-GroupRotate = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces (rotate)")
-GroupRotate.Add(FacesRotate)
-
-# define revolution angle and axis
-angle45 = 45 * math.pi / 180
-axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -23.321, -13.3402, -13.3265, 6.66632)
-
-# perform revolution of an object
-mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) 
-\endcode
+\include modifying_meshes_ex24.py
+<a href="../../examples/SMESH/modifying_meshes_ex24.py">Download this script</a>
 
 <br>
 \anchor tui_pattern_mapping
 <h2>Pattern Mapping</h2>
-
-\code
-import geompy
-import smesh
-
-# define the geometry
-Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.)
-geompy.addToStudy(Box_1, "Box_1")
-
-faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
-Face_1 = faces[0]
-Face_2 = faces[1]
-
-geompy.addToStudyInFather(Box_1, Face_1, "Face_1")
-geompy.addToStudyInFather(Box_1, Face_2, "Face_2")
-
-# build a quadrangle mesh 3x3 on Face_1
-Mesh_1 = smesh.Mesh(Face_1)
-algo1D = Mesh_1.Segment()
-algo1D.NumberOfSegments(3)
-Mesh_1.Quadrangle()
-
-isDone = Mesh_1.Compute()
-if not isDone: print 'Mesh Mesh_1 : computation failed'
-
-# build a triangle mesh on Face_2
-Mesh_2 = smesh.Mesh(Face_2)
-
-algo1D = Mesh_2.Segment()
-algo1D.NumberOfSegments(1)
-algo2D = Mesh_2.Triangle()
-algo2D.MaxElementArea(240)
-
-isDone = Mesh_2.Compute()
-if not isDone: print 'Mesh Mesh_2 : computation failed'
-
-# create a 2d pattern
-pattern = smesh.GetPattern()
-
-isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0)
-if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode()
-
-# apply the pattern to a face of the first mesh
-facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE)
-print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))
-pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0)
-isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
-if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()  
-
-# create quadrangle mesh
-Mesh_3 = smesh.Mesh(Box_1)
-Mesh_3.Segment().NumberOfSegments(1)
-Mesh_3.Quadrangle()
-Mesh_3.Hexahedron()
-isDone = Mesh_3.Compute()
-if not isDone: print 'Mesh Mesh_3 : computation failed'
-
-# create a 3d pattern (hexahedrons)
-pattern_hexa = smesh.GetPattern()
-
-smp_hexa = """!!! Nb of points:
-15
-      0        0        0   !- 0
-      1        0        0   !- 1
-      0        1        0   !- 2
-      1        1        0   !- 3
-      0        0        1   !- 4
-      1        0        1   !- 5
-      0        1        1   !- 6
-      1        1        1   !- 7
-    0.5        0      0.5   !- 8
-    0.5        0        1   !- 9
-    0.5      0.5      0.5   !- 10
-    0.5      0.5        1   !- 11
-      1        0      0.5   !- 12
-      1      0.5      0.5   !- 13
-      1      0.5        1   !- 14
-  !!! Indices of points of 4 elements:
-  8 12 5 9 10 13 14 11
-  0 8 9 4 2 10 11 6
-  2 10 11 6 3 13 14 7
-  0 1 12 8 2 3 13 10"""
-
-pattern_hexa.LoadFromFile(smp_hexa)
-
-# apply the pattern to a mesh
-volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME)
-print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))
-pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3)
-isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True)
-if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode()  
-
-# create one more quadrangle mesh
-Mesh_4 = smesh.Mesh(Box_1)
-Mesh_4.Segment().NumberOfSegments(1)
-Mesh_4.Quadrangle()
-Mesh_4.Hexahedron()
-isDone = Mesh_4.Compute()
-if not isDone: print 'Mesh Mesh_4 : computation failed'
-
-# create another 3d pattern (pyramids)
-pattern_pyra = smesh.GetPattern()
-
-smp_pyra = """!!! Nb of points:
-9
-        0        0        0   !- 0
-        1        0        0   !- 1
-        0        1        0   !- 2
-        1        1        0   !- 3
-        0        0        1   !- 4
-        1        0        1   !- 5
-        0        1        1   !- 6
-        1        1        1   !- 7
-      0.5      0.5      0.5   !- 8
-  !!! Indices of points of 6 elements:
-  0 1 5 4 8
-  7 5 1 3 8
-  3 2 6 7 8
-  2 0 4 6 8
-  0 2 3 1 8
-  4 5 7 6 8"""
-
-pattern_pyra.LoadFromFile(smp_pyra)
-
-# apply the pattern to a face mesh
-volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME)
-print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))
-pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0)
-isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True)
-if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode()  
-\endcode
+\include modifying_meshes_ex25.py
+<a href="../../examples/SMESH/modifying_meshes_ex25.py">Download this script</a>
 
 <br>
 \anchor tui_quadratic
 <h2>Convert mesh to/from quadratic</h2>
-
-\code
-import geompy
-import smesh
-
-# create sphere of radius 100
-
-Sphere = geompy.MakeSphereR( 100 )
-geompy.addToStudy( Sphere, "Sphere" )
-
-# create simple trihedral mesh
-
-Mesh = smesh.Mesh(Sphere)
-Regular_1D = Mesh.Segment()
-Nb_Segments = Regular_1D.NumberOfSegments(5)
-MEFISTO_2D = Mesh.Triangle()
-Tetrahedron = Mesh.Tetrahedron()
-
-# compute mesh
-
-isDone = Mesh.Compute()
-
-# convert to quadratic
-# theForce3d = 1; this results in the medium node lying at the
-# middle of the line segments connecting start and end node of a mesh
-# element
-
-Mesh.ConvertToQuadratic( theForce3d=1 )
-
-# revert back to the non-quadratic mesh
-
-Mesh.ConvertFromQuadratic()
-
-# convert to quadratic
-# theForce3d = 0; this results in the medium node lying at the
-# geometrical edge from which the mesh element is built
-
-Mesh.ConvertToQuadratic( theForce3d=0 )
-
-# to convert not the whole mesh but a sub-mesh, provide it as 
-# an additional argument to the functions:
-# Mesh.ConvertToQuadratic( 0, subMesh )
-# Mesh.ConvertFromQuadratic( subMesh )
-#
-# Note that the mesh becomes non-conformal at conversion of sub-mesh.
-
-\endcode
+\include modifying_meshes_ex26.py
+<a href="../../examples/SMESH/modifying_meshes_ex26.py">Download this script</a>
 
 */
index a300ee63381d9b9267b48ba69e3a3e2c0f4c5c67..3403590697e6a95e0244eb2dca6214625fb6a2ca 100644 (file)
@@ -3,45 +3,7 @@
 \page tui_notebook_smesh_page Using SALOME NoteBook
 
 \anchor tui_notebook_smesh
-
-\code
-import geompy
-import smesh
-import salome_notebook
-
-# set variables
-notebook = salome_notebook.notebook
-notebook.set("Length", 100)
-notebook.set("Width", 200)
-notebook.set("Offset", 50)
-
-notebook.set("NbSegments", 7)
-notebook.set("MaxElementArea", 800)
-notebook.set("MaxElementVolume", 900)
-
-# create a box
-box = geompy.MakeBoxDXDYDZ("Length", "Width", 300)
-idbox = geompy.addToStudy(box, "Box")
-
-# create a mesh
-tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments("NbSegments")
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea("MaxElementArea")
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume("MaxElementVolume")
-
-# compute the mesh
-ret = tetra.Compute()
-
-# translate the mesh
-point = smesh.PointStruct("Offset", 0., 0.)
-vector = smesh.DirStruct(point) 
-tetra.TranslateObject(tetra, vector, 0)
-\endcode
+\include notebook_smesh.py
+<a href="../../examples/SMESH/notebook_smesh.py">Download this script</a>
 
 */
diff --git a/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc b/doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc
new file mode 100644 (file)
index 0000000..d0234a7
--- /dev/null
@@ -0,0 +1,10 @@
+/*!
+
+\page tui_prism_3d_algo Use 3D extrusion meshing algorithm
+\include prism_3d_algo.py
+<a href="../../examples/SMESH/prism_3d_algo.py">Download this script</a>
+
+The result geometry and mesh is shown below
+\image html prism_tui_sample.png
+
+*/
index 2991eb521fe8b6116ec834492b5799460137234b..e09389d3f815d25eef339afde955d06564e6f8de 100644 (file)
 \page tui_quality_controls_page Quality Controls
 
 \section tui_free_borders Free Borders
-
-\code
-import salome
-import geompy
-
-import smesh
-
-# create open shell: a box without one plane
-box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-FaceList.remove(FaceList[5])
-box = geompy.MakeShell(FaceList)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-mesh = smesh.Mesh(box, "Mesh_free_borders")
-algo = mesh.Segment()
-algo.NumberOfSegments(5)
-algo = mesh.Triangle()
-algo.MaxElementArea(20.)
-mesh.Compute() 
-
-# criterion : free borders
-aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) 
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-# print the result
-print "Criterion: Free borders Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateGroup(SMESH.EDGE, "Free borders")
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex01.py
+<a href="../../examples/SMESH/quality_controls_ex01.py">Download this script</a>
 
 \section tui_borders_at_multiconnection Borders at Multiconnection
-
-\code
-import salome
-import geompy
-
-import smesh
-import SMESH
-
-# create open shell: a box without one plane
-box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-FaceList.remove(FaceList[5])
-box = geompy.MakeShell(FaceList)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
-algo = mesh.Segment()
-algo.NumberOfSegments(5)
-algo = mesh.Triangle()
-algo.MaxElementArea(20.)
-mesh.Compute() 
-
-# Criterion : Borders at multi-connection
-nb_conn = 2
-
-aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-# print the result
-print "Criterion: Borders at multi-connections Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateGroup(SMESH.EDGE, "Borders at multi-connections")
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex02.py
+<a href="../../examples/SMESH/quality_controls_ex02.py">Download this script</a>
 
 \section tui_length_1d Length 1D
-
-\code
-import salome
-import geompy
-
-import smesh
-
-# create open shell: a box without one plane
-box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-FaceList.remove(FaceList[5])
-box = geompy.MakeShell(FaceList)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-mesh = smesh.Mesh(box, "Mesh_Length_1D")
-algo = mesh.Segment()
-algo.NumberOfSegments(5)
-algo = mesh.Triangle()
-algo.MaxElementArea(20.)
-mesh.Compute() 
-
-# Criterion : Length > 3.
-length_margin = 3.
-
-aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex03.py
+<a href="../../examples/SMESH/quality_controls_ex03.py">Download this script</a>
 
 \section tui_free_edges Free Edges
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-aFilterMgr = smesh.CreateFilterManager()
-
-# Remove some elements to obtain free edges
-# Criterion : AREA > 95.
-area_margin = 95.
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-mesh.RemoveElements(anIds)
-
-# Criterion : Free Edges
-aBorders = mesh.GetFreeBorders() 
-
-# create groups
-aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges")
-aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges")
-
-# fill groups with elements, corresponding to the criterion
-print ""
-print "Criterion: Free edges Nb = ", len(aBorders)
-for i in range(len(aBorders)):
-  aBorder = aBorders[i]
-  print "Face # ", aBorder.myElemId, " : Edge between nodes (",
-  print aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
-
-  aGroupF.Add([aBorder.myElemId])
-  aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex04.py
+<a href="../../examples/SMESH/quality_controls_ex04.py">Download this script</a>
 
 \section tui_free_nodes Free Nodes
-
-\code
-import salome
-import geompy
-
-import smesh
-
-# create box
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-mesh = smesh.Mesh(box, "Mesh_free_nodes")
-algo = mesh.Segment()
-algo.NumberOfSegments(10)
-algo = mesh.Triangle(smesh.MEFISTO)
-algo.MaxElementArea(150.)
-mesh.Compute() 
-
-# Remove some elements to obtain free nodes
-# Criterion : AREA < 80.
-area_margin = 80.
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-mesh.RemoveElements(anIds)
-
-# criterion : free nodes
-aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) 
-anNodeIds = mesh.GetIdsFromFilter(aFilter)
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
-aGroup.Add(anNodeIds)
-
-# print the result
-print "Criterion: Free nodes Nb = ", len(anNodeIds)
-j = 1
-for i in range(len(anNodeIds)):
-  if j > 20: j = 1; print ""
-  print anNodeIds[i],
-  j = j + 1
-  pass
-print ""
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex05.py
+<a href="../../examples/SMESH/quality_controls_ex05.py">Download this script</a>
 
 \section tui_free_faces Free Faces
-
-\code
-import salome
-import geompy
-
-####### GEOM part ########
-
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Box_1_vertex_6 = geompy.GetSubShape(Box_1, [6])
-Box_1 = geompy.GetMainShape(Box_1_vertex_6)
-Box_1_vertex_16 = geompy.GetSubShape(Box_1, [16])
-Box_1 = geompy.GetMainShape(Box_1_vertex_16)
-Box_1_vertex_11 = geompy.GetSubShape(Box_1, [11])
-Box_1 = geompy.GetMainShape(Box_1_vertex_11)
-Plane_1 = geompy.MakePlaneThreePnt(Box_1_vertex_6, Box_1_vertex_16, Box_1_vertex_11, 2000)
-Partition_1 = geompy.MakePartition([Box_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
-
-Box_1_vertex_19 = geompy.GetSubShape(Box_1, [19])
-Box_1_vertex_21 = geompy.GetSubShape(Box_1, [21])
-Plane_2 = geompy.MakePlaneThreePnt(Box_1_vertex_16, Box_1_vertex_19, Box_1_vertex_21, 2000)
-
-geompy.addToStudy( Box_1, "Box_1" )
-geompy.addToStudyInFather( Box_1, Box_1_vertex_6, "Box_1:vertex_6" )
-geompy.addToStudyInFather( Box_1, Box_1_vertex_16, "Box_1:vertex_16" )
-geompy.addToStudyInFather( Box_1, Box_1_vertex_11, "Box_1:vertex_11" )
-geompy.addToStudy( Plane_1, "Plane_1" )
-geompy.addToStudy( Partition_1, "Partition_1" )
-geompy.addToStudyInFather( Box_1, Box_1_vertex_19, "Box_1:vertex_19" )
-geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
-geompy.addToStudy( Plane_2, "Plane_2" )
-
-###### SMESH part ######
-import smesh
-
-import StdMeshers
-
-Mesh_1 = smesh.Mesh(Partition_1)
-Regular_1D = Mesh_1.Segment()
-Max_Size_1 = Regular_1D.MaxSize(34.641)
-MEFISTO_2D = Mesh_1.Triangle()
-Tetrahedronn = Mesh_1.Tetrahedron()
-isDone = Mesh_1.Compute()
-
-# create a group of free faces
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
-aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
-
-aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
-aGroup.Add(aFaceIds)
-
-# print the result
-print "Criterion: Free faces Nb = ", len(aFaceIds)
-j = 1
-for i in range(len(aFaceIds)):
-  if j > 20: j = 1; print ""
-  print aFaceIds[i],
-  j = j + 1
-  pass
-print ""
-
-#filter faces from plane 2
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
-aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
-aGroup.Remove(aFaceIds)
-
-# create a group of shared faces (located on partition boundary inside box)
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
-aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
-
-aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
-aGroup.Add(aFaceIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex06.py
+<a href="../../examples/SMESH/quality_controls_ex06.py">Download this script</a>
 
 \section tui_bare_border_faces Bare border faces
-
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-geompy.addToStudy( box, "box" )
-
-mesh = smesh.Mesh(box)
-mesh.Segment().NumberOfSegments(3)
-mesh.Quadrangle()
-mesh.Compute()
-
-# remove 2 faces
-allFaces = mesh.GetElementsByType(FACE)
-mesh.RemoveElements( allFaces[0:2])
-
-bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
-assert(bareGroup.Size() == 3)
-\endcode
+\include quality_controls_ex07.py
+<a href="../../examples/SMESH/quality_controls_ex07.py">Download this script</a>
 
 \section tui_bare_border_volumes Bare border volumes
-
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-box = geompy.MakeBoxDXDYDZ(100, 30, 10)
-# the smallest face of the box
-face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
-
-geompy.addToStudy( box, "box" )
-geompy.addToStudyInFather( box, face, "face" )
-
-mesh = Mesh(box)
-mesh.AutomaticHexahedralization();
-
-# remove half of mesh faces from the smallest face
-faceFaces = mesh.GetSubMeshElementsId(face)
-faceToRemove = faceFaces[: len(faceFaces)/2]
-mesh.RemoveElements( faceToRemove )
-
-# make a group of volumes missing the removed faces
-bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
-assert(bareGroup.Size() == len( faceToRemove))
-\endcode
+\include quality_controls_ex08.py
+<a href="../../examples/SMESH/quality_controls_ex08.py">Download this script</a>
 
 \section tui_over_constrained_faces Over-constrained faces
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-mesh = Mesh()
-faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
-
-#make an edge
-n1 = mesh.AddNode(0,0,0)
-n2 = mesh.AddNode(10,0,0)
-edge = mesh.AddEdge([n1,n2])
-assert( not mesh.GetIdsFromFilter( faceFilter ))
-
-# make faces 
-mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
-assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
-\endcode
+\include quality_controls_ex09.py
+<a href="../../examples/SMESH/quality_controls_ex09.py">Download this script</a>
 
 \section tui_over_constrained_volumes Over-constrained volumes
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-mesh = Mesh()
-volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
-
-# make volumes by extrusion of one face
-n1 = mesh.AddNode(0,0,0)
-n2 = mesh.AddNode(10,0,0)
-edge = mesh.AddEdge([n1,n2])
-mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 1)
-mesh.ExtrusionSweep( mesh.GetElementsByType(FACE), MakeDirStruct(0,0,5), 7)
-assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
-\endcode
+\include quality_controls_ex10.py
+<a href="../../examples/SMESH/quality_controls_ex10.py">Download this script</a>
 
 \section tui_length_2d Length 2D
-
-\code
-import salome
-import geompy
-
-import smesh
-
-# create open shell: a box without one plane
-box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-FaceList.remove(FaceList[5])
-box = geompy.MakeShell(FaceList)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-mesh = smesh.Mesh(box, "Mesh_Length_2D")
-algo = mesh.Segment()
-algo.NumberOfSegments(5)
-algo = mesh.Triangle()
-algo.MaxElementArea(20.)
-mesh.Compute()
-
-# Criterion : Length 2D > 5.7
-length_margin = 5.7
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-# print the result
-print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex11.py
+<a href="../../examples/SMESH/quality_controls_ex11.py">Download this script</a>
 
 \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
-
-\code
-import salome
-import geompy
-
-import smesh
-
-# create a compound of two glued boxes
-box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-box2 = geompy.MakeTranslation(box1, 0., 20., 0)
-comp = geompy.MakeCompound([box1, box2])
-box = geompy.MakeGlueFaces(comp, 0.000001)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
-algo = mesh.Segment()
-algo.NumberOfSegments(5)
-algo = mesh.Triangle()
-algo.MaxElementArea(20.)
-mesh.Compute() 
-
-# Criterion : MULTI-CONNECTION 2D = 3
-nb_conn = 3
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex12.py
+<a href="../../examples/SMESH/quality_controls_ex12.py">Download this script</a>
 
 \section tui_area Area
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 100.
-area_margin = 100.
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)  
-\endcode
+\include quality_controls_ex13.py
+<a href="../../examples/SMESH/quality_controls_ex13.py">Download this script</a>
 
 \section tui_taper Taper
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : Taper > 3e-20
-taper_margin = 3e-20
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex14.py
+<a href="../../examples/SMESH/quality_controls_ex14.py">Download this script</a>
 
 \section tui_aspect_ratio Aspect Ratio
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : ASPECT RATIO > 1.8
-ar_margin = 1.8
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex15.py
+<a href="../../examples/SMESH/quality_controls_ex15.py">Download this script</a>
 
 \section tui_minimum_angle Minimum Angle
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : MINIMUM ANGLE < 35.
-min_angle = 35.
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
-
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex16.py
+<a href="../../examples/SMESH/quality_controls_ex16.py">Download this script</a>
 
 \section tui_warping Warping
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : WARP ANGLE > 1e-15
-wa_margin = 1e-15
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
-
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include quality_controls_ex17.py
+<a href="../../examples/SMESH/quality_controls_ex17.py">Download this script</a>
 
 \section tui_skew Skew
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : Skew > 38.
-skew_margin = 38.
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-# print the result
-print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex18.py
+<a href="../../examples/SMESH/quality_controls_ex18.py">Download this script</a>
 
 \section tui_max_element_length_2d Element Diameter 2D
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : ELEMENT DIAMETER 2D > 10
-mel_2d_margin = 10
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex19.py
+<a href="../../examples/SMESH/quality_controls_ex19.py">Download this script</a>
 
 \section tui_aspect_ratio_3d Aspect Ratio 3D
-
-\code
-import SMESH_mechanic_tetra 
-
-smesh  = SMESH_mechanic_tetra.smesh
-mesh   = SMESH_mechanic_tetra.mesh
-salome = SMESH_mechanic_tetra.salome
-
-# Criterion : ASPECT RATIO 3D > 4.5
-ar_margin = 4.5
-
-aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
-
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex20.py
+<a href="../../examples/SMESH/quality_controls_ex20.py">Download this script</a>
 
 \section tui_volume Volume
-
-\code
-import SMESH_mechanic_tetra
-
-smesh  = SMESH_mechanic_tetra.smesh
-mesh   = SMESH_mechanic_tetra.mesh
-salome = SMESH_mechanic_tetra.salome
-
-# Criterion : VOLUME < 7.
-volume_margin = 7.
-
-aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print ""
-print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
-
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1) 
-\endcode
+\include quality_controls_ex21.py
+<a href="../../examples/SMESH/quality_controls_ex21.py">Download this script</a>
 
 \section tui_max_element_length_3d Element Diameter 3D
-
-\code
-import SMESH_mechanic_tetra
-
-smesh  = SMESH_mechanic_tetra.smesh
-mesh   = SMESH_mechanic_tetra.mesh
-salome = SMESH_mechanic_tetra.salome
-
-# Criterion : ELEMENT DIAMETER 3D > 10
-mel_3d_margin = 10
-
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-# print the result
-print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
-j = 1
-for i in range(len(anIds)):
-  if j > 20: j = 1; print ""
-  print anIds[i],
-  j = j + 1
-  pass
-print ""
-
-# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
-aGroup.Add(anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include quality_controls_ex22.py
+<a href="../../examples/SMESH/quality_controls_ex22.py">Download this script</a>
 
 */
index a4c6df87d60af179feaab31896d06b7ca6d40661..3b77fab34b86bbff2f75ce650aa9f85eb7a60a22 100644 (file)
 <br>
 \anchor tui_translation
 <h3>Translation</h3>
-
-\code
-import SMESH_mechanic
-
-smesh = SMESH_mechanic.smesh 
-mesh = SMESH_mechanic.mesh 
-
-# define translation vector
-point = smesh.PointStruct(-150., -150., 0.)
-vector =smesh.DirStruct(point) 
-
-# translate a mesh
-doCopy = 1
-
-mesh.Translate([], vector, doCopy)
-\endcode
+\include transforming_meshes_ex01.py
+<a href="../../examples/SMESH/transforming_meshes_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_rotation
 <h3>Rotation</h3>
-
-\code
-import math
-
-import SMESH_mechanic
-
-smesh = SMESH_mechanic.smesh
-mesh = SMESH_mechanic.mesh 
-
-# define rotation axis and angle
-axisXYZ = smesh.AxisStruct(0., 0., 0., 5., 5., 20.)
-angle270 = 1.5 * math.pi
-
-# rotate a mesh
-mesh.Rotate([], axisXYZ, angle270, 1)  
-\endcode
+\include transforming_meshes_ex02.py
+<a href="../../examples/SMESH/transforming_meshes_ex02.py">Download this script</a>
 
 <br>
 \anchor tui_scale
 <h3>Scale</h3>
-
-\code
-import geompy
-Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
-
-import smesh,SMESH
-import StdMeshers
-Mesh1 = smesh.Mesh(f[0])
-Regular_1D = Mesh1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(3)
-Nb_Segments_1.SetDistrType( 0 )
-Quadrangle_2D = Mesh1.Quadrangle()
-isDone = Mesh1.Compute()
-
-#Perform scale opration for the whole mesh and creation of a new mesh
-newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh")
-
-#Perform scale operation for the whole mesh and copy elements
-Mesh1.Scale(Mesh1,SMESH.PointStruct(200,100,100),[0.5,0.5,0.5],True,True)
-
-#Perform scale opration for two edges and move elements
-Mesh1.Scale([1,2],SMESH.PointStruct(-100,100,100),[0.8,1.0,0.7],False)
-
-#Perform scale opration for one face and move elements
-Mesh1.Scale([21],SMESH.PointStruct(0,200,200),[0.7,0.7,0.7],False)
-\endcode
+\include transforming_meshes_ex03.py
+<a href="../../examples/SMESH/transforming_meshes_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_symmetry
 <h3>Symmetry</h3>
-
-\code
-import math
-
-import SMESH_mechanic
-
-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)
-
-mesh.Mirror([], axis, smesh.POINT, 1)
-\endcode
+\include transforming_meshes_ex04.py
+<a href="../../examples/SMESH/transforming_meshes_ex04.py">Download this script</a>
 
 <br>
 \anchor tui_merging_nodes
 <h3>Merging Nodes</h3>
-
-\code
-import SMESH_mechanic
-mesh = SMESH_mechanic.mesh
-
-# merge nodes
-Tolerance = 25.0
-
-GroupsOfNodes =  mesh.FindCoincidentNodes(Tolerance)
-mesh.MergeNodes(GroupsOfNodes)  
-\endcode
+\include transforming_meshes_ex05.py
+<a href="../../examples/SMESH/transforming_meshes_ex05.py">Download this script</a>
 
 <br>
 \anchor tui_merging_elements
 <h3>Merging Elements</h3>
-
-\code
-import salome
-import geompy
-import smesh
-
-# create a face to be meshed
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-pz = geompy.MakeVertex(0.  , 0.  , 100.)
-
-vxy = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, pz, px)
-
-wire = geompy.MakeWire([vxy, arc])
-isPlanarFace = 1
-
-face1 = geompy.MakeFace(wire, isPlanarFace)
-id_face1 = geompy.addToStudy(face1, "Face1")
-
-# create a circle to be an extrusion path
-px1 = geompy.MakeVertex( 100.,  100.,  0.)
-py1 = geompy.MakeVertex(-100., -100.,  0.)
-pz1 = geompy.MakeVertex(   0.,    0., 50.)
-
-circle = geompy.MakeCircleThreePnt(py1, pz1, px1)
-id_circle = geompy.addToStudy(circle, "Path")
-# create a 2D mesh on the face
-trias = smesh.Mesh(face1, "Face : 2D mesh")
-
-algo1D = trias.Segment()
-algo1D.NumberOfSegments(6)
-algo2D = trias.Triangle()
-algo2D.LengthFromEdges()
-
-trias.Compute()
-
-# create a path mesh
-circlemesh = smesh.Mesh(circle, "Path mesh")
-algo = circlemesh.Segment()
-algo.NumberOfSegments(10)
-circlemesh.Compute()
-
-# extrusion of the mesh
-trias.ExtrusionAlongPath([], circlemesh, circle,
-                         1, 0, [], 0, smesh.PointStruct(0, 0, 0))
-
-# merge nodes
-print "Number of nodes before MergeNodes:", 
-trias.NbNodes()
-tolerance = 0.001
-array_of_nodes_groups = trias.FindCoincidentNodes(tolerance)
-
-trias.MergeNodes(array_of_nodes_groups)
-
-print "Number of nodes after MergeNodes:", trias.NbNodes()
-print ""
-print "Number of elements before MergeEqualElements:"
-print "Edges      : ", trias.NbEdges()
-print "Triangles  : ", trias.NbTriangles()
-print "Quadrangles: ", trias.NbQuadrangles()
-print "Volumes    : ", trias.NbVolumes()
-
-# merge elements
-trias.MergeEqualElements()
-print "Number of elements after MergeEqualElements:"
-print "Edges      : ", trias.NbEdges()
-print "Triangles  : ", trias.NbTriangles()
-print "Quadrangles: ", trias.NbQuadrangles()
-print "Volumes    : ", trias.NbVolumes()
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include transforming_meshes_ex06.py
+<a href="../../examples/SMESH/transforming_meshes_ex06.py">Download this script</a>
 
 <br><h2>Sewing Meshes</h2>
 
 <br>
 \anchor tui_sew_meshes_border_to_side
 <h3>Sew Meshes Border to Side</h3>
-
-\code
-import geompy
-import smesh
-
-# create two faces of a box
-box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.)
-facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
-face1 = facesList1[2]
-
-box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
-facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
-face2 = facesList2[1]
-
-edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
-edge1 = edgesList[2]
-
-aComp = geompy.MakeCompound([face1, face2])
-geompy.addToStudy(aComp, "Two faces")
-
-# create a mesh on two faces
-mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
-
-algo1D = mesh.Segment()
-algo1D.NumberOfSegments(9)
-algo2D = mesh.Quadrangle()
-
-algo_local = mesh.Segment(edge1)
-algo_local.Arithmetic1D(1, 4)
-algo_local.Propagation()
-
-mesh.Compute()
-
-# sew border to side
-# FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
-# FirstNodeIDOnSide, LastNodeIDOnSide,
-# CreatePolygons, CreatePolyedrs
-mesh.SewBorderToSide(5, 45, 6, 113, 109, 0, 0)
-\endcode
+\include transforming_meshes_ex07.py
+<a href="../../examples/SMESH/transforming_meshes_ex07.py">Download this script</a>
 
 <br>
 \anchor tui_sew_conform_free_borders
 <h3>Sew Conform Free Borders</h3>
-
-\code
-import geompy
-import smesh
-
-# create two faces of the box
-box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.)
-facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
-face1 = facesList1[2]
-
-box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
-facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
-face2 = facesList2[1]
-
-edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
-edge1 = edgesList[2]
-
-aComp = geompy.MakeCompound([face1, face2])
-geompy.addToStudy(aComp, "Two faces")
-
-# create a mesh on two faces
-mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
-
-algo1D = mesh.Segment()
-algo1D.NumberOfSegments(9)
-algo2D = mesh.Quadrangle()
-
-algo_local = mesh.Segment(edge1)
-algo_local.Arithmetic1D(1, 4)
-algo_local.Propagation()
-
-mesh.Compute()
-
-# sew conform free borders
-# FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2
-mesh.SewConformFreeBorders(5, 45, 6, 3, 24) 
-\endcode
+\include transforming_meshes_ex08.py
+<a href="../../examples/SMESH/transforming_meshes_ex08.py">Download this script</a>
 
 <br>
 \anchor tui_sew_free_borders
 <h3>Sew Free Borders</h3>
-
-\code
-import geompy
-import smesh
-
-# create two faces of the box
-box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
-face1 = facesList1[2]
-
-box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
-facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
-face2 = facesList2[1]
-
-edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
-edge1 = edgesList[2]
-
-aComp = geompy.MakeCompound([face1, face2])
-geompy.addToStudy(aComp, "Two faces")
-
-# create a mesh on two faces
-mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
-
-algo1D = mesh.Segment()
-algo1D.NumberOfSegments(4)
-algo2D = mesh.Quadrangle()
-
-algo_local = mesh.Segment(edge1)
-algo_local.Arithmetic1D(1, 4)
-algo_local.Propagation()
-
-mesh.Compute()
-
-# sew free borders
-# FirstNodeID1, SecondNodeID1, LastNodeID1,
-# FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs
-mesh.SewFreeBorders(6, 21, 5, 1, 12, 3, 0, 0)
-\endcode
+\include transforming_meshes_ex09.py
+<a href="../../examples/SMESH/transforming_meshes_ex09.py">Download this script</a>
 
 <br>
 \anchor tui_sew_side_elements
 <h3>Sew Side Elements</h3>
-
-\code
-import geompy
-import smesh
-
-# create two boxes
-box1 = geompy.MakeBox(0.,  0., 0., 10., 10., 10.)
-box2 = geompy.MakeBox(0., 15., 0., 20., 25., 10.)
-
-EdgesList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
-
-aComp = geompy.MakeCompound([box1, box2])
-geompy.addToStudy(aComp, "Two boxes")
-
-# create a mesh on two boxes
-mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
-
-algo1D = mesh.Segment()
-algo1D.NumberOfSegments(2)
-algo2D = mesh.Quadrangle()
-
-algo_local = mesh.Segment(EdgesList[8])
-algo_local.NumberOfSegments(4)
-algo_local.Propagation()
-
-mesh.Compute()
-
-# sew side elements
-# IDsOfSide1Elements, IDsOfSide2Elements,
-# NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge
-mesh.SewSideElements([69, 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)
-\endcode
+\include transforming_meshes_ex10.py
+<a href="../../examples/SMESH/transforming_meshes_ex10.py">Download this script</a>
 
 <br>
 \anchor tui_duplicate_nodes
 <h3>Duplicate nodes</h3>
-
-\code
-import salome
-import smesh
-import SMESH_test1
-
-mesh = SMESH_test1.mesh
-
-# Compute mesh
-mesh.Compute()
-
-# Without the duplication of border elements
-
-# Nodes to duplicate
-nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' )
-nodes1.Add( [ 289, 278, 302, 285 ] )
-
-# Group of faces to replace nodes with new ones 
-faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' )
-faces1.Add( [ 519, 556, 557 ] )
-
-# Duplicate nodes
-print "\nMesh before the first nodes duplication:"
-print "Nodes      : ", mesh.NbNodes()
-print "Edges      : ", mesh.NbEdges()
-print "Triangles  : ", mesh.NbTriangles()
-
-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()
-
-# With the duplication of border elements
-
-# Edges to duplicate
-edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' )
-edges.Add( [ 29, 30, 31 ] )
-
-# Nodes not to duplicate
-nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' )
-nodes2.Add( [ 32, 5 ] )
-
-# Group of faces to replace nodes with new ones 
-faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' )
-faces2.Add( [ 576, 578, 580 ] )
-
-# Duplicate nodes
-print "\nMesh before the second nodes duplication:"
-print "Nodes      : ", mesh.NbNodes()
-print "Edges      : ", mesh.NbEdges()
-print "Triangles  : ", mesh.NbTriangles()
-
-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()
-
-# Update object browser
-if salome.sg.hasDesktop():
-    salome.sg.updateObjBrowser(0)
-\endcode
+\include transforming_meshes_ex11.py
+<a href="../../examples/SMESH/transforming_meshes_ex11.py">Download this script</a>
 
 <br>
 \anchor tui_make_2dmesh_from_3d
 <h3>Create boundary elements</h3>
-
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
-f1,f2 = gFaces[0],gFaces[1]
-geompy.addToStudy(box,"box")
-geompy.addToStudyInFather(box,f1,"face1")
-geompy.addToStudyInFather(box,f2,"face2")
-
-twoFaces = geompy.MakeCompound([f1,f2])
-
-## -----------
-##
-## 2D from 3D
-##
-## -----------
-dim = SMESH.BND_2DFROM3D
-
-init_mesh = Mesh(box, "box")
-init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
-
-# remove some faces
-faces = init_mesh.GetElementsByType( SMESH.FACE )
-nb_faces = len( faces )
-rm_face = faces[ : nb_faces/2]
-init_mesh.RemoveElements( rm_face )
-
-# restore boundary in this mesh
-mesh = CopyMesh( init_mesh, "2D from 3D")
-groupName = "bnd 2D"
-nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
-
-# restore boundary (only) in other mesh
-meshName = "2D boundary of " + init_mesh.GetName()
-nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName)
-
-# restore boundary in mesh copy
-meshName = init_mesh.GetName() + " + boundary"
-nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName, toCopyAll=True)
-
-
-## -----------
-##
-## 1D from 2D
-##
-## -----------
-dim = SMESH.BND_1DFROM2D
-
-init_mesh = Mesh(f1, "2D mesh")
-init_mesh.AutomaticHexahedralization()
-
-# remove some edges
-edges = init_mesh.GetElementsByType( SMESH.EDGE )
-nb_edges = len( edges )
-rm_edge = edges[ : nb_edges/2]
-init_mesh.RemoveElements( rm_edge )
-
-
-# restore boundary edges in this mesh
-mesh = CopyMesh( init_mesh, "1D from 2D")
-groupName = "bnd 1D"
-nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
-
-# restore boundary edges (only) in other mesh
-meshName = "1D boundary of " + init_mesh.GetName()
-nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName)
-
-# restore boundary edges in mesh copy
-meshName = init_mesh.GetName() + " + boundary"
-nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName, toCopyAll=True)
-
-
-
-## ------------------
-##
-## 1D from 2D GROUPS
-##
-## ------------------
-dim = SMESH.BND_1DFROM3D
-
-init_mesh = Mesh(box, "box")
-init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
-# remove all edges
-rm_edges = init_mesh.GetElementsByType( SMESH.EDGE )
-init_mesh.RemoveElements( rm_edges )
-
-# make groups of faces
-fGroup1 = init_mesh.Group( f1, "f1" )
-fGroup2 = init_mesh.Group( f2, "f2" )
-
-# make 1D boundary around groups in this mesh
-mesh = CopyMesh( init_mesh, "1D from 2D groups", toCopyGroups=True)
-groups = mesh.GetGroups()
-nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName,groups=groups)
-
-# make 1D boundary (only) in other mesh
-meshName =  "boundary from groups of " + init_mesh.GetName()
-groups = init_mesh.GetGroups()
-nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName,groups=groups)
-
-# make 1D boundary in mesh copy
-meshName = init_mesh.GetName() + " + boundary from groups"
-nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName,
-                                                         groups=groups, toCopyAll=True)
-
-\endcode
+\include transforming_meshes_ex12.py
+<a href="../../examples/SMESH/transforming_meshes_ex12.py">Download this script</a>
 
 <br>
 \anchor tui_reorient_faces
 <h3>Reorient faces by vector</h3>
-
-\code
-import smesh, geompy, SMESH
-
-# create a geometry consisting of two faces
-box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
-faces = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])
-
-shape = geompy.MakeCompound( faces[:2] )
-faces = geompy.SubShapeAll( shape, geompy.ShapeType["FACE"] )
-geompy.addToStudy( shape, "shape")
-geompy.addToStudyInFather( shape, faces[0], "faces[0]")
-geompy.addToStudyInFather( shape, faces[1], "faces[1]")
-
-# create a 2D mesh
-mesh = smesh.Mesh( shape, "test_Reorient2D")
-mesh.AutomaticHexahedralization(0.5)
-localAlgo = mesh.Segment(faces[0])
-localAlgo.NumberOfSegments( 11 )
-mesh.Compute()
-group = mesh.Group( faces[1] )
-
-vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
-
-# Each of arguments of Reorient2D() function can be of different types:
-#
-# 2DObject    - the whole mesh
-# Direction   - a GEOM object (vector)
-# FaceOrPoint - an ID of face
-mesh.Reorient2D( mesh, vec, mesh.NbElements() )
-#
-# 2DObject    - a sub-mesh
-# Direction   - components of a vector
-# FaceOrPoint - a GEOM object (vertex)
-mesh.Reorient2D( localAlgo.GetSubMesh(), [ 1, -1, 1 ], geompy.GetFirstVertex( vec ))
-#
-# 2DObject    - a group of faces
-# Direction   - a SMESH.DirStruct structure
-# FaceOrPoint - coordinates of a point
-mesh.Reorient2D( group, smesh.MakeDirStruct( -10, 1, 10 ), [0,0,0])
-#
-# FaceOrPoint - a SMESH.PointStruct structure
-mesh.Reorient2D( localAlgo.GetSubMesh().GetIDs(), [10,1,0], SMESH.PointStruct(0,0,0))
-
-\endcode
+\include transforming_meshes_ex13.py
+<a href="../../examples/SMESH/transforming_meshes_ex13.py">Download this script</a>
 
 */
index 0f95ac4d4f9e070ca91e721325f8e0888e05a2b1..46dfe1e054a22efa783bbc87e876b3511d05e89a 100644 (file)
@@ -6,117 +6,8 @@ This sample demonstrates how to use <b>Use existing faces</b> algorithm,
 which is actulally just a stub allowing to use your own 2D algoritm
 implemented in Python.
 
-
-\code
-import smesh, geompy
-import numpy as np
-
-# define my 2D algorithm
-def my2DMeshing( geomFace ):
-
-    # find gravity center of geomFace
-    gcXYZ = geompy.PointCoordinates( geompy.MakeCDG( geomFace ))
-
-    # define order and orientation of edges
-    sortedEdges = []
-    geomEdges = geompy.SubShapeAll( geomFace, geompy.ShapeType["EDGE"])
-    sortedEdges.append(( geomEdges.pop(0), True ))
-    while geomEdges:
-        prevEdge_rev = sortedEdges[ -1 ]
-        prevVV = geompy.SubShapeAll( prevEdge_rev[0], geompy.ShapeType["VERTEX"])
-        prevV2 = prevVV[ prevEdge_rev[1] ]
-        found = False
-        for iE in range( len( geomEdges )):
-            v1,v2 = geompy.SubShapeAll( geomEdges[ iE ], geompy.ShapeType["VERTEX"])
-            same1,same2 = [( geompy.MinDistance( prevV2, v ) < 1e-7 ) for v in [v1,v2] ]
-            if not same1 and not same2: continue
-            sortedEdges.append(( geomEdges.pop( iE ), same1 ))
-            found = True
-            break
-        assert found
-    sortedEdges.reverse()
-
-    # put nodes on edges in a right order
-    nodes = []
-    for edge, isForward in sortedEdges:
-        v1,v2 = geompy.SubShapeAll( edge, geompy.ShapeType["VERTEX"])
-        edgeNodes = mesh.GetSubMeshNodesId( v2,   all=False ) + \
-                    mesh.GetSubMeshNodesId( edge, all=False ) + \
-                    mesh.GetSubMeshNodesId( v1,   all=False )
-        if not isForward: edgeNodes.reverse()
-        nodes.extend( edgeNodes[:-1] )
-
-    # create nodes inside the geomFace
-    r1 = 0.6
-    r2 = 1 - r1
-    nodesInside = []
-    for n in nodes:
-        nXYZ = mesh.GetNodeXYZ( n )
-        newXYZ = np.add( np.multiply( r1, gcXYZ ), np.multiply( r2, nXYZ ))
-        nodesInside.append( mesh.AddNode( newXYZ[0], newXYZ[1], newXYZ[2] ))
-        mesh.SetNodeOnFace( nodesInside[-1], geomFace, 0, 0 )
-
-    # find out orientation of faces to create
-    #    geomFace normal
-    faceNorm = geompy.GetNormal( geomFace )
-    v1,v2 = [ geompy.PointCoordinates( v ) \
-              for v in geompy.SubShapeAll( faceNorm, geompy.ShapeType["VERTEX"]) ]
-    faceNormXYZ = np.subtract( v2, v1 )
-    outDirXYZ   = np.subtract( v1, [ 50, 50, 50 ] )
-    if np.dot( faceNormXYZ, outDirXYZ ) < 0: # reversed face
-        faceNormXYZ = np.multiply( -1., faceNormXYZ )
-    #   mesh face normal
-    e1 = np.subtract( mesh.GetNodeXYZ( nodes[0] ), mesh.GetNodeXYZ( nodes[1] ))
-    e2 = np.subtract( mesh.GetNodeXYZ( nodes[0] ), mesh.GetNodeXYZ( nodesInside[0] ))
-    meshNorm = np.cross( e1, e2 )
-    #   faces orientation
-    reverse = ( np.dot( faceNormXYZ, meshNorm ) < 0 )
-
-    # create mesh faces
-    iN = len( nodes )
-    while iN:
-        n1, n2, n3, n4 = nodes[iN-1], nodes[iN-2], nodesInside[iN-2], nodesInside[iN-1]
-        iN -= 1
-        if reverse:
-            f = mesh.AddFace( [n1, n2, n3, n4] )
-        else:
-            f = mesh.AddFace( [n4, n3, n2, n1] )
-        # new faces must be assigned to geometry to allow 3D algorithm finding them
-        mesh.SetMeshElementOnShape( f, geomFace )
-
-    if reverse:
-        nodesInside.reverse()
-    polygon = mesh.AddPolygonalFace( nodesInside )
-    mesh.SetMeshElementOnShape( polygon, geomFace )
-
-    return
-
-# create geometry and get faces to mesh with my2DMeshing()
-box = geompy.MakeBoxDXDYDZ( 100, 100, 100 )
-f1 = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
-f2 = geompy.GetOppositeFace( box, f1 )
-geompy.addToStudy( box, "box" )
-geompy.addToStudy( f1, "f1" )
-geompy.addToStudy( f2, "f2" )
-
-# compute 1D mesh
-mesh = smesh.Mesh( box )
-mesh.Segment().NumberOfSegments( 5 )
-mesh.Compute()
-
-# compute 2D mesh
-mesh.Quadrangle()
-mesh.UseExistingFaces(f1) # UseExistingFaces() allows using my2DMeshing()
-mesh.UseExistingFaces(f2)
-my2DMeshing( f1 )
-my2DMeshing( f2 )
-assert mesh.Compute()
-
-# compute 3D mesh
-mesh.Prism()
-assert mesh.Compute()
-
-\endcode
+\include use_existing_faces.py
+<a href="../../examples/SMESH/use_existing_faces.py">Download this script</a>
 
 Resulting mesh:
 \image html use_existing_face_sample_mesh.png
index fc0094e4b5f440348035387c3b9a8e8d9be70f13..06586ffea212f7e88f9edb190bc10296498d7113 100644 (file)
 <br>
 \anchor tui_viewing_mesh_infos
 <h2>Viewing Mesh Infos</h2>
-
-\code
-import geompy
-import smesh
-import SMESH
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
-geompy.addToStudy(box, "box")
-[Face_1,Face_2,Face_3,Face_4,Face_5,Face_5] = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-
-# create a mesh
-tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments(3)
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea(10.)
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume(900.)
-
-# Creation of SubMesh
-Regular_1D_1_1 = tetra.Segment(geom=Face_1)
-Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5)
-Nb_Segments_1.SetDistrType( 0 )
-Quadrangle_2D = tetra.Quadrangle(geom=Face_1)
-isDone = tetra.Compute()
-submesh = Regular_1D_1_1.GetSubMesh()
-
-# compute the mesh
-tetra.Compute()
-
-# Creation of group
-group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' )
-nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] )
-
-# Print information about the mesh
-print "Information about mesh:" 
-print "Number of nodes       : ", tetra.NbNodes()
-print "Number of edges       : ", tetra.NbEdges()
-print "Number of faces       : ", tetra.NbFaces()
-print "          triangles   : ", tetra.NbTriangles()
-print "          quadrangles : ", tetra.NbQuadrangles()
-print "          polygons    : ", tetra.NbPolygons()
-print "Number of volumes     : ", tetra.NbVolumes()
-print "          tetrahedrons: ", tetra.NbTetras()
-print "          hexahedrons : ", tetra.NbHexas()
-print "          prisms      : ", tetra.NbPrisms()
-print "          pyramids    : ", tetra.NbPyramids()
-print "          polyhedrons : ", tetra.NbPolyhedrons() 
-
-# Get Information About Mesh by GetMeshInfo
-print "\nInformation about mesh by GetMeshInfo:"
-info = smesh.GetMeshInfo(tetra)
-keys = info.keys(); keys.sort()
-for i in keys:
-  print "  %s   :  %d" % ( i, info[i] )
-  pass
-
-# Get Information About Group by GetMeshInfo
-print "\nInformation about group by GetMeshInfo:"
-info = smesh.GetMeshInfo(group)
-keys = info.keys(); keys.sort()
-for i in keys:
-  print "  %s  :  %d" % ( i, info[i] )
-  pass
-
-# Get Information About SubMesh by GetMeshInfo
-print "\nInformation about Submesh by GetMeshInfo:"
-info = smesh.GetMeshInfo(submesh)
-keys = info.keys(); keys.sort()
-for i in keys:
-  print "  %s  :  %d" % ( i, info[i] )
-  pass
-\endcode
-
-
+\include viewing_meshes_ex01.py
+<a href="../../examples/SMESH/viewing_meshes_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_find_element_by_point
 <h2>Find Element by Point</h2>
-
-\code
-import geompy
-import smesh
-import SMESH
-
-# Create a geometry to mesh
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-
-# Create a mesh
-mesh = Mesh(box,"Mesh")
-mesh.AutomaticHexahedralization()
-mesh.Compute()
-
-# Create a point
-x,y,z = 0, 0, 1
-
-# Find all elements (except 0D ones) located at the point
-all_elems_except_0D = mesh.FindElementsByPoint(x,y,z)
-assert( len(all_elems_except_0D) == 4)
-
-# Find nodes at the point
-nodes = mesh.FindElementsByPoint(x,y,z, SMESH.NODE )
-assert( len(nodes) == 0)
-assert( len( mesh.FindElementsByPoint(x,y,0, SMESH.NODE)) == 1)
-
-# Find an edge at the point
-edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE )
-assert( len(edges) == 1)
-
-# Find faces at the point
-edges = mesh.FindElementsByPoint(x,y,z, SMESH.FACE )
-assert( len(edges) == 2)
-
-# Find a volume at the point
-vols = mesh.FindElementsByPoint(x,y,z, SMESH.VOLUME )
-assert( len(vols) == 1)
-
-# Find 0D elements at the point
-elems0d = mesh.FindElementsByPoint(x,y,z, SMESH.ELEM0D )
-assert( len(elems0d) == 0)
-
-# Find edges within a group
-group1D = mesh.MakeGroupByIds("1D", SMESH.EDGE, [1,2] )
-edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE, group1D )
-
-\endcode
+\include viewing_meshes_ex02.py
+<a href="../../examples/SMESH/viewing_meshes_ex02.py">Download this script</a>
 
 */
index 3634ccf6046e4a3a85e4e221a6df40abb3f7ba2c..b568a94dd73a06a26fe0e981d18be7b46cec7660 100644 (file)
@@ -40,7 +40,10 @@ the same groups as in the imported source mesh.</li>
 
 <b>Use Existing 2D Elements</b> algorithm allows to define the mesh of
 a geometrical face (or group of faces)
-by importing mesh faces contained in a group (or groups) from another mesh.
+by importing mesh faces contained in a group (or groups) from another
+(or this) mesh. 1D elements on the boundary of the geometrical face
+(if not yet present) are also created by the algorithm according to be conformal
+with the created 2D elements.
 \n To apply this algorithm select the geometrical face to be meshed (indicated in
 the field \b Geometry of <b>Create mesh</b> dialog box),
 <b>Use existing 2D elements</b> in the list of 2D algorithms and click the
index 8cc7bc8645724e8201e5d8c7bb0997d99e57d7bb..2c701fc2bd2e410f7fb969c2054d33fbf3b04018 100644 (file)
@@ -115,7 +115,7 @@ module SMESH
   {
     double GetValue( in long theElementId );
 
-    Histogram GetHistogram( in short nbIntervals );
+    Histogram GetHistogram( in short nbIntervals, in boolean isLogarithmic );
 
     /*!
     * Set precision for calculation. It is a position after point which is
index 56f465e45ecc838e7b9eddb4675c9432ac55170f..33c775e38b96e36bd1f80cc43836185bb22d0275 100644 (file)
@@ -110,6 +110,14 @@ module SMESH
     double_array     params; // [U] on EDGE, [U,V] on FACE, [] on the rest shapes
   };
 
+  /*!
+   * Element location on a shape
+   */
+  struct ElementPosition {
+    long             shapeID;
+    GEOM::shape_type shapeType;
+  };
+
   /*!
    * Enumeration for element type, like in SMDS
    */
@@ -220,6 +228,7 @@ module SMESH
     DRS_WARN_RENUMBER,  // a MED file has overlapped ranges of element numbers,
                         // so the numbers from the file are ignored
     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
+    DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
     DRS_FAIL            // general failure (exception etc.)
   };
 
@@ -505,8 +514,6 @@ module SMESH
     Hypothesis_Status AddHypothesis(in GEOM::GEOM_Object aSubObject,
                                    in SMESH_Hypothesis anHyp)
       raises (SALOME::SALOME_Exception);
-//     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
-//       raises (SALOME::SALOME_Exception);
 
     /*!
      * Remove an hypothesis previouly added with AddHypothesis.
@@ -514,17 +521,12 @@ module SMESH
     Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Object aSubObject,
                                       in SMESH_Hypothesis anHyp)
       raises (SALOME::SALOME_Exception);
-//     boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
-//                          in SMESH_Hypothesis anHyp)
-//       raises (SALOME::SALOME_Exception);
 
     /*!
      * Get the list of hypothesis added on a sub-shape
      */
     ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Object aSubObject)
       raises (SALOME::SALOME_Exception);
-//     ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh)
-//       raises (SALOME::SALOME_Exception);
 
     /*!
      * Get the log of nodes and elements added or removed since previous
@@ -532,8 +534,6 @@ module SMESH
      * @params
      * - clearAfterGet : log is emptied after Get (safe if concurrents access)
      */
-    //    string_array GetLog(in boolean clearAfterGet)
-    //      raises (SALOME::SALOME_Exception);
     log_array GetLog(in boolean clearAfterGet)
       raises (SALOME::SALOME_Exception);
 
@@ -836,6 +836,11 @@ module SMESH
      */
     NodePosition GetNodePosition(in long NodeID);
 
+    /*!
+     * \brief Return position of an element on shape
+     */
+    ElementPosition GetElementPosition(in long ElemID);
+
     /*!
      * If given element is node returns IDs of shape from position
      * If there is not node for given ID - returns -1
index 20be2291777f1f731c46d505c9288e9a44a232f0..efad182dbf62aa75299a5230af682d15a157772f 100644 (file)
     <parameter name="auto_groups"                  value="false"/>
     <parameter name="show_result_notification"     value="2"/>
     <parameter name="mesh_elem_info"               value="1"/>
+    <parameter name="elem_info_grp_details"        value="false"/>
     <parameter name="info_groups_nodes_limit"      value="100000"/>
+    <parameter name="info_dump_base"               value="true" />
+    <parameter name="info_dump_elem"               value="true" />
+    <parameter name="info_dump_add"                value="true" />
     <parameter name="segmentation"                 value="10"/>
     <parameter name="nb_segments_per_edge"         value="15"/>
     <parameter name="forget_mesh_on_hyp_modif"     value="false"/>
     <parameter name="documentation"                value="smesh_help"/>
     <parameter name="preview_actor_chunk_size"     value="100" />
     <parameter name="historical_python_dump"       value="true" />
+    <parameter name="numbering_node_color"         value="255, 255, 255" />
+    <parameter name="numbering_node_font"          value="Times,Bold,10" />
+    <parameter name="numbering_elem_color"         value="0, 255, 0" />
+    <parameter name="numbering_elem_font"          value="Times,Bold,12" />
     <!-- Input field precisions -->
     <parameter name="def_precision"                value="3"  />
     <parameter name="length_precision"             value="-6"  />
index 3e44afe282f09f0a2c53c05b5466a46986c87f9d..239aa41e4be9f406af25451bce4fb401b16db0d8 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 #include "SMESH_ControlsDef.hxx"
 
@@ -322,12 +321,12 @@ double NumericalFunctor::Round( const double & aVal )
  *  \param minmax - boundaries of diapason of values to divide into intervals
  */
 //================================================================================
-
 void NumericalFunctor::GetHistogram(int                  nbIntervals,
                                     std::vector<int>&    nbEvents,
                                     std::vector<double>& funValues,
                                     const vector<int>&   elements,
-                                    const double*        minmax)
+                                    const double*        minmax,
+                                    const bool           isLogarithmic)
 {
   if ( nbIntervals < 1 ||
        !myMesh ||
@@ -380,8 +379,15 @@ void NumericalFunctor::GetHistogram(int                  nbIntervals,
   for ( int i = 0; i < nbIntervals; ++i )
   {
     // find end value of i-th interval
-    double r = (i+1) / double( nbIntervals );
-    funValues[i+1] = funValues.front() * (1-r) + funValues.back() * r;
+    double r = (i+1) / double(nbIntervals);
+    if (isLogarithmic && funValues.front() > 1e-07 && funValues.back() > 1e-07) {
+      double logmin = log10(funValues.front());
+      double lval = logmin + r * (log10(funValues.back()) - logmin);
+      funValues[i+1] = pow(10.0, lval);
+    }
+    else {
+      funValues[i+1] = funValues.front() * (1-r) + funValues.back() * r;
+    }
 
     // count values in the i-th interval if there are any
     if ( min != values.end() && *min <= funValues[i+1] )
@@ -3671,23 +3677,11 @@ ElementsOnShape::ElementsOnShape()
     myToler(Precision::Confusion()),
     myAllNodesFlag(false)
 {
-  myCurShapeType = TopAbs_SHAPE;
 }
 
 ElementsOnShape::~ElementsOnShape()
 {
-}
-
-void ElementsOnShape::SetMesh (const SMDS_Mesh* theMesh)
-{
-  myMeshModifTracer.SetMesh( theMesh );
-  if ( myMeshModifTracer.IsMeshModified())
-    SetShape(myShape, myType);
-}
-
-bool ElementsOnShape::IsSatisfy (long theElementId)
-{
-  return myIds.Contains(theElementId);
+  clearClassifiers();
 }
 
 SMDSAbs_ElementType ElementsOnShape::GetType() const
@@ -3710,169 +3704,163 @@ double ElementsOnShape::GetTolerance() const
 
 void ElementsOnShape::SetAllNodes (bool theAllNodes)
 {
-  if (myAllNodesFlag != theAllNodes) {
-    myAllNodesFlag = theAllNodes;
-    SetShape(myShape, myType);
-  }
+  myAllNodesFlag = theAllNodes;
+}
+
+void ElementsOnShape::SetMesh (const SMDS_Mesh* theMesh)
+{
+  myMesh = theMesh;
 }
 
 void ElementsOnShape::SetShape (const TopoDS_Shape&       theShape,
                                 const SMDSAbs_ElementType theType)
 {
-  myType = theType;
+  myType  = theType;
   myShape = theShape;
-  myIds.Clear();
-
-  const SMDS_Mesh* myMesh = myMeshModifTracer.GetMesh();
+  if ( myShape.IsNull() ) return;
   
-  if ( !myMesh ) return;
-
-  myIds.ReSize( myMeshModifTracer.GetMesh()->GetMeshInfo().NbElements( myType ));
+  TopTools_IndexedMapOfShape shapesMap;
+  TopAbs_ShapeEnum shapeTypes[4] = { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX };
+  TopExp_Explorer sub;
+  for ( int i = 0; i < 4; ++i )
+  {
+    if ( shapesMap.IsEmpty() )
+      for ( sub.Init( myShape, shapeTypes[i] ); sub.More(); sub.Next() )
+        shapesMap.Add( sub.Current() );
+    if ( i > 0 )
+      for ( sub.Init( myShape, shapeTypes[i], shapeTypes[i-1] ); sub.More(); sub.Next() )
+        shapesMap.Add( sub.Current() );
+  }
 
-  myShapesMap.Clear();
-  addShape(myShape);
+  clearClassifiers();
+  myClassifiers.resize( shapesMap.Extent() );
+  for ( int i = 0; i < shapesMap.Extent(); ++i )
+    myClassifiers[ i ] = new TClassifier( shapesMap( i+1 ), myToler );
 }
 
-void ElementsOnShape::addShape (const TopoDS_Shape& theShape)
+void ElementsOnShape::clearClassifiers()
 {
-  if (theShape.IsNull() || myMeshModifTracer.GetMesh() == 0)
-    return;
+  for ( size_t i = 0; i < myClassifiers.size(); ++i )
+    delete myClassifiers[ i ];
+  myClassifiers.clear();
+}
 
-  if (!myShapesMap.Add(theShape)) return;
+bool ElementsOnShape::IsSatisfy (long elemId)
+{
+  const SMDS_MeshElement* elem =
+    ( myType == SMDSAbs_Node ? myMesh->FindNode( elemId ) : myMesh->FindElement( elemId ));
+  if ( !elem || myClassifiers.empty() )
+    return false;
 
-  myCurShapeType = theShape.ShapeType();
-  switch (myCurShapeType)
+  for ( size_t i = 0; i < myClassifiers.size(); ++i )
   {
-  case TopAbs_COMPOUND:
-  case TopAbs_COMPSOLID:
-  case TopAbs_SHELL:
-  case TopAbs_WIRE:
+    SMDS_ElemIteratorPtr aNodeItr = elem->nodesIterator();
+    bool isSatisfy = myAllNodesFlag;
+    
+    gp_XYZ centerXYZ (0, 0, 0);
+
+    while (aNodeItr->more() && (isSatisfy == myAllNodesFlag))
     {
-      TopoDS_Iterator anIt (theShape, Standard_True, Standard_True);
-      for (; anIt.More(); anIt.Next()) addShape(anIt.Value());
+      SMESH_TNodeXYZ aPnt ( aNodeItr->next() );
+      centerXYZ += aPnt;
+      isSatisfy = ! myClassifiers[i]->IsOut( aPnt );
     }
-    break;
-  case TopAbs_SOLID:
+
+    // Check the center point for volumes MantisBug 0020168
+    if (isSatisfy &&
+        myAllNodesFlag &&
+        myClassifiers[i]->ShapeType() == TopAbs_SOLID)
     {
-      myCurSC.Load(theShape);
-      process();
+      centerXYZ /= elem->NbNodes();
+      isSatisfy = ! myClassifiers[i]->IsOut( centerXYZ );
     }
+    if ( isSatisfy )
+      return true;
+  }
+
+  return false;
+}
+
+TopAbs_ShapeEnum ElementsOnShape::TClassifier::ShapeType() const
+{
+  return myShape.ShapeType();
+}
+
+bool ElementsOnShape::TClassifier::IsOut(const gp_Pnt& p)
+{
+  return (this->*myIsOutFun)( p );
+}
+
+void ElementsOnShape::TClassifier::Init (const TopoDS_Shape& theShape, double theTol)
+{
+  myShape = theShape;
+  myTol   = theTol;
+  switch ( myShape.ShapeType() )
+  {
+  case TopAbs_SOLID: {
+    mySolidClfr.Load(theShape);
+    myIsOutFun = & ElementsOnShape::TClassifier::isOutOfSolid;
     break;
-  case TopAbs_FACE:
-    {
-      TopoDS_Face aFace = TopoDS::Face(theShape);
-      BRepAdaptor_Surface SA (aFace, true);
-      Standard_Real
-        u1 = SA.FirstUParameter(),
-        u2 = SA.LastUParameter(),
-        v1 = SA.FirstVParameter(),
-        v2 = SA.LastVParameter();
-      Handle(Geom_Surface) surf = BRep_Tool::Surface(aFace);
-      myCurProjFace.Init(surf, u1,u2, v1,v2);
-      myCurFace = aFace;
-      process();
-    }
+  }
+  case TopAbs_FACE:  {
+    Standard_Real u1,u2,v1,v2;
+    Handle(Geom_Surface) surf = BRep_Tool::Surface( TopoDS::Face( theShape ));
+    surf->Bounds( u1,u2,v1,v2 );
+    myProjFace.Init(surf, u1,u2, v1,v2, myTol );
+    myIsOutFun = & ElementsOnShape::TClassifier::isOutOfFace;
     break;
-  case TopAbs_EDGE:
-    {
-      TopoDS_Edge anEdge = TopoDS::Edge(theShape);
-      Standard_Real u1, u2;
-      Handle(Geom_Curve) curve = BRep_Tool::Curve(anEdge, u1, u2);
-      myCurProjEdge.Init(curve, u1, u2);
-      process();
-    }
+  }
+  case TopAbs_EDGE:  {
+    Standard_Real u1, u2;
+    Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge(theShape), u1, u2);
+    myProjEdge.Init(curve, u1, u2);
+    myIsOutFun = & ElementsOnShape::TClassifier::isOutOfEdge;
     break;
-  case TopAbs_VERTEX:
-    {
-      TopoDS_Vertex aV = TopoDS::Vertex(theShape);
-      myCurPnt = BRep_Tool::Pnt(aV);
-      process();
-    }
+  }
+  case TopAbs_VERTEX:{
+    myVertexXYZ = BRep_Tool::Pnt( TopoDS::Vertex( theShape ) );
+    myIsOutFun = & ElementsOnShape::TClassifier::isOutOfVertex;
     break;
+  }
   default:
-    break;
+    throw SALOME_Exception("Programmer error in usage of ElementsOnShape::TClassifier");
   }
 }
 
-void ElementsOnShape::process()
+bool ElementsOnShape::TClassifier::isOutOfSolid (const gp_Pnt& p)
 {
-  const SMDS_Mesh* myMesh = myMeshModifTracer.GetMesh();
-  if (myShape.IsNull() || myMesh == 0)
-    return;
-
-  SMDS_ElemIteratorPtr anIter = myMesh->elementsIterator(myType);
-  while (anIter->more())
-    process(anIter->next());
+  mySolidClfr.Perform( p, myTol );
+  return ( mySolidClfr.State() != TopAbs_IN && mySolidClfr.State() != TopAbs_ON );
 }
 
-void ElementsOnShape::process (const SMDS_MeshElement* theElemPtr)
+bool ElementsOnShape::TClassifier::isOutOfFace  (const gp_Pnt& p)
 {
-  if (myShape.IsNull())
-    return;
-
-  SMDS_ElemIteratorPtr aNodeItr = theElemPtr->nodesIterator();
-  bool isSatisfy = myAllNodesFlag;
-
-  gp_XYZ centerXYZ (0, 0, 0);
-
-  while (aNodeItr->more() && (isSatisfy == myAllNodesFlag))
+  myProjFace.Perform( p );
+  if ( myProjFace.IsDone() && myProjFace.LowerDistance() <= myTol )
   {
-    SMESH_TNodeXYZ aPnt ( aNodeItr->next() );
-    centerXYZ += aPnt;
-
-    switch (myCurShapeType)
-    {
-    case TopAbs_SOLID:
-      {
-        myCurSC.Perform(aPnt, myToler);
-        isSatisfy = (myCurSC.State() == TopAbs_IN || myCurSC.State() == TopAbs_ON);
-      }
-      break;
-    case TopAbs_FACE:
-      {
-        myCurProjFace.Perform(aPnt);
-        isSatisfy = (myCurProjFace.IsDone() && myCurProjFace.LowerDistance() <= myToler);
-        if (isSatisfy)
-        {
-          // check relatively the face
-          Quantity_Parameter u, v;
-          myCurProjFace.LowerDistanceParameters(u, v);
-          gp_Pnt2d aProjPnt (u, v);
-          BRepClass_FaceClassifier aClsf (myCurFace, aProjPnt, myToler);
-          isSatisfy = (aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON);
-        }
-      }
-      break;
-    case TopAbs_EDGE:
-      {
-        myCurProjEdge.Perform(aPnt);
-        isSatisfy = (myCurProjEdge.NbPoints() > 0 && myCurProjEdge.LowerDistance() <= myToler);
-      }
-      break;
-    case TopAbs_VERTEX:
-      {
-        isSatisfy = (myCurPnt.Distance(aPnt) <= myToler);
-      }
-      break;
-    default:
-      {
-        isSatisfy = false;
-      }
-    }
+    // check relatively to the face
+    Quantity_Parameter u, v;
+    myProjFace.LowerDistanceParameters(u, v);
+    gp_Pnt2d aProjPnt (u, v);
+    BRepClass_FaceClassifier aClsf ( TopoDS::Face( myShape ), aProjPnt, myTol );
+    if ( aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON )
+      return false;
   }
+  return true;
+}
 
-  if (isSatisfy && myCurShapeType == TopAbs_SOLID) { // Check the center point for volumes MantisBug 0020168
-    centerXYZ /= theElemPtr->NbNodes();
-    gp_Pnt aCenterPnt (centerXYZ);
-    myCurSC.Perform(aCenterPnt, myToler);
-    if ( !(myCurSC.State() == TopAbs_IN || myCurSC.State() == TopAbs_ON))
-      isSatisfy = false;
-  }
+bool ElementsOnShape::TClassifier::isOutOfEdge  (const gp_Pnt& p)
+{
+  myProjEdge.Perform( p );
+  return ! ( myProjEdge.NbPoints() > 0 && myProjEdge.LowerDistance() <= myTol );
+}
 
-  if (isSatisfy)
-    myIds.Add(theElemPtr->GetID());
+bool ElementsOnShape::TClassifier::isOutOfVertex(const gp_Pnt& p)
+{
+  return ( myVertexXYZ.Distance( p ) > myTol );
 }
 
+
 TSequenceOfXYZ::TSequenceOfXYZ()
 {}
 
index 587f5b6d609bf79b6c09b933764aaaf81758953b..9b9c26525d83d93f511e8a3c853444cec46c4c80 100644 (file)
@@ -125,7 +125,8 @@ namespace SMESH{
                         std::vector<int>&       nbEvents,
                         std::vector<double>&    funValues,
                         const std::vector<int>& elements,
-                        const double*           minmax=0);
+                        const double*           minmax=0,
+                        const bool              isLogarithmic = false);
       virtual SMDSAbs_ElementType GetType() const = 0;
       virtual double GetBadRate( double Value, int nbNodes ) const = 0;
       long  GetPrecision() const;
@@ -820,25 +821,36 @@ namespace SMESH{
                         const SMDSAbs_ElementType theType);
 
     private:
-      void    addShape (const TopoDS_Shape& theShape);
-      void    process();
-      void    process (const SMDS_MeshElement* theElem);
 
-    private:
-      TMeshModifTracer      myMeshModifTracer;
-      TColStd_MapOfInteger  myIds;
-      SMDSAbs_ElementType   myType;
-      TopoDS_Shape          myShape;
-      double                myToler;
-      bool                  myAllNodesFlag;
-
-      TopTools_MapOfShape         myShapesMap;
-      TopAbs_ShapeEnum            myCurShapeType; // type of current sub-shape
-      BRepClass3d_SolidClassifier myCurSC;        // current SOLID
-      GeomAPI_ProjectPointOnSurf  myCurProjFace;  // current FACE
-      TopoDS_Face                 myCurFace;      // current FACE
-      GeomAPI_ProjectPointOnCurve myCurProjEdge;  // current EDGE
-      gp_Pnt                      myCurPnt;       // current VERTEX
+      struct TClassifier
+      {
+        TClassifier(const TopoDS_Shape& s, double tol) { Init(s,tol); }
+        void Init(const TopoDS_Shape& s, double tol);
+        bool IsOut(const gp_Pnt& p);
+        TopAbs_ShapeEnum ShapeType() const;
+      private:
+        bool isOutOfSolid (const gp_Pnt& p);
+        bool isOutOfFace  (const gp_Pnt& p);
+        bool isOutOfEdge  (const gp_Pnt& p);
+        bool isOutOfVertex(const gp_Pnt& p);
+
+        bool (TClassifier::* myIsOutFun)(const gp_Pnt& p);
+        BRepClass3d_SolidClassifier mySolidClfr;
+        GeomAPI_ProjectPointOnSurf  myProjFace;
+        GeomAPI_ProjectPointOnCurve myProjEdge;
+        gp_Pnt                      myVertexXYZ;
+        TopoDS_Shape                myShape;
+        double                      myTol;
+      };
+      void clearClassifiers();
+
+      std::vector< TClassifier* > myClassifiers;
+      const SMDS_Mesh*            myMesh;
+      SMDSAbs_ElementType         myType;
+      TopoDS_Shape                myShape;
+      double                      myToler;
+      bool                        myAllNodesFlag;
+
     };
 
     typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
index fcaea2b3e6f0e54c4206aa30ee91d9a82ad918bb..a3629e497b86fae606efa71b07d221dafb10c329 100644 (file)
@@ -54,6 +54,7 @@ class MESHDRIVER_EXPORT Driver_Mesh
     DRS_WARN_RENUMBER,  // a file has overlapped ranges of element numbers,
                         // so the numbers from the file are ignored
     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
+    DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
     DRS_FAIL            // general failure (exception etc.)
   };
 
index b16c39c93d768224f4706e314a25fe8ec92282ce..e0892c77eba97d946cd90882a6332908a6d7618b 100644 (file)
@@ -1,21 +1,21 @@
 
 
 /*----------------------------------------------------------*/
-/*                                                                                                                     */
-/*                                             LIBMESH V 5.46                                          */
-/*                                                                                                                     */
+/*                                                                                                                      */
+/*                                              LIBMESH V 5.46                                          */
+/*                                                                                                                      */
 /*----------------------------------------------------------*/
-/*                                                                                                                     */
-/*     Description:            handle .meshb file format I/O           */
-/*     Author:                         Loic MARECHAL                                           */
-/*     Creation date:          feb 16 2007                                                     */
-/*     Last modification:      apr 03 2012                                                     */
-/*                                                                                                                     */
+/*                                                                                                                      */
+/*      Description:            handle .meshb file format I/O           */
+/*      Author:                         Loic MARECHAL                                           */
+/*      Creation date:          feb 16 2007                                                     */
+/*      Last modification:      apr 03 2012                                                     */
+/*                                                                                                                      */
 /*----------------------------------------------------------*/
 
 
 /*----------------------------------------------------------*/
-/* Includes                                                                                                    */
+/* Includes                                                                                                     */
 /*----------------------------------------------------------*/
 
 #include <stdio.h>
@@ -29,7 +29,7 @@
 
 
 /*----------------------------------------------------------*/
-/* Defines                                                                                                     */
+/* Defines                                                                                                      */
 /*----------------------------------------------------------*/
 
 #define Asc 1
 
 
 /*----------------------------------------------------------*/
-/* Structures                                                                                          */
+/* Structures                                                                                           */
 /*----------------------------------------------------------*/
 
 typedef struct
 {
-       int typ, SolSiz, NmbWrd, NmbLin, NmbTyp, TypTab[ GmfMaxTyp ];
-       long pos;
-       char fmt[ GmfMaxTyp*9 ];
+        int typ, SolSiz, NmbWrd, NmbLin, NmbTyp, TypTab[ GmfMaxTyp ];
+        long pos;
+        char fmt[ GmfMaxTyp*9 ];
 }KwdSct;
 
 typedef struct
 {
-       int dim, ver, mod, typ, cod, pos;
-       long NexKwdPos, siz;
-       KwdSct KwdTab[ GmfMaxKwd + 1 ];
-       FILE *hdl;
-       int *IntBuf;
-       float *FltBuf;
-       unsigned char *buf;
-       char FilNam[ GmfStrSiz ];
-       double DblBuf[1000/8];
-       unsigned char blk[ BufSiz + 1000 ];
+        int dim, ver, mod, typ, cod, pos;
+        long NexKwdPos, siz;
+        KwdSct KwdTab[ GmfMaxKwd + 1 ];
+        FILE *hdl;
+        int *IntBuf;
+        float *FltBuf;
+        unsigned char *buf;
+        char FilNam[ GmfStrSiz ];
+        double DblBuf[1000/8];
+        unsigned char blk[ BufSiz + 1000 ];
 }GmfMshSct;
 
 
 /*----------------------------------------------------------*/
-/* Global variables                                                                                    */
+/* Global variables                                                                                     */
 /*----------------------------------------------------------*/
 
 static int GmfIniFlg=0;
 static GmfMshSct *GmfMshTab[ MaxMsh + 1 ];
 static const char *GmfKwdFmt[ GmfMaxKwd + 1 ][4] = 
-{      {"Reserved", "", "", ""},
-       {"MeshVersionFormatted", "", "", "i"},
-       {"Reserved", "", "", ""},
-       {"Dimension", "", "", "i"},
-       {"Vertices", "Vertex", "i", "dri"},
-       {"Edges", "Edge", "i", "iii"},
-       {"Triangles", "Triangle", "i", "iiii"},
-       {"Quadrilaterals", "Quadrilateral", "i", "iiiii"},
-       {"Tetrahedra", "Tetrahedron", "i", "iiiii"},
-       {"Prisms", "Prism", "i", "iiiiiii"},
-       {"Hexahedra", "Hexahedron", "i", "iiiiiiiii"},
-       {"IterationsAll", "IterationAll","","i"},
-       {"TimesAll", "TimeAll","","r"},                                 
-       {"Corners", "Corner", "i", "i"},
-       {"Ridges", "Ridge", "i", "i"},
-       {"RequiredVertices", "RequiredVertex", "i", "i"},
-       {"RequiredEdges", "RequiredEdge", "i", "i"},
-       {"RequiredTriangles", "RequiredTriangle", "i", "i"},
-       {"RequiredQuadrilaterals", "RequiredQuadrilateral", "i", "i"},
-       {"TangentAtEdgeVertices", "TangentAtEdgeVertex", "i", "iii"},
-       {"NormalAtVertices", "NormalAtVertex", "i", "ii"},
-       {"NormalAtTriangleVertices", "NormalAtTriangleVertex", "i", "iii"},
-       {"NormalAtQuadrilateralVertices", "NormalAtQuadrilateralVertex", "i", "iiii"},
-       {"AngleOfCornerBound", "", "", "r"},
-       {"TrianglesP2", "TriangleP2", "i", "iiiiiii"},
-       {"EdgesP2", "EdgeP2", "i", "iiii"},
-       {"SolAtPyramids", "SolAtPyramid", "i", "sr"},
-       {"QuadrilateralsQ2", "QuadrilateralQ2", "i", "iiiiiiiiii"},
-       {"ISolAtPyramids", "ISolAtPyramid", "i", "iiiii"},
-       {"SubDomainFromGeom", "SubDomainFromGeom", "i", "iiii"},
-       {"TetrahedraP2", "TetrahedronP2", "i", "iiiiiiiiiii"},
-       {"Fault_NearTri", "Fault_NearTri", "i", "i"},
-       {"Fault_Inter", "Fault_Inter", "i", "i"},
-       {"HexahedraQ2", "HexahedronQ2", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiii"},
-       {"ExtraVerticesAtEdges", "ExtraVerticesAtEdge", "i", "in"},
-       {"ExtraVerticesAtTriangles", "ExtraVerticesAtTriangle", "i", "in"},
-       {"ExtraVerticesAtQuadrilaterals", "ExtraVerticesAtQuadrilateral", "i", "in"},
-       {"ExtraVerticesAtTetrahedra", "ExtraVerticesAtTetrahedron", "i", "in"},
-       {"ExtraVerticesAtPrisms", "ExtraVerticesAtPrism", "i", "in"},
-       {"ExtraVerticesAtHexahedra", "ExtraVerticesAtHexahedron", "i", "in"},
-       {"VerticesOnGeometricVertices", "VertexOnGeometricVertex", "i", "iir"},
-       {"VerticesOnGeometricEdges", "VertexOnGeometricEdge", "i", "iirr"},
-       {"VerticesOnGeometricTriangles", "VertexOnGeometricTriangle", "i", "iirrr"},
-       {"VerticesOnGeometricQuadrilaterals", "VertexOnGeometricQuadrilateral", "i", "iirrr"},
-       {"EdgesOnGeometricEdges", "EdgeOnGeometricEdge", "i", "iir"},
-       {"Fault_FreeEdge", "Fault_FreeEdge", "i", "i"},
-       {"Polyhedra", "Polyhedron", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"},
-       {"Polygons", "Polygon", "", "iiiiiiiii"},
-       {"Fault_Overlap", "Fault_Overlap", "i", "i"},
-       {"Pyramids", "Pyramid", "i", "iiiiii"},
-       {"BoundingBox", "", "", "drdr"},
-       {"Body","i", "drdrdrdr"},
-       {"PrivateTable", "PrivateTable", "i", "i"},
-       {"Fault_BadShape", "Fault_BadShape", "i", "i"},
-       {"End", "", "", ""},
-       {"TrianglesOnGeometricTriangles", "TriangleOnGeometricTriangle", "i", "iir"},
-       {"TrianglesOnGeometricQuadrilaterals", "TriangleOnGeometricQuadrilateral", "i", "iir"},
-       {"QuadrilateralsOnGeometricTriangles", "QuadrilateralOnGeometricTriangle", "i", "iir"},
-       {"QuadrilateralsOnGeometricQuadrilaterals", "QuadrilateralOnGeometricQuadrilateral", "i", "iir"},
-       {"Tangents", "Tangent", "i", "dr"},
-       {"Normals", "Normal", "i", "dr"},
-       {"TangentAtVertices", "TangentAtVertex", "i", "ii"},
-       {"SolAtVertices", "SolAtVertex", "i", "sr"},
-       {"SolAtEdges", "SolAtEdge", "i", "sr"},
-       {"SolAtTriangles", "SolAtTriangle", "i", "sr"},
-       {"SolAtQuadrilaterals", "SolAtQuadrilateral", "i", "sr"},
-       {"SolAtTetrahedra", "SolAtTetrahedron", "i", "sr"},
-       {"SolAtPrisms", "SolAtPrism", "i", "sr"},
-       {"SolAtHexahedra", "SolAtHexahedron", "i", "sr"},
-       {"DSolAtVertices", "DSolAtVertex", "i", "sr"},
-       {"ISolAtVertices", "ISolAtVertex", "i", "i"},
-       {"ISolAtEdges", "ISolAtEdge", "i", "ii"},
-       {"ISolAtTriangles", "ISolAtTriangle", "i", "iii"},
-       {"ISolAtQuadrilaterals", "ISolAtQuadrilateral", "i", "iiii"},
-       {"ISolAtTetrahedra", "ISolAtTetrahedron", "i", "iiii"},
-       {"ISolAtPrisms", "ISolAtPrism", "i", "iiiiii"},
-       {"ISolAtHexahedra", "ISolAtHexahedron", "i", "iiiiiiii"},
-       {"Iterations", "","","i"},
-       {"Time", "","","r"},
-       {"Fault_SmallTri", "Fault_SmallTri","i","i"},
-       {"CoarseHexahedra", "CoarseHexahedron", "i", "i"}
+{       {"Reserved", "", "", ""},
+        {"MeshVersionFormatted", "", "", "i"},
+        {"Reserved", "", "", ""},
+        {"Dimension", "", "", "i"},
+        {"Vertices", "Vertex", "i", "dri"},
+        {"Edges", "Edge", "i", "iii"},
+        {"Triangles", "Triangle", "i", "iiii"},
+        {"Quadrilaterals", "Quadrilateral", "i", "iiiii"},
+        {"Tetrahedra", "Tetrahedron", "i", "iiiii"},
+        {"Prisms", "Prism", "i", "iiiiiii"},
+        {"Hexahedra", "Hexahedron", "i", "iiiiiiiii"},
+        {"IterationsAll", "IterationAll","","i"},
+        {"TimesAll", "TimeAll","","r"},                                 
+        {"Corners", "Corner", "i", "i"},
+        {"Ridges", "Ridge", "i", "i"},
+        {"RequiredVertices", "RequiredVertex", "i", "i"},
+        {"RequiredEdges", "RequiredEdge", "i", "i"},
+        {"RequiredTriangles", "RequiredTriangle", "i", "i"},
+        {"RequiredQuadrilaterals", "RequiredQuadrilateral", "i", "i"},
+        {"TangentAtEdgeVertices", "TangentAtEdgeVertex", "i", "iii"},
+        {"NormalAtVertices", "NormalAtVertex", "i", "ii"},
+        {"NormalAtTriangleVertices", "NormalAtTriangleVertex", "i", "iii"},
+        {"NormalAtQuadrilateralVertices", "NormalAtQuadrilateralVertex", "i", "iiii"},
+        {"AngleOfCornerBound", "", "", "r"},
+        {"TrianglesP2", "TriangleP2", "i", "iiiiiii"},
+        {"EdgesP2", "EdgeP2", "i", "iiii"},
+        {"SolAtPyramids", "SolAtPyramid", "i", "sr"},
+        {"QuadrilateralsQ2", "QuadrilateralQ2", "i", "iiiiiiiiii"},
+        {"ISolAtPyramids", "ISolAtPyramid", "i", "iiiii"},
+        {"SubDomainFromGeom", "SubDomainFromGeom", "i", "iiii"},
+        {"TetrahedraP2", "TetrahedronP2", "i", "iiiiiiiiiii"},
+        {"Fault_NearTri", "Fault_NearTri", "i", "i"},
+        {"Fault_Inter", "Fault_Inter", "i", "i"},
+        {"HexahedraQ2", "HexahedronQ2", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiii"},
+        {"ExtraVerticesAtEdges", "ExtraVerticesAtEdge", "i", "in"},
+        {"ExtraVerticesAtTriangles", "ExtraVerticesAtTriangle", "i", "in"},
+        {"ExtraVerticesAtQuadrilaterals", "ExtraVerticesAtQuadrilateral", "i", "in"},
+        {"ExtraVerticesAtTetrahedra", "ExtraVerticesAtTetrahedron", "i", "in"},
+        {"ExtraVerticesAtPrisms", "ExtraVerticesAtPrism", "i", "in"},
+        {"ExtraVerticesAtHexahedra", "ExtraVerticesAtHexahedron", "i", "in"},
+        {"VerticesOnGeometricVertices", "VertexOnGeometricVertex", "i", "iir"},
+        {"VerticesOnGeometricEdges", "VertexOnGeometricEdge", "i", "iirr"},
+        {"VerticesOnGeometricTriangles", "VertexOnGeometricTriangle", "i", "iirrr"},
+        {"VerticesOnGeometricQuadrilaterals", "VertexOnGeometricQuadrilateral", "i", "iirrr"},
+        {"EdgesOnGeometricEdges", "EdgeOnGeometricEdge", "i", "iir"},
+        {"Fault_FreeEdge", "Fault_FreeEdge", "i", "i"},
+        {"Polyhedra", "Polyhedron", "i", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"},
+        {"Polygons", "Polygon", "", "iiiiiiiii"},
+        {"Fault_Overlap", "Fault_Overlap", "i", "i"},
+        {"Pyramids", "Pyramid", "i", "iiiiii"},
+        {"BoundingBox", "", "", "drdr"},
+        {"Body","i", "drdrdrdr"},
+        {"PrivateTable", "PrivateTable", "i", "i"},
+        {"Fault_BadShape", "Fault_BadShape", "i", "i"},
+        {"End", "", "", ""},
+        {"TrianglesOnGeometricTriangles", "TriangleOnGeometricTriangle", "i", "iir"},
+        {"TrianglesOnGeometricQuadrilaterals", "TriangleOnGeometricQuadrilateral", "i", "iir"},
+        {"QuadrilateralsOnGeometricTriangles", "QuadrilateralOnGeometricTriangle", "i", "iir"},
+        {"QuadrilateralsOnGeometricQuadrilaterals", "QuadrilateralOnGeometricQuadrilateral", "i", "iir"},
+        {"Tangents", "Tangent", "i", "dr"},
+        {"Normals", "Normal", "i", "dr"},
+        {"TangentAtVertices", "TangentAtVertex", "i", "ii"},
+        {"SolAtVertices", "SolAtVertex", "i", "sr"},
+        {"SolAtEdges", "SolAtEdge", "i", "sr"},
+        {"SolAtTriangles", "SolAtTriangle", "i", "sr"},
+        {"SolAtQuadrilaterals", "SolAtQuadrilateral", "i", "sr"},
+        {"SolAtTetrahedra", "SolAtTetrahedron", "i", "sr"},
+        {"SolAtPrisms", "SolAtPrism", "i", "sr"},
+        {"SolAtHexahedra", "SolAtHexahedron", "i", "sr"},
+        {"DSolAtVertices", "DSolAtVertex", "i", "sr"},
+        {"ISolAtVertices", "ISolAtVertex", "i", "i"},
+        {"ISolAtEdges", "ISolAtEdge", "i", "ii"},
+        {"ISolAtTriangles", "ISolAtTriangle", "i", "iii"},
+        {"ISolAtQuadrilaterals", "ISolAtQuadrilateral", "i", "iiii"},
+        {"ISolAtTetrahedra", "ISolAtTetrahedron", "i", "iiii"},
+        {"ISolAtPrisms", "ISolAtPrism", "i", "iiiiii"},
+        {"ISolAtHexahedra", "ISolAtHexahedron", "i", "iiiiiiii"},
+        {"Iterations", "","","i"},
+        {"Time", "","","r"},
+        {"Fault_SmallTri", "Fault_SmallTri","i","i"},
+        {"CoarseHexahedra", "CoarseHexahedron", "i", "i"}
  };
 
 
 /*----------------------------------------------------------*/
-/* Prototypes of local procedures                                                      */
+/* Prototypes of local procedures                                                       */
 /*----------------------------------------------------------*/
 
 static void ScaWrd(GmfMshSct *, unsigned char *);
@@ -179,299 +179,299 @@ static void ScaKwdHdr(GmfMshSct *, int);
 
 
 /*----------------------------------------------------------*/
-/* Open a mesh file in read or write mod                                       */
+/* Open a mesh file in read or write mod                                        */
 /*----------------------------------------------------------*/
 
 int GmfOpenMesh(const char *FilNam, int mod, ...)
 {
-       int i, KwdCod, res, *PtrVer, *PtrDim, MshIdx=0;
-       char str[ GmfStrSiz ];
-       va_list VarArg;
-       GmfMshSct *msh;
-       char *ptr;
-       int k;
-
-       if(!GmfIniFlg)
-       {
-               for(i=0;i<=MaxMsh;i++)
-                       GmfMshTab[i] = NULL;
-
-               GmfIniFlg = 1;
-       }
-
-       /*---------------------*/
-       /* MESH STRUCTURE INIT */
-       /*---------------------*/
-
-       for(i=1;i<=MaxMsh;i++)
-               if(!GmfMshTab[i])
-               {
-                       MshIdx = i;
-                       break;
-               }
-
-       if( !MshIdx || !(msh = calloc(1, sizeof(GmfMshSct))) )
-               return(0);
-
-       /* Copy the FilNam into the structure */
-
-       if(strlen(FilNam) + 7 >= GmfStrSiz)
+        int i, KwdCod, res, *PtrVer, *PtrDim, MshIdx=0;
+        char str[ GmfStrSiz ];
+        va_list VarArg;
+        GmfMshSct *msh;
+        char *ptr;
+        int k;
+
+        if(!GmfIniFlg)
+        {
+                for(i=0;i<=MaxMsh;i++)
+                        GmfMshTab[i] = NULL;
+
+                GmfIniFlg = 1;
+        }
+
+        /*---------------------*/
+        /* MESH STRUCTURE INIT */
+        /*---------------------*/
+
+        for(i=1;i<=MaxMsh;i++)
+                if(!GmfMshTab[i])
+                {
+                        MshIdx = i;
+                        break;
+                }
+
+        if( !MshIdx || !(msh = calloc(1, sizeof(GmfMshSct))) )
+                return(0);
+
+        /* Copy the FilNam into the structure */
+
+        if(strlen(FilNam) + 7 >= GmfStrSiz)
         {
                 free (msh);
-               return(0);
+                return(0);
         }
 
-       strcpy(msh->FilNam, FilNam);
-
-       /* Store the opening mod (read or write) and guess the filetype (binary or ascii) depending on the extension */
-
-       msh->mod = mod;
-       msh->buf = (unsigned char *)msh->DblBuf;
-       msh->FltBuf = (float *)msh->DblBuf;
-       msh->IntBuf = (int *)msh->DblBuf;
-
-       k = strlen(msh->FilNam) - 6;
-       if(k < 0)
-               k = 0;
-       ptr = msh->FilNam+k;
-       if(strstr(ptr, ".meshb"))
-               msh->typ |= (Bin | MshFil);
-       else if(strstr(ptr, ".mesh"))
-               msh->typ |= (Asc | MshFil);
-       else if(strstr(ptr, ".solb"))
-               msh->typ |= (Bin | SolFil);
-       else if(strstr(ptr, ".sol"))
-               msh->typ |= (Asc | SolFil);
-       else {
-               free (msh);
-               return(0);
-       }
-
-       /* Open the file in the required mod and initialyse the mesh structure */
-
-       if(msh->mod == GmfRead)
-       {
-
-               /*-----------------------*/
-               /* OPEN FILE FOR READING */
-               /*-----------------------*/
-
-               va_start(VarArg, mod);
-               PtrVer = va_arg(VarArg, int *);
-               PtrDim = va_arg(VarArg, int *);
-               va_end(VarArg);
-
-               /* Create the name string and open the file */
-
-               if(!(msh->hdl = fopen(msh->FilNam, "rb")))
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               /* Read the endian coding tag, the mesh version and the mesh dimension (mandatory kwd) */
-
-               if(msh->typ & Bin)
-               {
-                       fread((unsigned char *)&msh->cod, WrdSiz, 1, msh->hdl);
-
-                       if( (msh->cod != 1) && (msh->cod != 16777216) )
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       ScaWrd(msh, (unsigned char *)&msh->ver);
-
-                       if( (msh->ver < 1) || (msh->ver > 3) )
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       if( (msh->ver == 3) && (sizeof(long) == 4) )
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       ScaWrd(msh, (unsigned char *)&KwdCod);
-
-                       if(KwdCod != GmfDimension)
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       GetPos(msh);
-                       ScaWrd(msh, (unsigned char *)&msh->dim);
-               }
-               else
-               {
-                       do
-                       {
-                               res = fscanf(msh->hdl, "%s", str);
-                       }while( (res != EOF) && strcmp(str, "MeshVersionFormatted") );
-
-                       if(res == EOF)
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       fscanf(msh->hdl, "%d", &msh->ver);
-
-                       if( (msh->ver < 1) || (msh->ver > 3) )
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       do
-                       {
-                               res = fscanf(msh->hdl, "%s", str);
-                       }while( (res != EOF) && strcmp(str, "Dimension") );
-
-                       if(res == EOF)
-                       {
-                               free (msh);
-                               return(0);
-                       }
-
-                       fscanf(msh->hdl, "%d", &msh->dim);
-               }
-
-               if( (msh->dim != 2) && (msh->dim != 3) )
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               (*PtrVer) = msh->ver;
-               (*PtrDim) = msh->dim;
-
-               /*------------*/
-               /* KW READING */
-               /*------------*/
-
-               /* Read the list of kw present in the file */
-
-               if(!ScaKwdTab(msh))
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               GmfMshTab[ MshIdx ] = msh;
-
-               return(MshIdx);
-       }
-       else if(msh->mod == GmfWrite)
-       {
-
-               /*-----------------------*/
-               /* OPEN FILE FOR WRITING */
-               /*-----------------------*/
-
-               msh->cod = 1;
-
-               /* Check if the user provided a valid version number and dimension */
-
-               va_start(VarArg, mod);
-               msh->ver = va_arg(VarArg, int);
-               msh->dim = va_arg(VarArg, int);
-               va_end(VarArg);
-
-               if( (msh->ver < 1) || (msh->ver > 3) )
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               if( (msh->ver == 3) && (sizeof(long) == 4) )
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               if( (msh->dim != 2) && (msh->dim != 3) )
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               /* Create the mesh file */
-
-               if(!(msh->hdl = fopen(msh->FilNam, "wb")))
-               {
-                       free (msh);
-                       return(0);
-               }
-
-               GmfMshTab[ MshIdx ] = msh;
-
-
-               /*------------*/
-               /* KW WRITING */
-               /*------------*/
-
-               /* Write the mesh version and dimension */
-
-               if(msh->typ & Asc)
-               {
-                       fprintf(msh->hdl, "%s %d\n\n", GmfKwdFmt[ GmfVersionFormatted ][0], msh->ver);
-                       fprintf(msh->hdl, "%s %d\n", GmfKwdFmt[ GmfDimension ][0], msh->dim);
-               }
-               else
-               {
-                       RecWrd(msh, (unsigned char *)&msh->cod);
-                       RecWrd(msh, (unsigned char *)&msh->ver);
-                       GmfSetKwd(MshIdx, GmfDimension, 0);
-                       RecWrd(msh, (unsigned char *)&msh->dim);
-               }
-
-               return(MshIdx);
-       }
-       else
-       {
+        strcpy(msh->FilNam, FilNam);
+
+        /* Store the opening mod (read or write) and guess the filetype (binary or ascii) depending on the extension */
+
+        msh->mod = mod;
+        msh->buf = (unsigned char *)msh->DblBuf;
+        msh->FltBuf = (float *)msh->DblBuf;
+        msh->IntBuf = (int *)msh->DblBuf;
+
+        k = strlen(msh->FilNam) - 6;
+        if(k < 0)
+                k = 0;
+        ptr = msh->FilNam+k;
+        if(strstr(ptr, ".meshb"))
+                msh->typ |= (Bin | MshFil);
+        else if(strstr(ptr, ".mesh"))
+                msh->typ |= (Asc | MshFil);
+        else if(strstr(ptr, ".solb"))
+                msh->typ |= (Bin | SolFil);
+        else if(strstr(ptr, ".sol"))
+                msh->typ |= (Asc | SolFil);
+        else {
                 free (msh);
-               return(0);
+                return(0);
+        }
+
+        /* Open the file in the required mod and initialyse the mesh structure */
+
+        if(msh->mod == GmfRead)
+        {
+
+                /*-----------------------*/
+                /* OPEN FILE FOR READING */
+                /*-----------------------*/
+
+                va_start(VarArg, mod);
+                PtrVer = va_arg(VarArg, int *);
+                PtrDim = va_arg(VarArg, int *);
+                va_end(VarArg);
+
+                /* Create the name string and open the file */
+
+                if(!(msh->hdl = fopen(msh->FilNam, "rb")))
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                /* Read the endian coding tag, the mesh version and the mesh dimension (mandatory kwd) */
+
+                if(msh->typ & Bin)
+                {
+                        fread((unsigned char *)&msh->cod, WrdSiz, 1, msh->hdl);
+
+                        if( (msh->cod != 1) && (msh->cod != 16777216) )
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        ScaWrd(msh, (unsigned char *)&msh->ver);
+
+                        if( (msh->ver < 1) || (msh->ver > 3) )
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        if( (msh->ver == 3) && (sizeof(long) == 4) )
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        ScaWrd(msh, (unsigned char *)&KwdCod);
+
+                        if(KwdCod != GmfDimension)
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        GetPos(msh);
+                        ScaWrd(msh, (unsigned char *)&msh->dim);
+                }
+                else
+                {
+                        do
+                        {
+                                res = fscanf(msh->hdl, "%s", str);
+                        }while( (res != EOF) && strcmp(str, "MeshVersionFormatted") );
+
+                        if(res == EOF)
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        fscanf(msh->hdl, "%d", &msh->ver);
+
+                        if( (msh->ver < 1) || (msh->ver > 3) )
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        do
+                        {
+                                res = fscanf(msh->hdl, "%s", str);
+                        }while( (res != EOF) && strcmp(str, "Dimension") );
+
+                        if(res == EOF)
+                        {
+                                free (msh);
+                                return(0);
+                        }
+
+                        fscanf(msh->hdl, "%d", &msh->dim);
+                }
+
+                if( (msh->dim != 2) && (msh->dim != 3) )
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                (*PtrVer) = msh->ver;
+                (*PtrDim) = msh->dim;
+
+                /*------------*/
+                /* KW READING */
+                /*------------*/
+
+                /* Read the list of kw present in the file */
+
+                if(!ScaKwdTab(msh))
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                GmfMshTab[ MshIdx ] = msh;
+
+                return(MshIdx);
+        }
+        else if(msh->mod == GmfWrite)
+        {
+
+                /*-----------------------*/
+                /* OPEN FILE FOR WRITING */
+                /*-----------------------*/
+
+                msh->cod = 1;
+
+                /* Check if the user provided a valid version number and dimension */
+
+                va_start(VarArg, mod);
+                msh->ver = va_arg(VarArg, int);
+                msh->dim = va_arg(VarArg, int);
+                va_end(VarArg);
+
+                if( (msh->ver < 1) || (msh->ver > 3) )
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                if( (msh->ver == 3) && (sizeof(long) == 4) )
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                if( (msh->dim != 2) && (msh->dim != 3) )
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                /* Create the mesh file */
+
+                if(!(msh->hdl = fopen(msh->FilNam, "wb")))
+                {
+                        free (msh);
+                        return(0);
+                }
+
+                GmfMshTab[ MshIdx ] = msh;
+
+
+                /*------------*/
+                /* KW WRITING */
+                /*------------*/
+
+                /* Write the mesh version and dimension */
+
+                if(msh->typ & Asc)
+                {
+                        fprintf(msh->hdl, "%s %d\n\n", GmfKwdFmt[ GmfVersionFormatted ][0], msh->ver);
+                        fprintf(msh->hdl, "%s %d\n", GmfKwdFmt[ GmfDimension ][0], msh->dim);
+                }
+                else
+                {
+                        RecWrd(msh, (unsigned char *)&msh->cod);
+                        RecWrd(msh, (unsigned char *)&msh->ver);
+                        GmfSetKwd(MshIdx, GmfDimension, 0);
+                        RecWrd(msh, (unsigned char *)&msh->dim);
+                }
+
+                return(MshIdx);
+        }
+        else
+        {
+                free (msh);
+                return(0);
         }
 }
 
 
 /*----------------------------------------------------------*/
-/* Close a meshfile in the right way                                           */
+/* Close a meshfile in the right way                                            */
 /*----------------------------------------------------------*/
 
 int GmfCloseMesh(int MshIdx)
 {
-       int res = 1;
-       GmfMshSct *msh;
+        int res = 1;
+        GmfMshSct *msh;
 
-       if( (MshIdx < 1) || (MshIdx > MaxMsh) )
-               return(0);
+        if( (MshIdx < 1) || (MshIdx > MaxMsh) )
+                return(0);
 
-       msh = GmfMshTab[ MshIdx ];
-       RecBlk(msh, msh->buf, 0);
+        msh = GmfMshTab[ MshIdx ];
+        RecBlk(msh, msh->buf, 0);
 
-       /* In write down the "End" kw in write mode */
+        /* In write down the "End" kw in write mode */
 
-       if(msh->mod == GmfWrite){
-               if(msh->typ & Asc)
-                       fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ GmfEnd ][0]);
-               else
-                       GmfSetKwd(MshIdx, GmfEnd, 0);
-       }
-       /* Close the file and free the mesh structure */
+        if(msh->mod == GmfWrite){
+                if(msh->typ & Asc)
+                        fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ GmfEnd ][0]);
+                else
+                        GmfSetKwd(MshIdx, GmfEnd, 0);
+        }
+        /* Close the file and free the mesh structure */
 
-       if(fclose(msh->hdl))
-               res = 0;
+        if(fclose(msh->hdl))
+                res = 0;
 
-       free(msh);
-       GmfMshTab[ MshIdx ] = NULL;
+        free(msh);
+        GmfMshTab[ MshIdx ] = NULL;
 
-       return(res);
+        return(res);
 }
 
 
@@ -481,866 +481,866 @@ int GmfCloseMesh(int MshIdx)
 
 int GmfStatKwd(int MshIdx, int KwdCod, ...)
 {
-       int i, *PtrNmbTyp, *PtrSolSiz, *TypTab;
-       GmfMshSct *msh;
-       KwdSct *kwd;
-       va_list VarArg;
+        int i, *PtrNmbTyp, *PtrSolSiz, *TypTab;
+        GmfMshSct *msh;
+        KwdSct *kwd;
+        va_list VarArg;
 
-       if( (MshIdx < 1) || (MshIdx > MaxMsh) )
-               return(0);
+        if( (MshIdx < 1) || (MshIdx > MaxMsh) )
+                return(0);
 
-       msh = GmfMshTab[ MshIdx ];
+        msh = GmfMshTab[ MshIdx ];
 
-       if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
-               return(0);
+        if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
+                return(0);
 
-       kwd = &msh->KwdTab[ KwdCod ];
+        kwd = &msh->KwdTab[ KwdCod ];
 
-       if(!kwd->NmbLin)
-               return(0);
+        if(!kwd->NmbLin)
+                return(0);
 
-       /* Read further arguments if this kw is a sol */
+        /* Read further arguments if this kw is a sol */
 
-       if(kwd->typ == SolKwd)
-       {
-               va_start(VarArg, KwdCod);
+        if(kwd->typ == SolKwd)
+        {
+                va_start(VarArg, KwdCod);
 
-               PtrNmbTyp = va_arg(VarArg, int *);
-               *PtrNmbTyp = kwd->NmbTyp;
+                PtrNmbTyp = va_arg(VarArg, int *);
+                *PtrNmbTyp = kwd->NmbTyp;
 
-               PtrSolSiz = va_arg(VarArg, int *);
-               *PtrSolSiz = kwd->SolSiz;
+                PtrSolSiz = va_arg(VarArg, int *);
+                *PtrSolSiz = kwd->SolSiz;
 
-               TypTab = va_arg(VarArg, int *);
+                TypTab = va_arg(VarArg, int *);
 
-               for(i=0;i<kwd->NmbTyp;i++)
-                       TypTab[i] = kwd->TypTab[i];
+                for(i=0;i<kwd->NmbTyp;i++)
+                        TypTab[i] = kwd->TypTab[i];
 
-               va_end(VarArg);
-       }
+                va_end(VarArg);
+        }
 
-       return(kwd->NmbLin);
+        return(kwd->NmbLin);
 }
 
 
 /*----------------------------------------------------------*/
-/* Set the current file position to a given kwd                                */
+/* Set the current file position to a given kwd                         */
 /*----------------------------------------------------------*/
 
 int GmfGotoKwd(int MshIdx, int KwdCod)
 {
-       GmfMshSct *msh;
-       KwdSct *kwd;
+        GmfMshSct *msh;
+        KwdSct *kwd;
 
-       if( (MshIdx < 1) || (MshIdx > MaxMsh) )
-               return(0);
+        if( (MshIdx < 1) || (MshIdx > MaxMsh) )
+                return(0);
 
-       msh = GmfMshTab[ MshIdx ];
+        msh = GmfMshTab[ MshIdx ];
 
-       if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
-               return(0);
+        if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
+                return(0);
 
-       kwd = &msh->KwdTab[ KwdCod ];
+        kwd = &msh->KwdTab[ KwdCod ];
 
-       if(!kwd->NmbLin)
-               return(0);
+        if(!kwd->NmbLin)
+                return(0);
 
-       return(fseek(msh->hdl, kwd->pos, SEEK_SET));
+        return(fseek(msh->hdl, kwd->pos, SEEK_SET));
 }
 
 
 /*----------------------------------------------------------*/
-/* Write the kwd and set the number of lines                           */
+/* Write the kwd and set the number of lines                            */
 /*----------------------------------------------------------*/
 
 int GmfSetKwd(int MshIdx, int KwdCod, ...)
 {
-       int i, NmbLin=0, *TypTab;
-       long CurPos;
-       va_list VarArg;
-       GmfMshSct *msh;
-       KwdSct *kwd;
+        int i, NmbLin=0, *TypTab;
+        long CurPos;
+        va_list VarArg;
+        GmfMshSct *msh;
+        KwdSct *kwd;
 
-       if( (MshIdx < 1) || (MshIdx > MaxMsh) )
-               return(0);
+        if( (MshIdx < 1) || (MshIdx > MaxMsh) )
+                return(0);
 
-       msh = GmfMshTab[ MshIdx ];
-       RecBlk(msh, msh->buf, 0);
+        msh = GmfMshTab[ MshIdx ];
+        RecBlk(msh, msh->buf, 0);
 
-       if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
-               return(0);
+        if( (KwdCod < 1) || (KwdCod > GmfMaxKwd) )
+                return(0);
 
-       kwd = &msh->KwdTab[ KwdCod ];
+        kwd = &msh->KwdTab[ KwdCod ];
 
-       /* Read further arguments if this kw has a header */
+        /* Read further arguments if this kw has a header */
 
-       if(strlen(GmfKwdFmt[ KwdCod ][2]))
-       {
-               va_start(VarArg, KwdCod);
-               NmbLin = va_arg(VarArg, int);
+        if(strlen(GmfKwdFmt[ KwdCod ][2]))
+        {
+                va_start(VarArg, KwdCod);
+                NmbLin = va_arg(VarArg, int);
 
-               if(!strcmp(GmfKwdFmt[ KwdCod ][3], "sr"))
-               {
-                       kwd->NmbTyp = va_arg(VarArg, int);
-                       TypTab = va_arg(VarArg, int *);
+                if(!strcmp(GmfKwdFmt[ KwdCod ][3], "sr"))
+                {
+                        kwd->NmbTyp = va_arg(VarArg, int);
+                        TypTab = va_arg(VarArg, int *);
 
-                       for(i=0;i<kwd->NmbTyp;i++)
-                               kwd->TypTab[i] = TypTab[i];
-               }
+                        for(i=0;i<kwd->NmbTyp;i++)
+                                kwd->TypTab[i] = TypTab[i];
+                }
 
-               va_end(VarArg);
-       }
+                va_end(VarArg);
+        }
 
-       /* Setup the kwd info */
+        /* Setup the kwd info */
 
-       ExpFmt(msh, KwdCod);
+        ExpFmt(msh, KwdCod);
 
-       if(!kwd->typ)
-               return(0);
-       else if(kwd->typ == InfKwd)
-               kwd->NmbLin = 1;
-       else
-               kwd->NmbLin = NmbLin;
+        if(!kwd->typ)
+                return(0);
+        else if(kwd->typ == InfKwd)
+                kwd->NmbLin = 1;
+        else
+                kwd->NmbLin = NmbLin;
 
-       /* Store the next kwd position in binary file */
+        /* Store the next kwd position in binary file */
 
-       if( (msh->typ & Bin) && msh->NexKwdPos )
-       {
-               CurPos = ftell(msh->hdl);
-               fseek(msh->hdl, msh->NexKwdPos, SEEK_SET);
-               SetPos(msh, CurPos);
-               fseek(msh->hdl, CurPos, SEEK_SET);
-       }
+        if( (msh->typ & Bin) && msh->NexKwdPos )
+        {
+                CurPos = ftell(msh->hdl);
+                fseek(msh->hdl, msh->NexKwdPos, SEEK_SET);
+                SetPos(msh, CurPos);
+                fseek(msh->hdl, CurPos, SEEK_SET);
+        }
 
-       /* Write the header */
+        /* Write the header */
 
-       if(msh->typ & Asc)
-       {
-               fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ KwdCod ][0]);
+        if(msh->typ & Asc)
+        {
+                fprintf(msh->hdl, "\n%s\n", GmfKwdFmt[ KwdCod ][0]);
 
-               if(kwd->typ != InfKwd)
-                       fprintf(msh->hdl, "%d\n", kwd->NmbLin);
+                if(kwd->typ != InfKwd)
+                        fprintf(msh->hdl, "%d\n", kwd->NmbLin);
 
-               /* In case of solution field, write the extended header */
+                /* In case of solution field, write the extended header */
 
-               if(kwd->typ == SolKwd)
-               {
-                       fprintf(msh->hdl, "%d ", kwd->NmbTyp);
+                if(kwd->typ == SolKwd)
+                {
+                        fprintf(msh->hdl, "%d ", kwd->NmbTyp);
 
-                       for(i=0;i<kwd->NmbTyp;i++)
-                               fprintf(msh->hdl, "%d ", kwd->TypTab[i]);
+                        for(i=0;i<kwd->NmbTyp;i++)
+                                fprintf(msh->hdl, "%d ", kwd->TypTab[i]);
 
-                       fprintf(msh->hdl, "\n\n");
-               }
-       }
-       else
-       {
-               RecWrd(msh, (unsigned char *)&KwdCod);
-               msh->NexKwdPos = ftell(msh->hdl);
-               SetPos(msh, 0);
+                        fprintf(msh->hdl, "\n\n");
+                }
+        }
+        else
+        {
+                RecWrd(msh, (unsigned char *)&KwdCod);
+                msh->NexKwdPos = ftell(msh->hdl);
+                SetPos(msh, 0);
 
-               if(kwd->typ != InfKwd)
-                       RecWrd(msh, (unsigned char *)&kwd->NmbLin);
+                if(kwd->typ != InfKwd)
+                        RecWrd(msh, (unsigned char *)&kwd->NmbLin);
 
-               /* In case of solution field, write the extended header at once */
+                /* In case of solution field, write the extended header at once */
 
-               if(kwd->typ == SolKwd)
-               {
-                       RecWrd(msh, (unsigned char *)&kwd->NmbTyp);
+                if(kwd->typ == SolKwd)
+                {
+                        RecWrd(msh, (unsigned char *)&kwd->NmbTyp);
 
-                       for(i=0;i<kwd->NmbTyp;i++)
-                               RecWrd(msh, (unsigned char *)&kwd->TypTab[i]);
-               }
-       }
+                        for(i=0;i<kwd->NmbTyp;i++)
+                                RecWrd(msh, (unsigned char *)&kwd->TypTab[i]);
+                }
+        }
 
-       /* Reset write buffer position */
-       msh->pos = 0;
+        /* Reset write buffer position */
+        msh->pos = 0;
 
-       /* Estimate the total file size and check whether it crosses the 2GB threshold */
+        /* Estimate the total file size and check whether it crosses the 2GB threshold */
 
-       msh->siz += kwd->NmbLin * kwd->NmbWrd * WrdSiz;
+        msh->siz += kwd->NmbLin * kwd->NmbWrd * WrdSiz;
 
-       if(msh->siz > 2E9)
-               return(0);
-       else
-               return(kwd->NmbLin);
+        if(msh->siz > 2E9)
+                return(0);
+        else
+                return(kwd->NmbLin);
 }
 
 
 /*----------------------------------------------------------*/
-/* Read a full line from the current kwd                                       */
+/* Read a full line from the current kwd                                        */
 /*----------------------------------------------------------*/
 
 void GmfGetLin(int MshIdx, int KwdCod, ...)
 {
-       int i, j;
-       float *FltSolTab;
-       double *DblSolTab;
-       va_list VarArg;
-       GmfMshSct *msh = GmfMshTab[ MshIdx ];
-       KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
-       /* Start decoding the arguments */
-
-       va_start(VarArg, KwdCod);
-
-       if(kwd->typ != SolKwd)
-       {
-               int k, nb_repeat = 0;
-
-               if(msh->ver == 1)
-               {
-                       if(msh->typ & Asc)
-                       {
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               fscanf(msh->hdl, "%f", va_arg(VarArg, float *));
-                                       else if(kwd->fmt[i] == 'n') {
-                                               fscanf(msh->hdl, "%d", &nb_repeat);
-                                               *(va_arg(VarArg,  int *)) = nb_repeat;
-                                               for(k=0;k<nb_repeat;k++)
-                                                       fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
-                                       }
-                                       else
-                                               fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
-                       }
-                       else
-                       {
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               ScaWrd(msh, (unsigned char *)va_arg(VarArg, float *));
-                                       else if(kwd->fmt[i] == 'n') {
-                                               ScaWrd(msh, (unsigned char *)&nb_repeat);
-                                               *(va_arg(VarArg,  int *)) = nb_repeat;
-                                               for(k=0;k<nb_repeat;k++)
-                                                       ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
-                                       }
-                                       else
-                                               ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
-                       }
-               }
-               else
-               {
-                       if(msh->typ & Asc)
-                       {
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               fscanf(msh->hdl, "%lf", va_arg(VarArg, double *));
-                                       else if(kwd->fmt[i] == 'n') {
-                                               fscanf(msh->hdl, "%d", &nb_repeat);
-                                               *(va_arg(VarArg,  int *)) = nb_repeat;
-                                               for(k=0;k<nb_repeat;k++)
-                                                       fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
-                                       }
-                                       else
-                                               fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
-                       }
-                       else
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               ScaDblWrd(msh, (unsigned char *)va_arg(VarArg, double *));
-                                       else if(kwd->fmt[i] == 'n') {
-                                               ScaWrd(msh, (unsigned char *)&nb_repeat);
-                                               *(va_arg(VarArg,  int *)) = nb_repeat;
-                                               for(k=0;k<nb_repeat;k++)
-                                                       ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
-                                       }
-                                       else
-                                               ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
-               }
-       }
-       else
-       {
-               if(msh->ver == 1)
-               {
-                       FltSolTab = va_arg(VarArg, float *);
-
-                       if(msh->typ & Asc)
-                               for(j=0;j<kwd->SolSiz;j++)
-                                       fscanf(msh->hdl, "%f", &FltSolTab[j]);
-                       else
-                               ScaBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
-               }
-               else
-               {
-                       DblSolTab = va_arg(VarArg, double *);
-
-                       if(msh->typ & Asc)
-                               for(j=0;j<kwd->SolSiz;j++)
-                                       fscanf(msh->hdl, "%lf", &DblSolTab[j]);
-                       else
-                               for(j=0;j<kwd->SolSiz;j++)
-                                       ScaDblWrd(msh, (unsigned char *)&DblSolTab[j]);
-               }
-       }
-
-       va_end(VarArg);
+        int i, j;
+        float *FltSolTab;
+        double *DblSolTab;
+        va_list VarArg;
+        GmfMshSct *msh = GmfMshTab[ MshIdx ];
+        KwdSct *kwd = &msh->KwdTab[ KwdCod ];
+
+        /* Start decoding the arguments */
+
+        va_start(VarArg, KwdCod);
+
+        if(kwd->typ != SolKwd)
+        {
+                int k, nb_repeat = 0;
+
+                if(msh->ver == 1)
+                {
+                        if(msh->typ & Asc)
+                        {
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                fscanf(msh->hdl, "%f", va_arg(VarArg, float *));
+                                        else if(kwd->fmt[i] == 'n') {
+                                                fscanf(msh->hdl, "%d", &nb_repeat);
+                                                *(va_arg(VarArg,  int *)) = nb_repeat;
+                                                for(k=0;k<nb_repeat;k++)
+                                                        fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+                                        }
+                                        else
+                                                fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+                        }
+                        else
+                        {
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                ScaWrd(msh, (unsigned char *)va_arg(VarArg, float *));
+                                        else if(kwd->fmt[i] == 'n') {
+                                                ScaWrd(msh, (unsigned char *)&nb_repeat);
+                                                *(va_arg(VarArg,  int *)) = nb_repeat;
+                                                for(k=0;k<nb_repeat;k++)
+                                                        ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+                                        }
+                                        else
+                                                ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+                        }
+                }
+                else
+                {
+                        if(msh->typ & Asc)
+                        {
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                fscanf(msh->hdl, "%lf", va_arg(VarArg, double *));
+                                        else if(kwd->fmt[i] == 'n') {
+                                                fscanf(msh->hdl, "%d", &nb_repeat);
+                                                *(va_arg(VarArg,  int *)) = nb_repeat;
+                                                for(k=0;k<nb_repeat;k++)
+                                                        fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+                                        }
+                                        else
+                                                fscanf(msh->hdl, "%d", va_arg(VarArg, int *));
+                        }
+                        else
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                ScaDblWrd(msh, (unsigned char *)va_arg(VarArg, double *));
+                                        else if(kwd->fmt[i] == 'n') {
+                                                ScaWrd(msh, (unsigned char *)&nb_repeat);
+                                                *(va_arg(VarArg,  int *)) = nb_repeat;
+                                                for(k=0;k<nb_repeat;k++)
+                                                        ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+                                        }
+                                        else
+                                                ScaWrd(msh, (unsigned char *)va_arg(VarArg, int *));
+                }
+        }
+        else
+        {
+                if(msh->ver == 1)
+                {
+                        FltSolTab = va_arg(VarArg, float *);
+
+                        if(msh->typ & Asc)
+                                for(j=0;j<kwd->SolSiz;j++)
+                                        fscanf(msh->hdl, "%f", &FltSolTab[j]);
+                        else
+                                ScaBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
+                }
+                else
+                {
+                        DblSolTab = va_arg(VarArg, double *);
+
+                        if(msh->typ & Asc)
+                                for(j=0;j<kwd->SolSiz;j++)
+                                        fscanf(msh->hdl, "%lf", &DblSolTab[j]);
+                        else
+                                for(j=0;j<kwd->SolSiz;j++)
+                                        ScaDblWrd(msh, (unsigned char *)&DblSolTab[j]);
+                }
+        }
+
+        va_end(VarArg);
 }
 
 
 /*----------------------------------------------------------*/
-/* Write a full line from the current kwd                                      */
+/* Write a full line from the current kwd                                       */
 /*----------------------------------------------------------*/
 
 void GmfSetLin(int MshIdx, int KwdCod, ...)
 {
-       int i, j, pos, *IntBuf;
-       float *FltSolTab;
-       double *DblSolTab, *DblBuf;
-       va_list VarArg;
-       GmfMshSct *msh = GmfMshTab[ MshIdx ];
-       KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
-       /* Start decoding the arguments */
-
-       va_start(VarArg, KwdCod);
-
-       if(kwd->typ != SolKwd)
-       {
-               int k, nb_repeat = 0;
-
-               if(msh->ver == 1)
-               {
-                       if(msh->typ & Asc)
-                       {
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               fprintf(msh->hdl, "%g ", (float)va_arg(VarArg, double));
-                                       else if(kwd->fmt[i] == 'n') {
-                                               nb_repeat = va_arg(VarArg, int);
-                                               fprintf(msh->hdl, "%d ", nb_repeat);
-                                               for(k=0;k<nb_repeat;k++)
-                                                       fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
-                                       }
-                                       else
-                                               fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
-                       }
-                       else
-                       {
-                               int size_of_block = kwd->SolSiz;
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               msh->FltBuf[i] = va_arg(VarArg, double);
-                                       else if(kwd->fmt[i] == 'n') {
-                                               nb_repeat = va_arg(VarArg, int);
-                                               msh->FltBuf[i] = nb_repeat;
-                                               for(k=0;k<nb_repeat;k++) {
-                                                       msh->IntBuf[i+1+k] = va_arg(VarArg, int);
-                                                       size_of_block ++;
-                                               }
-                                       }
-                                       else
-                                               msh->IntBuf[i] = va_arg(VarArg, int);
-
-                               RecBlk(msh, msh->buf, size_of_block);
-                       }
-               }
-               else
-               {
-                       if(msh->typ & Asc)
-                       {
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                               fprintf(msh->hdl, "%.15lg ", va_arg(VarArg, double));
-                                       else if(kwd->fmt[i] == 'n') {
-                                               nb_repeat = va_arg(VarArg, int);
-                                               fprintf(msh->hdl, "%d ", nb_repeat);
-                                               for(k=0;k<nb_repeat;k++)
-                                                       fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
-                                       }
-                                       else
-                                               fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
-                       }
-                       else
-                       {
-                               pos = 0;
-
-                               for(i=0;i<kwd->SolSiz;i++)
-                                       if(kwd->fmt[i] == 'r')
-                                       {
-                                               DblBuf = (double *)&msh->buf[ pos ];
-                                               *DblBuf = va_arg(VarArg, double);
-                                               pos += 8;
-                                       }
-                                       else if(kwd->fmt[i] == 'n')
-                                       {
-                                               IntBuf = (int *)&msh->buf[ pos ];
-                                               nb_repeat = va_arg(VarArg, int);
-                                               *IntBuf = nb_repeat;
-                                               pos += 4;
-                                               for(k=0;k<nb_repeat;k++) {
-                                                       IntBuf = (int *)&msh->buf[ pos ];
-                                                       *IntBuf = va_arg(VarArg, int);
-                                                       pos += 4;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               IntBuf = (int *)&msh->buf[ pos ];
-                                               *IntBuf = va_arg(VarArg, int);
-                                               pos += 4;
-                                       }
-                               RecBlk(msh, msh->buf, pos/4);
-                       }
-               }
-       }
-       else
-       {
-               if(msh->ver == 1)
-               {
-                       FltSolTab = va_arg(VarArg, float *);
-
-                       if(msh->typ & Asc)
-                               for(j=0;j<kwd->SolSiz;j++)
-                                       fprintf(msh->hdl, "%g ", FltSolTab[j]);
-                       else
-                               RecBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
-               }
-               else
-               {
-                       DblSolTab = va_arg(VarArg, double *);
-
-                       if(msh->typ & Asc)
-                               for(j=0;j<kwd->SolSiz;j++)
-                                       fprintf(msh->hdl, "%.15lg ", DblSolTab[j]);
-                       else
-                               RecBlk(msh, (unsigned char *)DblSolTab, kwd->NmbWrd);
-               }
-       }
-
-       va_end(VarArg);
-
-       if(msh->typ & Asc)
-               fprintf(msh->hdl, "\n");
+        int i, j, pos, *IntBuf;
+        float *FltSolTab;
+        double *DblSolTab, *DblBuf;
+        va_list VarArg;
+        GmfMshSct *msh = GmfMshTab[ MshIdx ];
+        KwdSct *kwd = &msh->KwdTab[ KwdCod ];
+
+        /* Start decoding the arguments */
+
+        va_start(VarArg, KwdCod);
+
+        if(kwd->typ != SolKwd)
+        {
+                int k, nb_repeat = 0;
+
+                if(msh->ver == 1)
+                {
+                        if(msh->typ & Asc)
+                        {
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                fprintf(msh->hdl, "%g ", (float)va_arg(VarArg, double));
+                                        else if(kwd->fmt[i] == 'n') {
+                                                nb_repeat = va_arg(VarArg, int);
+                                                fprintf(msh->hdl, "%d ", nb_repeat);
+                                                for(k=0;k<nb_repeat;k++)
+                                                        fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+                                        }
+                                        else
+                                                fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+                        }
+                        else
+                        {
+                                int size_of_block = kwd->SolSiz;
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                msh->FltBuf[i] = va_arg(VarArg, double);
+                                        else if(kwd->fmt[i] == 'n') {
+                                                nb_repeat = va_arg(VarArg, int);
+                                                msh->FltBuf[i] = nb_repeat;
+                                                for(k=0;k<nb_repeat;k++) {
+                                                        msh->IntBuf[i+1+k] = va_arg(VarArg, int);
+                                                        size_of_block ++;
+                                                }
+                                        }
+                                        else
+                                                msh->IntBuf[i] = va_arg(VarArg, int);
+
+                                RecBlk(msh, msh->buf, size_of_block);
+                        }
+                }
+                else
+                {
+                        if(msh->typ & Asc)
+                        {
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                                fprintf(msh->hdl, "%.15lg ", va_arg(VarArg, double));
+                                        else if(kwd->fmt[i] == 'n') {
+                                                nb_repeat = va_arg(VarArg, int);
+                                                fprintf(msh->hdl, "%d ", nb_repeat);
+                                                for(k=0;k<nb_repeat;k++)
+                                                        fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+                                        }
+                                        else
+                                                fprintf(msh->hdl, "%d ", va_arg(VarArg, int));
+                        }
+                        else
+                        {
+                                pos = 0;
+
+                                for(i=0;i<kwd->SolSiz;i++)
+                                        if(kwd->fmt[i] == 'r')
+                                        {
+                                                DblBuf = (double *)&msh->buf[ pos ];
+                                                *DblBuf = va_arg(VarArg, double);
+                                                pos += 8;
+                                        }
+                                        else if(kwd->fmt[i] == 'n')
+                                        {
+                                                IntBuf = (int *)&msh->buf[ pos ];
+                                                nb_repeat = va_arg(VarArg, int);
+                                                *IntBuf = nb_repeat;
+                                                pos += 4;
+                                                for(k=0;k<nb_repeat;k++) {
+                                                        IntBuf = (int *)&msh->buf[ pos ];
+                                                        *IntBuf = va_arg(VarArg, int);
+                                                        pos += 4;
+                                                }
+                                        }
+                                        else
+                                        {
+                                                IntBuf = (int *)&msh->buf[ pos ];
+                                                *IntBuf = va_arg(VarArg, int);
+                                                pos += 4;
+                                        }
+                                RecBlk(msh, msh->buf, pos/4);
+                        }
+                }
+        }
+        else
+        {
+                if(msh->ver == 1)
+                {
+                        FltSolTab = va_arg(VarArg, float *);
+
+                        if(msh->typ & Asc)
+                                for(j=0;j<kwd->SolSiz;j++)
+                                        fprintf(msh->hdl, "%g ", FltSolTab[j]);
+                        else
+                                RecBlk(msh, (unsigned char *)FltSolTab, kwd->NmbWrd);
+                }
+                else
+                {
+                        DblSolTab = va_arg(VarArg, double *);
+
+                        if(msh->typ & Asc)
+                                for(j=0;j<kwd->SolSiz;j++)
+                                        fprintf(msh->hdl, "%.15lg ", DblSolTab[j]);
+                        else
+                                RecBlk(msh, (unsigned char *)DblSolTab, kwd->NmbWrd);
+                }
+        }
+
+        va_end(VarArg);
+
+        if(msh->typ & Asc)
+                fprintf(msh->hdl, "\n");
 }
 
 
 /*----------------------------------------------------------*/
-/* Private procedure for transmesh : copy a whole line         */
+/* Private procedure for transmesh : copy a whole line          */
 /*----------------------------------------------------------*/
 
 void GmfCpyLin(int InpIdx, int OutIdx, int KwdCod)
 {
-       double d;
-       float f;
-       int i, a;
-       GmfMshSct *InpMsh = GmfMshTab[ InpIdx ], *OutMsh = GmfMshTab[ OutIdx ];
-       KwdSct *kwd = &InpMsh->KwdTab[ KwdCod ];
-
-       for(i=0;i<kwd->SolSiz;i++)
-       {
-               if(kwd->fmt[i] == 'r')
-               {
-                       if(InpMsh->ver == 1)
-                       {
-                               if(InpMsh->typ & Asc)
-                                       fscanf(InpMsh->hdl, "%f", &f);
-                               else
-                                       ScaWrd(InpMsh, (unsigned char *)&f);
-
-                               d = f;
-                       }
-                       else
-                       {
-                               if(InpMsh->typ & Asc)
-                                       fscanf(InpMsh->hdl, "%lf", &d);
-                               else
-                                       ScaDblWrd(InpMsh, (unsigned char *)&d);
-
-                               f = (float)d;
-                       }
-
-                       if(OutMsh->ver == 1)
-                               if(OutMsh->typ & Asc)
-                                       fprintf(OutMsh->hdl, "%g ", f);
-                               else
-                                       RecWrd(OutMsh, (unsigned char *)&f);
-                       else
-                               if(OutMsh->typ & Asc)
-                                       fprintf(OutMsh->hdl, "%.15g ", d);
-                               else
-                                       RecDblWrd(OutMsh, (unsigned char *)&d);
-               }
-               else if(kwd->fmt[i] == 'n')
-               {
-                       int k, nb_repeat = 0;
-
-                       if(InpMsh->typ & Asc)
-                               fscanf(InpMsh->hdl, "%d", &a);
-                       else
-                               ScaWrd(InpMsh, (unsigned char *)&a);
-
-                       nb_repeat = a;
-
-                       if(OutMsh->typ & Asc)
-                               fprintf(OutMsh->hdl, "%d ", a);
-                       else
-                               RecWrd(OutMsh, (unsigned char *)&a);
-
-                       for(k=0;k<nb_repeat;k++) {
-                               if(InpMsh->typ & Asc)
-                                       fscanf(InpMsh->hdl, "%d", &a);
-                               else
-                                       ScaWrd(InpMsh, (unsigned char *)&a);
-
-                               if(OutMsh->typ & Asc)
-                                       fprintf(OutMsh->hdl, "%d ", a);
-                               else
-                                       RecWrd(OutMsh, (unsigned char *)&a);
-                       }
-               }
-               else
-               {
-                       if(InpMsh->typ & Asc)
-                               fscanf(InpMsh->hdl, "%d", &a);
-                       else
-                               ScaWrd(InpMsh, (unsigned char *)&a);
-
-                       if(OutMsh->typ & Asc)
-                               fprintf(OutMsh->hdl, "%d ", a);
-                       else
-                               RecWrd(OutMsh, (unsigned char *)&a);
-               }
-       }
-
-       if(OutMsh->typ & Asc)
-               fprintf(OutMsh->hdl, "\n");
+        double d;
+        float f;
+        int i, a;
+        GmfMshSct *InpMsh = GmfMshTab[ InpIdx ], *OutMsh = GmfMshTab[ OutIdx ];
+        KwdSct *kwd = &InpMsh->KwdTab[ KwdCod ];
+
+        for(i=0;i<kwd->SolSiz;i++)
+        {
+                if(kwd->fmt[i] == 'r')
+                {
+                        if(InpMsh->ver == 1)
+                        {
+                                if(InpMsh->typ & Asc)
+                                        fscanf(InpMsh->hdl, "%f", &f);
+                                else
+                                        ScaWrd(InpMsh, (unsigned char *)&f);
+
+                                d = f;
+                        }
+                        else
+                        {
+                                if(InpMsh->typ & Asc)
+                                        fscanf(InpMsh->hdl, "%lf", &d);
+                                else
+                                        ScaDblWrd(InpMsh, (unsigned char *)&d);
+
+                                f = (float)d;
+                        }
+
+                        if(OutMsh->ver == 1)
+                                if(OutMsh->typ & Asc)
+                                        fprintf(OutMsh->hdl, "%g ", f);
+                                else
+                                        RecWrd(OutMsh, (unsigned char *)&f);
+                        else
+                                if(OutMsh->typ & Asc)
+                                        fprintf(OutMsh->hdl, "%.15g ", d);
+                                else
+                                        RecDblWrd(OutMsh, (unsigned char *)&d);
+                }
+                else if(kwd->fmt[i] == 'n')
+                {
+                        int k, nb_repeat = 0;
+
+                        if(InpMsh->typ & Asc)
+                                fscanf(InpMsh->hdl, "%d", &a);
+                        else
+                                ScaWrd(InpMsh, (unsigned char *)&a);
+
+                        nb_repeat = a;
+
+                        if(OutMsh->typ & Asc)
+                                fprintf(OutMsh->hdl, "%d ", a);
+                        else
+                                RecWrd(OutMsh, (unsigned char *)&a);
+
+                        for(k=0;k<nb_repeat;k++) {
+                                if(InpMsh->typ & Asc)
+                                        fscanf(InpMsh->hdl, "%d", &a);
+                                else
+                                        ScaWrd(InpMsh, (unsigned char *)&a);
+
+                                if(OutMsh->typ & Asc)
+                                        fprintf(OutMsh->hdl, "%d ", a);
+                                else
+                                        RecWrd(OutMsh, (unsigned char *)&a);
+                        }
+                }
+                else
+                {
+                        if(InpMsh->typ & Asc)
+                                fscanf(InpMsh->hdl, "%d", &a);
+                        else
+                                ScaWrd(InpMsh, (unsigned char *)&a);
+
+                        if(OutMsh->typ & Asc)
+                                fprintf(OutMsh->hdl, "%d ", a);
+                        else
+                                RecWrd(OutMsh, (unsigned char *)&a);
+                }
+        }
+
+        if(OutMsh->typ & Asc)
+                fprintf(OutMsh->hdl, "\n");
 }
 
 
 /*----------------------------------------------------------*/
-/* Find every kw present in a meshfile                                         */
+/* Find every kw present in a meshfile                                          */
 /*----------------------------------------------------------*/
 
 static int ScaKwdTab(GmfMshSct *msh)
 {
-       int KwdCod;
-       long  NexPos, CurPos, EndPos;
-       char str[ GmfStrSiz ];
-
-       if(msh->typ & Asc)
-       {
-               /* Scan each string in the file until the end */
-
-               while(fscanf(msh->hdl, "%s", str) != EOF)
-               {
-                       /* Fast test in order to reject quickly the numeric values */
-
-                       if(isalpha(str[0]))
-                       {
-                               /* Search which kwd code this string is associated with, 
-                                       then get its header and save the curent position in file (just before the data) */
-
-                               for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++)
-                                       if(!strcmp(str, GmfKwdFmt[ KwdCod ][0]))
-                                       {
-                                               ScaKwdHdr(msh, KwdCod);
-                                               break;
-                                       }
-                       }
-                       else if(str[0] == '#')
-                               while(fgetc(msh->hdl) != '\n');
-               }
-       }
-       else
-       {
-               /* Get file size */
-
-               CurPos = ftell(msh->hdl);
-               fseek(msh->hdl, 0, SEEK_END);
-               EndPos = ftell(msh->hdl);
-               fseek(msh->hdl, CurPos, SEEK_SET);
-
-               /* Jump through kwd positions in the file */
-
-               do
-               {
-                       /* Get the kwd code and the next kwd position */
-
-                       ScaWrd(msh, (unsigned char *)&KwdCod);
-                       NexPos = GetPos(msh);
-
-                       if(NexPos > EndPos)
-                               return(0);
-
-                       /* Check if this kwd belongs to this mesh version */
-
-                       if( (KwdCod >= 1) && (KwdCod <= GmfMaxKwd) )
-                               ScaKwdHdr(msh, KwdCod);
-
-                       /* Go to the next kwd */
-
-                       if(NexPos)
-                               fseek(msh->hdl, NexPos, SEEK_SET);
-               }while(NexPos && (KwdCod != GmfEnd));
-       }
-
-       return(1);
+        int KwdCod;
+        long  NexPos, CurPos, EndPos;
+        char str[ GmfStrSiz ];
+
+        if(msh->typ & Asc)
+        {
+                /* Scan each string in the file until the end */
+
+                while(fscanf(msh->hdl, "%s", str) != EOF)
+                {
+                        /* Fast test in order to reject quickly the numeric values */
+
+                        if(isalpha(str[0]))
+                        {
+                                /* Search which kwd code this string is associated with, 
+                                        then get its header and save the curent position in file (just before the data) */
+
+                                for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++)
+                                        if(!strcmp(str, GmfKwdFmt[ KwdCod ][0]))
+                                        {
+                                                ScaKwdHdr(msh, KwdCod);
+                                                break;
+                                        }
+                        }
+                        else if(str[0] == '#')
+                                while(fgetc(msh->hdl) != '\n');
+                }
+        }
+        else
+        {
+                /* Get file size */
+
+                CurPos = ftell(msh->hdl);
+                fseek(msh->hdl, 0, SEEK_END);
+                EndPos = ftell(msh->hdl);
+                fseek(msh->hdl, CurPos, SEEK_SET);
+
+                /* Jump through kwd positions in the file */
+
+                do
+                {
+                        /* Get the kwd code and the next kwd position */
+
+                        ScaWrd(msh, (unsigned char *)&KwdCod);
+                        NexPos = GetPos(msh);
+
+                        if(NexPos > EndPos)
+                                return(0);
+
+                        /* Check if this kwd belongs to this mesh version */
+
+                        if( (KwdCod >= 1) && (KwdCod <= GmfMaxKwd) )
+                                ScaKwdHdr(msh, KwdCod);
+
+                        /* Go to the next kwd */
+
+                        if(NexPos)
+                                fseek(msh->hdl, NexPos, SEEK_SET);
+                }while(NexPos && (KwdCod != GmfEnd));
+        }
+
+        return(1);
 }
 
 
 /*----------------------------------------------------------*/
-/* Read and setup the keyword's header                                         */
+/* Read and setup the keyword's header                                          */
 /*----------------------------------------------------------*/
 
 static void ScaKwdHdr(GmfMshSct *msh, int KwdCod)
 {
-       int i;
-       KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
-       if(!strcmp("i", GmfKwdFmt[ KwdCod ][2]))
-       {
-               if(msh->typ & Asc)
-                       fscanf(msh->hdl, "%d", &kwd->NmbLin);
-               else
-                       ScaWrd(msh, (unsigned char *)&kwd->NmbLin);
-       }
-       else
-               kwd->NmbLin = 1;
-
-       if(!strcmp("sr", GmfKwdFmt[ KwdCod ][3]))
-       {
-               if(msh->typ & Asc)
-               {
-                       fscanf(msh->hdl, "%d", &kwd->NmbTyp);
-
-                       for(i=0;i<kwd->NmbTyp;i++)
-                               fscanf(msh->hdl, "%d", &kwd->TypTab[i]);
-               }
-               else
-               {
-                       ScaWrd(msh, (unsigned char *)&kwd->NmbTyp);
-
-                       for(i=0;i<kwd->NmbTyp;i++)
-                               ScaWrd(msh, (unsigned char *)&kwd->TypTab[i]);
-               }
-       }
-
-       ExpFmt(msh, KwdCod);
-       kwd->pos = ftell(msh->hdl);
+        int i;
+        KwdSct *kwd = &msh->KwdTab[ KwdCod ];
+
+        if(!strcmp("i", GmfKwdFmt[ KwdCod ][2]))
+        {
+                if(msh->typ & Asc)
+                        fscanf(msh->hdl, "%d", &kwd->NmbLin);
+                else
+                        ScaWrd(msh, (unsigned char *)&kwd->NmbLin);
+        }
+        else
+                kwd->NmbLin = 1;
+
+        if(!strcmp("sr", GmfKwdFmt[ KwdCod ][3]))
+        {
+                if(msh->typ & Asc)
+                {
+                        fscanf(msh->hdl, "%d", &kwd->NmbTyp);
+
+                        for(i=0;i<kwd->NmbTyp;i++)
+                                fscanf(msh->hdl, "%d", &kwd->TypTab[i]);
+                }
+                else
+                {
+                        ScaWrd(msh, (unsigned char *)&kwd->NmbTyp);
+
+                        for(i=0;i<kwd->NmbTyp;i++)
+                                ScaWrd(msh, (unsigned char *)&kwd->TypTab[i]);
+                }
+        }
+
+        ExpFmt(msh, KwdCod);
+        kwd->pos = ftell(msh->hdl);
 }
 
 
 /*----------------------------------------------------------*/
-/* Expand the compacted format and compute the line size       */
+/* Expand the compacted format and compute the line size        */
 /*----------------------------------------------------------*/
 
 static void ExpFmt(GmfMshSct *msh, int KwdCod)
 {
-       int i, j, TmpSiz=0;
-       char chr;
-       const char *InpFmt = GmfKwdFmt[ KwdCod ][3];
-       KwdSct *kwd = &msh->KwdTab[ KwdCod ];
-
-       /* Set the kwd's type */
-
-       if(!strlen(GmfKwdFmt[ KwdCod ][2]))
-               kwd->typ = InfKwd;
-       else if(!strcmp(InpFmt, "sr"))
-               kwd->typ = SolKwd;
-       else
-               kwd->typ = RegKwd;
-
-       /* Get the solution-field's size */
-
-       if(kwd->typ == SolKwd)
-               for(i=0;i<kwd->NmbTyp;i++)
-                       switch(kwd->TypTab[i])
-                       {
-                               case GmfSca    : TmpSiz += 1; break;
-                               case GmfVec    : TmpSiz += msh->dim; break;
-                               case GmfSymMat : TmpSiz += (msh->dim * (msh->dim+1)) / 2; break;
-                               case GmfMat    : TmpSiz += msh->dim * msh->dim; break;
-                       }
-
-       /* Scan each character from the format string */
-
-       i = kwd->SolSiz = kwd->NmbWrd = 0;
-
-       while(i < strlen(InpFmt))
-       {
-               chr = InpFmt[ i++ ];
-
-               if(chr == 'd')
-               {
-                       chr = InpFmt[i++];
-
-                       for(j=0;j<msh->dim;j++)
-                               kwd->fmt[ kwd->SolSiz++ ] = chr;
-               }
-               else if(chr == 's')
-               {
-                       chr = InpFmt[i++];
-
-                       for(j=0;j<TmpSiz;j++)
-                               kwd->fmt[ kwd->SolSiz++ ] = chr;
-               }
-               else
-                       kwd->fmt[ kwd->SolSiz++ ] = chr;
-       }
-
-       for(i=0;i<kwd->SolSiz;i++)
-               if(kwd->fmt[i] == 'i')
-                       kwd->NmbWrd++;
-               else if(msh->ver >= 2)
-                       kwd->NmbWrd += 2;
-               else
-                       kwd->NmbWrd++;
+        int i, j, TmpSiz=0;
+        char chr;
+        const char *InpFmt = GmfKwdFmt[ KwdCod ][3];
+        KwdSct *kwd = &msh->KwdTab[ KwdCod ];
+
+        /* Set the kwd's type */
+
+        if(!strlen(GmfKwdFmt[ KwdCod ][2]))
+                kwd->typ = InfKwd;
+        else if(!strcmp(InpFmt, "sr"))
+                kwd->typ = SolKwd;
+        else
+                kwd->typ = RegKwd;
+
+        /* Get the solution-field's size */
+
+        if(kwd->typ == SolKwd)
+                for(i=0;i<kwd->NmbTyp;i++)
+                        switch(kwd->TypTab[i])
+                        {
+                                case GmfSca    : TmpSiz += 1; break;
+                                case GmfVec    : TmpSiz += msh->dim; break;
+                                case GmfSymMat : TmpSiz += (msh->dim * (msh->dim+1)) / 2; break;
+                                case GmfMat    : TmpSiz += msh->dim * msh->dim; break;
+                        }
+
+        /* Scan each character from the format string */
+
+        i = kwd->SolSiz = kwd->NmbWrd = 0;
+
+        while(i < strlen(InpFmt))
+        {
+                chr = InpFmt[ i++ ];
+
+                if(chr == 'd')
+                {
+                        chr = InpFmt[i++];
+
+                        for(j=0;j<msh->dim;j++)
+                                kwd->fmt[ kwd->SolSiz++ ] = chr;
+                }
+                else if(chr == 's')
+                {
+                        chr = InpFmt[i++];
+
+                        for(j=0;j<TmpSiz;j++)
+                                kwd->fmt[ kwd->SolSiz++ ] = chr;
+                }
+                else
+                        kwd->fmt[ kwd->SolSiz++ ] = chr;
+        }
+
+        for(i=0;i<kwd->SolSiz;i++)
+                if(kwd->fmt[i] == 'i')
+                        kwd->NmbWrd++;
+                else if(msh->ver >= 2)
+                        kwd->NmbWrd += 2;
+                else
+                        kwd->NmbWrd++;
 }
 
 
 /*----------------------------------------------------------*/
-/* Read a four bytes word from a mesh file                                     */
+/* Read a four bytes word from a mesh file                                      */
 /*----------------------------------------------------------*/
 
 static void ScaWrd(GmfMshSct *msh, unsigned char *wrd)
 {
-       unsigned char swp;
+        unsigned char swp;
 
-       fread(wrd, WrdSiz, 1, msh->hdl);
+        fread(wrd, WrdSiz, 1, msh->hdl);
 
-       if(msh->cod == 1)
-               return;
+        if(msh->cod == 1)
+                return;
 
-       swp = wrd[3];
-       wrd[3] = wrd[0];
-       wrd[0] = swp;
+        swp = wrd[3];
+        wrd[3] = wrd[0];
+        wrd[0] = swp;
 
-       swp = wrd[2];
-       wrd[2] = wrd[1];
-       wrd[1] = swp;
+        swp = wrd[2];
+        wrd[2] = wrd[1];
+        wrd[1] = swp;
 }
 
 
 /*----------------------------------------------------------*/
-/* Read an eight bytes word from a mesh file                           */
+/* Read an eight bytes word from a mesh file                            */
 /*----------------------------------------------------------*/
 
 static void ScaDblWrd(GmfMshSct *msh, unsigned char *wrd)
 {
-       int i;
-       unsigned char swp;
+        int i;
+        unsigned char swp;
 
-       fread(wrd, WrdSiz, 2, msh->hdl);
+        fread(wrd, WrdSiz, 2, msh->hdl);
 
-       if(msh->cod == 1)
-               return;
+        if(msh->cod == 1)
+                return;
 
-       for(i=0;i<4;i++)
-       {
-               swp = wrd[7-i];
-               wrd[7-i] = wrd[i];
-               wrd[i] = swp;
-       }
+        for(i=0;i<4;i++)
+        {
+                swp = wrd[7-i];
+                wrd[7-i] = wrd[i];
+                wrd[i] = swp;
+        }
 }
 
 
 /*----------------------------------------------------------*/
-/* Read ablock of four bytes word from a mesh file                     */
+/* Read ablock of four bytes word from a mesh file                      */
 /*----------------------------------------------------------*/
 
 static void ScaBlk(GmfMshSct *msh, unsigned char *blk, int siz)
 {
-       int i, j;
-       unsigned char swp, *wrd;
+        int i, j;
+        unsigned char swp, *wrd;
 
-       fread(blk, WrdSiz, siz, msh->hdl);
+        fread(blk, WrdSiz, siz, msh->hdl);
 
-       if(msh->cod == 1)
-               return;
+        if(msh->cod == 1)
+                return;
 
-       for(i=0;i<siz;i++)
-       {
-               wrd = &blk[ i * 4 ];
-
-               for(j=0;j<2;j++)
-               {
-                       swp = wrd[ 3-j ];
-                       wrd[ 3-j ] = wrd[j];
-                       wrd[j] = swp;
-               }
-       }
+        for(i=0;i<siz;i++)
+        {
+                wrd = &blk[ i * 4 ];
+
+                for(j=0;j<2;j++)
+                {
+                        swp = wrd[ 3-j ];
+                        wrd[ 3-j ] = wrd[j];
+                        wrd[j] = swp;
+                }
+        }
 }
 
 
 /*----------------------------------------------------------*/
-/* Read a 4 or 8 bytes position in mesh file                           */
+/* Read a 4 or 8 bytes position in mesh file                            */
 /*----------------------------------------------------------*/
 
 static long GetPos(GmfMshSct *msh)
 {
-       int IntVal;
-       long pos;
-
-       if(msh->ver >= 3)
-               ScaDblWrd(msh, (unsigned char*)&pos);
-       else
-       {
-               ScaWrd(msh, (unsigned char*)&IntVal);
-               pos = IntVal;
-       }
-
-       return(pos);
+        int IntVal;
+        long pos;
+
+        if(msh->ver >= 3)
+                ScaDblWrd(msh, (unsigned char*)&pos);
+        else
+        {
+                ScaWrd(msh, (unsigned char*)&IntVal);
+                pos = IntVal;
+        }
+
+        return(pos);
 }
 
 
 /*----------------------------------------------------------*/
-/* Write a four bytes word to a mesh file                                      */
+/* Write a four bytes word to a mesh file                                       */
 /*----------------------------------------------------------*/
 
 static void RecWrd(GmfMshSct *msh, unsigned char *wrd)
 {
-       fwrite(wrd, WrdSiz, 1, msh->hdl);
+        fwrite(wrd, WrdSiz, 1, msh->hdl);
 }
 
 
 /*----------------------------------------------------------*/
-/* Write an eight bytes word to a mesh file                                    */
+/* Write an eight bytes word to a mesh file                                     */
 /*----------------------------------------------------------*/
 
 static void RecDblWrd(GmfMshSct *msh, unsigned char *wrd)
 {
-       fwrite(wrd, WrdSiz, 2, msh->hdl);
+        fwrite(wrd, WrdSiz, 2, msh->hdl);
 }
 
 
 /*----------------------------------------------------------*/
-/* Write a block of four bytes word to a mesh file                     */
+/* Write a block of four bytes word to a mesh file                      */
 /*----------------------------------------------------------*/
 
 static void RecBlk(GmfMshSct *msh, unsigned char *blk, int siz)
 {
-       /* Copy this line-block into the main mesh buffer */
+        /* Copy this line-block into the main mesh buffer */
 
-       if(siz)
-       {
-               memcpy(&msh->blk[ msh->pos ], blk, siz * WrdSiz);
-               msh->pos += siz * WrdSiz;
-       }
+        if(siz)
+        {
+                memcpy(&msh->blk[ msh->pos ], blk, siz * WrdSiz);
+                msh->pos += siz * WrdSiz;
+        }
 
-       /* When the buffer is full or this procedure is called with a 0 size, flush the cache on disk */
+        /* When the buffer is full or this procedure is called with a 0 size, flush the cache on disk */
 
-       if( (msh->pos > BufSiz) || (!siz && msh->pos) )
-       {
-               fwrite(msh->blk, 1, msh->pos, msh->hdl);
-               msh->pos = 0;
-       }
+        if( (msh->pos > BufSiz) || (!siz && msh->pos) )
+        {
+                fwrite(msh->blk, 1, msh->pos, msh->hdl);
+                msh->pos = 0;
+        }
 }
 
 
 /*----------------------------------------------------------*/
-/* Write a 4 or 8 bytes position in a mesh file                                */
+/* Write a 4 or 8 bytes position in a mesh file                         */
 /*----------------------------------------------------------*/
 
 static void SetPos(GmfMshSct *msh, long pos)
 {
-       int IntVal;
-
-       if(msh->ver >= 3)
-               RecDblWrd(msh, (unsigned char*)&pos);
-       else
-       {
-               IntVal = pos;
-               RecWrd(msh, (unsigned char*)&IntVal);
-       }
+        int IntVal;
+
+        if(msh->ver >= 3)
+                RecDblWrd(msh, (unsigned char*)&pos);
+        else
+        {
+                IntVal = pos;
+                RecWrd(msh, (unsigned char*)&IntVal);
+        }
 }
index 66579574d4ba7e9d8f30a87b961b4d290b955cfe..066853f52fb5d386fe01659cfa7b16b4c8d5279d 100644 (file)
@@ -1,21 +1,21 @@
 
 
 /*----------------------------------------------------------*/
-/*                                                                                                                     */
-/*                                             LIBMESH V 5.46                                          */
-/*                                                                                                                     */
+/*                                                                                                                      */
+/*                                              LIBMESH V 5.46                                          */
+/*                                                                                                                      */
 /*----------------------------------------------------------*/
-/*                                                                                                                     */
-/*     Description:            handle .meshb file format I/O           */
-/*     Author:                         Loic MARECHAL                                           */
-/*     Creation date:          feb 16 2007                                                     */
-/*     Last modification:      dec 09 2011                                                     */
-/*                                                                                                                     */
+/*                                                                                                                      */
+/*      Description:            handle .meshb file format I/O           */
+/*      Author:                         Loic MARECHAL                                           */
+/*      Creation date:          feb 16 2007                                                     */
+/*      Last modification:      dec 09 2011                                                     */
+/*                                                                                                                      */
 /*----------------------------------------------------------*/
 
 
 /*----------------------------------------------------------*/
-/* Defines                                                                                                     */
+/* Defines                                                                                                      */
 /*----------------------------------------------------------*/
 
 #include "SMESH_DriverGMF.hxx"
 
 enum GmfKwdCod
 {
-       GmfReserved1, \
-       GmfVersionFormatted, \
-       GmfReserved2, \
-       GmfDimension, \
-       GmfVertices, \
-       GmfEdges, \
-       GmfTriangles, \
-       GmfQuadrilaterals, \
-       GmfTetrahedra, \
-       GmfPrisms, \
-       GmfHexahedra, \
-       GmfIterationsAll, \
-       GmfTimesAll, \
-       GmfCorners, \
-       GmfRidges, \
-       GmfRequiredVertices, \
-       GmfRequiredEdges, \
-       GmfRequiredTriangles, \
-       GmfRequiredQuadrilaterals, \
-       GmfTangentAtEdgeVertices, \
-       GmfNormalAtVertices, \
-       GmfNormalAtTriangleVertices, \
-       GmfNormalAtQuadrilateralVertices, \
-       GmfAngleOfCornerBound, \
-       GmfTrianglesP2, \
-       GmfEdgesP2, \
-       GmfSolAtPyramids, \
-       GmfQuadrilateralsQ2, \
-       GmfISolAtPyramids, \
-       GmfSubDomainFromGeom, \
-       GmfTetrahedraP2, \
-       GmfFault_NearTri, \
-       GmfFault_Inter, \
-       GmfHexahedraQ2, \
-       GmfExtraVerticesAtEdges, \
-       GmfExtraVerticesAtTriangles, \
-       GmfExtraVerticesAtQuadrilaterals, \
-       GmfExtraVerticesAtTetrahedra, \
-       GmfExtraVerticesAtPrisms, \
-       GmfExtraVerticesAtHexahedra, \
-       GmfVerticesOnGeometricVertices, \
-       GmfVerticesOnGeometricEdges, \
-       GmfVerticesOnGeometricTriangles, \
-       GmfVerticesOnGeometricQuadrilaterals, \
-       GmfEdgesOnGeometricEdges, \
-       GmfFault_FreeEdge, \
-       GmfPolyhedra, \
-       GmfPolygons, \
-       GmfFault_Overlap, \
-       GmfPyramids, \
-       GmfBoundingBox, \
-       GmfBody, \
-       GmfPrivateTable, \
-       GmfFault_BadShape, \
-       GmfEnd, \
-       GmfTrianglesOnGeometricTriangles, \
-       GmfTrianglesOnGeometricQuadrilaterals, \
-       GmfQuadrilateralsOnGeometricTriangles, \
-       GmfQuadrilateralsOnGeometricQuadrilaterals, \
-       GmfTangents, \
-       GmfNormals, \
-       GmfTangentAtVertices, \
-       GmfSolAtVertices, \
-       GmfSolAtEdges, \
-       GmfSolAtTriangles, \
-       GmfSolAtQuadrilaterals, \
-       GmfSolAtTetrahedra, \
-       GmfSolAtPrisms, \
-       GmfSolAtHexahedra, \
-       GmfDSolAtVertices, \
-       GmfISolAtVertices, \
-       GmfISolAtEdges, \
-       GmfISolAtTriangles, \
-       GmfISolAtQuadrilaterals, \
-       GmfISolAtTetrahedra, \
-       GmfISolAtPrisms, \
-       GmfISolAtHexahedra, \
-       GmfIterations, \
-       GmfTime, \
-       GmfFault_SmallTri, \
-       GmfCoarseHexahedra
+        GmfReserved1, \
+        GmfVersionFormatted, \
+        GmfReserved2, \
+        GmfDimension, \
+        GmfVertices, \
+        GmfEdges, \
+        GmfTriangles, \
+        GmfQuadrilaterals, \
+        GmfTetrahedra, \
+        GmfPrisms, \
+        GmfHexahedra, \
+        GmfIterationsAll, \
+        GmfTimesAll, \
+        GmfCorners, \
+        GmfRidges, \
+        GmfRequiredVertices, \
+        GmfRequiredEdges, \
+        GmfRequiredTriangles, \
+        GmfRequiredQuadrilaterals, \
+        GmfTangentAtEdgeVertices, \
+        GmfNormalAtVertices, \
+        GmfNormalAtTriangleVertices, \
+        GmfNormalAtQuadrilateralVertices, \
+        GmfAngleOfCornerBound, \
+        GmfTrianglesP2, \
+        GmfEdgesP2, \
+        GmfSolAtPyramids, \
+        GmfQuadrilateralsQ2, \
+        GmfISolAtPyramids, \
+        GmfSubDomainFromGeom, \
+        GmfTetrahedraP2, \
+        GmfFault_NearTri, \
+        GmfFault_Inter, \
+        GmfHexahedraQ2, \
+        GmfExtraVerticesAtEdges, \
+        GmfExtraVerticesAtTriangles, \
+        GmfExtraVerticesAtQuadrilaterals, \
+        GmfExtraVerticesAtTetrahedra, \
+        GmfExtraVerticesAtPrisms, \
+        GmfExtraVerticesAtHexahedra, \
+        GmfVerticesOnGeometricVertices, \
+        GmfVerticesOnGeometricEdges, \
+        GmfVerticesOnGeometricTriangles, \
+        GmfVerticesOnGeometricQuadrilaterals, \
+        GmfEdgesOnGeometricEdges, \
+        GmfFault_FreeEdge, \
+        GmfPolyhedra, \
+        GmfPolygons, \
+        GmfFault_Overlap, \
+        GmfPyramids, \
+        GmfBoundingBox, \
+        GmfBody, \
+        GmfPrivateTable, \
+        GmfFault_BadShape, \
+        GmfEnd, \
+        GmfTrianglesOnGeometricTriangles, \
+        GmfTrianglesOnGeometricQuadrilaterals, \
+        GmfQuadrilateralsOnGeometricTriangles, \
+        GmfQuadrilateralsOnGeometricQuadrilaterals, \
+        GmfTangents, \
+        GmfNormals, \
+        GmfTangentAtVertices, \
+        GmfSolAtVertices, \
+        GmfSolAtEdges, \
+        GmfSolAtTriangles, \
+        GmfSolAtQuadrilaterals, \
+        GmfSolAtTetrahedra, \
+        GmfSolAtPrisms, \
+        GmfSolAtHexahedra, \
+        GmfDSolAtVertices, \
+        GmfISolAtVertices, \
+        GmfISolAtEdges, \
+        GmfISolAtTriangles, \
+        GmfISolAtQuadrilaterals, \
+        GmfISolAtTetrahedra, \
+        GmfISolAtPrisms, \
+        GmfISolAtHexahedra, \
+        GmfIterations, \
+        GmfTime, \
+        GmfFault_SmallTri, \
+        GmfCoarseHexahedra
 };
 
 
 /*----------------------------------------------------------*/
-/* External procedures                                                                         */
+/* External procedures                                                                          */
 /*----------------------------------------------------------*/
 
 MESHDriverGMF_EXPORT extern int GmfOpenMesh(const char *, int, ...);
@@ -133,7 +133,7 @@ MESHDriverGMF_EXPORT extern void GmfSetLin(int, int, ...);
 
 
 /*----------------------------------------------------------*/
-/* Fortran 77 API                                                                                      */
+/* Fortran 77 API                                                                                       */
 /*----------------------------------------------------------*/
 
 #if defined(F77_NO_UNDER_SCORE)
@@ -144,7 +144,7 @@ MESHDriverGMF_EXPORT extern void GmfSetLin(int, int, ...);
 
 
 /*----------------------------------------------------------*/
-/* Transmesh private API                                                                       */
+/* Transmesh private API                                                                        */
 /*----------------------------------------------------------*/
 
 #ifdef TRANSMESH
index 35caa0286e17d144444063469d93701754119c82..d6bb729e490d8eb5d3199cc8d564730f556bf676 100644 (file)
@@ -71,6 +71,7 @@ DriverMED_R_SMESHDS_Mesh
 ::Perform()
 {
   Status aResult = DRS_FAIL;
+  bool isDescConn = false;
 #ifndef _DEXCEPT_
   try{
 #endif
@@ -173,15 +174,26 @@ DriverMED_R_SMESHDS_Mesh
           }
         }
 
+        // Are there any MED cells in descending connectivity
+        //---------------------------------------------------
+        if (!isDescConn) {
+          MED::TEntityInfo aEntityInfoDesc = aMed->GetEntityInfo(aMeshInfo, eDESC);
+          MED::TEntityInfo::iterator anEntityIterDesc = aEntityInfoDesc.begin();
+          for (; anEntityIterDesc != aEntityInfoDesc.end() && !isDescConn; anEntityIterDesc++) {
+            const EEntiteMaillage& anEntity = anEntityIterDesc->first;
+            if (anEntity != eNOEUD) isDescConn = true;
+          }
+        }
+
         // Reading pre information about all MED cells
         //--------------------------------------------
         typedef MED::TVector<int> TNodeIds;
         bool takeNumbers = true;  // initially we trust the numbers from file
-        MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+        MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo, eNOD);
         MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
-        for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
+        for (; anEntityIter != aEntityInfo.end(); anEntityIter++) {
           const EEntiteMaillage& anEntity = anEntityIter->first;
-          if(anEntity == eNOEUD) continue;
+          if (anEntity == eNOEUD) continue;
           // Reading MED cells to the corresponding SMDS structure
           //------------------------------------------------------
           const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
@@ -905,6 +917,12 @@ DriverMED_R_SMESHDS_Mesh
 #endif
   if (myMesh)
     myMesh->compactMesh();
+
+  if (aResult == DRS_OK && isDescConn) {
+    INFOS("There are some elements in descending connectivity in med file. They were not read !!!");
+    aResult = DRS_WARN_DESCENDING;
+  }
+
   if(MYDEBUG) MESSAGE("Perform - aResult status = "<<aResult);
   return aResult;
 }
index 7fbced58b7684e20e0ac7d3c84d2485551cc1b2c..d7a7812b0be903ab1f728e1ae822cdfbd5cd1e7f 100644 (file)
@@ -62,7 +62,7 @@ libMeshDriverMED_la_LDFLAGS  = \
        $(BOOST_LIBS) \
        ../Driver/libMeshDriver.la \
        $(MED_LDFLAGS) -lMEDWrapper -lMEDWrapperBase -lMEDWrapper_V2_2
-
+       $(BOOST_LIB_SYSTEM) 
 
 MED_Test_CPPFLAGS = \
        $(libMeshDriverMED_la_CPPFLAGS)
@@ -80,3 +80,4 @@ MED_Test_LDADD = \
        -lMEDWrapper \
        -lMEDWrapperBase \
        -lMEDWrapper_V2_2
+       $(BOOST_LIB_SYSTEM) 
index 1463f03fe5d96aebeeddd5550a01377c3a6db7cb..3ae80f7a1005c341105adf6ee8c41aaa6b32f68a 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //  SMESH OBJECT : interactive object for SMESH visualization
 //  File   : SMESH_Actor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SMESH
-//
+
 #include "SMESH_ActorDef.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_DeviceActor.h"
@@ -99,8 +98,8 @@ SMESH_ActorDef* SMESH_ActorDef::New(){
 }
 
 
-SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj, 
-                              const char* theEntry, 
+SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
+                              const char* theEntry,
                               const char* theName,
                               int theIsClear)
 {
@@ -120,7 +119,7 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
 
 SMESH_ActorDef::SMESH_ActorDef()
 {
-  if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);  
+  if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
   myBaseActor = SMESH_DeviceActor::New();
 
   myTimeStamp = vtkTimeStamp::New();
@@ -129,9 +128,11 @@ SMESH_ActorDef::SMESH_ActorDef()
   myIsEntityModeCache = false;
 
   myHighlightActor = SMESH_SVTKActor::New();
+  myHighlightActor->Delete(); // vtkSmartPointer!
   myHighlightActor->Initialize();
 
   myPreHighlightActor = SMESH_SVTKActor::New();
+  myPreHighlightActor->Delete();
   myPreHighlightActor->Initialize();
 
   myIsShrinkable = false;
@@ -150,6 +151,42 @@ SMESH_ActorDef::SMESH_ActorDef()
   vtkFloatingPointType aLineWidth    = SMESH::GetFloat("SMESH:element_width",1);
   vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
 
+  SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
+  bool aBoldNd    = true;
+  bool anItalicNd = false;
+  bool aShadowNd  = false;
+  int  aSizeNd    = 10;
+  if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
+    QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
+    if ( f.family()      == "Arial" )   aFamilyNd = SMESH::FntArial;
+    else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
+    else if ( f.family() == "Times" )   aFamilyNd = SMESH::FntTimes;
+    aBoldNd    = f.bold();
+    anItalicNd = f.italic();
+    aShadowNd  = f.overline();
+    aSizeNd    = f.pointSize();
+  }
+  vtkFloatingPointType anRGBNd[3] = {1,1,1};
+  SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
+
+  SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
+  bool aBoldEl    = true;
+  bool anItalicEl = false;
+  bool aShadowEl  = false;
+  int  aSizeEl    = 12;
+  if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
+    QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
+    if ( f.family()      == "Arial" )   aFamilyEl = SMESH::FntArial;
+    else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
+    else if ( f.family() == "Times" )   aFamilyEl = SMESH::FntTimes;
+    aBoldEl    = f.bold();
+    anItalicEl = f.italic();
+    aShadowEl  = f.overline();
+    aSizeEl    = f.pointSize();
+  }
+  vtkFloatingPointType anRGBEl[3] = {0,1,0};
+  SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
+
   vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
   VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
 
@@ -180,6 +217,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my2DActor->SetStoreGemetryMapping(true);
   my2DActor->SetUserMatrix(aMatrix);
   my2DActor->PickableOff();
+  my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
   my2DActor->SetProperty(mySurfaceProp);
   my2DActor->SetBackfaceProperty(myBackSurfaceProp);
   my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
@@ -218,6 +256,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my3DActor->SetStoreGemetryMapping(true);
   my3DActor->SetUserMatrix(aMatrix);
   my3DActor->PickableOff();
+  my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
   my3DActor->SetProperty(myNormalVProp);
   my3DActor->SetBackfaceProperty(myReversedVProp);
   my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
@@ -287,6 +326,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my1DActor->SetUserMatrix(aMatrix);
   my1DActor->PickableOff();
   my1DActor->SetHighlited(true);
+  my1DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
   my1DActor->SetProperty(myEdgeProp);
   my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
   aFilter = my1DActor->GetExtractUnstructuredGrid();
@@ -298,7 +338,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my1DProp->DeepCopy(myEdgeProp);
   my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
   my1DProp->SetPointSize(aElem0DSize);
-  
+
   my1DExtProp = vtkProperty::New();
   my1DExtProp->DeepCopy(myEdgeProp);
   anRGB[0] = 1 - anRGB[0];
@@ -332,6 +372,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   my0DActor->SetUserMatrix(aMatrix);
   my0DActor->SetStoreGemetryMapping(true);
   my0DActor->PickableOff();
+  my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
   my0DActor->SetVisibility(false);
   my0DActor->SetProperty(my0DProp);
   my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
@@ -339,7 +380,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   aFilter->RegisterCellsWithType(VTK_VERTEX);
-  
+
   //Definition 0D device of the actor (ball elements)
   //-----------------------------------------------
   myBallProp = vtkProperty::New();
@@ -351,13 +392,14 @@ SMESH_ActorDef::SMESH_ActorDef()
   myBallActor->SetUserMatrix(aMatrix);
   myBallActor->SetStoreGemetryMapping(true);
   myBallActor->PickableOff();
+  myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
   myBallActor->SetVisibility(false);
   myBallActor->SetProperty(myBallProp);
   myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
   aFilter = myBallActor->GetExtractUnstructuredGrid();
   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
   aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
-  
+
   //my0DExtProp = vtkProperty::New();
   //my0DExtProp->DeepCopy(my0DProp);
   //anRGB[0] = 1 - anRGB[0];
@@ -391,11 +433,12 @@ SMESH_ActorDef::SMESH_ActorDef()
   myNodeActor->SetStoreClippingMapping(true);
   myNodeActor->PickableOff();
   myNodeActor->SetVisibility(false);
+  myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
   myNodeActor->SetProperty(myNodeProp);
   myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
   aFilter = myNodeActor->GetExtractUnstructuredGrid();
   aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
-  
+
   myNodeExtProp = vtkProperty::New();
   myNodeExtProp->DeepCopy(myNodeProp);
   anRGB[0] = 1 - anRGB[0];
@@ -422,7 +465,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   myBaseActor->SetStoreGemetryMapping(true);
   myBaseActor->GetProperty()->SetOpacity(0.0);
   myPickableActor = myBaseActor;
-  
+
   myHighlightProp = vtkProperty::New();
   myHighlightProp->SetAmbient(1.0);
   myHighlightProp->SetDiffuse(0.0);
@@ -436,7 +479,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   myBallHighlightProp = vtkProperty::New();
   myBallHighlightProp->DeepCopy(myHighlightProp);
   myBallHighlightProp->SetPointSize(aBallElemSize);
-  
+
 
   myOutLineProp = vtkProperty::New();
   myOutLineProp->SetAmbient(1.0);
@@ -478,7 +521,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   //Definition of myScalarBarActor
   //------------------------------
   myLookupTable = vtkLookupTable::New();
-  //Fix for Bug PAL5195 - SMESH764: 
+  //Fix for Bug PAL5195 - SMESH764:
   //Controls - Aspect Ratio: incorrect colors of the best and worst values
   myLookupTable->SetHueRange(0.667,0.0);
 
@@ -497,11 +540,11 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   myEntityMode = eAllEntity;
   myEntityModeCache = eAllEntity;
-  
+
   // Clipping planes
   myImplicitBoolean = vtkImplicitBoolean::New();
   myImplicitBoolean->SetOperationTypeToIntersection();
-  
+
   //Quadratic 2D elements representation
   //-----------------------------------------------------------------------------
   int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
@@ -515,11 +558,11 @@ SMESH_ActorDef::SMESH_ActorDef()
     my2DActor->SetQuadraticArcMode(true);
     my1DActor->SetQuadraticArcMode(true);
   }
-  
+
   int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
   myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
   my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
-  
+
   // Set colors of the name actor
   SMESH::GetColor( "SMESH", "default_grp_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
   myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
@@ -539,12 +582,9 @@ SMESH_ActorDef::~SMESH_ActorDef()
 {
   if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
 
-#ifndef DISABLE_PLOT2DVIEWER
-  if(my2dHistogram) {
-    SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
-    delete my2dHistogram;
-  }
-#endif
+  // Please keep the order same as one in the header file
+
+  myTimeStamp->Delete();
 
   myScalarBarActor->Delete();
   myLookupTable->Delete();
@@ -553,47 +593,53 @@ SMESH_ActorDef::~SMESH_ActorDef()
   myBackSurfaceProp->Delete();
   myNormalVProp->Delete();
   myReversedVProp->Delete();
-  myOutLineProp->Delete();
-
   myEdgeProp->Delete();
+  myNodeProp->Delete();
+
+  myNodeActor->Delete();
+  myBaseActor->Delete();
+  //myPickableActor->Delete(); myPickableActor == myBaseActor
+
   myHighlightProp->Delete();
+  myOutLineProp->Delete();
   myPreselectProp->Delete();
 
-  myNodeProp->Delete();
-  myNodeExtProp->Delete();
-  my0DProp->Delete();
-  my0DActor->Delete();
-  myBallActor->Delete();
-
-  //my0DExtProp->Delete();
-  //my0DExtActor->Delete();
-  my1DProp->Delete();
-  my1DActor->Delete();
+  myBallHighlightProp->Delete();
+  myBallPreselectProp->Delete();
 
-  my1DExtProp->Delete();
-  my1DExtActor->Delete();
+  myHighlitableActor->Delete();
 
-  my2DActor->Delete();
   my2DExtProp->Delete();
+  my3DExtProp->Delete();
+  my2DActor->Delete();
   my2DExtActor->Delete();
   my3DActor->Delete();
-  my3DExtProp->Delete();
   my3DExtActor->Delete();
+  // myControlActor->Delete(); myControlActor == my2DActor
 
-  myNodeActor->Delete();
-  myBaseActor->Delete();
+  myNodeExtProp->Delete();
+  myNodeExtActor->Delete();
 
-  myNodeExtActor->Delete();  
-  myHighlitableActor->Delete();
+  my1DProp->Delete();
+  my1DActor->Delete();
+  my1DExtProp->Delete();
+  my1DExtActor->Delete();
+
+  my0DProp->Delete();
+  my0DActor->Delete();
+  myBallProp->Delete();
+  myBallActor->Delete();
+  //my0DExtProp->Delete();
+  //my0DExtActor->Delete();
 
   myImplicitBoolean->Delete();
 
-  myTimeStamp->Delete();
-  myBallHighlightProp->Delete();
-  myBallPreselectProp->Delete();
-          
+#ifndef DISABLE_PLOT2DVIEWER
+  if(my2dHistogram) {
+    SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
+    delete my2dHistogram;
+  }
+#endif
 }
 
 void SMESH_ActorDef::Delete()
@@ -609,7 +655,7 @@ void SMESH_ActorDef::Delete()
 }
 
 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
-{    
+{
   if(myNodeActor) {
     myNodeActor->SetPointsLabeled(theIsPointsLabeled);
     SetRepresentation(GetRepresentation());
@@ -617,6 +663,48 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
   }
 }
 
+void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize,
+                                              bool theBold, bool theItalic, bool theShadow,
+                                              vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
+{
+  if(myNodeActor) {
+    myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
+    SetRepresentation( GetRepresentation() );
+    myTimeStamp->Modified();
+  }
+}
+
+void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize,
+                                             bool theBold, bool theItalic, bool theShadow,
+                                             vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
+{
+  if(my3DActor) {
+    my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
+    SetRepresentation( GetRepresentation() );
+    myTimeStamp->Modified();
+  }
+  if(my2DActor) {
+    my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
+    SetRepresentation( GetRepresentation() );
+    myTimeStamp->Modified();
+  }
+  if(my1DActor) {
+    my1DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
+    SetRepresentation( GetRepresentation() );
+    myTimeStamp->Modified();
+  }
+  if(my0DActor) {
+    my0DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
+    SetRepresentation( GetRepresentation() );
+    myTimeStamp->Modified();
+  }
+  if(myBallActor) {
+    myBallActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
+    SetRepresentation( GetRepresentation() );
+    myTimeStamp->Modified();
+  }
+}
+
 bool SMESH_ActorDef::GetPointsLabeled() {
   return myNodeActor && myNodeActor->GetPointsLabeled();
 }
@@ -634,10 +722,10 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
 
   if(my0DActor)
     my0DActor->SetCellsLabeled(theIsCellsLabeled);
-  
+
   if(myBallActor)
     myBallActor->SetCellsLabeled(theIsCellsLabeled);
-  
+
   myTimeStamp->Modified();
 }
 
@@ -712,7 +800,7 @@ bool SMESH_ActorDef::GetFacesOrientation3DVectors()
 }
 
 
-void 
+void
 SMESH_ActorDef::
 SetControlMode(eControl theMode)
 {
@@ -720,12 +808,16 @@ SetControlMode(eControl theMode)
 }
 
 
-void 
+void
 SMESH_ActorDef::
 SetControlMode(eControl theMode,
                bool theCheckEntityMode)
 {
-  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();  
+  vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
+  bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+  lookupTable->SetScale(VTK_SCALE_LINEAR);
+
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
   if( !mgr )
     return;
 
@@ -947,7 +1039,7 @@ SetControlMode(eControl theMode,
         if (!myIsEntityModeCache){
           myEntityModeCache = GetEntityMode();
           myIsEntityModeCache=true;
-        } 
+        }
         SetEntityMode(eEdges);
       }
       else if(myControlActor == my2DActor) {
@@ -959,7 +1051,7 @@ SetControlMode(eControl theMode,
           if (!myIsEntityModeCache){
             myEntityModeCache = GetEntityMode();
             myIsEntityModeCache=true;
-          } 
+          }
           SetEntityMode(eFaces);
           break;
         default:
@@ -973,7 +1065,7 @@ SetControlMode(eControl theMode,
         if (!myIsEntityModeCache){
             myEntityModeCache = GetEntityMode();
             myIsEntityModeCache=true;
-        } 
+        }
         SetEntityMode(eVolumes);
     }
     }
@@ -991,15 +1083,22 @@ SetControlMode(eControl theMode,
 
   myTimeStamp->Modified();
   Modified();
+
+  lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
+  double * range = lookupTable->GetRange();
+
+  if (isLogarithmic && range[0] > 1e-07 && range[1] > 1e-07)
+    lookupTable->SetScale(VTK_SCALE_LOG10);
+
   Update();
 }
 
 
 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
-  
+
   //myHighlightActor->AddToRender(theRenderer);
 
-  theRenderer->AddActor(myBaseActor);  
+  theRenderer->AddActor(myBaseActor);
   theRenderer->AddActor(myNodeExtActor);
   theRenderer->AddActor(my1DExtActor);
 
@@ -1014,7 +1113,7 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
   //theRenderer->AddActor(my0DExtActor);
 
   theRenderer->AddActor(myHighlitableActor);
-  
+
   theRenderer->AddActor2D(myScalarBarActor);
 
   // the superclass' method should be called at the end
@@ -1048,8 +1147,8 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
 }
 
 
-bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, 
-                          const char* theEntry, 
+bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
+                          const char* theEntry,
                           const char* theName,
                           int theIsClear)
 {
@@ -1066,23 +1165,23 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
 
   myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
-  
+
   my0DActor->Init(myVisualObj,myImplicitBoolean);
   myBallActor->Init(myVisualObj,myImplicitBoolean);
   //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
-  
+
   my1DActor->Init(myVisualObj,myImplicitBoolean);
   my1DExtActor->Init(myVisualObj,myImplicitBoolean);
-  
+
   my2DActor->Init(myVisualObj,myImplicitBoolean);
   my2DExtActor->Init(myVisualObj,myImplicitBoolean);
   my3DActor->Init(myVisualObj,myImplicitBoolean);
   my3DExtActor->Init(myVisualObj,myImplicitBoolean);
-  
+
   my0DActor->GetMapper()->SetLookupTable(myLookupTable);
   myBallActor->GetMapper()->SetLookupTable(myLookupTable);
   //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
-  
+
   my1DActor->GetMapper()->SetLookupTable(myLookupTable);
   my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
 
@@ -1090,7 +1189,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
   my3DActor->GetMapper()->SetLookupTable(myLookupTable);
   my3DExtActor->GetMapper()->SetLookupTable(myLookupTable);
-    
+
   vtkFloatingPointType aFactor, aUnits;
   my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
   my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
@@ -1108,7 +1207,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
 
   int aMode = mgr->integerValue( "SMESH", "display_mode" );
   SetRepresentation(-1);
-  
+
   if(aMode == 0){
     SetRepresentation(eEdge);
   }else if(aMode == 1){
@@ -1116,7 +1215,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   }else if(aMode == 2){
     SetRepresentation(ePoint);
   }
-  
+
   if(aMode == 3){
     SetShrink();
   }
@@ -1149,7 +1248,7 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
 
   myNodeActor->SetTransform(theTransform);
   myBaseActor->SetTransform(theTransform);
-  
+
   myHighlitableActor->SetTransform(theTransform);
 
   myNodeExtActor->SetTransform(theTransform);
@@ -1185,7 +1284,7 @@ vtkMapper* SMESH_ActorDef::GetMapper(){
 }
 
 
-vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){ 
+vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
   return myVisualObj->GetUnstructuredGrid();
 }
 
@@ -1194,7 +1293,7 @@ bool SMESH_ActorDef::IsInfinitive(){
   vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
   aDataSet->Update();
   myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
-    ( aDataSet->GetNumberOfCells() == 1 && 
+    ( aDataSet->GetNumberOfCells() == 1 &&
     aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
   return SALOME_Actor::IsInfinitive();
 }
@@ -1292,7 +1391,7 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
 
   myNodeActor->VisibilityOff();
   myBaseActor->VisibilityOff();
-  
+
   myNodeExtActor->VisibilityOff();
 
   my0DActor->VisibilityOff();
@@ -1301,18 +1400,18 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
 
   my1DActor->VisibilityOff();
   my1DExtActor->VisibilityOff();
-  
+
   my2DActor->VisibilityOff();
   my2DExtActor->VisibilityOff();
   my3DActor->VisibilityOff();
   my3DExtActor->VisibilityOff();
-  
+
   myScalarBarActor->VisibilityOff();
-  
+
   if(GetVisibility()){
     if(theIsUpdateRepersentation)
       SetRepresentation(GetRepresentation());
-    
+
     if(myControlMode != eNone){
       switch(myControlMode){
       case eFreeNodes:
@@ -1360,34 +1459,34 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
     if(myEntityMode & eEdges && GetRepresentation() != ePoint){
       my1DActor->VisibilityOn();
     }
-    
+
     if(myEntityMode & eFaces && GetRepresentation() != ePoint){
       my2DActor->VisibilityOn();
     }
-    
+
     if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
       my3DActor->VisibilityOn();
     }
-    
-    if(myNodeActor->GetPointsLabeled()){ 
+
+    if(myNodeActor->GetPointsLabeled()){
       myNodeActor->VisibilityOn();
     }
 
     if(my0DActor)
       my0DActor->UpdateLabels();
-    
+
     if(myBallActor)
       myBallActor->UpdateLabels();
-    
+
     if(my1DActor)
       my1DActor->UpdateLabels();
-    
+
     if(my2DActor)
       my2DActor->UpdateLabels();
-    
+
     if(my3DActor)
-      my3DActor->UpdateLabels();    
-  } 
+      my3DActor->UpdateLabels();
+  }
 #ifndef DISABLE_PLOT2DVIEWER
   else
     SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
@@ -1508,7 +1607,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
 //#ifdef VTK_HAVE_POLYHEDRON
     aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
 //#endif
-    
+
     aHightFilter->RegisterCellsWithType(VTK_TETRA);
     aHightFilter->RegisterCellsWithType(VTK_VOXEL);
     aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
@@ -1531,7 +1630,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
 }
 
 void SMESH_ActorDef::SetRepresentation (int theMode)
-{ 
+{
   int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
   int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
   int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
@@ -1553,7 +1652,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
     case eSurface:
       if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
       break;
-    }    
+    }
     myRepresentation = theMode;
   }
 
@@ -1566,7 +1665,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
       myIsShrunk = true;
     } else {
       SetShrink();
-    }      
+    }
   }
 
   myPickableActor = myBaseActor;
@@ -1607,7 +1706,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
     my2DActor->SetQuadraticArcMode(true);
 
   my2DExtActor->SetRepresentation(aReperesent);
-  
+
   my3DActor->SetProperty(aPropVN);
   my3DActor->SetBackfaceProperty(aPropVR);
   my3DActor->SetRepresentation(aReperesent);
@@ -1632,7 +1731,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
       aReperesent = SMESH_DeviceActor::eInsideframe;
     break;
   }
-  
+
   if(aQuadraticMode == SMESH_Actor::eLines)
     my1DActor->SetQuadraticArcMode(false);
   else if(aQuadraticMode == SMESH_Actor::eArcs)
@@ -1664,7 +1763,7 @@ void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
   SetRepresentation(GetRepresentation());
 }
 
-bool SMESH_ActorDef::GetPointRepresentation(){ 
+bool SMESH_ActorDef::GetPointRepresentation(){
   return myIsPointsVisible || myNodeActor->GetPointsLabeled();
 }
 
@@ -1681,13 +1780,13 @@ void SMESH_ActorDef::UpdateHighlight(){
     {
       if(myIsHighlighted) {
         myHighlitableActor->SetProperty(myHighlightProp);
-       myBallActor->SetProperty(myBallHighlightProp);
+        myBallActor->SetProperty(myBallHighlightProp);
       }else if(myIsPreselected){
         myHighlitableActor->SetProperty(myPreselectProp);
-       myBallActor->SetProperty(myBallPreselectProp);
+        myBallActor->SetProperty(myBallPreselectProp);
       } else if(anIsVisible){
-       myBallActor->SetProperty(myBallProp);
-        (myRepresentation == eSurface) ? 
+        myBallActor->SetProperty(myBallProp);
+        (myRepresentation == eSurface) ?
           myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
       }
       if(GetUnstructuredGrid()->GetNumberOfCells()) {
@@ -1724,10 +1823,10 @@ void SMESH_ActorDef::highlight(bool theHighlight){
 }
 
 
-void SMESH_ActorDef::SetPreSelected(bool thePreselect){ 
+void SMESH_ActorDef::SetPreSelected(bool thePreselect){
   if ( myIsPreselected == thePreselect )
     return;
-  myIsPreselected = thePreselect; 
+  myIsPreselected = thePreselect;
   UpdateHighlight();
 }
 
@@ -1781,30 +1880,30 @@ void SMESH_ActorDef::Update(){
 
   if(my0DActor)
     my0DActor->UpdateLabels();
-  
+
   if(myBallActor)
     myBallActor->UpdateLabels();
-  
+
   if(my1DActor)
     my1DActor->UpdateLabels();
-  
+
   if(my2DActor)
     my2DActor->UpdateLabels();
 
   if(my3DActor)
     my3DActor->UpdateLabels();
-  
+
   if(myIsFacesOriented){
     SetFacesOriented(myIsFacesOriented);
   }
-    
+
   if(myVisualObj->GetEntitiesFlag()) {
     myEntityMode |= myVisualObj->GetEntitiesState();
   }
-  
+
   SetEntityMode(GetEntityMode());
   SetVisibility(GetVisibility());
-  
+
   myTimeStamp->Modified();
   Modified();
 }
@@ -1851,7 +1950,7 @@ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType
   if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
     if( aGroupObj->GetElementType() == SMDSAbs_Face )
       myNameActor->SetBackgroundColor(r,g,b);
-  
+
   myDeltaBrightness = delta;
   QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
   myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
@@ -1869,7 +1968,7 @@ void SMESH_ActorDef::SetVolumeColor(vtkFloatingPointType r,vtkFloatingPointType
   if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
     if( aGroupObj->GetElementType() == SMDSAbs_Volume )
       myNameActor->SetBackgroundColor(r,g,b);
-  
+
   myDeltaVBrightness = delta;
   QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
   myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
@@ -1905,7 +2004,7 @@ void SMESH_ActorDef::GetOutlineColor(vtkFloatingPointType& r,vtkFloatingPointTyp
 }
 
 
-void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
+void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
   myNodeProp->SetColor(r,g,b);
   myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
   if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
@@ -1914,11 +2013,11 @@ void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,
   Modified();
 }
 
-void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
+void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
   ::GetColor(myNodeProp,r,g,b);
 }
 
-void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
+void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
   my0DProp->SetColor(r,g,b);
   if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
     if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
@@ -1926,11 +2025,11 @@ void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vt
   Modified();
 }
 
-void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
+void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
   ::GetColor(my0DProp,r,g,b);
 }
 
-void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
+void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
   myBallProp->SetColor(r,g,b);
   if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
     if( aGroupObj->GetElementType() == SMDSAbs_Ball )
@@ -1938,27 +2037,27 @@ void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,
   Modified();
 }
 
-void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
+void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
   ::GetColor(myBallProp,r,g,b);
 }
 
-void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
+void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
   myHighlightProp->SetColor(r,g,b);
   myBallHighlightProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
+void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
   ::GetColor(myHighlightProp,r,g,b);
 }
 
-void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
+void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
   myPreselectProp->SetColor(r,g,b);
   myBallPreselectProp->SetColor(r,g,b);
   Modified();
 }
 
-void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
+void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
   ::GetColor(myPreselectProp,r,g,b);
 }
 
@@ -1972,7 +2071,7 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
   myEdgeProp->SetLineWidth(theVal);
 
   my1DProp->SetLineWidth(theVal + aLineWidthInc);
-  my1DExtProp->SetLineWidth(theVal + aLineWidthInc);    
+  my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
   my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
   my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
   myOutLineProp->SetLineWidth(theVal);
@@ -2064,7 +2163,7 @@ SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
   my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
 }
 
-vtkIdType 
+vtkIdType
 SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
 {
   if(thePlane){
@@ -2095,7 +2194,7 @@ GetNumberOfClippingPlanes()
   return myCippingPlaneCont.size();
 }
 
-vtkPlane* 
+vtkPlane*
 SMESH_ActorDef::
 GetClippingPlane(vtkIdType theID)
 {
@@ -2223,7 +2322,7 @@ void SMESH_ActorDef::UpdateScalarBar()
 
   int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
   myScalarBarActor->SetDistributionColoringType(coloringType);
-  
+
   QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
                                              QColor(255, 255, 255));
   double rgb[3];
@@ -2232,7 +2331,7 @@ void SMESH_ActorDef::UpdateScalarBar()
   rgb[2]= distributionColor.blue()/255.;
   myScalarBarActor->SetDistributionColor(rgb);
 
-  
+
 }
 
 void SMESH_ActorDef::UpdateDistribution()
@@ -2251,7 +2350,8 @@ void SMESH_ActorDef::UpdateDistribution()
       elemIds.push_back( (*e)->GetID());
     vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
     double * range = lookupTable->GetRange();
-    fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range);
+    bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+    fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
     myScalarBarActor->SetDistribution(nbEvents);
   }
 }
@@ -2305,17 +2405,17 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
 
   if(my2dHistogram)
     my2dHistogram->clearAllPoints();
-  
+
   if(SMESH::Controls::NumericalFunctor* fun =
      dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
   {
-    
+
     if(!my2dHistogram) {
       my2dHistogram = new SPlot2d_Histogram();
       Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
       my2dHistogram->setIO(anIO);
     }
-    
+
     int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
     std::vector<int> nbEvents;
     std::vector<double> funValues;
@@ -2323,22 +2423,23 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
     if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
       dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
     std::vector<int> elemIds;
-    
+
     for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
       elemIds.push_back( (*e)->GetID());
 
     vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
     double * range = lookupTable->GetRange();
-    fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range);
+    bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+    fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
 
-    for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ ) 
+    for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
       my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
 
     if(funValues.size() >= 2)
       my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
 
   }
-  
+
   //Color of the histogram
   if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
     my2dHistogram->setAutoAssign(true);
@@ -2349,7 +2450,7 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
     my2dHistogram->setColor(aColor);
 
   }
-      
+
   return my2dHistogram;
 }
 #endif
index fc954253d052994d1848ef53fa1602e750fb52bd..bbd7ac9655e5ea7d49f94fb8750222722cfc3401 100644 (file)
@@ -31,6 +31,7 @@
 #include <SALOMEconfig.h> // To fix some redefinition
 #include <SALOME_Actor.h>
 #include "SMESH_Object.h"
+#include "SMESH_ActorUtils.h"
 
 #include <vtkCommand.h>
 
@@ -162,6 +163,13 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
   virtual void UpdateScalarBar() = 0;
   virtual void UpdateDistribution() = 0;
 
+  virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, 
+                                        bool bold, bool italic, bool shadow,
+                                        vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0;
+  virtual void SetCellsFontProperties( SMESH::LabelFont family, int size, 
+                                       bool bold, bool italic, bool shadow,
+                                       vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b ) = 0;
+
 #ifndef DISABLE_PLOT2DVIEWER
   virtual SPlot2d_Histogram* GetPlot2Histogram() = 0;
   virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0;
index 11d7fe41ac030f0ae2fa35d61108dc60a9a49b73..47dc703a0ff8bbc74c322385fb7259031d17aa85 100644 (file)
@@ -180,6 +180,13 @@ class SMESH_ActorDef : public SMESH_Actor
   virtual void SetPointsLabeled(bool theIsPointsLabeled);
   virtual bool GetPointsLabeled();
 
+  virtual void SetPointsFontProperties( SMESH::LabelFont family, int size, 
+                                        bool bold, bool italic, bool shadow,
+                                        vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b );
+  virtual void SetCellsFontProperties( SMESH::LabelFont family, int size, 
+                                       bool bold, bool italic, bool shadow,
+                                       vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b );
+  
   virtual void SetCellsLabeled(bool theIsCellsLabeled);
   virtual bool GetCellsLabeled();
 
index bb9fd64b185324fea24f498371bd67a37bedc711..c756156e01e9f23f8170508e89770b7439085b1f 100644 (file)
@@ -144,10 +144,10 @@ namespace SMESH
 
   void
   GetColor(  const QString& theSect, 
-            const QString& theName, 
-            QColor& color,
-            int& delta,
-            QString def) 
+             const QString& theName, 
+             QColor& color,
+             int& delta,
+             QString def) 
   {
     
     SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
@@ -160,15 +160,15 @@ namespace SMESH
   std::map<SMDSAbs_ElementType,int> GetEntitiesFromObject(SMESH_VisualObj *theObject) {
     std::map<SMDSAbs_ElementType,int> entities;
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_0DElement,
-               theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0));
+                theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0));
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Ball,
-               theObject ? theObject->GetNbEntities(SMDSAbs_Ball) : 0));
+                theObject ? theObject->GetNbEntities(SMDSAbs_Ball) : 0));
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Edge,
-               theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0));
+                theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0));
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Face,
-               theObject ? theObject->GetNbEntities(SMDSAbs_Face) : 0));
+                theObject ? theObject->GetNbEntities(SMDSAbs_Face) : 0));
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Volume,
-               theObject ? theObject->GetNbEntities(SMDSAbs_Volume) : 0));
+                theObject ? theObject->GetNbEntities(SMDSAbs_Volume) : 0));
     return entities;
   }
   
index 3a15c40adcb9c97ec7f4524c8b7a754478a8573a..ce189fbe8dcb88a6304e514733ced33702a8294d 100644 (file)
@@ -33,6 +33,13 @@ class SMESH_Actor;
 
 namespace SMESH
 {
+  //! Label font family
+  enum LabelFont { 
+    FntArial,    //!< arial font family
+    FntCourier,  //!< courier font family
+    FntTimes,    //!< times font family
+  };
+
 SMESHOBJECT_EXPORT  
   vtkFloatingPointType 
   GetFloat( const QString& theValue, 
@@ -71,10 +78,10 @@ SMESHOBJECT_EXPORT
  SMESHOBJECT_EXPORT
    void
    GetColor(  const QString& theSect, 
-             const QString& theName, 
-             QColor& color,
-             int& delta,
-             QString def);
+              const QString& theName, 
+              QColor& color,
+              int& delta,
+              QString def);
    
  SMESHOBJECT_EXPORT
    std::map<SMDSAbs_ElementType,int>
index 3e117de16858568a164989c9d6734bc76faba832..297c37da97f8534fc5cdfc46f6c25030f1ca34d2 100644 (file)
@@ -69,21 +69,19 @@ SMESH_CellLabelActor::SMESH_CellLabelActor() {
   myClsLabeledDataMapper->SetLabelFormat("%d");
   myClsLabeledDataMapper->SetLabelModeToLabelScalars();
     
-  vtkTextProperty* aClsTextProp = vtkTextProperty::New();
-  aClsTextProp->SetFontFamilyToTimes();
-  static int aCellsFontSize = 12;
-  aClsTextProp->SetFontSize(aCellsFontSize);
-  aClsTextProp->SetBold(1);
-  aClsTextProp->SetItalic(0);
-  aClsTextProp->SetShadow(0);
-  myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
-  aClsTextProp->Delete();
+  myClsTextProp = vtkTextProperty::New();
+  myClsTextProp->SetFontFamilyToTimes();
+  myClsTextProp->SetFontSize(12);
+  myClsTextProp->SetBold(1);
+  myClsTextProp->SetItalic(0);
+  myClsTextProp->SetShadow(0);
+  myClsTextProp->SetColor( 0, 1, 0 );
+  myClsLabeledDataMapper->SetLabelTextProperty(myClsTextProp);
     
   myIsCellsLabeled = false;
 
   myCellsLabels = vtkActor2D::New();
   myCellsLabels->SetMapper(myClsLabeledDataMapper);
-  myCellsLabels->GetProperty()->SetColor(0,1,0);
   myCellsLabels->SetVisibility(myIsCellsLabeled);
 
   vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
@@ -91,7 +89,7 @@ SMESH_CellLabelActor::SMESH_CellLabelActor() {
   callBackCommand->SetCallback(SMESH_CellLabelActor::ProcessEvents);
 
   myTransformFilter->AddObserver("VTKViewer_TransformFilter::TransformationFinished",
-                                callBackCommand);
+                                 callBackCommand);
   callBackCommand->Delete();
 }
 
@@ -103,26 +101,43 @@ SMESH_CellLabelActor::~SMESH_CellLabelActor() {
   //Deleting of cells numbering pipeline
   //---------------------------------------
   myCellsNumDataSet->Delete();
-
-  myClsLabeledDataMapper->RemoveAllInputs();
-  myClsLabeledDataMapper->Delete();
-  
-  // commented: porting to vtk 5.0
-  //  myClsSelectVisiblePoints->UnRegisterAllOutputs();
-  myClsSelectVisiblePoints->Delete();
-  
+  myCellsLabels->Delete();
   // commented: porting to vtk 5.0
   //  myClsMaskPoints->UnRegisterAllOutputs();
   myClsMaskPoints->Delete();
-  
   // commented: porting to vtk 5.0
   //  myCellCenters->UnRegisterAllOutputs();
   myCellCenters->Delete();
-  
-  myCellsLabels->Delete();
+
+  myClsLabeledDataMapper->RemoveAllInputs();
+  myClsLabeledDataMapper->Delete();
+  // commented: porting to vtk 5.0
+  //  myClsSelectVisiblePoints->UnRegisterAllOutputs();
+  myClsSelectVisiblePoints->Delete();
+  myClsTextProp->Delete();
 }
 
 
+void SMESH_CellLabelActor::SetFontProperties( SMESH::LabelFont family, int size,
+                                              bool bold, bool italic, bool shadow,
+                                              vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b  )
+{
+  switch ( family ) {
+  case SMESH::FntArial:
+    myClsTextProp->SetFontFamilyToArial(); break;
+  case SMESH::FntCourier:
+    myClsTextProp->SetFontFamilyToCourier(); break;
+  case SMESH::FntTimes:
+  default:
+    myClsTextProp->SetFontFamilyToTimes(); break;
+  }    
+  myClsTextProp->SetFontSize( size );
+  myClsTextProp->SetBold( bold );
+  myClsTextProp->SetItalic( italic );
+  myClsTextProp->SetShadow( shadow );
+  myClsTextProp->SetColor( r, g, b ); 
+}
+
 void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) {
   myTransformFilter->Update();
   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
@@ -176,9 +191,9 @@ void SMESH_CellLabelActor::UpdateLabels() {
 
 
 void SMESH_CellLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
-                                        unsigned long theEvent,
-                                        void* theClientData,
-                                        void* vtkNotUsed(theCallData)) {
+                                         unsigned long theEvent,
+                                         void* theClientData,
+                                         void* vtkNotUsed(theCallData)) {
   SMESH_CellLabelActor* self = reinterpret_cast<SMESH_CellLabelActor*>(theClientData);
   if(self)
     self->UpdateLabels();
index 988a0dcaf8cb2994ee4544a4e227d3aa6719f9dd..f9a6a239de7abac3cee52e960b7bb44c4e5c2861 100644 (file)
 #define SMESH_CELL_LABEL_ACTOR_H
 
 #include "SMESH_DeviceActor.h"
+#include "SMESH_ActorUtils.h"
 
 class vtkSelectVisiblePoints;
 class vtkLabeledDataMapper;
 class vtkActor2D;
 class vtkMaskPoints;
 class vtkUnstructuredGrid;
+class vtkTextProperty;
 
 class VTKViewer_CellCenters;
 
@@ -42,9 +44,9 @@ public:
   static SMESH_CellLabelActor* New();
 
   static void ProcessEvents(vtkObject* theObject,
-                           unsigned long theEvent,
-                           void* theClientData,
-                           void* theCallData);
+                            unsigned long theEvent,
+                            void* theClientData,
+                            void* theCallData);
 
 
   vtkTypeMacro(SMESH_CellLabelActor, SMESH_DeviceActor);
@@ -57,6 +59,10 @@ public:
 
   virtual void AddToRender(vtkRenderer* theRenderer);
   virtual void RemoveFromRender(vtkRenderer* theRenderer);
+  
+  virtual void SetFontProperties( SMESH::LabelFont family, int size,
+                                  bool bold, bool italic, bool shadow,
+                                  vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b );
 
   void UpdateLabels();
   
@@ -72,6 +78,7 @@ protected:
   vtkLabeledDataMapper* myClsLabeledDataMapper;
   vtkSelectVisiblePoints* myClsSelectVisiblePoints;  
   SMESH_DeviceActor* myBaseActor; //Pointer to the base actor
+  vtkTextProperty* myClsTextProp;
 
 protected:
   // Not implemented.
index d53765d79baf12703c580dad0c702028a1d3c08c..c82bbf30524a34ebea0025dc4c3737ebc80775b0 100644 (file)
@@ -138,33 +138,29 @@ SMESH_DeviceActor
 {
   if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
 
-  myProperty->Delete();
-
   myMapper->Delete();
 
-  myShrinkFilter->Delete();
+  myProperty->Delete();
 
-  myExtractUnstructuredGrid->Delete();
+  myExtractGeometry->Delete();
 
   myMergeFilter->Delete();
+  myExtractUnstructuredGrid->Delete();
 
-  myGeomFilter->Delete();
+  // Orientation of faces
+  myFaceOrientationFilter->Delete();
+  myFaceOrientationDataMapper->RemoveAllInputs();
+  myFaceOrientationDataMapper->Delete();
+  myFaceOrientation->Delete();
 
-  myExtractGeometry->Delete();
+  myGeomFilter->Delete();
 
   myTransformFilter->Delete();
 
-  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
+  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
     myPassFilter[i]->Delete();
-  }
-
-  // Orientation of faces
-  myFaceOrientationFilter->Delete();
-
-  myFaceOrientationDataMapper->RemoveAllInputs();
-  myFaceOrientationDataMapper->Delete();
 
-  myFaceOrientation->Delete();
+  myShrinkFilter->Delete();
 }
 
 
index 5d7b33507218119af1ad000723f2ee523d49c764..b3a8d3d0f8d4a72012ae854136a5b3d260b3d45a 100644 (file)
@@ -63,21 +63,19 @@ SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
   myPtsLabeledDataMapper->SetLabelFormat("%d");
   myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
     
-  vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
-  aPtsTextProp->SetFontFamilyToTimes();
-  static int aPointsFontSize = 10;
-  aPtsTextProp->SetFontSize(aPointsFontSize);
-  aPtsTextProp->SetBold(1);
-  aPtsTextProp->SetItalic(0);
-  aPtsTextProp->SetShadow(0);
-  myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
-  aPtsTextProp->Delete();
+  myPtsTextProp = vtkTextProperty::New();
+  myPtsTextProp->SetFontFamilyToTimes();
+  myPtsTextProp->SetFontSize(10);
+  myPtsTextProp->SetBold(1);
+  myPtsTextProp->SetItalic(0);
+  myPtsTextProp->SetShadow(0);
+  myPtsTextProp->SetColor( 1, 1, 1 );
+  myPtsLabeledDataMapper->SetLabelTextProperty(myPtsTextProp);
 
   myIsPointsLabeled = false;
 
   myPointLabels = vtkActor2D::New();
   myPointLabels->SetMapper(myPtsLabeledDataMapper);
-  myPointLabels->GetProperty()->SetColor(1,1,1);
   myPointLabels->SetVisibility(myIsPointsLabeled);
 
   vtkCallbackCommand* callBackCommand = vtkCallbackCommand::New();
@@ -85,7 +83,7 @@ SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
   callBackCommand->SetCallback(SMESH_NodeLabelActor::ProcessEvents);
 
   myTransformFilter->AddObserver("VTKViewer_TransformFilter::TransformationFinished",
-                                callBackCommand);
+                                 callBackCommand);
   callBackCommand->Delete();
 }
 
@@ -109,7 +107,27 @@ SMESH_NodeLabelActor::~SMESH_NodeLabelActor() {
   //  myPtsMaskPoints->UnRegisterAllOutputs();
   myPtsMaskPoints->Delete();
   myPointLabels->Delete();
+  myPtsTextProp->Delete();
+}
 
+void SMESH_NodeLabelActor::SetFontProperties( SMESH::LabelFont family, int size, 
+                                              bool bold, bool italic, bool shadow,
+                                              vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
+{
+  switch ( family ) {
+  case SMESH::FntArial:
+    myPtsTextProp->SetFontFamilyToArial(); break;
+  case SMESH::FntCourier:
+    myPtsTextProp->SetFontFamilyToCourier(); break;
+  case SMESH::FntTimes:
+  default:
+    myPtsTextProp->SetFontFamilyToTimes(); break;
+  }
+  myPtsTextProp->SetFontSize( size );
+  myPtsTextProp->SetBold( bold );
+  myPtsTextProp->SetItalic( italic );
+  myPtsTextProp->SetShadow( shadow ); 
+  myPtsTextProp->SetColor( r, g, b ); 
 }
 
 void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
@@ -178,9 +196,9 @@ void SMESH_NodeLabelActor::UpdateLabels() {
 
 
 void SMESH_NodeLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
-                                        unsigned long theEvent,
-                                        void* theClientData,
-                                        void* vtkNotUsed(theCallData)) {
+                                         unsigned long theEvent,
+                                         void* theClientData,
+                                         void* vtkNotUsed(theCallData)) {
   SMESH_NodeLabelActor* self = reinterpret_cast<SMESH_NodeLabelActor*>(theClientData);    
   if(self)
     self->UpdateLabels();
index a15a2330b5e8d2806a76fea0851dfa083be193be..03de78f3ad7117b9ad09ab821dd80ff042a091e0 100644 (file)
 #define SMESH_NODE_LABEL_ACTOR_H
 
 #include "SMESH_DeviceActor.h"
+#include "SMESH_ActorUtils.h"
 
 class vtkSelectVisiblePoints;
 class vtkLabeledDataMapper;
 class vtkActor2D;
 class vtkMaskPoints;
 class vtkUnstructuredGrid;
-
+class vtkTextProperty;
 
 class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor {
 public:
   static SMESH_NodeLabelActor* New();
 
   static void ProcessEvents(vtkObject* theObject,
-                           unsigned long theEvent,
-                           void* theClientData,
-                           void* theCallData);
+                            unsigned long theEvent,
+                            void* theClientData,
+                            void* theCallData);
 
 
   vtkTypeMacro(SMESH_NodeLabelActor, SMESH_DeviceActor);
@@ -55,6 +56,10 @@ public:
 
   virtual void AddToRender(vtkRenderer* theRenderer); 
   virtual void RemoveFromRender(vtkRenderer* theRenderer);
+  
+  virtual void SetFontProperties( SMESH::LabelFont family, int size,
+                                  bool bold, bool italic, bool shadow,
+                                  vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b );
 
   void UpdateLabels();
   
@@ -68,6 +73,7 @@ protected:
   vtkMaskPoints* myPtsMaskPoints;
   vtkLabeledDataMapper* myPtsLabeledDataMapper;
   vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
+  vtkTextProperty* myPtsTextProp;
 
 protected:
   // Not implemented.
index 30bef057940ff267aebc4eed6203d4e94baf83a5..96b25c9b99e95134faa13b0e26c0c82c2516fff8 100644 (file)
@@ -567,12 +567,12 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
 bool SMESH_VisualObjDef::IsValid() const
 {
         //MESSAGE("SMESH_VisualObjDef::IsValid");
-  return GetNbEntities(SMDSAbs_Node) > 0      || 
-         GetNbEntities(SMDSAbs_0DElement) > 0 || 
-         GetNbEntities(SMDSAbs_Ball) > 0 || 
-         GetNbEntities(SMDSAbs_Edge) > 0      || 
-         GetNbEntities(SMDSAbs_Face) > 0      ||
-         GetNbEntities(SMDSAbs_Volume) > 0 ;
+  return ( GetNbEntities(SMDSAbs_0DElement) > 0 || 
+           GetNbEntities(SMDSAbs_Ball     ) > 0 || 
+           GetNbEntities(SMDSAbs_Edge     ) > 0 || 
+           GetNbEntities(SMDSAbs_Face     ) > 0 ||
+           GetNbEntities(SMDSAbs_Volume   ) > 0 ||
+           GetNbEntities(SMDSAbs_Node     ) > 0 );
 }
 
 //=================================================================================
@@ -659,6 +659,8 @@ SMESH_MeshObj::~SMESH_MeshObj()
 {
   if ( MYDEBUG ) 
     MESSAGE("SMESH_MeshObj - this = "<<this<<"\n");
+  if ( myEmptyGrid )
+    myEmptyGrid->Delete();
 }
 
 //=================================================================================
@@ -995,11 +997,16 @@ int SMESH_GroupObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList&
   theResList.clear();
   SMDS_Mesh* aMesh = myMeshObj->GetMesh();
   
-  if ( myGroupServer->Size() == 0 || aMesh == 0 )
+  if ( aMesh == 0 )
     return 0;
 
   SMDSAbs_ElementType aGrpType = SMDSAbs_ElementType(myGroupServer->GetType());
+  if ( aGrpType != theType && theType != SMDSAbs_Node )
+    return 0;
+
   SMESH::long_array_var anIds = myGroupServer->GetListOfID();
+  if ( anIds->length() == 0 )
+    return 0;
 
   if ( aGrpType == theType )
     return getPointers( theType, anIds, aMesh, theResList );
@@ -1007,7 +1014,7 @@ int SMESH_GroupObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList&
     return getNodesFromElems( anIds, aMesh, theResList );
   else
     return 0;
-}    
+}
 
 
 
index 5ce10b850076b6a3e73507336d4e6e188b0cdd0f..ade7920934f6743418f236b08497292c09c468cd 100644 (file)
@@ -45,6 +45,9 @@
 #include "SMESH_Controls.hxx"
 #include "SMDSAbs_ElementType.hxx"
 
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
 class SMDS_Mesh;
 class vtkUnstructuredGrid;
 
@@ -62,6 +65,7 @@ public:
 
   virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
   virtual SMDS_Mesh* GetMesh() const = 0;
+  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() = 0;
 
   virtual bool GetEdgeNodes( const int theElemId,
                              const int theEdgeNum,
index 4532a019744afe2d85f07320114755601a7bd19b..56f7543759af5bef31f1fd3bad9077656447550c 100644 (file)
@@ -70,6 +70,7 @@ public:
   virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
   virtual bool              IsNodePrs() const = 0;
   virtual SMDS_Mesh*        GetMesh() const = 0;
+  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() = 0;
 
   virtual bool              IsValid() const;
 
@@ -135,10 +136,11 @@ public:
 
   virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
   
-  SMESH::SMESH_Mesh_ptr     GetMeshServer() { return myClient.GetMeshServer(); }
-  SMDS_Mesh*                GetMesh() const { return myClient.GetMesh(); }
+  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() { return myClient.GetMeshServer(); }
+  virtual SMDS_Mesh*        GetMesh() const { return myClient.GetMesh(); }
 
 protected:
+
   SMESH_Client              myClient;
   vtkUnstructuredGrid*      myEmptyGrid;
 };
@@ -161,6 +163,7 @@ public:
   virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
   virtual int               GetElemDimension( const int theObjId );
   virtual SMDS_Mesh*        GetMesh() const { return myMeshObj->GetMesh(); }
+  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshObj->GetMeshServer(); }
   
 protected:
 
index 9fecefb1866a3065443bf54b40f061aaeec9b994..9d6d1c80f5513eb6407a305b07c6a4f701b51a96 100644 (file)
@@ -65,8 +65,8 @@ SMESH_PreviewActorsCollection::~SMESH_PreviewActorsCollection()
 }
 
 bool SMESH_PreviewActorsCollection::Init( const TopoDS_Shape& theShape,
-                                         TopAbs_ShapeEnum theType,
-                                         const QString& theEntry )
+                                          TopAbs_ShapeEnum theType,
+                                          const QString& theEntry )
 {
   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
 
index b86c81d5481eb3f6e9ada5502a43c2c285e103d8..48ad8691026d940a2383031b614ba60cd0d10943 100644 (file)
@@ -124,29 +124,32 @@ SMESH_SVTKActor
   for(int ind = 1; ind <= aNbOfParts; ind++){
     int aPartId = theMapIndex( ind );
     if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
-      {
+    {
 #if VTK_XVERSION > 50700
       if (aCell->GetCellType() != VTK_POLYHEDRON)
 #endif
-      if(aCell->GetCellType() == VTK_VERTEX ) {
-       my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-      } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
-       myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-      } else {
-        myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+      {
+        if(aCell->GetCellType() == VTK_VERTEX ) {
+          my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+        } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
+          myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+        } else {
+          myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+        }
       }
 #if VTK_XVERSION > 50700
       else
-        {
-          vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
-          if (!polyhedron)
-            throw SALOME_Exception(LOCALIZED ("not a polyhedron"));
-          vtkIdType *pts = polyhedron->GetFaces();
-          myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
-        }
-#endif
+      {
+        vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
+        if (!polyhedron)
+          throw SALOME_Exception(LOCALIZED ("not a polyhedron"));
+        vtkIdType *pts = polyhedron->GetFaces();
+        myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
       }
-    
+#endif
+    }
+  }
+
   UnShrink();
   if(theMapActor->IsShrunk()){
     SetShrinkFactor(theMapActor->GetShrinkFactor());
@@ -154,9 +157,8 @@ SMESH_SVTKActor
   }
 
   myMapIndex = theMapIndex;
-  }
 }
-  
+
 void
 SMESH_SVTKActor
 ::Initialize()
index 07c7f0830a68a915f99f32231d0b6d66b87049c0..cfb841f5cca859b0e513c262743270af4d009f7d 100644 (file)
@@ -33,6 +33,7 @@
 #include <SMESHGUI_Utils.h>
 #include <boost/shared_ptr.hpp>
 #include <GEOMImpl_Types.hxx>
+#include <GEOM_wrap.hxx>
 
 #include <TopoDS.hxx>
 #include <BRep_Tool.hxx>
@@ -225,7 +226,8 @@ TopAbs_ShapeEnum GeomSelectionTools::entryToShapeType(std::string entry){
         // if the Geom Object is a group
         if (aShape->GetType() == GEOM_GROUP){
 //           MESSAGE("It's a group");
-          GEOM::GEOM_IGroupOperations_var aGroupOp = _geomEngine->GetIGroupOperations(myStudy->StudyId());
+          GEOM::GEOM_IGroupOperations_wrap aGroupOp =
+            _geomEngine->GetIGroupOperations(myStudy->StudyId());
           ShapeType= (TopAbs_ShapeEnum)aGroupOp->GetType(aShape);
         }
         // if not
index 1ee3710556b2804591e9eb086455142911367455..261ed6459b574aadcfba86b21aa84bc0a7647b21 100644 (file)
 #define _OBJECTPOOL_HXX_
 
 #include <vector>
-#include <stack>
+//#include <stack>
 #include <iostream>
 
+namespace
+{
+  // assure deallocation of memory of a vector
+  template<class Y> void clearVector(std::vector<Y>& v )
+  {
+    std::vector<Y> emptyVec; v.swap( emptyVec );
+  }
+}
+
 template<class X> class ObjectPool
 {
 
@@ -70,7 +79,7 @@ public:
 
   virtual ~ObjectPool()
   {
-    for (int i = 0; i < _chunkList.size(); i++)
+    for (size_t i = 0; i < _chunkList.size(); i++)
       delete[] _chunkList[i];
   }
 
@@ -101,7 +110,7 @@ public:
   void destroy(X* obj)
   {
     long adrobj = (long) (obj);
-    for (int i = 0; i < _chunkList.size(); i++)
+    for (size_t i = 0; i < _chunkList.size(); i++)
       {
         X* chunk = _chunkList[i];
         long adrmin = (long) (chunk);
@@ -121,6 +130,16 @@ public:
       }
   }
 
+  void clear()
+  {
+    _nextFree = 0;
+    _maxAvail = 0;
+    for (size_t i = 0; i < _chunkList.size(); i++)
+      delete[] _chunkList[i];
+    clearVector( _chunkList );
+    clearVector( _freeList );
+  }
+
   //  void destroy(int toFree)
   //  {
   //    // no control 0<= toFree < _freeList.size()
index fe6f186e496b9b33a9f76da95648fa5b9a0a5598..999df6d2581a6fd163d9b48773ae048aa929a0d3 100644 (file)
@@ -2656,6 +2656,13 @@ SMDS_Mesh::~SMDS_Mesh()
         myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
       }
   }
+  myGrid->Delete();
+
+  delete myNodePool;
+  delete myVolumePool;
+  delete myFacePool;
+  delete myEdgePool;
+  delete myBallPool;
 }
 
 //================================================================================
@@ -2688,50 +2695,56 @@ void SMDS_Mesh::Clear()
     myElementIDFactory->Clear();
     }
 
-  SMDS_ElemIteratorPtr itv = elementsIterator();
-  while (itv->more())
-    {
-      SMDS_MeshElement* elem = (SMDS_MeshElement*)(itv->next());
-      SMDSAbs_ElementType aType = elem->GetType();
-      switch (aType)
-      {
-        case SMDSAbs_0DElement:
-          delete elem;
-          break;
-        case SMDSAbs_Edge:
-           myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(elem));
-          break;
-        case SMDSAbs_Face:
-          myFacePool->destroy(static_cast<SMDS_VtkFace*>(elem));
-          break;
-        case SMDSAbs_Volume:
-          myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(elem));
-          break;
-        case SMDSAbs_Ball:
-          myBallPool->destroy(static_cast<SMDS_BallElement*>(elem));
-          break;
-        default:
-          break;
-      }
-    }
-  myCells.clear();
-  myCellIdVtkToSmds.clear();
-  //myCellIdSmdsToVtk.clear();
+  // SMDS_ElemIteratorPtr itv = elementsIterator();
+  // while (itv->more())
+  //   {
+  //     SMDS_MeshElement* elem = (SMDS_MeshElement*)(itv->next());
+  //     SMDSAbs_ElementType aType = elem->GetType();
+  //     switch (aType)
+  //     {
+  //       case SMDSAbs_0DElement:
+  //         delete elem;
+  //         break;
+  //       case SMDSAbs_Edge:
+  //          myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(elem));
+  //         break;
+  //       case SMDSAbs_Face:
+  //         myFacePool->destroy(static_cast<SMDS_VtkFace*>(elem));
+  //         break;
+  //       case SMDSAbs_Volume:
+  //         myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(elem));
+  //         break;
+  //       case SMDSAbs_Ball:
+  //         myBallPool->destroy(static_cast<SMDS_BallElement*>(elem));
+  //         break;
+  //       default:
+  //         break;
+  //     }
+  //   }
+  myVolumePool->clear();
+  myFacePool->clear();
+  myEdgePool->clear();
+  myBallPool->clear();
+
+  clearVector( myCells );
+  clearVector( myCellIdVtkToSmds );
 
   SMDS_NodeIteratorPtr itn = nodesIterator();
   while (itn->more())
     {
       SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
       node->SetPosition(SMDS_SpacePosition::originSpacePosition());
-      myNodePool->destroy(node);
+      //myNodePool->destroy(node);
     }
-  myNodes.clear();
+  myNodePool->clear();
+  clearVector( myNodes );
 
   list<SMDS_Mesh*>::iterator itc=myChildren.begin();
   while(itc!=myChildren.end())
     (*itc)->Clear();
 
   myModified = false;
+  myModifTime++;
   xmin = 0; xmax = 0;
   ymin = 0; ymax = 0;
   zmin = 0; zmax = 0;
index b81ffe55a4dcaf614a0be982932c51e61fae2bfc..e945c285e506ad5c927e4d3a626936cd72f51e57 100644 (file)
@@ -122,17 +122,21 @@ void SMDS_MeshGroup::Clear()
 //purpose  : 
 //=======================================================================
 
-void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
+bool SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
 {
   // the type of the group is determined by the first element added
-  if (myElements.empty()) myType = theElem->GetType();
+  if (myElements.empty()) {
+    myType = theElem->GetType();
+  }
   else if (theElem->GetType() != myType) {
     MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<<theElem->GetType()<<"!="<<myType);
-    return;
+    return false;
   }
         
   myElements.insert(myElements.end(), theElem);
   ++myTic;
+
+  return true;
 }
 
 //=======================================================================
index c46184ea9dac57799f8c721207b4a5f04036626a..25e9027d101f3650a12b0ffac8189b674ded8b7b 100644 (file)
@@ -46,7 +46,7 @@ class SMDS_EXPORT SMDS_MeshGroup:public SMDS_MeshObject
 
         void SetType (const SMDSAbs_ElementType theType);
         void Clear();
-        void Add(const SMDS_MeshElement * theElem);
+        bool Add(const SMDS_MeshElement * theElem);
         bool Remove(const SMDS_MeshElement * theElem);
         bool IsEmpty() const { return myElements.empty(); }
         int Extent() const { return myElements.size(); }
index 309be4ceba8472d4ab288ed53b6acfd60bd67b57..91fd238eca0f7905157683e6f44a5d240a82c107 100644 (file)
@@ -71,8 +71,7 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do
   points->InsertPoint(myVtkID, x, y, z);
   SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks());
   assert(cellLinks);
-  if (myVtkID >= cellLinks->GetLinksSize())
-          cellLinks->ResizeL(myVtkID+SMDS_Mesh::chunkSize);
+  cellLinks->ResizeForPoint( myVtkID );
 }
 
 SMDS_MeshNode::~SMDS_MeshNode()
index 1eb5c445d60e5e13ed1af797359a7f258ceb53d5..5a05789969713c900d85498ebb0f13cb5bf60993 100644 (file)
@@ -17,7 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#define CHRONODEF
 #include "SMDS_UnstructuredGrid.hxx"
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshInfo.hxx"
@@ -44,14 +43,14 @@ SMDS_CellLinks* SMDS_CellLinks::New()
   return new SMDS_CellLinks();
 }
 
-vtkCellLinks::Link* SMDS_CellLinks::ResizeL(vtkIdType sz)
+void SMDS_CellLinks::ResizeForPoint(vtkIdType vtkID)
 {
-  return vtkCellLinks::Resize(sz);
-}
-
-vtkIdType SMDS_CellLinks::GetLinksSize()
-{
-  return this->Size;
+  if ( vtkID > this->MaxId )
+  {
+    this->MaxId = vtkID;
+    if ( vtkID >= this->Size ) 
+      vtkCellLinks::Resize( vtkID+SMDS_Mesh::chunkSize );
+  }
 }
 
 SMDS_CellLinks::SMDS_CellLinks() :
@@ -154,7 +153,7 @@ void SMDS_UnstructuredGrid::setSMDS_mesh(SMDS_Mesh *mesh)
 void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int newNodeSize,
                                         std::vector<int>& idCellsOldToNew, int newCellSize)
 {
-  MESSAGE("------------------------- SMDS_UnstructuredGrid::compactGrid " << newNodeSize << " " << newCellSize);CHRONO(1);
+  MESSAGE("------------------------- SMDS_UnstructuredGrid::compactGrid " << newNodeSize << " " << newCellSize);//CHRONO(1);
   int alreadyCopied = 0;
 
   // --- if newNodeSize, create a new compacted vtkPoints
index 774c54e2780ce100982b60448ff76e38da556eb4..4cd1dae371aefb52bae9e7af4b2397d098548efd 100644 (file)
@@ -54,8 +54,7 @@ class SMDS_MeshVolume;
 class SMDS_EXPORT SMDS_CellLinks: public vtkCellLinks
 {
 public:
-  vtkCellLinks::Link* ResizeL(vtkIdType sz);
-  vtkIdType GetLinksSize();
+  void ResizeForPoint(vtkIdType vtkID);
   static SMDS_CellLinks* New();
 protected:
   SMDS_CellLinks();
@@ -108,6 +107,7 @@ public:
 
   static SMDS_UnstructuredGrid* New();
   SMDS_Mesh *_mesh;
+
 protected:
   SMDS_UnstructuredGrid();
   ~SMDS_UnstructuredGrid();
index cb324014ec4b58fc8f1023a0542b96c28917acc1..d3cf38655f7a4732cc333a39e18b176e5d25f1a9 100644 (file)
@@ -33,7 +33,7 @@ SMDS_VtkEdge::SMDS_VtkEdge()
 {
 }
 
-SMDS_VtkEdge::SMDS_VtkEdge(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
+SMDS_VtkEdge::SMDS_VtkEdge(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   init(nodeIds, mesh);
 }
@@ -42,7 +42,7 @@ SMDS_VtkEdge::~SMDS_VtkEdge()
 {
 }
 
-void SMDS_VtkEdge::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
+void SMDS_VtkEdge::init(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshEdge::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
index c5f04300b98cb283a8c3b83ecad479ca93df59a9..ff28a3af6c6921e7def76e225516a060a6f3ba50 100644 (file)
@@ -35,9 +35,9 @@ class SMDS_EXPORT SMDS_VtkEdge: public SMDS_MeshEdge
 
 public:
   SMDS_VtkEdge();
-  SMDS_VtkEdge(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
+  SMDS_VtkEdge(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh);
   ~SMDS_VtkEdge();
-  void init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
+  void init(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh);
   bool ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2);
   virtual bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
index 72cc31ce1895d328def29aaf40b7cecc1e2c5f4b..34086239638b14b88b119909d8fd278037704bf6 100644 (file)
@@ -95,5 +95,6 @@ libSMESHimpl_la_LDFLAGS = \
        $(DriverCGNS_LIB) \
        ../SMESHUtils/libSMESHUtils.la \
        $(BOOST_LIB_THREAD)  \
+       $(BOOST_LIB_SYSTEM)  \
        $(GEOM_LDFLAGS) -lNMTTools \
        $(CAS_LDPATH) -lTKShHealing -lTKPrim -lTKG2d -lTKCDF
index f7bd7f9bf3b2bf85824bab37264a6da3a0453e12..ac294864b2a4bf35362f1a99e99488ea3ff33d17 100644 (file)
@@ -87,6 +87,8 @@ SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
   _onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
   _quadraticMesh = _supportSubmeshes = false;
   _error = COMPERR_OK;
+  for ( int i = 0; i < 4; ++i )
+    _neededLowerHyps[ i ] = false;
 }
 
 //=============================================================================
@@ -823,19 +825,42 @@ void SMESH_Algo::addBadInputElement(const SMDS_MeshElement* elem)
     _badInputElements.push_back( elem );
 }
 
+//=======================================================================
+//function : addBadInputElements
+//purpose  : store a bad input elements or nodes preventing computation
+//=======================================================================
+
+void SMESH_Algo::addBadInputElements(const SMESHDS_SubMesh* sm,
+                                     const bool             addNodes)
+{
+  if ( sm )
+  {
+    if ( addNodes )
+    {
+      SMDS_NodeIteratorPtr nIt = sm->GetNodes();
+      while ( nIt->more() ) addBadInputElement( nIt->next() );
+    }
+    else
+    {
+      SMDS_ElemIteratorPtr eIt = sm->GetElements();
+      while ( eIt->more() ) addBadInputElement( eIt->next() );
+    }
+  }
+}
+
 //=============================================================================
 /*!
  *  
  */
 //=============================================================================
 
-int SMESH_Algo::NumberOfWires(const TopoDS_Shape& S)
-{
-  int i = 0;
-  for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next())
-    i++;
-  return i;
-}
+// int SMESH_Algo::NumberOfWires(const TopoDS_Shape& S)
+// {
+//   int i = 0;
+//   for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next())
+//     i++;
+//   return i;
+// }
 
 //=============================================================================
 /*!
index 1a3be0876eb8dc012a137455948ae486836bff51..76f6de97957d6168ffd8a7d2ada8f59598e06321 100644 (file)
 #include <list>
 #include <map>
 
+class SMDS_MeshNode;
+class SMESHDS_Mesh;
+class SMESHDS_SubMesh;
 class SMESH_Gen;
-class SMESH_Mesh;
 class SMESH_HypoFilter;
-class TopoDS_Vertex;
-class TopoDS_Wire;
+class SMESH_Mesh;
+class SMESH_MesherHelper;
+class SMESH_subMesh;
 class TopoDS_Face;
 class TopoDS_Shape;
-class SMESHDS_Mesh;
-class SMDS_MeshNode;
-class SMESH_subMesh;
-class SMESH_MesherHelper;
+class TopoDS_Vertex;
+class TopoDS_Wire;
 class gp_XYZ;
 
 typedef std::map< SMESH_subMesh*, std::vector<int> >           MapShapeNbElems;
@@ -231,6 +232,10 @@ public:
   bool SupportSubmeshes() const { return _supportSubmeshes; }
   // 5 - whether supports submeshes if !NeedDiscreteBoundary()
 
+  bool NeedLowerHyps(int dim) const { return _neededLowerHyps[ dim ]; }
+  // 6 - if algo !NeedDiscreteBoundary() but requires presence of
+  // hypotheses of dimension <dim> to generate all-dimensional mesh.
+  // This info is used not to issue warnings on hiding of lower global algos.
 
 public:
   // ==================================================================
@@ -302,7 +307,7 @@ public:
    */
   static bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true);
 
-  static int NumberOfWires(const TopoDS_Shape& S);
+  //static int NumberOfWires(const TopoDS_Shape& S);
   int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W);
 
   /*!
@@ -363,6 +368,9 @@ public:
    */
   void addBadInputElement(const SMDS_MeshElement* elem);
 
+  void addBadInputElements(const SMESHDS_SubMesh* sm,
+                           const bool             addNodes=false);
+
 protected:
 
   std::vector<std::string>              _compatibleHypothesis;
@@ -373,9 +381,10 @@ protected:
   // in what turn and with what input shape.
   // These fields must be redefined if necessary by each descendant at constructor.
   bool _onlyUnaryInput;         // mesh one shape of GetDim() at once. Default TRUE
-  bool _requireDiscreteBoundary; // GetDim()-1 mesh must be present. Default TRUE
+  bool _requireDiscreteBoundary;// GetDim()-1 mesh must be present. Default TRUE
   bool _requireShape;           // work with GetDim()-1 mesh bound to geom only. Default TRUE
   bool _supportSubmeshes;       // if !_requireDiscreteBoundary. Default FALSE
+  bool _neededLowerHyps[4];     // hyp dims needed by algo that !NeedDiscreteBoundary(). Df. FALSE
 
   // indicates if quadratic mesh creation is required,
   // is usually set like this: _quadraticMesh = SMESH_MesherHelper::IsQuadraticSubMesh(shape)
index 95013c9d49092b18f860391c1d920a298bac4596..a9ef17d1eb215f0aa5ebb2679111f65eef81a9bb 100644 (file)
@@ -53,6 +53,9 @@
 
 using namespace std;
 
+//#include <vtkDebugLeaks.h>
+
+
 //=============================================================================
 /*!
  *  Constructor
@@ -67,11 +70,12 @@ SMESH_Gen::SMESH_Gen()
         _segmentation = _nbSegments = 10;
         SMDS_Mesh::_meshList.clear();
         MESSAGE(SMDS_Mesh::_meshList.size());
-        _counters = new counters(100);
+        //_counters = new counters(100);
 #ifdef WITH_SMESH_CANCEL_COMPUTE
         _compute_canceled = false;
         _sm_current = NULL;
 #endif
+        //vtkDebugLeaks::SetExitError(0);
 }
 
 //=============================================================================
@@ -83,6 +87,12 @@ SMESH_Gen::SMESH_Gen()
 SMESH_Gen::~SMESH_Gen()
 {
   MESSAGE("SMESH_Gen::~SMESH_Gen");
+  std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
+  for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
+  {
+    delete i_sc->second->myDocument;
+    delete i_sc->second;
+  }  
 }
 
 //=============================================================================
@@ -312,6 +322,7 @@ bool SMESH_Gen::Compute(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
@@ -360,7 +371,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
 
   // fix quadratic mesh by bending iternal links near concave boundary
   if ( aShape.IsSame( aMesh.GetShapeToMesh() ) &&
-       !aShapesId ) // not preview
+       !aShapesId && // not preview
+       ret ) // everything is OK
   {
     SMESH_MesherHelper aHelper( aMesh );
     if ( aHelper.IsQuadraticMesh() != SMESH_MesherHelper::LINEAR )
@@ -581,12 +593,13 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh&               aMesh,
     }
     else
     {
-      bool isGlobal = (aMesh.IsMainShape( aSubMesh->GetSubShape() ));
-      int dim = algo->GetDim();
+      bool       isGlobal = (aMesh.IsMainShape( aSubMesh->GetSubShape() ));
+      int             dim = algo->GetDim();
       int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 );
+      bool    isNeededDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->NeedLowerHyps( dim ) : false );
 
-      if ( dim < aMaxGlobIgnoDim &&
-           ( isGlobal || !aGlobIgnoAlgo->SupportSubmeshes() ))
+      if (( dim < aMaxGlobIgnoDim && !isNeededDim ) &&
+          ( isGlobal || !aGlobIgnoAlgo->SupportSubmeshes() ))
       {
         // algo is hidden by a global algo
         theErrors.push_back( SMESH_Gen::TAlgoStateError() );
@@ -642,8 +655,15 @@ static bool checkMissing(SMESH_Gen*                aGen,
                          set<SMESH_subMesh*>&      aCheckedMap,
                          list< SMESH_Gen::TAlgoStateError > & theErrors)
 {
-  if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX ||
-       aCheckedMap.count( aSubMesh ))
+  switch ( aSubMesh->GetSubShape().ShapeType() )
+  {
+  case TopAbs_EDGE:
+  case TopAbs_FACE:
+  case TopAbs_SOLID: break; // check this submesh, it can be meshed
+  default:
+    return true; // not meshable submesh
+  }
+  if ( aCheckedMap.count( aSubMesh ))
     return true;
 
   //MESSAGE("=====checkMissing");
index fafd29b4b75a4cdacbee83d0c072862db91d2be9..964032af5798f72f5d323df4eecd375b22dad190 100644 (file)
@@ -42,13 +42,13 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
                                    int studyId,
                                    SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
 {
-  _gen = gen;
-  _studyId = studyId;
-  StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
-  myStudyContext->mapHypothesis[_hypId] = this;
-  _type = PARAM_ALGO;
-  _shapeType = 0; // to be set by algo with TopAbs_Enum
+  _gen            = gen;
+  _studyId        = studyId;
+  _type           = PARAM_ALGO;
+  _shapeType      = 0;  // to be set by algo with TopAbs_Enum
   _param_algo_dim = -1; // to be set by algo parameter
+  StudyContextStruct* myStudyContext = gen->GetStudyContext(_studyId);
+  myStudyContext->mapHypothesis[hypId] = this;
 }
 
 //=============================================================================
index 4c29ff333f7923fe42f6d59b168a4c639464aa5e..ec21fff14e5ffbdfc9cb30e8c1e6c48a389c27d0 100644 (file)
@@ -71,10 +71,11 @@ public:
   SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
   virtual ~SMESH_Hypothesis();
   virtual int GetDim() const;
-  int GetStudyId() const;
-  virtual void NotifySubMeshesHypothesisModification();
+  int         GetStudyId() const;
+  SMESH_Gen*  GetGen() const { return (SMESH_Gen*) _gen; }
   virtual int GetShapeType() const;
   virtual const char* GetLibName() const;
+  virtual void NotifySubMeshesHypothesisModification();
   void  SetLibName(const char* theLibName);
 
   //void  SetParameters(const char *theParameters);
index 2616e0b5f368b3b2c58b8d576a9590f7351ca54e..ecc9e60613231240439cde53590f232ade7213e5 100644 (file)
@@ -103,13 +103,12 @@ SMESH_Mesh::SMESH_Mesh(int               theLocalId,
   _studyId       = theStudyId;
   _gen           = theGen;
   _myDocument    = theDocument;
-  _idDoc         = theDocument->NewMesh(theIsEmbeddedMode);
-  _myMeshDS      = theDocument->GetMesh(_idDoc);
+  _myMeshDS      = theDocument->NewMesh(theIsEmbeddedMode,theLocalId);
   _isShapeToMesh = false;
   _isAutoColor   = false;
   _isModified    = false;
   _shapeDiagonal = 0.0;
-  _callUp = 0;
+  _callUp        = NULL;
   _myMeshDS->ShapeToMesh( PseudoShape() );
 }
 
@@ -122,7 +121,6 @@ SMESH_Mesh::SMESH_Mesh(int               theLocalId,
 SMESH_Mesh::SMESH_Mesh():
   _id(-1),
   _studyId(-1),
-  _idDoc(-1),
   _groupId( 0 ),
   _nbSubShapes( 0 ),
   _isShapeToMesh( false ),
@@ -660,8 +658,6 @@ SMESH_Hypothesis::Hypothesis_Status
   }
   HasModificationsToDiscard(); // to reset _isModified flag if a mesh becomes empty
 
-  GetMeshDS()->Modified();
-
   if(MYDEBUG) subMesh->DumpAlgoState(true);
   if(MYDEBUG) SCRUTE(ret);
   return ret;
@@ -735,8 +731,6 @@ SMESH_Hypothesis::Hypothesis_Status
 
   HasModificationsToDiscard(); // to reset _isModified flag if mesh become empty
 
-  GetMeshDS()->Modified();
-
   if(MYDEBUG) subMesh->DumpAlgoState(true);
   if(MYDEBUG) SCRUTE(ret);
   return ret;
@@ -1262,7 +1256,7 @@ void SMESH_Mesh::ExportMED(const char *        file,
   myWriter.SetFile    ( file, MED::EVersion(theVersion) );
   myWriter.SetMesh    ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
   if ( !theMeshName ) 
-    myWriter.SetMeshId  ( _idDoc      );
+    myWriter.SetMeshId  ( _id         );
   else {
     myWriter.SetMeshId  ( -1          );
     myWriter.SetMeshName( theMeshName );
@@ -1355,7 +1349,7 @@ void SMESH_Mesh::ExportDAT(const char *        file,
   DriverDAT_W_SMDS_Mesh myWriter;
   myWriter.SetFile( file );
   myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
-  myWriter.SetMeshId(_idDoc);
+  myWriter.SetMeshId(_id);
   myWriter.Perform();
 }
 
@@ -1372,7 +1366,7 @@ void SMESH_Mesh::ExportUNV(const char *        file,
   DriverUNV_W_SMDS_Mesh myWriter;
   myWriter.SetFile( file );
   myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
-  myWriter.SetMeshId(_idDoc);
+  myWriter.SetMeshId(_id);
   //  myWriter.SetGroups(_mapGroup);
 
   if ( !meshPart )
@@ -1405,7 +1399,7 @@ void SMESH_Mesh::ExportSTL(const char *        file,
   myWriter.SetFile( file );
   myWriter.SetIsAscii( isascii );
   myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS);
-  myWriter.SetMeshId(_idDoc);
+  myWriter.SetMeshId(_id);
   myWriter.Perform();
 }
 
index 2b926f5dd8804c68f42a1ebe4d8dbd1bcefdd8bb..8e01301b6e82f23e73ca48ab0fb88237c5fbfb3a 100644 (file)
@@ -344,7 +344,6 @@ private:
 protected:
   int                        _id;           // id given by creator (unique within the creator instance)
   int                        _studyId;
-  int                        _idDoc;        // id given by SMESHDS_Document
   int                        _groupId;      // id generator for group objects
   int                        _nbSubShapes;  // initial nb of subshapes in the shape to mesh
   bool                       _isShapeToMesh;// set to true when a shape is given (only once)
index ce9b88f8a6fb25e5fbf684a5eea6d7ae74f13305..e8756102484c9a0be90835252e8074d3c47ac1a8 100644 (file)
@@ -97,6 +97,8 @@
 #include <algorithm>
 #include <sstream>
 
+#include <boost/tuple/tuple.hpp>
+
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx>
 
@@ -4169,7 +4171,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap &     mapNewNodes,
                                vecNewNodes[ 1 ]->second.back())) {
           myLastCreatedElems.Append(aMesh->AddEdge(vecNewNodes[ 0 ]->second.back(),
                                                    vecNewNodes[ 1 ]->second.back()));
-          srcElements.Append( myLastCreatedElems.Last() );
+          srcElements.Append( elem );
         }
       }
       else {
@@ -4179,7 +4181,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap &     mapNewNodes,
           myLastCreatedElems.Append(aMesh->AddEdge(vecNewNodes[ 0 ]->second.back(),
                                                    vecNewNodes[ 1 ]->second.back(),
                                                    vecNewNodes[ 2 ]->second.back()));
-          srcElements.Append( myLastCreatedElems.Last() );
+          srcElements.Append( elem );
         }
       }
     }
@@ -4201,19 +4203,20 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap &     mapNewNodes,
         int iNext = ( iNode + 1 == nbNodes ) ? 0 : iNode + 1;
         const SMDS_MeshNode* n1 = vecNewNodes[ iNode ]->first;
         const SMDS_MeshNode* n2 = vecNewNodes[ iNext ]->first;
-        // check if a link is free
+        // check if a link n1-n2 is free
         if ( ! SMESH_MeshEditor::FindFaceInSet ( n1, n2, elemSet, avoidSet )) {
           hasFreeLinks = true;
-          // make an edge and a ceiling for a new edge
-          if ( !aMesh->FindEdge( n1, n2 )) {
-            myLastCreatedElems.Append(aMesh->AddEdge( n1, n2 )); // free link edge
+          // make a new edge and a ceiling for a new edge
+          const SMDS_MeshElement* edge;
+          if ( ! ( edge = aMesh->FindEdge( n1, n2 ))) {
+            myLastCreatedElems.Append( edge = aMesh->AddEdge( n1, n2 )); // free link edge
             srcElements.Append( myLastCreatedElems.Last() );
           }
           n1 = vecNewNodes[ iNode ]->second.back();
           n2 = vecNewNodes[ iNext ]->second.back();
           if ( !aMesh->FindEdge( n1, n2 )) {
-            myLastCreatedElems.Append(aMesh->AddEdge( n1, n2 )); // ceiling edge
-            srcElements.Append( myLastCreatedElems.Last() );
+            myLastCreatedElems.Append(aMesh->AddEdge( n1, n2 )); // new edge ceiling
+            srcElements.Append( edge );
           }
         }
       }
@@ -4235,14 +4238,14 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap &     mapNewNodes,
           // find medium node
           if ( !aMesh->FindEdge( n1, n2, n3 )) {
             myLastCreatedElems.Append(aMesh->AddEdge( n1, n2, n3 )); // free link edge
-            srcElements.Append( myLastCreatedElems.Last() );
+            srcElements.Append( elem );
           }
           n1 = vecNewNodes[ iNode ]->second.back();
           n2 = vecNewNodes[ iNext ]->second.back();
           n3 = vecNewNodes[ iNode+nbn ]->second.back();
           if ( !aMesh->FindEdge( n1, n2, n3 )) {
             myLastCreatedElems.Append(aMesh->AddEdge( n1, n2, n3 )); // ceiling edge
-            srcElements.Append( myLastCreatedElems.Last() );
+            srcElements.Append( elem );
           }
         }
       }
@@ -4498,7 +4501,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap &     mapNewNodes,
       }
 
       while ( srcElements.Length() < myLastCreatedElems.Length() )
-        srcElements.Append( myLastCreatedElems.Last() );
+        srcElements.Append( elem );
     }
   } // loop on swept elements
 }
@@ -6001,8 +6004,10 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
 
   // Sort existing groups by types and collect their names
 
-  // to store an old group and a generated new one
-  typedef pair< SMESHDS_GroupBase*, SMESHDS_Group* > TOldNewGroup;
+  // to store an old group and a generated new ones
+  using boost::tuple;
+  using boost::make_tuple;
+  typedef tuple< SMESHDS_GroupBase*, SMESHDS_Group*, SMESHDS_Group* > TOldNewGroup;
   vector< list< TOldNewGroup > > groupsByType( SMDSAbs_NbElementTypes );
   vector< TOldNewGroup* > orderedOldNewGroups; // in order of old groups
   // group names
@@ -6018,11 +6023,12 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
     if ( !group ) continue;
     SMESHDS_GroupBase* groupDS = group->GetGroupDS();
     if ( !groupDS || groupDS->IsEmpty() ) continue;
-    groupNames.insert( group->GetName() );
+    groupNames.insert    ( group->GetName() );
     groupDS->SetStoreName( group->GetName() );
-    SMESHDS_Group* newGroup = new SMESHDS_Group( newGroupID++, mesh->GetMeshDS(),
-                                                 groupDS->GetType() );
-    groupsByType[ groupDS->GetType() ].push_back( make_pair( groupDS, newGroup ));
+    const SMDSAbs_ElementType type = groupDS->GetType();
+    SMESHDS_Group* newGroup    = new SMESHDS_Group( newGroupID++, mesh->GetMeshDS(), type );
+    SMESHDS_Group* newTopGroup = new SMESHDS_Group( newGroupID++, mesh->GetMeshDS(), type );
+    groupsByType[ groupDS->GetType() ].push_back( make_tuple( groupDS, newGroup, newTopGroup ));
     orderedOldNewGroups.push_back( & groupsByType[ groupDS->GetType() ].back() );
   }
 
@@ -6033,7 +6039,7 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
     const SMESH_SequenceOfElemPtr& gens  = isNodes ? nodeGens : elemGens;
     const SMESH_SequenceOfElemPtr& elems = isNodes ? myLastCreatedNodes : myLastCreatedElems;
     if ( gens.Length() != elems.Length() )
-      throw SALOME_Exception(LOCALIZED("invalid args"));
+      throw SALOME_Exception("SMESH_MeshEditor::generateGroups(): invalid args");
 
     // loop on created elements
     for (int iElem = 1; iElem <= elems.Length(); ++iElem )
@@ -6049,7 +6055,7 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
           ++iElem; // skip all elements made by sourceElem
         continue;
       }
-      // collect all elements made by sourceElem
+      // collect all elements made by the iElem-th sourceElem
       list< const SMDS_MeshElement* > resultElems;
       if ( const SMDS_MeshElement* resElem = elems( iElem ))
         if ( resElem != sourceElem )
@@ -6063,14 +6069,25 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
       list< TOldNewGroup >::iterator gOldNew, gLast = groupsOldNew.end();
       for ( gOldNew = groupsOldNew.begin(); gOldNew != gLast; ++gOldNew )
       {
-        SMESHDS_GroupBase* oldGroup = gOldNew->first;
+        SMESHDS_GroupBase* oldGroup = gOldNew->get<0>();
         if ( oldGroup->Contains( sourceElem )) // sourceElem is in oldGroup
         {
           // fill in a new group
-          SMDS_MeshGroup & newGroup = gOldNew->second->SMDSGroup();
+          SMDS_MeshGroup & newGroup = gOldNew->get<1>()->SMDSGroup();
+          list< const SMDS_MeshElement* > rejectedElems; // elements of other type
           list< const SMDS_MeshElement* >::iterator resLast = resultElems.end(), resElemIt;
           for ( resElemIt = resultElems.begin(); resElemIt != resLast; ++resElemIt )
-            newGroup.Add( *resElemIt );
+            if ( !newGroup.Add( *resElemIt ))
+              rejectedElems.push_back( *resElemIt );
+
+          // fill "top" group
+          if ( !rejectedElems.empty() )
+          {
+            SMDS_MeshGroup & newTopGroup = gOldNew->get<2>()->SMDSGroup();
+            resLast = rejectedElems.end();
+            for ( resElemIt = rejectedElems.begin(); resElemIt != resLast; ++resElemIt )
+              !newTopGroup.Add( *resElemIt );
+          }
         }
       }
     } // loop on created elements
@@ -6078,35 +6095,52 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
 
   // Create new SMESH_Groups from SMESHDS_Groups and remove empty SMESHDS_Groups
 
+  list<int> topGrouIds;
   for ( size_t i = 0; i < orderedOldNewGroups.size(); ++i )
   {
-    SMESHDS_GroupBase* oldGroupDS = orderedOldNewGroups[i]->first;
-    SMESHDS_Group*     newGroupDS = orderedOldNewGroups[i]->second;
-    if ( newGroupDS->IsEmpty() )
-    {
-      mesh->GetMeshDS()->RemoveGroup( newGroupDS );
-    }
-    else
-    {
-      // make a name
-      string name = oldGroupDS->GetStoreName();
-      if ( !targetMesh ) {
-        name += "_";
-        name += postfix;
-        int nb = 1;
-        while ( !groupNames.insert( name ).second ) // name exists
-          name = SMESH_Comment( oldGroupDS->GetStoreName() ) << "_" << postfix << "_" << nb++;
+    SMESHDS_GroupBase* oldGroupDS =   orderedOldNewGroups[i]->get<0>();
+    SMESHDS_Group*   newGroups[2] = { orderedOldNewGroups[i]->get<1>(),
+                                      orderedOldNewGroups[i]->get<2>() };
+    const int nbNewGroups = !newGroups[0]->IsEmpty() + !newGroups[1]->IsEmpty();
+    for ( int is2nd = 0; is2nd < 2; ++is2nd )
+    {
+      SMESHDS_Group* newGroupDS = newGroups[ is2nd ];
+      if ( newGroupDS->IsEmpty() )
+      {
+        mesh->GetMeshDS()->RemoveGroup( newGroupDS );
+      }
+      else
+      {
+        // set group type
+        newGroupDS->SetType( newGroupDS->GetElements()->next()->GetType() );
+
+        // make a name
+        const bool isTop = ( nbNewGroups == 2 &&
+                             newGroupDS->GetType() == oldGroupDS->GetType() );
+        string name = oldGroupDS->GetStoreName();
+        if ( !targetMesh ) {
+          string suffix = ( isTop ? "top": postfix.c_str() );
+          name += "_";
+          name += suffix;
+          int nb = 1;
+          while ( !groupNames.insert( name ).second ) // name exists
+            name = SMESH_Comment( oldGroupDS->GetStoreName() ) << "_" << suffix << "_" << nb++;
+        }
+        else if ( isTop ) {
+          name += "_top";
+        }
+        newGroupDS->SetStoreName( name.c_str() );
+
+        // make a SMESH_Groups
+        mesh->AddGroup( newGroupDS );
+        if ( isTop )
+          topGrouIds.push_back( newGroupDS->GetID() );
+        else
+          newGroupIDs->push_back( newGroupDS->GetID() );
       }
-      newGroupDS->SetStoreName( name.c_str() );
-
-      // make a SMESH_Groups
-      mesh->AddGroup( newGroupDS );
-      newGroupIDs->push_back( newGroupDS->GetID() );
-
-      // set group type
-      newGroupDS->SetType( newGroupDS->GetElements()->next()->GetType() );
     }
   }
+  newGroupIDs->splice( newGroupIDs->end(), topGrouIds );
 
   return newGroupIDs;
 }
index ab1cc9cab3dbf82c04fc99b5365ac5e9add7d794..668b33232fa2f7db2d42f58171660cb93405419e 100644 (file)
 #include "SMDS_FacePosition.hxx" 
 #include "SMDS_IteratorOnIterators.hxx"
 #include "SMDS_VolumeTool.hxx"
+#include "SMESH_Block.hxx"
 #include "SMESH_ProxyMesh.hxx"
 #include "SMESH_subMesh.hxx"
 
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepAdaptor_Surface.hxx>
-#include <BRepClass3d_SolidClassifier.hxx>
 #include <BRepTools.hxx>
-#include <BRepTools_WireExplorer.hxx>
 #include <BRep_Tool.hxx>
 #include <Geom2d_Curve.hxx>
 #include <GeomAPI_ProjectPointOnCurve.hxx>
@@ -199,7 +198,7 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh)
 
 //=======================================================================
 //function : SetSubShape
-//purpose  : Set geomerty to make elements on
+//purpose  : Set geometry to make elements on
 //=======================================================================
 
 void SMESH_MesherHelper::SetSubShape(const int aShID)
@@ -214,7 +213,7 @@ void SMESH_MesherHelper::SetSubShape(const int aShID)
 
 //=======================================================================
 //function : SetSubShape
-//purpose  : Set geomerty to create elements on
+//purpose  : Set geometry to create elements on
 //=======================================================================
 
 void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh)
@@ -1709,6 +1708,25 @@ namespace
   }
 }
 
+//=======================================================================
+//function : IsSameElemGeometry
+//purpose  : Returns true if all elements of a sub-mesh are of same shape
+//=======================================================================
+
+bool SMESH_MesherHelper::IsSameElemGeometry(const SMESHDS_SubMesh* smDS,
+                                            SMDSAbs_GeometryType   shape,
+                                            const bool             nullSubMeshRes)
+{
+  if ( !smDS ) return nullSubMeshRes;
+
+  SMDS_ElemIteratorPtr elemIt = smDS->GetElements();
+  while ( elemIt->more() )
+    if ( elemIt->next()->GetGeomType() != shape )
+      return false;
+
+  return true;
+}
+
 //=======================================================================
 //function : LoadNodeColumns
 //purpose  : Load nodes bound to face into a map of node columns
@@ -1738,7 +1756,7 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap &            theParam2
                                          SMESHDS_Mesh*                 theMesh,
                                          SMESH_ProxyMesh*              theProxyMesh)
 {
-  // get a right submesh of theFace
+  // get a right sub-mesh of theFace
 
   const SMESHDS_SubMesh* faceSubMesh = 0;
   if ( theProxyMesh )
@@ -1758,70 +1776,74 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap &            theParam2
   if ( !faceSubMesh || faceSubMesh->NbElements() == 0 )
     return false;
 
-  // get data of edges for normalization of params
-
-  vector< double > length;
-  double fullLen = 0;
-  list<TopoDS_Edge>::const_iterator edge;
+  if ( theParam2ColumnMap.empty() )
   {
-    for ( edge = theBaseSide.begin(); edge != theBaseSide.end(); ++edge )
+    // get data of edges for normalization of params
+
+    vector< double > length;
+    double fullLen = 0;
+    list<TopoDS_Edge>::const_iterator edge;
     {
-      double len = std::max( 1e-10, SMESH_Algo::EdgeLength( *edge ));
-      fullLen += len;
-      length.push_back( len );
+      for ( edge = theBaseSide.begin(); edge != theBaseSide.end(); ++edge )
+      {
+        double len = std::max( 1e-10, SMESH_Algo::EdgeLength( *edge ));
+        fullLen += len;
+        length.push_back( len );
+      }
     }
-  }
 
-  // get nodes on theBaseEdge sorted by param on edge and initialize theParam2ColumnMap with them
-  edge = theBaseSide.begin();
-  for ( int iE = 0; edge != theBaseSide.end(); ++edge, ++iE )
-  {
-    map< double, const SMDS_MeshNode*> sortedBaseNodes;
-    SMESH_Algo::GetSortedNodesOnEdge( theMesh, *edge,/*noMedium=*/true, sortedBaseNodes);
-    if ( sortedBaseNodes.empty() ) continue;
-
-    map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNodes.begin();
-    if ( theProxyMesh ) // from sortedBaseNodes remove nodes not shared by faces of faceSubMesh
+    // get nodes on theBaseEdge sorted by param on edge and initialize theParam2ColumnMap with them
+    edge = theBaseSide.begin();
+    for ( int iE = 0; edge != theBaseSide.end(); ++edge, ++iE )
     {
-      const SMDS_MeshNode* n1 = sortedBaseNodes.begin()->second;
-      const SMDS_MeshNode* n2 = sortedBaseNodes.rbegin()->second;
-      bool allNodesAreProxy = ( n1 != theProxyMesh->GetProxyNode( n1 ) &&
-                                n2 != theProxyMesh->GetProxyNode( n2 ));
-      if ( allNodesAreProxy )
-        for ( u_n = sortedBaseNodes.begin(); u_n != sortedBaseNodes.end(); u_n++ )
-          u_n->second = theProxyMesh->GetProxyNode( u_n->second );
-
-      if ( u_n = sortedBaseNodes.begin(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
+      map< double, const SMDS_MeshNode*> sortedBaseNN;
+      SMESH_Algo::GetSortedNodesOnEdge( theMesh, *edge,/*noMedium=*/true, sortedBaseNN);
+      if ( sortedBaseNN.empty() ) continue;
+
+      map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNN.begin();
+      if ( theProxyMesh ) // from sortedBaseNN remove nodes not shared by faces of faceSubMesh
       {
-        while ( ++u_n != sortedBaseNodes.end() && !isNodeInSubMesh( u_n->second, faceSubMesh ));
-        sortedBaseNodes.erase( sortedBaseNodes.begin(), u_n );
+        const SMDS_MeshNode* n1 = sortedBaseNN.begin()->second;
+        const SMDS_MeshNode* n2 = sortedBaseNN.rbegin()->second;
+        bool allNodesAreProxy = ( n1 != theProxyMesh->GetProxyNode( n1 ) &&
+                                  n2 != theProxyMesh->GetProxyNode( n2 ));
+        if ( allNodesAreProxy )
+          for ( u_n = sortedBaseNN.begin(); u_n != sortedBaseNN.end(); u_n++ )
+            u_n->second = theProxyMesh->GetProxyNode( u_n->second );
+
+        if ( u_n = sortedBaseNN.begin(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
+        {
+          while ( ++u_n != sortedBaseNN.end() && !isNodeInSubMesh( u_n->second, faceSubMesh ));
+          sortedBaseNN.erase( sortedBaseNN.begin(), u_n );
+        }
+        else if ( u_n = --sortedBaseNN.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
+        {
+          while ( u_n != sortedBaseNN.begin() && !isNodeInSubMesh( (--u_n)->second, faceSubMesh ));
+          sortedBaseNN.erase( ++u_n, sortedBaseNN.end() );
+        }
+        if ( sortedBaseNN.empty() ) continue;
       }
-      else if ( u_n = --sortedBaseNodes.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
+
+      double f, l;
+      BRep_Tool::Range( *edge, f, l );
+      if ( edge->Orientation() == TopAbs_REVERSED ) std::swap( f, l );
+      const double coeff = 1. / ( l - f ) * length[iE] / fullLen;
+      const double prevPar = theParam2ColumnMap.empty() ? 0 : theParam2ColumnMap.rbegin()->first;
+      for ( u_n = sortedBaseNN.begin(); u_n != sortedBaseNN.end(); u_n++ )
       {
-        while ( u_n != sortedBaseNodes.begin() && !isNodeInSubMesh( (--u_n)->second, faceSubMesh ));
-        sortedBaseNodes.erase( ++u_n, sortedBaseNodes.end() );
+        double par = prevPar + coeff * ( u_n->first - f );
+        TParam2ColumnMap::iterator u2nn =
+          theParam2ColumnMap.insert( theParam2ColumnMap.end(), make_pair( par, TNodeColumn()));
+        u2nn->second.push_back( u_n->second );
       }
-      if ( sortedBaseNodes.empty() ) continue;
-    }
-
-    double f, l;
-    BRep_Tool::Range( *edge, f, l );
-    if ( edge->Orientation() == TopAbs_REVERSED ) std::swap( f, l );
-    const double coeff = 1. / ( l - f ) * length[iE] / fullLen;
-    const double prevPar = theParam2ColumnMap.empty() ? 0 : theParam2ColumnMap.rbegin()->first;
-    for ( u_n = sortedBaseNodes.begin(); u_n != sortedBaseNodes.end(); u_n++ )
-    {
-      double par = prevPar + coeff * ( u_n->first - f );
-      TParam2ColumnMap::iterator u2nn =
-        theParam2ColumnMap.insert( theParam2ColumnMap.end(), make_pair( par, TNodeColumn()));
-      u2nn->second.push_back( u_n->second );
     }
+    if ( theParam2ColumnMap.empty() )
+      return false;
   }
-  if ( theParam2ColumnMap.empty() )
-    return false;
-
 
-  int nbRows = 1 + faceSubMesh->NbElements() / ( theParam2ColumnMap.size()-1 );
+  // nb rows of nodes
+  int prevNbRows     = theParam2ColumnMap.begin()->second.size(); // current, at least 1 here
+  int expectedNbRows = faceSubMesh->NbElements() / ( theParam2ColumnMap.size()-1 ); // to be added
 
   // fill theParam2ColumnMap column by column by passing from nodes on
   // theBaseEdge up via mesh faces on theFace
@@ -1834,35 +1856,172 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap &            theParam2
   {
     vector<const SMDS_MeshNode*>& nCol1 = par_nVec_1->second;
     vector<const SMDS_MeshNode*>& nCol2 = par_nVec_2->second;
-    nCol1.resize( nbRows );
-    nCol2.resize( nbRows );
+    nCol1.resize( prevNbRows + expectedNbRows );
+    nCol2.resize( prevNbRows + expectedNbRows );
 
-    int i1, i2, iRow = 0;
-    const SMDS_MeshNode *n1 = nCol1[0], *n2 = nCol2[0];
+    int i1, i2, foundNbRows = 0;
+    const SMDS_MeshNode *n1 = nCol1[ prevNbRows-1 ];
+    const SMDS_MeshNode *n2 = nCol2[ prevNbRows-1 ];
     // find face sharing node n1 and n2 and belonging to faceSubMesh
     while ( const SMDS_MeshElement* face =
             SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, avoidSet, &i1, &i2))
     {
       if ( faceSubMesh->Contains( face ))
       {
-        int nbNodes = face->IsQuadratic() ? face->NbNodes()/2 : face->NbNodes();
+        int nbNodes = face->NbCornerNodes();
         if ( nbNodes != 4 )
           return false;
+        if ( foundNbRows + 1 > expectedNbRows )
+          return false;
         n1 = face->GetNode( (i2+2) % 4 ); // opposite corner of quadrangle face
         n2 = face->GetNode( (i1+2) % 4 );
-        if ( ++iRow >= nbRows )
-          return false;
-        nCol1[ iRow ] = n1;
-        nCol2[ iRow ] = n2;
-        avoidSet.clear();
+        nCol1[ prevNbRows + foundNbRows] = n1;
+        nCol2[ prevNbRows + foundNbRows] = n2;
+        ++foundNbRows;
       }
       avoidSet.insert( face );
     }
-    // set a real height
-    nCol1.resize( iRow + 1 );
-    nCol2.resize( iRow + 1 );
+    if ( foundNbRows != expectedNbRows )
+      return false;
+    avoidSet.clear();
+  }
+  return ( theParam2ColumnMap.size() > 1 &&
+           theParam2ColumnMap.begin()->second.size() == prevNbRows + expectedNbRows );
+}
+
+namespace
+{
+  //================================================================================
+  /*!
+   * \brief Return true if a node is at a corner of a 2D structured mesh of FACE
+   */
+  //================================================================================
+
+  bool isCornerOfStructure( const SMDS_MeshNode*   n,
+                            const SMESHDS_SubMesh* faceSM )
+  {
+    int nbFacesInSM = 0;
+    if ( n ) {
+      SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator( SMDSAbs_Face );
+      while ( fIt->more() )
+        nbFacesInSM += faceSM->Contains( fIt->next() );
+    }
+    return ( nbFacesInSM == 1 );
+  }
+}
+
+//=======================================================================
+//function : IsStructured
+//purpose  : Return true if 2D mesh on FACE is structured
+//=======================================================================
+
+bool SMESH_MesherHelper::IsStructured( SMESH_subMesh* faceSM )
+{
+  SMESHDS_SubMesh* fSM = faceSM->GetSubMeshDS();
+  if ( !fSM || fSM->NbElements() == 0 )
+    return false;
+
+  list< TopoDS_Edge > edges;
+  list< int > nbEdgesInWires;
+  int nbWires = SMESH_Block::GetOrderedEdges( TopoDS::Face( faceSM->GetSubShape() ),
+                                              edges, nbEdgesInWires );
+  if ( nbWires != 1 )
+    return false;
+
+  // algo: find corners of a structure and then analyze nb of faces and
+  // length of structure sides
+
+  SMESHDS_Mesh* meshDS = faceSM->GetFather()->GetMeshDS();
+
+  // rotate edges to get the first node being at corner
+  // (in principle it's not necessary but so far none SALOME algo can make
+  //  such a structured mesh that all corner nodes are not on VERTEXes)
+  bool isCorner     = false;
+  int nbRemainEdges = nbEdgesInWires.front();
+  do {
+    TopoDS_Vertex V = IthVertex( 0, edges.front() );
+    isCorner = isCornerOfStructure( SMESH_Algo::VertexNode( V, meshDS ), fSM);
+    if ( !isCorner ) {
+      edges.splice( edges.end(), edges, edges.begin() );
+      --nbRemainEdges;
+    }
+  }
+  while ( !isCorner && nbRemainEdges > 0 );
+
+  if ( !isCorner )
+    return false;
+
+  // get all nodes from EDGEs
+  list< const SMDS_MeshNode* > nodes;
+  list< TopoDS_Edge >::iterator edge = edges.begin();
+  for ( ; edge != edges.end(); ++edge )
+  {
+    map< double, const SMDS_MeshNode* > u2Nodes;
+    if ( !SMESH_Algo::GetSortedNodesOnEdge( meshDS, *edge,
+                                            /*skipMedium=*/true, u2Nodes ))
+      return false;
+
+    list< const SMDS_MeshNode* > edgeNodes;
+    map< double, const SMDS_MeshNode* >::iterator u2n = u2Nodes.begin();
+    if ( !nodes.empty() && nodes.back() == u2n->second )
+      ++u2n;
+    map< double, const SMDS_MeshNode* >::iterator u2nEnd = --u2Nodes.end();
+    if ( nodes.empty() || nodes.back() != u2nEnd->second )
+      ++u2nEnd;
+    for ( ; u2n != u2nEnd; ++u2n )
+      edgeNodes.push_back( u2n->second );
+
+    if ( edge->Orientation() == TopAbs_REVERSED )
+      edgeNodes.reverse();
+    nodes.splice( nodes.end(), edgeNodes, edgeNodes.begin(), edgeNodes.end() );
+  }
+
+  // get length of structured sides
+  vector<int> nbEdgesInSide;
+  int nbEdges = 0;
+  list< const SMDS_MeshNode* >::iterator n = ++nodes.begin();
+  for ( ; n != nodes.end(); ++n )
+  {
+    ++nbEdges;
+    if ( isCornerOfStructure( *n, fSM )) {
+      nbEdgesInSide.push_back( nbEdges );
+      nbEdges = 0;
+    }
+  }
+
+  // checks
+  if ( nbEdgesInSide.size() != 4 )
+    return false;
+  if ( nbEdgesInSide[0] != nbEdgesInSide[2] )
+    return false;
+  if ( nbEdgesInSide[1] != nbEdgesInSide[3] )
+    return false;
+  if ( nbEdgesInSide[0] * nbEdgesInSide[1] != fSM->NbElements() )
+    return false;
+
+  return true;
+}
+
+//=======================================================================
+//function : Count
+//purpose  : Count nb of sub-shapes
+//=======================================================================
+
+int SMESH_MesherHelper::Count(const TopoDS_Shape&    shape,
+                              const TopAbs_ShapeEnum type,
+                              const bool             ignoreSame)
+{
+  if ( ignoreSame ) {
+    TopTools_IndexedMapOfShape map;
+    TopExp::MapShapes( shape, type, map );
+    return map.Extent();
+  }
+  else {
+    int nb = 0;
+    for ( TopExp_Explorer exp( shape, type ); exp.More(); exp.Next() )
+      ++nb;
+    return nb;
   }
-  return theParam2ColumnMap.size() > 1 && theParam2ColumnMap.begin()->second.size() > 1;
 }
 
 //=======================================================================
index da6cfcbfb3efb5ed7e0ec86a00149c9514087217..af5e106731c2794b5649096f1332a64dcacda3c6 100644 (file)
@@ -58,12 +58,15 @@ typedef gp_XY (*xyFunPtr)(const gp_XY& uv1, const gp_XY& uv2);
 
 //=======================================================================
 /*!
- * \brief It helps meshers to add elements
+ * \brief It helps meshers to add elements and provides other utilities
  *
- * It allow meshers not to care about creation of medium nodes
+ * - It allows meshers not to care about creation of medium nodes
  * when filling a quadratic mesh. Helper does it itself.
- * It defines degree of elements to create when IsQuadraticSubMesh()
+ * It defines order of elements to create when IsQuadraticSubMesh()
  * is called.
+ * - It provides information on a shape it is initialized with:
+ * periodicity, presence of singularities etc.
+ * - ...
  */
 //=======================================================================
 
@@ -73,13 +76,15 @@ public:
   // ---------- PUBLIC UTILITIES ----------
   
   /*!
-   * \brief Returns true if given node is medium
-    * \param n - node to check
-    * \param typeToCheck - type of elements containing the node to ask about node status
+   * \brief Returns true if all elements of a sub-mesh are of same shape
+    * \param smDS - sub-mesh to check elements of
+    * \param shape - expected shape of elements
+    * \param nullSubMeshRes - result value for the case of smDS == NULL
     * \retval bool - check result
    */
-  static bool IsMedium(const SMDS_MeshNode*      node,
-                       const SMDSAbs_ElementType typeToCheck = SMDSAbs_All);
+  static bool IsSameElemGeometry(const SMESHDS_SubMesh* smDS,
+                                 SMDSAbs_GeometryType   shape,
+                                 const bool             nullSubMeshRes = true);
 
   /*!
    * \brief Load nodes bound to face into a map of node columns
@@ -107,6 +112,19 @@ public:
                               const TopoDS_Edge& theBaseEdge,
                               SMESHDS_Mesh*      theMesh,
                               SMESH_ProxyMesh*   theProxyMesh=0);
+  /*!
+   * \brief Return true if 2D mesh on FACE is structured
+   */
+  static bool IsStructured( SMESH_subMesh* faceSM );
+
+  /*!
+   * \brief Returns true if given node is medium
+    * \param n - node to check
+    * \param typeToCheck - type of elements containing the node to ask about node status
+    * \retval bool - check result
+   */
+  static bool IsMedium(const SMDS_MeshNode*      node,
+                       const SMDSAbs_ElementType typeToCheck = SMDSAbs_All);
   /*!
    * \brief Return support shape of a node
    * \param node - the node
@@ -128,6 +146,17 @@ public:
     return ind;
   }
 
+  /*!
+   * \brief Count nb of sub-shapes
+    * \param shape - the shape
+    * \param type - the type of sub-shapes to count
+    * \param ignoreSame - if true, use map not to count same shapes, esle use explorer
+    * \retval int - the calculated number
+   */
+  static int Count(const TopoDS_Shape&    shape,
+                   const TopAbs_ShapeEnum type,
+                   const bool             ignoreSame);
+
   /*!
    * \brief Return number of unique ancestors of the shape
    */
@@ -141,13 +170,12 @@ public:
                                         const SMESH_Mesh&   mesh,
                                         TopAbs_ShapeEnum    ancestorType);
   /*!
-   * \brief Find a common ancestors of two shapes of the given type
+   * \brief Find a common ancestor, of the given type, of two shapes
    */
   static TopoDS_Shape GetCommonAncestor(const TopoDS_Shape& shape1,
                                         const TopoDS_Shape& shape2,
                                         const SMESH_Mesh&   mesh,
                                         TopAbs_ShapeEnum    ancestorType);
-
   /*!
    * \brief Return orientation of sub-shape in the main shape
    */
@@ -205,7 +233,8 @@ public:
    *        or the next methods. By defaul elements are set on the shape if
    *        a mesh has no shape to be meshed
    */
-  void SetElementsOnShape(bool toSet) { mySetElemOnShape = toSet; }
+  bool SetElementsOnShape(bool toSet)
+  { bool res = mySetElemOnShape; mySetElemOnShape = toSet; return res; }
 
   /*!
    * \brief Set shape to make elements on without calling IsQuadraticSubMesh()
index cc493ca3439cfed759fbb3153f1a8a1518d2ecb1..757a83354b1e3ae175954d7e8e0794032a82da60 100644 (file)
@@ -514,7 +514,8 @@ static bool isMeshBoundToShape(SMESHDS_Mesh *     aMeshDS,
 
 bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
                           const TopoDS_Face& theFace,
-                          bool               theProject)
+                          bool               theProject,
+                          TopoDS_Vertex      the1stVertex)
 {
   MESSAGE(" ::Load(face) " );
   Clear();
@@ -538,10 +539,9 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
 
   // check if face is closed
   bool isClosed = helper.HasSeam();
-  TopoDS_Vertex bidon;
   list<TopoDS_Edge> eList;
   list<TopoDS_Edge>::iterator elIt;
-  SMESH_Block::GetOrderedEdges( face, bidon, eList, myNbKeyPntInBoundary );
+  SMESH_Block::GetOrderedEdges( face, eList, myNbKeyPntInBoundary, the1stVertex );
 
   // check that requested or needed projection is possible
   bool isMainShape = theMesh->IsMainShape( face );
@@ -2370,7 +2370,7 @@ bool SMESH_Pattern::Apply (const TopoDS_Face&   theFace,
 
   list< TopoDS_Edge > eList;
   list< int >         nbVertexInWires;
-  int nbWires = SMESH_Block::GetOrderedEdges( face, theVertexOnKeyPoint1, eList, nbVertexInWires);
+  int nbWires = SMESH_Block::GetOrderedEdges( face, eList, nbVertexInWires, theVertexOnKeyPoint1);
   if ( !theVertexOnKeyPoint1.IsSame( TopExp::FirstVertex( eList.front(), true )))
   {
     MESSAGE( " theVertexOnKeyPoint1 not found in the outer wire ");
index 2ba7666aa93790ec1e1ede12ab847505970bba24..272e7bef537a83aaeea9e2d1444025f183e4b73b 100644 (file)
@@ -35,7 +35,7 @@
 #include <set>
 #include <iostream>
 
-#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
 #include <TopTools_IndexedMapOfOrientedShape.hxx>
 #include <gp_XYZ.hxx>
 #include <gp_XY.hxx>
@@ -48,7 +48,6 @@ class SMDS_MeshNode;
 class SMESH_Mesh;
 class SMESHDS_SubMesh;
 class TopoDS_Shell;
-class TopoDS_Vertex;
 class TopoDS_Face;
 class TopoDS_Edge;
 
@@ -71,7 +70,8 @@ class SMESH_EXPORT SMESH_Pattern {
 
   bool Load (SMESH_Mesh*        theMesh,
              const TopoDS_Face& theFace,
-             bool               theProject = false);
+             bool               theProject = false,
+             TopoDS_Vertex      the1stVertex=TopoDS_Vertex());
   // Create a pattern from the mesh built on <theFace>.
   // <theProject>==true makes override nodes positions
   // on <theFace> computed by mesher
index 5fae7685a7366585561cef3adcfe92958d9b9de2..1c03f3fc3e2c3f0381b36b24fae218ff37d9c5c5 100644 (file)
@@ -264,11 +264,11 @@ bool SMESH_subMesh::IsMeshComputed() const
 
 //=============================================================================
 /*!
- *
+ * Return true if all sub-meshes have been meshed
  */
 //=============================================================================
 
-bool SMESH_subMesh::subMeshesComputed()
+bool SMESH_subMesh::SubMeshesComputed() const
 {
   int myDim = SMESH_Gen::GetShapeDim( _subShape );
   int dimToCheck = myDim - 1;
@@ -1398,7 +1398,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           if (!algo->OnlyUnaryInput())
             shape = getCollection( gen, algo, subComputed );
           else
-            subComputed = subMeshesComputed();
+            subComputed = SubMeshesComputed();
           ret = ( algo->NeedDiscreteBoundary() ? subComputed :
                   algo->SupportSubmeshes() ? true :
                   ( !subComputed || _father->IsNotConformAllowed() ));
@@ -1474,9 +1474,12 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           }
         }
         catch ( SALOME_Exception& S_ex ) {
+          const int skipSalomeShift = 7; /* to skip "Salome " of
+                                            "Salome Exception" prefix returned
+                                            by SALOME_Exception::what() */
           if ( !_computeError ) _computeError = SMESH_ComputeError::New();
           _computeError->myName    = COMPERR_SLM_EXCEPTION;
-          _computeError->myComment = S_ex.what();
+          _computeError->myComment = S_ex.what() + skipSalomeShift;
         }
         catch ( std::exception& exc ) {
           if ( !_computeError ) _computeError = SMESH_ComputeError::New();
@@ -1519,7 +1522,26 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
         {
           _computeError.reset();
         }
-        updateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED
+
+        // send event SUBMESH_COMPUTED
+        if ( ret ) {
+          if ( !algo->NeedDiscreteBoundary() )
+            // send SUBMESH_COMPUTED to dependants of all sub-meshes of shape
+            for (subS.ReInit(); subS.More(); subS.Next())
+            {
+              SMESH_subMesh* sm = _father->GetSubMesh( subS.Current() );
+              SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(false,false);
+              while ( smIt->more() ) {
+                sm = smIt->next();
+                if ( sm->GetSubShape().ShapeType() == TopAbs_VERTEX )
+                  sm->updateDependantsState( SUBMESH_COMPUTED );
+                else
+                  break;
+              }
+            }
+          else
+            updateDependantsState( SUBMESH_COMPUTED );
+        }
       }
       break;
 #ifdef WITH_SMESH_CANCEL_COMPUTE
@@ -1862,9 +1884,7 @@ void SMESH_subMesh::updateDependantsState(const compute_event theEvent)
   for (; it.More(); it.Next())
   {
     const TopoDS_Shape& ancestor = it.Value();
-    SMESH_subMesh *aSubMesh =
-      _father->GetSubMeshContaining(ancestor);
-    if (aSubMesh)
+    if ( SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor))
       aSubMesh->ComputeStateEngine( theEvent );
   }
 }
@@ -1933,7 +1953,7 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
                                           SMESH_Algo* theAlgo,
                                           bool &      theSubComputed)
 {
-  theSubComputed = subMeshesComputed();
+  theSubComputed = SubMeshesComputed();
 
   TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh();
 
@@ -1966,7 +1986,7 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
       if (strcmp( anAlgo->GetName(), theAlgo->GetName()) == 0 && // same algo
           anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) // same hyps
         aBuilder.Add( aCompound, S );
-      if ( !subMesh->subMeshesComputed() )
+      if ( !subMesh->SubMeshesComputed() )
         theSubComputed = false;
     }
   }
@@ -2192,20 +2212,19 @@ void SMESH_subMesh::DeleteEventListener(EventListener* listener)
 {
   map< EventListener*, EventListenerData* >::iterator l_d =
     _eventListeners.find( listener );
-  if ( l_d != _eventListeners.end() ) {
-    if ( l_d->first && l_d->first->IsDeletable() )
-    {
-      l_d->first->BeforeDelete( this, l_d->second );
-      delete l_d->first;
-    }
+  if ( l_d != _eventListeners.end() && l_d->first )
+  {
     if ( l_d->second && l_d->second->IsDeletable() )
     {
       delete l_d->second;
     }
+    l_d->first->myBusySM.erase( this );
+    if ( l_d->first->IsDeletable() )
+    {
+      l_d->first->BeforeDelete( this, l_d->second );
+      delete l_d->first;
+    }
     _eventListeners.erase( l_d );
-
-    if ( l_d->first && !l_d->first->IsDeletable() )
-      l_d->first->myBusySM.erase( this );
   }
 }
 
@@ -2343,22 +2362,23 @@ namespace {
 //================================================================================
 
 SMESH_subMeshIteratorPtr SMESH_subMesh::getDependsOnIterator(const bool includeSelf,
-                                                             const bool reverse)
+                                                             const bool reverse) const
 {
+  SMESH_subMesh *me = (SMESH_subMesh*) this;
   SMESH_subMesh *prepend=0, *append=0;
   if ( includeSelf ) {
-    if ( reverse ) prepend = this;
-    else            append = this;
+    if ( reverse ) prepend = me;
+    else            append = me;
   }
   typedef map < int, SMESH_subMesh * > TMap;
   if ( reverse )
   {
     return SMESH_subMeshIteratorPtr
-      ( new _Iterator( new SMDS_mapReverseIterator<TMap>( DependsOn() ), prepend, append ));
+      ( new _Iterator( new SMDS_mapReverseIterator<TMap>( me->DependsOn() ), prepend, append ));
   }
   {
     return SMESH_subMeshIteratorPtr
-      ( new _Iterator( new SMDS_mapIterator<TMap>( DependsOn() ), prepend, append ));
+      ( new _Iterator( new SMDS_mapIterator<TMap>( me->DependsOn() ), prepend, append ));
   }
 }
 
index 43b8349f1b032c0dae5bf02b7e49d1b9ebb7d4c8..0c956cea623af7fa8627fde9e16b659e71c95be7 100644 (file)
@@ -84,7 +84,7 @@ class SMESH_EXPORT SMESH_subMesh
    * \brief Return iterator on the submeshes this one depends on
    */
   SMESH_subMeshIteratorPtr getDependsOnIterator(const bool includeSelf,
-                                                const bool complexShapeFirst);
+                                                const bool complexShapeFirst) const;
 
   const TopoDS_Shape & GetSubShape() const;
 
@@ -253,6 +253,8 @@ public:
   void SetIsAlwaysComputed(bool isAlCo);
   bool IsAlwaysComputed() { return _alwaysComputed; }
 
+  bool SubMeshesComputed() const;
+
   
   /*!
    * \brief  Find common submeshes (based on shared subshapes with other
@@ -267,9 +269,6 @@ protected:
   // ==================================================================
   void insertDependence(const TopoDS_Shape aSubShape);
 
-  bool subMeshesComputed();
-  //bool SubMeshesReady();
-
   void removeSubMeshElementsAndNodes();
   void updateDependantsState(const compute_event theEvent);
   void updateSubMeshState(const compute_state theState);
index 258eda28bcc51fc3bb99748cc8c419f01882b340..531752fbe981fc42e348f291b6b7266353abe877 100644 (file)
@@ -28,7 +28,7 @@ void memostat(const char* f, int l);
 void memostat(const char* f, int l)
 {
 #ifdef WIN32
-       //rnv: TODO: find alternative of the malloc_stats() on windows platform
+        //rnv: TODO: find alternative of the malloc_stats() on windows platform
 #else
   /*  struct mallinfo mem = mallinfo(); */
   /*  std::cerr << f << ":"<< l << " " << mem.arena << " " << mem.ordblks << " " << mem.hblks << " " << mem.hblkhd << " "  << mem.uordblks << " "  << mem.fordblks << " " << mem.keepcost << std::endl; */
index 315275e33ac9f742e6ddc35552229d47e1285a31..ff16aa2b097d703a8930342a9d4167d260e3e499 100644 (file)
@@ -55,13 +55,15 @@ SMESHDS_Document::~SMESHDS_Document()
 //function : NewMesh
 //purpose  : 
 //=======================================================================
-int SMESHDS_Document::NewMesh(bool theIsEmbeddedMode)
-{
-  static int aNewMeshID = 0;
-  aNewMeshID++;
-  SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(aNewMeshID,theIsEmbeddedMode);
-  myMeshes[aNewMeshID] = aNewMesh;
-  return aNewMeshID;
+SMESHDS_Mesh * SMESHDS_Document::NewMesh(bool theIsEmbeddedMode, int MeshID)
+{
+  std::map<int,SMESHDS_Mesh*>::iterator i_m =
+    myMeshes.insert( make_pair( MeshID, (SMESHDS_Mesh*)0 )).first;
+  if ( i_m->second )
+    throw SALOME_Exception("SMESHDS_Document::NewMesh(): ID of existing mesh given");
+  SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(MeshID,theIsEmbeddedMode);
+  i_m->second = aNewMesh;
+  return aNewMesh;
 }
 
 //=======================================================================
index 4b7f1fcd1bab0a2a1d9fe55eb55eb6c825ec7f67..172b723e2c6ba64d7ae7e5eecb56095ee8525a5d 100644 (file)
@@ -38,8 +38,8 @@ class SMESHDS_EXPORT SMESHDS_Document
 {
   public:
         SMESHDS_Document(int UserID);
-         ~SMESHDS_Document();
-        int                  NewMesh(bool theIsEmbeddedMode);
+        ~SMESHDS_Document();
+        SMESHDS_Mesh *       NewMesh(bool theIsEmbeddedMode, int MeshID);
         void                 RemoveMesh(int MeshID);
         SMESHDS_Mesh *       GetMesh(int MeshID);
         void                 AddHypothesis(SMESHDS_Hypothesis * H);
index 32bd8c7f3485553f1dcb7cc7e7bfd4bba304db29..80082af0d2f7b7cd94f1fe87373dabbb35590c29 100644 (file)
@@ -28,6 +28,9 @@
 #include "SMESHDS_Mesh.hxx"
 #include "SMDS_SetIterator.hxx"
 
+#include <numeric>
+#include <limits>
+
 using namespace std;
 
 //=============================================================================
@@ -40,9 +43,12 @@ SMESHDS_GroupOnFilter::SMESHDS_GroupOnFilter (const int                 theID,
                                               const SMESHDS_Mesh*       theMesh,
                                               const SMDSAbs_ElementType theType,
                                               const SMESH_PredicatePtr& thePredicate)
-  : SMESHDS_GroupBase(theID,theMesh,theType), myMeshModifTime(0), myPredicateTic(0)
+  : SMESHDS_GroupBase(theID,theMesh,theType),
+    myMeshInfo( SMDSEntity_Last, 0 ),
+    myMeshModifTime(0),
+    myPredicateTic(0),
+    myNbElemToSkip(0)
 {
-  setChanged();
   SetPredicate( thePredicate );
 }
 
@@ -52,7 +58,7 @@ SMESHDS_GroupOnFilter::SMESHDS_GroupOnFilter (const int                 theID,
  */
 //================================================================================
 
-void SMESHDS_GroupOnFilter::SetPredicate( const SMESH_PredicatePtr& thePredicate)
+void SMESHDS_GroupOnFilter::SetPredicate( const SMESH_PredicatePtr& thePredicate )
 {
   myPredicate = thePredicate;
   ++myPredicateTic;
@@ -70,7 +76,36 @@ void SMESHDS_GroupOnFilter::SetPredicate( const SMESH_PredicatePtr& thePredicate
 int SMESHDS_GroupOnFilter::Extent() const
 {
   update();
-  return myElements.size();
+  return std::accumulate( myMeshInfo.begin(), myMeshInfo.end(), 0 );
+}
+
+//================================================================================
+/*!
+ * \brief Checks emptyness
+ */
+//================================================================================
+
+bool SMESHDS_GroupOnFilter::IsEmpty()
+{
+  if ( IsUpToDate() )
+  {
+    return ( Extent() == 0 );
+  }
+  else // not up-to-date
+  {
+    setChanged();
+    SMDS_ElemIteratorPtr okElemIt = GetElements();
+    if ( !okElemIt->more() )
+    {
+      // no satisfying elements
+      setChanged( false );
+    }
+    else
+    {
+      return false;
+    }
+  }
+  return true;
 }
 
 //================================================================================
@@ -95,6 +130,53 @@ bool SMESHDS_GroupOnFilter::Contains (const SMDS_MeshElement* elem)
   return myPredicate ? myPredicate->IsSatisfy( elem->GetID() ) : false;
 }
 
+//================================================================================
+namespace // Iterator
+{
+  struct TIterator : public SMDS_ElemIterator
+  {
+    SMESH_PredicatePtr      myPredicate;
+    SMDS_ElemIteratorPtr    myElemIt;
+    const SMDS_MeshElement* myNextElem;
+    size_t                  myNbToFind, myNbFound;
+    TIterator( const SMESH_PredicatePtr& filter,
+               SMDS_ElemIteratorPtr&     elems,
+               size_t                    nbToFind):
+      myPredicate( filter ),
+      myElemIt( elems ),
+      myNextElem( 0 ),
+      myNbToFind( nbToFind ),
+      myNbFound( 0 )
+    {
+      next();
+    }
+    virtual bool more()
+    {
+      return myNextElem;
+    }
+    virtual const SMDS_MeshElement* next()
+    {
+      const SMDS_MeshElement* res = myNextElem;
+      myNbFound += bool( res );
+      myNextElem = 0;
+      if ( myNbFound < myNbToFind )
+        while ( myElemIt->more() && !myNextElem )
+        {
+          myNextElem = myElemIt->next();
+          if ( !myPredicate->IsSatisfy( myNextElem->GetID() ))
+            myNextElem = 0;
+        }
+      return res;
+    }
+  };
+
+  struct TEmptyIterator : public SMDS_ElemIterator
+  {
+    virtual bool more()                    { return false; }
+    virtual const SMDS_MeshElement* next() { return 0; }
+  };
+}
+
 //================================================================================
 /*!
  * \brief Return iterator on all elements
@@ -103,25 +185,84 @@ bool SMESHDS_GroupOnFilter::Contains (const SMDS_MeshElement* elem)
 
 SMDS_ElemIteratorPtr SMESHDS_GroupOnFilter::GetElements() const
 {
-  update();
-  return SMDS_ElemIteratorPtr
-    ( new SMDS_ElementVectorIterator( myElements.begin(), myElements.end() ));
+  size_t nbToFind = std::numeric_limits<size_t>::max();
+
+  SMDS_ElemIteratorPtr elemIt;
+  if ( myPredicate )
+  {
+    myPredicate->SetMesh( GetMesh() ); // hope myPredicate updates self here if necessary
+
+    elemIt = GetMesh()->elementsIterator( GetType() );
+    if ( IsUpToDate() )
+    {
+      nbToFind = Extent();
+      if ( nbToFind == GetMesh()->GetMeshInfo().NbElements( GetType() ))
+        return elemIt; // all elements are OK
+      for ( size_t i = 0; i < myNbElemToSkip; ++i )
+        elemIt->next(); // skip w/o check
+    }
+  }
+  else
+  {
+    elemIt = SMDS_ElemIteratorPtr( new TEmptyIterator );
+  }
+  return SMDS_ElemIteratorPtr ( new TIterator( myPredicate, elemIt, nbToFind ));
 }
 
 //================================================================================
 /*!
- * \brief return ID of theIndex-th element
- *  \param theIndex - index countered from 1
- *  \retval int - element ID
+ * \brief Return info on sub-types of elements
  */
 //================================================================================
 
-int SMESHDS_GroupOnFilter::GetID (const int theIndex)
+std::vector< int > SMESHDS_GroupOnFilter::GetMeshInfo() const
 {
   update();
-  if ( theIndex < 1 || theIndex > myElements.size() )
-    return -1;
-  return myElements[ theIndex-1 ]->GetID();
+  return myMeshInfo;
+}
+
+//================================================================================
+/*!
+ * \brief Fill ids of elements. And return their number.
+ *       \a ids must be pre-allocated using nb of elements of type == GetType()
+ */
+//================================================================================
+
+int SMESHDS_GroupOnFilter::getElementIds( void* ids, size_t idSize ) const
+{
+  SMESHDS_GroupOnFilter* me = const_cast<SMESHDS_GroupOnFilter*>( this );
+
+  char* curID = (char*) ids;
+  SMDS_ElemIteratorPtr elIt = GetElements();
+  if ( elIt->more() )
+  {
+    if ( IsUpToDate() )
+    {
+      for ( ; elIt->more(); curID += idSize )
+        (*(int*) curID) = elIt->next()->GetID();
+    }
+    else
+    {
+      me->setChanged();
+
+      // find out nb of elements to skip w/o check before the 1st OK element
+      const SMDS_MeshElement* firstOkElem = me->setNbElemToSkip( elIt );
+
+      me->myMeshInfo.assign( SMDSEntity_Last, 0 );
+      me->myMeshInfo[ firstOkElem->GetEntityType() ]++;
+
+      (*(int*) curID) = firstOkElem->GetID();
+      for ( curID += idSize; elIt->more(); curID += idSize )
+      {
+        const SMDS_MeshElement* e = elIt->next();
+        (*(int*) curID) = e->GetID();
+        me->myMeshInfo[ e->GetEntityType() ]++;
+      }
+    }
+  }
+  me->setChanged( false );
+
+  return ( curID - (char*)ids ) / idSize;
 }
 
 //================================================================================
@@ -154,23 +295,17 @@ bool SMESHDS_GroupOnFilter::IsUpToDate() const
 
 void SMESHDS_GroupOnFilter::update() const
 {
+  SMESHDS_GroupOnFilter* me = const_cast<SMESHDS_GroupOnFilter*>( this );
   if ( !IsUpToDate() )
   {
-    SMESHDS_GroupOnFilter* me = const_cast<SMESHDS_GroupOnFilter*>( this );
-    me->myElements.clear();
-    if ( myPredicate )
-    {
-      myPredicate->SetMesh( GetMesh() ); // hope myPredicate updates self here if necessary
-      me->myElements.reserve( GetMesh()->GetMeshInfo().NbElements(GetType()));
-      SMDS_ElemIteratorPtr elIt = GetMesh()->elementsIterator(GetType());
+    me->setChanged();
+    SMDS_ElemIteratorPtr elIt = GetElements();
+    if ( elIt->more() ) {
+      // find out nb of elements to skip w/o check before the 1st OK element
+      const SMDS_MeshElement* e = me->setNbElemToSkip( elIt );
+      ++me->myMeshInfo[ e->GetEntityType() ];
       while ( elIt->more() )
-      {
-        const SMDS_MeshElement* e = elIt->next();
-        if ( myPredicate->IsSatisfy( e->GetID() ))
-          me->myElements.push_back( e );
-      }
-      vector< const SMDS_MeshElement*> elems( me->myElements.begin(), me->myElements.end() );
-      me->myElements.swap( elems );
+        ++me->myMeshInfo[ elIt->next()->GetEntityType() ];
     }
     me->setChanged( false );
   }
@@ -178,7 +313,7 @@ void SMESHDS_GroupOnFilter::update() const
 
 //================================================================================
 /*!
- * \brief Sets myMeshModifTime according to modification state
+ * \brief Sets myMeshModifTime and clear fields according to modification state
  */
 //================================================================================
 
@@ -187,4 +322,31 @@ void SMESHDS_GroupOnFilter::setChanged(bool changed)
   myMeshModifTime = GetMesh()->GetMTime();
   if ( changed && myMeshModifTime != 0 )
     --myMeshModifTime;
+  if ( changed ) {
+    myNbElemToSkip = 0;
+    myMeshInfo.assign( SMDSEntity_Last, 0 );
+  }
+}
+
+//================================================================================
+/*!
+ * \brief Sets myNbElemToSkip
+ *  \param okElemIt - iterator on OK elements
+ *  \retval const SMDS_MeshElement* - the first OK element
+ */
+//================================================================================
+
+const SMDS_MeshElement*
+SMESHDS_GroupOnFilter::setNbElemToSkip( SMDS_ElemIteratorPtr& okElemIt )
+{
+  // find out nb of elements to skip w/o check before the 1st OK element
+  const SMDS_MeshElement* firstOkElem = okElemIt->next();
+  if ( myNbElemToSkip == 0 )
+  {
+    SMDS_ElemIteratorPtr elemIt = GetMesh()->elementsIterator( GetType() );
+    myNbElemToSkip = 0;
+    while ( elemIt->next() != firstOkElem )
+      ++myNbElemToSkip;
+  }
+  return firstOkElem;
 }
index b1e33e5fc7ba4a9065bbdf074d9ec3df3f115f8f..9200744d29935f13818fd27ce776554c027ed456 100644 (file)
@@ -46,7 +46,18 @@ class SMESHDS_EXPORT SMESHDS_GroupOnFilter: public SMESHDS_GroupBase
 
   SMESH_PredicatePtr GetPredicate() const { return myPredicate; }
 
-  virtual int Extent() const;
+  std::vector< int > GetMeshInfo() const;
+
+  template< typename IDTYPE >
+    int        GetElementIds( IDTYPE* ids ) const
+  {
+    return getElementIds( (void*)ids, sizeof(IDTYPE));
+  }
+
+
+  virtual int  Extent() const;
+
+  virtual bool IsEmpty();
 
   virtual bool Contains (const int theID);
 
@@ -54,21 +65,22 @@ class SMESHDS_EXPORT SMESHDS_GroupOnFilter: public SMESHDS_GroupBase
 
   virtual SMDS_ElemIteratorPtr GetElements() const;
 
-  virtual int GetID (const int theIndex);
-
-  virtual int GetTic() const;
+  virtual int  GetTic() const;
 
-  bool IsUpToDate() const;
+  bool         IsUpToDate() const;
 
  private:
 
   void update() const;
   void setChanged(bool changed=true);
+  const SMDS_MeshElement* setNbElemToSkip( SMDS_ElemIteratorPtr& elIt );
+  int getElementIds( void* ids, size_t idSize ) const;
 
   SMESH_PredicatePtr                    myPredicate;
-  std::vector< const SMDS_MeshElement*> myElements;
-  unsigned long                         myMeshModifTime; // when myElements was filled
+  std::vector< int >                    myMeshInfo;
+  size_t                                myMeshModifTime; // when myMeshInfo was updated
   int                                   myPredicateTic;
+  size_t                                myNbElemToSkip;
 };
 
 #endif
index 32073bb50bb9e179eca45bf9f615772fc798acc3..9eb49ff077cf7ca1fd3212a1839497bee27b73d8 100644 (file)
@@ -469,8 +469,8 @@ SMESHDS_SubMeshIteratorPtr SMESHDS_SubMesh::GetSubMeshIterator() const
 
 void SMESHDS_SubMesh::Clear()
 {
-  myElements.clear();
-  myNodes.clear();
+  clearVector( myElements );
+  clearVector( myNodes );
   myUnusedIdNodes = 0;
   myUnusedIdElements = 0;
   SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
index 49d6ab1d24e639468d091f7c980ea803ec6747e6..e23cc43e349362cd6d7349285b486a439088d97b 100644 (file)
@@ -23,6 +23,9 @@
 #ifndef _SMESH_CONTROLS_HXX_
 #define _SMESH_CONTROLS_HXX_
 
+// This file is named incosistently with others, i.e. not SMESHDS_Controls.hxx,
+// because it was moved from ../Controls/SMESH_Controls.hxx
+
 #include "SMDSAbs_ElementType.hxx"
 
 #include <boost/shared_ptr.hpp>
index 86de4f316721e8c6680303eeff1d93a7b883b749..5c87d1c2c7e2d7fdb27e6a6b9b5191b55699234e 100644 (file)
 
             anEntryList.append( aMeshSO->GetID().c_str() );
 
-#ifdef WITHGENERICOBJ
             // obj has been published in study. Its refcount has been incremented.
             // It is safe to decrement its refcount
             // so that it will be destroyed when the entry in study will be removed
             aMeshes[i]->UnRegister();
-#endif
           }
           else {
             isEmpty = true;
               vtkLookupTable* lookupTable =
                 static_cast<vtkLookupTable*>(aScalarBarActor->GetLookupTable());
               double * minmax = lookupTable->GetRange();
+              bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
               std::vector<int>    nbEvents;
               std::vector<double> funValues;
-              aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax );
+              aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax, isLogarithmic );
               QString anInitialPath = "";
               if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
                 anInitialPath = QDir::currentPath();
             aControl = SMESH_Actor::eCoincidentElems3D;
             break;
           }
-            
+
           anActor->SetControlMode(aControl);
           anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
           SMESH::RepaintCurrentView();
       std::string anEntry = SO->GetID();
 
       /** Erase graphical object **/
-      if(SO->FindAttribute(anAttr, "AttributeIOR")){
-        ViewManagerList aViewMenegers = anApp->viewManagers();
-        ViewManagerList::const_iterator it = aViewMenegers.begin();
-        for( ; it != aViewMenegers.end(); it++) {         
-          SUIT_ViewManager* vm = *it;
-          int nbSf = vm ? vm->getViewsCount() : 0;
-          if(vm) {
-            QVector<SUIT_ViewWindow*> aViews = vm->getViews();
-            for(int i = 0; i < nbSf; i++){
-              SUIT_ViewWindow *sf = aViews[i];
-              if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
-                SMESH::RemoveActor(sf,anActor);
-              }
-            }
-          }
-        }
+      if(SO->FindAttribute(anAttr, "AttributeIOR")) {
+        SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true);
+        // ViewManagerList aViewMenegers = anApp->viewManagers();
+        // ViewManagerList::const_iterator it = aViewMenegers.begin();
+        // for( ; it != aViewMenegers.end(); it++) {         
+        //   SUIT_ViewManager* vm = *it;
+        //   int nbSf = vm ? vm->getViewsCount() : 0;
+        //   if(vm) {
+        //     QVector<SUIT_ViewWindow*> aViews = vm->getViews();
+        //     for(int i = 0; i < nbSf; i++){
+        //       SUIT_ViewWindow *sf = aViews[i];
+        //       if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
+        //         SMESH::RemoveActor(sf,anActor);
+        //       }
+        //     }
+        //   }
+        // }
       }
       /** Remove an object from data structures **/
       SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
@@ -1891,8 +1891,7 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
  */
 //=============================================================================
 SMESHGUI::SMESHGUI() :
-SalomeApp_Module( "SMESH" ),
-LightApp_Module( "SMESH" )
+SalomeApp_Module( "SMESH" )
 {
   if ( CORBA::is_nil( myComponentSMESH ) )
   {
@@ -1927,10 +1926,6 @@ LightApp_Module( "SMESH" )
   myEventCallbackCommand->SetCallback( SMESHGUI::ProcessEvents );
   myPriority = 0.0;
 
-  SMESH::GetFilterManager();
-  SMESH::GetPattern();
-  SMESH::GetMeasurements();
-
   /* load resources for all available meshers */
   SMESH::InitAvailableHypotheses();
 }
@@ -1942,12 +1937,6 @@ LightApp_Module( "SMESH" )
 //=============================================================================
 SMESHGUI::~SMESHGUI()
 {
-#ifdef WITHGENERICOBJ
-  SMESH::GetFilterManager()->UnRegister();
-  SMESH::GetMeasurements()->UnRegister();
-#endif
-  SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
-  SMESH::GetMeasurements() = SMESH::Measurements::_nil();
 }
 
 //=============================================================================
@@ -4747,7 +4736,7 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( notifyMode, "indexes", indices );
 
   int infoGroup = addPreference( tr( "PREF_GROUP_INFO" ), genTab );
-  setPreferenceProperty( infoGroup, "columns", 4 );
+  setPreferenceProperty( infoGroup, "columns", 2 );
   int elemInfo = addPreference( tr( "PREF_ELEM_INFO" ), infoGroup, LightApp_Preferences::Selector, "SMESH", "mesh_elem_info" );
   modes.clear();
   modes.append( tr( "PREF_ELEM_INFO_SIMPLE" ) );
@@ -4762,6 +4751,10 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( nodesLim, "max", 10000000 );
   setPreferenceProperty( nodesLim, "step", 10000 );
   setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
+  addPreference( tr( "PREF_ELEM_INFO_GRP_DETAILS" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "elem_info_grp_details" );
+  addPreference( tr( "PREF_DUMP_BASE_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_base" );
+  addPreference( tr( "PREF_DUMP_ELEM_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_elem" );
+  addPreference( tr( "PREF_DUMP_ADD_INFO"  ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_add" );
 
   int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
   setPreferenceProperty( segGroup, "columns", 2 );
@@ -4892,6 +4885,15 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( shrink, "min", 0 );
   setPreferenceProperty( shrink, "max", 100 );
 
+  int numGroup = addPreference( tr( "PREF_GROUP_NUMBERING" ), meshTab );
+  setPreferenceProperty( numGroup, "columns", 2 );
+  
+  addPreference( tr( "PREF_NUMBERING_NODE" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_node_color" );
+  addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_node_font", true );
+
+  addPreference( tr( "PREF_NUMBERING_ELEM" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_elem_color" );
+  addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_elem_font", true );
+
   int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab );
   setPreferenceProperty( orientGroup, "columns", 1 );
 
@@ -5078,6 +5080,12 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
       QString val = aResourceMgr->stringValue( "SMESH", name );
       myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
     }
+    else if ( name == QString( "numbering_node_color" ) || name == QString( "numbering_node_font" ) ) {
+      SMESH::UpdateFontProp( this );    
+    }
+    else if ( name == QString( "numbering_elem_color" ) || name == QString( "numbering_elem_font" ) ) {
+      SMESH::UpdateFontProp( this );
+    }
 
     if(aWarning.size() != 0){
       aWarning += "The default values are applied instead.";
@@ -6345,7 +6353,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
   \param param parameter
   \return identifier of preferences
 */
-int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
+int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param, const bool needSize )
 {
   int tfont = addPreference( label, pId, LightApp_Preferences::Font, "SMESH", param );
 
@@ -6359,6 +6367,7 @@ int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString
   setPreferenceProperty( tfont, "fonts", fam );
 
   int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
+  if ( needSize ) f = f | QtxFontEdit::Size;
   setPreferenceProperty( tfont, "features", f );
 
   return tfont;
index 6f5237ce3adbdec3627dfbeff7e797b754037cbc..f45cfbfb531c468cef2c3369a534abdeee1eb126 100644 (file)
@@ -200,9 +200,10 @@ protected:
 
 private:
   void                            OnEditDelete();
-  int                             addVtkFontPref( const QString& label, 
-                                                  const int pId, 
-                                                  const QString& param );
+  int                             addVtkFontPref( const QString&, 
+                                                  const int, 
+                                                  const QString&,
+                                                 const bool = false);
 
   void                            connectView( const SUIT_ViewWindow* );
  
index 51e19437060dbbf5f05c1ae0899ba9ae0d94b7a4..cadd4593f51688b49182c8cc8966723736e8986d 100644 (file)
@@ -347,13 +347,11 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
 
     SMESHGUI::Modified();
 
-#ifdef WITHGENERICOBJ
     // obj has been published in study. Its refcount has been incremented.
     // It is safe to decrement its refcount
     // so that it will be destroyed when the entry in study will be removed
     if (!CORBA::is_nil(aCompoundMesh))
       aCompoundMesh->UnRegister();
-#endif
 
     return true;
   }
index 7bf81c56cca5918ccbd2a78f177abd3ba273a683..1d5555e7eb71f13c1274e12da6315e3efa7c1252 100644 (file)
@@ -41,6 +41,7 @@
 // SALOME GEOM includes
 #include <GEOMBase.h>
 #include <GEOM_Actor.h>
+#include <GEOM_wrap.hxx>
 
 // SALOME GUI includes
 #include <LightApp_SelectionMgr.h>
@@ -58,6 +59,7 @@
 // SALOME KERNEL includes
 #include <SALOMEDS_SObject.hxx>
 #include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDS_wrap.hxx>
 
 // OCCT includes
 #include <BRep_Tool.hxx>
@@ -386,17 +388,23 @@ namespace SMESH
   }
   // -----------------------------------------------------------------------
   /*!
-   * \brief Return sub-shape by ID
+   * \brief Return sub-shape by ID. WARNING: UnRegister() must be called on a result
    */
   GEOM::GEOM_Object_ptr getSubShape( int subShapeID, GEOM::GEOM_Object_var aMainShape)
   {
     GEOM::GEOM_Object_var aSubShape;
-    if ( subShapeID == 1 )
+    if ( subShapeID == 1 ) {
       aSubShape = aMainShape;
-    else if ( _PTR(SObject) so = getSubShapeSO( subShapeID, aMainShape ))
+      aSubShape->Register();
+    }
+    else if ( _PTR(SObject) so = getSubShapeSO( subShapeID, aMainShape )) {
       aSubShape = SMESH::SObjectToInterface<GEOM::GEOM_Object>( so );
-    else
+      aSubShape->Register();
+    }
+    else {
       aSubShape = SMESH::GetSubShape( aMainShape, subShapeID );
+      // future call of UnRegister() will delete a servant of this new object
+    }
     return aSubShape._retn();
   }
   // -----------------------------------------------------------------------
@@ -433,7 +441,8 @@ namespace SMESH
       text = aSO->GetName().c_str();
     else {
       text = QString("#%1").arg( subShapeID );
-      QString typeName = shapeTypeName( getSubShape( subShapeID, aMainShape ));
+      GEOM::GEOM_Object_wrap shape = getSubShape( subShapeID, aMainShape );
+      QString typeName = shapeTypeName( shape );
       if ( typeName.length() )
         text += QString(" (%1)").arg(typeName);
     }
@@ -712,24 +721,43 @@ void SMESHGUI_ComputeDlg_QThread::cancel()
 //================================================================================
 //================================================================================
 
-SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
-                                                                       SMESH::SMESH_Gen_var gen,
+SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget             * parent,
+                                                                       SMESH::SMESH_Gen_var  gen,
                                                                        SMESH::SMESH_Mesh_var mesh,
                                                                        GEOM::GEOM_Object_var mainShape)
-  : QDialog(parent),
+  : QDialog(parent,
+            Qt::WindowSystemMenuHint |
+            Qt::WindowCloseButtonHint |
+            Qt::Dialog |
+            Qt::WindowMaximizeButtonHint),
     qthread(gen, mesh, mainShape)
 {
   // --
   setWindowTitle(tr("Compute"));
+  setMinimumWidth( 200 );
+
   cancelButton = new QPushButton(tr("Cancel"));
   cancelButton->setDefault(true);
+
+  QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
+  QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this );
+  nbNodesLabel = new QLabel("0", this );
+  nbElemsLabel = new QLabel("0", this );
+
+  QGridLayout* layout = new QGridLayout(this);
+  layout->setMargin( MARGIN );
+  layout->setSpacing( SPACING );
+  layout->addWidget(nbNodesName,  0, 0);
+  layout->addWidget(nbNodesLabel, 0, 1);
+  layout->addWidget(nbElemsName,  1, 0);
+  layout->addWidget(nbElemsLabel, 1, 1);
+  layout->addWidget(cancelButton, 2, 0, 1, 2);
+  adjustSize();
+  update();
+
   connect(cancelButton, SIGNAL(clicked()), this, SLOT(onCancel()));
-  QHBoxLayout *layout = new QHBoxLayout;
-  layout->addWidget(cancelButton);
-  setLayout(layout);
-  resize(200, 50);
   // --
-  startTimer(30); // 30 millisecs
+  startTimer(300); // millisecs
   qthread.start();
 }
 
@@ -749,6 +777,8 @@ void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
     {
       close();
     }
+  nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() ));
+  nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() ));
   event->accept();
 }
 
@@ -1094,20 +1124,22 @@ void SMESHGUI_BaseComputeOp::onPublishShape()
   foreach ( row, rows )
   {
     int curSub = table()->item(row, COL_SHAPEID)->text().toInt();
-    GEOM::GEOM_Object_var shape = SMESH::getSubShape( curSub, myMainShape );
+    GEOM::GEOM_Object_wrap shape = SMESH::getSubShape( curSub, myMainShape );
     if ( !shape->_is_nil() && ! SMESH::getSubShapeSO( curSub, myMainShape ))
     {
       if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published
       {
         QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" ));
-        SALOMEDS::SObject_var so =
+        SALOMEDS::SObject_wrap so =
           geomGen->AddInStudy( study, myMainShape, name.toLatin1().data(), GEOM::GEOM_Object::_nil());
         // look for myMainShape in the table
         for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) {
           if ( table()->item( r, COL_SHAPEID )->text() == "1" ) {
             if ( so->_is_nil() ) {
-              table()->item( r, COL_SHAPE )->setText( so->GetName() );
-              table()->item( r, COL_PUBLISHED )->setText( so->GetID() );
+              CORBA::String_var name  = so->GetName();
+              CORBA::String_var entry = so->GetID();
+              table()->item( r, COL_SHAPE     )->setText( name.in() );
+              table()->item( r, COL_PUBLISHED )->setText( entry.in() );
             }
             break;
           }
@@ -1115,10 +1147,12 @@ void SMESHGUI_BaseComputeOp::onPublishShape()
         if ( curSub == 1 ) continue;
       }
       QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" ));
-      SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape);
+      SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape);
       if ( !so->_is_nil() ) {
-        table()->item( row, COL_SHAPE )->setText( so->GetName() );
-        table()->item( row, COL_PUBLISHED )->setText( so->GetID() );
+        CORBA::String_var name  = so->GetName();
+        CORBA::String_var entry = so->GetID();
+        table()->item( row, COL_SHAPE     )->setText( name.in() );
+        table()->item( row, COL_PUBLISHED )->setText( entry.in() );
       }
     }
   }
index 49aa2477c77ba31127699f7d1c66e54abd1565cd..c01dad073f27301c0fbb49990f60beb425aa9242 100644 (file)
@@ -271,20 +271,21 @@ class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
   Q_OBJECT
     
 public:
-  SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
+  SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var  gen,
                               SMESH::SMESH_Mesh_var mesh,
                               GEOM::GEOM_Object_var mainShape);
-  bool result();
-  void cancel();
-  
+  bool                   result();
+  void                   cancel();
+  SMESH::SMESH_Mesh_var& getMesh() { return myMesh; }
+
 protected:
   void run();
   
 private:
-  SMESH::SMESH_Gen_var myGen;
+  SMESH::SMESH_Gen_var  myGen;
   SMESH::SMESH_Mesh_var myMesh;
   GEOM::GEOM_Object_var myMainShape;
-  bool myResult;
+  bool                  myResult;
 };
 
 /*!
@@ -296,8 +297,8 @@ class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
   Q_OBJECT
     
 public:
-  SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *parent,
-                                     SMESH::SMESH_Gen_var gen,
+  SMESHGUI_ComputeDlg_QThreadQDialog(QWidget *             parent,
+                                     SMESH::SMESH_Gen_var  gen,
                                      SMESH::SMESH_Mesh_var mesh,
                                      GEOM::GEOM_Object_var mainShape);
   bool result();
@@ -311,8 +312,9 @@ private slots:
   
 private:
   SMESHGUI_ComputeDlg_QThread qthread;
-  QPushButton *cancelButton;
-  
+  QPushButton *               cancelButton;
+  QLabel *                    nbNodesLabel;
+  QLabel *                    nbElemsLabel;
 };
 
 #endif // SMESHGUI_COMPUTEDLG_H
index ead9da3c0ab7d7c1739c680adcba9aac1e6f6120..c0daa7005752fa172fcdf34e86eabd647ad63b96 100644 (file)
@@ -30,6 +30,7 @@
 
 // SALOME GEOM includes
 #include <GeometryGUI.h>
+#include <GEOM_wrap.hxx>
 
 // SALOME KERNEL includes
 #include <SALOMEDS_SObject.hxx>
@@ -114,10 +115,11 @@ namespace SMESH
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
     if (!aStudy || geomGen->_is_nil())
       return GEOM::GEOM_Object::_nil();
-    GEOM::GEOM_IShapesOperations_var aShapesOp = geomGen->GetIShapesOperations(aStudy->StudyId());
+    GEOM::GEOM_IShapesOperations_wrap aShapesOp =
+      geomGen->GetIShapesOperations(aStudy->StudyId());
     if (aShapesOp->_is_nil())
       return GEOM::GEOM_Object::_nil();
-    GEOM::GEOM_Object_var subShape = aShapesOp->GetSubShape (theMainShape,theID);
+    GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape (theMainShape,theID);
     return subShape._retn();
   }
 } // end of namespace SMESH
index f6d02c232a452648b4efcad933a2488a07b0b51a..03ebc273151c28875f28c9e3f5530e38c877ec56 100644 (file)
@@ -44,6 +44,7 @@
 // SALOME GEOM includes
 #include <GEOMBase.h>
 #include <GEOM_SelectionFilter.h>
+#include <GEOM_wrap.hxx>
 
 // SALOME GUI includes
 #include <QtxColorButton.h>
@@ -1033,8 +1034,6 @@ bool SMESHGUI_GroupDlg::onApply()
         return false;
 
       _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-      GEOM::GEOM_IGroupOperations_var aGroupOp =
-        SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
 
       if (myGeomObjects->length() == 1) {
         myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
@@ -1053,8 +1052,7 @@ bool SMESHGUI_GroupDlg::onApply()
         if (geomGen->_is_nil() || !aStudy)
           return false;
 
-        GEOM::GEOM_IGroupOperations_var op =
-          geomGen->GetIGroupOperations(aStudy->StudyId());
+        GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
         if (op->_is_nil())
           return false;
 
@@ -1071,8 +1069,8 @@ bool SMESHGUI_GroupDlg::onApply()
           }
         }
 
-        GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
-        GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
+        GEOM::GEOM_Object_var  aMeshShape = myMesh->GetShapeToMesh();
+        GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
         op->UnionList(aGroupVar, myGeomObjects);
 
         if (op->IsDone()) {
@@ -1373,15 +1371,19 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
 
         // Check if group constructed on the same shape as a mesh or on its child
         _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-        GEOM::GEOM_IGroupOperations_var anOp =
-          SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
 
         // The main shape of the group
         GEOM::GEOM_Object_var aGroupMainShape;
-        if (aGeomGroup->GetType() == 37)
+        if (aGeomGroup->GetType() == 37) {
+          GEOM::GEOM_IGroupOperations_wrap anOp =
+            SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
           aGroupMainShape = anOp->GetMainShape(aGeomGroup);
-        else
-          aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
+          // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
+        }
+        else {
+          aGroupMainShape = aGeomGroup;
+          aGroupMainShape->Register();
+        }
         _PTR(SObject) aGroupMainShapeSO =
           aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
 
@@ -1951,7 +1953,7 @@ void SMESHGUI_GroupDlg::onAdd()
 
   } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-    GEOM::GEOM_IGroupOperations_var aGroupOp =
+    GEOM::GEOM_IGroupOperations_wrap aGroupOp =
       SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
 
     SMESH::ElementType aGroupType = SMESH::ALL;
index f4cde4f1b1c3c2323cd9a07ece977c49dbab32ac..c31a07c449810fb5e3026b632a83119023b997f6 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <GeometryGUI.h>
 #include <GEOM_SelectionFilter.h>
+#include <GEOM_wrap.hxx>
 
 #include <SUIT_Session.h>
 #include <SUIT_OverrideCursor.h>
@@ -204,7 +205,7 @@ LightApp_Dialog* SMESHGUI_GroupOnShapeOp::dlg() const
  */
 //================================================================================
 
-static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
+static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
 {
   if ( !geom->_is_nil() ) {
     switch ( geom->GetShapeType() ) {
@@ -219,17 +220,18 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
     default:             return SMESH::ALL;
     }
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-    GEOM::GEOM_IShapesOperations_var aShapeOp =
+    GEOM::GEOM_IShapesOperations_wrap aShapeOp =
       SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
 
     if ( geom->GetType() == 37 ) { // geom group
-      GEOM::GEOM_IGroupOperations_var  aGroupOp =
+      GEOM::GEOM_IGroupOperations_wrap aGroupOp =
         SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
       if ( !aGroupOp->_is_nil() ) {
+        // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
         GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
         GEOM::ListOfLong_var        ids = aGroupOp->GetObjects( geom );
         if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
-          GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( mainShape, ids[0] );
+          GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );
           return elementType( member );
         }
       }
@@ -237,7 +239,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
     else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
       GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
       if ( ids->length() ) {
-        GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( geom, ids[0] );
+        GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
         return elementType( member );
       }
     }
@@ -489,13 +491,13 @@ void SMESHGUI_GroupOnShapeOp::selectionDone()
     }
   }
 
-  if ( myDlg->myElemGeomBtn->isChecked() ) // elem geomerty selection
+  if ( myDlg->myElemGeomBtn->isChecked() ) // elem geometry selection
   {
     myDlg->myElemGeomList->clear();
     myDlg->myElemGeomList->addItems( goodNames );
     myElemGeoIDs = goodIds;
   }
-  else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geomerty selection
+  else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geometry selection
   {
     myDlg->myNodeGeomList->clear();
     myDlg->myNodeGeomList->addItems( goodNames );
index 7b10c0ff54d7e2c27b6e53bca2f5bee714af5820..e2852230cff51eafbe17fe338bf0b30277c85717 100644 (file)
 #define SPACING 6
 #define MARGIN  11
 
-//To disable automatic genericobj management, the following line should be commented.
-//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
-#define WITHGENERICOBJ
-
 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
-  : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
+  : myToDeleteInitParamsHypo( false ),
+    myHypType( theHypType ),
+    myIsCreate( false ),
+    myDlg( 0 )
 {
 }
 
 SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
 {
+  if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
+    myInitParamsHypo->UnRegister();
 }
 
 void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
 {
-  if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
-    myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
+  if ( !CORBA::is_nil( hyp ) ) {
+    if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
+      myInitParamsHypo->UnRegister();
+    CORBA::String_var hypName = hyp->GetName();
+    if ( hypType() == hypName.in() )
+    {
+      myInitParamsHypo         = SMESH::SMESH_Hypothesis::_duplicate( hyp );
+      myToDeleteInitParamsHypo = !SMESH::FindSObject( myInitParamsHypo );
+    }
+  }
 }
 
 void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
@@ -91,19 +100,15 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
   if (isAlgo) {
     SMESH::SMESH_Hypothesis_var anAlgo =
       SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
-#ifdef WITHGENERICOBJ
     if (!CORBA::is_nil(anAlgo))
       anAlgo->UnRegister();
-#endif
   }
   else {
     SMESH::SMESH_Hypothesis_var aHypothesis =
       SMESH::CreateHypothesis( hypType(), theHypName, false );
     editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
-#ifdef WITHGENERICOBJ
     if (!CORBA::is_nil(aHypothesis))
       aHypothesis->UnRegister();
-#endif
   }
 }
 
@@ -128,9 +133,7 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
 {
   myHypName = theHypName;
   myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
-#ifdef WITHGENERICOBJ
   myHypo->Register();
-#endif
 
   SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
   connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
@@ -302,9 +305,7 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
       }
   }
   SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
-#ifdef WITHGENERICOBJ
   myHypo->UnRegister();
-#endif
   myHypo = SMESH::SMESH_Hypothesis::_nil();
   myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
 
index bb5d9f8ac01c5e4d86aa97a1216cfe53e8f99d9d..22fc991f2e012238bc71bda3f119b61ee145fa43 100644 (file)
@@ -130,6 +130,7 @@ private:
 
 private:
   SMESH::SMESH_Hypothesis_var  myHypo, myInitParamsHypo;
+  bool                         myToDeleteInitParamsHypo;
   QString                      myHypName;
   QString                      myHypType;
   ListOfWidgets                myParamWidgets;
index 2c5d1828c0d7b0081216aa87557eab4dcc60d56c..b52f7308e83f86ff1b7e8e002882c836dc1d9b38 100644 (file)
@@ -612,23 +612,21 @@ namespace SMESH
     return res < SMESH::HYP_UNKNOWN_FATAL;
   }
 
-  bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
+  bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject)               MorSM,
                                           SMESH::SMESH_Hypothesis_ptr anHyp)
   {
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeIOR_var anIOR;
     int res = SMESH::HYP_UNKNOWN_FATAL;
     SUIT_OverrideCursor wc;
 
     if (MorSM) {
       try {
         GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
-        SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
-        SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-        
+        SMESH::SMESH_Mesh_var aMesh        = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+        SMESH::SMESH_subMesh_var aSubMesh  = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
         if (!aSubMesh->_is_nil())
           aMesh = aSubMesh->GetFather();
-        
+
         if (!aMesh->_is_nil()) {    
           if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
             res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
index 877d6b6d42f7869a2ad1bdfd71fedf115319c790..b1345a00afab7ff775757823ed5e22c6c82bda0b 100644 (file)
@@ -670,7 +670,7 @@ bool SMESHGUI_MergeDlg::ClickOnApply()
       aMeshEditor->MergeElements (aGroupsOfElements.inout());
 
     if ( myTypeId == 0 ) {
-      if (myAction ==0)
+      if (myAction == 0 )
         SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INFORMATION"),
                                      tr("SMESH_MERGED_NODES").arg(QString::number(ListCoincident->count()).toLatin1().data()));
       else
index 3b90ce6d6f63c2368028d79a10d06011fbed40bf..98761c13382ee44bfc0f7e1c73bc7bf659347500 100644 (file)
 #include "SMDS_BallElement.hxx"
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_FacePosition.hxx"
+#include "SMESHDS_Mesh.hxx"
 #include "SMESH_ControlsDef.hxx"
 
 #include <LightApp_SelectionMgr.h>
+#include <SUIT_FileDlg.h>
 #include <SUIT_OverrideCursor.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
 #include <SVTK_ViewWindow.h>
 
 #include <SALOMEDSClient_Study.hxx>
+#include <SalomeApp_Study.h>
 
 #include <QApplication>
 #include <QButtonGroup>
+#include <QCheckBox>
+#include <QContextMenuEvent>
 #include <QGridLayout>
 #include <QHBoxLayout>
 #include <QHeaderView>
 #include <QKeyEvent>
 #include <QLabel>
 #include <QLineEdit>
+#include <QMenu>
 #include <QPushButton>
 #include <QRadioButton>
+#include <QTextStream>
 #include <QTabWidget>
 #include <QTextBrowser>
 #include <QVBoxLayout>
@@ -68,6 +76,17 @@ const int MARGIN       = 9;
 const int MAXITEMS     = 10;
 const int GROUPS_ID    = 100;
 const int SUBMESHES_ID = 200;
+const int SPACING_INFO = 2;
+
+enum InfoRole {
+  TypeRole = Qt::UserRole + 10,
+  IdRole,
+};
+
+enum InfoType {
+  NodeConnectivity = 100,
+  ElemConnectivity,
+};
 
 /*!
   \class ExtraWidget
@@ -117,6 +136,68 @@ void ExtraWidget::updateControls( int total, int index, int blockSize )
   next->setEnabled( (index+1)*blockSize < total );
 }
 
+/*!
+  \class DumpFileDlg
+  \brief Customization of standard "Save file" dialog box for dump info operation
+  \internal
+*/
+
+class DumpFileDlg : public SUIT_FileDlg
+{
+public:
+  DumpFileDlg( QWidget* parent );
+
+  QCheckBox* myBaseChk;
+  QCheckBox* myElemChk;
+  QCheckBox* myAddChk;
+};
+
+/*!
+  \brief Constructor
+  \internal
+*/
+DumpFileDlg::DumpFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true, true )
+{
+  QGridLayout* grid = ::qobject_cast<QGridLayout *>( layout() );
+  if ( grid ) {
+    QWidget* hB = new QWidget( this );
+    myBaseChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_BASE_INFO" ), hB );
+    myElemChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_ELEM_INFO" ), hB );
+    myAddChk  = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_ADD_INFO" ),  hB );
+
+    QHBoxLayout* layout = new QHBoxLayout( hB );
+    layout->addWidget( myBaseChk );
+    layout->addWidget( myElemChk );
+    layout->addWidget( myAddChk );
+
+    QPushButton* pb = new QPushButton( this );
+
+    int row = grid->rowCount();
+    grid->addWidget( new QLabel( "", this ), row, 0 );
+    grid->addWidget( hB, row, 1, 1, 3 );
+    grid->addWidget( pb, row, 5 );
+
+    pb->hide();
+  }
+}
+
+/*!
+  \brief Get depth of the tree item
+  \internal
+  \param theItem tree widget item
+  \return item's depth in tree widget (where top-level items have zero depth)
+*/
+static int itemDepth( QTreeWidgetItem* item )
+{
+  int d = 0;
+  QTreeWidgetItem* p = item->parent();
+  while ( p ) {
+    d++;
+    p = p->parent();
+  }
+  return d;
+}
+
 /*!
   \class SMESHGUI_MeshInfo
   \brief Base mesh information widget
@@ -165,6 +246,14 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
   myWidgets[ index++ ] << aElemLine;
   myWidgets[ index++ ] << aElemLab << aElemTotal << aElemLin << aElemQuad;
 
+  // ... Number elements
+  QWidget* aNbLine     = createLine(); 
+  QLabel*  aNbTotal    = createField();
+  QLabel*  aNbLin      = createField();
+  QLabel*  aNbQuad     = createField();
+  myWidgets[ index++ ] << aNbLine;
+  myWidgets[ index++ ] << new QLabel( "", this ) << aNbTotal << aNbLin << aNbQuad;
+
   // ... 0D elements
   QWidget* a0DLine     = createLine();
   QLabel*  a0DLab      = new QLabel( tr( "0D_LAB" ), this );
@@ -274,58 +363,63 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
   l->addWidget( aElemTotal,   5, 1 );
   l->addWidget( aElemLin,     5, 2 );
   l->addWidget( aElemQuad,    5, 3 );
-  l->addWidget( a0DLine,      6, 1, 1, 3 );
-  l->addWidget( a0DLab,       7, 0 );
-  l->addWidget( a0DTotal,     7, 1 );
-  l->addWidget( aBallLine,    8, 1, 1, 3 );
-  l->addWidget( aBallLab,     9, 0 );
-  l->addWidget( aBallTotal,   9, 1 );
-  l->addWidget( a1DLine,      10, 1, 1, 3 );
-  l->addWidget( a1DLab,       11, 0 );
-  l->addWidget( a1DTotal,     11, 1 );
-  l->addWidget( a1DLin,       11, 2 );
-  l->addWidget( a1DQuad,      11, 3 );
-  l->addWidget( a2DLine,     12, 1, 1, 3 );
-  l->addWidget( a2DLab,      13, 0 );
-  l->addWidget( a2DTotal,    13, 1 );
-  l->addWidget( a2DLin,      13, 2 );
-  l->addWidget( a2DQuad,     13, 3 );
-  l->addWidget( a2DTriLab,   14, 0 );
-  l->addWidget( a2DTriTotal, 14, 1 );
-  l->addWidget( a2DTriLin,   14, 2 );
-  l->addWidget( a2DTriQuad,  14, 3 );
-  l->addWidget( a2DQuaLab,   15, 0 );
-  l->addWidget( a2DQuaTotal, 15, 1 );
-  l->addWidget( a2DQuaLin,   15, 2 );
-  l->addWidget( a2DQuaQuad,  15, 3 );
-  l->addWidget( a2DPolLab,   16, 0 );
-  l->addWidget( a2DPolTotal, 16, 1 );
-  l->addWidget( a3DLine,     17, 1, 1, 3 );
-  l->addWidget( a3DLab,      18, 0 );
-  l->addWidget( a3DTotal,    18, 1 );
-  l->addWidget( a3DLin,      18, 2 );
-  l->addWidget( a3DQuad,     18, 3 );
-  l->addWidget( a3DTetLab,   19, 0 );
-  l->addWidget( a3DTetTotal, 19, 1 );
-  l->addWidget( a3DTetLin,   19, 2 );
-  l->addWidget( a3DTetQuad,  19, 3 );
-  l->addWidget( a3DHexLab,   20, 0 );
-  l->addWidget( a3DHexTotal, 20, 1 );
-  l->addWidget( a3DHexLin,   20, 2 );
-  l->addWidget( a3DHexQuad,  20, 3 );
-  l->addWidget( a3DPyrLab,   21, 0 );
-  l->addWidget( a3DPyrTotal, 21, 1 );
-  l->addWidget( a3DPyrLin,   21, 2 );
-  l->addWidget( a3DPyrQuad,  21, 3 );
-  l->addWidget( a3DPriLab,   22, 0 );
-  l->addWidget( a3DPriTotal, 22, 1 );
-  l->addWidget( a3DPriLin,   22, 2 );
-  l->addWidget( a3DPriQuad,  22, 3 );
-  l->addWidget( a3DHexPriLab,   23, 0 );
-  l->addWidget( a3DHexPriTotal, 23, 1 );
-  l->addWidget( a3DPolLab,   24, 0 );
-  l->addWidget( a3DPolTotal, 24, 1 );
-  l->addWidget( myLoadBtn,   25, 1, 1, 3 );
+  l->addWidget( aNbLine,      6, 1, 1, 3 );
+  l->addWidget( aNbTotal,     7, 1 );
+  l->addWidget( aNbLin,       7, 2 );
+  l->addWidget( aNbQuad,      7, 3 );
+  l->addWidget( a0DLine,      8, 1, 1, 3 );
+  l->addWidget( a0DLab,       9, 0 );
+  l->addWidget( a0DTotal,     9, 1 );
+  l->addWidget( aBallLine,    10, 1, 1, 3 );
+  l->addWidget( aBallLab,     11, 0 );
+  l->addWidget( aBallTotal,   11, 1 );
+  l->addWidget( a1DLine,      12, 1, 1, 3 );
+  l->addWidget( a1DLab,       13, 0 );
+  l->addWidget( a1DTotal,     13, 1 );
+  l->addWidget( a1DLin,       13, 2 );
+  l->addWidget( a1DQuad,      13, 3 );
+  l->addWidget( a2DLine,     14, 1, 1, 3 );
+  l->addWidget( a2DLab,      15, 0 );
+  l->addWidget( a2DTotal,    15, 1 );
+  l->addWidget( a2DLin,      15, 2 );
+  l->addWidget( a2DQuad,     15, 3 );
+  l->addWidget( a2DTriLab,   16, 0 );
+  l->addWidget( a2DTriTotal, 16, 1 );
+  l->addWidget( a2DTriLin,   16, 2 );
+  l->addWidget( a2DTriQuad,  16, 3 );
+  l->addWidget( a2DQuaLab,   17, 0 );
+  l->addWidget( a2DQuaTotal, 17, 1 );
+  l->addWidget( a2DQuaLin,   17, 2 );
+  l->addWidget( a2DQuaQuad,  17, 3 );
+  l->addWidget( a2DPolLab,   18, 0 );
+  l->addWidget( a2DPolTotal, 18, 1 );
+  l->addWidget( a3DLine,     19, 1, 1, 3 );
+  l->addWidget( a3DLab,      20, 0 );
+  l->addWidget( a3DTotal,    20, 1 );
+  l->addWidget( a3DLin,      20, 2 );
+  l->addWidget( a3DQuad,     20, 3 );
+  l->addWidget( a3DTetLab,   21, 0 );
+  l->addWidget( a3DTetTotal, 21, 1 );
+  l->addWidget( a3DTetLin,   21, 2 );
+  l->addWidget( a3DTetQuad,  21, 3 );
+  l->addWidget( a3DHexLab,   22, 0 );
+  l->addWidget( a3DHexTotal, 22, 1 );
+  l->addWidget( a3DHexLin,   22, 2 );
+  l->addWidget( a3DHexQuad,  22, 3 );
+  l->addWidget( a3DPyrLab,   23, 0 );
+  l->addWidget( a3DPyrTotal, 23, 1 );
+  l->addWidget( a3DPyrLin,   23, 2 );
+  l->addWidget( a3DPyrQuad,  23, 3 );
+  l->addWidget( a3DPriLab,   24, 0 );
+  l->addWidget( a3DPriTotal, 24, 1 );
+  l->addWidget( a3DPriLin,   24, 2 );
+  l->addWidget( a3DPriQuad,  24, 3 );
+  l->addWidget( a3DHexPriLab,   25, 0 );
+  l->addWidget( a3DHexPriTotal, 25, 1 );
+  l->addWidget( a3DPolLab,   26, 0 );
+  l->addWidget( a3DPolTotal, 26, 1 ); 
+  l->addWidget( myLoadBtn,   27, 1, 1, 3 );
+
   l->setColumnStretch( 0, 0 );
   l->setColumnStretch( 1, 5 );
   l->setColumnStretch( 2, 5 );
@@ -434,7 +528,12 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
     myWidgets[i3DPrisms][iQuadratic]      ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Penta] ) );
     myWidgets[i3DHexaPrisms][iTotal]      ->setProperty( "text", QString::number( info[SMDSEntity_Hexagonal_Prism] ) );
     myWidgets[i3DPolyhedrons][iTotal]     ->setProperty( "text", QString::number( info[SMDSEntity_Polyhedra] ) );
-
+    long nbElemTotal     = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DLinear + nb2DQuadratic + nb3DLinear + nb3DQuadratic;
+    long nbElemLinerial  = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear;
+    long nbElemQuadratic = info[SMDSEntity_Quad_Edge] + nb2DQuadratic + nb3DQuadratic;
+    myWidgets[iNb][iTotal]    ->setProperty( "text", QString::number( nbElemTotal ) );
+    myWidgets[iNb][iLinear]   ->setProperty( "text", QString::number( nbElemLinerial ) );
+    myWidgets[iNb][iQuadratic]->setProperty( "text", QString::number( nbElemQuadratic ) );
     // before full loading from study file, type of elements in a sub-mesh can't be defined
     // in some cases
     bool infoOK = obj->IsMeshInfoCorrect();
@@ -460,6 +559,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
           myWidgets[i2DQuadrangles][iLinear]   ->setProperty( "text", "?" );
           myWidgets[i2DQuadrangles][iQuadratic]->setProperty( "text", "?" );
           myWidgets[i2DPolygons][iTotal]       ->setProperty( "text", "?" );
+          myWidgets[iNb][iTotal]               ->setProperty( "text", "?" );
+          myWidgets[iNb][iLinear]              ->setProperty( "text", "?" );
+          myWidgets[iNb][iQuadratic]           ->setProperty( "text", "?" );
         }
         else if ( nb3DLinear + nb3DQuadratic > 0 )
         {
@@ -479,6 +581,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
           myWidgets[i3DPrisms][iQuadratic]      ->setProperty( "text", "?" );
           myWidgets[i3DHexaPrisms][iTotal]      ->setProperty( "text", "?" );
           myWidgets[i3DPolyhedrons][iTotal]     ->setProperty( "text", "?" );
+          myWidgets[iNb][iTotal]                ->setProperty( "text", "?" );
+          myWidgets[iNb][iLinear]               ->setProperty( "text", "?" );
+          myWidgets[iNb][iQuadratic]            ->setProperty( "text", "?" );
         }
       }
       else
@@ -516,6 +621,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
         myWidgets[i3DPrisms][iQuadratic]      ->setProperty( "text", "?" );
         myWidgets[i3DHexaPrisms][iTotal]      ->setProperty( "text", "?" );
         myWidgets[i3DPolyhedrons][iTotal]     ->setProperty( "text", "?" );
+        myWidgets[iNb][iTotal]                ->setProperty( "text", "?" );
+        myWidgets[iNb][iLinear]               ->setProperty( "text", "?" );
+        myWidgets[iNb][iQuadratic]            ->setProperty( "text", "?" );
       }
     }
   }
@@ -585,6 +693,9 @@ void SMESHGUI_MeshInfo::clear()
   myWidgets[i3DPrisms][iQuadratic]      ->setProperty( "text", QString::number( 0 ) );
   myWidgets[i3DHexaPrisms][iTotal]      ->setProperty( "text", QString::number( 0 ) );
   myWidgets[i3DPolyhedrons][iTotal]     ->setProperty( "text", QString::number( 0 ) );
+  myWidgets[iNb][iTotal]                ->setProperty( "text", QString::number( 0 ) );
+  myWidgets[iNb][iLinear]               ->setProperty( "text", QString::number( 0 ) );
+  myWidgets[iNb][iQuadratic]            ->setProperty( "text", QString::number( 0 ) );
 }
 
 /*!
@@ -647,6 +758,66 @@ void SMESHGUI_MeshInfo::setFieldsVisible( int start, int end, bool on )
   }
 }
 
+void SMESHGUI_MeshInfo::saveInfo( QTextStream &out )
+{
+  out << QString( 9, '-' ) << "\n";
+  out << tr( "BASE_INFO" ) << "\n";
+  out << QString( 9, '-' ) << "\n";
+  out <<                                   tr( "NAME_LAB" )         << "  " << ( myWidgets[iName][iSingle]->property( "text" ) ).toString() << "\n";
+  out <<                                   tr( "OBJECT_LAB" )       << "  " << ( myWidgets[iObject][iSingle]->property( "text" ) ).toString() << "\n";
+  out <<                                   tr( "NODES_LAB" )        << "  " << ( myWidgets[iNodes][iTotal]->property( "text" ) ).toString() << "\n";
+  out <<                                   tr( "ELEMENTS_LAB" )     << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[iNb][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[iNb][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[iNb][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "0D_LAB" )           << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i0D][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "BALL_LAB" )         << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[iBalls][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "1D_LAB" )           << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i1D][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i1D][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i1D][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "2D_LAB" )           << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i2D][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i2D][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i2D][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TRIANGLES_LAB" )    << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i2DTriangles][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i2DTriangles][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i2DTriangles][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRANGLES_LAB" )  << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i2DQuadrangles][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i2DQuadrangles][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i2DQuadrangles][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "POLYGONS_LAB" )     << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i2DPolygons][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO,   ' ' ) << tr( "3D_LAB" )           << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3D][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i3D][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i3D][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "TETRAHEDRONS_LAB" ) << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3DTetrahedrons][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i3DTetrahedrons][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i3DTetrahedrons][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "HEXAHEDONRS_LAB" )  << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3DHexahedrons][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i3DHexahedrons][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i3DHexahedrons][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "PYRAMIDS_LAB" )     << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3DPyramids][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i3DPyramids][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i3DPyramids][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "PRISMS_LAB" )       << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3DPrisms][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "LINEAR_LAB" )       << ": " << ( myWidgets[i3DPrisms][iLinear]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "QUADRATIC_LAB" )    << ": " << ( myWidgets[i3DPrisms][iQuadratic]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "HEX_PRISMS_LAB" )   << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3DHexaPrisms][iTotal]->property( "text" ) ).toString() << "\n";
+  out << QString( SPACING_INFO*2, ' ' ) << tr( "POLYHEDRONS_LAB" )  << "\n";
+  out << QString( SPACING_INFO*3, ' ' ) << tr( "TOTAL_LAB" )        << ": " << ( myWidgets[i3DPolyhedrons][iTotal]->property( "text" ) ).toString() << "\n" << "\n";
+}
+
 /*!
   \class SMESHGUI_ElemInfo
   \brief Base class for the mesh element information widget.
@@ -886,7 +1057,8 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
   clearInternal();
   
   if ( actor() ) {
-    int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
+    int grp_details = SMESHGUI::resourceMgr()->booleanValue( "SMESH", "elem_info_grp_details", false );
+    int precision   = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
     int cprecision = -1;
     if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) ) 
       cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
@@ -899,11 +1071,11 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
         if ( !node ) return;
 
         // node ID
-        myInfo->append( QString( "<b>%1 #%2</b>" ).arg( tr( "NODE" ) ).arg( id ) );
+        myInfo->append( QString( "<b>%1 #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( id ) );
         // separator
         myInfo->append( "" );
         // coordinates
-        myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "COORDINATES" ) ).
+        myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "COORDINATES" ) ).
                         arg( node->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
                         arg( node->Y(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
                         arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
@@ -912,25 +1084,120 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
         // connectivity
         Connectivity connectivity = nodeConnectivity( node );
         if ( !connectivity.isEmpty() ) {
-          myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONNECTIVITY" ) ) );
+          myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) ) );
           QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
           if ( !con.isEmpty() )
-            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "0D_ELEMENTS" ) ).arg( con ) );
+            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) ).arg( con ) );
           con = formatConnectivity( connectivity, SMDSAbs_Edge );
           if ( !con.isEmpty() )
-            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "EDGES" ) ).arg( con ) );
+            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "EDGES" ) ).arg( con ) );
           con = formatConnectivity( connectivity, SMDSAbs_Ball );
           if ( !con.isEmpty() )
-            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "BALL_ELEMENTS" ) ).arg( con ) );
+            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) ).arg( con ) );
           con = formatConnectivity( connectivity, SMDSAbs_Face );
           if ( !con.isEmpty() )
-            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "FACES" ) ).arg( con ) );
+            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "FACES" ) ).arg( con ) );
           con = formatConnectivity( connectivity, SMDSAbs_Volume );
           if ( !con.isEmpty() )
-            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUMES" ) ).arg( con ) );
+            myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "VOLUMES" ) ).arg( con ) );
         }
         else {
-          myInfo->append( QString( "<b>%1</b>" ).arg( tr( "FREE_NODE" ) ).arg( id ) );
+          myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" ) ).arg( id ) );
+        }
+        // node position
+        SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();   
+        if ( !CORBA::is_nil( aMeshPtr ) ) {
+          SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id );
+          int shapeID = pos->shapeID;
+          if ( shapeID > 0 ) {
+            QString shapeType;
+            double u, v;
+            switch ( pos->shapeType ) {
+            case GEOM::EDGE:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );
+              if ( pos->params.length() == 1 )
+                u = pos->params[0];
+              break;
+            case GEOM::FACE:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
+              if ( pos->params.length() == 2 ) {
+               u = pos->params[0];
+               v = pos->params[1];
+              }
+              break;
+            case GEOM::VERTEX:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" );
+              break;
+            default:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
+              break;
+            }
+            // separator
+            myInfo->append( "" );
+            myInfo->append( QString( "<b>%1:" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ) );
+            myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( shapeType ).arg( shapeID ) );
+            if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) {
+              myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "U_POSITION" ) ).
+                              arg( QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )) ) );
+              if ( pos->shapeType == GEOM::FACE ) {
+                myInfo->append( QString( "- <b>%1: #%2</b>" ).arg( SMESHGUI_ElemInfo::tr( "V_POSITION" ) ).
+                                arg( QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )) ) );
+              }
+            }
+          }
+        }
+        // groups node belongs to
+        SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
+        if ( !CORBA::is_nil( aMesh ) ) {
+          SMESH::ListOfGroups_var groups = aMesh->GetGroups();
+          myInfo->append( "" ); // separator
+          bool top_created = false;
+          for ( int i = 0; i < groups->length(); i++ ) {
+            SMESH::SMESH_GroupBase_var aGrp = groups[i];
+            if ( CORBA::is_nil( aGrp ) ) continue;
+            QString aName = aGrp->GetName();
+            if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) {
+              if ( !top_created ) {
+                myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) );
+                top_created = true;
+              }
+              myInfo->append( QString( "+ <b>%1:</b>" ).arg( aName.trimmed() ) );
+              if ( grp_details ) {
+                SMESH::SMESH_Group_var         aStdGroup  = SMESH::SMESH_Group::_narrow( aGrp );
+                SMESH::SMESH_GroupOnGeom_var   aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
+                SMESH::SMESH_GroupOnFilter_var aFltGroup  = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
+                
+                // type : group on geometry, standalone group, group on filter
+                if ( !CORBA::is_nil( aStdGroup ) ) {
+                  myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                  arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) );
+                }
+                else if ( !CORBA::is_nil( aGeomGroup ) ) {
+                  myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                  arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) );
+                  GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
+                  _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
+                  if ( sobj ) {
+                    myInfo->append( QString( "  - <b>%1:</b> %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                    arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) );
+                  }
+                }
+                else if ( !CORBA::is_nil( aFltGroup ) ) {
+                  myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                  arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) );
+                }
+                
+                // size
+                myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ).
+                                arg( QString::number( aGrp->Size() ) ) );
+                
+                // color
+                SALOMEDS::Color color = aGrp->GetColor();
+                myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ).
+                                arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) );
+              }
+            }
+          }
         }
       }
       else {
@@ -945,15 +1212,15 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
         QString stype;
         switch( e->GetType() ) {
         case SMDSAbs_0DElement:
-          stype = tr( "0D ELEMENT" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break;
         case SMDSAbs_Ball:
-          stype = tr( "BALL" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "BALL" ); break;
         case SMDSAbs_Edge:
-          stype = tr( "EDGE" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break;
         case SMDSAbs_Face:
-          stype = tr( "FACE" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "FACE" ); break;
         case SMDSAbs_Volume:
-          stype = tr( "VOLUME" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break;
         default: 
           break;
         }
@@ -966,50 +1233,50 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
         switch( e->GetEntityType() ) {
         case SMDSEntity_Triangle:
         case SMDSEntity_Quad_Triangle:
-          gtype = tr( "TRIANGLE" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break;
         case SMDSEntity_Quadrangle:
         case SMDSEntity_Quad_Quadrangle:
         case SMDSEntity_BiQuad_Quadrangle:
-          gtype = tr( "QUADRANGLE" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "QUADRANGLE" ); break;
         case SMDSEntity_Polygon:
         case SMDSEntity_Quad_Polygon:
-          gtype = tr( "POLYGON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "POLYGON" ); break;
         case SMDSEntity_Tetra:
         case SMDSEntity_Quad_Tetra:
-          gtype = tr( "TETRAHEDRON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "TETRAHEDRON" ); break;
         case SMDSEntity_Pyramid:
         case SMDSEntity_Quad_Pyramid:
-          gtype = tr( "PYRAMID" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "PYRAMID" ); break;
         case SMDSEntity_Hexa:
         case SMDSEntity_Quad_Hexa:
         case SMDSEntity_TriQuad_Hexa:
-          gtype = tr( "HEXAHEDRON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "HEXAHEDRON" ); break;
         case SMDSEntity_Penta:
         case SMDSEntity_Quad_Penta:
-          gtype = tr( "PRISM" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "PRISM" ); break;
         case SMDSEntity_Hexagonal_Prism:
-          gtype = tr( "HEX_PRISM" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "HEX_PRISM" ); break;
         case SMDSEntity_Polyhedra:
         case SMDSEntity_Quad_Polyhedra:
-          gtype = tr( "POLYHEDRON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
         default: 
           break;
         }
         if ( !gtype.isEmpty() )
-          myInfo->append( QString( "<b>%1:</b> %2" ).arg( tr( "TYPE" ) ).arg( gtype ) );
+          myInfo->append( QString( "<b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "TYPE" ) ).arg( gtype ) );
         // quadratic flag and gravity center (any element except 0D)
         if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
           // quadratic flag
-          myInfo->append( QString( "<b>%1?</b> %2" ).arg( tr( "QUADRATIC" ) ).arg( e->IsQuadratic() ? tr( "YES" ) : tr( "NO" ) ) );
+          myInfo->append( QString( "<b>%1?</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "QUADRATIC" ) ).arg( e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ) ) );
           // separator
           myInfo->append( "" );
           // gravity center
           XYZ gc = gravityCenter( e );
-          myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "GRAVITY_CENTER" ) ).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ) );
+          myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) ).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ) );
         }
         if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
           // ball diameter
-          myInfo->append( QString( "<b>%1:</b> %2" ).arg( tr( "BALL_DIAMETER" ) ).arg( ball->GetDiameter() ));
+          myInfo->append( QString( "<b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ) ).arg( ball->GetDiameter() ));
         }
         // separator
         myInfo->append( "" );
@@ -1018,37 +1285,37 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
         for ( int idx = 1; nodeIt->more(); idx++ ) {
           const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
           // node number and ID
-          myInfo->append( QString( "<b>%1 %2/%3</b> - #%4" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ).arg( node->GetID() ) );
+          myInfo->append( QString( "<b>%1 %2/%3</b> - #%4" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ).arg( node->GetID() ) );
           // node coordinates
-          myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "COORDINATES" ) ).
+          myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "COORDINATES" ) ).
                           arg( node->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
                           arg( node->Y(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
                           arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
           // node connectivity
           Connectivity connectivity = nodeConnectivity( node );
           if ( !connectivity.isEmpty() ) {
-            myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONNECTIVITY" ) ) );
+            myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) ) );
             QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
             if ( !con.isEmpty() )
-              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "0D_ELEMENTS" ) ).arg( con ) );
+              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) ).arg( con ) );
             con = formatConnectivity( connectivity, SMDSAbs_Edge );
             if ( !con.isEmpty() )
-              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "EDGES" ) ).arg( con ) );
+              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "EDGES" ) ).arg( con ) );
             con = formatConnectivity( connectivity, SMDSAbs_Face );
             if ( !con.isEmpty() )
-              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "FACES" ) ).arg( con ) );
+              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "FACES" ) ).arg( con ) );
             con = formatConnectivity( connectivity, SMDSAbs_Volume );
             if ( !con.isEmpty() )
-              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUMES" ) ).arg( con ) );
+              myInfo->append( QString( "- <b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "VOLUMES" ) ).arg( con ) );
           }
           else {
-            myInfo->append( QString( "<b>%1</b>" ).arg( tr( "FREE_NODE" ) ).arg( id ) );
+            myInfo->append( QString( "<b>%1</b>" ).arg( SMESHGUI_ElemInfo::tr( "FREE_NODE" ) ).arg( id ) );
           }
         }
         // separator
         myInfo->append( "" );
         //controls
-        myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "MEN_CTRL" ) ) );
+        myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONTROLS" ) ) );
         //Length
         if ( e->GetType() == SMDSAbs_Edge ) {    
           afunctor.reset( new SMESH::Controls::Length() );
@@ -1066,7 +1333,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
           afunctor.reset( new SMESH::Controls::Taper() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );  
           afunctor->SetPrecision( cprecision );
-          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MEN_TAPER" ) ).arg( afunctor->GetValue( id ) ) );
+          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "TAPER_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
           //AspectRatio2D        
           afunctor.reset( new SMESH::Controls::AspectRatio() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
@@ -1080,12 +1347,12 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
           afunctor.reset( new SMESH::Controls::Warping() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           afunctor->SetPrecision( cprecision );
-          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "STB_WARP" ) ).arg( afunctor->GetValue( id ) ) );
+          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "WARP_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
           //Skew         
           afunctor.reset( new SMESH::Controls::Skew() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           afunctor->SetPrecision( cprecision );
-          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "TOP_SKEW" ) ).arg( afunctor->GetValue( id ) ) );
+          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "SKEW_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
           //ElemDiam2D   
           afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
@@ -1099,30 +1366,85 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
           //Volume      
           afunctor.reset(  new SMESH::Controls::Volume() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
-          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MEN_VOLUME_3D" ) ).arg( afunctor->GetValue( id ) ) );
+          myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUME_3D_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) );
           //ElementDiameter3D    
           afunctor.reset(  new SMESH::Controls::Volume() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) );
         }
-       /*
-        if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
-          // separator
-          myInfo->append( "" );
-          //shapeID
-          int shapeID = e->getshapeId();
-          if ( shapeID > 0 ) {     
-            QString shapeType;
-            switch ( actor()->GetObject()->GetMesh()->FindElement( shapeID )->GetType() ) {
-            case SMDS_TOP_EDGE:   shapeType = tr( "EDGE" ); break;
-            case SMDS_TOP_FACE:   shapeType = tr( "FACE" ); break;
-            case SMDS_TOP_VERTEX: shapeType = tr( "VERTEX" ); break;
-            default:              shapeType = tr( "SOLID" );
-            }     
-            myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( tr( "Position" ) ).arg( shapeType ).arg( shapeID ) );
+        // element position
+        if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
+          SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();    
+          if ( !CORBA::is_nil( aMesh ) ) {
+            SMESH::ElementPosition pos = aMesh->GetElementPosition( id );
+            int shapeID = pos.shapeID;
+            if ( shapeID > 0 ) {
+              myInfo->append( "" ); // separator
+              QString shapeType;
+              switch ( pos.shapeType ) {
+              case GEOM::EDGE:   shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );   break;
+              case GEOM::FACE:   shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );   break;
+              case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
+              case GEOM::SOLID:  shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );  break;
+              case GEOM::SHELL:  shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" );  break;
+              default:           shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" );  break;
+              }
+              myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( SMESHGUI_ElemInfo::tr( "POSITION" ) ).arg( shapeType ).arg( shapeID ) );
+            }
+          }
+        }
+        // groups element belongs to
+        SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
+        if ( !CORBA::is_nil( aMesh ) ) {
+          SMESH::ListOfGroups_var  groups = aMesh->GetGroups();
+          myInfo->append( "" ); // separator
+          bool top_created = false;
+          for ( int i = 0; i < groups->length(); i++ ) {
+            SMESH::SMESH_GroupBase_var aGrp = groups[i];
+            if ( CORBA::is_nil( aGrp ) ) continue;
+            QString aName = aGrp->GetName();
+            if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) {
+              if ( !top_created ) {
+                myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) );
+                top_created = true;
+              }
+              myInfo->append( QString( "+ <b>%1:</b>" ).arg( aName.trimmed() ) );
+              if ( grp_details ) {
+                SMESH::SMESH_Group_var         aStdGroup  = SMESH::SMESH_Group::_narrow( aGrp );
+                SMESH::SMESH_GroupOnGeom_var   aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
+                SMESH::SMESH_GroupOnFilter_var aFltGroup  = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
+                
+                // type : group on geometry, standalone group, group on filter
+                if ( !CORBA::is_nil( aStdGroup ) ) {
+                  myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                  arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) );
+                }
+                else if ( !CORBA::is_nil( aGeomGroup ) ) {
+                  myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                  arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) );
+                  GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
+                  _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
+                  if ( sobj ) {
+                    myInfo->append( QString( "  - <b>%1:</b> %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                    arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) );
+                  }
+                }
+                else if ( !CORBA::is_nil( aFltGroup ) ) {
+                  myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
+                                  arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) );
+                }
+                
+                myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ).
+                                arg( QString::number( aGrp->Size() ) ) );
+                
+                // color
+                SALOMEDS::Color color = aGrp->GetColor();
+                myInfo->append( QString( "  - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ).
+                                arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) );
+              }
+            }
           }
         }
-       */
       }
       // separator
       if ( ids.count() > 1 ) {
@@ -1142,6 +1464,16 @@ void SMESHGUI_SimpleElemInfo::clearInternal()
   myInfo->clear();
 }
 
+void SMESHGUI_SimpleElemInfo::saveInfo( QTextStream &out )
+{
+  out << QString( 12, '-' ) << "\n";
+  out << SMESHGUI_ElemInfo::tr( "ELEM_INFO" ) << "\n";
+  out << QString( 12, '-' ) << "\n";
+  out << myInfo->toPlainText();
+  out << "\n";
+}
+
+
 /*!
   \class SMESHGUI_TreeElemInfo::ItemDelegate
   \brief Item delegate for tree mesh info widget
@@ -1194,6 +1526,7 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
   QVBoxLayout* l = new QVBoxLayout( frame() );
   l->setMargin( 0 );
   l->addWidget( myInfo );
+  connect( myInfo, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( itemDoubleClicked( QTreeWidgetItem*, int ) ) );
 }
 
 /*!
@@ -1205,7 +1538,8 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
   clearInternal();
 
   if ( actor() ) {
-    int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
+    int grp_details = SMESHGUI::resourceMgr()->booleanValue( "SMESH", "elem_info_grp_details", false );
+    int precision   = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
     int cprecision = -1;
     if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) ) 
       cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
@@ -1220,11 +1554,11 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
       
         // node ID
         QTreeWidgetItem* nodeItem = createItem( 0, Bold | All );
-        nodeItem->setText( 0, tr( "NODE" ) );
+        nodeItem->setText( 0, SMESHGUI_ElemInfo::tr( "NODE" ) );
         nodeItem->setText( 1, QString( "#%1" ).arg( id ) );
         // coordinates
         QTreeWidgetItem* coordItem = createItem( nodeItem, Bold );
-        coordItem->setText( 0, tr( "COORDINATES" ) );
+        coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) );
         QTreeWidgetItem* xItem = createItem( coordItem );
         xItem->setText( 0, "X" );
         xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
@@ -1236,73 +1570,142 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
         zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
         // connectivity
         QTreeWidgetItem* conItem = createItem( nodeItem, Bold );
-        conItem->setText( 0, tr( "CONNECTIVITY" ) );
+        conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
         Connectivity connectivity = nodeConnectivity( node );
         if ( !connectivity.isEmpty() ) {
           QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
           if ( !con.isEmpty() ) {
             QTreeWidgetItem* i = createItem( conItem );
-            i->setText( 0, tr( "0D_ELEMENTS" ) );
+            i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) );
             i->setText( 1, con );
           }
           con = formatConnectivity( connectivity, SMDSAbs_Ball );
           if ( !con.isEmpty() ) {
             QTreeWidgetItem* i = createItem( conItem );
-            i->setText( 0, tr( "BALL_ELEMENTS" ) );
+            i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) );
             i->setText( 1, con );
+            i->setData( 1, TypeRole, NodeConnectivity );
           }
           con = formatConnectivity( connectivity, SMDSAbs_Edge );
           if ( !con.isEmpty() ) {
             QTreeWidgetItem* i = createItem( conItem );
-            i->setText( 0, tr( "EDGES" ) );
+            i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) );
             i->setText( 1, con );
+            i->setData( 1, TypeRole, NodeConnectivity );
           }
           con = formatConnectivity( connectivity, SMDSAbs_Face );
           if ( !con.isEmpty() ) {
             QTreeWidgetItem* i = createItem( conItem );
-            i->setText( 0, tr( "FACES" ) );
+            i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) );
             i->setText( 1, con );
+            i->setData( 1, TypeRole, NodeConnectivity );
           }
           con = formatConnectivity( connectivity, SMDSAbs_Volume );
           if ( !con.isEmpty() ) {
             QTreeWidgetItem* i = createItem( conItem );
-            i->setText( 0, tr( "VOLUMES" ) );
+            i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) );
             i->setText( 1, con );
+            i->setData( 1, TypeRole, NodeConnectivity );
           }
         }
         else {
-          conItem->setText( 1, tr( "FREE_NODE" ) );
+          conItem->setText( 1, SMESHGUI_ElemInfo::tr( "FREE_NODE" ) );
         }
         // node position
-        int shapeID = node->getshapeId();
-        if ( shapeID > 0 )
-        {
-          SMDS_PositionPtr        pos = node->GetPosition();
-          SMDS_TypeOfPosition posType = pos->GetTypeOfPosition();
-          QString shapeType;
-          double u,v;
-          switch ( posType ) {
-          case SMDS_TOP_EDGE:   shapeType = tr( "EDGE" );
-            u = static_cast<SMDS_EdgePosition*>( pos )->GetUParameter();
-            break;
-          case SMDS_TOP_FACE:   shapeType = tr( "FACE" );
-            u = static_cast<SMDS_FacePosition*>( pos )->GetUParameter();
-            v = static_cast<SMDS_FacePosition*>( pos )->GetVParameter();
-            break;
-          case SMDS_TOP_VERTEX: shapeType = tr( "VERTEX" ); break;
-          default:              shapeType = tr( "SOLID" );
+        SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();   
+        if ( !CORBA::is_nil( aMeshPtr ) ) {
+          SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id );
+          int shapeID = pos->shapeID;
+          if ( shapeID > 0 ) {
+            QString shapeType;
+            double u, v;
+            switch ( pos->shapeType ) {
+            case GEOM::EDGE:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );
+              if ( pos->params.length() == 1 )
+                u = pos->params[0];
+              break;
+            case GEOM::FACE:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
+              if ( pos->params.length() == 2 ) {
+                u = pos->params[0];
+                v = pos->params[1];
+              }
+              break;
+            case GEOM::VERTEX:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" );
+              break;
+            default:
+              shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
+              break;
+            }
+            QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
+            posItem->setText( 0, SMESHGUI_ElemInfo::tr("POSITION") );
+            posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
+            if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) {
+              QTreeWidgetItem* uItem = createItem( posItem );
+              uItem->setText( 0, SMESHGUI_ElemInfo::tr("U_POSITION") );
+              uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )));
+              if ( pos->shapeType == GEOM::FACE ) {
+                QTreeWidgetItem* vItem = createItem( posItem );
+                vItem->setText( 0, SMESHGUI_ElemInfo::tr("V_POSITION") );
+                vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )));
+              }
+            }
           }
-          QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
-          posItem->setText( 0, tr("NODE_POSITION") );
-          posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
-          if ( posType == SMDS_TOP_EDGE || posType == SMDS_TOP_FACE ) {
-            QTreeWidgetItem* uItem = createItem( posItem );
-            uItem->setText( 0, tr("U_POSITION") );
-            uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )));
-            if ( posType == SMDS_TOP_FACE ) {
-              QTreeWidgetItem* vItem = createItem( posItem );
-              vItem->setText( 0, tr("V_POSITION") );
-              vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )));
+        }
+        // groups node belongs to
+        SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
+        if ( !CORBA::is_nil( aMesh ) ) {
+          SMESH::ListOfGroups_var groups = aMesh->GetGroups();
+          QTreeWidgetItem* groupsItem = 0;
+          for ( int i = 0; i < groups->length(); i++ ) {
+            SMESH::SMESH_GroupBase_var aGrp = groups[i];
+            if ( CORBA::is_nil( aGrp ) ) continue;
+            QString aName = aGrp->GetName();
+            if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) {
+              if ( !groupsItem ) {
+                groupsItem = createItem( nodeItem, Bold );
+                groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) );
+              }
+              QTreeWidgetItem* it = createItem( groupsItem, Bold );
+              it->setText( 0, aName.trimmed() );
+              if ( grp_details ) {
+                SMESH::SMESH_Group_var         aStdGroup  = SMESH::SMESH_Group::_narrow( aGrp );
+                SMESH::SMESH_GroupOnGeom_var   aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
+                SMESH::SMESH_GroupOnFilter_var aFltGroup  = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
+                
+                // type : group on geometry, standalone group, group on filter
+                QTreeWidgetItem* typeItem = createItem( it );
+                typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) );
+                if ( !CORBA::is_nil( aStdGroup ) ) {
+                  typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) );
+                }
+                else if ( !CORBA::is_nil( aGeomGroup ) ) {
+                  typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) );
+                  GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
+                  _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
+                  if ( sobj ) {
+                    QTreeWidgetItem* gobjItem = createItem( typeItem );
+                    gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) );
+                    gobjItem->setText( 1, sobj->GetName().c_str() );
+                  }
+                }
+                else if ( !CORBA::is_nil( aFltGroup ) ) {
+                  typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
+                }
+                
+                // size
+                QTreeWidgetItem* sizeItem = createItem( it );
+                sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) );
+                sizeItem->setText( 1, QString::number( aGrp->Size() ) );
+                
+                // color
+                SALOMEDS::Color color = aGrp->GetColor();
+                QTreeWidgetItem* colorItem = createItem( it );
+                colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) );
+                colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) );
+              }
             }
           }
         }
@@ -1319,15 +1722,15 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
         QString stype;
         switch( e->GetType() ) {
         case SMDSAbs_0DElement:
-          stype = tr( "0D ELEMENT" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break;
         case SMDSAbs_Ball:
-          stype = tr( "BALL" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "BALL" ); break;
         case SMDSAbs_Edge:
-          stype = tr( "EDGE" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break;
         case SMDSAbs_Face:
-          stype = tr( "FACE" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "FACE" ); break;
         case SMDSAbs_Volume:
-          stype = tr( "VOLUME" ); break;
+          stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break;
         default: 
           break;
         }
@@ -1340,50 +1743,50 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
         switch( e->GetEntityType() ) {
         case SMDSEntity_Triangle:
         case SMDSEntity_Quad_Triangle:
-          gtype = tr( "TRIANGLE" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break;
         case SMDSEntity_Quadrangle:
         case SMDSEntity_Quad_Quadrangle:
         case SMDSEntity_BiQuad_Quadrangle:
-          gtype = tr( "QUADRANGLE" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "QUADRANGLE" ); break;
         case SMDSEntity_Polygon:
         case SMDSEntity_Quad_Polygon:
-          gtype = tr( "POLYGON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "POLYGON" ); break;
         case SMDSEntity_Tetra:
         case SMDSEntity_Quad_Tetra:
-          gtype = tr( "TETRAHEDRON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "TETRAHEDRON" ); break;
         case SMDSEntity_Pyramid:
         case SMDSEntity_Quad_Pyramid:
-          gtype = tr( "PYRAMID" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "PYRAMID" ); break;
         case SMDSEntity_Hexa:
         case SMDSEntity_Quad_Hexa:
         case SMDSEntity_TriQuad_Hexa:
-          gtype = tr( "HEXAHEDRON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "HEXAHEDRON" ); break;
         case SMDSEntity_Penta:
         case SMDSEntity_Quad_Penta:
-          gtype = tr( "PRISM" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "PRISM" ); break;
         case SMDSEntity_Hexagonal_Prism:
-          gtype = tr( "HEX_PRISM" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "HEX_PRISM" ); break;
         case SMDSEntity_Polyhedra:
         case SMDSEntity_Quad_Polyhedra:
-          gtype = tr( "POLYHEDRON" ); break;
+          gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
         default: 
           break;
         }
         if ( !gtype.isEmpty() ) {
           QTreeWidgetItem* typeItem = createItem( elemItem, Bold );
-          typeItem->setText( 0, tr( "TYPE" ) );
+          typeItem->setText( 0, SMESHGUI_ElemInfo::tr( "TYPE" ) );
           typeItem->setText( 1, gtype );
         }
         // quadratic flag and gravity center (any element except 0D)
         if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
           // quadratic flag
           QTreeWidgetItem* quadItem = createItem( elemItem, Bold );
-          quadItem->setText( 0, tr( "QUADRATIC" ) );
-          quadItem->setText( 1, e->IsQuadratic() ? tr( "YES" ) : tr( "NO" ) );
+          quadItem->setText( 0, SMESHGUI_ElemInfo::tr( "QUADRATIC" ) );
+          quadItem->setText( 1, e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ) );
           // gravity center
           XYZ gc = gravityCenter( e );
           QTreeWidgetItem* gcItem = createItem( elemItem, Bold );
-          gcItem->setText( 0, tr( "GRAVITY_CENTER" ) );
+          gcItem->setText( 0, SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) );
           QTreeWidgetItem* xItem = createItem( gcItem );
           xItem->setText( 0, "X" );
           xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
@@ -1397,23 +1800,25 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
         if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
           // ball diameter
           QTreeWidgetItem* diamItem = createItem( elemItem, Bold );
-          diamItem->setText( 0, tr( "BALL_DIAMETER" ) );
+          diamItem->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ) );
           diamItem->setText( 1, QString( "%1" ).arg( ball->GetDiameter() ));
         }
         // connectivity
         QTreeWidgetItem* conItem = createItem( elemItem, Bold );
-        conItem->setText( 0, tr( "CONNECTIVITY" ) );
+        conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
         SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
         for ( int idx = 1; nodeIt->more(); idx++ ) {
           const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
           // node number and ID
           QTreeWidgetItem* nodeItem = createItem( conItem, Bold );
-          nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) );
+          nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) );
           nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) );
+          nodeItem->setData( 1, TypeRole, ElemConnectivity );
+          nodeItem->setData( 1, IdRole, node->GetID() );
           nodeItem->setExpanded( false );
           // node coordinates
           QTreeWidgetItem* coordItem = createItem( nodeItem );
-          coordItem->setText( 0, tr( "COORDINATES" ) );
+          coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) );
           QTreeWidgetItem* xItem = createItem( coordItem );
           xItem->setText( 0, "X" );
           xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
@@ -1425,44 +1830,48 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
           // node connectivity
           QTreeWidgetItem* nconItem = createItem( nodeItem );
-          nconItem->setText( 0, tr( "CONNECTIVITY" ) );
+          nconItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
           Connectivity connectivity = nodeConnectivity( node );
           if ( !connectivity.isEmpty() ) {
             QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
             if ( !con.isEmpty() ) {
               QTreeWidgetItem* i = createItem( nconItem );
-              i->setText( 0, tr( "0D_ELEMENTS" ) );
+              i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) );
               i->setText( 1, con );
             }
             con = formatConnectivity( connectivity, SMDSAbs_Edge );
             if ( !con.isEmpty() ) {
               QTreeWidgetItem* i = createItem( nconItem );
-              i->setText( 0, tr( "EDGES" ) );
+              i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) );
               i->setText( 1, con );
+              i->setData( 1, TypeRole, NodeConnectivity );
             }
             con = formatConnectivity( connectivity, SMDSAbs_Ball );
             if ( !con.isEmpty() ) {
               QTreeWidgetItem* i = createItem( nconItem );
-              i->setText( 0, tr( "BALL_ELEMENTS" ) );
+              i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) );
               i->setText( 1, con );
+              i->setData( 1, TypeRole, NodeConnectivity );
             }
             con = formatConnectivity( connectivity, SMDSAbs_Face );
             if ( !con.isEmpty() ) {
               QTreeWidgetItem* i = createItem( nconItem );
-              i->setText( 0, tr( "FACES" ) );
+              i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) );
               i->setText( 1, con );
+              i->setData( 1, TypeRole, NodeConnectivity );
             }
             con = formatConnectivity( connectivity, SMDSAbs_Volume );
             if ( !con.isEmpty() ) {
               QTreeWidgetItem* i = createItem( nconItem );
-              i->setText( 0, tr( "VOLUMES" ) );
+              i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) );
               i->setText( 1, con );
+              i->setData( 1, TypeRole, NodeConnectivity );
             }
           }
         }
         //Controls
         QTreeWidgetItem* cntrItem = createItem( elemItem, Bold );
-        cntrItem->setText( 0, tr( "MEN_CTRL" ) );
+        cntrItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONTROLS" ) );
         //Length
         if( e->GetType()==SMDSAbs_Edge){         
           afunctor.reset( new SMESH::Controls::Length() );
@@ -1485,7 +1894,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           afunctor->SetPrecision( cprecision );
           QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold );
-          taperlItem->setText( 0, tr( "MEN_TAPER" ) );
+          taperlItem->setText( 0, tr( "TAPER_ELEMENTS" ) );
           taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );    
           //AspectRatio2D
           afunctor.reset( new SMESH::Controls::AspectRatio() );
@@ -1505,14 +1914,14 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           afunctor->SetPrecision( cprecision );
           QTreeWidgetItem* warpItem = createItem( cntrItem, Bold );
-          warpItem->setText( 0, tr( "STB_WARP" ));
+          warpItem->setText( 0, tr( "WARP_ELEMENTS" ));
           warpItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );        
           //Skew          
           afunctor.reset( new SMESH::Controls::Skew() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           afunctor->SetPrecision( cprecision );
           QTreeWidgetItem* skewItem = createItem( cntrItem, Bold );
-          skewItem->setText( 0, tr( "TOP_SKEW" ) );
+          skewItem->setText( 0, tr( "SKEW_ELEMENTS" ) );
           skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );       
           //ElemDiam2D    
           afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
@@ -1532,7 +1941,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           afunctor.reset( new SMESH::Controls::Volume() );
           afunctor->SetMesh( actor()->GetObject()->GetMesh() );
           QTreeWidgetItem* volItem = createItem( cntrItem, Bold );
-          volItem->setText( 0, tr( "MEN_VOLUME_3D" ) );
+          volItem->setText( 0, tr( "VOLUME_3D_ELEMENTS" ) );
           volItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
           //ElementDiameter3D   
           afunctor.reset( new SMESH::Controls::MaxElementLength3D() );
@@ -1541,24 +1950,83 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
           diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );     
         }
-       /*
-        if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
-          //shapeID
-          int shapeID = e->getshapeId();
-          if ( shapeID > 0 ) {
-            QTreeWidgetItem* shItem = createItem( elemItem, Bold );
-            QString shapeType;
-            switch ( actor()->GetObject()->GetMesh()->FindElement( shapeID )->GetType() ) {
-            case SMDS_TOP_EDGE:   shapeType = tr( "EDGE" ); break;
-            case SMDS_TOP_FACE:   shapeType = tr( "FACE" ); break;
-            case SMDS_TOP_VERTEX: shapeType = tr( "VERTEX" ); break;
-            default:              shapeType = tr( "SOLID" );
+        // element position
+        if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
+          SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();    
+          if ( !CORBA::is_nil( aMesh ) ) {
+            SMESH::ElementPosition pos = aMesh->GetElementPosition( id );
+            int shapeID = pos.shapeID;
+            if ( shapeID > 0 ) {
+              QTreeWidgetItem* shItem = createItem( elemItem, Bold );
+              QString shapeType;
+              switch ( pos.shapeType ) {
+              case GEOM::EDGE:   shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );   break;
+              case GEOM::FACE:   shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );   break;
+              case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
+              case GEOM::SOLID:  shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );  break;
+              case GEOM::SHELL:  shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" );  break;
+              default:           shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" );  break;
+              }
+              shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ) );
+              shItem->setText( 1, QString( "%1 #%2" ).arg( shapeType ).arg( shapeID ) );
+            }
+          }
+        }
+        // groups element belongs to
+        SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
+        if ( !CORBA::is_nil( aMesh ) ) {
+          SMESH::ListOfGroups_var  groups = aMesh->GetGroups();
+          QTreeWidgetItem* groupsItem = 0;
+          for ( int i = 0; i < groups->length(); i++ ) {
+            SMESH::SMESH_GroupBase_var aGrp = groups[i];
+            if ( CORBA::is_nil( aGrp ) ) continue;
+            QString aName = aGrp->GetName();
+            if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) {
+              if ( !groupsItem ) {
+                groupsItem = createItem( elemItem, Bold );
+                groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) );
+              }
+              QTreeWidgetItem* it = createItem( groupsItem, Bold );
+              it->setText( 0, aName.trimmed() );
+              if ( grp_details ) {
+                SMESH::SMESH_Group_var         aStdGroup  = SMESH::SMESH_Group::_narrow( aGrp );
+                SMESH::SMESH_GroupOnGeom_var   aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
+                SMESH::SMESH_GroupOnFilter_var aFltGroup  = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
+                
+                // type : group on geometry, standalone group, group on filter
+                QTreeWidgetItem* typeItem = createItem( it );
+                typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) );
+                if ( !CORBA::is_nil( aStdGroup ) ) {
+                  typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) );
+                }
+                else if ( !CORBA::is_nil( aGeomGroup ) ) {
+                  typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) );
+                  GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
+                  _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
+                  if ( sobj ) {
+                    QTreeWidgetItem* gobjItem = createItem( typeItem );
+                    gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) );
+                    gobjItem->setText( 1, sobj->GetName().c_str() );
+                  }
+                }
+                else if ( !CORBA::is_nil( aFltGroup ) ) {
+                  typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
+                }
+                
+                // size
+                QTreeWidgetItem* sizeItem = createItem( it );
+                sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) );
+                sizeItem->setText( 1, QString::number( aGrp->Size() ) );
+                
+                // color
+                SALOMEDS::Color color = aGrp->GetColor();
+                QTreeWidgetItem* colorItem = createItem( it );
+                colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) );
+                colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) );
+              }
             }
-            shItem->setText( 0, tr( "Position" ) );
-            shItem->setText( 1, QString( "%1 #%2" ).arg(shapeType).arg( shapeID ) );
           }
         }
-       */
       }
     }
   }
@@ -1600,6 +2068,51 @@ QTreeWidgetItem* SMESHGUI_TreeElemInfo::createItem( QTreeWidgetItem* parent, int
   return item;
 }
 
+void SMESHGUI_TreeElemInfo::contextMenuEvent( QContextMenuEvent* e )
+{
+  QList< QTreeWidgetItem* > widgets = myInfo->selectedItems();
+  if ( widgets.isEmpty() ) return;
+  QTreeWidgetItem* aTreeItem = widgets.first();
+  int type = aTreeItem->data( 1, TypeRole ).toInt();
+  int id   = aTreeItem->data( 1, IdRole ).toInt();
+  QMenu menu;
+  QAction* a = menu.addAction( tr( "SHOW_ITEM_INFO" ) );
+  if ( type == ElemConnectivity && id > 0 && menu.exec( e->globalPos() ) == a )
+    emit( itemInfo( id ) );
+  else if ( type == NodeConnectivity && menu.exec( e->globalPos() ) == a )
+    emit( itemInfo( aTreeItem->text( 1 ) ) );
+}
+
+void  SMESHGUI_TreeElemInfo::itemDoubleClicked( QTreeWidgetItem* theItem, int theColumn )
+{
+  if ( theItem ) {
+    int type = theItem->data( 1, TypeRole ).toInt();
+    int id   = theItem->data( 1, IdRole ).toInt();
+    if ( type == ElemConnectivity && id > 0 )
+      emit( itemInfo( id ) );
+    else if ( type == NodeConnectivity )
+      emit( itemInfo( theItem->text( 1 ) ) );
+  }
+}
+
+void SMESHGUI_TreeElemInfo::saveInfo( QTextStream &out )
+{
+  out << QString( 12, '-' ) << "\n";
+  out << SMESHGUI_ElemInfo::tr( "ELEM_INFO" ) << "\n";
+  out << QString( 12, '-' ) << "\n";
+
+  QTreeWidgetItemIterator it( myInfo );
+  while ( *it ) {
+    if ( !( *it )->text(0).isEmpty() ) {
+      out << QString( SPACING_INFO * itemDepth( *it ), ' ' ) << ( *it )->text(0);
+      if ( !( *it )->text(1).isEmpty() ) out << ": " << ( *it )->text(1);
+      out << "\n";
+    }
+    ++it;
+  }
+  out << "\n";
+}
+
 /*!
   \class GrpComputor
   \brief Mesh information computer
@@ -2059,6 +2572,26 @@ void SMESHGUI_AddInfo::showNextSubMeshes()
   showSubMeshes();
 }
 
+void SMESHGUI_AddInfo::saveInfo( QTextStream &out )
+{
+  out << QString( 15, '-')       << "\n";
+  out << tr( "ADDITIONAL_INFO" ) << "\n";
+  out << QString( 15, '-' )      << "\n";
+  QTreeWidgetItemIterator it( this );
+  while ( *it ) {
+    if ( !( ( *it )->text(0) ).isEmpty() ) {
+      out << QString( SPACING_INFO * itemDepth( *it ), ' ' ) << ( *it )->text(0);
+      if ( ( *it )->text(0)  == tr( "COLOR" ) ) {
+        out << ": " << ( ( ( *it )->background(1) ).color() ).name();
+      }
+      else if ( !( ( *it )->text(1) ).isEmpty() ) out << ": " << ( *it )->text(1);
+      out << "\n";
+    }
+    ++it;
+  }
+  out << "\n";
+}
+
 /*!
   \class SMESHGUI_MeshInfoDlg
   \brief Mesh information dialog box
@@ -2124,6 +2657,8 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   okBtn->setAutoDefault( true );
   okBtn->setDefault( true );
   okBtn->setFocus();
+  QPushButton* dumpBtn = new QPushButton( tr( "BUT_DUMP_MESH" ), this );
+  dumpBtn->setAutoDefault( true );
   QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
   helpBtn->setAutoDefault( true );
 
@@ -2132,6 +2667,7 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   btnLayout->setMargin( 0 );
 
   btnLayout->addWidget( okBtn );
+  btnLayout->addWidget( dumpBtn );
   btnLayout->addStretch( 10 );
   btnLayout->addWidget( helpBtn );
 
@@ -2144,12 +2680,15 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   myTabWidget->setCurrentIndex( qMax( (int)BaseInfo, qMin( (int)ElemInfo, page ) ) );
 
   connect( okBtn,       SIGNAL( clicked() ),              this, SLOT( reject() ) );
+  connect( dumpBtn,     SIGNAL( clicked() ),              this, SLOT( dump() ) );
   connect( helpBtn,     SIGNAL( clicked() ),              this, SLOT( help() ) );
   connect( myTabWidget, SIGNAL( currentChanged( int  ) ), this, SLOT( updateSelection() ) );
   connect( myMode,      SIGNAL( buttonClicked( int  ) ),  this, SLOT( modeChanged() ) );
-  connect( myID,        SIGNAL( textEdited( QString  ) ), this, SLOT( idChanged() ) );
+  connect( myID,        SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ) );
   connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
   connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) );
+  connect( myElemInfo,  SIGNAL( itemInfo( int ) ),     this, SLOT( showItemInfo( int ) ) );
+  connect( myElemInfo,  SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString ) ) );
 
   updateSelection();
 }
@@ -2354,8 +2893,79 @@ void SMESHGUI_MeshInfoDlg::idChanged()
       }
     }
     selector->AddOrRemoveIndex( IO, ID, false );
-    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
+    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) {
       aViewWindow->highlight( IO, true, true );
+      aViewWindow->Repaint();
+    }
     myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
   }
 }
+
+void SMESHGUI_MeshInfoDlg::showItemInfo( int id )
+{
+  if ( id > 0 &&  myActor->GetObject()->GetMesh()->FindNode( id ) ) {
+    myMode->button( NodeMode )->click();
+    myID->setText( QString::number( id ) );
+  }
+}
+
+void SMESHGUI_MeshInfoDlg::showItemInfo( const QString& theStr )
+{
+  if ( !theStr.isEmpty() ) {
+    myMode->button( ElemMode )->click();
+    myID->setText( theStr );
+  }
+}
+
+void SMESHGUI_MeshInfoDlg::dump()
+{
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if ( !app ) return;
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
+  if ( !appStudy ) return;
+  _PTR( Study ) aStudy = appStudy->studyDS();
+
+  QStringList aFilters;
+  aFilters.append( tr( "TEXT_FILES" ) );
+
+  bool anIsBase = true;
+  bool anIsElem = true;
+  bool anIsAdd  = true;
+
+  if ( SUIT_ResourceMgr* aResourceMgr = SMESHGUI::resourceMgr() ) {
+    anIsBase = aResourceMgr->booleanValue( "SMESH", "info_dump_base", anIsBase );
+    anIsElem = aResourceMgr->booleanValue( "SMESH", "info_dump_elem", anIsElem );
+    anIsAdd  = aResourceMgr->booleanValue( "SMESH", "info_dump_add",  anIsAdd );
+  }
+
+  DumpFileDlg fd( this );
+  fd.setWindowTitle( tr( "SAVE_INFO" ) );
+  fd.setFilters( aFilters );
+  fd.myBaseChk->setChecked( anIsBase );
+  fd.myElemChk->setChecked( anIsElem );
+  fd.myAddChk ->setChecked( anIsAdd );
+  if ( fd.exec() == QDialog::Accepted )
+  {
+    QString aFileName = fd.selectedFile();
+
+    bool toBase = fd.myBaseChk->isChecked();
+    bool toElem = fd.myElemChk->isChecked();
+    bool toAdd  = fd.myAddChk->isChecked();
+
+    if ( !aFileName.isEmpty() ) {
+      QFileInfo aFileInfo( aFileName );
+      if ( aFileInfo.isDir() )
+        return;
+      QFile aFile( aFileName );
+      if ( !aFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
+        return;
+      
+      QTextStream out( &aFile );
+      
+      if ( toBase ) myBaseInfo->saveInfo( out );
+      if ( toElem ) myElemInfo->saveInfo( out );
+      if ( toAdd )  myAddInfo ->saveInfo( out );
+    }
+  }
+}
index a2fa39930e6deb2dc6b12f5d505dee906d3d1ce3..8e375667490d0125b78d1102fbec8fc9e625d1c5 100644 (file)
@@ -41,6 +41,7 @@
 #include CORBA_SERVER_HEADER(SMESH_Group)
 
 class QButtonGroup;
+class QContextMenuEvent;
 class QLabel;
 class QLineEdit;
 class QPushButton;
@@ -64,7 +65,10 @@ class SMESHGUI_EXPORT SMESHGUI_MeshInfo : public QFrame
     iNodesEnd,
     iElementsStart = iNodesEnd, 
     iElements,
-    i0DStart,
+    iNbStart,
+    iNb,
+    iNbEnd,
+    i0DStart = iNbEnd,
     i0D,
     i0DEnd,
     iBallsStart = i0DEnd,
@@ -107,6 +111,7 @@ public:
 
   void     showInfo( SMESH::SMESH_IDSource_ptr );
   void     clear();
+  void     saveInfo( QTextStream &out );
 
 private:
   enum { Bold = 0x01, Italic = 0x02 };
@@ -136,6 +141,7 @@ public:
   void         showInfo( long, bool );
   void         showInfo( QSet<long>, bool );
   void         clear();
+  virtual void saveInfo( QTextStream &out ) = 0;
 
 protected:
   struct XYZ
@@ -161,6 +167,10 @@ protected:
   QString      formatConnectivity( Connectivity, int );
   XYZ          gravityCenter( const SMDS_MeshElement* );
 
+signals:
+  void         itemInfo( int );
+  void         itemInfo( const QString& );
+
 private slots:
   void         showPrevious();
   void         showNext();
@@ -177,8 +187,11 @@ private:
 
 class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
 {
+  Q_OBJECT
+
 public:
   SMESHGUI_SimpleElemInfo( QWidget* = 0 );
+  void          saveInfo( QTextStream &out );
 
 protected:
   void          information( const QList<long>& );
@@ -190,17 +203,24 @@ private:
 
 class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
 {
+  Q_OBJECT;
+
   class ItemDelegate;
 
   enum { Bold = 0x01, All = 0x80 };
 
 public:
   SMESHGUI_TreeElemInfo( QWidget* = 0 );
+  void             saveInfo( QTextStream &out );
 
 protected:
+  void             contextMenuEvent( QContextMenuEvent* e );
   void             information( const QList<long>& );
   void             clearInternal();
 
+private slots:
+  void             itemDoubleClicked( QTreeWidgetItem*, int );
+  
 private:
   QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
   
@@ -236,6 +256,7 @@ public:
 
   void             showInfo( SMESH::SMESH_IDSource_ptr );
   //  void             clear();
+  void             saveInfo( QTextStream &out );
 
 private slots:
   void             changeLoadToCompute();
@@ -291,6 +312,9 @@ private slots:
   void deactivate();
   void modeChanged();
   void idChanged();
+  void showItemInfo( int );
+  void showItemInfo( const QString& );
+  void dump();
 
 private:
   QTabWidget*        myTabWidget;
index df085305b151244508c4ce609f8ccf6ef970fe9c..9d9aa1c0ccc2c9516e4e7ab4b0551bc3062ebffb 100644 (file)
@@ -40,6 +40,7 @@
 #include <GEOM_SelectionFilter.h>
 #include <GEOMBase.h>
 #include <GeometryGUI.h>
+#include <GEOM_wrap.hxx>
 
 // SALOME GUI includes
 #include <SalomeApp_Tools.h>
@@ -56,6 +57,8 @@
 // SALOME KERNEL includes
 #include <SALOMEDS_SComponent.hxx>
 #include <SALOMEDS_SObject.hxx>
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_wrap.hxx>
 
 // Qt includes
 #include <QStringList>
@@ -336,8 +339,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
     if (geomGen->_is_nil() || !aStudy) return false;
 
-    GEOM::GEOM_IGroupOperations_var op =
-        geomGen->GetIGroupOperations(aStudy->StudyId());
+    GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
     if (op->_is_nil()) return false;
 
     // check all selected shapes
@@ -352,18 +354,18 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
       if (aSubGeomVar->_is_nil()) return false;
 
       // skl for NPAL14695 - implementation of searching of mainObj
-      GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar);
-      //if (mainObj->_is_nil() ||
-      //    string(mainObj->GetEntry()) != string(mainGeom->GetEntry())) return false;
+      GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
+                                                                        mainObj already exists! */
       while(1) {
         if (mainObj->_is_nil())
           return false;
-        if (std::string(mainObj->GetEntry()) == std::string(mainGeom->GetEntry()))
+        CORBA::String_var entry1 = mainObj->GetEntry();
+        CORBA::String_var entry2 = mainGeom->GetEntry();
+        if (std::string( entry1.in() ) == entry2.in() )
           return true;
         mainObj = op->GetMainShape(mainObj);
       }
     }
-    //return true;
   }
 
   return false;
@@ -896,7 +898,8 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
           SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar );
           if ( !aHypVar->_is_nil() )
           {
-            HypothesisData* aData = SMESH::GetHypothesisData( aHypVar->GetName() );
+            CORBA::String_var hypType = aHypVar->GetName();
+            HypothesisData* aData = SMESH::GetHypothesisData( hypType.in() );
             if ( !aData) continue;
             if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) &&
                  ( isCompatible ( theAlgoData, aData, theHypType )) &&
@@ -1710,7 +1713,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
     GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
     if (!geomGen->_is_nil() && aStudy) {
-      GEOM::GEOM_IGroupOperations_var op =
+      GEOM::GEOM_IGroupOperations_wrap op =
         geomGen->GetIGroupOperations(aStudy->StudyId());
       if (!op->_is_nil()) {
         // check and add all selected GEOM objects: they must be
@@ -1735,18 +1738,19 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
           aSeq[iSubSh] = aSubGeomVar;
         }
         // create a group
-        GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(mainGeom, aGroupType);
+        GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType);
         op->UnionList(aGroupVar, aSeq);
 
         if (op->IsDone()) {
-          aGeomVar = aGroupVar;
+          aGeomVar = aGroupVar.in();
 
           // publish the GEOM group in study
           QString aNewGeomGroupName ("Auto_group_for_");
           aNewGeomGroupName += aName;
-          SALOMEDS::SObject_var aNewGroupSO =
-            geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
-                                aNewGeomGroupName.toLatin1().data(), mainGeom);
+          SALOMEDS::Study_var aStudyVar = _CAST(Study, aStudy)->GetStudy();
+          SALOMEDS::SObject_wrap aNewGroupSO =
+            geomGen->AddInStudy( aStudyVar, aGeomVar,
+                                 aNewGeomGroupName.toLatin1().data(), mainGeom);
         }
       }
     }
index 7f0a861ae9f1f1e9bfdeba20d8d2d196c889c04d..4e3f3d5b59a60fbfee7592761559f652de54de2d 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_Preferences_ScalarBarDlg.cxx
 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
 // SMESH includes
-//
+
 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
 
 #include "SMESHGUI.h"
@@ -130,22 +129,28 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
   /******************************************************************************/
   // Scalar range
   myRangeGrp = new QGroupBox ( tr( "SMESH_RANGE_SCALARBAR" ), this );
-  QHBoxLayout* myRangeGrpLayout = new QHBoxLayout( myRangeGrp );
+  //QHBoxLayout* myRangeGrpLayout = new QHBoxLayout( myRangeGrp );
+  QGridLayout* myRangeGrpLayout = new QGridLayout( myRangeGrp );
   myRangeGrpLayout->setSpacing( SPACING_SIZE ); myRangeGrpLayout->setMargin( MARGIN_SIZE );
-  
+
   myMinEdit = new QLineEdit( myRangeGrp );
   myMinEdit->setMinimumWidth( MINIMUM_WIDTH );
   myMinEdit->setValidator( new QDoubleValidator( this ) );
-  
+
   myMaxEdit = new QLineEdit( myRangeGrp );
   myMaxEdit->setMinimumWidth( MINIMUM_WIDTH );
   myMaxEdit->setValidator( new QDoubleValidator( this ) );
-  
-  myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ) );
-  myRangeGrpLayout->addWidget( myMinEdit );
-  myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ) );
-  myRangeGrpLayout->addWidget( myMaxEdit );
-  
+
+  myLogarithmicCheck = new QCheckBox (myRangeGrp);
+  myLogarithmicCheck->setText(tr("SMESH_LOGARITHMIC_SCALARBAR"));
+  myLogarithmicCheck->setChecked(false);
+
+  myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ), 0, 0, 1, 1 );
+  myRangeGrpLayout->addWidget( myMinEdit, 0, 1, 1, 1 );
+  myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ), 0, 2, 1, 1 );
+  myRangeGrpLayout->addWidget( myMaxEdit, 0, 3, 1, 1 );
+  myRangeGrpLayout->addWidget( myLogarithmicCheck, 1, 0, 1, 4 );
+
   aTopLayout->addWidget( myRangeGrp );
 
   /******************************************************************************/
@@ -255,19 +260,19 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
 
   myYSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
   myYSpin->setAcceptNames( false );
-  myYSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );  
+  myYSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
   myYSpin->setMinimumWidth( MINIMUM_WIDTH );
   myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
   myWidthSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
   myWidthSpin->setAcceptNames( false );
-  myWidthSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );    
+  myWidthSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
   myWidthSpin->setMinimumWidth( MINIMUM_WIDTH );
   myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
   myHeightSpin = new SMESHGUI_SpinBox(myOriginDimGrp);
   myHeightSpin->setAcceptNames( false );
-  myHeightSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );    
+  myHeightSpin->RangeStepAndValidator( 0.0, 1.0, 0.1, "parametric_precision" );
   myHeightSpin->setMinimumWidth( MINIMUM_WIDTH );
   myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
@@ -297,18 +302,18 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
 
   myDistribColorGrp->addButton(myDMonoColor);myDistribColorGrp->setId(myDMonoColor,1);
   myDistribColorGrp->addButton(myDMultiColor);myDistribColorGrp->setId(myDMultiColor,2);
-  
+
   aDistributionGrpLayout->addWidget( myDMultiColor );
   aDistributionGrpLayout->addWidget( myDMonoColor );
-  
+
   //Color of the Distribution in monocolor case:
   myDistributionColorLbl = new QLabel( tr( "SMESH_DISTRIBUTION_COLOR" ), myDistributionGrp );
   aDistributionGrpLayout->addWidget( myDistributionColorLbl );
   myMonoColorBtn = new QtxColorButton( myDistributionGrp  );
   aDistributionGrpLayout->addWidget(myMonoColorBtn);
-  
+
   aTopLayout->addWidget(myDistributionGrp);
-  
+
   /******************************************************************************/
   // Common buttons
   myButtonGrp = new QGroupBox( this );
@@ -351,13 +356,13 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
       myTitleFontCombo->setCurrentIndex(1);
     if( f.family()=="Times")
       myTitleFontCombo->setCurrentIndex(2);
-    
+
     myTitleBoldCheck->setChecked  ( f.bold() );
     myTitleItalicCheck->setChecked( f.italic() );
     myTitleShadowCheck->setChecked( f.overline() );
   }
-                                      
-  QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color", 
+
+  QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color",
                                       QColor(255, 255, 255));
   myLabelsColorBtn->setColor(labelColor);
   myLabelsFontCombo->setCurrentIndex(0);
@@ -369,7 +374,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
       myLabelsFontCombo->setCurrentIndex(1);
     if (f.family() == "Times")
       myLabelsFontCombo->setCurrentIndex(2);
-      
+
     myLabelsBoldCheck  ->setChecked( f.bold() );
     myLabelsItalicCheck->setChecked( f.italic() );
     myLabelsShadowCheck->setChecked( f.overline() );
@@ -391,7 +396,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
 
   QString name = isHoriz ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1";
 
-  myIniX = mgr->doubleValue("SMESH", name.arg( "x" ), 
+  myIniX = mgr->doubleValue("SMESH", name.arg( "x" ),
                             myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X);
 
   myIniY = mgr->doubleValue("SMESH", name.arg( "y" ),
@@ -412,18 +417,16 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
   int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
   if( coloringType == SMESH_MONOCOLOR_TYPE ) {
     myDMonoColor->setChecked(true);
-    onDistributionChanged(myDistribColorGrp->id(myDMonoColor));    
+    onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
   } else {
     myDMultiColor->setChecked(true);
     onDistributionChanged(myDistribColorGrp->id(myDMultiColor));
 
   }
-  
+
   QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
                                              QColor(255, 255, 255));
   myMonoColorBtn->setColor(distributionColor);
-  
-  
 
   // --> then init from selection if necessary
   onSelectionChanged();
@@ -434,6 +437,8 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
   connect( myApplyBtn,          SIGNAL( clicked() ), this, SLOT( onApply() ) );
   connect( myCancelBtn,         SIGNAL( clicked() ), this, SLOT( onCancel() ) );
   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() ) );
   connect( myXSpin,             SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
   connect( myYSpin,             SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
   connect( aOrientationGrp,     SIGNAL( buttonClicked( int ) ),   this, SLOT( onOrientationChanged() ) );
@@ -528,9 +533,9 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
   if( myDistributionGrp->isChecked() ) {
     int ColoringType = myDMultiColor->isChecked() ? SMESH_MULTICOLOR_TYPE : SMESH_MONOCOLOR_TYPE;
     distributionTypeChanged = (ColoringType != myScalarBarActor->GetDistributionColoringType());
-    if(distributionTypeChanged)      
+    if (distributionTypeChanged)
       myScalarBarActor->SetDistributionColoringType(ColoringType);
-    
+
     if( !myDMultiColor->isChecked() ) {
       QColor aTColor = myMonoColorBtn->color();
       double rgb[3], oldRgb[3];;
@@ -551,29 +556,31 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
   double oldMinMax[2] = { myLookupTable->GetRange()[0], myLookupTable->GetRange()[1] };
   bool rangeChanges = ( fabs( oldMinMax[0] - aMin ) + fabs( oldMinMax[1] - aMax ) >
                         0.001 * ( aMax-aMin + oldMinMax[1]-oldMinMax[0] ));
-  
+
   bool nbColorsChanged = (myColorsSpin->value() != myScalarBarActor->GetMaximumNumberOfColors());
   if(nbColorsChanged)
     myScalarBarActor->SetMaximumNumberOfColors(myColorsSpin->value());
-  
 
   myLookupTable->SetRange( aMin, aMax );
   myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
+
+  bool scaleChanged = (myLogarithmicCheck->isChecked() != (myLookupTable->GetScale() == VTK_SCALE_LOG10));
+  if (scaleChanged)
+    myLookupTable->SetScale(myLogarithmicCheck->isChecked() ? VTK_SCALE_LOG10 : VTK_SCALE_LINEAR);
+
   myLookupTable->Build();
 
-  if( nbColorsChanged || rangeChanges)
+  if (nbColorsChanged || rangeChanges || scaleChanged)
     myActor->UpdateDistribution();
-  
+
 #ifndef DISABLE_PLOT2DVIEWER
-  if( myActor->GetPlot2Histogram() && 
-      (nbColorsChanged || 
+  if( myActor->GetPlot2Histogram() &&
+      (nbColorsChanged ||
        rangeChanges ||
-       distributionTypeChanged || 
+       distributionTypeChanged ||
        colorChanged ))
     SMESH::ProcessIn2DViewers(myActor);
 #endif
-    
-    
 
   SMESH::RepaintCurrentView();
   return true;
@@ -601,7 +608,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onCancel()
 void SMESHGUI_Preferences_ScalarBarDlg::onHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
@@ -612,7 +619,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onHelp()
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                  platform)).
                              arg(myHelpFileName));
   }
@@ -639,9 +646,13 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
         SMESH_ScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
 
         if ( myScalarBarActor->GetLookupTable() ) {
-          vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange();
+          vtkLookupTable* aLookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
+
+          vtkFloatingPointType *range = aLookupTable->GetRange();
           myMinEdit->setText( QString::number( range[0],'g',12 ) );
           myMaxEdit->setText( QString::number( range[1],'g',12 ) );
+          myLogarithmicCheck->setChecked(aLookupTable->GetScale() == VTK_SCALE_LOG10);
+          myLogarithmicCheck->setEnabled(range[0] > 1e-07 && range[1] > 1e-07);
         }
 
         vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
@@ -682,15 +693,14 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
         myMonoColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
         if ( coloringType == SMESH_MONOCOLOR_TYPE ) {
           myDMonoColor->setChecked(true);
-          onDistributionChanged(myDistribColorGrp->id(myDMonoColor));    
+          onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
         } else {
           myDMultiColor->setChecked(true);
           onDistributionChanged(myDistribColorGrp->id(myDMultiColor));
         }
         myDistributionGrp->setChecked((bool)myScalarBarActor->GetDistributionVisibility());
         onDistributionActivated(myScalarBarActor->GetDistributionVisibility());
-        
-        
+
         myRangeGrp->setEnabled( true );
         myFontGrp->setEnabled( true );
         myLabColorGrp->setEnabled( true );
@@ -727,6 +737,22 @@ void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e )
   QDialog::closeEvent( e );
 }
 
+//=================================================================================================
+/*!
+ *  SMESHGUI_Preferences_ScalarBarDlg::onMinMaxChanged
+ *
+ *  Called when Scalar Range values are changed
+ */
+//=================================================================================================
+void SMESHGUI_Preferences_ScalarBarDlg::onMinMaxChanged()
+{
+  double aMin = myMinEdit->text().toDouble();
+  double aMax = myMaxEdit->text().toDouble();
+  bool isLogarithmicEnabled = (aMin > 1e-07 && aMax > 1e-07);
+  myLogarithmicCheck->setChecked(isLogarithmicEnabled);
+  myLogarithmicCheck->setEnabled(isLogarithmicEnabled);
+}
+
 //=================================================================================================
 /*!
  *  SMESHGUI_Preferences_ScalarBarDlg::onXYChanged
@@ -833,7 +859,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources()
   QString name;
   if (mgr){
     // initialize from resoources
-    
+
     // horizontal
     name = QString("scalar_bar_horizontal_%1");
     if (mgr->hasValue("SMESH", name.arg( "x" )))
index 804b4aa6aa742a97a9fa4480f28d0724eb7643d7..05dea0f597033bc0a5ab2333b435ca67dabd5a05 100644 (file)
@@ -23,7 +23,7 @@
 // SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_Preferences_ScalarBarDlg.h
 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
 #ifndef SMESHGUI_PREFERENCES_SCALARBARDLG_H
 #define SMESHGUI_PREFERENCES_SCALARBARDLG_H
 
@@ -78,6 +78,7 @@ protected slots:
   void                     onHelp();
   void                     onSelectionChanged();
   void                     onXYChanged();
+  void                     onMinMaxChanged();
   void                     onOrientationChanged();
   void                     onDistributionChanged( int );
   void                     onDistributionActivated( bool );
@@ -94,6 +95,7 @@ private:
   QGroupBox*               myRangeGrp;
   QLineEdit*               myMinEdit;
   QLineEdit*               myMaxEdit;
+  QCheckBox*               myLogarithmicCheck;
 
   QGroupBox*               myFontGrp;
   QtxColorButton*          myTitleColorBtn;
index efa3c236148fb3fdd621d82b67d9f9039fd4e99b..758993e4df723f4fd5af7ddb4252f9c5c110402f 100644 (file)
@@ -653,7 +653,7 @@ bool SMESHGUI_Selection::isImported( const int ind ) const
     SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) );
     if( !aMesh->_is_nil() )
     {
-      SALOME_MED::MedFileInfo* inf = aMesh->GetMEDFileInfo();
+      SALOME_MED::MedFileInfo_var inf = aMesh->GetMEDFileInfo();
       res = strlen( (char*)inf->fileName ) > 0;
     }
   }
index 940dd4f3ea43f0f0b0e6398a48ec40bb60c9d8b9..511d0d5fa446b4be88354d55dda8202c341c082f 100644 (file)
@@ -40,6 +40,7 @@
 // SALOME GEOM includes
 #include <GEOMBase.h>
 #include <GeometryGUI.h>
+#include <GEOM_wrap.hxx>
 
 // SALOME GUI includes
 #include <LightApp_DataOwner.h>
@@ -53,6 +54,8 @@
 
 // SALOME KERNEL includes
 #include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_wrap.hxx>
 
 // OCCT includes
 #include <TColStd_MapOfInteger.hxx>
@@ -80,8 +83,9 @@ enum { EDGE = 0, FACE, VOLUME };
  * \brief Dialog to publish a sub-shape of the mesh main shape
  *        by selecting mesh elements
  */
-SMESHGUI_ShapeByMeshDlg::SMESHGUI_ShapeByMeshDlg()
-  : SMESHGUI_Dialog( 0, false, true, OK | Close )
+SMESHGUI_ShapeByMeshDlg::SMESHGUI_ShapeByMeshDlg(bool isMultipleAllowed)
+  : SMESHGUI_Dialog( 0, false, true, OK | Close ),
+    myIsMultipleAllowed( isMultipleAllowed )
 {
   setWindowTitle(tr("CAPTION"));
 
@@ -169,8 +173,7 @@ SMESHGUI_ShapeByMeshOp::SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed):
   if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
     GeometryGUI::InitGeomGen();
 
-  myDlg = new SMESHGUI_ShapeByMeshDlg;
-  myDlg->setMultipleAllowed(myIsMultipleAllowed);
+  myDlg = new SMESHGUI_ShapeByMeshDlg(myIsMultipleAllowed);
 
   connect(myDlg->myElemTypeGroup, SIGNAL(buttonClicked(int)), SLOT(onTypeChanged(int)));
   connect(myDlg->myElementId, SIGNAL(textChanged(const QString&)), SLOT(onElemIdChanged(const QString&)));
@@ -223,7 +226,7 @@ SMESH::SMESH_Mesh_ptr SMESHGUI_ShapeByMeshOp::GetMesh()
 
 //=======================================================================
 // function : GetShape()
-// purpose  : Get published sub-shape
+// purpose  : Return published sub-shape, it must be UnRegister()ed!
 //=======================================================================
 GEOM::GEOM_Object_ptr SMESHGUI_ShapeByMeshOp::GetShape()
 {
@@ -306,85 +309,92 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
   try {
     QStringList aListId = myDlg->myElementId->text().split( " ", QString::SkipEmptyParts);
     if (aListId.count() == 1)
+    {
+      int elemID = (aListId.first()).toInt();
+      // GEOM_Object is published -> no need to UnRegister()
+      myGeomObj = GEOM::GEOM_Object::_duplicate
+        (SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
+         ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
+    }
+    else
+    {
+      GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
+      _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
+      if (geomGen->_is_nil() || !aStudy)
+        return;
+
+      GEOM::GEOM_IShapesOperations_wrap aShapesOp =
+        geomGen->GetIShapesOperations(aStudy->StudyId());
+      if (aShapesOp->_is_nil() )
+        return;
+
+      TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
+
+      std::map<double, GEOM::GEOM_Object_wrap> aGeomObjectsMap;
+      GEOM::GEOM_Object_wrap aGeomObject;
+
+      GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
+
+      for ( int i = 0; i < aListId.count(); i++ )
       {
-        int elemID = (aListId.first()).toInt();
-        myGeomObj = GEOM::GEOM_Object::_duplicate(
-            SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
-          ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
+        aGeomObject = // received object need UnRegister()!
+          SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
+
+        if (aGeomObject->_is_nil()) continue;
+
+        double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
+        if (aShapesOp->IsDone() && !aGeomObjectsMap.count(anId) )
+        {
+          aGeomObjectsMap[anId] = aGeomObject;
+
+          TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
+          if (i == 0)
+            aGroupType = aSubShapeType;
+          else if (aSubShapeType != aGroupType)
+            aGroupType = TopAbs_SHAPE;
+        }
       }
-    else
+
+      int aNumberOfGO = aGeomObjectsMap.size();
+      if (aNumberOfGO == 1)
       {
-        GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-        _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-        
-        if (geomGen->_is_nil() || !aStudy)
-          return;
-        
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          geomGen->GetIShapesOperations(aStudy->StudyId());
-        if (aShapesOp->_is_nil() )
+        aGeomObject = (*aGeomObjectsMap.begin()).second;
+      }
+      else if (aNumberOfGO > 1)
+      {
+        GEOM::GEOM_IGroupOperations_wrap aGroupOp =
+          geomGen->GetIGroupOperations(aStudy->StudyId());
+        if(aGroupOp->_is_nil())
           return;
-        
-        TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
-        
-        std::map<double, GEOM::GEOM_Object_var> aGeomObjectsMap;
-        GEOM::GEOM_Object_var aGeomObject;
 
-        GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
-        
-        for ( int i = 0; i < aListId.count(); i++ )
-          {
-            aGeomObject =
-              SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
+        GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
+        aGeomObjects->length( aNumberOfGO );
 
-            if (aGeomObject->_is_nil()) continue;
-            
-            double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
-            if (aShapesOp->IsDone() && aGeomObjectsMap.find(anId) == aGeomObjectsMap.end())
-              {
-                aGeomObjectsMap[anId] = aGeomObject;
+        int i = 0;
+        std::map<double, GEOM::GEOM_Object_wrap>::iterator anIter;
+        for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
+          aGeomObjects[i++] = (*anIter).second.in();
 
-                TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
-                if (i == 0)
-                  aGroupType = aSubShapeType;
-                else if (aSubShapeType != aGroupType)
-                  aGroupType = TopAbs_SHAPE;
-              }
-          }
-        
-        int aNumberOfGO = aGeomObjectsMap.size();
-        if (aNumberOfGO == 1)
-          myGeomObj = (*aGeomObjectsMap.begin()).second;
-        else if (aNumberOfGO > 1)
-          {
-            GEOM::GEOM_IGroupOperations_var aGroupOp =
-              geomGen->GetIGroupOperations(aStudy->StudyId());
-            if(aGroupOp->_is_nil())
-              return;
-            
-            GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
-            aGeomObjects->length( aNumberOfGO );
-
-            int i = 0;
-            std::map<double, GEOM::GEOM_Object_var>::iterator anIter;
-            for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
-              aGeomObjects[i++] = (*anIter).second;
-          
-            //create geometry group
-            myGeomObj = aGroupOp->CreateGroup(aMeshShape, aGroupType);
-            aGroupOp->UnionList(myGeomObj, aGeomObjects);
-
-            if (!aGroupOp->IsDone())
-              return;
-          }
-        
-        // publish the GEOM object in study
-        QString aNewGeomGroupName ( myDlg->myGeomName->text() );
-          
-        SALOMEDS::SObject_var aNewGroupSO =
-          geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj, 
-                              aNewGeomGroupName.toLatin1().data(), aMeshShape);
+        //create geometry group
+        aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType);
+        aGroupOp->UnionList(myGeomObj, aGeomObjects);
+
+        if (!aGroupOp->IsDone())
+          return;
       }
+
+      // publish the GEOM object in study
+      QString aNewGeomGroupName ( myDlg->myGeomName->text() );
+      SALOMEDS::Study_var aStudyVar = _CAST(Study,aStudy)->GetStudy();
+      SALOMEDS::SObject_wrap aNewGroupSO =
+        geomGen->AddInStudy( aStudyVar, aGeomObject, 
+                             aNewGeomGroupName.toLatin1().data(), aMeshShape);
+
+      // get a GEOM_Object already published, which doesn't need UnRegister()
+      CORBA::Object_var obj = aNewGroupSO->GetObject();
+      myGeomObj = GEOM::GEOM_Object::_narrow( obj );
+    }
   }
   catch (const SALOME::SALOME_Exception& S_ex) {
     SalomeApp_Tools::QtCatchCorbaException(S_ex);
index 63477e34c0b608646e751e5e157b5189a148b971..9d9d950705bb91a4155c4c0bfbee43a524f1e0ba 100644 (file)
@@ -51,7 +51,7 @@ class SMESHGUI_EXPORT SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog
   Q_OBJECT
 
 public:
-  SMESHGUI_ShapeByMeshDlg();
+  SMESHGUI_ShapeByMeshDlg(bool isMultipleAllowed);
   virtual ~SMESHGUI_ShapeByMeshDlg();
 
 private:
index 6562da87a3a4c19ba8d4e4c470f7e8823e009bef..229d7f809518fb67cbb493a59ff6cddc8be115f5 100644 (file)
@@ -34,6 +34,8 @@
 
 #include <SMESH_Actor.h>
 #include <SMESH_ActorUtils.h>
+#include "SMESH_NodeLabelActor.h"
+#include "SMESH_CellLabelActor.h"
 #include <SMESH_ObjectDef.h>
 #include <SMDS_Mesh.hxx>
 
@@ -614,7 +616,7 @@ namespace SMESH
           int deltaF, deltaV;
           SMESH::GetColor( "SMESH", "fill_color", c, deltaF, "0,170,255|-100"  );
           SMESH::GetColor( "SMESH", "volume_color", c, deltaV, "255,0,170|-100"  );
-          SMESH::GetColor( "SMESH", "default_grp_color", c );
+          c = SMESH::GetColor( "SMESH", "default_grp_color", c );
           SALOMEDS::Color aColor = aGroup->GetColor();
           if( !( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ))
           {
@@ -949,6 +951,81 @@ namespace SMESH
   }
 
 
+  void UpdateFontProp( SMESHGUI* theModule )
+  {
+    if ( !theModule ) return;
+
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( theModule->application() );
+    if ( !app ) return;
+
+    SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule );
+    if ( !mgr ) return;
+    //
+    vtkFloatingPointType anRGBNd[3] = {1,1,1};
+    SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
+    int aSizeNd = 10;
+    SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
+    bool aBoldNd    = true;
+    bool anItalicNd = false;
+    bool aShadowNd  = false;
+
+    if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
+      QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
+      if ( f.family()      == "Arial" )   aFamilyNd = SMESH::FntArial;
+      else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
+      else if ( f.family() == "Times" )   aFamilyNd = SMESH::FntTimes;
+      aBoldNd    = f.bold();
+      anItalicNd = f.italic();
+      aShadowNd  = f.overline();
+      aSizeNd    = f.pointSize();
+    }
+    //
+    vtkFloatingPointType anRGBEl[3] = {0,1,0};
+    SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
+    int aSizeEl = 12;
+    SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
+    bool aBoldEl    = true;
+    bool anItalicEl = false;
+    bool aShadowEl  = false;
+
+    if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
+      QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
+
+      if ( f.family()      == "Arial" )          aFamilyEl = SMESH::FntArial;
+      else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
+      else if ( f.family() == "Times" )   aFamilyEl = SMESH::FntTimes;    
+      aBoldEl    = f.bold();
+      anItalicEl = f.italic();
+      aShadowEl  = f.overline();
+      aSizeEl    = f.pointSize();
+    }
+    //
+    ViewManagerList vmList;
+    app->viewManagers( SVTK_Viewer::Type(), vmList );
+    foreach ( SUIT_ViewManager* vm, vmList ) {
+      QVector<SUIT_ViewWindow*> views = vm->getViews();
+      foreach ( SUIT_ViewWindow* vw, views ) {
+       // update VTK viewer properties
+       if ( SVTK_ViewWindow* aVtkView = GetVtkViewWindow( vw ) ) {
+         // update actors
+         vtkRenderer* aRenderer = aVtkView->getRenderer();
+         VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() );
+         vtkActorCollection* aCollection = aCopy.GetActors();
+         aCollection->InitTraversal();
+         while ( vtkActor* anAct = aCollection->GetNextActor() ) {
+           if ( SMESH_NodeLabelActor* anActor = dynamic_cast< SMESH_NodeLabelActor* >( anAct ) ) {
+             anActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
+           }
+           else if ( SMESH_CellLabelActor* anActor = dynamic_cast< SMESH_CellLabelActor* >( anAct ) ) {
+             anActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+           }
+         }
+         aVtkView->Repaint( false ); 
+       }
+      }
+    }
+  }
+
   //----------------------------------------------------------------------------
   SVTK_Selector*
   GetSelector(SUIT_ViewWindow *theWindow)
index 94d69a9cd9d3b08d73add36bbf5f84b793b2149e..b226f7767263878de40db1ebad4ba33837ee60ad 100644 (file)
@@ -137,6 +137,9 @@ SMESHGUI_EXPORT
 SMESHGUI_EXPORT
   void UpdateSelectionProp( SMESHGUI* );
 
+SMESHGUI_EXPORT
+  void UpdateFontProp( SMESHGUI* );
+
   //----------------------------------------------------------------------------
 SMESHGUI_EXPORT
   SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() );
index 5d43fc78ac5bb2b5ccad02a69e2e5f80c4afab0f..5e82b9bb18d16fc5eb2be3411f63342a639aa73c 100644 (file)
         <source>ASPECTRATIO_ELEMENTS</source>
         <translation>Aspect Ratio</translation>
     </message>
-    <message>
-        <source>NODE_POSITION</source>
-        <translation>Position</translation>
-    </message>
-    <message>
-        <source>U_POSITION</source>
-        <translation>U</translation>
-    </message>
-    <message>
-        <source>V_POSITION</source>
-        <translation>V</translation>
-    </message>
     <message>
         <source>COL_ALGO_HEADER</source>
         <translation>Algorithm</translation>
@@ -1490,6 +1478,10 @@ so that the application may crash. Do you wish to continue visualization?</trans
     </message>
     <message>
         <source>SMESH_DRS_4</source>
+        <translation type="unfinished">MED file contains some elements in descending connectivity. They were not read.</translation>
+    </message>
+    <message>
+        <source>SMESH_DRS_5</source>
         <translation>The file is incorrect, some data is missed</translation>
     </message>
     <message>
@@ -1836,6 +1828,10 @@ Check algorithm documentation for supported geometry</translation>
         <source>SMESH_LENGTH</source>
         <translation>Length</translation>
     </message>
+    <message>
+        <source>SMESH_LOGARITHMIC_SCALARBAR</source>
+        <translation>Logarithmic</translation>
+    </message>
     <message>
         <source>SMESH_MAKE_GROUPS</source>
         <translation>Generate groups</translation>
@@ -1910,7 +1906,7 @@ Check algorithm documentation for supported geometry</translation>
     </message>
     <message>
         <source>SMESH_MERGED_NODES</source>
-        <translation>%1 nodes successfully merged.</translation>
+        <translation>%1 groups of nodes successfully merged.</translation>
     </message>
     <message>
         <source>SMESH_NO_ELEMENTS_DETECTED</source>
@@ -2232,6 +2228,22 @@ Check algorithm documentation for supported geometry</translation>
         <source>SMESH_PRECISION</source>
         <translation>Precision</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_NUMBERING</source>
+        <translation>Numbering</translation>
+    </message>
+    <message>
+        <source>PREF_NUMBERING_NODE</source>
+        <translation>Nodes: Color</translation>
+    </message>
+     <message>
+        <source>PREF_NUMBERING_ELEM</source>
+        <translation>Edges: Color</translation>
+    </message>
+    <message>
+        <source>PREF_NUMBERING_FONT</source>
+        <translation>Font</translation>
+    </message>
     <message>
         <source>SMESH_PREFERENCES_SCALARBAR</source>
         <translation>Scalar Bar Preferences</translation>
@@ -2591,6 +2603,10 @@ Check algorithm documentation for supported geometry</translation>
     </message>
     <message>
         <source>SMESH_VISU_PROBLEM</source>
+        <translation>Mesh visualization failed</translation>
+    </message>
+    <message>
+        <source>SMESH_VISU_PROBLEM_MEMORY</source>
         <translation>Mesh visualization failed, probably due to lack of memory</translation>
     </message>
     <message>
@@ -4199,6 +4215,22 @@ Please, create VTK viewer and try again</translation>
         <source>PREF_ELEM_INFO_TREE</source>
         <translation>Tree</translation>
     </message>
+    <message>
+        <source>PREF_ELEM_INFO_GRP_DETAILS</source>
+        <translation>Show details on groups in element information tab</translation>
+    </message>
+    <message>
+        <source>PREF_DUMP_BASE_INFO</source>
+        <translation>Dump base information</translation>
+    </message>
+    <message>
+        <source>PREF_DUMP_ELEM_INFO</source>
+        <translation>Dump element information</translation>
+    </message>
+    <message>
+        <source>PREF_DUMP_ADD_INFO</source>
+        <translation>Dump additional information</translation>
+    </message>
     <message>
         <source>PREF_GPP_NODES_LIMIT</source>
         <translation>Automatic nodes compute limit</translation>
@@ -6396,6 +6428,10 @@ as they are of improper type:
 </context>
 <context>
     <name>SMESHGUI_MeshInfo</name>
+    <message>
+        <source>BASE_INFO</source>
+        <translation>Base information</translation>
+    </message>
     <message>
         <source>NAME_LAB</source>
         <translation>Name:</translation>
@@ -6547,6 +6583,18 @@ as they are of improper type:
         <source>ELEM_MODE</source>
         <translation>Element</translation>
     </message>
+    <message>
+        <source>BUT_DUMP_MESH</source>
+        <translation>&amp;Dump</translation>
+    </message>
+    <message>
+        <source>TEXT_FILES</source>
+        <translation>Text files (*.txt)</translation>
+    </message>
+    <message>
+        <source>SAVE_INFO</source>
+        <translation>Save info</translation>
+    </message>
     <message>
         <source>X_FROM_Y_ITEMS_SHOWN</source>
         <translation>%1-%2 from %3 items shown</translation>
@@ -6554,61 +6602,65 @@ as they are of improper type:
 </context>
 <context>
     <name>SMESHGUI_ElemInfo</name>
+    <message>
+        <source>ELEM_INFO</source>
+        <translation>Element information</translation>
+    </message>
     <message>
         <source>COORDINATES</source>
-        <translation>COORDINATES</translation>
+        <translation>Coordinates</translation>
     </message>
     <message>
         <source>CONNECTIVITY</source>
-        <translation>CONNECTIVITY</translation>
+        <translation>Connectivity</translation>
     </message>
     <message>
         <source>GRAVITY_CENTER</source>
-        <translation>GRAVITY CENTER</translation>
+        <translation>Gravity Center</translation>
     </message>
     <message>
         <source>NODE</source>
-        <translation>NODE</translation>
+        <translation>Node</translation>
     </message>
     <message>
         <source>0D_ELEMENT</source>
-        <translation>0D ELEMENT</translation>
+        <translation>0D Element</translation>
     </message>
     <message>
         <source>0D_ELEMENTS</source>
-        <translation>0D ELEMENTS</translation>
+        <translation>0D Elements</translation>
     </message>
     <message>
         <source>BALL_ELEMENT</source>
-        <translation>BALL ELEMENT</translation>
+        <translation>Ball Element</translation>
     </message>
     <message>
         <source>BALL_ELEMENTS</source>
-        <translation>BALL ELEMENTS</translation>
+        <translation>Ball Elements</translation>
     </message>
     <message>
         <source>EDGE</source>
-        <translation>EDGE</translation>
+        <translation>Edge</translation>
     </message>
     <message>
         <source>EDGES</source>
-        <translation>EDGES</translation>
+        <translation>Edges</translation>
     </message>
     <message>
         <source>FACE</source>
-        <translation>FACE</translation>
+        <translation>Face</translation>
     </message>
     <message>
         <source>FACES</source>
-        <translation>FACES</translation>
+        <translation>Faces</translation>
     </message>
     <message>
         <source>VOLUME</source>
-        <translation>VOLUME</translation>
+        <translation>Volume</translation>
     </message>
     <message>
         <source>VOLUMES</source>
-        <translation>VOLUMES</translation>
+        <translation>Volumes</translation>
     </message>
     <message>
         <source>FREE_NODE</source>
@@ -6616,7 +6668,7 @@ as they are of improper type:
     </message>
     <message>
         <source>TYPE</source>
-        <translation>TYPE</translation>
+        <translation>Type</translation>
     </message>
     <message>
         <source>TRIANGLE</source>
@@ -6656,7 +6708,7 @@ as they are of improper type:
     </message>
     <message>
         <source>QUADRATIC</source>
-        <translation>QUADRATIC</translation>
+        <translation>Quadratic</translation>
     </message>
     <message>
         <source>YES</source>
@@ -6666,6 +6718,57 @@ as they are of improper type:
         <source>NO</source>
         <translation>No</translation>
     </message>
+    <message>
+        <source>BALL_DIAMETER</source>
+        <translation>Diameter</translation>
+    </message>
+    <message>
+        <source>GEOM_VERTEX</source>
+        <translation>Vertex</translation>
+    </message>
+    <message>
+        <source>GEOM_EDGE</source>
+        <translation>Edge</translation>
+    </message>
+    <message>
+        <source>GEOM_FACE</source>
+        <translation>Face</translation>
+    </message>
+    <message>
+        <source>GEOM_SOLID</source>
+        <translation>Solid</translation>
+    </message>
+    <message>
+        <source>GEOM_SHELL</source>
+        <translation>Shell</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE</source>
+        <translation>Shape</translation>
+    </message>
+    <message>
+        <source>POSITION</source>
+        <translation>Position</translation>
+    </message>
+    <message>
+        <source>U_POSITION</source>
+        <translation>U</translation>
+    </message>
+    <message>
+        <source>V_POSITION</source>
+        <translation>V</translation>
+    </message>
+    <message>
+        <source>CONTROLS</source>
+        <translation>Quality Controls</translation>
+    </message>
+</context>
+<context>
+    <name>SMESHGUI_TreeElemInfo</name>
+    <message>
+      <source>SHOW_ITEM_INFO</source>
+      <translation>Show info</translation>
+    </message>
     <message>
         <source>PROPERTY</source>
         <translation>Property</translation>
@@ -6677,6 +6780,10 @@ as they are of improper type:
 </context>
 <context>
     <name>SMESHGUI_AddInfo</name>
+    <message>
+        <source>ADDITIONAL_INFO</source>
+        <translation>Additional information</translation>
+    </message>
     <message>
         <source>NAME</source>
         <translation>Name</translation>
index fad91d48043bbf411dfc679f75fae1a291f1d04e..b322da2b2567d045f91918a7a857babc6bc49613 100755 (executable)
         <source>ASPECTRATIO_ELEMENTS</source>
         <translation>Rapport de forme</translation>
     </message>
-    <message>
-        <source>NODE_POSITION</source>
-        <translation>Position</translation>
-    </message>
-    <message>
-        <source>U_POSITION</source>
-        <translation>U</translation>
-    </message>
-    <message>
-        <source>V_POSITION</source>
-        <translation>V</translation>
-    </message>
     <message>
         <source>COL_ALGO_HEADER</source>
         <translation>Algorithme</translation>
@@ -1462,6 +1450,10 @@ ce qui peut faire planter l&apos;application. Voulez-vous continuer la visualisa
     </message>
     <message>
         <source>SMESH_DRS_4</source>
+        <translation type="unfinished">MED file contains some elements in descending connectivity. They were not read.</translation>
+    </message>
+    <message>
+        <source>SMESH_DRS_5</source>
         <translation>Le fichier n&apos;est pas correct, des données sont manquantes</translation>
     </message>
     <message>
@@ -1808,6 +1800,10 @@ Référez-vous à la documentation sur l&apos;algorithme et la géométrie suppo
         <source>SMESH_LENGTH</source>
         <translation>Longueur</translation>
     </message>
+    <message>
+        <source>SMESH_LOGARITHMIC_SCALARBAR</source>
+        <translation type="unfinished">Logarithmic</translation>
+    </message>
     <message>
         <source>SMESH_MAKE_GROUPS</source>
         <translation>Générer les groupes</translation>
@@ -2204,6 +2200,22 @@ Référez-vous à la documentation sur l&apos;algorithme et la géométrie suppo
         <source>SMESH_PRECISION</source>
         <translation>Précision</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_NUMBERING</source>
+        <translation type="unfinished">Numbering</translation>
+    </message>
+    <message>
+        <source>PREF_NUMBERING_NODE</source>
+        <translation type="unfinished">Nodes: Color</translation>
+    </message>
+     <message>
+        <source>PREF_NUMBERING_ELEM</source>
+        <translation type="unfinished">Edges: Color</translation>
+    </message>
+    <message>
+        <source>PREF_NUMBERING_FONT</source>
+        <translation>Police</translation>
+    </message>
     <message>
         <source>SMESH_PREFERENCES_SCALARBAR</source>
         <translation>Préférences de la barre d&apos;échelle</translation>
@@ -4154,6 +4166,22 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
         <source>PREF_ELEM_INFO_TREE</source>
         <translation>Arbre</translation>
     </message>
+    <message>
+        <source>PREF_ELEM_INFO_GRP_DETAILS</source>
+        <translation type="unfinished">Show details on groups in element information tab</translation>
+    </message>
+    <message>
+        <source>PREF_DUMP_BASE_INFO</source>
+        <translation type="unfinished">Dump base information</translation>
+    </message>
+    <message>
+        <source>PREF_DUMP_ELEM_INFO</source>
+        <translation type="unfinished">Dump element information</translation>
+    </message>
+    <message>
+        <source>PREF_DUMP_ADD_INFO</source>
+        <translation type="unfinished">Dump additional information</translation>
+    </message>
     <message>
         <source>PREF_GPP_NODES_LIMIT</source>
         <translation>Calcul automatique du nombre de nœuds: limite</translation>
@@ -6315,6 +6343,10 @@ en raison de leurs types incompatibles:
 </context>
 <context>
     <name>SMESHGUI_MeshInfo</name>
+    <message>
+        <source>BASE_INFO</source>
+        <translation>Informations de base</translation>
+    </message>
     <message>
         <source>NAME_LAB</source>
         <translation>Nom:</translation>
@@ -6466,6 +6498,18 @@ en raison de leurs types incompatibles:
         <source>ELEM_MODE</source>
         <translation>Elément</translation>
     </message>
+    <message>
+        <source>BUT_DUMP_MESH</source>
+        <translation>&amp;Dump</translation>
+    </message>
+    <message>
+        <source>TEXT_FILES</source>
+        <translation type="unfinished">Text files (*.txt)</translation>
+    </message>
+    <message>
+        <source>SAVE_INFO</source>
+        <translation type="unfinished">Save info</translation>
+    </message>
     <message>
         <source>X_FROM_Y_ITEMS_SHOWN</source>
         <translation>%1-%2 sur %3 éléments affichés</translation>
@@ -6473,6 +6517,10 @@ en raison de leurs types incompatibles:
 </context>
 <context>
     <name>SMESHGUI_ElemInfo</name>
+    <message>
+        <source>ELEM_INFO</source>
+        <translation>Infos sur les éléments</translation>
+    </message>
     <message>
         <source>COORDINATES</source>
         <translation>COORDONNÉES</translation>
@@ -6585,6 +6633,57 @@ en raison de leurs types incompatibles:
         <source>NO</source>
         <translation>Non</translation>
     </message>
+    <message>
+        <source>BALL_DIAMETER</source>
+        <translation>Diamètre</translation>
+    </message>
+    <message>
+        <source>GEOM_VERTEX</source>
+        <translation>Sommet</translation>
+    </message>
+    <message>
+        <source>GEOM_EDGE</source>
+        <translation>Arête</translation>
+    </message>
+    <message>
+        <source>GEOM_FACE</source>
+        <translation>Face</translation>
+    </message>
+    <message>
+        <source>GEOM_SOLID</source>
+        <translation>Solide</translation>
+    </message>
+    <message>
+        <source>GEOM_SHELL</source>
+        <translation>Coque</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE</source>
+        <translation>Forme</translation>
+    </message>
+    <message>
+        <source>POSITION</source>
+        <translation>Position</translation>
+    </message>
+    <message>
+        <source>U_POSITION</source>
+        <translation>U</translation>
+    </message>
+    <message>
+        <source>V_POSITION</source>
+        <translation>V</translation>
+    </message>
+    <message>
+        <source>CONTROLS</source>
+        <translation>Quality Controls</translation>
+    </message>
+</context>
+<context>
+    <name>SMESHGUI_TreeElemInfo</name>
+    <message>
+      <source>SHOW_ITEM_INFO</source>
+      <translation>Show info</translation>
+    </message>
     <message>
         <source>PROPERTY</source>
         <translation>Propriété</translation>
@@ -6596,6 +6695,10 @@ en raison de leurs types incompatibles:
 </context>
 <context>
     <name>SMESHGUI_AddInfo</name>
+    <message>
+        <source>ADDITIONAL_INFO</source>
+        <translation>Infos détaillées</translation>
+    </message>
     <message>
         <source>NAME</source>
         <translation>Nom</translation>
index a90736ca50539a2e9d7d72003f7edbb4931919d1..7f5cac1403dc1ca4e60c5e912f4d290ed3f7197d 100644 (file)
@@ -33,7 +33,8 @@ salomeinclude_HEADERS = \
        SMESH_Comment.hxx \
        SMESH_ComputeError.hxx \
        SMESH_File.hxx \
-       SMESH_Utils.hxx
+       SMESH_Utils.hxx \
+       SMESH_TryCatch.hxx
 
 # Libraries targets
 
@@ -44,6 +45,7 @@ dist_libSMESHUtils_la_SOURCES = \
        SMESH_Quadtree.cxx \
        SMESH_Octree.cxx \
        SMESH_OctreeNode.cxx \
+       SMESH_TryCatch.cxx \
        SMESH_File.cxx
 
 # additionnal information to compile and link file
index b28dc7d67e2e666aac1ab76e6b059d443a544a8d..205e6aba2054940564708c93c9d10f309e232e27 100644 (file)
@@ -957,10 +957,10 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord )
 /*!
  * \brief Return number of wires and a list of oredered edges.
  *  \param theFace - the face to process
- *  \param theFirstVertex - the vertex of the outer wire to set first in the returned
- *         list ( theFirstVertex may be NULL )
  *  \param theEdges - all ordered edges of theFace (outer edges goes first).
  *  \param theNbEdgesInWires - nb of edges (== nb of vertices in closed wire) in each wire
+ *  \param theFirstVertex - the vertex of the outer wire to set first in the returned
+ *         list ( theFirstVertex may be NULL )
  *  \param theShapeAnalysisAlgo - if true, ShapeAnalysis::OuterWire() is used to find
  *         the outer wire else BRepTools::OuterWire() is used.
  *  \retval int - nb of wires
@@ -972,9 +972,9 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord )
 //================================================================================
 
 int SMESH_Block::GetOrderedEdges (const TopoDS_Face&   theFace,
-                                  TopoDS_Vertex        theFirstVertex,
                                   list< TopoDS_Edge >& theEdges,
                                   list< int >  &       theNbEdgesInWires,
+                                  TopoDS_Vertex        theFirstVertex,
                                   const bool           theShapeAnalysisAlgo)
 {
   // put wires in a list, so that an outer wire comes first
@@ -1352,7 +1352,7 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell&         theShell,
   // find bottom edges and veritices
   list< TopoDS_Edge > eList;
   list< int >         nbVertexInWires;
-  GetOrderedEdges( TopoDS::Face( Fxy0 ), TopoDS::Vertex( V000 ), eList, nbVertexInWires );
+  GetOrderedEdges( TopoDS::Face( Fxy0 ), eList, nbVertexInWires, TopoDS::Vertex( V000 ) );
   if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) {
     MESSAGE(" LoadBlockShapes() error ");
     return false;
@@ -1374,7 +1374,7 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell&         theShell,
 
   // find top edges and veritices
   eList.clear();
-  GetOrderedEdges( TopoDS::Face( Fxy1 ), TopoDS::Vertex( V001 ), eList, nbVertexInWires );
+  GetOrderedEdges( TopoDS::Face( Fxy1 ), eList, nbVertexInWires, TopoDS::Vertex( V001 ) );
   if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) {
     MESSAGE(" LoadBlockShapes() error ");
     return false;
index 4971db99af4a5371a8aa889649e4db1c972617b6..65c41bbec8e25858dd985fee27481da144bd1fc4 100644 (file)
@@ -256,7 +256,7 @@ public:
 
  public:
   // ---------------
-  // Block geomerty
+  // Block geometry
   // ---------------
 
   
@@ -275,9 +275,9 @@ public:
   // Return true if an in-block parameter increases along theEdge curve
 
   static int GetOrderedEdges (const TopoDS_Face&        theFace,
-                              TopoDS_Vertex             theFirstVertex,
                               std::list< TopoDS_Edge >& theEdges,
                               std::list< int >  &       theNbEdgesInWires,
+                              TopoDS_Vertex             theFirstVertex=TopoDS_Vertex(),
                               const bool                theShapeAnalysisAlgo=false);
   // Return nb wires and a list of oredered edges.
   // It is used to assign indices to subshapes.
diff --git a/src/SMESHUtils/SMESH_TryCatch.cxx b/src/SMESHUtils/SMESH_TryCatch.cxx
new file mode 100644 (file)
index 0000000..78808cf
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "SMESH_TryCatch.hxx"
+
+void SMESH::throwSalomeEx(const char* txt)
+{
+  throw SALOME_Exception( txt );
+}
+
+void SMESH::doNothing(const char* txt)
+{
+  MESSAGE( txt << " " << __FILE__ << ": " << __LINE__ );
+}
+
diff --git a/src/SMESHUtils/SMESH_TryCatch.hxx b/src/SMESHUtils/SMESH_TryCatch.hxx
new file mode 100644 (file)
index 0000000..18b9eec
--- /dev/null
@@ -0,0 +1,109 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : SMESH_TryCatch.hxx
+// Created   : Mon Dec 17 15:43:38 2012
+// Author    : Edward AGAPOV (eap)
+
+#ifndef __SMESH_TryCatch_HXX__
+#define __SMESH_TryCatch_HXX__
+
+#include "SMESH_Comment.hxx"
+#include "SMESH_ComputeError.hxx"
+#include "SMESH_Utils.hxx"
+
+#include <Utils_SALOME_Exception.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Basics_OCCTVersion.hxx>
+#include <utilities.h>
+
+// IMPORTANT: include this file _after_ OCC ones, else OCC_CATCH_SIGNALS can be undefined!
+
+#ifndef OCC_CATCH_SIGNALS
+#define OCC_CATCH_SIGNALS
+#endif
+
+// Define macros to catch and convert some of possible exceptions into text or SALOME_Exception
+
+//-------------------------------------------------------------------------------------
+#define SMESH_TRY                               \
+  try {                                         \
+  OCC_CATCH_SIGNALS                             \
+
+//-------------------------------------------------------------------------------------
+// A macro to add a custom catch clause to SMESH_CATCH
+// To add your own catch close, define SMY_OWN_CATCH macro before including this file.
+#ifndef SMY_OWN_CATCH
+#define SMY_OWN_CATCH
+#endif
+
+//-------------------------------------------------------------------------------------
+// A macro allowing to retrieve a result returned by onExceptionFun
+#define SMESH_CAUGHT
+
+//-------------------------------------------------------------------------------------
+// A macro makes description of a caught exception and calls onExceptionFun(const char*).
+// Two onExceptionFun() are defined here: SMESH::throwSalomeEx() and SMESH::doNothing().
+// To add your own catch close, define SMY_OWN_CATCH macro before including this file.
+
+#define SMESH_CATCH( onExceptionFun )                                   \
+  }                                                                     \
+  catch (Standard_Failure& ex)                                          \
+  {                                                                     \
+    SMESH_Comment text("OCCT Exception: ");                             \
+    text << ": " << ex.DynamicType()->Name();                           \
+    if ( ex.GetMessageString() && strlen( ex.GetMessageString() ))      \
+      text << ": " << ex.GetMessageString();                            \
+    SMESH_CAUGHT onExceptionFun( text );                                \
+  }                                                                     \
+  catch ( ::SMESH_ComputeError& ce )                                    \
+  {                                                                     \
+    if ( !ce.myComment.empty() )                                        \
+      SMESH_CAUGHT onExceptionFun( ce.myComment.c_str() );              \
+    else if ( ce.IsCommon() )                                           \
+      SMESH_CAUGHT onExceptionFun( ce.CommonName().c_str() );           \
+    else                                                                \
+      SMESH_CAUGHT onExceptionFun                                       \
+        (SMESH_Comment("SMESH_ComputeError: ") << ce.myName );          \
+  }                                                                     \
+  catch ( const std::exception& ex)                                     \
+  {                                                                     \
+    SMESH_CAUGHT onExceptionFun( ex.what() );                           \
+  }                                                                     \
+                                                                        \
+  SMY_OWN_CATCH                                                         \
+                                                                        \
+  catch (...)                                                           \
+  {                                                                     \
+    SMESH_CAUGHT onExceptionFun("Unknown Exception caught");            \
+  }
+
+//-------------------------------------------------------------------------------------
+// Functions that can be used as an argument of SMESH_CATCH
+
+namespace SMESH
+{
+  SMESHUtils_EXPORT void throwSalomeEx(const char* txt);
+  SMESHUtils_EXPORT void doNothing(const char* txt);
+}
+
+#endif
index 0dbdd74226f2f5ef47a19b241e021a0b25823b07..daadb673c93f6fbb93438dfa09d1923072712c92 100644 (file)
@@ -48,6 +48,9 @@ typedef std::set< const SMDS_MeshNode*,    TIDCompare >      TIDSortedNodeSet;
 
 typedef std::pair< const SMDS_MeshNode*, const SMDS_MeshNode* >   NLink;
 
+struct faceQuadStruct; // defined in StdMeshers_Quadrangle_2D.hxx
+typedef boost::shared_ptr<faceQuadStruct> TFaceQuadStructPtr;
+
 
 namespace SMESHUtils
 {
index 08ba9b7021475c0b7c8d924aa5b2dab92b1d7a5d..9ea8491ddf0839778106a052be8b28ff69339893 100644 (file)
@@ -51,10 +51,6 @@ salomeinclude_HEADERS = \
        SMESH_MeshPartDS.hxx \
        SMESH.hxx
 
-# Scripts to be installed.
-dist_salomescript_DATA= \
-       smeshpy.py
-
 # Libraries targets
 
 lib_LTLIBRARIES = libSMESHEngine.la
index 4dc84a2a15083b369efa9098fc46631bdc267555..57a076883f6fa04f107a99bd22e86be21a89fd85 100644 (file)
 //
 #include "SMESH_2smeshpy.hxx"
 
-#include "utilities.h"
 #include "SMESH_PythonDump.hxx"
 #include "SMESH_NoteBook.hxx"
 #include "SMESH_Filter_i.hxx"
 
+#include <SALOMEDS_wrap.hxx>
+#include <utilities.h>
+
 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
 #include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
 
@@ -431,7 +433,7 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
   {
     // find a GEOM entry
     _pyID geomID;
-    SALOMEDS::SComponent_var geomComp = theStudy->FindComponent("GEOM");
+    SALOMEDS::SComponent_wrap geomComp = theStudy->FindComponent("GEOM");
     if ( geomComp->_is_nil() ) return;
     CORBA::String_var entry = geomComp->GetID();
     geomID = entry.in();
@@ -1329,7 +1331,7 @@ bool _pyGen::IsNotPublished(const _pyID& theObjID) const
   // either the SMESH object is not in study or it is a GEOM object
   if ( IsGeomObject( theObjID ))
   {
-    SALOMEDS::SObject_var so = myStudy->FindObjectID( theObjID.ToCString() );
+    SALOMEDS::SObject_wrap so = myStudy->FindObjectID( theObjID.ToCString() );
     if ( so->_is_nil() ) return true;
     CORBA::Object_var obj = so->GetObject();
     return CORBA::is_nil( obj );
index e76a8a7360fe547ea3e487b2b54a340cd304def2..b609c57501ef9d686398557ee7507a9d9dfeb5dc 100644 (file)
 //  Module  : SMESH
 
 #include "SMESH_PythonDump.hxx"
-#include "SMESH_Gen_i.hxx"
+
+#include "SMESH_2smeshpy.hxx"
+#include "SMESH_Comment.hxx"
 #include "SMESH_Filter_i.hxx"
+#include "SMESH_Gen_i.hxx"
 #include "SMESH_MeshEditor_i.hxx"
-#include "SMESH_2smeshpy.hxx"
+
+#include <SALOMEDS_wrap.hxx>
 
 #include <TColStd_HSequenceOfInteger.hxx>
 #include <TCollection_AsciiString.hxx>
-#include <SMESH_Comment.hxx>
-
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -72,7 +74,7 @@ namespace SMESH
       SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
       std::string aString = myStream.str();
       TCollection_AsciiString aCollection(Standard_CString(aString.c_str()));
-      SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+      SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
       if(!aStudy->_is_nil() && !aCollection.IsEmpty()){
         aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
         if(MYDEBUG) MESSAGE(aString);
@@ -238,10 +240,13 @@ namespace SMESH
   TPythonDump::
   operator<<(SALOMEDS::SObject_ptr aSObject)
   {
-    if ( !aSObject->_is_nil() )
-      myStream << aSObject->GetID();
-    else
+    if ( !aSObject->_is_nil() ) {
+      CORBA::String_var entry = aSObject->GetID();
+      myStream << entry.in();
+    }
+    else {
       myStream << NotPublishedObjectName();
+    }
     return *this;
   }
 
@@ -249,9 +254,9 @@ namespace SMESH
   TPythonDump::
   operator<<(CORBA::Object_ptr theArg)
   {
-    SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
-    SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
-    SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+    SMESH_Gen_i*          aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+    SALOMEDS::Study_var      aStudy = aSMESHGen->GetCurrentStudy();
+    SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
     if(!aSObject->_is_nil()) {
       CORBA::String_var id = aSObject->GetID();
       myStream << id;
@@ -270,8 +275,8 @@ namespace SMESH
   TPythonDump::
   operator<<(SMESH::SMESH_Hypothesis_ptr theArg)
   {
-    SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
-    SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+    SALOMEDS::Study_var     aStudy = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
+    SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
     if(aSObject->_is_nil() && !CORBA::is_nil(theArg))
       myStream << "hyp_" << theArg->GetId();
     else
@@ -285,18 +290,22 @@ namespace SMESH
   {
     if ( CORBA::is_nil( theArg ) )
       return *this << "None";
-    SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
-    SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
-    SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+    SMESH_Gen_i*          aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+    SALOMEDS::Study_var      aStudy = aSMESHGen->GetCurrentStudy();
+    SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
     if(!aSObject->_is_nil())
+    {
       return *this << aSObject;
+    }
     if ( SMESH::Filter_i* filter = SMESH::DownCast<SMESH::Filter_i*>( theArg ))
+    {
       return *this << filter;
-    SMESH::SMESH_Mesh_var mesh = theArg->GetMesh();
-    if ( !theArg->_is_equivalent( mesh ))
+    }
+    if ( SMESH_MeshEditor_i::IsTemporaryIDSource( theArg ))
     {
-      SMESH::long_array_var anElementsId = theArg->GetIDs();
-      SMESH::array_of_ElementType_var types =  theArg->GetTypes();
+      SMESH::SMESH_Mesh_var            mesh = theArg->GetMesh();
+      SMESH::long_array_var    anElementsId = theArg->GetIDs();
+      SMESH::array_of_ElementType_var types = theArg->GetTypes();
       SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
       return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")";
     }
@@ -590,7 +599,8 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
   if (CORBA::is_nil(aStudy))
     return new Engines::TMPFile(0);
 
-  SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType());
+  CORBA::String_var compDataType = ComponentDataType();
+  SALOMEDS::SObject_wrap aSO = aStudy->FindComponent( compDataType.in() );
   if (CORBA::is_nil(aSO))
     return new Engines::TMPFile(0);
 
@@ -599,9 +609,9 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
   Resource_DataMapOfAsciiStringAsciiString aMapNames;
   //TCollection_AsciiString s ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
 
-  SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
+  SALOMEDS::ChildIterator_wrap Itr = aStudy->NewChildIterator(aSO);
   for (Itr->InitEx(true); Itr->More(); Itr->Next()) {
-    SALOMEDS::SObject_var aValue = Itr->Value();
+    SALOMEDS::SObject_wrap aValue = Itr->Value();
     CORBA::String_var anID = aValue->GetID();
     CORBA::String_var aName = aValue->GetName();
     TCollection_AsciiString aGUIName ( (char*) aName.in() );
@@ -613,13 +623,15 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
   }
 
   // Get trace of restored study
-  //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
+  //SALOMEDS::SObject_wrap aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  SALOMEDS::GenericAttribute_var anAttr =
+  SALOMEDS::GenericAttribute_wrap anAttr =
     aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
 
-  char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
-  TCollection_AsciiString aSavedTrace (oldValue);
+  SALOMEDS::AttributePythonObject_var pyAttr =
+    SALOMEDS::AttributePythonObject::_narrow(anAttr);
+  CORBA::String_var oldValue = pyAttr->GetObject();
+  TCollection_AsciiString aSavedTrace (oldValue.in());
 
   // Add trace of API methods calls and replace study entries by names
   TCollection_AsciiString aScript;
@@ -675,14 +687,16 @@ void SMESH_Gen_i::SavePython (SALOMEDS::Study_ptr theStudy)
   TCollection_AsciiString aScript = GetNewPythonLines(theStudy->StudyId());
 
   // Check contents of PythonObject attribute
-  SALOMEDS::SObject_var aSO = theStudy->FindComponent(ComponentDataType());
-  //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
+  CORBA::String_var compDataType = ComponentDataType();
+  SALOMEDS::SObject_wrap aSO = theStudy->FindComponent( compDataType.in() );
   SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
-  SALOMEDS::GenericAttribute_var anAttr =
+  SALOMEDS::GenericAttribute_wrap anAttr =
     aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
 
-  char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
-  TCollection_AsciiString oldScript (oldValue);
+  SALOMEDS::AttributePythonObject_var pyAttr =
+    SALOMEDS::AttributePythonObject::_narrow(anAttr);
+  CORBA::String_var oldValue = pyAttr->GetObject();
+  TCollection_AsciiString oldScript (oldValue.in());
 
   if (oldScript.Length() > 0) {
     oldScript += "\n";
@@ -692,7 +706,7 @@ void SMESH_Gen_i::SavePython (SALOMEDS::Study_ptr theStudy)
   }
 
   // Store in PythonObject attribute
-  SALOMEDS::AttributePythonObject::_narrow(anAttr)->SetObject(oldScript.ToCString(), 1);
+  pyAttr->SetObject(oldScript.ToCString(), 1);
 
   // Clean trace of API methods calls
   CleanPythonTrace(theStudy->StudyId());
@@ -776,7 +790,9 @@ namespace {
       isValidName = false;
     }
     // shorten names like CartesianParameters3D_400_400_400_1000000_1
-    if ( aName.Length() > 20 && nbUnderscore > 2 )
+    const int nbAllowedUnderscore = 3; /* changed from 2 to 3 by an user request
+                                          posted to SALOME Forum */
+    if ( aName.Length() > 20 && nbUnderscore > nbAllowedUnderscore )
     {
       p = aName.Location( "_", 20, aName.Length());
       if ( p > 1 )
@@ -792,14 +808,14 @@ namespace {
  */
 //=============================================================================
 TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
-                        (SALOMEDS::Study_ptr theStudy,
+                        (SALOMEDS::Study_ptr                       theStudy,
                          Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
                          Resource_DataMapOfAsciiStringAsciiString& theNames,
-                         bool isPublished,
-                         bool isMultiFile,
-                         bool isHistoricalDump,
-                         bool& aValidScript,
-                         const TCollection_AsciiString& theSavedTrace)
+                         bool                                      isPublished,
+                         bool                                      isMultiFile,
+                         bool                                      isHistoricalDump,
+                         bool&                                     aValidScript,
+                         const TCollection_AsciiString&            theSavedTrace)
 {
   int aStudyID = theStudy->StudyId();
 
@@ -1014,7 +1030,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
   if (isPublished)
   {
     //Output the script that sets up the visual parameters.
-    char* script = theStudy->GetDefaultScript(ComponentDataType(), "\t");
+    CORBA::String_var compDataType = ComponentDataType();
+    char* script = theStudy->GetDefaultScript( compDataType.in(), "\t");
     if (script && strlen(script) > 0) {
       anUpdatedScript += "\n\n\t### Store presentation parameters of displayed objects\n";
       anUpdatedScript += script;
index fc5314b8cbf339ae8721f9bd3ab80bd492256889..f7040c5abbea6916a6efc1c672d8a54192e68fa3 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Filter_i.cxx
 //  Author : Alexey Petrov, OCC
 //  Module : SMESH
-//
-#include "SMESH_Filter_i.hxx"
 
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_PythonDump.hxx"
+#include "SMESH_Filter_i.hxx"
 
+#include "SMDS_ElemIterator.hxx"
 #include "SMDS_Mesh.hxx"
-#include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshElement.hxx"
-#include "SMDS_ElemIterator.hxx"
-
+#include "SMDS_MeshNode.hxx"
 #include "SMESHDS_Mesh.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include <SALOMEDS_wrap.hxx>
 
 #include <BRep_Tool.hxx>
 #include <Geom_CylindricalSurface.hxx>
@@ -496,7 +495,9 @@ static TopoDS_Shape getShapeByName( const char* theName )
       {
         CORBA::Object_var        anObj = aList[ 0 ]->GetObject();
         GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( anObj );
-        return aSMESHGen->GeomObjectToShape( aGeomObj );
+        TopoDS_Shape             shape = aSMESHGen->GeomObjectToShape( aGeomObj );
+        SALOME::UnRegister( aList ); // UnRegister() objects in aList
+        return shape;
       }
     }
   }
@@ -509,7 +510,7 @@ static TopoDS_Shape getShapeByID (const char* theID)
     SMESH_Gen_i*     aSMESHGen = SMESH_Gen_i::GetSMESHGen();
     SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
     if ( !aStudy->_is_nil() ) {
-      SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID);
+      SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
       if ( !aSObj->_is_nil() ) {
         CORBA::Object_var          obj = aSObj->GetObject();
         GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(obj);
@@ -526,7 +527,7 @@ static std::string getShapeNameByID (const char* theID)
     SMESH_Gen_i*     aSMESHGen = SMESH_Gen_i::GetSMESHGen();
     SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
     if ( !aStudy->_is_nil() ) {
-      SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID);
+      SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
       if ( !aSObj->_is_nil() ) {
         CORBA::String_var name = aSObj->GetName();
         return name.in();
@@ -578,12 +579,12 @@ CORBA::Double NumericalFunctor_i::GetValue( CORBA::Long theId )
   return myNumericalFunctorPtr->GetValue( theId );
 }
 
-SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals)
+SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic)
 {
   std::vector<int> nbEvents;
   std::vector<double> funValues;
   std::vector<int> elements;
-  myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements);
+  myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements,0,isLogarithmic);
 
 #ifdef WIN32
   nbIntervals = CORBA::Short( min( nbEvents.size(), funValues.size() - 1));
index cb82aa6d5637d0448f017525c07789acd44ed5d5..d874819a807e01cc112bcf1c1a96ff30e4b3e98b 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Filter_i.hxx
 //  Author : Alexey Petrov, OCC
 //  Module : SMESH
-//
+
 #ifndef _SMESH_FILTER_I_HXX_
 #define _SMESH_FILTER_I_HXX_
 
@@ -162,7 +161,7 @@ namespace SMESH
   {
   public:
     CORBA::Double                   GetValue( CORBA::Long theElementId );
-    SMESH::Histogram*               GetHistogram(CORBA::Short nbIntervals);
+    SMESH::Histogram*               GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic);
     void                            SetPrecision( CORBA::Long thePrecision );
     CORBA::Long                     GetPrecision();
     Controls::NumericalFunctorPtr   GetNumericalFunctor();
index ca74c6a0b834164368cd28da71311f63475d8bd7..8fb303ad35ce421875c92c6f75190fc78a4ae206 100644 (file)
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
 #include CORBA_CLIENT_HEADER(SALOME_Session)
 
+// helpers about SALOME::GenericObj
+#include <SALOMEDS_wrap.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
+#include <GEOM_wrap.hxx>
+
 #include <map>
 #include <fstream>
 #include <cstdio>
@@ -176,16 +181,16 @@ PortableServer::ServantBase_var SMESH_Gen_i::GetServant( CORBA::Object_ptr theOb
 
 CORBA::Object_var SMESH_Gen_i::SObjectToObject( SALOMEDS::SObject_ptr theSObject )
 {
-  SALOMEDS::GenericAttribute_var anAttr;
+  SALOMEDS::GenericAttribute_wrap anAttr;
   CORBA::Object_var anObj;
   if ( !theSObject->_is_nil() ) {
     try {
-      if( theSObject->FindAttribute( anAttr, "AttributeIOR" ) ) {
-        SALOMEDS::AttributeIOR_var anIOR  = SALOMEDS::AttributeIOR::_narrow( anAttr );
+      if( theSObject->FindAttribute( anAttr.inout(), "AttributeIOR" ) ) {
+        SALOMEDS::AttributeIOR_wrap anIOR  = anAttr;
         CORBA::String_var aValue = anIOR->Value();
         if( strcmp( aValue, "" ) != 0 )
           anObj = GetORB()->string_to_object( aValue );
-        }
+      }
     }
     catch( ... ) {
       INFOS( "SObjectToObject - Unknown exception was caught!!!" );
@@ -234,7 +239,7 @@ SALOME_LifeCycleCORBA*  SMESH_Gen_i::GetLCC() {
  *  Get GEOM::GEOM_Gen reference
  */
 //=============================================================================
-GEOM::GEOM_Gen_ptr SMESH_Gen_i::GetGeomEngine() {
+GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine() {
   //CCRT GEOM::GEOM_Gen_var aGeomEngine =
   //CCRT   GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") );
   //CCRT return aGeomEngine._retn();
@@ -341,7 +346,7 @@ SMESH_Gen_i::~SMESH_Gen_i()
   }
   myStudyContextMap.clear();
   // delete shape reader
-  if ( !myShapeReader )
+  if ( myShapeReader )
     delete myShapeReader;
 }
 
@@ -604,29 +609,27 @@ void SMESH_Gen_i::setCurrentStudy( SALOMEDS::Study_ptr theStudy,
   myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy );
   // create study context, if it doesn't exist and set current study
   int studyId = GetCurrentStudyID();
-  if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() ) {
+  if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() )
     myStudyContextMap[ studyId ] = new StudyContext;
-  }
 
   // myCurrentStudy may be nil
   if ( !theStudyIsBeingClosed && !CORBA::is_nil( myCurrentStudy ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
-    if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
-      aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() );
-
+    SALOMEDS::SComponent_wrap GEOM_var = myCurrentStudy->FindComponent( "GEOM" );
+    if( !GEOM_var->_is_nil() )
+      aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() );
     // NPAL16168, issue 0020210
     // Let meshes update their data depending on GEOM groups that could change
     if ( curStudyId != studyId )
     {
-      //SALOMEDS::SComponent_var me =  PublishComponent( myCurrentStudy );
-      SALOMEDS::SComponent_var me = SALOMEDS::SComponent::_narrow
-        ( myCurrentStudy->FindComponent( ComponentDataType() ) );
+      CORBA::String_var compDataType = ComponentDataType();
+      SALOMEDS::SComponent_wrap me = myCurrentStudy->FindComponent( compDataType.in() );
       if ( !me->_is_nil() ) {
-        SALOMEDS::ChildIterator_var anIter = myCurrentStudy->NewChildIterator( me );
+        SALOMEDS::ChildIterator_wrap anIter = myCurrentStudy->NewChildIterator( me );
         for ( ; anIter->More(); anIter->Next() ) {
-          SALOMEDS::SObject_var so = anIter->Value();
-          CORBA::Object_var    ior = SObjectToObject( so );
-          if ( SMESH_Mesh_i*  mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
+          SALOMEDS::SObject_wrap so = anIter->Value();
+          CORBA::Object_var     ior = SObjectToObject( so );
+          if ( SMESH_Mesh_i*   mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
             mesh->CheckGeomGroupModif();
         }
       }
@@ -682,7 +685,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::CreateHypothesis( const char* theHypNam
 
   // Publish hypothesis/algorithm in the study
   if ( CanPublishInStudy( hyp ) ) {
-    SALOMEDS::SObject_var aSO = PublishHypothesis( myCurrentStudy, hyp );
+    SALOMEDS::SObject_wrap aSO = PublishHypothesis( myCurrentStudy, hyp );
     if ( !aSO->_is_nil() ) {
       // Update Python script
       TPythonDump() << aSO << " = " << this << ".CreateHypothesis('"
@@ -746,9 +749,11 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char*           theHypType,
       // check local shape
       SMESH::ListOfHypothesis_var aHypList = theMesh->GetHypothesisList( theGeom );
       int nbLocalHyps = aHypList->length();
-      for ( int i = 0; i < nbLocalHyps; i++ )
-        if ( strcmp( theHypType, aHypList[i]->GetName() ) == 0 ) // FOUND local!
+      for ( int i = 0; i < nbLocalHyps; i++ ) {
+        CORBA::String_var hypName = aHypList[i]->GetName();
+        if ( strcmp( theHypType, hypName.in() ) == 0 ) // FOUND local!
           return SMESH::SMESH_Hypothesis::_duplicate( aHypList[i] );
+      }
       // check super shapes
       TopTools_ListIteratorOfListOfShape itShape( mesh->GetAncestors( shape ));
       while ( nbLocalHyps == 0 && itShape.More() ) {
@@ -896,7 +901,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj
   if ( CanPublishInStudy( mesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, mesh.in() );
+    SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, mesh.in() );
     aStudyBuilder->CommitCommand();
     if ( !aSO->_is_nil() ) {
       // Update Python script
@@ -927,7 +932,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateEmptyMesh()
   if ( CanPublishInStudy( mesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, mesh.in() );
+    SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, mesh.in() );
     aStudyBuilder->CommitCommand();
     if ( !aSO->_is_nil() ) {
       // Update Python script
@@ -958,7 +963,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName
   if ( CanPublishInStudy( aMesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
+    SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
     aStudyBuilder->CommitCommand();
     if ( !aSO->_is_nil() ) {
       // Update Python script
@@ -990,6 +995,13 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa
                                                            const char* theCommandNameForPython,
                                                            const char* theFileNameForPython)
 {
+#ifdef WIN32
+  char bname[ _MAX_FNAME ];
+  _splitpath( theFileNameForPython, NULL, NULL, bname, NULL );
+  string aFileName = bname;
+#else
+  string aFileName = basename( theFileNameForPython );
+#endif
   // Retrieve mesh names from the file
   DriverMED_R_SMESHDS_Mesh myReader;
   myReader.SetFile( theFileName );
@@ -1020,9 +1032,12 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMEDorSAUV( const char* theFileNa
       SMESH::SMESH_Mesh_var mesh = createMesh();
 
       // publish mesh in the study
-      SALOMEDS::SObject_var aSO;
+      SALOMEDS::SObject_wrap aSO;
       if ( CanPublishInStudy( mesh ) )
-        aSO = PublishMesh( myCurrentStudy, mesh.in(), (*it).c_str() );
+        // little trick: for MED file theFileName and theFileNameForPython are the same, but they are different for SAUV
+        // - as names of meshes are stored in MED file, we use them for data publishing
+        // - as mesh name is not stored in UNV file, we use file name as name of mesh when publishing data
+        aSO = PublishMesh( myCurrentStudy, mesh.in(), ( theFileName == theFileNameForPython ) ? (*it).c_str() : aFileName.c_str() );
       if ( !aSO->_is_nil() ) {
         // Python Dump
         aPythonDump << aSO;
@@ -1120,12 +1135,19 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName
   if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshesFromSTL" );
 
   SMESH::SMESH_Mesh_var aMesh = createMesh();
-  string aFileName;
+  //string aFileName;
+#ifdef WIN32
+  char bname[ _MAX_FNAME ];
+  _splitpath( theFileName, NULL, NULL, bname, NULL );
+  string aFileName = bname;
+#else
+  string aFileName = basename( theFileName );
+#endif
   // publish mesh in the study
   if ( CanPublishInStudy( aMesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    SALOMEDS::SObject_var aSO = PublishInStudy
+    SALOMEDS::SObject_wrap aSO = PublishInStudy
       ( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
     aStudyBuilder->CommitCommand();
     if ( !aSO->_is_nil() ) {
@@ -1199,15 +1221,17 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char* theFileName,
 
         meshServant->GetImpl().GetMeshDS()->Modified();
         // publish mesh in the study
-        SALOMEDS::SObject_var aSO;
+        SALOMEDS::SObject_wrap aSO;
         if ( CanPublishInStudy( mesh ) )
           aSO = PublishMesh( myCurrentStudy, mesh.in(), meshName.c_str() );
 
         // Python Dump
-        if ( !aSO->_is_nil() )
+        if ( !aSO->_is_nil() ) {
           aPythonDump << aSO;
-        else
+        }
+        else {
           aPythonDump << "mesh_" << i;
+        }
       }
       aStudyBuilder->CommitCommand();
     }
@@ -1250,7 +1274,7 @@ SMESH_Gen_i::CreateMeshesFromGMF( const char*             theFileName,
   if ( CanPublishInStudy( aMesh ) ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
     aStudyBuilder->NewCommand();  // There is a transaction
-    SALOMEDS::SObject_var aSO = PublishInStudy
+    SALOMEDS::SObject_wrap aSO = PublishInStudy
       ( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
     aStudyBuilder->CommitCommand();
     if ( !aSO->_is_nil() ) {
@@ -1320,16 +1344,16 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::GetAlgoSO(const ::SMESH_Algo* algo)
   if ( algo ) {
     if ( !myCurrentStudy->_is_nil() ) {
       // find algo in the study
-      SALOMEDS::SComponent_var father = SALOMEDS::SComponent::_narrow
-        ( myCurrentStudy->FindComponent( ComponentDataType() ) );
+      CORBA::String_var compDataType  = ComponentDataType();
+      SALOMEDS::SComponent_wrap father = myCurrentStudy->FindComponent( compDataType.in() );
       if ( !father->_is_nil() ) {
-        SALOMEDS::ChildIterator_var itBig = myCurrentStudy->NewChildIterator( father );
+        SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( father );
         for ( ; itBig->More(); itBig->Next() ) {
-          SALOMEDS::SObject_var gotBranch = itBig->Value();
+          SALOMEDS::SObject_wrap gotBranch = itBig->Value();
           if ( gotBranch->Tag() == GetAlgorithmsRootTag() ) {
-            SALOMEDS::ChildIterator_var algoIt = myCurrentStudy->NewChildIterator( gotBranch );
+            SALOMEDS::ChildIterator_wrap algoIt = myCurrentStudy->NewChildIterator( gotBranch );
             for ( ; algoIt->More(); algoIt->Next() ) {
-              SALOMEDS::SObject_var algoSO = algoIt->Value();
+              SALOMEDS::SObject_wrap algoSO = algoIt->Value();
               CORBA::Object_var     algoIOR = SObjectToObject( algoSO );
               if ( !CORBA::is_nil( algoIOR )) {
                 SMESH_Hypothesis_i* impl = SMESH::DownCast<SMESH_Hypothesis_i*>( algoIOR );
@@ -1396,11 +1420,14 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr
           errStruct.code       = -( error->myName < 0 ? error->myName + 1: error->myName ); // -1 -> 0
           errStruct.comment    = error->myComment.c_str();
           errStruct.subShapeID = sm->GetId();
-          SALOMEDS::SObject_var algoSO = GetAlgoSO( error->myAlgo );
-          if ( !algoSO->_is_nil() )
-            errStruct.algoName = algoSO->GetName();
-          else
+          SALOMEDS::SObject_wrap algoSO = GetAlgoSO( error->myAlgo );
+          if ( !algoSO->_is_nil() ) {
+            CORBA::String_var algoName = algoSO->GetName();
+            errStruct.algoName = algoName;
+          }
+          else {
             errStruct.algoName = error->myAlgo->GetName();
+          }
           errStruct.hasBadMesh = !error->myBadElements.empty();
         }
       }
@@ -1548,9 +1575,11 @@ SMESH::algo_error_array* SMESH_Gen_i::GetAlgoState( SMESH::SMESH_Mesh_ptr theMes
         errStruct.algoDim      = error->_algoDim;
         errStruct.isGlobalAlgo = error->_isGlobalAlgo;
         errStruct.algoName     = "";
-        SALOMEDS::SObject_var algoSO = GetAlgoSO( error->_algo );
-        if ( !algoSO->_is_nil() )
-          errStruct.algoName   = algoSO->GetName();
+        SALOMEDS::SObject_wrap algoSO = GetAlgoSO( error->_algo );
+        if ( !algoSO->_is_nil() ) {
+          CORBA::String_var algoName = algoSO->GetName();
+          errStruct.algoName = algoName.in();
+        }
       }
     }
   }
@@ -2004,7 +2033,7 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
  *  \param theMesh - the mesh the element is in
  *  \param theElementID - the element ID
  *  \param theGeomName - the name of the result geom object if it is not yet published
- *  \retval GEOM::GEOM_Object_ptr - the found or just published geom object
+ *  \retval GEOM::GEOM_Object_ptr - the found or just published geom object (no need to UnRegister())
  */
 //================================================================================
 
@@ -2016,31 +2045,34 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
 {
   Unexpect aCatch(SALOME_SalomeException);
 
-  GEOM::GEOM_Object_var geom = FindGeometryByMeshElement(theMesh, theElementID);
+  GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID);
   if ( !geom->_is_nil() ) {
     GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
     GEOM::GEOM_Gen_ptr    geomGen   = GetGeomEngine();
 
     // try to find the corresponding SObject
-    SALOMEDS::SObject_var SObj = ObjectToSObject( myCurrentStudy, geom.in() );
+    SALOMEDS::SObject_wrap SObj = ObjectToSObject( myCurrentStudy, geom.in() );
     if ( SObj->_is_nil() ) // submesh can be not found even if published
     {
       // try to find published submesh
       GEOM::ListOfLong_var list = geom->GetSubShapeIndices();
       if ( !geom->IsMainShape() && list->length() == 1 ) {
-        SALOMEDS::SObject_var mainSO = ObjectToSObject( myCurrentStudy, mainShape );
-        SALOMEDS::ChildIterator_var it;
-        if ( !mainSO->_is_nil() )
+        SALOMEDS::SObject_wrap mainSO = ObjectToSObject( myCurrentStudy, mainShape );
+        SALOMEDS::ChildIterator_wrap it;
+        if ( !mainSO->_is_nil() ) {
           it = myCurrentStudy->NewChildIterator( mainSO );
+        }
         if ( !it->_is_nil() ) {
-          for ( it->InitEx(true); SObj->_is_nil() && it->More(); it->Next() ) {
-            GEOM::GEOM_Object_var subGeom =
-              GEOM::GEOM_Object::_narrow( SObjectToObject( it->Value() ));
+          for ( it->InitEx(true); it->More(); it->Next() ) {
+            SALOMEDS::SObject_wrap      so = it->Value();
+            CORBA::Object_var         obj = SObjectToObject( so );
+            GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj );
             if ( !subGeom->_is_nil() ) {
               GEOM::ListOfLong_var subList = subGeom->GetSubShapeIndices();
               if ( subList->length() == 1 && list[0] == subList[0] ) {
-                SObj = it->Value();
+                SObj = so;
                 geom = subGeom;
+                break;
               }
             }
           }
@@ -2051,8 +2083,12 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
       SObj = geomGen->AddInStudy( myCurrentStudy, geom, theGeomName, mainShape );
 
     // return only published geometry
-    if ( !SObj->_is_nil() )
-      return geom._retn();
+    if ( !SObj->_is_nil() ) {
+      //return geom._retn(); -- servant of geom must be UnRegister()ed;
+      CORBA::Object_var    obj = SObjectToObject( SObj );
+      GEOM::GEOM_Object_var go = GEOM::GEOM_Object::_narrow( obj );
+      return go._retn();
+    }
   }
   return GEOM::GEOM_Object::_nil();
 }
@@ -2062,7 +2098,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
  * \brief Return geometrical object the given element is built on.
  *  \param theMesh - the mesh the element is in
  *  \param theElementID - the element ID
- *  \retval GEOM::GEOM_Object_ptr - the found geom object
+ *  \retval GEOM::GEOM_Object_ptr - the found or created (UnRegister()!) geom object
  */
 //================================================================================
 
@@ -2092,14 +2128,16 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
         GEOM::GEOM_Object_var geom = ShapeToGeomObject( meshDS->IndexToShape( shapeID ));
         if ( geom->_is_nil() ) {
           // try to find a published sub-shape
-          SALOMEDS::SObject_var mainSO = ObjectToSObject( myCurrentStudy, mainShape );
-          SALOMEDS::ChildIterator_var it;
-          if ( !mainSO->_is_nil() )
+          SALOMEDS::SObject_wrap mainSO = ObjectToSObject( myCurrentStudy, mainShape );
+          SALOMEDS::ChildIterator_wrap it;
+          if ( !mainSO->_is_nil() ) {
             it = myCurrentStudy->NewChildIterator( mainSO );
+          }
           if ( !it->_is_nil() ) {
             for ( it->InitEx(true); it->More(); it->Next() ) {
-              GEOM::GEOM_Object_var subGeom =
-                GEOM::GEOM_Object::_narrow( SObjectToObject( it->Value() ));
+              SALOMEDS::SObject_wrap      so = it->Value();
+              CORBA::Object_var         obj = SObjectToObject( so );
+              GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj );
               if ( !subGeom->_is_nil() ) {
                 GEOM::ListOfLong_var subList = subGeom->GetSubShapeIndices();
                 if ( subList->length() == 1 && shapeID == subList[0] ) {
@@ -2112,11 +2150,14 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
         }
         if ( geom->_is_nil() ) {
           // explode
-          GEOM::GEOM_IShapesOperations_var op =
+          GEOM::GEOM_IShapesOperations_wrap op =
             geomGen->GetIShapesOperations( GetCurrentStudyID() );
           if ( !op->_is_nil() )
             geom = op->GetSubShape( mainShape, shapeID );
         }
+        else {
+          geom->Register();
+        }
         if ( !geom->_is_nil() ) {
           GeomObjectToShape( geom ); // let geom client remember the found shape
           return geom._retn();
@@ -2345,7 +2386,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
             if ( theCommonGroups ) {
               for(aGroupType=SMESH::NODE;aGroupType<=SMESH::BALL;aGroupType=(SMESH::ElementType)(aGroupType+1)) {
                 string str = "Gr";
-                SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
+                SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
                 if(aMeshSObj)
                   str += aMeshSObj->GetName();
                 str += "_";
@@ -2512,7 +2553,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
   }
 
   // IPAL21468 Change icon of compound because it need not be computed.
-  SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh );
+  SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh );
   SetPixMap( aMeshSObj, "ICON_SMESH_TREE_MESH" );
 
   if (aNewMeshDS)
@@ -2558,7 +2599,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
   SMESH_Mesh_i*       newMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( newMesh );
   if ( !newMesh_i )
     THROW_SALOME_CORBA_EXCEPTION( "can't create a mesh", SALOME::INTERNAL_ERROR );
-  SALOMEDS::SObject_var meshSO = ObjectToSObject(myCurrentStudy, newMesh );
+  SALOMEDS::SObject_wrap meshSO = ObjectToSObject(myCurrentStudy, newMesh );
   if ( !meshSO->_is_nil() )
   {
     SetName( meshSO, meshName, "Mesh" );
@@ -2883,9 +2924,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
   // SetStoreName() to groups before storing hypotheses to let them refer to
   // groups using "store name", which is "Group <group_persistent_id>"
   {
-    SALOMEDS::ChildIterator_var itBig = myCurrentStudy->NewChildIterator( theComponent );
+    SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( theComponent );
     for ( ; itBig->More(); itBig->Next() ) {
-      SALOMEDS::SObject_var gotBranch = itBig->Value();
+      SALOMEDS::SObject_wrap gotBranch = itBig->Value();
       if ( gotBranch->Tag() > GetAlgorithmsRootTag() ) {
         CORBA::Object_var anObject = SObjectToObject( gotBranch );
         if ( !CORBA::is_nil( anObject ) ) {
@@ -2920,9 +2961,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
   aFile->CreateOnDisk();
 
   // --> iterator for top-level objects
-  SALOMEDS::ChildIterator_var itBig = myCurrentStudy->NewChildIterator( theComponent );
+  SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( theComponent );
   for ( ; itBig->More(); itBig->Next() ) {
-    SALOMEDS::SObject_var gotBranch = itBig->Value();
+    SALOMEDS::SObject_wrap gotBranch = itBig->Value();
 
     // --> hypotheses root branch (only one for the study)
     if ( gotBranch->Tag() == GetHypothesisRootTag() ) {
@@ -2931,9 +2972,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
       aTopGroup->CreateOnDisk();
 
       // iterator for all hypotheses
-      SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( gotBranch );
+      SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( gotBranch );
       for ( ; it->More(); it->Next() ) {
-        SALOMEDS::SObject_var mySObject = it->Value();
+        SALOMEDS::SObject_wrap mySObject = it->Value();
         CORBA::Object_var anObject = SObjectToObject( mySObject );
         if ( !CORBA::is_nil( anObject ) ) {
           SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
@@ -3000,9 +3041,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
       aTopGroup->CreateOnDisk();
 
       // iterator for all algorithms
-      SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( gotBranch );
+      SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( gotBranch );
       for ( ; it->More(); it->Next() ) {
-        SALOMEDS::SObject_var mySObject = it->Value();
+        SALOMEDS::SObject_wrap mySObject = it->Value();
         CORBA::Object_var anObject = SObjectToObject( mySObject );
         if ( !CORBA::is_nil( anObject ) ) {
           SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
@@ -3126,12 +3167,12 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
             aDataset->CloseOnDisk();
 
             // write reference on a shape if exists
-            SALOMEDS::SObject_var myRef;
+            SALOMEDS::SObject_wrap myRef;
             bool shapeRefFound = false;
-            bool found = gotBranch->FindSubObject( GetRefOnShapeTag(), myRef );
+            bool found = gotBranch->FindSubObject( GetRefOnShapeTag(), myRef.inout() );
             if ( found ) {
-              SALOMEDS::SObject_var myShape;
-              bool ok = myRef->ReferencedObject( myShape );
+              SALOMEDS::SObject_wrap myShape;
+              bool ok = myRef->ReferencedObject( myShape.inout() );
               if ( ok ) {
                 shapeRefFound = (! CORBA::is_nil( myShape->GetObject() ));
                 string myRefOnObject = myShape->GetID();
@@ -3146,8 +3187,8 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
             }
 
             // write applied hypotheses if exist
-            SALOMEDS::SObject_var myHypBranch;
-            found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch );
+            SALOMEDS::SObject_wrap myHypBranch;
+            found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch.inout() );
             if ( found && !shapeRefFound && hasShape) { // remove applied hyps
               myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myHypBranch );
             }
@@ -3155,12 +3196,12 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
               aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
               aGroup->CreateOnDisk();
 
-              SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myHypBranch );
+              SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myHypBranch );
               int hypNb = 0;
               for ( ; it->More(); it->Next() ) {
-                SALOMEDS::SObject_var mySObject = it->Value();
-                SALOMEDS::SObject_var myRefOnHyp;
-                bool ok = mySObject->ReferencedObject( myRefOnHyp );
+                SALOMEDS::SObject_wrap mySObject = it->Value();
+                SALOMEDS::SObject_wrap myRefOnHyp;
+                bool ok = mySObject->ReferencedObject( myRefOnHyp.inout() );
                 if ( ok ) {
                   // san - it is impossible to recover applied hypotheses
                   //       using their entries within Load() method,
@@ -3189,8 +3230,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
             }
 
             // write applied algorithms if exist
-            SALOMEDS::SObject_var myAlgoBranch;
-            found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(), myAlgoBranch );
+            SALOMEDS::SObject_wrap myAlgoBranch;
+            found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(),
+                                              myAlgoBranch.inout() );
             if ( found && !shapeRefFound && hasShape) { // remove applied algos
               myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myAlgoBranch );
             }
@@ -3198,12 +3240,12 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
               aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
               aGroup->CreateOnDisk();
 
-              SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myAlgoBranch );
+              SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myAlgoBranch );
               int algoNb = 0;
               for ( ; it->More(); it->Next() ) {
-                SALOMEDS::SObject_var mySObject = it->Value();
-                SALOMEDS::SObject_var myRefOnAlgo;
-                bool ok = mySObject->ReferencedObject( myRefOnAlgo );
+                SALOMEDS::SObject_wrap mySObject = it->Value();
+                SALOMEDS::SObject_wrap myRefOnAlgo;
+                bool ok = mySObject->ReferencedObject( myRefOnAlgo.inout() );
                 if ( ok ) {
                   // san - it is impossible to recover applied algorithms
                   //       using their entries within Load() method,
@@ -3234,18 +3276,18 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
             // --> submesh objects sub-branches
 
             for ( int i = GetSubMeshOnVertexTag(); i <= GetSubMeshOnCompoundTag(); i++ ) {
-              SALOMEDS::SObject_var mySubmeshBranch;
-              found = gotBranch->FindSubObject( i, mySubmeshBranch );
+              SALOMEDS::SObject_wrap mySubmeshBranch;
+              found = gotBranch->FindSubObject( i, mySubmeshBranch.inout() );
 
               if ( found ) // check if there is shape reference in submeshes
               {
                 bool hasShapeRef = false;
-                SALOMEDS::ChildIterator_var itSM =
+                SALOMEDS::ChildIterator_wrap itSM =
                   myCurrentStudy->NewChildIterator( mySubmeshBranch );
                 for ( ; itSM->More(); itSM->Next() ) {
-                  SALOMEDS::SObject_var mySubRef, myShape, mySObject = itSM->Value();
-                  if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ))
-                    mySubRef->ReferencedObject( myShape );
+                  SALOMEDS::SObject_wrap mySubRef, myShape, mySObject = itSM->Value();
+                  if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ))
+                    mySubRef->ReferencedObject( myShape.inout() );
                   if ( !CORBA::is_nil( myShape ) && !CORBA::is_nil( myShape->GetObject() ))
                     hasShapeRef = true;
                   else
@@ -3296,9 +3338,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
                 aGroup->CreateOnDisk();
 
                 // iterator for all submeshes of given type
-                SALOMEDS::ChildIterator_var itSM = myCurrentStudy->NewChildIterator( mySubmeshBranch );
+                SALOMEDS::ChildIterator_wrap itSM = myCurrentStudy->NewChildIterator( mySubmeshBranch );
                 for ( ; itSM->More(); itSM->Next() ) {
-                  SALOMEDS::SObject_var mySObject = itSM->Value();
+                  SALOMEDS::SObject_wrap mySObject = itSM->Value();
                   CORBA::Object_var anSubObject = SObjectToObject( mySObject );
                   if ( !CORBA::is_nil( anSubObject ))
                   {
@@ -3313,9 +3355,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
                     aSubGroup->CreateOnDisk();
 
                     // write reference on a shape, already checked if it exists
-                    SALOMEDS::SObject_var mySubRef, myShape;
-                    if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ))
-                      mySubRef->ReferencedObject( myShape );
+                    SALOMEDS::SObject_wrap mySubRef, myShape;
+                    if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ))
+                      mySubRef->ReferencedObject( myShape.inout() );
                     string myRefOnObject = myShape->GetID();
                     if ( myRefOnObject.length() > 0 ) {
                       aSize[ 0 ] = myRefOnObject.length() + 1;
@@ -3326,18 +3368,19 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
                     }
 
                     // write applied hypotheses if exist
-                    SALOMEDS::SObject_var mySubHypBranch;
-                    found = mySObject->FindSubObject( GetRefOnAppliedHypothesisTag(), mySubHypBranch );
+                    SALOMEDS::SObject_wrap mySubHypBranch;
+                    found = mySObject->FindSubObject( GetRefOnAppliedHypothesisTag(),
+                                                      mySubHypBranch.inout() );
                     if ( found ) {
                       aSubSubGroup = new HDFgroup( "Applied Hypotheses", aSubGroup );
                       aSubSubGroup->CreateOnDisk();
 
-                      SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( mySubHypBranch );
+                      SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( mySubHypBranch );
                       int hypNb = 0;
                       for ( ; it->More(); it->Next() ) {
-                        SALOMEDS::SObject_var mySubSObject = it->Value();
-                        SALOMEDS::SObject_var myRefOnHyp;
-                        bool ok = mySubSObject->ReferencedObject( myRefOnHyp );
+                        SALOMEDS::SObject_wrap mySubSObject = it->Value();
+                        SALOMEDS::SObject_wrap myRefOnHyp;
+                        bool ok = mySubSObject->ReferencedObject( myRefOnHyp.inout() );
                         if ( ok ) {
                           //string myRefOnObject = myRefOnHyp->GetID();
                           CORBA::Object_var anObject = SObjectToObject( myRefOnHyp );
@@ -3361,18 +3404,20 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
                     }
 
                     // write applied algorithms if exist
-                    SALOMEDS::SObject_var mySubAlgoBranch;
-                    found = mySObject->FindSubObject( GetRefOnAppliedAlgorithmsTag(), mySubAlgoBranch );
+                    SALOMEDS::SObject_wrap mySubAlgoBranch;
+                    found = mySObject->FindSubObject( GetRefOnAppliedAlgorithmsTag(),
+                                                      mySubAlgoBranch.inout() );
                     if ( found ) {
                       aSubSubGroup = new HDFgroup( "Applied Algorithms", aSubGroup );
                       aSubSubGroup->CreateOnDisk();
 
-                      SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( mySubAlgoBranch );
+                      SALOMEDS::ChildIterator_wrap it =
+                        myCurrentStudy->NewChildIterator( mySubAlgoBranch );
                       int algoNb = 0;
                       for ( ; it->More(); it->Next() ) {
-                        SALOMEDS::SObject_var mySubSObject = it->Value();
-                        SALOMEDS::SObject_var myRefOnAlgo;
-                        bool ok = mySubSObject->ReferencedObject( myRefOnAlgo );
+                        SALOMEDS::SObject_wrap mySubSObject = it->Value();
+                        SALOMEDS::SObject_wrap myRefOnAlgo;
+                        bool ok = mySubSObject->ReferencedObject( myRefOnAlgo.inout() );
                         if ( ok ) {
                           //string myRefOnObject = myRefOnAlgo->GetID();
                           CORBA::Object_var anObject = SObjectToObject( myRefOnAlgo );
@@ -3442,9 +3487,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
             }
 
             // groups root sub-branch
-            SALOMEDS::SObject_var myGroupsBranch;
+            SALOMEDS::SObject_wrap myGroupsBranch;
             for ( int i = GetNodeGroupsTag(); i <= GetBallElementsGroupsTag(); i++ ) {
-              found = gotBranch->FindSubObject( i, myGroupsBranch );
+              found = gotBranch->FindSubObject( i, myGroupsBranch.inout() );
               if ( found ) {
                 char name_group[ 30 ];
                 if ( i == GetNodeGroupsTag() )
@@ -3463,9 +3508,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
                 aGroup = new HDFgroup( name_group, aTopGroup );
                 aGroup->CreateOnDisk();
 
-                SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myGroupsBranch );
+                SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myGroupsBranch );
                 for ( ; it->More(); it->Next() ) {
-                  SALOMEDS::SObject_var mySObject = it->Value();
+                  SALOMEDS::SObject_wrap mySObject = it->Value();
                   CORBA::Object_var aSubObject = SObjectToObject( mySObject );
                   if ( !CORBA::is_nil( aSubObject ) ) {
                     SMESH_GroupBase_i* myGroupImpl =
@@ -3515,9 +3560,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
                     SMESHDS_GroupOnGeom* aGeomGrp =
                       dynamic_cast<SMESHDS_GroupOnGeom*>( aGrpBaseDS );
                     if ( aGeomGrp ) {
-                      SALOMEDS::SObject_var mySubRef, myShape;
-                      if (mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ) &&
-                          mySubRef->ReferencedObject( myShape ) &&
+                      SALOMEDS::SObject_wrap mySubRef, myShape;
+                      if (mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ) &&
+                          mySubRef->ReferencedObject( myShape.inout() ) &&
                           !CORBA::is_nil( myShape->GetObject() ))
                       {
                         string myRefOnObject = myShape->GetID();
@@ -3878,10 +3923,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
   TCollection_AsciiString tmpDir =
     isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
 
-    INFOS( "THE URL++++++++++++++" )
-    INFOS( theURL );
-    INFOS( "THE TMP PATH+++++++++" );
-    INFOS( tmpDir );
+  INFOS( "THE URL++++++++++++++" );
+  INFOS( theURL );
+  INFOS( "THE TMP PATH+++++++++" );
+  INFOS( tmpDir );
 
   // Convert the stream into sequence of files to process
   SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream,
@@ -4020,8 +4065,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             if ( myImpl ) {
               // myImpl->LoadFrom( hypdata.c_str() );
               hypDataList.push_back( make_pair( myImpl, hypdata ));
-              string iorString = GetORB()->object_to_string( myHyp );
-              int newId = myStudyContext->findId( iorString );
+              CORBA::String_var iorString = GetORB()->object_to_string( myHyp );
+              int newId = myStudyContext->findId( iorString.in() );
               myStudyContext->mapOldToNew( id, newId );
             }
             else
@@ -4120,8 +4165,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             if ( myImpl ) {
               //myImpl->LoadFrom( hypdata.c_str() );
               hypDataList.push_back( make_pair( myImpl, hypdata ));
-              string iorString = GetORB()->object_to_string( myHyp );
-              int newId = myStudyContext->findId( iorString );
+              CORBA::String_var iorString = GetORB()->object_to_string( myHyp );
+              int newId = myStudyContext->findId( iorString.in() );
               myStudyContext->mapOldToNew( id, newId );
             }
             else
@@ -4161,8 +4206,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             continue;
           meshGroupList.push_back( make_pair( myNewMeshImpl, aTopGroup ));
 
-          string iorString = GetORB()->object_to_string( myNewMesh );
-          int newId = myStudyContext->findId( iorString );
+          CORBA::String_var iorString = GetORB()->object_to_string( myNewMesh );
+          int newId = myStudyContext->findId( iorString.in() );
           myStudyContext->mapOldToNew( id, newId );
 
           // ouv : NPAL12872
@@ -4178,6 +4223,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             aDataset->ReadFromDisk( anAutoColor );
             aDataset->CloseOnDisk();
             myNewMeshImpl->GetImpl().SetAutoColor( (bool)anAutoColor[0] );
+            delete [] anAutoColor;
           }
 
           // try to read and set reference to shape
@@ -4191,7 +4237,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             aDataset->ReadFromDisk( refFromFile );
             aDataset->CloseOnDisk();
             if ( strlen( refFromFile ) > 0 ) {
-              SALOMEDS::SObject_var shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+              SALOMEDS::SObject_wrap shapeSO = myCurrentStudy->FindObjectID( refFromFile );
 
               // Make sure GEOM data are loaded first
               //loadGeomData( shapeSO->GetFatherComponent() );
@@ -4203,6 +4249,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
                   myNewMeshImpl->SetShape( aShapeObject );
               }
             }
+            delete [] refFromFile;
           }
 
           // issue 20918. Restore Persistent Id of SMESHDS_Mesh
@@ -4215,6 +4262,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             aDataset->ReadFromDisk( meshPersistentId );
             aDataset->CloseOnDisk();
             myNewMeshImpl->GetImpl().GetMeshDS()->SetPersistentId( *meshPersistentId );
+            delete [] meshPersistentId;
           }
         }
       }
@@ -4245,8 +4293,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
       bool hasData = false;
 
       // get mesh old id
-      string iorString = GetORB()->object_to_string( myNewMeshImpl->_this() );
-      int newId = myStudyContext->findId( iorString );
+      CORBA::String_var iorString = GetORB()->object_to_string( myNewMeshImpl->_this() );
+      int newId = myStudyContext->findId( iorString.in() );
       int id = myStudyContext->getOldId( newId );
 
       // try to find mesh data dataset
@@ -4265,6 +4313,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
           // myReader.Perform();
           hasData = true;
         }
+        delete [] strHasData;
       }
 
       // Try to get applied ALGORITHMS (mesh is not cleared by algo addition because
@@ -4287,9 +4336,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             aDataset->ReadFromDisk( refFromFile );
             aDataset->CloseOnDisk();
             // san - it is impossible to recover applied algorithms using their entries within Load() method
-            //SALOMEDS::SObject_var hypSO = myCurrentStudy->FindObjectID( refFromFile );
+            //SALOMEDS::SObject_wrap hypSO = myCurrentStudy->FindObjectID( refFromFile );
             //CORBA::Object_var hypObject = SObjectToObject( hypSO );
             int id = atoi( refFromFile );
+            delete [] refFromFile;
             string anIOR = myStudyContext->getIORbyOldId( id );
             if ( !anIOR.empty() ) {
               CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
@@ -4323,9 +4373,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             aDataset->ReadFromDisk( refFromFile );
             aDataset->CloseOnDisk();
             // san - it is impossible to recover applied hypotheses using their entries within Load() method
-            //SALOMEDS::SObject_var hypSO = myCurrentStudy->FindObjectID( refFromFile );
+            //SALOMEDS::SObject_wrap hypSO = myCurrentStudy->FindObjectID( refFromFile );
             //CORBA::Object_var hypObject = SObjectToObject( hypSO );
             int id = atoi( refFromFile );
+            delete [] refFromFile;
             string anIOR = myStudyContext->getIORbyOldId( id );
             if ( !anIOR.empty() ) {
               CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
@@ -4393,7 +4444,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
                 aDataset->ReadFromDisk( refFromFile );
                 aDataset->CloseOnDisk();
                 if ( strlen( refFromFile ) > 0 ) {
-                  SALOMEDS::SObject_var subShapeSO = myCurrentStudy->FindObjectID( refFromFile );
+                  SALOMEDS::SObject_wrap subShapeSO = myCurrentStudy->FindObjectID( refFromFile );
                   CORBA::Object_var subShapeObject = SObjectToObject( subShapeSO );
                   if ( !CORBA::is_nil( subShapeObject ) ) {
                     aSubShapeObject = GEOM::GEOM_Object::_narrow( subShapeObject );
@@ -4543,7 +4594,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
                 aDataset->ReadFromDisk( refFromFile );
                 aDataset->CloseOnDisk();
                 if ( strlen( refFromFile ) > 0 ) {
-                  SALOMEDS::SObject_var shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+                  SALOMEDS::SObject_wrap shapeSO = myCurrentStudy->FindObjectID( refFromFile );
                   CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
                   if ( !CORBA::is_nil( shapeObject ) ) {
                     aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
@@ -4579,7 +4630,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
                 continue;
 
               string iorSubString = GetORB()->object_to_string( aNewGroup );
-              int newSubId = myStudyContext->findId( iorSubString );
+              int        newSubId = myStudyContext->findId( iorSubString );
               myStudyContext->mapOldToNew( subid, newSubId );
 
               SMESH_GroupBase_i* aGroupImpl = SMESH::DownCast< SMESH_GroupBase_i*>( aNewGroup );
@@ -4770,24 +4821,6 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
     myStudyContextMap.erase( studyId );
   }
 
-  // delete SMESH_Mesh's
-//   See bug IPAL19437.
-//
-//   StudyContextStruct* context = myGen.GetStudyContext( studyId );
-//   map< int, SMESH_Mesh* >::iterator i_mesh = context->mapMesh.begin();
-//   for ( ; i_mesh != context->mapMesh.end(); ++i_mesh ) {
-//     printf( "--------------------------- SMESH_Gen_i::Close, delete aGroup = %p \n", i_mesh->second );
-//     delete i_mesh->second;
-//   }
-
-
-  // delete SMESHDS_Mesh's
-  // it's too long on big meshes
-//   if ( context->myDocument ) {
-//     delete context->myDocument;
-//     context->myDocument = 0;
-//   }
-
   // remove the tmp files meshes are loaded from
   SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent );
 
@@ -4906,7 +4939,7 @@ void SMESH_Gen_i::SetName(const char* theIOR,
 {
   if ( theIOR && strcmp( theIOR, "" ) ) {
     CORBA::Object_var anObject = GetORB()->string_to_object( theIOR );
-    SALOMEDS::SObject_var aSO = ObjectToSObject( myCurrentStudy, anObject );
+    SALOMEDS::SObject_wrap aSO = ObjectToSObject( myCurrentStudy, anObject );
     if ( !aSO->_is_nil() ) {
       SetName( aSO, theName );
     }
index 746f73765029ed22d53a0120bdb47e062615a90c..c78122345a1a3040e423c272cb2a78752622919f 100644 (file)
 #include CORBA_CLIENT_HEADER(SALOMEDS)
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
+#include "SMESH_Gen.hxx"
 #include "SMESH_Mesh_i.hxx"
 #include "SMESH_Hypothesis_i.hxx"
-#include "SALOME_Component_i.hxx"
-#include "SALOME_NamingService.hxx"
 
-#include "SMESH_Gen.hxx"
-#include "GEOM_Client.hxx"
+#include <SALOME_Component_i.hxx>
+#include <SALOME_NamingService.hxx>
+#include <Utils_CorbaException.hxx>
+
+#include <GEOM_Client.hxx>
 
 #include <TCollection_AsciiString.hxx>
 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
@@ -146,7 +148,7 @@ public:
   // Get SALOME_LifeCycleCORBA object
   static SALOME_LifeCycleCORBA* GetLCC();
   // Retrieve and get GEOM engine reference
-  static GEOM::GEOM_Gen_ptr GetGeomEngine();
+  static GEOM::GEOM_Gen_var GetGeomEngine();
   // Get object of the CORBA reference
   static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
   // Get CORBA object corresponding to the SALOMEDS::SObject
@@ -630,6 +632,15 @@ namespace SMESH
   {
     return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
   }
+
+  /*!
+   * \brief Function used in SMESH_CATCH to convert a caught exception to
+   * SALOME::SALOME_Exception
+   */
+  inline void throwCorbaException(const char* excText)
+  {
+    THROW_SALOME_CORBA_EXCEPTION( excText, SALOME::INTERNAL_ERROR );
+  }
 }
 
 
index 1638083b5869b129580b36225e97542b924cff39..b78d04a85fa6ad60133696c528ede339afff9a8d 100644 (file)
 
 #include "SMESH_Gen_i.hxx"
 
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Hypothesis_i.hxx"
 #include "SMESH_Algo_i.hxx"
+#include "SMESH_Comment.hxx"
 #include "SMESH_Group_i.hxx"
+#include "SMESH_Hypothesis_i.hxx"
+#include "SMESH_Mesh_i.hxx"
 #include "SMESH_subMesh_i.hxx"
 
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
 
-#include "utilities.h"
-#include "Utils_ExceptHandlers.hxx"
+#include <utilities.h>
+#include <Utils_ExceptHandlers.hxx>
+#include <SALOMEDS_wrap.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
 
 #include <TCollection_AsciiString.hxx>
 #include <TopoDS_Solid.hxx>
@@ -182,13 +185,13 @@ bool SMESH_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
 
 //=======================================================================
 //function : ObjectToSObject
-//purpose  : 
+//purpose  : Put a result into a SALOMEDS::SObject_wrap or call UnRegister()!
 //=======================================================================
 
 SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(SALOMEDS::Study_ptr theStudy,
                                                    CORBA::Object_ptr   theObject)
 {
-  SALOMEDS::SObject_var aSO;
+  SALOMEDS::SObject_wrap aSO;
   if ( !CORBA::is_nil( theStudy ) && !CORBA::is_nil( theObject ))
   {
     CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theObject );
@@ -256,30 +259,33 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
                                      const char*           thePixMap = 0,
                                      const bool            theSelectable = true)
 {
-  SALOMEDS::SObject_var SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
+  SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
   SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
   if ( SO->_is_nil() ) {
     if ( theTag == 0 )
       SO = aStudyBuilder->NewObject( theFatherObject );
-    else if ( !theFatherObject->FindSubObject( theTag, SO ))
+    else if ( !theFatherObject->FindSubObject( theTag, SO.inout() ))
       SO = aStudyBuilder->NewObjectToTag( theFatherObject, theTag );
   }
 
-  SALOMEDS::GenericAttribute_var anAttr;
+  SALOMEDS::GenericAttribute_wrap anAttr;
   if ( !CORBA::is_nil( theIOR )) {
     anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeIOR" );
     CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR );
-    SALOMEDS::AttributeIOR::_narrow(anAttr)->SetValue( objStr.in() );
+    SALOMEDS::AttributeIOR_wrap iorAttr = anAttr;
+    iorAttr->SetValue( objStr.in() );
   }
   if ( thePixMap ) {
     anAttr  = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
-    SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr );
+    SALOMEDS::AttributePixMap_wrap pm = anAttr;
     pm->SetPixMap( thePixMap );
   }
   if ( !theSelectable ) {
-    anAttr   = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
-    SALOMEDS::AttributeSelectable::_narrow( anAttr )->SetSelectable( false );
+    anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
+    SALOMEDS::AttributeSelectable_wrap selAttr = anAttr;
+    selAttr->SetSelectable( false );
   }
+
   return SO._retn();
 }
 
@@ -293,18 +299,18 @@ void SMESH_Gen_i::SetName(SALOMEDS::SObject_ptr theSObject,
                           const char*           theDefaultName)
 {
   if ( !theSObject->_is_nil() ) {
-    SALOMEDS::StudyBuilder_var aStudyBuilder = theSObject->GetStudy()->NewBuilder();
-    SALOMEDS::GenericAttribute_var anAttr =
+    SALOMEDS::Study_var               aStudy = theSObject->GetStudy();
+    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::GenericAttribute_wrap   anAttr =
       aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributeName" );
-    SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
+    SALOMEDS::AttributeName_wrap aNameAttr = anAttr;
     if ( theName && strlen( theName ) != 0 )
       aNameAttr->SetValue( theName );
     else {
-      CORBA::String_var curName = CORBA::string_dup( aNameAttr->Value() );
-      if ( strlen( curName ) == 0 ) {
-        TCollection_AsciiString aName( (char*) theDefaultName );
-        aName += TCollection_AsciiString("_") + TCollection_AsciiString( theSObject->Tag() );
-        aNameAttr->SetValue( aName.ToCString() );
+      CORBA::String_var curName = aNameAttr->Value();
+      if ( strlen( curName.in() ) == 0 ) {
+        SMESH_Comment aName(theDefaultName);
+        aNameAttr->SetValue( ( aName<< "_" << theSObject->Tag()).c_str() );
       }
     }
   }
@@ -320,11 +326,11 @@ void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject,
 {
   if ( !theSObject->_is_nil() && thePixMap && strlen( thePixMap ))
   {
-    SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+    SALOMEDS::Study_var               aStudy = theSObject->GetStudy();
     SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-    SALOMEDS::GenericAttribute_var anAttr =
+    SALOMEDS::GenericAttribute_wrap anAttr =
       aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributePixMap" );
-    SALOMEDS::AttributePixMap_var aPMAttr = SALOMEDS::AttributePixMap::_narrow( anAttr );
+    SALOMEDS::AttributePixMap_wrap aPMAttr = anAttr;
     aPMAttr->SetPixMap( thePixMap );
   }
 }
@@ -339,24 +345,27 @@ static void addReference (SALOMEDS::Study_ptr   theStudy,
                           CORBA::Object_ptr     theToObject,
                           int                   theTag = 0)
 {
-  SALOMEDS::SObject_var aToObjSO = SMESH_Gen_i::ObjectToSObject( theStudy, theToObject );
+  SALOMEDS::SObject_wrap aToObjSO = SMESH_Gen_i::ObjectToSObject( theStudy, theToObject );
   if ( !aToObjSO->_is_nil() && !theSObject->_is_nil() ) {
     SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
-    SALOMEDS::SObject_var aReferenceSO;
+    SALOMEDS::SObject_wrap aReferenceSO;
     if ( !theTag ) {
       // check if the reference to theToObject already exists
       // and find a free label for the reference object
       bool isReferred = false;
       int tag = 1;
-      SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator( theSObject );
+      SALOMEDS::ChildIterator_wrap anIter = theStudy->NewChildIterator( theSObject );
       for ( ; !isReferred && anIter->More(); anIter->Next(), ++tag ) {
-        if ( anIter->Value()->ReferencedObject( aReferenceSO )) {
-          if ( strcmp( aReferenceSO->GetID(), aToObjSO->GetID() ) == 0 )
+        SALOMEDS::SObject_wrap curSO = anIter->Value();
+        if ( curSO->ReferencedObject( aReferenceSO.inout() )) {
+          CORBA::String_var refEntry = aReferenceSO->GetID();
+          CORBA::String_var  toEntry = aToObjSO->GetID();
+          if ( strcmp( refEntry, toEntry ) == 0 )
             isReferred = true;
         }
         else if ( !theTag ) {
-          SALOMEDS::GenericAttribute_var anAttr;
-          if ( !anIter->Value()->FindAttribute( anAttr, "AttributeIOR" ))
+          SALOMEDS::GenericAttribute_wrap anAttr;
+          if ( !curSO->FindAttribute( anAttr.inout(), "AttributeIOR" ))
             theTag = tag;
         }
       }
@@ -365,7 +374,7 @@ static void addReference (SALOMEDS::Study_ptr   theStudy,
       if ( !theTag )
         theTag = tag;
     }
-    if ( !theSObject->FindSubObject( theTag, aReferenceSO ))
+    if ( !theSObject->FindSubObject( theTag, aReferenceSO.inout() ))
       aReferenceSO = aStudyBuilder->NewObjectToTag( theSObject, theTag );
     aStudyBuilder->Addreference( aReferenceSO, aToObjSO );
   }
@@ -386,7 +395,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy
      throw (SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
-  SALOMEDS::SObject_var aSO;
+  SALOMEDS::SObject_wrap aSO;
   if ( CORBA::is_nil( theStudy ) || CORBA::is_nil( theIOR ))
     return aSO._retn();
   if(MYDEBUG) MESSAGE("PublishInStudy");
@@ -432,8 +441,8 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theSt
     return SALOMEDS::SComponent::_nil();
   if(MYDEBUG) MESSAGE("PublishComponent");
 
-  SALOMEDS::SComponent_var father =
-    SALOMEDS::SComponent::_narrow( theStudy->FindComponent( ComponentDataType() ) );
+  CORBA::String_var   compDataType = ComponentDataType();
+  SALOMEDS::SComponent_wrap father = theStudy->FindComponent( compDataType.in() );
   if ( !CORBA::is_nil( father ) )
     return father._retn();
 
@@ -442,20 +451,21 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theSt
   if ( CORBA::is_nil( aCat ) )
     return father._retn();
 
-  SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( ComponentDataType() );
+  SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( compDataType.in() );
   if ( CORBA::is_nil( aComp ) )
     return father._retn();
 
-  SALOMEDS::StudyBuilder_var     aStudyBuilder = theStudy->NewBuilder(); 
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributePixMap_var  aPixmap;
+  SALOMEDS::StudyBuilder_var      aStudyBuilder = theStudy->NewBuilder(); 
+  SALOMEDS::GenericAttribute_wrap anAttr;
+  SALOMEDS::AttributePixMap_wrap  aPixmap;
 
-  father  = aStudyBuilder->NewComponent( ComponentDataType() );
+  father  = aStudyBuilder->NewComponent( compDataType.in() );
   aStudyBuilder->DefineComponentInstance( father, SMESH_Gen::_this() );
   anAttr  = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" );
-  aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
-  aPixmap ->SetPixMap( "ICON_OBJBROWSER_SMESH" );
-  SetName( father, aComp->componentusername(), "MESH" );
+  aPixmap = anAttr;
+  aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
+  CORBA::String_var userName = aComp->componentusername();
+  SetName( father, userName.in(), "MESH" );
   if(MYDEBUG) MESSAGE("PublishComponent--END");
 
   return father._retn();
@@ -475,9 +485,10 @@ static long findMaxChildTag( SALOMEDS::SObject_ptr theSObject )
   if ( !theSObject->_is_nil() ) {
     SALOMEDS::Study_var aStudy = theSObject->GetStudy();
     if ( !aStudy->_is_nil() ) {
-      SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( theSObject );
+      SALOMEDS::ChildIterator_wrap anIter = aStudy->NewChildIterator( theSObject );
       for ( ; anIter->More(); anIter->Next() ) {
-        long nTag = anIter->Value()->Tag();
+        SALOMEDS::SObject_wrap anSO = anIter->Value();
+        long nTag = anSO->Tag();
         if ( nTag > aTag )
           aTag = nTag;
       }
@@ -502,10 +513,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr   theStudy,
 
   // find or publish a mesh
 
-  SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+  SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
   if ( aMeshSO->_is_nil() )
   {
-    SALOMEDS::SComponent_var father = PublishComponent( theStudy );
+    SALOMEDS::SComponent_wrap father = PublishComponent( theStudy );
     if ( father->_is_nil() )
       return aMeshSO._retn();
 
@@ -531,9 +542,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr   theStudy,
     // Publish global hypotheses
 
     SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject );
-    for ( int i = 0; i < hypList->length(); i++ ) {
+    for ( int i = 0; i < hypList->length(); i++ )
+    {
       SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
-      PublishHypothesis( theStudy, aHyp );
+      SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
       AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp );
     }
   }
@@ -549,7 +561,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr   theStudy,
     SMESH::SMESH_subMesh_ptr aSubMesh = (*subIt).second->_this();
     if ( !CORBA::is_nil( aSubMesh )) {
       aShapeObject = aSubMesh->GetSubShape();
-      PublishSubMesh( theStudy, theMesh, aSubMesh, aShapeObject );
+      SALOMEDS::SObject_wrap( PublishSubMesh( theStudy, theMesh, aSubMesh, aShapeObject ));
     }
   }
 
@@ -560,12 +572,11 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr   theStudy,
   {
     SMESH::SMESH_GroupBase_ptr aGroup = (*it).second;
     if ( !aGroup->_is_nil() ) {
-      GEOM::GEOM_Object_var  aShapeObj;
-      SMESH::SMESH_GroupOnGeom_var aGeomGroup =
-        SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
+      GEOM::GEOM_Object_var aShapeObj;
+      SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
       if ( !aGeomGroup->_is_nil() )
         aShapeObj = aGeomGroup->GetShape();
-      PublishGroup( theStudy, theMesh, aGroup, aShapeObj );
+      SALOMEDS::SObject_wrap( PublishGroup( theStudy, theMesh, aGroup, aShapeObj ));
     }
   }
 
@@ -588,10 +599,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SALOMEDS::Study_ptr      theS
       theSubMesh->_is_nil() || theShapeObject->_is_nil() )
     return SALOMEDS::SObject::_nil();
 
-  SALOMEDS::SObject_var aSubMeshSO = ObjectToSObject( theStudy, theSubMesh );
+  SALOMEDS::SObject_wrap aSubMeshSO = ObjectToSObject( theStudy, theSubMesh );
   if ( aSubMeshSO->_is_nil() )
   {
-    SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+    SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
     if ( aMeshSO->_is_nil() ) {
       aMeshSO = PublishMesh( theStudy, theMesh );
       if ( aMeshSO->_is_nil())
@@ -632,8 +643,11 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SALOMEDS::Study_ptr      theS
     }
 
     // Find or create submesh root
-    SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(),
+    SALOMEDS::SObject_wrap aRootSO = publish (theStudy, CORBA::Object::_nil(),
                                              aMeshSO, aRootTag, 0, false );
+    if ( aRootSO->_is_nil() )
+      return aSubMeshSO._retn();
+
     SetName( aRootSO, aRootName );
 
     // Add new submesh to corresponding sub-tree
@@ -652,13 +666,12 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SALOMEDS::Study_ptr      theS
 
   // Publish hypothesis
 
-  SMESH::ListOfHypothesis * hypList = theMesh->GetHypothesisList( theShapeObject );
-  if ( hypList )
-    for ( int i = 0; i < hypList->length(); i++ ) {
-      SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( (*hypList)[ i ]);
-      PublishHypothesis( theStudy, aHyp );
-      AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp );
-    }
+  SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( theShapeObject );
+  for ( int i = 0; i < hypList->length(); i++ ) {
+    SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
+    SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
+    AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp );
+  }
 
   return aSubMeshSO._retn();
 }
@@ -677,10 +690,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr    theStudy
   if (theStudy->_is_nil() || theMesh->_is_nil() || theGroup->_is_nil() )
     return SALOMEDS::SObject::_nil();
 
-  SALOMEDS::SObject_var aGroupSO = ObjectToSObject( theStudy, theGroup );
+  SALOMEDS::SObject_wrap aGroupSO = ObjectToSObject( theStudy, theGroup );
   if ( aGroupSO->_is_nil() )
   {
-    SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+    SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
     if ( aMeshSO->_is_nil() ) {
       aMeshSO = PublishInStudy( theStudy, SALOMEDS::SObject::_nil(), theMesh, "");
       if ( aMeshSO->_is_nil())
@@ -698,8 +711,10 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr    theStudy
       long aRootTag = GetNodeGroupsTag() + aType - 1;
 
       // Find or create groups root
-      SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(),
+      SALOMEDS::SObject_wrap aRootSO = publish (theStudy, CORBA::Object::_nil(),
                                                aMeshSO, aRootTag, 0, false );
+      if ( aRootSO->_is_nil() ) return SALOMEDS::SObject::_nil();
+
       if ( aType < sizeof(aRootNames)/sizeof(char*) )
         SetName( aRootSO, aRootNames[aType] );
 
@@ -746,35 +761,34 @@ SALOMEDS::SObject_ptr
   if (theStudy->_is_nil() || theHyp->_is_nil())
     return SALOMEDS::SObject::_nil();
 
-  SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );
+  CORBA::String_var hypType = theHyp->GetName();
+
+  SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theStudy, theHyp );
   if ( aHypSO->_is_nil() )
   {
-    SALOMEDS::SComponent_var father = PublishComponent( theStudy );
+    SALOMEDS::SComponent_wrap father = PublishComponent( theStudy );
     if ( father->_is_nil() )
       return aHypSO._retn();
 
     //Find or Create Hypothesis root
     bool isAlgo = ( !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil() );
     int aRootTag = isAlgo ? GetAlgorithmsRootTag() : GetHypothesisRootTag();
-    SALOMEDS::SObject_var aRootSO =
+    SALOMEDS::SObject_wrap aRootSO =
       publish (theStudy, CORBA::Object::_nil(),father, aRootTag,
                isAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false);
     SetName( aRootSO, isAlgo ?  "Algorithms" : "Hypotheses" );
 
     // Add New Hypothesis
     string aPmName = isAlgo ? "ICON_SMESH_TREE_ALGO_" : "ICON_SMESH_TREE_HYPO_";
-    aPmName += theHyp->GetName();
+    aPmName += hypType.in();
     // prepend plugin name to pixmap name
-    string pluginName = myHypCreatorMap[string(theHyp->GetName())]->GetModuleName();
+    string pluginName = myHypCreatorMap[ hypType.in() ]->GetModuleName();
     if ( pluginName != "StdMeshers" )
       aPmName = pluginName + "::" + aPmName;
     aHypSO = publish( theStudy, theHyp, aRootSO, 0, aPmName.c_str() );
   }
 
-  if ( !aHypSO->_is_nil() ) {
-    CORBA::String_var aHypName = CORBA::string_dup( theHyp->GetName() );
-    SetName( aHypSO, theName, aHypName );
-  }
+  SetName( aHypSO, theName, hypType.in() );
 
   if(MYDEBUG) MESSAGE("PublishHypothesis--END")
   return aHypSO._retn();
@@ -791,7 +805,7 @@ SALOMEDS::SObject_ptr
                                         GEOM::GEOM_Object_ptr theShape)
 {
   if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
-  SALOMEDS::SObject_var aMeshOrSubMesh;
+  SALOMEDS::SObject_wrap aMeshOrSubMesh;
   if (theMesh->_is_nil() || ( theShape->_is_nil() && theMesh->HasShapeToMesh()))
     return aMeshOrSubMesh._retn();
   
@@ -834,15 +848,15 @@ bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
                             && theMesh->HasShapeToMesh()) )
     return false;
 
-  SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+  SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
   if ( aMeshSO->_is_nil() )
     aMeshSO = PublishMesh( theStudy, theMesh );
-  SALOMEDS::SObject_var aHypSO = PublishHypothesis( theStudy, theHyp );
+  SALOMEDS::SObject_wrap aHypSO = PublishHypothesis( theStudy, theHyp );
   if ( aMeshSO->_is_nil() || aHypSO->_is_nil())
     return false;
 
   // Find a mesh or submesh refering to theShape
-  SALOMEDS::SObject_var aMeshOrSubMesh =
+  SALOMEDS::SObject_wrap aMeshOrSubMesh =
     GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
   if ( aMeshOrSubMesh->_is_nil() )
   {
@@ -861,15 +875,14 @@ bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
 
   //Find or Create Applied Hypothesis root
   bool aIsAlgo = !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil();
-  SALOMEDS::SObject_var AHR =
+  SALOMEDS::SObject_wrap AHR =
     publish (theStudy, CORBA::Object::_nil(), aMeshOrSubMesh,
              aIsAlgo ? GetRefOnAppliedAlgorithmsTag() : GetRefOnAppliedHypothesisTag(),
              aIsAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false);
   SetName( AHR, aIsAlgo ? "Applied algorithms" : "Applied hypotheses" );
-  if ( AHR->_is_nil() )
-    return false;
 
   addReference( theStudy, AHR, theHyp );
+
   if(MYDEBUG) MESSAGE("AddHypothesisToShape--END")
   return true;
 }
@@ -889,27 +902,36 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy
                             && theMesh->HasShapeToMesh()))
     return false;
 
-  SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );
+  SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theStudy, theHyp );
   if ( aHypSO->_is_nil() )
     return false;
 
+  CORBA::String_var hypEntry = aHypSO->GetID();
+
   // Find a mesh or submesh refering to theShape
-  SALOMEDS::SObject_var aMeshOrSubMesh =
+  SALOMEDS::SObject_wrap aMeshOrSubMesh =
     GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
   if ( aMeshOrSubMesh->_is_nil() )
     return false;
 
   // Find and remove a reference to aHypSO
-  SALOMEDS::SObject_var aRef, anObj;
-  CORBA::String_var     anID = CORBA::string_dup( aHypSO->GetID() );
-  SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator( aMeshOrSubMesh );
-  for ( it->InitEx( true ); it->More(); it->Next() ) {
+  SALOMEDS::SObject_wrap aRef, anObj;
+  SALOMEDS::ChildIterator_wrap it = theStudy->NewChildIterator( aMeshOrSubMesh );
+  bool found = false;
+  for ( it->InitEx( true ); ( it->More() && !found ); it->Next() ) {
     anObj = it->Value();
-    if (anObj->ReferencedObject( aRef ) && strcmp( aRef->GetID(), anID ) == 0 ) {
-      theStudy->NewBuilder()->RemoveObject( anObj );
-      break;
+    if (anObj->ReferencedObject( aRef.inout() ))
+    {
+      CORBA::String_var refEntry = aRef->GetID();
+      found = ( strcmp( refEntry, hypEntry ) == 0 );
+    }
+    if ( found )
+    {
+      SALOMEDS::StudyBuilder_var builder = theStudy->NewBuilder();
+      builder->RemoveObject( anObj );
     }
   }
+
   return true;
 }
 
@@ -919,7 +941,7 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy
 //=======================================================================
 void SMESH_Gen_i::UpdateParameters(/*CORBA::Object_ptr theObject,*/ const char* theParameters)
 {
-  SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = GetCurrentStudy();
   if ( aStudy->_is_nil() )
     return;
   myLastParameters.clear();
@@ -950,11 +972,11 @@ void SMESH_Gen_i::UpdateParameters(/*CORBA::Object_ptr theObject,*/ const char*
 
   // if(VARIABLE_DEBUG)
   //   cout<<"UpdateParameters : "<<theParameters<<endl;
-  // //SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
+  // //SALOMEDS::Study_var aStudy = GetCurrentStudy();
   // if(aStudy->_is_nil() || CORBA::is_nil(theObject)) 
   //   return;
 
-  // SALOMEDS::SObject_var aSObj =  ObjectToSObject(aStudy,theObject);
+  // SALOMEDS::SObject_wrap aSObj =  ObjectToSObject(aStudy,theObject);
   // if(aSObj->_is_nil())  
   //   return;
 
@@ -1066,22 +1088,21 @@ char* SMESH_Gen_i::ParseParameters(const char* theParameters)
 //function : GetParameters
 //purpose  : 
 //=======================================================================
+
 char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
 {
-  TCollection_AsciiString aResult;
-
-  SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
-  SALOMEDS::SObject_var aSObj =  ObjectToSObject(aStudy,theObject);
-
-  if(!aStudy->_is_nil() && 
-     !CORBA::is_nil(theObject) && 
-     !aSObj->_is_nil()){
-    
-    SALOMEDS::GenericAttribute_var anAttr;
-    if ( aSObj->FindAttribute(anAttr, "AttributeString")) {
-      aResult = TCollection_AsciiString(SALOMEDS::AttributeString::_narrow(anAttr)->Value());
+  CORBA::String_var aResult("");
+
+  SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy,theObject);
+  if ( !aSObj->_is_nil() )
+  {
+    SALOMEDS::GenericAttribute_wrap attr;
+    if ( aSObj->FindAttribute( attr.inout(), "AttributeString"))
+    {
+      SALOMEDS::AttributeString_wrap strAttr = attr;
+      aResult = strAttr->Value();
     }
   }
-  
-  return CORBA::string_dup( aResult.ToCString() );
+
+  return CORBA::string_dup( aResult.in() );
 }
index 1b99653c62b603bf02ac844ca10080faba71b668..535ebc176973d5080ec4d3ef8ba7bfab85ea36a2 100644 (file)
@@ -156,11 +156,16 @@ void SMESH_GroupBase_i::SetName( const char* theName )
   aGroup->SetName(theName);
 
   // Update group name in a study
-  SMESH_Gen_i* aGen = myMeshServant->GetGen();
-  aGen->SetName( aGen->ObjectToSObject( aGen->GetCurrentStudy(), _this() ), theName );
-  
-  // Update Python script
-  TPythonDump() <<  _this() << ".SetName( '" << theName << "' )";
+  SMESH_Gen_i*          aGen = myMeshServant->GetGen();
+  SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
+  SALOMEDS::SObject_var anSO = aGen->ObjectToSObject( aStudy, _this() );
+  if ( !anSO->_is_nil() )
+  {
+    aGen->SetName( anSO, theName );
+
+    // Update Python script
+    TPythonDump() <<  _this() << ".SetName( '" << theName << "' )";
+  }
 }
 
 //=============================================================================
@@ -678,6 +683,7 @@ void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
  * Inherited from SMESH_IDSource
  */
 //=============================================================================
+
 SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo()
 {
   if ( myPreMeshInfo )
@@ -777,6 +783,7 @@ void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
 
   if ( myFilter )
   {
+    myFilter->SetMesh( SMESH::SMESH_Mesh::_nil() ); // to UnRegister() the mesh
     myFilter->Register();
     SMESH::DownCast< SMESH::Filter_i* >( myFilter )->AddWaiter( this );
   }
@@ -795,6 +802,67 @@ SMESH::Filter_ptr SMESH_GroupOnFilter_i::GetFilter()
   return f._retn();
 }
 
+//=======================================================================
+//function : GetIDs
+//purpose  : Returns ids of members
+//=======================================================================
+
+SMESH::long_array* SMESH_GroupOnFilter_i::GetListOfID()
+{
+  if ( myPreMeshInfo )
+    myPreMeshInfo->FullLoadFromFile();
+
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  SMESHDS_GroupBase* aGroupDS = GetGroupDS();
+  if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() ))
+  {
+    const SMDS_MeshInfo& meshInfo = aGroupDS->GetMesh()->GetMeshInfo();
+    aRes->length( meshInfo.NbElements( aGroupDS->GetType() ));
+    if ( aRes->length() ) // else aRes[0] -> SIGSEGV
+      aRes->length( grDS->GetElementIds( &aRes[0] ));
+
+    if ( 0 < aRes->length() && aRes->length() < 100 ) // for comfortable testing ;)
+      std::sort( &aRes[0], &aRes[0] + aRes->length() );
+  }
+  MESSAGE("get list of IDs of a vague group");
+  return aRes._retn();
+}
+
+//=============================================================================
+/*!
+ * Returns statistic of mesh elements
+ * Result array of number enityties
+ * Inherited from SMESH_IDSource
+ */
+//=============================================================================
+
+SMESH::long_array* SMESH_GroupOnFilter_i::GetMeshInfo()
+{
+  if ( myPreMeshInfo )
+    return myPreMeshInfo->GetMeshInfo();
+
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+
+  if ( SMESHDS_GroupBase* g = GetGroupDS())
+  {
+    if ( g->GetType() == SMDSAbs_Node || ( myNbNodes > -1 && g->GetTic() == myGroupDSTic))
+      aRes[ SMDSEntity_Node ] = GetNumberOfNodes();
+
+    if ( g->GetType() != SMDSAbs_Node )
+    {
+      vector< int > nbElems = static_cast< SMESHDS_GroupOnFilter* >( g )->GetMeshInfo();
+      for ( size_t i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+        if ( i < nbElems.size() )
+          aRes[i] = nbElems[ i ];
+    }
+  }
+
+  return aRes._retn();
+}
+
 #define SEPAR '^'
 
 //================================================================================
index dcb441057e0399e8978bae67fc1392c0474c78c4..226319b62f2bb6fe3a8d345fef4b1fc4b1d88883 100644 (file)
@@ -110,14 +110,14 @@ protected:
   SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
   friend class SMESH_PreMeshInfo;
 
+  int myNbNodes, myGroupDSTic;
+
 private:
   SMESH_Mesh_i* myMeshServant;
   int myLocalID;
 
   void changeLocalId(int localId) { myLocalID = localId; }
   friend class SMESH_Mesh_i;
-
-  int myNbNodes, myGroupDSTic;
 };
 
 // ======
@@ -183,6 +183,8 @@ class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
   // CORBA interface implementation
   void SetFilter(SMESH::Filter_ptr theFilter);
   SMESH::Filter_ptr GetFilter();
+  virtual SMESH::long_array* GetListOfID();
+  virtual SMESH::long_array* GetMeshInfo();
 
   // method of SMESH::Filter_i::TPredicateChangeWaiter
   virtual void PredicateChanged();
index f0fed296401201f4d8d9bc894612017bc409616c..c6d837f4932f7e2d3c1c237a2061281ed699912b 100644 (file)
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
 //
-#include <iostream>
-#include <sstream>
 #include "SMESH_Hypothesis_i.hxx"
 #include "SMESH_Gen_i.hxx"
-#include "utilities.h"
+
+#include <utilities.h>
+#include <SALOMEDS_wrap.hxx>
+
+#include <iostream>
+#include <sstream>
 
 using namespace std;
 
@@ -42,7 +45,7 @@ using namespace std;
 //=============================================================================
 
 SMESH_Hypothesis_i::SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA )
-     : SALOME::GenericObj_i( thePOA )
+  : SALOME::GenericObj_i( thePOA )
 {
   MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Début" );
   myBaseImpl = 0;
@@ -127,12 +130,13 @@ CORBA::Long SMESH_Hypothesis_i::GetId()
  *
  */
 //=============================================================================
-bool SMESH_Hypothesis_i::IsPublished(){
+bool SMESH_Hypothesis_i::IsPublished()
+{
   bool res = false;
-  SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-  if(gen){
-    SALOMEDS::SObject_var SO = 
-      SMESH_Gen_i::ObjectToSObject(gen->GetCurrentStudy() , SMESH::SMESH_Hypothesis::_narrow(_this()));
+  if ( SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen())
+  {
+    SALOMEDS::Study_var study = gen->GetCurrentStudy();
+    SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( study, _this());
     res = !SO->_is_nil();
   }
   return res;
@@ -210,105 +214,6 @@ void SMESH_Hypothesis_i::setOldParameters (const char* theParameters)
   }
 }
 
-//=============================================================================
-/*!
- *  SMESH_Hypothesis_i::SetParameters()
- *
- */
-//=============================================================================
-// void SMESH_Hypothesis_i::SetParameters(const char* theParameters)
-// {
-//   SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-//   //char * aParameters = CORBA::string_dup(theParameters);
-//   if(gen){
-//     gen->UpdateParameters(theParameters);
-//     // if(IsPublished()) {
-//     //   SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Hypothesis::_narrow(_this()),aParameters);
-//     // }
-//     // else {
-//     //   myBaseImpl->SetParameters(gen->ParseParameters(aParameters));
-//     // }
-//   }
-// }
-
-// //=============================================================================
-// /*!
-//  *  SMESH_Hypothesis_i::GetParameters()
-//  *
-//  */
-// //=============================================================================
-// char* SMESH_Hypothesis_i::GetParameters()
-// {
-//   SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-//   char* aResult;
-//   if(IsPublished()) {
-//     MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get Parameters from SObject");
-//     aResult = gen->GetParameters(SMESH::SMESH_Hypothesis::_narrow(_this()));
-//   }
-//   else {
-//     MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get local parameters");
-//     aResult = myBaseImpl->GetParameters(); 
-//   }
-//   return CORBA::string_dup(aResult);
-// }
-
-// //=============================================================================
-// /*!
-//  *  SMESH_Hypothesis_i::GetLastParameters()
-//  *
-//  */
-// //=============================================================================
-// SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters()
-// {
-//   SMESH::ListOfParameters_var aResult = new SMESH::ListOfParameters();
-//   SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-//   if(gen) {
-//     char *aParameters;
-//     if(IsPublished())
-//      aParameters = GetParameters();
-//     else
-//       aParameters = myBaseImpl->GetLastParameters();
-
-//     SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
-//     if(!aStudy->_is_nil()) {
-//       SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters); 
-//       if(aSections->length() > 0) {
-//         SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
-//         aResult->length(aVars.length());
-//         for(int i = 0;i < aVars.length();i++)
-//           aResult[i] = CORBA::string_dup( aVars[i]);
-//       }
-//     }
-//   }
-//   return aResult._retn();
-// }
-
-// //=============================================================================
-// /*!
-//  *  SMESH_Hypothesis_i::SetLastParameters()
-//  *
-//  */
-// //=============================================================================
-// void SMESH_Hypothesis_i::SetLastParameters(const char* theParameters)
-// {
-//   if(!IsPublished()) {
-//     myBaseImpl->SetLastParameters(theParameters);
-//   }
-// }
-// //=============================================================================
-// /*!
-//  *  SMESH_Hypothesis_i::ClearParameters()
-//  *
-//  */
-// //=============================================================================
-// void SMESH_Hypothesis_i::ClearParameters()
-// {
-//   myMethod2VarParams.clear();
-//   // if(!IsPublished()) {
-//   //   myBaseImpl->ClearParameters();
-//   // }
-// }
-
 //=============================================================================
 /*!
  *  SMESH_Hypothesis_i::GetImpl
index 823c8a037057165e95fc78d76e8bc43e8b4f76bd..ffde0e00fc947bb2e67e274f169807970f89b81d 100644 (file)
@@ -31,6 +31,9 @@
 #include "SMESHDS_Mesh.hxx"
 #include "SMESHDS_SubMesh.hxx"
 
+#include "SMESH_MEDSupport_i.hxx"
+#include "SMESH_MEDFamily_i.hxx"
+
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopTools_MapOfShape.hxx>
 
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-
-#include "SMESH_MEDSupport_i.hxx"
-#include "SMESH_MEDFamily_i.hxx"
+#include <utilities.h>
+#include <Utils_CorbaException.hxx>
 
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-# include "Utils_ExceptHandlers.hxx"
+#include <Utils_ORB_INIT.hxx>
+#include <Utils_SINGLETON.hxx>
+#include <Utils_ExceptHandlers.hxx>
+#include <SALOMEDS_wrap.hxx>
 
 extern "C"
 {
@@ -119,11 +120,12 @@ char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
   {
     SMESH_Gen_i*             gen = SMESH_Gen_i::GetSMESHGen();
     SALOMEDS::Study_var    study = gen->GetCurrentStudy();
-    SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
+    SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
     if ( meshSO->_is_nil() )
       return CORBA::string_dup("toto");
 
     CORBA::String_var name = meshSO->GetName();
+
     return CORBA::string_dup( name.in() );
   }
   catch(...)
@@ -856,50 +858,8 @@ void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
   if (_meshId != "")
   {
     MESSAGE("Mesh already in Study");
-    THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
-                                 SALOME::BAD_PARAM);
-  };
-
-  /*
-   * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
-   * 
-   * // Create SComponent labelled 'MED' if it doesn't already exit
-   * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
-   * if ( CORBA::is_nil(medfather) ) 
-   * {
-   * MESSAGE("Add Component MED");
-   * medfather = myBuilder->NewComponent("MED");
-   * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
-   * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
-   * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
-   * aName->SetValue("MED");
-   * 
-   * myBuilder->DefineComponentInstance(medfather,myIor);
-   * 
-   * } ;
-   * 
-   * MESSAGE("Add a mesh Object under MED");
-   * myBuilder->NewCommand();
-   * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
-   * 
-   * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-   * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
-   * CORBA::ORB_var &orb = init(0,0);
-   * CORBA::String_var iorStr = orb->object_to_string(myIor);
-   * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
-   * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
-   * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
-   * aIOR->SetValue(iorStr.c_str());
-   * 
-   * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
-   * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
-   * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
-   * aName->SetValue(_mesh_i->getName().c_str());
-   * 
-   * _meshId = newObj->GetID();
-   * myBuilder->CommitCommand();
-   * 
-   */
+    THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", SALOME::BAD_PARAM);
+  }
   END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
 }
 
index 0709265bf2aab9c7d49509f93d010808abad7b76..87e88611289bc893010542658742e0552164cc85 100644 (file)
@@ -29,8 +29,6 @@
 
 #include "SMESH_MeshEditor_i.hxx"
 
-#include "DriverMED_R_SMESHDS_Mesh.h"
-#include "DriverMED_W_SMESHDS_Mesh.h"
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_ElemIterator.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_MeshVolume.hxx"
 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
 #include "SMDS_SetIterator.hxx"
-#include "SMDS_SetIterator.hxx"
 #include "SMDS_VolumeTool.hxx"
-#include "SMESHDS_Command.hxx"
-#include "SMESHDS_CommandType.hxx"
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
 #include "SMESH_ControlsDef.hxx"
 #include "SMESH_Filter_i.hxx"
-#include "SMESH_Filter_i.hxx"
-#include "SMESH_Gen_i.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_Group.hxx"
 #include "SMESH_Group_i.hxx"
-#include "SMESH_Group_i.hxx"
-#include "SMESH_MEDMesh_i.hxx"
-#include "SMESH_MeshEditor.hxx"
 #include "SMESH_MeshPartDS.hxx"
 #include "SMESH_MesherHelper.hxx"
-#include "SMESH_PreMeshInfo.hxx"
-#include "SMESH_PythonDump.hxx"
 #include "SMESH_PythonDump.hxx"
 #include "SMESH_subMeshEventListener.hxx"
 #include "SMESH_subMesh_i.hxx"
-#include "SMESH_subMesh_i.hxx"
 
-#include "utilities.h"
-#include "Utils_ExceptHandlers.hxx"
-#include "Utils_CorbaException.hxx"
+#include <utilities.h>
+#include <Utils_ExceptHandlers.hxx>
+#include <Utils_CorbaException.hxx>
+#include <SALOMEDS_wrap.hxx>
 
 #include <BRepAdaptor_Surface.hxx>
 #include <BRep_Tool.hxx>
@@ -93,6 +81,8 @@
 #include <sstream>
 #include <limits>
 
+#include "SMESH_TryCatch.hxx" // include after OCCT headers!
+
 #define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem )
 
 using namespace std;
@@ -112,7 +102,7 @@ namespace MeshEditor_I {
     SMDSAbs_ElementType myPreviewType; // type to show
     //!< Constructor
     TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) {
-      _isShapeToMesh = (_id =_studyId =_idDoc = 0);
+      _isShapeToMesh = (_id =_studyId = 0);
       _myMeshDS  = new SMESHDS_Mesh( _id, true );
       myPreviewType = previewElements;
     }
@@ -543,9 +533,6 @@ SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData()
     else {
       aMeshDS = getEditor().GetMeshDS();
     }
-    int nbEdges = aMeshDS->NbEdges();
-    int nbFaces = aMeshDS->NbFaces();
-    int nbVolum = aMeshDS->NbVolumes();
     myPreviewData = new SMESH::MeshPreviewStruct();
     myPreviewData->nodesXYZ.length(aMeshDS->NbNodes());
 
@@ -555,14 +542,15 @@ SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData()
       if (TPreviewMesh * aPreviewMesh = dynamic_cast< TPreviewMesh* >( getEditor().GetMesh() )) {
         previewType = aPreviewMesh->myPreviewType;
         switch ( previewType ) {
-        case SMDSAbs_Edge  : nbFaces = nbVolum = 0; break;
-        case SMDSAbs_Face  : nbEdges = nbVolum = 0; break;
-        case SMDSAbs_Volume: nbEdges = nbFaces = 0; break;
+        case SMDSAbs_Edge  : break;
+        case SMDSAbs_Face  : break;
+        case SMDSAbs_Volume: break;
         default:;
+          if ( aMeshDS->GetMeshInfo().NbElements() == 0 ) previewType = SMDSAbs_Node;
         }
       }
 
-    myPreviewData->elementTypes.length(nbEdges + nbFaces + nbVolum);
+    myPreviewData->elementTypes.length( aMeshDS->GetMeshInfo().NbElements( previewType ));
     int i = 0, j = 0;
     SMDS_ElemIteratorPtr itMeshElems = aMeshDS->elementsIterator(previewType);
 
@@ -709,6 +697,11 @@ SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_arr
   return anIDSourceVar._retn();
 }
 
+bool SMESH_MeshEditor_i::IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource )
+{
+  return SMESH::DownCast<SMESH_MeshEditor_i::_IDSource*>( idSource );
+}
+
 void SMESH_MeshEditor_i::deleteAuxIDSources()
 {
   std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin();
@@ -863,6 +856,8 @@ CORBA::Long SMESH_MeshEditor_i::AddBall(CORBA::Long IDOfNode, CORBA::Double diam
   if ( diameter < std::numeric_limits<double>::min() )
     THROW_SALOME_CORBA_EXCEPTION("Invalid diameter", SALOME::BAD_PARAM);
 
+  SMESH_TRY;
+
   const SMDS_MeshNode* aNode = getMeshDS()->FindNode(IDOfNode);
   SMDS_MeshElement* elem = getMeshDS()->AddBall(aNode, diameter);
 
@@ -876,6 +871,8 @@ CORBA::Long SMESH_MeshEditor_i::AddBall(CORBA::Long IDOfNode, CORBA::Double diam
   if (elem)
     return elem->GetID();
 
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return 0;
 }
 
@@ -1144,6 +1141,8 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
   SMESH::SMESH_IDSource_var result;
   TPythonDump pyDump;
 
+  SMESH_TRY;
+
   TIDSortedElemSet elements, elems0D;
   if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     getEditor().Create0DElementsOnAllNodes( elements, elems0D );
@@ -1190,6 +1189,8 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
   pyDump << " = " << this << ".Create0DElementsOnAllNodes( "
          << theObject << ", '" << theGroupName << "' )";
 
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return result._retn();
 }
 
@@ -5281,10 +5282,10 @@ void SMESH_MeshEditor_i::ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr th
 
 SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName)
 {
-  SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
-  SMESH::SMESH_Mesh_var mesh = gen->CreateEmptyMesh();
-  SALOMEDS::Study_var study = gen->GetCurrentStudy();
-  SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, mesh );
+  SMESH_Gen_i*              gen = SMESH_Gen_i::GetSMESHGen();
+  SMESH::SMESH_Mesh_var    mesh = gen->CreateEmptyMesh();
+  SALOMEDS::Study_var     study = gen->GetCurrentStudy();
+  SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, mesh );
   gen->SetName( meshSO, theMeshName, "Mesh" );
   gen->SetPixMap( meshSO, "ICON_SMESH_TREE_MESH_IMPORTED");
 
@@ -6199,8 +6200,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
                                                                  CORBA::Boolean createJointElems )
   throw (SALOME::SALOME_Exception)
 {
-  initData();
+  bool aResult = false;
 
+  SMESH_TRY;
+  initData();
 
   SMESHDS_Mesh* aMeshDS = getMeshDS();
 
@@ -6222,7 +6225,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
     }
   }
 
-  bool aResult = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems );
+  aResult = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems );
   // TODO publish the groups of flat elements in study
 
   myMesh->GetMeshDS()->Modified();
@@ -6230,6 +6233,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
   // Update Python script
   TPythonDump() << "isDone = " << this << ".DoubleNodesOnGroupBoundaries( " << &theDomains
       << ", " << createJointElems << " )";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return aResult;
 }
 
@@ -6289,8 +6295,10 @@ void SMESH_MeshEditor_i::CreateHoleSkin(CORBA::Double radius,
                                         const char* groupName,
                                         const SMESH::double_array& theNodesCoords,
                                         SMESH::array_of_long_array_out GroupsOfNodes)
-throw (SALOME::SALOME_Exception)
+  throw (SALOME::SALOME_Exception)
 {
+  SMESH_TRY;
+
   initData();
   std::vector<std::vector<int> > aListOfListOfNodes;
   ::SMESH_MeshEditor aMeshEditor( myMesh );
@@ -6301,27 +6309,33 @@ throw (SALOME::SALOME_Exception)
 
   vector<double> nodesCoords;
   for (int i = 0; i < theNodesCoords.length(); i++)
-    {
-      nodesCoords.push_back( theNodesCoords[i] );
+  {
+    nodesCoords.push_back( theNodesCoords[i] );
   }
 
   TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
-  aMeshEditor.CreateHoleSkin(radius, aShape, theNodeSearcher, groupName, nodesCoords, aListOfListOfNodes);
+  aMeshEditor.CreateHoleSkin(radius, aShape, theNodeSearcher, groupName,
+                             nodesCoords, aListOfListOfNodes);
 
   GroupsOfNodes = new SMESH::array_of_long_array;
   GroupsOfNodes->length( aListOfListOfNodes.size() );
   std::vector<std::vector<int> >::iterator llIt = aListOfListOfNodes.begin();
   for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ )
-    {
-      vector<int>& aListOfNodes = *llIt;
-      vector<int>::iterator lIt = aListOfNodes.begin();;
-      SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
-      aGroup.length( aListOfNodes.size() );
-      for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
-        aGroup[ j ] = (*lIt);
-    }
+  {
+    vector<int>& aListOfNodes = *llIt;
+    vector<int>::iterator lIt = aListOfNodes.begin();;
+    SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
+    aGroup.length( aListOfNodes.size() );
+    for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
+      aGroup[ j ] = (*lIt);
+  }
   TPythonDump() << "lists_nodes = " << this << ".CreateHoleSkin( "
-      << radius << ", " << theShape << ", " << ", " << groupName << ", " << theNodesCoords << " )";
+                << radius << ", "
+                << theShape
+                << ", '" << groupName << "', "
+                << theNodesCoords << " )";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
 }
 
 
index a6a0e3c44b89aca9703a90ec30a099f0a9857666..d3295821d70e31dac6678c9652482a0ab9786364 100644 (file)
@@ -84,6 +84,7 @@ public:
    */
   SMESH::SMESH_IDSource_ptr MakeIDSource(const SMESH::long_array& IDsOfElements,
                                          SMESH::ElementType       type);
+  static bool               IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource );
   CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
   CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
   CORBA::Long    RemoveOrphanNodes();
index afe7656491c7ebdf32d3ab5f312796866f3377d8..cf844162374e6285040eda9a199d0916670d2919 100644 (file)
 #include "SMDS_ElemIterator.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_IteratorOnIterators.hxx"
+#include "SMDS_MeshGroup.hxx"
 #include "SMDS_SetIterator.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESHDS_Command.hxx"
 #include "SMESHDS_CommandType.hxx"
+#include "SMESHDS_Group.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
 #include "SMESH_Filter_i.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_subMesh_i.hxx"
 
 #include <OpUtil.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
+#include <SALOMEDS_wrap.hxx>
 #include <SALOME_NamingService.hxx>
-#include <Utils_CorbaException.hxx>
 #include <Utils_ExceptHandlers.hxx>
 #include <Utils_SINGLETON.hxx>
 #include <utilities.h>
+
 #include <GEOMImpl_Types.hxx>
+#include <GEOM_wrap.hxx>
 
 // OCCT Includes
 #include <BRep_Builder.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopoDS_Compound.hxx>
 
+#include "SMESH_TryCatch.hxx" // include after OCCT headers!
+
 // STL Includes
 #include <algorithm>
 #include <string>
 #include <iostream>
 #include <sstream>
+
 #include <sys/stat.h>
 
 #ifdef _DEBUG_
@@ -92,10 +100,6 @@ using SMESH::TPythonDump;
 
 int SMESH_Mesh_i::_idGenerator = 0;
 
-//To disable automatic genericobj management, the following line should be commented.
-//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
-#define WITHGENERICOBJ
-
 //=============================================================================
 /*!
  *  Constructor
@@ -108,10 +112,10 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
 : SALOME::GenericObj_i( thePOA )
 {
   MESSAGE("SMESH_Mesh_i");
-  _impl = NULL;
-  _gen_i = gen_i;
-  _id = _idGenerator++;
-  _studyId = studyId;
+  _impl        = NULL;
+  _gen_i       = gen_i;
+  _id          = _idGenerator++;
+  _studyId     = studyId;
   _preMeshInfo = NULL;
 }
 
@@ -125,50 +129,38 @@ SMESH_Mesh_i::~SMESH_Mesh_i()
 {
   MESSAGE("~SMESH_Mesh_i");
 
-#ifdef WITHGENERICOBJ
   // destroy groups
   map<int, SMESH::SMESH_GroupBase_ptr>::iterator itGr;
-  for (itGr = _mapGroups.begin(); itGr != _mapGroups.end(); itGr++) {
-    if ( CORBA::is_nil( itGr->second ))
-      continue;
-    SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>(SMESH_Gen_i::GetServant(itGr->second).in());
-    if (aGroup) {
-      // this method is called from destructor of group (PAL6331)
+  for (itGr = _mapGroups.begin(); itGr != _mapGroups.end(); itGr++)
+    if (SMESH_GroupBase_i* aGroup = SMESH::DownCast<SMESH_GroupBase_i*>(itGr->second))
+    {
+      // _impl->RemoveGroup() is called by ~SMESH_GroupBase_i() (PAL6331)
       //_impl->RemoveGroup( aGroup->GetLocalID() );
       aGroup->myMeshServant = 0;
       aGroup->UnRegister();
     }
-  }
   _mapGroups.clear();
 
   // destroy submeshes
   map<int, SMESH::SMESH_subMesh_ptr>::iterator itSM;
-  for ( itSM = _mapSubMeshIor.begin(); itSM != _mapSubMeshIor.end(); itSM++ ) {
-    if ( CORBA::is_nil( itSM->second ))
-      continue;
-    SMESH_subMesh_i* aSubMesh = dynamic_cast<SMESH_subMesh_i*>(SMESH_Gen_i::GetServant(itSM->second).in());
-    if (aSubMesh) {
+  for ( itSM = _mapSubMeshIor.begin(); itSM != _mapSubMeshIor.end(); itSM++ )
+    if ( SMESH_subMesh_i* aSubMesh = SMESH::DownCast<SMESH_subMesh_i*>( itSM->second ))
+    {
       aSubMesh->UnRegister();
     }
-  }
   _mapSubMeshIor.clear();
 
   // destroy hypotheses
   map<int, SMESH::SMESH_Hypothesis_ptr>::iterator itH;
-  for ( itH = _mapHypo.begin(); itH != _mapHypo.end(); itH++ ) {
-    if ( CORBA::is_nil( itH->second ))
-      continue;
-    SMESH_Hypothesis_i* aHypo = dynamic_cast<SMESH_Hypothesis_i*>(SMESH_Gen_i::GetServant(itH->second).in());
-    if (aHypo) {
+  for ( itH = _mapHypo.begin(); itH != _mapHypo.end(); itH++ )
+    if ( SMESH_Hypothesis_i* aHypo = SMESH::DownCast<SMESH_Hypothesis_i*>( itH->second ))
+    {
       aHypo->UnRegister();
     }
-  }
   _mapHypo.clear();
-#endif
 
   delete _impl; _impl = NULL;
-
-  if ( _preMeshInfo ) delete _preMeshInfo; _preMeshInfo = NULL;
+  delete _preMeshInfo; _preMeshInfo = NULL;
 }
 
 //=============================================================================
@@ -280,6 +272,8 @@ void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception)
   catch(SALOME_Exception & S_ex) {
     THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
   }
+  _impl->GetMeshDS()->Modified();
+
   TPythonDump() <<  _this() << ".Clear()";
 }
 
@@ -302,6 +296,9 @@ void SMESH_Mesh_i::ClearSubMesh(CORBA::Long ShapeID)
   catch(SALOME_Exception & S_ex) {
     THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
   }
+  _impl->GetMeshDS()->Modified();
+
+  TPythonDump() <<  _this() << ".ClearSubMesh( " << ShapeID << " )";
 }
 
 //=============================================================================
@@ -323,6 +320,8 @@ static SMESH::DriverMED_ReadStatus ConvertDriverMEDReadStatus (int theStatus)
     res = SMESH::DRS_WARN_RENUMBER; break;
   case DriverMED_R_SMESHDS_Mesh::DRS_WARN_SKIP_ELEM:
     res = SMESH::DRS_WARN_SKIP_ELEM; break;
+  case DriverMED_R_SMESHDS_Mesh::DRS_WARN_DESCENDING:
+    res = SMESH::DRS_WARN_DESCENDING; break;
   case DriverMED_R_SMESHDS_Mesh::DRS_FAIL:
   default:
     res = SMESH::DRS_FAIL; break;
@@ -453,11 +452,15 @@ char* SMESH_Mesh_i::GetVersionString(SMESH::MED_VERSION version, CORBA::Short nb
 int SMESH_Mesh_i::ImportUNVFile( const char* theFileName )
   throw ( SALOME::SALOME_Exception )
 {
+  SMESH_TRY;
+
   // Read mesh with name = <theMeshName> into SMESH_Mesh
   _impl->UNVToMesh( theFileName );
 
   CreateGroupServants();
 
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return 1;
 }
 
@@ -471,12 +474,30 @@ int SMESH_Mesh_i::ImportUNVFile( const char* theFileName )
 int SMESH_Mesh_i::ImportSTLFile( const char* theFileName )
   throw ( SALOME::SALOME_Exception )
 {
+  SMESH_TRY;
+
   // Read mesh with name = <theMeshName> into SMESH_Mesh
   _impl->STLToMesh( theFileName );
 
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return 1;
 }
 
+//================================================================================
+/*!
+ * \brief Function used in SMESH_CATCH by ImportGMFFile()
+ */
+//================================================================================
+
+namespace
+{
+  SMESH_ComputeErrorPtr exceptionToComputeError(const char* excText)
+  {
+    return SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, excText );
+  }
+}
+
 //================================================================================
 /*!
  * \brief Imports data from a GMF file and returns an error description
@@ -488,29 +509,16 @@ SMESH::ComputeError* SMESH_Mesh_i::ImportGMFFile( const char* theFileName,
   throw (SALOME::SALOME_Exception)
 {
   SMESH_ComputeErrorPtr error;
-  try {
-    error = _impl->GMFToMesh( theFileName, theMakeRequiredGroups );
-  }
-  catch ( std::bad_alloc& exc ) {
-    error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, "std::bad_alloc raised" );
-  }
-  catch ( Standard_OutOfMemory& exc ) {
-    error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, "Standard_OutOfMemory raised" );
-  }
-  catch (Standard_Failure& ex) {
-    error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, ex.DynamicType()->Name() );
-    if ( ex.GetMessageString() && strlen( ex.GetMessageString() ))
-      error->myComment += string(": ") + ex.GetMessageString();
-  }
-  catch ( SALOME_Exception& S_ex ) {
-    error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, S_ex.what() );
-  }
-  catch ( std::exception& exc ) {
-    error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, exc.what() );
-  }
-  catch (...) {
-    error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, "Unknown exception" );
-  }
+
+#undef SMESH_CAUGHT
+#define SMESH_CAUGHT error =
+  SMESH_TRY;
+
+  error = _impl->GMFToMesh( theFileName, theMakeRequiredGroups );
+
+  SMESH_CATCH( exceptionToComputeError );
+#undef SMESH_CAUGHT
+#define SMESH_CAUGHT
 
   CreateGroupServants();
 
@@ -621,9 +629,7 @@ SMESH_Hypothesis::Hypothesis_Status
     status = _impl->AddHypothesis(myLocSubShape, hypId);
     if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
       _mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp );
-#ifdef WITHGENERICOBJ
       _mapHypo[hypId]->Register();
-#endif
       // assure there is a corresponding submesh
       if ( !_impl->IsMainShape( myLocSubShape )) {
         int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );
@@ -827,7 +833,7 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
     if ( subMesh->_is_nil() )
       subMesh = createSubMesh( aSubShapeObject );
     if ( _gen_i->CanPublishInStudy( subMesh )) {
-      SALOMEDS::SObject_var aSO =
+      SALOMEDS::SObject_wrap aSO =
         _gen_i->PublishSubMesh(_gen_i->GetCurrentStudy(), aMesh,
                                subMesh, aSubShapeObject, theName );
       if ( !aSO->_is_nil()) {
@@ -850,27 +856,32 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
 //=============================================================================
 
 void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
-     throw (SALOME::SALOME_Exception)
+  throw (SALOME::SALOME_Exception)
 {
-  if(MYDEBUG) MESSAGE("SMESH_Mesh_i::RemoveSubMesh");
+  SMESH_TRY;
+  
   if ( theSubMesh->_is_nil() )
     return;
 
   GEOM::GEOM_Object_var aSubShapeObject;
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() )  {
     // Remove submesh's SObject
-    SALOMEDS::SObject_var anSO = _gen_i->ObjectToSObject( aStudy, theSubMesh );
+    SALOMEDS::SObject_wrap anSO = _gen_i->ObjectToSObject( aStudy, theSubMesh );
     if ( !anSO->_is_nil() ) {
       long aTag = SMESH_Gen_i::GetRefOnShapeTag();
-      SALOMEDS::SObject_var anObj, aRef;
-      if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) )
-        aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() );
-
-//       if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
-//         aSubShapeObject = theSubMesh->GetSubShape();
+      SALOMEDS::SObject_wrap anObj, aRef;
+      if ( anSO->FindSubObject( aTag, anObj.inout() ) &&
+           anObj->ReferencedObject( aRef.inout() ))
+      {
+        CORBA::Object_var obj = aRef->GetObject();
+        aSubShapeObject = GEOM::GEOM_Object::_narrow( obj );
+      }
+      // if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
+      //   aSubShapeObject = theSubMesh->GetSubShape();
 
-      aStudy->NewBuilder()->RemoveObjectWithChildren( anSO );
+      SALOMEDS::StudyBuilder_var builder = aStudy->NewBuilder();
+      builder->RemoveObjectWithChildren( anSO );
 
       // Update Python script
       TPythonDump() << _this() << ".RemoveSubMesh( " << anSO << " )";
@@ -880,6 +891,8 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
   if ( removeSubMesh( theSubMesh, aSubShapeObject.in() ))
     if ( _preMeshInfo )
       _preMeshInfo->ForgetOrLoad();
+
+  SMESH_CATCH( SMESH::throwCorbaException );
 }
 
 //=============================================================================
@@ -900,7 +913,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroup( SMESH::ElementType theElemType
     SMESH::SMESH_Group::_narrow( createGroup( theElemType, theName ));
 
   if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
-    SALOMEDS::SObject_var aSO =
+    SALOMEDS::SObject_wrap aSO =
       _gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
                            aNewGroup, GEOM::GEOM_Object::_nil(), theName);
     if ( !aSO->_is_nil()) {
@@ -937,7 +950,7 @@ SMESH_Mesh_i::CreateGroupFromGEOM (SMESH::ElementType    theElemType,
       ( createGroup( theElemType, theName, aShape ));
 
     if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
-      SALOMEDS::SObject_var aSO =
+      SALOMEDS::SObject_wrap aSO =
         _gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
                              aNewGroup, theGeomObj, theName);
       if ( !aSO->_is_nil()) {
@@ -987,7 +1000,7 @@ SMESH_Mesh_i::CreateGroupFromFilter(SMESH::ElementType theElemType,
 
   if ( _gen_i->CanPublishInStudy( aNewGroup ) )
   {
-    SALOMEDS::SObject_var aSO =
+    SALOMEDS::SObject_wrap aSO =
       _gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(), aNewGroup,
                            GEOM::GEOM_Object::_nil(), theName);
     if ( !aSO->_is_nil()) {
@@ -1012,26 +1025,31 @@ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
   if ( theGroup->_is_nil() )
     return;
 
+  SMESH_TRY;
+
   SMESH_GroupBase_i* aGroup =
     dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( theGroup ).in() );
   if ( !aGroup )
     return;
 
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() )  {
-    SALOMEDS::SObject_var aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
+    SALOMEDS::SObject_wrap aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
 
     if ( !aGroupSO->_is_nil() ) {
       // Update Python script
       TPythonDump() << _this() << ".RemoveGroup( " << aGroupSO << " )";
 
       // Remove group's SObject
-      aStudy->NewBuilder()->RemoveObjectWithChildren( aGroupSO );
+      SALOMEDS::StudyBuilder_var builder = aStudy->NewBuilder();
+      builder->RemoveObjectWithChildren( aGroupSO );
     }
   }
 
   // Remove the group from SMESH data structures
   removeGroup( aGroup->GetLocalID() );
+
+  SMESH_CATCH( SMESH::throwCorbaException );
 }
 
 //=============================================================================
@@ -1043,6 +1061,7 @@ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
 void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
@@ -1070,6 +1089,8 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup
 
   // Remove group
   RemoveGroup( theGroup );
+
+  SMESH_CATCH( SMESH::throwCorbaException );
 }
 
 //================================================================================
@@ -1138,63 +1159,58 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr the
                                                   const char* theName )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aResGrp;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
-  try
-  {
-    if ( theGroup1->_is_nil() || theGroup2->_is_nil() ||
-         theGroup1->GetType() != theGroup2->GetType() )
-      return SMESH::SMESH_Group::_nil();
+  if ( theGroup1->_is_nil() || theGroup2->_is_nil() ||
+       theGroup1->GetType() != theGroup2->GetType() )
+    return SMESH::SMESH_Group::_nil();
+
+  TPythonDump pyDump;
 
-    // Create Union
-    SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
-    if ( aResGrp->_is_nil() )
-      return SMESH::SMESH_Group::_nil();
+  // Create Union
+  aResGrp = CreateGroup( theGroup1->GetType(), theName );
+  if ( aResGrp->_is_nil() )
+    return SMESH::SMESH_Group::_nil();
 
-    SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
-    SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
+  SMESH::long_array_var anIds1 = theGroup1->GetListOfID();
+  SMESH::long_array_var anIds2 = theGroup2->GetListOfID();
 
-    TColStd_MapOfInteger aResMap;
+  TColStd_MapOfInteger aResMap;
 
-    for ( int i1 = 0, n1 = anIds1->length(); i1 < n1; i1++ )
-      aResMap.Add( anIds1[ i1 ] );
+  for ( int i1 = 0, n1 = anIds1->length(); i1 < n1; i1++ )
+    aResMap.Add( anIds1[ i1 ] );
 
-    for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
-      aResMap.Add( anIds2[ i2 ] );
+  for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
+    aResMap.Add( anIds2[ i2 ] );
 
-    SMESH::long_array_var aResIds = new SMESH::long_array;
-    aResIds->length( aResMap.Extent() );
+  SMESH::long_array_var aResIds = new SMESH::long_array;
+  aResIds->length( aResMap.Extent() );
 
-    int resI = 0;
-    TColStd_MapIteratorOfMapOfInteger anIter( aResMap );
-    for( ; anIter.More(); anIter.Next() )
-      aResIds[ resI++ ] = anIter.Key();
+  int resI = 0;
+  TColStd_MapIteratorOfMapOfInteger anIter( aResMap );
+  for( ; anIter.More(); anIter.Next() )
+    aResIds[ resI++ ] = anIter.Key();
 
-    aResGrp->Add( aResIds );
+  aResGrp->Add( aResIds );
 
-    // Clear python lines, created by CreateGroup() and Add()
-    SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-    _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-    _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
+  // Update Python script
+  pyDump << aResGrp << " = " << _this() << ".UnionGroups( "
+         << theGroup1 << ", " << theGroup2 << ", '"
+         << theName << "' )";
 
-    // Update Python script
-    TPythonDump() << aResGrp << " = " << _this() << ".UnionGroups( "
-                  << theGroup1 << ", " << theGroup2 << ", '"
-                  << theName << "' )";
+  SMESH_CATCH( SMESH::throwCorbaException );
 
-    return aResGrp._retn();
-  }
-  catch( ... )
-  {
-    return SMESH::SMESH_Group::_nil();
-  }
+  return aResGrp._retn();
 }
 
 //=============================================================================
 /*!
   \brief Union list of groups. New group is created. All mesh elements that are
-   present in initial groups are added to the new one.
+  present in initial groups are added to the new one.
   \param theGroups list of groups
   \param theName name of group to be created
   \return pointer on the group
@@ -1202,7 +1218,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr the
 //=============================================================================
 SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionListOfGroups(const SMESH::ListOfGroups& theGroups,
                                                        const char*                theName )
-throw (SALOME::SALOME_Exception)
+  throw (SALOME::SALOME_Exception)
 {
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
@@ -1210,67 +1226,59 @@ throw (SALOME::SALOME_Exception)
   if ( !theName )
     return SMESH::SMESH_Group::_nil();
 
-  try
-  {
-    vector< int > anIds;
-    SMESH::ElementType aType = SMESH::ALL;
-    for ( int g = 0, n = theGroups.length(); g < n; g++ )
-    {
-      SMESH::SMESH_GroupBase_var aGrp = theGroups[ g ];
-      if ( CORBA::is_nil( aGrp ) )
-        continue;
+  SMESH::SMESH_Group_var aResGrp;
 
-      // check type
-      SMESH::ElementType aCurrType = aGrp->GetType();
-      if ( aType == SMESH::ALL )
-        aType = aCurrType;
-      else 
-      {
-        if ( aType != aCurrType )
-          return SMESH::SMESH_Group::_nil();
-      }
+  SMESH_TRY;
 
-      // unite ids
-      SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
-      for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
-      {
-        int aCurrId = aCurrIds[ i ];
-        anIds.push_back( aCurrId );
-      }
+  vector< int > anIds;
+  SMESH::ElementType aType = SMESH::ALL;
+  for ( int g = 0, n = theGroups.length(); g < n; g++ )
+  {
+    SMESH::SMESH_GroupBase_var aGrp = theGroups[ g ];
+    if ( CORBA::is_nil( aGrp ) )
+      continue;
+
+    // check type
+    SMESH::ElementType aCurrType = aGrp->GetType();
+    if ( aType == SMESH::ALL )
+      aType = aCurrType;
+    else
+    {
+      if ( aType != aCurrType )
+        return SMESH::SMESH_Group::_nil();
     }
 
-    // Create group
-    SMESH::SMESH_Group_var aResGrp = CreateGroup( aType, theName );
-    if ( aResGrp->_is_nil() )
-      return SMESH::SMESH_Group::_nil();
-    
-    // Create array of identifiers
-    SMESH::long_array_var aResIds = new SMESH::long_array;
-    aResIds->length( anIds.size() );
-    
-    //NCollection_Map< int >::Iterator anIter( anIds );
-    for ( int i = 0; i<anIds.size(); i++ )
+    // unite ids
+    SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
+    for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
     {
-      aResIds[ i ] = anIds[i];
+      int aCurrId = aCurrIds[ i ];
+      anIds.push_back( aCurrId );
     }
-    aResGrp->Add( aResIds );
+  }
 
-    // Clear python lines, created by CreateGroup() and Add()
-    SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
+  TPythonDump pyDump;
 
-    // Update Python script
-    
-    TPythonDump() << aResGrp << " = " << _this() << ".UnionListOfGroups( "
-                  << &theGroups << ", '" << theName << "' )";
-
-    return aResGrp._retn();
-  }
-  catch( ... )
-  {
+  // Create group
+  aResGrp = CreateGroup( aType, theName );
+  if ( aResGrp->_is_nil() )
     return SMESH::SMESH_Group::_nil();
-  }
+
+  // Create array of identifiers
+  SMESH::long_array_var aResIds = new SMESH::long_array;
+  aResIds->length( anIds.size() );
+
+  for ( size_t i = 0; i<anIds.size(); i++ )
+    aResIds[ i ] = anIds[i];
+  aResGrp->Add( aResIds );
+
+  // Update Python script
+  pyDump << aResGrp << " = " << _this() << ".UnionListOfGroups( "
+         << &theGroups << ", '" << theName << "' )";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return aResGrp._retn();
 }
 
 //=============================================================================
@@ -1281,9 +1289,12 @@ throw (SALOME::SALOME_Exception)
 //=============================================================================
 SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
                                                       SMESH::SMESH_GroupBase_ptr theGroup2,
-                                                      const char* theName )
+                                                      const char*                theName )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aResGrp;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
@@ -1291,8 +1302,10 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr
        theGroup1->GetType() != theGroup2->GetType() )
     return SMESH::SMESH_Group::_nil();
 
+  TPythonDump pyDump;
+
   // Create Intersection
-  SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
+  aResGrp = CreateGroup( theGroup1->GetType(), theName );
   if ( aResGrp->_is_nil() )
     return aResGrp;
 
@@ -1305,27 +1318,21 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr
     aMap1.Add( anIds1[ i1 ] );
 
   TColStd_SequenceOfInteger aSeq;
-
   for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
     if ( aMap1.Contains( anIds2[ i2 ] ) )
       aSeq.Append( anIds2[ i2 ] );
 
   SMESH::long_array_var aResIds = new SMESH::long_array;
   aResIds->length( aSeq.Length() );
-
-  for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
+  for ( size_t resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
     aResIds[ resI ] = aSeq( resI + 1 );
-
   aResGrp->Add( aResIds );
 
-  // Clear python lines, created by CreateGroup() and Add()
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-
   // Update Python script
-  TPythonDump() << aResGrp << " = " << _this() << ".IntersectGroups( "
-                << theGroup1 << ", " << theGroup2 << ", '" << theName << "')";
+  pyDump << aResGrp << " = " << _this() << ".IntersectGroups( "
+         << theGroup1 << ", " << theGroup2 << ", '" << theName << "')";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
 
   return aResGrp._retn();
 }
@@ -1344,88 +1351,79 @@ SMESH_Mesh_i::IntersectListOfGroups(const SMESH::ListOfGroups& theGroups,
                                     const char*                theName )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aResGrp;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
   if ( !theName )
     return SMESH::SMESH_Group::_nil();
 
-  try
+  NCollection_DataMap< int, int > anIdToCount;
+  SMESH::ElementType aType = SMESH::ALL;
+  for ( int g = 0, n = theGroups.length(); g < n; g++ )
   {
-    NCollection_DataMap< int, int > anIdToCount;
-    SMESH::ElementType aType = SMESH::ALL;
-    for ( int g = 0, n = theGroups.length(); g < n; g++ )
-    {
-      SMESH::SMESH_GroupBase_var aGrp = theGroups[ g ];
-      if ( CORBA::is_nil( aGrp ) )
-        continue;
-
-      // check type
-      SMESH::ElementType aCurrType = aGrp->GetType();
-      if ( aType == SMESH::ALL )
-        aType = aCurrType;
-      else 
-      {
-        if ( aType != aCurrType )
-          return SMESH::SMESH_Group::_nil();
-      }
+    SMESH::SMESH_GroupBase_var aGrp = theGroups[ g ];
+    if ( CORBA::is_nil( aGrp ) )
+      continue;
 
-      // calculates number of occurance ids in groups
-      SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
-      for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
-      {
-        int aCurrId = aCurrIds[ i ];
-        if ( !anIdToCount.IsBound( aCurrId ) )
-          anIdToCount.Bind( aCurrId, 1 );
-        else 
-          anIdToCount( aCurrId ) = anIdToCount( aCurrId ) + 1;
-      }
-    }
-    
-    // create map of ids
-    int nbGrp = theGroups.length();
-    vector< int > anIds;
-    NCollection_DataMap< int, int >::Iterator anIter( anIdToCount );
-    for ( ; anIter.More(); anIter.Next() )
+    // check type
+    SMESH::ElementType aCurrType = aGrp->GetType();
+    if ( aType == SMESH::ALL )
+      aType = aCurrType;
+    else
     {
-      int aCurrId = anIter.Key();
-      int aCurrNb = anIter.Value();
-      if ( aCurrNb == nbGrp )
-        anIds.push_back( aCurrId );
+      if ( aType != aCurrType )
+        return SMESH::SMESH_Group::_nil();
     }
 
-    // Create group
-    SMESH::SMESH_Group_var aResGrp = CreateGroup( aType, theName );
-    if ( aResGrp->_is_nil() )
-      return SMESH::SMESH_Group::_nil();
-    
-    // Create array of identifiers
-    SMESH::long_array_var aResIds = new SMESH::long_array;
-    aResIds->length( anIds.size() );
-    
-    //NCollection_Map< int >::Iterator aListIter( anIds );
-    for ( int i = 0; i<anIds.size(); i++ )
+    // calculates number of occurance ids in groups
+    SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
+    for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
     {
-      aResIds[ i ] = anIds[i];
+      int aCurrId = aCurrIds[ i ];
+      if ( !anIdToCount.IsBound( aCurrId ) )
+        anIdToCount.Bind( aCurrId, 1 );
+      else
+        anIdToCount( aCurrId ) = anIdToCount( aCurrId ) + 1;
     }
-    aResGrp->Add( aResIds );
+  }
 
-    // Clear python lines, created by CreateGroup() and Add()
-    SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
+  // create map of ids
+  int nbGrp = theGroups.length();
+  vector< int > anIds;
+  NCollection_DataMap< int, int >::Iterator anIter( anIdToCount );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    int aCurrId = anIter.Key();
+    int aCurrNb = anIter.Value();
+    if ( aCurrNb == nbGrp )
+      anIds.push_back( aCurrId );
+  }
 
-    // Update Python script
-    
-    TPythonDump() << aResGrp << " = " << _this() << ".IntersectListOfGroups( "
-                  << &theGroups << ", '" << theName << "' )";
+  TPythonDump pyDump;
 
-    return aResGrp._retn();
-  }
-  catch( ... )
-  {
+  // Create group
+  aResGrp = CreateGroup( aType, theName );
+  if ( aResGrp->_is_nil() )
     return SMESH::SMESH_Group::_nil();
-  }
+
+  // Create array of identifiers
+  SMESH::long_array_var aResIds = new SMESH::long_array;
+  aResIds->length( anIds.size() );
+
+  for ( size_t i = 0; i<anIds.size(); i++ )
+    aResIds[ i ] = anIds[i];
+  aResGrp->Add( aResIds );
+
+  // Update Python script
+  pyDump << aResGrp << " = " << _this() << ".IntersectListOfGroups( "
+         << &theGroups << ", '" << theName << "' )";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return aResGrp._retn();
 }
 
 //=============================================================================
@@ -1439,6 +1437,9 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGr
                                                 const char*                theName )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aResGrp;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
@@ -1446,8 +1447,10 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGr
        theGroup1->GetType() != theGroup2->GetType() )
     return SMESH::SMESH_Group::_nil();
 
+  TPythonDump pyDump;
+
   // Perform Cutting
-  SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
+  aResGrp = CreateGroup( theGroup1->GetType(), theName );
   if ( aResGrp->_is_nil() )
     return aResGrp;
 
@@ -1469,18 +1472,14 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGr
 
   for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
     aResIds[ resI ] = aSeq( resI + 1 );
-
   aResGrp->Add( aResIds );
 
-  // Clear python lines, created by CreateGroup() and Add()
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-  _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-
   // Update Python script
-  TPythonDump() << aResGrp << " = " << _this() << ".CutGroups( "
-                << theGroup1 << ", " << theGroup2 << ", '"
-                << theName << "' )";
+  pyDump << aResGrp << " = " << _this() << ".CutGroups( "
+         << theGroup1 << ", " << theGroup2 << ", '"
+         << theName << "' )";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
 
   return aResGrp._retn();
 }
@@ -1501,124 +1500,122 @@ SMESH_Mesh_i::CutListOfGroups(const SMESH::ListOfGroups& theMainGroups,
                               const char*                theName )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aResGrp;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
   if ( !theName )
     return SMESH::SMESH_Group::_nil();
 
-  try
+  set< int > aToolIds;
+  SMESH::ElementType aType = SMESH::ALL;
+  int g, n;
+  // iterate through tool groups
+  for ( g = 0, n = theToolGroups.length(); g < n; g++ )
   {
-    set< int > aToolIds;
-    SMESH::ElementType aType = SMESH::ALL;
-    int g, n;
-    // iterate through tool groups
-    for ( g = 0, n = theToolGroups.length(); g < n; g++ )
-    {
-      SMESH::SMESH_GroupBase_var aGrp = theToolGroups[ g ];
-      if ( CORBA::is_nil( aGrp ) )
-        continue;
-
-      // check type
-      SMESH::ElementType aCurrType = aGrp->GetType();
-      if ( aType == SMESH::ALL )
-        aType = aCurrType;
-      else 
-      {
-        if ( aType != aCurrType )
-          return SMESH::SMESH_Group::_nil();
-      }
+    SMESH::SMESH_GroupBase_var aGrp = theToolGroups[ g ];
+    if ( CORBA::is_nil( aGrp ) )
+      continue;
 
-      // unite tool ids
-      SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
-      for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
-      {
-        int aCurrId = aCurrIds[ i ];
-        aToolIds.insert( aCurrId );
-      }
+    // check type
+    SMESH::ElementType aCurrType = aGrp->GetType();
+    if ( aType == SMESH::ALL )
+      aType = aCurrType;
+    else
+    {
+      if ( aType != aCurrType )
+        return SMESH::SMESH_Group::_nil();
     }
 
-    vector< int > anIds; // result
-
-    // Iterate through main group 
-    for ( g = 0, n = theMainGroups.length(); g < n; g++ )
+    // unite tool ids
+    SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
+    for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
     {
-      SMESH::SMESH_GroupBase_var aGrp = theMainGroups[ g ];
-      if ( CORBA::is_nil( aGrp ) )
-        continue;
+      int aCurrId = aCurrIds[ i ];
+      aToolIds.insert( aCurrId );
+    }
+  }
 
-      // check type
-      SMESH::ElementType aCurrType = aGrp->GetType();
-      if ( aType == SMESH::ALL )
-        aType = aCurrType;
-      else 
-      {
-        if ( aType != aCurrType )
-          return SMESH::SMESH_Group::_nil();
-      }
+  vector< int > anIds; // result
 
-      // unite tool ids
-      SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
-      for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
-      {
-        int aCurrId = aCurrIds[ i ];
-        if ( !aToolIds.count( aCurrId ) )
-          anIds.push_back( aCurrId );
-      }
-    }
+  // Iterate through main group 
+  for ( g = 0, n = theMainGroups.length(); g < n; g++ )
+  {
+    SMESH::SMESH_GroupBase_var aGrp = theMainGroups[ g ];
+    if ( CORBA::is_nil( aGrp ) )
+      continue;
 
-    // Create group
-    SMESH::SMESH_Group_var aResGrp = CreateGroup( aType, theName );
-    if ( aResGrp->_is_nil() )
-      return SMESH::SMESH_Group::_nil();
-    
-    // Create array of identifiers
-    SMESH::long_array_var aResIds = new SMESH::long_array;
-    aResIds->length( anIds.size() );
-    
-    for (int i=0; i<anIds.size(); i++ )
+    // check type
+    SMESH::ElementType aCurrType = aGrp->GetType();
+    if ( aType == SMESH::ALL )
+      aType = aCurrType;
+    else
     {
-      aResIds[ i ] = anIds[i];
+      if ( aType != aCurrType )
+        return SMESH::SMESH_Group::_nil();
     }
-    aResGrp->Add( aResIds );
 
-    // Clear python lines, created by CreateGroup() and Add()
-    SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
+    // unite tool ids
+    SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
+    for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
+    {
+      int aCurrId = aCurrIds[ i ];
+      if ( !aToolIds.count( aCurrId ) )
+        anIds.push_back( aCurrId );
+    }
+  }
 
-    // Update Python script
+  TPythonDump pyDump;
 
-    TPythonDump() << aResGrp << " = " << _this() << ".CutListOfGroups( "
-                  << &theMainGroups << ", " << &theToolGroups << ", '"
-                  << theName << "' )";
-    
-    return aResGrp._retn();
-  }
-  catch( ... )
-  {
+  // Create group
+  aResGrp = CreateGroup( aType, theName );
+  if ( aResGrp->_is_nil() )
     return SMESH::SMESH_Group::_nil();
-  }
+
+  // Create array of identifiers
+  SMESH::long_array_var aResIds = new SMESH::long_array;
+  aResIds->length( anIds.size() );
+
+  for (int i=0; i<anIds.size(); i++ )
+    aResIds[ i ] = anIds[i];
+  aResGrp->Add( aResIds );
+
+  // Update Python script
+  pyDump << aResGrp << " = " << _this() << ".CutListOfGroups( "
+         << &theMainGroups << ", " << &theToolGroups << ", '"
+         << theName << "' )";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return aResGrp._retn();
 }
 
 //=============================================================================
 /*!
   \brief Create groups of entities from existing groups of superior dimensions 
-  System 
+  System
   1) extract all nodes from each group,
   2) combine all elements of specified dimension laying on these nodes.
   \param theGroups list of source groups 
   \param theElemType dimension of elements 
   \param theName name of new group
   \return pointer on new group
+  *
+  IMP 19939
 */
 //=============================================================================
+
 SMESH::SMESH_Group_ptr
 SMESH_Mesh_i::CreateDimGroup(const SMESH::ListOfGroups& theGroups, 
                              SMESH::ElementType         theElemType, 
                              const char*                theName )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aResGrp;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
@@ -1629,141 +1626,73 @@ SMESH_Mesh_i::CreateDimGroup(const SMESH::ListOfGroups& theGroups,
 
   SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)theElemType;
 
-  try
-  {
-    // Create map of nodes from all groups 
+  // Create a group
 
-    set< int > aNodeMap;
-    
-    for ( int g = 0, n = theGroups.length(); g < n; g++ )
-    {
-      SMESH::SMESH_GroupBase_var aGrp = theGroups[ g ];
-      if ( CORBA::is_nil( aGrp ) )
-        continue;
+  TPythonDump pyDump;
 
-      SMESH::ElementType aType = aGrp->GetType();
-      if ( aType == SMESH::ALL )
-        continue;
-      else if ( aType == SMESH::NODE )
-      {
-        SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
-        for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
-        {
-          int aCurrId = aCurrIds[ i ];
-          const SMDS_MeshNode* aNode = aMeshDS->FindNode( aCurrId );
-          if ( aNode )
-            aNodeMap.insert( aNode->GetID() );
-        }
-      }
-      else 
-      {
-        SMESH::long_array_var aCurrIds = aGrp->GetListOfID();
-        for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
-        {
-          int aCurrId = aCurrIds[ i ];
-          const SMDS_MeshElement* anElem = aMeshDS->FindElement( aCurrId );
-          if ( !anElem )
-            continue;
-          SMDS_ElemIteratorPtr aNodeIter = anElem->nodesIterator();
-          while( aNodeIter->more() )
-          {
-            const SMDS_MeshNode* aNode = 
-              dynamic_cast<const SMDS_MeshNode*>( aNodeIter->next() );
-            if ( aNode )
-              aNodeMap.insert( aNode->GetID() );
-          }
-        }
-      }
-    }
+  aResGrp = CreateGroup( theElemType, theName );
+  if ( aResGrp->_is_nil() )
+    return SMESH::SMESH_Group::_nil();
+
+  SMESHDS_GroupBase* groupBaseDS =
+    SMESH::DownCast<SMESH_GroupBase_i*>( aResGrp )->GetGroupDS();
+  SMDS_MeshGroup& resGroupCore = static_cast< SMESHDS_Group* >( groupBaseDS )->SMDSGroup();
+
+  for ( int g = 0, n = theGroups.length(); g < n; g++ ) // loop on theGroups
+  {
+    SMESH::SMESH_GroupBase_var aGrp = theGroups[ g ];
+    if ( CORBA::is_nil( aGrp ) )
+      continue;
 
-    // Get result identifiers 
+    groupBaseDS = SMESH::DownCast<SMESH_GroupBase_i*>( aGrp )->GetGroupDS();
+    SMDS_ElemIteratorPtr elIt = groupBaseDS->GetElements();
 
-    vector< int > aResultIds;
-    if ( theElemType == SMESH::NODE )
+    if ( theElemType == SMESH::NODE ) // get all nodes of elements
     {
-      //NCollection_Map< int >::Iterator aNodeIter( aNodeMap );
-      set<int>::iterator iter = aNodeMap.begin();
-      for ( ; iter != aNodeMap.end(); iter++ )
-        aResultIds.push_back( *iter);
+      while ( elIt->more() ) {
+        const SMDS_MeshElement* el = elIt->next();
+        SMDS_ElemIteratorPtr nIt = el->nodesIterator();
+        while ( nIt->more() )
+          resGroupCore.Add( nIt->next() );
+      }
     }
-    else
+    else // get elements of theElemType based on nodes of every element of group
     {
-      // Create list of elements of given dimension constructed on the nodes
-      vector< int > anElemList;
-      //NCollection_Map< int >::Iterator aNodeIter( aNodeMap );
-      //for ( ; aNodeIter.More(); aNodeIter.Next() )
-      set<int>::iterator iter = aNodeMap.begin();
-      for ( ; iter != aNodeMap.end(); iter++ )
+      while ( elIt->more() )
       {
-        const SMDS_MeshElement* aNode = 
-          dynamic_cast<const SMDS_MeshElement*>( aMeshDS->FindNode( *iter ) );
-        if ( !aNode )
-          continue;
-
-         SMDS_ElemIteratorPtr anElemIter = aNode->elementsIterator( anElemType );
-        while( anElemIter->more() )
-        {
-          const SMDS_MeshElement* anElem = 
-            dynamic_cast<const SMDS_MeshElement*>( anElemIter->next() );
-          if ( anElem && anElem->GetType() == anElemType )
-            anElemList.push_back( anElem->GetID() );
-        }
-      }
-
-      // check whether all nodes of elements are present in nodes map
-      for (int i=0; i< anElemList.size(); i++)
-      {
-        const SMDS_MeshElement* anElem = aMeshDS->FindElement( anElemList[i] );
-        if ( !anElem )
-          continue;
-
-        bool isOk = true;
-        SMDS_ElemIteratorPtr aNodeIter = anElem->nodesIterator();
-        while( aNodeIter->more() )
+        const SMDS_MeshElement* el = elIt->next(); // an element of group
+        TIDSortedElemSet elNodes( el->begin_nodes(), el->end_nodes() );
+        TIDSortedElemSet checkedElems;
+        SMDS_ElemIteratorPtr nIt = el->nodesIterator();
+        while ( nIt->more() )
         {
-          const SMDS_MeshNode* aNode = 
-            dynamic_cast<const SMDS_MeshNode*>( aNodeIter->next() );
-          if ( !aNode || !aNodeMap.count( aNode->GetID() ) )
+          const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nIt->next() );
+          SMDS_ElemIteratorPtr elOfTypeIt = n->GetInverseElementIterator( anElemType );
+          // check nodes of elements of theElemType around el
+          while ( elOfTypeIt->more() )
           {
-            isOk = false;
-            break;
+            const SMDS_MeshElement* elOfType = elOfTypeIt->next();
+            if ( !checkedElems.insert( elOfType ).second ) continue;
+
+            SMDS_ElemIteratorPtr nIt2 = elOfType->nodesIterator();
+            bool allNodesOK = true;
+            while ( nIt2->more() && allNodesOK )
+              allNodesOK = elNodes.count( nIt2->next() );
+            if ( allNodesOK )
+              resGroupCore.Add( elOfType );
           }
-        } 
-        if ( isOk )
-          aResultIds.push_back( anElem->GetID() );
+        }
       }
     }
+  }
 
-    // Create group
-
-    SMESH::SMESH_Group_var aResGrp = CreateGroup( theElemType, theName );
-    if ( aResGrp->_is_nil() )
-      return SMESH::SMESH_Group::_nil();
-    
-    // Create array of identifiers
-    SMESH::long_array_var aResIds = new SMESH::long_array;
-    aResIds->length( aResultIds.size() );
-    
-    for (int i=0; i< aResultIds.size(); i++)
-      aResIds[ i ] = aResultIds[i];
-    aResGrp->Add( aResIds );
-
-    // Remove strings corresponding to group creation
-    SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-    _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
+  // Update Python script
+  pyDump << aResGrp << " = " << _this() << ".CreateDimGroup( "
+         << &theGroups << ", " << theElemType << ", '" << theName << "' )";
 
-    // Update Python script
-    
-    TPythonDump() << aResGrp << " = " << _this() << ".CreateDimGroup( "
-                  << &theGroups << ", " << theElemType << ", '" << theName << "' )";
+  SMESH_CATCH( SMESH::throwCorbaException );
 
-    return aResGrp._retn();
-  }
-  catch( ... )
-  {
-    return SMESH::SMESH_Group::_nil();
-  }
+  return aResGrp._retn();
 }
 
 //================================================================================
@@ -1778,13 +1707,13 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
   if ( CORBA::is_nil( theGeomObj ) || theGeomObj->GetType() != GEOM_GROUP )
     return;
   // group SO
-  SALOMEDS::Study_var   study  = _gen_i->GetCurrentStudy();
-  SALOMEDS::SObject_var groupSO = _gen_i->ObjectToSObject( study, theGeomObj );
+  SALOMEDS::Study_var   study   = _gen_i->GetCurrentStudy();
+  SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( study, theGeomObj );
   if ( groupSO->_is_nil() )
     return;
   // group indices
   GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
-  GEOM::GEOM_IGroupOperations_var groupOp =
+  GEOM::GEOM_IGroupOperations_wrap groupOp =
     geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
   GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
 
@@ -1832,7 +1761,7 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
   // get geom group
   SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
   if ( study->_is_nil() ) return newShape; // means "not changed"
-  SALOMEDS::SObject_var groupSO = study->FindObjectID( groupData._groupEntry.c_str() );
+  SALOMEDS::SObject_wrap groupSO = study->FindObjectID( groupData._groupEntry.c_str() );
   if ( !groupSO->_is_nil() )
   {
     CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
@@ -1842,9 +1771,9 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
     // get indices of group items
     set<int> curIndices;
     GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
-    GEOM::GEOM_IGroupOperations_var groupOp =
+    GEOM::GEOM_IGroupOperations_wrap groupOp =
       geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
-    GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
+    GEOM::ListOfLong_var   ids = groupOp->GetObjects( geomGroup );
     for ( int i = 0; i < ids->length(); ++i )
       curIndices.insert( ids[i] );
 
@@ -1859,7 +1788,7 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
     TCollection_AsciiString groupIOR = geomGen->GetStringFromIOR( geomGroup );
     geomClient->RemoveShapeFromBuffer( groupIOR );
     newShape = _gen_i->GeomObjectToShape( geomGroup );
-  }    
+  }
 
   if ( newShape.IsNull() ) {
     // geom group becomes empty - return empty compound
@@ -2084,10 +2013,10 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
         if ( _mapGroups.find( oldID ) == _mapGroups.end() )
           continue;
         // get group name
-        SALOMEDS::SObject_var groupSO = _gen_i->ObjectToSObject( study,_mapGroups[oldID] );
-        CORBA::String_var     name    = groupSO->GetName();
+        SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( study,_mapGroups[oldID] );
+        CORBA::String_var      name    = groupSO->GetName();
         // update
-        SMESH_GroupBase_i* group_i    = SMESH::DownCast<SMESH_GroupBase_i*>(_mapGroups[oldID] );
+        SMESH_GroupBase_i*  group_i    = SMESH::DownCast<SMESH_GroupBase_i*>(_mapGroups[oldID] );
         int newID;
         if ( group_i && _impl->AddGroup( geomType->second, name.in(), newID, geom._shape ))
           group_i->changeLocalId( newID );
@@ -2101,7 +2030,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
   // Update icons
 
   CORBA::Long newNbEntities = NbNodes() + NbElements();
-  list< SALOMEDS::SObject_var > soToUpdateIcons;
+  list< SALOMEDS::SObject_wrap > soToUpdateIcons;
   if ( newNbEntities != nbEntities )
   {
     // Add all SObjects with icons to soToUpdateIcons
@@ -2116,7 +2045,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
       soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, i_gr->second ));
   }
 
-  list< SALOMEDS::SObject_var >::iterator so = soToUpdateIcons.begin();
+  list< SALOMEDS::SObject_wrap >::iterator so = soToUpdateIcons.begin();
   for ( ; so != soToUpdateIcons.end(); ++so )
     _gen_i->SetPixMap( *so, "ICON_SMESH_TREE_MESH_WARN" );
 }
@@ -2128,16 +2057,18 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
 //=============================================================================
 
 SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase_ptr theGroup )
+  throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_Group_var aGroup;
+
+  SMESH_TRY;
+
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
-  SMESH::SMESH_Group_var aGroup;
   if ( theGroup->_is_nil() )
     return aGroup._retn();
 
-  Unexpect aCatch(SALOME_SalomeException);
-
   SMESH_GroupBase_i* aGroupToRem =
     dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( theGroup ).in() );
   if ( !aGroupToRem )
@@ -2156,15 +2087,15 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase
   _mapGroups.erase( anId );
 
   SALOMEDS::StudyBuilder_var builder;
-  SALOMEDS::SObject_var aGroupSO;
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
-  if ( !aStudy->_is_nil() )  {
-    builder = aStudy->NewBuilder();
+  SALOMEDS::SObject_wrap      aGroupSO;
+  SALOMEDS::Study_var        aStudy = _gen_i->GetCurrentStudy();
+  if ( !aStudy->_is_nil() ) {
+    builder  = aStudy->NewBuilder();
     aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
-    if ( !aGroupSO->_is_nil() ) {
-
+    if ( !aGroupSO->_is_nil() )
+    {
       // remove reference to geometry
-      SALOMEDS::ChildIterator_var chItr = aStudy->NewChildIterator(aGroupSO);
+      SALOMEDS::ChildIterator_wrap chItr = aStudy->NewChildIterator(aGroupSO);
       for ( ; chItr->More(); chItr->Next() )
         // Remove group's child SObject
         builder->RemoveObject( chItr->Value() );
@@ -2180,28 +2111,26 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase
         const int isEmpty = ( elemTypes->length() == 0 );
         if ( !isEmpty )
         {
-          SALOMEDS::GenericAttribute_var anAttr =
+          SALOMEDS::GenericAttribute_wrap anAttr =
             builder->FindOrCreateAttribute( aGroupSO, "AttributePixMap" );
-          SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr );
+          SALOMEDS::AttributePixMap_wrap pm = anAttr;
           pm->SetPixMap( "ICON_SMESH_TREE_GROUP" );
         }
       }
     }
   }
 
-  // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-  SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
-  aGroupImpl->Register();
-  // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-
   // remember new group in own map
   aGroup = SMESH::SMESH_Group::_narrow( aGroupImpl->_this() );
   _mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup );
 
   // register CORBA object for persistence
-  /*int nextId =*/ _gen_i->RegisterObject( aGroup );
+  _gen_i->RegisterObject( aGroup );
+
+  CORBA::String_var ior = _gen_i->GetORB()->object_to_string( aGroup );
+  builder->SetIOR( aGroupSO, ior.in() );
 
-  builder->SetIOR( aGroupSO, _gen_i->GetORB()->object_to_string( aGroup ) );
+  SMESH_CATCH( SMESH::throwCorbaException );
 
   return aGroup._retn();
 }
@@ -2339,11 +2268,6 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType
     else
       aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
 
-    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-    SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
-    aGroupImpl->Register();
-    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-
     aGroup = SMESH::SMESH_GroupBase::_narrow( aGroupImpl->_this() );
     _mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup );
 
@@ -2390,57 +2314,57 @@ void SMESH_Mesh_i::removeGroup( const int theId )
 //=============================================================================
 
 SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
-throw(SALOME::SALOME_Exception)
+  throw(SALOME::SALOME_Exception)
 {
+  SMESH::log_array_var aLog;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
-  SMESH::log_array_var aLog;
-  try{
-    list < SMESHDS_Command * >logDS = _impl->GetLog();
-    aLog = new SMESH::log_array;
-    int indexLog = 0;
-    int lg = logDS.size();
-    SCRUTE(lg);
-    aLog->length(lg);
-    list < SMESHDS_Command * >::iterator its = logDS.begin();
-    while(its != logDS.end()){
-      SMESHDS_Command *com = *its;
-      int comType = com->GetType();
-      //SCRUTE(comType);
-      int lgcom = com->GetNumber();
-      //SCRUTE(lgcom);
-      const list < int >&intList = com->GetIndexes();
-      int inum = intList.size();
-      //SCRUTE(inum);
-      list < int >::const_iterator ii = intList.begin();
-      const list < double >&coordList = com->GetCoords();
-      int rnum = coordList.size();
-      //SCRUTE(rnum);
-      list < double >::const_iterator ir = coordList.begin();
-      aLog[indexLog].commandType = comType;
-      aLog[indexLog].number = lgcom;
-      aLog[indexLog].coords.length(rnum);
-      aLog[indexLog].indexes.length(inum);
-      for(int i = 0; i < rnum; i++){
-        aLog[indexLog].coords[i] = *ir;
-        //MESSAGE(" "<<i<<" "<<ir.Value());
-        ir++;
-      }
-      for(int i = 0; i < inum; i++){
-        aLog[indexLog].indexes[i] = *ii;
-        //MESSAGE(" "<<i<<" "<<ii.Value());
-        ii++;
-      }
-      indexLog++;
-      its++;
+  list < SMESHDS_Command * >logDS = _impl->GetLog();
+  aLog = new SMESH::log_array;
+  int indexLog = 0;
+  int lg = logDS.size();
+  SCRUTE(lg);
+  aLog->length(lg);
+  list < SMESHDS_Command * >::iterator its = logDS.begin();
+  while(its != logDS.end()){
+    SMESHDS_Command *com = *its;
+    int comType = com->GetType();
+    //SCRUTE(comType);
+    int lgcom = com->GetNumber();
+    //SCRUTE(lgcom);
+    const list < int >&intList = com->GetIndexes();
+    int inum = intList.size();
+    //SCRUTE(inum);
+    list < int >::const_iterator ii = intList.begin();
+    const list < double >&coordList = com->GetCoords();
+    int rnum = coordList.size();
+    //SCRUTE(rnum);
+    list < double >::const_iterator ir = coordList.begin();
+    aLog[indexLog].commandType = comType;
+    aLog[indexLog].number = lgcom;
+    aLog[indexLog].coords.length(rnum);
+    aLog[indexLog].indexes.length(inum);
+    for(int i = 0; i < rnum; i++){
+      aLog[indexLog].coords[i] = *ir;
+      //MESSAGE(" "<<i<<" "<<ir.Value());
+      ir++;
     }
-    if(clearAfterGet)
-      _impl->ClearLog();
-  }
-  catch(SALOME_Exception & S_ex){
-    THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+    for(int i = 0; i < inum; i++){
+      aLog[indexLog].indexes[i] = *ii;
+      //MESSAGE(" "<<i<<" "<<ii.Value());
+      ii++;
+    }
+    indexLog++;
+    its++;
   }
+  if(clearAfterGet)
+    _impl->ClearLog();
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return aLog._retn();
 }
 
@@ -2453,8 +2377,9 @@ throw(SALOME::SALOME_Exception)
 
 void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception)
 {
-  if(MYDEBUG) MESSAGE("SMESH_Mesh_i::ClearLog");
+  SMESH_TRY;
   _impl->ClearLog();
+  SMESH_CATCH( SMESH::throwCorbaException );
 }
 
 //=============================================================================
@@ -2465,7 +2390,6 @@ void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception)
 
 CORBA::Long SMESH_Mesh_i::GetId()throw(SALOME::SALOME_Exception)
 {
-  if(MYDEBUG) MESSAGE("SMESH_Mesh_i::GetId");
   return _id;
 }
 
@@ -2541,18 +2465,24 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl)
 //=============================================================================
 
 SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
+  throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_MeshEditor_var aMeshEdVar;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
   // Create MeshEditor
   SMESH_MeshEditor_i *aMeshEditor = new SMESH_MeshEditor_i( this, false );
-  SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
+  aMeshEdVar = aMeshEditor->_this();
 
   // Update Python script
   TPythonDump() << aMeshEditor << " = " << _this() << ".GetMeshEditor()";
 
-  return aMesh._retn();
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return aMeshEdVar._retn();
 }
 
 //=============================================================================
@@ -2562,13 +2492,20 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
 //=============================================================================
 
 SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditPreviewer()
+  throw (SALOME::SALOME_Exception)
 {
+  SMESH::SMESH_MeshEditor_var aMeshEdVar;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
   SMESH_MeshEditor_i *aMeshEditor = new SMESH_MeshEditor_i( this, true );
-  SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
-  return aMesh._retn();
+  aMeshEdVar = aMeshEditor->_this();
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return aMeshEdVar._retn();
 }
 
 //================================================================================
@@ -2731,25 +2668,23 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char*    file,
   // Perform Export
   PrepareForWriting(file, overwrite);
   string aMeshName = "Mesh";
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() ) {
-    SALOMEDS::SObject_var aMeshSO = _gen_i->ObjectToSObject( aStudy, _this() );
+    SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( aStudy, _this() );
     if ( !aMeshSO->_is_nil() ) {
       CORBA::String_var name = aMeshSO->GetName();
       aMeshName = name;
       // asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes
       if ( !aStudy->GetProperties()->IsLocked() )
       {
-        SALOMEDS::GenericAttribute_var anAttr;
+        SALOMEDS::GenericAttribute_wrap anAttr;
         SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-        SALOMEDS::AttributeExternalFileDef_var aFileName;
         anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeExternalFileDef");
-        aFileName = SALOMEDS::AttributeExternalFileDef::_narrow(anAttr);
+        SALOMEDS::AttributeExternalFileDef_wrap aFileName = anAttr;
         ASSERT(!aFileName->_is_nil());
         aFileName->SetValue(file);
-        SALOMEDS::AttributeFileType_var aFileType;
         anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeFileType");
-        aFileType = SALOMEDS::AttributeFileType::_narrow(anAttr);
+        SALOMEDS::AttributeFileType_wrap aFileType = anAttr;
         ASSERT(!aFileType->_is_nil());
         aFileType->SetValue("FICHIERMED");
       }
@@ -2924,9 +2859,9 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart,
   PrepareForWriting(file, overwrite);
 
   string aMeshName = "Mesh";
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
   if ( !aStudy->_is_nil() ) {
-    SALOMEDS::SObject_var SO = _gen_i->ObjectToSObject( aStudy, meshPart );
+    SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
     if ( !SO->_is_nil() ) {
       CORBA::String_var name = SO->GetName();
       aMeshName = name;
@@ -3479,10 +3414,17 @@ SMESH::long_array* SMESH_Mesh_i::GetNodesId()
 SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const bool iselem )
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::ElementType type;
+  SMESH_TRY;
+
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
-  return ( SMESH::ElementType )_impl->GetElementType( id, iselem );
+  type = ( SMESH::ElementType ) _impl->GetElementType( id, iselem );
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return type;
 }
 
 //=============================================================================
@@ -3512,11 +3454,12 @@ SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id )
 SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID)
      throw (SALOME::SALOME_Exception)
 {
+  SMESH::long_array_var aResult = new SMESH::long_array();
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
-  SMESH::long_array_var aResult = new SMESH::long_array();
-
   SMESH_subMesh* SM = _impl->GetSubMeshContaining(ShapeID);
   if(!SM) return aResult._retn();
 
@@ -3531,6 +3474,8 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID)
     aResult[i++] = eIt->next()->GetID();
   }
 
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return aResult._retn();
 }
 
@@ -3546,11 +3491,12 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID,
                                                    CORBA::Boolean    all)
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::long_array_var aResult = new SMESH::long_array();
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
-  SMESH::long_array_var aResult = new SMESH::long_array();
-
   SMESH_subMesh* SM = _impl->GetSubMeshContaining(ShapeID);
   if(!SM) return aResult._retn();
 
@@ -3583,6 +3529,8 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID,
   for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
     aResult[i++] = *itElem;
 
+  SMESH_CATCH( SMESH::throwCorbaException );
+
   return aResult._retn();
 }
   
@@ -3595,6 +3543,9 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID,
 SMESH::ElementType SMESH_Mesh_i::GetSubMeshElementType(const CORBA::Long ShapeID)
   throw (SALOME::SALOME_Exception)
 {
+  SMESH::ElementType type;
+
+  SMESH_TRY;
   if ( _preMeshInfo )
     _preMeshInfo->FullLoadFromFile();
 
@@ -3609,7 +3560,12 @@ SMESH::ElementType SMESH_Mesh_i::GetSubMeshElementType(const CORBA::Long ShapeID
 
   SMDS_ElemIteratorPtr eIt = SDSM->GetElements();
   const SMDS_MeshElement* anElem = eIt->next();
-  return ( SMESH::ElementType ) anElem->GetType();
+
+  type = ( SMESH::ElementType ) anElem->GetType();
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return type; 
 }
   
 
@@ -3755,6 +3711,52 @@ SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID)
   return aNodePosition;
 }
 
+//=============================================================================
+/*!
+ * \brief Return position of an element on shape
+ */
+//=============================================================================
+
+SMESH::ElementPosition SMESH_Mesh_i::GetElementPosition(CORBA::Long ElemID)
+{
+  if ( _preMeshInfo )
+    _preMeshInfo->FullLoadFromFile();
+
+  SMESH::ElementPosition anElementPosition;
+  anElementPosition.shapeID = 0;
+  anElementPosition.shapeType = GEOM::SHAPE;
+
+  SMESHDS_Mesh* mesh = _impl->GetMeshDS();
+  if ( !mesh ) return anElementPosition;
+
+  if ( const SMDS_MeshElement* anElem = mesh->FindElement( ElemID ) )
+  {
+    anElementPosition.shapeID = anElem->getshapeId();
+    const TopoDS_Shape& aSp = mesh->IndexToShape( anElem->getshapeId() );
+    if ( !aSp.IsNull() ) {
+      switch ( aSp.ShapeType() ) {
+      case TopAbs_EDGE:
+        anElementPosition.shapeType = GEOM::EDGE;
+        break;
+      case TopAbs_FACE:
+        anElementPosition.shapeType = GEOM::FACE;
+        break;
+      case TopAbs_VERTEX:
+        anElementPosition.shapeType = GEOM::VERTEX;
+        break;
+      case TopAbs_SOLID:
+        anElementPosition.shapeType = GEOM::SOLID;
+        break;
+      case TopAbs_SHELL:
+        anElementPosition.shapeType = GEOM::SHELL;
+        break;
+      default:;
+      }
+    }
+  }
+  return anElementPosition;
+}
+
 //=============================================================================
 /*!
  * If given element is node returns IDs of shape from position
@@ -3803,7 +3805,6 @@ CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const CORBA::Long id)
   if(!elem)
     return -1;
 
-  //SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor();
   ::SMESH_MeshEditor aMeshEditor(_impl);
   int index = aMeshEditor.FindShape( elem );
   if(index>0)
@@ -4146,7 +4147,7 @@ SMESH::double_array* SMESH_Mesh_i::BaryCenter(const CORBA::Long id)
 
 void SMESH_Mesh_i::CreateGroupServants()
 {
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
 
   set<int> addedIDs;
   ::SMESH_Mesh::GroupIteratorPtr groupIt = _impl->GetGroups();
@@ -4172,10 +4173,6 @@ void SMESH_Mesh_i::CreateGroupServants()
       aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
     }
 
-    // To ensure correct mapping of servant and correct reference counting in GenericObj_i
-    SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
-    aGroupImpl->Register();
-
     SMESH::SMESH_GroupBase_var groupVar =
       SMESH::SMESH_GroupBase::_narrow( aGroupImpl->_this() );
     _mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( groupVar );
@@ -4255,7 +4252,7 @@ void SMESH_Mesh_i::checkGroupNames()
   if ( !nbGrp )
     return;
 
-  SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
   if ( aStudy->_is_nil() )
     return; // nothing to do
   
@@ -4271,7 +4268,7 @@ void SMESH_Mesh_i::checkGroupNames()
     SMESH::SMESH_GroupBase_ptr aGrp = (*grpList)[ gIndx ];
     if ( !aGrp )
       continue;
-    SALOMEDS::SObject_var aGrpSO = _gen_i->ObjectToSObject( aStudy, aGrp );
+    SALOMEDS::SObject_wrap aGrpSO = _gen_i->ObjectToSObject( aStudy, aGrp );
     if ( aGrpSO->_is_nil() )
       continue;
     // correct name of the mesh group if necessary
@@ -4315,7 +4312,7 @@ SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
   SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
   if(gen) {
     char *aParameters = GetParameters();
-    SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
+    SALOMEDS::Study_var aStudy = gen->GetCurrentStudy();
     if(!aStudy->_is_nil()) {
       SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters); 
       if(aSections->length() > 0) {
index ca7e1af646faa6248de9f82c6d2272215c066860..a98be336eeebaddacaf0d112eab0be9821d6a348 100644 (file)
@@ -155,36 +155,31 @@ public:
   SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups,
                                           const SMESH::ListOfGroups& theToolGroups,
                                           const char* theName )
-  throw (SALOME::SALOME_Exception);
+    throw (SALOME::SALOME_Exception);
 
   SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups,
                                          SMESH::ElementType theElemType,
                                          const char* theName )
-  throw (SALOME::SALOME_Exception);
-
+    throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupBase_ptr theGroupOn );
 
-//    SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
-//      throw (SALOME::SALOME_Exception);
+  SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupBase_ptr theGroupOn )
+    throw (SALOME::SALOME_Exception);
 
   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
     throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
+  SMESH::SMESH_MeshEditor_ptr GetMeshEditor() throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_MeshEditor_ptr GetMeshEditPreviewer();
+  SMESH::SMESH_MeshEditor_ptr GetMeshEditPreviewer() throw (SALOME::SALOME_Exception);
 
   CORBA::Boolean HasModificationsToDiscard() throw (SALOME::SALOME_Exception);
 
-  void ClearLog()
-    throw (SALOME::SALOME_Exception);
+  void ClearLog() throw (SALOME::SALOME_Exception);
 
-  CORBA::Long GetId()
-    throw (SALOME::SALOME_Exception);
+  CORBA::Long GetId() throw (SALOME::SALOME_Exception);
 
-  CORBA::Long GetStudyId()
-    throw (SALOME::SALOME_Exception);
+  CORBA::Long GetStudyId() throw (SALOME::SALOME_Exception);
 
   // --- C++ interface
   void SetImpl(::SMESH_Mesh* impl);
@@ -464,6 +459,11 @@ public:
    */
   SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID);
 
+  /*!
+   * \brief Return position of an element on shape
+   */
+  SMESH::ElementPosition GetElementPosition(CORBA::Long ElemID);
+
   /*!
    * If given element is node returns IDs of shape from position
    * If there is not node for given ID - returns -1
index 7ecbe082382a2b20eb9677cdae5093d6a59c5810..816a29a972dbd3cbbbe9c42236f8a47359de4d12 100644 (file)
@@ -30,6 +30,9 @@
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_HSequenceOfInteger.hxx>
 
+#include <SALOMEDS_wrap.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
+
 #include <vector>
 #include <string>
 
@@ -642,14 +645,14 @@ void SMESH_NoteBook::ReplaceVariables()
         // this (and above) code can work wrong since nb of states can differ from nb of
         // dumped calls due to the fix of
         // issue 0021364:: Dump of netgen parameters has duplicate lines
-        SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
-        SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy();
-        SALOMEDS::SObject_var sobj = aStudy->FindObjectID( (*it).first.ToCString() );
-        CORBA::Object_var      obj = aGen->SObjectToObject( sobj );
+        SMESH_Gen_i *          aGen = SMESH_Gen_i::GetSMESHGen();
+        SALOMEDS::Study_var  aStudy = aGen->GetCurrentStudy();
+        SALOMEDS::SObject_wrap sobj = aStudy->FindObjectID( (*it).first.ToCString() );
+        CORBA::Object_var       obj = aGen->SObjectToObject( sobj );
         if ( SMESH_Hypothesis_i* h = SMESH::DownCast< SMESH_Hypothesis_i*>( obj ))
         {
           TState aCurrentState = aStates->GetCurrectState();
-          int argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
+          int         argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
           if ( 0 <= argIndex && argIndex < aCurrentState.size() &&
                !aCurrentState[argIndex].IsEmpty() )
             aCmd->SetArg( 1, aCurrentState[argIndex] );
@@ -681,22 +684,26 @@ void SMESH_NoteBook::InitObjectMap()
   if(!aGen)
     return;
   
-  SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy();
+  SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
   if(aStudy->_is_nil())
     return;
   
-  SALOMEDS::SObject_var aSO = aStudy->FindComponent(aGen->ComponentDataType());
+  CORBA::String_var compDataType = aGen->ComponentDataType();
+  SALOMEDS::SObject_wrap     aSO = aStudy->FindComponent( compDataType.in() );
   if(CORBA::is_nil(aSO))
     return;
   
-  SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
-  char* aParameters;
-  for(Itr->InitEx(true); Itr->More(); Itr->Next()) {
-    SALOMEDS::SObject_var aSObject = Itr->Value();
-    SALOMEDS::GenericAttribute_var anAttr;
-    if ( aSObject->FindAttribute(anAttr, "AttributeString")) {
-      aParameters = SALOMEDS::AttributeString::_narrow(anAttr)->Value();
-      SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
+  SALOMEDS::ChildIterator_wrap Itr = aStudy->NewChildIterator(aSO);
+  CORBA::String_var aParameters;
+  for( Itr->InitEx(true); Itr->More(); Itr->Next())
+  {
+    SALOMEDS::SObject_wrap aSObject = Itr->Value();
+    SALOMEDS::GenericAttribute_wrap anAttr;
+    if ( aSObject->FindAttribute( anAttr.inout(), "AttributeString"))
+    {
+      SALOMEDS::AttributeString_wrap strAttr = anAttr;
+      aParameters = strAttr->Value();
+      SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters.in());
       if(MYDEBUG) {
         cout<<"Entry : "<< aSObject->GetID()<<endl;
         cout<<"aParameters : "<<aParameters<<endl;
@@ -718,12 +725,13 @@ void SMESH_NoteBook::InitObjectMap()
       if(anObjType == "LayerDistribution")
         aState = new LayerDistributionStates();
       else
-        aState = new  SMESH_ObjectStates(anObjType);
+        aState = new SMESH_ObjectStates(anObjType);
 
       for(int i = 0; i < aSections->length(); i++) {
         TState aVars;
         SALOMEDS::ListOfStrings aListOfVars = aSections[i];
-        for(int j = 0;j<aListOfVars.length();j++) {
+        for ( int j = 0; j<aListOfVars.length(); j++)
+        {
           TCollection_AsciiString aVar(aListOfVars[j].in());
           if(!aVar.IsEmpty() && aStudy->IsVariable(aVar.ToCString())) {
             aVar.InsertBefore(1,            SMESH::TVar::Quote() );
@@ -888,7 +896,7 @@ bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double&
 
   const char* aName = aVarName.ToCString();
   if(aStudy->IsVariable(aName) && (aStudy->IsReal(aName) || aStudy->IsInteger(aName))) {
-    theValue = aStudy->GetReal(aVarName.ToCString());
+    theValue = aStudy->GetReal(aName);
     ok = true;
   }
 
index 0a3d58614a4a37e466e9c35517af8492cc6d9f0b..caee49db7e8a5ecf05720d850ce56dad3b7f8c77 100644 (file)
 #include "SMESH_Mesh_i.hxx"
 #include "SMESH_subMesh_i.hxx"
 
+#include <MED_Factory.hxx>
+
 #include <HDFarray.hxx>
 #include <HDFdataset.hxx>
 #include <HDFfile.hxx>
 #include <HDFgroup.hxx>
-#include <MED_Factory.hxx>
 #include <SALOMEDS_Tool.hxx>
+#include <SALOMEDS_wrap.hxx>
 
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS_Shape.hxx>
 
+#include "SMESH_TryCatch.hxx"
+
 #include CORBA_SERVER_HEADER(SALOME_Session)
 
-#define MYDEBUGOUT(msg) //std::cout << msg << std::endl;
 
-//================================================================================
-#define PreMeshInfo_TRY \
-  try { OCC_CATCH_SIGNALS
-//================================================================================
-#define PreMeshInfo_CATCH }                                             \
-  catch (Standard_Failure& ex) {                                        \
-    onExceptionCaught(SMESH_Comment("OCC Exception caught: \t")<<ex.GetMessageString()); \
-  }                                                                     \
-  catch ( const std::exception& ex) {                                   \
-    onExceptionCaught(SMESH_Comment("Exception caught: \t")<<ex.what()); \
-  }                                                                     \
-  catch (...) {                                                         \
-    onExceptionCaught("Unknown Exception caught");                      \
-  }
-//================================================================================
+#define MYDEBUGOUT(msg) //std::cout << msg << std::endl;
 
 namespace
 {
@@ -114,18 +101,6 @@ namespace
     }
   }
 
-  //================================================================================
-  /*!
-   * \brief Method useful only to set a breakpoint to debug in case of exception
-   */
-  //================================================================================
-
-  void onExceptionCaught(const string& msg)
-  {
-    INFOS( msg );
-    MYDEBUGOUT( msg );
-  }
-
   //=============================================================================
   /*!
    * \brief Class sending signals on start and finish of loading
@@ -143,8 +118,8 @@ namespace
       SALOMEDS::Study_var study = gen->GetCurrentStudy();
       if ( !study->_is_nil() && study->StudyId() == mesh->GetStudyId() )
       {
-        SALOMEDS::SObject_var meshSO = gen->ObjectToSObject(study, mesh->_this() );
-        CORBA::Object_var obj = gen->GetNS()->Resolve( "/Kernel/Session" );
+        SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject(study, mesh->_this() );
+        CORBA::Object_var        obj = gen->GetNS()->Resolve( "/Kernel/Session" );
         _session = SALOME::Session::_narrow( obj );
         if ( !meshSO->_is_nil() && !_session->_is_nil() )
         {
@@ -430,7 +405,7 @@ void SMESH_PreMeshInfo::LoadFromFile( SMESH_Mesh_i*      mesh,
                                       const std::string& hdfFile,
                                       const bool         toRemoveFiles)
 {
-  PreMeshInfo_TRY;
+  SMESH_TRY;
 
   SMESH_PreMeshInfo* meshPreInfo = new SMESH_PreMeshInfo( mesh,meshID,medFile,hdfFile );
   mesh->changePreMeshInfo() = meshPreInfo;
@@ -454,7 +429,7 @@ void SMESH_PreMeshInfo::LoadFromFile( SMESH_Mesh_i*      mesh,
   {
     meshPreInfo->FullLoadFromFile();
   }
-  PreMeshInfo_CATCH;
+  SMESH_CATCH( SMESH::doNothing );
 }
 
 //================================================================================
@@ -797,7 +772,7 @@ void SMESH_PreMeshInfo::SaveToFile( SMESH_Mesh_i* mesh,
   HDFgroup* infoHdfGroup = new HDFgroup( hdfGroupName, hdfFile );
   infoHdfGroup->CreateOnDisk();
 
-  PreMeshInfo_TRY;
+  SMESH_TRY;
 
   // info of mesh
   meshInfo2hdf( mesh->GetMeshInfo(), "Mesh", infoHdfGroup );
@@ -840,7 +815,7 @@ void SMESH_PreMeshInfo::SaveToFile( SMESH_Mesh_i* mesh,
     }
   }
 
-  PreMeshInfo_CATCH;
+  SMESH_CATCH( SMESH::doNothing );
 
   infoHdfGroup->CloseOnDisk();
 }
@@ -861,7 +836,7 @@ void SMESH_PreMeshInfo::FullLoadFromFile() const
   ::SMESH_Mesh&   mesh = _mesh->GetImpl();
   SMESHDS_Mesh* meshDS = mesh.GetMeshDS();
 
-  PreMeshInfo_TRY;
+  SMESH_TRY;
 
   MYDEBUGOUT( "BEG FullLoadFromFile() " << _meshID );
 
@@ -882,7 +857,7 @@ void SMESH_PreMeshInfo::FullLoadFromFile() const
   // load sub-meshes
   readSubMeshes( &myReader );
 
-  PreMeshInfo_CATCH;
+  SMESH_CATCH( SMESH::doNothing );
 
   _mesh->changePreMeshInfo() = meshInfo;
 
@@ -929,6 +904,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const
       aDataset->ReadFromDisk( isModified );
       aDataset->CloseOnDisk();
       _mesh->GetImpl().SetIsModified( bool(*isModified));
+      delete [] isModified;
     }
 
     bool submeshesInFamilies = ( ! aTopGroup->ExistInternalObject( "Submeshes" ));
@@ -1144,7 +1120,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const
 
 void SMESH_PreMeshInfo::ForgetAllData() const
 {
-  PreMeshInfo_TRY;
+  SMESH_TRY;
 
   if ( _mesh->changePreMeshInfo() != this )
     return _mesh->changePreMeshInfo()->ForgetAllData();
@@ -1165,9 +1141,9 @@ void SMESH_PreMeshInfo::ForgetAllData() const
   map<int, SMESH::SMESH_subMesh_ptr>::iterator id2sm = _mesh->_mapSubMeshIor.begin();
   for ( ; id2sm != _mesh->_mapSubMeshIor.end(); ++id2sm )
   {
-    if ( SMESH_subMesh_i* sm = SMESH::DownCast<SMESH_subMesh_i*>( id2sm->second ))
+    if ( SMESH_subMesh_i* sm_i = SMESH::DownCast<SMESH_subMesh_i*>( id2sm->second ))
     {
-      SMESH_PreMeshInfo* & info = sm->changePreMeshInfo();
+      SMESH_PreMeshInfo* & info = sm_i->changePreMeshInfo();
       delete info;
       info = NULL;
     }
@@ -1176,12 +1152,12 @@ void SMESH_PreMeshInfo::ForgetAllData() const
   _mesh->changePreMeshInfo() = NULL;
   delete this;
 
-  PreMeshInfo_CATCH;
+  SMESH_CATCH( SMESH::doNothing );
 
 
   // Finalize loading
 
-  // PreMeshInfo_TRY;
+  // SMESH_TRY;
 
   // ::SMESH_Mesh& mesh = _mesh->GetImpl();
 
@@ -1192,7 +1168,19 @@ void SMESH_PreMeshInfo::ForgetAllData() const
   // //     hyp->UpdateAsMeshesRestored();
 
 
-  // PreMeshInfo_CATCH;
+  // SMESH_CATCH( SMESH::doNothing );
+}
+
+//================================================================================
+/*!
+ * \brief remove all SMESH_PreMeshInfo fields from mesh and its child objects w/o data loading
+ */
+//================================================================================
+
+void SMESH_PreMeshInfo::ForgetAllData( SMESH_Mesh_i* mesh )
+{
+  if ( mesh && mesh->changePreMeshInfo() )
+    mesh->changePreMeshInfo()->ForgetAllData();
 }
 
 //================================================================================
@@ -1274,10 +1262,10 @@ void SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD(SALOMEDS::SComponent_ptr sme
   SALOMEDS::Study_var study = smeshComp->GetStudy();
   if ( theStudyIDToMeshCounter[ (int) study->StudyId() ] > 0 )
   {
-    SALOMEDS::ChildIterator_var itBig = study->NewChildIterator( smeshComp );
+    SALOMEDS::ChildIterator_wrap itBig = study->NewChildIterator( smeshComp );
     for ( ; itBig->More(); itBig->Next() ) {
-      SALOMEDS::SObject_var gotBranch = itBig->Value();
-      CORBA::Object_var anObject = SMESH_Gen_i::SObjectToObject( gotBranch );
+      SALOMEDS::SObject_wrap gotBranch = itBig->Value();
+      CORBA::Object_var       anObject = SMESH_Gen_i::SObjectToObject( gotBranch );
       if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( anObject ))
       {
         if ( mesh->changePreMeshInfo() )
index 38b15a24256b3a009ba473fb7a8e70648f6da10c..f92ce96c32f8169a942708a2a8b262a9a835853f 100644 (file)
@@ -52,7 +52,7 @@ class SMESH_Mesh_i;
 class SMESH_PreMeshInfo : public SMDS_MeshInfo
 {
 public:
-  // fills SMESH_PreMeshInfo field of all objects of mesh
+  // fills SMESH_PreMeshInfo* field of all objects of mesh
   static void LoadFromFile( SMESH_Mesh_i*      mesh,
                             const int          meshID,
                             const std::string& medFile,
@@ -64,6 +64,9 @@ public:
                           const int     meshID,
                           HDFfile*      hdfFile);
 
+  // remove all SMESH_PreMeshInfo fields from mesh and its child objects w/o data loading
+  static void ForgetAllData( SMESH_Mesh_i* mesh );
+
   // reads all data and remove all SMESH_PreMeshInfo fields from objects
   void FullLoadFromFile() const;
 
diff --git a/src/SMESH_I/smeshpy.py b/src/SMESH_I/smeshpy.py
deleted file mode 100644 (file)
index fa01ce2..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-#  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-#  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
-#  File   : smeshpy.py
-#  Module : SMESH
-#
-import salome
-import SMESH
-
-from SALOME_utilities import *
-
-#=============================================================================
-
-class smeshpy:
-    _geom = None
-    _smesh = None
-    _studyId = None
-
-    #--------------------------------------------------------------------------
-
-    def __init__(self):
-        try:
-            self._geom = salome.lcc.FindOrLoadComponent("FactoryServer","GEOM")
-            self._smesh = salome.lcc.FindOrLoadComponent("FactoryServer","SMESH")
-        except:
-            MESSAGE( "exception in smeshpy:__init__" )
-        self._study = salome.myStudy
-        self._smesh.SetCurrentStudy(self._study)
-
-    #--------------------------------------------------------------------------
-
-    def CreateMesh(self, shapeId):
-        try:
-            shape = salome.IDToObject(shapeId)
-            aMesh = self._smesh.CreateMesh(shape)
-            return aMesh
-        except:
-            MESSAGE( "exception in smeshpy:Init" )
-            return None
-
-    #--------------------------------------------------------------------------
-
-    def CreateHypothesis(self, name, libname):
-        try:
-            hyp = self._smesh.CreateHypothesis(name, libname)
-            return hyp
-        except:
-            MESSAGE( "exception in smeshpy:CreateHypothesis" )
-            return None    
-
-    #--------------------------------------------------------------------------
-
-    def Compute(self, mesh, shapeId):
-        try:
-            shape = salome.IDToObject(shapeId)
-            ret=self._smesh.Compute(mesh, shape)
-            return ret
-        except:
-            MESSAGE( "exception in smeshpy:Compute" )
-            return 0    
-
-#=============================================================================
-##    #--------------------------------------------------------------------------
-
-##def SmeshInit(shapeId):
-##    import salome
-##    import SMESH
-##    geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-##    smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-##    shape = salome.IDToObject(shapeId)
-##    studyId = salome.myStudyId
-##    MESSAGE( str(studyId) )
-##    aMesh = smesh.Init(geom, studyId, shape)
-##    return aMesh
-
-##    #--------------------------------------------------------------------------
index c07bfef200d99daf6087a181285411e863bec4ae..ab1c52ecc29528bfbcddeec9152a4130d4af060c 100644 (file)
@@ -186,7 +186,10 @@ def GetName(obj):
         if isinstance(obj, SALOMEDS._objref_SObject):
             # study object
             return obj.GetName()
-        ior  = salome.orb.object_to_string(obj)
+        try:
+            ior  = salome.orb.object_to_string(obj)
+        except:
+            ior = None
         if ior:
             # CORBA object
             studies = salome.myStudyManager.GetOpenStudies()
@@ -520,8 +523,10 @@ class smeshDC(SMESH._objref_SMESH_Gen):
     #  @param mergeNodesAndElements if true, equal nodes and elements aremerged
     #  @param mergeTolerance tolerance for merging nodes
     #  @param allGroups forces creation of groups of all elements
+    #  @param name name of a new mesh
     def Concatenate( self, meshes, uniteIdenticalGroups,
-                     mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False):
+                     mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False,
+                     name = ""):
         if not meshes: return None
         for i,m in enumerate(meshes):
             if isinstance(m, Mesh):
@@ -534,7 +539,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         else:
             aSmeshMesh = SMESH._objref_SMESH_Gen.Concatenate(
                 self,meshes,uniteIdenticalGroups,mergeNodesAndElements,mergeTolerance)
-        aMesh = Mesh(self, self.geompyD, aSmeshMesh)
+        aMesh = Mesh(self, self.geompyD, aSmeshMesh, name=name)
         return aMesh
 
     ## Create a mesh by copying a part of another mesh.
@@ -775,36 +780,39 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         if isinstance( theCriterion, SMESH._objref_NumericalFunctor ):
             return theCriterion
         aFilterMgr = self.CreateFilterManager()
+        functor = None
         if theCriterion == FT_AspectRatio:
-            return aFilterMgr.CreateAspectRatio()
+            functor = aFilterMgr.CreateAspectRatio()
         elif theCriterion == FT_AspectRatio3D:
-            return aFilterMgr.CreateAspectRatio3D()
+            functor = aFilterMgr.CreateAspectRatio3D()
         elif theCriterion == FT_Warping:
-            return aFilterMgr.CreateWarping()
+            functor = aFilterMgr.CreateWarping()
         elif theCriterion == FT_MinimumAngle:
-            return aFilterMgr.CreateMinimumAngle()
+            functor = aFilterMgr.CreateMinimumAngle()
         elif theCriterion == FT_Taper:
-            return aFilterMgr.CreateTaper()
+            functor = aFilterMgr.CreateTaper()
         elif theCriterion == FT_Skew:
-            return aFilterMgr.CreateSkew()
+            functor = aFilterMgr.CreateSkew()
         elif theCriterion == FT_Area:
-            return aFilterMgr.CreateArea()
+            functor = aFilterMgr.CreateArea()
         elif theCriterion == FT_Volume3D:
-            return aFilterMgr.CreateVolume3D()
+            functor = aFilterMgr.CreateVolume3D()
         elif theCriterion == FT_MaxElementLength2D:
-            return aFilterMgr.CreateMaxElementLength2D()
+            functor = aFilterMgr.CreateMaxElementLength2D()
         elif theCriterion == FT_MaxElementLength3D:
-            return aFilterMgr.CreateMaxElementLength3D()
+            functor = aFilterMgr.CreateMaxElementLength3D()
         elif theCriterion == FT_MultiConnection:
-            return aFilterMgr.CreateMultiConnection()
+            functor = aFilterMgr.CreateMultiConnection()
         elif theCriterion == FT_MultiConnection2D:
-            return aFilterMgr.CreateMultiConnection2D()
+            functor = aFilterMgr.CreateMultiConnection2D()
         elif theCriterion == FT_Length:
-            return aFilterMgr.CreateLength()
+            functor = aFilterMgr.CreateLength()
         elif theCriterion == FT_Length2D:
-            return aFilterMgr.CreateLength2D()
+            functor = aFilterMgr.CreateLength2D()
         else:
             print "Error: given parameter is not numerical functor type."
+        aFilterMgr.UnRegister()
+        return functor
 
     ## Creates hypothesis
     #  @param theHType mesh hypothesis type (string)
@@ -978,10 +986,11 @@ class Mesh:
         self.geompyD=geompyD
         if obj is None:
             obj = 0
+        objHasName = False
         if obj != 0:
-            objHasName = True
             if isinstance(obj, geompyDC.GEOM._objref_GEOM_Object):
                 self.geom = obj
+                objHasName = True
                 # publish geom of mesh (issue 0021122)
                 if not self.geom.GetStudyEntry() and smeshpyD.GetCurrentStudy():
                     objHasName = False
@@ -990,9 +999,9 @@ class Mesh:
                         geompyD.init_geom( smeshpyD.GetCurrentStudy())
                         pass
                     if name:
-                        geo_name = name
+                        geo_name = name + " shape"
                     else:
-                        geo_name = "%s_%s_for_meshing"%(self.geom.GetShapeType(), id(self.geom)%100)
+                        geo_name = "%s_%s to mesh"%(self.geom.GetShapeType(), id(self.geom)%100)
                     geompyD.addToStudy( self.geom, geo_name )
                 self.mesh = self.smeshpyD.CreateMesh(self.geom)
 
@@ -1000,10 +1009,10 @@ class Mesh:
                 self.SetMesh(obj)
         else:
             self.mesh = self.smeshpyD.CreateEmptyMesh()
-        if name != 0:
+        if name:
             self.smeshpyD.SetName(self.mesh, name)
-        elif obj != 0 and objHasName:
-            self.smeshpyD.SetName(self.mesh, GetName(obj))
+        elif objHasName:
+            self.smeshpyD.SetName(self.mesh, GetName(obj)) # + " mesh"
 
         if not self.geom:
             self.geom = self.mesh.GetShapeToMesh()
@@ -1021,8 +1030,11 @@ class Mesh:
     #  @param theMesh a SMESH_Mesh object
     #  @ingroup l2_construct
     def SetMesh(self, theMesh):
+        if self.mesh: self.mesh.UnRegister()
         self.mesh = theMesh
-        self.geom = self.mesh.GetShapeToMesh()
+        if self.mesh:
+            self.mesh.Register()
+            self.geom = self.mesh.GetShapeToMesh()
 
     ## Returns the mesh, that is an instance of SMESH_Mesh interface
     #  @return a SMESH_Mesh object
@@ -1096,19 +1108,25 @@ class Mesh:
         return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName )
 
     ## Returns the mesh dimension depending on the dimension of the underlying shape
+    #  or, if the mesh is not based on any shape, basing on deimension of elements
     #  @return mesh dimension as an integer value [0,3]
     #  @ingroup l1_auxiliary
     def MeshDimension(self):
-        shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] )
-        if len( shells ) > 0 :
-            return 3
-        elif self.geompyD.NumberOfFaces( self.geom ) > 0 :
-            return 2
-        elif self.geompyD.NumberOfEdges( self.geom ) > 0 :
-            return 1
+        if self.mesh.HasShapeToMesh():
+            shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SOLID"] )
+            if len( shells ) > 0 :
+                return 3
+            elif self.geompyD.NumberOfFaces( self.geom ) > 0 :
+                return 2
+            elif self.geompyD.NumberOfEdges( self.geom ) > 0 :
+                return 1
+            else:
+                return 0;
         else:
-            return 0;
-        pass
+            if self.NbVolumes() > 0: return 3
+            if self.NbFaces()   > 0: return 2
+            if self.NbEdges()   > 0: return 1
+        return 0
 
     ## Evaluates size of prospective mesh on a shape
     #  @return a list where i-th element is a number of elements of i-th SMESH.EntityType
@@ -1190,7 +1208,7 @@ class Mesh:
                              "Invalid input mesh",   #COMPERR_BAD_INPUT_MESH
                              "std::exception",       #COMPERR_STD_EXCEPTION
                              "OCC exception",        #COMPERR_OCC_EXCEPTION
-                             "SALOME exception",     #COMPERR_SLM_EXCEPTION
+                             "..",                   #COMPERR_SLM_EXCEPTION
                              "Unknown exception",    #COMPERR_EXCEPTION
                              "Memory allocation problem", #COMPERR_MEMORY_PB
                              "Algorithm failed",     #COMPERR_ALGO_FAILED
@@ -1275,7 +1293,8 @@ class Mesh:
     #  @ingroup l2_construct
     def Clear(self):
         self.mesh.Clear()
-        if salome.sg.hasDesktop():
+        if ( salome.sg.hasDesktop() and 
+             salome.myStudyManager.GetStudyByID( self.mesh.GetStudyId() )):
             smeshgui = salome.ImportComponentGUI("SMESH")
             smeshgui.Init(self.mesh.GetStudyId())
             smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
@@ -1356,7 +1375,7 @@ class Mesh:
     #  @return True of False
     #  @ingroup l2_hypotheses
     def IsUsedHypothesis(self, hyp, geom):
-        if not hyp or not geom:
+        if not hyp: # or not geom
             return False
         if isinstance( hyp, Mesh_Algorithm ):
             hyp = hyp.GetAlgorithm()
@@ -1376,11 +1395,16 @@ class Mesh:
         if isinstance( hyp, Mesh_Algorithm ):
             hyp = hyp.GetAlgorithm()
             pass
-        if not geom:
-            geom = self.geom
+        shape = geom
+        if not shape:
+            shape = self.geom
             pass
-        status = self.mesh.RemoveHypothesis(geom, hyp)
-        return status
+        if self.IsUsedHypothesis( hyp, shape ):
+            return self.mesh.RemoveHypothesis( shape, hyp )
+        hypName = GetName( hyp )
+        geoName = GetName( shape )
+        print "WARNING: RemoveHypothesis() failed as '%s' is not assigned to '%s' shape" % ( hypName, geoName )
+        return None
 
     ## Gets the list of hypotheses added on a geometry
     #  @param geom a sub-shape of mesh geometry
@@ -2109,6 +2133,12 @@ class Mesh:
     def GetNodePosition(self,NodeID):
         return self.mesh.GetNodePosition(NodeID)
 
+    ## @brief Returns the position of an element on the shape
+    #  @return SMESH::ElementPosition
+    #  @ingroup l1_meshinfo
+    def GetElementPosition(self,ElemID):
+        return self.mesh.GetElementPosition(ElemID)
+
     ## If the given element is a node, returns the ID of shape
     #  \n If there is no node for the given ID - returns -1
     #  @return an integer value
@@ -3186,7 +3216,9 @@ class Mesh:
 
     ## Generates new elements by extrusion of the elements with given ids
     #  @param IDsOfElements the list of elements ids for extrusion
-    #  @param StepVector vector or DirStruct, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
+    #  @param StepVector vector or DirStruct or 3 vector components, defining
+    #         the direction and value of extrusion for one step (the total extrusion
+    #         length will be NbOfSteps * ||StepVector||)
     #  @param NbOfSteps the number of steps
     #  @param MakeGroups forces the generation of new groups from existing ones
     #  @param IsNodes is True if elements with given ids are nodes
@@ -3195,8 +3227,10 @@ class Mesh:
     def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
-        if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
+        if isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if isinstance( StepVector, list ):
+            StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
         NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
         Parameters = StepVector.PS.parameters + var_separator + Parameters
         self.mesh.SetParameters(Parameters)
@@ -3213,7 +3247,9 @@ class Mesh:
 
     ## Generates new elements by extrusion of the elements with given ids
     #  @param IDsOfElements is ids of elements
-    #  @param StepVector vector, defining the direction and value of extrusion
+    #  @param StepVector vector or DirStruct or 3 vector components, defining
+    #         the direction and value of extrusion for one step (the total extrusion
+    #         length will be NbOfSteps * ||StepVector||)
     #  @param NbOfSteps the number of steps
     #  @param ExtrFlags sets flags for extrusion
     #  @param SewTolerance uses for comparing locations of nodes if flag
@@ -3225,6 +3261,8 @@ class Mesh:
                           ExtrFlags, SewTolerance, MakeGroups=False):
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if isinstance( StepVector, list ):
+            StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
         if MakeGroups:
             return self.editor.AdvancedExtrusionMakeGroups(IDsOfElements, StepVector, NbOfSteps,
                                                            ExtrFlags, SewTolerance)
@@ -3235,7 +3273,9 @@ class Mesh:
     ## Generates new elements by extrusion of the elements which belong to the object
     #  @param theObject the object which elements should be processed.
     #                   It can be a mesh, a sub mesh or a group.
-    #  @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
+    #  @param StepVector vector or DirStruct or 3 vector components, defining
+    #         the direction and value of extrusion for one step (the total extrusion
+    #         length will be NbOfSteps * ||StepVector||)
     #  @param NbOfSteps the number of steps
     #  @param MakeGroups forces the generation of new groups from existing ones
     #  @param  IsNodes is True if elements which belong to the object are nodes
@@ -3246,6 +3286,8 @@ class Mesh:
             theObject = theObject.GetMesh()
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if isinstance( StepVector, list ):
+            StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
         NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
         Parameters = StepVector.PS.parameters + var_separator + Parameters
         self.mesh.SetParameters(Parameters)
@@ -3263,7 +3305,9 @@ class Mesh:
     ## Generates new elements by extrusion of the elements which belong to the object
     #  @param theObject object which elements should be processed.
     #                   It can be a mesh, a sub mesh or a group.
-    #  @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
+    #  @param StepVector vector or DirStruct or 3 vector components, defining
+    #         the direction and value of extrusion for one step (the total extrusion
+    #         length will be NbOfSteps * ||StepVector||)
     #  @param NbOfSteps the number of steps
     #  @param MakeGroups to generate new groups from existing ones
     #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
@@ -3273,6 +3317,8 @@ class Mesh:
             theObject = theObject.GetMesh()
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if isinstance( StepVector, list ):
+            StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
         NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
         Parameters = StepVector.PS.parameters + var_separator + Parameters
         self.mesh.SetParameters(Parameters)
@@ -3284,7 +3330,9 @@ class Mesh:
     ## Generates new elements by extrusion of the elements which belong to the object
     #  @param theObject object which elements should be processed.
     #                   It can be a mesh, a sub mesh or a group.
-    #  @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
+    #  @param StepVector vector or DirStruct or 3 vector components, defining
+    #         the direction and value of extrusion for one step (the total extrusion
+    #         length will be NbOfSteps * ||StepVector||)
     #  @param NbOfSteps the number of steps
     #  @param MakeGroups forces the generation of new groups from existing ones
     #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
@@ -3294,6 +3342,8 @@ class Mesh:
             theObject = theObject.GetMesh()
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if isinstance( StepVector, list ):
+            StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
         NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
         Parameters = StepVector.PS.parameters + var_separator + Parameters
         self.mesh.SetParameters(Parameters)
index 679a8d8532f5d04f6c26bc661b19270cff099aba..905ca5f51ade50fd3f9ba8e222d38a118ba5d611 100644 (file)
@@ -83,12 +83,15 @@ namespace
       SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName");
       SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
       aName->SetValue(theName.toLatin1().data());
+      aName->UnRegister();
       anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap");
       SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
       aPixmap->SetPixMap(thePixmap.toLatin1().data());
+      aPixmap->UnRegister();
       anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable");
       SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
       aSelAttr->SetSelectable(false);
+      aSelAttr->UnRegister();
     }
 
     return aDomainRoot;
@@ -126,12 +129,12 @@ namespace
   //---------------------------------------------------------------
   inline
   SALOMEDS::SObject_var
-  AddToDomain(const std::string& theIOR,
-              const SALOMEDS::SComponent_var& theSComponentMesh,
+  AddToDomain(const std::string&                theIOR,
+              const SALOMEDS::SComponent_var&   theSComponentMesh,
               const SALOMEDS::StudyBuilder_var& theStudyBuilder,
-              CORBA::Long theDomainRootTag,
-              const QString& theDomainName,
-              const QString& theDomainPixmap)
+              CORBA::Long                       theDomainRootTag,
+              const QString&                    theDomainName,
+              const QString&                    theDomainPixmap)
   {
     SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
                                                   theStudyBuilder,
@@ -140,6 +143,7 @@ namespace
                                                   theDomainPixmap);
     // Add New Hypothesis
     SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain);
+    aDomain->UnRegister();
     SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
     SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     CORBA::Object_var anObject = StringToObject(theIOR);
@@ -147,9 +151,11 @@ namespace
     CORBA::String_var aType = aDomainItem->GetName();
     QString aPixmapName = theDomainPixmap + "_" + aType.in();
     aPixmap->SetPixMap(aPixmapName.toLatin1().data());
+    aPixmap->UnRegister();
     anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
     SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
     anIOR->SetValue(theIOR.c_str());
+    anIOR->UnRegister();
 
     return aSObject;
   }
@@ -187,44 +193,52 @@ namespace
 
   //---------------------------------------------------------------
   void
-  SetDomain(const char* theMeshOrSubMeshEntry,
-            const char* theDomainEntry,
-            const SALOMEDS::Study_var& theStudy,
+  SetDomain(const char*                       theMeshOrSubMeshEntry,
+            const char*                       theDomainEntry,
+            const SALOMEDS::Study_var&        theStudy,
             const SALOMEDS::StudyBuilder_var& theStudyBuilder,
-            long theRefOnAppliedDomainTag,
-            const QString& theAppliedDomainMEN,
-            const QString& theAppliedDomainICON)
+            long                              theRefOnAppliedDomainTag,
+            const QString&                    theAppliedDomainMEN,
+            const QString&                    theAppliedDomainICON)
   {
     SALOMEDS::SObject_var aMeshOrSubMeshSO = theStudy->FindObjectID(theMeshOrSubMeshEntry);
-    SALOMEDS::SObject_var aHypothesisSO = theStudy->FindObjectID(theDomainEntry);
+    SALOMEDS::SObject_var    aHypothesisSO = theStudy->FindObjectID(theDomainEntry);
 
     if(!aMeshOrSubMeshSO->_is_nil() && !aHypothesisSO->_is_nil()){
       //Find or Create Applied Hypothesis root
       SALOMEDS::SObject_var anAppliedDomainSO;
-      if(!aMeshOrSubMeshSO->FindSubObject(theRefOnAppliedDomainTag,anAppliedDomainSO)){
+      if( !aMeshOrSubMeshSO->FindSubObject( theRefOnAppliedDomainTag, anAppliedDomainSO ))
+      {
         anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
         SALOMEDS::GenericAttribute_var anAttr =
           theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
         SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
         aName->SetValue(theAppliedDomainMEN.toLatin1().data());
+        aName->UnRegister();
         anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable");
         SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
         aSelAttr->SetSelectable(false);
+        aSelAttr->UnRegister();
         anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap");
         SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
         aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data());
+        aPixmap->UnRegister();
       }
       SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO);
       theStudyBuilder->Addreference(aSObject,aHypothesisSO);
+      aSObject->UnRegister();
+      anAppliedDomainSO->UnRegister();
     }
+    if ( !aMeshOrSubMeshSO->_is_nil() ) aMeshOrSubMeshSO->UnRegister();
+    if ( !aHypothesisSO->_is_nil())     aHypothesisSO->UnRegister();
   }
 
 
   //---------------------------------------------------------------
   void
-  SetHypothesis(const char* theMeshOrSubMeshEntry,
-                const char* theDomainEntry,
-                const SALOMEDS::Study_var& theStudy,
+  SetHypothesis(const char*                       theMeshOrSubMeshEntry,
+                const char*                       theDomainEntry,
+                const SALOMEDS::Study_var&        theStudy,
                 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
   {
     SetDomain(theMeshOrSubMeshEntry,
@@ -239,9 +253,9 @@ namespace
 
   //---------------------------------------------------------------
   void
-  SetAlgorithms(const char* theMeshOrSubMeshEntry,
-                const char* theDomainEntry,
-                const SALOMEDS::Study_var& theStudy,
+  SetAlgorithms(const char*                       theMeshOrSubMeshEntry,
+                const char*                       theDomainEntry,
+                const SALOMEDS::Study_var&        theStudy,
                 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
   {
     SetDomain(theMeshOrSubMeshEntry,
@@ -296,31 +310,36 @@ SMESH_Swig::Init(int theStudyID)
 {
   class TEvent: public SALOME_Event
   {
-    int myStudyID;
-    SALOMEDS::Study_var& myStudy;
+    int                         myStudyID;
+    SALOMEDS::Study_var&        myStudy;
     SALOMEDS::StudyBuilder_var& myStudyBuilder;
-    SALOMEDS::SComponent_var& mySComponentMesh;
+    SALOMEDS::SComponent_var&   mySComponentMesh;
   public:
-    TEvent(int theStudyID,
-           SALOMEDS::Study_var& theStudy,
+    TEvent(int                         theStudyID,
+           SALOMEDS::Study_var&        theStudy,
            SALOMEDS::StudyBuilder_var& theStudyBuilder,
-           SALOMEDS::SComponent_var& theSComponentMesh):
-      myStudyID(theStudyID),
-      myStudy(theStudy),
-      myStudyBuilder(theStudyBuilder),
+           SALOMEDS::SComponent_var&   theSComponentMesh):
+      myStudyID       (theStudyID),
+      myStudy         (theStudy),
+      myStudyBuilder  (theStudyBuilder),
       mySComponentMesh(theSComponentMesh)
     {}
 
+    ~TEvent()
+    {
+      if ( !mySComponentMesh->_is_nil() ) mySComponentMesh->UnRegister();
+    }
+
     virtual
     void
     Execute()
     {
-      SUIT_Session* aSession = SUIT_Session::session();
+      SUIT_Session* aSession          = SUIT_Session::session();
       SUIT_Application* anApplication = aSession->activeApplication();
-      SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
+      SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
 
       SALOME_NamingService* aNamingService = anApp->namingService();
-      CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager");
+      CORBA::Object_var anObject           = aNamingService->Resolve("/myStudyManager");
       SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
       myStudy = aStudyMgr->GetStudyByID(myStudyID);
 
@@ -334,26 +353,33 @@ SMESH_Swig::Init(int theStudyID)
       SALOMEDS::AttributePixMap_var  aPixmap;
 
       SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
-      if(aSComponent->_is_nil()){
+      if ( aSComponent->_is_nil() )
+      {
         bool aLocked = myStudy->GetProperties()->IsLocked();
         if (aLocked)
           myStudy->GetProperties()->SetLocked(false);
-        
-        aSComponent = myStudyBuilder->NewComponent("SMESH");
-        anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName");
-        aName = SALOMEDS::AttributeName::_narrow(anAttr);
 
-        SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
-        if (!aSMESHGUI){
+        SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+        //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
+        if (!aSMESHGUI) {
           CAM_Module* aModule = anApp->module("Mesh");
           if(!aModule)
-              aModule = anApp->loadModule("Mesh");
+            aModule = anApp->loadModule("Mesh");
           aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
         } //SRN: BugID IPAL9186: end of a fix
+
+        aSComponent = myStudyBuilder->NewComponent("SMESH");
+
+        anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName");
+        aName  = SALOMEDS::AttributeName::_narrow(anAttr);
         aName->SetValue(aSMESHGUI->moduleName().toLatin1().data());
+        aName->UnRegister();
+
         anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
         aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
         aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
+        aPixmap->UnRegister();
+
         myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
         if (aLocked)
           myStudy->GetProperties()->SetLocked(true);
@@ -388,22 +414,29 @@ const char* SMESH_Swig::AddNewMesh(const char* theIOR)
 
   // VSR: added temporarily - to be removed - objects are published automatically by engine
   SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
-  if (aSObject->_is_nil()){
+  if (aSObject->_is_nil())
+  {
     //Find or Create Hypothesis root
-    GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
-    GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
+    SALOMEDS::SObject_var hroot = GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
+    SALOMEDS::SObject_var aroot = GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
+    hroot->UnRegister();
+    aroot->UnRegister();
 
     // Add New Mesh
     aSObject = myStudyBuilder->NewObject(mySComponentMesh);
     SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
     SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
+    aPixmap->UnRegister();
+
     anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
     SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
     anIOR->SetValue(theIOR);
+    anIOR->UnRegister();
   }
 
   CORBA::String_var anEntry = aSObject->GetID();
+  aSObject->UnRegister();
 
   return anEntry._retn();
 }
@@ -418,6 +451,8 @@ const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
                                                    mySComponentMesh,
                                                    myStudyBuilder);
   CORBA::String_var anEntry = aSObject->GetID();
+  aSObject->UnRegister();
+
   return anEntry._retn();
 }
 
@@ -431,6 +466,8 @@ const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
                                                    mySComponentMesh,
                                                    myStudyBuilder);
   CORBA::String_var anEntry = aSObject->GetID();
+  aSObject->UnRegister();
+
   return anEntry._retn();
 }
 
@@ -439,13 +476,16 @@ const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
 void SMESH_Swig::SetShape(const char* theShapeEntry,
                           const char* theMeshEntry)
 {
-  SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
   SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
+  SALOMEDS::SObject_var      aMeshSO = myStudy->FindObjectID( theMeshEntry );
 
   if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
     SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
     myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
+    aSObject->UnRegister();
   }
+  if ( !aMeshSO->_is_nil() )      aMeshSO->UnRegister();
+  if ( !aGeomShapeSO->_is_nil() ) aGeomShapeSO->UnRegister();
 }
 
 
@@ -485,49 +525,57 @@ const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
                                    int theShapeType)
 {
   SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
-  if(!aMeshSO->_is_nil()){
+  if(!aMeshSO->_is_nil()) {
     long aShapeTag;
     QString aSubMeshName;
-    switch(theShapeType){
+    switch(theShapeType) {
     case TopAbs_SOLID:
-      aShapeTag = SMESH::Tag_SubMeshOnSolid;
+      aShapeTag    = SMESH::Tag_SubMeshOnSolid;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
       break;
     case TopAbs_FACE:
-      aShapeTag = SMESH::Tag_SubMeshOnFace;
+      aShapeTag    = SMESH::Tag_SubMeshOnFace;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
       break;
     case TopAbs_EDGE:
-      aShapeTag = SMESH::Tag_SubMeshOnEdge;
+      aShapeTag    = SMESH::Tag_SubMeshOnEdge;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
       break;
     case TopAbs_VERTEX:
-      aShapeTag = SMESH::Tag_SubMeshOnVertex;
+      aShapeTag    = SMESH::Tag_SubMeshOnVertex;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
       break;
     default:
-      aShapeTag = SMESH::Tag_SubMeshOnCompound;
+      aShapeTag    = SMESH::Tag_SubMeshOnCompound;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
     }
 
-    SALOMEDS::SObject_var aSubMeshesRoot;
     SALOMEDS::GenericAttribute_var anAttr;
-    if(!aMeshSO->FindSubObject(aShapeTag,aSubMeshesRoot)){
+    SALOMEDS::SObject_var aSubMeshesRoot;
+    if ( !aMeshSO->FindSubObject( aShapeTag, aSubMeshesRoot ) )
+    {
       aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag);
       anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName");
       SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
       aName->SetValue(aSubMeshName.toLatin1().data());
+      aName->UnRegister();
       anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable");
       SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
       aSelAttr->SetSelectable(false);
+      aSelAttr->UnRegister();
     }
+    aSubMeshesRoot->UnRegister();
+    aMeshSO->UnRegister();
 
     SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObject(aSubMeshesRoot);
     anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
     SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
     anIOR->SetValue(theSubMeshIOR);
+    anIOR->UnRegister();
 
     CORBA::String_var aString = aSObject->GetID();
+    aSObject->UnRegister();
+
     return aString._retn();
   }
 
@@ -537,17 +585,20 @@ const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
 const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
                                           const char* theGeomShapeEntry,
                                           const char* theSubMeshIOR,
-                                          int ShapeType)
+                                          int         ShapeType)
 {
   SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
-  if(!aGeomShapeSO->_is_nil()){
-    const char * aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
+  if(!aGeomShapeSO->_is_nil())
+  {
+    const char *       aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
     SALOMEDS::SObject_var aSubMeshSO = myStudy->FindObjectID(aSubMeshEntry);
-    if(!aSubMeshSO->_is_nil()){
-      SetShape(theGeomShapeEntry,aSubMeshEntry);
+    if ( !aSubMeshSO->_is_nil()) {
+      SetShape( theGeomShapeEntry, aSubMeshEntry );
       CORBA::String_var aString = aSubMeshSO->GetID();
+      aSubMeshSO->UnRegister();
       return aString._retn();
     }
+    aGeomShapeSO->UnRegister();
   }
 
   return "";
@@ -566,11 +617,11 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
     }
     virtual void Execute() {
       //SMESH::UpdateView(SMESH::eDisplay, _entry);
-      SUIT_Session* aSession = SUIT_Session::session();
+      SUIT_Session* aSession          = SUIT_Session::session();
       SUIT_Application* anApplication = aSession->activeApplication();
-      SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
-      /*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
-      SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
+      SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
+      /*SUIT_ViewManager* vman        = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
+      SMESHGUI_Displayer* aDisp       = new SMESHGUI_Displayer(anApp);
       aDisp->Display(_entry,1);
     }
   };
@@ -584,31 +635,31 @@ void SMESH_Swig::EraseActor( const char* Mesh_Entry, const bool allViewers )
   {
   private:
     const char* _entry;
-    bool _allViewers;
+    bool        _allViewers;
   public:
     TEvent(const char* Mesh_Entry, const bool allViewers ) {
       _entry = Mesh_Entry;
       _allViewers = allViewers;
     }
     virtual void Execute() {
-      SUIT_Session* aSession = SUIT_Session::session();
+      SUIT_Session* aSession          = SUIT_Session::session();
       SUIT_Application* anApplication = aSession->activeApplication();
-      SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
-      SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
+      SalomeApp_Application* anApp    = dynamic_cast<SalomeApp_Application*>(anApplication);
+      SMESHGUI_Displayer* aDisp       = new SMESHGUI_Displayer(anApp);
       ViewManagerList aManagers;
       if ( !_allViewers ) {
-       aManagers << anApp->activeViewManager();
+        aManagers << anApp->activeViewManager();
       }
       else {
-       aManagers = anApp->viewManagers();
+        aManagers = anApp->viewManagers();
       }
       foreach( SUIT_ViewManager* aMgr, aManagers ) {
-       if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
-         SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
-         if (aSalomeView) {
-           aDisp->Erase(_entry,true, true, aSalomeView);
-         }
-       }
+        if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
+          SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
+          if (aSalomeView) {
+            aDisp->Erase(_entry,true, true, aSalomeView);
+          }
+        }
       }
     }
   };
@@ -626,6 +677,8 @@ void SMESH_Swig::SetName(const char* theEntry,
     anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
     aName = SALOMEDS::AttributeName::_narrow(anAttr);
     aName->SetValue(theName);
+    aName->UnRegister();
+    aSObject->UnRegister();
   }
 }
 
@@ -638,33 +691,33 @@ void SMESH_Swig::SetName(const char* theEntry,
 //================================================================================
 
 void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
-                             const bool theIsComputed,
-                             const bool isEmpty)
+                             const bool  theIsComputed,
+                             const bool  isEmpty)
 {
   class TEvent: public SALOME_Event
   {
     SALOMEDS::Study_var myStudy;
-    std::string myMeshEntry;
-    bool myIsComputed, myIsEmpty;
+    std::string         myMeshEntry;
+    bool                myIsComputed, myIsEmpty;
   public:
     TEvent(const SALOMEDS::Study_var& theStudy,
-           const std::string& theMeshEntry,
-           const bool theIsComputed,
-           const bool isEmpty):
-      myStudy(theStudy),
-      myMeshEntry(theMeshEntry),
+           const std::string&         theMeshEntry,
+           const bool                 theIsComputed,
+           const bool                 isEmpty):
+      myStudy     (theStudy),
+      myMeshEntry (theMeshEntry),
       myIsComputed(theIsComputed),
-      myIsEmpty(isEmpty)
+      myIsEmpty   (isEmpty)
     {}
 
     virtual
     void
     Execute()
     {
-      SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
-      if(!aMeshSO->_is_nil())
-        if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
-          SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
+      SALOMEDS::SObject_ptr aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
+      if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
+        SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
+      // aMeshSO->UnRegister();  ~aMesh() already called UnRegister()!
     }
   };
 
index 20283d9ca9a7b152e7b4e2e0023e519b32d429b4..937c86806ba05bc6d30aa8a161bb05ed5154106a 100644 (file)
@@ -645,7 +645,7 @@ namespace
    */
   void Grid::ComputeNodes(SMESH_MesherHelper& helper)
   {
-    // state of each node of the grid relative to the geomerty
+    // state of each node of the grid relative to the geometry
     const size_t nbGridNodes = _coords[0].size() * _coords[1].size() * _coords[2].size();
     vector< bool > isNodeOut( nbGridNodes, false );
     _nodes.resize( nbGridNodes, 0 );
index a4235d86386cc2d0b24829e5cf404bd63aefb96b..38d36f450c741add879c1489cd2f94461bb9bc9f 100644 (file)
@@ -655,10 +655,9 @@ bool _QuadFaceGrid::Init(const TopoDS_Face& f)
   //if ( myFace.Orientation() != TopAbs_FORWARD )
     //myFace.Reverse();
 
-  TopoDS_Vertex V;
   list< TopoDS_Edge > edges;
   list< int > nbEdgesInWire;
-  int nbWire = SMESH_Block::GetOrderedEdges (myFace, V, edges, nbEdgesInWire);
+  int nbWire = SMESH_Block::GetOrderedEdges (myFace, edges, nbEdgesInWire);
   if ( nbWire != 1 )
     return false;
 
index 36f0680cc4267e48bd301fc4ff4df772709f3011..37bc6c346792d2ccbb0e37dae0ed57c9e389019c 100644 (file)
@@ -160,11 +160,10 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face&   theFace,
       double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 );
       //cout<<"len = "<<len<<"  d2 = "<<d2<<"  fabs(2*d2/len-1.0) = "<<fabs(2*d2/len-1.0)<<endl;
       myIsUniform[i] = !( fabs(2*d2/myEdgeLength[i]-1.0) > 0.01 || fabs(2*d4/d2-1.0) > 0.01 );
-      if ( !myIsUniform[i] )
+      //if ( !myIsUniform[i] ) to implement Value3d(u)
       {
         double fp,lp;
-        TopLoc_Location L;
-        Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],L,fp,lp);
+        Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],fp,lp);
         myC3dAdaptor[i].Load( C3d, fp,lp );
       }
     }
@@ -208,8 +207,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face&   theFace,
  */
 //================================================================================
 
-StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
-                                         const gp_Pnt2d thePnt2d,
+StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode*       theNode,
+                                         const gp_Pnt2d             thePnt2d,
                                          const StdMeshers_FaceSide* theSide)
 {
   myC2d.resize(1);
@@ -218,7 +217,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
   myDefaultPnt2d = thePnt2d;
 
   myPoints = theSide->GetUVPtStruct();
-  myNbPonits = myNbSegments = myPoints.size();
+  myNbPonits = myPoints.size();
+  myNbSegments = theSide->myNbSegments;
   std::vector<uvPtStruct>::iterator it = myPoints.begin();
   for(; it!=myPoints.end(); it++) {
     (*it).u = thePnt2d.X();
@@ -336,7 +336,8 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool   isXConst,
       }
     } // loop on myEdge's
 
-    if ( u2node.size() + nbProxyNodes != myNbPonits )
+    if ( u2node.size() + nbProxyNodes != myNbPonits &&
+         u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
     {
       MESSAGE("Wrong node parameters on edges, u2node.size():"
               <<u2node.size()<<" !=  myNbPonits:"<<myNbPonits);
@@ -586,7 +587,7 @@ void StdMeshers_FaceSide::Reverse()
     reverse( myEdge );
     reverse( myEdgeID );
     reverse( myC2d );
-    reverse( myC3dAdaptor );
+    //reverse( myC3dAdaptor );
     reverse( myFirst );
     reverse( myLast );
     reverse( myNormPar );
@@ -601,6 +602,102 @@ void StdMeshers_FaceSide::Reverse()
     for ( size_t i = 0; i < myEdge.size(); ++i )
       reverseProxySubmesh( myEdge[i] );
   }
+  for ( size_t i = 0; i < myEdge.size(); ++i )
+  {
+    double fp,lp;
+    Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],fp,lp);
+    if ( !C3d.IsNull() )
+      myC3dAdaptor[i].Load( C3d, fp,lp );
+  }
+}
+
+//=======================================================================
+//function : SetIgnoreMediumNodes
+//purpose  : Make ignore medium nodes
+//=======================================================================
+
+void StdMeshers_FaceSide::SetIgnoreMediumNodes(bool toIgnore)
+{
+  if ( myIgnoreMediumNodes != toIgnore )
+  {
+    myIgnoreMediumNodes = toIgnore;
+
+    if ( !myPoints.empty() )
+    {
+      UVPtStructVec newPoints;
+      newPoints.reserve( myPoints.size()/2 + 1 );
+      for ( size_t i = 0; i < myPoints.size(); i += 2 )
+        newPoints.push_back( myPoints[i] );
+
+      myPoints.swap( newPoints );
+    }
+    else
+    {
+      NbPoints( /*update=*/true );
+    }
+  }
+}
+
+//=======================================================================
+//function : NbPoints
+//purpose  : Return nb nodes on edges and vertices (+1 to be == GetUVPtStruct().size() )
+//           Call it with update == true if mesh of this side can be recomputed
+//           since creation of this side
+//=======================================================================
+
+int StdMeshers_FaceSide::NbPoints(const bool update) const
+{
+  if ( !myPoints.empty() )
+    return myPoints.size();
+
+  // if ( !myFalsePoints.empty() )
+  //   return myFalsePoints.size();
+
+  if ( update && myEdge.size() > 0 )
+  {
+    StdMeshers_FaceSide* me = (StdMeshers_FaceSide*) this;
+    me->myNbPonits = 0;
+    me->myNbSegments = 0;
+    me->myMissingVertexNodes = false;
+
+    for ( int i = 0; i < NbEdges(); ++i )
+    {
+      TopoDS_Vertex v1 = SMESH_MesherHelper::IthVertex( 0, myEdge[i] );
+      if ( SMESH_Algo::VertexNode( v1, myProxyMesh->GetMeshDS() ))
+        me->myNbPonits += 1; // for the first end
+      else
+        me->myMissingVertexNodes = true;
+    
+      if ( const SMESHDS_SubMesh* sm = myProxyMesh->GetSubMesh( Edge(i) )) {
+        int nbN = sm->NbNodes();
+        if ( myIgnoreMediumNodes ) {
+          SMDS_ElemIteratorPtr elemIt = sm->GetElements();
+          if ( elemIt->more() && elemIt->next()->IsQuadratic() )
+            nbN -= sm->NbElements();
+        }
+        me->myNbPonits   += nbN;
+        me->myNbSegments += sm->NbElements();
+      }
+    }
+    TopoDS_Vertex v1 = SMESH_MesherHelper::IthVertex( 1, Edge( NbEdges()-1 ));
+    if ( SMESH_Algo::VertexNode( v1, myProxyMesh->GetMeshDS() ))
+      me->myNbPonits++; // for the last end
+    else
+      me->myMissingVertexNodes = true;
+  }
+  return myNbPonits;
+}
+
+//=======================================================================
+//function : NbSegments
+//purpose  : Return nb edges
+//           Call it with update == true if mesh of this side can be recomputed
+//           since creation of this side
+//=======================================================================
+
+int StdMeshers_FaceSide::NbSegments(const bool update) const
+{
+  return NbPoints( update ), myNbSegments;
 }
 
 //================================================================================
@@ -709,7 +806,6 @@ BRepAdaptor_CompCurve* StdMeshers_FaceSide::GetCurve3d() const
   return new BRepAdaptor_CompCurve( aWire );
 }
 
-
 //================================================================================
 /*!
  * \brief Return 2D point by normalized parameter
@@ -743,6 +839,35 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
   return myDefaultPnt2d;
 }
 
+//================================================================================
+/*!
+ * \brief Return XYZ by normalized parameter
+  * \param U - normalized parameter value
+  * \retval gp_Pnt - point
+ */
+//================================================================================
+
+gp_Pnt StdMeshers_FaceSide::Value3d(double U) const
+{
+  int        i = EdgeIndex( U );
+  double prevU = i ? myNormPar[ i-1 ] : 0;
+  double     r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
+
+  double par = myFirst[i] * ( 1 - r ) + myLast[i] * r;
+    
+  // check parametrization of curve
+  if( !myIsUniform[i] )
+  {
+    double aLen3dU = r * myEdgeLength[i] * ( myFirst[i]>myLast[i] ? -1. : 1.);
+    GCPnts_AbscissaPoint AbPnt
+      ( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), aLen3dU, myFirst[i] );
+    if( AbPnt.IsDone() ) {
+      par = AbPnt.Parameter();
+    }
+  }
+  return myC3dAdaptor[ i ].Value(par);
+}
+
 //================================================================================
 /*!
  * \brief Return wires of a face as StdMeshers_FaceSide's
@@ -755,10 +880,9 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face&   theFace,
                                               TError &             theError,
                                               SMESH_ProxyMesh::Ptr theProxyMesh)
 {
-  TopoDS_Vertex V1;
   list< TopoDS_Edge > edges, internalEdges;
   list< int > nbEdgesInWires;
-  int nbWires = SMESH_Block::GetOrderedEdges (theFace, V1, edges, nbEdgesInWires);
+  int nbWires = SMESH_Block::GetOrderedEdges (theFace, edges, nbEdgesInWires);
 
   // split list of all edges into separate wires
   TSideVector wires( nbWires );
index 1d4521dfe99bae2b145976e7f69dbab96b4fa67d..b4ab06966b16ec05aeab4035e3d6abaf3a4d1b60 100644 (file)
@@ -102,13 +102,22 @@ public:
    */
   void Reverse();
   /*!
-   * \brief Return nb nodes on edges and vertices (+1 to be == GetUVPtStruct().size() )
+   * \brief Make ignore medium nodes
    */
-  int NbPoints() const { return myNbPonits; }
+  void SetIgnoreMediumNodes(bool toIgnore);
+
+  /*!
+   * \brief Return nb nodes on edges and vertices (+1 to be == GetUVPtStruct().size() ).
+   *        Call it with update == true if mesh of this side can be recomputed
+   *        since creation of this side
+   */
+  int NbPoints(const bool update = false) const;
   /*!
    * \brief Return nb edges
+   *        Call it with update == true if mesh of this side can be recomputed
+   *        since creation of this side
    */
-  int NbSegments() const { return myNbSegments; }
+  int NbSegments(const bool update = false) const;
   /*!
    * \brief Return mesh
    */
@@ -117,6 +126,7 @@ public:
    * \brief Return true if there are vertices without nodes
    */
   bool MissVertexNode() const { return myMissingVertexNodes; }
+
   /*!
    * \brief Return detailed data on nodes
     * \param isXConst - true if normalized parameter X is constant
@@ -139,6 +149,7 @@ public:
     * For a closed side, the 1st point repeats at end
    */
   std::vector<const SMDS_MeshNode*> GetOrderedNodes() const;
+
   /*!
    * \brief Return edge and parameter on edge by normalized parameter
    */
@@ -147,6 +158,10 @@ public:
    * \brief Return UV by normalized parameter
    */
   gp_Pnt2d Value2d(double U) const;
+  /*!
+   * \brief Return XYZ by normalized parameter
+   */
+  gp_Pnt   Value3d(double U) const;
   /*!
    * \brief Creates a Adaptor2d_Curve2d to be used in SMESH_Block
    */
index 92f00af3a8e73c604addc0deffc5afcd4ca9bcb0..cc33934e1f1be4ac8f04a99dae5c14069a19d76c 100644 (file)
@@ -295,7 +295,7 @@ namespace
 //=============================================================================
 
 bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh &         aMesh,
-                                 const TopoDS_Shape & aShape)// throw(SALOME_Exception)
+                                 const TopoDS_Shape & aShape)
 {
   // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
   //Unexpect aCatch(SalomeException);
@@ -371,20 +371,12 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh &         aMesh,
     for ( int i = 0; i < 6; ++i )
     {
       const TopoDS_Face& sideF = aCubeSide[i]._quad->face;
-      if ( SMESHDS_SubMesh* smDS = meshDS->MeshElements( sideF ))
+      if ( !SMESH_MesherHelper::IsSameElemGeometry( meshDS->MeshElements( sideF ),
+                                                    SMDSGeom_QUADRANGLE,
+                                                    /*nullSubMeshRes=*/false ))
       {
-        bool isAllQuad = true;
-        SMDS_ElemIteratorPtr fIt = smDS->GetElements();
-        while ( fIt->more() && isAllQuad )
-        {
-          const SMDS_MeshElement* f = fIt->next();
-          isAllQuad = ( f->NbCornerNodes() == 4 );
-        }
-        if ( !isAllQuad )
-        {
-          SMESH_ComputeErrorPtr err = ComputePentahedralMesh(aMesh, aShape, proxymesh.get());
-          return error( err );
-        }
+        SMESH_ComputeErrorPtr err = ComputePentahedralMesh(aMesh, aShape, proxymesh.get());
+        return error( err );
       }
     }
   }
index 85eaef56619c46b5d460884730c24d96960fecd0..00a53610546f39a9b6cf983e50dba7ed1accbc78 100644 (file)
 //
 #include "StdMeshers_Prism_3D.hxx"
 
-#include "StdMeshers_ProjectionUtils.hxx"
-#include "SMESH_MesherHelper.hxx"
-#include "SMDS_VolumeTool.hxx"
-#include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_EdgePosition.hxx"
+#include "SMDS_VolumeOfNodes.hxx"
+#include "SMDS_VolumeTool.hxx"
 #include "SMESH_Comment.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_HypoFilter.hxx"
+#include "SMESH_MesherHelper.hxx"
+#include "StdMeshers_FaceSide.hxx"
+#include "StdMeshers_ProjectionSource1D.hxx"
+#include "StdMeshers_ProjectionSource2D.hxx"
+#include "StdMeshers_ProjectionUtils.hxx"
+#include "StdMeshers_Projection_1D.hxx"
+#include "StdMeshers_Projection_1D2D.hxx"
+#include "StdMeshers_Quadrangle_2D.hxx"
 
 #include "utilities.h"
 
+#include <BRepAdaptor_CompCurve.hxx>
 #include <BRep_Tool.hxx>
 #include <Bnd_B3d.hxx>
 #include <Geom2dAdaptor_Curve.hxx>
@@ -44,6 +53,7 @@
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <TopoDS.hxx>
@@ -69,6 +79,112 @@ enum { ID_BOT_FACE = SMESH_Block::ID_Fxy0,
 
 namespace {
 
+  //=======================================================================
+  /*!
+   * \brief Quadrangle algorithm
+   */
+  struct TQuadrangleAlgo : public StdMeshers_Quadrangle_2D
+  {
+    TQuadrangleAlgo(int studyId, SMESH_Gen* gen)
+      : StdMeshers_Quadrangle_2D( gen->GetANewId(), studyId, gen)
+    {
+    }
+    static StdMeshers_Quadrangle_2D* instance( SMESH_Algo*         fatherAlgo,
+                                               SMESH_MesherHelper* helper=0)
+    {
+      static TQuadrangleAlgo* algo = new TQuadrangleAlgo( fatherAlgo->GetStudyId(),
+                                                          fatherAlgo->GetGen() );
+      if ( helper &&
+           algo->myProxyMesh &&
+           algo->myProxyMesh->GetMesh() != helper->GetMesh() )
+        algo->myProxyMesh.reset( new SMESH_ProxyMesh( *helper->GetMesh() ));
+
+      algo->myQuadStruct.reset();
+
+      if ( helper )
+        algo->_quadraticMesh = helper->GetIsQuadratic();
+
+      return algo;
+    }
+  };
+  //=======================================================================
+  /*!
+   * \brief Algorithm projecting 1D mesh
+   */
+  struct TProjction1dAlgo : public StdMeshers_Projection_1D
+  {
+    StdMeshers_ProjectionSource1D myHyp;
+
+    TProjction1dAlgo(int studyId, SMESH_Gen* gen)
+      : StdMeshers_Projection_1D( gen->GetANewId(), studyId, gen),
+        myHyp( gen->GetANewId(), studyId, gen)
+    {
+      StdMeshers_Projection_1D::_sourceHypo = & myHyp;
+    }
+    static TProjction1dAlgo* instance( SMESH_Algo* fatherAlgo )
+    {
+      static TProjction1dAlgo* algo = new TProjction1dAlgo( fatherAlgo->GetStudyId(),
+                                                            fatherAlgo->GetGen() );
+      return algo;
+    }
+  };
+  //=======================================================================
+  /*!
+   * \brief Algorithm projecting 2D mesh
+   */
+  struct TProjction2dAlgo : public StdMeshers_Projection_1D2D
+  {
+    StdMeshers_ProjectionSource2D myHyp;
+
+    TProjction2dAlgo(int studyId, SMESH_Gen* gen)
+      : StdMeshers_Projection_1D2D( gen->GetANewId(), studyId, gen),
+        myHyp( gen->GetANewId(), studyId, gen)
+    {
+      StdMeshers_Projection_2D::_sourceHypo = & myHyp;
+    }
+    static TProjction2dAlgo* instance( SMESH_Algo* fatherAlgo )
+    {
+      static TProjction2dAlgo* algo = new TProjction2dAlgo( fatherAlgo->GetStudyId(),
+                                                            fatherAlgo->GetGen() );
+      return algo;
+    }
+  };
+
+  //================================================================================
+  /*!
+   * \brief Make \a botE be the BOTTOM_SIDE of \a quad.
+   *        Return false if the BOTTOM_SIDE is composite
+   */
+  //================================================================================
+
+  bool setBottomEdge( const TopoDS_Edge&   botE,
+                      faceQuadStruct::Ptr& quad,
+                      const TopoDS_Shape&  face)
+  {
+    quad->side[ QUAD_TOP_SIDE  ]->Reverse();
+    quad->side[ QUAD_LEFT_SIDE ]->Reverse();
+    int edgeIndex = 0;
+    for ( size_t i = 0; i < quad->side.size(); ++i )
+    {
+      StdMeshers_FaceSide* quadSide = quad->side[i];
+      for ( int iE = 0; iE < quadSide->NbEdges(); ++iE )
+        if ( botE.IsSame( quadSide->Edge( iE )))
+        {
+          if ( quadSide->NbEdges() > 1 )
+            return false;
+          edgeIndex = i;
+          i = quad->side.size(); // to quit from the outer loop
+          break;
+        }
+    }
+    if ( edgeIndex != QUAD_BOTTOM_SIDE )
+      quad->shift( quad->side.size() - edgeIndex, /*keepUnitOri=*/false );
+
+    quad->face = TopoDS::Face( face );
+
+    return true;
+  }
+
   //================================================================================
   /*!
    * \brief Return iterator pointing to node column for the given parameter
@@ -216,92 +332,40 @@ namespace {
 
   //================================================================================
   /*!
-   * \brief Removes submeshes meshed with regular grid from given list
+   * \brief Removes submeshes that are or can be meshed with regular grid from given list
    *  \retval int - nb of removed submeshes
    */
   //================================================================================
 
-  int removeQuasiQuads(list< SMESH_subMesh* >& notQuadSubMesh)
+  int removeQuasiQuads(list< SMESH_subMesh* >&   notQuadSubMesh,
+                       SMESH_MesherHelper*       helper,
+                       StdMeshers_Quadrangle_2D* quadAlgo)
   {
-    int oldNbSM = notQuadSubMesh.size();
-    SMESHDS_Mesh* mesh = notQuadSubMesh.front()->GetFather()->GetMeshDS();
+    int nbRemoved = 0;
+    //SMESHDS_Mesh* mesh = notQuadSubMesh.front()->GetFather()->GetMeshDS();
     list< SMESH_subMesh* >::iterator smIt = notQuadSubMesh.begin();
-#define __NEXT_SM { ++smIt; continue; }
     while ( smIt != notQuadSubMesh.end() )
     {
       SMESH_subMesh* faceSm = *smIt;
       SMESHDS_SubMesh* faceSmDS = faceSm->GetSubMeshDS();
-      int nbQuads = faceSmDS->NbElements();
-      if ( nbQuads == 0 ) __NEXT_SM;
-
-      // get oredered edges
-      list< TopoDS_Edge > orderedEdges;
-      list< int >         nbEdgesInWires;
-      TopoDS_Vertex       V000;
-      int nbWires = SMESH_Block::GetOrderedEdges( TopoDS::Face( faceSm->GetSubShape() ),
-                                                  V000, orderedEdges, nbEdgesInWires );
-      if ( nbWires != 1 || nbEdgesInWires.front() <= 4 )
-        __NEXT_SM;
-
-      // get nb of segements on edges
-      list<int> nbSegOnEdge;
-      list< TopoDS_Edge >::iterator edge = orderedEdges.begin();
-      for ( ; edge != orderedEdges.end(); ++edge )
-      {
-        if ( SMESHDS_SubMesh* edgeSmDS = mesh->MeshElements( *edge ))
-          nbSegOnEdge.push_back( edgeSmDS->NbElements() );
-        else
-          nbSegOnEdge.push_back(0);
-      }
-
-      // unite nbSegOnEdge of continues edges
-      int nbEdges = nbEdgesInWires.front();
-      list<int>::iterator nbSegIt = nbSegOnEdge.begin();
-      for ( edge = orderedEdges.begin(); edge != orderedEdges.end(); )
-      {
-        const TopoDS_Edge& e1 = *edge++;
-        const TopoDS_Edge& e2 = ( edge == orderedEdges.end() ? orderedEdges.front() : *edge );
-        if ( SMESH_Algo::IsContinuous( e1, e2 ))
-        {
-          // common vertex of continues edges must be shared by two 2D mesh elems of geom face
-          TopoDS_Vertex vCommon = TopExp::LastVertex( e1, true );
-          const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( vCommon, mesh );
-          int nbF = 0;
-          if ( vNode )
-          {
-            SMDS_ElemIteratorPtr fIt = vNode->GetInverseElementIterator(SMDSAbs_Face);
-            while ( fIt->more() )
-              nbF += faceSmDS->Contains( fIt->next() );
-          }
-          list<int>::iterator nbSegIt1 = nbSegIt++;
-          if ( !vNode || nbF == 2 ) // !vNode - two edges can be meshed as one
-          {
-            // unite
-            if ( nbSegIt == nbSegOnEdge.end() ) nbSegIt = nbSegOnEdge.begin();
-            *nbSegIt += *nbSegIt1;
-            nbSegOnEdge.erase( nbSegIt1 );
-            --nbEdges;
-          }
-        }
-        else
-        {
-          ++nbSegIt;
-        }
-      }
-      vector<int> nbSegVec( nbSegOnEdge.begin(), nbSegOnEdge.end());
-      if ( nbSegVec.size() == 4 &&
-           nbSegVec[0] == nbSegVec[2] &&
-           nbSegVec[1] == nbSegVec[3] &&
-           nbSegVec[0] * nbSegVec[1] == nbQuads
-           )
+      int nbQuads = faceSmDS ? faceSmDS->NbElements() : 0;
+      bool toRemove;
+      if ( nbQuads > 0 )
+        toRemove = helper->IsStructured( faceSm );
+      else
+        toRemove = quadAlgo->CheckNbEdges( *helper->GetMesh(),
+                                           faceSm->GetSubShape() );
+      nbRemoved += toRemove;
+      if ( toRemove )
         smIt = notQuadSubMesh.erase( smIt );
       else
-        __NEXT_SM;
+        ++smIt;
     }
 
-    return oldNbSM - notQuadSubMesh.size();
+    return nbRemoved;
   }
-}
+
+} // namespace
 
 //=======================================================================
 //function : StdMeshers_Prism_3D
@@ -311,9 +375,16 @@ namespace {
 StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, int studyId, SMESH_Gen* gen)
   :SMESH_3D_Algo(hypId, studyId, gen)
 {
-  _name = "Prism_3D";
-  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);       // 1 bit per shape type
-  myProjectTriangles = false;
+  _name                    = "Prism_3D";
+  _shapeType               = (1 << TopAbs_SOLID); // 1 bit per shape type
+  _onlyUnaryInput          = false; // accept all SOLIDs at once
+  _requireDiscreteBoundary = false; // mesh FACEs and EDGEs by myself
+  _supportSubmeshes        = true;  // "source" FACE must be meshed by other algo
+  _neededLowerHyps[ 1 ]    = true;  // suppress warning on hiding a global 1D algo
+  _neededLowerHyps[ 2 ]    = true;  // suppress warning on hiding a global 2D algo
+
+  //myProjectTriangles       = false;
+  mySetErrorToSM           = true;  // to pass an error to a sub-mesh of a current solid or not
 }
 
 //================================================================================
@@ -374,7 +445,7 @@ bool StdMeshers_Prism_3D::CheckHypothesis(SMESH_Mesh&                          a
 
 //=======================================================================
 //function : Compute
-//purpose  : 
+//purpose  : Compute mesh on a COMPOUND of SOLIDs
 //=======================================================================
 
 bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape)
@@ -382,15 +453,388 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
   SMESH_MesherHelper helper( theMesh );
   myHelper = &helper;
 
-  myHelper->IsQuadraticSubMesh( theShape );
+  int nbSolids = helper.Count( theShape, TopAbs_SOLID, /*skipSame=*/false );
+  if ( nbSolids < 1 )
+    return true;
+
+  Prism_3D::TPrismTopo prism;
+
+  if ( nbSolids == 1 )
+  {
+    return ( initPrism( prism, TopExp_Explorer( theShape, TopAbs_SOLID ).Current() ) &&
+             compute( prism ));
+  }
+
+  TopTools_IndexedDataMapOfShapeListOfShape faceToSolids;
+  TopExp::MapShapesAndAncestors( theShape, TopAbs_FACE, TopAbs_SOLID, faceToSolids );
+
+  // look for meshed FACEs ("source" FACEs) that must be prism bottoms
+  list< TopoDS_Face > meshedFaces;//, notQuadMeshedFaces, notQuadFaces;
+  const bool meshHasQuads = ( theMesh.NbQuadrangles() > 0 );
+  for ( int iF = 1; iF < faceToSolids.Extent(); ++iF )
+  {
+    const TopoDS_Face& face = TopoDS::Face( faceToSolids.FindKey( iF ));
+    SMESH_subMesh*   faceSM = theMesh.GetSubMesh( face );
+    if ( !faceSM->IsEmpty() )
+    {
+      if ( !meshHasQuads ||
+           !helper.IsSameElemGeometry( faceSM->GetSubMeshDS(), SMDSGeom_QUADRANGLE ) ||
+           !helper.IsStructured( faceSM ))
+        // notQuadMeshedFaces are of higher priority
+        meshedFaces.push_front( face );
+      else
+        meshedFaces.push_back( face );
+    }
+  }
+  //meshedFaces.splice( meshedFaces.begin(), notQuadMeshedFaces );
+
+  // if ( meshedFaces.empty() )
+  //   return error( COMPERR_BAD_INPUT_MESH, "No meshed source faces found" );
+
+  TopTools_MapOfShape meshedSolids;
+  list< Prism_3D::TPrismTopo > meshedPrism;
+  TopTools_ListIteratorOfListOfShape solidIt;
 
-  // Analyse mesh and geomerty to find block sub-shapes and submeshes
-  if ( !myBlock.Init( myHelper, theShape ))
-    return error( myBlock.GetError());
+  while ( meshedSolids.Extent() < nbSolids )
+  {
+    if ( _computeCanceled )
+      return toSM( error( SMESH_ComputeError::New(COMPERR_CANCELED)));
 
-  SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
+    // compute prisms having avident computed source FACE
+    while ( !meshedFaces.empty() )
+    {
+      TopoDS_Face face = meshedFaces.front();
+      meshedFaces.pop_front();
+      TopTools_ListOfShape& solidList = faceToSolids.ChangeFromKey( face );
+      while ( !solidList.IsEmpty() )
+      {
+        TopoDS_Shape solid = solidList.First();
+        solidList.RemoveFirst();
+        if ( meshedSolids.Add( solid ))
+        {
+          prism.Clear();
+          prism.myBottom = face;
+          if ( !initPrism( prism, solid ) ||
+               !compute( prism ))
+            return false;
 
-  int volumeID = meshDS->ShapeToIndex( theShape );
+          meshedFaces.push_front( prism.myTop );
+          meshedPrism.push_back( prism );
+        }
+      }
+    }
+    if ( meshedSolids.Extent() == nbSolids )
+      break;
+
+    // below in the loop we try to find source FACEs somehow
+
+    // project mesh from source FACEs of computed prisms to
+    // prisms sharing wall FACEs
+    list< Prism_3D::TPrismTopo >::iterator prismIt = meshedPrism.begin();
+    for ( ; prismIt != meshedPrism.end(); ++prismIt )
+    {
+      for ( size_t iW = 0; iW < prismIt->myWallQuads.size(); ++iW )
+      {
+        Prism_3D::TQuadList::iterator wQuad = prismIt->myWallQuads[iW].begin();
+        for ( ; wQuad != prismIt->myWallQuads[iW].end(); ++ wQuad )
+        {
+          const TopoDS_Face& wFace = (*wQuad)->face;
+          TopTools_ListOfShape& solidList = faceToSolids.ChangeFromKey( wFace );
+          solidIt.Initialize( solidList );
+          while ( solidIt.More() )
+          {
+            const TopoDS_Shape& solid = solidIt.Value();
+            if ( meshedSolids.Contains( solid )) {
+              solidList.Remove( solidIt );
+              continue; // already computed prism
+            }
+            // find a source FACE of the SOLID: it's a FACE sharing a bottom EDGE with wFace
+            const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ]->Edge(0);
+            PShapeIteratorPtr faceIt = myHelper->GetAncestors( wEdge, *myHelper->GetMesh(),
+                                                               TopAbs_FACE);
+            while ( const TopoDS_Shape* f = faceIt->next() )
+            {
+              const TopoDS_Face& candidateF = TopoDS::Face( *f );
+              prism.Clear();
+              prism.myBottom  = candidateF;
+              mySetErrorToSM = false;
+              if ( !myHelper->IsSubShape( candidateF, prismIt->myShape3D ) &&
+                   !myHelper->GetMesh()->GetSubMesh( candidateF )->IsMeshComputed() &&
+                   initPrism( prism, solid ) &&
+                   project2dMesh( prismIt->myBottom, candidateF))
+              {
+                mySetErrorToSM = true;
+                if ( !compute( prism ))
+                  return false;
+                meshedFaces.push_front( prism.myTop );
+                meshedFaces.push_front( prism.myBottom );
+                meshedPrism.push_back( prism );
+                meshedSolids.Add( solid );
+              }
+              InitComputeError();
+            }
+            mySetErrorToSM = true;
+            InitComputeError();
+            if ( meshedSolids.Contains( solid ))
+              solidList.Remove( solidIt );
+            else
+              solidIt.Next();
+          }
+        }
+      }
+      if ( !meshedFaces.empty() )
+        break; // to compute prisms with avident sources
+    }
+
+    // find FACEs with local 1D hyps, which has to be computed by now,
+    // or at least any computed FACEs
+    for ( int iF = 1; ( meshedFaces.empty() && iF < faceToSolids.Extent() ); ++iF )
+    {
+      const TopoDS_Face&               face = TopoDS::Face( faceToSolids.FindKey( iF ));
+      const TopTools_ListOfShape& solidList = faceToSolids.FindFromKey( face );
+      if ( solidList.IsEmpty() ) continue;
+      SMESH_subMesh*                 faceSM = theMesh.GetSubMesh( face );
+      if ( !faceSM->IsEmpty() )
+      {
+        meshedFaces.push_back( face ); // lower priority
+      }
+      else
+      {
+        bool allSubMeComputed = true;
+        SMESH_subMeshIteratorPtr smIt = faceSM->getDependsOnIterator(false,true);
+        while ( smIt->more() && allSubMeComputed )
+          allSubMeComputed = smIt->next()->IsMeshComputed();
+        if ( allSubMeComputed )
+        {
+          faceSM->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+          if ( !faceSM->IsEmpty() )
+            meshedFaces.push_front( face ); // higher priority
+          else
+            faceSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+        }
+      }
+    }
+
+
+    // TODO. there are other ways to find out the source FACE:
+    // propagation, topological similarity, ect.
+
+
+    if ( meshedFaces.empty() ) // set same error to 10 not-computed solids
+    {
+      SMESH_ComputeErrorPtr err = SMESH_ComputeError::New
+        ( COMPERR_BAD_INPUT_MESH, "No meshed source face found", this );
+
+      const int maxNbErrors = 10; // limit nb errors not to overload the Compute dialog
+      TopExp_Explorer solid( theShape, TopAbs_SOLID );
+      for ( int i = 0; ( i < maxNbErrors && solid.More() ); ++i, solid.Next() )
+        if ( !meshedSolids.Contains( solid.Current() ))
+        {
+          SMESH_subMesh* sm = theMesh.GetSubMesh( solid.Current() );
+          sm->GetComputeError() = err;
+        }
+      return false;
+    }
+  }
+  return true;
+}
+
+//================================================================================
+/*!
+ * \brief Find wall faces by bottom edges
+ */
+//================================================================================
+
+bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism,
+                                        const int              totalNbFaces)
+{
+  thePrism.myWallQuads.clear();
+
+  SMESH_Mesh* mesh = myHelper->GetMesh();
+
+  StdMeshers_Quadrangle_2D* quadAlgo = TQuadrangleAlgo::instance( this, myHelper );
+
+  TopTools_MapOfShape faceMap;
+  TopTools_IndexedDataMapOfShapeListOfShape edgeToFaces;   
+  TopExp::MapShapesAndAncestors( thePrism.myShape3D,
+                                 TopAbs_EDGE, TopAbs_FACE, edgeToFaces );
+
+  // ------------------------------
+  // Get the 1st row of wall FACEs
+  // ------------------------------
+
+  list< TopoDS_Edge >::iterator edge = thePrism.myBottomEdges.begin();
+  std::list< int >::iterator     nbE = thePrism.myNbEdgesInWires.begin();
+  int iE = 0;
+  while ( edge != thePrism.myBottomEdges.end() )
+  {
+    ++iE;
+    if ( BRep_Tool::Degenerated( *edge ))
+    {
+      edge = thePrism.myBottomEdges.erase( edge );
+      --iE;
+      --(*nbE);
+    }
+    else
+    {
+      TopTools_ListIteratorOfListOfShape faceIt( edgeToFaces.FindFromKey( *edge ));
+      for ( ; faceIt.More(); faceIt.Next() )
+      {
+        const TopoDS_Face& face = TopoDS::Face( faceIt.Value() );
+        if ( !thePrism.myBottom.IsSame( face ))
+        {
+          Prism_3D::TQuadList quadList( 1, quadAlgo->CheckNbEdges( *mesh, face ));
+          if ( !quadList.back() )
+            return toSM( error(TCom("Side face #") << shapeID( face )
+                               << " not meshable with quadrangles"));
+          if ( ! setBottomEdge( *edge, quadList.back(), face ))
+            return toSM( error(TCom("Composite 'horizontal' edges are not supported")));
+          thePrism.myWallQuads.push_back( quadList );
+          faceMap.Add( face );
+          break;
+        }
+      }
+      ++edge;
+    }
+    if ( iE == *nbE )
+    {
+      iE = 0;
+      ++nbE;
+    }
+  }
+
+  // -------------------------
+  // Find the rest wall FACEs
+  // -------------------------
+
+  // Compose a vector of indixes of right neighbour FACE for each wall FACE
+  // that is not so evident in case of several WIREs
+  thePrism.myRightQuadIndex.clear();
+  for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
+    thePrism.myRightQuadIndex.push_back( i+1 );
+  list< int >::iterator nbEinW = thePrism.myNbEdgesInWires.begin();
+  for ( int iLeft = 0; nbEinW != thePrism.myNbEdgesInWires.end(); ++nbEinW )
+  {
+    thePrism.myRightQuadIndex[ iLeft + *nbEinW - 1 ] = iLeft; // 1st EDGE index of a current WIRE
+    iLeft += *nbEinW;
+  }
+
+  while ( totalNbFaces - faceMap.Extent() > 2 )
+  {
+    // find wall FACEs adjacent to each of wallQuads by the right side EDGE
+    int nbKnownFaces;
+    do {
+      nbKnownFaces = faceMap.Extent();
+      StdMeshers_FaceSide *rightSide, *topSide; // sides of the quad
+      for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
+      {
+        rightSide = thePrism.myWallQuads[i].back()->side[ QUAD_RIGHT_SIDE ];
+        for ( int iE = 0; iE < rightSide->NbEdges(); ++iE ) // rightSide can be composite
+        {
+          const TopoDS_Edge & rightE = rightSide->Edge( iE );
+          TopTools_ListIteratorOfListOfShape face( edgeToFaces.FindFromKey( rightE ));
+          for ( ; face.More(); face.Next() )
+            if ( faceMap.Add( face.Value() ))
+            {
+              // a new wall FACE encountered, store it in thePrism.myWallQuads
+              const int iRight = thePrism.myRightQuadIndex[i];
+              topSide = thePrism.myWallQuads[ iRight ].back()->side[ QUAD_TOP_SIDE ];
+              const TopoDS_Edge&   newBotE = topSide->Edge(0);
+              const TopoDS_Shape& newWallF = face.Value();
+              thePrism.myWallQuads[ iRight ].push_back( quadAlgo->CheckNbEdges( *mesh, newWallF ));
+              if ( !thePrism.myWallQuads[ iRight ].back() )
+                return toSM( error(TCom("Side face #") << shapeID( newWallF ) <<
+                                   " not meshable with quadrangles"));
+              if ( ! setBottomEdge( newBotE, thePrism.myWallQuads[ iRight ].back(), newWallF ))
+                return toSM( error(TCom("Composite 'horizontal' edges are not supported")));
+            }
+        }
+      }
+    } while ( nbKnownFaces != faceMap.Extent() );
+
+    // find wall FACEs adjacent to each of thePrism.myWallQuads by the top side EDGE
+    if ( totalNbFaces - faceMap.Extent() > 2 )
+    {
+      for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
+      {
+        StdMeshers_FaceSide* topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ];
+        const TopoDS_Edge &     topE = topSide->Edge( 0 );
+        if ( topSide->NbEdges() > 1 )
+          return toSM( error(COMPERR_BAD_SHAPE, TCom("Side face #") <<
+                             shapeID( thePrism.myWallQuads[i].back()->face )
+                             << " has a composite top edge"));
+        TopTools_ListIteratorOfListOfShape faceIt( edgeToFaces.FindFromKey( topE ));
+        for ( ; faceIt.More(); faceIt.Next() )
+          if ( faceMap.Add( faceIt.Value() ))
+          {
+            // a new wall FACE encountered, store it in wallQuads
+            thePrism.myWallQuads[ i ].push_back( quadAlgo->CheckNbEdges( *mesh, faceIt.Value() ));
+            if ( !thePrism.myWallQuads[ i ].back() )
+              return toSM( error(TCom("Side face #") << shapeID( faceIt.Value() ) <<
+                                 " not meshable with quadrangles"));
+            if ( ! setBottomEdge( topE, thePrism.myWallQuads[ i ].back(), faceIt.Value() ))
+              return toSM( error(TCom("Composite 'horizontal' edges are not supported")));
+            if ( totalNbFaces - faceMap.Extent() == 2 )
+            {
+              i = thePrism.myWallQuads.size(); // to quit from the outer loop
+              break;
+            }
+          }
+      }
+    }
+  } // while ( totalNbFaces - faceMap.Extent() > 2 )
+
+  // ------------------
+  // Find the top FACE
+  // ------------------
+
+  if ( thePrism.myTop.IsNull() )
+  {
+    // now only top and bottom FACEs are not in the faceMap
+    faceMap.Add( thePrism.myBottom );
+    for ( TopExp_Explorer f( thePrism.myShape3D, TopAbs_FACE );f.More(); f.Next() )
+      if ( !faceMap.Contains( f.Current() )) {
+        thePrism.myTop = TopoDS::Face( f.Current() );
+        break;
+      }
+    if ( thePrism.myTop.IsNull() )
+      return toSM( error("Top face not found"));
+  }
+
+  // Check that the top FACE shares all the top EDGEs
+  for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
+  {
+    StdMeshers_FaceSide* topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ];
+    const TopoDS_Edge &     topE = topSide->Edge( 0 );
+    if ( !myHelper->IsSubShape( topE, thePrism.myTop ))
+      return toSM( error( TCom("Wrong source face (#") << shapeID( thePrism.myBottom )));
+  }
+
+  return true;
+}
+
+//=======================================================================
+//function : compute
+//purpose  : Compute mesh on a SOLID
+//=======================================================================
+
+bool StdMeshers_Prism_3D::compute(const Prism_3D::TPrismTopo& thePrism)
+{
+  myHelper->IsQuadraticSubMesh( thePrism.myShape3D );
+  if ( _computeCanceled )
+    return toSM( error( SMESH_ComputeError::New(COMPERR_CANCELED)));
+
+  // Make all side FACEs of thePrism meshed with quads
+  if ( !computeWalls( thePrism ))
+    return false;
+
+  // Analyse mesh and geometry to find block sub-shapes and submeshes
+  if ( !myBlock.Init( myHelper, thePrism ))
+    return toSM( error( myBlock.GetError()));
+
+  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+
+  int volumeID = meshDS->ShapeToIndex( thePrism.myShape3D );
 
 
   // To compute coordinates of a node inside a block, it is necessary to know
@@ -415,13 +859,13 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
 
   // try to use transformation (issue 0020680)
   vector<gp_Trsf> trsf;
-  if ( myBlock.GetLayersTransformation(trsf))
+  if ( myBlock.GetLayersTransformation( trsf, thePrism ))
   {
     // loop on nodes inside the bottom face
     TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin();
     for ( ; bot_column != myBotToColumnMap.end(); ++bot_column )
     {
-      const TNode& tBotNode = bot_column->first; // bottom TNode
+      const Prism_3D::TNode& tBotNode = bot_column->first; // bottom TNode
       if ( tBotNode.GetPositionType() != SMDS_TOP_FACE )
         continue; // node is not inside face 
 
@@ -443,11 +887,11 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
   else // use block approach
   {
     // loop on nodes inside the bottom face
-    TNode prevBNode;
+    Prism_3D::TNode prevBNode;
     TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin();
     for ( ; bot_column != myBotToColumnMap.end(); ++bot_column )
     {
-      const TNode& tBotNode = bot_column->first; // bottom TNode
+      const Prism_3D::TNode& tBotNode = bot_column->first; // bottom TNode
       if ( tBotNode.GetPositionType() != SMDS_TOP_FACE )
         continue; // node is not inside face 
 
@@ -460,9 +904,9 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
         paramHint = prevBNode.GetParams();
       if ( !myBlock.ComputeParameters( tBotNode.GetCoords(), tBotNode.ChangeParams(),
                                        ID_BOT_FACE, paramHint ))
-        return error(TCom("Can't compute normalized parameters for node ")
-                     << tBotNode.myNode->GetID() << " on the face #"
-                     << myBlock.SubMesh( ID_BOT_FACE )->GetId() );
+        return toSM( error(TCom("Can't compute normalized parameters for node ")
+                           << tBotNode.myNode->GetID() << " on the face #"
+                           << myBlock.SubMesh( ID_BOT_FACE )->GetId() ));
       prevBNode = tBotNode;
 
       myShapeXYZ[ ID_BOT_FACE ] = tBotNode.GetCoords();
@@ -475,9 +919,9 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
       if ( column.size() > 2 ) {
         gp_Pnt topCoords = myShapeXYZ[ ID_TOP_FACE ];
         if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE, topParams ))
-          return error(TCom("Can't compute normalized parameters ")
-                       << "for node " << column.back()->GetID()
-                       << " on the face #"<< column.back()->getshapeId() );
+          return toSM( error(TCom("Can't compute normalized parameters ")
+                             << "for node " << column.back()->GetID()
+                             << " on the face #"<< column.back()->getshapeId() ));
       }
 
       // vertical loop
@@ -504,7 +948,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
         // compute coords for a new node
         gp_XYZ coords;
         if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords ))
-          return error("Can't compute coordinates by normalized parameters");
+          return toSM( error("Can't compute coordinates by normalized parameters"));
 
         SHOWYXZ("TOPFacePoint ",myShapeXYZ[ ID_TOP_FACE]);
         SHOWYXZ("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode));
@@ -520,7 +964,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
   // Create volumes
 
   SMESHDS_SubMesh* smDS = myBlock.SubMeshDS( ID_BOT_FACE );
-  if ( !smDS ) return error(COMPERR_BAD_INPUT_MESH, "Null submesh");
+  if ( !smDS ) return toSM( error(COMPERR_BAD_INPUT_MESH, "Null submesh"));
 
   // loop on bottom mesh faces
   SMDS_ElemIteratorPtr faceIt = smDS->GetElements();
@@ -529,11 +973,9 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
     const SMDS_MeshElement* face = faceIt->next();
     if ( !face || face->GetType() != SMDSAbs_Face )
       continue;
-    int nbNodes = face->NbNodes();
-    if ( face->IsQuadratic() )
-      nbNodes /= 2;
 
     // find node columns for each node
+    int nbNodes = face->NbCornerNodes();
     vector< const TNodeColumn* > columns( nbNodes );
     for ( int i = 0; i < nbNodes; ++i )
     {
@@ -541,13 +983,13 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
       if ( n->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) {
         TNode2ColumnMap::iterator bot_column = myBotToColumnMap.find( n );
         if ( bot_column == myBotToColumnMap.end() )
-          return error(TCom("No nodes found above node ") << n->GetID() );
+          return toSM( error(TCom("No nodes found above node ") << n->GetID() ));
         columns[ i ] = & bot_column->second;
       }
       else {
         columns[ i ] = myBlock.GetNodeColumn( n );
         if ( !columns[ i ] )
-          return error(TCom("No side nodes found above node ") << n->GetID() );
+          return toSM( error(TCom("No side nodes found above node ") << n->GetID() ));
       }
     }
     // create prisms
@@ -562,16 +1004,275 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
   return true;
 }
 
+//=======================================================================
+//function : computeWalls
+//purpose  : Compute 2D mesh on walls FACEs of a prism
+//=======================================================================
+
+bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
+{
+  SMESH_Mesh*     mesh = myHelper->GetMesh();
+  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+
+  TProjction1dAlgo* projector1D = TProjction1dAlgo::instance( this );
+  StdMeshers_Quadrangle_2D* quadAlgo = TQuadrangleAlgo::instance( this, myHelper );
+
+  SMESH_HypoFilter hyp1dFilter( SMESH_HypoFilter::IsAlgo(),/*not=*/true);
+  hyp1dFilter.And( SMESH_HypoFilter::HasDim( 1 ));
+  hyp1dFilter.And( SMESH_HypoFilter::IsMoreLocalThan( thePrism.myShape3D, *mesh ));
+
+  // Discretize equally 'vertical' EDGEs
+  // -----------------------------------
+  // find source FACE sides for projection: either already computed ones or
+  // the 'most composite' ones
+  multimap< int, int > wgt2quad;
+  for ( size_t iW = 0; iW != thePrism.myWallQuads.size(); ++iW )
+  {
+    Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[iW].begin();
+    int wgt = 0; // "weight"
+    for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad )
+    {
+      StdMeshers_FaceSide* lftSide = (*quad)->side[ QUAD_LEFT_SIDE ];
+      for ( int i = 0; i < lftSide->NbEdges(); ++i )
+      {
+        ++wgt;
+        const TopoDS_Edge& E = lftSide->Edge(i);
+        if ( mesh->GetSubMesh( E )->IsMeshComputed() )
+          wgt += 10;
+        else if ( mesh->GetHypothesis( E, hyp1dFilter, true )) // local hypothesis!
+          wgt += 100;
+      }
+    }
+    wgt2quad.insert( make_pair( wgt, iW ));
+
+    // in quadratic mesh, pass ignoreMediumNodes to quad sides
+    if ( myHelper->GetIsQuadratic() )
+    {
+      quad = thePrism.myWallQuads[iW].begin();
+      for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad )
+        for ( int i = 0; i < NB_QUAD_SIDES; ++i )
+          (*quad)->side[ i ]->SetIgnoreMediumNodes( true );
+    }
+  }
+
+  // Project 'vertical' EDGEs, from left to right
+  multimap< int, int >::reverse_iterator w2q = wgt2quad.rbegin();
+  for ( ; w2q != wgt2quad.rend(); ++w2q )
+  {
+    const int iW = w2q->second;
+    const Prism_3D::TQuadList&         quads = thePrism.myWallQuads[ iW ];
+    Prism_3D::TQuadList::const_iterator quad = quads.begin();
+    for ( ; quad != quads.end(); ++quad )
+    {
+      StdMeshers_FaceSide* rgtSide = (*quad)->side[ QUAD_RIGHT_SIDE ]; // tgt
+      StdMeshers_FaceSide* lftSide = (*quad)->side[ QUAD_LEFT_SIDE ];  // src
+      bool swapLeftRight = ( lftSide->NbSegments( /*update=*/true ) == 0 &&
+                             rgtSide->NbSegments( /*update=*/true )  > 0 );
+      if ( swapLeftRight )
+        std::swap( lftSide, rgtSide );
+
+      // assure that all the source (left) EDGEs are meshed
+      int nbSrcSegments = 0;
+      for ( int i = 0; i < lftSide->NbEdges(); ++i )
+      {
+        const TopoDS_Edge& srcE = lftSide->Edge(i);
+        SMESH_subMesh*    srcSM = mesh->GetSubMesh( srcE );
+        if ( !srcSM->IsMeshComputed() ) {
+          srcSM->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
+          srcSM->ComputeStateEngine       ( SMESH_subMesh::COMPUTE );
+          if ( !srcSM->IsMeshComputed() )
+            return false;
+        }
+        nbSrcSegments += srcSM->GetSubMeshDS()->NbElements();
+      }
+      // check target EDGEs
+      int nbTgtMeshed = 0, nbTgtSegments = 0;
+      vector< bool > isTgtEdgeComputed( rgtSide->NbEdges() );
+      for ( int i = 0; i < rgtSide->NbEdges(); ++i )
+      {
+        const TopoDS_Edge& tgtE = rgtSide->Edge(i);
+        SMESH_subMesh*    tgtSM = mesh->GetSubMesh( tgtE );
+        if (( isTgtEdgeComputed[ i ] = tgtSM->IsMeshComputed() )) {
+          ++nbTgtMeshed;
+          nbTgtSegments += tgtSM->GetSubMeshDS()->NbElements();
+        }
+      }
+      if ( rgtSide->NbEdges() == nbTgtMeshed ) // all tgt EDGEs meshed
+      {
+        if ( nbTgtSegments != nbSrcSegments )
+        {
+          for ( int i = 0; i < lftSide->NbEdges(); ++i )
+            addBadInputElements( meshDS->MeshElements( lftSide->Edge( i )));
+          for ( int i = 0; i < rgtSide->NbEdges(); ++i )
+            addBadInputElements( meshDS->MeshElements( rgtSide->Edge( i )));
+          return toSM( error( TCom("Different nb of segment on logically vertical edges #")
+                              << shapeID( lftSide->Edge(0) ) << " and #"
+                              << shapeID( rgtSide->Edge(0) ) << ": "
+                              << nbSrcSegments << " != " << nbTgtSegments ));
+        }
+        continue;
+      }
+      // Compute
+      if ( nbTgtMeshed == 0 )
+      {
+        // compute nodes on target VERTEXes
+        const UVPtStructVec&  srcNodeStr = lftSide->GetUVPtStruct();
+        if ( srcNodeStr.size() == 0 )
+          return toSM( error( TCom("Invalid node positions on edge #") <<
+                              shapeID( lftSide->Edge(0) )));
+        vector< SMDS_MeshNode* > newNodes( srcNodeStr.size() );
+        for ( int is2ndV = 0; is2ndV < 2; ++is2ndV )
+        {
+          const TopoDS_Edge& E = rgtSide->Edge( is2ndV ? rgtSide->NbEdges()-1 : 0 );
+          TopoDS_Vertex      v = myHelper->IthVertex( is2ndV, E );
+          mesh->GetSubMesh( v )->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+          const SMDS_MeshNode* n = SMESH_Algo::VertexNode( v, meshDS );
+          newNodes[ is2ndV ? 0 : newNodes.size()-1 ] = (SMDS_MeshNode*) n;
+        }
+
+        // compute nodes on target EDGEs
+        rgtSide->Reverse(); // direct it same as the lftSide
+        myHelper->SetElementsOnShape( false );
+        TopoDS_Edge tgtEdge;
+        for ( size_t iN = 1; iN < srcNodeStr.size()-1; ++iN ) // add nodes
+        {
+          gp_Pnt       p = rgtSide->Value3d  ( srcNodeStr[ iN ].normParam );
+          double       u = rgtSide->Parameter( srcNodeStr[ iN ].normParam, tgtEdge );
+          newNodes[ iN ] = meshDS->AddNode( p.X(), p.Y(), p.Z() );
+          meshDS->SetNodeOnEdge( newNodes[ iN ], tgtEdge, u );
+        }
+        for ( size_t iN = 1; iN < srcNodeStr.size(); ++iN ) // add segments
+        {
+          SMDS_MeshElement* newEdge = myHelper->AddEdge( newNodes[ iN-1 ], newNodes[ iN ] );
+          std::pair<int, TopAbs_ShapeEnum> id2type = 
+            myHelper->GetMediumPos( newNodes[ iN-1 ], newNodes[ iN ] );
+          if ( id2type.second == TopAbs_EDGE )
+          {
+            meshDS->SetMeshElementOnShape( newEdge, id2type.first );
+          }
+          else // new nodes are on different EDGEs; put one of them on VERTEX
+          {
+            const int      edgeIndex = rgtSide->EdgeIndex( srcNodeStr[ iN-1 ].normParam );
+            const double vertexParam = rgtSide->LastParameter( edgeIndex );
+            const gp_Pnt           p = BRep_Tool::Pnt( rgtSide->LastVertex( edgeIndex ));
+            const int         isPrev = ( Abs( srcNodeStr[ iN-1 ].normParam - vertexParam ) <
+                                         Abs( srcNodeStr[ iN   ].normParam - vertexParam ));
+            meshDS->SetMeshElementOnShape( newEdge, newNodes[ iN-(1-isPrev) ]->getshapeId() );
+            meshDS->UnSetNodeOnShape( newNodes[ iN-isPrev ] );
+            meshDS->SetNodeOnVertex ( newNodes[ iN-isPrev ], rgtSide->LastVertex( edgeIndex ));
+            meshDS->MoveNode( newNodes[ iN-isPrev ], p.X(), p.Y(), p.Z() );
+          }
+        }
+        myHelper->SetElementsOnShape( true );
+        for ( int i = 0; i < rgtSide->NbEdges(); ++i ) // update state of sub-meshes
+        {
+          const TopoDS_Edge& E = rgtSide->Edge( i );
+          SMESH_subMesh* tgtSM = mesh->GetSubMesh( E );
+          tgtSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+        }
+
+        // to continue projection from the just computed side as a source
+        if ( !swapLeftRight && rgtSide->NbEdges() > 1 && w2q->second == iW )
+        {
+          std::pair<int,int> wgt2quadKeyVal( w2q->first + 1, thePrism.myRightQuadIndex[ iW ]);
+          wgt2quad.insert( wgt2quadKeyVal ); // it will be skipped by ++w2q
+          wgt2quad.insert( wgt2quadKeyVal );
+          w2q = wgt2quad.rbegin();
+        }
+      }
+      else
+      {
+        // HOPE assigned hypotheses are OK, so that equal nb of segments will be generated
+        //return toSM( error("Partial projection not implemented"));
+      }
+    } // loop on quads of a composite wall side
+  } // loop on the ordered wall sides
+
+
+
+  for ( size_t iW = 0; iW != thePrism.myWallQuads.size(); ++iW )
+  {
+    Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[iW].begin();
+    for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad )
+    {
+      // Top EDGEs must be projections from the bottom ones
+      // to compute stuctured quad mesh on wall FACEs
+      // ---------------------------------------------------
+      const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge(0);
+      const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE    ]->Edge(0);
+
+      projector1D->myHyp.SetSourceEdge( botE );
+
+      SMESH_subMesh* tgtEdgeSm = mesh->GetSubMesh( topE );
+      if ( !tgtEdgeSm->IsMeshComputed() )
+      {
+        // compute nodes on VERTEXes
+        tgtEdgeSm->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
+        // project segments
+        projector1D->InitComputeError();
+        bool ok = projector1D->Compute( *mesh, topE );
+        if ( !ok )
+        {
+          SMESH_ComputeErrorPtr err = projector1D->GetComputeError();
+          if ( err->IsOK() ) err->myName = COMPERR_ALGO_FAILED;
+          tgtEdgeSm->GetComputeError() = err;
+          return false;
+        }
+      }
+      tgtEdgeSm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+
+      // Compute quad mesh on wall FACEs
+      // -------------------------------
+      const TopoDS_Face& face = (*quad)->face;
+      SMESH_subMesh* fSM = mesh->GetSubMesh( face );
+      if ( ! fSM->IsMeshComputed() )
+      {
+        // make all EDGES meshed
+        fSM->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
+        if ( !fSM->SubMeshesComputed() )
+          return toSM( error( COMPERR_BAD_INPUT_MESH,
+                              "Not all edges have valid algorithm and hypothesis"));
+        // mesh the <face>
+        quadAlgo->InitComputeError();
+        bool ok = quadAlgo->Compute( *mesh, face );
+        fSM->GetComputeError() = quadAlgo->GetComputeError();
+        if ( !ok )
+          return false;
+        fSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+      }
+      if ( myHelper->GetIsQuadratic() )
+      {
+        // fill myHelper with medium nodes built by quadAlgo
+        SMDS_ElemIteratorPtr fIt = fSM->GetSubMeshDS()->GetElements();
+        while ( fIt->more() )
+          myHelper->AddTLinks( dynamic_cast<const SMDS_MeshFace*>( fIt->next() ));
+      }
+    }
+  }
+
+  return true;
+}
 
 //=======================================================================
 //function : Evaluate
 //purpose  : 
 //=======================================================================
 
-bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh,
+bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh&         theMesh,
                                    const TopoDS_Shape& theShape,
-                                   MapShapeNbElems& aResMap)
+                                   MapShapeNbElems&    aResMap)
 {
+  if ( theShape.ShapeType() == TopAbs_COMPOUND )
+  {
+    bool ok = true;
+    for ( TopoDS_Iterator it( theShape ); it.More(); it.Next() )
+      ok &= Evaluate( theMesh, it.Value(), aResMap );
+    return ok;
+  }
+  SMESH_MesherHelper helper( theMesh );
+  myHelper = &helper;
+  myHelper->SetSubShape( theShape );
+
   // find face contains only triangles
   vector < SMESH_subMesh * >meshFaces;
   TopTools_SequenceOfShape aFaces;
@@ -582,11 +1283,9 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh,
     SMESH_subMesh *aSubMesh = theMesh.GetSubMesh(exp.Current());
     meshFaces.push_back(aSubMesh);
     MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i-1]);
-    if( anIt==aResMap.end() ) {
-      SMESH_ComputeErrorPtr& smError = aSubMesh->GetComputeError();
-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
-      return false;
-    }
+    if( anIt==aResMap.end() )
+      return toSM( error( "Submesh can not be evaluated"));
+
     std::vector<int> aVec = (*anIt).second;
     int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
     int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
@@ -603,9 +1302,7 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh,
     for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
     SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
     aResMap.insert(std::make_pair(sm,aResVec));
-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
-    return false;
+    return toSM( error( "Submesh can not be evaluated" ));
   }
 
   if(NumBase==0) NumBase = 1; // only quads => set 1 faces as base
@@ -676,7 +1373,6 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh,
   return true;
 }
 
-
 //================================================================================
 /*!
  * \brief Create prisms
@@ -815,24 +1511,24 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
   SMESHDS_SubMesh * topSMDS = topSM->GetSubMeshDS();
 
   if ( !botSMDS || botSMDS->NbElements() == 0 )
-    return error(TCom("No elememts on face #") << botSM->GetId());
+    return toSM( error(TCom("No elememts on face #") << botSM->GetId() ));
 
-  bool needProject = false;
-  if ( !topSMDS || 
-       botSMDS->NbElements() != topSMDS->NbElements() ||
-       botSMDS->NbNodes()    != topSMDS->NbNodes())
+  bool needProject = !topSM->IsMeshComputed();
+  if ( !needProject && 
+       (botSMDS->NbElements() != topSMDS->NbElements() ||
+        botSMDS->NbNodes()    != topSMDS->NbNodes()))
   {
-    MESSAGE("nb elem bot " << botSMDS->NbElements() << " top " << topSMDS->NbElements());
-    MESSAGE("nb node bot " << botSMDS->NbNodes() << " top " << topSMDS->NbNodes());
-    if ( myBlock.HasNotQuadElemOnTop() )
-      return error(TCom("Mesh on faces #") << botSM->GetId()
-                   <<" and #"<< topSM->GetId() << " seems different" );
-    needProject = true;
+    MESSAGE("nb elem bot " << botSMDS->NbElements() <<
+            " top " << ( topSMDS ? topSMDS->NbElements() : 0 ));
+    MESSAGE("nb node bot " << botSMDS->NbNodes() <<
+            " top " << ( topSMDS ? topSMDS->NbNodes() : 0 ));
+    return toSM( error(TCom("Mesh on faces #") << botSM->GetId()
+                       <<" and #"<< topSM->GetId() << " seems different" ));
   }
 
   if ( 0/*needProject && !myProjectTriangles*/ )
-    return error(TCom("Mesh on faces #") << botSM->GetId()
-                 <<" and #"<< topSM->GetId() << " seems different" );
+    return toSM( error(TCom("Mesh on faces #") << botSM->GetId()
+                       <<" and #"<< topSM->GetId() << " seems different" ));
   ///RETURN_BAD_RESULT("Need to project but not allowed");
 
   if ( needProject )
@@ -847,16 +1543,16 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
   if ( !TAssocTool::FindSubShapeAssociation( botFace, myBlock.Mesh(),
                                              topFace, myBlock.Mesh(),
                                              shape2ShapeMap) )
-    return error(TCom("Topology of faces #") << botSM->GetId()
-                 <<" and #"<< topSM->GetId() << " seems different" );
+    return toSM( error(TCom("Topology of faces #") << botSM->GetId()
+                       <<" and #"<< topSM->GetId() << " seems different" ));
 
   // Find matching nodes of top and bottom faces
   TNodeNodeMap n2nMap;
   if ( ! TAssocTool::FindMatchingNodesOnFaces( botFace, myBlock.Mesh(),
                                                topFace, myBlock.Mesh(),
                                                shape2ShapeMap, n2nMap ))
-    return error(TCom("Mesh on faces #") << botSM->GetId()
-                 <<" and #"<< topSM->GetId() << " seems different" );
+    return toSM( error(TCom("Mesh on faces #") << botSM->GetId()
+                       <<" and #"<< topSM->GetId() << " seems different" ));
 
   // Fill myBotToColumnMap
 
@@ -870,7 +1566,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
     if ( botNode->GetPosition()->GetTypeOfPosition() != SMDS_TOP_FACE )
       continue; // wall columns are contained in myBlock
     // create node column
-    TNode bN( botNode );
+    Prism_3D::TNode bN( botNode );
     TNode2ColumnMap::iterator bN_col = 
       myBotToColumnMap.insert( make_pair ( bN, TNodeColumn() )).first;
     TNodeColumn & column = bN_col->second;
@@ -891,23 +1587,24 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
 
 bool StdMeshers_Prism_3D::projectBottomToTop()
 {
+  SMESHDS_Mesh*  meshDS = myBlock.MeshDS();
   SMESH_subMesh * botSM = myBlock.SubMesh( ID_BOT_FACE );
   SMESH_subMesh * topSM = myBlock.SubMesh( ID_TOP_FACE );
 
   SMESHDS_SubMesh * botSMDS = botSM->GetSubMeshDS();
   SMESHDS_SubMesh * topSMDS = topSM->GetSubMeshDS();
 
-  if ( topSMDS )
+  if ( topSMDS && topSMDS->NbElements() > 0 )
     topSM->ComputeStateEngine( SMESH_subMesh::CLEAN );
 
-  SMESHDS_Mesh* meshDS = myBlock.MeshDS();
-  int shapeID = myHelper->GetSubShapeID();
-  int topFaceID = meshDS->ShapeToIndex( topSM->GetSubShape() );
+  const TopoDS_Shape& botFace = myBlock.Shape( ID_BOT_FACE ); // oriented within the 3D SHAPE
+  const TopoDS_Shape& topFace = myBlock.Shape( ID_TOP_FACE);
+  int topFaceID = meshDS->ShapeToIndex( topFace );
 
   // Fill myBotToColumnMap
 
   int zSize = myBlock.VerticalSize();
-  TNode prevTNode;
+  Prism_3D::TNode prevTNode;
   SMDS_NodeIteratorPtr nIt = botSMDS->GetNodes();
   while ( nIt->more() )
   {
@@ -915,21 +1612,21 @@ bool StdMeshers_Prism_3D::projectBottomToTop()
     if ( botNode->GetPosition()->GetTypeOfPosition() != SMDS_TOP_FACE )
       continue; // strange
     // compute bottom node params
-    TNode bN( botNode );
+    Prism_3D::TNode bN( botNode );
     gp_XYZ paramHint(-1,-1,-1);
     if ( prevTNode.IsNeighbor( bN ))
       paramHint = prevTNode.GetParams();
     if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(),
                                      ID_BOT_FACE, paramHint ))
-      return error(TCom("Can't compute normalized parameters for node ")
-                   << botNode->GetID() << " on the face #"<< botSM->GetId() );
+      return toSM( error(TCom("Can't compute normalized parameters for node ")
+                         << botNode->GetID() << " on the face #"<< botSM->GetId() ));
     prevTNode = bN;
     // compute top node coords
     gp_XYZ topXYZ; gp_XY topUV;
     if ( !myBlock.FacePoint( ID_TOP_FACE, bN.GetParams(), topXYZ ) ||
          !myBlock.FaceUV   ( ID_TOP_FACE, bN.GetParams(), topUV ))
-      return error(TCom("Can't compute coordinates "
-                        "by normalized parameters on the face #")<< topSM->GetId() );
+      return toSM( error(TCom("Can't compute coordinates "
+                              "by normalized parameters on the face #")<< topSM->GetId() ));
     SMDS_MeshNode * topNode = meshDS->AddNode( topXYZ.X(),topXYZ.Y(),topXYZ.Z() );
     meshDS->SetNodeOnFace( topNode, topFaceID, topUV.X(), topUV.Y() );
     // create node column
@@ -943,36 +1640,43 @@ bool StdMeshers_Prism_3D::projectBottomToTop()
 
   // Create top faces
 
+  const bool oldSetElemsOnShape = myHelper->SetElementsOnShape( false );
+
+  // care of orientation;
+  // 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 );
+  int iFrw, iRev, *iPtr = &( reverseTop ? iRev : iFrw );
+
   // loop on bottom mesh faces
   SMDS_ElemIteratorPtr faceIt = botSMDS->GetElements();
+  vector< const SMDS_MeshNode* > nodes;
   while ( faceIt->more() )
   {
     const SMDS_MeshElement* face = faceIt->next();
     if ( !face || face->GetType() != SMDSAbs_Face )
       continue;
-    int nbNodes = face->NbNodes();
-    if ( face->IsQuadratic() )
-      nbNodes /= 2;
 
     // find top node in columns for each bottom node
-    vector< const SMDS_MeshNode* > nodes( nbNodes );
-    for ( int i = 0; i < nbNodes; ++i )
+    int nbNodes = face->NbCornerNodes();
+    nodes.resize( nbNodes );
+    for ( iFrw = 0, iRev = nbNodes-1; iFrw < nbNodes; ++iFrw, --iRev )
     {
-      const SMDS_MeshNode* n = face->GetNode( nbNodes - i - 1 );
+      const SMDS_MeshNode* n = face->GetNode( *iPtr );
       if ( n->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) {
         TNode2ColumnMap::iterator bot_column = myBotToColumnMap.find( n );
         if ( bot_column == myBotToColumnMap.end() )
-          return error(TCom("No nodes found above node ") << n->GetID() );
-        nodes[ i ] = bot_column->second.back();
+          return toSM( error(TCom("No nodes found above node ") << n->GetID() ));
+        nodes[ iFrw ] = bot_column->second.back();
       }
       else {
         const TNodeColumn* column = myBlock.GetNodeColumn( n );
         if ( !column )
-          return error(TCom("No side nodes found above node ") << n->GetID() );
-        nodes[ i ] = column->back();
+          return toSM( error(TCom("No side nodes found above node ") << n->GetID() ));
+        nodes[ iFrw ] = column->back();
       }
     }
-    // create a face, with reversed orientation
     SMDS_MeshElement* newFace = 0;
     switch ( nbNodes ) {
 
@@ -987,13 +1691,35 @@ bool StdMeshers_Prism_3D::projectBottomToTop()
     default:
       newFace = meshDS->AddPolygonalFace( nodes );
     }
-    if ( newFace && shapeID > 0 )
-      meshDS->SetMeshElementOnShape( newFace, shapeID );
+    if ( newFace )
+      meshDS->SetMeshElementOnShape( newFace, topFaceID );
   }
 
+  myHelper->SetElementsOnShape( oldSetElemsOnShape );  
+
   return true;
 }
 
+//=======================================================================
+//function : project2dMesh
+//purpose  : Project mesh faces from a source FACE of one prism (theSrcFace)
+//           to a source FACE of another prism (theTgtFace)
+//=======================================================================
+
+bool StdMeshers_Prism_3D::project2dMesh(const TopoDS_Face& theSrcFace,
+                                        const TopoDS_Face& theTgtFace)
+{
+  TProjction2dAlgo* projector2D = TProjction2dAlgo::instance( this );
+  projector2D->myHyp.SetSourceFace( theSrcFace );
+  bool ok = projector2D->Compute( *myHelper->GetMesh(), theTgtFace );
+
+  SMESH_subMesh* tgtSM = myHelper->GetMesh()->GetSubMesh( theTgtFace );
+  tgtSM->ComputeStateEngine       ( SMESH_subMesh::CHECK_COMPUTE_STATE );
+  tgtSM->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+
+  return ok;
+}
+
 //================================================================================
 /*!
  * \brief Set projection coordinates of a node to a face and it's sub-shapes
@@ -1031,23 +1757,78 @@ bool StdMeshers_Prism_3D::setFaceAndEdgesXYZ( const int faceID, const gp_XYZ& pa
   return true;
 }
 
-//================================================================================
-/*!
- * \brief Return true if this node and other one belong to one face
- */
-//================================================================================
+//=======================================================================
+//function : toSM
+//purpose  : If (!isOK), sets the error to a sub-mesh of a current SOLID
+//=======================================================================
 
-bool TNode::IsNeighbor( const TNode& other ) const
+bool StdMeshers_Prism_3D::toSM( bool isOK )
 {
-  if ( !other.myNode || !myNode ) return false;
+  if ( mySetErrorToSM &&
+       !isOK &&
+       myHelper &&
+       !myHelper->GetSubShape().IsNull() &&
+       myHelper->GetSubShape().ShapeType() == TopAbs_SOLID)
+  {
+    SMESH_subMesh* sm = myHelper->GetMesh()->GetSubMesh( myHelper->GetSubShape() );
+    sm->GetComputeError() = this->GetComputeError();
+    // clear error in order not to return it twice
+    _error = COMPERR_OK;
+    _comment.clear();
+  }
+  return isOK;
+}
+
+//=======================================================================
+//function : shapeID
+//purpose  : Return index of a shape
+//=======================================================================
 
-  SMDS_ElemIteratorPtr fIt = other.myNode->GetInverseElementIterator(SMDSAbs_Face);
-  while ( fIt->more() )
-    if ( fIt->next()->GetNodeIndex( myNode ) >= 0 )
-      return true;
-  return false;
+int StdMeshers_Prism_3D::shapeID( const TopoDS_Shape& S )
+{
+  if ( S.IsNull() ) return 0;
+  if ( !myHelper  ) return -3;
+  return myHelper->GetMeshDS()->ShapeToIndex( S );
 }
 
+namespace Prism_3D
+{
+  //================================================================================
+  /*!
+   * \brief Return true if this node and other one belong to one face
+   */
+  //================================================================================
+
+  bool Prism_3D::TNode::IsNeighbor( const Prism_3D::TNode& other ) const
+  {
+    if ( !other.myNode || !myNode ) return false;
+
+    SMDS_ElemIteratorPtr fIt = other.myNode->GetInverseElementIterator(SMDSAbs_Face);
+    while ( fIt->more() )
+      if ( fIt->next()->GetNodeIndex( myNode ) >= 0 )
+        return true;
+    return false;
+  }
+
+  //================================================================================
+  /*!
+   * \brief Prism initialization
+   */
+  //================================================================================
+
+  void TPrismTopo::Clear()
+  {
+    myShape3D.Nullify();
+    myTop.Nullify();
+    myBottom.Nullify();
+    myWallQuads.clear();
+    myBottomEdges.clear();
+    myNbEdgesInWires.clear();
+    myWallQuads.clear();
+  }
+
+} // namespace Prism_3D
+
 //================================================================================
 /*!
  * \brief Constructor. Initialization is needed
@@ -1076,242 +1857,142 @@ void StdMeshers_PrismAsBlock::Clear()
   myShapeIndex2ColumnMap.clear();
 }
 
-//================================================================================
-/*!
- * \brief Initialization.
- * \param helper - helper loaded with mesh and 3D shape
- * \param shape3D - a closed shell or solid
- * \retval bool - false if a mesh or a shape are KO
- */
-//================================================================================
+//=======================================================================
+//function : initPrism
+//purpose  : Analyse shape geometry and mesh.
+//           If there are triangles on one of faces, it becomes 'bottom'.
+//           thePrism.myBottom can be already set up.
+//=======================================================================
 
-bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
-                                   const TopoDS_Shape& shape3D)
+bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
+                                    const TopoDS_Shape&   shape3D)
 {
-  if ( mySide ) {
-    delete mySide; mySide = 0;
-  }
-  vector< TSideFace* > sideFaces( NB_WALL_FACES, 0 );
-  vector< pair< double, double> > params ( NB_WALL_FACES );
-  mySide = new TSideFace( sideFaces, params );
-
-  myHelper = helper;
-  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+  myHelper->SetSubShape( shape3D );
 
-  SMESH_Block::init();
-  myShapeIDMap.Clear();
-  myShapeIndex2ColumnMap.clear();
-  
-  int wallFaceIds[ NB_WALL_FACES ] = { // to walk around a block
-    SMESH_Block::ID_Fx0z, SMESH_Block::ID_F1yz,
-    SMESH_Block::ID_Fx1z, SMESH_Block::ID_F0yz
-  };
-
-  myError = SMESH_ComputeError::New();
-
-  // -------------------------------------------------------------
-  // Look for top and bottom faces: not quadrangle ones or meshed
-  // with not quadrangle elements
-  // -------------------------------------------------------------
+  SMESH_subMesh* mainSubMesh = myHelper->GetMesh()->GetSubMeshContaining( shape3D );
+  if ( !mainSubMesh ) return toSM( error(COMPERR_BAD_INPUT_MESH,"Null submesh of shape3D"));
 
+  // detect not-quad FACE sub-meshes of the 3D SHAPE
   list< SMESH_subMesh* > notQuadGeomSubMesh;
   list< SMESH_subMesh* > notQuadElemSubMesh;
   int nbFaces = 0;
   //
-  SMESH_subMesh* mainSubMesh = myHelper->GetMesh()->GetSubMeshContaining( shape3D );
-  if ( !mainSubMesh ) return error(COMPERR_BAD_INPUT_MESH,"Null submesh of shape3D");
-
-  // analyse face submeshes
-  SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,false);
+  SMESH_subMesh* anyFaceSM = 0;
+  SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,true);
   while ( smIt->more() )
   {
     SMESH_subMesh* sm = smIt->next();
     const TopoDS_Shape& face = sm->GetSubShape();
-    if ( face.ShapeType() != TopAbs_FACE )
-      continue;
+    if      ( face.ShapeType() > TopAbs_FACE ) break;
+    else if ( face.ShapeType() < TopAbs_FACE ) continue;
     nbFaces++;
+    anyFaceSM = sm;
 
-    // is quadrangle face?
+    // is quadrangle FACE?
     list< TopoDS_Edge > orderedEdges;
     list< int >         nbEdgesInWires;
-    TopoDS_Vertex       V000;
-    int nbWires = GetOrderedEdges( TopoDS::Face( face ),
-                                   V000, orderedEdges, nbEdgesInWires );
+    int nbWires = SMESH_Block::GetOrderedEdges( TopoDS::Face( face ), orderedEdges,
+                                                nbEdgesInWires );
     if ( nbWires != 1 || nbEdgesInWires.front() != 4 )
       notQuadGeomSubMesh.push_back( sm );
 
     // look for not quadrangle mesh elements
-    if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) {
-      bool hasNotQuad = false;
-      SMDS_ElemIteratorPtr eIt = smDS->GetElements();
-      while ( eIt->more() && !hasNotQuad ) {
-        const SMDS_MeshElement* elem = eIt->next();
-        if ( elem->GetType() == SMDSAbs_Face ) {
-          int nbNodes = elem->NbNodes();
-          if ( elem->IsQuadratic() )
-            nbNodes /= 2;
-          hasNotQuad = ( nbNodes != 4 );
-        }
-      }
-      if ( hasNotQuad )
+    if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() )
+      if ( !myHelper->IsSameElemGeometry( smDS, SMDSGeom_QUADRANGLE ))
         notQuadElemSubMesh.push_back( sm );
-    }
-    else {
-      return error(COMPERR_BAD_INPUT_MESH,TCom("Not meshed face #")<<sm->GetId());
-    }
-    // check if a quadrangle face is meshed with a quadranglar grid
-    if ( notQuadGeomSubMesh.back() != sm &&
-         notQuadElemSubMesh.back() != sm )
-    {
-      // count nb edges on face sides
-      vector< int > nbEdges;
-      nbEdges.reserve( nbEdgesInWires.front() );
-      for ( list< TopoDS_Edge >::iterator edge = orderedEdges.begin();
-            edge != orderedEdges.end(); ++edge )
-      {
-        if ( SMESHDS_SubMesh* smDS = meshDS->MeshElements( *edge ))
-          nbEdges.push_back ( smDS->NbElements() );
-        else
-          nbEdges.push_back ( 0 );
-      }
-      int nbQuads = sm->GetSubMeshDS()->NbElements();
-      if ( nbEdges[0] *  nbEdges[1] != nbQuads ||
-           nbEdges[0] != nbEdges[2] ||
-           nbEdges[1] != nbEdges[3] )
-        notQuadElemSubMesh.push_back( sm );
-    }
   }
 
-  // ----------------------------------------------------------------------
-  // Analyse mesh and topology of faces: choose the bottom submesh.
-  // If there are not quadrangle geom faces, they are top and bottom ones.
-  // Not quadrangle geom faces must be only on top and bottom.
-  // ----------------------------------------------------------------------
-
-  SMESH_subMesh * botSM = 0;
-  SMESH_subMesh * topSM = 0;
-
-  int nbNotQuad       = notQuadGeomSubMesh.size();
   int nbNotQuadMeshed = notQuadElemSubMesh.size();
-  bool hasNotQuad = ( nbNotQuad || nbNotQuadMeshed );
+  int       nbNotQuad = notQuadGeomSubMesh.size();
+  bool     hasNotQuad = ( nbNotQuad || nbNotQuadMeshed );
 
   // detect bad cases
   if ( nbNotQuadMeshed > 2 )
   {
-    return error(COMPERR_BAD_INPUT_MESH,
-                 TCom("More than 2 faces with not quadrangle elements: ")
-                 <<nbNotQuadMeshed);
+    return toSM( error(COMPERR_BAD_INPUT_MESH,
+                       TCom("More than 2 faces with not quadrangle elements: ")
+                       <<nbNotQuadMeshed));
   }
-  int nbQuasiQuads = 0;
-  if ( nbNotQuad > 0 && nbNotQuad != 2 )
+  if ( nbNotQuad > 2 || !thePrism.myBottom.IsNull() )
   {
-    // Issue 0020843 - one of side faces is quasi-quadrilateral.
+    // Issue 0020843 - one of side FACEs is quasi-quadrilateral (not 4 EDGEs).
     // Remove from notQuadGeomSubMesh faces meshed with regular grid
-    nbQuasiQuads = removeQuasiQuads( notQuadGeomSubMesh );
+    int nbQuasiQuads = removeQuasiQuads( notQuadGeomSubMesh, myHelper,
+                                         TQuadrangleAlgo::instance(this,myHelper) );
     nbNotQuad -= nbQuasiQuads;
-    if ( nbNotQuad > 0 && nbNotQuad != 2 )
-      return error(COMPERR_BAD_SHAPE,
-                   TCom("More than 2 not quadrilateral faces: ")
-                   <<nbNotQuad);
+    if ( nbNotQuad > 2 )
+      return toSM( error(COMPERR_BAD_SHAPE,
+                         TCom("More than 2 not quadrilateral faces: ") <<nbNotQuad));
+    hasNotQuad = ( nbNotQuad || nbNotQuadMeshed );
   }
 
-  // get found submeshes
-  if ( hasNotQuad )
+  // Analyse mesh and topology of FACEs: choose the bottom sub-mesh.
+  // If there are not quadrangle FACEs, they are top and bottom ones.
+  // Not quadrangle FACEs must be only on top and bottom.
+
+  SMESH_subMesh * botSM = 0;
+  SMESH_subMesh * topSM = 0;
+
+  if ( hasNotQuad ) // can chose a bottom FACE
   {
     if ( nbNotQuadMeshed > 0 ) botSM = notQuadElemSubMesh.front();
     else                       botSM = notQuadGeomSubMesh.front();
     if ( nbNotQuadMeshed > 1 ) topSM = notQuadElemSubMesh.back();
     else if ( nbNotQuad  > 1 ) topSM = notQuadGeomSubMesh.back();
-  }
-  // detect other bad cases
-  if ( nbNotQuad == 2 && nbNotQuadMeshed > 0 ) {
-    bool ok = false;
-    if ( nbNotQuadMeshed == 1 )
-      ok = ( find( notQuadGeomSubMesh.begin(),
-                   notQuadGeomSubMesh.end(), botSM ) != notQuadGeomSubMesh.end() );
-    else
-      ok = ( notQuadGeomSubMesh == notQuadElemSubMesh );
-    if ( !ok )
-      return error(COMPERR_BAD_INPUT_MESH, "Side face meshed with not quadrangle elements");
+
+    if ( topSM == botSM ) {
+      if ( nbNotQuadMeshed > 1 ) topSM = notQuadElemSubMesh.front();
+      else                       topSM = notQuadGeomSubMesh.front();
+    }
+
+    // detect mesh triangles on wall FACEs
+    if ( nbNotQuad == 2 && nbNotQuadMeshed > 0 ) {
+      bool ok = false;
+      if ( nbNotQuadMeshed == 1 )
+        ok = ( find( notQuadGeomSubMesh.begin(),
+                     notQuadGeomSubMesh.end(), botSM ) != notQuadGeomSubMesh.end() );
+      else
+        ok = ( notQuadGeomSubMesh == notQuadElemSubMesh );
+      if ( !ok )
+        return toSM( error(COMPERR_BAD_INPUT_MESH,
+                           "Side face meshed with not quadrangle elements"));
+    }
   }
 
-  myNotQuadOnTop = ( nbNotQuadMeshed > 1 );
-  MESSAGE("myNotQuadOnTop " << myNotQuadOnTop << " nbNotQuadMeshed " << nbNotQuadMeshed);
-  // ----------------------------------------------------------
+  thePrism.myNotQuadOnTop = ( nbNotQuadMeshed > 1 );
 
-  if ( nbNotQuad == 0 ) // Standard block of 6 quadrangle faces ?
+  // use thePrism.myBottom
+  if ( !thePrism.myBottom.IsNull() )
   {
-    // SMESH_Block will perform geometry analysis, we need just to find 2
-    // connected vertices on top and bottom
-
-    TopoDS_Vertex Vbot, Vtop;
-    if ( nbNotQuadMeshed > 0 ) // Look for vertices
-    {
-      TopTools_IndexedMapOfShape edgeMap;
-      TopExp::MapShapes( botSM->GetSubShape(), TopAbs_EDGE, edgeMap );
-      // vertex 1 is any vertex of the bottom face
-      Vbot = TopExp::FirstVertex( TopoDS::Edge( edgeMap( 1 )));
-      // vertex 2 is end vertex of edge sharing Vbot and not belonging to the bottom face
-      TopTools_ListIteratorOfListOfShape ancestIt = Mesh()->GetAncestors( Vbot );
-      for ( ; Vtop.IsNull() && ancestIt.More(); ancestIt.Next() )
-      {
-        const TopoDS_Shape & ancestor = ancestIt.Value();
-        if ( ancestor.ShapeType() == TopAbs_EDGE && !edgeMap.FindIndex( ancestor ))
-        {
-          TopoDS_Vertex V1, V2;
-          TopExp::Vertices( TopoDS::Edge( ancestor ), V1, V2);
-          if      ( Vbot.IsSame ( V1 )) Vtop = V2;
-          else if ( Vbot.IsSame ( V2 )) Vtop = V1;
-          // check that Vtop belongs to shape3D
-          TopExp_Explorer exp( shape3D, TopAbs_VERTEX );
-          for ( ; exp.More(); exp.Next() )
-            if ( Vtop.IsSame( exp.Current() ))
-              break;
-          if ( !exp.More() )
-            Vtop.Nullify();
-        }
+    if ( botSM ) {
+      if ( ! botSM->GetSubShape().IsSame( thePrism.myBottom )) {
+        std::swap( botSM, topSM );
+        if ( ! botSM->GetSubShape().IsSame( thePrism.myBottom ))
+          return toSM( error( COMPERR_BAD_INPUT_MESH,
+                              "Incompatible non-structured sub-meshes"));
       }
     }
-    // get shell from shape3D
-    TopoDS_Shell shell;
-    TopExp_Explorer exp( shape3D, TopAbs_SHELL );
-    int nbShell = 0;
-    for ( ; exp.More(); exp.Next(), ++nbShell )
-      shell = TopoDS::Shell( exp.Current() );
-//     if ( nbShell != 1 )
-//       RETURN_BAD_RESULT("There must be 1 shell in the block");
-
-    // Load geometry in SMESH_Block
-    if ( !SMESH_Block::FindBlockShapes( shell, Vbot, Vtop, myShapeIDMap )) {
-      if ( !hasNotQuad )
-        return error(COMPERR_BAD_SHAPE, "Can't detect top and bottom of a prism");
-    }
     else {
-      if ( !botSM ) botSM = Mesh()->GetSubMeshContaining( myShapeIDMap( ID_BOT_FACE ));
-      if ( !topSM ) topSM = Mesh()->GetSubMeshContaining( myShapeIDMap( ID_TOP_FACE ));
+      botSM = myHelper->GetMesh()->GetSubMesh( thePrism.myBottom );
     }
-
-  } // end  Standard block of 6 quadrangle faces
-  // --------------------------------------------------------
-
-  // Here the top and bottom faces are found
-  if ( nbNotQuadMeshed == 2 ) // roughly check correspondence of horiz meshes
+  }
+  else if ( !botSM ) // find a proper bottom
   {
-//     SMESHDS_SubMesh* topSMDS = topSM->GetSubMeshDS();
-//     SMESHDS_SubMesh* botSMDS = botSM->GetSubMeshDS();
-//     if ( topSMDS->NbNodes() != botSMDS->NbNodes() ||
-//          topSMDS->NbElements() != botSMDS->NbElements() )
-//       RETURN_BAD_RESULT("Top mesh doesn't correspond to bottom one");
+    // composite walls or not prism shape
+    for ( TopExp_Explorer f( shape3D, TopAbs_FACE ); f.More(); f.Next() )
+    {
+      int minNbFaces = 2 + myHelper->Count( f.Current(), TopAbs_EDGE, false);
+      if ( nbFaces >= minNbFaces)
+      {
+        thePrism.Clear();
+        thePrism.myBottom = TopoDS::Face( f.Current() );
+        if ( initPrism( thePrism, shape3D ))
+          return true;
+      }
+      return toSM( error( COMPERR_BAD_SHAPE ));
+    }
   }
 
-  // ---------------------------------------------------------
-  // If there are not quadrangle geom faces, we emulate
-  // a block of 6 quadrangle faces.
-  // Load SMESH_Block with faces and edges geometry
-  // ---------------------------------------------------------
-
-  
   // find vertex 000 - the one with smallest coordinates (for easy DEBUG :-)
   TopoDS_Vertex V000;
   double minVal = DBL_MAX, minX, val;
@@ -1328,63 +2009,101 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
     }
   }
 
+  thePrism.myShape3D = shape3D;
+  if ( thePrism.myBottom.IsNull() )
+    thePrism.myBottom  = TopoDS::Face( botSM->GetSubShape() );
+  thePrism.myBottom.Orientation( myHelper->GetSubShapeOri( shape3D,
+                                                           thePrism.myBottom ));
   // Get ordered bottom edges
-  list< TopoDS_Edge > orderedEdges;
-  list< int >         nbEInW;
-  SMESH_Block::GetOrderedEdges( TopoDS::Face( botSM->GetSubShape().Reversed() ),
-                                V000, orderedEdges, nbEInW );
-//   if ( nbEInW.size() != 1 )
-//     RETURN_BAD_RESULT("Wrong prism geometry");
-
-  // Get Wall faces corresponding to the ordered bottom edges
-  list< TopoDS_Face > wallFaces;
-  if ( !GetWallFaces( Mesh(), shape3D, botSM->GetSubShape(), orderedEdges, nbEInW, wallFaces))
-    return error(COMPERR_BAD_SHAPE, "Can't find side faces");
-
-  // check that the found top and bottom faces are opposite
+  TopoDS_Face reverseBottom = // to have order of top EDGEs as in the top FACE
+    TopoDS::Face( thePrism.myBottom.Reversed() );
+  SMESH_Block::GetOrderedEdges( reverseBottom,
+                                thePrism.myBottomEdges,
+                                thePrism.myNbEdgesInWires, V000 );
+
+  // Get Wall faces corresponding to the ordered bottom edges and the top FACE
+  if ( !getWallFaces( thePrism, nbFaces ))
+    return false; //toSM( error(COMPERR_BAD_SHAPE, "Can't find side faces"));
+
+  if ( topSM )
   {
-    for (TopExp_Explorer edge(botSM->GetSubShape(), TopAbs_EDGE); edge.More(); edge.Next())
-      if ( helper->IsSubShape( edge.Current(), topSM->GetSubShape() ))
-        return error(notQuadGeomSubMesh.empty() ? COMPERR_BAD_INPUT_MESH : COMPERR_BAD_SHAPE,
-                     "Non-quadrilateral faces are not opposite");
+    if ( !thePrism.myTop.IsSame( topSM->GetSubShape() ))
+      return toSM( error
+                   (notQuadGeomSubMesh.empty() ? COMPERR_BAD_INPUT_MESH : COMPERR_BAD_SHAPE,
+                    "Non-quadrilateral faces are not opposite"));
+
+    // check that the found top and bottom FACEs are opposite
+    list< TopoDS_Edge >::iterator edge = thePrism.myBottomEdges.begin();
+    for ( ; edge != thePrism.myBottomEdges.end(); ++edge )
+      if ( myHelper->IsSubShape( *edge, thePrism.myTop ))
+        return toSM( error
+                     (notQuadGeomSubMesh.empty() ? COMPERR_BAD_INPUT_MESH : COMPERR_BAD_SHAPE,
+                      "Non-quadrilateral faces are not opposite"));
   }
 
-  // Protect from a distorted block (test 3D_mesh_HEXA3D/B7 on 32bit platform)
-  // check that all wall faces have an edge common with the top face
-  {
-    list< TopoDS_Face >::iterator faceIt = wallFaces.begin();
-    for ( ; faceIt != wallFaces.end(); ++faceIt )
-    {
-      bool hasCommon = false;
-      for (TopExp_Explorer edge(*faceIt, TopAbs_EDGE); !hasCommon && edge.More(); edge.Next())
-        if ( helper->IsSubShape( edge.Current(), topSM->GetSubShape() ))
-          hasCommon = true;
-      if ( !hasCommon )
-        return error(COMPERR_BAD_SHAPE);
-    }
+  return true;
+}
+
+//================================================================================
+/*!
+ * \brief Initialization.
+ * \param helper - helper loaded with mesh and 3D shape
+ * \param thePrism - a prosm data
+ * \retval bool - false if a mesh or a shape are KO
+ */
+//================================================================================
+
+bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper*         helper,
+                                   const Prism_3D::TPrismTopo& thePrism)
+{
+  if ( mySide ) {
+    delete mySide; mySide = 0;
   }
+  vector< TSideFace* >         sideFaces( NB_WALL_FACES, 0 );
+  vector< pair< double, double> > params( NB_WALL_FACES );
+  mySide = new TSideFace( sideFaces, params );
+
+  myHelper = helper;
+  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+
+  SMESH_Block::init();
+  myShapeIDMap.Clear();
+  myShapeIndex2ColumnMap.clear();
+  
+  int wallFaceIds[ NB_WALL_FACES ] = { // to walk around a block
+    SMESH_Block::ID_Fx0z, SMESH_Block::ID_F1yz,
+    SMESH_Block::ID_Fx1z, SMESH_Block::ID_F0yz
+  };
+
+  myError = SMESH_ComputeError::New();
+
+  myNotQuadOnTop = thePrism.myNotQuadOnTop;
 
   // Find columns of wall nodes and calculate edges' lengths
   // --------------------------------------------------------
 
   myParam2ColumnMaps.clear();
-  myParam2ColumnMaps.resize( orderedEdges.size() ); // total nb edges
+  myParam2ColumnMaps.resize( thePrism.myBottomEdges.size() ); // total nb edges
 
-  int iE, nbEdges = nbEInW.front(); // nb outer edges
-  vector< double > edgeLength( nbEdges );
-  map< double, int > len2edgeMap;
+  size_t iE, nbEdges = thePrism.myNbEdgesInWires.front(); // nb outer edges
+  vector< double >    edgeLength( nbEdges );
+  multimap< double, int > len2edgeMap;
 
-  list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin();
-  list< TopoDS_Face >::iterator faceIt = wallFaces.begin();
-  for ( iE = 0; iE < nbEdges; ++edgeIt, ++faceIt )
+  list< TopoDS_Edge >::const_iterator edgeIt = thePrism.myBottomEdges.begin();
+  for ( iE = 0; iE < nbEdges; ++iE, ++edgeIt )
   {
     TParam2ColumnMap & faceColumns = myParam2ColumnMaps[ iE ];
-    if ( !myHelper->LoadNodeColumns( faceColumns, *faceIt, *edgeIt, meshDS ))
-      return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
-                   << "on a side face #" << MeshDS()->ShapeToIndex( *faceIt ));
 
-    SHOWYXZ("\np1 F "<<iE, gpXYZ(faceColumns.begin()->second.front() ));
-    SHOWYXZ("p2 F "<<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
+    Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[ iE ].begin();
+    for ( ; quad != thePrism.myWallQuads[ iE ].end(); ++quad )
+    {
+      const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge( 0 );
+      if ( !myHelper->LoadNodeColumns( faceColumns, (*quad)->face, quadBot, meshDS ))
+        return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
+                     << "on a side face #" << MeshDS()->ShapeToIndex( (*quad)->face ));
+    }
+    SHOWYXZ("\np1 F " <<iE, gpXYZ(faceColumns.begin()->second.front() ));
+    SHOWYXZ("p2 F "   <<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
     SHOWYXZ("V First "<<iE, BRep_Tool::Pnt( TopExp::FirstVertex(*edgeIt,true )));
 
     edgeLength[ iE ] = SMESH_Algo::EdgeLength( *edgeIt );
@@ -1395,20 +2114,23 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
       if ( !smDS )
         return error(COMPERR_BAD_INPUT_MESH, TCom("Null submesh on the edge #")
                      << MeshDS()->ShapeToIndex( *edgeIt ));
-      // assure length uniqueness
-      edgeLength[ iE ] *= smDS->NbNodes() + edgeLength[ iE ] / ( 1000 + iE );
-      len2edgeMap[ edgeLength[ iE ]] = iE;
+      len2edgeMap.insert( make_pair( edgeLength[ iE ], iE ));
     }
-    ++iE;
   }
   // Load columns of internal edges (forming holes)
   // and fill map ShapeIndex to TParam2ColumnMap for them
-  for ( ; edgeIt != orderedEdges.end() ; ++edgeIt, ++faceIt )
+  for ( ; edgeIt != thePrism.myBottomEdges.end() ; ++edgeIt, ++iE )
   {
     TParam2ColumnMap & faceColumns = myParam2ColumnMaps[ iE ];
-    if ( !myHelper->LoadNodeColumns( faceColumns, *faceIt, *edgeIt, meshDS ))
-      return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
-                   << "on a side face #" << MeshDS()->ShapeToIndex( *faceIt ));
+
+    Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[ iE ].begin();
+    for ( ; quad != thePrism.myWallQuads[ iE ].end(); ++quad )
+    {
+      const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge( 0 );
+      if ( !myHelper->LoadNodeColumns( faceColumns, (*quad)->face, quadBot, meshDS ))
+        return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
+                     << "on a side face #" << MeshDS()->ShapeToIndex( (*quad)->face ));
+    }
     // edge columns
     int id = MeshDS()->ShapeToIndex( *edgeIt );
     bool isForward = true; // meaningless for intenal wires
@@ -1422,10 +2144,10 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
     const SMDS_MeshNode* n1 = faceColumns.rbegin()->second.front();
     id = n1->getshapeId();
     myShapeIndex2ColumnMap[ id ] = make_pair( & faceColumns, isForward );
-//     SHOWYXZ("\np1 F "<<iE, gpXYZ(faceColumns.begin()->second.front() ));
-//     SHOWYXZ("p2 F "<<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
-//     SHOWYXZ("V First "<<iE, BRep_Tool::Pnt( TopExp::FirstVertex(*edgeIt,true )));
-    ++iE;
+
+    // SHOWYXZ("\np1 F " <<iE, gpXYZ(faceColumns.begin()->second.front() ));
+    // SHOWYXZ("p2 F "   <<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
+    // SHOWYXZ("V First "<<iE, BRep_Tool::Pnt( TopExp::FirstVertex(*edgeIt,true )));
   }
 
   // Create 4 wall faces of a block
@@ -1460,12 +2182,12 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
       }
     }
     // Create TSideFace's
-    faceIt = wallFaces.begin();
-    edgeIt = orderedEdges.begin();
     int iSide = 0;
-    for ( iE = 0; iE < nbEdges; ++edgeIt, ++faceIt )
+    list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
+    for ( iE = 0; iE < nbEdges; ++iE, ++botE )
     {
-     // split?
+      TFaceQuadStructPtr quad = thePrism.myWallQuads[ iE ].front();
+      // split?
       map< int, int >::iterator i_nb = iE2nbSplit.find( iE );
       if ( i_nb != iE2nbSplit.end() ) {
         // split!
@@ -1475,23 +2197,22 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
         const bool isForward =
           StdMeshers_PrismAsBlock::IsForwardEdge( myHelper->GetMeshDS(),
                                                   myParam2ColumnMaps[iE],
-                                                  *edgeIt, SMESH_Block::ID_Fx0z );
+                                                  *botE, SMESH_Block::ID_Fx0z );
         for ( int i = 0; i < nbSplit; ++i ) {
           double f = ( isForward ? params[ i ]   : params[ nbSplit - i-1 ]);
           double l = ( isForward ? params[ i+1 ] : params[ nbSplit - i ]);
           TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
-                                           *faceIt, *edgeIt,
+                                           thePrism.myWallQuads[ iE ], *botE,
                                            &myParam2ColumnMaps[ iE ], f, l );
           mySide->SetComponent( iSide++, comp );
         }
       }
       else {
         TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
-                                         *faceIt, *edgeIt,
+                                         thePrism.myWallQuads[ iE ], *botE,
                                          &myParam2ColumnMaps[ iE ]);
         mySide->SetComponent( iSide++, comp );
       }
-      ++iE;
     }
   }
   else { // **************************** Unite faces
@@ -1503,30 +2224,27 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
     for ( iE = 0; iE < nbExraFaces; ++iE )
       sumLen += edgeLength[ iE ];
 
-    vector< TSideFace* > components( nbExraFaces );
+    vector< TSideFace* >        components( nbExraFaces );
     vector< pair< double, double> > params( nbExraFaces );
-    faceIt = wallFaces.begin();
-    edgeIt = orderedEdges.begin();
-    for ( iE = 0; iE < nbExraFaces; ++edgeIt, ++faceIt )
+    list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
+    for ( iE = 0; iE < nbExraFaces; ++iE, ++botE )
     {
       components[ iE ] = new TSideFace( myHelper, wallFaceIds[ iSide ],
-                                        *faceIt, *edgeIt,
+                                        thePrism.myWallQuads[ iE ], *botE,
                                         &myParam2ColumnMaps[ iE ]);
       double u1 = u0 + edgeLength[ iE ] / sumLen;
       params[ iE ] = make_pair( u0 , u1 );
       u0 = u1;
-      ++iE;
     }
     mySide->SetComponent( iSide++, new TSideFace( components, params ));
 
     // fill the rest faces
-    for ( ; iE < nbEdges; ++faceIt, ++edgeIt )
+    for ( ; iE < nbEdges; ++iE, ++botE )
     {
       TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
-                                       *faceIt, *edgeIt,
+                                       thePrism.myWallQuads[ iE ], *botE,
                                        &myParam2ColumnMaps[ iE ]);
       mySide->SetComponent( iSide++, comp );
-      ++iE;
     }
   }
 
@@ -1534,9 +2252,6 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
   // Fill geometry fields of SMESH_Block
   // ------------------------------------
 
-  TopoDS_Face botF = TopoDS::Face( botSM->GetSubShape() );
-  TopoDS_Face topF = TopoDS::Face( topSM->GetSubShape() );
-
   vector< int > botEdgeIdVec;
   SMESH_Block::GetFaceEdgesIDs( ID_BOT_FACE, botEdgeIdVec );
 
@@ -1549,7 +2264,7 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
     TSideFace * sideFace = mySide->GetComponent( iF );
     if ( !sideFace )
       RETURN_BAD_RESULT("NULL TSideFace");
-    int fID = sideFace->FaceID();
+    int fID = sideFace->FaceID(); // in-block ID
 
     // fill myShapeIDMap
     if ( sideFace->InsertSubShapes( myShapeIDMap ) != 8 &&
@@ -1593,8 +2308,8 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
     // pcurves on horizontal faces
     for ( iE = 0; iE < NB_WALL_FACES; ++iE ) {
       if ( edgeIdVec[ BOTTOM_EDGE ] == botEdgeIdVec[ iE ] ) {
-        botPcurves[ iE ] = sideFace->HorizPCurve( false, botF );
-        topPcurves[ iE ] = sideFace->HorizPCurve( true,  topF );
+        botPcurves[ iE ] = sideFace->HorizPCurve( false, thePrism.myBottom );
+        topPcurves[ iE ] = sideFace->HorizPCurve( true,  thePrism.myTop );
         break;
       }
     }
@@ -1603,13 +2318,13 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
   // horizontal faces geometry
   {
     SMESH_Block::TFace& tFace = myFace[ ID_BOT_FACE - ID_FirstF ];
-    tFace.Set( ID_BOT_FACE, new BRepAdaptor_Surface( botF ), botPcurves, isForward );
-    SMESH_Block::Insert( botF, ID_BOT_FACE, myShapeIDMap );
+    tFace.Set( ID_BOT_FACE, new BRepAdaptor_Surface( thePrism.myBottom ), botPcurves, isForward );
+    SMESH_Block::Insert( thePrism.myBottom, ID_BOT_FACE, myShapeIDMap );
   }
   {
     SMESH_Block::TFace& tFace = myFace[ ID_TOP_FACE - ID_FirstF ];
-    tFace.Set( ID_TOP_FACE, new BRepAdaptor_Surface( topF ), topPcurves, isForward );
-    SMESH_Block::Insert( topF, ID_TOP_FACE, myShapeIDMap );
+    tFace.Set( ID_TOP_FACE, new BRepAdaptor_Surface( thePrism.myTop ), topPcurves, isForward );
+    SMESH_Block::Insert( thePrism.myTop, ID_TOP_FACE, myShapeIDMap );
   }
 
   // Fill map ShapeIndex to TParam2ColumnMap
@@ -1685,7 +2400,8 @@ const TNodeColumn* StdMeshers_PrismAsBlock::GetNodeColumn(const SMDS_MeshNode* n
 //           from bottom to top.
 //=======================================================================
 
-bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf) const
+bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> &           trsf,
+                                                      const Prism_3D::TPrismTopo& prism) const
 {
   const int zSize = VerticalSize();
   if ( zSize < 3 ) return true;
@@ -1695,21 +2411,17 @@ bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf) co
 
   vector< const TNodeColumn* > columns;
   {
-    const TopoDS_Shape& baseFace = Shape(ID_BOT_FACE);
-    list< TopoDS_Edge > orderedEdges;
-    list< int >         nbEdgesInWires;
-    GetOrderedEdges( TopoDS::Face( baseFace ), TopoDS_Vertex(), orderedEdges, nbEdgesInWires );
     bool isReverse;
-    list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin();
-    for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt )
+    list< TopoDS_Edge >::const_iterator edgeIt = prism.myBottomEdges.begin();
+    for ( int iE = 0; iE < prism.myNbEdgesInWires.front(); ++iE, ++edgeIt )
     {
       if ( BRep_Tool::Degenerated( *edgeIt )) continue;
       const TParam2ColumnMap* u2colMap =
-        GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse );
+        GetParam2ColumnMap( MeshDS()->ShapeToIndex( *edgeIt ), isReverse );
       if ( !u2colMap ) return false;
-      isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED );
       double f = u2colMap->begin()->first, l = u2colMap->rbegin()->first;
-      if ( isReverse ) swap ( f, l );
+      //isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED );
+      //if ( isReverse ) swap ( f, l ); -- u2colMap takes orientation into account
       const int nbCol = 5;
       for ( int i = 0; i < nbCol; ++i )
       {
@@ -1784,7 +2496,7 @@ bool StdMeshers_PrismAsBlock::IsForwardEdge(SMESHDS_Mesh*           meshDS,
   }
   else
   {
-    const TNodeColumn& firstCol = columnsMap.begin()->second;
+    const TNodeColumn&     firstCol = columnsMap.begin()->second;
     const SMDS_MeshNode* bottomNode = firstCol[0];
     TopoDS_Shape firstVertex = SMESH_MesherHelper::GetSubShapeByNode( bottomNode, meshDS );
     isForward = ( firstVertex.IsSame( TopExp::FirstVertex( bottomEdge, true )));
@@ -1795,94 +2507,61 @@ bool StdMeshers_PrismAsBlock::IsForwardEdge(SMESHDS_Mesh*           meshDS,
   return isForward;
 }
 
-//================================================================================
-/*!
- * \brief Find wall faces by bottom edges
- * \param mesh - the mesh
- * \param mainShape - the prism
- * \param bottomFace - the bottom face
- * \param bottomEdges - edges bounding the bottom face
- * \param wallFaces - faces list to fill in
- */
-//================================================================================
-
-bool StdMeshers_PrismAsBlock::GetWallFaces( SMESH_Mesh*               mesh,
-                                            const TopoDS_Shape &      mainShape,
-                                            const TopoDS_Shape &      bottomFace,
-                                            std::list< TopoDS_Edge >& bottomEdges,
-                                            std::list< int > &        nbEInW,
-                                            std::list< TopoDS_Face >& wallFaces)
-{
-  wallFaces.clear();
-
-  TopTools_IndexedMapOfShape faceMap;
-  TopExp::MapShapes( mainShape, TopAbs_FACE, faceMap );
-
-  list< TopoDS_Edge >::iterator edge = bottomEdges.begin();
-  std::list< int >::iterator nbE = nbEInW.begin();
-  int iE = 0;
-  while ( edge != bottomEdges.end() )
-  {
-    ++iE;
-    if ( BRep_Tool::Degenerated( *edge ))
-    {
-      edge = bottomEdges.erase( edge );
-      --iE;
-      --(*nbE);
-    }
-    else
-    {
-      PShapeIteratorPtr fIt = myHelper->GetAncestors( *edge, *mesh, TopAbs_FACE );
-      while ( fIt->more() )
-      {
-        const TopoDS_Shape* face = fIt->next();
-        if ( !bottomFace.IsSame( *face ) &&      // not bottom
-             faceMap.FindIndex( *face ))         // belongs to the prism
-        {
-          wallFaces.push_back( TopoDS::Face( *face ));
-          break;
-        }
-      }
-      ++edge;
-    }
-    if ( iE == *nbE )
-    {
-      iE = 0;
-      ++nbE;
-    }
-  }
-  return ( wallFaces.size() == bottomEdges.size() );
-}
-
 //================================================================================
 /*!
  * \brief Constructor
   * \param faceID - in-block ID
-  * \param face - geom face
+  * \param face - geom FACE
+  * \param baseEdge - EDGE proreply oriented in the bottom EDGE !!!
   * \param columnsMap - map of node columns
   * \param first - first normalized param
   * \param last - last normalized param
  */
 //================================================================================
 
-StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_MesherHelper* helper,
-                                              const int           faceID,
-                                              const TopoDS_Face&  face,
-                                              const TopoDS_Edge&  baseEdge,
-                                              TParam2ColumnMap*   columnsMap,
-                                              const double        first,
-                                              const double        last):
+StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_MesherHelper*        helper,
+                                              const int                  faceID,
+                                              const Prism_3D::TQuadList& quadList,
+                                              const TopoDS_Edge&         baseEdge,
+                                              TParam2ColumnMap*          columnsMap,
+                                              const double               first,
+                                              const double               last):
   myID( faceID ),
   myParamToColumnMap( columnsMap ),
-  myBaseEdge( baseEdge ),
   myHelper( helper )
 {
-  mySurface.Initialize( face );
   myParams.resize( 1 );
   myParams[ 0 ] = make_pair( first, last );
-  myIsForward = StdMeshers_PrismAsBlock::IsForwardEdge( myHelper->GetMeshDS(),
-                                                        *myParamToColumnMap,
-                                                        myBaseEdge, myID );
+  mySurface     = PSurface( new BRepAdaptor_Surface( quadList.front()->face ));
+  myBaseEdge    = baseEdge;
+  myIsForward   = StdMeshers_PrismAsBlock::IsForwardEdge( myHelper->GetMeshDS(),
+                                                          *myParamToColumnMap,
+                                                          myBaseEdge, myID );
+  if ( quadList.size() > 1 ) // side is vertically composite
+  {
+    // fill myShapeID2Surf map to enable finding a right surface by any sub-shape ID
+
+    SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+
+    TopTools_IndexedDataMapOfShapeListOfShape subToFaces;
+    Prism_3D::TQuadList::const_iterator quad = quadList.begin();
+    for ( ; quad != quadList.end(); ++quad )
+    {
+      const TopoDS_Face& face = (*quad)->face;
+      TopExp::MapShapesAndAncestors( face, TopAbs_VERTEX, TopAbs_FACE, subToFaces );
+      TopExp::MapShapesAndAncestors( face, TopAbs_EDGE,   TopAbs_FACE, subToFaces );
+      myShapeID2Surf.insert( make_pair( meshDS->ShapeToIndex( face ),
+                                        PSurface( new BRepAdaptor_Surface( face ))));
+    }
+    for ( int i = 1; i <= subToFaces.Extent(); ++i )
+    {
+      const TopoDS_Shape&     sub = subToFaces.FindKey( i );
+      TopTools_ListOfShape& faces = subToFaces( i );
+      int subID  = meshDS->ShapeToIndex( sub );
+      int faceID = meshDS->ShapeToIndex( faces.First() );
+      myShapeID2Surf.insert ( make_pair( subID, myShapeID2Surf[ faceID ]));
+    }
+  }
 }
 
 //================================================================================
@@ -2102,21 +2781,18 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
   TParam2ColumnIt u_col1, u_col2;
   double vR, hR = GetColumns( U, u_col1, u_col2 );
 
-  const SMDS_MeshNode* n1 = 0;
-  const SMDS_MeshNode* n2 = 0;
-  const SMDS_MeshNode* n3 = 0;
-  const SMDS_MeshNode* n4 = 0;
+  const SMDS_MeshNode* nn[4];
 
-  // BEGIN issue 0020680: EDF 1252 SMESH: Bad cell created by Radial prism in center of torus
+  // BEGIN issue 0020680: Bad cell created by Radial prism in center of torus
   // Workaround for a wrongly located point returned by mySurface.Value() for
   // UV located near boundary of BSpline surface.
-  // To bypass the problem, we take point from 3D curve of edge.
+  // To bypass the problem, we take point from 3D curve of EDGE.
   // It solves pb of the bloc_fiss_new.py
   const double tol = 1e-3;
   if ( V < tol || V+tol >= 1. )
   {
-    n1 = V < tol ? u_col1->second.front() : u_col1->second.back();
-    n3 = V < tol ? u_col2->second.front() : u_col2->second.back();
+    nn[0] = V < tol ? u_col1->second.front() : u_col1->second.back();
+    nn[2] = V < tol ? u_col2->second.front() : u_col2->second.back();
     TopoDS_Edge edge;
     if ( V < tol )
     {
@@ -2124,38 +2800,76 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
     }
     else
     {
-      TopoDS_Shape s = myHelper->GetSubShapeByNode( n1, myHelper->GetMeshDS() );
+      TopoDS_Shape s = myHelper->GetSubShapeByNode( nn[0], myHelper->GetMeshDS() );
       if ( s.ShapeType() != TopAbs_EDGE )
-        s = myHelper->GetSubShapeByNode( n3, myHelper->GetMeshDS() );
+        s = myHelper->GetSubShapeByNode( nn[2], myHelper->GetMeshDS() );
       if ( s.ShapeType() == TopAbs_EDGE )
         edge = TopoDS::Edge( s );
     }
     if ( !edge.IsNull() )
     {
-      double u1 = myHelper->GetNodeU( edge, n1 );
-      double u3 = myHelper->GetNodeU( edge, n3 );
+      double u1 = myHelper->GetNodeU( edge, nn[0] );
+      double u3 = myHelper->GetNodeU( edge, nn[2] );
       double u = u1 * ( 1 - hR ) + u3 * hR;
       TopLoc_Location loc; double f,l;
       Handle(Geom_Curve) curve = BRep_Tool::Curve( edge,loc,f,l );
       return curve->Value( u ).Transformed( loc );
     }
   }
-  // END issue 0020680: EDF 1252 SMESH: Bad cell created by Radial prism in center of torus
+  // END issue 0020680: Bad cell created by Radial prism in center of torus
+
+  vR = getRAndNodes( & u_col1->second, V, nn[0], nn[1] );
+  vR = getRAndNodes( & u_col2->second, V, nn[2], nn[3] );
 
-  vR = getRAndNodes( & u_col1->second, V, n1, n2 );
-  vR = getRAndNodes( & u_col2->second, V, n3, n4 );
+  if ( !myShapeID2Surf.empty() ) // side is vertically composite
+  {
+    // find a FACE on which the 4 nodes lie
+    TSideFace* me = (TSideFace*) this;
+    int notFaceID1 = 0, notFaceID2 = 0;
+    for ( int i = 0; i < 4; ++i )
+      if ( nn[i]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) // node on FACE
+      {
+        me->mySurface = me->myShapeID2Surf[ nn[i]->getshapeId() ];
+        notFaceID2 = 0;
+        break;
+      }
+      else if ( notFaceID1 == 0 ) // node on EDGE or VERTEX
+      {
+        me->mySurface  = me->myShapeID2Surf[ nn[i]->getshapeId() ];
+        notFaceID1 = nn[i]->getshapeId();
+      }
+      else if ( notFaceID1 != nn[i]->getshapeId() ) // node on other EDGE or VERTEX
+      {
+        if ( mySurface != me->myShapeID2Surf[ nn[i]->getshapeId() ])
+          notFaceID2 = nn[i]->getshapeId();
+      }
+    if ( notFaceID2 ) // no nodes of FACE and nodes are on different FACEs
+    {
+      SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+      TopoDS_Shape face = myHelper->GetCommonAncestor( meshDS->IndexToShape( notFaceID1 ),
+                                                       meshDS->IndexToShape( notFaceID2 ),
+                                                       *myHelper->GetMesh(),
+                                                       TopAbs_FACE );
+      if ( face.IsNull() ) 
+        throw SALOME_Exception("StdMeshers_PrismAsBlock::TSideFace::Value() face.IsNull()");
+      int faceID = meshDS->ShapeToIndex( face );
+      me->mySurface = me->myShapeID2Surf[ faceID ];
+      if ( !mySurface )
+        throw SALOME_Exception("StdMeshers_PrismAsBlock::TSideFace::Value() !mySurface");
+    }
+  }
   
-  gp_XY uv1 = myHelper->GetNodeUV( mySurface.Face(), n1, n4);
-  gp_XY uv2 = myHelper->GetNodeUV( mySurface.Face(), n2, n3);
+  gp_XY uv1 = myHelper->GetNodeUV( mySurface->Face(), nn[0], nn[2]);
+  gp_XY uv2 = myHelper->GetNodeUV( mySurface->Face(), nn[1], nn[3]);
   gp_XY uv12 = uv1 * ( 1 - vR ) + uv2 * vR;
 
-  gp_XY uv3 = myHelper->GetNodeUV( mySurface.Face(), n3, n2);
-  gp_XY uv4 = myHelper->GetNodeUV( mySurface.Face(), n4, n1);
+  gp_XY uv3 = myHelper->GetNodeUV( mySurface->Face(), nn[2], nn[0]);
+  gp_XY uv4 = myHelper->GetNodeUV( mySurface->Face(), nn[3], nn[1]);
   gp_XY uv34 = uv3 * ( 1 - vR ) + uv4 * vR;
 
   gp_XY uv = uv12 * ( 1 - hR ) + uv34 * hR;
 
-  gp_Pnt p = mySurface.Value( uv.X(), uv.Y() );
+  gp_Pnt p = mySurface->Value( uv.X(), uv.Y() );
   return p;
 }
 
index 42d56fe16ccfc70961435677c61aac61ff17454c..5a3ea214528a7154bd241ecf748dd245168417f8 100644 (file)
 #include "SMESH_Comment.hxx"
 #include "SMESH_Mesh.hxx"
 #include "SMESH_MesherHelper.hxx"
+#include "SMESH_TypeDefs.hxx"
 #include "SMESH_subMesh.hxx"
 
-#include <vector>
-
 #include <Adaptor2d_Curve2d.hxx>
 #include <Adaptor3d_Curve.hxx>
 #include <Adaptor3d_Surface.hxx>
 #include <BRepAdaptor_Surface.hxx>
 #include <TopTools_IndexedMapOfOrientedShape.hxx>
+#include <TopoDS_Face.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_XYZ.hxx>
 
+#include <vector>
 
+namespace Prism_3D
+{
+  struct TNode;
+  struct TPrismTopo;
+}
 class SMESHDS_SubMesh;
 class TopoDS_Edge;
-class TopoDS_Faces;
-struct TNode;
-
-typedef std::vector<const SMDS_MeshNode* > TNodeColumn;
 
+typedef TopTools_IndexedMapOfOrientedShape                       TBlockShapes;
+typedef std::vector<const SMDS_MeshNode* >                       TNodeColumn;
+typedef std::map< double,          TNodeColumn >                 TParam2ColumnMap;
+typedef std::map< double,          TNodeColumn >::const_iterator TParam2ColumnIt;
 // map of bottom nodes to the column of nodes above them
 // (the column includes the bottom nodes)
-typedef std::map< TNode, TNodeColumn >  TNode2ColumnMap;
-typedef std::map< double, TNodeColumn > TParam2ColumnMap;
-typedef std::map< double, TNodeColumn >::const_iterator TParam2ColumnIt;
+typedef std::map< Prism_3D::TNode, TNodeColumn >                 TNode2ColumnMap;
 
-typedef TopTools_IndexedMapOfOrientedShape TBlockShapes;
 
-// ===============================================
-/*!
- * \brief Structure containing node relative data
- */
-// ===============================================
-
-struct TNode
+namespace Prism_3D
 {
-  const SMDS_MeshNode* myNode;
-  mutable gp_XYZ       myParams;
+  // ===============================================
+  /*!
+   * \brief Structure containing node relative data
+   */
+  struct TNode
+  {
+    const SMDS_MeshNode* myNode;
+    mutable gp_XYZ       myParams;
+
+    gp_XYZ GetCoords() const { return gp_XYZ( myNode->X(), myNode->Y(), myNode->Z() ); }
+    gp_XYZ GetParams() const { return myParams; }
+    gp_XYZ& ChangeParams() const { return myParams; }
+    bool HasParams() const { return myParams.X() >= 0.0; }
+    SMDS_TypeOfPosition GetPositionType() const
+    { return myNode ? myNode->GetPosition()->GetTypeOfPosition() : SMDS_TOP_UNSPEC; }
+    bool IsNeighbor( const TNode& other ) const;
+
+    TNode(const SMDS_MeshNode* node = 0): myNode(node), myParams(-1,-1,-1) {}
+    bool operator < (const TNode& other) const { return myNode->GetID() < other.myNode->GetID(); }
+  };
+  // ===============================================
+  /*!
+   * \brief Topological data of the prism
+   */
+  typedef std::list< TFaceQuadStructPtr > TQuadList;
+
+  struct TPrismTopo
+  {
+    TopoDS_Shape             myShape3D;
+    TopoDS_Face              myBottom;
+    TopoDS_Face              myTop;
+    std::list< TopoDS_Edge > myBottomEdges;
+    std::vector< TQuadList>  myWallQuads; // wall sides can be vertically composite
+    std::vector< int >       myRightQuadIndex; // index of right neighbour wall quad
+    std::list< int >         myNbEdgesInWires;
 
-  gp_XYZ GetCoords() const { return gp_XYZ( myNode->X(), myNode->Y(), myNode->Z() ); }
-  gp_XYZ GetParams() const { return myParams; }
-  gp_XYZ& ChangeParams() const { return myParams; }
-  bool HasParams() const { return myParams.X() >= 0.0; }
-  SMDS_TypeOfPosition GetPositionType() const
-  { return myNode ? myNode->GetPosition()->GetTypeOfPosition() : SMDS_TOP_UNSPEC; }
-  bool IsNeighbor( const TNode& other ) const;
+    bool                     myNotQuadOnTop;
 
-  TNode(const SMDS_MeshNode* node = 0): myNode(node), myParams(-1,-1,-1) {}
-  bool operator < (const TNode& other) const { return myNode->GetID() < other.myNode->GetID(); }
-};
+    void Clear();
+  };
+}
 
 // ===============================================================
 /*!
@@ -95,11 +119,9 @@ struct TNode
  *  emulated by division/uniting of missing/excess faces.
  *  It also manage associations between block sub-shapes and a mesh.
  */
-// ===============================================================
-
 class STDMESHERS_EXPORT StdMeshers_PrismAsBlock: public SMESH_Block
 {
-public:
+ public:
   /*!
    * \brief Constructor. Initialization is needed
    */
@@ -109,14 +131,11 @@ public:
 
   /*!
    * \brief Initialization.
-    * \param helper - helper loaded with mesh and 3D shape
-    * \param shape3D - a closed shell or solid
-    * \retval bool - false if a mesh or a shape are KO
-    *
-    * Analyse shape geometry and mesh.
-    * If there are triangles on one of faces, it becomes 'bottom'
+   * \param helper - helper loaded with mesh and 3D shape
+   * \param prism - prism topology
+   * \retval bool - false if a mesh or a shape are KO
    */
-  bool Init(SMESH_MesherHelper* helper, const TopoDS_Shape& shape3D);
+  bool Init(SMESH_MesherHelper* helper, const Prism_3D::TPrismTopo& prism);
 
   /*!
    * \brief Return problem description
@@ -166,7 +185,8 @@ public:
    *        by nodes of the bottom. Layer is a set of nodes at a certain step
    *        from bottom to top.
    */
-  bool GetLayersTransformation(std::vector<gp_Trsf> & trsf) const;
+  bool GetLayersTransformation(std::vector<gp_Trsf> &      trsf,
+                               const Prism_3D::TPrismTopo& prism) const;
   
   /*!
    * \brief Return pointer to mesh
@@ -224,20 +244,6 @@ public:
                             const TParam2ColumnMap& columnsMap,
                             const TopoDS_Edge &     bottomEdge,
                             const int               sideFaceID);
-  /*!
-   * \brief Find wall faces by bottom edges
-    * \param mesh - the mesh
-    * \param mainShape - the prism
-    * \param bottomFace - the bottom face
-    * \param bottomEdges - edges bounding the bottom face
-    * \param wallFaces - faces list to fill in
-   */
-  bool GetWallFaces( SMESH_Mesh*               mesh,
-                     const TopoDS_Shape &      mainShape,
-                     const TopoDS_Shape &      bottomFace,
-                     std::list< TopoDS_Edge >& bottomEdges,
-                     std::list< int > &        nbEInW,
-                     std::list< TopoDS_Face >& wallFaces);
 
 private:
 
@@ -252,25 +258,28 @@ private:
   // --------------------------------------------------------------------
   class TSideFace: public Adaptor3d_Surface
   {
+    typedef boost::shared_ptr<BRepAdaptor_Surface> PSurface;
+
     int                             myID; //!< in-block ID
     // map used to find out real UV by it's normalized UV
     TParam2ColumnMap*               myParamToColumnMap;
-    BRepAdaptor_Surface             mySurface;
+    PSurface                        mySurface;
     TopoDS_Edge                     myBaseEdge;
+    map< int, PSurface >            myShapeID2Surf;
     // first and last normalized params and orientaion for each component or it-self
     std::vector< std::pair< double, double> > myParams;
     bool                            myIsForward;
     std::vector< TSideFace* >       myComponents;
     SMESH_MesherHelper *            myHelper;
   public:
-    TSideFace( SMESH_MesherHelper* helper,
-               const int           faceID,
-               const TopoDS_Face&  face,
-               const TopoDS_Edge&  baseEdge,
-               TParam2ColumnMap*   columnsMap,
-               const double        first = 0.0,
-               const double        last = 1.0);
-    TSideFace( const std::vector< TSideFace* >&             components,
+    TSideFace( SMESH_MesherHelper*        helper,
+               const int                  faceID,
+               const Prism_3D::TQuadList& quadList,
+               const TopoDS_Edge&         baseEdge,
+               TParam2ColumnMap*          columnsMap,
+               const double               first = 0.0,
+               const double               last  = 1.0);
+    TSideFace( const std::vector< TSideFace* >&                  components,
                const std::vector< std::pair< double, double> > & params);
     TSideFace( const TSideFace& other );
     ~TSideFace();
@@ -380,14 +389,12 @@ private:
     myError = SMESH_ComputeError::New(error,comment);
     return myError->IsOK();
   }
-};
+}; // class StdMeshers_PrismAsBlock
 
 // =============================================
 /*!
  * \brief Algo building prisms on a prism shape
  */
-// =============================================
-
 class STDMESHERS_EXPORT StdMeshers_Prism_3D: public SMESH_3D_Algo
 {
 public:
@@ -423,6 +430,28 @@ public:
 
 private:
 
+  /*!
+   * \brief Analyse shape geometry and mesh.
+    * If there are triangles on one of faces, it becomes 'bottom'
+   */
+  bool initPrism(Prism_3D::TPrismTopo& thePrism, const TopoDS_Shape& theSolid);
+
+  /*!
+   * \brief Fill thePrism.myWallQuads and thePrism.myTopEdges
+   */
+  bool getWallFaces( Prism_3D::TPrismTopo& thePrism,
+                     const int             totalNbFaces);
+
+  /*!
+   * \brief Compute mesh on a SOLID
+   */
+  bool compute(const Prism_3D::TPrismTopo& thePrism);
+
+  /*!
+   * \brief Compute 2D mesh on walls FACEs of a prism
+   */
+  bool computeWalls(const Prism_3D::TPrismTopo& thePrism);
+
   /*!
    * \brief Find correspondence between bottom and top nodes.
    *  If elements on the bottom and top faces are topologically different,
@@ -433,11 +462,18 @@ private:
 
   /*!
    * \brief Remove quadrangles from the top face and
-   * create triangles there by projection from the bottom
+   *        create triangles there by projection from the bottom
     * \retval bool - a success or not
    */
   bool projectBottomToTop();
 
+  /*!
+   * \brief Project mesh faces from a source FACE of one prism to
+   *        a source FACE of another prism
+   *  \retval bool - a success or not
+   */
+  bool project2dMesh(const TopoDS_Face& source, const TopoDS_Face& target);
+
   /*!
    * \brief Set projection coordinates of a node to a face and it's sub-shapes
     * \param faceID - the face given by in-block ID
@@ -446,9 +482,20 @@ private:
    */
   bool setFaceAndEdgesXYZ( const int faceID, const gp_XYZ& params, int z );
 
+  /*!
+   * \brief If (!isOK), sets the error to a sub-mesh of a current SOLID
+   */
+  bool toSM( bool isOK );
+
+  /*!
+   * \brief Return index of a shape
+   */
+  int shapeID( const TopoDS_Shape& S );
+
 private:
 
   bool myProjectTriangles;
+  bool mySetErrorToSM;
 
   StdMeshers_PrismAsBlock myBlock;
   SMESH_MesherHelper*     myHelper;
@@ -458,6 +505,7 @@ private:
   // map of bottom nodes to the column of nodes above them
   // (the column includes the bottom node)
   TNode2ColumnMap         myBotToColumnMap;
-};
+
+}; // class StdMeshers_Prism_3D
 
 #endif
index 479bdd6eca6f29bf8d70aec89f7ab05fd2d926e5..38017bf693333e0feff1d6233d840d61b81304d9 100644 (file)
@@ -28,6 +28,7 @@
 #include "StdMeshers_ProjectionSource2D.hxx"
 
 #include "SMESH_Mesh.hxx"
+#include "SMESH_MesherHelper.hxx"
 #include "StdMeshers_ProjectionUtils.hxx"
 
 #include "utilities.h"
@@ -111,7 +112,7 @@ void StdMeshers_ProjectionSource2D::SetVertexAssociation(const TopoDS_Shape& sou
   {
     // possibly there is only 1 vertex in the face
     if ( !_sourceFace.IsNull() &&
-         StdMeshers_ProjectionUtils::Count( _sourceFace, TopAbs_VERTEX, /*ignoreSame=*/true) != 1 )
+         SMESH_MesherHelper::Count( _sourceFace, TopAbs_VERTEX, /*ignoreSame=*/true) != 1 )
       throw SALOME_Exception(LOCALIZED("Two or none pairs of vertices must be provided"));
   }
 
index 76785fad0e64139375d4bbb51da17ac0f2eeb8a4..805915b56aff0f5bfbe7eaa0546b9f54b00d0ba8 100644 (file)
@@ -215,13 +215,12 @@ namespace {
     list<SMESH_subMesh*> subMeshes = tgtMesh1->GetGroupSubMeshesContaining(tgtShape);
     list<SMESH_subMesh*>::iterator sm = subMeshes.begin();
     int type, last = TopAbs_SHAPE;
-    StdMeshers_ProjectionUtils util;
     for ( ; sm != subMeshes.end(); ++sm ) {
       const TopoDS_Shape & group = (*sm)->GetSubShape();
       // check if group is similar to srcGroup
       for ( type = srcGroup.ShapeType(); type < last; ++type)
-        if ( util.Count( srcGroup, (TopAbs_ShapeEnum)type, 0) !=
-             util.Count( group,    (TopAbs_ShapeEnum)type, 0))
+        if ( SMESH_MesherHelper::Count( srcGroup, (TopAbs_ShapeEnum)type, 0) !=
+             SMESH_MesherHelper::Count( group,    (TopAbs_ShapeEnum)type, 0))
           break;
       if ( type == last )
         return group;
@@ -285,7 +284,7 @@ namespace {
         // get edges of the face
         TopoDS_Edge edgeGr1, edgeGr2, verticEdge2;
         list< TopoDS_Edge > edges;    list< int > nbEdgesInWire;
-        SMESH_Block::GetOrderedEdges( face, v1, edges, nbEdgesInWire);
+        SMESH_Block::GetOrderedEdges( face, edges, nbEdgesInWire, v1);
         if ( nbEdgesInWire.front() != 4 )
           return _StoreBadShape( face );
         list< TopoDS_Edge >::iterator edge = edges.begin();
@@ -713,7 +712,7 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       // Maybe groups contain only one member
       TopoDS_Iterator it1( theShape1 ), it2( theShape2 );
       TopAbs_ShapeEnum memberType = it1.Value().ShapeType();
-      int nbMembers = Count( theShape1, memberType, true );
+      int nbMembers = SMESH_MesherHelper::Count( theShape1, memberType, true );
       if ( nbMembers == 0 ) return true;
       if ( nbMembers == 1 ) {
         return FindSubShapeAssociation( it1.Value(), theMesh1, it2.Value(), theMesh2, theMap );
@@ -762,7 +761,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
                   if ( groupEdges[ is2ndGroup ].Contains( f.Current() ))
                     if ( ++nbGroupEdges > 1 )
                       break;
-                bool add = (nbGroupEdges > 1 || Count( face, TopAbs_EDGE, true ) == 1 );
+                bool add = (nbGroupEdges > 1 ||
+                            SMESH_MesherHelper::Count( face, TopAbs_EDGE, true ) == 1 );
                 if ( !add ) {
                   add = true;
                   for ( TopExp_Explorer v( face, TopAbs_VERTEX ); add && v.More(); v.Next())
@@ -779,8 +779,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       }
       // Associate shells
       //
-      int nbFaces1 = Count( shell1, TopAbs_FACE, 0 );
-      int nbFaces2 = Count( shell2, TopAbs_FACE, 0 );
+      int nbFaces1 = SMESH_MesherHelper:: Count( shell1, TopAbs_FACE, 0 );
+      int nbFaces2 = SMESH_MesherHelper:: Count( shell2, TopAbs_FACE, 0 );
       if ( nbFaces1 != nbFaces2 )
         RETURN_BAD_RESULT("Different nb of faces found for shells");
       if ( nbFaces1 > 0 ) {
@@ -997,16 +997,22 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       if ( face2.Orientation() >= TopAbs_INTERNAL ) face2.Orientation( TopAbs_FORWARD );
       TopoDS_Edge edge1, edge2;
       // get outer edge of theShape1
-      edge1 = TopoDS::Edge( OuterShape( face1, TopAbs_EDGE ));
-      // find out if any edge of face2 is a propagation edge of outer edge1
+      TopoDS_Shape wire = OuterShape( face1, TopAbs_WIRE );
+      //edge1 = TopoDS::Edge( OuterShape( face1, TopAbs_EDGE ));
       map<int,TopoDS_Edge> propag_edges; // use map to find the closest propagation edge
-      for ( TopExp_Explorer exp( face2, TopAbs_EDGE ); exp.More(); exp.Next() ) {
-        edge2 = TopoDS::Edge( exp.Current() );
-        pair<int,TopoDS_Edge> step_edge = GetPropagationEdge( theMesh1, edge2, edge1 );
-        if ( !step_edge.second.IsNull() ) { // propagation found
-          propag_edges.insert( step_edge );
-          if ( step_edge.first == 1 ) break; // most close found
+      for ( TopoDS_Iterator edgeIt( wire ); edgeIt.More(); edgeIt.Next() )
+      {
+        edge1 = TopoDS::Edge( edgeIt.Value() );
+        // find out if any edge of face2 is a propagation edge of outer edge1
+        for ( TopExp_Explorer exp( face2, TopAbs_EDGE ); exp.More(); exp.Next() ) {
+          edge2 = TopoDS::Edge( exp.Current() );
+          pair<int,TopoDS_Edge> step_edge = GetPropagationEdge( theMesh1, edge2, edge1 );
+          if ( !step_edge.second.IsNull() ) { // propagation found
+            propag_edges.insert( step_edge );
+            if ( step_edge.first == 1 ) break; // most close found
+          }
         }
+        if ( !propag_edges.empty() && propag_edges.begin()->first == 1 ) break;
       }
       if ( !propag_edges.empty() ) // propagation found
       {
@@ -1118,7 +1124,11 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
   TopoDS_Vertex VV1[2], VV2[2];
 
   if ( vMap1.Extent() != vMap2.Extent() )
-    RETURN_BAD_RESULT("Different nb of vertices");
+  {
+    if ( SMESH_MesherHelper:: Count( theShape1, TopAbs_EDGE, /*ignoreSame=*/false ) !=
+         SMESH_MesherHelper:: Count( theShape2, TopAbs_EDGE, /*ignoreSame=*/false ))
+      RETURN_BAD_RESULT("Different nb of vertices");
+  }
 
   if ( vMap1.Extent() == 1 ) {
     InsertAssociation( vMap1(1), vMap2(1), theMap );
@@ -1158,10 +1168,10 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
   // Find transformation to make the shapes be of similar size at same location
 
   Bnd_Box box[2];
-  for ( int i = 1; i <= vMap1.Extent(); ++i ) {
+  for ( int i = 1; i <= vMap1.Extent(); ++i )
     box[ 0 ].Add( BRep_Tool::Pnt ( TopoDS::Vertex( vMap1( i ))));
+  for ( int i = 1; i <= vMap2.Extent(); ++i )
     box[ 1 ].Add( BRep_Tool::Pnt ( TopoDS::Vertex( vMap2( i ))));
-  }
 
   gp_Pnt gc[2]; // box center
   double x0,y0,z0, x1,y1,z1;
@@ -1281,8 +1291,8 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
     edges1.clear();
     edges2.clear();
 
-    if ( SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbEInW1, outer_wire_algo) !=
-         SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, outer_wire_algo) )
+    if ( SMESH_Block::GetOrderedEdges( face1, edges1, nbEInW1, VV1[0], outer_wire_algo) !=
+         SMESH_Block::GetOrderedEdges( face2, edges2, nbEInW2, VV2[0], outer_wire_algo) )
       CONT_BAD_RESULT("Different number of wires in faces ");
 
     if ( nbEInW1 != nbEInW2 && outer_wire_algo == 0 &&
@@ -1364,8 +1374,8 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
       {
         edges1.clear();
         edges2.clear();
-        SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbEInW1, i_ok_wire_algo);
-        SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, i_ok_wire_algo);
+        SMESH_Block::GetOrderedEdges( face1, edges1, nbEInW1, VV1[0], i_ok_wire_algo);
+        SMESH_Block::GetOrderedEdges( face2, edges2, nbEInW2, VV2[0], i_ok_wire_algo);
       }
       gp_XY dUV = v0f2UV.XY() - v0f1UV.XY(); // UV shift between 2 faces
       //
@@ -2099,33 +2109,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
 
 //================================================================================
 /*!
- * \brief Count nb of sub-shapes
- * \param shape - the shape
- * \param type - the type of sub-shapes to count
- * \retval int - the calculated number
- */
-//================================================================================
-
-int StdMeshers_ProjectionUtils::Count(const TopoDS_Shape&    shape,
-                                      const TopAbs_ShapeEnum type,
-                                      const bool             ignoreSame)
-{
-  if ( ignoreSame ) {
-    TopTools_IndexedMapOfShape map;
-    TopExp::MapShapes( shape, type, map );
-    return map.Extent();
-  }
-  else {
-    int nb = 0;
-    for ( TopExp_Explorer exp( shape, type ); exp.More(); exp.Next() )
-      ++nb;
-    return nb;
-  }
-}
-
-//================================================================================
-/*!
- * \brief Return a boundary EDGE of edgeContainer
+ * \brief Return a boundary EDGE (or all boundary EDGEs) of edgeContainer
  */
 //================================================================================
 
@@ -2223,7 +2207,7 @@ void StdMeshers_ProjectionUtils::SetEventListener(SMESH_subMesh* subMesh,
                                                   TopoDS_Shape   srcShape,
                                                   SMESH_Mesh*    srcMesh)
 {
-  // Set listener that resets an event listener on source submesh when
+  // Set the listener that resets an event listener on source submesh when
   // "ProjectionSource*D" hypothesis is modified since source shape can be changed
   subMesh->SetEventListener( GetHypModifWaiter(),0,subMesh);
 
index 1d22b54b7e4f5d5acb1d46011676a20813b6a8d7..97d55ba22e9aab8f5be44a92242fa641a2893710 100644 (file)
@@ -53,13 +53,13 @@ struct StdMeshers_ShapeShapeBiDirectionMap
 {
   TopTools_DataMapOfShapeShape _map1to2, _map2to1;
 
-  // convension: s1 - target, s2 - source
+  // convention: s1 - target, s2 - source
   bool Bind( const TopoDS_Shape& s1, const TopoDS_Shape& s2 )
   { _map1to2.Bind( s1, s2 ); return _map2to1.Bind( s2, s1 ); }
   bool IsBound( const TopoDS_Shape& s, const bool isShape2=false ) const 
   { return (isShape2 ? _map2to1 : _map1to2).IsBound( s ); }
   bool IsEmpty() const { return _map1to2.IsEmpty(); }
-  int Extent() const { return _map1to2.Extent(); }
+  int  Extent()  const { return _map1to2.Extent(); }
   void Clear() { _map1to2.Clear(); _map2to1.Clear(); }
   const TopoDS_Shape& operator()( const TopoDS_Shape& s, const bool isShape2=false ) const
   { // if we get a Standard_NoSuchObject here, it means that the calling code
@@ -196,17 +196,6 @@ class StdMeshers_ProjectionUtils
    */
   static bool MakeComputed(SMESH_subMesh * sm, const int iterationNb = 0);
 
-  /*!
-   * \brief Count nb of sub-shapes
-    * \param shape - the shape
-    * \param type - the type of sub-shapes to count
-    * \param ignoreSame - if true, use map not to count same shapes, esle use explorer
-    * \retval int - the calculated number
-   */
-  static int Count(const TopoDS_Shape&    shape,
-                   const TopAbs_ShapeEnum type,
-                   const bool             ignoreSame);
-
   /*!
    * \brief Set event listeners to submesh with projection algo
     * \param subMesh - submesh with projection algo
@@ -218,7 +207,7 @@ class StdMeshers_ProjectionUtils
                                SMESH_Mesh*    srcMesh);
 
   /*!
-   * \brief Return a boundary EDGE of edgeContainer
+   * \brief Return a boundary EDGE (or all boundary EDGEs) of edgeContainer
    */
   static TopoDS_Edge GetBoundaryEdge(const TopoDS_Shape&       edgeContainer,
                                      const SMESH_Mesh&         mesh,
index 7e5cfe82181ca4f87276f0a52dc5fe1165b5a2b7..f9fe63dc3c6b87de66f08f83630be7065899a9a9 100644 (file)
@@ -70,7 +70,7 @@ namespace
    * \brief Structure used to temporary remove EventProparatorToEdges from faceSubMesh
    *  in order to prevent propagation of CLEAN event from FACE to EDGEs during 
    *  StdMeshers_Projection_1D2D::Compute(). The CLEAN event is emmited by Pattern mapper
-   * and causes removal of faces generated on adjacent FACEs.
+   *  and causes removal of faces generated on adjacent FACEs.
    */
   struct UnsetterOfEventProparatorToEdges
   {
@@ -108,9 +108,13 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape
 {
   UnsetterOfEventProparatorToEdges eventBarrier( theMesh.GetSubMesh( theShape ));
 
+  // 1) Project faces
+
   if ( !StdMeshers_Projection_2D::Compute(theMesh, theShape))
     return false;
 
+  // 2) Create segments
+
   SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
 
   SMESHDS_SubMesh * faceSubMesh = meshDS->MeshElements( theShape );
@@ -173,7 +177,7 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape
         meshDS->SetMeshElementOnShape( e, edgeID );
       }
     }
-  }   
+  }
 
   return true;
 }
index ad6f45e572bdb05ebb40db1b893de3c05d572e1b..7467a19f9b5a9c913ea337c36cb15fd082ac4337 100644 (file)
@@ -51,6 +51,7 @@
 #include <Bnd_B2d.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopoDS.hxx>
 #include <gp_Ax2.hxx>
@@ -248,7 +249,7 @@ namespace {
   /*!
    * \brief find new nodes belonging to one free border of mesh on face
     * \param sm - submesh on edge or vertex containg nodes to choose from
-    * \param face - the face bound the submesh
+    * \param face - the face bound by the submesh
     * \param u2nodes - map to fill with nodes
     * \param seamNodes - set of found nodes
     * \retval bool - is a success
@@ -290,43 +291,45 @@ namespace {
       if ( !smV1->IsMeshComputed() || !smV2->IsMeshComputed() )
         RETURN_BAD_RESULT("Empty vertex submeshes");
 
-      // Look for a new node on V1
-      nIt = smV1->GetSubMeshDS()->GetNodes();
       const SMDS_MeshNode* nV1 = 0;
-      while ( nIt->more() && !nV1 ) {
-        const SMDS_MeshNode* node = nIt->next();
-        if ( !isOldNode( node ) ) nV1 = node;
-      }
-      if ( !nV1 )
-        RETURN_BAD_RESULT("No new node found on V1");
-
-      // Find a new node connected to nV1 and belonging to edge submesh;
       const SMDS_MeshNode* nE = 0;
-      SMESHDS_SubMesh* smDS = sm->GetSubMeshDS();
-      SMDS_ElemIteratorPtr vElems = nV1->GetInverseElementIterator(SMDSAbs_Face);
-      while ( vElems->more() && !nE ) {
-        const SMDS_MeshElement* elem = vElems->next();
-        int nbNodes = elem->NbNodes();
-        if ( elem->IsQuadratic() )
-          nbNodes /= 2;
-        int iV1 = elem->GetNodeIndex( nV1 );
-        // try next after nV1
-        int iE = SMESH_MesherHelper::WrapIndex( iV1 + 1, nbNodes );
-        if ( smDS->Contains( elem->GetNode( iE ) ))
-          nE = elem->GetNode( iE );
-        if ( !nE ) {
-          // try node before nV1
-          iE = SMESH_MesherHelper::WrapIndex( iV1 - 1, nbNodes );
-          if ( smDS->Contains( elem->GetNode( iE )))
+
+      // Look for nV1 - a new node on V1
+      nIt = smV1->GetSubMeshDS()->GetNodes();
+      while ( nIt->more() && !nE ) {
+        const SMDS_MeshNode* node = nIt->next();
+        if ( isOldNode( node ) ) continue;
+        nV1 = node;
+
+        // Find nE - a new node connected to nV1 and belonging to edge submesh;
+        SMESHDS_SubMesh* smDS = sm->GetSubMeshDS();
+        SMDS_ElemIteratorPtr vElems = nV1->GetInverseElementIterator(SMDSAbs_Face);
+        while ( vElems->more() && !nE ) {
+          const SMDS_MeshElement* elem = vElems->next();
+          int nbNodes = elem->NbNodes();
+          if ( elem->IsQuadratic() )
+            nbNodes /= 2;
+          int iV1 = elem->GetNodeIndex( nV1 );
+          // try next after nV1
+          int iE = SMESH_MesherHelper::WrapIndex( iV1 + 1, nbNodes );
+          if ( smDS->Contains( elem->GetNode( iE ) ))
             nE = elem->GetNode( iE );
-        }
-        if ( nE && elem->IsQuadratic() ) { // find medium node between nV1 and nE
-          if ( Abs( iV1 - iE ) == 1 )
-            nE = elem->GetNode( Min ( iV1, iE ) + nbNodes );
-          else
-            nE = elem->GetNode( elem->NbNodes() - 1 );
+          if ( !nE ) {
+            // try node before nV1
+            iE = SMESH_MesherHelper::WrapIndex( iV1 - 1, nbNodes );
+            if ( smDS->Contains( elem->GetNode( iE )))
+              nE = elem->GetNode( iE );
+          }
+          if ( nE && elem->IsQuadratic() ) { // find medium node between nV1 and nE
+            if ( Abs( iV1 - iE ) == 1 )
+              nE = elem->GetNode( Min ( iV1, iE ) + nbNodes );
+            else
+              nE = elem->GetNode( elem->NbNodes() - 1 );
+          }
         }
       }
+      if ( !nV1 )
+        RETURN_BAD_RESULT("No new node found on V1");
       if ( !nE )
         RETURN_BAD_RESULT("new node on edge not found");
 
@@ -393,7 +396,9 @@ namespace {
 
       // make any local coord systems of src and tgt faces
       vector<gp_Pnt> srcPP, tgtPP; // 3 points on face boundaries to make axes of CS
-      SMESH_subMesh * srcSM = srcMesh->GetSubMesh( srcFace );
+      int tgtNbVert = SMESH_MesherHelper::Count( tgtFace, TopAbs_VERTEX, /*ignoreSame=*/true );
+      int srcNbVert = SMESH_MesherHelper::Count( srcFace, TopAbs_VERTEX, /*ignoreSame=*/true );
+      SMESH_subMesh *         srcSM = srcMesh->GetSubMesh( srcFace );
       SMESH_subMeshIteratorPtr smIt = srcSM->getDependsOnIterator(/*includeSelf=*/false,false);
       srcSM = smIt->next(); // sm of a vertex
       while ( smIt->more() && srcPP.size() < 3 )
@@ -430,7 +435,11 @@ namespace {
           if ( tgtShape.ShapeType() == TopAbs_VERTEX )
           {
             tgtP = BRep_Tool::Pnt( TopoDS::Vertex( tgtShape ));
-            pOK = true;
+            if ( srcNbVert == tgtNbVert || tgtPP.empty() )
+              pOK = true;
+            else
+              pOK = (( tgtP.Distance( tgtPP[0] ) > tol*tol ) &&
+                     ( tgtPP.size() == 1 || tgtP.Distance( tgtPP[1] ) > tol*tol ));
             //cout << "V - nS " << p._node->GetID() << " - nT " << SMESH_Algo::VertexNode(TopoDS::Vertex( tgtShape),tgtMesh->GetMeshDS())->GetID() << endl;
           }
           else if ( tgtPP.size() > 0 )
@@ -786,7 +795,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
   // Make sub-shapes association
   // ---------------------------
 
-  TopoDS_Face tgtFace = TopoDS::Face( theShape.Oriented(TopAbs_FORWARD));
+  TopoDS_Face   tgtFace = TopoDS::Face( theShape.Oriented(TopAbs_FORWARD));
   TopoDS_Shape srcShape = _sourceHypo->GetSourceFace().Oriented(TopAbs_FORWARD);
 
   TAssocTool::TShapeShapeMap shape2ShapeMap;
@@ -797,8 +806,8 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
   {
     if ( srcShape.ShapeType() == TopAbs_FACE )
     {
-      int nbE1 = TAssocTool::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
-      int nbE2 = TAssocTool::Count( srcShape, TopAbs_EDGE, /*ignoreSame=*/true );
+      int nbE1 = SMESH_MesherHelper::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
+      int nbE2 = SMESH_MesherHelper::Count( srcShape, TopAbs_EDGE, /*ignoreSame=*/true );
       if ( nbE1 != nbE2 )
         return error(COMPERR_BAD_SHAPE,
                      SMESH_Comment("Different number of edges in source and target faces: ")
@@ -879,38 +888,47 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
     const bool toProjectNodes =
       ( nbFaceNodes > 0 && ( uvBox.IsVoid() || uvBox.SquareExtent() < DBL_MIN ));
 
-    // Load pattern from the source face
-    SMESH_Pattern mapper;
-    mapper.Load( srcMesh, srcFace, toProjectNodes );
-    if ( mapper.GetErrorCode() != SMESH_Pattern::ERR_OK )
-      return error(COMPERR_BAD_INPUT_MESH,"Can't load mesh pattern from the source face");
-
-    // Find the first target vertex corresponding to first vertex of the <mapper>
+    // Find the corresponding source and target vertex
     // and <theReverse> flag needed to call mapper.Apply()
 
-    TopoDS_Vertex srcV1 = TopoDS::Vertex( mapper.GetSubShape( 1 ));
-    if ( srcV1.IsNull() )
-      RETURN_BAD_RESULT("Mesh is not bound to the face");
-    if ( !shape2ShapeMap.IsBound( srcV1, /*isSrc=*/true ))
-      RETURN_BAD_RESULT("Not associated vertices, srcV1 " << srcV1.TShape().operator->() );
-    TopoDS_Vertex tgtV1 = TopoDS::Vertex( shape2ShapeMap( srcV1, /*isSrc=*/true ));
-
-    if ( !SMESH_MesherHelper::IsSubShape( srcV1, srcFace ))
-      RETURN_BAD_RESULT("Wrong srcV1 " << srcV1.TShape().operator->());
-    if ( !SMESH_MesherHelper::IsSubShape( tgtV1, tgtFace ))
-      RETURN_BAD_RESULT("Wrong tgtV1 " << tgtV1.TShape().operator->());
-
-    // try to find out orientation by order of edges
+    TopoDS_Vertex srcV1, tgtV1;
     bool reverse = false;
+
+    if ( _sourceHypo->HasVertexAssociation() ) {
+      srcV1 = _sourceHypo->GetSourceVertex(1);
+      tgtV1 = _sourceHypo->GetTargetVertex(1);
+    } else {
+      srcV1 = TopoDS::Vertex( TopExp_Explorer( srcFace, TopAbs_VERTEX ).Current() );
+      tgtV1 = TopoDS::Vertex( shape2ShapeMap( srcV1, /*isSrc=*/true ));
+    }
     list< TopoDS_Edge > tgtEdges, srcEdges;
     list< int > nbEdgesInWires;
-    SMESH_Block::GetOrderedEdges( tgtFace, tgtV1, tgtEdges, nbEdgesInWires);
-    SMESH_Block::GetOrderedEdges( srcFace, srcV1, srcEdges, nbEdgesInWires);
-    if ( nbEdgesInWires.front() > 1 ) // possible to find out
+    SMESH_Block::GetOrderedEdges( tgtFace, tgtEdges, nbEdgesInWires, tgtV1 );
+    SMESH_Block::GetOrderedEdges( srcFace, srcEdges, nbEdgesInWires, srcV1 );
+
+    if ( nbEdgesInWires.front() > 1 ) // possible to find out orientation
     {
       TopoDS_Edge srcE1 = srcEdges.front(), tgtE1 = tgtEdges.front();
       TopoDS_Shape srcE1bis = shape2ShapeMap( tgtE1 );
       reverse = ( ! srcE1.IsSame( srcE1bis ));
+      if ( reverse &&
+           _sourceHypo->HasVertexAssociation() &&
+           nbEdgesInWires.front() > 2 &&
+           helper.IsRealSeam( tgtEdges.front() ))
+      {
+        // projection to a face with seam EDGE; pb is that GetOrderedEdges()
+        // always puts a seam EDGE first (if possible) and as a result
+        // we can't use only theReverse flag to correctly associate source
+        // and target faces in the mapper. Thus we select srcV1 so that
+        // GetOrderedEdges() to return EDGEs in a needed order
+        list< TopoDS_Edge >::iterator edge = srcEdges.begin();
+        for ( ; edge != srcEdges.end(); ++edge ) {
+          if ( srcE1bis.IsSame( *edge )) {
+            srcV1 = helper.IthVertex( 0, *edge );
+            break;
+          }
+        }
+      }
     }
     else if ( nbEdgesInWires.front() == 1 )
     {
@@ -922,6 +940,12 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
       RETURN_BAD_RESULT("Bad result from SMESH_Block::GetOrderedEdges()");
     }
 
+    // Load pattern from the source face
+    SMESH_Pattern mapper;
+    mapper.Load( srcMesh, srcFace, toProjectNodes, srcV1 );
+    if ( mapper.GetErrorCode() != SMESH_Pattern::ERR_OK )
+      return error(COMPERR_BAD_INPUT_MESH,"Can't load mesh pattern from the source face");
+
     // --------------------
     // Perform 2D mapping 
     // --------------------
@@ -952,7 +976,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
 
     // Make groups of nodes to merge
 
-    // loop on edge and vertex submeshes of a target face
+    // loop on EDGE and VERTEX sub-meshes of a target FACE
     smIt = tgtSubMesh->getDependsOnIterator(/*includeSelf=*/false,/*complexShapeFirst=*/false);
     while ( smIt->more() )
     {
@@ -963,6 +987,24 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
       //if ( !is1DComputed && sm->GetSubShape().ShapeType() == TopAbs_EDGE )
       //break;
 
+      if ( helper.IsDegenShape( sm->GetId() ) ) // to merge all nodes on degenerated
+      {
+        if ( sm->GetSubShape().ShapeType() == TopAbs_EDGE )
+        {
+          groupsOfNodes.push_back( list< const SMDS_MeshNode* >() );
+          SMESH_subMeshIteratorPtr smDegenIt
+            = sm->getDependsOnIterator(/*includeSelf=*/true,/*complexShapeFirst=*/false);
+          while ( smDegenIt->more() )
+            if (( smDS = smDegenIt->next()->GetSubMeshDS() ))
+            {
+              SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
+              while ( nIt->more() )
+                groupsOfNodes.back().push_back( nIt->next() );
+            }
+        }
+        continue; // do not treat sm of degen VERTEX
+      }
+
       // Sort new and old nodes of a submesh separately
 
       bool isSeam = helper.IsRealSeam( sm->GetId() );
@@ -1021,18 +1063,36 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
           u_oldNode = u2nodesMaps[ OLD_NODES ].begin(); 
           newEnd    = u2nodesMaps[ OLD_NODES ].end();
           for ( ; u_oldNode != newEnd; ++u_oldNode )
-            _badInputElements.push_back( u_oldNode->second );
+            SMESH_Algo::addBadInputElement( u_oldNode->second );
           return error( COMPERR_BAD_INPUT_MESH,
                         SMESH_Comment( "Existing mesh mismatches the projected 2D mesh on " )
                         << ( sm->GetSubShape().ShapeType() == TopAbs_EDGE ? "edge" : "vertex" )
                         << " #" << sm->GetId() );
         }
       if ( isSeam && !mergeSeamToNew ) {
-        //RETURN_BAD_RESULT
-        MESSAGE("Different nb of old and seam nodes " <<
-                u2nodesMaps[ OLD_NODES ].size() << " != " << u2nodesOnSeam.size());
+        const TopoDS_Shape& seam = sm->GetSubShape();
+        if ( u2nodesMaps[ NEW_NODES ].size() > 0 &&
+             u2nodesOnSeam.size()            > 0 &&
+             seam.ShapeType() == TopAbs_EDGE )
+        {
+          int nbE1 = SMESH_MesherHelper::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
+          int nbE2 = SMESH_MesherHelper::Count( srcFace, TopAbs_EDGE, /*ignoreSame=*/true );
+          if ( nbE1 != nbE2 ) // 2 EDGEs are mapped to a seam EDGE
+          {
+            // find the 2 EDGEs of srcFace
+            TopTools_DataMapIteratorOfDataMapOfShapeShape src2tgtIt( shape2ShapeMap._map2to1 );
+            for ( ; src2tgtIt.More(); src2tgtIt.Next() )
+              if ( seam.IsSame( src2tgtIt.Value() ))
+                SMESH_Algo::addBadInputElements
+                  ( srcMesh->GetMeshDS()->MeshElements( src2tgtIt.Key() ));
+            return error( COMPERR_BAD_INPUT_MESH,
+                          "Different number of nodes on two edges projected to a seam edge" );
+          }
+        }
       }
+
       // Make groups of nodes to merge
+
       u_oldNode = u2nodesMaps[ OLD_NODES ].begin(); 
       u_newNode = u2nodesMaps[ NEW_NODES ].begin();
       newEnd    = u2nodesMaps[ NEW_NODES ].end();
@@ -1053,7 +1113,8 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
           groupsOfNodes.back().push_back( u_newNode->second );
           groupsOfNodes.back().push_back( u_newOnSeam->second );
         }
-    }
+
+    } // loop on EDGE and VERTEX submeshes of a target FACE
 
     // Merge
 
@@ -1061,7 +1122,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
     int nbFaceBeforeMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
     editor.MergeNodes( groupsOfNodes );
     int nbFaceAtferMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
-    if ( nbFaceBeforeMerge != nbFaceAtferMerge )
+    if ( nbFaceBeforeMerge != nbFaceAtferMerge && !helper.HasDegeneratedEdges() )
       return error(COMPERR_BAD_INPUT_MESH, "Probably invalid node parameters on geom faces");
 
     // ----------------------------------------------------------------
index ed22742f75124308d1ad897b30ce204fee884a11..7c07b40f30df94dec0fa090391a5199268869a4e 100644 (file)
@@ -219,13 +219,13 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS
                  SMESH_Comment("Target shape must have 1 shell but not ") << nbShell);
 
   // Check that shapes are blocks
-  if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 ||
-       TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 ||
-       TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 )
+  if ( SMESH_MesherHelper::Count( tgtShell, TopAbs_FACE , 1 ) != 6 ||
+       SMESH_MesherHelper::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 ||
+       SMESH_MesherHelper::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 )
     return error(COMPERR_BAD_SHAPE, "Target shape is not a block");
-  if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 ||
-       TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 ||
-       TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 )
+  if ( SMESH_MesherHelper::Count( srcShell, TopAbs_FACE , 1 ) != 6 ||
+       SMESH_MesherHelper::Count( srcShell, TopAbs_EDGE , 1 ) != 12 ||
+       SMESH_MesherHelper::Count( srcShell, TopAbs_WIRE , 1 ) != 6 )
     return error(COMPERR_BAD_SHAPE, "Source shape is not a block");
 
   // Assure that mesh on a source shape is computed
@@ -459,13 +459,13 @@ bool StdMeshers_Projection_3D::Evaluate(SMESH_Mesh& aMesh,
                  SMESH_Comment("Target shape must have 1 shell but not ") << nbShell);
 
   // Check that shapes are blocks
-  if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 ||
-       TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 ||
-       TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 )
+  if ( SMESH_MesherHelper::Count( tgtShell, TopAbs_FACE , 1 ) != 6 ||
+       SMESH_MesherHelper::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 ||
+       SMESH_MesherHelper::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 )
     return error(COMPERR_BAD_SHAPE, "Target shape is not a block");
-  if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 ||
-       TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 ||
-       TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 )
+  if ( SMESH_MesherHelper::Count( srcShell, TopAbs_FACE , 1 ) != 6 ||
+       SMESH_MesherHelper::Count( srcShell, TopAbs_EDGE , 1 ) != 12 ||
+       SMESH_MesherHelper::Count( srcShell, TopAbs_WIRE , 1 ) != 6 )
     return error(COMPERR_BAD_SHAPE, "Source shape is not a block");
 
   // Assure that mesh on a source shape is computed
index d75a5aac2de8c7be2bd8f4387197e17d9199ae3f..5146d08d215d295994281be14f2842b4053a3843 100644 (file)
@@ -78,6 +78,11 @@ typedef SMESH_Comment TComm;
 StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
                                                     SMESH_Gen* gen)
   : SMESH_2D_Algo(hypId, studyId, gen),
+    myQuadranglePreference(false),
+    myTrianglePreference(false),
+    myTriaVertexID(-1),
+    myNeedSmooth(false),
+    myQuadType(QUAD_STANDARD),
     myHelper( 0 )
 {
   MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
@@ -122,6 +127,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
   myQuadType = QUAD_STANDARD;
   myQuadranglePreference = false;
   myTrianglePreference = false;
+  myQuadStruct.reset();
 
   bool isFirstParams = true;
 
@@ -211,10 +217,10 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh&         aMesh,
   _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape);
   myNeedSmooth = false;
 
-  FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
-  std::auto_ptr<FaceQuadStruct> quadDeleter (quad); // to delete quad at exit from Compute()
+  FaceQuadStruct::Ptr quad = CheckNbEdges(aMesh, aShape);
   if (!quad)
     return false;
+  myQuadStruct = quad;
 
   if (myQuadranglePreference) {
     int n1 = quad->side[0]->NbPoints();
@@ -781,24 +787,25 @@ static bool twoEdgesMeatAtVertex(const TopoDS_Edge& e1,
  */
 //=============================================================================
 
-FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMesh,
-                                                       const TopoDS_Shape & aShape)
-  //throw(SALOME_Exception)
+FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMesh,
+                                                           const TopoDS_Shape & aShape)
 {
+  if ( myQuadStruct && myQuadStruct->face.IsSame( aShape ))
+    return myQuadStruct;
+
   TopoDS_Face F = TopoDS::Face(aShape);
   if ( F.Orientation() >= TopAbs_INTERNAL ) F.Orientation( TopAbs_FORWARD );
   const bool ignoreMediumNodes = _quadraticMesh;
 
   // verify 1 wire only, with 4 edges
-  TopoDS_Vertex V;
   list< TopoDS_Edge > edges;
   list< int > nbEdgesInWire;
-  int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+  int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
   if (nbWire != 1) {
     error(COMPERR_BAD_SHAPE, TComm("Wrong number of wires: ") << nbWire);
-    return 0;
+    return FaceQuadStruct::Ptr();
   }
-  FaceQuadStruct* quad = new FaceQuadStruct;
+  FaceQuadStruct::Ptr quad( new FaceQuadStruct );
   quad->uv_grid = 0;
   quad->side.reserve(nbEdgesInWire.front());
   quad->face = F;
@@ -809,7 +816,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
   {
     SMESH_Comment comment;
     SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
-    if (myTriaVertexID == -1)
+    if (myTriaVertexID 1)
     {
       comment << "No Base vertex parameter provided for a trilateral geometrical face";
     }
@@ -853,13 +860,13 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
           comment << meshDS->ShapeToIndex(v.Current()) << (vMap.Extent()==3 ? "]" : ", ");
     }
     error(comment);
-    delete quad;
-    return quad = 0;
+    quad.reset();
+    return quad;
   }
   else if (nbEdgesInWire.front() == 4) // exactly 4 edges
   {
     for (; edgeIt != edges.end(); ++edgeIt, nbSides++)
-      quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt, &aMesh, nbSides < TOP_SIDE,
+      quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt, &aMesh, nbSides < QUAD_TOP_SIDE,
                                                    ignoreMediumNodes, myProxyMesh));
   }
   else if (nbEdgesInWire.front() > 4) // more than 4 edges - try to unite some
@@ -886,14 +893,14 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
       if ( sideEdges.size() == 1 && BRep_Tool::Degenerated( sideEdges.front() ))
         degenSides.push_back( nbSides );
 
-      quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, nbSides < TOP_SIDE,
+      quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, nbSides < QUAD_TOP_SIDE,
                                                    ignoreMediumNodes, myProxyMesh));
       ++nbSides;
     }
     if ( !degenSides.empty() && nbSides - degenSides.size() == 4 )
     {
       myNeedSmooth = true;
-      for ( unsigned i = TOP_SIDE; i < quad->side.size(); ++i )
+      for ( unsigned i = QUAD_TOP_SIDE; i < quad->side.size(); ++i )
         quad->side[i]->Reverse();
 
       for ( int i = degenSides.size()-1; i > -1; --i )
@@ -902,20 +909,19 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
         delete degenSide;
         quad->side.erase( quad->side.begin() + degenSides[ i ] );
       }
-      for ( unsigned i = TOP_SIDE; i < quad->side.size(); ++i )
+      for ( unsigned i = QUAD_TOP_SIDE; i < quad->side.size(); ++i )
         quad->side[i]->Reverse();
 
       nbSides -= degenSides.size();
     }
     // issue 20222. Try to unite only edges shared by two same faces
-    if (nbSides < 4) {
-      // delete found sides
-      { FaceQuadStruct cleaner(*quad); }
-      quad->side.clear();
+    if (nbSides < 4)
+    {
+      quad.reset( new FaceQuadStruct );
       quad->side.reserve(nbEdgesInWire.front());
       nbSides = 0;
 
-      SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+      SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
       while (!edges.empty()) {
         sideEdges.clear();
         sideEdges.splice(sideEdges.end(), edges, edges.begin());
@@ -938,7 +944,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
           }
         }
         quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh,
-                                                     nbSides < TOP_SIDE,
+                                                     nbSides < QUAD_TOP_SIDE,
                                                      ignoreMediumNodes, myProxyMesh));
         ++nbSides;
       }
@@ -953,13 +959,11 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
         MESSAGE (myHelper->GetMeshDS()->ShapeToIndex(quad->side[i]->Edge(e)) << " ");
       MESSAGE (")\n");
     }
-    //cout << endl;
 #endif
     if (!nbSides)
       nbSides = nbEdgesInWire.front();
     error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides);
-    delete quad;
-    quad = 0;
+    quad.reset();
   }
 
   return quad;
@@ -982,10 +986,9 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
   const TopoDS_Face & F = TopoDS::Face(aShape);
 
   // verify 1 wire only, with 4 edges
-  TopoDS_Vertex V;
   list< TopoDS_Edge > edges;
   list< int > nbEdgesInWire;
-  int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+  int nbWire = SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
   if (nbWire != 1) {
     return false;
   }
@@ -1101,7 +1104,7 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
     // issue 20222. Try to unite only edges shared by two same faces
     if (nbSides < 4) {
       nbSides = 0;
-      SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+      SMESH_Block::GetOrderedEdges (F, edges, nbEdgesInWire);
       while (!edges.empty()) {
         sideEdges.clear();
         sideEdges.splice(sideEdges.end(), edges, edges.begin());
@@ -1158,52 +1161,59 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
  */
 //=============================================================================
 
-FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
-                           (SMESH_Mesh &         aMesh,
-                            const TopoDS_Shape & aShape,
-                            const bool           CreateQuadratic) //throw(SALOME_Exception)
+FaceQuadStruct::Ptr
+StdMeshers_Quadrangle_2D::CheckAnd2Dcompute (SMESH_Mesh &         aMesh,
+                                             const TopoDS_Shape & aShape,
+                                             const bool           CreateQuadratic)
 {
   _quadraticMesh = CreateQuadratic;
 
-  FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
-
-  if (!quad) return 0;
-
-  // set normalized grid on unit square in parametric domain
-  bool stat = SetNormalizedGrid(aMesh, aShape, quad);
-  if (!stat) {
-    if (quad) delete quad;
-    quad = 0;
+  FaceQuadStruct::Ptr quad = CheckNbEdges(aMesh, aShape);
+  if ( quad )
+  {
+    // set normalized grid on unit square in parametric domain
+    if (!SetNormalizedGrid(aMesh, aShape, quad))
+      quad.reset();
   }
-
   return quad;
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
 faceQuadStruct::~faceQuadStruct()
 {
-  for (int i = 0; i < side.size(); i++) {
-    if (side[i])     delete side[i];
+  for (size_t i = 0; i < side.size(); i++) {
+    if (side[i]) {
+      delete side[i];
+      for (size_t j = i+1; j < side.size(); j++)
+        if ( side[i] == side[j] )
+          side[j] = 0;
+    }
+  }
+  side.clear();
+
+  if (uv_grid) {
+    delete [] uv_grid;
+    uv_grid = 0;
   }
-  if (uv_grid)       delete [] uv_grid;
 }
 
-namespace {
-  inline const vector<UVPtStruct>& GetUVPtStructIn(FaceQuadStruct* quad, int i, int nbSeg)
+namespace
+{
+  inline const vector<UVPtStruct>& getUVPtStructIn(FaceQuadStruct::Ptr& quad, int i, int nbSeg)
   {
-    bool   isXConst   = (i == BOTTOM_SIDE || i == TOP_SIDE);
-    double constValue = (i == BOTTOM_SIDE || i == LEFT_SIDE) ? 0 : 1;
+    bool   isXConst   = (i == QUAD_BOTTOM_SIDE || i == QUAD_TOP_SIDE);
+    double constValue = (i == QUAD_BOTTOM_SIDE || i == QUAD_LEFT_SIDE) ? 0 : 1;
     return
       quad->isEdgeOut[i] ?
       quad->side[i]->SimulateUVPtStruct(nbSeg,isXConst,constValue) :
       quad->side[i]->GetUVPtStruct(isXConst,constValue);
   }
-  inline gp_UV CalcUV(double x, double y,
+  inline gp_UV calcUV(double x, double y,
                       const gp_UV& a0,const gp_UV& a1,const gp_UV& a2,const gp_UV& a3,
                       const gp_UV& p0,const gp_UV& p1,const gp_UV& p2,const gp_UV& p3)
   {
@@ -1219,9 +1229,9 @@ namespace {
  */
 //=============================================================================
 
-bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
-                                                  const TopoDS_Shape& aShape,
-                                                  FaceQuadStruct* & quad) //throw (SALOME_Exception)
+bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh &          aMesh,
+                                                  const TopoDS_Shape&   aShape,
+                                                  FaceQuadStruct::Ptr & quad)
 {
   // Algorithme décrit dans "Génération automatique de maillages"
   // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
@@ -1257,10 +1267,10 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
 
   UVPtStruct *uv_grid = quad->uv_grid = new UVPtStruct[nbvertic * nbhoriz];
 
-  const vector<UVPtStruct>& uv_e0 = GetUVPtStructIn(quad, 0, nbhoriz - 1);
-  const vector<UVPtStruct>& uv_e1 = GetUVPtStructIn(quad, 1, nbvertic - 1);
-  const vector<UVPtStruct>& uv_e2 = GetUVPtStructIn(quad, 2, nbhoriz - 1);
-  const vector<UVPtStruct>& uv_e3 = GetUVPtStructIn(quad, 3, nbvertic - 1);
+  const vector<UVPtStruct>& uv_e0 = getUVPtStructIn(quad, 0, nbhoriz - 1);
+  const vector<UVPtStruct>& uv_e1 = getUVPtStructIn(quad, 1, nbvertic - 1);
+  const vector<UVPtStruct>& uv_e2 = getUVPtStructIn(quad, 2, nbhoriz - 1);
+  const vector<UVPtStruct>& uv_e3 = getUVPtStructIn(quad, 3, nbvertic - 1);
 
   if (uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty())
     //return error("Can't find nodes on sides");
@@ -1330,7 +1340,7 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
       double x = uv_grid[ij].x;
       double y = uv_grid[ij].y;
 
-      gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
+      gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
 
       uv_grid[ij].u = uv.X();
       uv_grid[ij].v = uv.Y();
@@ -1344,64 +1354,72 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
 //purpose  : auxilary function for ComputeQuadPref
 //=======================================================================
 
-static void ShiftQuad(FaceQuadStruct* quad, const int num, bool)
+static void shiftQuad(FaceQuadStruct::Ptr& quad, const int num, bool)
+{
+  quad->shift( num, /*ori=*/true );
+}
+
+//================================================================================
+/*!
+ * \brief Rotate sides of a quad by nb
+ *  \param nb  - number of rotation quartes 
+ *  \param ori - to keep orientation of sides as in an unit quad or not
+ */
+//================================================================================
+
+void FaceQuadStruct::shift( size_t nb, bool ori )
 {
-  StdMeshers_FaceSide* side[4] = { quad->side[0], quad->side[1],
-                                   quad->side[2], quad->side[3] };
-  for (int i = BOTTOM_SIDE; i < NB_SIDES; ++i) {
-    int id = (i + num) % NB_SIDES;
-    bool wasForward = (i TOP_SIDE);
-    bool newForward = (id < TOP_SIDE);
-    if (wasForward != newForward)
-      side[ i ]->Reverse();
-    quad->side[ id ] = side[ i ];
+  if ( nb == 0 ) return;
+  StdMeshers_FaceSide* sideArr[4] = { side[0], side[1], side[2], side[3] };
+  for (int i = QUAD_BOTTOM_SIDE; i < NB_QUAD_SIDES; ++i) {
+    int id = (i + nb) % NB_QUAD_SIDES;
+    bool wasForward = (i  < QUAD_TOP_SIDE);
+    bool newForward = (id < QUAD_TOP_SIDE);
+    if (ori && wasForward != newForward)
+      sideArr[ i ]->Reverse();
+    side[ id ] = sideArr[ i ];
   }
 }
 
 //=======================================================================
-//function : CalcUV
+//function : calcUV
 //purpose  : auxilary function for ComputeQuadPref
 //=======================================================================
 
-static gp_UV CalcUV(double x0, double x1, double y0, double y1,
-                    FaceQuadStruct* quad,
+static gp_UV calcUV(double x0, double x1, double y0, double y1,
+                    FaceQuadStruct::Ptr& quad,
                     const gp_UV& a0, const gp_UV& a1,
                     const gp_UV& a2, const gp_UV& a3)
 {
-  // const vector<UVPtStruct>& uv_eb = quad->side[0]->GetUVPtStruct(true,0);
-  // const vector<UVPtStruct>& uv_er = quad->side[1]->GetUVPtStruct(false,1);
-  // const vector<UVPtStruct>& uv_et = quad->side[2]->GetUVPtStruct(true,1);
-  // const vector<UVPtStruct>& uv_el = quad->side[3]->GetUVPtStruct(false,0);
-
   double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
   double y = y0 + x * (y1 - y0);
 
-  gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY();
-  gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY();
-  gp_UV p2 = quad->side[TOP_SIDE   ]->Value2d(x).XY();
-  gp_UV p3 = quad->side[LEFT_SIDE  ]->Value2d(y).XY();
+  gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY();
+  gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY();
+  gp_UV p2 = quad->side[QUAD_TOP_SIDE   ]->Value2d(x).XY();
+  gp_UV p3 = quad->side[QUAD_LEFT_SIDE  ]->Value2d(y).XY();
 
-  gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
+  gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
 
   return uv;
 }
 
 //=======================================================================
-//function : CalcUV2
+//function : calcUV2
 //purpose  : auxilary function for ComputeQuadPref
 //=======================================================================
 
-static gp_UV CalcUV2(double x, double y,
-                     FaceQuadStruct* quad,
+static gp_UV calcUV2(double x, double y,
+                     FaceQuadStruct::Ptr& quad,
                      const gp_UV& a0, const gp_UV& a1,
                      const gp_UV& a2, const gp_UV& a3)
 {
-  gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY();
-  gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY();
-  gp_UV p2 = quad->side[TOP_SIDE   ]->Value2d(x).XY();
-  gp_UV p3 = quad->side[LEFT_SIDE  ]->Value2d(y).XY();
+  gp_UV p0 = quad->side[QUAD_BOTTOM_SIDE]->Value2d(x).XY();
+  gp_UV p1 = quad->side[QUAD_RIGHT_SIDE ]->Value2d(y).XY();
+  gp_UV p2 = quad->side[QUAD_TOP_SIDE   ]->Value2d(x).XY();
+  gp_UV p3 = quad->side[QUAD_LEFT_SIDE  ]->Value2d(y).XY();
 
-  gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
+  gp_UV uv = calcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
 
   return uv;
 }
@@ -1415,7 +1433,7 @@ static gp_UV CalcUV2(double x, double y,
 
 bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
                                                 const TopoDS_Shape& aShape,
-                                                FaceQuadStruct*     quad)
+                                                FaceQuadStruct::Ptr quad)
 {
   // Auxilary key in order to keep old variant
   // of meshing after implementation new variant
@@ -1440,21 +1458,21 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
   if (dh>=dv) {
     if (nt>nb) {
       // it is a base case => not shift quad but me be replacement is need
-      ShiftQuad(quad,0,WisF);
+      shiftQuad(quad,0,WisF);
     }
     else {
       // we have to shift quad on 2
-      ShiftQuad(quad,2,WisF);
+      shiftQuad(quad,2,WisF);
     }
   }
   else {
     if (nr>nl) {
       // we have to shift quad on 1
-      ShiftQuad(quad,1,WisF);
+      shiftQuad(quad,1,WisF);
     }
     else {
       // we have to shift quad on 3
-      ShiftQuad(quad,3,WisF);
+      shiftQuad(quad,3,WisF);
     }
   }
 
@@ -1518,13 +1536,9 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
     UpdateDegenUV( quad );
 
   // arrays for normalized params
-  //cout<<"Dump B:"<<endl;
   TColStd_SequenceOfReal npb, npr, npt, npl;
   for (i=0; i<nb; i++) {
     npb.Append(uv_eb[i].normParam);
-    //cout<<"i="<<i<<" par="<<uv_eb[i].normParam<<" npar="<<uv_eb[i].normParam;
-    //const SMDS_MeshNode* N = uv_eb[i].node;
-    //cout<<" node("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
   }
   for (i=0; i<nr; i++) {
     npr.Append(uv_er[i].normParam);
@@ -1552,18 +1566,11 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
       npl.InsertAfter(1,npl.Value(2)-dpr);
     }
   }
-  //cout<<"npb:";
-  //for (i=1; i<=npb.Length(); i++) {
-  //  cout<<" "<<npb.Value(i);
-  //}
-  //cout<<endl;
   
   gp_XY a0(uv_eb.front().u, uv_eb.front().v);
   gp_XY a1(uv_eb.back().u,  uv_eb.back().v);
   gp_XY a2(uv_et.back().u,  uv_et.back().v);
   gp_XY a3(uv_et.front().u, uv_et.front().v);
-  //cout<<" a0("<<a0.X()<<","<<a0.Y()<<")"<<" a1("<<a1.X()<<","<<a1.Y()<<")"
-  //    <<" a2("<<a2.X()<<","<<a2.Y()<<")"<<" a3("<<a3.X()<<","<<a3.Y()<<")"<<endl;
 
   int nnn = Min(nr,nl);
   // auxilary sequence of XY for creation nodes
@@ -1589,7 +1596,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
         // diagonal node
         double y0 = npl.Value(i+1);
         double y1 = npr.Value(i+1);
-        gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1599,7 +1606,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
         for (j=2; j<nl; j++) {
           double y0 = npl.Value(dl+j);
           double y1 = npr.Value(dl+j);
-          gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+          gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
           gp_Pnt P = S->Value(UV.X(),UV.Y());
           SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
           meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1610,14 +1617,6 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
       for (i=1; i<=UVtmp.Length() && UVL.Length()<nbv-nnn; i++) {
         UVL.Append(UVtmp.Value(i));
       }
-      //cout<<"Dump NodesL:"<<endl;
-      //for (i=1; i<=dl+1; i++) {
-      //  cout<<"i="<<i;
-      //  for (j=1; j<=nl; j++) {
-      //    cout<<" ("<<NodesL.Value(i,j)->X()<<","<<NodesL.Value(i,j)->Y()<<","<<NodesL.Value(i,j)->Z()<<")";
-      //  }
-      //  cout<<endl;
-      //}
       // create faces
       for (i=1; i<=dl; i++) {
         for (j=1; j<nl; j++) {
@@ -1660,7 +1659,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
         // diagonal node
         double y0 = npl.Value(i+1);
         double y1 = npr.Value(i+1);
-        gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1670,7 +1669,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
         for (j=2; j<nr; j++) {
           double y0 = npl.Value(nbv-j+1);
           double y1 = npr.Value(nbv-j+1);
-          gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+          gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
           gp_Pnt P = S->Value(UV.X(),UV.Y());
           SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
           meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1733,7 +1732,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
       for (j=1; j<nnn; j++) {
         double y0 = npl.Value(nbv-nnn+j);
         double y1 = npr.Value(nbv-nnn+j);
-        gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1743,12 +1742,6 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
       }
     }
     // add diagonal layers
-    //cout<<"UVL.Length()="<<UVL.Length()<<" UVR.Length()="<<UVR.Length()<<endl;
-    //cout<<"Dump UVL:"<<endl;
-    //for (i=1; i<=UVL.Length(); i++) {
-    //  cout<<" ("<<UVL.Value(i).X()<<","<<UVL.Value(i).Y()<<")";
-    //}
-    //cout<<endl;
     gp_UV A2 = UVR.Value(nbv-nnn);
     gp_UV A3 = UVL.Value(nbv-nnn);
     for (i=1; i<nbv-nnn; i++) {
@@ -1759,7 +1752,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
         double x = npb.Value(j);
         gp_UV p0( uv_eb[j-1].u, uv_eb[j-1].v );
         gp_UV p2 = UVT.Value( j-1 );
-        gp_UV UV = CalcUV(x, y, a0, a1, A2, A3, p0,p1,p2,p3 );
+        gp_UV UV = calcUV(x, y, a0, a1, A2, A3, p0,p1,p2,p3 );
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y());
@@ -1798,7 +1791,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
       for (j=2; j<nb; j++) {
         double x = npb.Value(j);
         double y = (1-x) * npl.Value(i+1) + x * npr.Value(i+1);
-        gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(),UV.Y());
@@ -1848,7 +1841,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
           for (j=1; j<nb; j++) {
             double x = npt.Value(i+1) + npb.Value(j)*(1-npt.Value(i+1));
             double y = y0 + dy*x;
-            gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+            gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
             gp_Pnt P = S->Value(UV.X(),UV.Y());
             SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
             meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1865,7 +1858,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
             double x = npt.Value(i+1+drl) + 
               npb.Value(j) * (npt.Value(nt-i) - npt.Value(i+1+drl));
             double y = yy0 + dyy*x;
-            gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+            gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
             gp_Pnt P = S->Value(UV.X(),UV.Y());
             SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
             meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1891,7 +1884,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
           for (j=2; j<=nb; j++) {
             double x = npb.Value(j)*npt.Value(nt-i);
             double y = y0 + dy*x;
-            gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+            gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
             gp_Pnt P = S->Value(UV.X(),UV.Y());
             SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
             meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -1908,7 +1901,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
             double x = npt.Value(i+1) + 
               npb.Value(j) * (npt.Value(nt-i-drl) - npt.Value(i+1));
             double y = yy0 + dyy*x;
-            gp_UV UV = CalcUV2(x, y, quad, a0, a1, a2, a3);
+            gp_UV UV = calcUV2(x, y, quad, a0, a1, a2, a3);
             gp_Pnt P = S->Value(UV.X(),UV.Y());
             SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
             meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -2147,13 +2140,13 @@ namespace
 
   inline  SMDS_MeshNode* makeNode( UVPtStruct &         uvPt,
                                    const double         y,
-                                   FaceQuadStruct*      quad,
+                                   FaceQuadStruct::Ptr& quad,
                                    const gp_UV*         UVs,
                                    SMESH_MesherHelper*  helper,
                                    Handle(Geom_Surface) S)
   {
-    const vector<UVPtStruct>& uv_eb = quad->side[BOTTOM_SIDE]->GetUVPtStruct();
-    const vector<UVPtStruct>& uv_et = quad->side[TOP_SIDE   ]->GetUVPtStruct();
+    const vector<UVPtStruct>& uv_eb = quad->side[QUAD_BOTTOM_SIDE]->GetUVPtStruct();
+    const vector<UVPtStruct>& uv_et = quad->side[QUAD_TOP_SIDE   ]->GetUVPtStruct();
     double rBot = ( uv_eb.size() - 1 ) * uvPt.normParam;
     double rTop = ( uv_et.size() - 1 ) * uvPt.normParam;
     int iBot = int( rBot );
@@ -2162,11 +2155,11 @@ namespace
     double xTop = uv_et[ iTop ].normParam + ( rTop - iTop ) * ( uv_et[ iTop+1 ].normParam - uv_et[ iTop ].normParam );
     double x = xBot + y * ( xTop - xBot );
     
-    gp_UV uv = CalcUV(/*x,y=*/x, y,
+    gp_UV uv = calcUV(/*x,y=*/x, y,
                       /*a0,...=*/UVs[UV_A0], UVs[UV_A1], UVs[UV_A2], UVs[UV_A3],
-                      /*p0=*/quad->side[BOTTOM_SIDE]->Value2d( x ).XY(),
+                      /*p0=*/quad->side[QUAD_BOTTOM_SIDE]->Value2d( x ).XY(),
                       /*p1=*/UVs[ UV_R ],
-                      /*p2=*/quad->side[TOP_SIDE   ]->Value2d( x ).XY(),
+                      /*p2=*/quad->side[QUAD_TOP_SIDE   ]->Value2d( x ).XY(),
                       /*p3=*/UVs[ UV_L ]);
     gp_Pnt P = S->Value( uv.X(), uv.Y() );
     uvPt.u = uv.X();
@@ -2178,7 +2171,7 @@ namespace
                  vector<UVPtStruct>&       next_base,
                  const int                 j,
                  int &                     next_base_len,
-                 FaceQuadStruct*           quad,
+                 FaceQuadStruct::Ptr&      quad,
                  gp_UV*                    UVs,
                  const double              y,
                  SMESH_MesherHelper*       helper,
@@ -2247,7 +2240,7 @@ namespace
                  vector<UVPtStruct>&       next_base,
                  const int                 j,
                  int &                     next_base_len,
-                 FaceQuadStruct*           quad,
+                 FaceQuadStruct::Ptr&      quad,
                  gp_UV*                    UVs,
                  const double              y,
                  SMESH_MesherHelper*       helper,
@@ -2310,7 +2303,7 @@ namespace
                                      vector<UVPtStruct>&       next_base,
                                      const int                 j,
                                      int &                     next_base_len,
-                                     FaceQuadStruct*           quad,
+                                     FaceQuadStruct::Ptr &     quad,
                                      gp_UV*                    UVs,
                                      const double              y,
                                      SMESH_MesherHelper*       helper,
@@ -2325,7 +2318,7 @@ namespace
 //=======================================================================
 bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
                                                const TopoDS_Shape& aShape,
-                                               FaceQuadStruct*     quad)
+                                               FaceQuadStruct::Ptr quad)
 {
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   const TopoDS_Face& F = TopoDS::Face(aShape);
@@ -2398,21 +2391,21 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
     if (dh >= dv) {
       if (nt > nb) {
         // it is a base case => not shift quad but may be replacement is need
-        ShiftQuad(quad,0,true);
+        shiftQuad(quad,0,true);
       }
       else {
         // we have to shift quad on 2
-        ShiftQuad(quad,2,true);
+        shiftQuad(quad,2,true);
       }
     }
     else {
       if (nr > nl) {
         // we have to shift quad on 1
-        ShiftQuad(quad,1,true);
+        shiftQuad(quad,1,true);
       }
       else {
         // we have to shift quad on 3
-        ShiftQuad(quad,3,true);
+        shiftQuad(quad,3,true);
       }
     }
 
@@ -2520,7 +2513,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
         // diagonal node
         double y0 = npl.Value(i+1);
         double y1 = npr.Value(i+1);
-        gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -2530,7 +2523,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
         for (j=2; j<nl; j++) {
           double y0 = npl.Value(dl+j);
           double y1 = npr.Value(dl+j);
-          gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+          gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
           gp_Pnt P = S->Value(UV.X(),UV.Y());
           SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
           meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -2575,7 +2568,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
         // diagonal node
         double y0 = npl.Value(i+1);
         double y1 = npr.Value(i+1);
-        gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode * N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -2585,7 +2578,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
         for (j=2; j<nr; j++) {
           double y0 = npl.Value(nbv-j+1);
           double y1 = npr.Value(nbv-j+1);
-          gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+          gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
           gp_Pnt P = S->Value(UV.X(),UV.Y());
           SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
           meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -2640,7 +2633,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
       for (j=1; j<nnn; j++) {
         double y0 = npl.Value(nbv-nnn+j);
         double y1 = npr.Value(nbv-nnn+j);
-        gp_UV UV = CalcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
+        gp_UV UV = calcUV(x0, x1, y0, y1, quad, a0, a1, a2, a3);
         gp_Pnt P = S->Value(UV.X(),UV.Y());
         SMDS_MeshNode* N = meshDS->AddNode(P.X(), P.Y(), P.Z());
         meshDS->SetNodeOnFace(N, geomFaceID, UV.X(), UV.Y());
@@ -2676,21 +2669,21 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
     if (nr == nl) {
       if (nt < nb) {
         // it is a base case => not shift quad
-        //ShiftQuad(quad,0,true);
+        //shiftQuad(quad,0,true);
       }
       else {
         // we have to shift quad on 2
-        ShiftQuad(quad,2,true);
+        shiftQuad(quad,2,true);
       }
     }
     else {
       if (nl > nr) {
         // we have to shift quad on 1
-        ShiftQuad(quad,1,true);
+        shiftQuad(quad,1,true);
       }
       else {
         // we have to shift quad on 3
-        ShiftQuad(quad,3,true);
+        shiftQuad(quad,3,true);
       }
     }
 
@@ -3273,7 +3266,7 @@ namespace // data for smoothing
  */
 //================================================================================
 
-void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad)
+void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct::Ptr quad)
 {
   for ( unsigned i = 0; i < quad->side.size(); ++i )
   {
@@ -3291,7 +3284,7 @@ void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad)
 
     // find another side sharing the degenerated shape
     bool isPrev = ( degenInd == 0 );
-    if ( i >= TOP_SIDE )
+    if ( i >= QUAD_TOP_SIDE )
       isPrev = !isPrev;
     int i2 = ( isPrev ? ( i + 3 ) : ( i + 1 )) % 4;
     StdMeshers_FaceSide* side2 = quad->side[ i2 ];
@@ -3318,7 +3311,7 @@ void StdMeshers_Quadrangle_2D::UpdateDegenUV(FaceQuadStruct* quad)
  */
 //================================================================================
 
-void StdMeshers_Quadrangle_2D::Smooth (FaceQuadStruct* quad)
+void StdMeshers_Quadrangle_2D::Smooth (FaceQuadStruct::Ptr quad)
 {
   if ( !myNeedSmooth ) return;
 
index 000c01f66103b74908cec7eacb1abe52e68ac604..6ffe0e68f325c36f2fc0a003d87d7d9076105dcb 100644 (file)
@@ -42,16 +42,18 @@ class StdMeshers_FaceSide;
 struct uvPtStruct;
 
 
-enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES };
+enum TSideID { QUAD_BOTTOM_SIDE=0, QUAD_RIGHT_SIDE, QUAD_TOP_SIDE, QUAD_LEFT_SIDE, NB_QUAD_SIDES };
 
 typedef uvPtStruct UVPtStruct;
 typedef struct faceQuadStruct
 {
   std::vector< StdMeshers_FaceSide*> side;
-  bool isEdgeOut[4]; // true, if an edge has more nodes, than the opposite
+  bool isEdgeOut[4]; // true, if an EDGE has more nodes, than an opposite one
   UVPtStruct* uv_grid;
   TopoDS_Face face;
   ~faceQuadStruct();
+  void shift( size_t nb, bool keepUnitOri );
+  typedef boost::shared_ptr<faceQuadStruct> Ptr;
 } FaceQuadStruct;
 
 class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
@@ -70,12 +72,12 @@ public:
   virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
                         MapShapeNbElems& aResMap);
 
-  FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
-                                    const TopoDS_Shape& aShape,
-                                    const bool CreateQuadratic);
+  FaceQuadStruct::Ptr CheckAnd2Dcompute(SMESH_Mesh& aMesh,
+                                        const TopoDS_Shape& aShape,
+                                        const bool CreateQuadratic);
 
-  FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh,
-                               const TopoDS_Shape& aShape);
+  FaceQuadStruct::Ptr CheckNbEdges(SMESH_Mesh& aMesh,
+                                   const TopoDS_Shape& aShape);
 
 protected:
 
@@ -85,9 +87,9 @@ protected:
                                std::vector<int>& aNbNodes,
                                bool& IsQuadratic);
 
-  bool SetNormalizedGrid(SMESH_Mesh& aMesh,
-                         const TopoDS_Shape& aShape,
-                         FaceQuadStruct*& quad);
+  bool SetNormalizedGrid(SMESH_Mesh&          aMesh,
+                         const TopoDS_Shape&  aShape,
+                         FaceQuadStruct::Ptr& quad);
   
   void SplitQuad(SMESHDS_Mesh *theMeshDS,
                  const int theFaceID,
@@ -96,23 +98,23 @@ protected:
                  const SMDS_MeshNode* theNode3,
                  const SMDS_MeshNode* theNode4);
 
-  bool ComputeQuadPref(SMESH_Mesh& aMesh,
+  bool ComputeQuadPref(SMESH_Mesh&         aMesh,
                        const TopoDS_Shape& aShape,
-                       FaceQuadStruct* quad);
+                       FaceQuadStruct::Ptr quad);
 
-  bool EvaluateQuadPref(SMESH_Mesh& aMesh,
+  bool EvaluateQuadPref(SMESH_Mesh&         aMesh,
                         const TopoDS_Shape& aShape,
-                        std::vector<int>& aNbNodes,
-                        MapShapeNbElems& aResMap,
-                        bool IsQuadratic);
+                        std::vector<int>&   aNbNodes,
+                        MapShapeNbElems&    aResMap,
+                        bool                isQuadratic);
 
-  bool ComputeReduced (SMESH_Mesh& aMesh,
+  bool ComputeReduced (SMESH_Mesh&         aMesh,
                        const TopoDS_Shape& aShape,
-                       FaceQuadStruct* quad);
+                       FaceQuadStruct::Ptr quad);
 
-  void UpdateDegenUV(FaceQuadStruct* quad);
+  void UpdateDegenUV(FaceQuadStruct::Ptr quad);
 
-  void Smooth (FaceQuadStruct* quad);
+  void Smooth (FaceQuadStruct::Ptr quad);
 
 
   // true if QuadranglePreference hypothesis is assigned that forces
@@ -132,6 +134,8 @@ protected:
   SMESH_MesherHelper*  myHelper; // tool for working with quadratic elements
 
   SMESH_ProxyMesh::Ptr myProxyMesh;
+
+  FaceQuadStruct::Ptr  myQuadStruct;
 };
 
 #endif
index 6ae4ac7873760e900178b83489e59f021251ef4c..ec34a041c16fa3710287259ebe06a6f5d7f979e2 100644 (file)
 // Created   : Fri Oct 20 11:37:07 2006
 // Author    : Edward AGAPOV (eap)
 //
+
 #include "StdMeshers_RadialPrism_3D.hxx"
 
+#include <Basics_OCCTVersion.hxx>
+
 #include "StdMeshers_ProjectionUtils.hxx"
 #include "StdMeshers_NumberOfLayers.hxx"
 #include "StdMeshers_LayerDistribution.hxx"
 
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
+#if OCC_VERSION_LARGE > 0x06050400
+#include <BRepClass3d.hxx>
+#else
 #include <BRepTools.hxx>
+#endif
 #include <BRep_Tool.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
@@ -55,7 +62,6 @@
 #include <gp.hxx>
 #include <gp_Pnt.hxx>
 
-
 using namespace std;
 
 #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
@@ -162,7 +168,11 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a
 
   // get 2 shells
   TopoDS_Solid solid = TopoDS::Solid( aShape );
+#if OCC_VERSION_LARGE > 0x06050400
+  TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid );
+#else
   TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
+#endif
   TopoDS_Shape innerShell;
   int nbShells = 0;
   for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
@@ -402,7 +412,11 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh,
 {
   // get 2 shells
   TopoDS_Solid solid = TopoDS::Solid( aShape );
+#if OCC_VERSION_LARGE > 0x06050400
+  TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid );
+#else
   TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
+#endif
   TopoDS_Shape innerShell;
   int nbShells = 0;
   for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
index 0a033c0335ffa6b3b4715be869982c90ecf62419..1e5234d6ba4b8295b5f9056e8940a5232c62b895 100644 (file)
@@ -42,6 +42,8 @@
 
 #include <SALOMEDSClient_Study.hxx>
 
+#include <GEOM_wrap.hxx>
+
 // SALOME GUI includes
 #include <SUIT_ResourceMgr.h>
 
@@ -418,7 +420,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
 
       GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
       _PTR(Study)         aStudy = SMESH::GetActiveStudyDocument();
-      GEOM::GEOM_IShapesOperations_var shapeOp;
+      GEOM::GEOM_IShapesOperations_wrap shapeOp;
       if ( !geomGen->_is_nil() && aStudy )
         shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() );
       if ( !shapeOp->_is_nil() )
index 637163f66e0b37f0e00db5c66144bc68d06f10bf..03b6750b641a71b3691ed7c7396b0f6907ffbd90 100644 (file)
@@ -68,9 +68,6 @@
 #include <TopExp_Explorer.hxx>
 #include <StdSelect_TypeOfEdge.hxx>
 
-// SALOME KERNEL includes
-#include <SALOMEDS_SObject.hxx>
-
 
 #define SPACING 6
 #define MARGIN 0
@@ -251,7 +248,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::SelectionIntoArgument()
       
       GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( IO->getEntry() );
       if ( !CORBA::is_nil( aGeomObj ) ) { // Selected Object From Study
-        GEOM::GEOM_Object_ptr aGeomFatherObj = aGeomObj->GetMainShape();
+        GEOM::GEOM_Object_var aGeomFatherObj = aGeomObj->GetMainShape();
         QString aFatherEntry = "";
         QString aMainFatherEntry = "";
         TopoDS_Shape shape;
@@ -259,13 +256,13 @@ void StdMeshersGUI_SubShapeSelectorWdg::SelectionIntoArgument()
           // Get Main Shape
           GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry );
           if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) {  // Main Shape is a Group
-            GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape();
+            GEOM::GEOM_Object_var aMainFatherObj = aGeomMain->GetMainShape();
             if ( !CORBA::is_nil( aMainFatherObj ) )
               aMainFatherEntry = aMainFatherObj->GetStudyEntry();
           }
           aFatherEntry = aGeomFatherObj->GetStudyEntry();
         }
-        
+
         if ( aFatherEntry != "" && ( aFatherEntry == myEntry || aFatherEntry == aMainFatherEntry ) )
         {
           if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object
@@ -470,18 +467,17 @@ GEOM::GEOM_Object_var StdMeshersGUI_SubShapeSelectorWdg::GetGeomObjectByEntry( c
 {
   GEOM::GEOM_Object_var aGeomObj;
   SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
-  if (aStudy != 0) {
+  if ( !aStudy->_is_nil() )
+  {
     SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() );
-    SALOMEDS::GenericAttribute_var anAttr;
-
-    if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
-      SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-      CORBA::String_var aVal = anIOR->Value();
-      CORBA::Object_var obj = aStudy->ConvertIORToObject(aVal);
+    if (!aSObj->_is_nil() )
+    {
+      CORBA::Object_var obj = aSObj->GetObject();
       aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+      aSObj->UnRegister();
     }
   }
-  return aGeomObj;
+  return aGeomObj._retn();
 }
 
 //=================================================================================
index e2ad321413d5ecb4df9ab0a22d3349fcc2102e73..cf6eb69862ab52d6268d5fc323acb3830efe02b5 100644 (file)
@@ -32,8 +32,9 @@
 #include "SMESH_PythonDump.hxx"
 #include "StdMeshers_ObjRefUlils.hxx"
 
-#include "Utils_CorbaException.hxx"
-#include "utilities.h"
+#include <Utils_CorbaException.hxx>
+#include <utilities.h>
+#include <SALOMEDS_wrap.hxx>
 
 #include <TCollection_AsciiString.hxx>
 
@@ -97,7 +98,7 @@ void StdMeshers_ImportSource1D_i::SetSourceEdges(const SMESH::ListOfGroups& grou
           THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
         smesh_groups.push_back( gp_i->GetSmeshGroup() );
 
-        SALOMEDS::SObject_var so = SMESH_Gen_i::GetSMESHGen()->ObjectToSObject(study, groups[i]);
+        SALOMEDS::SObject_wrap so = SMESH_Gen_i::ObjectToSObject(study, groups[i]);
         if ( !so->_is_nil())
         {
           CORBA::String_var entry = so->GetID();
@@ -178,8 +179,8 @@ char* StdMeshers_ImportSource1D_i::SaveTo()
     os << " " << _groupEntries[i];
 
     // id
-    SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
-    CORBA::Object_var groupObj;
+    SALOMEDS::SObject_wrap groupSO = study->FindObjectID( _groupEntries[i] );
+    CORBA::Object_var     groupObj;
     if ( !groupSO->_is_nil() )
       groupObj = groupSO->GetObject();
     StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
index 35f9d3fb057df4c56780dba5ef81881e609b3ad2..29d14804dc30becf2212cd7a4848536d0c5842fe 100644 (file)
@@ -97,11 +97,12 @@ void StdMeshers_ImportSource2D_i::SetSourceFaces(const SMESH::ListOfGroups& grou
           THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
         smesh_groups.push_back( gp_i->GetSmeshGroup() );
 
-        SALOMEDS::SObject_var so = SMESH_Gen_i::GetSMESHGen()->ObjectToSObject(study, groups[i]);
+        SALOMEDS::SObject_var so = SMESH_Gen_i::ObjectToSObject(study, groups[i]);
         if ( !so->_is_nil())
         {
           CORBA::String_var entry = so->GetID();
           entries.push_back( entry.in() );
+          so->UnRegister();
         }
       }
     this->GetImpl()->SetGroups( smesh_groups );
@@ -179,9 +180,11 @@ char* StdMeshers_ImportSource2D_i::SaveTo()
 
     // id
     SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
-    CORBA::Object_var groupObj;
-    if ( !groupSO->_is_nil() )
+    CORBA::Object_var    groupObj;
+    if ( !groupSO->_is_nil() ) {
       groupObj = groupSO->GetObject();
+      groupSO->UnRegister();
+    }
     StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
   }
 
index e162f22aa32c593f1e684866a137b9f53e1354f6..0d4381be1ac1aec28b2115d61394e182d53b69c0 100644 (file)
@@ -88,11 +88,16 @@ void StdMeshers_LayerDistribution_i::SetLayerDistribution(SMESH::SMESH_Hypothesi
     this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() );
     myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D );
     // Remove SO of 1D hypothesis if it was published
-    if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
+    if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen())
+    {
       SALOMEDS::Study_var study = gen->GetCurrentStudy();
-      SALOMEDS::SObject_var SO = gen->ObjectToSObject( study, hyp1D );
+      SALOMEDS::SObject_var  SO = gen->ObjectToSObject( study, hyp1D );
       if ( ! SO->_is_nil() )
-        study->NewBuilder()->RemoveObjectWithChildren( SO );
+      {
+        SALOMEDS::StudyBuilder_var builder = study->NewBuilder();
+        builder->RemoveObjectWithChildren( SO );
+        SO->UnRegister();
+      }
     }
     // Update Python script: write creation of 1D hyp as it is not published and
     // for this, SMESH_Gen does not write it's creation
index 910d0aaa870d886314d0a6cd276ee3d0405a7ff7..390bd34c57765a21a4b39b7d67313b37ed0a8bac 100644 (file)
@@ -27,6 +27,7 @@
 //
 #include "StdMeshers_ObjRefUlils.hxx"
 
+#include <SALOMEDS_wrap.hxx>
 #include <TopoDS_Shape.hxx>
 
 using namespace std;
@@ -60,8 +61,8 @@ StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject (const std::string&  theEntry,
   if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
     SALOMEDS::Study_var study = gen->GetCurrentStudy();
     if ( ! theEntry.empty() && ! study->_is_nil() ) {
-      SALOMEDS::SObject_var sobj= study->FindObjectID( theEntry.c_str() );
-      CORBA::Object_var obj = gen->SObjectToObject( sobj );
+      SALOMEDS::SObject_wrap sobj = study->FindObjectID( theEntry.c_str() );
+      CORBA::Object_var       obj = gen->SObjectToObject( sobj );
       geom = GEOM::GEOM_Object::_narrow( obj );
     }
   }
@@ -87,9 +88,10 @@ void StdMeshers_ObjRefUlils::SaveToStream( const TopoDS_Shape& theShape, ostream
     if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
       GEOM::GEOM_Object_var geom = gen->ShapeToGeomObject( theShape );
       if ( ! geom->_is_nil() ) {
-        SALOMEDS::SObject_var sobj = gen->ObjectToSObject( gen->GetCurrentStudy(), geom );
+        SALOMEDS::SObject_wrap sobj = gen->ObjectToSObject( gen->GetCurrentStudy(), geom );
         if ( !sobj->_is_nil() ) {
-          stream << " " << sobj->GetID();
+          CORBA::String_var entry = sobj->GetID();
+          stream << " " << entry.in();
           ok = true;
         }
       }
@@ -114,9 +116,9 @@ TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream)
     if ( ! study->_is_nil() ) {
       string str;
       if (stream >> str) {
-        SALOMEDS::SObject_var sobj= study->FindObjectID( str.c_str() );
-        CORBA::Object_var obj = gen->SObjectToObject( sobj );
-        GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj );
+        SALOMEDS::SObject_wrap sobj = study->FindObjectID( str.c_str() );
+        CORBA::Object_var       obj = gen->SObjectToObject( sobj );
+        GEOM::GEOM_Object_var  geom = GEOM::GEOM_Object::_narrow( obj );
         return gen->GeomObjectToShape( geom.in() );
       }
     }
index 0ae4437e0ae15eeeee450a57684d1bfb2c5204f2..08284c21ab4cdf5b3aa71837bf2e454bbf1fe1fe 100644 (file)
@@ -1121,8 +1121,8 @@ void Maillage::outputMED(std::string fichierMED)
           // Création de la famille
           if (MEDfamilyCr(fid, maa, nomfam, numfam, 0, MED_NO_GROUP) < 0)
             ERREUR("Error MEDfamilyCr");
-         delete gro;
-       }
+          delete gro;
+        }
 
     }
 
@@ -1437,7 +1437,7 @@ void Maillage::outputMED(std::string fichierMED)
           if (MEDfamilyCr(fid, maa, nomfam, numfam, 1, gro) < 0)
             ERREUR("Error MEDfamilyCr");
 
-         delete gro;
+          delete gro;
         }
     }
 
index c92765d78c8c7b739a31766545cd43d2d4581d5e..43158e05d7c3650714744bfd447001ad707d8119 100644 (file)
@@ -20,7 +20,7 @@
 # Modules Python
 # Modules Eficas
 
-import os
+import os, subprocess
 from YamsPlugDialog import Ui_YamsPlugDialog
 from monViewText import MonViewText
 from PyQt4.QtGui import *
@@ -64,11 +64,8 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
           maDoc=os.environ['DISTENE_YAMS_DOC_PDF']
         except Exception:
           QMessageBox.warning( self, "Help unavailable", str(maDoc) + " not found")
-        old_ld=os.getenv("LD_LIBRARY_PATH")
-        command="unset LD_LIBRARY_PATH;"
-        command+="xdg-open "+maDoc+";"
-        command+="export LD_LIBRARY_PATH=%s"%old_ld
-        os.system(command)
+        command="xdg-open "+maDoc+";"
+       subprocess.call(command, shell=True)
 
 
   def PBOKPressed(self):
index 612906070fcc2cea2670c78ce35a77d85f553742..76c71870eb64e1e853c46dea32b8606c7886e8de 100644 (file)
@@ -294,9 +294,9 @@ CORBA::Long MeshJobManager_i::initialize(const MESHJOB::MeshJobParameterList & m
       break;
     default:
       _lastErrorMessage =
-       std::string("The type of the file ")+
-       std::string(currentMesh.file_name)+
-       std::string(" is not recognized");
+        std::string("The type of the file ")+
+        std::string(currentMesh.file_name)+
+        std::string(" is not recognized");
       LOG(_lastErrorMessage);
       return JOBID_UNDEFINED;
     }
index f53d7aa34888ce4f4b12fa44e2a81a0b1719cfd2..40e2a96ce1d8cd4cef43d712264fee69e699ba05 100644 (file)
@@ -42,9 +42,9 @@ public:
   ~MeshJobManager_i();
 
   bool           configure  (const char *configId,
-                            const MESHJOB::ConfigParameter & configParameter);
+                             const MESHJOB::ConfigParameter & configParameter);
   CORBA::Long    initialize (const MESHJOB::MeshJobParameterList & meshJobParameterList,
-                            const char *configId);
+                             const char *configId);
   bool           start      (CORBA::Long jobId);
   char*          getState   (CORBA::Long jobId);
   MESHJOB::MeshJobResults * finalize(CORBA::Long jobId);
index 26a7416cdf0d1f7bca6d97f1dbeb1b5a3c1ce77d..6aa4c71cefee993cbe371ee9c520e57c42bcb271 100644 (file)
@@ -33,8 +33,8 @@ class SPADDERPluginTester_i:
 {
 public:
   SPADDERPluginTester_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
-                       PortableServer::ObjectId * contId,
-                       const char *instanceName, const char *interfaceName);
+                        PortableServer::ObjectId * contId,
+                        const char *instanceName, const char *interfaceName);
   virtual ~SPADDERPluginTester_i();
   
   void demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c);