]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Merge from V7_main
authorrnc <rnc@opencascade.com>
Wed, 10 Jul 2013 16:22:23 +0000 (16:22 +0000)
committerrnc <rnc@opencascade.com>
Wed, 10 Jul 2013 16:22:23 +0000 (16:22 +0000)
227 files changed:
Makefile.am
build_configure
configure.ac
doc/salome/examples/creating_meshes_ex05.py
doc/salome/examples/defining_hypotheses_ex17.py
doc/salome/examples/transforming_meshes_ex11.py
doc/salome/gui/SMESH/CMakeLists.txt
doc/salome/gui/SMESH/Makefile.am
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/crack_emulation_double_nodes.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/crack_emulation_double_nodes_with_elems.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/ctrlinfo.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/duplicate01.png
doc/salome/gui/SMESH/images/duplicate02.png
doc/salome/gui/SMESH/images/duplicate03.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/eleminfo1.png
doc/salome/gui/SMESH/images/eleminfo2.png
doc/salome/gui/SMESH/images/meshexportmesh.png
doc/salome/gui/SMESH/images/pref21.png
doc/salome/gui/SMESH/images/pref22.png
doc/salome/gui/SMESH/images/pref23.png
doc/salome/gui/SMESH/images/pref24.png
doc/salome/gui/SMESH/images/reduce_three_to_one.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/smesh_sort.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/viscous_layers_hyp.png
doc/salome/gui/SMESH/images/viscous_layers_on_submesh.png [new file with mode: 0644]
doc/salome/gui/SMESH/input/2d_meshing_hypo.doc
doc/salome/gui/SMESH/input/about_hypo.doc
doc/salome/gui/SMESH/input/additional_hypo.doc
doc/salome/gui/SMESH/input/arranging_study_objects_page.doc [new file with mode: 0644]
doc/salome/gui/SMESH/input/basic_meshing_algos.doc
doc/salome/gui/SMESH/input/constructing_meshes.doc
doc/salome/gui/SMESH/input/double_nodes_page.doc
doc/salome/gui/SMESH/input/importing_exporting_meshes.doc
doc/salome/gui/SMESH/input/index.doc
doc/salome/gui/SMESH/input/mesh_infos.doc
doc/salome/gui/SMESH/input/mesh_preferences.doc
doc/salome/gui/SMESH/input/modifying_meshes.doc
doc/salome/gui/SMESH/input/tui_creating_meshes.doc
doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc
doc/salome/gui/SMESH/input/tui_transforming_meshes.doc
idl/Makefile.am
idl/SMESH_BasicHypothesis.idl
idl/SMESH_Filter.idl
idl/SMESH_Gen.idl
idl/SMESH_Mesh.idl
idl/SMESH_MeshEditor.idl
resources/Makefile.am
resources/SalomeApp.xml.in
resources/StdMeshers.xml
resources/mesh_duplicate_elem_only.png [new file with mode: 0644]
resources/open.png [new file with mode: 0644]
src/Controls/SMESH_Controls.cxx
src/Driver/Driver_Mesh.h
src/DriverMED/DriverMED.hxx [new file with mode: 0644]
src/DriverMED/DriverMED_Family.cxx
src/DriverMED/DriverMED_Family.h
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.h
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
src/DriverMED/Makefile.am
src/MEDWrapper/Base/CMakeLists.txt [new file with mode: 0644]
src/MEDWrapper/Base/MED_Algorithm.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Algorithm.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Common.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_CoordUtils.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_CoordUtils.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_GaussDef.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_GaussDef.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_GaussUtils.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_GaussUtils.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_SharedPtr.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_SliceArray.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Structures.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Structures.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_TStructures.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_TWrapper.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Utilities.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Utilities.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Vector.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Wrapper.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Wrapper.hxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_WrapperBase.hxx [new file with mode: 0755]
src/MEDWrapper/Base/Makefile.am [new file with mode: 0644]
src/MEDWrapper/CMakeLists.txt [new file with mode: 0644]
src/MEDWrapper/Factory/CMakeLists.txt [new file with mode: 0644]
src/MEDWrapper/Factory/MED_Factory.cxx [new file with mode: 0644]
src/MEDWrapper/Factory/MED_Factory.hxx [new file with mode: 0644]
src/MEDWrapper/Factory/MED_Test.cxx [new file with mode: 0644]
src/MEDWrapper/Factory/MED_WrapperFactory.hxx [new file with mode: 0755]
src/MEDWrapper/Factory/Makefile.am [new file with mode: 0644]
src/MEDWrapper/Factory/mprint_version.cxx [new file with mode: 0644]
src/MEDWrapper/Makefile.am [new file with mode: 0644]
src/MEDWrapper/V2_2/CMakeLists.txt [new file with mode: 0644]
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx [new file with mode: 0644]
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx [new file with mode: 0644]
src/MEDWrapper/V2_2/Makefile.am [new file with mode: 0644]
src/Makefile.am
src/SMDS/SMDS_MeshElement.hxx
src/SMDS/SMDS_VtkVolume.cxx
src/SMESH/Makefile.am
src/SMESH/SMESH_Algo.cxx
src/SMESH/SMESH_Algo.hxx
src/SMESH/SMESH_Gen.cxx
src/SMESH/SMESH_Gen.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx
src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx
src/SMESH/SMESH_subMesh.cxx
src/SMESH/SMESH_subMesh.hxx
src/SMESHClient/Makefile.am
src/SMESHGUI/Makefile.am
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h
src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx
src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx
src/SMESHGUI/SMESHGUI_FileInfoDlg.h
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.h
src/SMESHGUI/SMESHGUI_MeshUtils.cxx
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_Selection.h
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESH_images.ts
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts
src/SMESHUtils/SMESH_Block.cxx
src/SMESHUtils/SMESH_Block.hxx
src/SMESH_I/Makefile.am
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_2smeshpy.hxx
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_MEDFamily_i.cxx [deleted file]
src/SMESH_I/SMESH_MEDFamily_i.hxx [deleted file]
src/SMESH_I/SMESH_MEDMesh_i.cxx [deleted file]
src/SMESH_I/SMESH_MEDMesh_i.hxx [deleted file]
src/SMESH_I/SMESH_MEDSupport_i.cxx [deleted file]
src/SMESH_I/SMESH_MEDSupport_i.hxx [deleted file]
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_subMesh_i.cxx
src/SMESH_I/SMESH_subMesh_i.hxx
src/SMESH_SWIG/smeshBuilder.py
src/SMESH_SWIG/smesh_algorithm.py
src/StdMeshers/StdMeshers_FaceSide.cxx
src/StdMeshers/StdMeshers_Prism_3D.cxx
src/StdMeshers/StdMeshers_Prism_3D.hxx
src/StdMeshers/StdMeshers_ProjectionUtils.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshers/StdMeshers_RadialPrism_3D.cxx
src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx
src/StdMeshers/StdMeshers_ViscousLayers.cxx
src/StdMeshers/StdMeshers_ViscousLayers.hxx
src/StdMeshers/StdMeshers_ViscousLayers2D.cxx
src/StdMeshersGUI/Makefile.am
src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshers_msg_en.ts
src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx
src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx
src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx
src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py [new file with mode: 0644]
src/Tools/MGCleanerPlug/MGCleanerMonViewText.py [new file with mode: 0644]
src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui [new file with mode: 0644]
src/Tools/MGCleanerPlug/MGCleanerViewText.ui [new file with mode: 0644]
src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py [new file with mode: 0644]
src/Tools/MGCleanerPlug/Makefile.am [new file with mode: 0644]
src/Tools/MGCleanerPlug/Tolerance.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/Advanced_params.rst [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/Generics_params.rst [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/Makefile.am [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/Mandatory_params.rst [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/conf.py.in [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/editHypo.rst [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/files/mg-cleaner_user_manual.pdf [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/images/Advanced.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/images/AppelMGCleaner.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/images/Generic.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/images/Simple.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/images/Tolerance.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/index.rst [new file with mode: 0644]
src/Tools/MGCleanerPlug/doc/lct.rst [new file with mode: 0644]
src/Tools/MGCleanerPlug/open.png [new file with mode: 0644]
src/Tools/MGCleanerPlug/select1.png [new file with mode: 0644]
src/Tools/Makefile.am
src/Tools/YamsPlug/YamsPlugDialog.ui
src/Tools/YamsPlug/doc/Generics_params.rst
src/Tools/YamsPlug/doc/Makefile.am
src/Tools/YamsPlug/doc/Mandatory_params.rst
src/Tools/YamsPlug/doc/editHypo.rst
src/Tools/YamsPlug/doc/files/YamsWhitePaper_3.2.pdf [new file with mode: 0644]
src/Tools/YamsPlug/doc/images/Advanced.png
src/Tools/YamsPlug/doc/images/AppelYams.png
src/Tools/YamsPlug/doc/images/Generic.png
src/Tools/YamsPlug/doc/images/Simple.png
src/Tools/YamsPlug/doc/index.rst
src/Tools/YamsPlug/doc/lct.rst
src/Tools/YamsPlug/monViewText.py
src/Tools/YamsPlug/monYamsPlugDialog.py
src/Tools/YamsPlug/open.png [new file with mode: 0644]
src/Tools/YamsPlug/yamsplug_plugin.py
src/Tools/padder/doc/input/padder_userguide.doc
src/Tools/padder/meshjob/impl/Makefile.am
src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx
src/Tools/smesh_plugins.py

index 9893076e7a837c23965d5a250e256128b88a51e5..2244fdc0e39fee950a9991fddd214aa4b02e6b26 100644 (file)
@@ -28,12 +28,10 @@ if SMESH_ENABLE_GUI
   ACLOCAL_AMFLAGS = -I adm_local/unix/config_files                     \
                     -I ${GUI_ROOT_DIR}/adm_local/unix/config_files     \
                     -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
-                    -I ${MED_ROOT_DIR}/adm_local/unix/config_files     \
                     -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files
 else !SMESH_ENABLE_GUI
   ACLOCAL_AMFLAGS = -I adm_local/unix/config_files                     \
                     -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
-                    -I ${MED_ROOT_DIR}/adm_local/unix/config_files     \
                     -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files
 endif
 
index 6c9778d7c480cf68deccd511dc72079f09a4fb6f..a8500b6e8acf0635dcae1c72a34193f752c8ddc9 100755 (executable)
@@ -46,14 +46,6 @@ fi
 #    exit
 #fi
 
-########################################################################
-# Test if the MED_ROOT_DIR is set correctly
-
-if test ! -d "${MED_ROOT_DIR}"; then
-    echo "failed : MED_ROOT_DIR variable is not correct !"
-    exit
-fi
-
 ########################################################################
 # Test if the GEOM_ROOT_DIR is set correctly
 
@@ -82,12 +74,10 @@ if test -d "${GUI_ROOT_DIR}"; then
   aclocal -I adm_local/unix/config_files \
           -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
           -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \
-          -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
           -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1
 else
   aclocal -I adm_local/unix/config_files \
           -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
-          -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
           -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1
 fi
 
index 83aaf368578504bafa31c24d694712edeb417c7a..e97b1b891a3a0f3917de0036e195ed248ddce721 100644 (file)
@@ -408,14 +408,6 @@ echo
 
 CHECK_GEOM
 
-echo
-echo ---------------------------------------------
-echo Testing Med
-echo ---------------------------------------------
-echo
-
-CHECK_MED
-
 CHECK_PLATFORM
 
 echo
@@ -452,11 +444,11 @@ echo
 echo Configure
 
 if test "${gui_ok}" = "yes"; then
-  variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok cgns_ok tbb_ok omniORB_ok occ_ok doxygen_ok graphviz_ok sphinx_ok qwt_ok Kernel_ok Geom_ok Med_ok gui_ok"
+  variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok cgns_ok tbb_ok med3_ok omniORB_ok occ_ok doxygen_ok graphviz_ok sphinx_ok qwt_ok Kernel_ok Geom_ok gui_ok"
 elif test "${SalomeGUI_need}" != "no"; then
-  variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok cgns_ok tbb_ok med3_ok omniORB_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok Geom_ok Med_ok gui_ok"
+  variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok cgns_ok tbb_ok med3_ok omniORB_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok Geom_ok gui_ok"
 else
-  variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok cgns_ok tbb_ok med3_ok omniORB_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok Geom_ok Med_ok"
+  variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok cgns_ok tbb_ok med3_ok omniORB_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok Geom_ok"
 fi
 
 for var in $variables
@@ -549,6 +541,10 @@ AC_OUTPUT([ \
   doc/salome/tui/static/header.html \
   src/Makefile \
   src/Controls/Makefile \
+  src/MEDWrapper/Makefile \
+  src/MEDWrapper/Base/Makefile \
+  src/MEDWrapper/Factory/Makefile \
+  src/MEDWrapper/V2_2/Makefile \
   src/Driver/Makefile \
   src/DriverDAT/Makefile \
   src/DriverMED/Makefile \
@@ -578,6 +574,9 @@ AC_OUTPUT([ \
   src/Tools/YamsPlug/Makefile \
   src/Tools/YamsPlug/doc/Makefile \
   src/Tools/YamsPlug/doc/conf.py \
+  src/Tools/MGCleanerPlug/Makefile \
+  src/Tools/MGCleanerPlug/doc/Makefile \
+  src/Tools/MGCleanerPlug/doc/conf.py \
   src/Tools/padder/Makefile \
   src/Tools/padder/meshjob/Makefile \
   src/Tools/padder/meshjob/idl/Makefile \
index 98e921a06981585e1f09d607d61bea3e9dc4a586..ae1d073b4260139f5deb0c7502f018dae48cbbcd 100644 (file)
@@ -16,23 +16,43 @@ 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.)
+tetra.Segment().NumberOfSegments(7)
+tetra.Triangle()
+tetra.Tetrahedron()
 
 # compute the mesh
 tetra.Compute()
 
 # export the mesh in a MED file
-tetra.ExportMED("/tmp/meshMED.med", 0)
+import tempfile
+medFile = tempfile.NamedTemporaryFile(suffix=".med").name
+tetra.ExportMED( medFile, 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)
+tetra.ExportMED( medFile, meshPart=group )
+
+# ========================
+# autoDimension parameter
+# ========================
+
+face = geompy.MakeFaceHW( 10, 10, 1, "rectangle" )
+mesh2D = smesh.Mesh( face, "mesh2D" )
+mesh2D.AutomaticHexahedralization(0)
+
+import MEDLoader, os
+
+# exported mesh is in 2D space because it is a planar mesh lying
+# on XOY plane, and autoDimension=True by default
+mesh2D.ExportMED( medFile )
+medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0)
+print "autoDimension==True, exported mesh is in %sD"%medMesh.getSpaceDimension()
+
+# exported mesh is in 3D space, same as in Mesh module,
+# thanks to autoDimension=False
+mesh2D.ExportMED( medFile, autoDimension=False )
+medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0)
+print "autoDimension==False, exported mesh is in %sD"%medMesh.getSpaceDimension()
+
+os.remove( medFile )
index d21638fcc2a717235a51c5a7844df9a613e1f2d0..36d8f6c1f4f2e091cd456e00e7a7a9c23f21e147 100644 (file)
@@ -25,6 +25,7 @@ ignoreFaces = [ faces[0], faces[-1]]
 geompy.addToStudy( shape, "shape" )
 geompy.addToStudyInFather( shape, face1, "face1")
 
+# 3D Viscous layers
 
 mesh = smesh.Mesh(shape, "CFD")
 
@@ -45,3 +46,21 @@ mesh.Compute()
 mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
 mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID)
 mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA)
+
+# 2D Viscous layers
+
+# 3 edges of the 4 edges of face1
+edgeIds = geompy.SubShapeAllIDs( face1, geompy.ShapeType["EDGE"])[:-1]
+
+mesh = smesh.Mesh(face1,"VicsousLayers2D")
+mesh.Segment().NumberOfSegments( 5 )
+
+# viscous layers should be created on 1 edge, as we set 3 edges to ignore
+vlHyp = mesh.Triangle().ViscousLayers2D( 2, 3, 1.5, edgeIds, isEdgesToIgnore=True )
+
+mesh.Compute()
+
+# viscous layers should be created on 3 edges, as we pass isEdgesToIgnore=False
+vlHyp.SetEdges( edgeIds, False )
+
+mesh.Compute()
index 0c3bee898a13099c343063bf4a2144d65d50a4a5..de98b27bb2bd361856f195f69a9d999ae100913c 100644 (file)
@@ -1,13 +1,14 @@
-# Duplicate nodes
+# Duplicate nodes or/and elements
 
 
 import salome
 salome.salome_init()
+
 import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
 
-import SMESH, SALOMEDS
+import SMESH
 from salome.smesh import smeshBuilder
 smesh =  smeshBuilder.New(salome.myStudy)
 
@@ -24,7 +25,7 @@ mesh.Hexahedron()
 # Compute mesh
 mesh.Compute()
 
-# Without the duplication of border elements
+# Duplicate nodes only
 
 # Nodes to duplicate
 nodes1 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes1' )
@@ -48,7 +49,7 @@ print "Nodes       : ", mesh.NbNodes()
 print "Edges       : ", mesh.NbEdges()
 print "Quadrangles : ", mesh.NbQuadrangles()
 
-# With the duplication of border elements
+# Duplicate nodes and border elements
 
 # Edges to duplicate
 edges = mesh.CreateEmptyGroup( SMESH.EDGE, 'edges' )
@@ -76,6 +77,19 @@ print "Nodes       : ", mesh.NbNodes()
 print "Edges       : ", mesh.NbEdges()
 print "Quadrangles : ", mesh.NbQuadrangles()
 
+
+# Duplicate elements only
+
+# Duplicate all faces and make a group of new faces.
+# If a mesh is given to DoubleElements(), all elements of the greatest dimension are duplicated
+newFacesGroup = mesh.DoubleElements( mesh, "newFacesGroup" )
+
+# Duplicate edges contained in the group "edges" and add new edges to this group
+mesh.DoubleElements( edges, edges.GetName() )
+
+# Duplicate two first edges of the mesh
+mesh.DoubleElements([ 1, 2 ])
+
 # Update object browser
 if salome.sg.hasDesktop():
     salome.sg.updateObjBrowser(0)
index 326133c7e1420835310331b51b868ed6276af287..a0c5fe79a8bd6f37684ee026638c6e87eefd92cf 100644 (file)
@@ -46,8 +46,6 @@ IF(WINDOWS)
   @SET PATH=$ENV{KERNEL_ROOT_DIR}/lib/salome\;%PATH%
   @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/bin/salome\;%PYTHONPATH%
   @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=$ENV{MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
-  @SET PYTHONPATH=$ENV{MED_ROOT_DIR}/bin/salome\;%PYTHONPATH%
   @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
   @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/bin/salome\;%PYTHONPATH%
   @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
@@ -57,8 +55,8 @@ IF(WINDOWS)
   SET(EXT "bat")
   SET(CALL_STR "call")
 ELSE(WINDOWS)
-  SET(DOC_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages")
-  SET(DOC_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/lib/salome:${MED_ROOT_DIR}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome")
+  SET(DOC_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages")
+  SET(DOC_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome")
   SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:\${PYTHONPATH}
   export LD_LIBRARY_PATH=${DOC_LD_LIBRARY_PATH}:\${LD_LIBRARY_PATH}
   export SMESH_MeshersList=${DOC_SMESH_MeshersList}
index 351520331059098f21ca748e1132bdb2478e233c..aad285f221ad1f00c9cf75ce789b2ce010b76d95 100755 (executable)
@@ -31,8 +31,8 @@ dist_salomescript_PYTHON = collect_mesh_methods.py
 guidocdir = $(docdir)/gui/SMESH
 guidoc_DATA = images/head.png
 
-DOC_PYTHONPATH=$(prefix)/bin/salome:$(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(MED_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages
-DOC_LD_LIBRARY_PATH=$(prefix)/lib/salome:$(MED_ROOT_DIR)/lib/salome:$(GEOM_ROOT_DIR)/lib/salome:$(KERNEL_ROOT_DIR)/lib/salome
+DOC_PYTHONPATH=$(prefix)/bin/salome:$(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages
+DOC_LD_LIBRARY_PATH=$(prefix)/lib/salome:$(GEOM_ROOT_DIR)/lib/salome:$(KERNEL_ROOT_DIR)/lib/salome
 DOC_SMESH_MeshersList=StdMeshers
 
 tmp1/smeshBuilder.py: $(top_srcdir)/src/SMESH_SWIG/StdMeshersBuilder.py $(srcdir)/collect_mesh_methods.py
@@ -80,6 +80,7 @@ uninstall-local:
          case $${filen} in \
            dummy ) ;; \
            $(DESTDIR)$(guidocdir)/yams ) ;; \
+           $(DESTDIR)$(guidocdir)/MGCleaner ) ;; \
            $(DESTDIR)$(guidocdir)/head.png ) ;; \
            * ) echo "removing $${filen}" && rm -rf $${filen} ;; \
          esac ; \
index c9ac74a06414ad4abc493fdb87dff660332798d0..7dfcdf0743e194fab3b19be0ed420c161b1b7fc1 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 42d88c6384c6d023501c4d7a81d01a84f9f2d2b6..75215b304c0f30d2ce7109092b2383e0c01bcb14 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 f41ba29049495b47e81035e392562814c8363c3b..44b1ddad02f8f64d3ec522f1300fe2781ddff955 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 3471144a1b068ab6de1db00ad7b3def1722ece3b..c3585eaaffc9890d686baa9a89eeba2f8209c6a1 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
diff --git a/doc/salome/gui/SMESH/images/crack_emulation_double_nodes.png b/doc/salome/gui/SMESH/images/crack_emulation_double_nodes.png
new file mode 100644 (file)
index 0000000..032d9d6
Binary files /dev/null and b/doc/salome/gui/SMESH/images/crack_emulation_double_nodes.png differ
diff --git a/doc/salome/gui/SMESH/images/crack_emulation_double_nodes_with_elems.png b/doc/salome/gui/SMESH/images/crack_emulation_double_nodes_with_elems.png
new file mode 100644 (file)
index 0000000..9a0fd5e
Binary files /dev/null and b/doc/salome/gui/SMESH/images/crack_emulation_double_nodes_with_elems.png differ
diff --git a/doc/salome/gui/SMESH/images/ctrlinfo.png b/doc/salome/gui/SMESH/images/ctrlinfo.png
new file mode 100644 (file)
index 0000000..9cdad0a
Binary files /dev/null and b/doc/salome/gui/SMESH/images/ctrlinfo.png differ
index 80a4a2ba9692cc277f28217906b340a421c09470..02938fa41019a144ee84a1c6cf1a3b6b59691360 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/duplicate01.png and b/doc/salome/gui/SMESH/images/duplicate01.png differ
index 0e501412539a1f79c17ede8fc4730506219c9430..9653a3ea08806a2adc752317825b8e5da455c3f9 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/duplicate02.png and b/doc/salome/gui/SMESH/images/duplicate02.png differ
diff --git a/doc/salome/gui/SMESH/images/duplicate03.png b/doc/salome/gui/SMESH/images/duplicate03.png
new file mode 100644 (file)
index 0000000..72b2a7a
Binary files /dev/null and b/doc/salome/gui/SMESH/images/duplicate03.png differ
index 3e1888ff2b8fc83798dc08683e5806637233107f..74c76db637d8c3ee849b2936b9bb4d0ac53f1980 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/eleminfo1.png and b/doc/salome/gui/SMESH/images/eleminfo1.png differ
index ea73500bd0e4293e6c4479af4f643ddc5fef4447..b7a785bc96340d0dcbbf3325950c4c5512e324d2 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/eleminfo2.png and b/doc/salome/gui/SMESH/images/eleminfo2.png differ
index 57d0a802125ac7ef8cdbcdf3b3d538fc0d635a4b..d2997a47d377640e5ce81f10400db3dfc845987c 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/meshexportmesh.png and b/doc/salome/gui/SMESH/images/meshexportmesh.png differ
index d39efb580c5210d6c9bf532850c8168b05fb15c3..ddacc63325118a9226d76648666d6cc7e7c14085 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref21.png and b/doc/salome/gui/SMESH/images/pref21.png differ
index b56c4e5401c37c605a95b566fbfbf315045866a5..ff13403fba5b5974eb858d0b81aa7a3db86183ef 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref22.png and b/doc/salome/gui/SMESH/images/pref22.png differ
index 07858d726eebbf3c36be158cfe3d8a75915e2ac2..c715ee4825e971be3eb7f6720d7f47fa7388de47 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref23.png and b/doc/salome/gui/SMESH/images/pref23.png differ
index f1cdcf8fc7ea72550c5b7f477f3bbf57c7265672..167cc0bf065bc6b101f2c7e0f585e15a0fe4e75d 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref24.png and b/doc/salome/gui/SMESH/images/pref24.png differ
diff --git a/doc/salome/gui/SMESH/images/reduce_three_to_one.png b/doc/salome/gui/SMESH/images/reduce_three_to_one.png
new file mode 100644 (file)
index 0000000..d5f4a38
Binary files /dev/null and b/doc/salome/gui/SMESH/images/reduce_three_to_one.png differ
diff --git a/doc/salome/gui/SMESH/images/smesh_sort.png b/doc/salome/gui/SMESH/images/smesh_sort.png
new file mode 100644 (file)
index 0000000..0b00568
Binary files /dev/null and b/doc/salome/gui/SMESH/images/smesh_sort.png differ
index 843ff5d09adba4c7c6ed6b4c35b0f5345bfb1e74..9c99303174b63c523c1b60e0786734da882b99af 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/viscous_layers_hyp.png and b/doc/salome/gui/SMESH/images/viscous_layers_hyp.png differ
diff --git a/doc/salome/gui/SMESH/images/viscous_layers_on_submesh.png b/doc/salome/gui/SMESH/images/viscous_layers_on_submesh.png
new file mode 100644 (file)
index 0000000..3897baa
Binary files /dev/null and b/doc/salome/gui/SMESH/images/viscous_layers_on_submesh.png differ
index d72e4d50459e39613ca3ac0bca641acd810f497a..c5095b1bff90c30808e0738feedceedef6fb0964 100644 (file)
 \anchor max_element_area_anchor
 <h2>Max Element Area</h2>
 
-<b>Max Element Area</b> hypothesis is applied for meshing of 2D faces
+<b>Max Element Area</b> hypothesis is applied for meshing of faces
 composing your geometrical object. Definition of this hypothesis
-consists of setting the <b>maximum area</b> of meshing elements (depending on
-the chosen meshing algorithm it can be <b>triangles</b> or <b>quadrangles</b>),
-which will compose the mesh of these 2D faces.
+consists of setting the <b>maximum area</b> of mesh elements,
+which will compose the mesh of these faces.
 
 \image html a-maxelarea.png
 
@@ -33,8 +32,9 @@ operation.
 \anchor length_from_edges_anchor
 <h2>Length from Edges</h2>
 
-<b>Length from edges</b> hypothesis builds 2D mesh segments having a
-length calculated as an average edge length for a given wire.
+<b>Length from edges</b> hypothesis builds 2D mesh elements having a
+maximum linear size calculated as an average segment length for a wire
+of a given face.
 
 <b>See Also</b> a sample TUI Script of a 
 \ref tui_length_from_edges "Length from Edges" hypothesis operation.
@@ -48,7 +48,7 @@ length calculated as an average edge length for a given wire.
 <b>Quadrangle parameters</b> is a hypothesis for Quadrangle (Mapping).
 
 <b>Base vertex</b> parameter allows using Quadrangle (Mapping)
-algorithm for meshing of triangular faces. In this case it is
+algorithm for meshing of trilateral faces. In this case it is
 necessary to select the vertex, which will be used as the fourth edge
 (degenerated).
 
@@ -86,13 +86,22 @@ between them. The following types are available:
     <i>This type corresponds to <b>Quadrangle Preference</b>
     additional hypothesis, which is obsolete now.</i></li>
 <li><b>Quadrangle preference (reversed)</b> works in the same way and
-with the same restriction as <b>Quadrangle preference</b>, but
-    the transition area is located along the coarser meshed sides.</li>
+  with the same restriction as <b>Quadrangle preference</b>, but
+  the transition area is located along the coarser meshed sides.</li>
 <li><b>Reduced</b> type forces building only quadrangles and the transition
     between the sides is made gradually, layer by layer. This type has
     a limitation on the number of segments: one pair of opposite sides must have
     the same number of segments, the other pair must have an even difference
-    between the numbers of segments on the sides.</li>
+    between the numbers of segments on the sides. In addition, number
+    of rows of faces between sides with different discretization
+    should be enough for the transition. At the fastest transition
+    pattern, three segments become one (see the image below), hence
+    the least number of face rows needed to reduce from Nmax segments
+    to Nmin segments is log<sub>3</sub>( Nmax / Nmin ). The number of
+    face rows is equal to number of segments on each of equally
+    discretized sides.
+\image html reduce_three_to_one.png "The fastest transition pattern: 3 to 1"
+</li>
 </ul>
 
 <b>See Also</b> a sample TUI Script of a 
index 4453a7b8dcf8b29c5c054280ce75b9415606d340..e4bf36ca0945293fa2f49ca48b957e79c4618a66 100644 (file)
@@ -5,13 +5,12 @@
 \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
+the resulting meshes or sub-meshes: when applying different hypotheses
+with different parameters you can preset the quantity or size of
 elements which will compose your mesh. So, it will be possible to
 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):
+In \b MESH there are the following Basic Hypotheses:
 <ul>
 <li>\subpage a1d_meshing_hypo_page "1D Hypotheses" (for meshing of 
 <b>edges</b>):</li>
@@ -49,9 +48,8 @@ with other hypotheses:
 
 The choice of a hypothesis depends on:
 <ul>
-<li>the geometrical object (shape) which will be meshed</li>
 <li>the algorithm, which will be selected for meshing of this geometrical object (shape)</li>
+<li>the geometrical object (shape) which will be meshed</li>
 </ul>
 
 */
index 98353ed256b0b828aafdd12da6d22ae1a296f01a..938c7870e213fc7bea88e806c18154c993dcabf7 100644 (file)
@@ -53,8 +53,8 @@ segments on all four sides of the face must be even (divisible by 2).
 <h2>Viscous Layers and Viscous Layers 2D</h2>
 
 <b>Viscous Layers</b> and <b>Viscous Layers 2D </b> additional
-hypotheses can be used together with some 3D algorithms, for example,
-Hexahedron(i,j,k) or 2D algorithms, for example, Triangle
+hypotheses can be used together with either some 3D algorithms, for example
+Hexahedron(i,j,k), or 2D algorithms, for example Triangle
 (MEFISTO), correspondingly. These hypotheses allow creation of layers
 of highly stretched elements, prisms in 3D and quadrilaterals in 2D,
 near mesh boundary, which is beneficial for high quality viscous
@@ -67,16 +67,32 @@ computations.
 <li><b>Total thickness</b> - gives the total thickness of element layers.</li>
 <li><b>Number of layers</b> - defines the number of element layers.</li>
 <li><b>Stretch factor</b> - defines the growth factor of element height
-from the mesh boundary inwards.</li>
-<li><b>Faces (Edges) without layers</b> - defines geometrical faces
-  (or edges in 2D) on which element layers should not be
-  constructed. By default the element layers are not constructed on
-  geometrical faces shared by solids (and edges shared by faces in 2D). 
+  from the mesh boundary inwards.</li>
+<li><b>Specified Edges are</b> - defines how the shapes specified by
+  the next parameter are used.
+<li><b>Faces without layers</b> and <b>Edges with/without layers</b> - 
+  in the 3D case it defines geometrical faces on which element layers
+  should not be constructed; in the 2D case it defines geometrical edges
+  on which element layers either should be or should not be
+  constructed, depending on the value of the previous parameter
+  (<b>Specified Edges are</b>). 
   \note A mesh shown in the 3D Viewer can prevent selection of faces
-  and edges, in this case just hide the mesh. To avoid a long wait when a
+  and edges, just hide the mesh to avoid this. To avoid a long wait when a
   geometry with many faces (or edges) is displayed, the number of faces
   (edges) shown at a time is limited by the value of "Sub-shapes
-  preview chunk size" preference (in Preferences/Mesh/General tab).
+  preview chunk size" preference (in Preferences/Mesh/General tab).<br>
+
+  Whatever shapes are specified by this
+  parameter, the element layers are not constructed on geometrical
+  faces shared by several solids in 3D case and edges shared by
+  several faces in 2D case. In other words the element layers can be
+  constructed on boundary faces and edges, and are not constructed on
+  internal faces and edges. There is an exception to this rule in 2D
+  case: if "Viscous Layers 2D" hypothesis is assigned to a sub-mesh,
+  the element layers can be constructed on boundary edges of the shape
+  of this sub-mesh.
+  \image html viscous_layers_on_submesh.png 2D viscous layers constructed on boundary edges of a sub-mesh on a disk face.
+
 </li>
 </ul>
 
diff --git a/doc/salome/gui/SMESH/input/arranging_study_objects_page.doc b/doc/salome/gui/SMESH/input/arranging_study_objects_page.doc
new file mode 100644 (file)
index 0000000..ea655d5
--- /dev/null
@@ -0,0 +1,11 @@
+/*!
+
+\page arranging_study_objects_page Arranging objects in study
+
+If sub-meshes or groups container item has more than one child sub-object, then there is a possibility to sort these children in ascending order.
+
+To use sort functionality select "Sort children" popup menu item for the parent object.
+
+\image html smesh_sort.png "Sorting of sub-objects"
+
+*/
index 5aed468f1880cb68c3fa57181744d875aeb6aba1..142ca62f4f44a5d16e01a98b05ffa11005bed810 100644 (file)
@@ -30,13 +30,13 @@ quadrangular elements.</li>
 
 \image html image124.gif "Example of a quadrangular 2D mesh"
 
-<li>For meshing of 3D entities (<b>volume objects</b>):</li>
+<li>For meshing of 3D entities (<b>solid objects</b>):</li>
 
 <ul>
-<li>Hexahedron meshing algorithm (i,j,k) - 6-sided Volumes are split into
+<li>Hexahedron meshing algorithm (i,j,k) - 6-sided Solids 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 Solids 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>
index 126dcfbd905327f434bf7a67510cfbad5307c210..2255641b306762550975bcac2fbd09537dc4653d 100644 (file)
@@ -251,7 +251,7 @@ And the last mesh computation is made with:
 <em>"Result mesh with order SubMesh_3, SubMesh_2, SubMesh_1 "</em></center>
 
 As we can see, each mesh computation has a different number of result
-elements and a different mesh discretisation on the shared edges (the edges 
+elements and a different mesh discretization on the shared edges (the edges 
 that are shared between <b>Face_1</b>, <b>Face_2</b> and <b>Face_3</b>)
 
 Additionally, submesh priority (the order of applied algorithms) can
index a8a93d1f94190d39c78ff91586e7b0bd15ad711f..0c4c1eb2c28fc9edd638a557269c8ad4c0769f04 100644 (file)
@@ -1,36 +1,37 @@
 /*!
 
-\page double_nodes_page Duplicate Nodes
+\page double_nodes_page Duplicate Nodes or/and Elements
 
-\n This operation allows to duplicate nodes of your mesh, which can be
-useful to emulate a crack in the model.
-Duplication consists in replacement of an existing mesh element by another one.
-Lower level elements of the duplicated ones are cloned automatically. 
+\n This operation allows to duplicate nodes or/and elements of your mesh.
+Duplication of nodes can be useful to emulate a crack in the model.
+Duplication consists in creation of mesh element "equal" to existing ones.
 
-<em>To duplicate nodes:</em>
+<em>To duplicate nodes or/and elements:</em>
 <ol>
-<li>From the \b Modification menu choose \b Transformation -> \b Duplicate
-\b Nodes item or click <em>"Duplicate Nodes"</em> button in the toolbar.
+<li>From the \b Modification menu choose \b Transformation -> <b> Duplicate
+ Nodes or/and Elements </b> item or click <em>"Duplicate Nodes or/and
+ Elements"</em> button in the toolbar.
 <br>
-\image html duplicate_nodes.png "Duplicate Nodes button"
+\image html duplicate_nodes.png "Duplicate Nodes or/and Elements button"
 </li>
-<li>Check in the dialog box one of two radio buttons corresponding to
-the type of nodes duplication operation you would like to perform.</li>
-<li>Fill the other fields available in the dialog box (depends on the chosen
- operation mode).</li>
-<li>Click the \b Apply or <b>Apply and Close</b> button to perform the operation of nodes
- duplication.</li>
+<li>Check in the dialog box one of three radio buttons corresponding to
+  the type of duplication operation you would like to perform.</li>
+<li>Fill the other fields available in the dialog box (depending on
 the chosen operation mode).</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to perform the
+  operation of duplication.</li> 
 </ol>
 
-\n "Duplicate Nodes" dialog has two working modes:
+\n "Duplicate Nodes or/and Elements" dialog has three working modes:
 <ul>
-<li>\ref mode_without_elem_anchor "Without the duplication of border elements"</li>
-<li>\ref mode_with_elem_anchor "With the duplication of border elements"</li>
+<li>\ref mode_without_elem_anchor "Duplicate nodes only"</li>
+<li>\ref mode_with_elem_anchor "Duplicate nodes and border elements"</li>
+<li>\ref mode_elem_only_anchor "Duplicate elements only"</li>
 </ul>
 
 <br>
 \anchor mode_without_elem_anchor
-<h2>Without duplication of border elements</h2>
+<h2>Duplicate nodes only</h2>
 
 In this mode the dialog looks like:
 
@@ -38,16 +39,29 @@ In this mode the dialog looks like:
 
 Parameters to be defined in this mode:
 <ul>
-<li><b>Group of nodes to duplicate</b> (<em>mandatory</em>): these nodes will be duplicated.</li>
-<li><b>Group of elements to replace nodes with new ones</b> (<em>optional</em>): the duplicated nodes
- will be associated with these elements.</li>
-<li><b>Construct group with newly created nodes</b> option (<em>checked by default</em>): 
- if checked - the group with just created nodes will be built.</li>
+<li><b>Group of nodes to duplicate</b> (<em>mandatory</em>): these
+  nodes will be duplicated.</li>
+<li><b>Group of elements to replace nodes with new ones</b>
+  (<em>optional</em>): the new nodes will replace the nodes to
+  duplicate within these elements.</li> 
+<li><b>Construct group with newly created nodes</b> option
+  (<em>checked by default</em>): if checked - the group with just
+  created nodes will be built.</li> 
 </ul>
+A schema below explains the crack emulation using the node duplication.
+\image html crack_emulation_double_nodes.png "Crack emulation"
+This schema shows a virtual crack in a 2D mesh created using this duplication
+mode. In this schema:
+- Black balls are <b>nodes to duplicate</b>.
+- Red balls are <b>new nodes</b>.
+- <b>Elements to replace nodes with new ones</b> are marked with green.
+
+Note that in reality <b>nodes to duplicate</b> coincide with <b>new nodes</b>.
+
 
 <br>
 \anchor mode_with_elem_anchor
-<h2>With duplication of border elements</h2>
+<h2>Duplicate nodes and border elements</h2>
 
 In this mode the dialog looks like:
 
@@ -55,18 +69,62 @@ In this mode the dialog looks like:
 
 Parameters to be defined in this mode:
 <ul>
-<li><b>Group of elements to duplicate</b> (<em>mandatory</em>): these elements will be duplicated.</li>
-<li><b>Group of nodes at not to duplicate</b> (<em>optional</em>): group of nodes at crack bottom
- which will not be duplicated.</li>
-<li><b>Group of elements to replace nodes with new ones</b> (<em>mandatory</em>): the duplicated nodes
- will be associated with these elements.</li>
-<li><b>Construct group with newly created elements</b> option (<em>checked by default</em>): 
- if checked - the group of just created elements will be built.</li>
-<li><b>Construct group with newly created nodes</b> option (<em>checked by default</em>): 
- if checked - the group of just created nodes will be built.</li>
+<li><b>Group of elements to duplicate</b> (<em>mandatory</em>): these
+  elements will be duplicated.</li> 
+<li><b>Group of nodes not to duplicate</b> (<em>optional</em>):
+  group of nodes at crack bottom which will not be duplicated.</li>
+<li><b>Group of elements to replace nodes with new ones</b>
+  (<em>mandatory</em>): the new nodes will replace the nodes to
+  duplicate within these elements.</li> 
+<li><b>Construct group with newly created elements</b> option
+ (<em>checked by default</em>): if checked - the group of just created
+ elements will be built.</li>
+<li><b>Construct group with newly created nodes</b> option
+  (<em>checked by default</em>): if checked - the group of just
+  created nodes will be built.</li>
+</ul>
+
+A schema below explains the crack emulation using the node duplication
+with border elements.
+\image html crack_emulation_double_nodes_with_elems.png "Crack emulation"
+This schema shows a virtual crack in a 2D mesh created using this duplication
+mode. In this schema:
+- Black segments are <b>elements to duplicate</b> (edges in 2D case).
+- Black balls (except the lowest one) are nodes of <b>elements to
+  duplicate</b> that are duplicated.
+- The lowest black ball is a <b>node not to duplicate</b>.
+- Red balls are <b>creates nodes</b>.
+- Red segments are <b>created elements</b> (edges).
+- <b>Elements to replace nodes with new ones</b> are marked with green.
+
+Note that in reality <b>nodes to duplicate</b> coincide with <b>new nodes</b>.
+<br>
+In a 3D case, where <b>elements to duplicate</b> are faces, the edges
+located at the "crack" (if any) are cloned automatically.
+
+<br>
+\anchor mode_elem_only_anchor
+<h2>Duplicate elements only</h2>
+
+This mode just duplicates given elements, i.e. creates new elements on
+the same nodes as the given elements.
+<br>
+In this mode the dialog looks like:
+
+\image html duplicate03.png
+
+Parameters to be defined in this mode:
+<ul>
+<li><b>Group of elements to duplicate</b> (<em>mandatory</em>): these
+  elements will be duplicated.</li> 
+<li><b>Construct group with newly created elements</b> option
+  (<em>checked by default</em>): if checked - the group of just created
+  elements will be built. A name of the created group starts from
+  "DoubleElements".</li>
 </ul>
 
 
-<br><b>See Also</b> a sample TUI Script of a \ref tui_duplicate_nodes "Duplicate nodes" operation.
+<br><b>See Also</b> a sample TUI Script of a
+ \ref tui_duplicate_nodes "Duplicate nodes or/and elements" operation.
 
 */
index 9b0d032faea32b686e6a7a982d3258bd8232bcc2..6519aa16dc42b4cdb74a8b33b419fde1ee1d8981 100644 (file)
@@ -2,19 +2,22 @@
 
 \page importing_exporting_meshes_page Importing and exporting meshes
 
-\n In MESH there is a functionality allowing importation/exportation
+\n In MESH there is a functionality allowing import/export
 of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL,
-\b GMF (internal format of DISTENE products, namely BLSurf, GHS3D and Hexotic algorithms) and \b CGNS format files. You can also export a group as a whole mesh.
+\b GMF (internal format of DISTENE products, namely BLSurf, GHS3D and
+Hexotic algorithms) and \b CGNS format files. You can also export a
+group as a whole mesh.
 
 
 <em>To import a mesh:</em>
 
 <ol>
 <li>From the \b File menu choose the \b Import item, from its sub-menu
-select the corresponding format (MED, UNV, STL, GMF and CGNS) of the file containing
-your mesh.</li>
+  select the corresponding format (MED, UNV, STL, GMF and CGNS) of the
+  file containing your mesh.</li>
 <li>In the standard <b>Search File</b> dialog box find the file for
-importation. It is possible to select multiple files to be imported all at once. </li>
+  import. It is possible to select multiple files to be imported all at
+  once. </li> 
 
 <li>Click the \b OK button.</li>
 </ol>
@@ -24,17 +27,35 @@ importation. It is possible to select multiple files to be imported all at once.
 <em>To export a mesh or a group:</em>
 
 <ol>
-<li>Select the object you wish to export.</li>
-<li>From the \b File menu choose the \b Export item, from its sub-menu
-select the format (MED, UNV, DAT, STL, GMF and CGNS) of the file which will
-contain your exported mesh.</li>
-<li>In the standard <b>Search File</b> select a location for the
-exported file and enter its name.</li>
-<li>Click the \b OK button.</li>
+  <li>Select the object you wish to export.</li>
+  <li>From the \b File menu choose the \b Export item, from its sub-menu
+    select the format (MED, UNV, DAT, STL, GMF and CGNS) of the file which will
+    contain your exported mesh.</li>
+  <li>In the standard <b>Search File</b> select a location for the
+    exported file and enter its name.</li>
+  <li>Click the \b OK button.</li>
 </ol>
 
 \image html meshexportmesh.png
 
+At export to MED and SAUV format files additional parameters are available.
+<ul>
+  <li><b>Automatically create groups</b> check-box specifies whether to
+  create groups of all mesh entities of available dimensions or
+  not. If checked, the created groups have names like "Group_On_All_Nodes",
+  "Group_On_All_Faces" etc.</li>
+  <li><b>Automatically define space dimension</b> check-box specifies
+  whether to define space dimension for export by mesh configuration
+  or not. Usually the mesh is exported as a mesh in 3D space, just as
+  it is in Mesh module. The mesh can be exported as a mesh in lower
+  dimension in following cases, provided that this check-box is
+  checked.
+    <ul>
+      <li> 1D: if all mesh nodes lie on OX coordinate axis. </li>
+      <li> 2D: if all mesh nodes lie on XOY coordinate plane. </li>
+    </ul>
+  </li>
+</ul>
 <br><b>See Also</b> a sample TUI Script of an \ref tui_export_mesh "Export Mesh" operation.
 
 */
index 798237b4b2f77c7eb3ac60587c312fb661b027b4..917e540bdc56ed3327bbdcc7024d1ba9d0109ad3 100644 (file)
@@ -23,6 +23,9 @@ array of dedicated operations;</li>
 \subpage using_notebook_mesh_page "Salome notebook".</li>
 </ul>
 
+The possibility to sort the created sub-meshes or groups is detailed on
+\subpage arranging_study_objects_page section.
+
 Mesh module preferences are described in the \subpage mesh_preferences_page section of SALOME Mesh Help.
 
 Almost all mesh module functionalities are accessible via
index 95897e0f0fe8bba323406443c2b36f81ef88de4b..d446d2e9d9ed1350f4f11707f4ae58b1353d29bd 100644 (file)
@@ -15,11 +15,13 @@ in the toolbar.
 
 The <b>Mesh Information</b> dialog box provides three tab pages:
 - <b>\ref advanced_mesh_infos_anchor "Base Info"</b> - to show base
-information about the selected mesh object
+information about the selected mesh object.
 - <b>\ref mesh_element_info_anchor "Element Info"</b> - to show
 detailed information about the selected mesh node or element.
 - <b>\ref mesh_addition_info_anchor "Additional Info"</b> - to show additional information available
 for the selected mesh, sub-mesh or group object.
+- <b>\ref mesh_quality_info_anchor "Quality Info"</b> - to show
+overall quality information about the selected mesh, sub-mesh or group object.
 
 \anchor advanced_mesh_infos_anchor
 <h2>Base Information</h2>
@@ -119,6 +121,39 @@ 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).
 
+\anchor mesh_quality_info_anchor
+<h2>Quality Information</h2>
+
+The <b>Quality Info</b> tab page of the dialog box provides overal
+mesh quality controls information on the selected object - mesh, 
+sub-mesh or mesh group:
+- Name;
+- Nodes information:
+  - Number of the free nodes;
+  - Number of double nodes;
+- Edges information:
+  - Number of double edges;
+- Faces information:
+  - Number of double faces;
+  - Number of over-constrained faces;
+  - Aspect Ratio histogram;
+- Volume information:
+  - Number of double volumes;
+  - Number of over-constrained volumes;
+  - Aspect Ratio 3D histogram.
+
+<center>\image html ctrlinfo.png
+<em>"Quality Info" page</em></center>
+
+\note User can set "Double nodes tolerance" in the dialog for local change 
+      or via the "Quality controls" in Mesh preferences.
+
+\note For the perfomance reason, all quality control values for the big meshes are
+computed only by demand. For this, the user should press the "compute"
+button (see picture). Also, values are automatically computed if the number of the 
+nodes / elements does not exceed the "Automatic controls 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 a .txt file.
 
index 1ce536a165fa36b86f11695f38eb3357d663a482..80d751d6f057132817336fe10f77ce2592eb342d 100644 (file)
@@ -9,213 +9,227 @@ later sessions with this module.
 
 \image html pref21.png
 
-<ul>
-<li><b>Automatic Update</b></li>
-<ul>
-<li>If you toggle <b>Automatic Update</b> checkbox, the model in your
-viewer automatically updated whenever you make changes in it.</li>
-<li><b>Size limit (elements)</b> - allows to specify the maximum
-number of elements in the resulting mesh for which the automatic updating
-of the presentation is performed. This option affects only
-<b>Compute</b> operation. Zero value means "no limit". Default value
-is 500 000 mesh elements.
-</ul>
-<li><b>Quality Controls</b></li>
-<ul>
-<li>If you toggle <b>Display entity</b>, both faces and edges of an
-object will be displayed in the viewer by default.</li>
-<li>If you toggle <b>Use precision</b> checkbox, you can display numbers in
-<b>Quality Control</b> diagrams at the necessary level of precision.</li>
-<li><b>Number of digits after point</b> - defines precision for <b>Quality Controls</b>. By default, numbers in <b>Quality Control</b>
-diagrams are presented as integers.</li>
-<li><b>Double nodes tolerance</b> defines the maximal distance between two
-mesh nodes, at which they are considered coincident by <b>Double nodes</b>
-quality control.
-</ul>
-<li><b>Display mode</b> - allows to set Wireframe, Shading, Nodes or Shrink
-presentation mode as default.</li>
-<li><b>Representation of the 2D quadratic elements</b></li>
-<ul>
-<li><b>Representation of the 2D quadratic elements</b> combobox - allows
-to select lines or arcs for representation of quadratic elements.</li>
-<li><b>Maximum Angle</b> - maximum deviation angle used by the
-application to build arcs. </li>
-</ul>
-<li><b>Mesh export</b></li>
-<ul>
-<li>If you toggle <b>Automatically create groups for MED export</b> checkbox,
-this operation will be carried out automatically.</li>
-<li>If you toggle <b>Automatic renumbering</b> checkbox, the exported
-mesh will be renumbered automatically</li>
-</ul>
-<li><b>Mesh computation</b></li>
-<ul>
-<li><b>Show a computation result notification</b> combobox allows to
-select the notification mode about a mesh computation result.
-There are 3 possible modes:</li>
-<ul>
-<li><b>Never</b> - do not show the result dialog at all;</li>
-<li><b>Errors only</b> - the result dialog will be shown if there were
-some errors during a mesh computation;</li>
-<li><b>Always</b> - show the result dialog after each mesh
-computation. This is a default mode.</li>
-</ul></ul>
-<li><b>Mesh information</b></li>
-<ul>
-<li><b>Mesh element information</b></li> - Change the way mesh element
-information is shown:
-<ul>
-<li><b>Simple</b> - as a plain text</li>
-<li><b>Tree</b> - in a tree-like form</li>
-</ul>
-<li><b>Automatic nodes compute limit</b></li> - allows to define the size limit for the
-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>
-<li><b>Show details on groups in element information tab</b> - when
-this option is switched off (default), only the names of groups, to which the node
-or element belongs, are shown in the \ref mesh_element_info_anchor "Info Tab"
-tab of "Mesh Information" dialog box. If this option is
-switched on, the detailed information on groups is shown.</li>
-<li><b>Dump base information</b> - allows to dump base mesh information to the
-file, see \ref mesh_infos_page.</li>
-<li><b>Dump element information</b> - allows to dump element information to the
-file, see \ref mesh_infos_page.</li>
-<li><b>Dump additional information</b> - allows to 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
-used for automatic meshing: ratio between the bounding box of the
-meshed object and the Max Size of segments.</li>
-<li><b>Default Number of Segments</b> - allows defining the default
-number of segments on each edge</li>
-</li></ul>
-<li><b>Mesh loading</b></li>
-<ul>
-<li>If <b>No mesh loading from study file at hypothesis modification</b>
-  checkbox is on, the mesh data will not be loaded from the study file
-  when a hypothesis is modified. This allows  saving time by omitting
-  loading data of a large mesh that is planned to be recomputed with other parameters.</li>
-</ul>
-<li><b>Input fields precision</b></li>
-<ul>
-<li><b>Length precision</b> - allows to adjust input precision of coordinates and dimensions.</li>
-<li><b>Angular precision</b> - allows to adjust input precision of angles.</li>
-<li><b>Length tolerance precision</b> - allows to adjust input precision of tolerance of coordinates and dimensions.</li>
-<li><b>Parametric precision</b> - allows to adjust input precision of parametric values.</li>
-<li><b>Area precision</b> - allows to adjust input precision of mesh element area.</li>
-<li><b>Volume precision</b> - allows to adjust input precision of mesh element volume.</li>
-</ul>
-<li><b>Preview</b></li>
-<ul>
-<li><b>Sub-shapes preview chunk size</b> - allows to limit the number
-of previewed sub-shapes shown in the hypotheses creation dialog boxes,
-for example "Reverse Edges" parameter of \ref number_of_segments_anchor "Number of segments" hypothesis. 
-</ul>
-<li><b>Python Dump</b></li>
-<ul>
-<li><b>Historical python dump</b> checkbox allows switching between 
-  \a Historical and \a Snapshot dump mode. In \a
-  Historical mode, Python Dump script includes all commands
-  performed by SMESH engine. In \a Snapshot mode, the commands
-  relating to objects removed from the Study as well as the commands
-  not influencing the current state of meshes are excluded from the script.</li>
-</ul>
-</ul>
+- <b>Automatic Update</b>
+  - If you toggle <b>Automatic Update</b> checkbox, the model in your
+    viewer automatically updated when you make changes in it, depending on
+    values of additional preferences specified below.
+  - <b>Size limit (elements)</b> - allows to specify the maximum
+    number of elements in the resulting mesh for which the automatic updating
+    of the presentation is performed. This option affects only
+    <b>Compute</b> operation. Zero value means "no limit". Default value
+    is 500 000 mesh elements.
+  - <b>Incremental limit check</b> - when this control is switched on,
+    check for mesh size limit will be applied not to total number of
+    elements in resulting mesh, but iteratively to each entity types
+    in the following order: 0D elements, edges, faces, volumes, balls;
+    at each step number of entities of given type will be added to the
+    total number of elements computed at previous step - if resulting
+    number of elements does not exceed size limit, the entities of
+    this type will be shown, otherwise user will be warned that some
+    entities are not shown.
+
+- <b>Quality Controls</b>
+  - If you toggle <b>Display entity</b>, both faces and edges of an
+    object will be displayed in the viewer by default.
+  - If you toggle <b>Use precision</b> checkbox, you can display numbers in
+    <b>Quality Control</b> diagrams at the necessary level of precision.
+  - <b>Number of digits after point</b> - defines precision for
+    <b>Quality Controls</b>. By default, numbers in <b>Quality Control</b>
+    diagrams are presented as integers.
+  - <b>Double nodes tolerance</b> defines the maximal distance between two
+    mesh nodes, at which they are considered coincident by <b>Double nodes</b>
+    quality control.
+
+- <b>Display mode</b> - allows to set Wireframe, Shading, Nodes or Shrink
+  presentation mode as default.
+
+- <b>Representation of the 2D quadratic elements</b>
+  - <b>Representation of the 2D quadratic elements</b> combobox - allows
+    to select lines or arcs for representation of quadratic elements.
+  - <b>Maximum Angle</b> - maximum deviation angle used by the
+    application to build arcs.
+
+- <b>Mesh export</b>
+  - If you toggle <b>Automatically create groups for MED export</b> checkbox,
+    this operation will be carried out automatically.
+
+- <b>Mesh computation</b>
+  - <b>Show a computation result notification</b> combobox allows to
+    select the notification mode about a mesh computation result.
+    There are 3 possible modes:
+    - <b>Never</b> - do not show the result dialog at all;
+    - <b>Errors only</b> - the result dialog will be shown if there were
+      some errors during a mesh computation;
+    - <b>Always</b> - show the result dialog after each mesh
+      computation. This is a default mode.
+
+- <b>Mesh information</b>
+  - <b>Mesh element information</b> - change the way mesh element
+    information is shown:
+    - <b>Simple</b> - as a plain text
+    - <b>Tree</b> - in a tree-like form
+  - <b>Automatic nodes compute limit</b> - allows to define the size limit for the
+    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.
+  - <b>Automatic controls compute limit</b> - allows to define the size limit for the
+    mesh elements for which the Aspect Ratio histogram is calculated
+    automatically. If the mesh elements 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 3 000 mesh elements.
+  - <b>Show details on groups in element information tab</b> - when
+    this option is switched off (default), only the names of groups, to which the node
+    or element belongs, are shown in the \ref mesh_element_info_anchor "Info Tab"
+    tab of "Mesh Information" dialog box. If this option is
+    switched on, the detailed information on groups is shown.
+  - <b>Dump base information</b> - allows to dump base mesh information to the
+    file, see \ref mesh_infos_page.
+  - <b>Dump element information</b> - allows to dump element information to the
+    file, see \ref mesh_infos_page.
+  - <b>Dump additional information</b> - allows to dump additional mesh
+    information to the file, see \ref mesh_infos_page.
+  - <b>Dump controls information</b> - allows to dump quality mesh
+    information to the file, see \ref mesh_infos_page.
+
+- <b>Automatic Parameters</b>
+  - <b>Ratio Bounding Box Diagonal / Max Size</b> - this parameter is
+    used for automatic meshing: ratio between the bounding box of the
+    meshed object and the Max Size of segments.
+  - <b>Default Number of Segments</b> - allows defining the default
+    number of segments on each edge.
+
+- <b>Mesh loading</b>
+  - If <b>No mesh loading from study file at hypothesis modification</b>
+    checkbox is on, the mesh data will not be loaded from the study file
+    when a hypothesis is modified. This allows  saving time by omitting
+    loading data of a large mesh that is planned to be recomputed with other parameters.
+
+- <b>Input fields precision</b>
+  - <b>Length precision</b> - allows to adjust input precision of coordinates and dimensions.
+  - <b>Angular precision</b> - allows to adjust input precision of angles.
+  - <b>Length tolerance precision</b> - allows to adjust input precision of tolerance of coordinates and dimensions.
+  - <b>Parametric precision</b> - allows to adjust input precision of parametric values.
+  - <b>Area precision</b> - allows to adjust input precision of mesh element area.
+  - <b>Volume precision</b> - allows to adjust input precision of mesh element volume.
+
+- <b>Preview</b>
+  - <b>Sub-shapes preview chunk size</b> - allows to limit the number
+    of previewed sub-shapes shown in the hypotheses creation dialog boxes,
+    for example "Reverse Edges" parameter of \ref number_of_segments_anchor "Number of segments" hypothesis.
+
+- <b>Python Dump</b>
+  - <b>Historical python dump</b> checkbox allows switching between
+    \a Historical and \a Snapshot dump mode:
+    - In \a Historical mode, Python Dump script includes all commands
+      performed by SMESH engine.
+    - In \a Snapshot mode, the commands relating to objects removed
+      from the Study as well as the commands not influencing the
+      current state of meshes are excluded from the script.
 
 <h2>Mesh Preferences</h2>
 
 \image html pref22.png
 
-<ul>
-<li><b>Nodes</b></li>
-<ul>
-<li><b>Color</b> -  allows to select the color of nodes. Click on the
-colored line to access to the <b>Select Color</b> dialog box.</li>
-<li><b>Type of marker</b> - allows to define the shape of nodes.</li>
-<li><b>Scale of marker</b> - allows to define the size of nodes.</li>
-</ul>
-<li><b>Elements</b></li>
-<ul>
-<li><b>Surface color</b>  - allows to select the surface color of elements
-(seen in Shading mode). Click on the colored line to access to the <b>Select Color</b> dialog box.</li>
-<li><b>Back surface color</b> - allows to select the interior surface color
-of elements. Use the slider to select the color generated basing on  
-the <b>Surface color</b> by changing its brightness and saturation.</li>
-<li><b>Outline color</b> - allows to select the color of element
-borders. Click on the colored line to access to the <b>Select Color</b> dialog box.</li>
-<li><b>Wireframe color</b> - allows to select the color of borders of
-elements in the wireframe mode. Click on the colored line to access to the <b>Select Color</b> dialog box.</li>
-<li><b>Width</b> - allows to define the width of lines (edges and borders of elements).</li>
-<li><b>Shrink coef.</b> - allows to define relative space of elements
-compared to gaps between them in shrink mode.</li>
-</ul>
-<li><b>Orientation of Faces</b> - allows to define the behavior of
-<b>Orientation of faces</b> functionality</li>
-<ul>
-<li> \b Color - allows to define the color of orientation vertors;</li>
-<li> \b Scale - allows to define the size of orientation vectors;</li> 
-<li> <b> 3D Vector </b> checkbox allows to choose between 2D planar
-and 3D vectors.</li>
-</ul>
-</ul>
+- <b>Nodes</b>
+  - <b>Color</b> -  allows to select the color of nodes. Click on the
+    colored line to access to the <b>Select Color</b> dialog box.
+  - <b>Type of marker</b> - allows to define the shape of nodes.
+  - <b>Scale of marker</b> - allows to define the size of nodes.
+
+- <b>Elements</b>
+  - <b>Surface color</b>  - allows to select the surface color of 2D elements
+    (seen in Shading mode). Click on the colored line to access to the
+    <b>Select Color</b> dialog box.
+  - <b>Back surface color</b> - allows to select the back surface color
+    of 2D elements. This is useful to differ 2d elements with
+    reversed orientation. Use the slider to select the color generated basing on
+    the <b>Surface color</b> by changing its brightness and saturation.
+  - <b>Volume color</b> - allows to select the surface color of 3D elements
+    (seen in Shading mode).
+  - <b>Reversed volume color</b> - allows to select the surface color
+    of reversed 3D elements. Use the slider to select the color generated basing on
+    the <b>Volume color</b> by changing its brightness and saturation.
+  - <b>0D elements</b> - allows to choose color of 0D mesh elements.
+  - <b>Balls</b> - allows to choose color of discrete mesh elements (balls).
+  - <b>Outline color</b> - allows to select the color of element
+    borders.
+  - <b>Wireframe color</b> - allows to select the color of borders of
+    elements in the wireframe mode.
+  - <b>Size of 0D elements</b> - specifies default size of 0D elements.
+  - <b>Size of ball elements</b> - specifies default size of discrete
+    elements (balls).
+  - <b>Line width</b> - allows to define the width of 1D elements (edges).
+  - <b>Outline width</b> - allows to define the width of borders of
+    2D and 3D elements (shown in the Shading mode).
+  - <b>Shrink coef.</b> - allows to define relative space of elements
+    compared to gaps between them in shrink mode.
+
+- <b>Groups</b> allows to define groups default properties:
+  - <b>Names color</b> - specifies color of group names to be used in
+    3D viewer.
+  - <b>Default color</b> - specifies default group color.
+
+- <b>Numbering</b> allows to define properties of numbering functionality:
+  - <b>Nodes</b> - specifies text properties of nodes numbering
+    (font family, size, attributes, color).
+  - <b>Elements</b> - same for elements.
+
+- <b>Orientation of Faces</b> - allows to define the behavior of
+  <b>Orientation of faces</b> functionality:
+  - \b Color - allows to define the color of orientation vertors;
+  - \b Scale - allows to define the size of orientation vectors;
+  - <b>3D Vector</b> checkbox allows to choose between 2D planar
+    and 3D vectors.
 
 <br><h2>Selection Preferences</h2>
 
 \image html pref23.png
 
-<ul>
-<li><b>Selection</b> - performed with mouse-indexing (preselection)
-and left-clicking on an object, whose appearance changes as defined in
-the <b>Preferences</b>.</li>
-<ul>
-<li><b>Object Color</b> -  allows to select the color of mesh (edges and
-borders of meshes) of the selected entity. Click on the colored line
-to access to the <b>Select Color</b> dialog
-box.</li>
-<li><b>Element color</b> - allows to select the color of surface of selected
-elements (seen in Shading mode). Click on the colored line to access
-to the <b>Select Color</b> dialog box.</li>
-</ul>
-<li><b>Preselection</b> - performed with mouse-indexing on an object,
-whose appearance changes as defined in the <b>Preferences</b>.</li>
-<ul>
-<li><b>Highlight Color</b> -  allows to select the color of mesh (edges and
-borders of meshes) of the entity . Click on the colored line to access
-to the <b>Select Color</b> dialog box.</li>
-</ul>
-<li><b>Precision</b> - in this menu you can set the value of precision
-used for <b>Nodes</b>, <b>Elements</b> and <b>Objects</b>.</li>
-</ul>
+- <b>Selection</b> - performed with mouse-indexing (preselection)
+  and left-clicking on an object, whose appearance changes as defined in
+  the <b>Preferences</b>.
+  - <b>Object Color</b> -  allows to select the color of mesh (edges and
+    borders of meshes) of the selected entity. Click on the colored line
+    to access to the <b>Select Color</b> dialog box.
+  - <b>Element color</b> - allows to select the color of surface of selected
+    elements (seen in Shading mode). Click on the colored line to access
+    to the <b>Select Color</b> dialog box.
+
+- <b>Preselection</b> - performed with mouse-indexing on an object,
+  whose appearance changes as defined in the <b>Preferences</b>.
+  - <b>Highlight Color</b> -  allows to select the color of mesh (edges and
+    borders of meshes) of the entity . Click on the colored line to access
+    to the <b>Select Color</b> dialog box.
+
+- <b>Precision</b> - in this menu you can set the value of precision
+  used for <b>Nodes</b>, <b>Elements</b> and <b>Objects</b>.
 
 <br><h2>Scalar Bar Preferences</h2>
 
 \image html pref24.png
 
-<ul>
-<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>.</li>
-<li><b>Colors & Labels</b> - in this menu you can set the <b>number of
-colors</b> and the <b>number of labels</b> in use.</li>
-<li><b>Orientation</b> - here you can choose between vertical and
-horizontal orientation of the <b>Scalar Bar</b></li>.
-<li><b>Origin & Size Vertical & Horizontal</b> - allows to define
-placement (<b>X</b> and <b>Y</b>) and lookout (<b>Width</b> and
-<b>Height</b>) of Scalar Bars</li>
-<ul>
-<li><b>X</b>: abscissa of the point of origin (from the left
-side)</li>
-<li><b>Y</b>: ordinate of the origin of the bar (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 the <b>Coloring Type</b> of the histogram</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>
-</ul>
-</ul>
+- <b>Font</b> - in this menu you can set type, face and color for
+  the font of <b>Title</b> and <b>Labels</b>.
+
+- <b>Colors & Labels</b> - in this menu you can set the <b>number of
+  colors</b> and the <b>number of labels</b> in use.
+
+- <b>Orientation</b> - here you can choose between vertical and
+  horizontal orientation of the <b>Scalar Bar</b>
+
+- <b>Origin & Size Vertical & Horizontal</b> - allows to define
+  placement (<b>X</b> and <b>Y</b>) and lookout (<b>Width</b> and
+  <b>Height</b>) of Scalar Bars.
+  - <b>X</b>: abscissa of the point of origin (from the left
+    side)
+  - <b>Y</b>: ordinate of the origin of the bar (from the bottom)
+
+- <b>Distribution</b> in this menu you can Show/Hide distribution
+  histogram of the values of the <b>Scalar Bar</b> and specify the
+  <b>Coloring Type</b> of the histogram:
+  - <b>Multicolor</b> the histogram is colored as <b>Scalar Bar</b>
+  - <b>Monocolor</b> the histogram is colored as selected with
+    <b>Distribution color</b> selector 
 
 */
index 36c4e0abbae041ef649ee5bea334385cb76eac68..b7b7e2e646050fdd1ab262c3b5f9be5701237586 100644 (file)
@@ -22,7 +22,8 @@ the mesh or some of its elements.</li>
 elements.</li>
 <li>\subpage symmetry_page "Mirror" the mesh
 through a point or a vector of symmetry.</li>
-<li>\subpage double_nodes_page "Duplicate nodes" to emulate a crack in the model.</li>
+<li>\subpage double_nodes_page "Duplicate nodes or/and
+  Elements". Duplication of nodes can be useful to emulate a crack in the model.</li>
 <li>Unite meshes by \subpage sewing_meshes_page "sewing" free borders,
 conform free borders, border to side or side elements.</li>
 <li>\subpage merging_nodes_page "Merge Nodes", considered coincident
index d7edad332fa10bff4daf53b00e1def2feb45e140..f1b12e4c41882ede90fe4b6e91c70341ba05fd58 100644 (file)
@@ -20,7 +20,7 @@
 
 <br>
 \anchor tui_editing_mesh
-<h2>Editing of a mesh</h2>
+<h2>Editing a mesh</h2>
 \tui_script{creating_meshes_ex04.py}
 
 <br>
index 42f061b391fe328644bcaf2332eb3a26ee664f33..03f0141ed648a0f883761cdc618341186a3c73d2 100644 (file)
@@ -13,8 +13,8 @@ by flat elements.
 \n Triangles are transformed into prisms, and quadrangles into hexahedrons.
 \n The flat elements are stored in groups of volumes.
 These groups are named according to the position of the group in the list:
-the group j_n_p is the group of the flat elements that are built between the group #n and the group #p in the list.
-If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created.
+the group j_n_p is the group of the flat elements that are built between the group \#n and the group \#p in the list.
+If there is no shared faces between the group \#n and the group \#p in the list, the group j_n_p is not created.
 All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
 The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
 
index 303b7cec4a7d07797a9be1e330f612c39df00ab7..d3ad4de47db317e10870302aeb4220b943532fdf 100644 (file)
@@ -58,7 +58,7 @@
 
 <br>
 \anchor tui_duplicate_nodes
-<h3>Duplicate nodes</h3>
+<h3>Duplicate nodes or/and elements</h3>
 \tui_script{transforming_meshes_ex11.py}
 
 <br>
index c43c430ee81bf1b5af321d08d3804d327780e494..887895f9aee6b41d3b1a5dfe6991ff8079244c19 100644 (file)
@@ -64,12 +64,10 @@ nodist_salomeinclude_HEADERS = $(BASEIDL_FILES:%.idl=%.hh)
 libSalomeIDLSMESH_la_CPPFLAGS =                        \
        -I$(top_builddir)/idl                   \
        $(CORBA_CXXFLAGS) $(CORBA_INCLUDES)     \
-       $(KERNEL_CXXFLAGS) $(MED_CXXFLAGS)      \
-       $(GEOM_CXXFLAGS)
+       $(KERNEL_CXXFLAGS) $(GEOM_CXXFLAGS)
 libSalomeIDLSMESH_la_LDFLAGS = -no-undefined -version-info=0:0:0
 libSalomeIDLSMESH_la_LIBADD  =         \
        @CORBA_LIBS@                    \
-       $(MED_LDFLAGS) -lSalomeIDLMED   \
        $(GEOM_LDFLAGS) -lSalomeIDLGEOM \
        $(KERNEL_LDFLAGS) -lSalomeIDLKernel
 
@@ -80,7 +78,6 @@ OMNIORB_IDLPYFLAGS  = \
        @OMNIORB_IDLPYFLAGS@ \
        -I$(top_builddir)/idl/salome \
        -I$(KERNEL_ROOT_DIR)/idl/salome \
-       -I$(MED_ROOT_DIR)/idl/salome \
        -I$(GEOM_ROOT_DIR)/idl/salome
 
 IDLCXXFLAGS = \
@@ -88,13 +85,11 @@ IDLCXXFLAGS = \
        @IDLCXXFLAGS@ \
        -I$(top_builddir)/idl/salome \
        -I$(KERNEL_ROOT_DIR)/idl/salome \
-       -I$(MED_ROOT_DIR)/idl/salome \
        -I$(GEOM_ROOT_DIR)/idl/salome
 
 IDLPYFLAGS  = \
        @IDLPYFLAGS@ \
        -I$(KERNEL_ROOT_DIR)/idl/salome \
-       -I$(MED_ROOT_DIR)/idl/salome \
        -I$(GEOM_ROOT_DIR)/idl/salome
 
 # potential problem on parallel make on the following - multiple outputs
@@ -132,7 +127,7 @@ mostlyclean-local:
        @for dep in $^ dummy; do \
          if [ $$dep != "dummy" ]; then \
            echo Building dependencies for $$dep; \
-           $(CPP) $(C_DEPEND_FLAG) -x c -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome $$dep 2>/dev/null | \
+           $(CPP) $(C_DEPEND_FLAG) -x c -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome $$dep 2>/dev/null | \
            sed 's/\.o/\SK.cc/' >>$@; \
          fi; \
        done ;
index 312f173720a2875e75fee2bc97864e4cec151ab6..b2bca113cd43759713429f1a2a48f96ad12776c2 100644 (file)
@@ -875,6 +875,14 @@ module StdMeshers
     void SetIgnoreEdges(in SMESH::long_array edgeIDs) raises (SALOME::SALOME_Exception);
     SMESH::long_array GetIgnoreEdges();
 
+    /*!
+     * Set edges either to exclude from treatment or to make the Viscous Layers on.
+     */
+    void SetEdges(in SMESH::long_array edgeIDs, 
+                  in boolean           toIgnore) raises (SALOME::SALOME_Exception);
+    SMESH::long_array GetEdges();
+    boolean           GetIsToIgnoreEdges();
+
     /*!
      * Set total thickness of layers of prisms
      */
@@ -918,7 +926,7 @@ module StdMeshers
     boolean IsGridBySpacing(in short axis);
 
     /*!
-     * Set coordinates of nodes along an axis (counterd from zero)
+     * Set coordinates of nodes along an axis (countered from zero)
      */
     void SetGrid(in SMESH::double_array coords,
                  in short               axis) raises (SALOME::SALOME_Exception);
index 305a27f25e83f358e9d75afbee4120056486de96..4522b220532aee5b440ec7d677f1767cce99771b 100644 (file)
@@ -117,8 +117,9 @@ module SMESH
   {
     double GetValue( in long theElementId );
 
-    Histogram GetHistogram( in short nbIntervals, in boolean isLogarithmic );
-
+    Histogram GetHistogram     ( in short nbIntervals, in boolean isLogarithmic );
+    Histogram GetLocalHistogram( in short nbIntervals, in boolean isLogarithmic,
+                                 in SMESH::SMESH_IDSource obj );
     /*!
     * Set precision for calculation. It is a position after point which is
     * used to functor value after calculation.
@@ -164,11 +165,12 @@ module SMESH
 
   /*!
   * Predicates are intended for verification of criteria,
-  *            must return bool value by mesh id
+  *            they return bool value by mesh id
   */
   interface Predicate: Functor
   {
     boolean IsSatisfy( in long thEntityId );
+    long    NbSatisfying( in SMESH::SMESH_IDSource obj );
   };
 
   /*!
index fbe8a35d61517c704f8b6ac198805633aff7a8f7..aadfb1e33a99850be5213ce9da58e2fb8f12eee0 100644 (file)
@@ -36,6 +36,7 @@
 
 module SMESH
 {
+  typedef sequence<SALOMEDS::SObject> sobject_list;
   typedef sequence<GEOM::GEOM_Object> object_array;
   typedef sequence<SMESH_Mesh>        mesh_array;
 
@@ -402,6 +403,19 @@ module SMESH
      * \brief Get names of meshes defined in file with the specified name.
      */
     string_array GetMeshNames(in string theFileName);
+
+    /*!
+     * \brief Moves objects to the specified position
+     *
+     * This function is used in the drag-n-drop functionality.
+     *
+     * \param what objects being moved
+     * \param where parent object where objects are moved to
+     * \param row position in the parent object's children list at which objects are moved
+     */
+    void Move( in sobject_list what, 
+              in SALOMEDS::SObject where, 
+              in long row );
   };
 
 };
index 96e9269902e34cdc119b476a859359aed20e5109..4796428fd1adbc97a1b16202f7e62c56f771384e 100644 (file)
@@ -29,7 +29,6 @@
 #include "SALOME_Exception.idl"
 #include "SALOME_GenericObj.idl"
 #include "GEOM_Gen.idl"
-#include "MED.idl"
 
 module SMESH
 {
@@ -86,6 +85,7 @@ module SMESH
     double_array coords;
     long_array indexes;
   };
+  typedef sequence<log_block> log_array;
 
   struct PointStruct { double x;
                       double y;
@@ -93,7 +93,7 @@ module SMESH
 
   typedef sequence<PointStruct> nodes_array;
 
-  struct DirStruct   { PointStruct PS ; } ;          // analog to Occ Direction
+  struct DirStruct   { PointStruct PS ; } ;          // analog to OCCT gp_Vec
 
   struct AxisStruct  { double x;
                       double y;
@@ -101,7 +101,6 @@ module SMESH
                       double vx;
                       double vy;
                       double vz; } ;
-
   /*!
    * Node location on a shape
    */
@@ -130,12 +129,13 @@ module SMESH
     FACE,
     VOLUME,
     ELEM0D,
-    BALL
+    BALL,
+    NB_ELEMENT_TYPES
   };
   typedef sequence<ElementType> array_of_ElementType ;
 
   /*!
-   * Enumeration for element geometry type, like in SMDS
+   * Enumeration for element geometry type, like SMDSAbs_GeometryType in SMDSAbs_ElementType.hxx
    */
   enum GeometryType
   {
@@ -162,7 +162,6 @@ module SMESH
     ORDER_QUADRATIC     /*! entities of 2nd order */
   };
 
-
   /*!
    * Enumeration of entity type used in mesh info array,
    * it should be synchronised with enum SMDSAbs_EntityType
@@ -197,7 +196,6 @@ module SMESH
     Entity_Last
   };
 
-
   /*!
    * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
    */
@@ -221,12 +219,12 @@ module SMESH
   };
 
   /*!
-   * Enumeration for DriverMED read status (used by ImportMEDFile() method)
+   * Enumeration for mesh read status (used by SMESH_Gen::CreateMeshesFrom*() methods)
    */
   enum DriverMED_ReadStatus // in the order of severity
   {
     DRS_OK,
-    DRS_EMPTY,          // a MED file contains no mesh with the given name
+    DRS_EMPTY,          // a file contains no mesh with the given name
     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
@@ -235,16 +233,23 @@ module SMESH
   };
 
   /*!
-   * Enumeration for DriverMED (used by Perform() method)
+   * Enumeration for ExportToMED*()
    */
-  enum MED_VERSION // in the order of severity
+  enum MED_VERSION
   {
     MED_V2_1,
     MED_V2_2
   };
 
-  typedef sequence<log_block> log_array;
-
+  /*! 
+   * \brief A structure containing information about MED file
+   */
+  struct MedFileInfo
+  {
+    string fileName; //!< name of file
+    long   fileSize; //!< size of file
+    long   major, minor, release; //!< MED file version
+  };
 
   /*!
    * Auxilary flags for advanced extrusion.
@@ -280,11 +285,17 @@ module SMESH
     long_array GetIDs();
 
     /*!
-     * Returns statistic of mesh elements
-     * @return array of number enityties by index of EntityType
+     * Returns number of mesh elements of each \a EntityType
+     * @return array of number of elements per \a EntityType
      */
     long_array GetMeshInfo();
 
+    /*!
+     * Returns number of mesh elements of each \a ElementType
+     * @return array of number of elements per \a ElementType
+     */
+    long_array GetNbElementsByType();
+
     /*!
      * Returns types of elements it contains.
      * It's empty if the SMESH_IDSource contains no IDs
@@ -596,19 +607,26 @@ module SMESH
     boolean HasDuplicatedGroupNamesMED();
 
     /*!
-     * Export Mesh to different MED Formats
+     * Export Mesh to a MED Format file
      * @params
      * - file : name of the MED file
      * - auto_groups : boolean parameter for creating/not creating
-     *   the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
-     *   the typical use is auto_groups=false.
+     *                 the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
+     *                 the typical use is auto_groups=false.
      * - version : define the version of format of MED file, that will be created
      * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
+     * - autoDimension: if @c True (default), a space dimension of a MED mesh can be either
+     *         - 1D if all mesh nodes lie on OX coordinate axis, or
+     *         - 2D if all mesh nodes lie on XOY coordinate plane, or
+     *         - 3D in the rest cases.
+     *
+     *         If @a autoDimension is @c False, the space dimension is always 3.
      */
     void ExportToMEDX( in string      file, 
                        in boolean     auto_groups, 
                        in MED_VERSION version, 
-                       in boolean     overwrite ) raises (SALOME::SALOME_Exception);
+                       in boolean     overwrite,
+                       in boolean     autoDimension ) raises (SALOME::SALOME_Exception);
 
     /*!
      * Export a part of Mesh into a MED file
@@ -617,15 +635,20 @@ module SMESH
      * - file : name of the MED file
      * - version : define the version of format of MED file, that will be created
      * - overwrite : boolean parameter for overwriting/not overwriting the file, if it exists
+     * - autoDimension: if @c True, a space dimension for export is defined by mesh 
+     *                 configuration; for example a planar mesh lying on XOY plane
+     *                 will be exported as a mesh in 2D space. 
+     *                 If @a autoDimension == @c False, the space dimension is 3.
      */
     void ExportPartToMED( in SMESH_IDSource meshPart, 
                           in string         file, 
                           in boolean        auto_groups,
                           in MED_VERSION    version,
-                          in boolean        overwrite ) raises (SALOME::SALOME_Exception);
+                          in boolean        overwrite,
+                          in boolean        autoDimension ) raises (SALOME::SALOME_Exception);
 
     /*!
-     * Export Mesh to different MED Formats
+     * Export Mesh to a MED Format file
      * Works, just the same as ExportToMEDX, with overwrite parameter equal to true.
      * The method is kept in order to support old functionality
      */
@@ -674,12 +697,10 @@ module SMESH
     void ExportPartToSTL( in SMESH_IDSource meshPart,
                           in string         file,
                           in boolean        isascii ) raises (SALOME::SALOME_Exception);
-
     /*!
-     * Get MED Mesh
+     * Return computation progress [0.,1]
      */
-    SALOME_MED::MESH GetMEDMesh()
-      raises (SALOME::SALOME_Exception);
+    double GetComputeProgress();
 
     /*!
      * Get informations about mesh contents
@@ -932,7 +953,7 @@ module SMESH
     double_array BaryCenter(in long id);
 
     /*! Gets information about imported MED file */
-    SALOME_MED::MedFileInfo GetMEDFileInfo();
+    MedFileInfo GetMEDFileInfo();
 
     /*!
      *  Sets list of notebook variables used for Mesh operations separated by ":" symbol
@@ -1005,12 +1026,6 @@ module SMESH
      * Get the internal Id
      */
     long GetId();
-
-    /*!
-     * Get MED subMesh
-     */
-    SALOME_MED::FAMILY GetFamily()
-      raises (SALOME::SALOME_Exception);
   };
 
 };
index 752d689300f2133fe33278fd3b3ed9194a3787f5..43d7eac35bb09a0aded02422a33f99a6c76ede1a 100644 (file)
@@ -927,13 +927,29 @@ module SMESH
     boolean ChangeElemNodes(in long ide, in long_array newIDs) 
       raises (SALOME::SALOME_Exception);
 
+    /*!
+     * \brief Duplicates given elements, i.e. creates new elements based on the 
+     *        same nodes as the given ones.
+     * \param theElements - container of elements to duplicate.
+     * \param theGroupName - a name of group to contain the generated elements.
+     *                    If a group with such a name already exists, the new elements
+     *                    are added to the existng group, else a new group is created.
+     *                    If \a theGroupName is empty, new elements are not added 
+     *                    in any group.
+     * \return a group where the new elements are added. NULL if theGroupName == "".
+     * \sa DoubleNode()
+     */
+    SMESH_Group DoubleElements( in SMESH_IDSource theElements, 
+                                in string         theGroupName )
+      raises (SALOME::SALOME_Exception);
+
     /*!
      * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
      * \param theNodes - identifiers of nodes to be doubled
      * \param theModifiedElems - identifiers of elements to be updated by the new (doubled)
      *        nodes. If list of element identifiers is empty then nodes are doubled but
      *        they not assigned to elements
-     *        \return TRUE if operation has been completed successfully, FALSE otherwise
+     * \return TRUE if operation has been completed successfully, FALSE otherwise
      * \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
      */
     boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems ) 
index 62cb2827e61f4e111d105f6ba332ae01e720c5a9..7a057d2026d056c1df1ebca84fda7f7d13c77e23 100644 (file)
@@ -156,7 +156,8 @@ dist_salomeres_DATA = \
        mesh_sew_sideelements.png \
        mesh_merge_nodes.png \
        mesh_merge_elements.png \
-       select1.png \
+  select1.png \
+  open.png \
        StdMeshers.xml \
        mesh_pattern.png \
        mesh_pentahedron.png \
@@ -193,13 +194,14 @@ dist_salomeres_DATA = \
        mesh_tree_mesh_partial.png \
        mesh_extractGroup.png \
        mesh_precompute.png \
-       mesh_2d_from_3d.png \
-        mesh_free_faces.png \
-        scale.png \
-        scale_along_axes.png \
+  mesh_2d_from_3d.png \
+  mesh_free_faces.png \
+  scale.png \
+  scale_along_axes.png \
        split_into_tetra.png \
        mesh_duplicate_nodes.png \
        mesh_duplicate_nodes_with_elem.png \
+       mesh_duplicate_elem_only.png \
        mesh_bounding_box.png \
        mesh_hypo_viscous_layers.png \
        mesh_tree_hypo_viscous_layers.png \
index 72f293f20399f6cbfa5b00739e99e811fa541718..7f3e3c14eead0b784a7e584e886c62c1ca825c3c 100644 (file)
@@ -77,6 +77,7 @@
     <parameter name="distribution_color"           value="0, 85, 0" />
     <parameter name="DisplayMode"                  value="true" />
     <parameter name="auto_update"                  value="true" />
+    <parameter name="incremental_limit"            value="false" />
     <parameter name="update_limit"                 value="500000" />
     <parameter name="display_entity"               value="true" />
     <parameter name="display_mode"                 value="1"    />
     <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_controls_limit"          value="3000"/>
     <parameter name="info_dump_base"               value="true" />
     <parameter name="info_dump_elem"               value="true" />
     <parameter name="info_dump_add"                value="true" />
+    <parameter name="info_dump_ctrl"               value="true" />
     <parameter name="segmentation"                 value="10"/>
     <parameter name="nb_segments_per_edge"         value="15"/>
     <parameter name="forget_mesh_on_hyp_modif"     value="true"/>
     <parameter name="sub_menu"          value="%1 module"/>
     <parameter name="User's Guide"      value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/index.html"/>
     <parameter name="Plug-ins/Yams plugin User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/yams/index.html"/>
+    <parameter name="Plug-ins/MGCleaner plugin User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/MGCleaner/index.html"/>
     <parameter name="Developer's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/tui/SMESH/index.html"/>
   </section>
   <section name="resources">
index 81c8ba228aa64c42ea4e09c786e4386a828b5107..3deebff7cea5834549ab326eefffbdd34abd3b93 100644 (file)
         <algo>MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO)</algo>
         <hypo>LengthFromEdges=LengthFromEdges()</hypo>
         <hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
-        <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
+        <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2))</hypo>
       </python-wrap>
     </algorithm>
 
diff --git a/resources/mesh_duplicate_elem_only.png b/resources/mesh_duplicate_elem_only.png
new file mode 100644 (file)
index 0000000..c34edc3
Binary files /dev/null and b/resources/mesh_duplicate_elem_only.png differ
diff --git a/resources/open.png b/resources/open.png
new file mode 100644 (file)
index 0000000..8ed143e
Binary files /dev/null and b/resources/open.png differ
index b78c2f0f7a60ae7b3949ca041b21e4bbfcec65f4..7686e655db6ba1215f01d19318b80dcf844a738a 100644 (file)
@@ -2768,10 +2768,11 @@ void ElemEntityType::SetMesh( const SMDS_Mesh* theMesh )
 bool ElemEntityType::IsSatisfy( long theId )
 {
   if ( !myMesh ) return false;
+  if ( myType == SMDSAbs_Node )
+    return myMesh->FindNode( theId );
   const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
   return ( anElem &&
-           myEntityType == anElem->GetEntityType() &&
-           ( myType == SMDSAbs_Edge || myType == SMDSAbs_Face || myType ==  SMDSAbs_Volume ));
+           myEntityType == anElem->GetEntityType() );
 }
 
 void ElemEntityType::SetType( SMDSAbs_ElementType theType )
index 21170efca6c18c4a1e83f7ece2849c62168ff3d2..64a1eb739c6d767a62d4a6ee83a613564f9fd34c 100644 (file)
@@ -59,7 +59,7 @@ class MESHDRIVER_EXPORT Driver_Mesh
   };
 
   void                SetMeshId(int theMeshId);
-  void                SetFile(const std::string& theFileName);
+  virtual void        SetFile(const std::string& theFileName);
   virtual void        SetMeshName(const std::string& theMeshName);
   virtual std::string GetMeshName() const;
 
diff --git a/src/DriverMED/DriverMED.hxx b/src/DriverMED/DriverMED.hxx
new file mode 100644 (file)
index 0000000..c2bee4b
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2007-2013  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
+//
+
+// Declarations needed for usage of DriverMED
+
+#include <boost/shared_ptr.hpp>
+
+class DriverMED_Family;
+typedef boost::shared_ptr<DriverMED_Family> DriverMED_FamilyPtr;
index 0644c172863a1bca2a9e993118cbdeb4a1d2bc9c..55a857f61b0dfef14fb9ad5665735e40a26eab7f 100644 (file)
@@ -24,7 +24,6 @@
 //  File   : DriverMED_Family.cxx
 //  Author : Julia DOROVSKIKH
 //  Module : SMESH
-//  $Header$
 //
 #include "DriverMED_Family.h"
 #include "MED_Factory.hxx"
index 1cd35e27194c7ee6b4c761872425b28234bd837e..c64c17f7c402e4ea82dba33fbe04b2ee8570f60c 100644 (file)
 //  File   : DriverMED_Family.hxx
 //  Author : Julia DOROVSKIKH
 //  Module : SMESH
-//  $Header$
 //
 #ifndef _INCLUDE_DRIVERMED_FAMILY
 #define _INCLUDE_DRIVERMED_FAMILY
 
 #include "SMESH_DriverMED.hxx"
+#include "DriverMED.hxx"
 
 #include "SMDS_Mesh.hxx"
 #include "SMESHDS_GroupBase.hxx"
@@ -49,8 +49,6 @@
 #define REST_BALL_FAMILY    -5
 #define FIRST_ELEM_FAMILY   -6
 
-class DriverMED_Family;
-typedef boost::shared_ptr<DriverMED_Family> DriverMED_FamilyPtr;
 typedef std::list<DriverMED_FamilyPtr     > DriverMED_FamilyPtrList;
 typedef std::map<int,SMESHDS_SubMesh*     > SMESHDS_SubMeshPtrMap;
 typedef std::list<SMESHDS_GroupBase*      > SMESHDS_GroupBasePtrList;
index cd6243d16065e9be9b8c600aa27cd1cd2b915030..b4ca1a08fb6a2458c4e475bb17b92d7f8efb0bad 100644 (file)
@@ -52,6 +52,26 @@ static int MYDEBUG = 0;
 using namespace MED;
 using namespace std;
 
+typedef std::map<int, DriverMED_FamilyPtr> TID2FamilyMap;
+
+namespace DriverMED
+{
+  bool buildMeshGrille(const MED::PWrapper&  theWrapper,
+                       const MED::PMeshInfo& theMeshInfo,
+                       SMESHDS_Mesh*         theMesh,
+                       const TID2FamilyMap&  myFamilies);
+  /*!
+   * \brief Ensure aFamily has a required ID
+    * \param aFamily - a family to check
+    * \param anID - an ID aFamily should have
+    * \param myFamilies - a map of the family ID to the Family
+    * \retval bool  - true if successful
+   */
+  bool checkFamilyID(DriverMED_FamilyPtr & aFamily,
+                     int                   anID,
+                     const TID2FamilyMap&  myFamilies);
+}
+
 void
 DriverMED_R_SMESHDS_Mesh
 ::SetMeshName(string theMeshName)
@@ -135,7 +155,7 @@ DriverMED_R_SMESHDS_Mesh
         }
 
         if (aMeshInfo->GetType() == MED::eSTRUCTURE){
-          /*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
+          /*bool aRes = */DriverMED::buildMeshGrille(aMed,aMeshInfo,myMesh,myFamilies);
           continue;
         }
 
@@ -169,7 +189,7 @@ DriverMED_R_SMESHDS_Mesh
 
           // Save reference to this node from its family
           TInt aFamNum = aNodeInfo->GetFamNum(iElem);
-          if ( checkFamilyID ( aFamily, aFamNum ))
+          if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
           {
             aFamily->AddElement(aNode);
             aFamily->SetType(SMDSAbs_Node);
@@ -257,7 +277,7 @@ DriverMED_R_SMESHDS_Mesh
 
                 // Save reference to this element from its family
                 TInt aFamNum = aBallInfo->GetFamNum(iBall);
-                if ( checkFamilyID ( aFamily, aFamNum ))
+                if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
                 {
                   aFamily->AddElement(anElement);
                   aFamily->SetType( SMDSAbs_Ball );
@@ -329,7 +349,7 @@ DriverMED_R_SMESHDS_Mesh
                     if(aResult < DRS_WARN_RENUMBER)
                       aResult = DRS_WARN_RENUMBER;
                   }
-                  if ( checkFamilyID ( aFamily, aFamNum ))
+                  if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
                   {
                     // Save reference to this element from its family
                     aFamily->AddElement(anElement);
@@ -409,7 +429,7 @@ DriverMED_R_SMESHDS_Mesh
                     if (aResult < DRS_WARN_RENUMBER)
                       aResult = DRS_WARN_RENUMBER;
                   }
-                  if ( checkFamilyID ( aFamily, aFamNum )) {
+                  if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )) {
                     // Save reference to this element from its family
                     aFamily->AddElement(anElement);
                     aFamily->SetType(anElement->GetType());
@@ -920,7 +940,7 @@ DriverMED_R_SMESHDS_Mesh
                     if (aResult < DRS_WARN_RENUMBER)
                       aResult = DRS_WARN_RENUMBER;
                   }
-                  if ( checkFamilyID ( aFamily, aFamNum )) {
+                  if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )) {
                     // Save reference to this element from its family
                     myFamilies[aFamNum]->AddElement(anElement);
                     myFamilies[aFamNum]->SetType(anElement->GetType());
@@ -1127,7 +1147,9 @@ void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes ()
  * \param anID - an ID aFamily should have
  * \retval bool  - true if successful
  */
-bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const
+bool DriverMED::checkFamilyID(DriverMED_FamilyPtr & aFamily,
+                              int                   anID,
+                              const TID2FamilyMap&  myFamilies)
 {
   if ( !aFamily || aFamily->GetId() != anID ) {
     map<int, DriverMED_FamilyPtr>::const_iterator i_fam = myFamilies.find(anID);
@@ -1138,14 +1160,18 @@ bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int
   return ( aFamily->GetId() == anID );
 }
 
-
-/*! \brief Reading the structured mesh and convert to non structured (by filling of smesh structure for non structured mesh)
+/*!
+ * \brief Reading the structured mesh and convert to non structured
+ *        (by filling of smesh structure for non structured mesh)
  * \param theWrapper  - PWrapper const pointer
  * \param theMeshInfo - PMeshInfo const pointer
+ * \param myFamilies  - a map of the family ID to the Family
  * \return TRUE, if successfully. Else FALSE
  */
-bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
-                                               const MED::PMeshInfo& theMeshInfo)
+bool DriverMED::buildMeshGrille(const MED::PWrapper&  theWrapper,
+                                const MED::PMeshInfo& theMeshInfo,
+                                SMESHDS_Mesh*         myMesh,
+                                const TID2FamilyMap&  myFamilies)
 {
   bool res = true;
 
@@ -1167,7 +1193,7 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
 
     if((aGrilleInfo->myFamNumNode).size() > 0){
       TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
-      if ( checkFamilyID ( aFamily, aFamNum ))
+      if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
         {
           aFamily->AddElement(aNode);
           aFamily->SetType(SMDSAbs_Node);
@@ -1224,7 +1250,7 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
     }
     if((aGrilleInfo->myFamNum).size() > 0){
       TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
-      if ( checkFamilyID ( aFamily, aFamNum )){
+      if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )){
         aFamily->AddElement(anElement);
         aFamily->SetType(anElement->GetType());
       }
index 5e4459a3234467bed5d718d7630ad31feb0e9800..71d38ef78db0c4abb4e14acbf5f38db99f746941 100644 (file)
 
 #include "SMESH_DriverMED.hxx"
 
+#include "DriverMED.hxx"
 #include "Driver_SMESHDS_Mesh.h"
-#include "DriverMED_Family.h"
+#include "SMDSAbs_ElementType.hxx"
 
 #include <list>
+#include <map>
 
 class SMESHDS_Mesh;
 class SMESHDS_Group;
@@ -53,18 +55,6 @@ class MESHDRIVERMED_EXPORT DriverMED_R_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
   std::list<std::string> GetMeshNames(Status& theStatus);
   void SetMeshName(std::string theMeshName);
 
- private:
-  /*!
-   * \brief Ensure aFamily has required ID
-    * \param aFamily - a family to check
-    * \param anID - an ID aFamily should have
-    * \retval bool  - true if successful
-   */
-  bool checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const;
-
-  bool buildMeshGrille(const MED::PWrapper& theWrapper,
-                       const MED::PMeshInfo& theMeshInfo);
-
  private:
   std::string myMeshName;
   std::map<int, DriverMED_FamilyPtr> myFamilies;
index a3d934c84077d39a47f4f6518876123e22bdd9ab..aa89eea404c9a50914a106380de14ce2ef040a54 100644 (file)
 //  File   : DriverMED_W_SMESHDS_Mesh.cxx
 //  Module : SMESH
 //
-#include <sstream>
 
 #include "DriverMED_W_SMESHDS_Mesh.h"
-#include "DriverMED_Family.h"
 
-#include "SMESHDS_Mesh.hxx"
+#include "DriverMED_Family.h"
+#include "MED_Factory.hxx"
+#include "MED_Utilities.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMESHDS_Mesh.hxx"
 
-#include "utilities.h"
+#include <utilities.h>
 
-#include "MED_Utilities.hxx"
 
 #define _EDF_NODE_IDS_
 //#define _ELEMENTS_BY_DIM_
@@ -46,25 +46,27 @@ using namespace MED;
 
 
 DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
+  myMedVersion(MED::eV2_2),
   myAllSubMeshes (false),
   myDoGroupOfNodes (false),
   myDoGroupOfEdges (false),
   myDoGroupOfFaces (false),
   myDoGroupOfVolumes (false),
   myDoGroupOf0DElems(false),
-  myDoGroupOfBalls(false)
+  myDoGroupOfBalls(false),
+  myAutoDimension(true)
 {}
 
 void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, 
-                                       MED::EVersion theId)
+                                       MED::EVersion      theId)
 {
-  myMed = CrWrapper(theFileName,theId);
   Driver_SMESHDS_Mesh::SetFile(theFileName);
+  myMedVersion = theId;
 }
 
 void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
 {
-  return SetFile(theFileName,MED::eV2_2);
+  Driver_SMESHDS_Mesh::SetFile(theFileName);
 }
 
 string DriverMED_W_SMESHDS_Mesh::GetVersionString(const MED::EVersion theVersion, int theNbDigits)
@@ -120,7 +122,8 @@ void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes()
   myDoGroupOfVolumes = true;
 }
 
-namespace{
+namespace
+{
   typedef double (SMDS_MeshNode::* TGetCoord)() const;
   typedef const char* TName;
   typedef const char* TUnit;
@@ -311,12 +314,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     }
 
     // Mesh dimension definition
-    TInt aSpaceDimension;
+    TInt aSpaceDimension = 3;
     TCoordHelperPtr aCoordHelperPtr;
     {
       bool anIsXDimension = false;
       bool anIsYDimension = false;
       bool anIsZDimension = false;
+      if ( myAutoDimension )
       {
         SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
         double aBounds[6];
@@ -390,6 +394,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     if ( myMesh->NbVolumes() > 0 )
       aMeshDimension = 3;
     
+    MED::PWrapper myMed = CrWrapper(myFile,myMedVersion);
     PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName);
     MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
     myMed->SetMeshInfo(aMeshInfo);
index 7c02b40f02da34f38c9d55cc9f7ddc9e2401aae1..30d1f475fe006667a83d8fdf73621b1cd6648581 100644 (file)
@@ -30,7 +30,7 @@
 #include "SMESH_DriverMED.hxx"
 
 #include "Driver_SMESHDS_Mesh.h"
-#include "MED_Factory.hxx"
+#include "MED_Common.hxx"
 
 #include <string>
 #include <list>
@@ -48,6 +48,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
 
   virtual void SetFile(const std::string& theFileName);
   void SetFile(const std::string& theFileName, MED::EVersion theId);
+  void SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; }
   static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2);
 
   /*! sets file name; only for usage with Add(), not Write()
@@ -71,7 +72,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
 
  private:
 
-  MED::PWrapper myMed;
+  MED::EVersion myMedVersion;
   std::list<SMESHDS_GroupBase*> myGroups;
   bool myAllSubMeshes;
   std::map<int,SMESHDS_SubMesh*> mySubMeshes;
@@ -81,8 +82,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
   bool myDoGroupOfVolumes;
   bool myDoGroupOf0DElems;
   bool myDoGroupOfBalls;
+  bool myAutoDimension;
 };
 
-
 #endif
-
index 13ac7d4515efecd0971dcb8c1501b53ffaeb9eef..dc58802a1976835dce4f204d41a129d02e1c78ac 100644 (file)
@@ -26,6 +26,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 # header files 
 salomeinclude_HEADERS = \
+       DriverMED.hxx \
        DriverMED_R_SMESHDS_Mesh.h \
        DriverMED_W_SMESHDS_Mesh.h \
        DriverMED_Family.h \
@@ -47,12 +48,13 @@ dist_MED_Test_SOURCES = \
 
 # additionnal information to compil and link file
 libMeshDriverMED_la_CPPFLAGS = \
-       $(MED_CXXFLAGS) \
        @HDF5_INCLUDES@ \
        $(KERNEL_CXXFLAGS) \
        $(CAS_CPPFLAGS) \
         $(VTK_INCLUDES) \
        $(BOOST_CPPFLAGS) \
+       -I$(srcdir)/../MEDWrapper/Base \
+       -I$(srcdir)/../MEDWrapper/Factory \
        -I$(srcdir)/../Driver \
        -I$(srcdir)/../SMDS \
        -I$(srcdir)/../SMESHUtils \
@@ -61,7 +63,9 @@ libMeshDriverMED_la_CPPFLAGS = \
 libMeshDriverMED_la_LDFLAGS  = \
        $(BOOST_LIBS) \
        ../Driver/libMeshDriver.la \
-       $(MED_LDFLAGS) -lMEDWrapper -lMEDWrapperBase -lMEDWrapper_V2_2
+       ../MEDWrapper/Factory/libMEDWrapper.la \
+       ../MEDWrapper/Base/libMEDWrapperBase.la \
+       ../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \
        $(BOOST_LIB_SYSTEM) 
 
 MED_Test_CPPFLAGS = \
@@ -77,8 +81,7 @@ MED_Test_LDADD = \
        -lOpUtil \
        -lSALOMELocalTrace \
        -lSALOMEBasics \
-       $(MED_LDFLAGS) \
-       -lMEDWrapper \
-       -lMEDWrapperBase \
-       -lMEDWrapper_V2_2
+       ../MEDWrapper/Factory/libMEDWrapper.la \
+       ../MEDWrapper/Base/libMEDWrapperBase.la \
+       ../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \
        $(BOOST_LIB_SYSTEM) 
diff --git a/src/MEDWrapper/Base/CMakeLists.txt b/src/MEDWrapper/Base/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2d7fe40
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D
+#
+# 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_DIRECTORIES(
+  ${HDF5_INCLUDE_DIRS}
+  ${BOOST_INCLUDE_DIRS}
+)
+
+IF(MED_ENABLE_KERNEL)
+  INCLUDE_DIRECTORIES(${KERNEL_ROOT_DIR}/include/salome)
+ELSE(MED_ENABLE_KERNEL)
+  INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/adm_local_without_kernel)
+ENDIF(MED_ENABLE_KERNEL)
+
+SET(MEDWrapperBase_SOURCES
+  MED_Structures.cxx
+  MED_Wrapper.cxx
+  MED_Algorithm.cxx
+  MED_GaussUtils.cxx
+  MED_CoordUtils.cxx
+  MED_Utilities.cxx
+  MED_GaussDef.cxx
+  )
+
+ADD_LIBRARY(MEDWrapperBase SHARED ${MEDWrapperBase_SOURCES})
+SET_TARGET_PROPERTIES(MEDWrapperBase PROPERTIES COMPILE_FLAGS "-D${MACHINE} ${HDF5_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
+TARGET_LINK_LIBRARIES(MEDWrapperBase ${BOOST_LIB_THREAD} ${BOOST_LIB_DATE_TIME})
+INSTALL(TARGETS MEDWrapperBase DESTINATION ${MED_salomelib_LIBS})
+
+FILE(GLOB MEDWrapperBase_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
+INSTALL(FILES ${MEDWrapperBase_HEADERS_HXX} DESTINATION ${MED_salomeinclude_HEADERS})
diff --git a/src/MEDWrapper/Base/MED_Algorithm.cxx b/src/MEDWrapper/Base/MED_Algorithm.cxx
new file mode 100644 (file)
index 0000000..afe4ab7
--- /dev/null
@@ -0,0 +1,375 @@
+// Copyright (C) 2007-2013  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 "MED_Algorithm.hxx"
+#include "MED_Wrapper.hxx"
+
+#include "MED_Utilities.hxx"
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+#else
+// static int MYDEBUG = 0;
+// static int MYVALUEDEBUG = 0;
+#endif
+
+namespace MED
+{
+  //---------------------------------------------------------------
+  TEntity2TGeom2ElemInfo 
+  GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper, 
+                           const PMeshInfo& theMeshInfo,
+                           const MED::TEntityInfo& theEntityInfo)
+  {
+    MSG(MYDEBUG,"GetElemsByEntity(...)");
+    TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo;
+    MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin();
+    PElemInfo anElemInfo;
+    TErr anErr;
+    for(; anIter != theEntityInfo.end(); anIter++){
+      const EEntiteMaillage& anEntity = anIter->first;
+      const TGeom2Size& aGeom2Size = anIter->second;
+      TGeom2ElemInfo& aGeom2ElemInfo = anEntity2TGeom2ElemInfo[anEntity];
+
+      if(anEntity == eNOEUD){
+        aGeom2ElemInfo[ePOINT1] = theWrapper->GetPElemInfo(theMeshInfo);
+        continue;
+      }
+
+      TGeom2Size::const_iterator anIter2 = aGeom2Size.begin();
+      for(; anIter2 != aGeom2Size.end(); anIter2++){
+        const EGeometrieElement& aGeom = anIter2->first;
+        aGeom2ElemInfo[aGeom] = theWrapper->GetPElemInfo(theMeshInfo,anEntity,aGeom,MED::eNOD,&anErr);
+      }
+    }
+    ADDMSG(MYDEBUG,"\n");
+    return anEntity2TGeom2ElemInfo;
+  }
+  
+  
+  //---------------------------------------------------------------
+  TFamilyInfoSet
+  GetFamilyInfoSet(const PWrapper& theWrapper,
+                   const PMeshInfo& theMeshInfo)
+  {
+    MSG(MYDEBUG,"GetFamilies(...)");
+    TErr anErr;
+    TFamilyInfoSet aFamilyInfoSet;
+    TInt aNbFam = theWrapper->GetNbFamilies(*theMeshInfo);
+    INITMSG(MYDEBUG,"GetNbFamilies() = "<<aNbFam<<"\n");
+    for(TInt iFam = 1; iFam <= aNbFam; iFam++){
+      PFamilyInfo aFamilyInfo = theWrapper->GetPFamilyInfo(theMeshInfo,iFam,&anErr);
+      if(anErr >= 0)
+        aFamilyInfoSet.insert(aFamilyInfo);
+    }
+    ADDMSG(MYDEBUG,"\n");
+    return aFamilyInfoSet;
+  }
+
+
+  //---------------------------------------------------------------
+  TGroupInfo
+  GetGroupInfo(const TFamilyInfoSet& theFamilyInfoSet)
+  {
+    MSG(MYDEBUG,"GetFamiliesByGroup(...)");
+    TGroupInfo aGroup;
+    TFamilyInfoSet::const_iterator anIter = theFamilyInfoSet.begin();
+    for(; anIter != theFamilyInfoSet.end(); anIter++){
+      const PFamilyInfo& aFamilyInfo = *anIter;
+      TInt aNbGroup = aFamilyInfo->GetNbGroup();
+      for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
+        aGroup[aFamilyInfo->GetGroupName(iGroup)].insert(aFamilyInfo);
+      } 
+    }
+
+#ifdef _DEBUG_
+    if(MYDEBUG){
+      TGroupInfo::const_iterator anIter = aGroup.begin();
+      for(; anIter != aGroup.end(); anIter++){
+        const std::string& aName = anIter->first;
+        INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
+        const TFamilyInfoSet& aFamilyInfoSet = anIter->second;
+        TFamilyInfoSet::const_iterator anFamIter = aFamilyInfoSet.begin();
+        for(; anFamIter != aFamilyInfoSet.end(); anFamIter++){
+          const PFamilyInfo& aFamilyInfo = *anFamIter;
+          INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyInfo->GetName()<<"'\n");
+        }
+      }
+      ADDMSG(MYDEBUG,"\n");
+    }
+#endif
+
+    return aGroup;
+  }
+
+
+  //---------------------------------------------------------------
+  TFieldInfo2TimeStampInfoSet 
+  GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper, 
+                                const PMeshInfo& theMeshInfo,
+                                const MED::TEntityInfo& theEntityInfo)
+  {
+    MSG(MYDEBUG,"GetFieldsByEntity(...)");
+    TFieldInfo2TimeStampInfoSet aFieldInfo2TimeStampInfoSet;
+    TInt aNbFields = theWrapper->GetNbFields();
+    INITMSG(MYDEBUG,"GetNbFields() = "<<aNbFields<<"\n");
+    for(TInt iField = 1; iField <= aNbFields; iField++){
+      PFieldInfo aFieldInfo = theWrapper->GetPFieldInfo(theMeshInfo,iField);
+      INITMSG(MYDEBUG,"aFieldName = '"<<aFieldInfo->GetName()<<
+              "'; aNbComp = "<<aFieldInfo->GetNbComp()<<"; ");
+      TGeom2Size aGeom2Size;
+      EEntiteMaillage anEntity = EEntiteMaillage(-1);
+      TInt aNbTimeStamps = theWrapper->GetNbTimeStamps(aFieldInfo,theEntityInfo,anEntity,aGeom2Size);
+      ADDMSG(MYDEBUG,"anEntity = "<<anEntity<<"; GetNbTimeStamps = "<<aNbTimeStamps<<"\n");
+      for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+        PTimeStampInfo aTimeStamp = 
+          theWrapper->GetPTimeStampInfo(aFieldInfo,anEntity,aGeom2Size,iTimeStamp);
+        aFieldInfo2TimeStampInfoSet[aFieldInfo].insert(aTimeStamp);
+        INITMSG(MYDEBUG,
+                "aDt = "<<aTimeStamp->GetDt()<<
+                ", Unit = \'"<<aTimeStamp->GetUnitDt()<<"\n");
+      }
+    }
+    ADDMSG(MYDEBUG,"\n");
+    return aFieldInfo2TimeStampInfoSet;
+  }
+  
+
+  //---------------------------------------------------------------
+  TEntite2TFieldInfo2TimeStampInfoSet 
+  GetEntite2TFieldInfo2TimeStampInfoSet(const TFieldInfo2TimeStampInfoSet& theFieldInfo2TimeStampInfoSet)
+  {
+    TEntite2TFieldInfo2TimeStampInfoSet anEntite2TFieldInfo2TimeStampInfoSet;
+    TFieldInfo2TimeStampInfoSet::const_iterator anIter = theFieldInfo2TimeStampInfoSet.begin();
+    for(; anIter != theFieldInfo2TimeStampInfoSet.end(); anIter++){
+      const TTimeStampInfoSet& aTimeStampInfoSet = anIter->second;
+      //const PFieldInfo& aFieldInfo = anIter->first;
+      if(aTimeStampInfoSet.empty()) 
+        continue;
+      const PTimeStampInfo& aTimeStampInfo = *aTimeStampInfoSet.begin();
+      anEntite2TFieldInfo2TimeStampInfoSet[ConvertEntity(aTimeStampInfo->GetEntity())].insert(*anIter);
+    }
+    return anEntite2TFieldInfo2TimeStampInfoSet;
+  }
+  
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const TFamilyTSize& theLeft, const TFamilyTSize& theRight)
+  {
+    const MED::PFamilyInfo& aLeftInfo = boost::get<0>(theLeft);
+    const MED::PFamilyInfo& aRightInfo = boost::get<0>(theRight);
+    return aLeftInfo->GetId() < aRightInfo->GetId();
+  }
+
+
+  //---------------------------------------------------------------
+  TEntity2FamilySet 
+  GetEntity2FamilySet(const PWrapper& theWrapper, 
+                      const TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
+                      const TFamilyInfoSet& theFamilyInfoSet)
+  {
+    MSG(MYDEBUG,"GetFamiliesByEntity(...)");
+    TEntity2FamilySet anEntity2FamilySet;
+    
+    typedef std::map<TInt,PFamilyInfo> TId2Family;
+    TId2Family anId2Family;
+    TFamilyInfoSet::const_iterator anIter = theFamilyInfoSet.begin();
+    for(; anIter != theFamilyInfoSet.end(); anIter++){
+      const PFamilyInfo& aFamilyInfo = *anIter;
+      anId2Family.insert(TId2Family::value_type(aFamilyInfo->GetId(),aFamilyInfo));
+    }
+    
+    if(!anId2Family.empty()){
+      typedef std::map<TInt,TInt> TFamilyID2Size;
+      typedef std::map<EEntiteMaillage,TFamilyID2Size> TEntity2FamilyID;
+      TEntity2FamilyID anEntity2FamilyID;
+      
+      if(!theEntity2TGeom2ElemInfo.empty()){
+        TEntity2TGeom2ElemInfo::const_iterator anIter = theEntity2TGeom2ElemInfo.begin();
+        for(; anIter != theEntity2TGeom2ElemInfo.end(); anIter++){
+          const EEntiteMaillage& anEntity = anIter->first;
+          TFamilyID2Size& aFamilyID2Size = anEntity2FamilyID[anEntity];
+          const TGeom2ElemInfo& aGeom2ElemInfo = anIter->second;
+          TGeom2ElemInfo::const_iterator aGeom2ElemInfoIter = aGeom2ElemInfo.begin();
+          for(; aGeom2ElemInfoIter != aGeom2ElemInfo.end(); aGeom2ElemInfoIter++){
+            const PElemInfo& aElemInfo = aGeom2ElemInfoIter->second;
+            if(TInt aNbElem = aElemInfo->GetNbElem()){
+              for(TInt i = 0; i < aNbElem; i++){
+                aFamilyID2Size[aElemInfo->GetFamNum(i)] += 1;
+              }
+            }
+          }
+        }
+      }
+      
+      if(!anEntity2FamilyID.empty()){
+        TEntity2FamilyID::const_iterator anIter = anEntity2FamilyID.begin();
+        for(; anIter != anEntity2FamilyID.end(); anIter++){
+          const EEntiteMaillage& anEntity = anIter->first;
+          INITMSG(MYDEBUG,"anEntity = "<<anEntity<<":\n");
+          const TFamilyID2Size& aFamilyID2Size = anIter->second;
+          TFamilyID2Size::const_iterator anIter2 = aFamilyID2Size.begin();
+          for(; anIter2 != aFamilyID2Size.end(); anIter2++){
+            TInt anId = anIter2->first;
+            TInt aSize = anIter2->second;
+            TId2Family::const_iterator anIter3 = anId2Family.find(anId);
+            if(anIter3 != anId2Family.end()){
+              const PFamilyInfo& aFamilyInfo = anIter3->second;
+              anEntity2FamilySet[anEntity].insert(TFamilyTSize(aFamilyInfo,aSize));
+              INITMSG(MYDEBUG,
+                      "aFamilyName = '"<<aFamilyInfo->GetName()<<
+                      "' anId = "<<aFamilyInfo->GetId()<<"\n");
+            }
+          }
+        }
+      }
+    }    
+    ADDMSG(MYDEBUG,"\n");
+    return anEntity2FamilySet;
+  }
+  
+
+  //---------------------------------------------------------------
+  TKey2Gauss
+  GetKey2Gauss(const PWrapper& theWrapper, 
+               TErr* theErr,
+               EModeSwitch theMode)
+  {
+    INITMSG(MYDEBUG,"GetKey2Gauss - theMode = "<<theMode<<std::endl);
+    TKey2Gauss aKey2Gauss;
+    TInt aNbGauss = theWrapper->GetNbGauss(theErr);
+    for(TInt anId = 1; anId <= aNbGauss; anId++){
+      TGaussInfo::TInfo aPreInfo = theWrapper->GetGaussPreInfo(anId);
+      PGaussInfo anInfo = theWrapper->CrGaussInfo(aPreInfo,theMode);
+      theWrapper->GetGaussInfo(anId,anInfo,theErr);
+      TGaussInfo::TKey aKey = boost::get<0>(aPreInfo);
+      aKey2Gauss[aKey] = anInfo;
+
+#ifdef _DEBUG_
+      const EGeometrieElement& aGeom = boost::get<0>(aKey);
+      const std::string& aName = boost::get<1>(aKey);
+      INITMSG(MYDEBUG,
+              "- aGeom = "<<aGeom<<
+              "; aName = '"<<aName<<"'"<<
+              std::endl);
+#endif
+
+    }
+    return aKey2Gauss;
+  }
+
+
+  //---------------------------------------------------------------
+  PProfileInfo
+  GetProfileInfo(const PWrapper& theWrapper, 
+                 const std::string& theProfileName,
+                 TErr* theErr,
+                 EModeProfil theMode)
+  {
+    PProfileInfo anInfo;
+    TInt aNbProfiles = theWrapper->GetNbProfiles(theErr);
+    for(TInt anId = 1; anId <= aNbProfiles; anId++){
+      TProfileInfo::TInfo aPreInfo = theWrapper->GetProfilePreInfo(anId);
+      const std::string& aName = boost::get<0>(aPreInfo);
+      if(aName == theProfileName)
+        return theWrapper->GetPProfileInfo(anId,theMode,theErr);
+    }
+    return anInfo;
+  }
+  
+
+  //---------------------------------------------------------------
+  TMKey2Profile
+  GetMKey2Profile(const PWrapper& theWrapper, 
+                  TErr* theErr,
+                  EModeProfil theMode)
+  {
+    INITMSG(MYDEBUG,"GetMKey2Profile - theMode = "<<theMode<<std::endl);
+    TKey2Profile aKey2Profile;
+    TInt aNbProfiles = theWrapper->GetNbProfiles(theErr);
+    for(TInt anId = 1; anId <= aNbProfiles; anId++){
+      TProfileInfo::TInfo aPreInfo = theWrapper->GetProfilePreInfo(anId);
+      PProfileInfo anInfo = theWrapper->GetPProfileInfo(anId,theMode,theErr);
+      const std::string& aName = boost::get<0>(aPreInfo);
+      aKey2Profile[aName] = anInfo;
+      
+#ifdef _DEBUG_
+      INITMSG(MYDEBUG,
+              "- aName = '"<<aName<<"'"<<
+              " : "<<
+              std::endl);
+      TInt aNbElem = anInfo->GetSize();
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+      }
+      ADDMSG(MYVALUEDEBUG, std::endl);
+#endif
+      
+    }
+    return TMKey2Profile(theMode,aKey2Profile);
+  }
+
+  //---------------------------------------------------------------
+  EEntiteMaillage
+  GetEntityByFamilyId(PGrilleInfo& theInfo,TInt theId){
+    TElemNum::iterator aNodeFamIter = (theInfo->myFamNumNode).begin();
+    for(;aNodeFamIter != (theInfo->myFamNumNode).end(); aNodeFamIter++){
+      if(theId == *aNodeFamIter)
+        return eNOEUD;
+    }
+    TElemNum::iterator aCellFamIter = (theInfo->myFamNum).begin();
+    for(;aCellFamIter != (theInfo->myFamNum).end(); aCellFamIter++){
+      if(theId == *aCellFamIter)
+        return eMAILLE;
+    }
+    EXCEPTION(std::runtime_error, "GetEntityByFamilyId - fails");
+    return EEntiteMaillage(-1);
+  }
+
+  TFamilyID2NbCells
+  GetFamilyID2NbCells(PGrilleInfo& theInfo){
+    TFamilyID2NbCells aFamily2NbCells;
+    TInt aNbNodes = theInfo->myFamNumNode.size();
+    TInt aNbCells = theInfo->myFamNum.size();
+    for(TInt i=0; i<aNbNodes; i++) aFamily2NbCells[theInfo->GetFamNumNode(i)] = 0;
+    for(TInt i=0; i<aNbCells; i++) aFamily2NbCells[theInfo->GetFamNum(i)] = 0;
+    for(TInt i=0; i<aNbNodes; i++) aFamily2NbCells[theInfo->GetFamNumNode(i)] += 1;
+    for(TInt i=0; i<aNbCells; i++) aFamily2NbCells[theInfo->GetFamNum(i)] += 1;
+    return aFamily2NbCells;
+  }
+
+  EEntiteMaillage ConvertEntity(const EEntiteMaillage& aEntity){
+    switch( aEntity ){
+      
+    case eNOEUD_ELEMENT:
+    case eMAILLE: return eMAILLE; //eNOEUD_ELEMENT it is eMAILLE
+      
+    case eFACE:
+    case eARETE:
+    case eNOEUD: return aEntity; break;
+    default: return EEntiteMaillage(-1);
+      
+    }
+  }
+}
diff --git a/src/MEDWrapper/Base/MED_Algorithm.hxx b/src/MEDWrapper/Base/MED_Algorithm.hxx
new file mode 100644 (file)
index 0000000..ee7ac37
--- /dev/null
@@ -0,0 +1,157 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_Algorithm_HeaderFile
+#define MED_Algorithm_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+#include "MED_Structures.hxx"
+
+#include <set>
+
+namespace MED
+{
+  //---------------------------------------------------------------
+  typedef std::map<EGeometrieElement,PElemInfo> TGeom2ElemInfo;
+  typedef std::map<EEntiteMaillage,TGeom2ElemInfo> TEntity2TGeom2ElemInfo;
+
+  //! Get set of TElemInfo by its geometrical type and corresponding MED ENTITY
+  MEDWRAPPER_EXPORT
+  TEntity2TGeom2ElemInfo
+  GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper, 
+                           const PMeshInfo& theMeshInfo,
+                           const MED::TEntityInfo& theEntityInfo);
+
+
+  //---------------------------------------------------------------
+  typedef std::set<PFamilyInfo> TFamilyInfoSet;
+
+  //! Read set of MED FAMILIES for defined MED file
+  MEDWRAPPER_EXPORT
+  TFamilyInfoSet
+  GetFamilyInfoSet(const PWrapper& theWrapper, 
+                   const PMeshInfo& theMeshInfo);
+  
+
+  //---------------------------------------------------------------
+  typedef boost::tuple<PFamilyInfo,TInt> TFamilyTSize;
+
+  bool
+  operator<(const TFamilyTSize& theLeft, const TFamilyTSize& theRight);
+  typedef std::set<TFamilyTSize> TFamilyTSizeSet;
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EEntiteMaillage,TFamilyTSizeSet> TEntity2FamilySet;
+  
+  //! Split set of MED FAMILIES by corresponding MED ENTITY
+  MEDWRAPPER_EXPORT
+  TEntity2FamilySet
+  GetEntity2FamilySet(const PWrapper& theWrapper, 
+                      const TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
+                      const TFamilyInfoSet& theFamilyInfoSet);
+  
+
+  //---------------------------------------------------------------
+  typedef std::map<std::string,TFamilyInfoSet> TGroupInfo;
+  
+  //! Split the input set of MED FAMILIES by corresponding MED GROUPS
+  MEDWRAPPER_EXPORT
+  TGroupInfo
+  GetGroupInfo(const TFamilyInfoSet& theFamilyInfoSet);
+  
+  
+  //---------------------------------------------------------------
+  typedef std::set<PTimeStampInfo> TTimeStampInfoSet;
+  typedef std::map<PFieldInfo,TTimeStampInfoSet> TFieldInfo2TimeStampInfoSet;
+
+  //! Read set of MED TIMESTAMPS groupped by corresponding MED FIELDS
+  MEDWRAPPER_EXPORT
+  TFieldInfo2TimeStampInfoSet
+  GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper, 
+                                const PMeshInfo& theMeshInfo,
+                                const MED::TEntityInfo& theEntityInfo);
+  
+
+  //---------------------------------------------------------------
+  typedef std::map<EEntiteMaillage,TFieldInfo2TimeStampInfoSet> TEntite2TFieldInfo2TimeStampInfoSet;
+
+  //! Split the input set of MED TIMESTAMPS by corresponding MED FIELDS and MED ENTITIES
+  MEDWRAPPER_EXPORT
+  TEntite2TFieldInfo2TimeStampInfoSet
+  GetEntite2TFieldInfo2TimeStampInfoSet(const TFieldInfo2TimeStampInfoSet& theFieldInfo2TimeStampInfoSet);
+
+
+  //---------------------------------------------------------------
+  typedef std::map<TGaussInfo::TKey,PGaussInfo,TGaussInfo::TLess> TKey2Gauss;
+
+  //! Read set of MED GAUSS
+  MEDWRAPPER_EXPORT
+  TKey2Gauss
+  GetKey2Gauss(const PWrapper& theWrapper, 
+               TErr* theErr = NULL,
+               EModeSwitch theMode = eFULL_INTERLACE);
+
+
+  //---------------------------------------------------------------
+  //! Get MED PROFILE by its name
+  MEDWRAPPER_EXPORT
+  PProfileInfo
+  GetProfileInfo(const PWrapper& theWrapper, 
+                 const std::string& theProfileName,
+                 TErr* theErr = NULL,
+                 EModeProfil theMode = eCOMPACT);
+
+
+  //---------------------------------------------------------------
+  typedef std::map<TProfileInfo::TKey,PProfileInfo> TKey2Profile;
+  typedef boost::tuple<EModeProfil,TKey2Profile> TMKey2Profile;
+
+  //! Read set of MED PROFILES
+  MEDWRAPPER_EXPORT
+  TMKey2Profile
+  GetMKey2Profile(const PWrapper& theWrapper, 
+                  TErr* theErr = NULL,
+                  EModeProfil theMode = eCOMPACT);
+
+  //---------------------------------------------------------------
+  //! Get Entity for Grille by family id.
+  MEDWRAPPER_EXPORT
+  EEntiteMaillage
+  GetEntityByFamilyId(PGrilleInfo& theInfo,
+                      TInt theId);
+
+  typedef std::map<TInt,TInt> TFamilyID2NbCells;
+  
+  //! Get Number of cells for theId family, for Grille
+  MEDWRAPPER_EXPORT
+  TFamilyID2NbCells
+  GetFamilyID2NbCells(PGrilleInfo& theInfo);
+
+  //! Convert eNOEUD_ELEMENT to eMAILLE
+  MEDWRAPPER_EXPORT
+  EEntiteMaillage
+  ConvertEntity(const EEntiteMaillage& aEntity);
+
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_Common.hxx b/src/MEDWrapper/Base/MED_Common.hxx
new file mode 100644 (file)
index 0000000..4715f6c
--- /dev/null
@@ -0,0 +1,186 @@
+// Copyright (C) 2007-2013  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
+//
+
+#ifndef MED_Common_HeaderFile
+#define MED_Common_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+
+#include <string>
+#include <set>
+#include <map>
+
+#include <hdf5.h>
+
+#include <boost/tuple/tuple.hpp>
+
+#include "SALOMEconfig.h"
+
+#include "MED_Vector.hxx"
+#include "MED_SharedPtr.hxx"
+#include "MED_SliceArray.hxx"
+
+#ifdef WIN32
+#pragma warning(disable:4099)
+#endif
+
+namespace MED{
+
+  enum EVersion {eVUnknown = -1, eV2_1, eV2_2};
+  
+  typedef enum {eFAUX, eVRAI} EBooleen ; 
+  typedef double TFloat;
+#if defined(HAVE_F77INT64)
+  typedef long TInt;
+#else
+  typedef int TInt;
+#endif 
+  typedef hid_t TIdt;
+  typedef herr_t TErr;
+
+  typedef enum {eFULL_INTERLACE, eNO_INTERLACE} EModeSwitch;
+
+  typedef enum {eFLOAT64=6, eINT=26} ETypeChamp;
+
+  typedef enum {eNON_STRUCTURE, eSTRUCTURE} EMaillage;
+
+  typedef enum {eCART, eCYL, eSPHER} ERepere; 
+
+  typedef enum {eNOD, eDESC} EConnectivite ; 
+
+  typedef enum {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
+                eQUAD4=204, eTRIA6=206, eTRIA7=207, eQUAD8=208, eQUAD9=209,eTETRA4=304,
+                ePYRA5=305, ePENTA6=306, eHEXA8=308, eOCTA12=312, eTETRA10=310, 
+                ePYRA13=313, ePENTA15=315, eHEXA20=320, eHEXA27=327,
+                ePOLYGONE=400, ePOLYEDRE=500, eNONE=0, 
+                eBALL=1101 /*no such a type in med.h, it's just a trick*/,
+                eAllGeoType=-1 } EGeometrieElement;
+
+  typedef enum {eMAILLE, eFACE, eARETE, eNOEUD, eNOEUD_ELEMENT, eSTRUCT_ELEMENT} EEntiteMaillage; 
+
+  typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT}  EModeProfil; 
+
+  typedef enum {eGRILLE_CARTESIENNE, eGRILLE_POLAIRE, eGRILLE_STANDARD} EGrilleType;
+
+  typedef enum {eCOOR, eCONN, eNOM, eNUM, eFAM, eCOOR_IND1, eCOOR_IND2, eCOOR_IND3} ETable;
+
+  typedef TVector<TFloat> TFloatVector;
+  typedef TVector<std::string> TStringVector;
+  typedef TVector<TInt> TIntVector;
+  typedef std::set<std::string> TStringSet;
+  
+  typedef std::map<EGeometrieElement,TInt> TGeom2Size;
+  typedef std::map<EEntiteMaillage,TGeom2Size> TEntityInfo;
+
+  typedef std::set<EGeometrieElement> TGeomSet;
+  typedef std::map<EEntiteMaillage,TGeomSet> TEntity2GeomSet;
+
+  MEDWRAPPER_EXPORT 
+  const TEntity2GeomSet& 
+  GetEntity2GeomSet();
+
+  template<EVersion>
+  TInt MEDWRAPPER_EXPORT
+  GetDESCLength();
+  
+  template<EVersion>
+  TInt MEDWRAPPER_EXPORT
+  GetIDENTLength();
+  
+  template<EVersion>
+  TInt MEDWRAPPER_EXPORT
+  GetNOMLength();
+  
+  template<EVersion>
+  TInt MEDWRAPPER_EXPORT
+  GetLNOMLength();
+  
+  template<EVersion>
+  TInt MEDWRAPPER_EXPORT
+  GetPNOMLength();
+  
+  template<EVersion>
+  void MEDWRAPPER_EXPORT
+  GetVersionRelease(TInt& majeur, TInt& mineur, TInt& release);
+  
+  template<EVersion>
+  MEDWRAPPER_EXPORT
+  TInt
+  GetNbConn(EGeometrieElement typmai,
+            EEntiteMaillage typent,
+            TInt mdim);
+  
+  MEDWRAPPER_EXPORT
+  TInt 
+  GetNbNodes(EGeometrieElement typmai);
+
+  struct TNameInfo;
+  typedef SharedPtr<TNameInfo> PNameInfo;
+  
+  struct TMeshInfo;
+  typedef SharedPtr<TMeshInfo> PMeshInfo;
+  
+  struct TFamilyInfo;
+  typedef SharedPtr<TFamilyInfo> PFamilyInfo;
+
+  struct TElemInfo;
+  typedef SharedPtr<TElemInfo> PElemInfo;
+
+  struct TNodeInfo;
+  typedef SharedPtr<TNodeInfo> PNodeInfo;
+
+  struct TPolygoneInfo;
+  typedef SharedPtr<TPolygoneInfo> PPolygoneInfo;
+
+  struct TPolyedreInfo;
+  typedef SharedPtr<TPolyedreInfo> PPolyedreInfo;
+
+  struct TCellInfo;
+  typedef SharedPtr<TCellInfo> PCellInfo;
+
+  struct TBallInfo;
+  typedef SharedPtr<TBallInfo> PBallInfo;
+
+  struct TFieldInfo;
+  typedef SharedPtr<TFieldInfo> PFieldInfo;
+
+  struct TTimeStampInfo;
+  typedef SharedPtr<TTimeStampInfo> PTimeStampInfo;
+
+  struct TProfileInfo;
+  typedef SharedPtr<TProfileInfo> PProfileInfo;
+  
+  struct TGaussInfo;
+  typedef SharedPtr<TGaussInfo> PGaussInfo;
+  
+  class TGrilleInfo;
+  typedef SharedPtr<TGrilleInfo> PGrilleInfo;
+
+  struct TTimeStampValueBase;
+  typedef SharedPtr<TTimeStampValueBase> PTimeStampValueBase;
+
+  struct TWrapper;
+  typedef SharedPtr<TWrapper> PWrapper;
+}
+
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_CoordUtils.cxx b/src/MEDWrapper/Base/MED_CoordUtils.cxx
new file mode 100644 (file)
index 0000000..21f9162
--- /dev/null
@@ -0,0 +1,160 @@
+// Copyright (C) 2007-2013  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 "MED_CoordUtils.hxx"
+#include "MED_Utilities.hxx"
+namespace MED
+{
+
+  enum ECoordName{eX, eY, eZ, eNone};
+
+  template<ECoordName TCoordId>
+  TFloat 
+  GetCoord(const TCCoordSlice& theCoordSlice)
+  {
+    return theCoordSlice[TCoordId];
+  }
+
+  template<>
+  TFloat 
+  GetCoord<eNone>(const TCCoordSlice& theCoordSlice)
+  {
+    return 0.0;
+  }
+  
+  TGetCoord
+  aXYZGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eY>, 
+    &GetCoord<eZ>
+  };
+  
+  TGetCoord
+  aXYGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eY>, 
+    &GetCoord<eNone>
+  };
+  
+  TGetCoord
+  aYZGetCoord[3] = {
+    &GetCoord<eNone>,
+    &GetCoord<eX>, 
+    &GetCoord<eY>
+  };
+  
+  TGetCoord 
+  aXZGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eNone>,
+    &GetCoord<eY>
+  };
+  
+  
+  TGetCoord 
+  aXGetCoord[3] = {
+    &GetCoord<eX>, 
+    &GetCoord<eNone>,
+    &GetCoord<eNone>
+  };
+  
+  TGetCoord
+  aYGetCoord[3] = {
+    &GetCoord<eNone>,
+    &GetCoord<eX>, 
+    &GetCoord<eNone>
+  };
+
+  TGetCoord
+  aZGetCoord[3] = {
+    &GetCoord<eNone>,
+    &GetCoord<eNone>,
+    &GetCoord<eX>
+  };
+
+  
+  //---------------------------------------------------------------
+  TCoordHelper
+  ::TCoordHelper(TGetCoord* theGetCoord):
+    myGetCoord(theGetCoord)
+  {}
+
+  TFloat 
+  TCoordHelper
+  ::GetCoord(TCCoordSlice& theCoordSlice, 
+             TInt theCoordId)
+  {
+    return (*myGetCoord[theCoordId])(theCoordSlice);
+  }
+
+
+  //---------------------------------------------------------------
+  PCoordHelper
+  GetCoordHelper(PNodeInfo theNodeInfo)
+  {
+    PCoordHelper aCoordHelper;
+    {
+      PMeshInfo aMeshInfo = theNodeInfo->GetMeshInfo();
+      TInt aMeshDimension = aMeshInfo->GetDim();
+      bool anIsDimPresent[3] = {false, false, false};
+      for(int iDim = 0; iDim < aMeshDimension; iDim++){
+        // PAL16857(SMESH not conform to the MED convention) ->
+        // 1D - always along X
+        // 2D - always in XOY plane
+        anIsDimPresent[iDim] = iDim < aMeshDimension;
+//      std::string aName = theNodeInfo->GetCoordName(iDim);
+//         if ( aName.size() > 1 ) // PAL12148, aName has size 8 or 16
+//           aName = aName.substr(0,1);
+//      if(aName == "x" || aName == "X")
+//        anIsDimPresent[eX] = true;
+//      else if(aName == "y" || aName == "Y")
+//        anIsDimPresent[eY] = true;
+//      else if(aName == "z" || aName == "Z")
+//        anIsDimPresent[eZ] = true;
+      }
+
+      switch(aMeshDimension){
+      case 3:
+        aCoordHelper.reset(new TCoordHelper(aXYZGetCoord));
+        break;
+      case 2:
+        if(anIsDimPresent[eY] && anIsDimPresent[eZ])
+          aCoordHelper.reset(new TCoordHelper(aYZGetCoord));
+        else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
+          aCoordHelper.reset(new TCoordHelper(aXZGetCoord));
+        else
+          aCoordHelper.reset(new TCoordHelper(aXYGetCoord));
+        break;
+      case 1:
+        if(anIsDimPresent[eY])
+          aCoordHelper.reset(new TCoordHelper(aYGetCoord));
+        else if(anIsDimPresent[eZ])
+          aCoordHelper.reset(new TCoordHelper(aZGetCoord));
+        else
+          aCoordHelper.reset(new TCoordHelper(aXGetCoord));
+        break;
+      }
+    }
+    return aCoordHelper;
+  }
+}
diff --git a/src/MEDWrapper/Base/MED_CoordUtils.hxx b/src/MEDWrapper/Base/MED_CoordUtils.hxx
new file mode 100644 (file)
index 0000000..17b09d7
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_CoordUtils_HeaderFile
+#define MED_CoordUtils_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+
+#include "MED_Structures.hxx"
+
+namespace MED
+{
+  typedef TFloat (*TGetCoord)(const TCCoordSlice& theCoordSlice);
+
+
+  //---------------------------------------------------------------
+  class MEDWRAPPER_EXPORT TCoordHelper
+  {
+    TGetCoord* myGetCoord;
+    
+  public:
+    TCoordHelper(TGetCoord* theGetCoord);
+
+    TFloat 
+    GetCoord(TCCoordSlice& theCoordSlice, 
+             TInt theCoordId);
+  };
+  typedef SharedPtr<TCoordHelper> PCoordHelper;
+
+
+  //---------------------------------------------------------------
+  MEDWRAPPER_EXPORT 
+  PCoordHelper
+  GetCoordHelper(PNodeInfo theNodeInfo);
+
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_GaussDef.cxx b/src/MEDWrapper/Base/MED_GaussDef.cxx
new file mode 100644 (file)
index 0000000..f89042e
--- /dev/null
@@ -0,0 +1,570 @@
+// Copyright (C) 2007-2013  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   : MED_GaussDef.hxx
+// Author : Edward AGAPOV (eap)
+//
+#include "MED_GaussDef.hxx"
+#include "MED_Utilities.hxx"
+#include "MED_GaussUtils.hxx"
+
+namespace MED
+{
+  using namespace std;
+  using namespace MED;
+  //---------------------------------------------------------------
+
+  void TGaussDef::add(const double x, const double weight)
+  {
+    if ( dim() != 1 )
+      EXCEPTION( logic_error,"dim() != 1");
+    if ( myWeights.capacity() == myWeights.size() )
+      EXCEPTION( logic_error,"Extra gauss point");
+    myCoords.push_back( x );
+    myWeights.push_back( weight );
+  }
+  void TGaussDef::add(const double x, const double y, const double weight)
+  {
+    if ( dim() != 2 )
+      EXCEPTION( logic_error,"dim() != 2");
+    if ( myWeights.capacity() == myWeights.size() )
+      EXCEPTION( logic_error,"Extra gauss point");
+    myCoords.push_back( x );
+    myCoords.push_back( y );
+    myWeights.push_back( weight );
+  }
+  void TGaussDef::add(const double x, const double y, const double z, const double weight)
+  {
+    if ( dim() != 3 )
+      EXCEPTION( logic_error,"dim() != 3");
+    if ( myWeights.capacity() == myWeights.size() )
+      EXCEPTION( logic_error,"Extra gauss point");
+    myCoords.push_back( x );
+    myCoords.push_back( y );
+    myCoords.push_back( z );
+    myWeights.push_back( weight );
+  }
+  void TGaussDef::setRefCoords(const TShapeFun& aShapeFun)
+  {
+    myRefCoords.reserve( aShapeFun.myRefCoord.size() );
+    myRefCoords.assign( aShapeFun.myRefCoord.begin(),
+                        aShapeFun.myRefCoord.end() );
+  }
+
+
+  //---------------------------------------------------------------
+  /*!
+   * \brief Fill definition of gauss points family
+   */
+  //---------------------------------------------------------------
+
+  TGaussDef::TGaussDef(const int geom, const int nbGauss, const int variant)
+  {
+    myType = geom;
+    myCoords .reserve( nbGauss * dim() );
+    myWeights.reserve( nbGauss );
+
+    switch ( geom ) {
+
+    case eSEG2:
+    case eSEG3:
+      if (geom == eSEG2) setRefCoords( TSeg2a() );
+      else               setRefCoords( TSeg3a() );
+      switch ( nbGauss ) {
+      case 1: {
+        add( 0.0, 2.0 ); break;
+      }
+      case 2: {
+        const double a = 0.577350269189626;
+        add(  a,  1.0 );
+        add( -a,  1.0 ); break;
+      }
+      case 3: {
+        const double a = 0.774596669241;
+        const double P1 = 1./1.8;
+        const double P2 = 1./1.125;
+        add( -a,  P1 );
+        add(  0,  P2 ); 
+        add(  a,  P1 ); break;
+      }
+      case 4: {
+        const double a  = 0.339981043584856, b  = 0.861136311594053;
+        const double P1 = 0.652145154862546, P2 = 0.347854845137454 ;
+        add(  a,  P1 );
+        add( -a,  P1 );
+        add(  b,  P2 ); 
+        add( -b,  P2 ); break;
+      }
+      default:
+        EXCEPTION( logic_error,"Invalid nb of gauss points for SEG"<<nbGauss);
+      }
+      break;
+
+    case eTRIA3:
+    case eTRIA6:
+      if ( variant == 1 ) {
+        if (geom == eTRIA3) setRefCoords( TTria3b() );
+        else                setRefCoords( TTria6b() );
+        switch ( nbGauss ) {
+        case 1: { // FPG1
+          add( 1/3., 1/3., 1/2. ); break;
+        }
+        case 3: { // FPG3
+          // what about COT3 ???
+          add( 1/6., 1/6., 1/6. );
+          add( 2/3., 1/6., 1/6. );
+          add( 1/6., 2/3., 1/6. ); break;
+        }
+        case 4: { // FPG4
+          add( 1/5., 1/5.,  25/(24*4.) );
+          add( 3/5., 1/5.,  25/(24*4.) );
+          add( 1/5., 3/5.,  25/(24*4.) );
+          add( 1/3., 1/3., -27/(24*4.) ); break;
+        }
+        case 6: { // FPG6
+          const double P1 = 0.11169079483905, P2 = 0.0549758718227661;
+          const double a  = 0.445948490915965, b = 0.091576213509771;
+          add(     b,     b, P2 ); 
+          add( 1-2*b,     b, P2 );
+          add(     b, 1-2*b, P2 );
+          add(     a, 1-2*a, P1 );
+          add(     a,     a, P1 ); 
+          add( 1-2*a,     a, P1 ); break;
+        }
+        case 7: { // FPG7
+          const double A  = 0.470142064105115;
+          const double B  = 0.101286507323456;
+          const double P1 = 0.066197076394253;
+          const double P2 = 0.062969590272413;
+          add(  1/3.,  1/3., 9/80. ); 
+          add(     A,     A, P1 ); 
+          add( 1-2*A,     A, P1 );
+          add(     A, 1-2*A, P1 );
+          add(     B,     B, P2 ); 
+          add( 1-2*B,     B, P2 );
+          add(     B, 1-2*B, P2 ); break;
+        }
+        case 12: { // FPG12
+          const double A  = 0.063089014491502;
+          const double B  = 0.249286745170910;
+          const double C  = 0.310352451033785;
+          const double D  = 0.053145049844816;
+          const double P1 = 0.025422453185103;
+          const double P2 = 0.058393137863189;
+          const double P3 = 0.041425537809187;
+          add(     A,     A, P1 ); 
+          add( 1-2*A,     A, P1 );
+          add(     A, 1-2*A, P1 );
+          add(     B,     B, P2 ); 
+          add( 1-2*B,     B, P2 );
+          add(     B, 1-2*B, P2 );
+          add(     C,     D, P3 );
+          add(     D,     C, P3 );
+          add( 1-C-D,     C, P3 );
+          add( 1-C-D,     D, P3 );
+          add(     C, 1-C-D, P3 );
+          add(     D, 1-C-D, P3 ); break;
+        }
+        default:
+          EXCEPTION( logic_error,"Invalid nb of gauss points for TRIA, variant 1: "
+                     <<nbGauss);
+        }
+      }
+      else if ( variant == 2 ) {
+        if (geom == eTRIA3) setRefCoords( TTria3a() );
+        else                setRefCoords( TTria6a() );
+        switch ( nbGauss ) {
+        case 1: {
+          add( -1/3., -1/3., 2. ); break;
+        }
+        case 3: {
+          add( -2/3.,  1/3., 2/3. );
+          add( -2/3., -2/3., 2/3. );
+          add(  1/3., -2/3., 2/3. ); break;
+        }
+        case 6: {
+          const double P1 = 0.11169079483905, P2 = 0.0549758718227661;
+          const double A  = 0.445948490915965, B = 0.091576213509771;
+          add( 2*B-1, 1-4*B, 4*P2 ); 
+          add( 2*B-1, 2*B-1, 4*P2 );
+          add( 1-4*B, 2*B-1, 4*P2 );
+          add( 1-4*A, 2*A-1, 4*P1 );
+          add( 2*A-1, 1-4*A, 4*P1 ); 
+          add( 2*A-1, 2*A-1, 4*P1 ); break;
+        }
+        default:
+          EXCEPTION( logic_error,"Invalid nb of gauss points for TRIA, variant 2: "
+                     <<nbGauss);
+        }
+      }
+      else if ( variant == 3 ) {
+        if (geom == eTRIA3) setRefCoords( TTria3b() );
+        else                setRefCoords( TTria6b() );
+        switch ( nbGauss ) {
+        case 4: {
+          add( 1/3., 1/3., -27/96 );
+          add( 0.2 , 0.2 ,  25/96 );
+          add( 0.6 , 0.2 ,  25/96 );
+          add( 0.2 , 0.6 ,  25/96 ); break;
+        }
+        default:
+          EXCEPTION( logic_error,"Invalid nb of gauss points for TRIA, variant 3: "
+                     <<nbGauss);
+        }
+      }
+      break;
+
+    case eQUAD4:
+    case eQUAD8:
+      if ( variant == 1 ) {
+        if (geom == eQUAD4) setRefCoords( TQuad4b() );
+        else                setRefCoords( TQuad8b() );
+        switch ( nbGauss ) {
+        case 1: { // FPG1
+          add(  0,  0,  4 ); break;
+        }
+        case 4: { // FPG4
+          const double a = 1/sqrt(3.);
+          add( -a, -a,  1 );
+          add(  a, -a,  1 );
+          add(  a,  a,  1 );
+          add( -a,  a,  1 ); break;
+        }
+        case 9: { // FPG9
+          const double a = 0.774596669241483;
+          add( -a, -a,  25/81. );
+          add(  a, -a,  25/81. );
+          add(  a,  a,  25/81. );
+          add( -a,  a,  25/81. );
+          add( 0., -a,  40/81. );
+          add(  a, 0.,  40/81. );
+          add( 0.,  a,  40/81. );
+          add( -a, 0.,  40/81. );
+          add( 0., 0.,  64/81. ); break;
+        }
+        default:
+          EXCEPTION( logic_error,"Invalid nb of gauss points for QUAD, variant 1: "
+                     <<nbGauss);
+        }
+      }
+      else if ( variant == 2 ) {
+        if (geom == eQUAD4) setRefCoords( TQuad4a() );
+        else                setRefCoords( TQuad8a() );
+        switch ( nbGauss ) {
+        case 4: {
+          const double a = 1/sqrt(3.);
+          add( -a,  a,  1 );
+          add( -a, -a,  1 );
+          add(  a, -a,  1 );
+          add(  a,  a,  1 ); break;
+        }
+        case 9: {
+          const double a = 0.774596669241483;
+          add( -a,  a,  25/81. );
+          add( -a, -a,  25/81. );
+          add(  a, -a,  25/81. );
+          add(  a,  a,  25/81. );
+          add( -a, 0.,  40/81. );
+          add( 0., -a,  40/81. );
+          add(  a, 0.,  40/81. );
+          add( 0.,  a,  40/81. );
+          add( 0., 0.,  64/81. ); break;
+        }
+        default:
+          EXCEPTION( logic_error,"Invalid nb of gauss points for QUAD, variant 1: "
+                     <<nbGauss);
+        }
+      }
+      else if ( variant == 3 ) {
+        if (geom == eQUAD4) setRefCoords( TQuad4b() );
+        else                setRefCoords( TQuad8b() );
+        switch ( nbGauss ) {
+        case 4: {
+          const double a = 3/sqrt(3.);
+          add( -a, -a,  1 );
+          add( -a,  a,  1 );
+          add(  a, -a,  1 );
+          add(  a,  a,  1 ); break;
+        }
+        case 9: {
+          const double a = sqrt(3/5.), c1 = 5/9., c2 = 8/9.;
+          const double c12 = c1*c2, c22 = c2*c2, c1c2 = c1*c2;
+          add( -a, -a,  c12  );
+          add( -a, 0.,  c1c2 );
+          add( -a,  a,  c12  );
+          add( 0., -a,  c1c2 );
+          add( 0., 0.,  c22  );
+          add( 0.,  a,  c1c2 );
+          add(  a, -a,  c12  );
+          add(  a, 0.,  c1c2 );
+          add(  a,  a,  c12  ); break;
+        }
+        default:
+          EXCEPTION( logic_error,"Invalid nb of gauss points for QUAD, variant 3: "
+                     <<nbGauss);
+        }
+      }
+      break;
+
+    case eTETRA4:
+    case eTETRA10:
+      if (geom == eTETRA4) setRefCoords( TTetra4a() );
+      else                 setRefCoords( TTetra10a() );
+      switch ( nbGauss ) {
+      case 4: { // FPG4
+        const double a = (5 - sqrt(5.))/20., b = (5 + 3*sqrt(5.))/20.;
+        add(  a,  a,  a,  1/24. );
+        add(  a,  a,  b,  1/24. );
+        add(  a,  b,  a,  1/24. );
+        add(  b,  a,  a,  1/24. ); break;
+      }
+      case 5: { // FPG5
+        const double a = 0.25, b = 1/6., c = 0.5;
+        add(  a,  a,  a, -2/15. );
+        add(  b,  b,  b,  3/40. );
+        add(  b,  b,  c,  3/40. );
+        add(  b,  c,  b,  3/40. );
+        add(  c,  b,  b,  3/40. ); break;
+      }
+      case 15: { // FPG15
+        const double a = 0.25;
+        const double b1 = (7 + sqrt(15.))/34., c1 = (13 + 3*sqrt(15.))/34., d = (5 - sqrt(15.))/20.;
+        const double b2 = (7 - sqrt(15.))/34., c2 = (13 - 3*sqrt(15.))/34., e = (5 + sqrt(15.))/20.;
+        const double P1 = (2665 - 14*sqrt(15.))/226800.;
+        const double P2 = (2665 + 14*sqrt(15.))/226800.;
+        add(  a,  a,  a,  8/405.);//_____
+        add( b1, b1, b1,  P1    );
+        add( b1, b1, c1,  P1    );
+        add( b1, c1, b1,  P1    );
+        add( c1, b1, b1,  P1    );//_____
+        add( b2, b2, b2,  P2    );
+        add( b2, b2, c2,  P2    );
+        add( b2, c2, b2,  P2    );
+        add( c2, b2, b2,  P2    );//_____
+        add(  d,  d,  e,  5/567.);
+        add(  d,  e,  d,  5/567.);
+        add(  e,  d,  d,  5/567.);
+        add(  d,  e,  e,  5/567.);
+        add(  e,  d,  e,  5/567.);
+        add(  e,  e,  d,  5/567.);
+        break;
+      }
+      default:
+        EXCEPTION( logic_error,"Invalid nb of gauss points for TETRA: "<<nbGauss);
+      }
+      break;
+
+    case ePYRA5:
+    case ePYRA13:
+      if (geom == ePYRA5) setRefCoords( TPyra5a() );
+      else                setRefCoords( TPyra13a() );
+      switch ( nbGauss ) {
+      case 5: { // FPG5
+        const double h1 = 0.1531754163448146;
+        const double h2 = 0.6372983346207416;
+        add(  .5,  0.,  h1,  2/15. );
+        add(  0.,  .5,  h1,  2/15. );
+        add( -.5,  0.,  h1,  2/15. );
+        add(  0., -.5,  h1,  2/15. );
+        add(  0.,  0.,  h2,  2/15. ); break;
+      }
+      case 6: { // FPG6
+        const double p1 = 0.1024890634400000 ;
+        const double p2 = 0.1100000000000000 ;
+        const double p3 = 0.1467104129066667 ;
+        const double a  = 0.5702963741068025 ;
+        const double h1 = 0.1666666666666666 ;
+        const double h2 = 0.08063183038464675;
+        const double h3 = 0.6098484849057127 ;
+        add(  a, 0.,  h1,  p1 );
+        add( 0.,  a,  h1,  p1 );
+        add( -a, 0.,  h1,  p1 );
+        add( 0., -a,  h1,  p1 );
+        add( 0., 0.,  h2,  p2 );
+        add( 0., 0.,  h3,  p3 ); break;
+      }
+      case 27: { // FPG27
+        const double a1  = 0.788073483; 
+        const double b6  = 0.499369002; 
+        const double b1  = 0.848418011; 
+        const double c8  = 0.478508449; 
+        const double c1  = 0.652816472; 
+        const double d12 = 0.032303742; 
+        const double d1  = 1.106412899;
+        double z = 1/2., fz = b1/2*(1 - z);
+        add(  0.,  0.,   z,  a1 ); // 1
+        add(  fz,  fz,   z,  b6 ); // 2
+        add( -fz,  fz,   z,  b6 ); // 3
+        add( -fz, -fz,   z,  b6 ); // 4
+        add(  fz, -fz,   z,  b6 ); // 5
+        z = (1 - b1)/2.;
+        add(  0.,  0.,   z,  b6 ); // 6
+        z = (1 + b1)/2.;
+        add(  0.,  0.,   z,  b6 ); // 7
+        z = (1 - c1)/2.; fz = c1*(1 - z);
+        add(  fz,  0.,   z,  c8 ); // 8
+        add(  0.,  fz,   z,  c8 ); // 9
+        add( -fz,  0.,   z,  c8 ); // 10
+        add(  0., -fz,   z,  c8 ); // 11
+        z = (1 + c1)/2.; fz = c1*(1 - z);
+        add(  fz,  0.,   z,  c8 ); // 12
+        add(  0.,  fz,   z,  c8 ); // 13
+        add( -fz,  0.,   z,  c8 ); // 14
+        add(  0., -fz,   z,  c8 ); // 15
+        z = (1 - d1)/2., fz = d1/2*(1 - z);
+        add(  fz,  fz,   z,  d12); // 16
+        add( -fz,  fz,   z,  d12); // 17
+        add( -fz, -fz,   z,  d12); // 18
+        add(  fz, -fz,   z,  d12); // 19
+        z = 1/2.; fz = d1*(1 - z);
+        add(  fz,  0.,   z,  d12); // 20
+        add(  0.,  fz,   z,  d12); // 21
+        add( -fz,  0.,   z,  d12); // 22
+        add(  0., -fz,   z,  d12); // 23
+        z = (1 + d1)/2., fz = d1/2*(1 - z);
+        add(  fz,  fz,   z,  d12); // 24
+        add( -fz,  fz,   z,  d12); // 25
+        add( -fz, -fz,   z,  d12); // 26
+        add(  fz, -fz,   z,  d12); // 27
+        break;
+      }
+      default:
+        EXCEPTION( logic_error,"Invalid nb of gauss points for PYRA: "<<nbGauss);
+      }
+      break;
+    case ePENTA6:
+    case ePENTA15:
+      if (geom == ePENTA6) setRefCoords( TPenta6a() );
+      else                 setRefCoords( TPenta15a() );
+      switch ( nbGauss ) {
+      case 6: { // FPG6
+        const double a = sqrt(3.)/3.;
+        add( -a, .5, .5,  1/6. );
+        add( -a, 0., .5,  1/6. );
+        add( -a, .5, 0.,  1/6. );
+        add(  a, .5, .5,  1/6. );
+        add(  a, 0., .5,  1/6. );
+        add(  a, .5, 0.,  1/6. ); break;
+      }
+      case 8: { // FPG8
+        const double a = 0.577350269189626;
+        add( -a, 1/3., 1/3., -27/96. );
+        add( -a,  0.6,  0.2,  25/96. );
+        add( -a,  0.2,  0.6,  25/96. );
+        add( -a,  0.2,  0.2,  25/96. );
+        add( +a, 1/3., 1/3., -27/96. );
+        add( +a,  0.6,  0.2,  25/96. );
+        add( +a,  0.2,  0.6,  25/96. );
+        add( +a,  0.2,  0.2,  25/96. ); break;
+      }
+      case 21: { // FPG21
+        const double d = sqrt(3/5.), c1 = 5/9., c2 = 8/9.; // d <=> alfa
+        const double a = (6 + sqrt(15.))/21.;
+        const double b = (6 - sqrt(15.))/21.;
+        const double P1 = (155 + sqrt(15.))/2400.;
+        const double P2 = (155 - sqrt(15.))/2400.;  //___
+        add( -d,  1/3.,  1/3., c1*9/80. );//___
+        add( -d,     a,     a, c1*P1    );
+        add( -d, 1-2*a,     a, c1*P1    );
+        add( -d,     a, 1-2*a, c1*P1    );//___
+        add( -d,     b,     b, c1*P2    );
+        add( -d, 1-2*b,     b, c1*P2    );
+        add( -d,     b, 1-2*b, c1*P2    );//___
+        add( 0.,  1/3.,  1/3., c2*9/80. );//___
+        add( 0.,     a,     a, c2*P1    );
+        add( 0., 1-2*a,     a, c2*P1    );
+        add( 0.,     a, 1-2*a, c2*P1    );//___
+        add( 0.,     b,     b, c2*P2    );
+        add( 0., 1-2*b,     b, c2*P2    );
+        add( 0.,     b, 1-2*b, c2*P2    );//___
+        add(  d,  1/3.,  1/3., c1*9/80. );//___
+        add(  d,     a,     a, c1*P1    );
+        add(  d, 1-2*a,     a, c1*P1    );
+        add(  d,     a, 1-2*a, c1*P1    );//___
+        add(  d,     b,     b, c1*P2    );
+        add(  d, 1-2*b,     b, c1*P2    );
+        add(  d,     b, 1-2*b, c1*P2    );//___
+        break;
+      }
+      default:
+        EXCEPTION( logic_error,"Invalid nb of gauss points for PENTA: " <<nbGauss);
+      }
+      break;
+
+    case eHEXA8:
+    case eHEXA20:
+      if (geom == eHEXA8) setRefCoords( THexa8a() );
+      else                setRefCoords( THexa20a() );
+      switch ( nbGauss ) {
+      case 8: { // FPG8
+        const double a = sqrt(3.)/3.;
+        add( -a, -a, -a,  1. );
+        add( -a, -a,  a,  1. );
+        add( -a,  a, -a,  1. );
+        add( -a,  a,  a,  1. );
+        add(  a, -a, -a,  1. );
+        add(  a, -a,  a,  1. );
+        add(  a,  a, -a,  1. );
+        add(  a,  a,  a,  1. ); break;
+      }
+      case 27: { // FPG27
+        const double a = sqrt(3/5.), c1 = 5/9., c2 = 8/9.;
+        const double c12 = c1*c1, c13 = c1*c1*c1;
+        const double c22 = c2*c2, c23 = c2*c2*c2;
+        add( -a, -a, -a,   c13  ); // 1
+        add( -a, -a, 0., c12*c2 ); // 2
+        add( -a, -a,  a,   c13  ); // 3
+        add( -a, 0., -a, c12*c2 ); // 4
+        add( -a, 0., 0., c1*c22 ); // 5
+        add( -a, 0.,  a, c12*c2 ); // 6
+        add( -a,  a, -a,   c13  ); // 7
+        add( -a,  a, 0., c12*c2 ); // 8
+        add( -a,  a,  a,   c13  ); // 9
+        add( 0., -a, -a, c12*c2 ); // 10
+        add( 0., -a, 0., c1*c22 ); // 11
+        add( 0., -a,  a, c12*c2 ); // 12
+        add( 0., 0., -a, c1*c22 ); // 13
+        add( 0., 0., 0.,   c23  ); // 14
+        add( 0., 0.,  a, c1*c22 ); // 15
+        add( 0.,  a, -a, c12*c2 ); // 16
+        add( 0.,  a, 0., c1*c22 ); // 17
+        add( 0.,  a,  a, c12*c2 ); // 18
+        add(  a, -a, -a,   c13  ); // 19
+        add(  a, -a, 0., c12*c2 ); // 20
+        add(  a, -a,  a,   c13  ); // 21
+        add(  a, 0., -a, c12*c2 ); // 22
+        add(  a, 0., 0., c1*c22 ); // 23
+        add(  a, 0.,  a, c12*c2 ); // 24
+        add(  a,  a, -a,   c13  ); // 25
+        add(  a,  a, 0., c12*c2 ); // 26
+        add(  a,  a,  a,   c13  ); // 27
+        break;
+      }
+      default:
+        EXCEPTION( logic_error,"Invalid nb of gauss points for PENTA: " <<nbGauss);
+      }
+      break;
+
+    default:
+      EXCEPTION( logic_error,"unexpected EGeometrieElement: "<< geom);
+    }
+
+    if ( myWeights.capacity() != myWeights.size() )
+      EXCEPTION( logic_error,"Not all gauss points defined");
+  }
+}
diff --git a/src/MEDWrapper/Base/MED_GaussDef.hxx b/src/MEDWrapper/Base/MED_GaussDef.hxx
new file mode 100644 (file)
index 0000000..ae12c9a
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (C) 2007-2013  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   : MED_GaussDef.hxx
+// Author : Edward AGAPOV (eap)
+//
+#ifndef MED_GaussDef_HeaderFile
+#define MED_GaussDef_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+
+//#include "MED_GaussUtils.hxx" <<<---- avoid dependence on boost
+#include <vector>
+
+namespace MED
+{
+  class TShapeFun;
+  typedef std::vector<double> TDoubleVector;
+  /*!
+   * \brief Description of family of integration points
+   */
+  struct TGaussDef
+  {
+    int           myType;      //!< element geometry (EGeometrieElement or med_geometrie_element)
+    TDoubleVector myRefCoords; //!< description of reference points
+    TDoubleVector myCoords;    //!< coordinates of Gauss points
+    TDoubleVector myWeights;   //!< weights, len(weights)==<nb of gauss points>
+
+    /*!
+     * \brief Creates definition of gauss points family
+     *  \param geomType - element geometry (EGeometrieElement or med_geometrie_element)
+     *  \param nbPoints - nb gauss point
+     *  \param variant - [1-3] to choose the variant of definition
+     * 
+     * Throws in case of invalid parameters
+     * variant == 1 refers to "Fonctions de forme et points d'integration 
+     *              des elements finis" v7.4 by J. PELLET, X. DESROCHES, 15/09/05
+     * variant == 2 refers to the same doc v6.4 by J.P. LEFEBVRE, X. DESROCHES, 03/07/03
+     * variant == 3 refers to the same doc v6.4, second variant for 2D elements
+     */
+    MEDWRAPPER_EXPORT TGaussDef(const int geomType, const int nbPoints, const int variant=1);
+
+    MEDWRAPPER_EXPORT int dim() const { return myType/100; }
+    MEDWRAPPER_EXPORT int nbPoints() const { return myWeights.capacity(); }
+
+  private:
+    void add(const double x, const double weight);
+    void add(const double x, const double y, const double weight);
+    void add(const double x, const double y, const double z, const double weight);
+    void setRefCoords(const TShapeFun& aShapeFun);
+  };
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_GaussUtils.cxx b/src/MEDWrapper/Base/MED_GaussUtils.cxx
new file mode 100644 (file)
index 0000000..9ae82df
--- /dev/null
@@ -0,0 +1,2173 @@
+// Copyright (C) 2007-2013  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 "MED_GaussUtils.hxx"
+#include "MED_Utilities.hxx"
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+#else
+// static int MYDEBUG = 0;
+// static int MYVALUEDEBUG = 0;
+#endif
+
+//#define _DEBUG_REF_COORDS_
+
+namespace MED
+{
+  //---------------------------------------------------------------
+  TGaussCoord
+  ::TGaussCoord():
+    TModeSwitchInfo(eFULL_INTERLACE),
+    myNbElem(0),
+    myNbGauss(0),
+    myDim(0),
+    myGaussStep(0)
+  {
+  }
+
+  void
+  TGaussCoord
+  ::Init(TInt theNbElem,
+         TInt theNbGauss,
+         TInt theDim,
+         EModeSwitch theMode)
+  {
+    myModeSwitch = theMode;
+
+    myNbElem = theNbElem;
+    myNbGauss = theNbGauss;
+    myDim = theDim;
+
+    myGaussStep = myNbGauss*myDim;
+
+    myGaussCoord.resize(theNbElem*myGaussStep);
+  }
+
+
+  TInt
+  TGaussCoord
+  ::GetNbElem() const
+  { 
+    return myNbElem; 
+  }
+  
+  TInt
+  TGaussCoord
+  ::GetNbGauss() const
+  { 
+    return myNbGauss; 
+  }
+  
+  TInt
+  TGaussCoord
+  ::GetDim() const
+  { 
+    return myDim; 
+  }
+  
+  unsigned char*
+  TGaussCoord
+  ::GetValuePtr()
+  {
+    return (unsigned char*)&(myGaussCoord[0]);
+  }
+
+
+  TCCoordSliceArr 
+  TGaussCoord
+  ::GetCoordSliceArr(TInt theElemId) const
+  {
+    TCCoordSliceArr aCoordSliceArr(myNbGauss);
+    if(GetModeSwitch() == eFULL_INTERLACE){
+      TInt anId = theElemId*myGaussStep;
+      for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+        aCoordSliceArr[anGaussId] =
+          TCCoordSlice(myGaussCoord,std::slice(anId,myDim,1));
+        anId += myDim;
+      }
+    }
+    else{
+      for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+        aCoordSliceArr[anGaussId] =
+          TCCoordSlice(myGaussCoord,std::slice(theElemId,myDim,myGaussStep));
+      }
+    }
+    return aCoordSliceArr;
+  }
+
+
+  TCoordSliceArr 
+  TGaussCoord
+  ::GetCoordSliceArr(TInt theElemId)
+  {
+    TCoordSliceArr aCoordSliceArr(myNbGauss);
+    if(GetModeSwitch() == eFULL_INTERLACE){
+      TInt anId = theElemId*myGaussStep;
+      for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+        aCoordSliceArr[anGaussId] =
+          TCoordSlice(myGaussCoord,std::slice(anId,myDim,1));
+        anId += myDim;
+      }
+    }
+    else{
+      for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+        aCoordSliceArr[anGaussId] =
+          TCoordSlice(myGaussCoord,std::slice(theElemId,myDim,myGaussStep));
+      }
+    }
+    return aCoordSliceArr;
+  }
+
+
+  //---------------------------------------------------------------
+  inline
+  bool 
+  IsEqual(TFloat theLeft, TFloat theRight)
+  {
+    static TFloat EPS = 1.0E-3;
+    if(fabs(theLeft) + fabs(theRight) > EPS)
+      return fabs(theLeft-theRight)/(fabs(theLeft)+fabs(theRight)) < EPS;
+    return true;
+  }
+
+
+  //---------------------------------------------------------------
+  class TShapeFun::TFun
+  {
+    TFloatVector myFun;
+    TInt myNbRef;
+
+  public:
+
+    void
+    Init(TInt theNbGauss,
+         TInt theNbRef)
+    {
+      myFun.resize(theNbGauss*theNbRef);
+      myNbRef = theNbRef;
+    }
+
+    TCFloatVecSlice 
+    GetFunSlice(TInt theGaussId) const
+    {
+      return TCFloatVecSlice(myFun,std::slice(theGaussId*myNbRef,myNbRef,1));
+    }
+
+    TFloatVecSlice
+    GetFunSlice(TInt theGaussId)
+    {
+      return TFloatVecSlice(myFun,std::slice(theGaussId*myNbRef,myNbRef,1));
+    }
+  };
+
+  //---------------------------------------------------------------
+
+  TShapeFun::TShapeFun(TInt theDim, TInt theNbRef):
+    myRefCoord(theNbRef*theDim),
+    myDim(theDim),
+    myNbRef(theNbRef)
+  {}
+
+  TCCoordSlice 
+  TShapeFun::GetCoord(TInt theRefId) const
+  {
+    return TCCoordSlice(myRefCoord,std::slice(theRefId*myDim,myDim,1));
+  }
+
+  TCoordSlice
+  TShapeFun::GetCoord(TInt theRefId)
+  {
+    return TCoordSlice(myRefCoord,std::slice(theRefId*myDim,myDim,1));
+  }
+
+  void 
+  TShapeFun::GetFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    TInt aNbRef = theRef.size();
+    TInt aNbGauss = theGauss.size();
+    theFun.Init(aNbGauss,aNbRef);
+  }
+
+  bool 
+  TShapeFun::IsSatisfy(const TCCoordSliceArr& theRefCoord) const
+  {
+    TInt aNbRef = theRefCoord.size();
+    TInt aNbRef2 = GetNbRef();
+    INITMSG(MYDEBUG,"TShapeFun::IsSatisfy "<<
+            "- aNbRef("<<aNbRef<<")"<<
+            "; aNbRef2("<<aNbRef2<<")\n");
+    bool anIsSatisfy = (aNbRef == aNbRef2);
+    if(anIsSatisfy){
+      for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+        const TCCoordSlice& aCoord2 = theRefCoord[aRefId];
+        TCCoordSlice aCoord = GetCoord(aRefId);
+        TInt aDim = aCoord.size();
+        bool anIsEqual = false;
+        for(TInt anId = 0; anId < aDim; anId++){
+          anIsEqual = IsEqual(aCoord[anId],aCoord2[anId]);
+          if(!anIsEqual){
+            anIsSatisfy = false;
+            break;
+          }
+        }
+        if(!anIsEqual){
+#ifdef _DEBUG_
+          TCCoordSlice aCoord = GetCoord(aRefId);
+          INITMSG(MYDEBUG,aRefId + 1<<": aCoord = {");
+          TInt aDim = aCoord.size();
+          for(TInt anId = 0; anId < aDim; anId++)
+            ADDMSG(MYDEBUG,"\t"<<aCoord[anId]);
+          const TCCoordSlice& aCoord2 = theRefCoord[aRefId];
+          ADDMSG(MYDEBUG,"}\t!=\taCoord2 = {");
+          for(TInt anId = 0; anId < aDim; anId++)
+            ADDMSG(MYDEBUG,"\t"<<aCoord2[anId]);
+          ADDMSG(MYDEBUG,"}\n");
+#endif
+#ifndef _DEBUG_
+          BEGMSG(MYDEBUG,"anIsSatisfy = "<<anIsSatisfy<<"\n");
+          return anIsSatisfy;
+#endif
+        }
+      }
+    }
+
+    BEGMSG(MYDEBUG,"anIsSatisfy = "<<anIsSatisfy<<"\n");
+    return anIsSatisfy;
+  }
+
+  bool
+  TShapeFun::Eval(const TCellInfo&       theCellInfo,
+                  const TNodeInfo&       theNodeInfo,
+                  const TElemNum&        theElemNum,
+                  const TCCoordSliceArr& theRef,
+                  const TCCoordSliceArr& theGauss,
+                  TGaussCoord&           theGaussCoord,
+                  EModeSwitch            theMode)
+  {
+    INITMSG(MYDEBUG,"TShapeFun::Eval"<<std::endl);
+
+    if(IsSatisfy(theRef)){
+      const PMeshInfo& aMeshInfo = theCellInfo.GetMeshInfo();
+      TInt aDim = aMeshInfo->GetDim();
+      TInt aNbGauss = theGauss.size();
+
+      bool anIsSubMesh = !theElemNum.empty();
+      TInt aNbElem;
+      if(anIsSubMesh)
+        aNbElem = theElemNum.size();
+      else
+        aNbElem = theCellInfo.GetNbElem();
+
+      theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+      TFun aFun;
+      InitFun(theRef,theGauss,aFun);
+      TInt aConnDim = theCellInfo.GetConnDim();
+
+      INITMSG(MYDEBUG,"aDim = "<<aDim<<
+              "; aNbGauss = "<<aNbGauss<<
+              "; aNbElem = "<<aNbElem<<
+              "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+              std::endl);
+
+      for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+        TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+        TCConnSlice aConnSlice = theCellInfo.GetConnSlice(aCellId);
+        TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+
+        for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+          TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+          TCFloatVecSlice aFunSlice = aFun.GetFunSlice(aGaussId);
+
+          for(TInt aConnId = 0; aConnId < aConnDim; aConnId++){
+            TInt aNodeId = aConnSlice[aConnId] - 1;      
+            TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+            for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+              aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId]*aFunSlice[aConnId];
+            }
+          }
+        }
+      }
+
+#ifdef _DEBUG_
+      {
+        INITMSG(MYVALUEDEBUG,"theGauss: ");
+        for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+          TCCoordSlice aCoordSlice = theGauss[aGaussId];
+          ADDMSG(MYVALUEDEBUG,"{");
+          for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+            ADDMSG(MYVALUEDEBUG,aCoordSlice[aDimId]<<" ");
+          }
+          ADDMSG(MYVALUEDEBUG,"} ");
+        }
+        ADDMSG(MYVALUEDEBUG,std::endl);
+      }
+      for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+        TCCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+        INITMSG(MYVALUEDEBUG,"");
+        for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+          TCCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
+          ADDMSG(MYVALUEDEBUG,"{");
+          for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+            ADDMSG(MYVALUEDEBUG,aCoordSlice[aDimId]<<" ");
+          }
+          ADDMSG(MYVALUEDEBUG,"} ");
+        }
+        ADDMSG(MYVALUEDEBUG,std::endl);
+      }
+#endif
+      return true;
+    }
+
+    return false;
+  }
+
+
+  //---------------------------------------------------------------
+  TSeg2a::TSeg2a():TShapeFun(1,2)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0; break;
+      case  1: aCoord[0] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TSeg2a::InitFun(const TCCoordSliceArr& theRef,
+                  const TCCoordSliceArr& theGauss,
+                  TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*(1.0 - aCoord[0]);
+      aSlice[1] = 0.5*(1.0 + aCoord[0]);
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  TSeg3a::TSeg3a():TShapeFun(1,3)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0; break;
+      case  1: aCoord[0] =  1.0; break;
+      case  2: aCoord[0] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TSeg3a::InitFun(const TCCoordSliceArr& theRef,
+                  const TCCoordSliceArr& theGauss,
+                  TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*(1.0 - aCoord[0])*aCoord[0];
+      aSlice[1] = 0.5*(1.0 + aCoord[0])*aCoord[0];
+      aSlice[2] = (1.0 + aCoord[0])*(1.0 - aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTria3a::TTria3a():
+    TShapeFun(2,3)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      }
+    }
+  }
+
+  void
+  TTria3a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*(1.0 + aCoord[1]);
+      aSlice[1] = -0.5*(aCoord[0] + aCoord[1]);
+      aSlice[2] = 0.5*(1.0 + aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTria6a::TTria6a():TShapeFun(2,6)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+
+      case  3: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      case  4: aCoord[0] =  0.0;  aCoord[1] = -1.0; break;
+      case  5: aCoord[0] =  0.0;  aCoord[1] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TTria6a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*(1.0 + aCoord[1])*aCoord[1];
+      aSlice[1] = 0.5*(aCoord[0] + aCoord[1])*(aCoord[0] + aCoord[1] + 1);
+      aSlice[2] = 0.5*(1.0 + aCoord[0])*aCoord[0];
+
+      aSlice[3] = -1.0*(1.0 + aCoord[1])*(aCoord[0] + aCoord[1]);
+      aSlice[4] = -1.0*(1.0 + aCoord[0])*(aCoord[0] + aCoord[1]);
+      aSlice[5] = (1.0 + aCoord[1])*(1.0 + aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTria3b::TTria3b():
+    TShapeFun(2,3)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  0.0;  aCoord[1] =  0.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] =  0.0; break;
+      case  2: aCoord[0] =  0.0;  aCoord[1] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TTria3b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 1.0 - aCoord[0] - aCoord[1];
+      aSlice[1] = aCoord[0];
+      aSlice[2] = aCoord[1];
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTria6b::TTria6b():
+    TShapeFun(2,6)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  0.0;  aCoord[1] =  0.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] =  0.0; break;
+      case  2: aCoord[0] =  0.0;  aCoord[1] =  1.0; break;
+
+      case  3: aCoord[0] =  0.5;  aCoord[1] =  0.0; break;
+      case  4: aCoord[0] =  0.5;  aCoord[1] =  0.5; break;
+      case  5: aCoord[0] =  0.0;  aCoord[1] =  0.5; break;
+      }
+    }
+  }
+
+  void
+  TTria6b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = (1.0 - aCoord[0] - aCoord[1])*(1.0 - 2.0*aCoord[0] - 2.0*aCoord[1]);
+      aSlice[1] = aCoord[0]*(2.0*aCoord[0] - 1.0);
+      aSlice[2] = aCoord[1]*(2.0*aCoord[1] - 1.0);
+
+      aSlice[3] = 4.0*aCoord[0]*(1.0 - aCoord[0] - aCoord[1]);
+      aSlice[4] = 4.0*aCoord[0]*aCoord[1];
+      aSlice[5] = 4.0*aCoord[1]*(1.0 - aCoord[0] - aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TQuad4a::TQuad4a():
+    TShapeFun(2,4)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TQuad4a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.25*(1.0 + aCoord[1])*(1.0 - aCoord[0]);
+      aSlice[1] = 0.25*(1.0 - aCoord[1])*(1.0 - aCoord[0]);
+      aSlice[2] = 0.25*(1.0 - aCoord[1])*(1.0 + aCoord[0]);
+      aSlice[3] = 0.25*(1.0 + aCoord[0])*(1.0 + aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TQuad8a::TQuad8a():
+    TShapeFun(2,8)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0; break;
+
+      case  4: aCoord[0] = -1.0;  aCoord[1] =  0.0; break;
+      case  5: aCoord[0] =  0.0;  aCoord[1] = -1.0; break;
+      case  6: aCoord[0] =  1.0;  aCoord[1] =  0.0; break;
+      case  7: aCoord[0] =  0.0;  aCoord[1] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TQuad8a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.25*(1.0 + aCoord[1])*(1.0 - aCoord[0])*(aCoord[1] - aCoord[0] - 1.0);
+      aSlice[1] = 0.25*(1.0 - aCoord[1])*(1.0 - aCoord[0])*(-aCoord[1] - aCoord[0] - 1.0);
+      aSlice[2] = 0.25*(1.0 - aCoord[1])*(1.0 + aCoord[0])*(-aCoord[1] + aCoord[0] - 1.0);
+      aSlice[3] = 0.25*(1.0 + aCoord[1])*(1.0 + aCoord[0])*(aCoord[1] + aCoord[0] - 1.0);
+
+      aSlice[4] = 0.5*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[1]);
+      aSlice[5] = 0.5*(1.0 - aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[0]);
+      aSlice[6] = 0.5*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[1]);
+      aSlice[7] = 0.5*(1.0 + aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TQuad9a::TQuad9a():
+    TShapeFun(2,9)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0; break;
+
+      case  4: aCoord[0] = -1.0;  aCoord[1] =  0.0; break;
+      case  5: aCoord[0] =  0.0;  aCoord[1] = -1.0; break;
+      case  6: aCoord[0] =  1.0;  aCoord[1] =  0.0; break;
+      case  7: aCoord[0] =  0.0;  aCoord[1] =  1.0; break;
+
+      case  8: aCoord[0] =  0.0;  aCoord[1] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TQuad9a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] + 1.0)*(aCoord[1] - 1.0);
+      aSlice[1] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] + 1.0)*(aCoord[1] + 1.0);
+      aSlice[2] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] - 1.0)*(aCoord[1] + 1.0);
+      aSlice[3] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] - 1.0)*(aCoord[1] - 1.0);
+
+      aSlice[4] = 0.5*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1]);
+      aSlice[5] = 0.5*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] + 1.0);
+      aSlice[6] = 0.5*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1]);
+      aSlice[7] = 0.5*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0);
+
+      aSlice[8] = (1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TQuad4b::TQuad4b():
+    TShapeFun(2,4)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0; break;
+      case  3: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TQuad4b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.25*(1.0 - aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[1] = 0.25*(1.0 + aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[2] = 0.25*(1.0 + aCoord[0])*(1.0 + aCoord[1]);
+      aSlice[3] = 0.25*(1.0 - aCoord[0])*(1.0 + aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TQuad8b::TQuad8b():
+    TShapeFun(2,8)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0; break;
+      case  3: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+
+      case  4: aCoord[0] =  0.0;  aCoord[1] = -1.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] =  0.0; break;
+      case  6: aCoord[0] =  0.0;  aCoord[1] =  1.0; break;
+      case  7: aCoord[0] = -1.0;  aCoord[1] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TQuad8b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.25*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(-1.0 - aCoord[0] - aCoord[1]);
+      aSlice[1] = 0.25*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(-1.0 + aCoord[0] - aCoord[1]);
+      aSlice[2] = 0.25*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(-1.0 + aCoord[0] + aCoord[1]);
+      aSlice[3] = 0.25*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(-1.0 - aCoord[0] + aCoord[1]);
+
+      aSlice[4] = 0.5*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[5] = 0.5*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0]);
+      aSlice[6] = 0.5*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1]);
+      aSlice[7] = 0.5*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0]);
+
+      //aSlice[4] = 0.5*(1.0 - aCoord[0])*(1.0 - aCoord[0])*(1.0 - aCoord[1]);
+      //aSlice[5] = 0.5*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[1]);
+      //aSlice[6] = 0.5*(1.0 - aCoord[0])*(1.0 - aCoord[0])*(1.0 + aCoord[1]);
+      //aSlice[7] = 0.5*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TQuad9b::TQuad9b():
+    TShapeFun(2,9)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0; break;
+      case  3: aCoord[0] = -1.0;  aCoord[1] =  1.0; break;
+
+      case  4: aCoord[0] =  0.0;  aCoord[1] = -1.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] =  0.0; break;
+      case  6: aCoord[0] =  0.0;  aCoord[1] =  1.0; break;
+      case  7: aCoord[0] = -1.0;  aCoord[1] =  0.0; break;
+
+      case  8: aCoord[0] =  0.0;  aCoord[1] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TQuad9b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] - 1.0)*(aCoord[1] - 1.0);
+      aSlice[1] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] + 1.0)*(aCoord[1] - 1.0);
+      aSlice[2] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] + 1.0)*(aCoord[1] + 1.0);
+      aSlice[3] = 0.25*aCoord[0]*aCoord[1]*(aCoord[0] - 1.0)*(aCoord[1] + 1.0);
+
+      aSlice[4] = 0.5*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0);
+      aSlice[5] = 0.5*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1]);
+      aSlice[6] = 0.5*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] + 1.0);
+      aSlice[7] = 0.5*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1]);
+
+      aSlice[8] = (1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTetra4a::TTetra4a():
+    TShapeFun(3,4)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  2: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TTetra4a::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = aCoord[1];
+      aSlice[1] = aCoord[2];
+      aSlice[2] = 1.0 - aCoord[0] - aCoord[1] - aCoord[2];
+      aSlice[3] = aCoord[0];
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTetra10a::TTetra10a():
+    TShapeFun(3,10)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  2: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+
+      case  4: aCoord[0] =  0.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case  5: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  6: aCoord[0] =  0.0;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+
+      case  7: aCoord[0] =  0.5;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  8: aCoord[0] =  0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  9: aCoord[0] =  0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TTetra10a::InitFun(const TCCoordSliceArr& theRef,
+                     const TCCoordSliceArr& theGauss,
+                     TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = aCoord[1]*(2.0*aCoord[1] - 1.0);
+      aSlice[1] = aCoord[2]*(2.0*aCoord[2] - 1.0);
+      aSlice[2] = (1.0 - aCoord[0] - aCoord[1] - aCoord[2])*(1.0 - 2.0*aCoord[0] - 2.0*aCoord[1] - 2.0*aCoord[2]);
+      aSlice[3] = aCoord[0]*(2.0*aCoord[0] - 1.0);
+
+      aSlice[4] = 4.0*aCoord[1]*aCoord[2];
+      aSlice[5] = 4.0*aCoord[2]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+      aSlice[6] = 4.0*aCoord[1]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+
+      aSlice[7] = 4.0*aCoord[0]*aCoord[1];
+      aSlice[8] = 4.0*aCoord[0]*aCoord[2];
+      aSlice[9] = 4.0*aCoord[0]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+
+
+  TTetra4b::TTetra4b():
+    TShapeFun(3,4)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TTetra4b::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = aCoord[1];
+      aSlice[2] = aCoord[2];
+      aSlice[1] = 1.0 - aCoord[0] - aCoord[1] - aCoord[2];
+      aSlice[3] = aCoord[0];
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TTetra10b::TTetra10b():
+    TShapeFun(3,10)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+
+      case  6: aCoord[0] =  0.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case  5: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  4: aCoord[0] =  0.0;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+
+      case  7: aCoord[0] =  0.5;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  9: aCoord[0] =  0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  8: aCoord[0] =  0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TTetra10b::InitFun(const TCCoordSliceArr& theRef,
+                     const TCCoordSliceArr& theGauss,
+                     TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = aCoord[1]*(2.0*aCoord[1] - 1.0);
+      aSlice[2] = aCoord[2]*(2.0*aCoord[2] - 1.0);
+      aSlice[1] = (1.0 - aCoord[0] - aCoord[1] - aCoord[2])*(1.0 - 2.0*aCoord[0] - 2.0*aCoord[1] - 2.0*aCoord[2]);
+      aSlice[3] = aCoord[0]*(2.0*aCoord[0] - 1.0);
+
+      aSlice[6] = 4.0*aCoord[1]*aCoord[2];
+      aSlice[5] = 4.0*aCoord[2]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+      aSlice[4] = 4.0*aCoord[1]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+
+      aSlice[7] = 4.0*aCoord[0]*aCoord[1];
+      aSlice[9] = 4.0*aCoord[0]*aCoord[2];
+      aSlice[8] = 4.0*aCoord[0]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  THexa8a::THexa8a():
+    TShapeFun(3,8)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  3: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  4: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  6: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      case  7: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  THexa8a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[1] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[3] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+
+      aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[5] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[7] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  THexa20a::THexa20a(TInt theDim, TInt theNbRef):
+    TShapeFun(theDim,theNbRef)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  1: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  3: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  4: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  6: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      case  7: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+
+      case  8: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  9: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] = -1.0; break;
+      case 10: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case 11: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] = -1.0; break;
+      case 12: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case 13: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case 14: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 15: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 16: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case 17: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case 18: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      case 19: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  THexa20a::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+      aSlice[1] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 + aCoord[0] - aCoord[1] - aCoord[2]);
+      aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 + aCoord[0] + aCoord[1] - aCoord[2]);
+      aSlice[3] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 - aCoord[0] + aCoord[1] - aCoord[2]);
+      aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 - aCoord[0] - aCoord[1] + aCoord[2]);
+      aSlice[5] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 + aCoord[0] - aCoord[1] + aCoord[2]);
+      aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 + aCoord[0] + aCoord[1] + aCoord[2]);
+      aSlice[7] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 - aCoord[0] + aCoord[1] + aCoord[2]);
+
+      aSlice[8] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[9] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 - aCoord[2]);
+      aSlice[10] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[11] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 - aCoord[2]);
+      aSlice[12] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[13] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[14] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 + aCoord[1]);
+      aSlice[15] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 + aCoord[1]);
+      aSlice[16] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[17] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 + aCoord[2]);
+      aSlice[18] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[19] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  THexa27a::THexa27a():
+    THexa20a(3,27)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case 20: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] = -1.0; break;
+      case 21: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case 22: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case 23: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 24: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case 25: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case 26: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  THexa27a::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.125*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[1] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[2] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[3] = 0.125*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[4] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[5] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[6] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[7] = 0.125*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+
+      aSlice[8] = 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[9] = 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[10]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[11]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[12]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] - 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[13]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[14]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] + 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[15]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] + 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[16]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[17]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[18]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[19]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[20]= 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+      aSlice[21]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[22]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[23]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] + 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[24]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[2]*aCoord[2]);
+      aSlice[25]= 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] + 1.0);
+      aSlice[26]= 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[1]*aCoord[1]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  THexa8b::THexa8b():
+    TShapeFun(3,8)
+  {
+    TInt aNbRef = GetNbRef();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  4: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  7: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  6: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      case  5: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  THexa8b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[3] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[1] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+
+      aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[7] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[5] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  THexa20b::THexa20b(TInt theDim, TInt theNbRef):
+    TShapeFun(theDim,theNbRef)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case  2: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  4: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  7: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case  6: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      case  5: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+
+      case 11: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] = -1.0; break;
+      case 10: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] = -1.0; break;
+      case  9: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] = -1.0; break;
+      case  8: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] = -1.0; break;
+      case 16: aCoord[0] = -1.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case 19: aCoord[0] =  1.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case 18: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 17: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 15: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  1.0; break;
+      case 14: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case 13: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  1.0; break;
+      case 12: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  THexa20b::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+      aSlice[3] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 + aCoord[0] - aCoord[1] - aCoord[2]);
+      aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 + aCoord[0] + aCoord[1] - aCoord[2]);
+      aSlice[1] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])*
+        (-2.0 - aCoord[0] + aCoord[1] - aCoord[2]);
+      aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 - aCoord[0] - aCoord[1] + aCoord[2]);
+      aSlice[7] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 + aCoord[0] - aCoord[1] + aCoord[2]);
+      aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 + aCoord[0] + aCoord[1] + aCoord[2]);
+      aSlice[5] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])*
+        (-2.0 - aCoord[0] + aCoord[1] + aCoord[2]);
+
+      aSlice[11] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[10] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 - aCoord[2]);
+      aSlice[9] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+      aSlice[8] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 - aCoord[2]);
+      aSlice[16] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[19] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 - aCoord[1]);
+      aSlice[18] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 + aCoord[1]);
+      aSlice[17] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 + aCoord[1]);
+      aSlice[15] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[14] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 + aCoord[2]);
+      aSlice[13] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+      aSlice[12] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPenta6a::TPenta6a():
+    TShapeFun(3,6)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -0.0;  aCoord[2] =  1.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  4: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TPenta6a::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0]);
+      aSlice[1] = 0.5*aCoord[2]*(1.0 - aCoord[0]);
+      aSlice[2] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+
+      aSlice[3] = 0.5*aCoord[1]*(aCoord[0] + 1.0);
+      aSlice[4] = 0.5*aCoord[2]*(aCoord[0] + 1.0);
+      aSlice[5] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPenta6b::TPenta6b():
+    TShapeFun(3,6)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] = -0.0;  aCoord[2] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  4: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TPenta6b::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0]);
+      aSlice[2] = 0.5*aCoord[2]*(1.0 - aCoord[0]);
+      aSlice[1] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+
+      aSlice[3] = 0.5*aCoord[1]*(aCoord[0] + 1.0);
+      aSlice[5] = 0.5*aCoord[2]*(aCoord[0] + 1.0);
+      aSlice[4] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPenta15a::TPenta15a():
+    TShapeFun(3,15)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] = -0.0;  aCoord[2] =  1.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  4: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+
+      case  6: aCoord[0] = -1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case  7: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  8: aCoord[0] = -1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  9: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 10: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case 11: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case 12: aCoord[0] =  1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case 13: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case 14: aCoord[0] =  1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TPenta15a::InitFun(const TCCoordSliceArr& theRef,
+                     const TCCoordSliceArr& theGauss,
+                     TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0])*(2.0*aCoord[1] - 2.0 - aCoord[0]);
+      aSlice[1] = 0.5*aCoord[2]*(1.0 - aCoord[0])*(2.0*aCoord[2] - 2.0 - aCoord[0]);
+      aSlice[2] = 0.5*(aCoord[0] - 1.0)*(1.0 - aCoord[1] - aCoord[2])*(aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]);
+
+      aSlice[3] = 0.5*aCoord[1]*(1.0 + aCoord[0])*(2.0*aCoord[1] - 2.0 + aCoord[0]);
+      aSlice[4] = 0.5*aCoord[2]*(1.0 + aCoord[0])*(2.0*aCoord[2] - 2.0 + aCoord[0]);
+      aSlice[5] = 0.5*(-aCoord[0] - 1.0)*(1.0 - aCoord[1] - aCoord[2])*(-aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]);
+
+      aSlice[6] = 2.0*aCoord[1]*aCoord[2]*(1.0 - aCoord[0]);
+      aSlice[7] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+      aSlice[8] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+
+      aSlice[9] = aCoord[1]*(1.0 - aCoord[0]*aCoord[0]);
+      aSlice[10] = aCoord[2]*(1.0 - aCoord[0]*aCoord[0]);
+      aSlice[11] = (1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]*aCoord[0]);
+
+      aSlice[12] = 2.0*aCoord[1]*aCoord[2]*(1.0 + aCoord[0]);
+      aSlice[13] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+      aSlice[14] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPenta15b::TPenta15b():
+    TShapeFun(3,15)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] = -1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] = -0.0;  aCoord[2] =  1.0; break;
+      case  1: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  1.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  5: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case  4: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+
+      case  8: aCoord[0] = -1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case  7: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  6: aCoord[0] = -1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case 12: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case 14: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      case 13: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case 11: aCoord[0] =  1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case 10: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case  9: aCoord[0] =  1.0;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      }
+    }
+  }
+
+  void
+  TPenta15b::InitFun(const TCCoordSliceArr& theRef,
+                     const TCCoordSliceArr& theGauss,
+                     TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0])*(2.0*aCoord[1] - 2.0 - aCoord[0]);
+      aSlice[2] = 0.5*aCoord[2]*(1.0 - aCoord[0])*(2.0*aCoord[2] - 2.0 - aCoord[0]);
+      aSlice[1] = 0.5*(aCoord[0] - 1.0)*(1.0 - aCoord[1] - aCoord[2])*(aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]);
+
+      aSlice[3] = 0.5*aCoord[1]*(1.0 + aCoord[0])*(2.0*aCoord[1] - 2.0 + aCoord[0]);
+      aSlice[5] = 0.5*aCoord[2]*(1.0 + aCoord[0])*(2.0*aCoord[2] - 2.0 + aCoord[0]);
+      aSlice[4] = 0.5*(-aCoord[0] - 1.0)*(1.0 - aCoord[1] - aCoord[2])*(-aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]);
+
+      aSlice[8] = 2.0*aCoord[1]*aCoord[2]*(1.0 - aCoord[0]);
+      aSlice[7] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+      aSlice[6] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+
+      aSlice[12] = aCoord[1]*(1.0 - aCoord[0]*aCoord[0]);
+      aSlice[14] = aCoord[2]*(1.0 - aCoord[0]*aCoord[0]);
+      aSlice[13] = (1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]*aCoord[0]);
+
+      aSlice[11] = 2.0*aCoord[1]*aCoord[2]*(1.0 + aCoord[0]);
+      aSlice[10] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+      aSlice[9]  = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPyra5a::TPyra5a():
+    TShapeFun(3,5)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case  4: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TPyra5a::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+      // APO & RNV:
+      // Fix for 0019920: EDF 788 VISU: Bad localisation of gauss points for pyramids
+      // Seems shape function for ePYRA5 elements is:
+      // w0 = 0.25*(-X + Y - 1.0)*(-X - Y - 1.0)*(1.0 - Z);
+      // w1 = 0.25*(-X - Y - 1.0)*(+X - Y - 1.0)*(1.0 - Z);
+      // w2 = 0.25*(+X + Y - 1.0)*(+X - Y - 1.0)*(1.0 - Z);
+      // w3 = 0.25*(+X + Y - 1.0)*(-X + Y - 1.0)*(1.0 - Z);
+      // w4 = +Z;
+      aSlice[0] = 0.25*(-aCoord[0] + aCoord[1] - 1.0)*(-aCoord[0] - aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[1] = 0.25*(-aCoord[0] - aCoord[1] - 1.0)*(+aCoord[0] - aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[2] = 0.25*(+aCoord[0] + aCoord[1] - 1.0)*(+aCoord[0] - aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[3] = 0.25*(+aCoord[0] + aCoord[1] - 1.0)*(-aCoord[0] + aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[4] = aCoord[2];
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPyra5b::TPyra5b():
+    TShapeFun(3,5)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){        
+      case  0: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case  4: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+      }
+    }
+  }
+
+  void
+  TPyra5b::InitFun(const TCCoordSliceArr& theRef,
+                   const TCCoordSliceArr& theGauss,
+                   TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+    
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+      // APO & RNV:
+      // Fix for 0019920: EDF 788 VISU: Bad localisation of gauss points for pyramids
+      // Seems shape function for ePYRA5 elements is:
+      // w0 = 0.25*(-X + Y - 1.0)*(-X - Y - 1.0)*(1.0 - Z);
+      // w1 = 0.25*(-X - Y - 1.0)*(+X - Y - 1.0)*(1.0 - Z);
+      // w2 = 0.25*(+X + Y - 1.0)*(+X - Y - 1.0)*(1.0 - Z);
+      // w3 = 0.25*(+X + Y - 1.0)*(-X + Y - 1.0)*(1.0 - Z);
+      // w4 = +Z;
+      aSlice[0] = 0.25*(-aCoord[0] + aCoord[1] - 1.0)*(-aCoord[0] - aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[3] = 0.25*(-aCoord[0] - aCoord[1] - 1.0)*(+aCoord[0] - aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[2] = 0.25*(+aCoord[0] + aCoord[1] - 1.0)*(+aCoord[0] - aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[1] = 0.25*(+aCoord[0] + aCoord[1] - 1.0)*(-aCoord[0] + aCoord[1] - 1.0)*(1.0 - aCoord[2]);
+      aSlice[4] = aCoord[2];
+    }
+  }
+  
+
+
+  //---------------------------------------------------------------
+  TPyra13a::TPyra13a():
+    TShapeFun(3,13)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case  4: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+
+      case  5: aCoord[0] =  0.5;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  6: aCoord[0] = -0.5;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  7: aCoord[0] = -0.5;  aCoord[1] = -0.5;  aCoord[2] =  0.0; break;
+      case  8: aCoord[0] =  0.5;  aCoord[1] = -0.5;  aCoord[2] =  0.0; break;
+      case  9: aCoord[0] =  0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case 10: aCoord[0] =  0.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case 11: aCoord[0] = -0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case 12: aCoord[0] =  0.0;  aCoord[1] = -0.5;  aCoord[2] =  0.5; break;
+      }
+    }
+  }
+
+  void
+  TPyra13a::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[0] - 0.5)/(1.0 - aCoord[2]);
+      aSlice[1] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[1] - 0.5)/(1.0 - aCoord[2]);
+      aSlice[2] = 0.5*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[0] - 0.5)/(1.0 - aCoord[2]);
+      aSlice[3] = 0.5*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[1] - 0.5)/(1.0 - aCoord[2]);
+
+      aSlice[4] = 2.0*aCoord[2]*(aCoord[2] - 0.5);
+
+      aSlice[5] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+      aSlice[6] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+      aSlice[7] = 0.5*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+      aSlice[8] = 0.5*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+
+      aSlice[9] = 0.5*aCoord[2]*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+      aSlice[10] = 0.5*aCoord[2]*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+      aSlice[11] = 0.5*aCoord[2]*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+      aSlice[12] = 0.5*aCoord[2]*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  TPyra13b::TPyra13b():
+    TShapeFun(3,13)
+  {
+    TInt aNbRef = myRefCoord.size();
+    for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+      TCoordSlice aCoord = GetCoord(aRefId);
+      switch(aRefId){
+      case  0: aCoord[0] =  1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  3: aCoord[0] =  0.0;  aCoord[1] =  1.0;  aCoord[2] =  0.0; break;
+      case  2: aCoord[0] = -1.0;  aCoord[1] =  0.0;  aCoord[2] =  0.0; break;
+      case  1: aCoord[0] =  0.0;  aCoord[1] = -1.0;  aCoord[2] =  0.0; break;
+      case  4: aCoord[0] =  0.0;  aCoord[1] =  0.0;  aCoord[2] =  1.0; break;
+
+      case  8: aCoord[0] =  0.5;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  7: aCoord[0] = -0.5;  aCoord[1] =  0.5;  aCoord[2] =  0.0; break;
+      case  6: aCoord[0] = -0.5;  aCoord[1] = -0.5;  aCoord[2] =  0.0; break;
+      case  5: aCoord[0] =  0.5;  aCoord[1] = -0.5;  aCoord[2] =  0.0; break;
+      case  9: aCoord[0] =  0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case 12: aCoord[0] =  0.0;  aCoord[1] =  0.5;  aCoord[2] =  0.5; break;
+      case 11: aCoord[0] = -0.5;  aCoord[1] =  0.0;  aCoord[2] =  0.5; break;
+      case 10: aCoord[0] =  0.0;  aCoord[1] = -0.5;  aCoord[2] =  0.5; break;
+      }
+    }
+  }
+
+  void
+  TPyra13b::InitFun(const TCCoordSliceArr& theRef,
+                    const TCCoordSliceArr& theGauss,
+                    TFun& theFun) const
+  {
+    GetFun(theRef,theGauss,theFun);
+
+    TInt aNbGauss = theGauss.size();
+    for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+      const TCCoordSlice& aCoord = theGauss[aGaussId];
+      TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+      aSlice[0] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[0] - 0.5)/(1.0 - aCoord[2]);
+      aSlice[3] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[1] - 0.5)/(1.0 - aCoord[2]);
+      aSlice[2] = 0.5*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[0] - 0.5)/(1.0 - aCoord[2]);
+      aSlice[1] = 0.5*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[1] - 0.5)/(1.0 - aCoord[2]);
+
+      aSlice[4] = 2.0*aCoord[2]*(aCoord[2] - 0.5);
+
+      aSlice[8] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+      aSlice[7] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*
+        (aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+      aSlice[6] = 0.5*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+      aSlice[5] = 0.5*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*
+        (-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]);
+
+      aSlice[9] = 0.5*aCoord[2]*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+      aSlice[12] = 0.5*aCoord[2]*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+      aSlice[11] = 0.5*aCoord[2]*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+      aSlice[10] = 0.5*aCoord[2]*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/
+        (1.0 - aCoord[2]);
+    }
+  }
+
+
+
+  //---------------------------------------------------------------
+  bool
+  GetGaussCoord3D(const TGaussInfo& theGaussInfo, 
+                  const TCellInfo& theCellInfo,
+                  const TNodeInfo& theNodeInfo,
+                  TGaussCoord& theGaussCoord,
+                  const TElemNum& theElemNum,
+                  EModeSwitch theMode)
+  {
+    INITMSG(MYDEBUG,"GetGaussCoord3D\n");
+
+    if(theGaussInfo.myGeom == theCellInfo.myGeom){
+      EGeometrieElement aGeom = theGaussInfo.myGeom;
+
+      TInt aNbRef = theGaussInfo.GetNbRef();
+      TCCoordSliceArr aRefSlice(aNbRef);
+      for(TInt anId = 0; anId < aNbRef; anId++)
+        aRefSlice[anId] = theGaussInfo.GetRefCoordSlice(anId);
+
+      TInt aNbGauss = theGaussInfo.GetNbGauss();
+      TCCoordSliceArr aGaussSlice(aNbGauss);
+      for(TInt anId = 0; anId < aNbGauss; anId++)
+        aGaussSlice[anId] = theGaussInfo.GetGaussCoordSlice(anId);
+
+      switch(aGeom){
+      case eSEG2: {
+        INITMSG(MYDEBUG,"eSEG2"<<std::endl);
+
+        if(TSeg2a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eSEG3: {
+        INITMSG(MYDEBUG,"eSEG3"<<std::endl);
+
+        if(TSeg3a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eTRIA3: {
+        INITMSG(MYDEBUG,"eTRIA3"<<std::endl);
+
+        if(TTria3a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TTria3b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eTRIA6: {
+        INITMSG(MYDEBUG,"eTRIA6"<<std::endl);
+
+        if(TTria6a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TTria6b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eQUAD4: {
+        INITMSG(MYDEBUG,"eQUAD4"<<std::endl);
+
+        if(TQuad4a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TQuad4b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eQUAD8: {
+        INITMSG(MYDEBUG,"eQUAD8"<<std::endl);
+
+        if(TQuad8a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TQuad8b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eQUAD9: {
+        INITMSG(MYDEBUG,"eQUAD9"<<std::endl);
+
+        if(TQuad9a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TQuad9b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eTETRA4: {
+        INITMSG(MYDEBUG,"eTETRA4"<<std::endl);
+
+        if(TTetra4a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TTetra4b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case ePYRA5: {
+        INITMSG(MYDEBUG,"ePYRA5"<<std::endl);
+
+        if(TPyra5a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TPyra5b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case ePENTA6: {
+        INITMSG(MYDEBUG,"ePENTA6"<<std::endl);
+
+        if(TPenta6a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TPenta6b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eHEXA8: {
+        INITMSG(MYDEBUG,"eHEXA8"<<std::endl);
+
+        if(THexa8a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(THexa8b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eTETRA10: {
+        INITMSG(MYDEBUG,"eTETRA10"<<std::endl);
+
+        if(TTetra10a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TTetra10b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case ePYRA13: {
+        INITMSG(MYDEBUG,"ePYRA13"<<std::endl);
+
+        if(TPyra13a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TPyra13b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case ePENTA15: {
+        INITMSG(MYDEBUG,"ePENTA15"<<std::endl);
+
+        if(TPenta15a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(TPenta15b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      case eHEXA20: {
+        INITMSG(MYDEBUG,"eHEXA20"<<std::endl);
+
+        if(THexa20a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        if(THexa20b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+          return true;
+
+        break;
+      }
+      default: 
+        INITMSG(MYDEBUG,"eNONE"<<std::endl);
+        return false;
+      }
+    }
+
+    return false;
+  }
+
+  //---------------------------------------------------------------
+  bool
+  GetBaryCenter(const TCellInfo& theCellInfo,
+                const TNodeInfo& theNodeInfo,
+                TGaussCoord& theGaussCoord,
+                const TElemNum& theElemNum,
+                EModeSwitch theMode)
+  {
+    INITMSG(MYDEBUG,"GetBaryCenter\n");
+    const PMeshInfo& aMeshInfo = theCellInfo.GetMeshInfo();
+    TInt aDim = aMeshInfo->GetDim();
+    static TInt aNbGauss = 1;
+
+    bool anIsSubMesh = !theElemNum.empty();
+    TInt aNbElem;
+    if(anIsSubMesh)
+      aNbElem = theElemNum.size();
+    else
+      aNbElem = theCellInfo.GetNbElem();
+
+    theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+    TInt aConnDim = theCellInfo.GetConnDim();
+
+    INITMSGA(MYDEBUG,0,
+             "- aDim = "<<aDim<<
+             "; aNbGauss = "<<aNbGauss<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+             std::endl);
+
+    for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+      TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+      TCConnSlice aConnSlice = theCellInfo.GetConnSlice(aCellId);
+      TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+
+      for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+        TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+
+        for(TInt aConnId = 0; aConnId < aConnDim; aConnId++){
+          TInt aNodeId = aConnSlice[aConnId] - 1;      
+          TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+          for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+            aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId];
+          }
+        }
+
+        for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+          aGaussCoordSlice[aDimId] /= aConnDim;
+        }
+      }
+    }
+
+#ifdef _DEBUG_
+    for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+      TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+      INITMSG(MYVALUEDEBUG,"");
+      for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+        TCoordSlice& aCoordSlice = aCoordSliceArr[aGaussId];
+        ADDMSG(MYVALUEDEBUG,"{");
+        for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+          ADDMSG(MYVALUEDEBUG,aCoordSlice[aDimId]<<" ");
+        }
+        ADDMSG(MYVALUEDEBUG,"} ");
+      }
+      ADDMSG(MYVALUEDEBUG,std::endl);
+    }
+#endif
+
+    return true;
+  }
+
+
+  //---------------------------------------------------------------
+  bool
+  GetBaryCenter(const TPolygoneInfo& thePolygoneInfo,
+                const TNodeInfo& theNodeInfo,
+                TGaussCoord& theGaussCoord,
+                const TElemNum& theElemNum,
+                EModeSwitch theMode)
+  {
+    INITMSG(MYDEBUG,"GetBaryCenter\n");
+    const PMeshInfo& aMeshInfo = thePolygoneInfo.GetMeshInfo();
+    TInt aDim = aMeshInfo->GetDim();
+    static TInt aNbGauss = 1;
+
+    bool anIsSubMesh = !theElemNum.empty();
+    TInt aNbElem;
+    if(anIsSubMesh)
+      aNbElem = theElemNum.size();
+    else
+      aNbElem = thePolygoneInfo.GetNbElem();
+
+    theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+    INITMSGA(MYDEBUG,0,
+             "- aDim = "<<aDim<<
+             "; aNbGauss = "<<aNbGauss<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+             std::endl);
+
+    for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+      TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+
+      TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+      TCConnSlice aConnSlice = thePolygoneInfo.GetConnSlice(aCellId);
+      TInt aNbConn = thePolygoneInfo.GetNbConn(aCellId);
+      TInt aNbNodes = thePolygoneInfo.GetNbConn(aCellId);
+
+      for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+        TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+
+        for(TInt aConnId = 0; aConnId < aNbConn; aConnId++){
+          TInt aNodeId = aConnSlice[aConnId] - 1;      
+          TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+          for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+            aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId];
+          }
+        }
+
+        for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+          aGaussCoordSlice[aDimId] /= aNbNodes;
+        }
+      }
+    }
+
+    return true;
+  }
+
+
+  //---------------------------------------------------------------
+  bool
+  GetBaryCenter(const TPolyedreInfo& thePolyedreInfo,
+                const TNodeInfo& theNodeInfo,
+                TGaussCoord& theGaussCoord,
+                const TElemNum& theElemNum,
+                EModeSwitch theMode)
+  {
+    INITMSG(MYDEBUG,"GetBaryCenter\n");
+    const PMeshInfo& aMeshInfo = thePolyedreInfo.GetMeshInfo();
+    TInt aDim = aMeshInfo->GetDim();
+    static TInt aNbGauss = 1;
+
+    bool anIsSubMesh = !theElemNum.empty();
+    TInt aNbElem;
+    if(anIsSubMesh)
+      aNbElem = theElemNum.size();
+    else
+      aNbElem = thePolyedreInfo.GetNbElem();
+
+    theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+    INITMSGA(MYDEBUG,0,
+             "- aDim = "<<aDim<<
+             "; aNbGauss = "<<aNbGauss<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+             std::endl);
+
+    for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+      TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+
+      TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+      TCConnSliceArr aConnSliceArr = thePolyedreInfo.GetConnSliceArr(aCellId);
+      TInt aNbFaces = aConnSliceArr.size();
+
+      TInt aNbNodes = thePolyedreInfo.GetNbNodes(aCellId);
+
+      for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+        TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+
+        for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++){
+          TCConnSlice aConnSlice = aConnSliceArr[aFaceId];
+          TInt aNbConn = aConnSlice.size();
+          for(TInt aConnId = 0; aConnId < aNbConn; aConnId++){
+            TInt aNodeId = aConnSlice[aConnId] - 1;      
+            TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+            for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+              aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId];
+            }
+          }
+        }
+        for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+          aGaussCoordSlice[aDimId] /= aNbNodes;
+        }
+      }
+    }
+
+    return true;
+  }
+}
diff --git a/src/MEDWrapper/Base/MED_GaussUtils.hxx b/src/MEDWrapper/Base/MED_GaussUtils.hxx
new file mode 100644 (file)
index 0000000..ffea1a8
--- /dev/null
@@ -0,0 +1,366 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_GaussUtils_HeaderFile
+#define MED_GaussUtils_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+
+#include "MED_Structures.hxx"
+
+namespace MED
+{
+  //---------------------------------------------------------------
+  typedef TVector<TCCoordSlice> TCCoordSliceArr;
+  typedef TVector<TCoordSlice> TCoordSliceArr;
+
+  //! Define a helper class to handle Gauss Points coordinates
+  class MEDWRAPPER_EXPORT TGaussCoord:
+    virtual TModeSwitchInfo 
+  {
+    TInt myNbElem;
+    TInt myNbGauss;
+    TInt myDim;
+
+    TInt myGaussStep;
+
+    TNodeCoord myGaussCoord;
+
+  public:
+    
+    TGaussCoord();
+
+    //! To init the class
+    void
+    Init(TInt theNbElem,
+         TInt theNbGauss,
+         TInt theDim,
+         EModeSwitch theMode = eFULL_INTERLACE);
+
+    TInt
+    GetNbElem() const;
+
+    TInt
+    GetNbGauss() const;
+
+    TInt
+    GetDim() const;
+
+    unsigned char*
+    GetValuePtr();
+
+    //! Get slice of the coordinate that corresponds to defined cell (const version)
+    TCCoordSliceArr
+    GetCoordSliceArr(TInt theElemId) const;
+
+    //! Get slice of the coordinate that corresponds to defined cell
+    TCoordSliceArr 
+    GetCoordSliceArr(TInt theElemId);
+  };
+  typedef SharedPtr<TGaussCoord> PGaussCoord;
+
+
+  //---------------------------------------------------------------
+  //! To calculate Gauss Points coordinates
+  MEDWRAPPER_EXPORT 
+  bool
+  GetGaussCoord3D(const TGaussInfo& theGaussInfo, 
+                  const TCellInfo& theCellInfo,
+                  const TNodeInfo& theNodeInfo,
+                  TGaussCoord& theGaussCoord,
+                  const TElemNum& theElemNum = TElemNum(),
+                  EModeSwitch theMode = eFULL_INTERLACE);
+
+
+  //---------------------------------------------------------------
+  //! To calculate Gauss Points coordinates for defined TCellInfo as its bary center
+  MEDWRAPPER_EXPORT 
+  bool
+  GetBaryCenter(const TCellInfo& theCellInfo,
+                const TNodeInfo& theNodeInfo,
+                TGaussCoord& theGaussCoord,
+                const TElemNum& theElemNum = TElemNum(),
+                EModeSwitch theMode = eFULL_INTERLACE);
+
+  //! To calculate Gauss Points coordinates for defined TPolygoneInfo as its bary center
+  MEDWRAPPER_EXPORT 
+  bool
+  GetBaryCenter(const TPolygoneInfo& thePolygoneInfo,
+                const TNodeInfo& theNodeInfo,
+                TGaussCoord& theGaussCoord,
+                const TElemNum& theElemNum = TElemNum(),
+                EModeSwitch theMode = eFULL_INTERLACE);
+
+  //! To calculate Gauss Points coordinates for defined TPolyedreInfo as its bary center
+  MEDWRAPPER_EXPORT 
+  bool
+  GetBaryCenter(const TPolyedreInfo& thePolyedreInfo,
+                const TNodeInfo& theNodeInfo,
+                TGaussCoord& theGaussCoord,
+                const TElemNum& theElemNum = TElemNum(),
+                EModeSwitch theMode = eFULL_INTERLACE);
+
+  //---------------------------------------------------------------
+  //! Shape function definitions
+  //---------------------------------------------------------------
+  struct MEDWRAPPER_EXPORT TShapeFun
+  {
+    class TFun;
+    
+    TFloatVector myRefCoord;
+    TInt myDim;
+    TInt myNbRef;
+
+    TShapeFun(TInt theDim = 0, TInt theNbRef = 0);
+
+    TInt GetNbRef() const { return myNbRef; }
+
+    TCCoordSlice GetCoord(TInt theRefId) const;
+
+    TCoordSlice GetCoord(TInt theRefId);
+
+    void GetFun(const TCCoordSliceArr& theRef,
+                const TCCoordSliceArr& theGauss,
+                TFun& theFun) const;
+    virtual 
+    void InitFun(const TCCoordSliceArr& theRef,
+                 const TCCoordSliceArr& theGauss,
+                 TFun& theFun) const = 0;
+    virtual
+    bool IsSatisfy(const TCCoordSliceArr& theRefCoord) const;
+
+    bool Eval(const TCellInfo&       theCellInfo,
+              const TNodeInfo&       theNodeInfo,
+              const TElemNum&        theElemNum,
+              const TCCoordSliceArr& theRef,
+              const TCCoordSliceArr& theGauss,
+              TGaussCoord&           theGaussCoord,
+              EModeSwitch            theMode);
+  };
+  //---------------------------------------------------------------
+  struct TSeg2a: TShapeFun {
+    TSeg2a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TSeg3a: TShapeFun {
+    TSeg3a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTria3a: TShapeFun {
+    TTria3a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTria6a: TShapeFun {
+    TTria6a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTria3b: TShapeFun {
+    TTria3b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTria6b: TShapeFun {
+    TTria6b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TQuad4a: TShapeFun {
+    TQuad4a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TQuad8a: TShapeFun {
+    TQuad8a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TQuad9a: TShapeFun {
+    TQuad9a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TQuad4b: TShapeFun {
+    TQuad4b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TQuad8b: TShapeFun {
+    TQuad8b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TQuad9b: TShapeFun {
+    TQuad9b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTetra4a: TShapeFun {
+    TTetra4a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTetra10a: TShapeFun {
+    TTetra10a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTetra4b: TShapeFun {
+    TTetra4b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TTetra10b: TShapeFun {
+    TTetra10b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct THexa8a: TShapeFun {
+    THexa8a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct THexa20a: TShapeFun {
+    THexa20a(TInt theDim = 3, TInt theNbRef = 20);
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct THexa27a: THexa20a {
+    THexa27a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct THexa8b: TShapeFun {
+    THexa8b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct THexa20b: TShapeFun {
+    THexa20b(TInt theDim = 3, TInt theNbRef = 20);
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPenta6a: TShapeFun {
+    TPenta6a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPenta6b: TShapeFun {
+    TPenta6b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPenta15a: TShapeFun {
+    TPenta15a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPenta15b: TShapeFun {
+    TPenta15b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPyra5a: TShapeFun {
+    TPyra5a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPyra5b: TShapeFun {
+    TPyra5b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPyra13a: TShapeFun {
+    TPyra13a();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+  struct TPyra13b: TShapeFun {
+    TPyra13b();
+    virtual void InitFun(const TCCoordSliceArr& theRef,
+                         const TCCoordSliceArr& theGauss,
+                         TFun& theFun) const;
+  };
+  //---------------------------------------------------------------
+
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_SharedPtr.hxx b/src/MEDWrapper/Base/MED_SharedPtr.hxx
new file mode 100644 (file)
index 0000000..d0f4746
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_SharedPtr_HeaderFile
+#define MED_SharedPtr_HeaderFile
+
+#include <boost/shared_ptr.hpp>
+
+namespace MED
+{
+
+  //! To extend the boost::shared_ptr to support such features automatic dynamic cast
+  /*!
+    All entities of the MEDWrapper package are handled as pointer.
+    This class was introduced to provide correct and flexible memory management 
+    for all of the MEDWrapper objects.
+  */
+  template<class T> class SharedPtr: public boost::shared_ptr<T>
+  {
+  public:
+    //! Default constructor
+    SharedPtr() {}
+
+    //! Construct the class by any type of a pointer
+    template<class Y>
+    explicit SharedPtr(Y * p): 
+      boost::shared_ptr<T>(p) 
+    {}
+
+    //! Construct the class by any specialisation of the class
+    template<class Y>
+    SharedPtr(SharedPtr<Y> const & r):
+      boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
+    {}
+
+    //! Copy-constructor
+    template<class Y>
+    SharedPtr& 
+    operator=(SharedPtr<Y> const & r)
+    {
+      boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag()).swap(*this);
+      return *this;
+    }
+
+    //! Introduce a flexible way to reset the wrapped pointer
+    template<class Y> 
+    SharedPtr& 
+    operator()(Y * p) // Y must be complete
+    {
+      return operator=<Y>(SharedPtr<Y>(p));
+    }
+
+    //! Introduce a flexible way to reset the wrapped pointer
+    template<class Y> 
+    SharedPtr& 
+    operator()(SharedPtr<Y> const & r) // Y must be complete
+    {
+      return operator=<Y>(SharedPtr<Y>(r));
+    }
+
+    //! To provide a flexible way to use reference to the wrapped pointer (const version)
+    operator const T& () const 
+    { 
+      return *(this->get());
+    }
+
+    //! To provide a flexible way to use reference to the wrapped pointer
+    operator T& () 
+    { 
+      return *(this->get());
+    }
+  };
+
+}
+
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_SliceArray.hxx b/src/MEDWrapper/Base/MED_SliceArray.hxx
new file mode 100644 (file)
index 0000000..c41951c
--- /dev/null
@@ -0,0 +1,186 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_SliceArray_HeaderFile
+#define MED_SliceArray_HeaderFile
+
+#ifdef WIN32 // for correctly compiling "valarray" in modules, which are includes this file
+  #undef max
+  #undef min
+#endif
+
+#include <valarray>
+#include <stdexcept>
+
+//#if defined(_DEBUG_)
+#  define MED_TCSLICE_CHECK_RANGE
+//#endif
+
+namespace MED
+{
+  //---------------------------------------------------------------
+  //! This class intends to provide an uniform way to handle multy-dimention data (const version)
+  /*! 
+    It just contains pointer to real sequence and implement proper calcultion of its indexes.
+    This class deal with constant pointer to the sources data and provide const method to
+    read the them (data).
+   */
+  template<class TValueType> 
+  class TCSlice
+  {
+    const TValueType* myCValuePtr; //!< Reference to source multy-dimension data
+    size_t mySourceSize; //!< Size of the source multy-dimension data
+    std::slice mySlice; //!< Defines algorithm of index calculation
+
+  protected:
+    void
+    check_id(size_t theId) const
+    {
+      long int anId = -1;
+      if(theId < mySlice.size()){
+        anId = mySlice.start() + theId*mySlice.stride();
+        if(anId < (long int)mySourceSize)
+          return;
+      }
+      throw std::out_of_range("TCSlice::check_id");
+    }
+
+    //! Calculate internal index to get proper element from the source multy-dimension data
+    size_t
+    calculate_id(size_t theId) const
+    {
+      return mySlice.start() + theId*mySlice.stride();
+    }
+    
+    size_t
+    get_id(size_t theId) const
+    {
+#ifdef MED_TCSLICE_CHECK_RANGE
+      check_id(theId);
+#endif
+      return calculate_id(theId);
+    }
+    
+    size_t
+    get_id_at(size_t theId) const
+    {
+      check_id(theId);
+      return calculate_id(theId);
+    }
+
+  public:
+    typedef TValueType value_type;
+
+    //! Construct the class from bare pointer
+    TCSlice(const value_type* theValuePtr,
+            size_t theSourceSize,
+            const std::slice& theSlice): 
+      myCValuePtr(theValuePtr),
+      mySourceSize(theSourceSize),
+      mySlice(theSlice)
+    {}
+    
+    //! Construct the class from corresponding container
+    TCSlice(const TVector<value_type>& theContainer,
+            const std::slice& theSlice): 
+      myCValuePtr(&theContainer[0]),
+      mySourceSize(theContainer.size()),
+      mySlice(theSlice)
+    {}
+    
+    //! Default constructor (dangerous)
+    TCSlice():
+      myCValuePtr(NULL)
+    {}
+
+    //! Get element by its number (const version)
+    const value_type& 
+    operator[](size_t theId) const
+    {
+      return *(myCValuePtr + get_id(theId));
+    }
+    
+    const value_type& 
+    at(size_t theId) const
+    {
+      return *(myCValuePtr + get_id_at(theId));
+    }
+    
+    //! Get range of the order numbers
+    size_t
+    size() const
+    {
+      return mySlice.size();
+    }
+  };
+  
+
+  //---------------------------------------------------------------
+  //! This class extend TCSlice functionality for non-constant case
+  template<class TValueType> 
+  class TSlice: public TCSlice<TValueType>
+  {
+    TValueType* myValuePtr;
+    
+  public:
+    typedef TValueType value_type;
+    typedef TCSlice<TValueType> TSupperClass;
+
+    //! Construct the class from bare pointer
+    TSlice(value_type* theValuePtr,
+           size_t theSourceSize,
+           const std::slice& theSlice): 
+      TSupperClass(theValuePtr, theSourceSize, theSlice),
+      myValuePtr(theValuePtr)
+    {}
+    
+    //! Construct the class from corresponding container
+    TSlice(TVector<value_type>& theContainer,
+           const std::slice& theSlice): 
+      TSupperClass(theContainer, theSlice),
+      myValuePtr(&theContainer[0])
+    {}
+    
+    //! Default constructor (dangerous)
+    TSlice():
+      myValuePtr(NULL)
+    {}
+
+    //! Get element by its number
+    value_type& 
+    operator[](size_t theId)
+    {
+      return *(myValuePtr + this->get_id(theId));
+    }
+
+    value_type& 
+    at(size_t theId)
+    {
+      return *(myValuePtr + this->get_id_at(theId));
+    }
+  };
+
+}
+
+#undef MED_TCSLICE_CHECK_RANGE
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_Structures.cxx b/src/MEDWrapper/Base/MED_Structures.cxx
new file mode 100644 (file)
index 0000000..e9059ad
--- /dev/null
@@ -0,0 +1,865 @@
+// Copyright (C) 2007-2013  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   : MED_Structure.cxx
+//  Author : Eugeny NIKOLAEV
+//
+#include "MED_Structures.hxx"
+#include "MED_Utilities.hxx"
+
+#include <cstring>
+
+using namespace MED;
+
+namespace MED
+{
+  TInt
+  GetNbNodes(EGeometrieElement typmai)
+  {
+    return typmai%100;
+  }
+
+  std::string 
+  GetString(TInt theId, 
+            TInt theStep, 
+            const TString& theString)
+  {
+    const char* aPos = &theString[theId*theStep];
+    TInt aSize = std::min(TInt(strlen(aPos)),theStep);
+    return std::string(aPos,aSize);
+  }
+
+  void 
+  SetString(TInt theId, 
+            TInt theStep, 
+            TString& theString, 
+            const std::string& theValue)
+  {
+    TInt aSize = std::min(TInt(theValue.size()+1),theStep);
+    char* aPos = &theString[theId*theStep];
+    strncpy(aPos,theValue.c_str(),aSize);
+  }
+
+  void 
+  SetString(TInt theId, 
+            TInt theStep, 
+            TString& theString, 
+            const TString& theValue)
+  {
+    TInt aSize = std::min(TInt(theValue.size()+1),theStep);
+    char* aPos = &theString[theId*theStep];
+    const char* aValue = &theValue[0];
+    strncpy(aPos,aValue,aSize);
+  }
+
+  TInt
+  GetDimGaussCoord(EGeometrieElement theGeom)
+  {
+    return theGeom/100;
+  }
+
+  TInt
+  GetNbRefCoord(EGeometrieElement theGeom)
+  {
+    return (theGeom%100);
+  }
+
+  //---------------------------------------------------------------
+  PFloatTimeStampValue
+  CastToFloatTimeStampValue(const PTimeStampValueBase& theTimeStampValue)
+  {
+    return theTimeStampValue;
+  }
+
+  PIntTimeStampValue
+  CastToIntTimeStampValue(const PTimeStampValueBase& theTimeStampValue)
+  {
+    return theTimeStampValue;
+  }
+}
+
+//---------------------------------------------------------------
+TInt
+TFamilyInfo
+::GetAttrId(TInt theId) const 
+{
+  return myAttrId[theId];
+}
+
+TInt
+TFamilyInfo
+::GetAttrVal(TInt theId) const 
+{
+  return myAttrVal[theId];
+}
+
+void
+TFamilyInfo
+::SetAttrId(TInt theId,TInt theVal) 
+{
+  myAttrId[theId] = theVal;
+}
+
+void
+TFamilyInfo
+::SetAttrVal(TInt theId,TInt theVal) 
+{
+  myAttrVal[theId] = theVal;
+}
+
+//---------------------------------------------------------------
+TInt
+TElemInfo
+::GetFamNum(TInt theId) const 
+{
+  return (*myFamNum)[theId];
+}
+
+void
+TElemInfo
+::SetFamNum(TInt theId, TInt theVal) 
+{
+  (*myFamNum)[theId] = theVal;
+  myIsFamNum = eVRAI;
+}
+
+TInt
+TElemInfo
+::GetElemNum(TInt theId) const 
+{
+  return (*myElemNum)[theId];
+}
+
+void
+TElemInfo
+::SetElemNum(TInt theId, TInt theVal) 
+{
+  (*myElemNum)[theId] = theVal;
+}
+
+//---------------------------------------------------------------
+TCCoordSlice 
+TNodeInfo
+::GetCoordSlice(TInt theId) const
+{
+  TInt aDim = myMeshInfo->GetSpaceDim();
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCCoordSlice(*myCoord, std::slice(theId*aDim, aDim, 1));
+  else
+    return TCCoordSlice(*myCoord, std::slice(theId, aDim, aDim));
+}
+
+TCoordSlice 
+TNodeInfo
+::GetCoordSlice(TInt theId)
+{
+  TInt aDim = myMeshInfo->GetSpaceDim();
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCoordSlice(*myCoord, std::slice(theId*aDim,aDim,1));
+  else
+    return TCoordSlice(*myCoord, std::slice(theId,aDim,aDim));
+}
+
+//---------------------------------------------------------------
+TCConnSlice 
+TCellInfo
+::GetConnSlice(TInt theElemId) const
+{
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
+  else
+    return TCConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
+}
+
+TConnSlice 
+TCellInfo
+::GetConnSlice(TInt theElemId)
+{
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
+  else
+    return TConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
+}
+
+
+//---------------------------------------------------------------
+TInt
+TPolygoneInfo
+::GetNbConn(TInt theElemId) const 
+{
+  return (*myIndex)[theElemId + 1] - (*myIndex)[theElemId];
+}
+
+TCConnSlice 
+TPolygoneInfo
+::GetConnSlice(TInt theElemId) const
+{
+  return TCConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
+}
+
+TConnSlice 
+TPolygoneInfo
+::GetConnSlice(TInt theElemId)
+{
+  return TConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
+}
+
+
+//---------------------------------------------------------------
+TInt 
+TPolyedreInfo
+::GetNbFaces(TInt theElemId) const 
+{
+  return (*myIndex)[theElemId+1] - (*myIndex)[theElemId];
+}
+
+TInt 
+TPolyedreInfo
+::GetNbNodes(TInt theElemId) const 
+{
+  TInt aNbNodes = 0;
+  TInt aNbFaces = GetNbFaces(theElemId);
+  TInt aStartFaceId = (*myIndex)[theElemId] - 1;
+  for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
+    TInt aCurrentId = (*myFaces)[aStartFaceId];
+    TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
+    aNbNodes += aDiff;
+  }
+  return aNbNodes;
+}
+
+TCConnSliceArr 
+TPolyedreInfo
+::GetConnSliceArr(TInt theElemId) const
+{
+  TInt aNbFaces = GetNbFaces(theElemId);
+  TCConnSliceArr aConnSliceArr(aNbFaces);
+  TInt aStartFaceId = (*myIndex)[theElemId] - 1;
+  for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
+    TInt aCurrentId = (*myFaces)[aStartFaceId];
+    TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
+    aConnSliceArr[aFaceId] =
+      TCConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
+  }
+  return aConnSliceArr;
+}
+
+TConnSliceArr 
+TPolyedreInfo
+::GetConnSliceArr(TInt theElemId)
+{
+  TInt aNbFaces = GetNbFaces(theElemId);
+  TConnSliceArr aConnSliceArr(aNbFaces);
+  TInt aStartFaceId = (*myIndex)[theElemId] - 1;
+  for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
+    TInt aCurrentId = (*myFaces)[aStartFaceId];
+    TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
+    aConnSliceArr[aFaceId] =
+      TConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
+  }
+  return aConnSliceArr;
+}
+
+
+//---------------------------------------------------------------
+TMeshValueBase
+::TMeshValueBase():
+  myNbElem(0),
+  myNbComp(0),
+  myNbGauss(0),
+  myStep(0)
+{}
+
+void
+TMeshValueBase
+::Allocate(TInt theNbElem,
+           TInt theNbGauss,
+           TInt theNbComp,
+           EModeSwitch theMode)
+{
+  myModeSwitch = theMode;
+  
+  myNbElem = theNbElem;
+  myNbGauss = theNbGauss;
+  myNbComp = theNbComp;
+  
+  myStep = theNbComp*theNbGauss;
+}
+
+size_t
+TMeshValueBase
+::GetSize() const
+{
+  return myNbElem * myStep;
+}
+    
+size_t
+TMeshValueBase
+::GetNbVal() const
+{
+  return myNbElem * myNbGauss;
+}
+
+size_t
+TMeshValueBase
+::GetNbGauss() const
+{
+  return myNbGauss;
+}
+
+size_t
+TMeshValueBase
+::GetStep() const
+{
+  return myStep;
+}
+
+
+//---------------------------------------------------------------
+TInt
+TProfileInfo
+::GetElemNum(TInt theId) const 
+{
+  return (*myElemNum)[theId];
+}
+
+void
+TProfileInfo
+::SetElemNum(TInt theId,TInt theVal) 
+{
+  (*myElemNum)[theId] = theVal;
+}
+
+//---------------------------------------------------------------
+bool
+TGaussInfo::TLess
+::operator()(const TKey& theLeft, const TKey& theRight) const
+{
+  EGeometrieElement aLGeom = boost::get<0>(theLeft);
+  EGeometrieElement aRGeom = boost::get<0>(theRight);
+  if(aLGeom != aRGeom)
+    return aLGeom < aRGeom;
+
+  const std::string& aLStr = boost::get<1>(theLeft);
+  const std::string& aRStr = boost::get<1>(theRight);
+  return aLStr < aRStr;
+}
+
+bool
+TGaussInfo::TLess
+::operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const
+{
+  if(!&theLeft)
+    return true;
+
+  if(!&theRight)
+    return false;
+
+  if(theLeft.myGeom != theRight.myGeom)
+    return theLeft.myGeom < theRight.myGeom;
+
+  if(theLeft.myRefCoord != theRight.myRefCoord)
+    return theLeft.myRefCoord < theRight.myRefCoord;
+
+  return theLeft.myGaussCoord < theRight.myGaussCoord;
+}
+
+TCCoordSlice 
+TGaussInfo
+::GetRefCoordSlice(TInt theId) const
+{
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
+  else
+    return TCCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
+}
+
+TCoordSlice 
+TGaussInfo
+::GetRefCoordSlice(TInt theId)
+{
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
+  else
+    return TCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
+}
+
+TCCoordSlice 
+TGaussInfo
+::GetGaussCoordSlice(TInt theId) const
+{
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetDim(),1));
+  else
+    return TCCoordSlice(myGaussCoord,std::slice(theId,GetDim(),GetDim()));
+}
+
+TCoordSlice 
+TGaussInfo
+::GetGaussCoordSlice(TInt theId)
+{
+  if(GetModeSwitch() == eFULL_INTERLACE)
+    return TCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetNbGauss(),1));
+  else
+    return TCoordSlice(myGaussCoord,std::slice(theId,GetNbGauss(),GetDim()));
+}
+
+
+//---------------------------------------------------------------
+TInt
+TTimeStampInfo
+::GetNbGauss(EGeometrieElement theGeom) const
+{
+  TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
+  if(anIter == myGeom2NbGauss.end())
+    return 1;//EXCEPTION(runtime_error,"TTimeStampInfo::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
+
+  return anIter->second;
+}
+
+
+//---------------------------------------------------------------
+// TGrilleInfo structure methods
+//---------------------------------------------------------------
+const EGrilleType&
+TGrilleInfo
+::GetGrilleType() const
+{
+  return myGrilleType;
+}
+
+EGrilleType
+TGrilleInfo
+::GetGrilleType()
+{
+  return myGrilleType;
+}
+
+void
+TGrilleInfo
+::SetGrilleType(EGrilleType theGrilleType)
+{
+  myGrilleType = theGrilleType;
+}
+
+const
+TIndexes&
+TGrilleInfo
+::GetMapOfIndexes() const
+{
+  return myIndixes;
+}
+
+TIndexes&
+TGrilleInfo
+::GetMapOfIndexes()
+{
+  return myIndixes;
+}
+
+const
+TFloatVector&
+TGrilleInfo
+::GetIndexes(TInt theAxisNumber) const
+{
+  TIndexes::const_iterator aIter=myIndixes.find(theAxisNumber);
+  if(aIter==myIndixes.end())
+    EXCEPTION(std::runtime_error, "const TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber); fails");
+  return aIter->second;
+}
+
+TFloatVector&
+TGrilleInfo
+::GetIndexes(TInt theAxisNumber)
+{
+  TIndexes::iterator aIter=myIndixes.find(theAxisNumber);
+  if(aIter==myIndixes.end())
+    EXCEPTION(std::runtime_error, "TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber="<<theAxisNumber<<"); fails");
+  return aIter->second;
+}
+
+TInt
+TGrilleInfo
+::GetNbIndexes(TInt theAxisNumber)
+{
+  const TFloatVector& aVector=GetIndexes(theAxisNumber);
+  return aVector.size();
+}
+
+TInt
+TGrilleInfo
+::GetNbNodes()
+{
+  TInt nbNodes=0;
+  TInt aDim = myMeshInfo->GetDim();
+  for(int i=0;i<aDim;i++)
+    if(nbNodes == 0)
+      nbNodes = this->GetGrilleStructure()[i];
+    else
+      nbNodes = nbNodes*this->GetGrilleStructure()[i];
+  return nbNodes;
+}
+
+TInt
+TGrilleInfo
+::GetNbCells()
+{
+  TInt nbCells=0;
+  TInt aDim = myMeshInfo->GetDim();
+  for(int i=0;i<aDim;i++)
+    if(nbCells == 0)
+      nbCells = this->GetGrilleStructure()[i]-1;
+    else
+      nbCells = nbCells*(this->GetGrilleStructure()[i]-1);
+  return nbCells;
+}
+
+TInt
+TGrilleInfo
+::GetNbSubCells()
+{
+  TInt nb=0;
+  TInt aDim = myMeshInfo->GetDim();
+  switch (aDim) {
+  case 3:
+    nb =
+      (myGrilleStructure[0]  ) * (myGrilleStructure[1]-1) * (myGrilleStructure[2]-1) +
+      (myGrilleStructure[0]-1) * (myGrilleStructure[1]  ) * (myGrilleStructure[2]-1) +
+      (myGrilleStructure[0]-1) * (myGrilleStructure[1]-1) * (myGrilleStructure[2]  );
+    break;
+  case 2:
+    nb =
+      (myGrilleStructure[0]  ) * (myGrilleStructure[1]-1) +
+      (myGrilleStructure[0]-1) * (myGrilleStructure[1]  );
+    break;
+  }
+  return nb;
+}
+
+EGeometrieElement
+TGrilleInfo
+::GetGeom()
+{
+  TInt aDim = myMeshInfo->GetDim();
+  switch(aDim){
+  case 1:
+    return eSEG2;
+  case 2:
+    return eQUAD4;
+  case 3:
+    return eHEXA8;
+  default:
+    return eNONE;
+  }
+}
+
+EGeometrieElement
+TGrilleInfo
+::GetSubGeom()
+{
+  TInt aDim = myMeshInfo->GetDim();
+  switch(aDim){
+  case 2:
+    return eSEG2;
+  case 3:
+    return eQUAD4;
+  }
+  return eNONE;
+}
+
+EEntiteMaillage
+TGrilleInfo
+::GetEntity()
+{
+  return eMAILLE;
+}
+
+EEntiteMaillage
+TGrilleInfo
+::GetSubEntity()
+{
+  TInt aDim = myMeshInfo->GetDim();
+  switch(aDim){
+  case 2:
+    return eARETE;
+  case 3:
+    return eFACE;
+  }
+  return EEntiteMaillage(-1);
+}
+
+const
+TIntVector&
+TGrilleInfo
+::GetGrilleStructure() const
+{
+  return myGrilleStructure;
+}
+
+TIntVector
+TGrilleInfo
+::GetGrilleStructure()
+{
+  return myGrilleStructure;
+}
+
+void
+TGrilleInfo
+::SetGrilleStructure(TInt theAxis,TInt theNb)
+{
+  if(theAxis >= 0 && theAxis <=2 && theNb >= 0)
+  myGrilleStructure[theAxis]=theNb;
+}
+
+const
+TNodeCoord&
+TGrilleInfo
+::GetNodeCoord() const
+{
+  return myCoord;
+}
+
+TNodeCoord&
+TGrilleInfo
+::GetNodeCoord()
+{
+  return myCoord;
+}
+
+TNodeCoord
+TGrilleInfo
+::GetCoord(TInt theId)
+{
+  TNodeCoord aCoord;
+  TInt aDim       = myMeshInfo->GetDim();
+  TInt aNbNodes   = this->GetNbNodes();
+  aCoord.resize(aDim);
+  
+  if(theId >= aNbNodes)
+    EXCEPTION(std::runtime_error, "TGrilleInfo::GetCoord - theId out of range");
+
+  if(myGrilleType == eGRILLE_STANDARD){
+    switch(aDim){
+    case 3:
+      aCoord[2] = myCoord[aDim*theId+2];
+    case 2:
+      aCoord[1] = myCoord[aDim*theId+1];
+    case 1:{
+      aCoord[0] = myCoord[aDim*theId];
+      break;
+    }
+    }
+  } else {
+
+    TFloatVector aVecX  = this->GetIndexes(0);
+    TInt nbIndxX        = this->GetNbIndexes(0);
+    
+    switch(aDim){
+    case 1:{
+      aCoord[0] = aVecX[theId];
+      break;
+    }
+    case 2:{
+      TFloatVector aVecY = this->GetIndexes(1);
+      TInt i,j,k;
+      i = j = k = 0;
+      i = theId % nbIndxX;
+      j = theId / nbIndxX;
+      if(myGrilleType == eGRILLE_CARTESIENNE){
+        aCoord[0] = aVecX[i];
+        aCoord[1] = aVecY[j];
+      } else { // eGRILLE_POLAIRE (cylindrical)
+        aCoord[0] = aVecX[i] * cos(aVecY[j]);
+        aCoord[1] = aVecX[i] * sin(aVecY[j]);
+      }
+      break;
+    }
+    case 3:{
+      TFloatVector aVecY = this->GetIndexes(1);
+      TInt nbIndxY       = this->GetNbIndexes(1);
+      TFloatVector aVecZ = this->GetIndexes(2);
+      TInt i,j,k;
+      i = j = k = 0;
+      
+      i = theId % nbIndxX;
+      j = (theId / nbIndxX) % nbIndxY;
+      k = theId / (nbIndxX*nbIndxY);
+
+      if(myGrilleType == eGRILLE_CARTESIENNE){
+        aCoord[0] = aVecX[i];
+        aCoord[1] = aVecY[j];
+        aCoord[2] = aVecZ[k];
+      } else { // eGRILLE_POLAIRE (cylindrical)
+        aCoord[0] = aVecX[i] * cos(aVecY[j]);
+        aCoord[1] = aVecX[i] * sin(aVecY[j]);
+        aCoord[2] = aVecZ[k];
+      }
+      
+      break;
+    }
+    }
+  }
+
+  return aCoord;
+}
+
+TIntVector
+TGrilleInfo
+::GetConn(TInt theId, const bool isSub)
+{
+  TIntVector anIndexes;
+  TInt aDim = myMeshInfo->GetDim();
+
+  TInt idx;
+  TInt iMin, jMin, kMin, iMax, jMax, kMax;
+  TInt loc[3];
+
+  loc[0] = loc[1] = loc[2] = 0;
+  iMin = iMax = jMin = jMax = kMin = kMax = 0;
+
+  switch(aDim) {
+  case 3:
+    {
+      TInt nbX = this->GetGrilleStructure()[0];
+      TInt nbY = this->GetGrilleStructure()[1];
+      TInt nbZ = this->GetGrilleStructure()[2];
+      TInt d01 = nbX*nbY, dX = 1, dY = 1, dZ = 1;
+      if ( isSub )
+      {
+        if ( theId < nbX * (nbY-1) * (nbZ-1))
+        { // face is normal to X axis
+          dX = 0;
+        }
+        else if ( theId < nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1))
+        {  // face is normal to Y axis
+          theId -= nbX * (nbY-1) * (nbZ-1);
+          dY = 0;
+        }
+        else
+        {
+          theId -= nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1);
+          dZ = 0;
+        }
+      }
+      //else
+      {
+        iMin = theId % (nbX - dX);
+        jMin = (theId / (nbX - dX)) % (nbY - dY);
+        kMin = theId / ((nbX - dX) * (nbY - dY));
+        iMax = iMin+dX;
+        jMax = jMin+dY;
+        kMax = kMin+dZ;
+      }
+      for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
+        for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
+          for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
+          {
+            idx = loc[0] + loc[1]*nbX + loc[2]*d01;
+            anIndexes.push_back(idx);
+          }
+      break;
+    }
+  case 2:
+    {
+      TInt nbX = this->GetGrilleStructure()[0];
+      TInt nbY = this->GetGrilleStructure()[1];
+      TInt dX = 1, dY = 1;
+      if ( isSub )
+      {
+        if ( theId < nbX * (nbY-1))
+        { // edge is normal to X axis
+          dX = 0;
+        }
+        else
+        {
+          theId -= nbX * (nbY-1);
+          dY = 0;
+        }
+      }
+      iMin = theId % (nbX-dX);
+      jMin = theId / (nbX-dX);
+      iMax = iMin+dX;
+      jMax = jMin+dY;
+      for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
+        for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
+        {
+          idx = loc[0] + loc[1]*nbX;
+          anIndexes.push_back(idx);
+        }
+      break;
+    }
+  case 1:
+    {
+      iMin = theId;
+      for (loc[0]=iMin; loc[0]<=iMin+1; loc[0]++)
+      {
+        idx = loc[0];
+        anIndexes.push_back(idx);
+      }
+      break;
+    }
+  }
+
+  return anIndexes;
+}
+
+TInt
+TGrilleInfo
+::GetFamNumNode(TInt theId) const 
+{
+  return myFamNumNode[theId];
+}
+
+void
+TGrilleInfo
+::SetFamNumNode(TInt theId,TInt theVal) 
+{
+  myFamNumNode[theId] = theVal;
+}
+
+TInt
+TGrilleInfo
+::GetFamNum(TInt theId) const 
+{
+  return myFamNum[theId];
+}
+
+void
+TGrilleInfo
+::SetFamNum(TInt theId,TInt theVal) 
+{
+  myFamNum[theId] = theVal;
+}
+
+TInt
+TGrilleInfo
+::GetFamSubNum(TInt theId) const 
+{
+  return myFamSubNum[theId];
+}
+
+void
+TGrilleInfo
+::SetFamSubNum(TInt theId,TInt theVal) 
+{
+  myFamSubNum[theId] = theVal;
+}
diff --git a/src/MEDWrapper/Base/MED_Structures.hxx b/src/MEDWrapper/Base/MED_Structures.hxx
new file mode 100644 (file)
index 0000000..bcd361a
--- /dev/null
@@ -0,0 +1,1081 @@
+// Copyright (C) 2007-2013  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
+//
+
+#ifndef MED_Structures_HeaderFile
+#define MED_Structures_HeaderFile
+
+#include "MED_Common.hxx"
+#include "MED_Utilities.hxx"
+
+#ifdef WIN32
+#pragma warning(disable:4251)
+#endif
+
+namespace MED
+{
+
+  //---------------------------------------------------------------
+  //! Defines a type for managing sequence of strings
+  typedef TVector<char> TString; 
+  typedef SharedPtr<TString> PString;
+
+  //! Extract a substring from the sequence of the strings
+  MEDWRAPPER_EXPORT
+  std::string 
+  GetString(TInt theId, TInt theStep, 
+            const TString& theString);
+  
+  //! Set a substring in the sequence of the strings
+  MEDWRAPPER_EXPORT 
+  void
+  SetString(TInt theId, TInt theStep, 
+                 TString& theString, 
+                 const std::string& theValue);
+
+  //! Set a substring in the sequence of the strings
+  MEDWRAPPER_EXPORT
+  void
+  SetString(TInt theId, TInt theStep, 
+                 TString& theString, 
+                 const TString& theValue);
+
+  //---------------------------------------------------------------
+  //! Define a parent class for all MEDWrapper classes
+  struct MEDWRAPPER_EXPORT TBase
+  {
+    virtual ~TBase() {} 
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a parent class for all named MED entities
+  struct MEDWRAPPER_EXPORT TNameInfo: virtual TBase
+  {
+    TString myName; //!< Keeps its name
+    virtual std::string GetName() const = 0; //!< Gets its name
+    virtual void SetName(const std::string& theValue) = 0; //!< Set a new name
+    virtual void SetName(const TString& theValue) = 0; //!< Set a new name
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a parent class for all MED entities that contains a sequence of numbers
+  /*!
+    It defines through corresponding enumeration (EModeSwitch) how the sequence 
+    should be interpreted in C or Fortran mode (eFULL_INTERLACE or eNON_INTERLACE).
+  */
+  struct MEDWRAPPER_EXPORT TModeSwitchInfo: virtual TBase
+  {
+    //! To construct instance of the class by default
+    TModeSwitchInfo():
+      myModeSwitch(eFULL_INTERLACE)
+    {}
+
+    //! To construct instance of the class
+    TModeSwitchInfo(EModeSwitch theModeSwitch):
+      myModeSwitch(theModeSwitch)
+    {}
+
+    EModeSwitch myModeSwitch; //!< Keeps the 
+    EModeSwitch GetModeSwitch() const { return myModeSwitch;}
+  };
+
+
+  //---------------------------------------------------------------
+  //! Define a base class which represents MED Mesh entity
+  struct MEDWRAPPER_EXPORT TMeshInfo: virtual TNameInfo
+  {
+    TInt myDim; //!< Dimension of the mesh (0, 1, 2 or 3)
+    TInt GetDim() const { return myDim;} //!< Gets dimension of the mesh
+
+    TInt mySpaceDim;
+    TInt GetSpaceDim() const { return mySpaceDim; }
+
+    EMaillage myType; //!< Type of the mesh
+    EMaillage GetType() const { return myType;} //!< Gets type of the mesh
+
+    TString myDesc; //!< Description of the mesh
+    virtual std::string GetDesc() const = 0; //!< Get description for the mesh
+    virtual void SetDesc(const std::string& theValue) = 0; //!< Sets description for the mesh
+
+    
+  };
+  
+
+  //---------------------------------------------------------------
+  typedef TVector<TInt> TIntVector;
+  typedef TSlice<TInt> TIntVecSlice;
+  typedef TCSlice<TInt> TCIntVecSlice;
+
+  typedef TIntVector TFamAttr;
+
+  //! Define a base class which represents MED Family entity
+  struct MEDWRAPPER_EXPORT TFamilyInfo: virtual TNameInfo
+  {
+    PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
+    //! Get a reference to corresponding MED Mesh
+    const PMeshInfo& GetMeshInfo() const { return myMeshInfo;} 
+
+    TInt myId; //!< An unique index of the MED FAMILY
+    TInt GetId() const { return myId;} //!< Gets number of the MED FAMILY
+    void SetId(TInt theId) { myId = theId;} //! Define number of the MED FAMILY
+
+    TInt myNbGroup; //!< Defines number MED Groups connected to
+    //! Gets number of MED GROUPS the MED FAMILY is bound to
+    TInt GetNbGroup() const { return myNbGroup;} 
+
+    //! Contains sequence of the names for the MED Groups connected to
+    TString myGroupNames; 
+    //! Gets name of a bound MED GROUP by its number
+    virtual std::string GetGroupName(TInt theId) const = 0;
+    //! Sets name of the defined MED GROUP by its number
+    virtual void SetGroupName(TInt theId, const std::string& theValue) = 0;
+
+    TInt myNbAttr; //!< Defines number of the MED Family attributes 
+    //! Gets number of attached attributes for the MED FAMILY
+    TInt GetNbAttr() const { return myNbAttr;} 
+
+    //! Defines sequence of the indexes of the MED Family attributes
+    TFamAttr myAttrId; 
+    //! Get MED FAMILY attribute by its number
+    TInt GetAttrId(TInt theId) const;
+    //! Set MED FAMILY attribute by its number
+    void SetAttrId(TInt theId, TInt theVal);
+
+    //! Defines sequence of the values of the MED Family attributes
+    TFamAttr myAttrVal;
+    //! Get MED FAMILY attribute by its number
+    TInt GetAttrVal(TInt theId) const;
+    //! Set MED FAMILY attribute by its number
+    void SetAttrVal(TInt theId, TInt theVal);
+
+    //! Defines sequence of the names of the MED Family attributes
+    TString myAttrDesc;
+    //! Get value of the MED FAMILY attribute by its number
+    virtual std::string GetAttrDesc(TInt theId) const = 0;
+    //! Set value of the MED FAMILY attribute by its number
+    virtual void SetAttrDesc(TInt theId, const std::string& theValue) = 0;
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TIntVector TElemNum;
+  typedef SharedPtr<TElemNum> PElemNum;
+  
+  //! Define a parent class for all MED entities that describes mesh entites such as nodes and cells.
+  struct MEDWRAPPER_EXPORT TElemInfo: virtual TBase
+  {
+    PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
+    //! Get a reference to corresponding MED Mesh
+    const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+
+    TInt myNbElem; //<! Number of corresponding mesh entities
+    TInt GetNbElem() const { return myNbElem;} //! Get number of mesh elements
+    
+    //! Defines sequence MED Family indexes for corresponding mesh entites
+    PElemNum myFamNum; 
+    //! Get number of a MED FAMILY by order number of the mesh element
+    TInt GetFamNum(TInt theId) const;
+    //! Set number of a MED FAMILY for the mesh element with the  order number
+    void SetFamNum(TInt theId, TInt theVal);
+
+    //! Defines if the mesh elements are indexed
+    EBooleen myIsElemNum;
+    //! Let know if the mesh elements are indexed
+    EBooleen IsElemNum() const { return myIsElemNum;}
+    
+    //! Defines if the mesh elements family are indexed
+    EBooleen myIsFamNum;
+    //! Let know if the mesh elements family are indexed
+    EBooleen IsFamNum() const { return myIsFamNum;}
+    
+
+    //! Contains sequence of the indexes for the mesh elements
+    PElemNum myElemNum;
+    //! Get a reference number of the mesh element by its order number
+    TInt GetElemNum(TInt theId) const;
+    //! Set a reference number for the mesh element by its order number
+    void SetElemNum(TInt theId, TInt theVal);
+
+    //! Defines if the mesh elements are named
+    EBooleen myIsElemNames;
+    //! Let know if the mesh elements havew names
+    EBooleen IsElemNames() const { return myIsElemNames;}
+
+    //! Contains sequence of the names for the mesh elements
+    PString myElemNames;
+    //! Get name of the mesh element by its order number
+    virtual std::string GetElemName(TInt theId) const = 0;
+    //! Set name of the mesh element by its order number
+    virtual void SetElemName(TInt theId, const std::string& theValue) = 0;
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TVector<TFloat> TFloatVector;
+  typedef TSlice<TFloat> TFloatVecSlice;
+  typedef TCSlice<TFloat> TCFloatVecSlice;
+
+  typedef TFloatVector TNodeCoord;
+  typedef SharedPtr<TNodeCoord> PNodeCoord;
+
+  typedef TFloatVecSlice TCoordSlice;
+  typedef TCFloatVecSlice TCCoordSlice;
+
+  //! Define a base class which represents MED Nodes entity
+  struct MEDWRAPPER_EXPORT TNodeInfo: 
+    virtual TElemInfo,
+    virtual TModeSwitchInfo 
+  {
+    PNodeCoord myCoord; //!< Contains all nodal coordinates
+
+    //! Gives coordinates for mesh node by its number (const version)
+    TCCoordSlice GetCoordSlice(TInt theId) const;
+    //! Gives coordinates for mesh node by its number
+    TCoordSlice GetCoordSlice(TInt theId);
+
+    ERepere mySystem; //!< Defines, which coordinate system is used
+    //! Get which coordinate system is used for the node describing
+    ERepere GetSystem() const { return mySystem;}
+    //! Set coordinate system to be used for the node describing
+    void SetSystem(ERepere theSystem) { mySystem = theSystem;}
+
+    TString myCoordNames; //!< Contains names for the coordinate dimensions
+    //! Get name of the coordinate dimension by its order number
+    virtual std::string GetCoordName(TInt theId) const = 0;
+    //! Set name of the coordinate dimension by its order number
+    virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
+
+    TString myCoordUnits; //!< Contains units for the coordinate dimensions
+    //! Get name of unit for the coordinate dimension by its order number
+    virtual std::string GetCoordUnit(TInt theId) const = 0;
+    //! Set name of unit for the coordinate dimension by its order number
+    virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TIntVecSlice TConnSlice;
+  typedef TCIntVecSlice TCConnSlice;
+
+  //! Define a base class which represents MED Cells entity
+  struct MEDWRAPPER_EXPORT TCellInfo: 
+    virtual TElemInfo,
+    virtual TModeSwitchInfo 
+  {
+    EEntiteMaillage myEntity; //!< Defines the MED Entity where the mesh cells belongs to
+    //! Let known what MED ENTITY the cells belong to
+    EEntiteMaillage GetEntity() const { return myEntity;}
+
+    EGeometrieElement myGeom; //!< Defines the MED Geometric type of the instance
+    //! Let known what MED geometrical type the cells belong to
+    EGeometrieElement GetGeom() const { return myGeom;}
+
+    EConnectivite myConnMode; //!< Defines connectivity mode
+    //! Let known in what connectivity the cells are writen
+    EConnectivite GetConnMode() const { return myConnMode;}
+
+    virtual TInt GetConnDim() const = 0; //!< Gives step in the connectivity sequence
+
+    PElemNum myConn; //!< Defines sequence which describe connectivity for each of mesh cell
+
+    //! Gives connectivities for mesh cell by its number (const version)
+    TCConnSlice GetConnSlice(TInt theElemId) const;
+    //! Gives connectivities for mesh cell by its number
+    TConnSlice GetConnSlice(TInt theElemId);
+  };
+
+  //---------------------------------------------------------------
+  //! Define a base class which represents MED Polygon entity
+  struct MEDWRAPPER_EXPORT TPolygoneInfo: 
+    virtual TElemInfo
+  {
+    //! Defines the MED Entity where the polygons belongs to
+    EEntiteMaillage myEntity; // MED_FACE|MED_MAILLE
+    //! Let known what MED ENTITY the MED Polygons belong to
+    EEntiteMaillage GetEntity() const { return myEntity;}
+
+    //! Defines the MED Geometric type of the instance
+    EGeometrieElement myGeom; // ePOLYGONE
+    //! Let known what MED geometrical type the MED Polygons belong to
+    EGeometrieElement GetGeom() const { return ePOLYGONE;}
+
+    //! Defines connectivity mode
+    EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
+    //! Let known in what connectivity the cells are writen
+    EConnectivite GetConnMode() const { return myConnMode;}
+
+    PElemNum myConn; //!< Table de connectivities
+    PElemNum myIndex; //!< Table de indexes
+
+    //! Gives number of the connectivities for the defined polygon
+    TInt GetNbConn(TInt theElemId) const;
+
+    //! Gives connectivities for polygon by its number (const version)
+    TCConnSlice GetConnSlice(TInt theElemId) const;
+    //! Gives connectivities for polygon by its number
+    TConnSlice GetConnSlice(TInt theElemId);
+  };
+
+  //---------------------------------------------------------------
+  //! Define a class representing MED_BALL structure element.
+  //
+  //  This could be a generic class for any structure element
+  //  holding any number of contant and variable attributes
+  //  but it's too hard to implement
+  //
+  struct MEDWRAPPER_EXPORT TBallInfo: 
+    virtual TCellInfo
+  {
+    TFloatVector myDiameters;
+  };
+
+  //---------------------------------------------------------------
+  typedef TVector<TCConnSlice> TCConnSliceArr;
+  typedef TVector<TConnSlice> TConnSliceArr;
+
+  //! Define a base class which represents MED Polyedre entity
+  struct MEDWRAPPER_EXPORT TPolyedreInfo: 
+    virtual TElemInfo
+  {
+    //! Defines the MED Entity where the polyedres belongs to
+    EEntiteMaillage myEntity; // MED_FACE|MED_MAILLE
+    //! Let known what MED ENTITY the MED Polyedres belong to
+    EEntiteMaillage GetEntity() const { return myEntity;}
+
+    //! Defines the MED Geometric type of the instance
+    EGeometrieElement myGeom; // ePOLYEDRE
+    //! Let known what MED geometrical type the MED Polyedres belong to
+    EGeometrieElement GetGeom() const { return ePOLYEDRE;}
+
+    //! Defines connectivity mode
+    EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
+    //! Let known in what connectivity the cells are writen
+    EConnectivite GetConnMode() const { return myConnMode;}
+
+    PElemNum myConn; //!< Table de connectivities
+    PElemNum myFaces; //!< Table de faces indexes
+    PElemNum myIndex; //!< Table de indexes
+
+    //! Gives number of the faces for the defined polyedre (const version)
+    TInt GetNbFaces(TInt theElemId) const;
+    //! Gives number of the nodes for the defined polyedre
+    TInt GetNbNodes(TInt theElemId) const;
+
+    //! Gives sequence of the face connectivities for polyedre by its number (const version)
+    TCConnSliceArr GetConnSliceArr(TInt theElemId) const;
+    //! Gives sequence of the face connectivities for polyedre by its number
+    TConnSliceArr GetConnSliceArr(TInt theElemId);
+  };
+
+  //---------------------------------------------------------------
+  //! Define a base class which represents MED Field entity
+  struct MEDWRAPPER_EXPORT TFieldInfo: 
+    virtual TNameInfo
+  {
+    PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
+    //! Get a reference to corresponding MED Mesh
+    const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+
+    ETypeChamp myType; //!< Defines type of the MED Field
+    //! Let known what type of the MED FIELD is used
+    ETypeChamp GetType() const { return myType;}
+
+    TInt myNbComp; //!< Defines number of components stored in the field
+    //! Get number of components for the MED FIELD
+    TInt GetNbComp() const { return myNbComp;}
+
+    EBooleen myIsLocal; //!< Defines if the MED Field is local
+    //! Let known is the MED FIELD is local or not
+    EBooleen GetIsLocal() const { return myIsLocal;}
+
+    TInt myNbRef; //!< Defines number of refereces of the field
+    //! Let known number of references for the MED FIELD
+    TInt GetNbRef() const { return myNbRef;}
+
+    TString myCompNames; //!< Contains names for each of MED Field components
+    //! Get name of the component by its order number
+    virtual std::string GetCompName(TInt theId) const = 0;
+    //! Set name for the component by its order number
+    virtual void SetCompName(TInt theId, const std::string& theValue) = 0;
+
+    TString myUnitNames; //!< Contains units for each of MED Field components
+    //! Get unit of the component by its order number
+    virtual std::string GetUnitName(TInt theId) const = 0;
+    //! Set unit for the component by its order number
+    virtual void SetUnitName(TInt theId, const std::string& theValue) = 0;
+
+  };
+
+
+  //---------------------------------------------------------------
+  //! Get dimension of the Gauss coordinates for the defined type of mesh cell
+  MEDWRAPPER_EXPORT
+  TInt
+  GetDimGaussCoord(EGeometrieElement theGeom);
+
+  //! Get number of referenced nodes for the defined type of mesh cell
+  MEDWRAPPER_EXPORT
+  TInt
+  GetNbRefCoord(EGeometrieElement theGeom);
+
+  typedef TFloatVector TWeight;
+
+  //! The class represents MED Gauss entity
+  struct MEDWRAPPER_EXPORT TGaussInfo: 
+    virtual TNameInfo,
+    virtual TModeSwitchInfo 
+  {
+    typedef boost::tuple<EGeometrieElement,std::string> TKey;
+    typedef boost::tuple<TKey,TInt> TInfo;
+    struct MEDWRAPPER_EXPORT TLess
+    {
+      bool
+      operator()(const TKey& theLeft, const TKey& theRight) const;
+
+      bool
+      operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const;
+    };
+
+    //! Defines, which geometrical type the MED Gauss entity belongs to
+    EGeometrieElement myGeom; 
+    //! Let known what MED geometrical type the MED GAUSS entity belong to
+    EGeometrieElement GetGeom() const { return myGeom;}
+
+    //! Contains coordinates for the refereced nodes
+    TNodeCoord myRefCoord; 
+
+    //! Gives coordinates for the referenced node by its number
+    TCCoordSlice GetRefCoordSlice(TInt theId) const;
+    //! Gives coordinates for the referenced node by its number
+    TCoordSlice GetRefCoordSlice(TInt theId);
+
+    //! Contains coordinates for the Gauss points
+    TNodeCoord myGaussCoord;
+
+    //! Gives coordinates for the Gauss points by its number
+    TCCoordSlice GetGaussCoordSlice(TInt theId) const;
+    //! Gives coordinates for the Gauss points by its number
+    TCoordSlice GetGaussCoordSlice(TInt theId);
+
+    //! Contains wheights for the Gauss points
+    TWeight myWeight;
+
+    //! Gives number of the referenced nodes
+    TInt GetNbRef() const { return GetNbRefCoord(GetGeom());}
+
+    //! Gives dimension of the referenced nodes
+    TInt GetDim() const { return GetDimGaussCoord(GetGeom());}
+
+    //! Gives number of the Gauss Points
+    TInt GetNbGauss() const { return (TInt)(myGaussCoord.size()/GetDim());}
+  };
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometrieElement,PGaussInfo> TGeom2Gauss;
+  typedef std::map<EGeometrieElement,TInt> TGeom2NbGauss;
+
+  //! Define a base class which represents MED TimeStamp
+  struct MEDWRAPPER_EXPORT TTimeStampInfo: 
+    virtual TBase
+  {
+    PFieldInfo myFieldInfo; //!< A reference to correspondig MED Field
+    //! Get a reference to corresponding MED Field
+    const PFieldInfo& GetFieldInfo() const { return myFieldInfo;}
+
+    //! Defines the MED Entity where the MED TimeStamp belongs to
+    EEntiteMaillage myEntity;
+    //! Let known to what MED Entity the MED TimeStamp belong to
+    EEntiteMaillage GetEntity() const { return myEntity;}
+
+    //! Keeps map of number of cells per geometric type where the MED TimeStamp belongs to
+    TGeom2Size myGeom2Size;
+    //! Get map of number of cells per geometric type where the MED TimeStamp belongs to
+    const TGeom2Size& GetGeom2Size() const { return myGeom2Size;}
+
+    TGeom2NbGauss myGeom2NbGauss; //!< Keeps number of the Gauss Points for the MED TimeStamp
+    TInt GetNbGauss(EGeometrieElement theGeom) const; //!< Gives number of the Gauss Points for the MED TimeStamp
+
+    TInt myNumDt; //!< Keeps number in time for the MED TimeStamp
+    TInt GetNumDt() const { return myNumDt;} //!< Defines number in time for the MED TimeStamp
+
+    TInt myNumOrd; //!< Keeps number for the MED TimeStamp
+    TInt GetNumOrd() const { return myNumOrd;} //!< Defines number for the MED TimeStamp
+
+    TFloat myDt; //!< Keeps time for the MED TimeStamp
+    TFloat GetDt() const { return myDt;} //!< Defines time for the MED TimeStamp
+
+    //! Keeps map of MED Gauss entityes per geometric type
+    TGeom2Gauss myGeom2Gauss;
+    //! Gets a map of MED Gauss entityes per geometric type
+    const TGeom2Gauss& GetGeom2Gauss() const { return myGeom2Gauss;}
+
+    TString myUnitDt; //!< Defines unit for the time for the MED TimeStamp
+    //! Get unit of time for the MED TimeStamp
+    virtual std::string GetUnitDt() const = 0;
+    //! Set unit of time for the MED TimeStamp
+    virtual void SetUnitDt(const std::string& theValue) = 0;
+  };
+  
+
+  //---------------------------------------------------------------
+  //! The class represents MED Profile entity
+  struct MEDWRAPPER_EXPORT TProfileInfo: 
+    virtual TNameInfo
+  {
+    typedef std::string TKey;
+    typedef boost::tuple<TKey,TInt> TInfo;
+
+    EModeProfil myMode; //!< Keeps mode for the MED Profile
+    //! Let known what mode of MED Profile is used
+    EModeProfil GetMode() const { return myMode;}
+    //! Set mode for the MED Profile
+    void SetMode(EModeProfil theMode) { myMode = theMode;}
+
+    PElemNum myElemNum; //!< Keeps sequence of cell by its number which belong to the profile
+    //! Get number of mesh elelemts by its order number
+    TInt GetElemNum(TInt theId) const;
+    //! Set number of mesh elelemts by its order number
+    void SetElemNum(TInt theId, TInt theVal);
+
+    //! Let known is the MED Profile defined
+    bool IsPresent() const { return GetName() != "";}
+
+    //! Let known size of the MED Profile
+    TInt GetSize() const { return (TInt)myElemNum->size();}
+  };
+
+
+  //---------------------------------------------------------------
+  //! The class is a helper one. It provide safe and flexible way to get access to values for a MED TimeStamp
+  struct MEDWRAPPER_EXPORT TMeshValueBase:
+    virtual TModeSwitchInfo 
+  {
+    TInt myNbElem;
+    TInt myNbComp;
+    TInt myNbGauss;
+    TInt myStep;
+
+    TMeshValueBase();
+
+    //! Initialize the class
+    void
+    Allocate(TInt theNbElem,
+             TInt theNbGauss,
+             TInt theNbComp,
+             EModeSwitch theMode = eFULL_INTERLACE);
+
+    //! Returns size of the value container
+    size_t
+    GetSize() const;
+    
+    //! Returns MED interpetation of the value size
+    size_t
+    GetNbVal() const;
+    
+    //! Returns number of Gauss Points bounded with the value
+    size_t
+    GetNbGauss() const;
+    
+    //! Returns step inside of the data array
+    size_t
+    GetStep() const;
+    
+    //! Returns bare pointer on the internal value representation
+    virtual
+    unsigned char*
+    GetValuePtr() = 0;
+  };
+
+  //---------------------------------------------------------------
+  //! The class is a helper one. It provide safe and flexible way to get access to values for a MED TimeStamp
+  template<class TValueType>
+  struct TTMeshValue:
+    virtual TMeshValueBase 
+  {
+    typedef TValueType TValue;
+    typedef typename TValueType::value_type TElement;
+
+    typedef TSlice<TElement> TValueSlice;
+    typedef TCSlice<TElement> TCValueSlice;
+    
+    typedef TVector<TCValueSlice> TCValueSliceArr;
+    typedef TVector<TValueSlice> TValueSliceArr;
+    
+    TValue myValue;
+
+    //! Initialize the class
+    void
+    Allocate(TInt theNbElem,
+             TInt theNbGauss,
+             TInt theNbComp,
+             EModeSwitch theMode = eFULL_INTERLACE)
+    {
+      TMeshValueBase::Allocate(theNbElem, theNbGauss, theNbComp, theMode);
+      myValue.resize(theNbElem * this->GetStep());
+    }
+
+    //! Returns bare pointer on the internal value representation
+    virtual
+    unsigned char*
+    GetValuePtr()
+    {
+      return (unsigned char*)&myValue[0];
+    }
+
+    //! Returns bare pointer on the internal value representation
+    virtual
+    TElement*
+    GetPointer()
+    {
+      return &myValue[0];
+    }
+
+    //! Returns bare pointer on the internal value representation
+    virtual
+    const TElement*
+    GetPointer() const
+    {
+      return &myValue[0];
+    }
+
+    //! Iteration through Gauss Points by their components
+    TCValueSliceArr
+    GetGaussValueSliceArr(TInt theElemId) const
+    {
+      TCValueSliceArr aValueSliceArr(myNbGauss);
+      if(GetModeSwitch() == eFULL_INTERLACE){
+        TInt anId = theElemId * myStep;
+        for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+          aValueSliceArr[aGaussId] =
+            TCValueSlice(myValue, std::slice(anId, myNbComp, 1));
+          anId += myNbComp;
+        }
+      }
+      else{
+        for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+          aValueSliceArr[aGaussId] =
+            TCValueSlice(myValue, std::slice(theElemId, myNbComp, myStep));
+        }
+      }
+      return aValueSliceArr;
+    }
+
+    //! Iteration through Gauss Points by their components
+    TValueSliceArr 
+    GetGaussValueSliceArr(TInt theElemId)
+    {
+      TValueSliceArr aValueSliceArr(myNbGauss);
+      if(GetModeSwitch() == eFULL_INTERLACE){
+        TInt anId = theElemId*myStep;
+        for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+          aValueSliceArr[aGaussId] =
+            TValueSlice(myValue, std::slice(anId, myNbComp, 1));
+          anId += myNbComp;
+        }
+      }
+      else{
+        for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+          aValueSliceArr[aGaussId] =
+            TValueSlice(myValue, std::slice(theElemId, myNbComp, myStep));
+        }
+      }
+      return aValueSliceArr;
+    }
+
+    //! Iteration through components by corresponding Gauss Points
+    TCValueSliceArr
+    GetCompValueSliceArr(TInt theElemId) const
+    {
+      TCValueSliceArr aValueSliceArr(myNbComp);
+      if(GetModeSwitch() == eFULL_INTERLACE){
+        TInt anId = theElemId*myStep;
+        for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
+          aValueSliceArr[aCompId] =
+            TCValueSlice(myValue, std::slice(anId, myNbGauss, myNbComp));
+          anId += 1;
+        }
+      }
+      else{
+        for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
+          aValueSliceArr[aCompId] =
+            TCValueSlice(myValue, std::slice(theElemId, myNbGauss, myStep));
+        }
+      }
+      return aValueSliceArr;
+    }
+
+    //! Iteration through components by corresponding Gauss Points
+    TValueSliceArr 
+    GetCompValueSliceArr(TInt theElemId)
+    {
+      if(GetModeSwitch() == eFULL_INTERLACE){
+        TValueSliceArr aValueSliceArr(myNbComp);
+        TInt anId = theElemId*myStep;
+        for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
+          aValueSliceArr[aCompId] =
+            TValueSlice(myValue, std::slice(anId, myNbGauss, myNbComp));
+          anId += 1;
+        }
+        return aValueSliceArr;
+      }
+      else{
+        TValueSliceArr aValueSliceArr(myNbGauss);
+        for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+          aValueSliceArr[aGaussId] =
+            TValueSlice(myValue,std::slice(theElemId, myNbComp, myStep));
+        }
+        return aValueSliceArr;
+      }
+    }
+  };
+
+  typedef TTMeshValue<TFloatVector> TFloatMeshValue;
+  typedef TTMeshValue<TIntVector> TIntMeshValue;
+
+  //---------------------------------------------------------------
+  // Backward compatibility  declarations
+  typedef TFloatVector TValue;
+  typedef TSlice<TFloat> TValueSlice;
+  typedef TCSlice<TFloat> TCValueSlice;
+  
+  typedef TVector<TCValueSlice> TCValueSliceArr;
+  typedef TVector<TValueSlice> TValueSliceArr;
+    
+  typedef TFloatMeshValue TMeshValue;
+  typedef std::map<EGeometrieElement,TMeshValue> TGeom2Value;
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometrieElement,PProfileInfo> TGeom2Profile;
+  typedef std::set<EGeometrieElement> TGeom;
+
+  //! The class is a base class for MED TimeStamp values holder
+  struct MEDWRAPPER_EXPORT TTimeStampValueBase: 
+    virtual TModeSwitchInfo 
+  {
+    //! A reference to correspondig MED TimeStamp
+    PTimeStampInfo myTimeStampInfo;
+    //!< Get a reference to correspondig MED TimeStamp
+    const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo;}
+
+    //! Keeps set of MED EGeometrieElement which contains values for the timestamp
+    TGeomSet myGeomSet;
+    const TGeomSet& GetGeomSet() const { return myGeomSet;}
+
+    //! Keeps map of MED Profiles per geometric type
+    TGeom2Profile myGeom2Profile;
+    //! Gets a map of MED Profiles per geometric type
+    const TGeom2Profile& GetGeom2Profile() const { return myGeom2Profile;}
+
+    //! Gets type of the champ
+    virtual 
+    ETypeChamp
+    GetTypeChamp() const = 0;
+
+    //! Allocates values for the given geometry
+    virtual 
+    void
+    AllocateValue(EGeometrieElement theGeom,
+                  TInt theNbElem,
+                  TInt theNbGauss,
+                  TInt theNbComp,
+                  EModeSwitch theMode = eFULL_INTERLACE) = 0;
+    
+    virtual 
+    size_t
+    GetValueSize(EGeometrieElement theGeom) const = 0;
+    
+    virtual 
+    size_t
+    GetNbVal(EGeometrieElement theGeom) const = 0;
+    
+    virtual 
+    size_t
+    GetNbGauss(EGeometrieElement theGeom) const = 0;
+
+    virtual 
+    unsigned char*
+    GetValuePtr(EGeometrieElement theGeom) = 0;
+  };
+
+
+  //---------------------------------------------------------------
+  //! The class implements a container for MED TimeStamp values
+  template<class TMeshValueType>
+  struct TTimeStampValue: 
+    virtual TTimeStampValueBase 
+  {
+    typedef TMeshValueType TTMeshValue;
+    typedef SharedPtr<TMeshValueType> PTMeshValue;
+    typedef typename TMeshValueType::TElement TElement;
+    typedef std::map<EGeometrieElement, PTMeshValue> TTGeom2Value;
+
+    ETypeChamp myTypeChamp; //<! Keeps type of the champ
+
+    //! Gets type of the champ
+    virtual 
+    ETypeChamp
+    GetTypeChamp() const
+    {
+      return myTypeChamp;
+    }
+
+    //! Keeps map of MED TimeStamp values per geometric type (const version)
+    TTGeom2Value myGeom2Value;
+
+    const TTGeom2Value& 
+    GetGeom2Value() const
+    {
+      return myGeom2Value;
+    }
+
+    //! Gets MED TimeStamp values for the given geometric type (const version)
+    const PTMeshValue& 
+    GetMeshValuePtr(EGeometrieElement theGeom) const
+    {
+      typename TTGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom);
+      if(anIter == myGeom2Value.end())
+        EXCEPTION(std::runtime_error,"TTimeStampValue::GetMeshValuePtr - myGeom2Value.find(theGeom) fails");
+      return anIter->second;
+    }
+
+    //! Gets MED TimeStamp values for the given geometric type
+    PTMeshValue& 
+    GetMeshValuePtr(EGeometrieElement theGeom)
+    {
+      myGeomSet.insert(theGeom);
+      if(myGeom2Value.find(theGeom) == myGeom2Value.end()){
+        myGeom2Value[theGeom] = PTMeshValue(new TTMeshValue());
+        return myGeom2Value[theGeom];
+      }
+      return myGeom2Value[theGeom];
+    }
+
+    //! Gets MED TimeStamp values for the given geometric type (const version)
+    const TTMeshValue& 
+    GetMeshValue(EGeometrieElement theGeom) const
+    {
+      return *(this->GetMeshValuePtr(theGeom));
+    }
+
+    //! Gets MED TimeStamp values for the given geometric type
+    TTMeshValue& 
+    GetMeshValue(EGeometrieElement theGeom)
+    {
+      return *(this->GetMeshValuePtr(theGeom));
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TTimeStampValue<TFloatMeshValue> TFloatTimeStampValue;
+  typedef SharedPtr<TFloatTimeStampValue> PFloatTimeStampValue;
+
+  PFloatTimeStampValue MEDWRAPPER_EXPORT
+  CastToFloatTimeStampValue(const PTimeStampValueBase& theTimeStampValue);
+
+  typedef TTimeStampValue<TIntMeshValue> TIntTimeStampValue;
+  typedef SharedPtr<TIntTimeStampValue> PIntTimeStampValue;
+  
+  PIntTimeStampValue MEDWRAPPER_EXPORT
+  CastToIntTimeStampValue(const PTimeStampValueBase& theTimeStampValue);
+
+
+  //---------------------------------------------------------------
+  template<class TMeshValueTypeFrom, class TMeshValueTypeTo>
+  void
+  CopyTimeStampValue(SharedPtr<TTimeStampValue<TMeshValueTypeFrom> > theTimeStampValueFrom,
+                     SharedPtr<TTimeStampValue<TMeshValueTypeTo> > theTimeStampValueTo)
+  {
+    typedef TTimeStampValue<TMeshValueTypeFrom> TimeStampValueTypeFrom;
+    typedef TTimeStampValue<TMeshValueTypeTo> TimeStampValueTypeTo;
+    typedef typename TMeshValueTypeTo::TElement TElementTo;
+
+    typename TimeStampValueTypeFrom::TTGeom2Value& aGeom2Value = theTimeStampValueFrom->myGeom2Value;
+    typename TimeStampValueTypeFrom::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
+    for(; anIter != aGeom2Value.end(); anIter++){
+      const EGeometrieElement& aGeom = anIter->first;
+      const typename TimeStampValueTypeFrom::TTMeshValue& aMeshValue = *anIter->second;
+      typename TimeStampValueTypeTo::TTMeshValue& aMeshValue2 = theTimeStampValueTo->GetMeshValue(aGeom);
+      aMeshValue2.Allocate(aMeshValue.myNbElem, 
+                           aMeshValue.myNbGauss, 
+                           aMeshValue.myNbComp,
+                           aMeshValue.myModeSwitch);
+      const typename TimeStampValueTypeFrom::TTMeshValue::TValue& aValue = aMeshValue.myValue;
+      typename TimeStampValueTypeTo::TTMeshValue::TValue& aValue2 = aMeshValue2.myValue;
+      TInt aSize = aValue.size();
+      for(TInt anId = 0; anId < aSize; anId++)
+        aValue2[anId] = TElementTo(aValue[anId]);
+    }
+  }
+
+  template<class TMeshValueType>
+  void
+  CopyTimeStampValue(SharedPtr<TTimeStampValue<TMeshValueType> > theTimeStampValueFrom,
+                     SharedPtr<TTimeStampValue<TMeshValueType> > theTimeStampValueTo)
+  {
+    typedef TTimeStampValue<TMeshValueType> TimeStampValueType;
+    typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValueFrom->myGeom2Value;
+    typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
+    for(; anIter != aGeom2Value.end(); anIter++){
+      const EGeometrieElement& aGeom = anIter->first;
+      const typename TimeStampValueType::TTMeshValue& aMeshValue = *anIter->second;
+      typename TimeStampValueType::TTMeshValue& aMeshValue2 = theTimeStampValueTo->GetMeshValue(aGeom);
+      aMeshValue2 = aMeshValue;
+    }
+  }
+
+  //---------------------------------------------------------------
+  inline
+  void
+  CopyTimeStampValueBase(const PTimeStampValueBase& theValueFrom, 
+                         const PTimeStampValueBase& theValueTo)
+  {
+    if(theValueFrom->GetTypeChamp() == theValueTo->GetTypeChamp()){
+      if(theValueFrom->GetTypeChamp() == eFLOAT64)
+        CopyTimeStampValue<TFloatMeshValue>(theValueFrom, theValueTo);
+      else if(theValueFrom->GetTypeChamp() == eINT)
+        CopyTimeStampValue<TIntMeshValue>(theValueFrom, theValueTo);
+    }else{
+      if(theValueFrom->GetTypeChamp() == eFLOAT64 && theValueTo->GetTypeChamp() == eINT)
+        CopyTimeStampValue<TFloatMeshValue, TIntMeshValue>(theValueFrom, theValueTo);
+      else if(theValueFrom->GetTypeChamp() == eINT && theValueTo->GetTypeChamp() == eFLOAT64)
+        CopyTimeStampValue<TIntMeshValue, TFloatMeshValue>(theValueFrom, theValueTo);
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  // Backward compatibility  declarations
+  typedef TFloatTimeStampValue TTimeStampVal;
+  typedef PFloatTimeStampValue PTimeStampVal;
+
+  //---------------------------------------------------------------
+  typedef std::map<TInt,TFloatVector> TIndexes;
+  typedef std::map<TInt,TString> TNames;
+  
+  //! Define a base class which represents MED Grille (structured mesh)
+  struct MEDWRAPPER_EXPORT TGrilleInfo:
+    virtual TModeSwitchInfo
+  {
+
+    PMeshInfo myMeshInfo;
+    const PMeshInfo& GetMeshInfo() const { return myMeshInfo;} 
+
+    TNodeCoord myCoord; //!< Contains all nodal coordinates, now used only for eGRILLE_STANDARD
+    //! Gives coordinates for mesh nodes (const version)
+    const TNodeCoord& GetNodeCoord() const;
+    TNodeCoord& GetNodeCoord();
+    //! Gives coordinates for mesh node by its number, array index from 0
+    TNodeCoord GetCoord(TInt theId);
+    //! Gives ids of nodes for mesh cell or sub-cell by its number, array index from 0
+    TIntVector GetConn(TInt theId, const bool isSub=false);
+
+    EGrilleType myGrilleType; //!< Defines grille type (eGRILLE_CARTESIENNE,eGRILLE_POLAIRE,eGRILLE_STANDARD)
+    //!Gets grille type (const version)
+    const EGrilleType& GetGrilleType() const;
+    //!Gets grille type
+    EGrilleType GetGrilleType();
+    //!Sets grille type
+    void SetGrilleType(EGrilleType theGrilleType);
+
+
+    
+    TString myCoordNames; //!< Contains names for the coordinate dimensions
+    //! Get name of the coordinate dimension by its order number
+    virtual std::string GetCoordName(TInt theId) const = 0 ;
+    //! Set name of the coordinate dimension by its order number
+    virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
+
+    TString myCoordUnits; //!< Contains units for the coordinate dimensions
+    //! Get name of unit for the coordinate dimension by its order number
+    virtual std::string GetCoordUnit(TInt theId) const = 0;
+    //! Set name of unit for the coordinate dimension by its order number
+    virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
+
+
+    //! Map of index of axes and Table of indexes for certain axe, now used for eGRILLE_CARTESIENNE and eGRILLE_POLAIRE
+    TIndexes myIndixes;
+    //!Gets a map of Tables (const version)
+    const TIndexes& GetMapOfIndexes() const ;
+    //!Gets a map of Tables
+    TIndexes& GetMapOfIndexes();
+    //!Gets a Table of indexes for certain axe(const version)
+    const TFloatVector& GetIndexes(TInt theAxisNumber) const;
+    //!Gets a Table of indexes for certain axe
+    TFloatVector& GetIndexes(TInt theAxisNumber);
+    //!Gets a number of indices per axe
+    TInt GetNbIndexes(TInt theAxisNumber);
+    
+    TInt GetNbNodes();//! Return count of all points
+    TInt GetNbCells();//! Return count of all cells
+    TInt GetNbSubCells();//! Return count of all entities of <mesh dimension-1>
+    EGeometrieElement GetGeom();//! Return geometry of cells (calculated from mesh dimension)
+    EGeometrieElement GetSubGeom();//! Return geometry of subcells (calculated from mesh dimension)
+    EEntiteMaillage GetEntity();//! Return entity (eMAILLE)
+    EEntiteMaillage GetSubEntity();//! Return sub entity
+
+    /*!
+     *Vector of grille structure (Example: {3,4,5}, 3 nodes in X axe, 4 nodes in Y axe, ...)
+     */
+    TIntVector myGrilleStructure;
+    //!Gets grille structure(const version)
+    const TIntVector& GetGrilleStructure() const;
+    //!Gets grille structure
+    TIntVector GetGrilleStructure();
+    //!Sets the grille structure of theAxis axe to theNb.
+    void SetGrilleStructure(TInt theAxis,TInt theNb);
+    
+    /*!
+     *Defines sequence MED Family indexes for corresponding mesh entites
+     */
+    TElemNum myFamNum; 
+    //! Get number of a MED FAMILY by order number of the mesh element
+    TInt GetFamNum(TInt theId) const;
+    //! Set number of a MED FAMILY for the mesh element with the  order number
+    void SetFamNum(TInt theId, TInt theVal);
+    
+    /*!
+     *Defines sequence MED Family indexes for sub entites
+     */
+    TElemNum myFamSubNum; 
+    //! Get number of a MED FAMILY by order number of sub element
+    TInt GetFamSubNum(TInt theId) const;
+    //! Set number of a MED FAMILY for theId-th sub element
+    void SetFamSubNum(TInt theId, TInt theVal);
+    
+    /*!
+     *Defines sequence MED Family indexes for corresponding mesh nodes
+     */
+    TElemNum myFamNumNode;
+    //! Get number of a MED FAMILY by order number of the mesh node
+    TInt GetFamNumNode(TInt theId) const;
+    //! Set number of a MED FAMILY for the mesh node with the  order number
+    void SetFamNumNode(TInt theId, TInt theVal);
+
+  };
+
+
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_TStructures.hxx b/src/MEDWrapper/Base/MED_TStructures.hxx
new file mode 100644 (file)
index 0000000..dfbca90
--- /dev/null
@@ -0,0 +1,1216 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_TStructures_HeaderFile
+#define MED_TStructures_HeaderFile
+
+#include "MED_Structures.hxx"
+
+#ifdef WIN32
+#pragma warning(disable:4250)
+#endif
+
+namespace MED
+{
+  //---------------------------------------------------------------
+  //! To provide a common way to handle values of MEDWrapper types as native MED types
+  template<class TValue, class TRepresentation>
+  struct TValueHolder
+  {
+    TValue& myValue;
+    TRepresentation myRepresentation;
+
+    TValueHolder(TValue& theValue):
+      myValue(theValue),
+      myRepresentation(TRepresentation(theValue))
+    {}
+
+    ~TValueHolder()
+    {
+      myValue = TValue(myRepresentation);
+    }
+
+    TRepresentation*
+    operator& ()
+    {
+      return &myRepresentation;
+    }
+
+    operator TRepresentation () const
+    {
+      return myRepresentation;
+    }  
+
+    const TValue&
+    operator() () const
+    {
+      return myValue;
+    }  
+  };
+  
+  //! To customize TValueHolder common template definition for TVector
+  template<class TVal, class TRepresentation>
+  struct TValueHolder<TVector<TVal>, TRepresentation>
+  {
+    typedef TVector<TVal> TValue;
+    TValue& myValue;
+    TRepresentation* myRepresentation;
+
+    TValueHolder(TValue& theValue):
+      myValue(theValue)
+    {
+      if(theValue.empty())
+        myRepresentation = (TRepresentation*)NULL;
+      else
+        myRepresentation = (TRepresentation*)&theValue[0];
+    }
+
+    TRepresentation*
+    operator& ()
+    {
+      return myRepresentation;
+    }
+  };
+  
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTNameInfo: virtual TNameInfo
+  {
+    TTNameInfo(const std::string& theValue)
+    {
+      myName.resize(GetNOMLength<eVersion>()+1);
+      SetName(theValue);
+    }
+
+    virtual
+    std::string
+    GetName() const 
+    { 
+      return GetString(0, GetNOMLength<eVersion>(), myName);
+    }
+
+    virtual
+    void
+    SetName(const std::string& theValue)
+    {
+      SetString(0, GetNOMLength<eVersion>(), myName, theValue);
+    }
+
+    virtual
+    void
+    SetName(const TString& theValue)
+    {
+      SetString(0, GetNOMLength<eVersion>(), myName, theValue);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTMeshInfo: 
+    virtual TMeshInfo, 
+    virtual TTNameInfo<eVersion>
+  {
+    typedef TTNameInfo<eVersion> TNameInfoBase;
+
+    TTMeshInfo(const PMeshInfo& theInfo):
+      TNameInfoBase(theInfo->GetName())
+    {
+      myDim = theInfo->GetDim();
+      mySpaceDim = theInfo->GetSpaceDim();
+      myType = theInfo->GetType();
+      
+      myDesc.resize(GetDESCLength<eVersion>()+1);
+      SetDesc(theInfo->GetDesc());
+    }
+
+    TTMeshInfo(TInt theDim, TInt theSpaceDim,
+               const std::string& theValue,
+               EMaillage theType,
+               const std::string& theDesc):
+      TNameInfoBase(theValue)
+    {
+      myDim = theDim;
+      mySpaceDim = theSpaceDim;
+      myType = theType;
+      
+      myDesc.resize(GetDESCLength<eVersion>()+1);
+      SetDesc(theDesc);
+    }
+
+    virtual 
+    std::string
+    GetDesc() const 
+    { 
+      return GetString(0, GetDESCLength<eVersion>(), myDesc);
+    }
+
+    virtual
+    void
+    SetDesc(const std::string& theValue)
+    {
+      SetString(0, GetDESCLength<eVersion>(), myDesc, theValue);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTFamilyInfo: 
+    virtual TFamilyInfo, 
+    virtual TTNameInfo<eVersion>
+  {
+    typedef TTNameInfo<eVersion> TNameInfoBase;
+
+    TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
+      TNameInfoBase(theInfo->GetName())
+    {
+      myMeshInfo = theMeshInfo;
+
+      myId = theInfo->GetId();
+
+      myNbGroup = theInfo->GetNbGroup();
+      myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
+      if(myNbGroup){
+        for(TInt anId = 0; anId < myNbGroup; anId++){
+          SetGroupName(anId,theInfo->GetGroupName(anId));
+        }
+      }
+
+      myNbAttr = theInfo->GetNbAttr();
+      myAttrId.resize(myNbAttr);
+      myAttrVal.resize(myNbAttr);
+      myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
+      if(myNbAttr){
+        for(TInt anId = 0; anId < myNbAttr; anId++){
+          SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
+          myAttrVal[anId] = theInfo->GetAttrVal(anId);
+          myAttrId[anId] = theInfo->GetAttrId(anId);
+        }
+      }
+    }
+
+    TTFamilyInfo(const PMeshInfo& theMeshInfo,
+                 TInt theNbGroup, 
+                 TInt theNbAttr,
+                 TInt theId,
+                 const std::string& theValue):
+      TNameInfoBase(theValue)
+    {
+      myMeshInfo = theMeshInfo;
+
+      myId = theId;
+
+      myNbGroup = theNbGroup;
+      myGroupNames.resize(theNbGroup*GetLNOMLength<eVersion>()+1);
+
+      myNbAttr = theNbAttr;
+      myAttrId.resize(theNbAttr);
+      myAttrVal.resize(theNbAttr);
+      myAttrDesc.resize(theNbAttr*GetDESCLength<eVersion>()+1);
+    }
+
+    TTFamilyInfo(const PMeshInfo& theMeshInfo,
+                 const std::string& theValue,
+                 TInt theId,
+                 const TStringSet& theGroupNames, 
+                 const TStringVector& theAttrDescs, 
+                 const TIntVector& theAttrIds, 
+                 const TIntVector& theAttrVals):
+      TNameInfoBase(theValue)
+    {
+      myMeshInfo = theMeshInfo;
+
+      myId = theId;
+
+      myNbGroup = (TInt)theGroupNames.size();
+      myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
+      if(myNbGroup){
+        TStringSet::const_iterator anIter = theGroupNames.begin();
+        for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
+          const std::string& aVal = *anIter;
+          SetGroupName(anId,aVal);
+        }
+      }
+
+      myNbAttr = (TInt)theAttrDescs.size();
+      myAttrId.resize(myNbAttr);
+      myAttrVal.resize(myNbAttr);
+      myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
+      if(myNbAttr){
+        for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
+          SetAttrDesc(anId,theAttrDescs[anId]);
+          myAttrVal[anId] = theAttrVals[anId];
+          myAttrId[anId] = theAttrIds[anId];
+        }
+      }
+    }
+
+    virtual
+    std::string
+    GetGroupName(TInt theId) const 
+    { 
+      return GetString(theId, GetLNOMLength<eVersion>(), myGroupNames);
+    }
+
+    virtual
+    void
+    SetGroupName(TInt theId, const std::string& theValue)
+    {
+      SetString(theId, GetLNOMLength<eVersion>(), myGroupNames, theValue);
+    }
+
+    virtual
+    std::string
+    GetAttrDesc(TInt theId) const 
+    { 
+      return GetString(theId, GetDESCLength<eVersion>(), myAttrDesc);
+    }
+
+    virtual
+    void
+    SetAttrDesc(TInt theId, const std::string& theValue)
+    {
+      SetString(theId, GetDESCLength<eVersion>(), myAttrDesc, theValue);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTElemInfo: virtual TElemInfo
+  {
+    TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
+    {
+      myMeshInfo = theMeshInfo;
+      
+      myNbElem = theInfo->GetNbElem();
+      myFamNum.reset(new TElemNum(myNbElem));
+      myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
+
+      myIsElemNum = theInfo->IsElemNum();
+      if(theInfo->IsElemNum())
+        myElemNum.reset(new TElemNum(myNbElem));
+      else
+        myElemNum.reset(new TElemNum());
+
+      myIsElemNames = theInfo->IsElemNames();
+      if(theInfo->IsElemNames())
+        myElemNames.reset(new TString(myNbElem*GetPNOMLength<eVersion>() + 1));
+      else
+        myElemNames.reset(new TString());
+
+      if(theInfo->GetNbElem()){
+        for(TInt anId = 0; anId < myNbElem; anId++){
+          SetFamNum(anId, theInfo->GetFamNum(anId));
+        }
+        if(theInfo->IsElemNum() == eVRAI){
+          for(TInt anId = 0; anId < myNbElem; anId++){
+            SetElemNum(anId, theInfo->GetElemNum(anId));
+          }
+        }
+        if(theInfo->IsElemNames() == eVRAI){
+          for(TInt anId = 0; anId < myNbElem; anId++){
+            SetElemName(anId,theInfo->GetElemName(anId));
+          }
+        }
+      }
+    }
+
+    TTElemInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames)
+    {
+      myMeshInfo = theMeshInfo;
+
+      myNbElem = theNbElem;
+      myFamNum.reset(new TElemNum(theNbElem));
+      myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
+
+      myIsElemNum = theIsElemNum;
+      if(theIsElemNum)
+        myElemNum.reset(new TElemNum(theNbElem));
+      else
+        myElemNum.reset(new TElemNum());
+
+      myIsElemNames = theIsElemNames;
+      if(theIsElemNames)
+        myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
+      else
+        myElemNames.reset(new TString());
+   }
+    
+    TTElemInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums,
+               const TStringVector& theElemNames)
+    {
+      myMeshInfo = theMeshInfo;
+      
+      myNbElem = theNbElem;
+      myFamNum.reset(new TElemNum(theNbElem));
+      myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
+      
+      myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
+      if(myIsElemNum)
+        myElemNum.reset(new TElemNum(theNbElem));
+      else
+        myElemNum.reset(new TElemNum());
+      
+      myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
+      if(myIsElemNames)
+        myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
+      else
+        myElemNames.reset(new TString());
+     
+      if(theNbElem){
+
+        if(theFamilyNums.size())
+          *myFamNum = theFamilyNums;
+
+        if(myIsElemNum)
+          *myElemNum = theElemNums;
+
+        if(myIsElemNames){
+          for(TInt anId = 0; anId < theNbElem; anId++){
+            const std::string& aVal = theElemNames[anId];
+            SetElemName(anId,aVal);
+          }
+        }
+      }
+    }
+
+    virtual
+    std::string
+    GetElemName(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(), *myElemNames);
+    }
+
+    virtual
+    void
+    SetElemName(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(), *myElemNames, theValue);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTNodeInfo: 
+    virtual TNodeInfo, 
+    virtual TTElemInfo<eVersion>
+  {
+    typedef TTElemInfo<eVersion> TElemInfoBase;
+
+    TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
+      TNodeInfo(theInfo),
+      TElemInfoBase(theMeshInfo, theInfo)
+    {
+      myModeSwitch = theInfo->GetModeSwitch();
+      
+      mySystem = theInfo->GetSystem();
+      
+      myCoord.reset(new TNodeCoord(*theInfo->myCoord));
+      
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
+
+      myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      for(TInt anId = 0; anId < aSpaceDim; anId++)
+        SetCoordName(anId,theInfo->GetCoordName(anId));
+      
+      myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      for(TInt anId = 0; anId < aSpaceDim; anId++)
+        SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
+    }
+
+    TTNodeInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               EModeSwitch theMode,
+               ERepere theSystem, 
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames):
+      TModeSwitchInfo(theMode),
+      TElemInfoBase(theMeshInfo,
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
+    {
+      mySystem = theSystem;
+
+      myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->mySpaceDim));
+
+      myCoordUnits.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
+
+      myCoordNames.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
+    }
+
+    
+    TTNodeInfo(const PMeshInfo& theMeshInfo, 
+               const TFloatVector& theNodeCoords,
+               EModeSwitch theMode,
+               ERepere theSystem, 
+               const TStringVector& theCoordNames,
+               const TStringVector& theCoordUnits,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums,
+               const TStringVector& theElemNames):
+      TModeSwitchInfo(theMode),
+      TElemInfoBase(theMeshInfo,
+                    (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
+    {
+      mySystem = theSystem;
+
+      myCoord.reset(new TNodeCoord(theNodeCoords));
+      
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
+
+      myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      if(!theCoordNames.empty())
+        for(TInt anId = 0; anId < aSpaceDim; anId++)
+          SetCoordName(anId,theCoordNames[anId]);
+      
+      myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>() + 1);
+      if(!theCoordUnits.empty())
+        for(TInt anId = 0; anId < aSpaceDim; anId++)
+          SetCoordUnit(anId, theCoordUnits[anId]);
+    }
+
+    virtual
+    std::string
+    GetCoordName(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
+    }
+
+    virtual
+    void
+    SetCoordName(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
+    }
+
+    virtual
+    std::string 
+    GetCoordUnit(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
+    }
+
+    virtual
+    void
+    SetCoordUnit(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
+    }
+  };
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTPolygoneInfo: 
+    virtual TPolygoneInfo, 
+    virtual TTElemInfo<eVersion>
+  {
+    typedef TTElemInfo<eVersion> TElemInfoBase;
+
+    TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
+      TElemInfoBase(theMeshInfo,theInfo)
+    {
+      myEntity = theInfo->GetEntity();
+      myGeom = theInfo->GetGeom();
+
+      myIndex.reset(new TElemNum(*theInfo->myIndex));
+      myConn.reset(new TElemNum(*theInfo->myConn));
+
+      myConnMode = theInfo->GetConnMode();
+    }
+
+    TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theConnSize,
+                   EConnectivite theConnMode,
+                   EBooleen theIsElemNum,
+                   EBooleen theIsElemNames):
+      TElemInfoBase(theMeshInfo,
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
+    {
+      myEntity = theEntity;
+      myGeom = theGeom;
+
+      myIndex.reset(new TElemNum(theNbElem + 1));
+      myConn.reset(new TElemNum(theConnSize));
+
+      myConnMode = theConnMode;
+    }
+    
+    TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode,
+                   const TIntVector& theFamilyNums,
+                   const TIntVector& theElemNums,
+                   const TStringVector& theElemNames):
+      TElemInfoBase(theMeshInfo,
+                    (TInt)theIndexes.size() - 1,
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
+    {
+      myEntity = theEntity;
+      myGeom = theGeom;
+
+      myIndex.reset(new TElemNum(theIndexes));
+      myConn.reset(new TElemNum(theConnectivities));
+
+      myConnMode = theConnMode;
+    }
+  };
+  
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTPolyedreInfo: 
+    virtual TPolyedreInfo, 
+    virtual TTElemInfo<eVersion>
+  {
+    typedef TTElemInfo<eVersion> TElemInfoBase;
+
+    TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
+      TElemInfoBase(theMeshInfo,theInfo)
+    {
+      myEntity = theInfo->GetEntity();
+      myGeom = theInfo->GetGeom();
+
+      myIndex.reset(new TElemNum(*theInfo->myIndex));
+      myFaces.reset(new TElemNum(*theInfo->myFaces));
+      myConn.reset(new TElemNum(*theInfo->myConn));
+
+      myConnMode = theInfo->GetConnMode();
+    }
+
+    TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theNbFaces,
+                   TInt theConnSize,
+                   EConnectivite theConnMode,
+                   EBooleen theIsElemNum,
+                   EBooleen theIsElemNames):
+      TElemInfoBase(theMeshInfo,
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
+    {
+      myEntity = theEntity;
+      myGeom = theGeom;
+
+      myIndex.reset(new TElemNum(theNbElem + 1));
+      myFaces.reset(new TElemNum(theNbFaces));
+      myConn.reset(new TElemNum(theConnSize));
+
+      myConnMode = theConnMode;
+    }
+    
+    TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theFaces,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode,
+                   const TIntVector& theFamilyNums,
+                   const TIntVector& theElemNums,
+                   const TStringVector& theElemNames):
+      TElemInfoBase(theMeshInfo,
+                    (TInt)theIndexes.size()-1,
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
+    {
+      myEntity = theEntity;
+      myGeom = theGeom;
+
+      myIndex.reset(new TElemNum(theIndexes));
+      myFaces.reset(new TElemNum(theFaces));
+      myConn.reset(new TElemNum(theConnectivities));
+
+      myConnMode = theConnMode;
+    }
+  };
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTCellInfo: 
+    virtual TCellInfo, 
+    virtual TTElemInfo<eVersion>
+  {
+    typedef TTElemInfo<eVersion> TElemInfoBase;
+
+    TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
+      TElemInfoBase(theMeshInfo,theInfo)
+    {
+      myEntity = theInfo->GetEntity();
+      myGeom = theInfo->GetGeom();
+      myConnMode  = theInfo->GetConnMode();
+      
+      TInt aConnDim = GetNbNodes(myGeom);
+      TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
+      myConn.reset(new TElemNum(myNbElem * aNbConn));
+      for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
+        TConnSlice aConnSlice = GetConnSlice(anElemId);
+        TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
+        for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
+          aConnSlice[anConnId] = aConnSlice2[anConnId];
+        }
+      }
+    }
+
+    TTCellInfo(const PMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TInt theNbElem,
+               EConnectivite theConnMode,
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames,
+               EModeSwitch theMode):
+      TModeSwitchInfo(theMode),
+      TElemInfoBase(theMeshInfo,
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
+    {
+      myEntity = theEntity;
+      myGeom = theGeom;
+
+      myConnMode = theConnMode;
+      TInt aNbConn = GetNbConn<eVersion>(theGeom, myEntity, theMeshInfo->myDim);
+      myConn.reset(new TElemNum(theNbElem * aNbConn));
+    }
+    
+    TTCellInfo(const PMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               const TIntVector& theConnectivities,
+               EConnectivite theConnMode,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums,
+               const TStringVector& theElemNames,
+               EModeSwitch theMode):
+      TModeSwitchInfo(theMode),
+      TElemInfoBase(theMeshInfo,
+                    (TInt)theConnectivities.size() / GetNbNodes(theGeom),
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
+    {
+      myEntity = theEntity;
+      myGeom = theGeom;
+
+      myConnMode = theConnMode;
+      TInt aConnDim = GetNbNodes(myGeom);
+      TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
+      myConn.reset(new TElemNum(myNbElem * aNbConn));
+      for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
+        TConnSlice aConnSlice = GetConnSlice(anElemId);
+        for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
+          aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
+        }
+      }
+    }
+
+    virtual 
+    TInt
+    GetConnDim() const 
+    { 
+      return GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
+    }
+
+  };
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTBallInfo: 
+    virtual TBallInfo,
+    virtual TTCellInfo<eVersion>
+  {
+    typedef TTCellInfo<eVersion> TCellInfoBase;
+
+    TTBallInfo(const PMeshInfo& theMeshInfo, const PBallInfo& theInfo):
+      TCellInfoBase::TElemInfoBase(theMeshInfo, theInfo),
+      TCellInfoBase(theMeshInfo,theInfo)
+    {
+      myDiameters = theInfo->myDiameters;
+    }
+
+    TTBallInfo(const PMeshInfo& theMeshInfo,
+               TInt             theNbElem,
+               EBooleen         theIsElemNum ):
+      TCellInfoBase::TElemInfoBase(theMeshInfo,
+                                   theNbElem,
+                                   theIsElemNum,
+                                   /*theIsElemNames=*/eFAUX),
+      TCellInfoBase(theMeshInfo,
+                    eSTRUCT_ELEMENT,
+                    eBALL,
+                    theNbElem,
+                    /*EConnectivite=*/eNOD,
+                    theIsElemNum,
+                    /*theIsElemNames=*/eFAUX,
+                    eFULL_INTERLACE)
+    {
+      myDiameters.resize( theNbElem );
+    }
+
+    TTBallInfo(const PMeshInfo&  theMeshInfo, 
+               const TIntVector& theNodes,
+               TFloatVector&     theDiameters,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums):
+      TCellInfoBase::TElemInfoBase(theMeshInfo,
+                                   (TInt)std::max(theNodes.size(),theDiameters.size() ),
+                                   theFamilyNums,
+                                   theElemNums,
+                                   TStringVector()),
+      TCellInfoBase(theMeshInfo,
+                    eSTRUCT_ELEMENT,
+                    eBALL,
+                    theNodes,
+                    /*EConnectivite=*/eNOD,
+                    theFamilyNums,
+                    theElemNums,
+                    TStringVector(),
+                    eFULL_INTERLACE)
+    {
+      myDiameters.swap( theDiameters );
+    }
+  };
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTFieldInfo: 
+    virtual TFieldInfo, 
+    virtual TTNameInfo<eVersion>
+  {
+    typedef TTNameInfo<eVersion> TNameInfoBase;
+
+    TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
+      TNameInfoBase(theInfo->GetName())
+    {
+      myMeshInfo = theMeshInfo;
+
+      myNbComp = theInfo->GetNbComp();
+      myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
+      for(TInt anId = 0; anId < myNbComp; anId++){
+        SetCompName(anId,theInfo->GetCompName(anId));
+      }
+
+      myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
+      for(TInt anId = 0; anId < myNbComp; anId++){
+        SetUnitName(anId,theInfo->GetUnitName(anId));
+      }
+
+      myType = theInfo->GetType();
+
+      myIsLocal = theInfo->GetIsLocal();
+      myNbRef = theInfo->GetNbRef();
+    }
+
+    TTFieldInfo(const PMeshInfo& theMeshInfo, 
+                TInt theNbComp,
+                ETypeChamp theType,
+                const std::string& theValue,
+                EBooleen theIsLocal,
+                TInt theNbRef):
+      TNameInfoBase(theValue)
+    {
+      myMeshInfo = theMeshInfo;
+
+      myNbComp = theNbComp;
+      myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
+      myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
+
+      myType = theType;
+
+      myIsLocal = theIsLocal;
+      myNbRef = theNbRef;
+    }
+    
+    virtual 
+    std::string
+    GetCompName(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
+    }
+
+    virtual
+    void
+    SetCompName(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
+    }
+
+    virtual
+    std::string 
+    GetUnitName(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
+    }
+
+    virtual
+    void
+    SetUnitName(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTGaussInfo: 
+    virtual TGaussInfo,
+    virtual TTNameInfo<eVersion>
+  {
+    typedef TTNameInfo<eVersion> TNameInfoBase;
+
+    TTGaussInfo(const TGaussInfo::TInfo& theInfo,
+                EModeSwitch theMode):
+      TModeSwitchInfo(theMode),
+      TNameInfoBase(boost::get<1>(boost::get<0>(theInfo)))
+    {
+      const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
+
+      myGeom = boost::get<0>(aKey);
+      myRefCoord.resize(GetNbRef()*GetDim());
+
+      TInt aNbGauss = boost::get<1>(theInfo);
+      myGaussCoord.resize(aNbGauss*GetDim());
+      myWeight.resize(aNbGauss);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTTimeStampInfo: virtual TTimeStampInfo
+  {
+    TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
+    {
+      myFieldInfo = theFieldInfo;
+
+      myEntity = theInfo->GetEntity();
+      myGeom2Size = theInfo->GetGeom2Size();
+
+      myNumDt = theInfo->GetNumDt();
+      myNumOrd = theInfo->GetNumOrd();
+      myDt = theInfo->GetDt();
+
+      myUnitDt.resize(GetPNOMLength<eVersion>()+1);
+      SetUnitDt(theInfo->GetUnitDt());
+
+      myGeom2NbGauss = theInfo->myGeom2NbGauss;
+      myGeom2Gauss = theInfo->GetGeom2Gauss();
+    }
+
+    TTTimeStampInfo(const PFieldInfo& theFieldInfo, 
+                    EEntiteMaillage theEntity,
+                    const TGeom2Size& theGeom2Size,
+                    const TGeom2NbGauss& theGeom2NbGauss,
+                    TInt theNumDt,
+                    TInt theNumOrd,
+                    TFloat theDt,
+                    const std::string& theUnitDt,
+                    const TGeom2Gauss& theGeom2Gauss)
+    {
+      myFieldInfo = theFieldInfo;
+
+      myEntity = theEntity;
+      myGeom2Size = theGeom2Size;
+
+      myNumDt = theNumDt;
+      myNumOrd = theNumDt;
+      myDt = theDt;
+
+      myUnitDt.resize(GetPNOMLength<eVersion>()+1);
+      SetUnitDt(theUnitDt);
+
+      myGeom2NbGauss = theGeom2NbGauss;
+      myGeom2Gauss = theGeom2Gauss;
+    }
+
+    virtual 
+    std::string
+    GetUnitDt() const
+    { 
+      return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
+    }
+
+    virtual
+    void
+    SetUnitDt(const std::string& theValue)
+    {
+      SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTProfileInfo: 
+    virtual TProfileInfo,
+    virtual TTNameInfo<eVersion>
+  {
+    typedef TTNameInfo<eVersion> TNameInfoBase;
+
+    TTProfileInfo(const TProfileInfo::TInfo& theInfo,
+                  EModeProfil theMode):
+      TNameInfoBase(boost::get<0>(theInfo))
+    {
+      TInt aSize = boost::get<1>(theInfo);
+      myElemNum.reset(new TElemNum(aSize));
+      myMode = aSize > 0? theMode: eNO_PFLMOD;
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion, class TMeshValueType>
+  struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
+  {
+    TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const PTimeStampValueBase& theInfo,
+                     ETypeChamp theTypeChamp)
+    {
+      typedef TTimeStampValue<TMeshValueType> TCompatible;
+      if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
+        this->myTimeStampInfo = theTimeStampInfo;
+        this->myTypeChamp = theTypeChamp;
+        this->myGeom2Profile = aCompatible->GetGeom2Profile();
+        this->myGeom2Value = aCompatible->myGeom2Value;
+        this->myGeomSet = aCompatible->GetGeomSet();
+      }else
+        EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
+    }
+
+    TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     ETypeChamp theTypeChamp,
+                     const TGeom2Profile& theGeom2Profile,
+                     EModeSwitch theMode):
+      TModeSwitchInfo(theMode)
+    {
+      this->myTimeStampInfo = theTimeStampInfo;
+
+      this->myTypeChamp = theTypeChamp;
+
+      this->myGeom2Profile = theGeom2Profile;
+
+      TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
+
+      const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
+      TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+      for(; anIter != aGeom2Size.end(); anIter++){
+        const EGeometrieElement& aGeom = anIter->first;
+        TInt aNbElem = anIter->second;
+
+        MED::PProfileInfo aProfileInfo;
+        MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
+        if(anIter != theGeom2Profile.end())
+          aProfileInfo = anIter->second;
+
+        if(aProfileInfo && aProfileInfo->IsPresent())
+          aNbElem = aProfileInfo->GetSize();
+
+        TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
+        
+        this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
+      }
+    }
+
+    virtual 
+    size_t
+    GetValueSize(EGeometrieElement theGeom) const
+    {
+      return this->GetMeshValue(theGeom).GetSize();
+    }
+
+    virtual 
+    size_t
+    GetNbVal(EGeometrieElement theGeom) const
+    {
+      return this->GetMeshValue(theGeom).GetNbVal();
+    }
+
+    virtual 
+    size_t
+    GetNbGauss(EGeometrieElement theGeom) const
+    {
+      return this->GetMeshValue(theGeom).GetNbGauss();
+    }
+
+    virtual 
+    void
+    AllocateValue(EGeometrieElement theGeom,
+                  TInt theNbElem,
+                  TInt theNbGauss,
+                  TInt theNbComp,
+                  EModeSwitch theMode = eFULL_INTERLACE)
+    {
+      this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
+    }
+    
+    virtual 
+    unsigned char*
+    GetValuePtr(EGeometrieElement theGeom)
+    {
+      return this->GetMeshValue(theGeom).GetValuePtr();
+    }
+  };
+
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTGrilleInfo:
+    virtual TGrilleInfo
+  {
+    TTGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const PGrilleInfo& theInfo)
+    {
+      myMeshInfo        = theMeshInfo;
+
+      myCoord           = theInfo->GetNodeCoord();
+      
+      myGrilleType      = theInfo->GetGrilleType();
+
+      myCoordNames      = theInfo->myCoordNames;
+
+      myCoordUnits      = theInfo->myCoordUnits;
+
+      myIndixes         = theInfo->GetMapOfIndexes();
+
+      myGrilleStructure = theInfo->GetGrilleStructure();
+
+      myGrilleType      = theInfo->GetGrilleType();
+
+      myFamNumNode.resize(theInfo->GetNbNodes());
+      myFamNumNode      = theInfo->myFamNumNode;
+
+      myFamNum      = theInfo->myFamNum;
+    }
+
+    TTGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type,
+                 const TInt nnoeuds)
+    {
+      myMeshInfo        = theMeshInfo;
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
+      if(type == eGRILLE_STANDARD){
+        myCoord.resize(aSpaceDim*nnoeuds);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      } else { //if(type == eGRILLE_CARTESIENNE){
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+      }
+      myGrilleStructure.resize(aSpaceDim);
+      myFamNumNode.resize(nnoeuds);
+    }
+
+    TTGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type)
+    {
+      myMeshInfo        = theMeshInfo;
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
+      if(type == eGRILLE_STANDARD){
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      } else {// if(type == eGRILLE_CARTESIENNE){
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+      }
+      myGrilleStructure.resize(aSpaceDim);
+    }
+
+    TTGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type,
+                 const MED::TIntVector& nbNodeVec)
+    {
+      myMeshInfo        = theMeshInfo;
+
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
+      if(type == eGRILLE_STANDARD){
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      } else {// if(type == eGRILLE_CARTESIENNE){
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+      }
+
+      if(type != eGRILLE_STANDARD)
+        for(unsigned int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
+          myIndixes[aAxe].resize(nbNodeVec[aAxe]);
+        }
+      myGrilleStructure.resize(aSpaceDim);
+    }
+
+    virtual
+    std::string
+    GetCoordName(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
+    }
+
+    virtual
+    void
+    SetCoordName(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
+    }
+
+    virtual
+    std::string 
+    GetCoordUnit(TInt theId) const 
+    { 
+      return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
+    }
+
+    virtual
+    void
+    SetCoordUnit(TInt theId, const std::string& theValue)
+    {
+      SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
+    }
+
+  };
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_TWrapper.hxx b/src/MEDWrapper/Base/MED_TWrapper.hxx
new file mode 100644 (file)
index 0000000..4acda13
--- /dev/null
@@ -0,0 +1,578 @@
+// Copyright (C) 2007-2013  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
+//
+#ifndef MED_TWrapper_HeaderFile
+#define MED_TWrapper_HeaderFile
+
+#include "MED_TStructures.hxx"
+#include "MED_Wrapper.hxx"
+
+namespace MED
+{
+
+  template<EVersion eVersion>
+  class TTWrapper: public TWrapper
+  {
+  public:
+    //----------------------------------------------------------------------------
+    //! Gets version of the MED library used for the MED file
+    virtual 
+    EVersion
+    GetVersion()
+    {
+      return eVersion;
+    }
+    
+    //----------------------------------------------------------------------------
+    virtual 
+    PMeshInfo
+    CrMeshInfo(TInt theDim = 0, TInt theSpaceDim = 0,
+               const std::string& theValue = "",
+               EMaillage theType = eNON_STRUCTURE,
+               const std::string& theDesc = "")
+    {
+      return PMeshInfo(new TTMeshInfo<eVersion>
+                       (theDim,
+                        theSpaceDim,
+                        theValue,
+                        theType,
+                        theDesc));
+    }
+
+    virtual 
+    PMeshInfo
+    CrMeshInfo(const PMeshInfo& theInfo)
+    {
+      return PMeshInfo(new TTMeshInfo<eVersion>(theInfo));
+    }
+    
+
+    //----------------------------------------------------------------------------
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 TInt theNbGroup = 0, 
+                 TInt theNbAttr = 0,
+                 TInt theId = 0,
+                 const std::string& theValue = "")
+    {
+      return PFamilyInfo(new TTFamilyInfo<eVersion>
+                         (theMeshInfo,
+                          theNbGroup,
+                          theNbAttr,
+                          theId,
+                          theValue));
+    }
+
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 const std::string& theValue,
+                 TInt theId,
+                 const MED::TStringSet& theGroupNames, 
+                 const MED::TStringVector& theAttrDescs = MED::TStringVector(), 
+                 const MED::TIntVector& theAttrIds = MED::TIntVector(), 
+                 const MED::TIntVector& theAttrVals = MED::TIntVector())
+    {
+      return PFamilyInfo(new TTFamilyInfo<eVersion>
+                         (theMeshInfo,
+                          theValue,
+                          theId,
+                          theGroupNames,
+                          theAttrDescs,
+                          theAttrIds,
+                          theAttrVals));
+    }
+
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 const PFamilyInfo& theInfo)
+    {
+      return PFamilyInfo(new TTFamilyInfo<eVersion>
+                         (theMeshInfo,
+                          theInfo));
+    }
+
+    //----------------------------------------------------------------------------
+    virtual
+    PElemInfo
+    CrElemInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               EBooleen theIsElemNum = eVRAI,
+               EBooleen theIsElemNames = eVRAI)
+    {
+      return PElemInfo(new TTElemInfo<eVersion>
+                       (theMeshInfo,
+                        theNbElem,
+                        theIsElemNum,
+                        theIsElemNames));
+    }
+
+    virtual
+    PElemInfo
+    CrElemInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               const TIntVector& theFamNum,
+               const TIntVector& aElemNum,
+               const TStringVector& aElemNames)
+    {
+      return PElemInfo(new TTElemInfo<eVersion>
+                       (theMeshInfo,
+                        theNbElem,
+                        theFamNum,
+                        aElemNum,
+                        aElemNames));
+    }
+
+    //----------------------------------------------------------------------------
+    virtual
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               EModeSwitch theMode = eFULL_INTERLACE,
+               ERepere theSystem = eCART, 
+               EBooleen theIsElemNum = eVRAI,
+               EBooleen theIsElemNames = eVRAI)
+    {
+      return PNodeInfo(new TTNodeInfo<eVersion>
+                       (theMeshInfo,
+                        theNbElem,
+                        theMode,
+                        theSystem,
+                        theIsElemNum,
+                        theIsElemNames));
+    }
+
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+               const TFloatVector& theNodeCoords,
+               EModeSwitch theMode = eFULL_INTERLACE,
+               ERepere theSystem = eCART, 
+               const TStringVector& theCoordNames = TStringVector(),
+               const TStringVector& theCoordUnits = TStringVector(),
+               const TIntVector& theFamilyNums = TIntVector(),
+               const TIntVector& theElemNums = TIntVector(),
+               const TStringVector& theElemNames = TStringVector())
+    {
+      return PNodeInfo(new TTNodeInfo<eVersion>
+                       (theMeshInfo,
+                        theNodeCoords,
+                        theMode,
+                        theSystem,
+                        theCoordNames,
+                        theCoordUnits,
+                        theFamilyNums,
+                        theElemNums,
+                        theElemNames));
+    }
+
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo,
+               const PNodeInfo& theInfo)
+    {
+      return PNodeInfo(new TTNodeInfo<eVersion>
+                       (theMeshInfo,
+                        theInfo));
+    }
+    
+    //----------------------------------------------------------------------------
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theConnSize,
+                   EConnectivite theConnMode = eNOD,
+                   EBooleen theIsElemNum = eVRAI,
+                   EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolygoneInfo(new TTPolygoneInfo<eVersion>
+                           (theMeshInfo,
+                            theEntity,
+                            theGeom,
+                            theNbElem,
+                            theConnSize,
+                            theConnMode,
+                            theIsElemNum,
+                            theIsElemNames));
+    }
+
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode = eNOD,
+                   const TIntVector& theFamilyNums = TIntVector(),
+                   const TIntVector& theElemNums = TIntVector(),
+                   const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolygoneInfo(new TTPolygoneInfo<eVersion>
+                           (theMeshInfo,
+                            theEntity,
+                            theGeom,
+                            theIndexes,
+                            theConnectivities,
+                            theConnMode,
+                            theFamilyNums,
+                            theElemNums,
+                            theElemNames));
+    }
+
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+                   const PPolygoneInfo& theInfo)
+    {
+      return PPolygoneInfo(new TTPolygoneInfo<eVersion>
+                           (theMeshInfo,
+                            theInfo));
+    }
+    
+    //----------------------------------------------------------------------------
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theNbFaces,
+                   TInt theConnSize,
+                   EConnectivite theConnMode = eNOD,
+                   EBooleen theIsElemNum = eVRAI,
+                   EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolyedreInfo(new TTPolyedreInfo<eVersion>
+                           (theMeshInfo,
+                            theEntity,
+                            theGeom,
+                            theNbElem,
+                            theNbFaces,
+                            theConnSize,
+                            theConnMode,
+                            theIsElemNum,
+                            theIsElemNames));
+    }
+
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theFaces,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode = eNOD,
+                   const TIntVector& theFamilyNums = TIntVector(),
+                   const TIntVector& theElemNums = TIntVector(),
+                   const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolyedreInfo(new TTPolyedreInfo<eVersion>
+                           (theMeshInfo,
+                            theEntity,
+                            theGeom,
+                            theIndexes,
+                            theFaces,
+                            theConnectivities,
+                            theConnMode,
+                            theFamilyNums,
+                            theElemNums,
+                            theElemNames));
+    }
+
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+                   const PPolyedreInfo& theInfo)
+    {
+      return PPolyedreInfo(new TTPolyedreInfo<eVersion>
+                           (theMeshInfo,
+                            theInfo));
+    }
+
+    //----------------------------------------------------------------------------
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TInt theNbElem,
+               EConnectivite theConnMode = eNOD,
+               EBooleen theIsElemNum = eVRAI,
+               EBooleen theIsElemNames = eVRAI,
+               EModeSwitch theMode = eFULL_INTERLACE)
+    {
+      return PCellInfo(new TTCellInfo<eVersion>
+                       (theMeshInfo,
+                        theEntity,
+                        theGeom,
+                        theNbElem,
+                        theConnMode,
+                        theIsElemNum,
+                        theIsElemNames,
+                        theMode));
+    }
+
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               const TIntVector& theConnectivities,
+               EConnectivite theConnMode = eNOD,
+               const TIntVector& theFamilyNums = TIntVector(),
+               const TIntVector& theElemNums = TIntVector(),
+               const TStringVector& theElemNames = TStringVector(),
+               EModeSwitch theMode = eFULL_INTERLACE)
+    {
+      return PCellInfo(new TTCellInfo<eVersion>
+                       (theMeshInfo,
+                        theEntity,
+                        theGeom,
+                        theConnectivities,
+                        theConnMode,
+                        theFamilyNums,
+                        theElemNums,
+                        theElemNames,
+                        theMode));
+    }
+
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo,
+               const PCellInfo& theInfo)
+    {
+      return PCellInfo(new TTCellInfo<eVersion>
+                       (theMeshInfo,
+                        theInfo));
+    }
+    
+    //----------------------------------------------------------------------------
+    //! Creates a MEDWrapper MED Balls representation
+    virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo, 
+                                 TInt             theNbBalls,
+                                 EBooleen         theIsElemNum = eVRAI)
+    {
+      return PBallInfo( new TTBallInfo<eVersion>( theMeshInfo, theNbBalls, theIsElemNum ));
+    }
+
+    //! Creates a MEDWrapper MED Balls representation
+    virtual PBallInfo CrBallInfo(const PMeshInfo&  theMeshInfo, 
+                                 const TIntVector& theNodes,
+                                 TFloatVector&     theDiameters,
+                                 const TIntVector& theFamilyNums = TIntVector(),
+                                 const TIntVector& theElemNums = TIntVector())
+    {
+      return PBallInfo( new TTBallInfo<eVersion>( theMeshInfo, theNodes, theDiameters,
+                                                  theFamilyNums, theElemNums));
+    }
+
+    //! A copy-constructor for the MEDWrapper MED Balls representation
+    virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo,
+                                 const PBallInfo& theInfo)
+    {
+      return PBallInfo( new TTBallInfo<eVersion>( theMeshInfo, theInfo ));
+    }
+
+    //----------------------------------------------------------------------------
+    virtual
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo, 
+                TInt theNbComp = 0,
+                ETypeChamp theType = eFLOAT64,
+                const std::string& theValue = "",
+                EBooleen theIsLocal = eVRAI,
+                TInt theNbRef = 1)
+    {
+      return PFieldInfo(new TTFieldInfo<eVersion>
+                        (theMeshInfo,
+                         theNbComp,
+                         theType,
+                         theValue,
+                         theIsLocal,
+                         theNbRef));
+    }
+
+    virtual
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo,
+                const PFieldInfo& theInfo)
+    {
+      return PFieldInfo(new TTFieldInfo<eVersion>
+                        (theMeshInfo,
+                         theInfo));
+    }
+    
+
+    //----------------------------------------------------------------------------
+    virtual
+    PTimeStampInfo
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
+                    EEntiteMaillage theEntity,
+                    const TGeom2Size& theGeom2Size,
+                    const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
+                    TInt theNumDt = 0,
+                    TInt theNumOrd = 0,
+                    TFloat theDt = 0,
+                    const std::string& theUnitDt = "",
+                    const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss())
+    {
+      return PTimeStampInfo(new TTTimeStampInfo<eVersion>
+                            (theFieldInfo,
+                             theEntity,
+                             theGeom2Size,
+                             theGeom2NbGauss,
+                             theNumDt,
+                             theNumOrd,
+                             theDt,
+                             theUnitDt,
+                             theGeom2Gauss));
+    }
+
+    virtual
+    PTimeStampInfo
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+                    const PTimeStampInfo& theInfo)
+    {
+      return PTimeStampInfo(new TTTimeStampInfo<eVersion>
+                            (theFieldInfo,
+                             theInfo));
+    }
+
+
+    //----------------------------------------------------------------------------
+    virtual
+    PGaussInfo
+    CrGaussInfo(const TGaussInfo::TInfo& theInfo,
+                EModeSwitch theMode = eFULL_INTERLACE)
+    {
+      return PGaussInfo(new TTGaussInfo<eVersion>
+                        (theInfo,
+                         theMode));
+    }
+    
+
+    //----------------------------------------------------------------------------
+    virtual
+    PProfileInfo
+    CrProfileInfo(const TProfileInfo::TInfo& theInfo,
+                  EModeProfil theMode = eCOMPACT)
+    {
+      return PProfileInfo(new TTProfileInfo<eVersion>
+                           (theInfo,
+                            theMode));
+    }
+    
+
+    //----------------------------------------------------------------------------
+    virtual
+    PTimeStampValueBase
+    CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     ETypeChamp theTypeChamp,
+                     const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
+                     EModeSwitch theMode = eFULL_INTERLACE)
+    {
+      if(theTypeChamp == eFLOAT64)
+        return PTimeStampValueBase(new TTTimeStampValue<eVersion, TFloatMeshValue>
+                                   (theTimeStampInfo,
+                                    theTypeChamp,
+                                    theGeom2Profile,
+                                    theMode));
+      return PTimeStampValueBase(new TTTimeStampValue<eVersion, TIntMeshValue>
+                                 (theTimeStampInfo,
+                                  theTypeChamp,
+                                  theGeom2Profile,
+                                  theMode));
+    }
+
+    virtual
+    PTimeStampValueBase
+    CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const PTimeStampValueBase& theInfo,
+                     ETypeChamp theTypeChamp)
+    {
+      if(theTypeChamp == eFLOAT64)
+        return PTimeStampValueBase(new TTTimeStampValue<eVersion, TFloatMeshValue>
+                                   (theTimeStampInfo,
+                                    theInfo,
+                                    theTypeChamp));
+      return PTimeStampValueBase(new TTTimeStampValue<eVersion, TIntMeshValue>
+                                 (theTimeStampInfo,
+                                  theInfo,
+                                  theTypeChamp));
+    }
+    
+    //----------------------------------------------------------------------------
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const PGrilleInfo& theInfo)
+    {
+      return PGrilleInfo(new TTGrilleInfo<eVersion>
+                            (theMeshInfo,
+                             theInfo));
+    }
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type)
+    {
+      return PGrilleInfo(new TTGrilleInfo<eVersion>
+                            (theMeshInfo,
+                             type));
+    }
+
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type,
+                 const TInt& nbNodes)
+    {
+      return PGrilleInfo(new TTGrilleInfo<eVersion>
+                            (theMeshInfo,
+                             type,
+                             nbNodes));
+    }
+
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type,
+                 const MED::TIntVector& nbNodeVec)
+    {
+      return PGrilleInfo(new TTGrilleInfo<eVersion>
+                            (theMeshInfo,
+                             type,
+                             nbNodeVec));
+    }
+    //----------------------------------------------------------------------------
+  };
+
+}
+
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_Utilities.cxx b/src/MEDWrapper/Base/MED_Utilities.cxx
new file mode 100644 (file)
index 0000000..49cd74a
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright (C) 2007-2013  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 "MED_Utilities.hxx"
+#include "MED_Common.hxx"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+// static int MYDEBUG = 0;
+#endif
+
+
+int MED::PrefixPrinter::myCounter = 0;
+
+MED::PrefixPrinter::PrefixPrinter(bool theIsActive):
+  myIsActive(theIsActive)
+{
+  if(myIsActive)
+    myCounter++;
+  MSG(MYDEBUG,"MED::PrefixPrinter::PrefixPrinter(...)- "<<myCounter);
+}
+
+MED::PrefixPrinter::~PrefixPrinter()
+{
+  if(myIsActive){
+    myCounter--;
+    if(myCounter < 0)
+      EXCEPTION(runtime_error,"PrefixPrinter::~PrefixPrinter() - myCounter("<<myCounter<<") < 0");
+  }
+}
+
+string MED::PrefixPrinter::GetPrefix()
+{
+  if(myCounter){
+    if(myCounter < 0)
+      EXCEPTION(runtime_error,"PrefixPrinter::~PrefixPrinter() - myCounter("<<myCounter<<") < 0");
+    return string(myCounter*2,' ');
+  }
+  return "";
+}
+
+
+static MED::TEntity2GeomSet Entity2GeomSet;
+
+bool InitEntity2GeomSet()
+{
+  using namespace MED;
+
+  TGeomSet& aGeomARETESet = Entity2GeomSet[eARETE];
+  aGeomARETESet.insert(eSEG2);
+  aGeomARETESet.insert(eSEG3);
+
+  TGeomSet& aGeomFACESet = Entity2GeomSet[eFACE];
+  aGeomFACESet.insert(eTRIA3);
+  aGeomFACESet.insert(eQUAD4);
+  aGeomFACESet.insert(eTRIA6);
+  aGeomFACESet.insert(eTRIA7);
+  aGeomFACESet.insert(eQUAD8);
+  aGeomFACESet.insert(eQUAD9);
+  aGeomFACESet.insert(ePOLYGONE);
+
+  TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
+  aGeomMAILLESet.insert(ePOINT1);
+  aGeomMAILLESet.insert(aGeomARETESet.begin(),aGeomARETESet.end());
+  aGeomMAILLESet.insert(aGeomFACESet.begin(),aGeomFACESet.end());
+  aGeomMAILLESet.insert(eTETRA4);
+  aGeomMAILLESet.insert(ePYRA5);
+  aGeomMAILLESet.insert(ePENTA6);
+  aGeomMAILLESet.insert(eHEXA8);
+  aGeomMAILLESet.insert(eOCTA12);
+  aGeomMAILLESet.insert(eTETRA10);
+  aGeomMAILLESet.insert(ePYRA13);
+  aGeomMAILLESet.insert(ePENTA15);
+  aGeomMAILLESet.insert(eHEXA20);
+  aGeomMAILLESet.insert(eHEXA27);
+  aGeomMAILLESet.insert(ePOLYEDRE);
+
+  /* This combination allows reading nb of models of structure elements */
+  Entity2GeomSet[eSTRUCT_ELEMENT].insert(eAllGeoType); 
+
+  return true;
+}
+
+static bool anIsInited = InitEntity2GeomSet();
+
+const MED::TEntity2GeomSet& MED::GetEntity2GeomSet()
+{
+  return Entity2GeomSet;
+}
+
+
diff --git a/src/MEDWrapper/Base/MED_Utilities.hxx b/src/MEDWrapper/Base/MED_Utilities.hxx
new file mode 100644 (file)
index 0000000..39e7cf8
--- /dev/null
@@ -0,0 +1,74 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_Utilities_HeaderFile
+#define MED_Utilities_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+
+#include <iostream>     
+#include <sstream>      
+#include <string>
+#include <string.h>
+#include <stdexcept>
+
+
+namespace MED
+{
+  class MEDWRAPPER_EXPORT PrefixPrinter
+  {
+    static int myCounter;
+    bool myIsActive;
+  public:
+    PrefixPrinter(bool theIsActive = true);
+    ~PrefixPrinter();
+
+    static std::string GetPrefix();
+  };
+}
+
+#ifdef _DEBUG_
+  #define MSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg<<" ("<<__FILE__<<" ["<<__LINE__<<"])\n"
+  #define BEGMSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg
+  #define INITMSGA(deb,lev,msg) MED::PrefixPrinter aPrefixPrinter_##lev(deb); BEGMSG(deb,msg)
+  #define INITMSG(deb,msg) INITMSGA(deb,,msg)
+  #define ADDMSG(deb,msg) if(deb) std::cout<<msg
+#else
+  #define MSG(deb,msg)
+  #define BEGMSG(deb,msg)
+  #define INITMSGA(deb,lev,msg)
+  #define INITMSG(deb,msg)
+  #define ADDMSG(deb,msg)
+#endif
+
+
+#ifndef EXCEPTION
+
+#define EXCEPTION(TYPE, MSG) {\
+  std::ostringstream aStream;\
+  aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
+  throw TYPE(aStream.str().c_str());\
+}
+
+#endif
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_Vector.hxx b/src/MEDWrapper/Base/MED_Vector.hxx
new file mode 100644 (file)
index 0000000..94e894f
--- /dev/null
@@ -0,0 +1,153 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_Vector_HeaderFile
+#define MED_Vector_HeaderFile
+
+#include <vector>
+#include <stdexcept>
+
+//#if defined(_DEBUG_)
+#  define MED_TVECTOR_CHECK_RANGE
+//#endif
+
+namespace MED
+{
+
+  //! Main purpose to introduce the class was to customize operator [] 
+  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+  class TVector : public std::vector<_Tp, _Alloc>
+  {
+  public:
+    typedef size_t size_type;
+
+    typedef std::vector<_Tp, _Alloc> superclass;
+    typedef typename superclass::allocator_type allocator_type;
+
+    typedef _Tp value_type;
+    typedef value_type& reference;
+    typedef const value_type& const_reference;
+
+  protected:
+    void
+    check_range(size_type __n) const
+    {
+      if (__n >= this->size())
+        throw std::out_of_range("TVector [] access out of range");
+    }
+
+    const_reference
+    get_value(size_type __n) const
+    {
+      return superclass::operator[](__n);
+    }
+
+    reference
+    get_value(size_type __n)
+    {
+      return superclass::operator[](__n);
+    }
+
+  public:
+    explicit
+    TVector(const allocator_type& __a = allocator_type()): 
+      superclass(__a) 
+    {}
+    
+    TVector(size_type __n, const value_type& __val,
+            const allocator_type& __a = allocator_type()):
+      superclass(__n, __val, __a)
+    {}
+    
+    explicit
+    TVector(size_type __n):
+      superclass(__n)
+    {}
+
+    TVector(const TVector& __x):
+      superclass(__x)
+    {}
+
+    template<typename _InputIterator>
+    TVector(_InputIterator __first, _InputIterator __last,
+            const allocator_type& __a = allocator_type()):
+      superclass(__first, __last, __a)
+    {}
+
+    template<typename _Yp, typename _Al>
+    TVector(TVector<_Yp, _Al> __y):
+      superclass(__y.begin(), __y.end())
+    {}
+
+    TVector&
+    operator=(const TVector& __x)
+    {
+      superclass::operator=(__x);
+      return *this;
+    }
+
+    template<typename _Yp, typename _Al>
+    TVector&
+    operator=(TVector<_Yp, _Al> __y)
+    {
+      this->assign(__y.begin(), __y.end());
+      return *this;
+    }
+
+    reference
+    operator[](size_type __n)
+    {
+#if defined(MED_TVECTOR_CHECK_RANGE)
+      check_range(__n);
+#endif
+      return get_value(__n);
+    }
+
+    const_reference
+    operator[](size_type __n) const
+    {
+#if defined(MED_TVECTOR_CHECK_RANGE)
+      check_range(__n);
+#endif
+      return get_value(__n);
+    }
+
+    reference
+    at(size_type __n)
+    {
+      check_range(__n);
+      return get_value(__n);
+    }
+
+    const_reference
+    at(size_type __n) const
+    {
+      check_range(__n);
+      return get_value(__n);
+    }
+  };
+
+}
+
+#undef MED_TVECTOR_CHECK_RANGE
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_Wrapper.cxx b/src/MEDWrapper/Base/MED_Wrapper.cxx
new file mode 100644 (file)
index 0000000..d04c284
--- /dev/null
@@ -0,0 +1,707 @@
+// Copyright (C) 2007-2013  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   : MED_Wrapper.cxx
+//  Author : Alexey PETROV
+//
+#include "MED_Wrapper.hxx"
+#include "MED_Utilities.hxx"
+#include <boost/version.hpp>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+#else
+// static int MYDEBUG = 0;
+// static int MYVALUEDEBUG = 0;
+#endif
+
+namespace MED
+{
+  TLockProxy
+  ::TLockProxy(TWrapper* theWrapper):
+    myWrapper(theWrapper)
+  {
+#if BOOST_VERSION >= 103500
+    myWrapper->myMutex.lock();
+#else
+    boost::detail::thread::lock_ops<TWrapper::TMutex>::lock(myWrapper->myMutex);
+#endif
+    INITMSG(MYDEBUG,"TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
+  }
+  
+  TLockProxy
+  ::~TLockProxy()
+  {
+    INITMSG(MYDEBUG,"~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
+#if BOOST_VERSION >= 103500
+    myWrapper->myMutex.unlock();
+#else
+    boost::detail::thread::lock_ops<TWrapper::TMutex>::unlock(myWrapper->myMutex);
+#endif
+  }
+  
+  TWrapper*
+  TLockProxy
+  ::operator-> () const // never throws
+  {
+    return myWrapper;
+  }
+
+  //----------------------------------------------------------------------------
+  TWrapper::~TWrapper()
+  {
+  }
+
+  //----------------------------------------------------------------------------
+  PMeshInfo
+  TWrapper
+  ::GetPMeshInfo(TInt theId,
+                 TErr* theErr)
+  {
+    PMeshInfo anInfo = CrMeshInfo();
+    GetMeshInfo(theId,*anInfo,theErr);
+    return anInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
+  PFamilyInfo 
+  TWrapper
+  ::GetPFamilyInfo(const PMeshInfo& theMeshInfo, 
+                   TInt theId,
+                   TErr* theErr)
+  {
+    // must be reimplemented in connection with mesh type eSTRUCTURE
+    //     if(theMeshInfo->GetType() != eNON_STRUCTURE)
+    //       return PFamilyInfo();
+    
+    TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
+    TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
+    PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
+    GetFamilyInfo(theId,*anInfo,theErr);
+
+#ifdef _DEBUG_
+    std::string aName = anInfo->GetName();
+    INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
+            "'; andId = "<<anInfo->GetId()<<
+            "; aNbAttr = "<<aNbAttr<<
+            "; aNbGroup = "<<aNbGroup<<"\n");
+    for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
+      aName = anInfo->GetGroupName(iGroup);
+      INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
+    }
+#endif
+    
+    return anInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
+  PNodeInfo
+  TWrapper
+  ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
+                 TErr* theErr)
+  {
+    TInt aNbElems = GetNbNodes(*theMeshInfo);
+    if(aNbElems == 0){
+      return PNodeInfo();
+    }
+
+    PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
+    GetNodeInfo(*anInfo,theErr);
+
+#ifdef _DEBUG_
+    TInt aDim = theMeshInfo->myDim;
+    TInt aNbElem = anInfo->GetNbElem();
+    INITMSG(MYDEBUG,"GetPNodeInfo: ");
+    {
+      INITMSG(MYDEBUG,"aCoords: "<<aNbElem<<": ");
+      TNodeCoord& aCoord = anInfo->myCoord;
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+        for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
+          ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
+        }
+        ADDMSG(MYVALUEDEBUG," ");
+      }
+      ADDMSG(MYDEBUG, std::endl);
+      
+      BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+      }
+      ADDMSG(MYVALUEDEBUG, std::endl);
+      
+      if(anInfo->IsElemNum()){
+        BEGMSG(MYVALUEDEBUG,"GetElemNum: ");
+        for(TInt iElem = 0; iElem < aNbElem; iElem++){
+          ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+        }
+        ADDMSG(MYVALUEDEBUG, std::endl);
+      }
+    }
+    ADDMSG(MYDEBUG, std::endl);
+#endif
+    
+    return anInfo;
+  }
+
+  //----------------------------------------------------------------------------
+  PPolygoneInfo
+  TWrapper
+  ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+                     EEntiteMaillage theEntity, 
+                     EGeometrieElement theGeom, 
+                     EConnectivite theConnMode)
+  {
+    if(theMeshInfo->GetType() != eNON_STRUCTURE)
+      return PPolygoneInfo();
+
+    TInt aNbElem = GetNbPolygones(theMeshInfo,theEntity,theGeom,theConnMode);
+    TInt aConnSize = GetPolygoneConnSize(theMeshInfo,theEntity,theGeom,theConnMode);
+    PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,theEntity,theGeom,aNbElem,aConnSize,theConnMode);
+    GetPolygoneInfo(anInfo);
+
+#ifdef _DEBUG_
+    INITMSG(MYDEBUG,"GetPPolygoneInfo"<<
+            " - theGeom = "<<theGeom<<
+            "; aNbElem = "<<aNbElem<<": ");
+    for(TInt iElem = 1; iElem < aNbElem; iElem++){
+      TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
+      TInt aConnDim = aConnSlice.size();
+      for(TInt iConn = 0; iConn < aConnDim; iConn++){
+        ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
+      }
+      ADDMSG(MYDEBUG," ");
+    }
+    ADDMSG(MYDEBUG, std::endl);
+#endif
+
+    return anInfo;
+  }
+  
+  //----------------------------------------------------------------------------
+  PPolyedreInfo
+  TWrapper
+  ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+                     EEntiteMaillage theEntity, 
+                     EGeometrieElement theGeom, 
+                     EConnectivite theConnMode)
+  {
+    if(theMeshInfo->GetType() != eNON_STRUCTURE)
+      return PPolyedreInfo();
+    TInt aNbElem  = GetNbPolyedres(theMeshInfo,theEntity,theGeom,theConnMode);
+    TInt aNbFaces, aConnSize;
+    GetPolyedreConnSize(theMeshInfo,aNbFaces,aConnSize,theConnMode);
+    PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,theEntity,theGeom,aNbElem,aNbFaces,aConnSize,theConnMode);
+    GetPolyedreInfo(anInfo);
+
+#ifdef _DEBUG_
+    INITMSG(MYDEBUG,"GetPPolyedreInfo"<<
+            " - theGeom = "<<theGeom<<
+            "; aNbElem = "<<aNbElem<<": ");
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
+      TInt aNbFaces = aConnSliceArr.size();
+      ADDMSG(MYDEBUG,"{");
+      for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+        TCConnSlice aConnSlice = aConnSliceArr[iFace];
+        TInt aNbConn = aConnSlice.size();
+        ADDMSG(MYDEBUG,"[");
+        for(TInt iConn = 0; iConn < aNbConn; iConn++){
+          ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
+        }
+        ADDMSG(MYDEBUG,"] ");
+      }
+      ADDMSG(MYDEBUG,"} ");
+    }
+    ADDMSG(MYDEBUG, std::endl);
+#endif
+
+    return anInfo;
+  }
+  
+  //----------------------------------------------------------------------------
+  PElemInfo 
+  TWrapper
+  ::GetPElemInfo(const PMeshInfo& theMeshInfo,
+                 EEntiteMaillage theEntity, 
+                 EGeometrieElement theGeom, 
+                 EConnectivite theConnMode,
+                 TErr* theErr)
+  {
+    EMaillage aType = theMeshInfo->GetType();
+    if(aType == eNON_STRUCTURE){
+      switch(theGeom){
+      case ePOINT1:
+        if(theEntity == eNOEUD)
+          return GetPNodeInfo(theMeshInfo,theErr);
+        return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
+        break;
+      case ePOLYGONE:
+        return GetPPolygoneInfo(theMeshInfo,theEntity,theGeom,theConnMode);
+        break;
+      case ePOLYEDRE:
+        return GetPPolyedreInfo(theMeshInfo,theEntity,theGeom,theConnMode);
+        break;
+      default:
+        return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
+      }
+    } else {
+      PGrilleInfo aGrille = GetPGrilleInfo(theMeshInfo);
+
+      TInt nbElems;
+      EBooleen theIsElemNum = eFAUX;
+      // nodes
+      switch(theGeom){
+      case ePOINT1:
+        nbElems = aGrille->GetNbNodes();
+        theIsElemNum = eVRAI;
+        break;
+      case eSEG2:
+      case eQUAD4:
+      case eHEXA8:
+        nbElems = aGrille->GetNbCells();
+        break;
+      default:
+        nbElems = 0;
+      }
+      
+      TIntVector aFamNum;
+      TIntVector aElemNum;
+      TStringVector aElemNames;
+      
+      PElemInfo aElemInfo;
+
+      if(theGeom == ePOINT1){
+        aElemInfo = CrElemInfo(theMeshInfo,
+                               nbElems,
+                               theIsElemNum);
+        MED::TElemInfo &aTElemInfo = *aElemInfo;
+
+        // must be reimplemente in connection with mesh type eSTRUCTURE
+//      GetNumeration(aTElemInfo,
+//                    nbElems,
+//                    theEntity,
+//                    theGeom,
+//                    theErr);
+        
+        GetFamilies(aTElemInfo,
+                    nbElems,
+                    theEntity,
+                    theGeom,
+                    theErr);
+        
+        // must be reimplemente in connection with mesh type eSTRUCTURE
+//      GetNames(aTElemInfo,
+//               nbElems,
+//               theEntity,
+//               theGeom,
+//               theErr);
+      } else {
+        aElemInfo = CrElemInfo(theMeshInfo,
+                               nbElems,
+                               aFamNum,
+                               aElemNum,
+                               aElemNames);
+      }
+      
+      return aElemInfo;
+    }
+    return PElemInfo();
+  }
+
+
+  //----------------------------------------------------------------------------
+  PCellInfo 
+  TWrapper
+  ::GetPCellInfo(const PMeshInfo& theMeshInfo,
+                 EEntiteMaillage theEntity, 
+                 EGeometrieElement theGeom, 
+                 EConnectivite theConnMode,
+                 TErr* theErr)
+  {
+    if(theMeshInfo->GetType() != eNON_STRUCTURE)
+      return PCellInfo();
+    TInt aNbElem = GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode);
+    PCellInfo anInfo = CrCellInfo(theMeshInfo,theEntity,theGeom,aNbElem,theConnMode);
+    GetCellInfo(anInfo,theErr);
+
+#ifdef _DEBUG_
+    TInt aConnDim = anInfo->GetConnDim();
+    INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
+    BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
+      for(TInt iConn = 0; iConn < aConnDim; iConn++){
+        ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
+      }
+      ADDMSG(MYVALUEDEBUG," ");
+    }
+    ADDMSG(MYDEBUG, std::endl);
+
+    BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetFamNum: ");
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+    }
+    ADDMSG(MYVALUEDEBUG, std::endl);
+
+    if(anInfo->IsElemNum()){
+      BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetElemNum: ");
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+      }
+      ADDMSG(MYVALUEDEBUG, std::endl);
+    }
+    ADDMSG(MYDEBUG, std::endl);
+#endif
+    
+    return anInfo;
+  }
+
+  //----------------------------------------------------------------------------
+  //! Read a MEDWrapped representation of MED Balls from the MED file
+  PBallInfo
+  TWrapper
+  ::GetPBallInfo(const PMeshInfo& theMeshInfo)
+  {
+    TInt nbBalls = GetNbBalls(theMeshInfo);
+    if ( nbBalls < 1 ) return PBallInfo();
+
+    PBallInfo anInfo = CrBallInfo( theMeshInfo, nbBalls );
+    GetBallInfo(anInfo);
+
+    return anInfo;
+  }
+  //----------------------------------------------------------------------------
+  PFieldInfo
+  TWrapper
+  ::GetPFieldInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theId,
+                  TErr* theErr)
+  {
+    TInt aNbComp = GetNbComp(theId);
+    PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
+    GetFieldInfo(theId,*anInfo,theErr);
+
+#ifdef _DEBUG_
+    INITMSG(MYDEBUG,
+            "GetPFieldInfo "<<
+            "- aName = '"<<anInfo->GetName()<<"'"<<
+            "; aType = "<<anInfo->GetType()<<
+            "; aNbComp = "<<aNbComp<<
+            std::endl);
+#endif
+    
+    return anInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
+  PTimeStampInfo
+  TWrapper
+  ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
+                      EEntiteMaillage theEntity,
+                      const TGeom2Size& theGeom2Size,
+                      TInt theId,
+                      TErr* theErr)
+  {
+    PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom2Size);
+    GetTimeStampInfo(theId,*anInfo,theErr);
+
+#ifdef _DEBUG_
+    INITMSG(MYDEBUG,"GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
+    TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
+    TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
+    for(; anIter != aGeom2NbGauss.end(); anIter++){
+      const EGeometrieElement& aGeom = anIter->first;
+      INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
+    }
+#endif
+
+    return anInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
+  PProfileInfo
+  TWrapper
+  ::GetPProfileInfo(TInt theId,
+                    EModeProfil theMode,
+                    TErr* theErr)
+  {
+    TProfileInfo::TInfo aPreInfo = GetProfilePreInfo(theId);
+    PProfileInfo anInfo = CrProfileInfo(aPreInfo,theMode);
+    GetProfileInfo(theId,*anInfo,theErr);
+
+    return anInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
+  PTimeStampValueBase
+  TWrapper
+  ::CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const TGeom2Profile& theGeom2Profile,
+                     EModeSwitch theMode)
+  {
+    PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
+    return CrTimeStampValue(theTimeStampInfo,
+                            aFieldInfo->GetType(),
+                            theGeom2Profile,
+                            theMode);
+  }
+
+  //----------------------------------------------------------------------------
+  PTimeStampValueBase
+  TWrapper
+  ::CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const PTimeStampValueBase& theInfo)
+  {
+    PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
+    return CrTimeStampValue(theTimeStampInfo,
+                            theInfo,
+                            aFieldInfo->GetType());
+  }
+
+  //----------------------------------------------------------------------------
+  template<class TimeStampValueType>
+  void
+  Print(SharedPtr<TimeStampValueType> theTimeStampValue)
+  {
+    INITMSG(MYDEBUG,"Print - TimeStampValue\n");
+    typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
+    typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
+    for(; anIter != aGeom2Value.end(); anIter++){
+      const EGeometrieElement& aGeom = anIter->first;
+      const typename TimeStampValueType::TTMeshValue& aMeshValue = anIter->second;
+      TInt aNbElem = aMeshValue.myNbElem;
+      TInt aNbGauss = aMeshValue.myNbGauss;
+      TInt aNbComp = aMeshValue.myNbComp;
+      INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+        typename TimeStampValueType::TTMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+        ADDMSG(MYVALUEDEBUG,"{");
+        for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+          const typename TimeStampValueType::TTMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+          for(TInt iComp = 0; iComp < aNbComp; iComp++){
+            ADDMSG(MYVALUEDEBUG,aValueSlice[iComp]<<" ");
+          }
+          ADDMSG(MYVALUEDEBUG,"| ");
+        }
+        ADDMSG(MYVALUEDEBUG,"} ");
+      }
+      ADDMSG(MYDEBUG,"\n");
+    }
+  }
+
+  //----------------------------------------------------------------------------
+  PTimeStampValueBase 
+  TWrapper
+  ::GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                       const TMKey2Profile& theMKey2Profile,
+                       const TKey2Gauss& theKey2Gauss,
+                       TErr* theErr)
+  {
+    PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
+    PTimeStampValueBase anInfo = CrTimeStampValue(theTimeStampInfo,
+                                                  aFieldInfo->GetType());
+    GetTimeStampValue(anInfo, 
+                      theMKey2Profile, 
+                      theKey2Gauss,
+                      theErr);
+#ifdef _DEBUG_
+    if(aFieldInfo->GetType() == eFLOAT64)
+      Print<TFloatTimeStampValue>(anInfo);
+    else
+      Print<TIntTimeStampValue>(anInfo);
+#endif
+    return anInfo;
+  }
+
+  //----------------------------------------------------------------------------
+  void 
+  TWrapper
+  ::GetTimeStampVal(const PTimeStampVal& theVal,
+                    const TMKey2Profile& theMKey2Profile,
+                    const TKey2Gauss& theKey2Gauss,
+                    TErr* theErr)
+  {
+    PTimeStampInfo aTimeStampInfo = theVal->GetTimeStampInfo();
+    PFieldInfo aFieldInfo = aTimeStampInfo->GetFieldInfo();
+    if(aFieldInfo->GetType() == eFLOAT64)
+      GetTimeStampValue(theVal,
+                        theMKey2Profile,
+                        theKey2Gauss,
+                        theErr);
+    else{
+      PTimeStampValueBase aVal = CrTimeStampValue(aTimeStampInfo,
+                                                  theVal,
+                                                  eINT);
+      GetTimeStampValue(aVal,
+                        theMKey2Profile,
+                        theKey2Gauss,
+                        theErr);
+      CopyTimeStampValueBase(aVal, theVal);
+    }
+  }
+
+  //----------------------------------------------------------------------------
+  void
+  TWrapper
+  ::SetTimeStamp(const PTimeStampVal& theVal,
+                 TErr* theErr)
+  {
+    PTimeStampInfo aTimeStampInfo = theVal->GetTimeStampInfo();
+    PFieldInfo aFieldInfo = aTimeStampInfo->GetFieldInfo();
+    if(aFieldInfo->GetType() == eFLOAT64)
+      SetTimeStampValue(theVal, theErr);
+    else{
+      PTimeStampValueBase aVal = CrTimeStampValue(aTimeStampInfo,
+                                                  eINT,
+                                                  theVal->GetGeom2Profile(),
+                                                  theVal->GetModeSwitch());
+      CopyTimeStampValueBase(theVal, aVal);
+      SetTimeStampValue(aVal, theErr);
+    }
+  }
+
+  //----------------------------------------------------------------------------
+  PTimeStampVal
+  TWrapper
+  ::CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                   const TGeom2Profile& theGeom2Profile,
+                   EModeSwitch theMode)
+  {
+    return CrTimeStampValue(theTimeStampInfo,
+                            eFLOAT64,
+                            theGeom2Profile,
+                            theMode);
+  }
+
+  //----------------------------------------------------------------------------
+  PTimeStampVal
+  TWrapper
+  ::CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                   const PTimeStampVal& theInfo)
+  {
+    return CrTimeStampValue(theTimeStampInfo,
+                            theInfo,
+                            eFLOAT64);
+  }
+
+  //----------------------------------------------------------------------------
+  PTimeStampVal 
+  TWrapper
+  ::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                     const TMKey2Profile& theMKey2Profile,
+                     const TKey2Gauss& theKey2Gauss,
+                     TErr* theErr)
+  {
+    PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
+    GetTimeStampVal(anInfo, 
+                    theMKey2Profile, 
+                    theKey2Gauss,
+                    theErr);
+    return anInfo;
+  }
+
+  //----------------------------------------------------------------------------
+  PGrilleInfo
+  TWrapper
+  ::GetPGrilleInfo(const PMeshInfo& theMeshInfo)
+  {
+    if(theMeshInfo->GetType() != eSTRUCTURE)
+      return PGrilleInfo();
+
+    EGrilleType type;
+    GetGrilleType(*theMeshInfo,type);
+    PGrilleInfo anInfo;
+    if(type == eGRILLE_STANDARD){
+      const TInt nnoeuds = GetNbNodes(*theMeshInfo);
+      anInfo = CrGrilleInfo(theMeshInfo,type,nnoeuds);
+    }
+    else {
+      TIntVector aVec;
+      aVec.resize(theMeshInfo->GetDim());
+      for(int aAxe=0;aAxe<theMeshInfo->GetDim();aAxe++){
+        ETable aATable;
+        switch(aAxe){
+        case 0:
+          aATable = eCOOR_IND1;
+          break;
+        case 1:
+          aATable = eCOOR_IND2;
+          break;
+        case 2:
+          aATable = eCOOR_IND3;
+          break;
+        }
+        aVec[aAxe] = GetNbNodes(*theMeshInfo,aATable);
+      }
+      anInfo = CrGrilleInfo(theMeshInfo,type,aVec);
+    }
+
+    GetGrilleInfo(anInfo);
+    anInfo->SetGrilleType(type);
+
+#ifdef _DEBUG_
+    INITMSG(MYDEBUG,"GetPGrilleInfo: ");
+    {
+      TInt aNbElem = anInfo->GetNbNodes();
+      BEGMSG(MYVALUEDEBUG,"GetFamNumNode: ");
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetFamNumNode(iElem)<<", ");
+      }
+      TInt aNbCells = anInfo->GetNbCells();
+      BEGMSG(MYVALUEDEBUG,"GetFamNum: ");
+      for(TInt iElem = 0; iElem < aNbCells; iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+      }
+      ADDMSG(MYVALUEDEBUG, std::endl);
+      BEGMSG(MYVALUEDEBUG,"GetCoordName: ");
+      for(TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetCoordName(iElem)<<", ");
+      }
+      ADDMSG(MYVALUEDEBUG, std::endl);
+      BEGMSG(MYVALUEDEBUG,"GetCoordUnit: ");
+      for(TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++){
+        ADDMSG(MYVALUEDEBUG,anInfo->GetCoordUnit(iElem)<<", ");
+      }
+      ADDMSG(MYVALUEDEBUG, std::endl);
+      
+    }
+#endif
+    
+    return anInfo;
+  }
+  
+  //----------------------------------------------------------------------------
+  PGrilleInfo
+  TWrapper
+  ::GetPGrilleInfo(const PMeshInfo& theMeshInfo,
+                   const PGrilleInfo& theInfo)
+  {
+    PGrilleInfo anInfo = CrGrilleInfo(theMeshInfo,theInfo);
+    return anInfo;
+  }  
+}
diff --git a/src/MEDWrapper/Base/MED_Wrapper.hxx b/src/MEDWrapper/Base/MED_Wrapper.hxx
new file mode 100644 (file)
index 0000000..027c9a5
--- /dev/null
@@ -0,0 +1,1052 @@
+// Copyright (C) 2007-2013  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
+//
+
+#ifndef MED_Wrapper_HeaderFile
+#define MED_Wrapper_HeaderFile
+
+#include "MED_WrapperBase.hxx"
+
+#include "MED_Structures.hxx"
+#include "MED_Algorithm.hxx"
+
+#include <boost/thread/mutex.hpp>
+
+namespace MED
+{
+
+  //----------------------------------------------------------------------------
+  //! Define a base class that wraps the MED API
+  struct MEDWRAPPER_EXPORT TWrapper
+  {
+    typedef boost::mutex TMutex;
+    //! This is a syncronization primitive which allow to support thread safety for the MED access
+    TMutex myMutex;
+
+    virtual
+    ~TWrapper();
+
+    //----------------------------------------------------------------------------
+    //! Gets version of the MED library used for the MED file
+    virtual 
+    EVersion
+    GetVersion() = 0;
+    
+    //----------------------------------------------------------------------------
+    //! Creates a MEDWrapper MED Mesh representation
+    virtual 
+    PMeshInfo 
+    CrMeshInfo(TInt theDim = 0, TInt theSpaceDim = 0,
+               const std::string& theValue = "",
+               EMaillage theType = eNON_STRUCTURE,
+               const std::string& theDesc = "") = 0;
+
+    //! A copy-constructor for the MEDWrapper MED Mesh representation
+    virtual 
+    PMeshInfo 
+    CrMeshInfo(const PMeshInfo& theInfo) = 0;
+
+    //! Read number of MED Mesh entities in the defined MED file
+    virtual 
+    TInt 
+    GetNbMeshes(TErr* theErr = NULL) = 0;
+    
+    //! Read a MEDWrapper MED Mesh representation by its number
+    virtual 
+    void 
+    GetMeshInfo(TInt theMeshId, 
+                TMeshInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+
+    //! Write the MEDWrapper MED Mesh representation in the defined MED file
+    virtual 
+    void
+    SetMeshInfo(const TMeshInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+    
+    //! Read a MEDWrapper MED Mesh representation by its number
+    virtual 
+    PMeshInfo
+    GetPMeshInfo(TInt theId,
+                 TErr* theErr = NULL);
+
+
+    //----------------------------------------------------------------------------
+    //! Read number of MED Family entities in the defined MED file
+    virtual 
+    TInt
+    GetNbFamilies(const TMeshInfo& theMeshInfo,
+                  TErr* theErr = NULL) = 0;
+
+    //! Read number of attributes for defined MED Family
+    virtual 
+    TInt
+    GetNbFamAttr(TInt theFamId, 
+                 const TMeshInfo& theInfo,
+                 TErr* theErr = NULL) = 0;
+    
+    //! Read number of MED Groups where MED Family with the number belong to
+    virtual
+    TInt
+    GetNbFamGroup(TInt theFamId, 
+                  const TMeshInfo& theInfo,
+                  TErr* theErr = NULL) = 0;
+    
+    //! Read a MEDWrapper MED Family representation by its number
+    virtual
+    void
+    GetFamilyInfo(TInt theFamId, 
+                  TFamilyInfo& theInfo,
+                  TErr* theErr = NULL) = 0;
+    
+    //! Write a MEDWrapper MED Family representation by its number
+    virtual
+    void
+    SetFamilyInfo(const TFamilyInfo& theInfo,
+                  TErr* theErr = NULL) = 0;
+    
+    //! Creates a MEDWrapper MED Family representation
+    virtual 
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 TInt theNbGroup = 0, 
+                 TInt theNbAttr = 0,
+                 TInt theId = 0,
+                 const std::string& theValue = "") = 0;
+    
+    //! Creates a MEDWrapper MED Family representation
+    virtual 
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 const std::string& theValue,
+                 TInt theId,
+                 const TStringSet& theGroupNames, 
+                 const TStringVector& theAttrDescs = TStringVector(), 
+                 const TIntVector& theAttrIds = TIntVector(), 
+                 const TIntVector& theAttrVals = TIntVector()) = 0;
+    
+    //! A copy-constructor for the MEDWrapper MED Family representation
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 const PFamilyInfo& theInfo) = 0;
+    
+    //! Write a MEDWrapper MED Family representation by its number
+    PFamilyInfo
+    GetPFamilyInfo(const PMeshInfo& theMeshInfo, 
+                   TInt theId,
+                   TErr* theErr = NULL);
+    
+    //----------------------------------------------------------------------------
+    //! Read sequence of names for any descendant of TElemInfo
+    virtual
+    void
+    GetNames(TElemInfo& theInfo,
+             TInt theNb,
+             EEntiteMaillage theEntity, 
+             EGeometrieElement theGeom,
+             TErr* theErr = NULL)
+    {}
+
+    //! Read sequence of numerous for any descendant of TElemInfo
+    virtual
+    void
+    GetNumeration(TElemInfo& theInfo,
+                  TInt theNb,
+                  EEntiteMaillage theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr* theErr = NULL)
+    {}
+
+    //! Read sequence MED Family indexes for any descendant of TElemInfo
+    virtual
+    void
+    GetFamilies(TElemInfo& theInfo,
+                TInt theNb,
+                EEntiteMaillage theEntity, 
+                EGeometrieElement theGeom,
+                TErr* theErr = NULL)
+    {}
+
+    //! Write sequence of names for any descendant of TElemInfo
+    virtual
+    void
+    SetNames(const TElemInfo& theInfo,
+             EEntiteMaillage theEntity, 
+             EGeometrieElement theGeom,
+             TErr* theErr = NULL)
+    {}
+
+    //! Write sequence of numerous for any descendant of TElemInfo
+    virtual
+    void
+    SetNumeration(const TElemInfo& theInfo,
+                  EEntiteMaillage theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr* theErr = NULL)
+    {}
+
+    //! Write sequence MED Family indexes for any descendant of TElemInfo
+    virtual
+    void
+    SetFamilies(const TElemInfo& theInfo,
+                EEntiteMaillage theEntity, 
+                EGeometrieElement theGeom,
+                TErr* theErr = NULL)
+    {}
+
+    //! Read a MEDWrapper MED Element representation from defined MED file
+    PElemInfo
+    GetPElemInfo(const PMeshInfo& theMeshInfo,
+                 EEntiteMaillage theEntity = eNOEUD, 
+                 EGeometrieElement theGeom = ePOINT1, 
+                 EConnectivite theConnMode = eNOD,
+                 TErr* theErr = NULL);
+
+    //----------------------------------------------------------------------------
+    //! Read number of nodes in defined MED Mesh
+    virtual
+    TInt
+    GetNbNodes(const TMeshInfo& theMeshInfo,
+               TErr* theErr = NULL) = 0;
+    
+    virtual
+    TInt
+    GetNbNodes(const TMeshInfo& theMeshInfo,
+               ETable theTable,
+               TErr* theErr = NULL)
+    {
+      return 0;
+    }
+
+    //! Read a MEDWrapper MED Nodes representation from defined MED file
+    virtual
+    void
+    GetNodeInfo(TNodeInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+
+    //! Write the MEDWrapper MED Nodes representation into defined MED file
+    virtual 
+    void
+    SetNodeInfo(const TNodeInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+    
+    //! Creates a MEDWrapper MED Nodes representation
+    virtual 
+    PElemInfo
+    CrElemInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               EBooleen theIsElemNum = eVRAI,
+               EBooleen theIsElemNames = eVRAI)
+    {
+      return PElemInfo();
+    }
+
+    //! Creates a MEDWrapper MED Nodes representation
+    virtual 
+    PElemInfo
+    CrElemInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               const TIntVector& theFamNum,
+               const TIntVector& aElemNum,
+               const TStringVector& aElemNames)
+    {
+      return PElemInfo();
+    }
+
+    //! Creates a MEDWrapper MED Nodes representation
+    virtual
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbElem,
+               EModeSwitch theMode = eFULL_INTERLACE,
+               ERepere theSystem = eCART, 
+               EBooleen theIsElemNum = eVRAI,
+               EBooleen theIsElemNames = eVRAI) = 0;
+
+    //! Creates a MEDWrapper MED Nodes representation
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+               const TFloatVector& theNodeCoords,
+               EModeSwitch theMode = eFULL_INTERLACE,
+               ERepere theSystem = eCART, 
+               const TStringVector& theCoordNames = TStringVector(),
+               const TStringVector& theCoordUnits = TStringVector(),
+               const TIntVector& theFamilyNums = TIntVector(),
+               const TIntVector& theElemNums = TIntVector(),
+               const TStringVector& theElemNames = TStringVector()) = 0;
+    
+    //! A copy-constructor for the MEDWrapper MED Nodes representation
+    virtual
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo,
+               const PNodeInfo& theInfo) = 0;
+    
+    //! Read a MEDWrapper MED Nodes representation from defined MED file
+    PNodeInfo
+    GetPNodeInfo(const PMeshInfo& theMeshInfo,
+                 TErr* theErr = NULL);
+    
+    //----------------------------------------------------------------------------
+    //! Read a MEDWrapper MED Polygones representation from defined MED file
+    /*! This feature is supported only for version of 2.2 and higher */
+    virtual
+    void
+    GetPolygoneInfo(TPolygoneInfo& theInfo,
+                    TErr* theErr = NULL) 
+    {}
+
+    //! Write a MEDWrapper MED Polygones representation from defined MED file
+    /*! This feature is supported only for version of 2.2 and higher */
+    virtual
+    void
+    SetPolygoneInfo(const TPolygoneInfo& theInfo,
+                    TErr* theErr = NULL) 
+    {}
+
+    //! Read number of MED Polygones in defined MED Mesh
+    /*! This feature is supported only for version of 2.2 and higher */
+    virtual
+    TInt
+    GetNbPolygones(const TMeshInfo& theMeshInfo,
+                   EEntiteMaillage theEntity,
+                   EGeometrieElement theGeom,
+                   EConnectivite theConnMode = eNOD,
+                   TErr* theErr = NULL) 
+    { 
+      return 0;
+    }
+
+    //! Read connectivity infroamtion for the MED Polygones in defined MED Mesh
+    /*! This feature is supported only for version of 2.2 and higher */
+    virtual
+    TInt
+    GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
+                        EEntiteMaillage theEntity,
+                        EGeometrieElement theGeom,
+                        EConnectivite theConnMode = eNOD,
+                        TErr* theErr = NULL)
+    { 
+      return 0;
+    }
+    
+    //! Creates a MEDWrapper MED Polygones representation
+    /*! This feature is supported only for version of 2.2 and higher */
+    virtual 
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theConnSize,
+                   EConnectivite theConnMode = eNOD,
+                   EBooleen theIsElemNum = eVRAI,
+                   EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolygoneInfo();
+    }
+    
+    //! Creates a MEDWrapper MED Polygones representation
+    /*! This feature is supported only for version of 2.2 and higher */
+    virtual
+    PPolygoneInfo 
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode = eNOD,
+                   const TIntVector& theFamilyNums = TIntVector(),
+                   const TIntVector& theElemNums = TIntVector(),
+                   const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolygoneInfo();
+    }
+
+    //! A copy-constructor for the MEDWrapper MED Polygones representation
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+                   const PPolygoneInfo& theInfo)
+    {
+      return PPolygoneInfo();
+    }
+    
+    //! Read a MEDWrapper MED Polygones representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    PPolygoneInfo
+    GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+                     EEntiteMaillage theEntity, 
+                     EGeometrieElement theGeom, 
+                     EConnectivite theConnMode = eNOD);
+    
+    //----------------------------------------------------------------------------
+    //! Read a MEDWrapper MED Polyedres representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual 
+    void
+    GetPolyedreInfo(TPolyedreInfo& theInfo,
+                    TErr* theErr = NULL) 
+    {}
+
+    //! Write a MEDWrapper MED Polyedres representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    void
+    SetPolyedreInfo(const TPolyedreInfo& theInfo,
+                    TErr* theErr = NULL)
+    {}
+    
+    //! Read number of MED Polyedres in defined MED Mesh
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    TInt
+    GetNbPolyedres(const TMeshInfo& theMeshInfo,
+                   EEntiteMaillage theEntity,
+                   EGeometrieElement theGeom,
+                   EConnectivite theConnMode = eNOD,
+                   TErr* theErr = NULL)
+    { 
+      return 0;
+    }
+
+    //! Read connectivity infroamtion for the MED Polyedres in defined MED Mesh
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual 
+    void
+    GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+                        TInt& theNbFaces,
+                        TInt& theConnSize,
+                        EConnectivite theConnMode = eNOD,
+                        TErr* theErr = NULL)
+    {
+      theNbFaces = theConnSize = 0;
+    }
+    
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theNbFaces,
+                   TInt theConnSize,
+                   EConnectivite theConnMode = eNOD,
+                   EBooleen theIsElemNum = eVRAI,
+                   EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolyedreInfo();
+    }
+    
+    //! Creates a MEDWrapper MED Polyedres representation
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theFaces,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode = eNOD,
+                   const TIntVector& theFamilyNums = TIntVector(),
+                   const TIntVector& theElemNums = TIntVector(),
+                   const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolyedreInfo();
+    }
+
+    //! A copy-constructor for the MEDWrapper MED Polyedres representation
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+                   const PPolyedreInfo& theInfo)
+    {
+      return PPolyedreInfo();
+    }
+    
+    //! Read a MEDWrapper MED Polyedres representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    PPolyedreInfo
+    GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+                     EEntiteMaillage theEntity, 
+                     EGeometrieElement theGeom, 
+                     EConnectivite theConnMode = eNOD);
+    
+    //----------------------------------------------------------------------------
+    //! Get TEntityInfo which contains brief information about existing cells and their destribution among MED ENTITIES
+    virtual
+    TEntityInfo
+    GetEntityInfo(const TMeshInfo& theMeshInfo,
+                  EConnectivite theConnMode = eNOD,
+                  TErr* theErr = NULL) = 0;
+    
+    //! Read number of cells for defined MED Mesh, ENTITY and geometrical type with define mode of connectivity
+    virtual
+    TInt
+    GetNbCells(const TMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom, 
+               EConnectivite theConnMode = eNOD,
+               TErr* theErr = NULL) = 0;
+    
+    //! Read a MEDWrapper MED Cells representation from defined MED file
+    virtual
+    void
+    GetCellInfo(TCellInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+    
+    //! Write the MEDWrapper MED Cells representation into defined MED file
+    virtual 
+    void
+    SetCellInfo(const TCellInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+    
+    //! Creates a MEDWrapper MED Cells representation
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TInt theNbElem,
+               EConnectivite theConnMode = eNOD,
+               EBooleen theIsElemNum = eVRAI,
+               EBooleen theIsElemNames = eVRAI,
+               EModeSwitch theMode = eFULL_INTERLACE) = 0;
+    
+    //! Creates a MEDWrapper MED Cells representation
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               const TIntVector& theConnectivities,
+               EConnectivite theConnMode = eNOD,
+               const TIntVector& theFamilyNums = TIntVector(),
+               const TIntVector& theElemNums = TIntVector(),
+               const TStringVector& theElemNames = TStringVector(),
+               EModeSwitch theMode = eFULL_INTERLACE) = 0;
+    
+    //! A copy-constructor for the MEDWrapper MED Cells representation
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo,
+               const PCellInfo& theInfo) = 0;
+    
+    //! Read a MEDWrapper MED Cells representation from defined MED file
+    PCellInfo
+    GetPCellInfo(const PMeshInfo& theMeshInfo,
+                 EEntiteMaillage theEntity, 
+                 EGeometrieElement theGeom, 
+                 EConnectivite theConnMode = eNOD,
+                 TErr* theErr = NULL);
+
+    //----------------------------------------------------------------------------
+    //! Read number of balls in the Mesh
+    /*! This feature is supported since version 3.0 */
+    virtual
+    TInt
+    GetNbBalls(const TMeshInfo& theMeshInfo)
+    {
+      return 0;
+    }
+
+    //! Read a MEDWrapped representation of MED_BALL from the MED file
+    /*! This feature is supported since version 3.0 */
+    virtual
+    void
+    GetBallInfo(TBallInfo& theInfo,
+                TErr* theErr = NULL) 
+    {}
+
+    //! Write a MEDWrapped representation of MED_BALL to the MED file
+    /*! This feature is supported since version 3.0 */
+    virtual
+    void
+    SetBallInfo(const TBallInfo& theInfo,
+                TErr* theErr = NULL) 
+    {}
+
+    //! Creates a MEDWrapper MED Balls representation
+    /*! This feature is supported since version 3.0 */
+    virtual 
+    PBallInfo
+    CrBallInfo(const PMeshInfo& theMeshInfo, 
+               TInt             theNbBalls,
+               EBooleen         theIsElemNum = eVRAI)
+    {
+      return PBallInfo();
+    }
+
+    //! Creates a MEDWrapper MED Balls representation
+    /*! This feature is supported since version 3.0 */
+    virtual
+    PBallInfo 
+    CrBallInfo(const PMeshInfo&  theMeshInfo, 
+               const TIntVector& theNodes,
+               TFloatVector&     theDiameters,
+               const TIntVector& theFamilyNums = TIntVector(),
+               const TIntVector& theElemNums = TIntVector())
+    {
+      return PBallInfo();
+    }
+
+    //! A copy-constructor for the MEDWrapped MED Balls representation
+    virtual
+    PBallInfo
+    CrBallInfo(const PMeshInfo& theMeshInfo,
+               const PBallInfo& theInfo)
+    {
+      return PBallInfo();
+    }
+    
+    //! Read a MEDWrapped MED Balls representation from defined MED file
+    /*! This feature is supported since version 3.0 */
+    virtual
+    PBallInfo
+    GetPBallInfo(const PMeshInfo& theMeshInfo);
+
+    //----------------------------------------------------------------------------
+    //! Read number of MED FIELDS in defined MED Mesh
+    virtual 
+    TInt
+    GetNbFields(TErr* theErr = NULL) = 0;
+    
+    //! Read number of components for the defined MED FIELD by its order number
+    virtual
+    TInt
+    GetNbComp(TInt theFieldId,
+              TErr* theErr = NULL) = 0;
+    
+    //! Read MEDWrapper MED FIELD representation by its order number
+    virtual 
+    void
+    GetFieldInfo(TInt theFieldId, 
+                 TFieldInfo& theInfo,
+                 TErr* theErr = NULL) = 0;
+
+    //! Write MEDWrapper MED FIELD representation into defined MED file
+    virtual 
+    void
+    SetFieldInfo(const TFieldInfo& theInfo,
+                 TErr* theErr = NULL) = 0;
+    
+
+    //! Creates a MEDWrapper MED FIELD representation
+    virtual 
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo, 
+                TInt theNbComp = 0,
+                ETypeChamp theType = eFLOAT64,
+                const std::string& theValue = "",
+                EBooleen theIsLocal = eVRAI,
+                TInt theNbRef = 1) = 0;
+
+    //! A copy-constructor for the MEDWrapper MED FIELD representation
+    virtual 
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo,
+                const PFieldInfo& theInfo) = 0;
+    
+    //! Read a MEDWrapper MED FIELD representation from defined MED file
+    PFieldInfo
+    GetPFieldInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theId,
+                  TErr* theErr = NULL);
+
+
+    //----------------------------------------------------------------------------
+    //! Read number of MED GAUSS in defined MED Mesh
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual 
+    TInt
+    GetNbGauss(TErr* theErr = NULL)
+    { 
+      return TInt();
+    }
+
+    //! Read brief MED GAUSS information by its order number from defined MED Mesh
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual 
+    TGaussInfo::TInfo
+    GetGaussPreInfo(TInt theId, 
+                    TErr* theErr = NULL)
+    {
+      return TGaussInfo::TInfo( TGaussInfo::TKey(ePOINT1,""),0 );
+    }
+    
+    //! Read a MEDWrapper MED GAUSS representation by its order number from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual 
+    void
+    GetGaussInfo(TInt theId, 
+                 TGaussInfo& theInfo,
+                 TErr* theErr = NULL)
+    {}
+
+    //! Creates a MEDWrapper MED GAUSS representation
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PGaussInfo
+    CrGaussInfo(const TGaussInfo::TInfo& theInfo,
+                EModeSwitch theMode = eFULL_INTERLACE) = 0;
+
+
+    //----------------------------------------------------------------------------
+    //! Read number of MED TIMESTAMPS in defined MED Mesh
+    /*!
+      By the way some additional information can be obtained:
+      - to what MED ENTITY the MED TIMESTAMP conntected to;
+      - on what geometrical types the MED TIMESTAMP defined to.
+    */
+    virtual 
+    TInt
+    GetNbTimeStamps(const TFieldInfo& theInfo, 
+                    const TEntityInfo& theEntityInfo,
+                    EEntiteMaillage& theEntity,
+                    TGeom2Size& theGeom2Size,
+                    TErr* theErr = NULL) = 0;
+    
+    //! Read MEDWrapper MED TIMESTAMP representation by its order number
+    virtual 
+    void
+    GetTimeStampInfo(TInt theTimeStampId, 
+                     TTimeStampInfo& theInfo,
+                     TErr* theErr = NULL) = 0;
+
+    //! Creates a MEDWrapper MED TIMESTAMP representation
+    virtual 
+    PTimeStampInfo
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
+                    EEntiteMaillage theEntity,
+                    const TGeom2Size& theGeom2Size,
+                    const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
+                    TInt theNumDt = 0,
+                    TInt theNumOrd = 0,
+                    TFloat theDt = 0,
+                    const std::string& theUnitDt = "",
+                    const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss()) = 0;
+
+    //! A copy-constructor for the MEDWrapper MED TIMESTAMP representation
+    virtual 
+    PTimeStampInfo 
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+                    const PTimeStampInfo& theInfo) = 0;
+    
+    //! Read MEDWrapper MED TIMESTAMP representation by its order number
+    PTimeStampInfo
+    GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
+                      EEntiteMaillage theEntity,
+                      const TGeom2Size& theGeom2Size,
+                      TInt theId,
+                      TErr* theErr = NULL);
+    
+
+    //----------------------------------------------------------------------------
+    //! Read number of MED PROFILES in defined MED Mesh
+    virtual 
+    TInt
+    GetNbProfiles(TErr* theErr = NULL) = 0;
+
+    //! Read brief MED PROFILE information by its order number from defined MED Mesh
+    virtual 
+    TProfileInfo::TInfo
+    GetProfilePreInfo(TInt theId, 
+                      TErr* theErr = NULL) = 0;
+
+    //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
+    virtual 
+    void
+    GetProfileInfo(TInt theId, 
+                   TProfileInfo& theInfo,
+                   TErr* theErr = NULL) = 0;
+
+    //! Creates a MEDWrapper MED PROFILE representation
+    virtual
+    PProfileInfo
+    CrProfileInfo(const TProfileInfo::TInfo& theInfo,
+                  EModeProfil theMode = eCOMPACT) = 0;
+
+    //! Write a MEDWrapper MED PROFILE representation
+    virtual
+    void
+    SetProfileInfo(const TProfileInfo& theInfo,
+                   TErr* theErr = NULL) = 0;
+
+    //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
+    PProfileInfo
+    GetPProfileInfo(TInt theId,
+                    EModeProfil theMode = eCOMPACT,
+                    TErr* theErr = NULL);
+
+
+    //----------------------------------------------------------------------------
+    //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+    virtual 
+    void
+    GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                      const TMKey2Profile& theMKey2Profile,
+                      const TKey2Gauss& theKey2Gauss,
+                      TErr* theErr = NULL) = 0;
+    
+    //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
+    virtual 
+    void
+    SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                      TErr* theErr = NULL) = 0;
+    
+    //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+    virtual
+    PTimeStampValueBase
+    CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     ETypeChamp theTypeChamp,
+                     const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
+                     EModeSwitch theMode = eFULL_INTERLACE) = 0;
+
+    //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+    virtual
+    PTimeStampValueBase
+    CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
+                     EModeSwitch theMode = eFULL_INTERLACE);
+
+    //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
+    virtual 
+    PTimeStampValueBase
+    CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const PTimeStampValueBase& theInfo,
+                     ETypeChamp theTypeChamp) = 0;
+    
+    //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
+    virtual 
+    PTimeStampValueBase
+    CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                     const PTimeStampValueBase& theInfo);
+    
+    //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+    PTimeStampValueBase
+    GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+                       const TMKey2Profile& theMKey2Profile,
+                       const TKey2Gauss& theKey2Gauss,
+                       TErr* theErr = NULL);
+    
+    //----------------------------------------------------------------------------
+    // Backward compatibility  declarations
+    //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+    virtual 
+    void
+    GetTimeStampVal(const PTimeStampVal& theVal,
+                    const TMKey2Profile& theMKey2Profile,
+                    const TKey2Gauss& theKey2Gauss,
+                    TErr* theErr = NULL);
+    
+    //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
+    virtual 
+    void
+    SetTimeStamp(const PTimeStampVal& theVal,
+                 TErr* theErr = NULL);
+    
+    //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+    virtual
+    PTimeStampVal
+    CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                   const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
+                   EModeSwitch theMode = eFULL_INTERLACE);
+
+    //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
+    virtual 
+    PTimeStampVal
+    CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                   const PTimeStampVal& theInfo);
+    
+    //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+    PTimeStampVal
+    GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                     const TMKey2Profile& theMKey2Profile,
+                     const TKey2Gauss& theKey2Gauss,
+                     TErr* theErr = NULL);
+
+    //----------------------------------------------------------------------------
+    //! Read a MEDWrapper MED Grille representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    PGrilleInfo
+    GetPGrilleInfo(const PMeshInfo& theMeshInfo);
+
+    //! Read a MEDWrapper MED Grille representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    PGrilleInfo
+    GetPGrilleInfo(const PMeshInfo& theMeshInfo,
+                   const PGrilleInfo& theInfo);
+
+    //! Read a MEDWrapper MED Grille representation from defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    void
+    GetGrilleInfo(TGrilleInfo& theInfo,
+                  TErr* theErr = NULL)
+    {}
+
+    //! Write the MEDWrapper MED Grille representation into defined MED file
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual 
+    void
+    SetGrilleInfo(const TGrilleInfo& theInfo,
+                  TErr* theErr = NULL)
+    {}
+
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const PGrilleInfo& theGrilleInfo)
+    {
+      return PGrilleInfo();
+    }
+
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo)
+    {
+      return PGrilleInfo();
+    }
+    
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type)
+    {
+      return PGrilleInfo();
+    }
+    
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type,
+                 const TInt& nbNodes)
+    {
+      return PGrilleInfo();
+    }
+
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    PGrilleInfo
+    CrGrilleInfo(const PMeshInfo& theMeshInfo,
+                 const EGrilleType& type,
+                 const MED::TIntVector& nbNodeVec)
+    {
+      return PGrilleInfo();
+    }
+
+    /*! This feature is support only for version of 2.2 and higher */
+    virtual
+    void
+    GetGrilleType(const TMeshInfo& theMeshInfo,
+                  EGrilleType& type,
+                  TErr* theErr = NULL)
+    {
+    }
+    
+  };
+
+
+  //----------------------------------------------------------------------------
+  //! This class provide thread-safety for MEDWrapper interaction
+  class MEDWRAPPER_EXPORT TLockProxy
+  {
+    TLockProxy& operator=(const TLockProxy& );
+    TWrapper* myWrapper;
+
+  public:
+    TLockProxy(TWrapper* theWrapper);
+
+    ~TLockProxy();
+
+    TWrapper * operator-> () const;
+  };
+
+
+  //----------------------------------------------------------------------------
+  //! To specialize the SharedPtr for TWrapper
+  template<> 
+  class MEDWRAPPER_EXPORT SharedPtr<TWrapper>: public boost::shared_ptr<TWrapper>
+  {
+  public:
+    SharedPtr() {}
+
+    template<class Y>
+    explicit SharedPtr(Y * p): 
+      boost::shared_ptr<TWrapper>(p) 
+    {}
+
+    template<class Y>
+    SharedPtr(SharedPtr<Y> const & r):
+      boost::shared_ptr<TWrapper>(r,boost::detail::dynamic_cast_tag())
+    {}
+
+    template<class Y>
+    SharedPtr& 
+    operator=(SharedPtr<Y> const & r)
+    {
+      boost::shared_ptr<TWrapper>(r,boost::detail::dynamic_cast_tag()).swap(*this);
+      return *this;
+    }
+
+    template<class Y> 
+    SharedPtr& 
+    operator()(Y * p) // Y must be complete
+    {
+      return operator=<Y>(SharedPtr<Y>(p));
+    }
+
+    template<class Y> 
+    SharedPtr& 
+    operator()(SharedPtr<Y> const & r) // Y must be complete
+    {
+      return operator=<Y>(SharedPtr<Y>(r));
+    }
+
+    TLockProxy operator-> () const // never throws
+    {
+      return TLockProxy(this->get());
+    }
+    
+  protected:
+    operator const TWrapper& () const;
+
+    operator TWrapper& ();
+
+    TWrapper& operator* () const;
+
+    TWrapper * get() const // never throws
+    {
+      return boost::shared_ptr<TWrapper>::get();
+    }
+  };
+
+  //----------------------------------------------------------------------------
+  typedef SharedPtr<TWrapper> PWrapper;
+}
+
+#endif
diff --git a/src/MEDWrapper/Base/MED_WrapperBase.hxx b/src/MEDWrapper/Base/MED_WrapperBase.hxx
new file mode 100755 (executable)
index 0000000..128e4e8
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2007-2013  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   : MED_WrapperBase.hxx
+//  Author : Alexander A. BORODIN
+//
+#ifndef _MED_WrapperBase_HXX_
+#define _MED_WrapperBase_HXX_
+
+#ifdef WIN32
+ #if defined MEDWRAPPER_BASE_EXPORTS || defined MEDWrapperBase_EXPORTS
+  #if defined WIN32
+   #define MEDWRAPPER_EXPORT __declspec( dllexport )
+  #else
+   #define MEDWRAPPER_EXPORT
+  #endif
+ #else
+  #if defined WIN32
+   #define MEDWRAPPER_EXPORT __declspec( dllimport )
+  #else
+   #define MEDWRAPPER_EXPORT
+  #endif
+ #endif
+#else
+ #define MEDWRAPPER_EXPORT
+#endif
+
+#endif
diff --git a/src/MEDWrapper/Base/Makefile.am b/src/MEDWrapper/Base/Makefile.am
new file mode 100644 (file)
index 0000000..8594ce7
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright (C) 2007-2013  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
+#
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+lib_LTLIBRARIES= libMEDWrapperBase.la
+
+salomeinclude_HEADERS= \
+       MED_Common.hxx \
+       MED_Vector.hxx \
+       MED_SharedPtr.hxx \
+       MED_SliceArray.hxx \
+       MED_Wrapper.hxx \
+       MED_TWrapper.hxx \
+       MED_Structures.hxx \
+       MED_TStructures.hxx \
+       MED_Algorithm.hxx \
+       MED_GaussUtils.hxx \
+       MED_CoordUtils.hxx \
+       MED_Utilities.hxx \
+       MED_GaussDef.hxx \
+       MED_WrapperBase.hxx
+
+dist_libMEDWrapperBase_la_SOURCES= \
+       MED_Structures.cxx \
+       MED_Wrapper.cxx \
+       MED_Algorithm.cxx \
+       MED_GaussUtils.cxx \
+       MED_CoordUtils.cxx \
+       MED_Utilities.cxx \
+       MED_GaussDef.cxx
+
+libMEDWrapperBase_la_CPPFLAGS= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -D@MACHINE@
+libMEDWrapperBase_la_CPPFLAGS+= -I$(KERNEL_ROOT_DIR)/include/salome
+libMEDWrapperBase_la_CPPFLAGS+= $(MED_CPPFLAGS)
+libMEDWrapperBase_la_LDFLAGS= $(BOOST_LIB_THREAD) $(BOOST_LIB_SYSTEM) $(BOOST_LIB_DATE_TIME)
diff --git a/src/MEDWrapper/CMakeLists.txt b/src/MEDWrapper/CMakeLists.txt
new file mode 100644 (file)
index 0000000..90ed5a2
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D
+#
+# 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
+#
+
+ADD_SUBDIRECTORY(Base)
+ADD_SUBDIRECTORY(V2_2)
+ADD_SUBDIRECTORY(Factory)
diff --git a/src/MEDWrapper/Factory/CMakeLists.txt b/src/MEDWrapper/Factory/CMakeLists.txt
new file mode 100644 (file)
index 0000000..08cd75c
--- /dev/null
@@ -0,0 +1,57 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D
+#
+# 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_DIRECTORIES(
+  ${HDF5_INCLUDE_DIRS}
+  ${BOOST_INCLUDE_DIRS}
+  ${MED3_INCLUDE_DIRS}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../Base
+  ${CMAKE_CURRENT_SOURCE_DIR}/../V2_2
+  )
+
+IF(MED_ENABLE_KERNEL)
+  INCLUDE_DIRECTORIES(${KERNEL_ROOT_DIR}/include/salome)
+ELSE(MED_ENABLE_KERNEL)
+  INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/adm_local_without_kernel)
+ENDIF(MED_ENABLE_KERNEL)  
+
+SET(MEDWrapper_SOURCES
+  MED_Factory.cxx
+)
+
+SET(mprint_version_SOURCES
+  mprint_version.cxx
+  )
+
+ADD_LIBRARY(MEDWrapper SHARED ${MEDWrapper_SOURCES})
+SET_TARGET_PROPERTIES(MEDWrapper PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS} ${MED3_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
+TARGET_LINK_LIBRARIES(MEDWrapper MEDWrapper_V2_2)
+INSTALL(TARGETS MEDWrapper DESTINATION ${MED_salomelib_LIBS})
+
+ADD_EXECUTABLE(mprint_version ${mprint_version_SOURCES})
+SET_TARGET_PROPERTIES(mprint_version PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS} ${MED3_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
+TARGET_LINK_LIBRARIES(mprint_version MEDWrapper MEDWrapper_V2_2 MEDWrapperBase ${BOOST_LIBS} ${MED3_LIBS_C_ONLY})
+
+ADD_EXECUTABLE(MED_Test ${mprint_version_SOURCES})
+SET_TARGET_PROPERTIES(MED_Test PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS} ${MED3_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
+TARGET_LINK_LIBRARIES(MED_Test MEDWrapper MEDWrapper_V2_2 MEDWrapperBase ${BOOST_LIBS})
+
+FILE(GLOB MEDWrapper_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
+INSTALL(FILES ${MEDWrapper_HEADERS_HXX} DESTINATION ${MED_salomeinclude_HEADERS})
+INSTALL(TARGETS mprint_version MED_Test DESTINATION ${MED_salomebin_BINS})
diff --git a/src/MEDWrapper/Factory/MED_Factory.cxx b/src/MEDWrapper/Factory/MED_Factory.cxx
new file mode 100644 (file)
index 0000000..7232ee0
--- /dev/null
@@ -0,0 +1,164 @@
+// Copyright (C) 2007-2013  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 "MED_Factory.hxx"
+#include "MED_Utilities.hxx"
+#include "MED_V2_2_Wrapper.hxx"
+
+#include <stdio.h>
+#include <sstream>
+
+extern "C"
+{
+#include <med.h>
+#ifndef WIN32
+  #include <unistd.h>
+#endif
+}
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace MED
+{
+  
+  EVersion GetVersionId(const std::string& theFileName,
+                        bool theDoPreCheckInSeparateProcess)
+  {
+    INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'"<<std::endl);
+    EVersion aVersion = eVUnknown;    
+
+#ifndef WIN32
+    if (access(theFileName.c_str(),F_OK))
+      return aVersion;
+    if(theDoPreCheckInSeparateProcess){
+      // First check, is it possible to deal with the file
+      std::ostringstream aStr;
+      // File name is in quotes for the case of space(s) inside it (PAL13009)
+      aStr<<"bash -c \""<<getenv("SMESH_ROOT_DIR")<<"/bin/salome/mprint_version \'"<<theFileName<<"\'\"";
+      if(!MYDEBUG)
+        aStr<<" 2>&1 > /dev/null";
+
+      std::string aCommand = aStr.str();
+      int aStatus = system(aCommand.c_str());
+
+      BEGMSG(MYDEBUG,"aCommand = '"<<aCommand<<"'; aStatus = "<<aStatus<<std::endl);
+      if(aStatus != 0)
+        return aVersion;
+    }
+#endif
+    // check compatibility of hdf and med versions
+    med_bool hdfok, medok;
+    MEDfileCompatibility(theFileName.c_str(), &hdfok, &medok);
+    if ((!hdfok) /*|| (!medok)*/) // med-2.1 is KO since med-3.0.0
+      return aVersion;
+
+    // Next, try to open the file trough the MED API
+    const char* aFileName = theFileName.c_str();
+    med_idt aFid = MEDfileOpen(aFileName,MED_ACC_RDONLY);
+
+    MSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aFid = "<<aFid<<std::endl);
+    if(aFid >= 0){
+      med_int aMajor, aMinor, aRelease;
+      med_err aRet = MEDfileNumVersionRd(aFid,&aMajor,&aMinor,&aRelease);
+      INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aRet = "<<aRet<<std::endl);
+      if(aRet >= 0){
+        if(aMajor == 2 && aMinor == 1)
+          aVersion = eV2_1;
+        else
+          aVersion = eV2_2;
+      }
+      else {
+        // VSR: simulate med 2.3.6 behavior, med file version is assumed to 2.1
+        aVersion = eV2_1;
+      }
+    }
+    MEDfileClose(aFid);
+
+    BEGMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aVersion = "<<aVersion<<std::endl);
+    return aVersion;
+  }
+
+  bool getMEDVersion( const std::string& fname, int& major, int& minor, int& release )
+  {
+    med_idt f = MEDfileOpen(fname.c_str(), MED_ACC_RDONLY );
+    if( f<0 )
+      return false;
+
+    med_int aMajor, aMinor, aRelease;
+    med_err aRet = MEDfileNumVersionRd( f, &aMajor, &aMinor, &aRelease );
+    major = aMajor;
+    minor = aMinor;
+    release = aRelease;
+    MEDfileClose( f );
+    if( aRet<0 ) {
+      // VSR: simulate med 2.3.6 behavior, med file version is assumed to 2.1
+      major = 2; minor = release = -1;
+      //return false;
+    }
+    return true;
+  }
+
+  PWrapper CrWrapper(const std::string& theFileName,
+                     bool theDoPreCheckInSeparateProcess)
+  {
+    PWrapper aWrapper;
+    EVersion aVersion = GetVersionId(theFileName,theDoPreCheckInSeparateProcess);
+    switch(aVersion){
+    case eV2_2:
+      aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
+      break;
+    case eV2_1:
+      EXCEPTION(std::runtime_error,"Cannot open file '"<<theFileName<<"'. Med version 2.1 is not supported any more.");
+      //aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));
+      break;
+    default:
+      EXCEPTION(std::runtime_error,"MED::CrWrapper - theFileName = '"<<theFileName<<"'");
+    }
+    return aWrapper;
+  }
+
+  PWrapper CrWrapper(const std::string& theFileName, EVersion theId)
+  {
+    EVersion aVersion = GetVersionId(theFileName);
+
+    if(aVersion != theId)
+      remove(theFileName.c_str());
+    
+    PWrapper aWrapper;
+    switch(theId){
+    case eV2_2:
+      aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
+      break;
+    case eV2_1:
+      EXCEPTION(std::runtime_error,"Cannot open file '"<<theFileName<<"'. Med version 2.1 is not supported any more.");
+      //aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));
+      break;
+    default:
+      aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
+    }
+    return aWrapper;
+  }
+
+}
diff --git a/src/MEDWrapper/Factory/MED_Factory.hxx b/src/MEDWrapper/Factory/MED_Factory.hxx
new file mode 100644 (file)
index 0000000..469d52e
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2007-2013  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
+
+#ifndef MED_Factory_HeaderFile
+#define MED_Factory_HeaderFile
+
+#include "MED_WrapperFactory.hxx"
+#include "MED_Wrapper.hxx"
+
+namespace MED
+{
+  MEDWRAPPER_FACTORY_EXPORT
+  EVersion  
+  GetVersionId(const std::string& theFileName,
+               bool theDoPreCheckInSeparateProcess = false);
+
+  MEDWRAPPER_FACTORY_EXPORT
+    bool getMEDVersion( const std::string&, int&, int&, int& );
+  
+  MEDWRAPPER_FACTORY_EXPORT
+  PWrapper 
+  CrWrapper(const std::string& theFileName,
+            bool theDoPreCheckInSeparateProcess = false);
+
+  MEDWRAPPER_FACTORY_EXPORT
+  PWrapper 
+  CrWrapper(const std::string& theFileName, EVersion theId);
+}
+
+#endif
diff --git a/src/MEDWrapper/Factory/MED_Test.cxx b/src/MEDWrapper/Factory/MED_Test.cxx
new file mode 100644 (file)
index 0000000..721d330
--- /dev/null
@@ -0,0 +1,347 @@
+// Copyright (C) 2007-2013  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 "MED_Utilities.hxx"
+#include "MED_Algorithm.hxx"
+#include "MED_GaussUtils.hxx"
+#include "MED_Factory.hxx"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+// static int MYDEBUG = 0;
+#endif
+
+static int MYWRITEDEBUG = 1;
+
+using namespace MED;
+
+#undef _DEBUG_
+
+void CheckMed(const std::string& theFileName)
+{
+  MSG(MYDEBUG,"CheckMed - theFileName = '"<<theFileName<<"'");
+  {
+    //TErr anErr;
+    PWrapper aMed = CrWrapper(theFileName);
+
+    TKey2Gauss aKey2Gauss = GetKey2Gauss(aMed);
+    TMKey2Profile aMKey2Profile = GetMKey2Profile(aMed);
+    INITMSG(MYDEBUG,"aMed->GetNbProfiles() = "<<aMed->GetNbProfiles()<<std::endl);
+
+    TInt aNbMeshes = aMed->GetNbMeshes();
+    BEGMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<std::endl);
+    for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+      
+      PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      INITMSG(MYDEBUG,"aMeshInfo->GetName() = '"<<aMeshInfo->GetName()<<"'"<<std::endl);
+
+      TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+      
+      TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = 
+        GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,aEntityInfo);
+
+      TFieldInfo2TimeStampInfoSet aFieldInfo2TimeStampInfoSet = 
+        GetFieldInfo2TimeStampInfoSet(aMed,aMeshInfo,aEntityInfo);
+      
+      TEntite2TFieldInfo2TimeStampInfoSet anEntite2TFieldInfo2TimeStampInfoSet = 
+        GetEntite2TFieldInfo2TimeStampInfoSet(aFieldInfo2TimeStampInfoSet);
+
+      TEntite2TFieldInfo2TimeStampInfoSet::const_iterator anEntite2TFieldInfo2TimeStampInfoSetIter = 
+        anEntite2TFieldInfo2TimeStampInfoSet.begin();
+      for(; anEntite2TFieldInfo2TimeStampInfoSetIter != anEntite2TFieldInfo2TimeStampInfoSet.end(); anEntite2TFieldInfo2TimeStampInfoSetIter++){
+        const TFieldInfo2TimeStampInfoSet& aFieldInfo2TimeStampInfoSet = anEntite2TFieldInfo2TimeStampInfoSetIter->second;
+        TFieldInfo2TimeStampInfoSet::const_iterator aFieldInfo2TimeStampInfoSetIter = aFieldInfo2TimeStampInfoSet.begin();
+        for(; aFieldInfo2TimeStampInfoSetIter != aFieldInfo2TimeStampInfoSet.end(); aFieldInfo2TimeStampInfoSetIter++){
+          PFieldInfo aFieldInfo = aFieldInfo2TimeStampInfoSetIter->first;
+          INITMSG(MYDEBUG,
+                  "GetPFieldInfo "<<
+                  "- aName = '"<<aFieldInfo->GetName()<<"'"<<
+                  "; aType = "<<aFieldInfo->GetType()<<
+                  "; aNbComp = "<<aFieldInfo->GetNbComp()<<
+                  std::endl);
+          const TTimeStampInfoSet& aTimeStampInfoSet = aFieldInfo2TimeStampInfoSetIter->second;
+          TTimeStampInfoSet::const_iterator aTimeStampInfoSettIter = aTimeStampInfoSet.begin();
+          for(; aTimeStampInfoSettIter != aTimeStampInfoSet.end(); aTimeStampInfoSettIter++){
+            PTimeStampInfo aTimeStampInfo = *aTimeStampInfoSettIter;
+            INITMSG(MYDEBUG,
+                    "GetPTimeStampInfo "<<
+                    "- anEntity = "<<aTimeStampInfo->GetEntity()<<
+                    "; aNumDt = "<<aTimeStampInfo->GetNumDt()<<
+                    std::endl);
+            PTimeStampValueBase aTimeStampValue = 
+              aMed->GetPTimeStampValue(aTimeStampInfo,
+                                       aMKey2Profile,
+                                       aKey2Gauss);
+          }
+        }
+      }
+
+      continue;
+
+      TFamilyInfoSet aFamilyInfoSet = GetFamilyInfoSet(aMed,aMeshInfo);
+      
+      TEntity2FamilySet aEntity2FamilySet = 
+        GetEntity2FamilySet(aMed,anEntity2TGeom2ElemInfo,aFamilyInfoSet);
+      
+      TGroupInfo aGroupInfo = GetGroupInfo(aFamilyInfoSet);
+      
+      PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+      TEntity2TGeom2ElemInfo::const_iterator anIter = anEntity2TGeom2ElemInfo.begin();
+      for(; anIter != anEntity2TGeom2ElemInfo.end(); anIter++){
+        const EEntiteMaillage& anEntity = anIter->first;
+        if(anEntity != eNOEUD){
+          const TGeom2ElemInfo& aGeom2ElemInfo = anIter->second;
+          TKey2Gauss::const_iterator anIter2 = aKey2Gauss.begin();
+          for(; anIter2 != aKey2Gauss.end(); anIter2++){
+            const TGaussInfo::TKey& aKey = anIter2->first;
+            EGeometrieElement aGeom = boost::get<0>(aKey);
+            TGeom2ElemInfo::const_iterator anIter3 = aGeom2ElemInfo.find(aGeom);
+            if(anIter3 != aGeom2ElemInfo.end()){
+              if(PCellInfo aCellInfo = anIter3->second){
+                PGaussInfo aGaussInfo = anIter2->second;
+                TGaussCoord aGaussCoord;
+                GetGaussCoord3D(aGaussInfo,aCellInfo,aNodeInfo,aGaussCoord);
+              }
+            }
+          }
+        }
+      }
+      
+    }
+  }
+  MSG(MYDEBUG,"OK");
+}
+
+
+void CopyMed(const PWrapper& theMed, 
+             const PWrapper& theMed2, 
+             int theIncr)
+{
+  TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
+  TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
+
+  TInt aNbMeshes = theMed->GetNbMeshes();
+  MSG(MYDEBUG,"aNbMeshes = "<<aNbMeshes);
+  std::string aName;
+  for(TInt iMesh = 0; iMesh < aNbMeshes; iMesh++){
+    PMeshInfo aMeshInfo = theMed->GetPMeshInfo(iMesh+1);
+#ifdef _DEBUG_
+    TInt aDim = aMeshInfo->myDim;
+    aName = aMeshInfo->GetName();
+    INITMSG(MYDEBUG,"GetMeshInfo - aName = '"<<aName<<"'; aDim = "<<aDim<<"\n");
+#endif
+    PMeshInfo aMeshInfo2 = theMed2->CrMeshInfo(aMeshInfo);
+    if(MYWRITEDEBUG){
+      aName = aMeshInfo2->GetName();
+
+      aName[0] += theIncr;
+      aMeshInfo2->SetName(aName);
+      theMed2->SetMeshInfo(aMeshInfo2);
+      BEGMSG(MYDEBUG,"aNbMeshes2 = "<<theMed2->GetNbMeshes()<<"\n");
+    }
+    
+    TEntityInfo aEntityInfo = theMed->GetEntityInfo(aMeshInfo);
+
+    //continue;
+
+    TInt aNbFields = theMed->GetNbFields(); 
+    MSG(MYDEBUG,"GetNbFields() = "<<aNbFields);
+    for(TInt iField = 0; iField < aNbFields; iField++){
+      PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,iField+1);
+#ifdef _DEBUG_
+      TInt aNbComp = aFieldInfo->GetNbComp();
+      INITMSG(MYDEBUG,"aName = '"<<aFieldInfo->GetName()<<"'; aNbComp = "<<aNbComp<<";\n");
+#endif
+      PFieldInfo aFieldInfo2 = theMed->CrFieldInfo(aMeshInfo2,aFieldInfo);
+
+      if(MYWRITEDEBUG){
+        aName = aFieldInfo->GetName();
+        aName[0] += theIncr;
+        aFieldInfo2->SetName(aName);
+        theMed2->SetFieldInfo(aFieldInfo2);
+      }
+
+      EEntiteMaillage anEntity;
+      TGeom2Size aGeom2Size;
+      TInt aNbTimeStamps = 
+        theMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,anEntity,aGeom2Size);
+      {
+        INITMSG(MYDEBUG,"GetNbTimeStamps = "<<aNbTimeStamps<<std::endl);
+        for(TInt iTimeStamp = 0; iTimeStamp < aNbTimeStamps; iTimeStamp++){
+          PTimeStampInfo aTimeStampInfo = 
+          theMed->GetPTimeStampInfo(aFieldInfo,anEntity,aGeom2Size,iTimeStamp+1);
+#ifdef _DEBUG_
+          TInt aNumDt = aTimeStampInfo->GetNumDt();
+          INITMSG(MYDEBUG,"aNumDt = "<<aNumDt<<"\n");
+#endif
+          
+          PTimeStampInfo aTimeStampInfo2 = 
+            theMed->CrTimeStampInfo(aFieldInfo2,aTimeStampInfo);
+          
+          PTimeStampValueBase aTimeStampValue = 
+            theMed->GetPTimeStampValue(aTimeStampInfo,
+                                       aMKey2Profile,
+                                       aKey2Gauss);
+          
+          PTimeStampValueBase aTimeStampValue2 = 
+            theMed->CrTimeStampValue(aTimeStampInfo2,
+                                     aTimeStampValue);
+          
+          if(MYWRITEDEBUG) theMed2->SetTimeStamp(aTimeStampValue2);
+        }
+      }
+    }
+
+    TInt aNbFam = theMed->GetNbFamilies(aMeshInfo);
+    MSG(MYDEBUG,"GetNbFamilies() = "<<aNbFam);
+    for(TInt iFam = 0; iFam < aNbFam; iFam++){
+      PFamilyInfo aFamilyInfo = theMed->GetPFamilyInfo(aMeshInfo,iFam+1);
+      TInt aNbGroup = aFamilyInfo->GetNbGroup();
+#ifdef _DEBUG_
+      TInt aNbAttr = aFamilyInfo->GetNbAttr();
+#endif
+      TInt anId = aFamilyInfo->GetId();
+      if(anId == 0)
+        continue;
+
+      aName = aFamilyInfo->GetName();
+#ifdef _DEBUG_
+      INITMSG(MYDEBUG,"aName = '"<<aName<<"'; anId = "<<anId<<
+              "; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<"\n");
+#endif
+      PFamilyInfo aFamilyInfo2 = theMed->CrFamilyInfo(aMeshInfo2,aFamilyInfo);
+      for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
+        aName = aFamilyInfo->GetGroupName(iGroup);
+        INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
+        aName[0] += theIncr;
+        aFamilyInfo2->SetGroupName(iGroup,aName);
+      }
+
+      if(MYWRITEDEBUG){
+        aName = aFamilyInfo->GetName();
+        aName[0] += theIncr;
+        aFamilyInfo2->SetName(aName);
+        theMed2->SetFamilyInfo(aFamilyInfo2);
+        INITMSG(MYDEBUG,"GetNbFamilies = "<<theMed2->GetNbFamilies(aMeshInfo2)<<std::endl);
+      }
+    }
+
+    MSG(MYDEBUG,"GetEntityInfo - aNbEntities = "<<aEntityInfo.size());
+    TEntityInfo::iterator anEntityInfoIter = aEntityInfo.begin();
+    for(; anEntityInfoIter != aEntityInfo.end(); anEntityInfoIter++){
+      const EEntiteMaillage& anEntity = anEntityInfoIter->first;
+      INITMSG(MYDEBUG,"anEntity = "<<anEntity<<"\n");
+      if(anEntity == eNOEUD){
+        PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
+        PNodeInfo aNodeInfo2 = theMed->CrNodeInfo(aMeshInfo2,aNodeInfo);
+        if(MYWRITEDEBUG) theMed2->SetNodeInfo(aNodeInfo2);
+        continue;
+      }
+      TGeom2Size& aGeom2Size = anEntityInfoIter->second;
+      TGeom2Size::iterator aGeomIter = aGeom2Size.begin();
+      for(; aGeomIter != aGeom2Size.end(); aGeomIter++){
+        const EGeometrieElement& aGeom = aGeomIter->first;
+#ifdef _DEBUG_
+        const TInt& aNbElem = aGeomIter->second;
+        INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
+#endif
+        switch(aGeom){
+        case ePOLYGONE: {
+          PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
+          PPolygoneInfo aPolygoneInfo2 = theMed->CrPolygoneInfo(aMeshInfo2,aPolygoneInfo);
+          if(MYWRITEDEBUG) theMed2->SetPolygoneInfo(aPolygoneInfo2);
+          break;
+        }
+        case ePOLYEDRE: {
+          PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
+          PPolyedreInfo aPolyedreInfo2 = theMed->CrPolyedreInfo(aMeshInfo2,aPolyedreInfo);
+          if(MYWRITEDEBUG) theMed2->SetPolyedreInfo(aPolyedreInfo2);
+          break;
+        }
+        default:
+          PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
+          PCellInfo aCellInfo2 = theMed2->CrCellInfo(aMeshInfo2,aCellInfo);
+          if(MYWRITEDEBUG) theMed2->SetCellInfo(aCellInfo2);
+        }
+      }
+    }
+    
+  }
+  MSG(MYDEBUG,"OK");
+}
+
+
+void CopyMed(const std::string& theFileName, 
+             const std::string& theFileName2, 
+             MED::EVersion theVersion,
+             int theNbCopy)
+{
+  MSG(MYDEBUG,"CopyMed - theFileName = '"<<theFileName<<"'; theFileName2 = '"<<theFileName2<<"', theVersion = "<<theVersion);
+
+  PWrapper aMed = CrWrapper(theFileName);
+
+  PWrapper aMed2 = CrWrapper(theFileName2,theVersion);
+
+  for(int i = 0; i < theNbCopy; i++) 
+    CopyMed(aMed,aMed2,i);
+}
+
+
+void ReadMed(const char* theFileName, 
+             const char* theFileName2,
+             MED::EVersion theVersion = eV2_2,
+             int theNbCopy = 1)
+{
+  MSG(MYDEBUG,"theFileName = '"<<theFileName<<"'; "<<
+      "theFileName2 = '"<<theFileName2<<"'; "<<
+      "theVersion = "<<theVersion<<"; "<<
+      "theNbCopy = "<<theNbCopy);
+
+  CopyMed(theFileName,theFileName2,theVersion,theNbCopy);
+}
+
+#ifdef WIN32
+#pragma warning(disable:4101) // exc unreferenced ... ??
+#endif
+
+int main(int argc, char** argv){ 
+#ifndef _DEBUG_
+  try{
+#endif
+    if(argc == 2)
+      CheckMed(argv[1]);
+    if(argc == 3)
+      ReadMed(argv[1],argv[2]);
+    if(argc == 4)
+      ReadMed(argv[1],argv[2],MED::EVersion(atoi(argv[3])));
+    if(argc == 5)
+      ReadMed(argv[1],argv[2],MED::EVersion(atoi(argv[3])),atoi(argv[4]));
+    return 0;
+#ifndef _DEBUG_
+  }catch(std::exception& exc){
+    MSG(MYDEBUG,"Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MSG(MYDEBUG,"Unknown exception was accured");
+  } 
+#endif 
+  return 1;
+}
diff --git a/src/MEDWrapper/Factory/MED_WrapperFactory.hxx b/src/MEDWrapper/Factory/MED_WrapperFactory.hxx
new file mode 100755 (executable)
index 0000000..4578603
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2007-2013  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   : MED_WrapperFactory.hxx
+//  Author : Alexander A. BORODIN
+//
+#ifndef _MED_WrapperFactory_HXX_
+#define _MED_WrapperFactory_HXX_
+
+#ifdef WIN32
+ #if defined MEDWRAPPER_FACTORY_EXPORTS || defined MEDWrapper_EXPORTS
+  #if defined WIN32
+   #define MEDWRAPPER_FACTORY_EXPORT __declspec( dllexport )
+  #else
+   #define MEDWRAPPER_FACTORY_EXPORT
+  #endif
+ #else
+  #if defined WIN32
+   #define MEDWRAPPER_FACTORY_EXPORT __declspec( dllimport )
+  #else
+   #define MEDWRAPPER_FACTORY_EXPORT
+  #endif
+ #endif
+#else
+ #define MEDWRAPPER_FACTORY_EXPORT
+#endif
+
+#endif
diff --git a/src/MEDWrapper/Factory/Makefile.am b/src/MEDWrapper/Factory/Makefile.am
new file mode 100644 (file)
index 0000000..ac22c29
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright (C) 2007-2013  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
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+lib_LTLIBRARIES= libMEDWrapper.la
+
+salomeinclude_HEADERS= \
+       MED_Factory.hxx \
+       MED_WrapperFactory.hxx
+
+dist_libMEDWrapper_la_SOURCES= \
+       MED_Factory.cxx
+
+libMEDWrapper_la_CPPFLAGS= $(BOOST_CPPFLAGS) $(MED3_INCLUDES) \
+       -I$(srcdir)/../Base
+libMEDWrapper_la_CPPFLAGS+= -I$(KERNEL_ROOT_DIR)/include/salome
+libMEDWrapper_la_CPPFLAGS+= -I$(srcdir)/../V2_2
+libMEDWrapper_la_LDFLAGS= ../V2_2/libMEDWrapper_V2_2.la
+
+# Executables targets
+bin_PROGRAMS = MED_Test mprint_version
+
+dist_MED_Test_SOURCES= MED_Test.cxx
+MED_Test_CPPFLAGS= $(libMEDWrapper_la_CPPFLAGS)
+MED_Test_LDADD= $(libMEDWrapper_la_LDFLAGS) ../Base/libMEDWrapperBase.la \
+       $(BOOST_LIB_THREAD) $(BOOST_LIB_SYSTEM) libMEDWrapper.la
+
+dist_mprint_version_SOURCES= mprint_version.cxx
+mprint_version_CPPFLAGS= $(libMEDWrapper_la_CPPFLAGS)
+mprint_version_LDADD= $(libMEDWrapper_la_LDFLAGS) ../Base/libMEDWrapperBase.la \
+       $(BOOST_LIB_THREAD) $(BOOST_LIB_SYSTEM) libMEDWrapper.la $(MED3_LIBS_C_ONLY)
diff --git a/src/MEDWrapper/Factory/mprint_version.cxx b/src/MEDWrapper/Factory/mprint_version.cxx
new file mode 100644 (file)
index 0000000..fe77ea5
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (C) 2007-2013  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 <med.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char **argv)
+{
+  med_idt aFid = MEDfileOpen(argv[1],MED_ACC_RDONLY);
+  if(aFid < 0)
+    exit(1);
+
+  med_int aMajor, aMinor, aRelease;
+  med_err aRet = MEDfileNumVersionRd(aFid,&aMajor,&aMinor,&aRelease);
+  MEDfileClose(aFid);
+  if(aRet < 0) {
+    // VSR: simulate med 2.3.6 behavior, med file version is assumed to 2.1
+    aMajor=2;
+    aMinor=aRelease=-1;
+  }
+
+  printf("%d.%d.%d\n",aMajor,aMinor,aRelease);
+}
diff --git a/src/MEDWrapper/Makefile.am b/src/MEDWrapper/Makefile.am
new file mode 100644 (file)
index 0000000..8ebdfd6
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (C) 2007-2013  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
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+SUBDIRS = Base V2_2 Factory
+
+DIST_SUBDIRS = Base V2_2 Factory
diff --git a/src/MEDWrapper/V2_2/CMakeLists.txt b/src/MEDWrapper/V2_2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7bbe89e
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D
+#
+# 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_DIRECTORIES(
+  ${MED3_INCLUDE_DIRS}
+  ${HDF5_INCLUDE_DIRS}
+  ${BOOST_INCLUDE_DIRS}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../Base
+  )
+
+SET(MEDWrapper_V2_2_SOURCES
+  MED_V2_2_Wrapper.cxx
+  )
+
+IF(MED_ENABLE_KERNEL)
+  INCLUDE_DIRECTORIES(${KERNEL_ROOT_DIR}/include/salome)
+ELSE(MED_ENABLE_KERNEL)
+  INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/adm_local_without_kernel)
+ENDIF(MED_ENABLE_KERNEL)
+
+ADD_LIBRARY(MEDWrapper_V2_2 SHARED ${MEDWrapper_V2_2_SOURCES})
+SET_TARGET_PROPERTIES(MEDWrapper_V2_2 PROPERTIES COMPILE_FLAGS "${HDF5_DEFINITIONS} ${MED3_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}")
+TARGET_LINK_LIBRARIES(MEDWrapper_V2_2 MEDWrapperBase ${MED3_LIBS_C_ONLY} ${HDF5_LIBS})
+INSTALL(TARGETS MEDWrapper_V2_2 DESTINATION ${MED_salomelib_LIBS})
+
+FILE(GLOB MEDWrapper_V2_2_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
+INSTALL(FILES ${MEDWrapper_V2_2_HEADERS_HXX} DESTINATION ${MED_salomeinclude_HEADERS})
diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx
new file mode 100644 (file)
index 0000000..a7dc74a
--- /dev/null
@@ -0,0 +1,2878 @@
+// Copyright (C) 2007-2013  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 "MED_V2_2_Wrapper.hxx"
+#include "MED_Algorithm.hxx"
+#include "MED_Utilities.hxx"
+
+extern "C"
+{
+#include <med.h>
+#include <med_err.h>
+}
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+// #else
+// static int MYDEBUG = 0;
+#endif
+
+
+
+namespace MED
+{
+  template<>
+  TInt
+  GetDESCLength<eV2_2>()
+  {
+    return 200;
+  }
+
+  template<>
+  TInt
+  GetIDENTLength<eV2_2>()
+  {
+    return 8;
+  }
+
+  template<>
+  TInt
+  GetNOMLength<eV2_2>()
+  {
+    return 64;
+  }
+
+  template<>
+  TInt
+  GetLNOMLength<eV2_2>()
+  {
+    return 80;
+  }
+
+  template<>
+  TInt
+  GetPNOMLength<eV2_2>()
+  {
+    return 16;
+  }
+
+  template<>
+  void
+  GetVersionRelease<eV2_2>(TInt& majeur, TInt& mineur, TInt& release)
+  {
+    majeur=MED_MAJOR_NUM;
+    mineur=MED_MINOR_NUM;
+    release=MED_RELEASE_NUM;
+  }
+
+  template<>
+  TInt
+  GetNbConn<eV2_2>(EGeometrieElement typmai,
+                   EEntiteMaillage typent,
+                   TInt mdim)
+  {
+    return typmai%100;
+  }
+
+  namespace V2_2
+  {
+
+    //---------------------------------------------------------------
+    class TFile{
+      TFile();
+      TFile(const TFile&);
+      
+    public:
+      TFile(const std::string& theFileName): 
+        myCount(0),
+        myFid(0), 
+        myFileName(theFileName)
+      {}
+      
+      ~TFile()
+      { 
+        Close();
+      }
+      
+      void
+      Open(EModeAcces theMode, TErr* theErr = NULL)
+      {
+        if(myCount++ == 0){
+          const char* aFileName = myFileName.c_str();
+          myFid = MEDfileOpen(aFileName,med_access_mode(theMode));
+        }
+        if(theErr)
+          *theErr = TErr(myFid);
+        else if(myFid < 0)
+          EXCEPTION(std::runtime_error,"TFile - MEDfileOpen('"<<myFileName<<"',"<<theMode<<")");
+      }
+
+      const TIdt& Id() const 
+      { 
+        if(myFid < 0)
+          EXCEPTION(std::runtime_error,"TFile - GetFid() < 0");
+        return myFid;
+      }
+
+      void Close()
+      { 
+        if(--myCount == 0)
+          MEDfileClose(myFid);
+      }
+
+    protected:
+      TInt myCount;
+      TIdt myFid;
+      std::string myFileName;
+    };
+
+
+    //---------------------------------------------------------------
+    class TFileWrapper
+    {
+      PFile myFile;
+
+    public:
+      TFileWrapper(const PFile& theFile, EModeAcces theMode, TErr* theErr = NULL): 
+        myFile(theFile)
+      {
+        myFile->Open(theMode,theErr);
+      }
+      
+      ~TFileWrapper()
+      {
+        myFile->Close();
+      }
+    };
+
+
+    //---------------------------------------------------------------
+    TVWrapper::TVWrapper(const std::string& theFileName): 
+      myFile(new TFile(theFileName))
+    {}
+    
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbMeshes(TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      return MEDnMesh(myFile->Id());
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetMeshInfo(TInt theMeshId, 
+                  MED::TMeshInfo& theInfo,
+                  TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TValueHolder<TString, char> aMeshName(theInfo.myName);
+      TValueHolder<TInt, med_int> aDim(theInfo.myDim);
+      TValueHolder<TInt, med_int> aSpaceDim(theInfo.mySpaceDim);
+      TValueHolder<EMaillage, med_mesh_type> aType(theInfo.myType);
+      char dtunit[MED_SNAME_SIZE+1];
+      med_sorting_type sorttype;
+      med_int nstep;
+      med_axis_type at;
+      int naxis=MEDmeshnAxis(myFile->Id(),theMeshId);
+      char *axisname=new char[naxis*MED_SNAME_SIZE+1];
+      char *axisunit=new char[naxis*MED_SNAME_SIZE+1];
+      TErr aRet = MEDmeshInfo(myFile->Id(),
+                              theMeshId,
+                              &aMeshName,
+                              &aSpaceDim,
+                              &aDim,
+                              &aType,
+                              &theInfo.myDesc[0],
+                              dtunit,
+                              &sorttype,
+                              &nstep,
+                              &at,
+                              axisname,
+                              axisunit);
+      delete [] axisname;
+      delete [] axisunit;
+      if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetMeshInfo - MEDmeshInfo(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetMeshInfo(const MED::TMeshInfo& theInfo,
+                  EModeAcces theMode,
+                  TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+      
+      TValueHolder<TString, char> aMeshName(anInfo.myName);
+      TValueHolder<TInt, med_int> aDim(anInfo.myDim);
+      TValueHolder<TInt, med_int> aSpaceDim(anInfo.mySpaceDim);
+      TValueHolder<EMaillage, med_mesh_type> aType(anInfo.myType);
+      TValueHolder<TString, char> aDesc(anInfo.myDesc);
+
+      char *nam=new char[aSpaceDim*MED_SNAME_SIZE+1];
+      std::fill(nam,nam+aSpaceDim*MED_SNAME_SIZE+1,'\0');
+      char *unit=new char[aSpaceDim*MED_SNAME_SIZE+1];
+      std::fill(unit,unit+aSpaceDim*MED_SNAME_SIZE+1,'\0');
+      TErr aRet = MEDmeshCr(myFile->Id(),
+                            &aMeshName,
+                            aSpaceDim,
+                            aDim,
+                            aType,
+                            &aDesc,
+                            "",
+                            MED_SORT_DTIT,
+                            MED_CARTESIAN,
+                            nam,
+                            unit);
+      delete [] nam;
+      delete [] unit;
+      
+      //if(aRet == 0)
+      //  aRet = MEDunvCr(myFile->Id(),&aMeshName);
+      
+      INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetMeshInfo - MEDmeshCr(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetMeshInfo(const MED::TMeshInfo& theInfo,
+                  TErr* theErr)
+    {
+      TErr aRet;
+      SetMeshInfo(theInfo,eLECTURE_ECRITURE,&aRet);
+      
+      if(aRet < 0)
+        SetMeshInfo(theInfo,eLECTURE_AJOUT,&aRet);
+
+      if(aRet < 0)
+        SetMeshInfo(theInfo,eCREATION,&aRet);
+
+      if(theErr)
+        *theErr = aRet;
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbFamilies(const MED::TMeshInfo& theInfo,
+                    TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+      TValueHolder<TString, char> aName(anInfo.myName);
+      return MEDnFamily(myFile->Id(),&aName);
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbFamAttr(TInt theFamId, 
+                   const MED::TMeshInfo& theInfo,
+                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+
+      TValueHolder<TString, char> aName(anInfo.myName);
+
+      return MEDnFamily23Attribute(myFile->Id(),&aName,theFamId);
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbFamGroup(TInt theFamId, 
+                    const MED::TMeshInfo& theInfo,
+                    TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+
+      TValueHolder<TString, char> aName(anInfo.myName);
+
+      return MEDnFamilyGroup(myFile->Id(),&aName,theFamId);
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetFamilyInfo(TInt theFamId, 
+                    MED::TFamilyInfo& theInfo,
+                    TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+      
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TString, char> aFamilyName(theInfo.myName);
+      TValueHolder<TInt, med_int> aFamilyId(theInfo.myId);
+      TValueHolder<TFamAttr, med_int> anAttrId(theInfo.myAttrId);
+      TValueHolder<TFamAttr, med_int> anAttrVal(theInfo.myAttrVal);
+      TValueHolder<TString, char> anAttrDesc(theInfo.myAttrDesc);
+      TValueHolder<TString, char> aGroupNames(theInfo.myGroupNames);
+      
+      TErr aRet = MEDfamily23Info(myFile->Id(),
+                                  &aMeshName,
+                                  theFamId,
+                                  &aFamilyName,
+                                  &anAttrId,
+                                  &anAttrVal,
+                                  &anAttrDesc,
+                                  &aFamilyId,
+                                  &aGroupNames);
+
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetFamilyInfo - MEDfamily23Info(...) - "<<
+                  " aMeshInfo.myName = '"<<&aMeshName<<
+                  "'; theFamId = "<<theFamId<<
+                  "; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
+                  "; theInfo.myNbAttr = "<<theInfo.myNbAttr);
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+                    EModeAcces theMode,
+                    TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TFamilyInfo& anInfo = const_cast<MED::TFamilyInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+      
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TString, char> aFamilyName(anInfo.myName);
+      TValueHolder<TInt, med_int> aFamilyId(anInfo.myId);
+      TValueHolder<TFamAttr, med_int> anAttrId(anInfo.myAttrId);
+      TValueHolder<TFamAttr, med_int> anAttrVal(anInfo.myAttrVal);
+      TValueHolder<TInt, med_int> aNbAttr(anInfo.myNbAttr);
+      TValueHolder<TString, char> anAttrDesc(anInfo.myAttrDesc);
+      TValueHolder<TInt, med_int> aNbGroup(anInfo.myNbGroup);
+      TValueHolder<TString, char> aGroupNames(anInfo.myGroupNames);
+
+      TErr aRet = MEDfamilyCr(myFile->Id(),
+                              &aMeshName, 
+                              &aFamilyName,
+                              aFamilyId,
+                              aNbGroup,
+                              &aGroupNames);                 
+
+      INITMSG(MYDEBUG,"TVWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetFamilyInfo - MEDfamilyCr(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+                    TErr* theErr)
+    {
+      TErr aRet;
+      SetFamilyInfo(theInfo,eLECTURE_ECRITURE,&aRet);
+      
+      if(aRet < 0)
+        SetFamilyInfo(theInfo,eLECTURE_AJOUT,&aRet);
+
+      if(theErr)
+        *theErr = aRet;
+    }
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetNames(TElemInfo&        theInfo,
+               TInt              theNb,
+               EEntiteMaillage   theEntity, 
+               EGeometrieElement theGeom,
+               TErr*             theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      if ( theGeom == eBALL )
+        theGeom = GetBallGeom( theInfo.myMeshInfo );
+
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+      TValueHolder<TString, char>                        aMeshName  (aMeshInfo.myName);
+      TValueHolder<TString, char>                        anElemNames(theInfo.myElemNames);
+      TValueHolder<EEntiteMaillage, med_entity_type>     anEntity   (theEntity);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom      (theGeom);
+      
+      TErr aRet = MEDmeshEntityNameRd(myFile->Id(),
+                                      &aMeshName,
+                                      MED_NO_DT,
+                                      MED_NO_IT,
+                                      anEntity,
+                                      aGeom,
+                                      &anElemNames);
+
+      theInfo.myIsElemNames = aRet != 0? eFAUX : eVRAI ;
+
+      if(theErr)
+        *theErr = aRet;
+    }
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetNumeration(TElemInfo&        theInfo,
+                    TInt              theNb,
+                    EEntiteMaillage   theEntity, 
+                    EGeometrieElement theGeom,
+                    TErr*             theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      if ( theGeom == eBALL )
+        theGeom = GetBallGeom( theInfo.myMeshInfo );
+
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+      
+      TValueHolder<TString, char>                        aMeshName(aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int>                    anElemNum(theInfo.myElemNum);
+      TValueHolder<EEntiteMaillage, med_entity_type>     anEntity (theEntity);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom    (theGeom);
+      
+      TErr aRet = MEDmeshEntityNumberRd(myFile->Id(),
+                                        &aMeshName,
+                                        MED_NO_DT,
+                                        MED_NO_IT,
+                                        anEntity,
+                                        aGeom,
+                                        &anElemNum);
+
+      theInfo.myIsElemNum = aRet != 0? eFAUX : eVRAI;
+
+      if(theErr)
+        *theErr = aRet;
+    }
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetFamilies(TElemInfo&        theInfo,
+                  TInt              theNb,
+                  EEntiteMaillage   theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr*             theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      if ( theGeom == eBALL )
+        theGeom = GetBallGeom( theInfo.myMeshInfo );
+      
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+      TValueHolder<TString, char>                        aMeshName(aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int>                    aFamNum  (theInfo.myFamNum);
+      TValueHolder<EEntiteMaillage, med_entity_type>     anEntity (theEntity);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom    (theGeom);
+      
+      TErr aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+                                              &aMeshName,
+                                              MED_NO_DT,
+                                              MED_NO_IT,
+                                              anEntity,
+                                              aGeom,
+                                              &aFamNum);
+
+      if(aRet < 0)
+      {
+//        if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+          {
+            int aSize = (int)theInfo.myFamNum->size();
+            theInfo.myFamNum->clear();
+            theInfo.myFamNum->resize(aSize,0);
+            aRet = 0;
+          }
+//        else
+//          EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...) of CELLS");
+      }
+      if(theErr)
+        *theErr = aRet;
+    }
+
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetNames(const TElemInfo& theInfo,
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TErr* theErr)
+    { 
+      SetNames(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
+    }
+
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetNames(const TElemInfo&  theInfo,
+               EModeAcces        theMode,
+               EEntiteMaillage   theEntity, 
+               EGeometrieElement theGeom,
+               TErr*             theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      if ( theGeom == eBALL )
+        theGeom = GetBallGeom( theInfo.myMeshInfo );
+
+      MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      TErr aRet = 0;
+      if(theInfo.myIsElemNames)
+      {
+        TValueHolder<TString, char>                        aMeshName  (aMeshInfo.myName);
+        TValueHolder<TString, char>                        anElemNames(anInfo.myElemNames);
+        TValueHolder<EEntiteMaillage, med_entity_type>     anEntity   (theEntity);
+        TValueHolder<EGeometrieElement, med_geometry_type> aGeom      (theGeom);
+      
+        aRet  = MEDmeshEntityNameWr(myFile->Id(),
+                                    &aMeshName,
+                                    MED_NO_DT,
+                                    MED_NO_IT,
+                                    anEntity,
+                                    aGeom, 
+                                    (TInt)anInfo.myElemNames->size(),
+                                    &anElemNames);
+        if(theErr) 
+          *theErr = aRet;
+        else if(aRet < 0)
+          EXCEPTION(std::runtime_error,"SetNames - MEDmeshEntityNameWr(...)");
+      }
+    }
+
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetNumeration(const TElemInfo& theInfo,
+                    EEntiteMaillage theEntity, 
+                    EGeometrieElement theGeom,
+                    TErr* theErr)
+    { 
+      SetNumeration(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
+    }
+
+
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetNumeration(const TElemInfo&  theInfo,
+                    EModeAcces        theMode,
+                    EEntiteMaillage   theEntity, 
+                    EGeometrieElement theGeom,
+                    TErr*             theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      if ( theGeom == eBALL )
+        theGeom = GetBallGeom( theInfo.myMeshInfo );
+
+      MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      TErr aRet = 0;
+      if(theInfo.myIsElemNum)
+      {
+        TValueHolder<TString, char>                        aMeshName(aMeshInfo.myName);
+        TValueHolder<TElemNum, med_int>                    anElemNum(anInfo.myElemNum);
+        TValueHolder<EEntiteMaillage, med_entity_type>     anEntity (theEntity);
+        TValueHolder<EGeometrieElement, med_geometry_type> aGeom    (theGeom);
+      
+        aRet  = MEDmeshEntityNumberWr(myFile->Id(),
+                                      &aMeshName,
+                                      MED_NO_DT,
+                                      MED_NO_IT,
+                                      anEntity,
+                                      aGeom,
+                                      (TInt)anInfo.myElemNum->size(),
+                                      &anElemNum);
+        if(theErr) 
+          *theErr = aRet;
+        else if(aRet < 0)
+          EXCEPTION(std::runtime_error,"SetNumeration - MEDmeshEntityNumberWr(...)");
+      }
+    }
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetFamilies(const TElemInfo&  theInfo,
+                  EEntiteMaillage   theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr*             theErr)
+    { 
+      SetFamilies(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
+    }
+
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetFamilies(const TElemInfo&  theInfo,
+                  EModeAcces        theMode,
+                  EEntiteMaillage   theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr*             theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      if ( theGeom == eBALL )
+        theGeom = GetBallGeom( theInfo.myMeshInfo );
+
+      MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      TValueHolder<TString, char>                        aMeshName(aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int>                    aFamNum  (anInfo.myFamNum);
+      TValueHolder<EEntiteMaillage, med_entity_type>     anEntity (theEntity);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom    (theGeom);
+      
+      TErr aRet = MEDmeshEntityFamilyNumberWr(myFile->Id(),
+                                              &aMeshName,
+                                              MED_NO_DT,
+                                              MED_NO_IT,
+                                              anEntity,
+                                              aGeom,
+                                              (TInt)anInfo.myFamNum->size(),
+                                              &aFamNum);
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetFamilies - MEDmeshEntityFamilyNumberWr(...)");
+    }
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+                 ETable theTable,
+                 TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<ETable, med_data_type > aTable(theTable);
+      med_bool chgt,trsf;
+      return MEDmeshnEntity(myFile->Id(),
+                            &aMeshName,
+                            MED_NO_DT,
+                            MED_NO_IT,
+                            MED_NODE,
+                            MED_NO_GEOTYPE,
+                            aTable,
+                            MED_NO_CMODE,
+                            &chgt,
+                            &trsf);
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetNodeInfo(MED::TNodeInfo& theInfo,
+                  TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TInt, med_int> aDim(aMeshInfo.myDim);
+      TValueHolder<TNodeCoord, med_float> aCoord(theInfo.myCoord);
+      TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
+      TValueHolder<ERepere, med_axis_type> aSystem(theInfo.mySystem);
+      TValueHolder<TString, char> aCoordNames(theInfo.myCoordNames);
+      TValueHolder<TString, char> aCoordUnits(theInfo.myCoordUnits);
+      TValueHolder<TString, char> anElemNames(theInfo.myElemNames);
+      //TValueHolder<EBooleen, med_bool> anIsElemNames(theInfo.myIsElemNames);
+      TValueHolder<TElemNum, med_int> anElemNum(theInfo.myElemNum);
+      //TValueHolder<EBooleen, med_bool> anIsElemNum(theInfo.myIsElemNum);
+      TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamNum);
+      TValueHolder<TInt, med_int> aNbElem(theInfo.myNbElem);
+
+      TErr aRet = MEDmeshNodeCoordinateRd(myFile->Id(),
+                                          &aMeshName,
+                                          MED_NO_DT,
+                                          MED_NO_IT,
+                                          aModeSwitch,
+                                          &aCoord);
+
+      TErr aRet2 =MEDmeshEntityFamilyNumberRd(myFile->Id(),
+                                  &aMeshName,
+                                  MED_NO_DT,
+                                  MED_NO_IT,
+                                  MED_NODE,
+                                  MED_NO_GEOTYPE ,
+                                  &aFamNum);
+      if (aRet2  < 0)
+      {
+//        if (aRet2 == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+          {
+            int mySize = (int)theInfo.myFamNum->size();
+            theInfo.myFamNum->clear();
+            theInfo.myFamNum->resize(mySize,0);
+          }
+//        else
+//          EXCEPTION(std::runtime_error,"GetNodeInfo - MEDmeshEntityFamilyNumberRd(...)");
+      }
+                                  
+      if ( MEDmeshEntityNameRd(myFile->Id(),
+                          &aMeshName,
+                          MED_NO_DT,
+                          MED_NO_IT,
+                          MED_NODE,
+                          MED_NO_GEOTYPE ,
+                          &anElemNames) < 0) theInfo.myIsElemNames=eFAUX;
+      
+      if ( MEDmeshEntityNumberRd(myFile->Id(),
+                            &aMeshName,
+                            MED_NO_DT,
+                            MED_NO_IT,
+                            MED_NODE,
+                            MED_NO_GEOTYPE ,
+                            &anElemNum) < 0 ) theInfo.myIsElemNum=eFAUX;
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetNodeInfo - MEDmeshNodeCoordinateRd(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+                  EModeAcces theMode,
+                  TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+      
+      TValueHolder<TString, char>                aMeshName    (aMeshInfo.myName);
+      TValueHolder<TNodeCoord, med_float>        aCoord       (anInfo.myCoord);
+      TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch  (anInfo.myModeSwitch);
+      TValueHolder<ERepere, med_axis_type>       aSystem      (anInfo.mySystem);
+      TValueHolder<TString, char>                aCoordNames  (anInfo.myCoordNames);
+      TValueHolder<TString, char>                aCoordUnits  (anInfo.myCoordUnits);
+      TValueHolder<TString, char>                anElemNames  (anInfo.myElemNames);
+      TValueHolder<EBooleen, med_bool>           anIsElemNames(anInfo.myIsElemNames);
+      TValueHolder<TElemNum, med_int>            anElemNum    (anInfo.myElemNum);
+      TValueHolder<EBooleen, med_bool>           anIsElemNum  (anInfo.myIsElemNum);
+      TValueHolder<TElemNum, med_int>            aFamNum      (anInfo.myFamNum);
+      TValueHolder<TInt, med_int>                aNbElem      (anInfo.myNbElem);
+
+      TErr aRet = MEDmeshNodeCoordinateWr(myFile->Id(),
+                                          &aMeshName,
+                                          MED_NO_DT,
+                                          MED_NO_IT,
+                                          MED_NO_DT,
+                                          aModeSwitch,
+                                          aNbElem,
+                                          &aCoord);
+                                          
+      MEDmeshEntityFamilyNumberWr(myFile->Id(),
+                                  &aMeshName,
+                                  MED_NO_DT,
+                                  MED_NO_IT,
+                                  MED_NODE,
+                                  MED_NO_GEOTYPE,
+                                  aNbElem,
+                                  &aFamNum);
+      if(anIsElemNames)
+        MEDmeshEntityNameWr(myFile->Id(),
+                            &aMeshName,
+                            MED_NO_DT,
+                            MED_NO_IT,
+                            MED_NODE,
+                            MED_NO_GEOTYPE,
+                            aNbElem,
+                            &anElemNames);
+      if(anIsElemNum)
+        MEDmeshEntityNumberWr(myFile->Id(),
+                              &aMeshName,
+                              MED_NO_DT,
+                              MED_NO_IT,
+                              MED_NODE,
+                              MED_NO_GEOTYPE,
+                              aNbElem,
+                              &anElemNum);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetNodeInfo - MEDmeshNodeCoordinateWr(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+                  TErr* theErr)
+    {
+      TErr aRet;
+      SetNodeInfo(theInfo,eLECTURE_ECRITURE,&aRet);
+      
+      if(aRet < 0)
+        SetNodeInfo(theInfo,eLECTURE_AJOUT,&aRet);
+
+      if(theErr) 
+        *theErr = aRet;
+    }
+    
+
+    //-----------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
+                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return;
+
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int> anIndex(theInfo.myIndex);
+      TInt aNbElem = (TInt)theInfo.myElemNum->size();
+      TValueHolder<TElemNum, med_int> aConn(theInfo.myConn);
+      TValueHolder<EEntiteMaillage, med_entity_type> anEntity(theInfo.myEntity);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theInfo.myConnMode);
+
+      TErr aRet;
+      aRet = MEDmeshPolygonRd(myFile->Id(),
+                              &aMeshName,
+                              MED_NO_DT,
+                              MED_NO_IT,
+                              anEntity,
+                              aConnMode,
+                              &anIndex,
+                              &aConn);
+
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshPolygonRd(...)");
+
+      if(theInfo.myIsElemNames){
+        GetNames(theInfo,aNbElem,theInfo.myEntity,ePOLYGONE,&aRet);
+        if(theErr) 
+          *theErr = aRet;
+      }
+
+      if(theInfo.myIsElemNum){
+        GetNumeration(theInfo,aNbElem,theInfo.myEntity,ePOLYGONE,&aRet);
+        if(theErr) 
+          *theErr = aRet;
+      }
+
+      GetFamilies(theInfo,aNbElem,theInfo.myEntity,ePOLYGONE,&aRet);
+      if(theErr) 
+        *theErr = aRet;
+    }
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+                      TErr* theErr)
+    {
+      SetPolygoneInfo(theInfo,eLECTURE_ECRITURE,theErr);
+    }
+    
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+                      EModeAcces theMode,
+                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int> anIndex(anInfo.myIndex);
+      TValueHolder<TElemNum, med_int> aConn(anInfo.myConn);
+      TValueHolder<EEntiteMaillage, med_entity_type> anEntity(anInfo.myEntity);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(anInfo.myConnMode);
+
+      TErr aRet = MEDmeshPolygonWr(myFile->Id(),
+                                   &aMeshName,
+                                   MED_NO_DT,
+                                   MED_NO_IT,
+                                   MED_UNDEF_DT,
+                                   anEntity,
+                                   aConnMode,
+                                   anInfo.myNbElem + 1,
+                                   &anIndex,
+                                   &aConn);
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetPolygoneInfo - MEDmeshPolygonWr(...)");
+      
+      SetNames(anInfo,theInfo.myEntity,ePOLYGONE,&aRet);
+      if(theErr) 
+        *theErr = aRet;
+      
+      SetNumeration(anInfo,theInfo.myEntity,ePOLYGONE,&aRet);
+      if(theErr) 
+        *theErr = aRet;
+      
+      SetFamilies(anInfo,theInfo.myEntity,ePOLYGONE,&aRet);
+      if(theErr) 
+        *theErr = aRet;
+    }
+
+    //----------------------------------------------------------------------------
+    TInt 
+    TVWrapper
+    ::GetNbPolygones(const MED::TMeshInfo& theMeshInfo, 
+                     EEntiteMaillage theEntity, 
+                     EGeometrieElement theGeom, 
+                     EConnectivite theConnMode,
+                     TErr* theErr)
+    {
+      return GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
+    }
+    
+    //----------------------------------------------------------------------------
+    TInt 
+    TVWrapper
+    ::GetPolygoneConnSize(const MED::TMeshInfo& theMeshInfo, 
+                          EEntiteMaillage theEntity, 
+                          EGeometrieElement theGeom, 
+                          EConnectivite theConnMode,
+                          TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return 0;
+
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      med_int aTaille = 0;
+      med_bool chgt,trsf;
+      aTaille=MEDmeshnEntity(myFile->Id(),
+                             &aMeshName,
+                             MED_NO_DT,
+                             MED_NO_IT,
+                             med_entity_type(theEntity),
+                             MED_POLYGON,
+                             MED_CONNECTIVITY,
+                             med_connectivity_mode(theConnMode),
+                             &chgt,
+                             &trsf);
+
+      
+      if(aTaille < 0)
+        EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshnEntity(...)");
+
+      return TInt(aTaille);
+    }
+
+    //-----------------------------------------------------------------
+    void 
+    TVWrapper
+    ::GetPolyedreInfo(TPolyedreInfo& theInfo,
+                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return;
+
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TInt aNbElem = (TInt)theInfo.myElemNum->size();
+      TValueHolder<TElemNum, med_int> anIndex(theInfo.myIndex);
+      TValueHolder<TElemNum, med_int> aFaces(theInfo.myFaces);
+      TValueHolder<TElemNum, med_int> aConn(theInfo.myConn);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theInfo.myConnMode);
+
+      TErr aRet;
+      aRet = MEDmeshPolyhedronRd(myFile->Id(),
+                                 &aMeshName,
+                                 MED_NO_DT,
+                                 MED_NO_IT,
+                                 MED_CELL,
+                                 aConnMode,
+                                 &anIndex,
+                                 &aFaces,
+                                 &aConn);
+
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshPolyhedronRd(...)");
+
+      if(theInfo.myIsElemNames){
+        GetNames(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
+        if(theErr)
+          *theErr = aRet;
+      }
+
+      if(theInfo.myIsElemNum){
+        GetNumeration(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
+        if(theErr) 
+          *theErr = aRet;
+      }
+
+      GetFamilies(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
+      if(theErr) 
+        *theErr = aRet;
+    }
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetPolyedreInfo(const TPolyedreInfo& theInfo,
+                      TErr* theErr)
+    {
+      SetPolyedreInfo(theInfo,eLECTURE_ECRITURE,theErr);
+    }
+    
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+                      EModeAcces theMode,
+                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int> anIndex(anInfo.myIndex);
+      TValueHolder<TElemNum, med_int> aFaces(anInfo.myFaces);
+      TValueHolder<TElemNum, med_int> aConn(anInfo.myConn);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(anInfo.myConnMode);
+
+      TErr aRet;
+      aRet = MEDmeshPolyhedronWr(myFile->Id(),
+                                 &aMeshName,
+                                 MED_NO_DT,
+                                 MED_NO_IT,
+                                 MED_UNDEF_DT,
+                                 MED_CELL,
+                                 aConnMode,
+                                 anInfo.myNbElem+1,
+                                 &anIndex,
+                                 (TInt)anInfo.myFaces->size(),
+                                 &aFaces,
+                                 &aConn);
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshPolyhedronWr(...)");
+      
+      TValueHolder<EEntiteMaillage, med_entity_type> anEntity(anInfo.myEntity);
+
+      if(theInfo.myIsElemNames){
+        TValueHolder<TString, char> anElemNames(anInfo.myElemNames);
+        aRet  = MEDmeshEntityNameWr(myFile->Id(),
+                                    &aMeshName,
+                                    MED_NO_DT,
+                                    MED_NO_IT,
+                                    anEntity,
+                                    MED_POLYHEDRON,
+                                    (TInt)anInfo.myElemNames->size(),
+                                    &anElemNames);
+        if(theErr) 
+          *theErr = aRet;
+        else if(aRet < 0)
+          EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshEntityNameWr(...)");
+      }
+      
+      if(theInfo.myIsElemNum){
+        TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+        aRet = MEDmeshEntityNumberWr(myFile->Id(),
+                                     &aMeshName,
+                                     MED_NO_DT,
+                                     MED_NO_IT,
+                                     anEntity,
+                                     MED_POLYHEDRON,
+                                     (TInt)anInfo.myElemNum->size(),
+                                     &anElemNum);
+        if(theErr) 
+          *theErr = aRet;
+        else if(aRet < 0)
+          EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshEntityNumberWr(...)");
+      }
+      
+      
+      TValueHolder<TElemNum, med_int> aFamNum(anInfo.myFamNum);
+      aRet = MEDmeshEntityFamilyNumberWr(myFile->Id(),
+                                         &aMeshName,
+                                         MED_NO_DT,
+                                         MED_NO_IT,
+                                         anEntity,
+                                         MED_POLYHEDRON,
+                                         (TInt)anInfo.myFamNum->size(),
+                                         &aFamNum);
+      
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshEntityFamilyNumberWr(...)");
+    }
+
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo, 
+                     EEntiteMaillage theEntity, 
+                     EGeometrieElement theGeom, 
+                     EConnectivite theConnMode,
+                     TErr* theErr)
+    {
+      return GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
+    }
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper    ::GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+                          TInt& theNbFaces,
+                          TInt& theConnSize,
+                          EConnectivite theConnMode,
+                          TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0) 
+        EXCEPTION(std::runtime_error,"GetPolyedreConnSize - (...)");
+
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theConnMode);
+      //TValueHolder<TInt, med_int> aNbFaces(theNbFaces);
+      //TValueHolder<TInt, med_int> aConnSize(theConnSize);
+
+      med_bool chgt,trsf;
+      theNbFaces = MEDmeshnEntity(myFile->Id(),
+                                  &aMeshName,
+                                  MED_NO_DT,
+                                  MED_NO_IT,
+                                  MED_CELL,
+                                  MED_POLYHEDRON,
+                                  MED_INDEX_NODE,
+                                  aConnMode,
+                                  &chgt,
+                                  &trsf);
+
+      theConnSize = MEDmeshnEntity(myFile->Id(),
+                                  &aMeshName,
+                                  MED_NO_DT,
+                                  MED_NO_IT,
+                                  MED_CELL,
+                                  MED_POLYHEDRON,
+                                  MED_CONNECTIVITY,
+                                  aConnMode,
+                                  &chgt,
+                                  &trsf);
+
+      if(theNbFaces < 0 || theConnSize<0)
+        EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshnEntity(...)");
+
+    }
+    
+    //-----------------------------------------------------------------
+    TEntityInfo
+    TVWrapper
+    ::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
+                    EConnectivite theConnMode,
+                    TErr* theErr)
+    {
+      TEntityInfo anInfo;
+      
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return anInfo;
+
+      if(theMeshInfo.GetType() == eNON_STRUCTURE) {
+        TInt aNbElem = GetNbNodes(theMeshInfo);
+        if(aNbElem > 0){
+          anInfo[eNOEUD][ePOINT1] = aNbElem;
+          const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
+          TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
+          TEntity2GeomSet::const_iterator anIterEnd = anEntity2GeomSet.end();
+          for(; anIter != anIterEnd; anIter++){
+            const EEntiteMaillage& anEntity = anIter->first;
+            const TGeomSet& aGeomSet = anIter->second;
+            TGeomSet::const_iterator anIter2 = aGeomSet.begin();
+            TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
+            for(; anIter2 != anIterEnd2; anIter2++){
+              const EGeometrieElement& aGeom = *anIter2;
+              aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theConnMode,theErr);
+              if(aNbElem > 0) {
+                if ( anEntity == eSTRUCT_ELEMENT ) {
+                  const TInt nbStructTypes = aNbElem;
+                  for ( TInt structType = 0; structType < nbStructTypes; ++structType ) {
+                    // check type name to keep only "MED_BALL" structured element
+                    TValueHolder<TString, char> aMeshName((TString&) theMeshInfo.myName );
+                    char                        geotypename[ MED_NAME_SIZE + 1] = "";
+                    med_geometry_type           geotype;
+                    MEDmeshEntityInfo( myFile->Id(), &aMeshName, MED_NO_DT, MED_NO_IT,
+                                       med_entity_type(anEntity), structType+1,
+                                       geotypename, &geotype);
+                    if ( strcmp( geotypename, MED_BALL_NAME ) == 0 ) {
+                      aNbElem = GetNbCells( theMeshInfo, anEntity, EGeometrieElement(geotype),
+                                            theConnMode, theErr);
+                      if ( aNbElem > 0 )
+                        anInfo[anEntity][EGeometrieElement(geotype)] = aNbElem;
+                    }
+                  }
+                }
+                else {
+                  anInfo[anEntity][aGeom] = aNbElem;
+                }
+              }
+            }
+          }
+        }
+      } else { // eSTRUCTURE
+        EGrilleType aGrilleType;
+        TInt aNbNodes = 1;
+        TInt aNbElem  = 1;
+        TInt aNbSub   = 0;
+        TInt aDim = theMeshInfo.GetDim();
+        EGeometrieElement aGeom, aSubGeom;
+        EEntiteMaillage aSubEntity = eMAILLE;
+
+        GetGrilleType(theMeshInfo, aGrilleType);
+
+        TIntVector aStruct(aDim);
+        if(aGrilleType == eGRILLE_STANDARD)
+        {
+          GetGrilleStruct(theMeshInfo, aStruct, theErr);
+        }
+        else
+        { // eGRILLE_CARTESIENNE and eGRILLE_POLAIRE
+          ETable aTable[3] = { eCOOR_IND1, eCOOR_IND2, eCOOR_IND3 };
+          for(med_int anAxis = 0; anAxis < aDim; anAxis++)
+            aStruct[ anAxis ] = GetNbNodes(theMeshInfo, aTable[anAxis]);
+        }
+        for(med_int i = 0; i < aDim; i++){
+          aNbNodes = aNbNodes * aStruct[i];
+          aNbElem = aNbElem * (aStruct[i] - 1);
+        }
+        switch(aDim){
+        case 1:
+          aGeom = eSEG2;
+          break;
+        case 2:
+          aGeom = eQUAD4;
+          aSubGeom = eSEG2;
+          aSubEntity = eARETE;
+          aNbSub =
+            (aStruct[0]  ) * (aStruct[1]-1) +
+            (aStruct[0]-1) * (aStruct[1]  );
+          break;
+        case 3:
+          aGeom = eHEXA8;
+          aSubGeom = eQUAD4;
+          aSubEntity = eFACE;
+          aNbSub =
+            (aStruct[0]  ) * (aStruct[1]-1) * (aStruct[2]-1) +
+            (aStruct[0]-1) * (aStruct[1]  ) * (aStruct[2]-1) +
+            (aStruct[0]-1) * (aStruct[1]-1) * (aStruct[2]  );
+          break;
+        }
+        anInfo[eNOEUD][ePOINT1] = aNbNodes;
+        anInfo[eMAILLE][aGeom] = aNbElem;
+        if ( aDim > 1 )
+          anInfo[aSubEntity][aSubGeom] = aNbSub;
+      }
+      return anInfo;
+    }
+    
+    
+    //-----------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbCells(const MED::TMeshInfo& theMeshInfo, 
+                 EEntiteMaillage theEntity, 
+                 EGeometrieElement theGeom, 
+                 EConnectivite theConnMode,
+                 TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return -1;
+
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      med_bool chgt,trsf;
+      if(theGeom!=MED::ePOLYGONE && theGeom!=MED::ePOLYEDRE && theGeom != MED::eBALL)
+      {
+        return MEDmeshnEntity(myFile->Id(),
+                              &aMeshName,
+                              MED_NO_DT,
+                              MED_NO_IT,
+                              med_entity_type(theEntity),
+                              med_geometry_type(theGeom),
+                              MED_CONNECTIVITY,
+                              med_connectivity_mode(theConnMode),
+                              &chgt,
+                              &trsf);
+      }
+      else if(theGeom==MED::ePOLYGONE)
+      {
+        return MEDmeshnEntity(myFile->Id(),&aMeshName,MED_NO_DT,MED_NO_IT,med_entity_type(theEntity),
+                              MED_POLYGON,MED_INDEX_NODE,med_connectivity_mode(theConnMode),&chgt,&trsf)-1;
+      }
+      else if ( theGeom==MED::ePOLYEDRE )
+      {
+        return MEDmeshnEntity(myFile->Id(),&aMeshName,MED_NO_DT,MED_NO_IT,med_entity_type(theEntity),
+                              MED_POLYHEDRON,MED_INDEX_FACE,med_connectivity_mode(theConnMode),&chgt,&trsf)-1;
+      }
+      else if ( theGeom==MED::eBALL )
+      {
+        return GetNbBalls( theMeshInfo );
+      }
+      return 0;
+    }
+
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetCellInfo(MED::TCellInfo& theInfo,
+                  TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+      TValueHolder<TString, char>                        aMeshName    (aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int>                    aConn        (theInfo.myConn);
+      TValueHolder<EModeSwitch, med_switch_mode>         aModeSwitch  (theInfo.myModeSwitch);
+      TValueHolder<TString, char>                        anElemNames  (theInfo.myElemNames);
+      TValueHolder<EBooleen, med_bool>                   anIsElemNames(theInfo.myIsElemNames);
+      TValueHolder<TElemNum, med_int>                    anElemNum    (theInfo.myElemNum);
+      TValueHolder<EBooleen, med_bool>                   anIsElemNum  (theInfo.myIsElemNum);
+      TValueHolder<TElemNum, med_int>                    aFamNum      (theInfo.myFamNum);
+      TValueHolder<EBooleen, med_bool>                   anIsFamNum   (theInfo.myIsFamNum);
+      TValueHolder<EEntiteMaillage, med_entity_type>     anEntity     (theInfo.myEntity);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom        (theInfo.myGeom);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode    (theInfo.myConnMode);
+
+      TErr aRet;
+      aRet = MEDmeshElementRd(myFile->Id(),
+                              &aMeshName,
+                              MED_NO_DT,
+                              MED_NO_IT,
+                              anEntity,
+                              aGeom,
+                              aConnMode,
+                              aModeSwitch,
+                              &aConn,
+                              &anIsElemNames,
+                              &anElemNames,
+                              &anIsElemNum,
+                              &anElemNum,
+                              &anIsFamNum,
+                              &aFamNum);
+
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetCellInfo - MEDmeshElementRd(...)");
+      
+      if (anIsFamNum == MED_FALSE)
+        {
+          int mySize = (int) theInfo.myFamNum->size();
+          theInfo.myFamNum->clear();
+          theInfo.myFamNum->resize(mySize, 0);
+        }
+      
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetCellInfo(const MED::TCellInfo& theInfo,
+                  EModeAcces theMode,
+                  TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+
+      MED::TCellInfo& anInfo    = const_cast<MED::TCellInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      TValueHolder<TString, char>                        aMeshName    (aMeshInfo.myName);
+      TValueHolder<TElemNum, med_int>                    aConn        (anInfo.myConn);
+      TValueHolder<EModeSwitch, med_switch_mode>         aModeSwitch  (anInfo.myModeSwitch);
+      TValueHolder<TString, char>                        anElemNames  (anInfo.myElemNames);
+      TValueHolder<EBooleen, med_bool>                   anIsElemNames(anInfo.myIsElemNames);
+      TValueHolder<TElemNum, med_int>                    anElemNum    (anInfo.myElemNum);
+      TValueHolder<EBooleen, med_bool>                   anIsElemNum  (anInfo.myIsElemNum);
+      TValueHolder<TElemNum, med_int>                    aFamNum      (anInfo.myFamNum);
+      TValueHolder<EBooleen, med_bool>                   anIsFamNum   (anInfo.myIsFamNum);
+      TValueHolder<EEntiteMaillage, med_entity_type>     anEntity     (anInfo.myEntity);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom        (anInfo.myGeom);
+      TValueHolder<EConnectivite, med_connectivity_mode> aConnMode    (anInfo.myConnMode);
+      TValueHolder<TInt, med_int>                        aNbElem      (anInfo.myNbElem);
+
+      TErr aRet;
+      aRet = MEDmeshElementConnectivityWr(myFile->Id(),
+                                          &aMeshName,
+                                          MED_NO_DT,
+                                          MED_NO_IT,
+                                          MED_UNDEF_DT,
+                                          anEntity,
+                                          aGeom,
+                                          aConnMode,
+                                          aModeSwitch,
+                                          aNbElem,
+                                          &aConn);
+
+      MEDmeshEntityFamilyNumberWr(myFile->Id(),
+                                  &aMeshName,
+                                  MED_NO_DT,
+                                  MED_NO_IT,
+                                  anEntity,
+                                  aGeom,
+                                  aNbElem,
+                                  &aFamNum);
+      if(anIsElemNames)
+        MEDmeshEntityNameWr(myFile->Id(),
+                            &aMeshName,
+                            MED_NO_DT,
+                            MED_NO_IT,
+                            anEntity,
+                            aGeom,
+                            aNbElem,
+                            &anElemNames);
+      if(anIsElemNum)
+        MEDmeshEntityNumberWr(myFile->Id(),
+                              &aMeshName,
+                              MED_NO_DT,
+                              MED_NO_IT,
+                              anEntity,
+                              aGeom,
+                              aNbElem,
+                              &anElemNum);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetCellInfo - MEDmeshElementWr(...)");
+    }
+    
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetCellInfo(const MED::TCellInfo& theInfo,
+                  TErr* theErr)
+    {
+      SetCellInfo(theInfo,eLECTURE_ECRITURE,theErr);
+    }
+
+    //----------------------------------------------------------------------------
+    //! Read geom type of MED_BALL structural element
+    EGeometrieElement TVWrapper::GetBallGeom(const TMeshInfo& theMeshInfo)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE);
+
+      // read med_geometry_type of "MED_BALL" element
+      char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
+      return EGeometrieElement( MEDstructElementGeotype( myFile->Id(), geotypename ) );
+    }
+
+    //----------------------------------------------------------------------------
+    //! Read number of balls in the Mesh
+    TInt TVWrapper::GetNbBalls(const TMeshInfo& theMeshInfo)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE);
+
+      EGeometrieElement ballType = GetBallGeom( theMeshInfo );
+      if ( ballType < 0 )
+        return 0;
+
+      return GetNbCells( theMeshInfo, eSTRUCT_ELEMENT, ballType, eNOD );
+    }
+
+    //----------------------------------------------------------------------------
+    //! Read a MEDWrapped representation of MED_BALL from the MED file
+    void TVWrapper::GetBallInfo(TBallInfo& theInfo, TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      // check geometry of MED_BALL
+      if ( theInfo.myGeom == eBALL )
+      {
+        theInfo.myGeom = GetBallGeom( *theInfo.myMeshInfo );
+        if ( theInfo.myGeom < 0 ) {
+          if ( !theErr )
+            EXCEPTION(std::runtime_error,"GetBallInfo - no balls in the mesh");
+          *theErr = theInfo.myGeom;
+          return;
+        }
+      }
+
+      // read nodes ids
+      GetCellInfo( theInfo );
+
+      // read diameters
+      TValueHolder<TString, char>                        aMeshName (theInfo.myMeshInfo->myName);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom     (theInfo.myGeom);
+      TValueHolder<TFloatVector, void>                   aDiam     (theInfo.myDiameters);
+      char varattname[ MED_NAME_SIZE + 1] = MED_BALL_DIAMETER;
+
+      TErr aRet = MEDmeshStructElementVarAttRd( myFile->Id(), &aMeshName,
+                                                MED_NO_DT, MED_NO_IT,
+                                                aGeom,
+                                                varattname,
+                                                &aDiam);
+      if ( theErr )
+        *theErr = aRet;
+      else if ( aRet < 0 )
+        EXCEPTION(std::runtime_error,"GetBallInfo - pb at reading diameters");
+    }
+
+
+    //----------------------------------------------------------------------------
+    //! Write a MEDWrapped representation of MED_BALL to the MED file
+    void  TVWrapper::SetBallInfo(const TBallInfo& theInfo, EModeAcces theMode, TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+      TErr ret;
+      char ballsupportname[MED_NAME_SIZE+1]="BALL_SUPPORT_MESH";
+      EGeometrieElement ballGeom = GetBallGeom( *theInfo.myMeshInfo );
+      if ( ballGeom < 0 )
+      {
+        // no ball model in the file, create support mesh for it
+        char dummyname [MED_NAME_SIZE*3+1]="";
+        if (( ret = MEDsupportMeshCr( myFile->Id(),
+                                      ballsupportname,
+                                      theInfo.myMeshInfo->GetSpaceDim(),
+                                      theInfo.myMeshInfo->GetDim(),
+                                      "Support mesh for a ball model",
+                                      MED_CARTESIAN,
+                                      /*axisname=*/dummyname, /*unitname=*/dummyname)) < 0) {
+          if ( !theErr )
+            EXCEPTION(std::runtime_error,"SetBallInfo - MEDsupportMeshCr");
+          *theErr = ret;
+          return;
+        }
+        // write coordinates of 1 node
+        med_float coord[3] = {0,0,0};
+        if ((ret = MEDmeshNodeCoordinateWr(myFile->Id(),
+                                           ballsupportname, MED_NO_DT, MED_NO_IT, 0.0,
+                                           MED_FULL_INTERLACE, /*nnode=*/1, coord)) < 0) {
+          if ( !theErr )
+            EXCEPTION(std::runtime_error,"SetBallInfo - MEDmeshNodeCoordinateWr");
+          *theErr = ret;
+          return;
+        }
+        // ball model creation
+        char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
+        if (( ballGeom = (EGeometrieElement) MEDstructElementCr(myFile->Id(),
+                                                                geotypename,
+                                                                theInfo.myMeshInfo->GetSpaceDim(),
+                                                                ballsupportname,
+                                                                MED_NODE,MED_NONE)) < 0 ) {
+          if ( !theErr )
+            EXCEPTION(std::runtime_error,"SetBallInfo - MEDstructElementCr");
+          *theErr = ret;
+          return;
+        }
+        // create diameter attribute
+        if (( ret = MEDstructElementVarAttCr(myFile->Id(),
+                                             geotypename, MED_BALL_DIAMETER,
+                                             MED_ATT_FLOAT64, /*ncomp=*/1)) < 0) {
+          if ( !theErr )
+            EXCEPTION(std::runtime_error,"SetBallInfo - MEDstructElementVarAttCr");
+          *theErr = ret;
+          return;
+        }
+      } // ballGeom < 0
+
+      TBallInfo& aBallInfo = ((TBallInfo&) theInfo );
+      aBallInfo.myGeom = ballGeom;
+
+      // write node ids
+      SetCellInfo(theInfo,theMode,theErr);
+      if ( theErr && theErr < 0 )
+        return;
+
+      // write diameter
+      TValueHolder<TString, char>                        aMeshName (aBallInfo.myMeshInfo->myName);
+      TValueHolder<EGeometrieElement, med_geometry_type> aGeom     (aBallInfo.myGeom);
+      TValueHolder<TFloatVector, void>                   aDiam     (aBallInfo.myDiameters);
+      ret = MEDmeshStructElementVarAttWr(myFile->Id(), &aMeshName,
+                                         MED_NO_DT, MED_NO_IT,
+                                         aGeom, MED_BALL_DIAMETER,
+                                         theInfo.myNbElem, &aDiam);
+      if ( theErr )
+        *theErr = ret;
+      else if ( ret < 0 )
+        EXCEPTION(std::runtime_error,"SetBallInfo - MEDmeshStructElementVarAttWr");
+    }
+
+    //----------------------------------------------------------------------------
+    //! Write a MEDWrapped representation of MED_BALL to the MED file
+    void  TVWrapper::SetBallInfo(const TBallInfo& theInfo, TErr* theErr)
+    {
+      SetBallInfo( theInfo, eLECTURE_ECRITURE, theErr );
+    }
+
+    //-----------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbFields(TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      return MEDnField(myFile->Id());
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbComp(TInt theFieldId,
+                TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      return MEDfieldnComponent(myFile->Id(),theFieldId);
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetFieldInfo(TInt theFieldId, 
+                   MED::TFieldInfo& theInfo,
+                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TString aFieldName(256); // Protect from memory problems with too long names
+      TValueHolder<ETypeChamp, med_field_type> aType(theInfo.myType);
+      TValueHolder<TString, char> aCompNames(theInfo.myCompNames);
+      TValueHolder<TString, char> anUnitNames(theInfo.myUnitNames);
+      MED::TMeshInfo& aMeshInfo = theInfo.myMeshInfo;
+      
+      TErr aRet;
+      med_bool local;
+      char dtunit[MED_SNAME_SIZE+1];
+          char local_mesh_name[MED_NAME_SIZE+1]="";
+      med_int nbofstp;
+      theInfo.myNbComp = MEDfieldnComponent(myFile->Id(),theFieldId);
+      aRet = MEDfieldInfo(myFile->Id(),
+                          theFieldId,
+                          &aFieldName[0],
+                          local_mesh_name,
+                          &local,
+                          &aType,
+                          &aCompNames,
+                          &anUnitNames,
+                          dtunit,
+                          &nbofstp);
+
+          if(strcmp(&aMeshInfo.myName[0],local_mesh_name) != 0 ) {
+                  if(theErr)
+                        *theErr = -1;
+                  return;
+          }
+
+      theInfo.SetName(aFieldName);
+
+      if(theErr)
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetFieldInfo - MEDfieldInfo(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+                   EModeAcces theMode,
+                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
+      
+      TValueHolder<TString, char> aFieldName(anInfo.myName);
+      TValueHolder<ETypeChamp, med_field_type> aType(anInfo.myType);
+      TValueHolder<TString, char> aCompNames(anInfo.myCompNames);
+      TValueHolder<TString, char> anUnitNames(anInfo.myUnitNames);
+      MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
+      TErr aRet;
+      char dtunit[MED_SNAME_SIZE+1];
+      std::fill(dtunit,dtunit+MED_SNAME_SIZE+1,'\0');
+      aRet = MEDfieldCr(myFile->Id(),
+                        &aFieldName,
+                        aType,
+                        anInfo.myNbComp,
+                        &aCompNames,
+                        &anUnitNames,
+                        dtunit,
+                        &aMeshInfo.myName[0]);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetFieldInfo - MEDfieldCr(...)");
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+                   TErr* theErr)
+    {
+      TErr aRet;
+      SetFieldInfo(theInfo,eLECTURE_ECRITURE,&aRet);
+      
+      if(aRet < 0)
+        SetFieldInfo(theInfo,eLECTURE_AJOUT,&aRet);
+
+      if(theErr) 
+        *theErr = aRet;
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbGauss(TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      return MEDnLocalization(myFile->Id());
+    }
+
+
+    //----------------------------------------------------------------------------
+    TGaussInfo::TInfo
+    TVWrapper
+    ::GetGaussPreInfo(TInt theId, 
+                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return TGaussInfo::TInfo( TGaussInfo::TKey(ePOINT1,""),0 );
+      
+      med_int aNbGaussPoints = med_int();
+      TVector<char> aName(GetNOMLength<eV2_2>()+1);
+      med_geometry_type aGeom = MED_NONE;
+
+      TErr aRet;
+      med_int dim;
+      char geointerpname[MED_NAME_SIZE+1]="";
+      char ipointstructmeshname[MED_NAME_SIZE+1]="";
+      med_int nsectionmeshcell;
+      med_geometry_type sectiongeotype;
+      aRet = MEDlocalizationInfo (myFile->Id(),
+                                  theId,
+                                  &aName[0],
+                                  &aGeom,
+                                  &dim,
+                                  &aNbGaussPoints,
+                                  geointerpname,
+                                  ipointstructmeshname,
+                                  &nsectionmeshcell,
+                                  &sectiongeotype);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetGaussPreInfo - MEDlocalizationInfo(...)");
+      return TGaussInfo::TInfo(TGaussInfo::TKey(EGeometrieElement(aGeom),&aName[0]),
+                               TInt(aNbGaussPoints));
+    }
+
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetGaussInfo(TInt theId, 
+                   TGaussInfo& theInfo,
+                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TValueHolder<TNodeCoord, med_float> aRefCoord(theInfo.myRefCoord);
+      TValueHolder<TNodeCoord, med_float> aGaussCoord(theInfo.myGaussCoord);
+      TValueHolder<TWeight, med_float> aWeight(theInfo.myWeight);
+      TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
+      TValueHolder<TString, char> aGaussName(theInfo.myName);
+
+      TErr aRet;
+      aRet = MEDlocalizationRd(myFile->Id(),
+                               &aGaussName,
+                               aModeSwitch,
+                               &aRefCoord,
+                               &aGaussCoord,
+                               &aWeight);
+
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetGaussInfo - MEDlocalizationRd(...)");
+    }
+
+
+    //----------------------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbProfiles(TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return -1;
+      
+      return MEDnProfile(myFile->Id());
+    }
+
+    TProfileInfo::TInfo
+    TVWrapper
+    ::GetProfilePreInfo(TInt theId, 
+                        TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        return TProfileInfo::TInfo();
+      
+      med_int aSize = -1;
+      TVector<char> aName(GetNOMLength<eV2_2>()+1);
+
+      TErr aRet;
+      aRet = MEDprofileInfo(myFile->Id(),
+                            theId,
+                            &aName[0],
+                            &aSize);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetProfilePreInfo - MEDprofileInfo(...)");
+      
+      return TProfileInfo::TInfo(&aName[0],aSize);
+    }
+
+    void
+    TVWrapper
+    ::GetProfileInfo(TInt theId, 
+                     TProfileInfo& theInfo,
+                     TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TProfileInfo& anInfo = const_cast<TProfileInfo&>(theInfo);
+      TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+      TValueHolder<TString, char>     aProfileName(anInfo.myName);
+
+      TErr aRet;
+      aRet = MEDprofileRd(myFile->Id(),
+                          &aProfileName,
+                          &anElemNum);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetProfileInfo - MEDprofileRd(...)");
+    }
+
+    void
+    TVWrapper
+    ::SetProfileInfo(const TProfileInfo& theInfo,
+                     EModeAcces          theMode,
+                     TErr*               theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TProfileInfo& anInfo = const_cast<TProfileInfo&>(theInfo);
+      TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+      TValueHolder<TString, char>     aProfileName(anInfo.myName);
+
+      TErr aRet;
+      aRet = MEDprofileWr(myFile->Id(),      // descripteur du fichier.
+                          &aProfileName,        // tableau de valeurs du profil.
+                          theInfo.GetSize(), // taille du profil.
+                          &anElemNum);    // nom profil.
+      if(theErr)
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetProfileInfo - MEDprofileWr(...)");
+    }
+
+    void
+    TVWrapper
+    ::SetProfileInfo(const TProfileInfo& theInfo,
+                     TErr*               theErr)
+    {
+      TErr aRet;
+      SetProfileInfo(theInfo,eLECTURE_ECRITURE,&aRet);
+      
+      if(aRet < 0)
+        SetProfileInfo(theInfo,eLECTURE_AJOUT,&aRet);
+
+      if(aRet < 0)
+        SetProfileInfo(theInfo,eCREATION,&aRet);
+
+      if(theErr)
+        *theErr = aRet;
+    }
+
+    //-----------------------------------------------------------------
+    TInt
+    TVWrapper
+    ::GetNbTimeStamps(const MED::TFieldInfo& theInfo, 
+                      const MED::TEntityInfo& theEntityInfo,
+                      EEntiteMaillage& theEntity,
+                      TGeom2Size& theGeom2Size,
+                      TErr* theErr)
+    {
+      theEntity = EEntiteMaillage(-1);
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr){
+        if(theEntityInfo.empty())
+          *theErr = -1;
+        if(*theErr < 0)
+          return -1;
+      }else if(theEntityInfo.empty()) 
+        EXCEPTION(std::runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
+      
+      bool anIsPerformAdditionalCheck = GetNbMeshes() > 1;
+
+      theGeom2Size.clear();
+      TInt aNbTimeStamps = 0;
+      TIdt anId = myFile->Id();
+
+      MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
+      TValueHolder<TString, char> aFieldName(anInfo.myName);
+      MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
+
+      // workaround for IPAL13676
+      MED::TEntityInfo localEntityInfo = theEntityInfo;
+      TEntityInfo::iterator anLocalIter = localEntityInfo.find(eMAILLE);
+      if(anLocalIter != localEntityInfo.end()){
+        localEntityInfo[eNOEUD_ELEMENT] = anLocalIter->second;
+      }
+        
+      TEntityInfo::const_iterator anIter = localEntityInfo.begin();
+      for(; anIter != localEntityInfo.end(); anIter++){
+        med_entity_type anEntity = med_entity_type(anIter->first);
+        const TGeom2Size& aGeom2Size = anIter->second;
+        TGeom2Size::const_iterator anGeomIter = aGeom2Size.begin();
+        for(; anGeomIter != aGeom2Size.end(); anGeomIter++){
+          med_geometry_type aGeom = med_geometry_type(anGeomIter->first);
+          char aMeshName[MED_NAME_SIZE+1];
+          med_bool islocal;
+          med_field_type ft;
+          char dtunit[MED_SNAME_SIZE+1];
+          med_int myNbComp = MEDfieldnComponentByName(anId,&aFieldName);
+          char *cname=new char[myNbComp*MED_SNAME_SIZE+1];
+          char *unitname=new char[myNbComp*MED_SNAME_SIZE+1];
+          TInt aNbStamps;
+          MEDfieldInfoByName(anId,
+                             &aFieldName,
+                             aMeshName,
+                             &islocal,
+                             &ft,
+                             cname,
+                             unitname,
+                             dtunit,
+                             &aNbStamps);
+          delete [] cname;
+          delete [] unitname;
+          med_int nval = 0;
+          med_int aNumDt;
+          med_int aNumOrd;
+          med_float aDt;
+          if (aNbStamps > 0)
+            {
+              MEDfieldComputingStepInfo(anId,
+                                        &aFieldName,
+                                        1,
+                                        &aNumDt,
+                                        &aNumOrd,
+                                        &aDt);
+              char profilename[MED_NAME_SIZE+1];
+              char locname[MED_NAME_SIZE+1];
+              med_int profilsize;
+              med_int aNbGauss;
+
+              // protection from crash (division by zero)
+              // inside MEDfieldnValueWithProfile function
+              // caused by the workaround for IPAL13676 (see above)
+              if( anEntity == MED_NODE_ELEMENT && aGeom % 100 == 0 )
+                continue;
+
+              nval = MEDfieldnValueWithProfile(anId,
+                                               &aFieldName,
+                                               aNumDt,
+                                               aNumOrd,
+                                               anEntity,
+                                               med_geometry_type(aGeom),
+                                               1,
+                                               MED_COMPACT_STMODE,
+                                               profilename,
+                                               &profilsize,
+                                               locname,
+                                               &aNbGauss);
+            }
+          bool anIsSatisfied =(nval > 0);
+          if(anIsSatisfied){
+            INITMSG(MYDEBUG,
+                    "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
+                    "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
+            if(anIsPerformAdditionalCheck){
+              anIsSatisfied = !strcmp(&aMeshName[0],&aMeshInfo.myName[0]);
+              if(!anIsSatisfied){
+                INITMSG(MYDEBUG,
+                        "GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
+                        "; aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<"'\n");
+              }
+            }
+          }
+          if(anIsSatisfied){
+            theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
+            theEntity = EEntiteMaillage(anEntity);
+            aNbTimeStamps = aNbStamps;
+          }
+        }
+        if(!theGeom2Size.empty()) 
+          break;
+      }
+      return aNbTimeStamps;
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetTimeStampInfo(TInt theTimeStampId, 
+                       MED::TTimeStampInfo& theInfo,
+                       TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
+      
+      if(theErr){
+        if(aGeom2Size.empty())
+          *theErr = -1;
+        if(*theErr < 0)
+          return;
+      }else if(aGeom2Size.empty())
+        EXCEPTION(std::runtime_error,"GetTimeStampInfo - There is no any cell");
+      
+      MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
+      MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
+      
+      TValueHolder<TString, char> aFieldName(aFieldInfo.myName);
+      TValueHolder<EEntiteMaillage, med_entity_type> anEntity(theInfo.myEntity);
+      TValueHolder<TInt, med_int> aNumDt(theInfo.myNumDt);
+      TValueHolder<TInt, med_int> aNumOrd(theInfo.myNumOrd);
+      TValueHolder<TString, char> anUnitDt(theInfo.myUnitDt);
+      TValueHolder<TFloat, med_float> aDt(theInfo.myDt);
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<EBooleen, med_bool> anIsLocal(aFieldInfo.myIsLocal);
+      TValueHolder<TInt, med_int> aNbRef(aFieldInfo.myNbRef);
+
+      TGeom2NbGauss& aGeom2NbGauss = theInfo.myGeom2NbGauss;
+
+      // just to get a time stamp unit (anUnitDt)
+      med_field_type aFieldType;
+      med_int aNbComp = MEDfieldnComponentByName(myFile->Id(), &aFieldName);
+      char *aCompName = new char[aNbComp*MED_SNAME_SIZE+1];
+      char *aCompUnit = new char[aNbComp*MED_SNAME_SIZE+1];
+      TInt aNbStamps;
+      MEDfieldInfoByName(myFile->Id(),
+                         &aFieldName,
+                         &aMeshName,
+                         &anIsLocal,
+                         &aFieldType,
+                         aCompName,
+                         aCompUnit,
+                         &anUnitDt,
+                         &aNbStamps);
+      delete [] aCompName;
+      delete [] aCompUnit;
+
+      TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+      for(; anIter != aGeom2Size.end(); anIter++){
+        const EGeometrieElement& aGeom = anIter->first;
+        med_int aNbGauss = -1;
+
+        TErr aRet;
+        aRet = MEDfieldComputingStepInfo(myFile->Id(),
+                                         &aFieldName,
+                                         theTimeStampId,
+                                         &aNumDt,  
+                                         &aNumOrd,
+                                         &aDt);
+        char profilename[MED_NAME_SIZE+1];
+        med_int profilsize;
+        char locname[MED_NAME_SIZE+1];
+        MEDfieldnValueWithProfile(myFile->Id(),
+                                  &aFieldName,
+                                  aNumDt,
+                                  aNumOrd,
+                                  anEntity,
+                                  med_geometry_type(aGeom),
+                                  1,
+                                  MED_COMPACT_STMODE,
+                                  profilename,
+                                  &profilsize,
+                                  locname,
+                                  &aNbGauss);
+
+        static TInt MAX_NB_GAUSS_POINTS = 32;
+        if(aNbGauss <= 0 || aNbGauss > MAX_NB_GAUSS_POINTS)
+          aNbGauss = 1;
+
+        aGeom2NbGauss[aGeom] = aNbGauss;
+
+        if(theErr) 
+          *theErr = aRet;
+        else if(aRet < 0)
+          EXCEPTION(std::runtime_error,"GetTimeStampInfo - MEDfieldnValueWithProfile(...)");
+      }      
+    }
+    
+
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                        const TMKey2Profile& theMKey2Profile,
+                        const TKey2Gauss& theKey2Gauss,
+                        TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TIdt anId = myFile->Id();
+      
+      TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theTimeStampValue->myModeSwitch);
+      MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->myGeom2Profile;
+
+      MED::PTimeStampInfo aTimeStampInfo = theTimeStampValue->myTimeStampInfo;
+      TValueHolder<EEntiteMaillage, med_entity_type> anEntity(aTimeStampInfo->myEntity);
+      TValueHolder<TInt, med_int> aNumDt(aTimeStampInfo->myNumDt);
+      TValueHolder<TInt, med_int> aNumOrd(aTimeStampInfo->myNumOrd);
+
+      MED::PFieldInfo aFieldInfo = aTimeStampInfo->myFieldInfo;
+      TValueHolder<TString, char> aFieldName(aFieldInfo->myName);
+      TValueHolder<EBooleen, med_bool> anIsLocal(aFieldInfo->myIsLocal);
+
+      MED::PMeshInfo aMeshInfo = aFieldInfo->myMeshInfo;
+      TValueHolder<TString, char> aMeshName(aMeshInfo->myName);
+      
+      TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->myGeom2Gauss;
+      TVector<char> aGaussName(GetNOMLength<eV2_2>()+1);
+
+      med_storage_mode aProfileMode = med_storage_mode(boost::get<0>(theMKey2Profile));
+      MED::TKey2Profile aKey2Profile = boost::get<1>(theMKey2Profile);
+      TVector<char> aProfileName(GetNOMLength<eV2_2>()+1);
+
+      TGeom2Size& aGeom2Size = aTimeStampInfo->myGeom2Size;
+      TGeom2Size::iterator anIter = aGeom2Size.begin();
+      for(; anIter != aGeom2Size.end(); anIter++){
+        EGeometrieElement aGeom = anIter->first;
+        TInt aNbElem = anIter->second;
+        med_int profilesize,aNbGauss;
+
+        TInt aNbVal = MEDfieldnValueWithProfile(anId,
+                                                &aFieldName,
+                                                aNumDt,
+                                                aNumOrd,
+                                                anEntity,
+                                                med_geometry_type(aGeom),
+                                                1,
+                                                aProfileMode,
+                                                &aProfileName[0],
+                                                &profilesize,
+                                                &aGaussName[0],
+                                                &aNbGauss);
+
+        if(aNbVal <= 0){
+          if(theErr){
+            *theErr = -1;
+            return;
+          }
+          EXCEPTION(std::runtime_error,"GetTimeStampValue - MEDfieldnValueWithProfile(...) - aNbVal == "<<aNbVal<<" <= 0");
+        }
+        
+        TInt aNbComp = aFieldInfo->myNbComp;
+        TInt aNbValue = aNbVal;// / aNbGauss; rules in MED changed
+        theTimeStampValue->AllocateValue(aGeom,
+                                         aNbValue,
+                                         aNbGauss,
+                                         aNbComp);
+        TInt aValueSize = theTimeStampValue->GetValueSize(aGeom);
+
+        INITMSG(MYDEBUG,
+                "TVWrapper::GetTimeStampValue - aGeom = "<<aGeom<<
+                "; aNbVal = "<<aNbVal<<
+                "; aNbValue = "<<aNbValue<<
+                "; aNbGauss = "<<aNbGauss<<
+                "; aNbComp = "<<aNbComp<<
+                std::endl);
+        
+        TErr aRet = MEDfieldValueWithProfileRd(anId,
+                                               &aFieldName,
+                                               aNumDt,
+                                               aNumOrd,
+                                               anEntity,
+                                               med_geometry_type(aGeom),
+                                               aProfileMode,
+                                               &aProfileName[0],
+                                               aModeSwitch,
+                                               MED_ALL_CONSTITUENT,
+                                               theTimeStampValue->GetValuePtr(aGeom));
+        if(aRet < 0){
+          if(theErr){
+            *theErr = MED_FALSE;
+            return;
+          }
+          EXCEPTION(std::runtime_error,"GetTimeStampValue - MEDfieldValueWithProfileRd(...)");
+        }
+
+        MED::PGaussInfo aGaussInfo;
+        TGaussInfo::TKey aKey(aGeom,&aGaussName[0]);
+        if(strcmp(&aGaussName[0],"") != 0){
+          MED::TKey2Gauss::const_iterator anIter = theKey2Gauss.find(aKey);
+          if(anIter != theKey2Gauss.end()){
+            aGaussInfo = anIter->second;
+            aGeom2Gauss[aGeom] = aGaussInfo;
+          }
+        }
+        
+        MED::PProfileInfo aProfileInfo;
+        if(strcmp(&aProfileName[0],MED_NO_PROFILE) != 0){
+          MED::TKey2Profile::const_iterator anIter = aKey2Profile.find(&aProfileName[0]);
+          if(anIter != aKey2Profile.end()){
+            aProfileInfo = anIter->second;
+            aGeom2Profile[aGeom] = aProfileInfo;
+          }
+        }
+
+        if(aGaussInfo && aNbGauss != aGaussInfo->GetNbGauss()){
+          if(theErr){
+            *theErr = MED_FALSE;
+            return;
+          }
+          EXCEPTION(std::runtime_error,"GetTimeStampValue - aNbGauss != aGaussInfo->GetNbGauss()");
+        }
+        
+        if(aProfileInfo && aProfileInfo->IsPresent()){
+          TInt aNbSubElem = aProfileInfo->GetSize();
+          TInt aProfileSize = aNbSubElem*aNbComp*aNbGauss;
+          if(aProfileSize != aValueSize){
+            if(theErr){
+              *theErr = -1;
+              return;
+            }
+            EXCEPTION(std::runtime_error,
+                      "GetTimeStampValue - aProfileSize("<<aProfileSize<<
+                      ") != aValueSize("<<aValueSize<<
+                      "); aNbVal = "<<aNbVal<<
+                      "; anEntity = "<<anEntity<<
+                      "; aGeom = "<<aGeom<<
+                      "; aNbElem = "<<aNbElem<<
+                      "; aNbSubElem = "<<aNbSubElem<<
+                      "; aNbComp = "<<aNbComp<<
+                      "; aNbGauss = "<<aNbGauss<<
+                      "");
+          }
+        }else{
+          if((aProfileMode == MED_GLOBAL_STMODE) && (aNbElem != aNbValue)){
+            if(theErr){
+              *theErr = -1;
+              return;
+            }
+            EXCEPTION(std::runtime_error,
+                      "GetTimeStampValue - aNbElem("<<aNbElem<<
+                      ") != aNbValue("<<aNbValue<<
+                      "); aNbVal = "<<aNbVal<<
+                      "; anEntity = "<<anEntity<<
+                      "; aGeom = "<<aGeom<<
+                      "; aNbElem = "<<aNbElem<<
+                      "; aNbComp = "<<aNbComp<<
+                      "; aNbGauss = "<<aNbGauss<<
+                      "");
+          }
+        }
+      }
+    }
+    
+    
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::SetTimeStampValue(const MED::PTimeStampValueBase& theTimeStampValue,
+                        EModeAcces theMode,
+                        TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+        return;
+      
+      TErr aRet;
+      TIdt anId = myFile->Id();
+      
+      TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theTimeStampValue->myModeSwitch);
+      MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->myGeom2Profile;
+
+      MED::PTimeStampInfo aTimeStampInfo = theTimeStampValue->myTimeStampInfo;
+      TValueHolder<EEntiteMaillage, med_entity_type> anEntity(aTimeStampInfo->myEntity);
+      TValueHolder<TInt, med_int> aNumDt(aTimeStampInfo->myNumDt);
+      TValueHolder<TInt, med_int> aNumOrd(aTimeStampInfo->myNumOrd);
+      TValueHolder<TString, char> anUnitDt(aTimeStampInfo->myUnitDt);
+      TValueHolder<TFloat, med_float> aDt(aTimeStampInfo->myDt);
+      MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->myGeom2Gauss;
+
+      MED::PFieldInfo aFieldInfo = aTimeStampInfo->myFieldInfo;
+      TValueHolder<TString, char> aFieldName(aFieldInfo->myName);
+
+      MED::PMeshInfo aMeshInfo = aFieldInfo->myMeshInfo;
+      TValueHolder<TString, char> aMeshName(aMeshInfo->myName);
+      
+      const TGeomSet& aGeomSet = theTimeStampValue->myGeomSet;
+      TGeomSet::const_iterator anIter = aGeomSet.begin();
+      for(; anIter != aGeomSet.end(); anIter++){
+        EGeometrieElement aGeom = *anIter;
+
+        TVector<char> aGaussName(GetNOMLength<eV2_2>()+1);
+        MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aGeom);
+        if(aGaussIter != aGeom2Gauss.end()){
+          MED::PGaussInfo aGaussInfo = aGaussIter->second;
+          strcpy(&aGaussName[0],&aGaussInfo->myName[0]);
+        }
+
+        TVector<char> aProfileName(GetNOMLength<eV2_2>()+1);
+        med_storage_mode aProfileMode = med_storage_mode(eNO_PFLMOD);
+        MED::TGeom2Profile::const_iterator aProfileIter = aGeom2Profile.find(aGeom);
+        if(aProfileIter != aGeom2Profile.end()){
+          MED::PProfileInfo aProfileInfo = aProfileIter->second;
+          aProfileMode = med_storage_mode(aProfileInfo->myMode);
+          strcpy(&aProfileName[0],&aProfileInfo->myName[0]);
+        }
+
+        med_int aNbVal = theTimeStampValue->GetNbVal(aGeom);
+
+        aRet = MEDfieldValueWithProfileWr(anId,
+                                          &aFieldName,
+                                          aNumDt,
+                                          aNumOrd,
+                                          aDt,
+                                          anEntity,
+                                          med_geometry_type(aGeom),
+                                          aProfileMode,
+                                          &aProfileName[0],
+                                          &aGaussName[0],
+                                          aModeSwitch,
+                                          MED_ALL_CONSTITUENT,
+                                          aNbVal,
+                                          theTimeStampValue->GetValuePtr(aGeom));
+        if(aRet < 0){
+          if(theErr){
+            *theErr = MED_FALSE;
+            break;
+          }
+          EXCEPTION(std::runtime_error,"SetTimeStampValue - MEDfieldValueWithProfileWr(...)");
+        }
+        
+      }
+      
+      INITMSG(MYDEBUG,"TVWrapper::SetTimeStampValue - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+    }
+
+    
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                        TErr* theErr)
+    {
+      TErr aRet;
+      SetTimeStampValue(theTimeStampValue,eLECTURE_ECRITURE,&aRet);
+      
+      if(aRet < 0)
+        SetTimeStampValue(theTimeStampValue,eLECTURE_AJOUT,&aRet);
+
+      if(theErr) 
+        *theErr = aRet;
+    }
+    
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetGrilleInfo(const MED::TGrilleInfo& theInfo,
+                    TErr* theErr)
+    {
+      SetGrilleInfo(theInfo,eLECTURE_ECRITURE,theErr);
+    }
+
+    //----------------------------------------------------------------------------
+    void 
+    TVWrapper
+    ::SetGrilleInfo(const MED::TGrilleInfo& theInfo,
+                    EModeAcces theMode,
+                    TErr* theErr)
+    {
+      if(theInfo.myMeshInfo->myType != eSTRUCTURE)
+        return;
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && *theErr < 0)
+          return;
+
+      MED::TGrilleInfo& anInfo = const_cast<MED::TGrilleInfo&>(theInfo);
+
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+
+      TValueHolder<EGrilleType, med_grid_type > aGrilleType(anInfo.myGrilleType);
+
+      TErr aRet = 0;
+      aRet = MEDmeshGridTypeRd(myFile->Id(),
+                               &aMeshName,
+                               &aGrilleType);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshGridTypeRd(...)");
+      
+      if(anInfo.myGrilleType == eGRILLE_STANDARD){
+        TValueHolder<TNodeCoord, med_float> aCoord(anInfo.myCoord);
+        TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(anInfo.myModeSwitch);
+        TValueHolder<TString, char> aCoordNames(anInfo.myCoordNames);
+        TValueHolder<TString, char> aCoordUnits(anInfo.myCoordUnits);
+        med_int aNbNoeuds = med_int(anInfo.myCoord.size() / aMeshInfo.myDim);
+        //med_axis_type aRepere = MED_CARTESIAN;
+
+        aRet = MEDmeshNodeCoordinateWr(myFile->Id(),
+                                       &aMeshName,
+                                       MED_NO_DT,
+                                       MED_NO_IT,
+                                       MED_UNDEF_DT,
+                                       aModeSwitch,
+                                       aNbNoeuds,
+                                       &aCoord);
+
+        if(aRet < 0)
+          EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshNodeCoordinateWr(...)");
+
+        TValueHolder<TIntVector, med_int> aGrilleStructure(anInfo.myGrilleStructure);
+        aRet = MEDmeshGridStructWr(myFile->Id(),
+                                    &aMeshName,
+                                   MED_NO_DT,
+                                   MED_NO_IT,
+                                   MED_UNDEF_DT,
+                                   &aGrilleStructure);
+        if(aRet < 0)
+          EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshGridStructWr(...)");
+        
+      } else {
+        for(med_int aAxis = 0; aAxis < aMeshInfo.myDim; aAxis++){
+          aRet = MEDmeshGridIndexCoordinateWr(myFile->Id(),
+                                              &aMeshName,
+                                              MED_NO_DT,
+                                              MED_NO_IT,
+                                              MED_UNDEF_DT,
+                                              aAxis+1,
+                                              anInfo.GetIndexes(aAxis).size(),
+                                              &anInfo.GetIndexes(aAxis)[0]);
+
+          if(aRet < 0)
+            EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshGridIndexCoordinateWr(...)");
+        }
+        
+      }
+
+      return;
+    }
+
+    //----------------------------------------------------------------------------
+    void
+    TVWrapper
+    ::GetGrilleInfo(TGrilleInfo& theInfo,
+                    TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+          return;
+      
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      EMaillage aMaillageType = aMeshInfo.myType;
+      
+      GetGrilleType(aMeshInfo, theInfo.myGrilleType, theErr);
+      EGrilleType aGrilleType = theInfo.myGrilleType;
+
+      TErr aRet = 0;
+      if(aMaillageType == eSTRUCTURE && aGrilleType == eGRILLE_STANDARD) {
+        GetGrilleStruct(aMeshInfo, theInfo.myGrilleStructure, theErr);
+
+        TValueHolder<TNodeCoord, med_float> aCoord(theInfo.myCoord);
+        TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
+        TValueHolder<TString, char> aCoordNames(theInfo.myCoordNames);
+        TValueHolder<TString, char> aCoordUnits(theInfo.myCoordUnits);
+        //med_axis_type aRepere;
+
+        aRet = MEDmeshNodeCoordinateRd(myFile->Id(),
+                                       &aMeshName,
+                                       MED_NO_DT,
+                                       MED_NO_IT,
+                                       aModeSwitch,
+                                       &aCoord);
+
+        if(theErr) 
+          *theErr = aRet;
+        else if(aRet < 0)
+          EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshNodeCoordinateRd(...)");
+
+        //TInt aNbNodes = theInfo.GetNbNodes();//GetNbFamilies(aMeshInfo);
+        TValueHolder<TElemNum, med_int> aFamNumNode(theInfo.myFamNumNode);
+        
+        aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+                                           &aMeshName,
+                                           MED_NO_DT,
+                                           MED_NO_IT,
+                                           MED_NODE,
+                                           MED_NO_GEOTYPE,
+                                           &aFamNumNode);
+
+        if(aRet < 0)
+        {
+//            if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+              {
+                int mySize = (int)theInfo.myFamNumNode.size();
+                theInfo.myFamNumNode.clear();
+                theInfo.myFamNumNode.resize(mySize,0);
+                aRet = 0;
+              }
+//            else
+//              EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...)");
+        }
+        if(theErr) 
+          *theErr = aRet;
+
+        //============================
+      }
+
+      if(aMaillageType == eSTRUCTURE && aGrilleType != eGRILLE_STANDARD){
+        ETable aTable;
+        for(med_int anAxis = 1; anAxis <= aMeshInfo.myDim; anAxis++){
+          switch(anAxis){
+          case 1 :
+            aTable = eCOOR_IND1;
+            break;
+          case 2 :
+            aTable = eCOOR_IND2;
+            break;
+          case 3 :
+            aTable = eCOOR_IND3;
+            break;
+          default :
+            aRet = -1;
+          }
+            
+          if(theErr) 
+            *theErr = aRet;
+          else if(aRet < 0)
+            EXCEPTION(std::runtime_error,"GetGrilleInfo - anAxis number out of range(...)");
+          
+          TInt aNbIndexes = GetNbNodes(aMeshInfo,aTable);
+          if(aNbIndexes < 0)
+            EXCEPTION(std::runtime_error,"GetGrilleInfo - Erreur a la lecture de la taille de l'indice");
+            
+          TValueHolder<TFloatVector, med_float> anIndexes(theInfo.GetIndexes(anAxis-1));
+          //TValueHolder<ETable, med_data_type > table(aTable);
+          //char aCompNames[MED_SNAME_SIZE+1];
+          //char anUnitNames[MED_SNAME_SIZE+1];
+          aRet=MEDmeshGridIndexCoordinateRd(myFile->Id(),&aMeshName,
+                                            MED_NO_DT,MED_NO_IT,
+                                            anAxis,
+                                            &anIndexes);
+
+          //theInfo.SetCoordName(anAxis-1, aCompNames);
+          //theInfo.SetCoordUnit(anAxis-1, anUnitNames);
+          theInfo.SetGrilleStructure(anAxis-1, aNbIndexes);
+
+          if(theErr) 
+            *theErr = aRet;
+          else if(aRet < 0)
+            EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDindicesCoordLire(...)");
+        }
+      }
+
+      EGeometrieElement aGeom = theInfo.GetGeom();
+      EEntiteMaillage aEntity = theInfo.GetEntity();
+      TInt aNbCells = theInfo.GetNbCells();
+      
+      theInfo.myFamNum.resize(aNbCells);
+      TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamNum);
+      
+      aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+                                         &aMeshName,MED_NO_DT,MED_NO_IT,med_entity_type(aEntity),
+                                         med_geometry_type(aGeom),&aFamNum);
+
+      if ( aMeshInfo.myDim == 3 )
+      {
+        aGeom = theInfo.GetSubGeom();
+        aEntity = theInfo.GetSubEntity();
+        aNbCells = theInfo.GetNbSubCells();
+      
+        theInfo.myFamSubNum.resize(aNbCells,0);
+        TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamSubNum);
+      
+        aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+                                    &aMeshName,MED_NO_DT,MED_NO_IT,
+                                    med_entity_type(aEntity),
+                                    med_geometry_type(aGeom),&aFamNum);
+      }
+      if(aRet < 0)
+      {
+//          if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+            {
+              int mySize = (int)theInfo.myFamNumNode.size();
+              theInfo.myFamNumNode.clear();
+              theInfo.myFamNumNode.resize(mySize,0);
+              aRet = 0;
+            }
+//          else
+//            EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...)");
+      }
+      if(theErr) 
+        *theErr = aRet;
+    }
+
+    void
+    TVWrapper
+    ::GetGrilleType(const MED::TMeshInfo& theMeshInfo,
+                    EGrilleType& theGridType,
+                    TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && *theErr < 0)
+        EXCEPTION(std::runtime_error," GetGrilleType - aFileWrapper (...)");
+
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      
+      if(aMeshInfo.myType == eSTRUCTURE){
+        TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+        TValueHolder<EGrilleType, med_grid_type> aGridType(theGridType);
+        TErr aRet = MEDmeshGridTypeRd(myFile->Id(),
+                                      &aMeshName,
+                                      &aGridType);
+
+        if(aRet < 0)
+          EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridTypeRd(...)");
+      }
+    }    
+    
+    void
+    TVWrapper
+    ::GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
+                      TIntVector& theStruct,
+                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+      
+      if(theErr && *theErr < 0)
+          return;
+      
+      TErr aRet;
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+      TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+      TValueHolder<TIntVector, med_int> aGridStructure(theStruct);
+        
+      aRet = MEDmeshGridStructRd(myFile->Id(),
+                                 &aMeshName,
+                                 MED_NO_DT,
+                                 MED_NO_IT,
+                                 &aGridStructure);
+      if(theErr) 
+        *theErr = aRet;
+      else if(aRet < 0)
+        EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridStructRd(...)");
+    }
+
+  }  
+}
diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx
new file mode 100644 (file)
index 0000000..9d5a74c
--- /dev/null
@@ -0,0 +1,490 @@
+// Copyright (C) 2007-2013  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
+//
+//
+#ifndef MED_V2_2_Wrapper_HeaderFile
+#define MED_V2_2_Wrapper_HeaderFile
+
+#ifdef WIN32
+ #if defined MEDWRAPPER_V2_2_EXPORTS || defined MEDWrapper_V2_2_EXPORTS
+  #if defined WIN32
+   #define MED_V22_WRAPPER_EXPORT __declspec( dllexport )
+  #else
+   #define MED_V22_WRAPPER_EXPORT
+  #endif
+ #else
+  #if defined WIN32
+   #define MED_V22_WRAPPER_EXPORT __declspec( dllimport )
+  #else
+   #define MED_V22_WRAPPER_EXPORT
+  #endif
+ #endif
+#else
+ #define MED_V22_WRAPPER_EXPORT
+#endif
+
+#include "MED_Structures.hxx"
+#include "MED_TWrapper.hxx"
+
+namespace MED
+{
+  template<>
+  TInt MED_V22_WRAPPER_EXPORT
+  GetDESCLength<eV2_2>();
+  
+  template<>
+  TInt MED_V22_WRAPPER_EXPORT
+  GetIDENTLength<eV2_2>();
+  
+  template<>
+  TInt MED_V22_WRAPPER_EXPORT
+  GetNOMLength<eV2_2>();
+  
+  template<>
+  TInt MED_V22_WRAPPER_EXPORT
+  GetLNOMLength<eV2_2>();
+  
+  template<>
+  TInt MED_V22_WRAPPER_EXPORT
+  GetPNOMLength<eV2_2>();
+
+  template<>
+  void MED_V22_WRAPPER_EXPORT
+  GetVersionRelease<eV2_2>(TInt& majeur, TInt& mineur, TInt& release);
+
+  template<>
+  TInt MED_V22_WRAPPER_EXPORT
+  GetNbConn<eV2_2>(EGeometrieElement typmai,
+                   EEntiteMaillage typent,
+                   TInt mdim);
+
+  namespace V2_2
+  {
+    //----------------------------------------------------------------------------
+    class TFile;
+    typedef boost::shared_ptr<TFile> PFile;
+    
+    typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces; 
+
+    //----------------------------------------------------------------------------
+    class MED_V22_WRAPPER_EXPORT TVWrapper: public MED::TTWrapper<eV2_2>
+    {
+      TVWrapper();
+      TVWrapper(const TVWrapper&);
+      TVWrapper& operator=(const TVWrapper&);
+      
+    public:
+      TVWrapper(const std::string& theFileName);
+
+      //----------------------------------------------------------------------------
+      virtual 
+      TInt
+      GetNbMeshes(TErr* theErr = NULL);
+      
+      virtual
+      void
+      GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
+                               TErr* theErr = NULL);
+
+      virtual
+      void
+      SetMeshInfo(const MED::TMeshInfo& theInfo,
+                  TErr* theErr = NULL);
+      
+      void SetMeshInfo(const MED::TMeshInfo& theInfo,
+                       EModeAcces theMode,
+                       TErr* theErr = NULL);
+      
+      
+      //----------------------------------------------------------------------------
+      virtual
+      TInt
+      GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
+                    TErr* theErr = NULL);
+
+      virtual 
+      TInt
+      GetNbFamAttr(TInt theFamId, 
+                   const MED::TMeshInfo& theInfo,
+                   TErr* theErr = NULL);
+      
+      virtual
+      TInt
+      GetNbFamGroup(TInt theFamId, 
+                    const MED::TMeshInfo& theInfo,
+                    TErr* theErr = NULL);
+      
+      virtual
+      void
+      GetFamilyInfo(TInt theFamId, 
+                    MED::TFamilyInfo& theInfo,
+                    TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+                    TErr* theErr = NULL);
+      
+      void 
+      SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+                    EModeAcces theMode,
+                    TErr* theErr = NULL);
+      
+      
+      //----------------------------------------------------------------------------
+      virtual
+      void
+      GetNames(TElemInfo& theInfo,
+               TInt nb,
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TErr* theErr = NULL);
+
+      virtual
+      void
+      GetNumeration(TElemInfo& theInfo,
+                    TInt nb,
+                    EEntiteMaillage theEntity, 
+                    EGeometrieElement theGeom,
+                    TErr* theErr = NULL);
+
+      virtual
+      void
+      GetFamilies(TElemInfo& theInfo,
+                  TInt nb,
+                  EEntiteMaillage theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr* theErr = NULL);
+
+      virtual
+      void
+      SetNames(const TElemInfo& theInfo,
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TErr* theErr = NULL);
+
+      void
+      SetNames(const TElemInfo& theInfo,
+               EModeAcces theMode,
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetNumeration(const TElemInfo& theInfo,
+                    EEntiteMaillage theEntity, 
+                    EGeometrieElement theGeom,
+                    TErr* theErr = NULL);
+      void
+      SetNumeration(const TElemInfo& theInfo,
+                    EModeAcces theMode,
+                    EEntiteMaillage theEntity, 
+                    EGeometrieElement theGeom,
+                    TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetFamilies(const TElemInfo& theInfo,
+                  EEntiteMaillage theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr* theErr = NULL);
+      void
+      SetFamilies(const TElemInfo& theInfo,
+                  EModeAcces theMode,
+                  EEntiteMaillage theEntity, 
+                  EGeometrieElement theGeom,
+                  TErr* theErr = NULL);
+
+      //----------------------------------------------------------------------------
+      virtual
+      TInt
+      GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+                 TErr* theErr = NULL)
+      {
+        return GetNbNodes(theMeshInfo,eCOOR,theErr);
+      }
+
+      TInt
+      GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+                 ETable theTable,
+                 TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetNodeInfo(MED::TNodeInfo& theInfo,
+                  TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetNodeInfo(const MED::TNodeInfo& theInfo,
+                  TErr* theErr = NULL);
+      
+      void
+      SetNodeInfo(const MED::TNodeInfo& theInfo,
+                  EModeAcces theMode,
+                  TErr* theErr = NULL);
+      
+      //----------------------------------------------------------------------------
+      virtual
+      void
+      GetPolygoneInfo(TPolygoneInfo& theInfo,
+                      TErr* theErr = NULL);
+
+      virtual 
+      void
+      SetPolygoneInfo(const TPolygoneInfo& theInfo,
+                                   TErr* theErr = NULL);
+      
+      void
+      SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+                      EModeAcces theMode,
+                      TErr* theErr = NULL);
+
+      virtual 
+      TInt
+      GetNbPolygones(const TMeshInfo& theMeshInfo,
+                   EEntiteMaillage theEntity,
+                   EGeometrieElement theGeom,
+                   EConnectivite theConnMode = eNOD,
+                   TErr* theErr = NULL);
+      
+      virtual 
+      TInt
+      GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
+                        EEntiteMaillage theEntity,
+                        EGeometrieElement theGeom,
+                        EConnectivite theConnMode = eNOD,
+                        TErr* theErr = NULL);
+
+      //----------------------------------------------------------------------------
+      virtual 
+      void
+      GetPolyedreInfo(TPolyedreInfo& theInfo,
+                      TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetPolyedreInfo(const TPolyedreInfo& theInfo,
+                      TErr* theErr = NULL);
+      
+      void
+      SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+                      EModeAcces theMode,
+                      TErr* theErr = NULL);
+      
+      virtual
+      TInt
+      GetNbPolyedres(const TMeshInfo& theMeshInfo,
+                     EEntiteMaillage,
+                     EGeometrieElement,
+                     EConnectivite,
+                     TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+                          TInt& theNbFaces,
+                          TInt& theConnSize,
+                          EConnectivite theConnMode = eNOD,
+                          TErr* theErr = NULL);
+      
+      //----------------------------------------------------------------------------
+      virtual
+      TEntityInfo
+      GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
+                    EConnectivite theConnMode = eNOD,
+                    TErr* theErr = NULL);
+      
+      virtual 
+      TInt
+      GetNbCells(const MED::TMeshInfo& theMeshInfo, 
+                 EEntiteMaillage, 
+                 EGeometrieElement, 
+                 EConnectivite theConnMode = eNOD,
+                 TErr* theErr = NULL);
+      
+      virtual
+      void
+      GetCellInfo(MED::TCellInfo& theInfo,
+                  TErr* theErr = NULL);
+
+      virtual 
+      void
+      SetCellInfo(const MED::TCellInfo& theInfo,
+                  TErr* theErr = NULL);
+      
+      void 
+      SetCellInfo(const MED::TCellInfo& theInfo,
+                  EModeAcces theMode,
+                  TErr* theErr = NULL);
+      
+      //----------------------------------------------------------------------------
+      //! Read geom type of MED_BALL structural element
+      EGeometrieElement GetBallGeom(const TMeshInfo& theMeshInfo);
+      
+      //! Read number of balls in the Mesh
+      virtual TInt GetNbBalls(const TMeshInfo& theMeshInfo);
+
+      //! Read a MEDWrapped representation of MED_BALL from the MED file
+      virtual void GetBallInfo(TBallInfo& theInfo, TErr* theErr = NULL);
+
+      //! Write a MEDWrapped representation of MED_BALL to the MED file
+      virtual void  SetBallInfo(const TBallInfo& theInfo, TErr* theErr);
+
+      //! Write a MEDWrapped representation of MED_BALL to the MED file
+      void  SetBallInfo(const TBallInfo& theInfo, EModeAcces theMode, TErr* theErr);
+
+      //----------------------------------------------------------------------------
+      virtual
+      TInt
+      GetNbFields(TErr* theErr = NULL);
+      
+      virtual
+      TInt
+      GetNbComp(TInt theFieldId,
+                TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetFieldInfo(TInt theFieldId, 
+                   MED::TFieldInfo& theInfo,
+                   TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetFieldInfo(const MED::TFieldInfo& theInfo,
+                   TErr* theErr = NULL);
+      
+      void
+      SetFieldInfo(const MED::TFieldInfo& theInfo,
+                   EModeAcces theMode,
+                   TErr* theErr = NULL);
+      
+      //----------------------------------------------------------------------------
+      virtual 
+      TInt
+      GetNbGauss(TErr* theErr = NULL);
+
+      virtual 
+      TGaussInfo::TInfo
+      GetGaussPreInfo(TInt theId, 
+                      TErr* theErr = NULL);
+
+      virtual 
+      void
+      GetGaussInfo(TInt theId, 
+                   TGaussInfo& theInfo,
+                   TErr* theErr = NULL);
+
+      //----------------------------------------------------------------------------
+      virtual 
+      TInt
+      GetNbProfiles(TErr* theErr = NULL);
+
+      virtual 
+      TProfileInfo::TInfo
+      GetProfilePreInfo(TInt theId, 
+                        TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetProfileInfo(TInt theId, 
+                     TProfileInfo& theInfo,
+                     TErr* theErr = NULL);
+
+      virtual
+      void
+      SetProfileInfo(const TProfileInfo& theInfo,
+                     TErr*               theErr = NULL);
+
+      void
+      SetProfileInfo(const TProfileInfo& theInfo,
+                     EModeAcces          theMode,
+                     TErr*               theErr = NULL);
+
+      //----------------------------------------------------------------------------
+      virtual 
+      TInt
+      GetNbTimeStamps(const MED::TFieldInfo& theInfo, 
+                      const MED::TEntityInfo& theEntityInfo,
+                      EEntiteMaillage& theEntity,
+                      TGeom2Size& theGeom2Size,
+                      TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetTimeStampInfo(TInt theTimeStampId, 
+                       MED::TTimeStampInfo& theInfo,
+                       TErr* theErr = NULL);
+      
+      virtual
+      void
+      GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                        const TMKey2Profile& theMKey2Profile,
+                        const TKey2Gauss& theKey2Gauss,
+                        TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                        TErr* theErr = NULL);
+      
+      void 
+      SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+                        EModeAcces theMode,
+                        TErr* theErr = NULL);
+      
+
+      //----------------------------------------------------------------------------
+      virtual
+      void
+      GetGrilleInfo(TGrilleInfo& theGrilleInfo,
+                    TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
+                    TErr* theErr = NULL);
+
+      void
+      SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
+                    EModeAcces theMode,
+                    TErr* theErr = NULL);
+
+      virtual
+      void
+      GetGrilleType(const MED::TMeshInfo& theMeshInfo,
+                    EGrilleType& type,
+                    TErr* theErr = NULL);
+
+      void
+      GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
+                      TIntVector& theStruct,
+                      TErr* theErr = NULL);
+
+    protected:
+      PFile myFile;
+    };
+  }
+}
+
+#endif
diff --git a/src/MEDWrapper/V2_2/Makefile.am b/src/MEDWrapper/V2_2/Makefile.am
new file mode 100644 (file)
index 0000000..d744452
--- /dev/null
@@ -0,0 +1,32 @@
+# Copyright (C) 2007-2013  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
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+lib_LTLIBRARIES= libMEDWrapper_V2_2.la
+
+salomeinclude_HEADERS = \
+       MED_V2_2_Wrapper.hxx
+
+dist_libMEDWrapper_V2_2_la_SOURCES = \
+       MED_V2_2_Wrapper.cxx
+
+libMEDWrapper_V2_2_la_CPPFLAGS= $(BOOST_CPPFLAGS) $(MED3_INCLUDES) $(HDF5_INCLUDES) -I$(srcdir)/../Base
+libMEDWrapper_V2_2_la_CPPFLAGS+= -I$(KERNEL_ROOT_DIR)/include/salome
+libMEDWrapper_V2_2_la_LDFLAGS= $(MED3_LIBS_C_ONLY) $(HDF5_LIBS)
+libMEDWrapper_V2_2_la_LIBADD= ../Base/libMEDWrapperBase.la
index 3f6ab8b3e63aaffac018cbadea5069d0f3ee4946..246391150ba7662654d46f803486d1619f0b7192 100644 (file)
@@ -34,6 +34,7 @@ SUBDIRS = \
        SMESHUtils \
        Controls \
        Driver \
+       MEDWrapper \
        DriverMED \
        DriverDAT \
        DriverUNV \
@@ -60,7 +61,7 @@ if SMESH_ENABLE_GUI
        StdMeshersGUI
 endif
 
-DIST_SUBDIRS =         SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL DriverCGNS \
+DIST_SUBDIRS =         SMDS SMESHDS Controls Driver MEDWrapper DriverMED DriverDAT DriverUNV DriverSTL DriverCGNS      \
                DriverGMF \
                SMESHUtils SMESH SMESH_I SMESHClient SMESH_SWIG MEFISTO2 StdMeshers StdMeshers_I OBJECT         \
                SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY Tools
index a8a3ad4224f038efcf96ad34d21b539b19eb4c58..78238dcea1eb24053e6e1ffe52a31853f643012c 100644 (file)
@@ -151,19 +151,28 @@ public:
   /*!
    * \brief Filters of elements, to be used with SMDS_SetIterator
    */
-  struct TypeFilter
+  struct Filter
+  {
+    virtual bool operator()(const SMDS_MeshElement* e) const = 0;
+    ~Filter() {}
+  };
+  struct NonNullFilter: public Filter
+  {
+    bool operator()(const SMDS_MeshElement* e) const { return e; }
+  };
+  struct TypeFilter : public Filter
   {
     SMDSAbs_ElementType _type;
     TypeFilter( SMDSAbs_ElementType t = SMDSAbs_NbElementTypes ):_type(t) {}
     bool operator()(const SMDS_MeshElement* e) const { return e && e->GetType() == _type; }
   };
-  struct EntityFilter
+  struct EntityFilter : public Filter
   {
     SMDSAbs_EntityType _type;
     EntityFilter( SMDSAbs_EntityType t = SMDSEntity_Last ):_type(t) {}
     bool operator()(const SMDS_MeshElement* e) const { return e && e->GetEntityType() == _type; }
   };
-  struct GeomFilter
+  struct GeomFilter : public Filter
   {
     SMDSAbs_GeometryType _type;
     GeomFilter( SMDSAbs_GeometryType t = SMDSGeom_NONE ):_type(t) {}
index 7e66a83c8bda851a290415226c788c4c5093c18e..3db0ba03ba7ce9549c07a631b98cd4a8bf6b293a 100644 (file)
@@ -366,7 +366,6 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
 std::vector<int> SMDS_VtkVolume::GetQuantities() const
 {
   vector<int> quantities;
-  quantities.clear();
   SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
   vtkUnstructuredGrid* grid = mesh->getGrid();
   vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
@@ -428,6 +427,22 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
   vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
+  if ( aVtkType == VTK_POLYHEDRON)
+  {
+    vtkIdType nFaces = 0;
+    vtkIdType* ptIds = 0;
+    grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+    int id = 0, nbPoints = 0;
+    for (int i = 0; i < nFaces; i++)
+    {
+      int nodesInFace = ptIds[id];
+      if ( ind < nbPoints + nodesInFace )
+        return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( ptIds[ ind + i ]);
+      nbPoints += nodesInFace;
+      id += (nodesInFace + 1);
+    }
+    return 0;
+  }
   vtkIdType npts, *pts;
   grid->GetCellPoints( this->myVtkID, npts, pts );
   const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType ));
index 32ad95643c6b449e9aca83713acba7aaceff3cf6..d92df0a097828ecaec8867fe21f80e8351e77182 100644 (file)
@@ -63,12 +63,12 @@ dist_libSMESHimpl_la_SOURCES = \
 libSMESHimpl_la_CPPFLAGS = \
        $(KERNEL_CXXFLAGS) \
        $(CAS_CPPFLAGS) \
-       $(MED_CXXFLAGS) \
        $(GEOM_CXX_FLAGS) \
         $(VTK_INCLUDES) \
        $(BOOST_CPPFLAGS) \
        @HDF5_INCLUDES@ \
        -I$(srcdir)/../Controls \
+       -I$(srcdir)/../MEDWrapper/Base \
        -I$(srcdir)/../Driver \
        -I$(srcdir)/../DriverDAT \
        -I$(srcdir)/../DriverMED \
index 63d2320278cc07e916c5835dd666d7bea1a52b9c..263a1e673fe1779932eaff6e1e1b68121154d308 100644 (file)
@@ -175,7 +175,7 @@ const SMESH_Algo::Features& SMESH_Algo::GetFeatures( const std::string& algoType
 SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
   : SMESH_Hypothesis(hypId, studyId, gen)
 {
-  gen->_mapAlgo[hypId] = this;
+  //gen->_mapAlgo[hypId] = this;
 
   _onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
   _quadraticMesh = _supportSubmeshes = false;
@@ -205,28 +205,28 @@ SMESH_0D_Algo::SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen)
 {
   _shapeType = (1 << TopAbs_VERTEX);
   _type = ALGO_0D;
-  gen->_map0D_Algo[hypId] = this;
+  //gen->_map0D_Algo[hypId] = this;
 }
 SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen)
   : SMESH_Algo(hypId, studyId, gen)
 {
   _shapeType = (1 << TopAbs_EDGE);
   _type = ALGO_1D;
-  gen->_map1D_Algo[hypId] = this;
+  //gen->_map1D_Algo[hypId] = this;
 }
 SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
   : SMESH_Algo(hypId, studyId, gen)
 {
   _shapeType = (1 << TopAbs_FACE);
   _type = ALGO_2D;
-  gen->_map2D_Algo[hypId] = this;
+  //gen->_map2D_Algo[hypId] = this;
 }
 SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
   : SMESH_Algo(hypId, studyId, gen)
 {
   _shapeType = (1 << TopAbs_SOLID);
   _type = ALGO_3D;
-  gen->_map3D_Algo[hypId] = this;
+  //gen->_map3D_Algo[hypId] = this;
 }
 
 //=============================================================================
@@ -681,6 +681,17 @@ void SMESH_Algo::CancelCompute()
   _error = COMPERR_CANCELED;
 }
 
+//================================================================================
+/*
+ * If possible, returns progress of computation [0.,1.]
+ */
+//================================================================================
+
+double SMESH_Algo::GetProgress() const
+{
+  return _progress;
+}
+
 //================================================================================
 /*!
  * \brief store error and comment and then return ( error == COMPERR_OK )
@@ -728,7 +739,7 @@ SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError() const
 
 //================================================================================
 /*!
- * \brief initialize compute error
+ * \brief initialize compute error before call of Compute()
  */
 //================================================================================
 
@@ -743,6 +754,27 @@ void SMESH_Algo::InitComputeError()
   _badInputElements.clear();
 
   _computeCanceled = false;
+  _progressTic     = 0;
+  _progress        = 0.;
+}
+
+//================================================================================
+/*!
+ * \brief Return compute progress by nb of calls of this method
+ */
+//================================================================================
+
+double SMESH_Algo::GetProgressByTic() const
+{
+  int computeCost = 0;
+  for ( size_t i = 0; i < _smToCompute.size(); ++i )
+    computeCost += _smToCompute[i]->GetComputeCost();
+
+  const_cast<SMESH_Algo*>( this )->_progressTic++;
+
+  double x = 5 * _progressTic;
+  x = ( x < computeCost ) ? ( x / computeCost ) : 1.;
+  return 0.9 * sin( x * M_PI / 2 );
 }
 
 //================================================================================
index 25224689a452baa82dcda91775cba10b50a43da5..acb852b720c85338f052284e9bae336a5e94b448 100644 (file)
@@ -169,6 +169,11 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
    */
   virtual void CancelCompute();
 
+  /*!
+   * \brief If possible, returns progress of computation [0.,1.]
+   */
+  virtual double GetProgress() const;
+
   /*!
    * \brief evaluates size of prospective mesh on a shape
     * \param aMesh - the mesh
@@ -224,14 +229,23 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
    */
   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+
   /*!
    * \brief return compute error
    */
   SMESH_ComputeErrorPtr GetComputeError() const;
   /*!
-   * \brief initialize compute error
+   * \brief initialize compute error etc. before call of Compute()
    */
   void InitComputeError();
+  /*!
+   * \brief Return compute progress by nb of calls of this method
+   */
+  double GetProgressByTic() const;
+  /*!
+   * Return a vector of sub-meshes to Compute()
+   */
+  std::vector<SMESH_subMesh*>& SubMeshesToCompute() { return _smToCompute; }
 
 public:
   // ==================================================================
@@ -407,8 +421,14 @@ protected:
   std::list<const SMDS_MeshElement*> _badInputElements; //!< to explain COMPERR_BAD_INPUT_MESH
 
   volatile bool _computeCanceled; //!< is set to True while computing to stop it
+
+  double        _progress;        /* progress of Compute() [0.,1.],
+                                     to be set by an algo really tracking the progress */
+  int           _progressTic;     // counter of calls from SMESH_Mesh::GetComputeProgress()
+  std::vector<SMESH_subMesh*> _smToCompute; // sub-meshes to Compute()
 };
 
+
 class SMESH_EXPORT SMESH_0D_Algo: public SMESH_Algo
 {
 public:
index fa720985a628456aa85823ac0e988fdddda7a372..d515351393d12d2ad617c0f2e3be0162697c2e38 100644 (file)
@@ -120,16 +120,17 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
 }
 
 //=============================================================================
-/*!
+/*
  * Compute a mesh
  */
 //=============================================================================
 
 bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
                         const TopoDS_Shape &  aShape,
-                        const bool            anUpward,
-                        const ::MeshDimension aDim,
-                        TSetOfInt*            aShapesId)
+                        const bool            aShapeOnly /*=false*/,
+                        const bool            anUpward /*=false*/,
+                        const ::MeshDimension aDim /*=::MeshDim_3D*/,
+                        TSetOfInt*            aShapesId /*=0*/)
 {
   MESSAGE("SMESH_Gen::Compute");
   MEMOSTAT;
@@ -143,11 +144,12 @@ bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
   const int  globalAlgoDim = 100;
 
   SMESH_subMeshIteratorPtr smIt;
-  SMESH_subMesh::compute_event computeEvent;
-  if ( !anUpward && aShape.IsSame( aMesh.GetShapeToMesh() ))
-    computeEvent = SMESH_subMesh::COMPUTE;
-  else
-    computeEvent = SMESH_subMesh::COMPUTE_SUBMESH;
+
+  // Fix of Issue 22150. Due to !BLSURF->OnlyUnaryInput(), BLSURF computes edges
+  // that must be computed by Projection 1D-2D when Projection asks to compute
+  // one face only.
+  SMESH_subMesh::compute_event computeEvent =
+    aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
 
   if ( anUpward ) // is called from the below code in this method
   {
@@ -331,7 +333,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
             SMESH_Hypothesis::Hypothesis_Status status;
             if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
               // mesh a lower smToCompute starting from vertices
-              Compute( aMesh, aSubShape, /*anUpward=*/true, aDim, aShapesId );
+              Compute( aMesh, aSubShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId );
           }
         }
       }
@@ -363,7 +365,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
     // -----------------------------------------------
     // mesh the rest sub-shapes starting from vertices
     // -----------------------------------------------
-    ret = Compute( aMesh, aShape, /*anUpward=*/true, aDim, aShapesId );
+    ret = Compute( aMesh, aShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId );
   }
 
   MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
index 496ca9b69649318482e09495d139510698c6a4c5..53610552bc34a49ee06d4282b7f4cd50b0bfa2d8 100644 (file)
@@ -70,6 +70,8 @@ public:
 
   /*!
    * \brief Computes aMesh on aShape 
+   *  \param aShapeOnly - if true, algo->OnlyUnaryInput() feature is ignored and
+   *                      only \a aShape is computed.
    *  \param anUpward - compute from vertices up to more complex shape (internal usage)
    *  \param aDim - upper level dimension of the mesh computation
    *  \param aShapesId - list of shapes with computed mesh entities (elements or nodes)
@@ -77,16 +79,17 @@ public:
    */
   bool Compute(::SMESH_Mesh &        aMesh,
                const TopoDS_Shape &  aShape,
+               const bool            aShapeOnly=false,
                const bool            anUpward=false,
                const ::MeshDimension aDim=::MeshDim_3D,
                TSetOfInt*            aShapesId=0);
 
-#ifdef WITH_SMESH_CANCEL_COMPUTE
   void PrepareCompute(::SMESH_Mesh &        aMesh,
                       const TopoDS_Shape &  aShape);
   void CancelCompute(::SMESH_Mesh &        aMesh,
                      const TopoDS_Shape &  aShape);
-#endif
+
+  const SMESH_subMesh* GetCurrentSubMesh() const { return _sm_current; }
 
   /*!
    * \brief evaluates size of prospective mesh on a shape 
@@ -151,11 +154,11 @@ public:
 
   int GetANewId();
 
-  std::map < int, SMESH_Algo * >_mapAlgo;
-  std::map < int, SMESH_0D_Algo * >_map0D_Algo;
-  std::map < int, SMESH_1D_Algo * >_map1D_Algo;
-  std::map < int, SMESH_2D_Algo * >_map2D_Algo;
-  std::map < int, SMESH_3D_Algo * >_map3D_Algo;
+  // std::map < int, SMESH_Algo * >_mapAlgo;
+  // std::map < int, SMESH_0D_Algo * >_map0D_Algo;
+  // std::map < int, SMESH_1D_Algo * >_map1D_Algo;
+  // std::map < int, SMESH_2D_Algo * >_map2D_Algo;
+  // std::map < int, SMESH_3D_Algo * >_map3D_Algo;
 
 private:
 
@@ -168,14 +171,13 @@ private:
   // number of segments per diagonal of boundary box of geometry by which
   // default segment length of appropriate 1D hypotheses is defined
   int _segmentation;
-  // default of segments
+  // default number of segments
   int _nbSegments;
+
   counters *_counters;
 
-#ifdef WITH_SMESH_CANCEL_COMPUTE
-  volatile bool _compute_canceled;
+  volatile bool  _compute_canceled;
   SMESH_subMesh* _sm_current;
-#endif
 };
 
 #endif
index 9bf36fb1ff7b6aad47aae73802111b7a9d2dd6bf..bcddd46d52d707b398cf7b48fa5eaee7da38a1de 100644 (file)
@@ -58,6 +58,7 @@
 #include <BRepBndLib.hxx>
 #include <BRepPrimAPI_MakeBox.hxx>
 #include <Bnd_Box.hxx>
+#include <TColStd_MapOfInteger.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
@@ -592,19 +593,9 @@ SMESH_Hypothesis::Hypothesis_Status
   if ( !subMesh || !subMesh->GetId())
     return SMESH_Hypothesis::HYP_BAD_SUBSHAPE;
 
-  StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
-  if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
-  {
-    if(MYDEBUG) MESSAGE("Hypothesis ID does not give an hypothesis");
-    if(MYDEBUG) {
-      SCRUTE(_studyId);
-      SCRUTE(anHypId);
-    }
+  SMESH_Hypothesis *anHyp = GetHypothesis( anHypId );
+  if ( !anHyp )
     throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
-  }
-
-  SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
-  MESSAGE( "SMESH_Mesh::AddHypothesis " << anHyp->GetName() );
 
   bool isGlobalHyp = IsMainShape( aSubShape );
 
@@ -682,8 +673,7 @@ SMESH_Hypothesis::Hypothesis_Status
   
   SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
   if(MYDEBUG) {
-    int hypType = anHyp->GetType();
-    SCRUTE(hypType);
+    SCRUTE(anHyp->GetType());
   }
   
   // shape 
@@ -877,6 +867,22 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape &                aSubShape,
   return nbHyps;
 }
 
+//================================================================================
+/*!
+ * \brief Return a hypothesis by its ID
+ */
+//================================================================================
+
+SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const int anHypId) const
+{
+  StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
+  if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
+    return false;
+
+  SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
+  return anHyp;
+}
+
 //=============================================================================
 /*!
  * 
@@ -1249,19 +1255,21 @@ void SMESH_Mesh::ExportMED(const char *        file,
                            const char*         theMeshName, 
                            bool                theAutoGroups,
                            int                 theVersion,
-                           const SMESHDS_Mesh* meshPart) 
+                           const SMESHDS_Mesh* meshPart,
+                           bool                theAutoDimension)
   throw(SALOME_Exception)
 {
   Unexpect aCatch(SalomeException);
 
   DriverMED_W_SMESHDS_Mesh myWriter;
-  myWriter.SetFile    ( file, MED::EVersion(theVersion) );
-  myWriter.SetMesh    ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
+  myWriter.SetFile         ( file, MED::EVersion(theVersion) );
+  myWriter.SetMesh         ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS   );
+  myWriter.SetAutoDimension( theAutoDimension );
   if ( !theMeshName ) 
-    myWriter.SetMeshId  ( _id         );
+    myWriter.SetMeshId     ( _id         );
   else {
-    myWriter.SetMeshId  ( -1          );
-    myWriter.SetMeshName( theMeshName );
+    myWriter.SetMeshId     ( -1          );
+    myWriter.SetMeshName   ( theMeshName );
   }
 
   if ( theAutoGroups ) {
@@ -1300,6 +1308,12 @@ void SMESH_Mesh::ExportMED(const char *        file,
   myWriter.Perform();
 }
 
+//================================================================================
+/*!
+ * \brief Export the mesh to a SAUV file
+ */
+//================================================================================
+
 void SMESH_Mesh::ExportSAUV(const char *file, 
                             const char* theMeshName, 
                             bool theAutoGroups)
@@ -1444,6 +1458,66 @@ void SMESH_Mesh::ExportGMF(const char *        file,
   myWriter.Perform();
 }
 
+//================================================================================
+/*!
+ * \brief Return a ratio of "compute cost" of computed sub-meshes to the whole
+ *        "compute cost".
+ */
+//================================================================================
+
+double SMESH_Mesh::GetComputeProgress() const
+{
+  double totalCost = 1e-100, computedCost = 0;
+  const SMESH_subMesh* curSM = _gen->GetCurrentSubMesh();
+
+  // get progress of a current algo
+  TColStd_MapOfInteger currentSubIds; 
+  if ( curSM )
+    if ( SMESH_Algo* algo = curSM->GetAlgo() )
+    {
+      int algoNotDoneCost = 0, algoDoneCost = 0;
+      const std::vector<SMESH_subMesh*>& smToCompute = algo->SubMeshesToCompute();
+      for ( size_t i = 0; i < smToCompute.size(); ++i )
+      {
+        if ( smToCompute[i]->IsEmpty() )
+          algoNotDoneCost += smToCompute[i]->GetComputeCost();
+        else
+          algoDoneCost += smToCompute[i]->GetComputeCost();
+        currentSubIds.Add( smToCompute[i]->GetId() );
+      }
+      double rate = algo->GetProgress();
+      if ( !( 0. < rate && rate < 1.001 ))
+      {
+        rate = algo->GetProgressByTic();
+      }
+      // cout << "rate: "<<rate << " algoNotDoneCost: " << algoNotDoneCost << endl;
+      computedCost += algoDoneCost + rate * algoNotDoneCost;
+    }
+
+  // get cost of already treated sub-meshes
+  if ( SMESH_subMesh* mainSM = GetSubMeshContaining( 1 ))
+  {
+    SMESH_subMeshIteratorPtr smIt = mainSM->getDependsOnIterator(/*includeSelf=*/true);
+    while ( smIt->more() )
+    {
+      const SMESH_subMesh* sm = smIt->next();
+      const int smCost = sm->GetComputeCost();
+      totalCost += smCost;
+      if ( !currentSubIds.Contains( sm->GetId() ) )
+      {
+        if (( !sm->IsEmpty() ) ||
+            ( sm->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE &&
+              !sm->DependsOn( curSM ) ))
+          computedCost += smCost;
+      }
+    }
+  }
+  // cout << "Total: " << totalCost
+  //      << " computed: " << computedCost << " progress: " << computedCost / totalCost
+  //      << " nbElems: " << GetMeshDS()->GetMeshInfo().NbElements() << endl;
+  return computedCost / totalCost;
+}
+
 //================================================================================
 /*!
  * \brief Return number of nodes in the mesh
index e329e031336add63684b14a373634b4e1dea226b..fa6abc0bb4e610dbca2b6e611ae8f301a066eb4c 100644 (file)
@@ -148,6 +148,8 @@ public:
                     const bool                               andAncestors,
                     std::list< TopoDS_Shape > *              assignedTo=0) const;
 
+  SMESH_Hypothesis * GetHypothesis(const int aHypID) const;
+
   const std::list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
   
   void ClearLog() throw(SALOME_Exception);
@@ -229,11 +231,12 @@ public:
    */
   bool HasDuplicatedGroupNamesMED();
 
-  void ExportMED(const char *file, 
-                 const char* theMeshName = NULL, 
-                 bool theAutoGroups = true, 
-                 int theVersion = 0,
-                 const SMESHDS_Mesh* meshPart = 0) 
+  void ExportMED(const char *        theFile, 
+                 const char*         theMeshName = NULL, 
+                 bool                theAutoGroups = true, 
+                 int                 theVersion = 0,
+                 const SMESHDS_Mesh* theMeshPart = 0,
+                 bool                theAutoDimension = false)
     throw(SALOME_Exception);
 
   void ExportDAT(const char *        file,
@@ -251,6 +254,8 @@ public:
   void ExportSAUV(const char *file, 
                   const char* theMeshName = NULL, 
                   bool theAutoGroups = true) throw(SALOME_Exception);
+
+  double GetComputeProgress() const;
   
   int NbNodes() const throw(SALOME_Exception);
   int Nb0DElements() const throw(SALOME_Exception);
index 4e9a0f48d5a3c8bbcf8b1858684604b8883e01f7..16ed768ec1bf3b861c8dbdf905f473f4d75cacf4 100644 (file)
@@ -105,9 +105,11 @@ using namespace SMESH::Controls;
 
 namespace
 {
-  SMDS_ElemIteratorPtr elemSetIterator( const TIDSortedElemSet& elements )
+  template < class ELEM_SET >
+  SMDS_ElemIteratorPtr elemSetIterator( const ELEM_SET& elements )
   {
-    typedef SMDS_SetIterator< SMDS_pElement, TIDSortedElemSet::const_iterator> TSetIterator;
+    typedef SMDS_SetIterator
+      < SMDS_pElement, typename ELEM_SET::const_iterator> TSetIterator;
     return SMDS_ElemIteratorPtr( new TSetIterator( elements.begin(), elements.end() ));
   }
 }
@@ -424,10 +426,20 @@ void SMESH_MeshEditor::Create0DElementsOnAllNodes( const TIDSortedElemSet& eleme
                                                    TIDSortedElemSet&       all0DElems )
 {
   SMDS_ElemIteratorPtr elemIt;
+  vector< const SMDS_MeshElement* > allNodes;
   if ( elements.empty() )
+  {
+    allNodes.reserve( GetMeshDS()->NbNodes() );
     elemIt = GetMeshDS()->elementsIterator( SMDSAbs_Node );
+    while ( elemIt->more() )
+      allNodes.push_back( elemIt->next() );
+
+    elemIt = elemSetIterator( allNodes );
+  }
   else
+  {
     elemIt = elemSetIterator( elements );
+  }
 
   while ( elemIt->more() )
   {
@@ -9586,6 +9598,95 @@ SMESH_MeshEditor::FindMatchingNodes(set<const SMDS_MeshElement*>& theSide1,
   return SEW_OK;
 }
 
+//================================================================================
+/*!
+ * \brief Create elements equal (on same nodes) to given ones
+ *  \param [in] theElements - a set of elems to duplicate. If it is empty, all
+ *              elements of the uppest dimension are duplicated.
+ */
+//================================================================================
+
+void SMESH_MeshEditor::DoubleElements( const TIDSortedElemSet& theElements )
+{
+  CrearLastCreated();
+  SMESHDS_Mesh* mesh = GetMeshDS();
+
+  // get an element type and an iterator over elements
+
+  SMDSAbs_ElementType type;
+  SMDS_ElemIteratorPtr elemIt;
+  vector< const SMDS_MeshElement* > allElems;
+  if ( theElements.empty() )
+  {
+    if ( mesh->NbNodes() == 0 )
+      return;
+    // get most complex type
+    SMDSAbs_ElementType types[SMDSAbs_NbElementTypes] = {
+      SMDSAbs_Volume, SMDSAbs_Face, SMDSAbs_Edge,
+      SMDSAbs_0DElement, SMDSAbs_Ball, SMDSAbs_Node
+    };
+    for ( int i = 0; i < SMDSAbs_NbElementTypes; ++i )
+      if ( mesh->GetMeshInfo().NbElements( types[i] ))
+      {
+        type = types[i];
+        break;
+      }
+    // put all elements in the vector <allElems>
+    allElems.reserve( mesh->GetMeshInfo().NbElements( type ));
+    elemIt = mesh->elementsIterator( type );
+    while ( elemIt->more() )
+      allElems.push_back( elemIt->next());
+    elemIt = elemSetIterator( allElems );
+  }
+  else
+  {
+    type = (*theElements.begin())->GetType();
+    elemIt = elemSetIterator( theElements );
+  }
+
+  // duplicate elements
+
+  if ( type == SMDSAbs_Ball )
+  {
+    SMDS_UnstructuredGrid* vtkGrid = mesh->getGrid();
+    while ( elemIt->more() )
+    {
+      const SMDS_MeshElement* elem = elemIt->next();
+      if ( elem->GetType() != SMDSAbs_Ball )
+        continue;
+      if (( elem = mesh->AddBall( elem->GetNode(0),
+                                  vtkGrid->GetBallDiameter( elem->getVtkId() ))))
+        myLastCreatedElems.Append( elem );
+    }
+  }
+  else
+  {
+    vector< const SMDS_MeshNode* > nodes;
+    while ( elemIt->more() )
+    {
+      const SMDS_MeshElement* elem = elemIt->next();
+      if ( elem->GetType() != type )
+        continue;
+
+      nodes.assign( elem->begin_nodes(), elem->end_nodes() );
+
+      if ( type == SMDSAbs_Volume  && elem->GetVtkType() == VTK_POLYHEDRON )
+      {
+        std::vector<int> quantities =
+          static_cast< const SMDS_VtkVolume* >( elem )->GetQuantities();
+        elem = mesh->AddPolyhedralVolume( nodes, quantities );
+      }
+      else
+      {
+        AddElement( nodes, type, elem->IsPoly() );
+        elem = 0; // myLastCreatedElems is already filled
+      }
+      if ( elem )
+        myLastCreatedElems.Append( elem );
+    }
+  }
+}
+
 //================================================================================
 /*!
   \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@@ -10890,7 +10991,8 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius,
           double z = nodesCoords[i++];
           gp_Pnt p = gp_Pnt(x, y ,z);
           gpnts.push_back(p);
-          MESSAGE("TopoDS_Vertex " << k++ << " " << p.X() << " " << p.Y() << " " << p.Z());
+          MESSAGE("TopoDS_Vertex " << k << " " << p.X() << " " << p.Y() << " " << p.Z());
+          k++;
         }
     }
   else // --- no group, no coordinates : use the vertices of the geom shape provided, and radius
index 7796b7cbc92a1fd8c771f71e751241551a9c591c..e8b403e6efc467de31d25445f7f18fe96bcecd54 100644 (file)
@@ -504,6 +504,8 @@ public:
   // Return an index of the shape theElem is on
   // or zero if a shape not found
 
+  void DoubleElements( const TIDSortedElemSet& theElements );
+
   bool DoubleNodes( const std::list< int >& theListOfNodes, 
                     const std::list< int >& theListOfModifiedElems );
   
index 314a0f5c7bcfd13f9e5f79811eef5d769783ff20..316bcea6291e41a45c3577966e31417912df9202 100644 (file)
@@ -845,7 +845,7 @@ gp_XY SMESH_MesherHelper::GetCenterUV(const gp_XY& uv1,
 double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge&   E,
                                     const SMDS_MeshNode* n,
                                     const SMDS_MeshNode* inEdgeNode,
-                                    bool*                check)
+                                    bool*                check) const
 {
   double param = Precision::Infinite();
 
@@ -2489,9 +2489,16 @@ bool SMESH_MesherHelper::IsReversedSubMesh (const TopoDS_Face& theFace)
     {
       SMESH_TNodeXYZ nPnt[3];
       SMDS_ElemIteratorPtr nodesIt = elem->nodesIterator();
+      int iNodeOnFace = 0, iPosDim = SMDS_TOP_VERTEX;
       for ( int iN = 0; nodesIt->more() && iN < 3; ++iN) // loop on nodes
+      {
         nPnt[ iN ] = nodesIt->next();
-
+        if ( nPnt[ iN ]._node->GetPosition()->GetTypeOfPosition() > iPosDim )
+        {
+          iNodeOnFace = iN;
+          iPosDim = nPnt[ iN ]._node->GetPosition()->GetTypeOfPosition();
+        }
+      }
       // compute normal
       gp_Vec v01( nPnt[0], nPnt[1] ), v02( nPnt[0], nPnt[2] );
       if ( v01.SquareMagnitude() > RealSmall() &&
@@ -2499,7 +2506,7 @@ bool SMESH_MesherHelper::IsReversedSubMesh (const TopoDS_Face& theFace)
       {
         Ne = v01 ^ v02;
         if (( normalOK = ( Ne.SquareMagnitude() > RealSmall() )))
-          uv = GetNodeUV( theFace, nPnt[0]._node, nPnt[2]._node, &normalOK );
+          uv = GetNodeUV( theFace, nPnt[iNodeOnFace]._node, 0, &normalOK );
       }
     }
   }
index e6f5bb239c80002e69e24a73eb229f4ac852faab..f2b4d9ffc5d241c4499ae8f0136a2a9c52dbbd88 100644 (file)
@@ -420,7 +420,7 @@ public:
   double GetNodeU(const TopoDS_Edge&   theEdge,
                   const SMDS_MeshNode* theNode,
                   const SMDS_MeshNode* inEdgeNode=0,
-                  bool*                check=0);
+                  bool*                check=0) const;
   /*!
    * \brief Return node UV on face
    *  \param inFaceNode - a node of element being created located inside a face
index 9d0c236e08454755a9b9f6b596e5f5adc2e14472..483495be5fa4cafabcbf9182920034dcb1f6882c 100644 (file)
@@ -104,6 +104,8 @@ SMESH_subMesh::SMESH_subMesh(int                  Id,
     _algoState = NO_ALGO;
     _computeState = NOT_READY;
   }
+  _computeCost = 0; // how costly is to compute this sub-mesh
+  _realComputeCost = 0;
 }
 
 //=============================================================================
@@ -355,6 +357,48 @@ bool SMESH_subMesh::SubMeshesComputed(bool * isFailedToCompute/*=0*/) const
   return subMeshesComputed;
 }
 
+//================================================================================
+/*!
+ * \brief Return cost of computing this sub-mesh. If hypotheses are not well defined,
+ *        zero is returned
+ *  \return int - the computation cost in abstract units.
+ */
+//================================================================================
+
+int SMESH_subMesh::GetComputeCost() const
+{
+  return _realComputeCost;
+}
+
+//================================================================================
+/*!
+ * \brief Return cost of computing this sub-mesh. The cost depends on the shape type
+ *        and number of sub-meshes this one DependsOn().
+ *  \return int - the computation cost in abstract units.
+ */
+//================================================================================
+
+int SMESH_subMesh::computeCost() const
+{
+  if ( !_computeCost )
+  {
+    int computeCost;
+    switch ( _subShape.ShapeType() ) {
+    case TopAbs_SOLID:
+    case TopAbs_SHELL: computeCost = 1000; break;
+    case TopAbs_FACE:  computeCost = 100; break;
+    case TopAbs_EDGE:  computeCost = 10; break;
+    default:           computeCost = 1;
+    }
+    SMESH_subMeshIteratorPtr childIt = getDependsOnIterator(/*includeSelf=*/false);
+    while ( childIt->more() )
+      computeCost += childIt->next()->computeCost();
+
+    ((SMESH_subMesh*)this)->_computeCost = computeCost;
+  }
+  return _computeCost;
+}
+
 //=============================================================================
 /*!
  *
@@ -501,6 +545,23 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
   return _mapDepend;
 }
 
+//================================================================================
+/*!
+ * \brief Return a key for SMESH_subMesh::_mapDepend map
+ */
+//================================================================================
+
+namespace {
+  int dependsOnMapKey( const SMESH_subMesh* sm )
+  {
+    int type = sm->GetSubShape().ShapeType();
+    int ordType = 9 - type;               // 2 = Vertex, 8 = CompSolid
+    int cle = sm->GetId();
+    cle += 10000000 * ordType;    // sort map by ordType then index
+    return cle;
+  }
+}
+
 //=============================================================================
 /*!
  * For simple Shapes (solid, face, edge): add subMesh into dependence list.
@@ -510,10 +571,7 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
 void SMESH_subMesh::insertDependence(const TopoDS_Shape aSubShape)
 {
   SMESH_subMesh *aSubMesh = _father->GetSubMesh(aSubShape);
-  int type = aSubShape.ShapeType();
-  int ordType = 9 - type;               // 2 = Vertex, 8 = CompSolid
-  int cle = aSubMesh->GetId();
-  cle += 10000000 * ordType;    // sort map by ordType then index
+  int cle = dependsOnMapKey( aSubMesh );
   if ( _mapDepend.find( cle ) == _mapDepend.end())
   {
     _mapDepend[cle] = aSubMesh;
@@ -522,19 +580,28 @@ void SMESH_subMesh::insertDependence(const TopoDS_Shape aSubShape)
   }
 }
 
+//================================================================================
+/*!
+ * \brief Return \c true if \a this sub-mesh depends on \a other
+ */
+//================================================================================
+
+bool SMESH_subMesh::DependsOn( const SMESH_subMesh* other ) const
+{
+  return other ? _mapDepend.count( dependsOnMapKey( other )) : false;
+}
+
 //=============================================================================
 /*!
- *
+ * Return a shape of \a this sub-mesh
  */
 //=============================================================================
 
 const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
 {
-        //MESSAGE("SMESH_subMesh::GetSubShape");
-        return _subShape;
+  return _subShape;
 }
 
-
 //=======================================================================
 //function : CanAddHypothesis
 //purpose  : return true if theHypothesis can be attached to me:
@@ -1074,6 +1141,8 @@ SMESH_Hypothesis::Hypothesis_Status
   if (stateChange || modifiedHyp)
     ComputeStateEngine(MODIF_ALGO_STATE);
 
+  _realComputeCost = ( _algoState == HYP_OK ) ? computeCost() : 0;
+
   return ret;
 }
 
@@ -1251,8 +1320,7 @@ void SMESH_subMesh::cleanDependsOn( SMESH_Algo* algoRequiringCleaning/*=0*/ )
 
 void SMESH_subMesh::DumpAlgoState(bool isMain)
 {
-        int dim = SMESH_Gen::GetShapeDim(_subShape);
-//   if (dim < 1) return;
+  // if (dim < 1) return;
         if (isMain)
         {
                 const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
@@ -1264,8 +1332,9 @@ void SMESH_subMesh::DumpAlgoState(bool isMain)
                         sm->DumpAlgoState(false);
                 }
         }
-        int type = _subShape.ShapeType();
-        MESSAGE("dim = " << dim << " type of shape " << type);
+        //int type = _subShape.ShapeType();
+        MESSAGE("dim = " << SMESH_Gen::GetShapeDim(_subShape) <<
+                " type of shape " << _subShape.ShapeType());
         switch (_algoState)
         {
         case NO_ALGO:
@@ -1462,13 +1531,14 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           break;
         }
         TopoDS_Shape shape = _subShape;
+        algo->SubMeshesToCompute().assign( 1, this );
         // check submeshes needed
         if (_father->HasShapeToMesh() ) {
           bool subComputed = false, subFailed = false;
           if (!algo->OnlyUnaryInput()) {
             if ( event == COMPUTE /*&&
                  ( algo->NeedDiscreteBoundary() || algo->SupportSubmeshes() )*/)
-              shape = getCollection( gen, algo, subComputed, subFailed );
+              shape = getCollection( gen, algo, subComputed, subFailed, algo->SubMeshesToCompute());
             else
               subComputed = SubMeshesComputed( & subFailed );
           }
@@ -1501,6 +1571,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
           OCC_CATCH_SIGNALS;
 #endif
           algo->InitComputeError();
+
           MemoryReserve aMemoryReserve;
           SMDS_Mesh::CheckMemory();
           Kernel_Utils::Localizer loc;
@@ -2028,7 +2099,8 @@ void SMESH_subMesh::removeSubMeshElementsAndNodes()
 TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
                                           SMESH_Algo* theAlgo,
                                           bool &      theSubComputed,
-                                          bool &      theSubFailed)
+                                          bool &      theSubFailed,
+                                          std::vector<SMESH_subMesh*>& theSubs)
 {
   theSubComputed = SubMeshesComputed( & theSubFailed );
 
@@ -2048,11 +2120,14 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
   BRep_Builder aBuilder;
   aBuilder.MakeCompound( aCompound );
 
+  theSubs.clear();
+
   TopExp_Explorer anExplorer( mainShape, _subShape.ShapeType() );
   for ( ; anExplorer.More(); anExplorer.Next() )
   {
     const TopoDS_Shape& S = anExplorer.Current();
     SMESH_subMesh* subMesh = _father->GetSubMesh( S );
+    theSubs.push_back( subMesh );
     if ( subMesh == this )
     {
       aBuilder.Add( aCompound, S );
index 48ed2be01af35b7371bedcbeb84c9e94e391360c..63ff08d3f8a6077e6902d15d7f1d54446741fe3c 100644 (file)
@@ -80,11 +80,13 @@ class SMESH_EXPORT SMESH_subMesh
   SMESH_Algo* GetAlgo() const;
 
   const std::map < int, SMESH_subMesh * >& DependsOn();
+  bool DependsOn( const SMESH_subMesh* other ) const;
   /*!
-   * \brief Return iterator on the submeshes this one depends on
+   * \brief Return iterator on the sub-meshes this one depends on. By default
+   *        most simple sub-meshes go first.
    */
   SMESH_subMeshIteratorPtr getDependsOnIterator(const bool includeSelf,
-                                                const bool complexShapeFirst) const;
+                                                const bool complexShapeFirst=false) const;
 
   const TopoDS_Shape & GetSubShape() const;
 
@@ -244,7 +246,7 @@ public:
   bool IsEmpty() const;
 
   bool IsMeshComputed() const;
-  // check if _subMeshDS contains mesh elements
+  // check if _subMeshDS contains mesh elements unless _alwaysComputed==true
 
   /*!
    * \brief Allow algo->Compute() if a subshape of lower dim is meshed but
@@ -255,6 +257,8 @@ public:
 
   bool SubMeshesComputed(bool * isFailedToCompute=0) const;
 
+  int GetComputeCost() const;
+  // how costly is to compute this sub-mesh
   
   /*!
    * \brief  Find common submeshes (based on shared subshapes with other
@@ -283,7 +287,8 @@ protected:
   TopoDS_Shape getCollection(SMESH_Gen * theGen,
                              SMESH_Algo* theAlgo,
                              bool &      theSubComputed,
-                             bool &      theSubFailed);
+                             bool &      theSubFailed,
+                             std::vector<SMESH_subMesh*>& theSubs);
   /*!
    * \brief Update compute_state by _computeError
     * \retval bool - false if there are errors
@@ -303,6 +308,7 @@ protected:
                                              const SMESH_Hypothesis * theHyp,
                                              const int                theHypType = 0);
   // 
+  int computeCost() const;
 
 protected:
 
@@ -318,6 +324,8 @@ protected:
   algo_state            _algoState;
   compute_state         _computeState;
   SMESH_ComputeErrorPtr _computeError;
+  int                   _computeCost;     // how costly is to compute this sub-mesh
+  int                   _realComputeCost; // _computeCost depending on presence of needed hypotheses
 
   // allow algo->Compute() if a sub-shape of lower dim is meshed but
   // none mesh entity is bound to it. Eg StdMeshers_CompositeSegment_1D can
index a696d59dffa4648c2b65ce0abd0c057093cc9f66..e8e42e9fbd0d7e627883c8cc243750286e10ae98 100644 (file)
@@ -66,10 +66,12 @@ libSMESHClient_la_LDFLAGS  = \
        ../SMESH/libSMESHimpl.la \
        ../SMESHDS/libSMESHDS.la \
        ../Controls/libSMESHControls.la \
+       ../MEDWrapper/Factory/libMEDWrapper.la \
+       ../MEDWrapper/Base/libMEDWrapperBase.la \
+       ../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \
        $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeNS -lOpUtil -lSALOMEBasics \
        -lSalomeIDLKernel -lSALOMELocalTrace \
        $(GEOM_LDFLAGS) -lNMTDS -lSalomeIDLGEOM \
-       $(MED_LDFLAGS) -lMEDWrapper_V2_2 -lSalomeIDLMED -lMEDWrapper \
        $(CAS_KERNEL)
 
 SMESHClientBin_CPPFLAGS = \
index f2c9b5190ffed050f1a0b1a28cd2c21d10ab3331..446bf6eec4eb39a670db1a9f75696243a3e0e129 100644 (file)
@@ -267,6 +267,7 @@ libSMESH_la_CPPFLAGS = \
        -I$(srcdir)/../SMESH_I \
        -I$(srcdir)/../Controls \
        -I$(srcdir)/../SMESHClient \
+       -I$(srcdir)/../MEDWrapper/Base \
        -I$(top_builddir) \
        -I$(top_builddir)/idl
 
index 0bbbf9bdad90aee8ea7667cc3344fb25f745b7df..33de52b4dd998f5772ee063d60884091bc556595 100644 (file)
 #include <SALOMEDSClient_SComponent.hxx>
 #include <SALOMEDSClient_StudyBuilder.hxx>
 #include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_SObject.hxx>
 
 // OCCT includes
 #include <Standard_ErrorHandler.hxx>
     if ( resMgr )
       toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
     bool toOverwrite = true;
+    bool toFindOutDim = true;
 
     QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
     QString anInitialPath = "";
                                             anInitialPath + QString("/") + aMeshName,
                                             aFilter, aTitle, false);
     }
-    // else if ( isGMF )// Export to GMF
-    // {
-      // SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
-      //   ( SMESHGUI::desktop(), false, QObject::tr("SMESH_REQUIRED_GROUPS"), true, true );
-      // QStringList filters;
-      // filters << QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)"
-      //         << QObject::tr( "GMF_BINARY_FILES_FILTER" )  + " (*.meshb)";
-      // fd->setWindowTitle( aTitle );
-      // fd->setNameFilters( filters );
-
-      // if ( !aMeshOrGroup->_is_equivalent( aMesh ))
-      //   toCreateGroups = false;
-      // else
-      //   toCreateGroups = ( aMesh->NbGroups() > 0 );
-
-      // fd->SetChecked( true );
-      // if ( !anInitialPath.isEmpty() )
-      //   fd->setDirectory( anInitialPath );
-      // fd->selectFile(aMeshName);
-
-      // if ( fd->exec() )
-      //   aFilename = fd->selectedFile();
-      // toCreateGroups = fd->IsChecked();
-
-      // delete fd;
-    // }
     else if ( isCGNS )// Export to CGNS
     {
       SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
         if (it.value() == SMESH::MED_V2_2)
           aDefaultFilter = it.key();
       }
+      QStringList checkBoxes;
+      checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM");
 
-      SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
-        ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
+      SalomeApp_CheckFileDlg* fd =
+        new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
       fd->setWindowTitle( aTitle );
       fd->setNameFilters( filters );
       fd->selectNameFilter(aDefaultFilter);
-      fd->SetChecked(toCreateGroups);
+      fd->SetChecked(0,toCreateGroups);
+      fd->SetChecked(1,toFindOutDim);
       if ( !anInitialPath.isEmpty() )
         fd->setDirectory( anInitialPath );
       fd->selectFile(aMeshName);
           }
         }
       }
-      toCreateGroups = fd->IsChecked();
+      toCreateGroups = fd->IsChecked(0);
+      toFindOutDim   = fd->IsChecked(1);
       delete fd;
     }
     else
             SMESH::SMESH_Mesh_var        aMeshItem = aMeshOrGroup->GetMesh();
             if ( aMeshOrGroup->_is_equivalent( aMeshItem ))
               aMeshItem->ExportToMEDX( aFilename.toLatin1().data(), toCreateGroups,
-                                       aFormat, toOverwrite && aMeshIndex == 0 );
+                                       aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
             else
               aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups,
-                                          aFormat, toOverwrite && aMeshIndex == 0 );
+                                          aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
           }
         }
         else if ( isSAUV )
     SMESH::RepaintCurrentView();
   }
 
+  void OverallMeshQuality() {
+    SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+    LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel )
+      aSel->selectedObjects( selected );
+    
+    if ( selected.IsEmpty() ) return;
+    SALOME_ListIteratorOfListIO It( selected );
+    for ( ; It.More(); It.Next() ) {
+      SMESHGUI_CtrlInfoDlg* ctrlDlg = new SMESHGUI_CtrlInfoDlg( SMESHGUI::desktop() );
+      ctrlDlg->showInfo( It.Value() );
+      ctrlDlg->show();
+    }
+  }
+
   QString functorToString( SMESH::Controls::FunctorPtr f )
   {
     QString type = QObject::tr( "UNKNOWN_CONTROL" );
     }
   }
 
+  void sortChildren(){
+    LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SALOME_ListIO selected;
+    if( aSel ) {
+      aSel->selectedObjects( selected );
+      
+      if(selected.Extent()){
+       Handle(SALOME_InteractiveObject) anIObject = selected.First();
+       _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+       _PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
+       if (aSObj) {
+         if ( aStudy->GetUseCaseBuilder()->SortChildren( aSObj, true/*AscendingOrder*/ ) ) {
+           SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+         }
+       }
+      }
+    }
+  }
+
   void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
   {
     SALOME_ListIO selected;
@@ -1981,6 +1996,82 @@ bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded)
   return autoUpdate && !exceeded;
 }
 
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
+                                int* entities, bool* limitExceeded )
+{
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  if ( !resMgr )
+    return false;
+
+  bool autoUpdate  = resMgr->booleanValue( "SMESH", "auto_update", false );
+  long updateLimit = resMgr->integerValue( "SMESH", "update_limit", 500000 );
+  bool incrementalLimit = resMgr->booleanValue( "SMESH", "incremental_limit", false );
+
+  long requestedSize = theMesh->NbElements();
+
+  *entities = SMESH_Actor::eAllEntity;
+
+  bool exceeded = updateLimit > 0 && requestedSize > updateLimit;
+
+  if ( limitExceeded ) *limitExceeded = autoUpdate && exceeded;
+
+  if ( incrementalLimit ) {
+    long nbOdElems = theMesh->Nb0DElements();
+    long nbEdges   = theMesh->NbEdges();
+    long nbFaces   = theMesh->NbFaces();
+    long nbVolumes = theMesh->NbVolumes();
+    long nbBalls   = theMesh->NbBalls();
+    long total     = 0;
+
+    if ( nbOdElems > 0 ) {
+      if ( total + nbOdElems > updateLimit )
+        *entities = *entities & ~SMESH_Actor::e0DElements;
+      else
+        exceeded = false;
+    }
+    total += nbOdElems;
+
+    if ( nbEdges > 0 ) {
+      if ( total + nbEdges > updateLimit )
+        *entities = *entities & ~SMESH_Actor::eEdges;
+      else
+        exceeded = false;
+    }
+    total += nbEdges;
+
+    if ( nbFaces > 0 ) {
+      if ( total + nbFaces > updateLimit )
+        *entities = *entities & ~SMESH_Actor::eFaces;
+      else
+        exceeded = false;
+    }
+    total += nbFaces;
+
+    if ( nbVolumes > 0 ) {
+      if ( total + nbVolumes > updateLimit )
+        *entities = *entities & ~SMESH_Actor::eVolumes;
+      else
+        exceeded = false;
+    }
+    total += nbVolumes;
+
+    if ( nbBalls > 0 ) {
+      if ( total + nbBalls > updateLimit )
+        *entities = *entities & ~SMESH_Actor::eBallElem;
+      else
+        exceeded = false;
+    }
+    total += nbBalls;
+  }
+  
+  return autoUpdate && !exceeded;
+}
+
 //=============================================================================
 /*!
  *
@@ -2386,6 +2477,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 214:                                     // UPDATE
     {
       if(checkLock(aStudy)) break;
+      SUIT_OverrideCursor wc;
       try {
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
         OCC_CATCH_SIGNALS;
@@ -3073,26 +3165,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         SMDSAbs_EntityType type = SMDSEntity_Last;
 
         switch (theCommandID) {
-        case 4034:
-          type = SMDSEntity_Quad_Edge; break;
-        case 4035:
-          type = SMDSEntity_Quad_Triangle; break;
-        case 4036:
-          type = SMDSEntity_Quad_Quadrangle; break;
-        case 4136:
-          type = SMDSEntity_BiQuad_Quadrangle; break;
-        case 4137:
-          type = SMDSEntity_BiQuad_Triangle; break;
-        case 4037:
-          type = SMDSEntity_Quad_Tetra; break;
-        case 4038:
-          type = SMDSEntity_Quad_Pyramid; break;
-        case 4039:
-          type = SMDSEntity_Quad_Penta; break;
-        case 4040:
-          type = SMDSEntity_Quad_Hexa; break;
-        case 4140:
-          type = SMDSEntity_TriQuad_Hexa; break;
+        case 4034: type = SMDSEntity_Quad_Edge; break;
+        case 4035: type = SMDSEntity_Quad_Triangle; break;
+        case 4036: type = SMDSEntity_Quad_Quadrangle; break;
+        case 4136: type = SMDSEntity_BiQuad_Quadrangle; break;
+        case 4137: type = SMDSEntity_BiQuad_Triangle; break;
+        case 4037: type = SMDSEntity_Quad_Tetra; break;
+        case 4038: type = SMDSEntity_Quad_Pyramid; break;
+        case 4039: type = SMDSEntity_Quad_Penta; break;
+        case 4040: type = SMDSEntity_Quad_Hexa; break;
+        case 4140: type = SMDSEntity_TriQuad_Hexa; break;
         default: break;
         }
         if ( type != SMDSEntity_Last )
@@ -3189,6 +3271,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
                                                     SUIT_MessageBox::No ) == SUIT_MessageBox::Yes;
           if( confirm ) {
             try {
+              SUIT_OverrideCursor wc;
               SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
               int removed = aMeshEditor->RemoveOrphanNodes();
               SUIT_MessageBox::information(SMESHGUI::desktop(),
@@ -3408,6 +3491,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
           SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
           SMESH::SMESH_GroupBase_var aGroup   = SMESH::SMESH_GroupBase::_narrow( aObject );
           if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
+            SUIT_OverrideCursor wc;
             ::Control( theCommandID );
             break;
           }
@@ -3424,8 +3508,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
                                tr( "NOT_A_VTK_VIEWER" ) );
     }
     break;
+  case 6032: 
+    OverallMeshQuality();
+    break;
   case 9010:
     {
+      SUIT_OverrideCursor wc;
       LightApp_SelectionMgr* mgr = selectionMgr();
       SALOME_ListIO selected; mgr->selectedObjects( selected );
 
@@ -3442,6 +3530,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
   case 9011:
     {
+      SUIT_OverrideCursor wc;
       LightApp_SelectionMgr* mgr = selectionMgr();
       SALOME_ListIO selected; mgr->selectedObjects( selected );
 
@@ -3464,6 +3553,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       dlg->show();
       break;
     }
+  case 41:
+    ::sortChildren();
+    break;
+
   }
 
   anApp->updateActions(); //SRN: To update a Save button in the toolbar
@@ -3651,6 +3744,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( 6029, "EQUAL_EDGE",      "ICON_EQUAL_EDGE",    0, true );
   createSMESHAction( 6030, "EQUAL_FACE",      "ICON_EQUAL_FACE",    0, true );
   createSMESHAction( 6031, "EQUAL_VOLUME",    "ICON_EQUAL_VOLUME",  0, true );
+  createSMESHAction( 6032, "OVERALL_MESH_QUALITY" );
   createSMESHAction( 6003, "FREE_BORDER",     "ICON_FREE_EDGE_2D",  0, true );
   createSMESHAction( 6004, "CONNECTION",      "ICON_CONNECTION",    0, true );
   createSMESHAction( 6005, "FREE_NODE",       "ICON_FREE_NODE",     0, true );
@@ -3760,6 +3854,8 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( 301, "SHOW" );
   createSMESHAction( 302, "DISPLAY_ONLY" );
 
+  createSMESHAction( 41, "SORT_CHILD_ITEMS" );
+
   // ----- create menu --------------
   int fileId    = createMenu( tr( "MEN_FILE" ),    -1,  1 ),
       editId    = createMenu( tr( "MEN_EDIT" ),    -1,  3 ),
@@ -3862,6 +3958,8 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( 6024, volumeId, -1 );
   createMenu( 6026, volumeId, -1 );
   createMenu( 6031, volumeId, -1 );
+  createMenu( separator(), ctrlId, -1 );
+  createMenu( 6032, ctrlId, -1 );
 
   createMenu( 4000, addId, -1 );
   createMenu( 4009, addId, -1 );
@@ -4106,6 +4204,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 214, OB, mesh_part );                   // UPDATE
   createPopupItem( 900, OB, mesh_part );                   // ADV_INFO
   createPopupItem( 904, OB, mesh_group );                  // FIND_ELEM
+  createPopupItem( 6032, OB, mesh_part );                  // CTRL_INFO
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 801, OB, mesh );                        // CREATE_GROUP
   createPopupItem( 806, OB, mesh );                        // CREATE_GEO_GROUP
@@ -4147,6 +4246,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 214, View, mesh_part );  // UPDATE
   createPopupItem( 900, View, mesh_part );  // ADV_INFO
+  createPopupItem( 6032,View, mesh_part );  // CTRL_INFO
   createPopupItem( 904, View, mesh );       // FIND_ELEM
   popupMgr()->insert( separator(), -1, 0 );
 
@@ -4391,7 +4491,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->insert ( action( 6031 ), aSubId, -1 ); // EQUAL_VOLUME
   popupMgr()->setRule( action( 6031 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
   popupMgr()->setRule( action( 6031 ), "controlMode = 'eCoincidentElems3D'", QtxPopupMgr::ToggleRule );
-
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
@@ -4438,6 +4538,10 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   popupMgr()->insert( separator(), -1, -1 );
 
+  popupMgr()->insert( action( 41 ), -1, -1 );
+  popupMgr()->setRule( action( 41 ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule );
+  popupMgr()->insert( separator(), -1, -1 );
+
   connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
            this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
 
@@ -4678,11 +4782,13 @@ void SMESHGUI::createPreferences()
   int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
 
   int autoUpdate = addPreference( tr( "PREF_AUTO_UPDATE" ), genTab, LightApp_Preferences::Auto, "SMESH", "auto_update" );
+  setPreferenceProperty( autoUpdate, "columns", 2 );
   int lim = addPreference( tr( "PREF_UPDATE_LIMIT" ), autoUpdate, LightApp_Preferences::IntSpin, "SMESH", "update_limit" );
   setPreferenceProperty( lim, "min",  0 );
   setPreferenceProperty( lim, "max",  100000000 );
   setPreferenceProperty( lim, "step", 1000 );
   setPreferenceProperty( lim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
+  addPreference( tr( "PREF_INCREMENTAL_LIMIT" ), autoUpdate, LightApp_Preferences::Bool, "SMESH", "incremental_limit" );
 
   int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab );
   setPreferenceProperty( qaGroup, "columns", 2 );
@@ -4767,10 +4873,16 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( nodesLim, "max", 10000000 );
   setPreferenceProperty( nodesLim, "step", 10000 );
   setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
+  int ctrlLim = addPreference( tr( "PREF_CTRL_LIMIT" ), infoGroup, LightApp_Preferences::IntSpin, "SMESH", "info_controls_limit" );
+  setPreferenceProperty( ctrlLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
+  setPreferenceProperty( ctrlLim, "min", 0 );
+  setPreferenceProperty( ctrlLim, "max", 10000000 );
+  setPreferenceProperty( ctrlLim, "step", 1000 );
   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" );
+  addPreference( tr( "PREF_DUMP_CTRL_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_ctrl" );
 
   int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
   setPreferenceProperty( segGroup, "columns", 2 );
index 1b990f0993335bb17081421af814348d3754373f..8a38ec5ec374d910a608ba6cdb32d42e4f6bc890 100644 (file)
@@ -100,6 +100,7 @@ public :
   bool                            isActiveStudyLocked();
 
   static bool                     automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0);
+  static bool                     automaticUpdate( SMESH::SMESH_Mesh_ptr, int*, bool* );
 
   static void                     Modified( bool = true );
 
index be3fc2f18660e1633254a0ad6d7af06d359f2b1b..ec8dd9523c348c0906e0ba6b9c4861b1c923f9c4 100644 (file)
@@ -33,6 +33,7 @@
 #include "SMESHGUI_MeshOrderOp.h"
 #include "SMESHGUI_MeshOrderDlg.h"
 
+#include "SMESH_Actor.h"
 #include "SMESH_ActorUtils.h"
 
 #include <SMDS_SetIterator.hxx>
@@ -91,6 +92,7 @@
 #include <QButtonGroup>
 #include <QCloseEvent>
 #include <QTimerEvent>
+#include <QProgressBar>
 
 // VTK includes
 #include <vtkProperty.h>
 #include <vector>
 #include <set>
 
+#ifndef WIN32
+#include <sys/sysinfo.h>
+#endif
+
 #define SPACING 6
 #define MARGIN  11
 
 #define COLONIZE(str)   (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
 
-/* OBSOLETE
-static void addSeparator( QWidget* parent )
-{
-  QGridLayout* l = qobject_cast<QGridLayout*>( parent->layout() );
-  int row  = l->rowCount();
-  int cols = l->columnCount();
-  for ( int i = 0; i < cols; i++ ) {
-    QFrame* hline = new QFrame( parent );
-    hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-    l->addWidget( hline, row, i );
-  }
-}
-*/
-
 enum TCol {
   COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
 };
@@ -740,25 +732,37 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
     qthread(gen, mesh, mainShape)
 {
   // --
-  setWindowTitle(tr("Compute"));
+  setWindowTitle(tr("TITLE"));
   setMinimumWidth( 200 );
 
-  cancelButton = new QPushButton(tr("Cancel"));
+  cancelButton = new QPushButton(tr("CANCEL"));
   cancelButton->setDefault(true);
+  cancelButton->setCheckable(true);
 
   QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
   QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this );
+  QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this );
   nbNodesLabel = new QLabel("0", this );
   nbElemsLabel = new QLabel("0", this );
+  freeRAMLabel = new QLabel("", this );
+  progressBar  = new QProgressBar(this);
+  progressBar->setMinimum( 0 );
+  progressBar->setMaximum( 1000 );
 
   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);
+  int row = 0;
+  layout->addWidget(nbNodesName,  row,   0);
+  layout->addWidget(nbNodesLabel, row++, 1);
+  layout->addWidget(nbElemsName,  row,   0);
+  layout->addWidget(nbElemsLabel, row++, 1);
+#ifndef WNT
+  layout->addWidget(freeRAMName,  row,   0);
+  layout->addWidget(freeRAMLabel, row++, 1);
+#endif
+  layout->addWidget(progressBar,  row++, 0, 1, 2);
+  layout->addWidget(cancelButton, row++, 0, 1, 2);
   adjustSize();
   update();
 
@@ -776,23 +780,40 @@ bool SMESHGUI_ComputeDlg_QThreadQDialog::result()
 void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel()
 {
   qthread.cancel();
-}  
+  cancelButton->setText( tr("CANCELING"));
+  cancelButton->setEnabled(false);
+}
 
 void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
 {
+  if ( !cancelButton->isChecked() ) // not yet cancelled
+    progressBar->setValue( progressBar->maximum() * qthread.getMesh()->GetComputeProgress() );
+
   if(qthread.isFinished())
-    {
-      close();
-    }
-  nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() ));
-  nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() ));
+  {
+    close();
+  }
+  else
+  {
+    nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() ));
+    nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() ));
+#ifndef WNT
+    struct sysinfo si;
+    const int err = sysinfo( &si );
+    if ( err )
+      freeRAMLabel->setText("");
+    else
+      freeRAMLabel->setText( tr("SMESH_GIGABYTE").arg
+                             ( si.freeram * si.mem_unit /1024./1024./1024., 0, 'f', 2 ));
+#endif
+  }
   event->accept();
 }
 
 void SMESHGUI_ComputeDlg_QThreadQDialog::closeEvent(QCloseEvent *event)
 {
   if(qthread.isRunning())
-    {
+  {
       event->ignore();
       return;
     }
@@ -839,13 +860,9 @@ void SMESHGUI_BaseComputeOp::computeMesh()
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
       OCC_CATCH_SIGNALS;
 #endif
-      bool res;
       SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape);
       qthreaddialog.exec();
-      res = qthreaddialog.result();
-      res = gen->Compute(myMesh, myMainShape);
-      if (res)
-        computeFailed = false;
+      computeFailed = !qthreaddialog.result();
     }
     catch(const SALOME::SALOME_Exception & S_ex) {
       memoryLack = true;
@@ -875,17 +892,31 @@ void SMESHGUI_BaseComputeOp::computeMesh()
       // SHOW MESH
       // NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
       SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
-      long newSize = myMesh->NbElements();
       bool limitExceeded;
+      long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
+      int entities = SMESH_Actor::eAllEntity;
       if ( !memoryLack )
       {
-        if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) )
+        if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) )
         {
           try {
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
             OCC_CATCH_SIGNALS;
 #endif
+            SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
+            if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );    
+
+            anActor->SetEntityMode( entities );
+            SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
+
             SMESH::Update(myIObject, true);
+
+            if ( limitExceeded )
+            {
+              SUIT_MessageBox::warning( desktop(),
+                                        tr( "SMESH_WRN_WARNING" ),
+                                        tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) );
+            }
           }
           catch (...) {
 #ifdef _DEBUG_
@@ -901,10 +932,9 @@ void SMESHGUI_BaseComputeOp::computeMesh()
         }
         else if ( limitExceeded )
         {
-          long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
           SUIT_MessageBox::warning( desktop(),
                                     tr( "SMESH_WRN_WARNING" ),
-                                    tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( newSize ).arg( limitSize ) );
+                                    tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) );
         }
       }
       LightApp_SelectionMgr *Sel = selectionMgr();
index 81a09f85760563b424a8353e8bb0f5aeffd1894a..d67709d3757c5e568067eb99b6038258ab95d94a 100644 (file)
@@ -49,6 +49,7 @@ class QPushButton;
 class QTableWidget;
 class QLabel;
 class QtxComboBox;
+class QProgressBar;
 class SMESHGUI_ComputeDlg;
 class SMESHGUI_MeshInfosBox;
 class SMESHGUI_PrecomputeDlg;
@@ -317,6 +318,8 @@ private:
   QPushButton *               cancelButton;
   QLabel *                    nbNodesLabel;
   QLabel *                    nbElemsLabel;
+  QLabel *                    freeRAMLabel;
+  QProgressBar*               progressBar;
 };
 
 #endif // SMESHGUI_COMPUTEDLG_H
index 27c1c9d66a1d00a6ae18172dac2becd5c9aa8265..24d4a37cb16e4fa32eb41159554f965daf968455 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
+#include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_VTKUtils.h"
 
 #include <SMESH_TypeFilter.hxx>
@@ -63,6 +64,7 @@
 #include <QKeyEvent>
 
 #include <utilities.h>
+#include <SALOMEDSClient_SObject.hxx>
 
 // IDL includes
 #include <SALOMEconfig.h>
@@ -107,6 +109,7 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
   SUIT_ResourceMgr* aResMgr = SMESH::GetResourceMgr( mySMESHGUI );
   QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES")));
   QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM")));
+  QPixmap iconElemOnly (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_ELEM_ONLY")));
   QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   // Main layout
@@ -125,11 +128,15 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
   aRadioButton1->setIcon(iconWithoutElem);
   QRadioButton* aRadioButton2 = new QRadioButton(aConstructorsBox);
   aRadioButton2->setIcon(iconWithElem);
+  QRadioButton* aRadioButton3 = new QRadioButton(aConstructorsBox);
+  aRadioButton3->setIcon(iconElemOnly);
   
   aConstructorsBoxLayout->addWidget(aRadioButton1);
   aConstructorsBoxLayout->addWidget(aRadioButton2);
+  aConstructorsBoxLayout->addWidget(aRadioButton3);
   myGroupConstructors->addButton(aRadioButton1, 0);
   myGroupConstructors->addButton(aRadioButton2, 1);
+  myGroupConstructors->addButton(aRadioButton3, 2);
 
   // Arguments
   myGroupArguments = new QGroupBox(this);
@@ -200,6 +207,9 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
   aMainLayout->addWidget(myGroupArguments);
   aMainLayout->addWidget(aGroupButtons);
   
+  myCheckBoxNewElemGroup->setChecked(true);
+  myCheckBoxNewNodeGroup->setChecked(true);
+
   // Initialize the dialog
   Init();
 
@@ -237,8 +247,6 @@ SMESHGUI_DuplicateNodesDlg::~SMESHGUI_DuplicateNodesDlg()
 void SMESHGUI_DuplicateNodesDlg::Init()
 {
   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-  myCheckBoxNewElemGroup->setChecked(true);
-  myCheckBoxNewNodeGroup->setChecked(true);
 
   // Set initial parameters
   myBusy = false;
@@ -294,6 +302,9 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
       myCheckBoxNewNodeGroup->show();
       
       // Hide the third field
+      myTextLabel2->show();
+      mySelectButton2->show();
+      myLineEdit2->show();
       myTextLabel3->hide();
       mySelectButton3->hide();
       myLineEdit3->hide();
@@ -312,10 +323,32 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
       myCheckBoxNewNodeGroup->show();
 
       // Show the third field
+      myTextLabel2->show();
+      mySelectButton2->show();
+      myLineEdit2->show();
       myTextLabel3->show();
       mySelectButton3->show();
       myLineEdit3->show();
 
+      break;
+    }
+  case 2:
+    {
+      // Set text to the group of arguments and to all the labels
+      myGroupArguments->setTitle(tr("DUPLICATION_ONLY_ELEMS"));
+      myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE"));
+      
+      myCheckBoxNewElemGroup->show();
+      myCheckBoxNewNodeGroup->hide();
+
+      // Hide the second and the third field
+      myTextLabel2->hide();
+      mySelectButton2->hide();
+      myLineEdit2->hide();
+      myTextLabel3->hide();
+      mySelectButton3->hide();
+      myLineEdit3->hide();
+
       break;
     }
   }
@@ -336,17 +369,20 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
  
   bool toCreateElemGroup = myCheckBoxNewElemGroup->isChecked();
   bool toCreateNodeGroup = myCheckBoxNewNodeGroup->isChecked();
-  int operationMode = myGroupConstructors->checkedId();
+  int operationMode      = myGroupConstructors->checkedId();
   
   // Apply changes
   bool result = false;
   SUIT_OverrideCursor aWaitCursor;
+  QStringList anEntryList;
 
   try {
     SMESH::SMESH_Mesh_var aMesh = myGroups1[0]->GetMesh();
     SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
 
-    if ( operationMode == 0 ) {
+    switch ( operationMode ) {
+    case 0:
+    {
       SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
       g1->length( myGroups1.count() );
       for ( int i = 0; i < myGroups1.count(); i++ )
@@ -364,8 +400,10 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
       else {
         result = aMeshEditor->DoubleNodeGroups( g1.in(), g2.in() );
       }
+      break;
     }
-    else {
+    case 1:
+    {
       SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
       g1->length( myGroups1.count() );
       for ( int i = 0; i < myGroups1.count(); i++ )
@@ -388,6 +426,31 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
       else {
         result = aMeshEditor->DoubleNodeElemGroups( g1.in(), g2.in(), g3.in() );
       }
+      break;
+    }
+    case 2:
+    {
+      result = true;
+      QString groupName;
+      if ( toCreateElemGroup )
+        groupName = SMESH::UniqueName("DoubleElements");
+      for ( int i = 0; i < myGroups1.count(); i++ )
+      {
+        SMESH::SMESH_Group_var group =
+          aMeshEditor->DoubleElements( myGroups1[i], groupName.toLatin1().data() );
+        if ( group->_is_nil() )
+        {
+          if ( toCreateElemGroup )
+            result = false;
+        }
+        else
+        {
+          if ( _PTR(SObject) so = SMESH::FindSObject( group ))
+            anEntryList.append( so->GetID().c_str() );
+        }
+      }
+      break;
+    }
     }
   }
   catch (const SALOME::SALOME_Exception& S_ex) {
@@ -396,7 +459,7 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
   catch ( const std::exception& exc ) {
     INFOS( "Follow exception was cought:\n\t" << exc.what() );
   } 
-  catch (...){
+  catch (...) {
     INFOS( "Unknown exception was cought !!!" );
   }
 
@@ -413,9 +476,14 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
   SMESHGUI::Modified();
   mySMESHGUI->updateObjBrowser(true);
 
+  if ( !anEntryList.isEmpty())
+    if( LightApp_Application* anApp =
+        dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ))
+      anApp->browseObjects( anEntryList, true, false );
+
   // Reinitialize the dialog
   Init();
-  
+
   return true;
 }
 
@@ -471,15 +539,20 @@ void SMESHGUI_DuplicateNodesDlg::onSelectionChanged()
     // check group of proper type is selected
     if ( ok ) {
       SMESH::ElementType aGroupType = aGroup->GetType();
-      if ( operationMode == 0 ) {
+      switch ( operationMode ) {
+      case 0:
         ok = ( myCurrentLineEdit == myLineEdit1 && aGroupType == SMESH::NODE ) ||
              ( myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE );
-      }
-      else {
+        break;
+      case 1:
         ok = ( myCurrentLineEdit == myLineEdit1 && ( aGroupType == SMESH::EDGE ||
                                                      aGroupType == SMESH::FACE ) ) ||
              ( myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE )     ||
              ( myCurrentLineEdit == myLineEdit3 && aGroupType != SMESH::NODE );
+        break;
+      case 2:
+        ok = ( aGroupType != SMESH::NODE );
+        break;
       }
     }
     if ( ok ) aGroups << aGroup;
@@ -533,7 +606,7 @@ void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument()
 
 /*!
   \brief Check if the input data is valid.
-  \return \c true id the data is valid
+  \return \c true if the data is valid
 */
 bool SMESHGUI_DuplicateNodesDlg::isValid()
 {
index d850c3071ebf3b1c75d52df534bbc1bdcbc4bc4b..498a72dad9aff3aedf291bb0f69ae41f6040ee50 100644 (file)
 //
 #include "SMESHGUI_FileInfoDlg.h"
 
-#include <MED_Common.hxx>
+#include "MED_Common.hxx"
 
 #include <QGridLayout>
 #include <QLabel>
 #include <QLineEdit>
 
-SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
+SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SMESH::MedFileInfo* inf )
   : QtxDialog( parent, true, true, QtxDialog::OK )
 {
   setWindowTitle( tr( "CAPTION" ) );
index a1264d9a242a1387051e3e0fc27010654deaeddc..2cab5a95bbc5f08737bedf0b320eba4ecbce0bfd 100644 (file)
 #include <QtxDialog.h>
 
 #include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(MED)
+#include CORBA_CLIENT_HEADER(SMESH_Mesh)
 
 class SMESHGUI_FileInfoDlg : public QtxDialog
 {
   Q_OBJECT
 
 public:
-  SMESHGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* );
+  SMESHGUI_FileInfoDlg( QWidget*, SMESH::MedFileInfo* );
   virtual ~SMESHGUI_FileInfoDlg();
 };
 
index 07f8a30a5cb2a966b399583e6d9c5976f109111b..df5618fc2b223224094f732b318fe3f6af22c96a 100755 (executable)
@@ -1765,184 +1765,215 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
   Table* aTable = myTables[ aType ];
   ComboItem* aCompareItem = (ComboItem*)aTable->item(row, 1);
 
-  int aCriterionType = GetCriterionType(row);
+  // find out type of a existing threshould table item
   QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(row, 2));
-  int aComboType = ComboItem::Type();
-  int aIntSpinType = IntSpinItem::Type();
-  int aDoubleSpinType = DoubleSpinItem::Type();
-  QTableWidgetItem* aTableItem = aTable->item(row, 2);
-  bool isComboItem = false;
-  bool isIntSpinItem = false;
-  bool isDoubleSpinItem = false;
-  if (aTableItem) {
-    int aTableType = aTable->item(row, 2)->type();
-    isComboItem = ( aTableType == aComboType );
-    isIntSpinItem = ( aTableType == aIntSpinType );
-    isDoubleSpinItem = ( aTableType == aDoubleSpinType );
+  bool isComboItem       = false;
+  bool isIntSpinItem     = false;
+  bool isDoubleSpinItem  = false;
+  if ( QTableWidgetItem* aTableItem = aTable->item(row, 2) )
+  {
+    int aTableType   = aTableItem->type();
+    isComboItem      = ( aTableType == ComboItem::Type() );
+    isIntSpinItem    = ( aTableType == IntSpinItem::Type() );
+    isDoubleSpinItem = ( aTableType == DoubleSpinItem::Type() );
+  }
+
+  // find out a type of item required by a new criterion and other table features
+  int aCriterionType       = GetCriterionType(row);
+  bool anIsDoubleCriterion = false;
+  bool anIsIntCriterion    = false;
+  bool anIsComboCriterion  = false;
+  // other features:
+  QList<int> comboIDs; // values to show in a combo item
+  int nbCompareSigns = 0; // possible values are 0,1,3
+  bool isThresholdEditable = false; // actual for "simple" item types
+  switch ( aCriterionType )
+  {
+  case SMESH::FT_AspectRatio:
+  case SMESH::FT_AspectRatio3D:
+  case SMESH::FT_Warping:
+  case SMESH::FT_MinimumAngle:
+  case SMESH::FT_Taper:
+  case SMESH::FT_Skew:
+  case SMESH::FT_Area:
+  case SMESH::FT_Volume3D:
+  case SMESH::FT_MaxElementLength2D:
+  case SMESH::FT_MaxElementLength3D:
+    anIsDoubleCriterion = true; nbCompareSigns = 3; break;
+
+  case SMESH::FT_FreeBorders:
+  case SMESH::FT_FreeEdges:
+  case SMESH::FT_FreeNodes:
+  case SMESH::FT_FreeFaces:
+  case SMESH::FT_EqualNodes:
+  case SMESH::FT_EqualEdges:
+  case SMESH::FT_EqualFaces:
+  case SMESH::FT_EqualVolumes: break;
+
+  case SMESH::FT_MultiConnection:
+  case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; break;
+
+  case SMESH::FT_Length:
+  case SMESH::FT_Length2D: anIsDoubleCriterion = true; break;
+
+  case SMESH::FT_BelongToGeom:
+  case SMESH::FT_BelongToPlane:
+  case SMESH::FT_BelongToCylinder:
+  case SMESH::FT_BelongToGenSurface:
+  case SMESH::FT_LyingOnGeom: nbCompareSigns = 1; isThresholdEditable = true; break;
+
+  case SMESH::FT_RangeOfIds: nbCompareSigns = 1; isThresholdEditable = true; break;
+
+  case SMESH::FT_BadOrientedVolume:
+  case SMESH::FT_BareBorderVolume:
+  case SMESH::FT_BareBorderFace:
+  case SMESH::FT_OverConstrainedVolume:
+  case SMESH::FT_OverConstrainedFace:
+  case SMESH::FT_LinearOrQuadratic: break;
+
+  case SMESH::FT_GroupColor: nbCompareSigns = 1; isThresholdEditable = true; break;
+
+  case SMESH::FT_ElemGeomType:
+    comboIDs = geomTypes( aType ); anIsComboCriterion = true; nbCompareSigns = 1; break;
+
+  case SMESH::FT_EntityType:
+    comboIDs = entityTypes( aType ); anIsComboCriterion = true; nbCompareSigns = 1; break;
+
+  case SMESH::FT_CoplanarFaces: isThresholdEditable = true; break;
+
+  case SMESH::FT_BallDiameter: anIsDoubleCriterion = true; break;
+
+  case SMESH::FT_ConnectedElements: isThresholdEditable = true; break;
+
+  case SMESH::FT_LessThan:
+  case SMESH::FT_MoreThan:
+  case SMESH::FT_EqualTo:
+  case SMESH::FT_LogicalNOT:
+  case SMESH::FT_LogicalAND:
+  case SMESH::FT_LogicalOR:
+  case SMESH::FT_Undefined:
+  default: return;
   }
-  
-  bool anIsDoubleCriterion =
-    aCriterionType == SMESH::FT_AspectRatio ||
-    aCriterionType == SMESH::FT_AspectRatio3D ||
-    aCriterionType == SMESH::FT_Taper ||
-    aCriterionType == SMESH::FT_Warping ||
-    aCriterionType == SMESH::FT_MinimumAngle ||
-    aCriterionType == SMESH::FT_Skew ||
-    aCriterionType == SMESH::FT_Area ||
-    aCriterionType == SMESH::FT_Length ||
-    aCriterionType == SMESH::FT_Length2D ||
-    aCriterionType == SMESH::FT_MaxElementLength2D ||
-    aCriterionType == SMESH::FT_MaxElementLength3D ||
-    aCriterionType == SMESH::FT_Volume3D ||
-    aCriterionType == SMESH::FT_EntityType;
+
+  // get a precision of a double criterion
   int aPrecision = 0;
   if ( anIsDoubleCriterion ) {
-    const char* aPrecisionType = getPrecision( aCriterionType );
+    const char*     aPrecisionType = getPrecision( aCriterionType );
     SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr( mySMESHGUI );
     if( aPrecisionType && aResourceMgr )
       aPrecision = aResourceMgr->integerValue( "SMESH", aPrecisionType, aPrecision );
   }
 
-  // if the precision is to be changed we should remove the existing
-  // spin item and create another one with new precision
-  bool anIsPrecisionChanged = false;
-  if ( anIsDoubleCriterion && isDoubleSpinItem ) {
-    if ( DoubleSpinItem* aDoubleSpinItem = dynamic_cast<DoubleSpinItem*>( aTable->item( row, 2 ) ) ) {
-      anIsPrecisionChanged = aDoubleSpinItem->precision() != aPrecision;
+  // check if the current item type satisfies the criterion
+  bool itemTypeKO =
+    ( aCriterionType == SMESH::FT_GroupColor && !clrBtn) ||
+    ( anIsComboCriterion                     && !isComboItem ) ||
+    ( anIsIntCriterion                       && !isIntSpinItem ) ||
+    ( anIsDoubleCriterion                    && !isDoubleSpinItem );
+
+  if ( !itemTypeKO )
+  {
+    if ( anIsDoubleCriterion )
+    {
+      // if the precision is to be changed we should remove the existing
+      // spin item and create another one with new precision
+      if ( DoubleSpinItem* aDoubleSpinItem = dynamic_cast<DoubleSpinItem*>( aTable->item( row, 2 )))
+        itemTypeKO = ( aDoubleSpinItem->precision() != aPrecision );
+      else
+        itemTypeKO = true;
+    }
+    else if ( anIsComboCriterion )
+    {
+      if ( ComboItem* aComboItem = dynamic_cast<ComboItem*>( aTable->item( row, 2 )))
+        itemTypeKO = ( aComboItem->count() != comboIDs.count() );
+      else
+        itemTypeKO = true;
+    }
+    else if ( !anIsIntCriterion && aCriterionType != SMESH::FT_GroupColor )
+    {
+      itemTypeKO = ( clrBtn || isComboItem || isIntSpinItem || isDoubleSpinItem );
     }
   }
 
-  if ( (aCriterionType != SMESH::FT_GroupColor && clrBtn) ||
-       (aCriterionType != SMESH::FT_ElemGeomType && isComboItem) ||
-       (aCriterionType != SMESH::FT_EntityType && isComboItem) ||
-       (aCriterionType != SMESH::FT_MultiConnection && isIntSpinItem) ||
-       (!anIsDoubleCriterion && isDoubleSpinItem) ||
-       anIsPrecisionChanged )
+  // update the table row
+
+  bool isSignalsBlocked = aTable->signalsBlocked();
+  aTable->blockSignals( true );
+
+  // update threshold table item
+  if ( itemTypeKO )
   {
-    bool isSignalsBlocked = aTable->signalsBlocked();
-    aTable->blockSignals( true );
     aTable->removeCellWidget( row, 2 );
-    aTable->setItem( row, 2, new QTableWidgetItem() );
-    aTable->blockSignals( isSignalsBlocked );
-  }
-  if ( (aCriterionType == SMESH::FT_GroupColor && !clrBtn) ||
-       (aCriterionType == SMESH::FT_ElemGeomType && !isComboItem) ||
-       (aCriterionType == SMESH::FT_EntityType && !isComboItem) ||
-       (aCriterionType == SMESH::FT_MultiConnection && !isIntSpinItem) ||
-       (anIsDoubleCriterion && !isDoubleSpinItem) ||
-       anIsPrecisionChanged )
-  {
-    bool isSignalsBlocked = aTable->signalsBlocked();
-    aTable->blockSignals( true );
-    if ( aCriterionType == SMESH::FT_GroupColor )
+
+    if ( aCriterionType == SMESH::FT_GroupColor ) // ---------------------- QtxColorButton
+    {
       aTable->setCellWidget( row, 2, new QtxColorButton( aTable ) );
-    else if ( aCriterionType == SMESH::FT_ElemGeomType ) {
-      QList<int> typeIds = geomTypes( aType );
-      QMap<int, QString> typeNames;
-      QList<int>::const_iterator anIter = typeIds.begin();
-      for ( int i = 0; anIter != typeIds.end(); ++anIter, ++i)
-      {
-        QString typeKey = QString( "GEOM_TYPE_%1" ).arg( *anIter );
-        typeNames[ *anIter ] = tr( typeKey.toLatin1().data() );
-      }
-      ComboItem* typeBox = new ComboItem( typeNames );
-      aTable->setItem( row, 2, typeBox );
-    }
-    else if ( aCriterionType == SMESH::FT_EntityType ) {
-      QList<int> typeIds = entityTypes( aType );
-      QMap<int, QString> typeNames;
-      QList<int>::const_iterator anIter = typeIds.begin();
-      for ( int i = 0; anIter != typeIds.end(); ++anIter, ++i)
+    }
+    else if ( anIsComboCriterion ) // -------------------------------------------ComboItem
+    {
+      QString msgPrefix
+        ( aCriterionType == SMESH::FT_ElemGeomType  ? "GEOM_TYPE_%1" :  "ENTITY_TYPE_%1" );
+      QMap<int, QString> names;
+      QList<int>::const_iterator id = comboIDs.begin();
+      for ( ; id != comboIDs.end(); ++id )
       {
-        QString typeKey = QString( "ENTITY_TYPE_%1" ).arg( *anIter );
-        typeNames[ *anIter ] = tr( typeKey.toLatin1().data() );
+        QString name = msgPrefix.arg( *id );
+        names[ *id ] = tr( name.toLatin1().data() );
       }
-      ComboItem* typeBox = new ComboItem( typeNames );
-      aTable->setItem( row, 2, typeBox );
+      ComboItem* comboBox = new ComboItem( names );
+      aTable->setItem( row, 2, comboBox );
     }
-    else if ( aCriterionType == SMESH::FT_MultiConnection ) {
+    else if ( anIsIntCriterion ) // ------------------------------------------ IntSpinItem
+    {
       IntSpinItem* intSpin = new IntSpinItem( 0 );
       aTable->setItem( row, 2, intSpin );
     }
-    else if ( anIsDoubleCriterion ) {
+    else if ( anIsDoubleCriterion ) // -------------------------------------DoubleSpinItem
+    {
       DoubleSpinItem* dblSpin = new DoubleSpinItem( 0 );
       dblSpin->setPrecision( aPrecision );
       aTable->setItem( row, 2, dblSpin );
     }
-    aTable->blockSignals( isSignalsBlocked );
-  }
-
-  // set Compare and enable/desable Threshold
-  if ((aType == SMESH::NODE && (aCriterionType == SMESH::FT_FreeNodes               ||
-                                aCriterionType == SMESH::FT_EqualNodes ))           ||
-      (aType == SMESH::EDGE && (aCriterionType == SMESH::FT_FreeBorders             ||
-                                aCriterionType == SMESH::FT_EqualEdges ))           ||
-      (aType == SMESH::FACE && (aCriterionType == SMESH::FT_BareBorderFace          ||
-                                aCriterionType == SMESH::FT_OverConstrainedFace     ||
-                                aCriterionType == SMESH::FT_FreeEdges               ||
-                                aCriterionType == SMESH::FT_FreeFaces               ||
-                                aCriterionType == SMESH::FT_EqualFaces))            ||
-      (aType == SMESH::VOLUME && (aCriterionType == SMESH::FT_BadOrientedVolume     ||
-                                  aCriterionType == SMESH::FT_OverConstrainedVolume ||
-                                  aCriterionType == SMESH::FT_BareBorderVolume      ||
-                                  aCriterionType == SMESH::FT_EqualVolumes ))       ||
-      aCriterionType == SMESH::FT_LinearOrQuadratic ||
-      aCriterionType == SMESH::FT_CoplanarFaces ||
-      aCriterionType == SMESH::FT_ConnectedElements
-      )
-  {
-    // - No compare
-    bool isSignalsBlocked = aTable->signalsBlocked();
-    aTable->blockSignals( true );
-
-    if (aCompareItem->count() > 0)
-      aCompareItem->clear();
-    aTable->setEditable(false, row, 1);
-    // - Threshold is NOT editable for most of criteria
-    aTable->item(row, 2)->setText( QString("") );
-    aTable->setEditable(( aCriterionType == SMESH::FT_ConnectedElements ||
-                          aCriterionType == SMESH::FT_CoplanarFaces       ), row, 2);
-    aTable->blockSignals( isSignalsBlocked );
-  }
-  else if (aCriterionType == SMESH::FT_RangeOfIds ||
-           aCriterionType == SMESH::FT_GroupColor ||
-           aCriterionType == SMESH::FT_ElemGeomType ||
-           aCriterionType == SMESH::FT_EntityType ||
-           aCriterionType == SMESH::FT_BelongToGeom ||
-           aCriterionType == SMESH::FT_BelongToPlane ||
-           aCriterionType == SMESH::FT_BelongToCylinder ||
-           aCriterionType == SMESH::FT_BelongToGenSurface ||
-           aCriterionType == SMESH::FT_LyingOnGeom)
-  {
-    // - EQUAL_TO compare ONLY
-    QMap<int, QString> aMap;
-    aMap[ SMESH::FT_EqualTo ] = tr("EQUAL_TO");
-    aCompareItem->setItems(aMap);
-    // if (!aTable->isEditable(row, 2))
-    aTable->setEditable(false, row, 1);
-    // - Threshold is editable
-    if (!aTable->isEditable(row, 2))
-      aTable->setEditable(true, row, 2);
+    else // --------------------------------------------------------------QTableWidgetItem
+    {
+      aTable->setItem( row, 2, new QTableWidgetItem() );
+    }
   }
-  else
+
+  // set Compare
+  if ( aCompareItem->count() != nbCompareSigns )
   {
-    // All compare signs
-    if (aCompareItem && aCompareItem->count() != 3)
-    {
+    switch ( nbCompareSigns ) {
+    case 0: {
+      aCompareItem->clear();
+      break;
+    }
+    case 1: {
+      QMap<int, QString> aMap;
+      aMap[ SMESH::FT_EqualTo ] = tr("EQUAL_TO");
+      aCompareItem->setItems(aMap);
+      break;
+    }
+    case 3: {
       aCompareItem->setItems(getCompare());
+      break;
     }
-    // Threshold is editable
-    if (aTable->item( row, 2 )) {
-      QString aText = aTable->text(row, 2);
-      bool isOk = false;
-      aText.toDouble(&isOk);
-      aTable->item( row, 2 )->setText(isOk ? aText : QString(""));
-      if (!aTable->isEditable(row, 1))
-        aTable->setEditable(true, row, 1);
-      if (!aTable->isEditable(row, 2))
-        aTable->setEditable(true, row, 2);
     }
   }
+  aTable->setEditable( nbCompareSigns == 3, row, 1);
+
+  // enable/desable Threshold
+  if ( aCriterionType == SMESH::FT_GroupColor ||
+       anIsComboCriterion ||
+       anIsIntCriterion ||
+       anIsDoubleCriterion )
+  {
+    isThresholdEditable = true;
+  }
+  aTable->setEditable( isThresholdEditable, row, 2);
+
+
+  aTable->blockSignals( isSignalsBlocked );
 
   updateAdditionalWidget();
 
index da396be6f65c10fe5f971b4955100c47f35f4404..a6e19527bbb9695a2ca4d184186aae4cfa39760b 100644 (file)
@@ -185,6 +185,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
   {
     QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
     GroupC1Layout->addWidget( lab, i, 0 );
+    myParamLabels << lab;
 
     QWidget* w = getCustomWidget( *anIt, GroupC1, i );
     if ( !w )
@@ -466,6 +467,22 @@ SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCrea
   return myParamWidgets;
 }
 
+//================================================================================
+/*!
+ * \brief Returns a QLabel of a spesified parameter.
+ * If isCreation(), the 1st label (supposed to be "Name") is not countered.
+ */
+//================================================================================
+
+QLabel* SMESHGUI_GenericHypothesisCreator::getLabel(int i) const
+{
+  if ( isCreation() )
+    i++;
+  if ( i < myParamLabels.size() )
+    return (QLabel*) myParamLabels.at(i);
+  return NULL;
+}
+
 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
 {
   return myDlg;
index 475763191d3844df55a9f5962d64346530dda03e..83da609d3cdcc04b7206f1dee4add797f8f1183b 100644 (file)
@@ -99,6 +99,7 @@ protected:
   bool                         hasInitParamsHypothesis() const;
   const ListOfWidgets&         widgets() const;
   ListOfWidgets&               changeWidgets();
+  QLabel*                      getLabel(int i) const;
   QtxDialog*                   dlg() const;
   QString                      getVariableName(const char* methodName) const;
 
@@ -134,6 +135,7 @@ private:
   QString                      myHypName;
   QString                      myHypType;
   ListOfWidgets                myParamWidgets;
+  ListOfWidgets                myParamLabels;
   bool                         myIsCreate;
   QtxDialog*                   myDlg;
   QString                      myShapeEntry;
index aad40cdb2c098427bce3f36cee01e701d1a8f5f0..786c72f9d48602341bc7d8a311371206f9f9df91 100644 (file)
 
 #include "SMESHGUI_MeshInfo.h"
 
-#include "SMESH_Actor.h"
-#include "SMESHGUI.h"
-#include "SMESHGUI_IdValidator.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
 #include "SMDSAbs_ElementType.hxx"
-#include "SMDS_Mesh.hxx"
 #include "SMDS_BallElement.hxx"
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_FacePosition.hxx"
+#include "SMDS_Mesh.hxx"
 #include "SMESHDS_Mesh.hxx"
-#include "SMESH_ControlsDef.hxx"
+#include "SMESHGUI.h"
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESH_Actor.h"
 
 #include <LightApp_SelectionMgr.h>
 #include <SUIT_FileDlg.h>
@@ -60,6 +61,7 @@
 #include <QLineEdit>
 #include <QMenu>
 #include <QPushButton>
+#include <QToolButton>
 #include <QRadioButton>
 #include <QTextStream>
 #include <QTabWidget>
@@ -71,6 +73,8 @@
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(GEOM_Gen)
 
+namespace {
+
 const int SPACING      = 6;
 const int MARGIN       = 9;
 const int MAXITEMS     = 10;
@@ -87,12 +91,12 @@ enum InfoType {
   NodeConnectivity = 100,
   ElemConnectivity,
 };
+} // namesapce
 
 /*!
   \class ExtraWidget
   \internal
 */
-
 class ExtraWidget : public QWidget
 {
 public:
@@ -150,6 +154,7 @@ public:
   QCheckBox* myBaseChk;
   QCheckBox* myElemChk;
   QCheckBox* myAddChk;
+  QCheckBox* myCtrlChk;
 };
 
 /*!
@@ -164,11 +169,13 @@ DumpFileDlg::DumpFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true,
     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 );
+    myCtrlChk = new QCheckBox( SMESHGUI::tr( "PREF_DUMP_CTRL_INFO" ), hB );
 
-    QHBoxLayout* layout = new QHBoxLayout( hB );
-    layout->addWidget( myBaseChk );
-    layout->addWidget( myElemChk );
-    layout->addWidget( myAddChk );
+    QGridLayout* layout = new QGridLayout( hB );
+    layout->addWidget( myBaseChk, 0, 0 );
+    layout->addWidget( myElemChk, 0, 1 );
+    layout->addWidget( myAddChk, 1, 0 );
+    layout->addWidget( myCtrlChk, 1, 1 );
 
     QPushButton* pb = new QPushButton( this );
 
@@ -418,13 +425,13 @@ SMESHGUI_MeshInfo::SMESHGUI_MeshInfo( QWidget* parent )
   l->addWidget( a3DHexPriTotal, 25, 1 );
   l->addWidget( a3DPolLab,   26, 0 );
   l->addWidget( a3DPolTotal, 26, 1 ); 
-  l->addWidget( myLoadBtn,   27, 1, 1, 3 );
+  l->addWidget( myLoadBtn,   28, 1, 1, 3 );
 
   l->setColumnStretch( 0, 0 );
   l->setColumnStretch( 1, 5 );
   l->setColumnStretch( 2, 5 );
   l->setColumnStretch( 3, 5 );
-  l->setRowStretch( 23, 5 );
+  l->setRowStretch( 27, 5 );
 
   clear();
 }
@@ -459,27 +466,13 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
     else if ( !aGroup->_is_nil() ) {
       QString objType;
       switch( aGroup->GetType() ) {
-      case SMESH::NODE:
-        objType = tr( "OBJECT_GROUP_NODES" );
-        break;
-      case SMESH::EDGE:
-        objType = tr( "OBJECT_GROUP_EDGES" );
-        break;
-      case SMESH::FACE:
-        objType = tr( "OBJECT_GROUP_FACES" );
-        break;
-      case SMESH::VOLUME:
-        objType = tr( "OBJECT_GROUP_VOLUMES" );
-        break;
-      case SMESH::ELEM0D:
-        objType = tr( "OBJECT_GROUP_0DELEMS" );
-        break;
-      case SMESH::BALL:
-        objType = tr( "OBJECT_GROUP_BALLS" );
-        break;
-      default:
-        objType = tr( "OBJECT_GROUP" );
-        break;
+      case SMESH::NODE:  objType = tr( "OBJECT_GROUP_NODES"   );break;
+      case SMESH::EDGE:  objType = tr( "OBJECT_GROUP_EDGES"   );break;
+      case SMESH::FACE:  objType = tr( "OBJECT_GROUP_FACES"   );break;
+      case SMESH::VOLUME:objType = tr( "OBJECT_GROUP_VOLUMES" );break;
+      case SMESH::ELEM0D:objType = tr( "OBJECT_GROUP_0DELEMS" );break;
+      case SMESH::BALL:  objType = tr( "OBJECT_GROUP_BALLS"   );break;
+      default:           objType = tr( "OBJECT_GROUP"         );break;
       }
       myWidgets[iObject][iSingle]->setProperty( "text", objType );
     }
@@ -495,7 +488,7 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
     long nbQuadrangles = info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle];
     long nb2DLinear    = info[SMDSEntity_Triangle] + info[SMDSEntity_Quadrangle] + info[SMDSEntity_Polygon];
     long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle];
-    myWidgets[i2D][iTotal]               ->setProperty( "text", QString::number( nb2DLinear + nb2DQuadratic ) );
+    myWidgets[i2D][iTotal]               ->setProperty( "text", QString::number( nb2DLinear + nb2DQuadratic ));
     myWidgets[i2D][iLinear]              ->setProperty( "text", QString::number( nb2DLinear ) );
     myWidgets[i2D][iQuadratic]           ->setProperty( "text", QString::number( nb2DQuadratic ) );
     myWidgets[i2DTriangles][iTotal]      ->setProperty( "text", QString::number( nbTriangles ) );
@@ -2242,7 +2235,7 @@ void SMESHGUI_AddInfo::meshInfo( SMESH::SMESH_Mesh_ptr mesh, QTreeWidgetItem* pa
 {
   // type
   GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh();
-  SALOME_MED::MedFileInfo* inf = mesh->GetMEDFileInfo();
+  SMESH::MedFileInfo* inf = mesh->GetMEDFileInfo();
   QTreeWidgetItem* typeItem = createItem( parent, Bold );
   typeItem->setText( 0, tr( "TYPE" ) );
   if ( !CORBA::is_nil( shape ) ) {
@@ -2653,6 +2646,11 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   myAddInfo = new SMESHGUI_AddInfo( myTabWidget );
   myTabWidget->addTab( myAddInfo, tr( "ADDITIONAL_INFO" ) );
 
+  // controls info
+
+  myCtrlInfo = new SMESHGUI_CtrlInfo( myTabWidget );
+  myTabWidget->addTab( myCtrlInfo, tr( "CTRL_INFO" ) );
+
   // buttons
 
   QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
@@ -2712,6 +2710,7 @@ void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO
   if ( !CORBA::is_nil( obj ) ) {
     myBaseInfo->showInfo( obj );
     myAddInfo->showInfo( obj );
+    myCtrlInfo->showInfo( obj );
 
     myActor = SMESH::FindActorByEntry( IO->getEntry() );
     SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
@@ -2782,7 +2781,7 @@ void SMESHGUI_MeshInfoDlg::updateSelection()
   disconnect( selMgr, 0, this, 0 );
   selMgr->clearFilters();
 
-  if ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo ) {
+  if ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo || myTabWidget->currentIndex() == CtrlInfo ) {
     SMESH::SetPointRepresentation( false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
       aViewWindow->SetSelectionMode( ActorSelection );
@@ -2933,11 +2932,13 @@ void SMESHGUI_MeshInfoDlg::dump()
   bool anIsBase = true;
   bool anIsElem = true;
   bool anIsAdd  = true;
+  bool anIsCtrl = 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 );
+    anIsCtrl = aResourceMgr->booleanValue( "SMESH", "info_dump_ctrl", anIsCtrl );
   }
 
   DumpFileDlg fd( this );
@@ -2946,6 +2947,7 @@ void SMESHGUI_MeshInfoDlg::dump()
   fd.myBaseChk->setChecked( anIsBase );
   fd.myElemChk->setChecked( anIsElem );
   fd.myAddChk ->setChecked( anIsAdd );
+  fd.myCtrlChk->setChecked( anIsCtrl );
   if ( fd.exec() == QDialog::Accepted )
   {
     QString aFileName = fd.selectedFile();
@@ -2953,6 +2955,7 @@ void SMESHGUI_MeshInfoDlg::dump()
     bool toBase = fd.myBaseChk->isChecked();
     bool toElem = fd.myElemChk->isChecked();
     bool toAdd  = fd.myAddChk->isChecked();
+    bool toCtrl = fd.myCtrlChk->isChecked();
 
     if ( !aFileName.isEmpty() ) {
       QFileInfo aFileInfo( aFileName );
@@ -2968,6 +2971,639 @@ void SMESHGUI_MeshInfoDlg::dump()
       if ( toBase ) myBaseInfo->saveInfo( out );
       if ( toElem ) myElemInfo->saveInfo( out );
       if ( toAdd )  myAddInfo ->saveInfo( out );
+      if ( toCtrl ) myCtrlInfo->saveInfo( out );
     }
   }
 }
+
+/*!
+  \class SMESHGUI_CtrlInfo
+  \brief Class for the mesh controls information widget.
+*/
+
+/*!
+  \brief Constructor
+  \param parent parent widget
+*/
+SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
+  : QFrame( parent ), myPlot( 0 ), myPlot3D( 0 )
+{
+  setFrameStyle( StyledPanel | Sunken );
+
+  myMainLayout = new QGridLayout( this );
+  myMainLayout->setMargin( MARGIN );
+  myMainLayout->setSpacing( SPACING );
+
+  // name
+  QLabel* aNameLab = new QLabel( tr( "NAME_LAB" ), this );
+  QLabel* aName = createField();
+  aName->setMinimumWidth( 150 );
+  myWidgets << aName;
+
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  QIcon aComputeIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_COMPUTE" ) ) );
+
+  SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
+
+  // nodes info
+  QLabel* aNodesLab = new QLabel( tr( "NODES_INFO" ), this );
+  QLabel* aNodesFreeLab = new QLabel( tr( "NUMBER_OF_THE_FREE_NODES" ), this );
+  QLabel* aNodesFree = createField();
+  myWidgets << aNodesFree;
+  myPredicates << aFilterMgr->CreateFreeNodes();
+  //
+  QLabel* aNodesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_NODES" ), this );
+  QLabel* aNodesDouble = createField();
+  myWidgets << aNodesDouble;
+  myPredicates << aFilterMgr->CreateEqualNodes();
+  QLabel* aToleranceLab = new QLabel( tr( "DOUBLE_NODES_TOLERANCE" ), this );
+  myToleranceWidget = new SMESHGUI_SpinBox( this );
+  myToleranceWidget->RangeStepAndValidator(0.0000000001, 1000000.0, 0.0000001, "length_precision" );
+  myToleranceWidget->setAcceptNames( false );
+  myToleranceWidget->SetValue( SMESHGUI::resourceMgr()->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 ) );
+
+  // edges info
+  QLabel* anEdgesLab = new QLabel( tr( "EDGES_INFO" ),  this );
+  QLabel* anEdgesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_EDGES" ),     this );
+  QLabel* anEdgesDouble = createField();
+  myWidgets << anEdgesDouble;
+  myPredicates << aFilterMgr->CreateEqualEdges();
+
+  // faces info
+  QLabel* aFacesLab = new QLabel( tr( "FACES_INFO" ), this );
+  QLabel* aFacesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_FACES" ), this );
+  QLabel* aFacesDouble = createField();
+  myWidgets << aFacesDouble;
+  myPredicates << aFilterMgr->CreateEqualFaces();
+  QLabel* aFacesOverLab = new QLabel( tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ), this );
+  QLabel* aFacesOver = createField();
+  myWidgets << aFacesOver;
+  myPredicates << aFilterMgr->CreateOverConstrainedFace();
+  QLabel* anAspectRatioLab = new QLabel( tr( "ASPECT_RATIO_HISTOGRAM" ), this );
+  myPlot = createPlot( this );
+  myAspectRatio = aFilterMgr->CreateAspectRatio();
+  // volumes info
+  QLabel* aVolumesLab = new QLabel( tr( "VOLUMES_INFO" ), this );
+  QLabel* aVolumesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_VOLUMES" ), this );
+  QLabel* aVolumesDouble = createField();
+  myWidgets << aVolumesDouble;
+  myPredicates << aFilterMgr->CreateEqualVolumes();
+  QLabel* aVolumesOverLab = new QLabel( tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ), this );
+  QLabel* aVolumesOver = createField();
+  myWidgets << aVolumesOver;
+  myPredicates << aFilterMgr->CreateOverConstrainedVolume();
+  QLabel* anAspectRatio3DLab = new QLabel( tr( "ASPECT_RATIO_3D_HISTOGRAM" ), this );
+  myPlot3D = createPlot( this );
+  myAspectRatio3D = aFilterMgr->CreateAspectRatio3D();
+
+  QToolButton* aFreeNodesBtn = new QToolButton( this );
+  aFreeNodesBtn->setIcon(aComputeIcon);
+  myButtons << aFreeNodesBtn;       //0
+
+  QToolButton* aDoubleNodesBtn = new QToolButton( this );
+  aDoubleNodesBtn->setIcon(aComputeIcon);
+  myButtons << aDoubleNodesBtn;     //1
+
+  QToolButton* aDoubleEdgesBtn = new QToolButton( this );
+  aDoubleEdgesBtn->setIcon(aComputeIcon);
+  myButtons << aDoubleEdgesBtn;     //2
+
+  QToolButton* aDoubleFacesBtn = new QToolButton( this );
+  aDoubleFacesBtn->setIcon(aComputeIcon);
+  myButtons << aDoubleFacesBtn;     //3
+
+  QToolButton* aOverContFacesBtn = new QToolButton( this );
+  aOverContFacesBtn->setIcon(aComputeIcon);
+  myButtons << aOverContFacesBtn;   //4
+
+  QToolButton* aComputeFaceBtn = new QToolButton( this );
+  aComputeFaceBtn->setIcon(aComputeIcon);
+  myButtons << aComputeFaceBtn;     //5
+
+  QToolButton* aDoubleVolumesBtn = new QToolButton( this );
+  aDoubleVolumesBtn->setIcon(aComputeIcon);
+  myButtons << aDoubleVolumesBtn;   //6
+
+  QToolButton* aOverContVolumesBtn = new QToolButton( this );
+  aOverContVolumesBtn->setIcon(aComputeIcon);
+  myButtons << aOverContVolumesBtn; //7
+
+  QToolButton* aComputeVolumeBtn = new QToolButton( this );
+  aComputeVolumeBtn->setIcon(aComputeIcon);
+  myButtons << aComputeVolumeBtn;   //8
+
+  connect( aComputeFaceBtn,   SIGNAL( clicked() ), this, SLOT( computeAspectRatio() ) );
+  connect( aComputeVolumeBtn, SIGNAL( clicked() ), this, SLOT( computeAspectRatio3D() ) );
+  connect( aFreeNodesBtn, SIGNAL( clicked() ), this, SLOT( computeFreeNodesInfo() ) );
+  connect( aDoubleNodesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleNodesInfo() ) );
+  connect( aDoubleEdgesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleEdgesInfo() ) );
+  connect( aDoubleFacesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleFacesInfo() ) );
+  connect( aOverContFacesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedFacesInfo() ) );
+  connect( aDoubleVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleVolumesInfo() ) );
+  connect( aOverContVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ) );
+  connect( myToleranceWidget, SIGNAL(valueChanged(double)), this, SLOT( setTolerance( double )));
+
+  setFontAttributes( aNameLab );
+  setFontAttributes( aNodesLab );
+  setFontAttributes( anEdgesLab );
+  setFontAttributes( aFacesLab );
+  setFontAttributes( aVolumesLab );
+
+  myMainLayout->addWidget( aNameLab,           0, 0 );       //0
+  myMainLayout->addWidget( aName,              0, 1, 1, 2 ); //1
+  myMainLayout->addWidget( aNodesLab,          1, 0, 1, 3 ); //2
+  myMainLayout->addWidget( aNodesFreeLab,      2, 0 );       //3
+  myMainLayout->addWidget( aNodesFree,         2, 1 );       //4
+  myMainLayout->addWidget( aFreeNodesBtn,      2, 2 );       //5
+  myMainLayout->addWidget( aNodesDoubleLab,    3, 0 );       //6
+  myMainLayout->addWidget( aNodesDouble,       3, 1 );       //7
+  myMainLayout->addWidget( aDoubleNodesBtn,    3, 2 );       //8
+  myMainLayout->addWidget( aToleranceLab,      4, 0 );       //9
+  myMainLayout->addWidget( myToleranceWidget,  4, 1 );       //10
+  myMainLayout->addWidget( anEdgesLab,         5, 0, 1, 3 ); //11
+  myMainLayout->addWidget( anEdgesDoubleLab,   6, 0 );       //12
+  myMainLayout->addWidget( anEdgesDouble,      6, 1 );       //13
+  myMainLayout->addWidget( aDoubleEdgesBtn,    6, 2 );       //14
+  myMainLayout->addWidget( aFacesLab,          7, 0, 1, 3 ); //15
+  myMainLayout->addWidget( aFacesDoubleLab,    8, 0 );       //16
+  myMainLayout->addWidget( aFacesDouble,       8, 1 );       //17
+  myMainLayout->addWidget( aDoubleFacesBtn,    8, 2 );       //18
+  myMainLayout->addWidget( aFacesOverLab,      9, 0 );       //19
+  myMainLayout->addWidget( aFacesOver,         9, 1 );       //20
+  myMainLayout->addWidget( aOverContFacesBtn,  9, 2 );       //21
+  myMainLayout->addWidget( anAspectRatioLab,   10, 0 );      //22
+  myMainLayout->addWidget( aComputeFaceBtn,    10, 2 );      //23
+  myMainLayout->addWidget( myPlot,             11, 0, 1, 3 );//24
+  myMainLayout->addWidget( aVolumesLab,        12, 0, 1, 3 );//25
+  myMainLayout->addWidget( aVolumesDoubleLab,  13, 0 );      //26
+  myMainLayout->addWidget( aVolumesDouble,     13, 1 );      //27
+  myMainLayout->addWidget( aDoubleVolumesBtn,  13, 2 );      //28
+  myMainLayout->addWidget( aVolumesOverLab,    14, 0 );      //28
+  myMainLayout->addWidget( aVolumesOver,       14, 1 );      //30
+  myMainLayout->addWidget( aOverContVolumesBtn,14, 2 );      //31
+  myMainLayout->addWidget( anAspectRatio3DLab, 15, 0 );      //32
+  myMainLayout->addWidget( aComputeVolumeBtn,  15, 2 );      //33
+  myMainLayout->addWidget( myPlot3D,           16, 0, 1, 3 );//34
+  myMainLayout->setColumnStretch(  0,  0 );
+  myMainLayout->setColumnStretch(  1,  5 );
+  myMainLayout->setRowStretch   ( 11,  5 );
+  myMainLayout->setRowStretch   ( 16,  5 );
+  myMainLayout->setRowStretch   ( 17,  1 );
+
+  clearInternal();
+}
+
+/*!
+  \brief Destructor
+*/
+SMESHGUI_CtrlInfo::~SMESHGUI_CtrlInfo()
+{}
+
+/*!
+  \brief Change widget font attributes (bold, ...).
+  \param w widget
+  \param attr font attributes (XORed flags)
+*/
+void SMESHGUI_CtrlInfo::setFontAttributes( QWidget* w )
+{
+  if ( w ) {
+    QFont f = w->font();
+    f.setBold( true );
+    w->setFont( f );
+  }
+}
+
+/*!
+  \brief Create info field
+  \return new info field
+*/
+QLabel* SMESHGUI_CtrlInfo::createField()
+{
+  QLabel* lab = new QLabel( this );
+  lab->setFrameStyle( StyledPanel | Sunken );
+  lab->setAlignment( Qt::AlignCenter );
+  lab->setAutoFillBackground( true );
+  QPalette pal = lab->palette();
+  pal.setColor( QPalette::Window, QApplication::palette().color( QPalette::Active, QPalette::Base ) );
+  lab->setPalette( pal );
+  lab->setMinimumWidth( 60 );
+  return lab;
+}
+
+/*!
+  \brief Create QwtPlot
+  \return new QwtPlot
+*/
+QwtPlot* SMESHGUI_CtrlInfo::createPlot( QWidget* parent )
+{
+  QwtPlot* aPlot = new QwtPlot( parent );
+  aPlot->setMinimumSize( 100, 100 );
+  QFont xFont = aPlot->axisFont( QwtPlot::xBottom );
+  xFont.setPointSize( 5 );
+  QFont yFont = aPlot->axisFont( QwtPlot::yLeft );
+  yFont.setPointSize( 5 );
+  aPlot->setAxisFont( QwtPlot::xBottom, xFont );
+  aPlot->setAxisFont( QwtPlot::yLeft, yFont );
+  aPlot->replot();
+  return aPlot;
+}
+
+/*!
+  \brief Show controls information on the selected object
+*/
+void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
+{
+  clearInternal();
+
+  myObject = SMESH::SMESH_IDSource::_duplicate( obj );
+  if ( myObject->_is_nil() ) return;
+
+  if ( _PTR(SObject) aSO = SMESH::FindSObject( obj ))
+    myWidgets[0]->setText( aSO->GetName().c_str() );
+
+  SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
+  if ( mesh->_is_nil() ) return;
+
+  const bool meshLoaded = mesh->IsLoaded();
+  if ( !meshLoaded ) // mesh not yet loaded from the hdf file
+    // enable Compute buttons, just in case obj->GetNbElementsByType() fails
+    for ( int i = 0; i < myButtons.count(); ++i )
+      myButtons[i]->setEnabled( true );
+
+  SMESH::long_array_var nbElemsByType = obj->GetNbElementsByType();
+  if ( ! &nbElemsByType.in() ) return;
+
+  const CORBA::Long ctrlLimit =
+    meshLoaded ? SMESHGUI::resourceMgr()->integerValue( "SMESH", "info_controls_limit", 3000 ) : -1;
+
+  // nodes info
+  const CORBA::Long nbNodes =   nbElemsByType[ SMESH::NODE ];
+  const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
+                                nbElemsByType[ SMESH::FACE ] +
+                                nbElemsByType[ SMESH::VOLUME ] );
+  if ( nbNodes + nbElems > 0 ) {
+    if ( Max( (int)nbNodes, (int)nbElems ) <= ctrlLimit ) {
+      // free nodes
+      computeFreeNodesInfo();
+      // double nodes
+      computeDoubleNodesInfo();
+    }
+    else {
+      myButtons[0]->setEnabled( true );
+      myButtons[1]->setEnabled( true );
+    }
+  }
+  else {
+    for( int i=2; i<=10; i++)
+      myMainLayout->itemAt(i)->widget()->setVisible( false );
+  }
+
+  // edges info
+  if ( nbElemsByType[ SMESH::EDGE ] > 0 ) {
+    // double edges
+    if( nbElemsByType[ SMESH::EDGE ] <= ctrlLimit )
+      computeDoubleEdgesInfo();
+    else
+      myButtons[2]->setEnabled( true );
+  }
+  else {
+    for( int i=11; i<=14; i++)
+      myMainLayout->itemAt(i)->widget()->setVisible( false );
+  }
+  // faces info
+  if ( nbElemsByType[ SMESH::FACE ] > 0 ) {
+    if ( nbElemsByType[ SMESH::FACE ] <= ctrlLimit ) {
+      // double faces
+      computeDoubleFacesInfo();
+      // over constrained faces
+      computeOverConstrainedFacesInfo();
+      // aspect Ratio histogram
+      computeAspectRatio();
+    }
+    else {
+      myButtons[3]->setEnabled( true );
+      myButtons[4]->setEnabled( true );
+      myButtons[5]->setEnabled( true );
+    }
+  }
+  else {
+    myMainLayout->setRowStretch(11,0);
+    for( int i=15; i<=24; i++)
+      myMainLayout->itemAt(i)->widget()->setVisible( false );
+  }
+
+  // volumes info
+  if ( nbElemsByType[ SMESH::VOLUME ] > 0 ) {
+    if ( nbElemsByType[ SMESH::VOLUME ] <= ctrlLimit ) {
+      // double volumes
+      computeDoubleVolumesInfo();
+      // over constrained volumes
+      computeOverConstrainedVolumesInfo();
+      // aspect Ratio 3D histogram
+      computeAspectRatio3D();
+     }
+     else {
+       myButtons[6]->setEnabled( true );
+       myButtons[7]->setEnabled( true );
+       myButtons[8]->setEnabled( true );
+     }
+  }
+  else {
+    myMainLayout->setRowStretch(16,0);
+    for( int i=25; i<=34; i++)
+      myMainLayout->itemAt(i)->widget()->setVisible( false );
+  }
+}
+
+//================================================================================
+/*!
+ * \brief Computes and shows nb of elements satisfying a given predicate
+ *  \param [in] ft - a predicate type (SMESH::FunctorType)
+ *  \param [in] iBut - index of one of myButtons to disable
+ *  \param [in] iWdg - index of one of myWidgets to show the computed number
+ */
+//================================================================================
+
+void SMESHGUI_CtrlInfo::computeNb( int ft, int iBut, int iWdg )
+{
+  myButtons[ iBut ]->setEnabled( false );
+  myWidgets[ iWdg ]->setText( "" );
+  if ( myObject->_is_nil() ) return;
+
+  SUIT_OverrideCursor wc;
+
+  SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
+  if ( !mesh->_is_nil() && !mesh->IsLoaded() )
+  {
+    mesh->Load();
+    this->showInfo( myObject ); // try to show all values
+    if ( !myWidgets[ iWdg ]->text().isEmpty() )
+      return; // <ft> predicate already computed
+  }
+  // look for a predicate of type <ft>
+  for ( int i = 0; i < myPredicates.count(); ++i )
+    if ( myPredicates[i]->GetFunctorType() == ft )
+    {
+      CORBA::Long nb = myPredicates[i]->NbSatisfying( myObject );
+      myWidgets[ iWdg ]->setText( QString::number( nb ));
+    }
+}
+
+void SMESHGUI_CtrlInfo::computeFreeNodesInfo()
+{
+  computeNb( SMESH::FT_FreeNodes, 0, 1 );
+}
+
+void SMESHGUI_CtrlInfo::computeDoubleNodesInfo()
+{
+  computeNb( SMESH::FT_EqualNodes, 1, 2 );
+}
+
+void SMESHGUI_CtrlInfo::computeDoubleEdgesInfo()
+{
+  computeNb( SMESH::FT_EqualEdges, 2, 3 );
+}
+
+void SMESHGUI_CtrlInfo::computeDoubleFacesInfo()
+{
+  computeNb( SMESH::FT_EqualFaces, 3, 4 );
+}
+
+void SMESHGUI_CtrlInfo::computeOverConstrainedFacesInfo()
+{
+  computeNb( SMESH::FT_OverConstrainedFace, 4, 5 );
+}
+
+void SMESHGUI_CtrlInfo::computeDoubleVolumesInfo()
+{
+  computeNb( SMESH::FT_EqualVolumes, 6, 6 );
+}
+
+void SMESHGUI_CtrlInfo::computeOverConstrainedVolumesInfo()
+{
+  computeNb( SMESH::FT_OverConstrainedVolume, 7, 7 );
+}
+
+void SMESHGUI_CtrlInfo::computeAspectRatio()
+{
+  myButtons[5]->setEnabled( false );
+
+  if ( myObject->_is_nil() ) return;
+
+  SUIT_OverrideCursor wc;
+
+  Plot2d_Histogram* aHistogram = getHistogram( myAspectRatio );
+  if ( aHistogram && !aHistogram->isEmpty() ) {
+    QwtPlotItem* anItem = aHistogram->createPlotItem();
+    anItem->attach( myPlot );
+    myPlot->replot();
+  }
+}
+
+void SMESHGUI_CtrlInfo::computeAspectRatio3D()
+{
+  myButtons[8]->setEnabled( false );
+
+  if ( myObject->_is_nil() ) return;
+
+  SUIT_OverrideCursor wc;
+
+  Plot2d_Histogram* aHistogram = getHistogram( myAspectRatio3D );
+  if ( aHistogram && !aHistogram->isEmpty() ) {
+    QwtPlotItem* anItem = aHistogram->createPlotItem();
+    anItem->attach( myPlot3D );
+    myPlot3D->replot();
+  }
+}
+
+/*!
+  \brief Internal clean-up (reset widget)
+*/
+void SMESHGUI_CtrlInfo::clearInternal()
+{
+  for( int i=0; i<=34; i++)
+    myMainLayout->itemAt(i)->widget()->setVisible( true );
+  for( int i=0; i<=8; i++)
+    myButtons[i]->setEnabled( false );
+  myPlot->detachItems();
+  myPlot3D->detachItems();
+  myPlot->replot();
+  myPlot3D->replot();
+  myWidgets[0]->setText( QString() );
+  for ( int i = 1; i < myWidgets.count(); i++ )
+    myWidgets[i]->setText( "" );
+  myMainLayout->setRowStretch(11,5);
+  myMainLayout->setRowStretch(16,5);
+}
+
+void SMESHGUI_CtrlInfo::setTolerance( double theTolerance )
+{
+  //SMESH::long_array_var anElems = getElementsByType( SMESH::NODE );
+  myButtons[1]->setEnabled( true );
+  myWidgets[2]->setText("");
+}
+
+Plot2d_Histogram* SMESHGUI_CtrlInfo::getHistogram( SMESH::NumericalFunctor_ptr aNumFun )
+{
+  SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
+  if ( mesh->_is_nil() ) return 0;
+  if ( !mesh->IsLoaded() )
+    mesh->Load();
+  aNumFun->SetMesh( mesh );
+
+  CORBA::Long cprecision = 6;
+  if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) ) 
+    cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
+  aNumFun->SetPrecision( cprecision );
+
+  int nbIntervals = SMESHGUI::resourceMgr()->integerValue( "SMESH", "scalar_bar_num_colors", false );
+
+  SMESH::Histogram_var histogramVar = aNumFun->GetLocalHistogram( nbIntervals,
+                                                                  /*isLogarithmic=*/false,
+                                                                  myObject );
+  Plot2d_Histogram* aHistogram = new Plot2d_Histogram();
+  aHistogram->setColor( palette().color( QPalette::Highlight ) );
+  if ( &histogramVar.in() )
+  {
+    for ( size_t i = 0, nb = histogramVar->length(); i < nb; i++ )
+      aHistogram->addPoint( 0.5 * ( histogramVar[i].min + histogramVar[i].max ), histogramVar[i].nbEvents );
+    if ( histogramVar->length() >= 2 )
+      aHistogram->setWidth( ( histogramVar[0].max - histogramVar[0].min ) * 0.8 );
+  }
+  return aHistogram;
+}
+
+void SMESHGUI_CtrlInfo::saveInfo( QTextStream &out ) {
+  out << QString( 20, '-' ) << "\n";
+  out << tr( "CTRL_INFO"  ) << "\n";
+  out << QString( 20, '-' ) << "\n";
+  out <<                                 tr( "NAME_LAB" )                       << "  " << myWidgets[0]->text() << "\n";
+  out <<                                 tr( "NODES_INFO" )                     << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_FREE_NODES" )       << ": " << myWidgets[1]->text() << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_NODES" )     << ": " << myWidgets[2]->text() << "\n";
+  out <<                                 tr( "EDGES_INFO" )                     << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_EDGES" )     << ": " << myWidgets[3]->text() << "\n";
+  out <<                                 tr( "FACES_INFO" )                     << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_FACES" )     << ": " << myWidgets[4]->text() << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[5]->text() << "\n";
+  out <<                                 tr( "VOLUMES_INFO" )                   << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_DOUBLE_VOLUMES" )   << ": " << myWidgets[6]->text() << "\n";
+  out << QString( SPACING_INFO, ' ' ) << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[7]->text() << "\n";
+}
+
+/*!
+  \class SMESHGUI_CtrlInfoDlg
+  \brief Controls information dialog box
+*/
+
+/*!
+  \brief Constructor
+  \param parent parent widget
+  \param page specifies the dialog page to be shown at the start-up
+*/
+SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent )
+: QDialog( parent )
+{
+  setAttribute( Qt::WA_DeleteOnClose, true );
+  setWindowTitle( tr( "CTRL_INFO" ) );
+  setMinimumSize( 400, 600 );
+
+  myCtrlInfo = new SMESHGUI_CtrlInfo( this );
+  
+  // buttons
+  QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
+  okBtn->setAutoDefault( true );
+  okBtn->setDefault( true );
+  okBtn->setFocus();
+
+  QGridLayout* l = new QGridLayout ( this );
+  l->setMargin( MARGIN );
+  l->setSpacing( SPACING );
+  l->addWidget( myCtrlInfo, 0, 0, 1, 3 );
+  l->addWidget( okBtn, 1, 1 );
+  l->setColumnStretch( 0, 5 );
+  l->setColumnStretch( 2, 5 );
+
+  connect( okBtn,                   SIGNAL( clicked() ),                      this, SLOT( reject() ) );
+  connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
+  connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) );
+
+  updateSelection();
+}
+
+/*!
+  \brief Destructor
+*/
+SMESHGUI_CtrlInfoDlg::~SMESHGUI_CtrlInfoDlg()
+{
+}
+
+/*!
+  \brief Show controls information
+  \param IO interactive object
+*/
+void SMESHGUI_CtrlInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO )
+{  
+  if ( SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO ) )
+    myCtrlInfo->showInfo( obj );
+}
+
+/*!
+  \brief Perform clean-up actions on the dialog box closing.
+*/
+void SMESHGUI_CtrlInfoDlg::reject()
+{
+  SMESH::SetPointRepresentation( false );
+  QDialog::reject();
+}
+
+/*!
+  \brief Setup selection mode depending on the current dialog box state.
+*/
+void SMESHGUI_CtrlInfoDlg::updateSelection()
+{
+  LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
+  disconnect( selMgr, 0, this, 0 );
+  SMESH::SetPointRepresentation( false );  
+  connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
+  updateInfo();  
+}
+
+/*!
+  \brief Show mesh information
+*/
+void SMESHGUI_CtrlInfoDlg::updateInfo()
+{
+  SUIT_OverrideCursor wc;
+
+  SALOME_ListIO selected;
+  SMESHGUI::selectionMgr()->selectedObjects( selected );
+
+  if ( selected.Extent() == 1 ) {
+    Handle(SALOME_InteractiveObject) IO = selected.First();
+    showInfo( IO );
+  }
+}
+
+/*!
+  \brief Activate dialog box
+*/
+void SMESHGUI_CtrlInfoDlg::activate()
+{
+  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+  SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this );
+  updateSelection();
+}
+
+/*!
+  \brief Deactivate dialog box
+*/
+void SMESHGUI_CtrlInfoDlg::deactivate()
+{
+  disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
+}
+
+
index 111a73b5b3accf20cf41abf0c2e41f3fc3029170..54c1013244e38aa91b8250558b79eb28d0c5c461 100644 (file)
@@ -26,7 +26,9 @@
 #define SMESHGUI_MESHINFO_H
 
 #include "SMESH_SMESHGUI.hxx"
-#include <SALOME_InteractiveObject.hxx>
+#include "SMESH_ControlsDef.hxx"
+
+#include <Plot2d_Histogram.h>
 
 #include <QFrame>
 #include <QDialog>
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_SERVER_HEADER(SMESH_Filter)
 
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_GenericObj_wrap.hxx>
+
+class QAbstractButton;
 class QButtonGroup;
 class QContextMenuEvent;
 class QLabel;
@@ -47,9 +54,11 @@ class QLineEdit;
 class QPushButton;
 class QTabWidget;
 class QTextBrowser;
+class QGridLayout;
 class SMESH_Actor;
 class SMDS_MeshNode;
 class SMDS_MeshElement;
+class SMESHGUI_SpinBox;
 
 class ExtraWidget;
 
@@ -280,6 +289,54 @@ private:
   SMESH::submesh_array_var mySubMeshes;
 };
 
+class SMESHGUI_EXPORT SMESHGUI_CtrlInfo : public QFrame
+{
+  Q_OBJECT;
+
+public:
+  SMESHGUI_CtrlInfo( QWidget* = 0 );
+  ~SMESHGUI_CtrlInfo();
+
+  void                  showInfo( SMESH::SMESH_IDSource_ptr );
+  void                  saveInfo( QTextStream &out );
+
+private:
+  enum ObjectType { Mesh, SubMesh, Group };
+  QLabel*               createField();
+  QwtPlot*              createPlot( QWidget* );
+  void                  setFontAttributes( QWidget* );
+  void                  clearInternal();
+  Plot2d_Histogram*     getHistogram( SMESH::NumericalFunctor_ptr functor );
+  void                  computeNb( int ft, int iBut, int iWdg );
+
+private slots:
+  void                  computeAspectRatio();
+  void                  computeAspectRatio3D();
+  void                  computeFreeNodesInfo();
+  void                  computeDoubleNodesInfo();
+  void                  computeDoubleEdgesInfo();
+  void                  computeDoubleFacesInfo();
+  void                  computeOverConstrainedFacesInfo();
+  void                  computeDoubleVolumesInfo();
+  void                  computeOverConstrainedVolumesInfo();
+  void                  setTolerance( const double theTolerance );
+  
+
+private:
+  typedef SALOME::GenericObj_wrap< SMESH::Predicate >        TPredicate;
+  typedef SALOME::GenericObj_wrap< SMESH::NumericalFunctor > TNumFunctor;
+  SMESH::SMESH_IDSource_var myObject;
+  ObjectType                myObjectType;
+  SMESHGUI_SpinBox*         myToleranceWidget;
+  QList<QLabel*>            myWidgets;
+  QGridLayout*              myMainLayout;
+  QwtPlot*                  myPlot;
+  QwtPlot*                  myPlot3D;
+  QList<QAbstractButton*>   myButtons;
+  QList<TPredicate>         myPredicates;
+  TNumFunctor               myAspectRatio, myAspectRatio3D;
+};
+
 class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
 { 
   Q_OBJECT;
@@ -291,7 +348,8 @@ public:
   enum { 
     BaseInfo,  //!< base mesh information
     ElemInfo,  //!< mesh element information
-    AddInfo    //!< additional information
+    AddInfo,   //!< additional information
+    CtrlInfo //!< controls information
   };
 
   SMESHGUI_MeshInfoDlg( QWidget* = 0, int = BaseInfo );
@@ -323,7 +381,29 @@ private:
   QLineEdit*         myID;
   SMESHGUI_ElemInfo* myElemInfo;   
   SMESHGUI_AddInfo*  myAddInfo;
+  SMESHGUI_CtrlInfo* myCtrlInfo;
   SMESH_Actor*       myActor;
 };
 
+class SMESHGUI_EXPORT SMESHGUI_CtrlInfoDlg : public QDialog
+{ 
+  Q_OBJECT;
+
+public:
+  SMESHGUI_CtrlInfoDlg( QWidget* = 0 );
+  ~SMESHGUI_CtrlInfoDlg();
+
+  void showInfo( const Handle(SALOME_InteractiveObject)& );
+  void reject();
+
+private slots:
+  void updateInfo();
+  void activate();
+  void deactivate();
+  void updateSelection();
+
+private:
+  SMESHGUI_CtrlInfo*  myCtrlInfo;
+};
+
 #endif // SMESHGUI_MESHINFO_H
index 110b80f0edd195b251c0522bda67cb1ad8dc0816..b6036d4de0a2527fa93899410bdef242b9a61bbe 100644 (file)
@@ -95,6 +95,7 @@ namespace SMESH
       if ( !p ) p = aStudy->FindComponent( "SMESH" );
       if ( p ) {
         _PTR(ChildIterator) iter = aStudy->NewChildIterator( p );
+        iter->InitEx(/*allLevels=*/true);
         int idx = 0;
         while( true ) {
           bool found = false;
index 8c7ebc2c2b989bc4dff57f69d5a56c6ee1bce265..86a9292141693bf30ae063814bd47c386ffec12d 100644 (file)
@@ -127,6 +127,9 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
   else if ( p=="groupType" )     val = QVariant( groupType( ind ) );
   else if ( p=="quadratic2DMode") val =  QVariant(quadratic2DMode(ind));
   else if ( p=="isDistributionVisible") val = QVariant(isDistributionVisible(ind));
+  else if ( p=="hasChildren") val = QVariant(hasChildren(ind));
+  else if ( p=="nbChildren") val = QVariant(nbChildren(ind));
+  else if ( p=="isContainer") val = QVariant(isContainer(ind));
 
   if( val.isValid() )
     return val;
@@ -529,6 +532,50 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const
   return QVariant( false );
 }
 
+//=======================================================================
+//function : hasChildren
+//purpose  : 
+//=======================================================================
+
+bool SMESHGUI_Selection::hasChildren( int ind ) const
+{
+  if ( ind >= 0 )
+  {
+    _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+    return SMESH::GetActiveStudyDocument()->GetUseCaseBuilder()->HasChildren( sobj );
+  }
+  return false;
+}
+
+//=======================================================================
+//function : hasChildren
+//purpose  : 
+//=======================================================================
+
+int SMESHGUI_Selection::nbChildren( int ind ) const
+{
+  int nb = 0;
+  if ( ind >= 0 )
+  {
+    _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+    if ( sobj->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode( sobj ) ) {
+      _PTR(UseCaseIterator) it = sobj->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( sobj ); 
+      for (it->Init(false); it->More(); it->Next()) nb++;
+    }
+  }
+  return nb;
+}
+
+//=======================================================================
+//function : isContainer
+//purpose  : 
+//=======================================================================
+
+bool SMESHGUI_Selection::isContainer( int ind ) const
+{
+  return ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Unknown";
+}
+
 //=======================================================================
 //function : type
 //purpose  : 
@@ -653,7 +700,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_var inf = aMesh->GetMEDFileInfo();
+      SMESH::MedFileInfo_var inf = aMesh->GetMEDFileInfo();
       res = strlen( (char*)inf->fileName ) > 0;
     }
   }
index 4358bab072531f67bdd4658cf4609952818710a0..5f2a50bdb7f0d94860e0920f730f89ef39606e4d 100644 (file)
@@ -63,6 +63,9 @@ public:
   virtual QString         quadratic2DMode(int ) const;
 
   virtual bool            isDistributionVisible(int ) const;
+  virtual bool            hasChildren( int ) const;
+  virtual int             nbChildren( int ) const;
+  virtual bool            isContainer( int ) const;
 
   // parameters got from actor return nothing if an actor is not visible
   virtual QList<QVariant> elemTypes( int ) const;
index 1abc292e4d407878da371ac1b7bc5aabe3be2d7b..29c51666cda4ee5e42adc998654e9fcffec3ebee 100644 (file)
@@ -103,9 +103,6 @@ private:
 #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
 
 //=================================================================================
 // class    : SMESHGUI_TranslationDlg()
@@ -509,84 +506,80 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
       switch ( actionButton ) {
       case MOVE_ELEMS_BUTTON:
         if(CheckBoxMesh->isChecked())
-         for ( int i = 0; i < myObjects.count(); i++ ) {
-           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
-           myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
-           aMeshEditor->TranslateObject(myObjects[i], aVector, false);
-         }
+          for ( int i = 0; i < myObjects.count(); i++ ) {
+            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+            myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+            aMeshEditor->TranslateObject(myObjects[i], aVector, false);
+          }
         else {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
-         myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+          myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
           aMeshEditor->Translate(anElementsId, aVector, false);
-       }
+        }
         break;
       case COPY_ELEMS_BUTTON:
         if ( makeGroups ) {
           SMESH::ListOfGroups_var groups;
           if(CheckBoxMesh->isChecked()) {
-           for ( int i = 0; i < myObjects.count(); i++ ) {
-             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
-             myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
-             groups = aMeshEditor->TranslateObjectMakeGroups(myObjects[i],aVector);
-           }
-         }
+            for ( int i = 0; i < myObjects.count(); i++ ) {
+              SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+              myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+              groups = aMeshEditor->TranslateObjectMakeGroups(myObjects[i],aVector);
+            }
+          }
           else {
-           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
-           myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+            myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
             groups = aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
-         }
+          }
         }
         else {
           if(CheckBoxMesh->isChecked()) {
-           for ( int i = 0; i < myObjects.count(); i++ ) {
-             SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
-             myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
-             aMeshEditor->TranslateObject(myObjects[i], aVector, true);
-           }
-         }
+            for ( int i = 0; i < myObjects.count(); i++ ) {
+              SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+              myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+              aMeshEditor->TranslateObject(myObjects[i], aVector, true);
+            }
+          }
           else {
-           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
-           myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+            myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
             aMeshEditor->Translate(anElementsId, aVector, true);
-         }
+          }
         }
         break;
       case MAKE_MESH_BUTTON: {
         SMESH::SMESH_Mesh_var mesh;
         if (CheckBoxMesh->isChecked()) {
-         for ( int i = 0; i < myObjects.count(); i++ ) {
-           QString aName = SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ) );
-           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
-           myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
-           mesh = aMeshEditor->TranslateObjectMakeMesh(myObjects[i], aVector, makeGroups,
-                                                       aName.toLatin1().data());
-           if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
-             anEntryList.append( aSObject->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
-           mesh->UnRegister();
-#endif
-         }
-       }
-       else {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
-         myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
-         mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
+          for ( int i = 0; i < myObjects.count(); i++ ) {
+            QString aName = SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ) );
+            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+            myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+            mesh = aMeshEditor->TranslateObjectMakeMesh(myObjects[i], aVector, makeGroups,
+                                                        aName.toLatin1().data());
+            if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+              anEntryList.append( aSObject->GetID().c_str() );
+
+            // 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
+            mesh->UnRegister();
+          }
+        }
+        else {
+          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+          myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
+          mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
                                                 LineEditNewMesh->text().toLatin1().data());
           if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
             anEntryList.append( aSObject->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
           mesh->UnRegister();
-#endif
-       }
-       break;
+        }
+        break;
       }
       }
     } catch (...) {
@@ -762,26 +755,26 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
       Handle(SALOME_InteractiveObject) IO = it.Value();
       SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
       if ( aMesh->_is_nil() )
-       return;
+        return;
 
       SMESH_Actor* anActor = SMESH::FindActorByObject( aMesh );
       if ( !anActor )
-       anActor = SMESH::FindActorByEntry( IO->getEntry() );
+        anActor = SMESH::FindActorByEntry( IO->getEntry() );
 
       if ( !anActor && !CheckBoxMesh->isChecked() )
-       return;
+        return;
 
       if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
-       if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
-         _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
-         _PTR(GenericAttribute) anAttr;
-         if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
-           _PTR(AttributeName) aNameAttr( anAttr );
-           myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
-           myObjectsNames << aNameAttr->Value().c_str();
-           myMeshes << aMesh;
-         }
-       }
+        if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
+          _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
+          _PTR(GenericAttribute) anAttr;
+          if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
+            _PTR(AttributeName) aNameAttr( anAttr );
+            myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
+            myObjectsNames << aNameAttr->Value().c_str();
+            myMeshes << aMesh;
+          }
+        }
       }
 
       myActor = anActor;
@@ -803,7 +796,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
     if (CheckBoxMesh->isChecked()) {
       SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
       if (myMeshes.isEmpty())
-       return;
+        return;
     } else {
       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
       myElementsId = aString;
@@ -1151,19 +1144,19 @@ void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview ) {
         bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON ||
                       ActionGroup->checkedId() == MAKE_MESH_BUTTON );
         SUIT_OverrideCursor aWaitCursor;
-       QList<SMESH::MeshPreviewStruct_var> aMeshPreviewStruct;
+        QList<SMESH::MeshPreviewStruct_var> aMeshPreviewStruct;
         if(CheckBoxMesh->isChecked())
-         for ( int i = 0; i < myObjects.count(); i++ ) {
-           SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
-           aMeshEditor->TranslateObject(myObjects[i], aVector, copy);
-           aMeshPreviewStruct << aMeshEditor->GetPreviewData();
-         }
+          for ( int i = 0; i < myObjects.count(); i++ ) {
+            SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
+            aMeshEditor->TranslateObject(myObjects[i], aVector, copy);
+            aMeshPreviewStruct << aMeshEditor->GetPreviewData();
+          }
         else {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
+          SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
           aMeshEditor->Translate(anElementsId, aVector, copy);
-         aMeshPreviewStruct << aMeshEditor->GetPreviewData();
-       }
-       setSimulationPreview( aMeshPreviewStruct );
+          aMeshPreviewStruct << aMeshEditor->GetPreviewData();
+        }
+        setSimulationPreview( aMeshPreviewStruct );
       } catch (...) {
         
       }
index 17eafcde31fff18216279f7776ab8890d18283ea..a8fa7fd738cb47ab5724c14d31933bdc1d13ab55 100644 (file)
@@ -51,7 +51,7 @@
             <source>ICON_CONNECTION_2D</source>
             <translation>mesh_multi_edges_2d.png</translation>
         </message>
-       <message>
+        <message>
             <source>ICON_CREATE_GROUP</source>
             <translation>mesh_group.png</translation>
         </message>
             <source>ICON_FREE_EDGE</source>
             <translation>mesh_free_edges.png</translation>
         </message>
-       <message>
+        <message>
             <source>ICON_FREE_EDGE_2D</source>
             <translation>mesh_free_edges_2d.png</translation>
         </message>
-       <message>
+        <message>
             <source>ICON_FREE_NODE</source>
             <translation>mesh_free_nodes.png</translation>
         </message>
             <source>ICON_REORIENT_2D</source>
             <translation>reorient_faces_face.png</translation>
         </message>
-       <message>
+        <message>
             <source>ICON_SMESH_DUPLICATE_NODES</source>
             <translation>mesh_duplicate_nodes.png</translation>
         </message>
-       <message>
+        <message>
             <source>ICON_SMESH_DUPLICATE_NODES_WITH_ELEM</source>
             <translation>mesh_duplicate_nodes_with_elem.png</translation>
+        </message>
+           <message>
+            <source>ICON_SMESH_DUPLICATE_ELEM_ONLY</source>
+            <translation>mesh_duplicate_elem_only.png</translation>
         </message>
         <message>
             <source>ICON_SMESH_TREE_ALGO</source>
index c10c3bad0d066a6b6df8cd4ea16371104255f900..6a8b6750f79bd7df7514a1a40bc7ef83e70b5a23 100644 (file)
         <source>MEN_RESET</source>
         <translation>Reset</translation>
     </message>
+    <message>
+        <source>MEN_OVERALL_MESH_QUALITY</source>
+        <translation>Overall Mesh Quality</translation>
+    </message>
     <message>
         <source>MEN_DISTRIBUTION_CTRL</source>
         <translation>Distribution</translation>
     </message>
     <message>
         <source>MEN_DUPLICATE_NODES</source>
-        <translation>Duplicate Nodes</translation>
+        <translation>Duplicate Nodes or/and Elements</translation>
     </message>
     <message>
         <source>MEN_TRANSF</source>
@@ -1269,6 +1273,10 @@ Please enter correct values and try again</translation>
         <source>SMESH_AUTO_GROUPS</source>
         <translation>Automatically create groups</translation>
     </message>
+    <message>
+        <source>SMESH_AUTO_DIM</source>
+        <translation>Automatically define space dimension</translation>
+    </message>
     <message>
         <source>SMESH_REQUIRED_GROUPS</source>
         <translation>Create groups of required entities</translation>
@@ -2555,7 +2563,7 @@ Check algorithm documentation for supported geometry</translation>
     </message>
     <message>
         <source>SMESH_DUPLICATE_TITLE</source>
-        <translation>Duplicate Nodes</translation>
+        <translation>Duplicate Nodes and/or Elements</translation>
     </message>
     <message>
         <source>SMESH_SCALE</source>
@@ -2711,6 +2719,12 @@ Consider saving your work before application crash</translation>
         <source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
         <translation>No automatic update of the presentation has been done: new mesh size (%1 elements) exceeds current size limit (%2 elements).
 Please check preferences of Mesh module.
+</translation>
+    </message>
+    <message>
+        <source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
+        <translation>New mesh sise (%1 elements) exceeds current size limit (%2 elements).
+Not all mesh elements are shown. Please check preferences of Mesh module.
 </translation>
     </message>
     <message>
@@ -3283,7 +3297,7 @@ Please check preferences of Mesh module.
     </message>
     <message>
         <source>STB_DUPLICATE_NODES</source>
-        <translation>Duplicate Nodes</translation>
+        <translation>Duplicate Nodes or/and Elements</translation>
     </message>
     <message>
         <source>STB_TRANSP</source>
@@ -3891,7 +3905,7 @@ Please check preferences of Mesh module.
     </message>
     <message>
         <source>TOP_DUPLICATE_NODES</source>
-        <translation>Duplicate Nodes</translation>
+        <translation>Duplicate Nodes or/and Elements</translation>
     </message>
     <message>
         <source>TOP_TRANSP</source>
@@ -4092,6 +4106,22 @@ Input value precision can be adjusted using
         <translation>Selected object has been used to create another one.
 It can&apos;t be deleted </translation>
     </message>
+    <message>
+        <source>SMESH_FREERAM</source>
+        <translation>Free RAM</translation>
+    </message>
+    <message>
+        <source>SMESH_GIGABYTE</source>
+        <translation>%1 GB</translation>
+    </message>
+    <message>
+        <source>MEN_SORT_CHILD_ITEMS</source>
+        <translation>Sort children</translation>
+    </message>
+    <message>
+        <source>STB_SORT_CHILD_ITEMS</source>
+        <translation>Sort child items</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_Dialog</name>
@@ -4151,6 +4181,10 @@ Please, create VTK viewer and try again</translation>
         <source>PREF_UPDATE_LIMIT_NOLIMIT</source>
         <translation>No limit</translation>
     </message>
+    <message>
+        <source>PREF_INCREMENTAL_LIMIT</source>
+        <translation>Incremental limit check</translation>
+    </message>
     <message>
         <source>PREF_BACKFACE</source>
         <translation>Back surface color</translation>
@@ -4263,10 +4297,18 @@ Please, create VTK viewer and try again</translation>
         <source>PREF_DUMP_ADD_INFO</source>
         <translation>Dump additional information</translation>
     </message>
+    <message>
+        <source>PREF_DUMP_CTRL_INFO</source>
+        <translation>Dump controls information</translation>
+    </message>
     <message>
         <source>PREF_GPP_NODES_LIMIT</source>
         <translation>Automatic nodes compute limit</translation>
     </message>
+    <message>
+        <source>PREF_CTRL_LIMIT</source>
+        <translation>Automatic controls compute limit</translation>
+    </message>
     <message>
         <source>SMESH_PREF_GROUP_PRECISION</source>
         <translation>Input fields precision</translation>
@@ -4617,6 +4659,21 @@ Please, create VTK viewer and try again</translation>
         <translation>Bad Mesh to Group</translation>
     </message>
 </context>
+<context>
+    <name>SMESHGUI_ComputeDlg_QThreadQDialog</name>
+    <message>
+        <source>CANCEL</source>
+        <translation>Cancel</translation>
+    </message>
+    <message>
+        <source>CANCELING</source>
+        <translation>Canceling...</translation>
+    </message>
+    <message>
+        <source>TITLE</source>
+        <translation>Compute</translation>
+    </message>
+</context>
 <context>
     <name>SMESHGUI_PrecomputeDlg</name>
     <message>
@@ -6463,7 +6520,7 @@ It is impossible to read point coordinates from file</translation>
     </message>
     <message>
         <source>DUPLICATION_WITHOUT_ELEMS</source>
-        <translation>Without duplication of border elements</translation>
+        <translation>Duplicate nodes only</translation>
     </message>
     <message>
         <source>GROUP_NODES_TO_DUPLICATE</source>
@@ -6475,7 +6532,11 @@ It is impossible to read point coordinates from file</translation>
     </message>
     <message>
         <source>DUPLICATION_WITH_ELEMS</source>
-        <translation>With duplication of border elements</translation>
+        <translation>Duplicate nodes and border elements</translation>
+    </message>
+    <message>
+        <source>DUPLICATION_ONLY_ELEMS</source>
+        <translation>Duplicate elements only</translation>
     </message>
     <message>
         <source>GROUP_ELEMS_TO_DUPLICATE</source>
@@ -6739,6 +6800,10 @@ as they are of improper type:
         <source>ADDITIONAL_INFO</source>
         <translation>Additional Info</translation>
     </message>
+    <message>
+        <source>CTRL_INFO</source>
+        <translation>Quality Info</translation>
+    </message>
     <message>
         <source>NODE_MODE</source>
         <translation>Node</translation>
@@ -7105,6 +7170,84 @@ as they are of improper type:
         <translation>Vertex</translation>
     </message>
 </context>
+<context>
+    <name>SMESHGUI_CtrlInfo</name>
+    <message>
+        <source>CTRL_INFO</source>
+        <translation>Quality information</translation>
+    </message>
+    <message>
+        <source>NAME_LAB</source>
+        <translation>Name:</translation>
+    </message>
+    <message>
+        <source>VALUE</source>
+        <translation>Value</translation>
+    </message>
+    <message>
+        <source>BUT_COMPUTE</source>
+        <translation>Compute</translation>
+    </message>
+    <message>
+        <source>NODES_INFO</source>
+        <translation>Nodes Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_FREE_NODES</source>
+        <translation>Number of the free nodes</translation>
+    </message>
+    <message>
+        <source>DOUBLE_NODES_TOLERANCE</source>
+        <translation>Double nodes tolerance</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_NODES</source>
+        <translation>Number of the double nodes</translation>
+    </message>
+    <message>
+        <source>EDGES_INFO</source>
+        <translation>Edges Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_EDGES</source>
+        <translation>Number of the double edges</translation>
+    </message>
+    <message>
+        <source>FACES_INFO</source>
+        <translation>Faces Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_FACES</source>
+        <translation>Number of the double faces</translation>
+    </message>   
+    <message>
+        <source>ASPECT_RATIO_HISTOGRAM</source>
+        <translation>Aspect Ratio histogram</translation>
+    </message>
+    <message>
+        <source>VOLUMES_INFO</source>
+        <translation>Volumes Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_VOLUMES</source>
+        <translation>Number of the double volumes</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_OVER_CONSTRAINED</source>
+        <translation>Number of the over-constrained</translation>
+    </message>
+    <message>
+        <source>ASPECT_RATIO_3D_HISTOGRAM</source>
+        <translation>Aspect Ratio 3D histogram</translation>
+    </message>
+</context>
+<context>
+    <name>SMESHGUI_CtrlInfoDlg</name>
+    <message>
+        <source>CTRL_INFO</source>
+        <translation>Quality Info</translation>
+    </message>
+</context>
 <context>
     <name>SMESHGUI_MinDistance</name>
     <message>
index 6aae4287aef9e894b0f2d21ef18703c3c859235d..7423e43ea0dd273b6786a099c2510b34fe630fff 100755 (executable)
@@ -3,6 +3,46 @@
 <TS version="2.0" language="fr_FR">
 <context>
     <name>@default</name>
+    <message>
+        <source>SMESH_GIGABYTE</source>
+        <translation type="unfinished">%1 GB</translation>
+    </message>
+    <message>
+        <source>SMESH_FREERAM</source>
+        <translation type="unfinished">Free RAM</translation>
+    </message>
+    <message>
+        <source>STB_BIQUADRATIC_TRIANGLE</source>
+        <translation type="unfinished">BiQuadratic Triangle</translation>
+    </message>
+    <message>
+        <source>TOP_BIQUADRATIC_TRIANGLE</source>
+        <translation type="unfinished">BiQuadratic Triangle</translation>
+    </message>
+    <message>
+        <source>MEN_BIQUADRATIC_TRIANGLE</source>
+        <translation type="unfinished">BiQuadratic Triangle</translation>
+    </message>
+    <message>
+        <source>SMESH_BIQUADRATIC_TRIANGLES</source>
+        <translation type="unfinished">BiQuadratic Triangles</translation>
+    </message>
+    <message>
+        <source>SMESH_BIQUADRATIC_TRIANGLE</source>
+        <translation type="unfinished">BiQuadratic Triangle</translation>
+    </message>
+    <message>
+        <source>SMESH_AUTO_DIM</source>
+        <translation type="unfinished">Automatically define space dimension</translation>
+    </message>
+    <message>
+        <source>SMESH_ADD_BIQUADRATIC_TRIANGLE_TITLE</source>
+        <translation type="unfinished">Add BiQuadratic Triangle</translation>
+    </message>
+    <message>
+        <source>COMPERR_WARNING</source>
+        <translation type="unfinished">Warning</translation>
+    </message>
     <message>
         <source>SMESH_EXPORT_MESH</source>
         <translation>Exporter le maillage</translation>
         <source>MEN_RESET</source>
         <translation>Restaurer</translation>
     </message>
+    <message>
+        <source>MEN_OVERALL_MESH_QUALITY</source>
+        <translation type="unfinished">Overall Mesh Quality</translation>
+    </message>
     <message>
         <source>MEN_DISTRIBUTION_CTRL</source>
         <translation>Distribution</translation>
@@ -2683,6 +2727,12 @@ Enregistrez votre travail avant que l&apos;application se plante</translation>
         <source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
         <translation>La présentation n&apos;a pas été mise à jour automatiquement: la nouvelle taille du maillage (%1 éléments) dépasse la limite de taille actuelle (%2 éléments).
 Vérifiez la limite dans les préférences du module Mesh.
+</translation>
+    </message>
+    <message>
+        <source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
+        <translation type="unfinished">New mesh sise (%1 elements) exceeds current size limit (%2 elements).
+Not all mesh elements are shown. Please check preferences of Mesh module.
 </translation>
     </message>
     <message>
@@ -4064,6 +4114,14 @@ avec le paramètre &apos;%1&apos; des préférences du module Mesh.</translation
         <translation>L&apos;objet sélectionné a été utilisé pour en créer un autre.
 Il ne peut pas être supprimé.</translation>
     </message>
+    <message>
+        <source>MEN_SORT_CHILD_ITEMS</source>
+        <translation type="unfinished">Sort children</translation>
+    </message>
+    <message>
+        <source>STB_SORT_CHILD_ITEMS</source>
+        <translation type="unfinished">Sort child items</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_Dialog</name>
@@ -4123,6 +4181,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
         <source>PREF_UPDATE_LIMIT_NOLIMIT</source>
         <translation>Sans limite</translation>
     </message>
+    <message>
+        <source>PREF_INCREMENTAL_LIMIT</source>
+        <translation type="unfinished">Incremental limit check</translation>
+    </message>
     <message>
         <source>PREF_BACKFACE</source>
         <translation>Couleur de face arrière</translation>
@@ -4235,10 +4297,18 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
         <source>PREF_DUMP_ADD_INFO</source>
         <translation>Copier les informations additionelles</translation>
     </message>
+    <message>
+        <source>PREF_DUMP_CTRL_INFO</source>
+        <translation type="unfinished">Dump controls information</translation>
+    </message>
     <message>
         <source>PREF_GPP_NODES_LIMIT</source>
         <translation>Calcul automatique du nombre de nœuds: limite</translation>
     </message>
+    <message>
+        <source>PREF_CTRL_LIMIT</source>
+        <translation type="unfinished">Automatic controls compute limit</translation>
+    </message>
     <message>
         <source>SMESH_PREF_GROUP_PRECISION</source>
         <translation>Précision des champs d&apos;entrée</translation>
@@ -4435,6 +4505,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
 </context>
 <context>
     <name>SMESHGUI_AddQuadraticElementDlg</name>
+    <message>
+        <source>SMESH_ADD_BIQUADRATIC_TRIANGLE</source>
+        <translation type="unfinished">Add BiQuadratic Triangle</translation>
+    </message>
     <message>
         <source>SMESH_ADD_QUADRATIC_EDGE</source>
         <translation>Ajouter une arête quadratique</translation>
@@ -4544,6 +4618,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
 </context>
 <context>
     <name>SMESHGUI_ComputeDlg</name>
+    <message>
+        <source>GROUP_OF_BAD_MESH</source>
+        <translation type="unfinished">Bad Mesh to Group</translation>
+    </message>
     <message>
         <source>CAPTION</source>
         <translation>Le calcul du maillage a échoué</translation>
@@ -4763,6 +4841,10 @@ Vérifiez l&apos;espace de disque disponible et vos droits d&apos;écriture dans
 </context>
 <context>
     <name>SMESHGUI_CuttingOfQuadsDlg</name>
+    <message>
+        <source>TO_4_TRIA</source>
+        <translation type="unfinished">Cut into 4 triangles</translation>
+    </message>
     <message>
         <source>CAPTION</source>
         <translation>Découpe des quadrangles</translation>
@@ -5132,6 +5214,22 @@ Vérifiez la validité des informations données</translation>
 </context>
 <context>
     <name>SMESHGUI_FilterTable</name>
+    <message>
+        <source>ENTITY_TYPE_24</source>
+        <translation type="unfinished">BALL</translation>
+    </message>
+    <message>
+        <source>ENTITY_TYPE_23</source>
+        <translation type="unfinished">QPOLYEDRE</translation>
+    </message>
+    <message>
+        <source>ENTITY_TYPE_1</source>
+        <translation type="unfinished">POINT1</translation>
+    </message>
+    <message>
+        <source>CONNECTED_ELEMS</source>
+        <translation type="unfinished">Elements of a domain</translation>
+    </message>
     <message>
         <source>ADD</source>
         <translation>Ajouter</translation>
@@ -6401,6 +6499,10 @@ Il y a trop peu de points dans le fichier </translation>
 </context>
 <context>
     <name>SMESHGUI_DuplicateNodesDlg</name>
+    <message>
+        <source>DUPLICATION_ONLY_ELEMS</source>
+        <translation type="unfinished">Duplicate elements only</translation>
+    </message>
     <message>
         <source>DUPLICATION_MODE</source>
         <translation>Mode de duplication</translation>
@@ -6683,6 +6785,10 @@ en raison de leurs types incompatibles:
         <source>ADDITIONAL_INFO</source>
         <translation>Infos détaillées</translation>
     </message>
+    <message>
+        <source>CTRL_INFO</source>
+        <translation type="unfinished">Quality Info</translation>
+    </message>
     <message>
         <source>NODE_MODE</source>
         <translation>Nœud</translation>
@@ -7049,6 +7155,84 @@ en raison de leurs types incompatibles:
         <translation>Point</translation>
     </message>
 </context>
+<context>
+    <name>SMESHGUI_CtrlInfo</name>
+    <message>
+        <source>CTRL_INFO</source>
+        <translation type="unfinished">Quality information</translation>
+    </message>
+    <message>
+        <source>NAME_LAB</source>
+        <translation type="unfinished">Name:</translation>
+    </message>
+    <message>
+        <source>VALUE</source>
+        <translation type="unfinished">Value</translation>
+    </message>
+    <message>
+        <source>BUT_COMPUTE</source>
+        <translation type="unfinished">Compute</translation>
+    </message>
+    <message>
+        <source>NODES_INFO</source>
+        <translation type="unfinished">Nodes Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_FREE_NODES</source>
+        <translation type="unfinished">Number of the free nodes</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_NODES</source>
+        <translation type="unfinished">Number of the double nodes</translation>
+    </message>
+    <message>
+        <source>DOUBLE_NODES_TOLERANCE</source>
+        <translation>Tolérance des nœuds doubles</translation>
+    </message>
+    <message>
+        <source>EDGES_INFO</source>
+        <translation type="unfinished">Edges Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_EDGES</source>
+        <translation type="unfinished">Number of the double edges</translation>
+    </message>
+    <message>
+        <source>FACES_INFO</source>
+        <translation type="unfinished">Faces Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_FACES</source>
+        <translation type="unfinished">Number of the double faces</translation>
+    </message>   
+    <message>
+        <source>ASPECT_RATIO_HISTOGRAM</source>
+        <translation type="unfinished">Aspect Ratio histogram</translation>
+    </message>
+    <message>
+        <source>VOLUMES_INFO</source>
+        <translation type="unfinished">Volumes Information:</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_DOUBLE_VOLUMES</source>
+        <translation type="unfinished">Number of the double volumes</translation>
+    </message>
+    <message>
+        <source>NUMBER_OF_THE_OVER_CONSTRAINED</source>
+        <translation type="unfinished">Number of the over-constrained</translation>
+    </message>
+    <message>
+        <source>ASPECT_RATIO_3D_HISTOGRAM</source>
+        <translation type="unfinished">Aspect Ratio 3D histogram</translation>
+    </message>
+</context>
+<context>
+    <name>SMESHGUI_CtrlInfoDlg</name>
+    <message>
+        <source>CTRL_INFO</source>
+        <translation type="unfinished">Quality Info</translation>
+    </message>
+</context>
 <context>
     <name>SMESHGUI_MinDistance</name>
     <message>
@@ -7308,4 +7492,19 @@ en raison de leurs types incompatibles:
         <translation>Coef de réduction:</translation>
     </message>
 </context>
+<context>
+    <name>SMESHGUI_ComputeDlg_QThreadQDialog</name>
+    <message>
+        <source>TITLE</source>
+        <translation type="unfinished">Compute</translation>
+    </message>
+    <message>
+        <source>CANCELING</source>
+        <translation type="unfinished">Canceling...</translation>
+    </message>
+    <message>
+        <source>CANCEL</source>
+        <translation type="unfinished">Cancel</translation>
+    </message>
+</context>
 </TS>
index 084c491463331e7d2c247c3de7f1d3b581c77a72..f0838270efc55477f09a0b75e28c7a4254fabbba 100644 (file)
@@ -694,12 +694,12 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint,
       start.SetCoord( iParam, sumParam / 4.);
     }
     if ( needGrid ) {
-      // compute nodes of 3 x 3 x 3 grid
+      // compute nodes of 10 x 10 x 10 grid
       int iNode = 0;
       Bnd_Box box;
-      for ( double x = 0.25; x < 0.9; x += 0.25 )
-        for ( double y = 0.25; y < 0.9; y += 0.25 )
-          for ( double z = 0.25; z < 0.9; z += 0.25 ) {
+      for ( double x = 0.05; x < 1.; x += 0.1 )
+        for ( double y = 0.05; y < 1.; y += 0.1 )
+          for ( double z = 0.05; z < 1.; z += 0.1 ) {
             TxyzPair & prmPtn = my3x3x3GridNodes[ iNode++ ];
             prmPtn.first.SetCoord( x, y, z );
             ShellPoint( prmPtn.first, prmPtn.second );
@@ -718,7 +718,7 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint,
   {
     double minDist = DBL_MAX;
     gp_XYZ* bestParam = 0;
-    for ( int iNode = 0; iNode < 27; iNode++ ) {
+    for ( int iNode = 0; iNode < 1000; iNode++ ) {
       TxyzPair & prmPtn = my3x3x3GridNodes[ iNode ];
       double dist = ( thePoint.XYZ() - prmPtn.second ).SquareModulus();
       if ( dist < minDist ) {
@@ -819,6 +819,12 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint,
          << " ------ NB IT: " << myNbIterations << ",  SUM DIST: " << mySumDist );
 #endif
 
+  const double reachedDist = sqrt( sqDistance );
+  if ( reachedDist > 1000 * myTolerance &&
+       computeParameters( thePoint, theParams, solution ) &&
+       reachedDist > distance() )
+    return true;
+
   theParams = solution;
 
   if ( myFaceIndex > 0 )
index 427cc94de67f35631c5448da14fa03f38a5e2fa2..4f0a60db9855243b4e9170e99c0fb65916a22423 100644 (file)
@@ -383,7 +383,7 @@ public:
   double   myValues[ 4 ]; // values computed at myParam: square distance and 3 derivatives
 
   typedef std::pair<gp_XYZ,gp_XYZ> TxyzPair;
-  TxyzPair my3x3x3GridNodes[ 27 ]; // to compute the first param guess
+  TxyzPair my3x3x3GridNodes[ 1000 ]; // to compute the first param guess
   bool     myGridComputed;
 };
 
index 982b6c33b5740a25c5e52dc71b7bf00bf2388240..d76a6c7dc6de6bfd005145aebe1c6890e2689b12 100644 (file)
@@ -38,11 +38,8 @@ salomeinclude_HEADERS = \
        SMESH_Hypothesis_i.hxx \
        SMESH_PythonDump.hxx \
        SMESH_Group_i.hxx \
-       SMESH_MEDMesh_i.hxx \
        SMESH_Filter_i.hxx \
        SMESH_MeshEditor_i.hxx \
-       SMESH_MEDFamily_i.hxx \
-       SMESH_MEDSupport_i.hxx \
        SMESH_Pattern_i.hxx \
        SMESH_2smeshpy.hxx \
        SMESH_NoteBook.hxx \
@@ -60,9 +57,6 @@ dist_libSMESHEngine_la_SOURCES = \
        SMESH_Gen_i_1.cxx \
        SMESH_DumpPython.cxx \
        SMESH_Mesh_i.cxx \
-       SMESH_MEDMesh_i.cxx \
-       SMESH_MEDFamily_i.cxx \
-       SMESH_MEDSupport_i.cxx \
        SMESH_subMesh_i.cxx \
        SMESH_MeshEditor_i.cxx \
        SMESH_Hypothesis_i.cxx \
@@ -95,11 +89,12 @@ libSMESHEngine_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
        $(KERNEL_CXXFLAGS) \
        $(GUI_CXXFLAGS) \
-       $(MED_CXXFLAGS) \
        $(GEOM_CXXFLAGS) \
        -I$(srcdir)/../Controls \
        -I$(srcdir)/../SMDS \
        -I$(srcdir)/../SMESHDS \
+       -I$(srcdir)/../MEDWrapper/Base \
+       -I$(srcdir)/../MEDWrapper/Factory \
        -I$(srcdir)/../Driver \
        -I$(srcdir)/../DriverMED \
        -I$(srcdir)/../DriverCGNS \
@@ -124,10 +119,6 @@ libSMESHEngine_la_LDFLAGS  = \
        -lSalomeGenericObj \
        -lSalomeIDLKernel \
        -lSALOMELocalTrace \
-       $(MED_LDFLAGS) \
-       -lMEDWrapper \
-       -lMEDWrapper_V2_2 \
-        -lSalomeIDLMED \
        $(CAS_LDPATH) \
        -lTKCDF \
        -lTKBO \
index 7ff09306b48e375b64eb1f49dd9625c0637e0cc2..b0a202b5ef2d7a07f93e8a745a9a50bd9eeea470 100644 (file)
@@ -196,8 +196,16 @@ namespace {
         cmd->Clear();
       return;
     }
-    // comment a command having not created args
-    for ( int iArg = cmd->GetNbArgs(); iArg; --iArg )
+    // check if an Object was created in the script
+    _AString comment;
+    const _pyID& obj = cmd->GetObject();
+    if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
+    {
+      comment = "not created Object";
+      theGen->ObjectCreationRemoved( obj );
+    }
+    // check if a command has not created args
+    for ( int iArg = cmd->GetNbArgs(); iArg && comment.IsEmpty(); --iArg )
     {
       const _pyID& arg = cmd->GetArg( iArg );
       if ( arg.IsEmpty() || arg.Value( 1 ) == '"' || arg.Value( 1 ) == '\'' )
@@ -207,34 +215,29 @@ namespace {
       for ( ; id != idList.end(); ++id )
         if ( !theGen->IsGeomObject( *id ) && !presentObjects.count( *id ))
         {
-          cmd->Comment();
-          cmd->GetString() += " ### " ;
-          cmd->GetString() += *id + " has not been yet created";
-          for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
-            _pyID objID = cmd->GetResultValue( i+1 );
-            theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
-          }
-          return;
+          comment += *id + " has not been yet created";
+          break;
         }
     }
-    // comment a command having not created Object
-    const _pyID& obj = cmd->GetObject();
-    if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
+    // treat result objects
+    const _pyID& result = cmd->GetResultValue();
+    if ( !result.IsEmpty() && result.Value( 1 ) != '"' && result.Value( 1 ) != '\'' )
+    {
+      list< _pyID > idList = cmd->GetStudyEntries( result );
+      list< _pyID >::iterator id = idList.begin();
+      for ( ; id != idList.end(); ++id )
+        if ( comment.IsEmpty() )
+          presentObjects.insert( *id );
+        else
+          theGen->ObjectCreationRemoved( *id ); // objID.SetName( name ) is not needed
+    }
+    // comment the command
+    if ( !comment.IsEmpty() )
     {
       cmd->Comment();
-      cmd->GetString() += " ### not created object" ;
-      for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
-        _pyID objID = cmd->GetResultValue( i+1 );
-        theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
-      }
+      cmd->GetString() += " ### ";
+      cmd->GetString() += comment;
     }
-    const _pyID& result = cmd->GetResultValue();
-    if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
-      return;
-    list< _pyID > idList = cmd->GetStudyEntries( result );
-    list< _pyID >::iterator id = idList.begin();
-    for ( ; id != idList.end(); ++id )
-      presentObjects.insert( *id );
   }
 
   //================================================================================
@@ -307,6 +310,8 @@ namespace {
       undef2newItems[ 44 ].push_back( 37 );
       undef2newItems[ 45 ].push_back( 36 );
       undef2newItems[ 46 ].push_back( 39 );
+
+      ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined );
     }
 
     int iType     = Type.IntegerValue();
@@ -342,6 +347,90 @@ namespace {
       BinaryOp = TCollection_AsciiString( iBinaryOp );
     }
   }
+
+  //================================================================================
+  /*!
+   * \brief Replaces "SMESH.PointStruct(x,y,z)" and "SMESH.DirStruct( SMESH.PointStruct(x,y,z))"
+   *        arguments of a given command by a list "[x,y,z]" if the list is accesible
+   *        type of argument.
+   */
+  //================================================================================
+
+  void StructToList( Handle( _pyCommand)& theCommand )
+  {
+    static TStringSet methodsAcceptingList;
+    if ( methodsAcceptingList.empty() ) {
+      const char * methodNames[] = {
+        "GetCriterion","Reorient2D","ExtrusionSweep","ExtrusionSweepMakeGroups0D",
+        "ExtrusionSweepMakeGroups","ExtrusionSweep0D",
+        "AdvancedExtrusion","AdvancedExtrusionMakeGroups",
+        "ExtrusionSweepObject","ExtrusionSweepObject0DMakeGroups",
+        "ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
+        "ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups",
+        "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
+        "Translate","TranslateMakeGroups","TranslateMakeMesh",
+        "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh"
+        ,"" }; // <- mark of the end
+      methodsAcceptingList.Insert( methodNames );
+    }
+    if ( methodsAcceptingList.Contains( theCommand->GetMethod() ))
+    {
+      for ( int i = theCommand->GetNbArgs(); i > 0; --i )
+      {
+        const _AString & arg = theCommand->GetArg( i );
+        if ( arg.Search( "SMESH.PointStruct" ) == 1 ||
+             arg.Search( "SMESH.DirStruct"   ) == 1 )
+        {
+          Handle(_pyCommand) workCmd = new _pyCommand( arg );
+          if ( workCmd->GetNbArgs() == 1 ) // SMESH.DirStruct( SMESH.PointStruct(x,y,z))
+          {
+            workCmd = new _pyCommand( workCmd->GetArg( 1 ) );
+          }
+          if ( workCmd->GetNbArgs() == 3 ) // SMESH.PointStruct(x,y,z)
+          {
+            _AString newArg = "[ ";
+            newArg += ( workCmd->GetArg( 1 ) + ", " +
+                        workCmd->GetArg( 2 ) + ", " +
+                        workCmd->GetArg( 3 ) + " ]");
+            theCommand->SetArg( i, newArg );
+          }
+        }
+      }
+    }
+  }
+  //================================================================================
+  /*!
+   * \brief Replaces "mesh.GetIDSource([id1,id2])" argument of a given command by
+   *        a list "[id1,id2]" if the list is an accesible type of argument.
+   */
+  //================================================================================
+
+  void GetIDSourceToList( Handle( _pyCommand)& theCommand )
+  {
+    static TStringSet methodsAcceptingList;
+    if ( methodsAcceptingList.empty() ) {
+      const char * methodNames[] = {
+        "ExportPartToMED","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL",
+        "ExportCGNS","ExportGMF",
+        "Create0DElementsOnAllNodes","Reorient2D","QuadTo4Tri",
+        "ScaleMakeGroups","Scale","ScaleMakeMesh",
+        "FindCoincidentNodesOnPartBut","DoubleElements"
+        ,"" }; // <- mark of the end
+      methodsAcceptingList.Insert( methodNames );
+    }
+    if ( methodsAcceptingList.Contains( theCommand->GetMethod() ))
+    {
+      for ( int i = theCommand->GetNbArgs(); i > 0; --i )
+      {
+        _pyCommand argCmd( theCommand->GetArg( i ));
+        if ( argCmd.GetMethod() == "GetIDSource" &&
+             argCmd.GetNbArgs() == 2 )
+        {
+          theCommand->SetArg( i, argCmd.GetArg( 1 ));
+        }
+      }
+    }
+  }
 }
 
 //================================================================================
@@ -537,12 +626,16 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
     PlaceSubmeshAfterItsCreation( aCommand );
   }
 
+  // Method( SMESH.PointStruct(x,y,z) -> Method( [x,y,z]
+  StructToList( aCommand );
+
   // Find an object to process theCommand
 
   // SMESH_Gen method?
   if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName())
   {
     this->Process( aCommand );
+    addFilterUser( aCommand, theGen ); // protect filters from clearing
     return aCommand;
   }
 
@@ -566,6 +659,11 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
       myObjects.insert( make_pair( subMeshID, subMesh ));
     }
 
+    // Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2]
+    GetIDSourceToList( aCommand );
+
+    addFilterUser( aCommand, theGen ); // protect filters from clearing
+
     id_mesh->second->Process( aCommand );
     id_mesh->second->AddProcessedCmd( aCommand );
     return aCommand;
@@ -575,6 +673,11 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
   map< _pyID, Handle(_pyMeshEditor) >::iterator id_editor = myMeshEditors.find( objID );
   if ( id_editor != myMeshEditors.end() )
   {
+    // Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2]
+    GetIDSourceToList( aCommand );
+
+    addFilterUser( aCommand, theGen ); // protect filters from clearing
+
     const TCollection_AsciiString& method = aCommand->GetMethod();
 
     // some commands of SMESH_MeshEditor create meshes and groups
@@ -719,6 +822,9 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
     UnaryOp  = SMESH + SMESH::FunctorTypeToString( SMESH::FunctorType( UnaryOp.IntegerValue() ));
     BinaryOp = SMESH + SMESH::FunctorTypeToString( SMESH::FunctorType( BinaryOp.IntegerValue() ));
 
+    if ( Compare == "SMESH.FT_EqualTo" )
+      Compare = "'='";
+
     aCommand->RemoveArgs();
     aCommand->SetObject( SMESH_2smeshpy::GenName() );
     aCommand->SetMethod( "GetCriterion" );
@@ -1250,6 +1356,35 @@ void _pyGen::setNeighbourCommand( Handle(_pyCommand)& theCmd,
     (*pos)->SetOrderNb( i++ );
 }
 
+//================================================================================
+/*!
+ * \brief Call _pyFilter.AddUser() if a filter is used as a command arg
+ */
+//================================================================================
+
+void _pyGen::addFilterUser( Handle(_pyCommand)& theCommand, const Handle(_pyObject)& user )
+{
+  const char filterPrefix[] = "aFilter0x";
+  if ( theCommand->GetString().Search( filterPrefix ) < 1 )
+    return;
+
+  for ( int i = theCommand->GetNbArgs(); i > 0; --i )
+  {
+    const _AString & arg = theCommand->GetArg( i );
+    // NOT TREATED CASE: arg == "[something, aFilter0x36a2f60]"
+    if ( arg.Search( filterPrefix ) != 1 )
+      continue;
+
+    Handle(_pyFilter) filter = Handle(_pyFilter)::DownCast( FindObject( arg ));
+    if ( !filter.IsNull() )
+    {
+      filter->AddUser( user );
+      if ( !filter->GetNewID().IsEmpty() )
+        theCommand->SetArg( i, filter->GetNewID() );
+    }
+  }
+}
+
 //================================================================================
 /*!
  * \brief Set command be last in list of commands
@@ -1676,9 +1811,17 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
   // ----------------------------------------------------------------------
   else if ( theCommand->MethodStartsFrom( "Export" ))
   {
-    if ( method == "ExportToMED" ||   // ExportToMED()  --> ExportMED()
-         method == "ExportToMEDX" ) { // ExportToMEDX() --> ExportMED()
+    if ( method == "ExportToMED" ||  // ExportToMED()  --> ExportMED()
+         method == "ExportToMEDX" )  // ExportToMEDX() --> ExportMED()
+    {
       theCommand->SetMethod( "ExportMED" );
+      if ( theCommand->GetNbArgs() == 5 )
+      {
+        // ExportToMEDX(...,autoDimension) -> ExportToMEDX(...,meshPart=None,autoDimension)
+        _AString autoDimension = theCommand->GetArg( 5 );
+        theCommand->SetArg( 5, "None" );
+        theCommand->SetArg( 6, autoDimension );
+      }
     }
     else if ( method == "ExportCGNS" )
     { // ExportCGNS(part, ...) -> ExportCGNS(..., part)
@@ -1703,9 +1846,9 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
       TCollection_AsciiString newMethod = method;
       newMethod.Remove( 7, 6 );
       theCommand->SetMethod( newMethod );
-      // make the 1st arg be the last one
+      // make the 1st arg be the last one (or last but one for ExportMED())
       _pyID partID = theCommand->GetArg( 1 );
-      int nbArgs = theCommand->GetNbArgs();
+      int nbArgs = theCommand->GetNbArgs() - (newMethod == "ExportMED");
       for ( int i = 2; i <= nbArgs; ++i )
         theCommand->SetArg( i-1, theCommand->GetArg( i ));
       theCommand->SetArg( nbArgs, partID );
@@ -2090,29 +2233,36 @@ _pyMeshEditor::_pyMeshEditor(const Handle(_pyCommand)& theCreationCmd):
 
 void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
 {
-  // names of SMESH_MeshEditor methods fully equal to methods of the python class Mesh, so
-  // commands calling this methods are converted to calls of Mesh methods
+  // Names of SMESH_MeshEditor methods fully equal to methods of the python class Mesh, so
+  // commands calling these methods are converted to calls of Mesh methods without
+  // additional modifs, only object is changed from MeshEditor to Mesh.
   static TStringSet sameMethods;
   if ( sameMethods.empty() ) {
     const char * names[] = {
-      "RemoveElements","RemoveNodes","RemoveOrphanNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall",
-      "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
+      "RemoveElements","RemoveNodes","RemoveOrphanNodes",
+      "AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall",
+      "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces",
+      "MoveNode", "MoveClosestNodeToPoint",
       "InverseDiag","DeleteDiag","Reorient","ReorientObject",
       "TriToQuad","TriToQuadObject", "QuadTo4Tri", "SplitQuad","SplitQuadObject",
       "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
       "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
       "RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D",
-      "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
-      "ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathX",
-      "ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
+      "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D",
+      "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject",
+      "ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
       "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
-      "FindCoincidentNodes",/*"FindCoincidentNodesOnPart",*/"MergeNodes","FindEqualElements",
+      "FindCoincidentNodes","MergeNodes","FindEqualElements",
       "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
       "SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
       "GetLastCreatedElems",
       "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh",
       "Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh",
-      "MakeBoundaryElements", "SplitVolumesIntoTetra"
+      "MakeBoundaryElements", "SplitVolumesIntoTetra",
+      "DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups",
+      "DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup",
+      "DoubleNodeElemGroupInRegion","DoubleNodeElemGroups","DoubleNodeElemGroupsInRegion",
+      "DoubleNodesOnGroupBoundaries","CreateFlatElementsOnFacesGroups","CreateHoleSkin"
       ,"" }; // <- mark of the end
     sameMethods.Insert( names );
   }
@@ -3202,6 +3352,7 @@ int _pyCommand::GetBegPos( int thePartIndex )
     return EMPTY;
   if ( myBegPos.Length() < thePartIndex )
     return UNKNOWN;
+  ASSERT( thePartIndex > 0 );
   return myBegPos( thePartIndex );
 }
 
@@ -3217,6 +3368,7 @@ void _pyCommand::SetBegPos( int thePartIndex, int thePosition )
 {
   while ( myBegPos.Length() < thePartIndex )
     myBegPos.Append( UNKNOWN );
+  ASSERT( thePartIndex > 0 );
   myBegPos( thePartIndex ) = thePosition;
 }
 
@@ -3747,7 +3899,7 @@ void _pyCommand::Comment()
   if ( i <= Length() )
   {
     myString.Insert( i, "#" );
-    for ( int iPart = 0; iPart < myBegPos.Length(); ++iPart )
+    for ( int iPart = 1; iPart <= myBegPos.Length(); ++iPart )
     {
       int begPos = GetBegPos( iPart + 1 );
       if ( begPos != UNKNOWN )
index 86a0877283ead578602005aad4660b63552c8ba7..32ad5cd94b017365781c69f5e06c4e8521db50ef 100644 (file)
@@ -268,7 +268,8 @@ private:
   void setNeighbourCommand( Handle(_pyCommand)& theCmd,
                             Handle(_pyCommand)& theOtherCmd,
                             const bool theIsAfter );
-  
+  void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
+
 private:
   std::map< _pyID, Handle(_pyMesh) >        myMeshes;
   std::map< _pyID, Handle(_pyMeshEditor) >  myMeshEditors;
index 5840f0ab2f6db3d92673331077a52a25a324243f..c9ca6c87087757808edd909308b4470d2534d0fb 100644 (file)
@@ -881,15 +881,16 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
   aScript += helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()\n\t";
   aScript += helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()\n\t";
 
+  // This is not needed since entering a plug-in system to smesh.py
   // import python files corresponding to plugins
-  set<string> moduleNameSet;
-  map<string, GenericHypothesisCreator_i*>::iterator hyp_creator = myHypCreatorMap.begin();
-  for ( ; hyp_creator != myHypCreatorMap.end(); ++hyp_creator ) {
-    string moduleName = hyp_creator->second->GetModuleName();
-    bool newModule = moduleNameSet.insert( moduleName ).second;
-    if ( newModule )
-      aScript += helper + "\n\t" + "from salome." + (char*) moduleName.c_str() + " import " + (char*) moduleName.c_str() +"Builder";
-  }
+  // set<string> moduleNameSet;
+  // map<string, GenericHypothesisCreator_i*>::iterator hyp_creator = myHypCreatorMap.begin();
+  // for ( ; hyp_creator != myHypCreatorMap.end(); ++hyp_creator ) {
+  //   string moduleName = hyp_creator->second->GetModuleName();
+  //   bool newModule = moduleNameSet.insert( moduleName ).second;
+  //   if ( newModule )
+  //     aScript += helper + "\n\t" + "from salome." + (char*) moduleName.c_str() + " import " + (char*) moduleName.c_str() +"Builder";
+  // }
 
   // Dump trace of restored study
   if (theSavedTrace.Length() > 0) {
@@ -993,7 +994,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
         do {
           aName = aBaseName + (++objectCounter);
         } while (theObjectNames.IsBound(aName));
-        seqRemoved.Append(aName);
+        if ( !aRemovedObjIDs.count( anEntry ))
+          seqRemoved.Append(aName);
         mapRemoved.Bind(anEntry, "1");
         theObjectNames.Bind(anEntry, aName);
       }
@@ -1032,7 +1034,6 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
     anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
   }
   for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
-    if ( aRemovedObjIDs.count( seqRemoved.Value(ir) )) continue;
     anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
     anUpdatedScript += seqRemoved.Value(ir);
     // for object wrapped by class of smeshBuilder.py
@@ -1043,12 +1044,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
   }
 
   // Set object names
-  anUpdatedScript += "\n\t## set object names";
-//   anUpdatedScript += "\n\t\tsmeshgui = salome.ImportComponentGUI(\"SMESH\")";
-//   anUpdatedScript += "\n\t\tsmeshgui.Init(theStudy._get_StudyId())";
-//   anUpdatedScript += "\n";
 
-  TCollection_AsciiString aGUIName;
+  TCollection_AsciiString aGUIName, aSetNameScriptPart;
   Resource_DataMapOfAsciiStringAsciiString mapEntries;
   for (Standard_Integer i = 1; i <= aLen; i += 2)
   {
@@ -1056,23 +1053,24 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
     aName   = geom->GetDumpName( anEntry.ToCString() );
     if (aName.IsEmpty() && // Not a GEOM object
         theNames.IsBound(anEntry) &&
-        !aRemovedObjIDs.count(anEntry) && // a command creating anEntry was erased
+        !aRemovedObjIDs.count(anEntry) && // A command creating anEntry was erased
         !mapEntries.IsBound(anEntry) && // Not yet processed
         !mapRemoved.IsBound(anEntry)) // Was not removed
     {
       aName    = theObjectNames.Find(anEntry);
       aGUIName = theNames.Find(anEntry);
       mapEntries.Bind(anEntry, aName);
-      anUpdatedScript += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
+      aSetNameScriptPart += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
       if ( anEntry2AccessorMethod.IsBound( anEntry ) )
-        anUpdatedScript += helper + "." + anEntry2AccessorMethod( anEntry );
-      anUpdatedScript += helper + ", '" + aGUIName + "')";
+        aSetNameScriptPart += helper + "." + anEntry2AccessorMethod( anEntry );
+      aSetNameScriptPart += helper + ", '" + aGUIName + "')";
     }
   }
-
-  // Issue 0021249: removed (a similar block is dumped by SALOMEDSImpl_Study)
-  //anUpdatedScript += "\n\tif salome.sg.hasDesktop():";
-  //anUpdatedScript += "\n\t\tsalome.sg.updateObjBrowser(0)";
+  if ( !aSetNameScriptPart.IsEmpty() )
+  {
+    anUpdatedScript += "\n\t## set object names";
+    anUpdatedScript += aSetNameScriptPart;
+  }
 
   // -----------------------------------------------------------------
   // store visual properties of displayed objects
index 6ab4d0850818ffdd8f84b63bad8f237c458b2ba6..b7b0e53e1e75b0691300d99ae3a4b5b5a437b204 100644 (file)
@@ -33,6 +33,7 @@
 #include "SMDS_MeshNode.hxx"
 #include "SMESHDS_Mesh.hxx"
 #include "SMESH_Gen_i.hxx"
+#include "SMESH_Group_i.hxx"
 #include "SMESH_PythonDump.hxx"
 
 #include <SALOMEDS_wrap.hxx>
@@ -588,12 +589,63 @@ SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals, COR
   std::vector<int> elements;
   myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements,0,isLogarithmic);
 
-#ifdef WIN32
-  nbIntervals = CORBA::Short( min( nbEvents.size(), funValues.size() - 1));
-#else
-  nbIntervals = CORBA::Short( std::min( nbEvents.size(), funValues.size() - 1));
-#endif
   SMESH::Histogram_var histogram = new SMESH::Histogram;
+
+  nbIntervals = CORBA::Short( Min( int( nbEvents.size()),
+                                   int( funValues.size() - 1 )));
+  if ( nbIntervals > 0 )
+  {
+    histogram->length( nbIntervals );
+    for ( int i = 0; i < nbIntervals; ++i )
+    {
+      HistogramRectangle& rect = histogram[i];
+      rect.nbEvents = nbEvents[i];
+      rect.min = funValues[i];
+      rect.max = funValues[i+1];
+    }
+  }
+  return histogram._retn();
+}
+
+SMESH::Histogram* NumericalFunctor_i::GetLocalHistogram(CORBA::Short              nbIntervals,
+                                                        CORBA::Boolean            isLogarithmic,
+                                                        SMESH::SMESH_IDSource_ptr object)
+{
+  SMESH::Histogram_var histogram = new SMESH::Histogram;
+
+  std::vector<int>    nbEvents;
+  std::vector<double> funValues;
+  std::vector<int>    elements;
+
+  SMDS_ElemIteratorPtr elemIt;
+  if ( SMESH::DownCast< SMESH_GroupOnFilter_i* >( object ) ||
+       SMESH::DownCast< SMESH::Filter_i* >( object ))
+  {
+    elemIt = SMESH_Mesh_i::GetElements( object, GetElementType() );
+  }
+  else
+  {
+    SMESH::SMESH_Mesh_var        mesh = object->GetMesh();
+    SMESH::long_array_var  objNbElems = object->GetNbElementsByType();
+    SMESH::long_array_var meshNbElems = mesh->  GetNbElementsByType();
+    if ( meshNbElems[ GetElementType() ] !=
+         objNbElems [ GetElementType() ] )
+    {
+      elements.reserve( objNbElems[ GetElementType() ]);
+      elemIt = SMESH_Mesh_i::GetElements( object, GetElementType() );
+    }
+  }
+  if ( elemIt )
+  {
+    while ( elemIt->more() )
+      elements.push_back( elemIt->next()->GetID() );
+    if ( elements.empty() ) return histogram._retn();
+  }
+
+  myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements,0,isLogarithmic);
+
+  nbIntervals = CORBA::Short( Min( int( nbEvents.size()),
+                                   int( funValues.size() - 1 )));
   if ( nbIntervals > 0 )
   {
     histogram->length( nbIntervals );
@@ -920,6 +972,29 @@ CORBA::Boolean Predicate_i::IsSatisfy( CORBA::Long theId )
   return myPredicatePtr->IsSatisfy( theId );
 }
 
+CORBA::Long Predicate_i::NbSatisfying( SMESH::SMESH_IDSource_ptr obj )
+{
+  SMESH::SMESH_Mesh_var meshVar = obj->GetMesh();
+  const SMDS_Mesh*       meshDS = MeshPtr2SMDSMesh( meshVar );
+  if ( !meshDS )
+    return 0;
+  myPredicatePtr->SetMesh( meshDS );
+
+  SMDSAbs_ElementType elemType = SMDSAbs_ElementType( GetElementType() );
+
+  int nb = 0;
+  SMDS_ElemIteratorPtr elemIt =
+    SMESH::DownCast<SMESH_Mesh_i*>( meshVar )->GetElements( obj, GetElementType() );
+  if ( elemIt )
+    while ( elemIt->more() )
+    {
+      const SMDS_MeshElement* e = elemIt->next();
+      if ( e && e->GetType() == elemType )
+        nb += myPredicatePtr->IsSatisfy( e->GetID() );
+    }
+  return nb;
+}
+
 Controls::PredicatePtr Predicate_i::GetPredicate()
 {
   return myPredicatePtr;
@@ -2702,59 +2777,63 @@ GetElementsId( SMESH_Mesh_ptr theMesh )
   return anArray._retn();
 }
 
-template<class TElement, class TIterator, class TPredicate>
-static void collectMeshInfo(const TIterator& theItr,
-                            TPredicate& thePred,
-                            SMESH::long_array& theRes)
-{         
-  if (!theItr)
-    return;
-  while (theItr->more()) {
-    const SMDS_MeshElement* anElem = theItr->next();
-    if ( thePred->IsSatisfy( anElem->GetID() ) )
-      theRes[ anElem->GetEntityType() ]++;
+//=============================================================================
+/*!
+ * \brief Returns number of mesh elements per each \a EntityType
+ */
+//=============================================================================
+
+SMESH::long_array* ::Filter_i::GetMeshInfo()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = 0; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+
+  if ( !CORBA::is_nil(myMesh) && myPredicate )
+  {
+    const SMDS_Mesh*  aMesh = MeshPtr2SMDSMesh(myMesh);
+    SMDS_ElemIteratorPtr it = aMesh->elementsIterator( SMDSAbs_ElementType( GetElementType() ));
+    while ( it->more() )
+    {
+      const SMDS_MeshElement* anElem = it->next();
+      if ( myPredicate->IsSatisfy( anElem->GetID() ) )
+        aRes[ anElem->GetEntityType() ]++;
+    }
   }
+
+  return aRes._retn();  
 }
 
 //=============================================================================
 /*!
- * \brief Returns statistic of mesh elements
+ * \brief Returns number of mesh elements of each \a ElementType
  */
 //=============================================================================
-SMESH::long_array* ::Filter_i::GetMeshInfo()
+
+SMESH::long_array* ::Filter_i::GetNbElementsByType()
 {
   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->length(SMESH::NB_ELEMENT_TYPES);
+  for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
     aRes[i] = 0;
 
-  if(!CORBA::is_nil(myMesh) && myPredicate) {
-    const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh);
-    SMDS_ElemIteratorPtr it;
-    switch( GetElementType() )
+  if ( !CORBA::is_nil(myMesh) && myPredicate ) {
+    const SMDS_Mesh*  aMesh = MeshPtr2SMDSMesh(myMesh);
+    SMDS_ElemIteratorPtr it = aMesh->elementsIterator( SMDSAbs_ElementType( GetElementType() ));
+    CORBA::Long& nbElems = aRes[ GetElementType() ];
+    while ( it->more() )
     {
-    case SMDSAbs_Node:
-      collectMeshInfo<const SMDS_MeshNode*>(aMesh->nodesIterator(),myPredicate,aRes);
-      break;
-    case SMDSAbs_Edge:
-      collectMeshInfo<const SMDS_MeshElement*>(aMesh->edgesIterator(),myPredicate,aRes);
-      break;
-    case SMDSAbs_Face:
-      collectMeshInfo<const SMDS_MeshElement*>(aMesh->facesIterator(),myPredicate,aRes);
-      break;
-    case SMDSAbs_Volume:
-      collectMeshInfo<const SMDS_MeshElement*>(aMesh->volumesIterator(),myPredicate,aRes);
-      break;
-    case SMDSAbs_All:
-    default:
-      collectMeshInfo<const SMDS_MeshElement*>(aMesh->elementsIterator(),myPredicate,aRes);
-      break;
+      const SMDS_MeshElement* anElem = it->next();
+      if ( myPredicate->IsSatisfy( anElem->GetID() ) )
+        nbElems++;
     }
   }
 
   return aRes._retn();  
 }
 
+
 //================================================================================
 /*!
  * \brief Return GetElementType() within an array
index fa9436722ee7435cb9689dbd7e6de5dcddcff1a8..b6036a13da01a54316c1fbae5cb98d76ed901c5d 100644 (file)
@@ -162,7 +162,11 @@ namespace SMESH
   {
   public:
     CORBA::Double                   GetValue( CORBA::Long theElementId );
-    SMESH::Histogram*               GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic);
+    SMESH::Histogram*               GetHistogram(CORBA::Short   nbIntervals,
+                                                 CORBA::Boolean isLogarithmic);
+    SMESH::Histogram*               GetLocalHistogram(CORBA::Short               nbIntervals,
+                                                      CORBA::Boolean            isLogarithmic,
+                                                      SMESH::SMESH_IDSource_ptr object);
     void                            SetPrecision( CORBA::Long thePrecision );
     CORBA::Long                     GetPrecision();
     Controls::NumericalFunctorPtr   GetNumericalFunctor();
@@ -383,6 +387,7 @@ namespace SMESH
   {
   public:
     CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
+    CORBA::Long                     NbSatisfying( SMESH::SMESH_IDSource_ptr obj );
     Controls::PredicatePtr          GetPredicate();
     
   protected:
@@ -1029,6 +1034,7 @@ namespace SMESH
     // =========================
     virtual SMESH::long_array*           GetIDs();
     virtual SMESH::long_array*           GetMeshInfo();
+    virtual SMESH::long_array*           GetNbElementsByType();
     virtual SMESH::array_of_ElementType* GetTypes();
     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
     virtual bool                         IsMeshInfoCorrect() { return true; }
index 82428ef94a977277cb7c1fdfe646eedbac8e9078..f393b918c14440ff20c797f6275de355ede1bd92 100644 (file)
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_version.h"
 
+#include "DriverMED_W_SMESHDS_Mesh.h"
+#include "DriverMED_R_SMESHDS_Mesh.h"
+#ifdef WITH_CGNS
+#include "DriverCGNS_Read.hxx"
+#endif
+#include "MED_Factory.hxx"
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
 #include "SMESH_Mesh_i.hxx"
 #include "SMESH_PreMeshInfo.hxx"
 #include "SMESH_PythonDump.hxx"
+#include "memoire.h"
 
 #include CORBA_SERVER_HEADER(SMESH_Group)
 #include CORBA_SERVER_HEADER(SMESH_Filter)
 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
 
-#include "DriverMED_W_SMESHDS_Mesh.h"
-#include "DriverMED_R_SMESHDS_Mesh.h"
-#ifdef WITH_CGNS
-#include "DriverCGNS_Read.hxx"
-#endif
-#include "memoire.h"
 
 #include <GEOM_Client.hxx>
 
@@ -473,7 +474,8 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
   // activate the CORBA servant of hypothesis
   hypothesis_i = SMESH::SMESH_Hypothesis::_narrow( myHypothesis_i->_this() );
   int nextId = RegisterObject( hypothesis_i );
-  if(MYDEBUG) MESSAGE( "Add hypo to map with id = "<< nextId );
+  if(MYDEBUG) { MESSAGE( "Add hypo to map with id = "<< nextId ); }
+  else        { nextId = 0; } // avoid "unused variable" warning in release mode
 
   return hypothesis_i._retn();
 }
@@ -502,7 +504,8 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::createMesh()
     // activate the CORBA servant of Mesh
     SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( meshServant->_this() );
     int nextId = RegisterObject( mesh );
-    if(MYDEBUG) MESSAGE( "Add mesh to map with id = "<< nextId);
+    if(MYDEBUG) { MESSAGE( "Add mesh to map with id = "<< nextId); }
+    else        { nextId = 0; } // avoid "unused variable" warning in release mode
     return mesh._retn();
   }
   catch (SALOME_Exception& S_ex) {
@@ -1830,7 +1833,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh
       ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
       TSetOfInt shapeIds;
       ::MeshDimension aDim = (MeshDimension)theDimension;
-      if ( myGen.Compute( myLocMesh, myLocShape, false, aDim, &shapeIds ) )
+      if ( myGen.Compute( myLocMesh, myLocShape, false, false, aDim, &shapeIds ) )
       {
         int nbShapeId = shapeIds.size();
         theShapesId.length( nbShapeId );
@@ -4787,6 +4790,18 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
   }
   pd << ""; // prevent optimizing pd out
 
+  // creation of tree nodes for all data objects in the study
+  // to support tree representation customization and drag-n-drop:
+  SALOMEDS::UseCaseBuilder_var useCaseBuilder = theComponent->GetStudy()->GetUseCaseBuilder();
+  if ( !useCaseBuilder->IsUseCaseNode( theComponent ) ) {
+    useCaseBuilder->SetRootCurrent();
+    useCaseBuilder->Append( theComponent ); // component object is added as the top level item
+    SALOMEDS::ChildIterator_var it = theComponent->GetStudy()->NewChildIterator( theComponent ); 
+    for (it->InitEx(true); it->More(); it->Next()) {
+      useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
+    }
+  }
+
   INFOS( "SMESH_Gen_i::Load completed" );
   return true;
 }
@@ -4994,6 +5009,46 @@ char* SMESH_Gen_i::getVersion()
 #endif
 }
 
+//=================================================================================
+// function : Move()
+// purpose  : Moves objects to the specified position. 
+//            Is used in the drag-n-drop functionality.
+//=================================================================================
+void SMESH_Gen_i::Move( const SMESH::sobject_list& what,
+                       SALOMEDS::SObject_ptr where,
+                       CORBA::Long row )
+{
+  if ( CORBA::is_nil( where ) ) return;
+
+  SALOMEDS::Study_var study = where->GetStudy();
+  SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
+  SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
+  SALOMEDS::SComponent_var father = where->GetFatherComponent();
+  std::string dataType = father->ComponentDataType();
+  if ( dataType != "SMESH" ) return; // not a SMESH component
+  
+  SALOMEDS::SObject_var objAfter;
+  if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) {
+    // insert at given row -> find insertion position
+    SALOMEDS::UseCaseIterator_var useCaseIt = useCaseBuilder->GetUseCaseIterator( where );
+    int i;
+    for ( i = 0; i < row && useCaseIt->More(); i++, useCaseIt->Next() );
+    if ( i == row && useCaseIt->More() ) {
+      objAfter = useCaseIt->Value();
+    }
+  }
+  
+  for ( int i = 0; i < what.length(); i++ ) {
+    SALOMEDS::SObject_var sobj = what[i];
+    if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
+    // insert the object to the use case tree
+    if ( !CORBA::is_nil( objAfter ) )
+      useCaseBuilder->InsertBefore( sobj, objAfter ); // insert at given row
+    else
+      useCaseBuilder->AppendTo( where, sobj );        // append to the end of list
+  }
+}
+
 //=============================================================================
 /*!
  *  SMESHEngine_factory
index bbd544fabf3334b7d708ae85d9d4d0da325050e0..403fb7ee5cc25e12c4bc7f57e01a7066cd7b943f 100644 (file)
@@ -585,6 +585,11 @@ public:
   const std::string &               GetLastObjEntry() const { return myLastObj; }
   std::vector< std::string >        GetAllParameters(const std::string& theObjectEntry) const;
 
+  // Move objects to the specified position
+  void Move( const SMESH::sobject_list& what,
+            SALOMEDS::SObject_ptr where,
+            CORBA::Long row );
+
 private:
   // Create hypothesis of given type
   SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
index 4ac7ad8d3e6fe9d878dd5b06091924abf34d47a0..fc50bc409a4e4a2de0110a1ca00be527c6dbab38 100644 (file)
@@ -261,6 +261,7 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
 {
   SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
   SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
   if ( SO->_is_nil() ) {
     if ( theTag == 0 )
       SO = aStudyBuilder->NewObject( theFatherObject );
@@ -286,6 +287,10 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
     selAttr->SetSelectable( false );
   }
 
+  // add object to the use case tree
+  // (to support tree representation customization and drag-n-drop)
+  useCaseBuilder->AppendTo( SO->GetFather(), SO );
+
   return SO._retn();
 }
 
@@ -377,6 +382,9 @@ static void addReference (SALOMEDS::Study_ptr   theStudy,
     if ( !theSObject->FindSubObject( theTag, aReferenceSO.inout() ))
       aReferenceSO = aStudyBuilder->NewObjectToTag( theSObject, theTag );
     aStudyBuilder->Addreference( aReferenceSO, aToObjSO );
+    // add reference to the use case tree
+    // (to support tree representation customization and drag-n-drop)
+    theStudy->GetUseCaseBuilder()->AppendTo( aReferenceSO->GetFather(), aReferenceSO );
   }
 }
 
@@ -456,6 +464,7 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theSt
     return father._retn();
 
   SALOMEDS::StudyBuilder_var      aStudyBuilder = theStudy->NewBuilder(); 
+  SALOMEDS::UseCaseBuilder_var    useCaseBuilder = theStudy->GetUseCaseBuilder();
   SALOMEDS::GenericAttribute_wrap anAttr;
   SALOMEDS::AttributePixMap_wrap  aPixmap;
 
@@ -466,6 +475,10 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theSt
   aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
   CORBA::String_var userName = aComp->componentusername();
   SetName( father, userName.in(), "MESH" );
+  // add component to the use case tree
+  // (to support tree representation customization and drag-n-drop)
+  useCaseBuilder->SetRootCurrent();
+  useCaseBuilder->Append( father ); // component object is added as the top level item
   if(MYDEBUG) MESSAGE("PublishComponent--END");
 
   return father._retn();
index 20da6c040fb9c5a2ab320a74c2b32e5fbc1afa57..d5c06b37cfab4b9a3c928dbc1d9955414822c4a6 100644 (file)
@@ -677,9 +677,9 @@ void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
 }
 
 //=============================================================================
-/*!
- * Returns statistic of mesh elements
- * Result array of number enityties
+/*
+ * Returns number of mesh elements of each \a SMESH::EntityType
+ * Result array of number of elements per \a SMESH::EntityType
  * Inherited from SMESH_IDSource
  */
 //=============================================================================
@@ -706,6 +706,27 @@ SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo()
   return aRes._retn();
 }
 
+//=============================================================================
+/*
+ * Returns number of mesh elements of each \a ElementType
+ */
+//=============================================================================
+
+SMESH::long_array* SMESH_GroupBase_i::GetNbElementsByType()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::NB_ELEMENT_TYPES);
+  for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
+    aRes[ i ] = 0;
+
+  if ( myPreMeshInfo )
+    aRes[ GetType() ] = myPreMeshInfo->NbElements( SMDSAbs_ElementType( GetType() ));
+  else
+    aRes[ GetType() ] = Size();
+
+  return aRes._retn();  
+}
+
 //=======================================================================
 //function : GetIDs
 //purpose  : Returns ids of members
index ad4522a0a92873c240c856586af6b43aca841b47..152abd53c0d1d3b3e2f55598a36e4a76ce1afa2e 100644 (file)
@@ -72,15 +72,19 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
   virtual SMESH::SMESH_Mesh_ptr GetMesh();
 
   /*!
-   * Returns statistic of mesh elements
-   * Result array of number enityties
+   * Returns number of mesh elements of each \a EntityType
+   * Result array of number of elements per \a EntityType
    * Inherited from SMESH_IDSource
    */
   virtual SMESH::long_array* GetMeshInfo();
-
-  // Inherited from SMESH_IDSource interface
+  /*!
+   * Returns number of mesh elements of each \a ElementType
+   */
+  virtual SMESH::long_array* GetNbElementsByType();
+  /*!
+   * Returns a sequence of all element IDs
+   */
   virtual SMESH::long_array* GetIDs();
-
   /*!
    * Returns types of elements it contains
    * Inherited from SMESH_IDSource interface
diff --git a/src/SMESH_I/SMESH_MEDFamily_i.cxx b/src/SMESH_I/SMESH_MEDFamily_i.cxx
deleted file mode 100644 (file)
index ada90fd..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-// Copyright (C) 2007-2013  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   : SMESH_MEDFamily_i.cxx
-//  Module : SMESH
-//
-#include "SMESH_MEDFamily_i.hxx"
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-
-using namespace std;
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-SMESH_MEDFamily_i::SMESH_MEDFamily_i()
-{
-  BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
-  END_OF("Default Constructor SMESH_MEDFamily_i");
-}
-//=============================================================================
-/*!
- * constructor par recopie
- */
-//=============================================================================
-SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f): 
-  SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity),
-  _subMesh_i(f._subMesh_i),
-  _identifier(f._identifier),
-  _numberOfAttribute(f._numberOfAttribute),
-  _numberOfGroup(f._numberOfGroup), 
-  _attributeValue(f._attributeValue)
-{
-  BEGIN_OF("Copy Constructor SMESH_MEDFamily_i");
-  _attributeDescription=new string[_numberOfAttribute];
-  for (int i=0;i<_numberOfAttribute;i++) {
-    _attributeDescription[i]=f._attributeDescription[i];
-  };
-  _groupName=new string[_numberOfGroup];
-  for (int i=0;i<_numberOfAttribute;i++) {
-    _groupName[i]=f._groupName[i];
-  };
-  END_OF("Copy Constructor SMESH_MEDFamily_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
-{
-}
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
-                                     string name, string description, SALOME_MED::medEntityMesh entity): 
-  SMESH_MEDSupport_i( sm, name, description, entity ),
-  
-  _subMesh_i(sm),
-  _identifier(identifier),
-  _numberOfAttribute(0),
-  _attributeIdentifier((int*)NULL),
-  _attributeValue((int*)NULL), 
-  _attributeDescription((string*)NULL),
-  _numberOfGroup(0), 
-  _groupName((string*)NULL)
-{
-  BEGIN_OF("Constructor SMESH_MEDFamily_i");
-  END_OF("Constructor SMESH_MEDFamily_i");
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Family's Identifier
- */
-//=============================================================================
-
-CORBA::Long SMESH_MEDFamily_i::getIdentifier()      
-throw (SALOME::SALOME_Exception)
-{
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR); 
-  return _identifier;
-  
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for number of attributes
- */
-//=============================================================================
-CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes() 
-throw (SALOME::SALOME_Exception)
-{
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-  return _numberOfAttribute;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attributes identifiers
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong*  SMESH_MEDFamily_i::getAttributesIdentifiers() 
-throw (SALOME::SALOME_Exception)
-{
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-  if (_numberOfAttribute == 0)
-    {
-      MESSAGE("Les familles SMESH n ont pas d attribut");
-      THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                                   ,SALOME::BAD_PARAM);
-    };
-  
-  SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
-  myseq->length(_numberOfAttribute);
-  for (int i=0;i<_numberOfAttribute;i++)
-    {
-      myseq[i]=_attributeIdentifier[i];
-    };
-  return myseq._retn();
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attribute identifier I
- */
-//=============================================================================
-CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i) 
-  throw (SALOME::SALOME_Exception)
-{    
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-  MESSAGE("Les familles SMESH n ont pas d attribut");
-  THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                               ,SALOME::BAD_PARAM);
-  if (_numberOfAttribute == 0)
-    {
-      MESSAGE("Les familles SMESH n ont pas d attribut");
-      THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                                   ,SALOME::BAD_PARAM);
-    };
-  ASSERT (i <= _numberOfAttribute);
-  return _attributeIdentifier[i];
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attributes values
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong*  SMESH_MEDFamily_i::getAttributesValues() 
-  throw (SALOME::SALOME_Exception)
-{
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-
-  if (_numberOfAttribute == 0)
-    {
-      MESSAGE("Les familles SMESH n ont pas d attribut");
-      THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                                   ,SALOME::BAD_PARAM);
-    };
-
-  SALOME_TYPES::ListOfLong_var myseq= new SALOME_TYPES::ListOfLong;
-  myseq->length(_numberOfAttribute);
-  for (int i=0;i<_numberOfAttribute;i++)
-    {
-      myseq[i]=_attributeValue[i];
-    };
-  return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attribute value I
- */
-//=============================================================================
-CORBA::Long  SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i) 
-  throw (SALOME::SALOME_Exception)
-{   
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-  if (_numberOfAttribute == 0)
-    {
-      MESSAGE("Les familles SMESH n ont pas d attribut");
-      THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                                   ,SALOME::BAD_PARAM);
-    }
-
-  ASSERT (i <= _numberOfAttribute);
-  return _attributeValue[i];
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attributes desriptions
- */
-//=============================================================================
-SALOME_TYPES::ListOfString * SMESH_MEDFamily_i::getAttributesDescriptions() 
-  throw (SALOME::SALOME_Exception)
-{
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-  if (_numberOfAttribute == 0)
-    {
-      MESSAGE("Les familles SMESH n ont pas d attribut");
-      THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                                   ,SALOME::BAD_PARAM);
-    }
-  SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
-  for (int i=0;i<_numberOfAttribute;i++)
-    {
-      myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
-    }
-  return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attribute description i
- */
-//=============================================================================
-char *  SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i) 
-  throw (SALOME::SALOME_Exception)
-{   
-  if (_subMesh==NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
-                                 SALOME::INTERNAL_ERROR);
-  if (_numberOfAttribute == 0)
-    {
-      MESSAGE("Les familles SMESH n ont pas d attribut");
-      THROW_SALOME_CORBA_EXCEPTION("No attributes"\
-                                   ,SALOME::BAD_PARAM);
-    }
-  ASSERT (i <= _numberOfAttribute);
-  return CORBA::string_dup(_attributeDescription[i].c_str());
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for the number of groups
- */
-//=============================================================================
-CORBA::Long SMESH_MEDFamily_i::getNumberOfGroups()
-    throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  return 0;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for the name of the group i
- */
-//=============================================================================
-char * SMESH_MEDFamily_i::getGroupName( CORBA::Long i)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  return NULL;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for all the groups name
- */
-//=============================================================================
-SALOME_TYPES::ListOfString* SMESH_MEDFamily_i::getGroupsNames()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  return NULL;
-}
diff --git a/src/SMESH_I/SMESH_MEDFamily_i.hxx b/src/SMESH_I/SMESH_MEDFamily_i.hxx
deleted file mode 100644 (file)
index f4ec074..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2007-2013  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   : SMESH_MEDFamily_i.hxx
-//  Module : SMESH
-//
-#ifndef SMESH_MED_FAMILY_I_HXX_
-#define SMESH_MED_FAMILY_I_HXX_
-
-#include "SMESH.hxx"
-
-#include "SMESH_MEDSupport_i.hxx"
-
-#include<string>
-
-class SMESH_I_EXPORT SMESH_MEDFamily_i:
-  public virtual POA_SALOME_MED::FAMILY,
-  public virtual SMESH_MEDSupport_i
-{
-protected :
-  SMESH_MEDFamily_i();
-  ~SMESH_MEDFamily_i();
-  
-  ::SMESH_subMesh_i*      _subMesh_i;
-  
-  // Values
-  int       _identifier;
-  int       _numberOfAttribute;
-  int    *  _attributeIdentifier;
-  int    *  _attributeValue;
-  std::string *  _attributeDescription;
-  int       _numberOfGroup ;
-  std::string *  _groupName ;
-  
-
-public :
-  
-  // Constructors and associated internal methods
-  SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
-                    std::string name, std::string description, SALOME_MED::medEntityMesh entity );
-  SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f);
-  
-  // IDL Methods
-  void setProtocol(SALOME::TypeOfCommunication typ) {}
-  void release() {}
-  SALOME::SenderInt_ptr getSenderForNumber(SALOME_MED::medGeometryElement) {return SALOME::SenderInt::_nil();}
-  SALOME::SenderInt_ptr getSenderForNumberIndex() {return SALOME::SenderInt::_nil();}
-  
-  CORBA::Long            getIdentifier()      
-    throw (SALOME::SALOME_Exception);
-  CORBA::Long            getNumberOfAttributes() 
-    throw (SALOME::SALOME_Exception);
-  SALOME_TYPES::ListOfLong*   getAttributesIdentifiers() 
-    throw (SALOME::SALOME_Exception);
-  CORBA::Long            getAttributeIdentifier(CORBA::Long i) 
-    throw (SALOME::SALOME_Exception);
-  SALOME_TYPES::ListOfLong*   getAttributesValues() 
-    throw (SALOME::SALOME_Exception);
-  CORBA::Long            getAttributeValue(CORBA::Long i) 
-    throw (SALOME::SALOME_Exception);
-  SALOME_TYPES::ListOfString* getAttributesDescriptions() 
-    throw (SALOME::SALOME_Exception);
-  char*                  getAttributeDescription( CORBA::Long i) 
-    throw (SALOME::SALOME_Exception);
-  CORBA::Long               getNumberOfGroups()
-    throw (SALOME::SALOME_Exception);
-  char *                    getGroupName( CORBA::Long i)
-    throw (SALOME::SALOME_Exception);
-  SALOME_TYPES::ListOfString* getGroupsNames()
-    throw (SALOME::SALOME_Exception);  
-};
-#endif /* MED_FAMILY_I_HXX_ */
diff --git a/src/SMESH_I/SMESH_MEDMesh_i.cxx b/src/SMESH_I/SMESH_MEDMesh_i.cxx
deleted file mode 100644 (file)
index f338dfe..0000000
+++ /dev/null
@@ -1,1210 +0,0 @@
-// Copyright (C) 2007-2013  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   : SMESH_MEDMesh_i.cxx
-//  Module : SMESH
-//
-#include "SMESH_MEDMesh_i.hxx"
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_Mesh_i.hxx"
-
-#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_Iterator.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_CompSolid.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopTools_MapOfShape.hxx>
-
-#include <utilities.h>
-#include <Utils_CorbaException.hxx>
-
-#include <Utils_ORB_INIT.hxx>
-#include <Utils_SINGLETON.hxx>
-#include <Utils_ExceptHandlers.hxx>
-#include <SALOMEDS_wrap.hxx>
-
-extern "C"
-{
-#include <stdio.h>
-}
-
-using namespace std;
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-// PN Est-ce un const ?
-SMESH_MEDMesh_i::SMESH_MEDMesh_i()
-{
-  BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
-  END_OF("Default Constructor SMESH_MEDMesh_i");
-}
-
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
-{
-}
-
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
-                                                       _compte(false),
-                                                       _creeFamily(false),
-                                                       _famIdent(0),
-                                                       _indexElts(0),
-                                                       _indexEnts(0)
-{
-  BEGIN_OF("Constructor SMESH_MEDMesh_i");
-
-  _mesh_i = m_i;
-  _meshDS = _mesh_i->GetImpl().GetMeshDS();
-
-  END_OF("Constructor SMESH_MEDMesh_i");
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Name
- */
-//=============================================================================
-char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
-{
-  if (_meshDS == NULL)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-
-  try
-  {
-    SMESH_Gen_i*             gen = SMESH_Gen_i::GetSMESHGen();
-    SALOMEDS::Study_var    study = gen->GetCurrentStudy();
-    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(...)
-  {
-    MESSAGE("Exception en accedant au nom");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for corbaindex cuisine interne 
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Non Implemente");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Space Dimension
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
-{
-  // PN : Il semblerait que la dimension soit fixee a 3
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  return 3;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Mesh Dimension
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  // PN : Il semblerait que la dimension soit fixee a 3
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  return 3;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for the boolean _isAGrid
- */
-//=============================================================================
-CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return false;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for the connectivities, to see if they exist
- */
-//=============================================================================
-CORBA::Boolean
-SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
-                                   SALOME_MED::medEntityMesh entity)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
-
-
-  return false;
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinate
- */
-//=============================================================================
-CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return 0.0;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates System
- */
-//=============================================================================
-char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  // PN : En dur. Non encore prevu
-  try
-  {
-    string systcoo = "CARTESIEN";
-    return CORBA::string_dup(systcoo.c_str());
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant au maillage");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates
- */
-//=============================================================================
-SALOME_TYPES::ListOfDouble * SMESH_MEDMesh_i::getCoordinates
-(SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  SALOME_TYPES::ListOfDouble_var myseq = new SALOME_TYPES::ListOfDouble;
-  try
-  {
-    // PN  : En dur
-    int spaceDimension = 3;
-    int nbNodes = _meshDS->NbNodes();
-    SCRUTE(nbNodes);
-    myseq->length(nbNodes * spaceDimension);
-    int i = 0;
-
-    SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
-    while(itNodes->more())
-    {
-      const SMDS_MeshNode* node = itNodes->next();
-
-      if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
-      {
-        myseq[i * 3] = node->X();
-        myseq[i * 3 + 1] = node->Y();
-        myseq[i * 3 + 2] = node->Z();
-        SCRUTE(myseq[i * 3]);
-        SCRUTE(myseq[i * 3 + 1]);
-        SCRUTE(myseq[i * 3 + 2]);
-      }
-      else
-      {
-        ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
-        myseq[i] = node->X();
-        myseq[i + nbNodes] = node->Y();
-        myseq[i + (nbNodes * 2)] = node->Z();
-        SCRUTE(myseq[i]);
-        SCRUTE(myseq[i + nbNodes]);
-        SCRUTE(myseq[i + (nbNodes * 2)]);
-      }
-      i++;
-    }
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant aux coordonnees");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-  return myseq._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates Names
- */
-//=============================================================================
-SALOME_TYPES::ListOfString *
-SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
-  try
-  {
-    // PN : en dur
-    int spaceDimension = 3;
-    myseq->length(spaceDimension);
-    myseq[0] = CORBA::string_dup("x");
-    myseq[1] = CORBA::string_dup("y");
-    myseq[2] = CORBA::string_dup("z");
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant aux noms des coordonnees");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-  return myseq._retn();
-
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates Units
- */
-//=============================================================================
-SALOME_TYPES::ListOfString *
-SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
-  try
-  {
-    // PN : en dur
-    int spaceDimension = 3;
-    myseq->length(spaceDimension);
-    myseq[0] = CORBA::string_dup("m");
-    myseq[1] = CORBA::string_dup("m");
-    myseq[2] = CORBA::string_dup("m");
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant aux unites des coordonnees");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-  return myseq._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Number of Nodes
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  try
-  {
-    return _meshDS->NbNodes();
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant au nombre de noeuds");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for number of Types
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
-  throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  try
-  {
-    if (!_compte)
-      calculeNbElts();
-    int retour = 0;
-    if (_mapNbTypes.find(entity) != _mapNbTypes.end())
-      retour = _mapNbTypes[entity];
-    return retour;
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant au nombre de Types");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for existing geometry element types 
- *        Not implemented for MED_ALL_ENTITIES
- */
-//=============================================================================
-SALOME_MED::medGeometryElement_array *
-SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
-                                                                  SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  if (entity == SALOME_MED::MED_ALL_ENTITIES)
-    THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
-                                 SALOME::BAD_PARAM);
-  if (!_compte)
-    calculeNbElts();
-  SALOME_MED::medGeometryElement_array_var myseq =
-    new SALOME_MED::medGeometryElement_array;
-  try
-  {
-    if (_mapNbTypes.find(entity) == _mapNbTypes.end())
-      THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
-                                   SALOME::BAD_PARAM);
-    int nbTypes = _mapNbTypes[entity];
-
-    myseq->length(nbTypes);
-
-    if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
-      THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
-                                   SALOME::INTERNAL_ERROR);
-
-    int index = _mapIndToVectTypes[entity];
-    ASSERT(_TypesId[index].size() != 0);
-    int i = 0;
-    vector < SALOME_MED::medGeometryElement >::iterator it;
-    for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
-    {
-      myseq[i++] = *it;
-    };
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant aux differents types");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-  return myseq._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns number of elements of type medGeometryElement
- *        Not implemented for MED_ALL_ELEMENTS 
- *        implemented for MED_ALL_ENTITIES
- *
- * Dans cette implementation, il n est pas prevu de tenir compte du entity
- * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement 
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
-                                                 medEntityMesh entity,
-                                                 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
-    THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
-                                 SALOME::BAD_PARAM);
-  if (!_compte)
-    calculeNbElts();
-
-  try
-  {
-    int retour = 0;
-    if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
-    {
-      int index = _mapIndToSeqElts[geomElement];
-
-      retour = _seq_elemId[index]->length();
-    }
-    return retour;
-  }
-  catch(...)
-  {
-    MESSAGE("Exception en accedant au nombre d élements");
-    THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
-                                 SALOME::INTERNAL_ERROR);
-  }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for connectivities
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong *
-SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medConnectivity mode,
-                                 SALOME_MED::medEntityMesh entity,
-                                 SALOME_MED::medGeometryElement geomElement)
-  throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  if (mode != SALOME_MED::MED_NODAL)
-    THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  /*if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
-    THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);*/
-  if (!_compte)
-    calculeNbElts();
-
-  // Faut-il renvoyer un pointeur vide ???
-  if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
-    THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
-                                 SALOME::BAD_PARAM);
-
-  int index = _mapIndToSeqElts[geomElement];
-
-  return _seq_elemId[index]._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for connectivities
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong *
-SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
-                                      SALOME_MED::medEntityMesh entity)
-  throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: Find an element corresponding to the given connectivity
- */
-//=============================================================================
-CORBA::Long
-SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
-                                  SALOME_MED::medEntityMesh entity,
-                                  SALOME_MED::medGeometryElement type,
-                                  const SALOME_TYPES::ListOfLong & connectivity)
-  throw(SALOME::SALOME_Exception)
-{
-  const char *LOC = "getElementNumber ";
-  MESSAGE(LOC << "Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return -1;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Ascendant connectivities
- * not implemented for MED_ALL_ENTITIES and MED_MAILLE
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong *
-SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
-                                        medConnectivity mode) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for connectivities
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong *
-SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
-                                             medConnectivity mode) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns number of families within the mesh
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
-                                                 medEntityMesh entity) throw(SALOME::SALOME_Exception)
-{
-  if (_creeFamily == false)
-    createFamilies();
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  return _families.size();
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns number of groups within the mesh
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
-  throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  MESSAGE(" Pas d implementation des groupes dans SMESH");
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns references for families within the mesh
- */
-//=============================================================================
-SALOME_MED::Family_array *
-SMESH_MEDMesh_i::getFamilies(SALOME_MED::
-                             medEntityMesh entity) throw(SALOME::SALOME_Exception)
-{
-  if (_creeFamily == false)
-    createFamilies();
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
-  int nbfam = _families.size();
-  myseq->length(nbfam);
-  int i = 0;
-  vector < SALOME_MED::FAMILY_ptr >::iterator it;
-  for (it = _families.begin(); it != _families.end(); it++)
-  {
-    myseq[i++] = *it;
-  };
-  return myseq._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns references for family i within the mesh
- */
-//=============================================================================
-SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
-                                                  medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
-{
-  if (_creeFamily == false)
-    createFamilies();
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-
-  SCRUTE(_families[i]->getName());
-  MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns references for groups within the mesh
- */
-//=============================================================================
-SALOME_MED::Group_array *
-SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
-                                                                   SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  MESSAGE(" Pas d implementation des groupes dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
-}
-
-//=============================================================================
-/*!
- * CORBA: Returns references for group i within the mesh
- */
-//=============================================================================
-SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
-                                                medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
-{
-  if (_mesh_i == 0)
-    THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                                 SALOME::INTERNAL_ERROR);
-  MESSAGE(" Pas d implementation des groupes dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for the global numbering index
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong*
-SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for the support of boundary elements of type
- * entity
- */
-//=============================================================================
-SALOME_MED::SUPPORT_ptr
-SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-//=============================================================================
-/*!
- * CORBA:  Method return a reference on a support define on all the element of
- *         an entity.
- */
-//=============================================================================
-SALOME_MED::SUPPORT_ptr
-SMESH_MEDMesh_i::getSupportOnAll(SALOME_MED::medEntityMesh entity)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for the support of the skin of the support
- * mySupport3D
- */
-//=============================================================================
-SALOME_MED::SUPPORT_ptr
-SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-//=============================================================================
-/*!
- * CORBA: 
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
-                                                 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: 
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
-                                               SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: 
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
-                                                 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: 
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
-                                                 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: 
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
-                                                     SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Pas Implemente dans SMESH");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: 
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
-                                                        SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Non Implemente");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * CORBA: add the Mesh in the StudyManager 
- * PN Pas Implemente
- */
-//=============================================================================
-void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
-                                 SALOME_MED::GMESH_ptr myIor) throw(SALOME::SALOME_Exception)
-{
-  BEGIN_OF("MED_Mesh_i::addInStudy");
-  if (_meshId != "")
-  {
-    MESSAGE("Mesh already in Study");
-    THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", SALOME::BAD_PARAM);
-  }
-  END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
-}
-
-//=============================================================================
-/*!
- * CORBA: write mesh in a med file
- */
-//=============================================================================
-void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
-  throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Non Implemente");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-}
-
-//=============================================================================
-/*!
- * CORBA: read mesh in a med file
- */
-//=============================================================================
-void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Non Implemente");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-}
-
-//=============================================================================
-/*!
- * CORBA : release driver
- */
-//=============================================================================
-void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Non Implemente");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-}
-
-//=============================================================================
-/*!
- * CORBA : attach driver
- */
-//=============================================================================
-CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
-                                       const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
-{
-  MESSAGE("Non Implemente");
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-  return 0;
-}
-
-//=============================================================================
-/*!
- * Calcule le Nb d'elements par entite geometrique
- */
-//=============================================================================
-void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
-{
-  if (!_compte)
-  {
-    _compte = true;
-
-    _mapNbTypes[SALOME_MED::MED_NODE] = 1;
-    // On compte les aretes MED_SEG2 ou MED_SEG3
-    // On range les elements dans  les vecteurs correspondants 
-
-    _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
-    _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
-    _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
-
-    int trouveSeg2 = 0;
-    int trouveSeg3 = 0;
-    SALOME_MED::medGeometryElement medElement;
-
-    SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
-    while(itEdges->more())
-    {
-      const SMDS_MeshEdge* elem = itEdges->next();
-      int nb_of_nodes = elem->NbNodes();
-
-      switch (nb_of_nodes)
-      {
-      case 2:
-        {
-          medElement = SALOME_MED::MED_SEG2;
-          if (trouveSeg2 == 0)
-          {
-            trouveSeg2 = 1;
-            _TypesId[SALOME_MED::MED_EDGE].
-              push_back(SALOME_MED::MED_SEG2);
-          }
-          break;
-        }
-      case 3:
-        {
-          medElement = SALOME_MED::MED_SEG3;
-          if (trouveSeg3 == 0)
-          {
-            trouveSeg3 = 1;
-            _TypesId[SALOME_MED::MED_EDGE].
-              push_back(SALOME_MED::MED_SEG3);
-          }
-          break;
-        }
-      }
-      int index = _mapIndToSeqElts[medElement];
-      SCRUTE(index);
-      // Traitement de l arete
-
-      int longueur = _seq_elemId[index]->length();
-      _seq_elemId[index]->length(longueur + nb_of_nodes);
-
-      SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
-
-      for(int k=0; itn->more(); k++)
-        _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
-    }
-
-    _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
-
-    // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
-    // On range les elements dans  les vecteurs correspondants 
-    int trouveTria3 = 0;
-    int trouveTria6 = 0;
-    int trouveQuad4 = 0;
-
-    _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
-    _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
-    _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
-    _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
-
-    SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
-    while(itFaces->more())
-    {
-      const SMDS_MeshFace * elem = itFaces->next();
-      int nb_of_nodes = elem->NbNodes();
-
-      switch (nb_of_nodes)
-      {
-      case 3:
-        {
-          medElement = SALOME_MED::MED_TRIA3;
-          if (trouveTria3 == 0)
-          {
-            trouveTria3 = 1;
-            _TypesId[SALOME_MED::MED_FACE].
-              push_back(SALOME_MED::MED_TRIA3);
-          }
-          break;
-        }
-      case 4:
-        {
-          medElement = SALOME_MED::MED_QUAD4;
-          if (trouveQuad4 == 0)
-          {
-            trouveQuad4 = 1;
-            _TypesId[SALOME_MED::MED_FACE].
-              push_back(SALOME_MED::MED_QUAD4);
-          }
-          break;
-        }
-      case 6:
-        {
-          medElement = SALOME_MED::MED_TRIA6;
-          if (trouveTria6 == 0)
-          {
-            trouveTria6 = 1;
-            _TypesId[SALOME_MED::MED_FACE].
-              push_back(SALOME_MED::MED_TRIA6);
-          }
-          break;
-        }
-      }
-      int index = _mapIndToSeqElts[medElement];
-      SCRUTE(index);
-
-      // Traitement de la face
-      // Attention La numérotation des noeuds Med commence a 1
-
-      int longueur = _seq_elemId[index]->length();
-      _seq_elemId[index]->length(longueur + nb_of_nodes);
-
-      SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
-
-      for(int k=0; itn->more(); k++)
-        _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
-    } //itFaces
-
-    _mapNbTypes[SALOME_MED::MED_FACE] =
-      trouveTria3 + trouveTria6 + trouveQuad4;
-
-    _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
-    _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
-    int index = _mapIndToSeqElts[medElement];
-
-    int trouveHexa8 = 0;
-
-    SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
-    while(itVolumes->more())
-    {
-      const SMDS_MeshVolume * elem = itVolumes->next();
-
-      int nb_of_nodes = elem->NbNodes();
-      medElement = SALOME_MED::MED_HEXA8;
-      ASSERT(nb_of_nodes == 8);
-
-      if (trouveHexa8 == 0)
-      {
-        trouveHexa8 = 1;
-        _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
-      };
-      // Traitement de la maille
-      int longueur = _seq_elemId[index]->length();
-      _seq_elemId[index]->length(longueur + nb_of_nodes);
-
-      SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
-      for(int k=0; itn->more(); k++)
-        _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
-    }
-
-    _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
-    _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
-      =
-      trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
-      trouveSeg3;
-  }// fin du _compte
-};
-
-//=============================================================================
-/*!
- * Creation des familles
- */
-//=============================================================================
-void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
-{
-  Unexpect aCatch(SALOME_SalomeException);
-  string famDes = ("Je ne sais pas");
-  string famName0 = "Famille_";
-  string famName;
-  char numero[10];
-
-  if (_creeFamily == false)
-  {
-    _creeFamily = true;
-    //SMESH_subMesh_i *subMeshServant;
-
-    map < int, SMESH_subMesh_i * >::iterator it;
-    for (it = _mesh_i->_mapSubMesh_i.begin();
-         it != _mesh_i->_mapSubMesh_i.end(); it++)
-    {
-      SMESH_subMesh_i *submesh_i = (*it).second;
-      int famIdent = (*it).first;
-
-      ASSERT(famIdent < 999999999);
-      sprintf(numero, "%d\n", famIdent);
-      famName = famName0 + numero;
-
-      SMESH_MEDFamily_i *famservant =
-        new SMESH_MEDFamily_i(famIdent, submesh_i,
-                              famName, famDes, SALOME_MED::MED_NODE);
-#ifdef WNT
-      SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
-      POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
-      if ( servantbase )
-        famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
-#else 
-      SALOME_MED::FAMILY_ptr famille = 
-        SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
-#endif
-      _families.push_back(famille);
-    }
-  }
-};
-//=============================================================================
-/*!
- * Gives informations of the considered mesh.
- */
-//=============================================================================
-SALOME_MED::GMESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-
-//================================================================================
-/*!
- * \brief Converts this GMESH into MESH
- */
-//================================================================================
-
-SALOME_MED::MESH_ptr SMESH_MEDMesh_i::convertInMESH() throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-
-//=============================================================================
-/*!
- * Gives informations on coordinates of the considered mesh.
- */
-//=============================================================================
-SALOME_MED::GMESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-//=============================================================================
-/*!
- * Gives informations on connectivities of the considered mesh for the entity
- * entity.
- */
-//=============================================================================
-SALOME_MED::MESH::connectivityInfos *
-SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return NULL;
-}
-//=============================================================================
-/*!
- * Gives the type of the element number of entity entity
- */
-//=============================================================================
-SALOME_MED::medGeometryElement
-SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
-                                CORBA::Long number)
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
-
-  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
-
-  return (SALOME_MED::medGeometryElement) 0;
-}
diff --git a/src/SMESH_I/SMESH_MEDMesh_i.hxx b/src/SMESH_I/SMESH_MEDMesh_i.hxx
deleted file mode 100644 (file)
index db415bc..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright (C) 2007-2013  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   : SMESH_MEDMesh_i.hxx
-//  Module : SMESH
-//
-#ifndef _MED_SMESH_MESH_I_HXX_
-#define _MED_SMESH_MESH_I_HXX_
-
-#include "SMESH.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(MED)
-#include <string>
-#include <vector>
-#include <map>
-
-#include "SMESHDS_Mesh.hxx"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-#include "SALOME_GenericObj_i.hh"
-
-#define MED_NBR_GEOMETRIE_MAILLE 15
-#define MED_NBR_TYPE 5
-
-class SMESH_Mesh_i;
-
-class SMESH_I_EXPORT SMESH_MEDMesh_i:
-  public virtual POA_SALOME_MED::MESH, 
-  public virtual SALOME::GenericObj_i
-{
-protected:
-  // C++ object containing values
-  ::SMESH_Mesh_i * _mesh_i;
-  SMESHDS_Mesh *_meshDS;
-  
-  std::string _meshId;
-  bool _compte;
-  bool _creeFamily;
-  int _indexElts;
-  int _indexEnts;
-  int _famIdent;
-  
-  std::map < SALOME_MED::medGeometryElement, int >_mapIndToSeqElts;
-  SALOME_TYPES::ListOfLong_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE];
-  
-  std::map < SALOME_MED::medEntityMesh, int >_mapNbTypes;
-  std::map < SALOME_MED::medEntityMesh, int >_mapIndToVectTypes;
-  std::vector < SALOME_MED::medGeometryElement >
-  _TypesId[MED_NBR_GEOMETRIE_MAILLE];
-  
-  std::vector < SALOME_MED::FAMILY_ptr > _families;
-public:
-  
-  // Constructors and associated internal methods
-  SMESH_MEDMesh_i();
-  SMESH_MEDMesh_i(SMESH_Mesh_i * m);
-  ~SMESH_MEDMesh_i();
-  
-  // IDL Methods
-  void setProtocol(SALOME::TypeOfCommunication typ) {}
-  void release() {}
-  SALOME::SenderDouble_ptr getSenderForCoordinates(SALOME_MED::medModeSwitch) {return SALOME::SenderDouble::_nil();}
-  SALOME::SenderInt_ptr getSenderForConnectivity(SALOME_MED::medConnectivity, 
-                                                 SALOME_MED::medEntityMesh, 
-                                                 SALOME_MED::medGeometryElement) 
-  {
-    return SALOME::SenderInt::_nil();
-  }  
-  SALOME::SenderInt_ptr getSenderForConnectivityIndex(SALOME_MED::medConnectivity,
-                                                      SALOME_MED::medEntityMesh,
-                                                      SALOME_MED::medGeometryElement)
-  {
-    return SALOME::SenderInt::_nil();
-  }  
-  SALOME::SenderInt_ptr getSenderForPolygonsConnectivity(SALOME_MED::medConnectivity, SALOME_MED::medEntityMesh) {return SALOME::SenderInt::_nil();}
-  SALOME::SenderInt_ptr getSenderForPolygonsConnectivityIndex(SALOME_MED::medConnectivity, SALOME_MED::medEntityMesh) {return SALOME::SenderInt::_nil();}
-  SALOME::SenderInt_ptr getSenderForPolyhedronConnectivity(SALOME_MED::medConnectivity) {return SALOME::SenderInt::_nil();}
-  SALOME::SenderInt_ptr getSenderForPolyhedronIndex(SALOME_MED::medConnectivity) {return SALOME::SenderInt::_nil();}
-  SALOME::SenderInt_ptr getSenderForPolyhedronFacesIndex() {return SALOME::SenderInt::_nil();}
-  
-  char *getName() throw(SALOME::SALOME_Exception);
-  CORBA::Long getSpaceDimension() throw(SALOME::SALOME_Exception);
-  
-  CORBA::Long getMeshDimension() throw(SALOME::SALOME_Exception);
-  
-  CORBA::Boolean  getIsAGrid() throw (SALOME::SALOME_Exception);
-  
-  CORBA::Boolean
-  existConnectivity(SALOME_MED::medConnectivity connectivityType,
-                    SALOME_MED::medEntityMesh entity)
-    throw (SALOME::SALOME_Exception);
-  
-  char *getCoordinatesSystem() throw(SALOME::SALOME_Exception);
-  
-  CORBA::Double getCoordinate(CORBA::Long Number, CORBA::Long Axis)
-    throw (SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfDouble * getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
-    throw(SALOME::SALOME_Exception);
-
-  SALOME_TYPES::ListOfString * getCoordinatesNames()
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfString * getCoordinatesUnits()
-    throw(SALOME::SALOME_Exception);
-  
-  CORBA::Long getNumberOfNodes() throw(SALOME::SALOME_Exception);
-  
-  CORBA::Long getNumberOfTypes(SALOME_MED::medEntityMesh entity)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::medGeometryElement_array *
-  getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
-                                                   SALOME_Exception);
-  
-  SALOME_MED::medGeometryElement
-  getElementType(SALOME_MED::medEntityMesh entity,
-                 CORBA::Long number)
-    throw   (SALOME::SALOME_Exception);
-  
-  CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity,
-                                  SALOME_MED::medGeometryElement geomElement)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfLong *
-  getConnectivity(SALOME_MED::medConnectivity mode,
-                  SALOME_MED::medEntityMesh entity,
-                  SALOME_MED::medGeometryElement geomElement)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfLong *
-  getConnectivityIndex(SALOME_MED::medConnectivity mode,
-                       SALOME_MED::medEntityMesh entity)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfLong*
-  getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
-    throw (SALOME::SALOME_Exception);
-  
-  CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
-                               SALOME_MED::medEntityMesh entity,
-                               SALOME_MED::medGeometryElement type,
-                               const SALOME_TYPES::ListOfLong & connectivity)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfLong *
-  getReverseConnectivity(SALOME_MED::medConnectivity mode)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_TYPES::ListOfLong *
-  getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) 
-    throw(SALOME::SALOME_Exception);
-  
-  // Family and Group
-  CORBA::Long getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
-    throw(SALOME::SALOME_Exception);
-  
-  CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::Family_array *
-  getFamilies(SALOME_MED::medEntityMesh entity)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity,
-                                   CORBA::Long i) 
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::GROUP_ptr getGroup(SALOME_MED::medEntityMesh entity,
-                                 CORBA::Long i) 
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::SUPPORT_ptr
-  getBoundaryElements(SALOME_MED::medEntityMesh entity)
-    throw (SALOME::SALOME_Exception);
-  
-  SALOME_MED::SUPPORT_ptr
-  getSupportOnAll(SALOME_MED::medEntityMesh entity)
-    throw (SALOME::SALOME_Exception);
-  
-  SALOME_MED::SUPPORT_ptr getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
-    throw (SALOME::SALOME_Exception);
-  
-  SALOME_MED::FIELD_ptr getVolume(SALOME_MED::SUPPORT_ptr mySupport)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::FIELD_ptr getArea(SALOME_MED::SUPPORT_ptr mySupport)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::FIELD_ptr getLength(SALOME_MED::SUPPORT_ptr mySupport)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::FIELD_ptr getNormal(SALOME_MED::SUPPORT_ptr mySupport)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::FIELD_ptr getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::FIELD_ptr getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
-    throw(SALOME::SALOME_Exception);
-  
-  // Others
-  void addInStudy(SALOMEDS::Study_ptr myStudy,
-                  SALOME_MED::GMESH_ptr myIor) 
-    throw(SALOME::SALOME_Exception);
-  CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType,
-                        const char *fileName, const char *meshName)
-    throw(SALOME::SALOME_Exception);
-  void rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception);
-  void read(CORBA::Long i) throw(SALOME::SALOME_Exception);
-  void write(CORBA::Long i, const char *driverMeshName)
-    throw(SALOME::SALOME_Exception);
-  
-  //                    Cuisine interne
-  CORBA::Long getCorbaIndex() 
-    throw(SALOME::SALOME_Exception);
-  
-  SALOME_MED::GMESH::meshInfos * getMeshGlobal()
-    throw (SALOME::SALOME_Exception);
-  
-  bool areEquals(SALOME_MED::GMESH_ptr other) { return false;};
-  
-  SALOME_MED::MESH_ptr convertInMESH() throw (SALOME::SALOME_Exception);
-  
-  SALOME_MED::GMESH::coordinateInfos * getCoordGlobal()
-    throw (SALOME::SALOME_Exception);
-  
-  SALOME_MED::MESH::connectivityInfos *
-  getConnectGlobal(SALOME_MED::medEntityMesh entity)
-    throw (SALOME::SALOME_Exception);
-  
-  //
-  void calculeNbElts() throw(SALOME::SALOME_Exception);
-  void createFamilies() throw(SALOME::SALOME_Exception);
-};
-
-#endif /* _MED_MESH_I_HXX_ */
diff --git a/src/SMESH_I/SMESH_MEDSupport_i.cxx b/src/SMESH_I/SMESH_MEDSupport_i.cxx
deleted file mode 100644 (file)
index 803ffa6..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-// Copyright (C) 2007-2013  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   : SMESH_MEDSupport_i.cxx
-//  Module : SMESH
-//
-#include "SMESH_MEDSupport_i.hxx"
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-#include "Utils_ExceptHandlers.hxx"
-
-#include "SMESHDS_Mesh.hxx"
-
-#include "SMESH_subMesh.hxx"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_subMesh_i.hxx"
-#include "SMESH_Gen_i.hxx"
-
-#include <TopoDS_Iterator.hxx>
-
-using namespace std;
-
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-SMESH_MEDSupport_i::SMESH_MEDSupport_i()
-{
-        BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
-        END_OF("Default Constructor SMESH_MEDSupport_i");
-}
-
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name,
-        string description, SALOME_MED::medEntityMesh entity)
-  :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
-   _seqNumber(false), _seqLength(0)
-{
-        BEGIN_OF("Constructor SMESH_MEDSupport_i");
-
-        int subMeshId = sm->GetId();
-
-        MESSAGE(" subMeshId " << subMeshId);
-
-        SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( sm->GetMesh() );
-        _subMesh = mesh_i->GetImpl().GetSubMeshContaining( subMeshId );
-
-        if (_entity == SALOME_MED::MED_NODE)
-        {
-                _numberOfGeometricType = 1;
-                _geometricType = new SALOME_MED::medGeometryElement[1];
-                _geometricType[0] = SALOME_MED::MED_NONE;
-        }
-        else
-        {
-                MESSAGE("Pas implemente dans cette version");
-                THROW_SALOME_CORBA_EXCEPTION
-                        ("Seules les familles de noeuds sont implementees ",
-                        SALOME::BAD_PARAM);
-        }
-
-        END_OF("Constructor SMESH_MEDSupport_i");
-}
-
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-SMESH_MEDSupport_i::
-SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh(s._subMesh),
-_name(s._name), _description(s._description), _entity(s._entity),
-_seqNumber(false), _seqLength(0)
-{
-        BEGIN_OF("Constructor SMESH_MEDSupport_i");
-
-        END_OF("Constructor SMESH_MEDSupport_i");
-}
-
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-
-SMESH_MEDSupport_i::~SMESH_MEDSupport_i()
-{
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Corba Index 
- */
-//=============================================================================
-
-CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
-{
-        if (_subMesh == NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        MESSAGE("Not implemented for SMESH_i");
-        THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM);
-
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Name 
- */
-//=============================================================================
-
-char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        return CORBA::string_dup(_name.c_str());
-
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Description 
- */
-//=============================================================================
-
-char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        return CORBA::string_dup(_description.c_str());
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Mesh 
- */
-//=============================================================================
-
-SALOME_MED::GMESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
-        SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-
-        return _subMesh_i->GetMesh()->GetMEDMesh();
-}
-
-//=============================================================================
-/*!
- * CORBA: boolean indicating if support concerns all elements 
- */
-//=============================================================================
-
-CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME::
-        SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        if (_seqNumber == false)
-        {
-                if (_entity != SALOME_MED::MED_NONE)
-                {
-                        _seqLength = _subMesh_i->GetNumberOfNodes(/*all=*/false);
-                        _seqNumber = true;
-                }
-                else
-                {
-                        MESSAGE("Only Node Families are implemented ");
-                        THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ",
-                                SALOME::BAD_PARAM);
-                }
-        }
-        try
-        {
-          _isOnAllElements = (_seqLength == _subMesh->GetFather()->NbNodes());
-        }
-        catch(...)
-        {
-                MESSAGE("unable to acces related Mesh");
-                THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
-                        SALOME::INTERNAL_ERROR);
-        };
-        return _isOnAllElements;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for type of support's entity 
- */
-//=============================================================================
-
-SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME::
-        SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        return _entity;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for types of geometry elements 
- */
-//=============================================================================
-
-SALOME_MED::medGeometryElement_array *
-        SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        SALOME_MED::medGeometryElement_array_var myseq =
-                new SALOME_MED::medGeometryElement_array;
-        try
-        {
-                int mySeqLength = _numberOfGeometricType;
-                myseq->length(mySeqLength);
-                for (int i = 0; i < mySeqLength; i++)
-                {
-                        myseq[i] = _geometricType[i];
-                }
-        }
-        catch(...)
-        {
-                MESSAGE("Exception lors de la recherche des differents types");
-                THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types",
-                        SALOME::INTERNAL_ERROR);
-        }
-        return myseq._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Number of different types of geometry elements
- *        existing in the support
- */
-//=============================================================================
-CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::
-        medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
-{
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-        return _numberOfGeometricType;
-
-}
-
-//=============================================================================
-/*!
- * CORBA: get Nodes 
- */
-//=============================================================================
-
-SALOME_TYPES::ListOfLong * SMESH_MEDSupport_i::getNumber(
-        SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
-{
-  Unexpect aCatch(SALOME_SalomeException);
-        if (_subMesh==NULL)
-                THROW_SALOME_CORBA_EXCEPTION("No associated Support",
-                        SALOME::INTERNAL_ERROR);
-
-        // A changer s'il ne s agit plus seulement de famille de noeuds
-        if (geomElement != SALOME_MED::MED_NONE)
-                THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM);
-
-        SALOME_TYPES::ListOfLong_var myseq = new SALOME_TYPES::ListOfLong;
-
-        int i = 0;
-        myseq->length(_subMesh_i->GetNumberOfNodes(/*all=*/false));
-
-        if ( _subMesh->GetSubMeshDS() )
-        {
-          SMDS_NodeIteratorPtr it = _subMesh->GetSubMeshDS()->GetNodes();
-          while(it->more())
-          {
-            myseq[i] = it->next()->GetID();
-            i++;
-          };
-        }
-
-        SCRUTE(myseq->length());
-        MESSAGE("End of SMESH_MEDSupport_i::getNumber");
-        return myseq._retn();
-
-}
-
-//=============================================================================
-/*!
- * CORBA: get Nodes from file
- */
-//=============================================================================
-
-SALOME_TYPES::ListOfLong * SMESH_MEDSupport_i::getNumberFromFile(
-        SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
-{
-  return getNumber(geomElement);
-}
-
-//=============================================================================
-/*!
- * CORBA: Global Nodes Index (optionnaly designed by the user)
- * CORBA:  ??????????????????????????????
- */
-//=============================================================================
-
-SALOME_TYPES::ListOfLong *
-        SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
-{
-        MESSAGE("Not implemented for SMESH_i");
-        THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-        return NULL;
-}
-//=============================================================================
-/*!
- * CORBA: Array containing indexes for elements included in the support  
- */
-//=============================================================================
-
-CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED::
-        medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
-{
-        MESSAGE("Not implemented for SMESH_i");
-        return 0;
-}
-//=============================================================================
-/*!
- * Gives the number of types of elements included in the support 
- */
-//=============================================================================
-CORBA::Long SMESH_MEDSupport_i::getNumberOfTypes()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  return 0;
-}
-//=============================================================================
-/*!
- * Gives CORBA: Array containing the numbers of Gauss point of elements
- * included in the support 
- */
-//=============================================================================
-SALOME_TYPES::ListOfLong* SMESH_MEDSupport_i::getNumbersOfGaussPoint()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  return NULL;
-}
-//=============================================================================
-/*!
- * build the object which will contain all the boundary elements of the mesh.
- */
-//=============================================================================
-void SMESH_MEDSupport_i::getBoundaryElements()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-}
-//=============================================================================
-/*!
- * Gives information on the support
- */
-//=============================================================================
-SALOME_MED::SUPPORT::supportInfos * SMESH_MEDSupport_i::getSupportGlobal()
-  throw (SALOME::SALOME_Exception)
-{
-  MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
-  THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
-  return NULL;
-}
diff --git a/src/SMESH_I/SMESH_MEDSupport_i.hxx b/src/SMESH_I/SMESH_MEDSupport_i.hxx
deleted file mode 100644 (file)
index d8c1c83..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (C) 2007-2013  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 : SMESH_MEDSupport_i.hxx
-// Module : SMESH
-//
-#ifndef _MED_SMESH_MEDSUPPORT_I_HXX_
-#define _MED_SMESH_MEDSUPPORT_I_HXX_
-
-#include "SMESH.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(MED)
-#include <string>
-
-#include "SMESHDS_Mesh.hxx"
-#include "SMESHDS_SubMesh.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-
-#include "SMESH_MEDSupport_i.hxx"
-#include "SALOME_GenericObj_i.hh"
-class SMESH_subMesh;
-class SMESH_subMesh_i;
-
-class SMESH_I_EXPORT SMESH_MEDSupport_i:
-        public virtual POA_SALOME_MED::SUPPORT, public virtual SALOME::GenericObj_i
-{
-  public:
-
-// Constructors and associated internal methods
-        SMESH_MEDSupport_i(SMESH_subMesh_i * sm,
-                std::string name, std::string description, SALOME_MED::medEntityMesh entity);
-        SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s);
-
-// IDL Methods
-        char *getName() throw(SALOME::SALOME_Exception);
-        char *getDescription() throw(SALOME::SALOME_Exception);
-        SALOME_MED::GMESH_ptr getMesh() throw(SALOME::SALOME_Exception);
-        CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception);
-        SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception);
-        CORBA::Long
-        getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
-          throw(SALOME::SALOME_Exception);
-
-        CORBA::Long getNumberOfTypes() throw (SALOME::SALOME_Exception);
-
-        SALOME_TYPES::ListOfLong *
-        getNumber(SALOME_MED::medGeometryElement geomElement)
-          throw(SALOME::SALOME_Exception);
-
-  /*!
-   * Same function as getNumber.
-   */
-        SALOME_TYPES::ListOfLong *
-        getNumberFromFile(SALOME_MED::medGeometryElement geomElement)
-          throw(SALOME::SALOME_Exception);
-
-        SALOME_TYPES::ListOfLong * getNumberIndex()
-          throw(SALOME::SALOME_Exception);
-
-        CORBA::Long
-        getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement)
-          throw(SALOME::SALOME_Exception);
-
-        SALOME_TYPES::ListOfLong* getNumbersOfGaussPoint()
-          throw (SALOME::SALOME_Exception);
-
-        SALOME_MED::medGeometryElement_array *getTypes()
-          throw(SALOME::SALOME_Exception);
-
-        void getBoundaryElements() throw (SALOME::SALOME_Exception);
-
-        CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception);
-
-        SALOME_MED::SUPPORT::supportInfos * getSupportGlobal()
-          throw (SALOME::SALOME_Exception);
-
-        void createSeq() throw(SALOME::SALOME_Exception);
-
-  public: //public field
-        SMESH_subMesh_i * _subMesh_i;
-        ::SMESH_subMesh * _subMesh;
-
-        std::string _name;
-        std::string _description;
-        bool _isOnAllElements;
-        bool _seqNumber;
-        int _seqLength;
-
-        SALOME_MED::medEntityMesh _entity;
-        SALOME_MED::medGeometryElement * _geometricType;
-        int _numberOfGeometricType;
-
-  protected:
-        SMESH_MEDSupport_i();
-        ~SMESH_MEDSupport_i();
-};
-
-#endif /* _MED_MEDSUPPORT_I_HXX_ */
index 6cb26a80ab6931f5803e96d2c9491228f2dfc9a2..25750af0e18455154c9a3509ce6dee5a9cd8cbf3 100644 (file)
@@ -274,13 +274,23 @@ namespace MeshEditor_I {
                   TIDSortedElemSet&         aMap,
                   const SMDSAbs_ElementType aType = SMDSAbs_All )
   {
-    for (int i=0; i<IDs.length(); i++) {
-      CORBA::Long ind = IDs[i];
-      const SMDS_MeshElement * elem =
-        (aType == SMDSAbs_Node ? aMesh->FindNode(ind) : aMesh->FindElement(ind));
-      if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType ))
-        aMap.insert( aMap.end(), elem );
-    }
+    SMDS_MeshElement::NonNullFilter filter1;
+    SMDS_MeshElement::TypeFilter    filter2( aType );
+    SMDS_MeshElement::Filter &      filter =
+      ( aType == SMDSAbs_All ) ? (SMDS_MeshElement::Filter&) filter1 : filter2;
+
+    if ( aType == SMDSAbs_Node )
+      for (int i=0; i<IDs.length(); i++) {
+        const SMDS_MeshElement * elem = aMesh->FindNode( IDs[i] );
+        if ( filter( elem ))
+          aMap.insert( aMap.end(), elem );
+      }
+    else
+      for (int i=0; i<IDs.length(); i++) {
+        const SMDS_MeshElement * elem = aMesh->FindElement( IDs[i] );
+        if ( filter( elem ))
+          aMap.insert( aMap.end(), elem );
+      }
   }
   //================================================================================
   /*!
@@ -711,6 +721,14 @@ struct SMESH_MeshEditor_i::_IDSource : public POA_SMESH::SMESH_IDSource
   SMESH::SMESH_Mesh_ptr _mesh;
   SMESH::long_array* GetIDs()      { return new SMESH::long_array( _ids ); }
   SMESH::long_array* GetMeshInfo() { return 0; }
+  SMESH::long_array* GetNbElementsByType()
+  {
+    SMESH::long_array_var aRes = new SMESH::long_array();
+    aRes->length(SMESH::NB_ELEMENT_TYPES);
+    for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
+      aRes[ i ] = ( i == _type ) ? _ids.length() : 0;
+    return aRes._retn();  
+  }
   SMESH::SMESH_Mesh_ptr GetMesh()  { return SMESH::SMESH_Mesh::_duplicate( _mesh ); }
   bool IsMeshInfoCorrect()         { return true; }
   SMESH::array_of_ElementType* GetTypes()
@@ -746,6 +764,18 @@ bool SMESH_MeshEditor_i::IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSourc
   return SMESH::DownCast<SMESH_MeshEditor_i::_IDSource*>( idSource );
 }
 
+CORBA::Long* SMESH_MeshEditor_i::GetTemporaryIDs( SMESH::SMESH_IDSource_ptr& idSource,
+                                                  int&                       nbIds)
+{
+  if ( _IDSource* tmpIdSource = SMESH::DownCast<SMESH_MeshEditor_i::_IDSource*>( idSource ))
+  {
+    nbIds = (int) tmpIdSource->_ids.length();
+    return & tmpIdSource->_ids[0];
+  }
+  nbIds = 0;
+  return 0;
+}
+
 void SMESH_MeshEditor_i::deleteAuxIDSources()
 {
   std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin();
@@ -1211,6 +1241,7 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
   TPythonDump pyDump;
 
   TIDSortedElemSet elements, elems0D;
+  prepareIdSource( theObject );
   if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     getEditor().Create0DElementsOnAllNodes( elements, elems0D );
 
@@ -1559,6 +1590,8 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO
 
   TPythonDump aTPythonDump; // suppress dump in Reorient()
 
+  prepareIdSource( theObject );
+
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = Reorient(anElementsId);
 
@@ -1593,6 +1626,7 @@ CORBA::Long SMESH_MeshEditor_i::Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
   initData(/*deleteSearchers=*/false);
 
   TIDSortedElemSet elements;
+  prepareIdSource( the2Dgroup );
   if ( !idSourceToSet( the2Dgroup, getMeshDS(), elements, SMDSAbs_Face, /*emptyIfIsMesh=*/1))
     THROW_SALOME_CORBA_EXCEPTION("No faces in given group", SALOME::BAD_PARAM);
 
@@ -1714,6 +1748,8 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr
   initData();
 
   TPythonDump aTPythonDump;  // suppress dump in TriToQuad()
+
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = TriToQuad(anElementsId, Criterion, MaxAngle);
 
@@ -1783,6 +1819,7 @@ CORBA::Boolean SMESH_MeshEditor_i::QuadToTriObject (SMESH::SMESH_IDSource_ptr
 
   TPythonDump aTPythonDump;  // suppress dump in QuadToTri()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = QuadToTri(anElementsId, Criterion);
 
@@ -1813,6 +1850,7 @@ void SMESH_MeshEditor_i::QuadTo4Tri (SMESH::SMESH_IDSource_ptr theObject)
   initData();
 
   TIDSortedElemSet faces;
+  prepareIdSource( theObject );
   if ( !idSourceToSet( theObject, getMeshDS(), faces, SMDSAbs_Face, /*emptyIfIsMesh=*/true ) &&
        faces.empty() )
     THROW_SALOME_CORBA_EXCEPTION("No faces given", SALOME::BAD_PARAM);
@@ -1868,6 +1906,7 @@ CORBA::Boolean SMESH_MeshEditor_i::SplitQuadObject (SMESH::SMESH_IDSource_ptr th
 
   TPythonDump aTPythonDump;  // suppress dump in SplitQuad()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = SplitQuad(anElementsId, Diag13);
 
@@ -1932,6 +1971,7 @@ void SMESH_MeshEditor_i::SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems,
   SMESH_TRY;
   initData();
 
+  prepareIdSource( elems );
   SMESH::long_array_var anElementsId = elems->GetIDs();
   TIDSortedElemSet elemSet;
   arrayToSet( anElementsId, getMeshDS(), elemSet, SMDSAbs_Volume );
@@ -2091,6 +2131,7 @@ SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr              theObjec
 
   TPythonDump aTPythonDump;  // suppress dump in smooth()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = smooth (anElementsId, IDsOfFixedNodes, MaxNbOfIterations,
                                   MaxAspectRatio, Method, IsParametric);
@@ -2292,6 +2333,7 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
                   << theNbOfSteps << ", "
                   << theTolerance << " )";
   }
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   rotationSweep(anElementsId,
                 theAxis,
@@ -2321,6 +2363,7 @@ void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObje
                   << TVar( theNbOfSteps      ) << ", "
                   << TVar( theTolerance      ) << " )";
   }
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   rotationSweep(anElementsId,
                 theAxis,
@@ -2351,6 +2394,7 @@ void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObje
                   << TVar( theNbOfSteps      ) << ", "
                   << TVar( theTolerance      ) << " )";
   }
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   rotationSweep(anElementsId,
                 theAxis,
@@ -2376,6 +2420,7 @@ SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theO
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
                                                theAxis,
@@ -2410,6 +2455,7 @@ SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr th
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
                                                theAxis,
@@ -2445,6 +2491,7 @@ SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr th
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
                                                theAxis,
@@ -2558,6 +2605,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
                                               CORBA::Long               theNbOfSteps)
   throw (SALOME::SALOME_Exception)
 {
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
   if (!myIsPreviewMode) {
@@ -2576,6 +2624,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObj
                                                 CORBA::Long               theNbOfSteps)
   throw (SALOME::SALOME_Exception)
 {
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
   if ( !myIsPreviewMode ) {
@@ -2594,6 +2643,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj
                                                 CORBA::Long               theNbOfSteps)
   throw (SALOME::SALOME_Exception)
 {
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
   if ( !myIsPreviewMode ) {
@@ -2612,6 +2662,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObj
                                                 CORBA::Long               theNbOfSteps)
   throw (SALOME::SALOME_Exception)
 {
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
   if ( !myIsPreviewMode ) {
@@ -2679,6 +2730,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr the
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector, theNbOfSteps, true);
 
@@ -2703,6 +2755,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr t
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
                                                  theNbOfSteps, true, SMDSAbs_Node);
@@ -2727,6 +2780,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
                                                  theNbOfSteps, true, SMDSAbs_Edge);
@@ -2751,6 +2805,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
                                                  theNbOfSteps, true, SMDSAbs_Face);
@@ -3149,6 +3204,7 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObje
                   << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionAlongPath( anElementsId,
                       thePathMesh,
@@ -3194,6 +3250,7 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr   theOb
                   << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionAlongPath( anElementsId,
                       thePathMesh,
@@ -3240,6 +3297,7 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr   theOb
                   << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
   }
   SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   extrusionAlongPath( anElementsId,
                       thePathMesh,
@@ -3327,6 +3385,7 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
                                                       thePathMesh,
@@ -3381,6 +3440,7 @@ ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
                                                       thePathMesh,
@@ -3436,6 +3496,7 @@ ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( theObject );
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
                                                       thePathMesh,
@@ -3493,6 +3554,7 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr  Object,
 {
   TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
 
+  prepareIdSource( Object );
   SMESH::long_array_var anElementsId = Object->GetIDs();
   SMESH::ListOfGroups * aGroups = extrusionAlongPathX(anElementsId,
                                                       Path,
@@ -3781,6 +3843,7 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObj
 
   bool emptyIfIsMesh = myIsPreviewMode ? false : true;
 
+  prepareIdSource( theObject );
   if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
     mirror(elements, theAxis, theMirrorType, theCopy, false);
 }
@@ -3830,6 +3893,7 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           t
 
   SMESH::ListOfGroups * aGroups = 0;
   TIDSortedElemSet elements;
+  prepareIdSource( theObject );
   if ( idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     aGroups = mirror(elements, theMirror, theMirrorType, true, true);
 
@@ -3915,6 +3979,7 @@ SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           the
     mesh = makeMesh( theMeshName );
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
     TIDSortedElemSet elements;
+    prepareIdSource( theObject );
     if ( mesh_i &&
          idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     {
@@ -4043,6 +4108,7 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
 
   bool emptyIfIsMesh = myIsPreviewMode ? false : true;
   
+  prepareIdSource( theObject );
   if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
     translate(elements, theVector, theCopy, false);
 }
@@ -4088,6 +4154,7 @@ SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObjec
 
   SMESH::ListOfGroups * aGroups = 0;
   TIDSortedElemSet elements;
+  prepareIdSource( theObject );
   if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     aGroups = translate(elements, theVector, true, true);
 
@@ -4170,6 +4237,7 @@ SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
 
     TIDSortedElemSet elements;
+    prepareIdSource( theObject );
     if ( mesh_i &&
       idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     {
@@ -4297,6 +4365,7 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
   }
   TIDSortedElemSet elements;
   bool emptyIfIsMesh = myIsPreviewMode ? false : true;
+  prepareIdSource( theObject );
   if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
     rotate(elements,theAxis,theAngle,theCopy,false);
 }
@@ -4346,6 +4415,7 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
 
   SMESH::ListOfGroups * aGroups = 0;
   TIDSortedElemSet elements;
+  prepareIdSource( theObject );
   if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     aGroups = rotate(elements, theAxis, theAngle, true, true);
 
@@ -4437,6 +4507,7 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
     mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
 
     TIDSortedElemSet elements;
+    prepareIdSource( theObject );
     if (mesh_i &&
         idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
     {
@@ -4489,6 +4560,7 @@ SMESH_MeshEditor_i::scale(SMESH::SMESH_IDSource_ptr  theObject,
     theCopy = false;
 
   TIDSortedElemSet elements;
+  prepareIdSource( theObject );
   bool emptyIfIsMesh = myIsPreviewMode ? false : true;
   if ( !idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
     return 0;
@@ -4672,6 +4744,7 @@ void SMESH_MeshEditor_i::FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr
   initData();
 
   TIDSortedNodeSet nodes;
+  prepareIdSource( theObject );
   idSourceToNodeSet( theObject, getMeshDS(), nodes );
 
   ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
@@ -4715,6 +4788,7 @@ FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr      theObject,
   initData();
 
   TIDSortedNodeSet nodes;
+  prepareIdSource( theObject );
   idSourceToNodeSet( theObject, getMeshDS(), nodes );
 
   for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
@@ -4808,6 +4882,7 @@ void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr      theObj
   if ( !(!group->_is_nil() && group->GetType() == SMESH::NODE) )
   {
     TIDSortedElemSet elems;
+    prepareIdSource( theObject );
     idSourceToSet( theObject, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true);
 
     ::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
@@ -5515,8 +5590,11 @@ void SMESH_MeshEditor_i::convertToQuadratic(CORBA::Boolean            theForce3d
   TIDSortedElemSet elems;
   bool elemsOK;
   if ( !( elemsOK = CORBA::is_nil( theObject )))
+  {
+    prepareIdSource( theObject );
     elemsOK =  idSourceToSet( theObject, getMeshDS(), elems,
                               SMDSAbs_All, /*emptyIfIsMesh=*/true );
+  }
   if ( elemsOK )
   {
     if ( !elems.empty() && (*elems.begin())->GetType() == SMDSAbs_Node )
@@ -5595,8 +5673,11 @@ void SMESH_MeshEditor_i::ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr th
   throw (SALOME::SALOME_Exception)
 {
   SMESH_TRY;
-    TPythonDump pyDump;
+
+  TPythonDump pyDump;
+
   TIDSortedElemSet elems;
+  prepareIdSource( theObject );
   if ( idSourceToSet( theObject, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true ))
   {
     if ( elems.empty() )
@@ -5677,11 +5758,99 @@ string SMESH_MeshEditor_i::generateGroupName(const string& thePrefix)
   int index = 0;
 
   while (!groupNames.insert(name).second)
-    name = SMESH_Comment( thePrefix ) << "_" << index;
+    name = SMESH_Comment( thePrefix ) << "_" << index++;
 
   return name;
 }
 
+//================================================================================
+/*!
+ * \brief Prepare SMESH_IDSource for work
+ */
+//================================================================================
+
+void SMESH_MeshEditor_i::prepareIdSource(SMESH::SMESH_IDSource_ptr theObject)
+{
+  if ( SMESH::Filter_i* filter = SMESH::DownCast<SMESH::Filter_i*>( theObject ))
+  {
+    SMESH::SMESH_Mesh_var mesh = myMesh_i->_this();
+    filter->SetMesh( mesh );
+  }
+}
+
+//================================================================================
+/*!
+ * \brief Duplicates given elements, i.e. creates new elements based on the 
+ *        same nodes as the given ones.
+ * \param theElements - container of elements to duplicate.
+ * \param theGroupName - a name of group to contain the generated elements.
+ *                    If a group with such a name already exists, the new elements
+ *                    are added to the existng group, else a new group is created.
+ *                    If \a theGroupName is empty, new elements are not added 
+ *                    in any group.
+ * \return a group where the new elements are added. NULL if theGroupName == "".
+ * \sa DoubleNode()
+ */
+//================================================================================
+
+SMESH::SMESH_Group_ptr
+SMESH_MeshEditor_i::DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
+                                   const char*               theGroupName)
+  throw (SALOME::SALOME_Exception)
+{
+  SMESH::SMESH_Group_var newGroup;
+
+  SMESH_TRY;
+  initData();
+
+  TPythonDump pyDump;
+
+  TIDSortedElemSet elems;
+  prepareIdSource( theElements );
+  if ( idSourceToSet( theElements, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true))
+  {
+    getEditor().DoubleElements( elems );
+
+    if ( strlen( theGroupName ) && !getEditor().GetLastCreatedElems().IsEmpty() )
+    {
+      // group type
+      SMESH::ElementType type =
+        SMESH::ElementType( getEditor().GetLastCreatedElems().Value(1)->GetType() );
+      // find existing group
+      SMESH::ListOfGroups_var groups = myMesh_i->GetGroups();
+      for ( size_t i = 0; i < groups->length(); ++i )
+        if ( groups[i]->GetType() == type )
+        {
+          CORBA::String_var name = groups[i]->GetName();
+          if ( strcmp( name, theGroupName ) == 0 ) {
+            newGroup = SMESH::SMESH_Group::_narrow( groups[i] );
+            break;
+          }
+        }
+      // create a new group
+      if ( newGroup->_is_nil() )
+        newGroup = myMesh_i->CreateGroup( type, theGroupName );
+      // fill newGroup
+      if ( SMESH_Group_i* group_i = SMESH::DownCast< SMESH_Group_i* >( newGroup ))
+      {
+        SMESHDS_Group* groupDS = static_cast< SMESHDS_Group* >( group_i->GetGroupDS() );
+        const SMESH_SequenceOfElemPtr& aSeq = getEditor().GetLastCreatedElems();
+        for ( int i = 1; i <= aSeq.Length(); i++ )
+          groupDS->SMDSGroup().Add( aSeq(i) );
+      }
+    }
+  }
+  // python dump
+  if ( !newGroup->_is_nil() )
+    pyDump << newGroup << " = ";
+  pyDump << this << ".DoubleElements( "
+         << theElements << ", " << "'" << theGroupName <<"')";
+
+  SMESH_CATCH( SMESH::throwCorbaException );
+
+  return newGroup._retn();
+}
+
 //================================================================================
 /*!
   \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@@ -6831,6 +7000,7 @@ SMESH_MeshEditor_i::MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr idSource,
 
   TIDSortedElemSet elements;
   SMDSAbs_ElementType elemType = (dim == SMESH::BND_1DFROM2D) ? SMDSAbs_Face : SMDSAbs_Volume;
+  prepareIdSource( idSource );
   if ( idSourceToSet( idSource, aMeshDS, elements, elemType,/*emptyIfIsMesh=*/true ))
   {
     // mesh to fill in
index 07435e3a6fec2bd9f4243f68e7ea2455f72c92d0..ec6ae3b84f6c3a645e6ece3a6694f4e84ee2bffa 100644 (file)
@@ -89,6 +89,7 @@ public:
   SMESH::SMESH_IDSource_ptr MakeIDSource(const SMESH::long_array& IDsOfElements,
                                          SMESH::ElementType       type);
   static bool               IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource );
+  static CORBA::Long*       GetTemporaryIDs( SMESH::SMESH_IDSource_ptr& idSource, int& nbIds );
 
   CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements)
     throw (SALOME::SALOME_Exception);
@@ -723,6 +724,10 @@ public:
   CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
     throw (SALOME::SALOME_Exception);
 
+  SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
+                                        const char*               theGroupName)
+    throw (SALOME::SALOME_Exception);
+
   CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
                               const SMESH::long_array& theModifiedElems )
     throw (SALOME::SALOME_Exception);
@@ -1077,6 +1082,8 @@ private: //!< private methods
 
   string generateGroupName(const string& thePrefix);
 
+  void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
+
 private: //!< fields
 
   SMESH_Mesh_i*                myMesh_i;
index 0e0e82a6b1d453d30b72f4824d1f2a5055af5e87..41cfc153c18034a852f9fb26048fc35cdab39751 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "DriverMED_R_SMESHDS_Mesh.h"
 #include "DriverMED_W_SMESHDS_Mesh.h"
+#include "MED_Factory.hxx"
 #include "SMDS_EdgePosition.hxx"
 #include "SMDS_ElemIterator.hxx"
 #include "SMDS_FacePosition.hxx"
 #include "SMESHDS_CommandType.hxx"
 #include "SMESHDS_Group.hxx"
 #include "SMESHDS_GroupOnGeom.hxx"
+#include "SMESH_Controls.hxx"
 #include "SMESH_Filter_i.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_Group.hxx"
 #include "SMESH_Group_i.hxx"
-#include "SMESH_MEDMesh_i.hxx"
 #include "SMESH_MeshEditor.hxx"
 #include "SMESH_MeshEditor_i.hxx"
 #include "SMESH_MeshPartDS.hxx"
@@ -382,7 +383,7 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName )
   int major, minor, release;
   if( !MED::getMEDVersion( theFileName, major, minor, release ) )
     major = minor = release = -1;
-  _medFileInfo           = new SALOME_MED::MedFileInfo();
+  _medFileInfo           = new SMESH::MedFileInfo();
   _medFileInfo->fileName = theFileName;
   _medFileInfo->fileSize = 0;
 #ifdef WIN32
@@ -2155,7 +2156,8 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Object_ptr theS
 
   // register CORBA object for persistence
   int nextId = _gen_i->RegisterObject( subMesh );
-  if(MYDEBUG) MESSAGE( "Add submesh to map with id = "<< nextId);
+  if(MYDEBUG) { MESSAGE( "Add submesh to map with id = "<< nextId); }
+  else        { nextId = 0; } // avoid "unused variable" warning in release mode
 
   // to track changes of GEOM groups
   addGeomGroupData( theSubShapeObject, subMesh );
@@ -2270,7 +2272,8 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType
 
     // register CORBA object for persistence
     int nextId = _gen_i->RegisterObject( aGroup );
-    if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
+    if(MYDEBUG) { MESSAGE( "Add group to map with id = "<< nextId); }
+    else        { nextId = 0; } // avoid "unused variable" warning in release mode
 
     // to track changes of GEOM groups
     if ( !theShape.IsNull() ) {
@@ -2706,7 +2709,8 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char*    file,
 void SMESH_Mesh_i::ExportToMEDX (const char*        file,
                                  CORBA::Boolean     auto_groups,
                                  SMESH::MED_VERSION theVersion,
-                                 CORBA::Boolean     overwrite)
+                                 CORBA::Boolean     overwrite,
+                                 CORBA::Boolean     autoDimension)
   throw(SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
@@ -2715,9 +2719,11 @@ void SMESH_Mesh_i::ExportToMEDX (const char*        file,
 
   string aMeshName = prepareMeshNameAndGroups(file, overwrite);
   TPythonDump() << _this() << ".ExportToMEDX( r'"
-                << file << "', " << auto_groups << ", " << theVersion << ", " << overwrite << " )";
+                << file << "', " << auto_groups << ", "
+                << theVersion << ", " << overwrite << ", "
+                << autoDimension << " )";
 
-  _impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion );
+  _impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion, 0, autoDimension );
 }
 
 //================================================================================
@@ -2846,29 +2852,39 @@ void SMESH_Mesh_i::ExportPartToMED(::SMESH::SMESH_IDSource_ptr meshPart,
                                    const char*                 file,
                                    CORBA::Boolean              auto_groups,
                                    ::SMESH::MED_VERSION        version,
-                                   ::CORBA::Boolean            overwrite)
+                                   ::CORBA::Boolean            overwrite,
+                                   ::CORBA::Boolean            autoDimension)
   throw (SALOME::SALOME_Exception)
 {
   Unexpect aCatch(SALOME_SalomeException);
-  if ( _preMeshInfo )
-    _preMeshInfo->FullLoadFromFile();
+  TPythonDump pyDump;
 
-  PrepareForWriting(file, overwrite);
+  if ( SMESH_Mesh_i * mesh = SMESH::DownCast< SMESH_Mesh_i* >( meshPart ))
+  {
+    mesh->ExportToMEDX( file, auto_groups, version, autoDimension );
+  }
+  else
+  {
+    if ( _preMeshInfo )
+      _preMeshInfo->FullLoadFromFile();
 
-  string aMeshName = "Mesh";
-  SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
-  if ( !aStudy->_is_nil() ) {
-    SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
-    if ( !SO->_is_nil() ) {
-      CORBA::String_var name = SO->GetName();
-      aMeshName = name;
+    PrepareForWriting(file, overwrite);
+
+    string aMeshName = "Mesh";
+    SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
+    if ( !aStudy->_is_nil() ) {
+      SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
+      if ( !SO->_is_nil() ) {
+        CORBA::String_var name = SO->GetName();
+        aMeshName = name;
+      }
     }
+    SMESH_MeshPartDS partDS( meshPart );
+    _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS, autoDimension );
   }
-  SMESH_MeshPartDS partDS( meshPart );
-  _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, &partDS );
-
-  TPythonDump() << _this() << ".ExportPartToMED( " << meshPart << ", r'" << file << "', "
-                << auto_groups << ", " << version << ", " << overwrite << " )";
+  pyDump << _this() << ".ExportPartToMED( " << meshPart << ", r'" << file << "', "
+         << auto_groups << ", " << version << ", " << overwrite << ", "
+         << autoDimension << " )";
 }
 
 //================================================================================
@@ -2993,22 +3009,19 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart,
 
 //=============================================================================
 /*!
- * Return implementation of SALOME_MED::MESH interfaces
+ * Return computation progress [0.,1]
  */
 //=============================================================================
 
-SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()throw(SALOME::SALOME_Exception)
+CORBA::Double SMESH_Mesh_i::GetComputeProgress()
 {
-  Unexpect aCatch(SALOME_SalomeException);
-  if ( _preMeshInfo )
-    _preMeshInfo->FullLoadFromFile();
+  SMESH_TRY;
 
-  SMESH_MEDMesh_i *aMedMesh = new SMESH_MEDMesh_i(this);
-  SALOME_MED::MESH_var aMesh = aMedMesh->_this();
-  return aMesh._retn();
-}
+  return _impl->GetComputeProgress();
 
-//=============================================================================
+  SMESH_CATCH( SMESH::doNothing );
+  return 0.;
+}
 
 CORBA::Long SMESH_Mesh_i::NbNodes()throw(SALOME::SALOME_Exception)
 {
@@ -4273,7 +4286,8 @@ void SMESH_Mesh_i::CreateGroupServants()
 
     // register CORBA object for persistence
     int nextId = _gen_i->RegisterObject( groupVar );
-    if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
+    if(MYDEBUG) { MESSAGE( "Add group to map with id = "<< nextId); }
+    else        { nextId = 0; } // avoid "unused variable" warning in release mode
 
     // publishing the groups in the study
     if ( !aStudy->_is_nil() ) {
@@ -4323,11 +4337,11 @@ SMESH::ListOfGroups* SMESH_Mesh_i::GetGroups(const list<int>& groupIDs) const
  */
 //=============================================================================
 
-SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo()
+SMESH::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo()
 {
-  SALOME_MED::MedFileInfo_var res( _medFileInfo );
+  SMESH::MedFileInfo_var res( _medFileInfo );
   if ( !res.operator->() ) {
-    res = new SALOME_MED::MedFileInfo;
+    res = new SMESH::MedFileInfo;
     res->fileName = "";
     res->fileSize = res->major = res->minor = res->release = -1;
   }
@@ -4466,7 +4480,7 @@ bool SMESH_Mesh_i::IsMeshInfoCorrect()
 
 //=============================================================================
 /*!
- * \brief Returns statistic of mesh elements
+ * \brief Returns number of mesh elements per each \a EntityType
  */
 //=============================================================================
 
@@ -4490,7 +4504,33 @@ SMESH::long_array* SMESH_Mesh_i::GetMeshInfo()
 
 //=============================================================================
 /*!
- * \brief Collect statistic of mesh elements given by iterator
+ * \brief Returns number of mesh elements per each \a ElementType
+ */
+//=============================================================================
+
+SMESH::long_array* SMESH_Mesh_i::GetNbElementsByType()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::NB_ELEMENT_TYPES);
+  for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
+    aRes[ i ] = 0;
+
+  const SMDS_MeshInfo* meshInfo = 0;
+  if ( _preMeshInfo )
+    meshInfo = _preMeshInfo;
+  else if ( SMESHDS_Mesh* meshDS = _impl->GetMeshDS() )
+    meshInfo = & meshDS->GetMeshInfo();
+
+  if (meshInfo)
+    for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
+      aRes[i] = meshInfo->NbElements((SMDSAbs_ElementType)i);
+
+  return aRes._retn();
+}
+
+//=============================================================================
+/*
+ * Collect statistic of mesh elements given by iterator
  */
 //=============================================================================
 
@@ -4502,6 +4542,232 @@ void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
     theInfo[ theItr->next()->GetEntityType() ]++;
 }
 
+//=============================================================================
+namespace /* Iterators used in SMESH_Mesh_i::GetElements(SMESH::SMESH_IDSource_var obj,
+           *                                             SMESH::ElementType        type) */
+{
+  using namespace SMESH::Controls;
+  //-----------------------------------------------------------------------------
+  struct PredicateIterator : public SMDS_ElemIterator
+  {
+    SMDS_ElemIteratorPtr    _elemIter;
+    PredicatePtr            _predicate;
+    const SMDS_MeshElement* _elem;
+
+    PredicateIterator( SMDS_ElemIteratorPtr   iterator,
+                       PredicatePtr predicate):
+      _elemIter(iterator), _predicate(predicate)
+    {
+      next();
+    }
+    virtual bool more()
+    {
+      return _elem;
+    }
+    virtual const SMDS_MeshElement* next()
+    {
+      const SMDS_MeshElement* res = _elem;
+      _elem = 0;
+      while ( _elemIter->more() && !_elem )
+      {
+        _elem = _elemIter->next();
+        if ( _elem && ( !_predicate->IsSatisfy( _elem->GetID() )))
+          _elem = 0;
+      }
+      return res;
+    }
+  };
+
+  //-----------------------------------------------------------------------------
+  struct IDSourceIterator : public SMDS_ElemIterator
+  {
+    const CORBA::Long*        _idPtr;
+    const CORBA::Long*        _idEndPtr;
+    SMESH::long_array_var     _idArray;
+    const SMDS_Mesh*          _mesh;
+    const SMDSAbs_ElementType _type;
+    const SMDS_MeshElement*   _elem;
+
+    IDSourceIterator( const SMDS_Mesh*    mesh,
+                      const CORBA::Long*  ids,
+                      const int           nbIds,
+                      SMDSAbs_ElementType type):
+      _idPtr( ids ), _idEndPtr( ids + nbIds ), _mesh( mesh ), _type( type ), _elem( 0 )
+    {
+      if ( _idPtr && nbIds && _mesh )
+        next();
+    }
+    IDSourceIterator( const SMDS_Mesh*    mesh,
+                      SMESH::long_array*  idArray,
+                      SMDSAbs_ElementType type):
+      _idPtr( 0 ), _idEndPtr( 0 ), _idArray( idArray), _mesh( mesh ), _type( type ), _elem( 0 )
+    {
+      if ( idArray && _mesh )
+      {
+        _idPtr    = &_idArray[0];
+        _idEndPtr = _idPtr + _idArray->length();
+        next();
+      }
+    }
+    virtual bool more()
+    {
+      return _elem;
+    }
+    virtual const SMDS_MeshElement* next()
+    {
+      const SMDS_MeshElement* res = _elem;
+      _elem = 0;
+      while ( _idPtr < _idEndPtr && !_elem )
+      {
+        if ( _type == SMDSAbs_Node )
+        {
+          _elem = _mesh->FindNode( *_idPtr++ );
+        }
+        else if ((_elem = _mesh->FindElement( *_idPtr++ )) &&
+                 _elem->GetType() != _type )
+        {
+          _elem = 0;
+        }
+      }
+      return res;
+    }
+  };
+  //-----------------------------------------------------------------------------
+
+  struct NodeOfElemIterator : public SMDS_ElemIterator
+  {
+    TColStd_MapOfInteger    _checkedNodeIDs;
+    SMDS_ElemIteratorPtr    _elemIter;
+    SMDS_ElemIteratorPtr    _nodeIter;
+    const SMDS_MeshElement* _node;
+
+    NodeOfElemIterator( SMDS_ElemIteratorPtr iter ): _elemIter( iter ), _node( 0 )
+    {
+      if ( _elemIter && _elemIter->more() )
+      {
+        _nodeIter = _elemIter->next()->nodesIterator();
+        next();
+      }
+    }
+    virtual bool more()
+    {
+      return _node;
+    }
+    virtual const SMDS_MeshElement* next()
+    {
+      const SMDS_MeshElement* res = _node;
+      _node = 0;
+      while (( _elemIter->more() || _nodeIter->more() ) && !_node )
+      {
+        if ( _nodeIter->more() )
+        {
+          _node = _nodeIter->next();
+          if ( !_checkedNodeIDs.Add( _node->GetID() ))
+            _node = 0;
+        }
+        else
+        {
+          _nodeIter = _elemIter->next()->nodesIterator();
+        }
+      }
+      return res;
+    }
+  };
+}
+
+//=============================================================================
+/*
+ * Return iterator on elements of given type in given object
+ */
+//=============================================================================
+
+SMDS_ElemIteratorPtr SMESH_Mesh_i::GetElements(SMESH::SMESH_IDSource_ptr theObject,
+                                               SMESH::ElementType        theType)
+{
+  SMDS_ElemIteratorPtr  elemIt;
+  bool                  typeOK = false;
+  SMDSAbs_ElementType elemType = SMDSAbs_ElementType( theType );
+
+  SMESH::SMESH_Mesh_var meshVar = theObject->GetMesh();
+  SMESH_Mesh_i*          mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( meshVar );
+  if ( !mesh_i ) return elemIt;
+  SMESHDS_Mesh*          meshDS = mesh_i->GetImpl().GetMeshDS();
+
+  if ( SMESH::DownCast<SMESH_Mesh_i*>( theObject ))
+  {
+    elemIt = meshDS->elementsIterator( elemType );
+    typeOK = true;
+  }
+  else if ( SMESH_subMesh_i* submesh_i = SMESH::DownCast<SMESH_subMesh_i*>( theObject ))
+  {
+    SMESHDS_SubMesh* sm = ((SMESHDS_Mesh*) meshDS)->MeshElements( submesh_i->GetId() );
+    if ( sm )
+    {
+      elemIt = sm->GetElements();
+      if ( elemType != SMDSAbs_Node )
+      {
+        typeOK = ( elemIt && elemIt->more() && elemIt->next()->GetType() == elemType );
+        elemIt = typeOK ? sm->GetElements() : SMDS_ElemIteratorPtr();
+      }
+    }
+  }
+  else if ( SMESH_GroupBase_i* group_i = SMESH::DownCast<SMESH_GroupBase_i*>( theObject ))
+  {
+    SMESHDS_GroupBase* groupDS = group_i->GetGroupDS();
+    if ( groupDS && ( groupDS->GetType() == elemType || elemType == SMDSAbs_Node ))
+    {
+      elemIt = groupDS->GetElements();
+      typeOK = ( groupDS->GetType() == elemType );
+    }
+  }
+  else if ( SMESH::Filter_i* filter_i = SMESH::DownCast<SMESH::Filter_i*>( theObject ))
+  {
+    if ( filter_i->GetElementType() == theType || elemType == SMDSAbs_Node )
+    {
+      SMESH::Predicate_i* pred_i = filter_i->GetPredicate_i();
+      if ( pred_i && pred_i->GetPredicate() )
+      {
+        SMDSAbs_ElementType filterType = SMDSAbs_ElementType( filter_i->GetElementType() );
+        SMDS_ElemIteratorPtr allElemIt = meshDS->elementsIterator( filterType );
+        elemIt = SMDS_ElemIteratorPtr( new PredicateIterator( allElemIt, pred_i->GetPredicate() ));
+        typeOK = ( filterType == elemType );
+      }
+    }
+  }
+  else
+  {
+    SMESH::array_of_ElementType_var types = theObject->GetTypes();
+    const bool                    isNodes = ( types->length() == 1 && types[0] == SMESH::NODE );
+    if ( isNodes && elemType != SMDSAbs_Node )
+      return elemIt;
+    if ( SMESH_MeshEditor_i::IsTemporaryIDSource( theObject ))
+    {
+      int nbIds;
+      if ( CORBA::Long* ids = SMESH_MeshEditor_i::GetTemporaryIDs( theObject, nbIds ))
+        elemIt = SMDS_ElemIteratorPtr( new IDSourceIterator( meshDS, ids, nbIds, elemType ));
+    }
+    else
+    {
+      SMESH::long_array_var ids = theObject->GetIDs();
+      elemIt = SMDS_ElemIteratorPtr( new IDSourceIterator( meshDS, ids._retn(), elemType ));
+    }
+    typeOK = ( isNodes == ( elemType == SMDSAbs_Node ));
+  }
+
+  if ( elemIt && elemIt->more() && !typeOK )
+  {
+    if ( elemType == SMDSAbs_Node )
+    {
+      elemIt = SMDS_ElemIteratorPtr( new NodeOfElemIterator( elemIt ));
+    }
+    else
+    {
+      elemIt = SMDS_ElemIteratorPtr();
+    }
+  }
+  return elemIt;
+}
+
 //=============================================================================
 namespace // Finding concurrent hypotheses
 //=============================================================================
@@ -4549,9 +4815,9 @@ class SMESH_DimHyp
 
   //-----------------------------------------------------------------------------
   //! Constructors
-  SMESH_DimHyp(const SMESH_subMesh*  theSubMesh,
-               const int             theDim,
-               const TopoDS_Shape&   theShape)
+  SMESH_DimHyp(const SMESH_subMesh* theSubMesh,
+               const int            theDim,
+               const TopoDS_Shape&  theShape)
   {
     _subMesh = (SMESH_subMesh*)theSubMesh;
     SetShape( theDim, theShape );
@@ -4563,7 +4829,7 @@ class SMESH_DimHyp
                 const TopoDS_Shape& theShape)
   {
     _dim = theDim;
-    _ownDim = (int)SMESH_Gen::GetShapeDim(theShape);
+    _ownDim = SMESH_Gen::GetShapeDim(theShape);
     if (_dim >= _ownDim)
       _shapeMap.Add( theShape );
     else {
index f9df1792b3d64a84f05addb399a5d449ebe8bfa3..cead1dc066bb172a7ccfdd15f8650e5eedf35392 100644 (file)
@@ -34,7 +34,6 @@
 #include CORBA_SERVER_HEADER(SMESH_Group)
 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(MED)
 
 #include "SMESH_Hypothesis.hxx"
 #include "SMESH_Mesh.hxx"
@@ -231,7 +230,8 @@ public:
   void ExportToMEDX( const char*        file,
                      CORBA::Boolean     auto_groups,
                      SMESH::MED_VERSION version,
-                     CORBA::Boolean     overwrite ) throw (SALOME::SALOME_Exception);
+                     CORBA::Boolean     overwrite,
+                     CORBA::Boolean     autoDimension=true) throw (SALOME::SALOME_Exception);
   void ExportToMED ( const char*        file,
                      CORBA::Boolean     auto_groups,
                      SMESH::MED_VERSION version ) throw (SALOME::SALOME_Exception);
@@ -254,7 +254,8 @@ public:
                        const char*               file,
                        CORBA::Boolean            auto_groups,
                        SMESH::MED_VERSION        version,
-                       CORBA::Boolean            overwrite) throw (SALOME::SALOME_Exception);
+                       CORBA::Boolean            overwrite,
+                       CORBA::Boolean            autoDim=true) throw (SALOME::SALOME_Exception);
   void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
                        const char*               file) throw (SALOME::SALOME_Exception);
   void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
@@ -263,8 +264,7 @@ public:
                        const char*               file,
                        CORBA::Boolean            isascii) throw (SALOME::SALOME_Exception);
 
-  SALOME_MED::MESH_ptr GetMEDMesh()
-    throw (SALOME::SALOME_Exception);
+  CORBA::Double GetComputeProgress();
 
   CORBA::Long NbNodes()
     throw (SALOME::SALOME_Exception);
@@ -560,7 +560,7 @@ public:
   /*!
    * Returns information about imported MED file
    */
-  virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
+  virtual SMESH::MedFileInfo* GetMEDFileInfo();
 
   /*!
    * Sets list of notebook variables used for Mesh operations separated by ":" symbol
@@ -577,12 +577,6 @@ public:
    */
   SMESH::string_array* GetLastParameters();
 
-  /*!
-   * Collect statistic of mesh elements given by iterator
-   */
-  static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
-                              SMESH::long_array&         theInfo);
-
   /*!
    * \brief Return submesh objects list in meshing order
    */
@@ -593,17 +587,32 @@ public:
   virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
 
 
+  /*!
+   * Collect statistic of mesh elements given by iterator
+   */
+  static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
+                              SMESH::long_array&         theInfo);
+  /*!
+   * \brief Return iterator on elements of given type in given object
+   */
+  static SMDS_ElemIteratorPtr GetElements(SMESH::SMESH_IDSource_ptr obj,
+                                          SMESH::ElementType        type);
+
   // =========================
   // SMESH_IDSource interface
   // =========================
 
   virtual SMESH::long_array* GetIDs();
   /*!
-   * Returns statistic of mesh elements
-   * Result array of number enityties
+   * Returns number of mesh elements of each \a EntityType
+   * Result array of number of elements per \a EntityType
    * Inherited from SMESH_IDSource
    */
   virtual SMESH::long_array* GetMeshInfo();
+  /*!
+   * Returns number of mesh elements of each \a ElementType
+   */
+  virtual SMESH::long_array* GetNbElementsByType();
   /*!
    * Returns types of elements it contains
    */
@@ -646,8 +655,8 @@ private:
   std::map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
   std::map<int, SMESH::SMESH_GroupBase_ptr>  _mapGroups;
   std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
-  SALOME_MED::MedFileInfo_var _medFileInfo;
-  SMESH_PreMeshInfo*          _preMeshInfo; // mesh info before full loading from study file
+  SMESH::MedFileInfo_var _medFileInfo;
+  SMESH_PreMeshInfo*     _preMeshInfo; // mesh info before full loading from study file
 
   SMESH_PreMeshInfo* & changePreMeshInfo() { return _preMeshInfo; }
   friend class SMESH_PreMeshInfo;
index 3dab3db5b2731fac89f3d37d86171ffcbd37c607..30c8cc52ae21147145b7bb9bd3df40e107515a56 100644 (file)
@@ -207,53 +207,29 @@ CORBA::Long SMESH_subMesh_i::GetNumberOfNodes(CORBA::Boolean all)
   ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
   SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
 
-  set<int> nodeIds;
-
-  // nodes are bound to shell instead of solid
-  TListOfSubMeshes smList;
-  if ( all && getSubMeshes( aSubMesh, smList ))
+  if ( aSubMeshDS && aSubMeshDS->IsComplexSubmesh() )
   {
-    TListOfSubMeshes::iterator sm = smList.begin();
-    for ( ; sm != smList.end(); ++sm )
-    {
-      SMDS_ElemIteratorPtr eIt = (*sm)->GetElements();
-      if ( eIt->more() ) {
-        while ( eIt->more() ) {
-          const SMDS_MeshElement* anElem = eIt->next();
-          SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
-          while ( nIt->more() )
-            nodeIds.insert( nIt->next()->GetID() );
-        }
-      } else {
-        SMDS_NodeIteratorPtr nIt = (*sm)->GetNodes();
-        while ( nIt->more() )
-          nodeIds.insert( nIt->next()->GetID() );
-      }      
-    }
-    return nodeIds.size();
+    // sub-mesh on a geom group, always return all nodes
+    return aSubMeshDS->NbNodes();
   }
-
-  if ( aSubMeshDS == NULL )
-    return 0;
-
-  if ( all ) { // all nodes of submesh elements
-    SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
-    if ( eIt->more() ) {
-      while ( eIt->more() ) {
-        const SMDS_MeshElement* anElem = eIt->next();
-        SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
-        while ( nIt->more() )
-          nodeIds.insert( nIt->next()->GetID() );
-      }
-    } else {
-      SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
-      while ( nIt->more() )
-        nodeIds.insert( nIt->next()->GetID() );
+  if ( aSubMeshDS && !all )
+  {
+    // return anything we have
+    return aSubMeshDS->NbNodes();
+  }
+  if ( all ) // get nodes from aSubMesh and all child sub-meshes
+  {
+    int nbNodes = 0;
+    SMESH_subMeshIteratorPtr smIt = aSubMesh->getDependsOnIterator( /*includeSelf=*/true );
+    while ( smIt->more() )
+    {
+      aSubMesh = smIt->next();
+      if (( aSubMeshDS = aSubMesh->GetSubMeshDS() ))
+        nbNodes += aSubMeshDS->NbNodes();
     }
-    return nodeIds.size();
   }
 
-  return aSubMeshDS->NbNodes();
+  return aSubMeshDS ? aSubMeshDS->NbNodes() : 0;
 }
 
 //=============================================================================
@@ -485,30 +461,6 @@ GEOM::GEOM_Object_ptr SMESH_subMesh_i::GetSubShape()
   return aShapeObj._retn();
 }
 
-//=============================================================================
-/*!
- *  
- */
-//=============================================================================
-SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily()
-  throw (SALOME::SALOME_Exception)
-{
-  Unexpect aCatch(SALOME_SalomeException);
-  if ( _preMeshInfo )
-    _preMeshInfo->FullLoadFromFile();
-  SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh();
-
-  SALOME_MED::Family_array_var families = 
-    MEDMesh->getFamilies(SALOME_MED::MED_NODE);
-    
-  for ( int i = 0; i < families->length(); i++ ) {
-    if ( families[i]->getIdentifier() == ( _localId ) )
-      return families[i];
-  }
-  
-  return SALOME_MED::FAMILY::_nil();
-}
-
 //=============================================================================
 /*!
  *  
@@ -532,14 +484,13 @@ SMESH::ElementType SMESH_subMesh_i::GetElementType( const CORBA::Long id, const
   return GetFather()->GetElementType( id, iselem );
 }
 
-
 //=============================================================================
-/*!
- * Returns statistic of mesh elements
- * Result array of number enityties
- * Inherited from SMESH_IDSource
+/*
+ * Returns number of mesh elements of each \a EntityType
+ * @return array of number of elements per \a EntityType
  */
 //=============================================================================
+
 SMESH::long_array* SMESH_subMesh_i::GetMeshInfo()
 {
   if ( _preMeshInfo )
@@ -564,6 +515,37 @@ SMESH::long_array* SMESH_subMesh_i::GetMeshInfo()
   return aRes._retn();
 }
 
+//=======================================================================
+/*
+ * Returns number of mesh elements of each \a ElementType
+ */
+//=======================================================================
+
+SMESH::long_array* SMESH_subMesh_i::GetNbElementsByType()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::NB_ELEMENT_TYPES);
+  for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
+    if ( _preMeshInfo )
+      aRes[ i ] = _preMeshInfo->NbElements( SMDSAbs_ElementType( i ));
+    else
+      aRes[ i ] = 0;
+
+  if ( !_preMeshInfo )
+  {
+    aRes[ SMESH::NODE ] = GetNumberOfNodes(true);
+
+    ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
+    if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() )
+    {
+      SMDS_ElemIteratorPtr eIt = smDS->GetElements();
+      if ( eIt->more() )
+        aRes[ eIt->next()->GetType() ] = smDS->NbElements();
+    }
+  }
+  return aRes._retn();  
+}
+
 
 //=======================================================================
 //function : GetTypes
index 39d6d267729ff6f7fb88eb57fd1afd8e7b83f759..5282620ddc127f23d719dfef57d60ad0358b4b58 100644 (file)
@@ -34,7 +34,6 @@
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
-#include CORBA_CLIENT_HEADER(MED)
 
 #include "SALOME_GenericObj_i.hh"
 #include "SMESH_Mesh_i.hxx"
@@ -80,9 +79,6 @@ public:
 
   CORBA::Long GetId();
 
-  SALOME_MED::FAMILY_ptr GetFamily()
-    throw (SALOME::SALOME_Exception);
-
 
   // =========================
   // interface SMESH_IDSource
@@ -92,11 +88,15 @@ public:
    */
   virtual SMESH::long_array* GetIDs();
   /*!
-   * Returns statistic of mesh elements
-   * Result array of number enityties
+   * Returns number of mesh elements of each \a EntityType
+   * Result array of number of elements per \a EntityType
    * Inherited from SMESH_IDSource
    */
   virtual SMESH::long_array* GetMeshInfo();
+  /*!
+   * Returns number of mesh elements of each \a ElementType
+   */
+  virtual SMESH::long_array* GetNbElementsByType();
   /*!
    * Returns types of elements it contains
    */
index a7ddf41916821c16995785da19ea8d634d405a51..852b6ba50aa820e632cc78b54f3d8c4e2f133f57 100644 (file)
@@ -1567,14 +1567,21 @@ class Mesh:
     #  @param version MED format version(MED_V2_1 or MED_V2_2)
     #  @param overwrite boolean parameter for overwriting/not overwriting the file
     #  @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
+    #  @param autoDimension: if @c True (default), a space dimension of a MED mesh can be either
+    #         - 1D if all mesh nodes lie on OX coordinate axis, or
+    #         - 2D if all mesh nodes lie on XOY coordinate plane, or
+    #         - 3D in the rest cases.
+    #
+    #         If @a autoDimension is @c False, the space dimension is always 3.
     #  @ingroup l2_impexp
-    def ExportMED(self, f, auto_groups=0, version=MED_V2_2, overwrite=1, meshPart=None):
+    def ExportMED(self, f, auto_groups=0, version=MED_V2_2,
+                  overwrite=1, meshPart=None, autoDimension=True):
         if meshPart:
             if isinstance( meshPart, list ):
                 meshPart = self.GetIDSource( meshPart, SMESH.ALL )
-            self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite )
+            self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension)
         else:
-            self.mesh.ExportToMEDX(f, auto_groups, version, overwrite)
+            self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension)
 
     ## Exports the mesh in a file in SAUV format
     #  @param f is the file name
@@ -1965,12 +1972,6 @@ class Mesh:
     def GetIDSource(self, ids, elemType):
         return self.editor.MakeIDSource(ids, elemType)
 
-    ## Gets MED Mesh
-    #  @return an instance of SALOME_MED::MESH
-    #  @ingroup l1_auxiliary
-    def GetMEDMesh(self):
-        return self.mesh.GetMEDMesh()
-
 
     # Get informations about mesh contents:
     # ------------------------------------
@@ -4133,12 +4134,30 @@ class Mesh:
     def GetLastCreatedElems(self):
         return self.editor.GetLastCreatedElems()
 
-    ## Clear sequences of nodes and elements created by mesh edition oparations
+    ## Clears sequences of nodes and elements created by mesh edition oparations
     #  @ingroup l1_auxiliary
     def ClearLastCreated(self):
         self.editor.ClearLastCreated()
 
-     ## Creates a hole in a mesh by doubling the nodes of some particular elements
+    ## Creates Duplicates given elements, i.e. creates new elements based on the 
+    #  same nodes as the given ones.
+    #  @param theElements - container of elements to duplicate. It can be a Mesh,
+    #         sub-mesh, group, filter or a list of element IDs.
+    # @param theGroupName - a name of group to contain the generated elements.
+    #                    If a group with such a name already exists, the new elements
+    #                    are added to the existng group, else a new group is created.
+    #                    If \a theGroupName is empty, new elements are not added 
+    #                    in any group.
+    # @return a group where the new elements are added. None if theGroupName == "".
+    #  @ingroup l2_modif_edit
+    def DoubleElements(self, theElements, theGroupName=""):
+        if isinstance( theElements, Mesh ):
+            theElements = theElements.mesh
+        elif isinstance( theElements, list ):
+            theElements = self.GetIDSource( theElements, SMESH.ALL )
+        return self.editor.DoubleElements(theElements, theGroupName)
+
+    ## Creates a hole in a mesh by doubling the nodes of some particular elements
     #  @param theNodes identifiers of nodes to be doubled
     #  @param theModifiedElems identifiers of elements to be updated by the new (doubled)
     #         nodes. If list of element identifiers is empty then nodes are doubled but
index 6dc35e6b28fcb875897d737332e4c2b11096620c..a81f825a6ac4ebd2440f3d079bb63423a13a8340 100644 (file)
@@ -290,21 +290,27 @@ class Mesh_Algorithm:
     #  @param thickness total thickness of layers of quadrilaterals
     #  @param numberOfLayers number of layers
     #  @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
-    #  @param ignoreEdges list of geometrical edge (or their ids) not to generate layers on
+    #  @param edges list of geometrical edge (or their ids).
+    #         Viscous layers are either generated on these edges or not, depending on
+    #         the values of \a isEdgesToIgnore parameter.
+    #  @param isEdgesToIgnore if \c True, the Viscous layers are not generated on the
+    #         edges specified by the previous parameter (\a edges).
     #  @ingroup l3_hypos_additi
-    def ViscousLayers2D(self, thickness, numberOfLayers, stretchFactor, ignoreEdges=[]):
+    def ViscousLayers2D(self, thickness, numberOfLayers, stretchFactor,
+                        edges=[], isEdgesToIgnore=True ):
         if not isinstance(self.algo, SMESH._objref_SMESH_2D_Algo):
             raise TypeError, "ViscousLayers2D are supported by 2D algorithms only"
         if not "ViscousLayers2D" in self.GetCompatibleHypothesis():
             raise TypeError, "ViscousLayers2D are not supported by %s"%self.algo.GetName()
-        if ignoreEdges and isinstance( ignoreEdges[0], geomBuilder.GEOM._objref_GEOM_Object ):
-            ignoreEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreEdges ]
+        if edges and isinstance( edges[0], geomBuilder.GEOM._objref_GEOM_Object ):
+            edges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in edges ]
         hyp = self.Hypothesis("ViscousLayers2D",
-                              [thickness, numberOfLayers, stretchFactor, ignoreEdges])
+                              [thickness, numberOfLayers, stretchFactor,
+                               edges, isEdgesToIgnore])
         hyp.SetTotalThickness(thickness)
         hyp.SetNumberLayers(numberOfLayers)
         hyp.SetStretchFactor(stretchFactor)
-        hyp.SetIgnoreEdges(ignoreEdges)
+        hyp.SetEdges(edges, isEdgesToIgnore)
         return hyp
 
     ## Transform a list of ether edges or tuples (edge, 1st_vertex_of_edge)
index 4d72e2f68bcab49d12faab351cc4564b4539ae49..a0e7f00342543867dfb2441498094ccd199caaae 100644 (file)
@@ -358,13 +358,22 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool   isXConst,
       {
         const UVPtStructVec& edgeUVPtStruct = proxySubMesh[iE]->GetUVPtStructVec();
         std::copy( edgeUVPtStruct.begin(), edgeUVPtStruct.end(), & points[iPt] );
+        // check orientation
+        double du1 = edgeUVPtStruct.back().param - edgeUVPtStruct[0].param;
+        double du2 = myLast[iE] - myFirst[iE];
+        if ( du1 * du2 < 0 )
+        {
+          std::reverse( & points[iPt], & points[iPt + edgeUVPtStruct.size()]);
+          for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i )
+            points[iPt+i].normParam = 1. - points[iPt+i].normParam;
+        }
         // update normalized params
         if ( myEdge.size() > 1 ) {
           for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i, ++iPt )
           {
             UVPtStruct & uvPt = points[iPt];
-            uvPt.normParam = prevNormPar + uvPt.normParam * paramSize;
-            uvPt.x = uvPt.y = uvPt.normParam;
+            uvPt.normParam    = prevNormPar + uvPt.normParam * paramSize;
+            uvPt.x = uvPt.y   = uvPt.normParam;
           }
           --iPt; // to point to the 1st VERTEX of the next EDGE
         }
index 149e35a0ebbfbc8f1b9b5ea872f9857e6ff69afe..33f261506a26bbfd5cd41dbccb2db3e60d5a987b 100644 (file)
@@ -2118,15 +2118,17 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
 bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper*         helper,
                                    const Prism_3D::TPrismTopo& thePrism)
 {
+  myHelper = helper;
+  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
+  SMESH_Mesh*     mesh = myHelper->GetMesh();
+
   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 );
+  mySide = new TSideFace( *mesh, sideFaces, params );
 
-  myHelper = helper;
-  SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
 
   SMESH_Block::init();
   myShapeIDMap.Clear();
@@ -2265,14 +2267,14 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper*         helper,
         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 ],
+          TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
                                            thePrism.myWallQuads[ iE ], *botE,
                                            &myParam2ColumnMaps[ iE ], f, l );
           mySide->SetComponent( iSide++, comp );
         }
       }
       else {
-        TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
+        TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
                                          thePrism.myWallQuads[ iE ], *botE,
                                          &myParam2ColumnMaps[ iE ]);
         mySide->SetComponent( iSide++, comp );
@@ -2293,19 +2295,19 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper*         helper,
     list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
     for ( iE = 0; iE < nbExraFaces; ++iE, ++botE )
     {
-      components[ iE ] = new TSideFace( myHelper, wallFaceIds[ iSide ],
+      components[ iE ] = new TSideFace( *mesh, wallFaceIds[ iSide ],
                                         thePrism.myWallQuads[ iE ], *botE,
                                         &myParam2ColumnMaps[ iE ]);
       double u1 = u0 + edgeLength[ iE ] / sumLen;
       params[ iE ] = make_pair( u0 , u1 );
       u0 = u1;
     }
-    mySide->SetComponent( iSide++, new TSideFace( components, params ));
+    mySide->SetComponent( iSide++, new TSideFace( *mesh, components, params ));
 
     // fill the rest faces
     for ( ; iE < nbEdges; ++iE, ++botE )
     {
-      TSideFace* comp = new TSideFace( myHelper, wallFaceIds[ iSide ],
+      TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
                                        thePrism.myWallQuads[ iE ], *botE,
                                        &myParam2ColumnMaps[ iE ]);
       mySide->SetComponent( iSide++, comp );
@@ -2583,7 +2585,7 @@ bool StdMeshers_PrismAsBlock::IsForwardEdge(SMESHDS_Mesh*           meshDS,
  */
 //================================================================================
 
-StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_MesherHelper*        helper,
+StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_Mesh&                mesh,
                                               const int                  faceID,
                                               const Prism_3D::TQuadList& quadList,
                                               const TopoDS_Edge&         baseEdge,
@@ -2592,20 +2594,20 @@ StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_MesherHelper*        helper,
                                               const double               last):
   myID( faceID ),
   myParamToColumnMap( columnsMap ),
-  myHelper( helper )
+  myHelper( mesh )
 {
   myParams.resize( 1 );
   myParams[ 0 ] = make_pair( first, last );
   mySurface     = PSurface( new BRepAdaptor_Surface( quadList.front()->face ));
   myBaseEdge    = baseEdge;
-  myIsForward   = StdMeshers_PrismAsBlock::IsForwardEdge( myHelper->GetMeshDS(),
+  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();
+    SMESHDS_Mesh* meshDS = myHelper.GetMeshDS();
 
     TopTools_IndexedDataMapOfShapeListOfShape subToFaces;
     Prism_3D::TQuadList::const_iterator quad = quadList.begin();
@@ -2630,19 +2632,20 @@ StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_MesherHelper*        helper,
 
 //================================================================================
 /*!
- * \brief Constructor of complex side face
+ * \brief Constructor of complex side face
  */
 //================================================================================
 
 StdMeshers_PrismAsBlock::TSideFace::
-TSideFace(const vector< TSideFace* >&             components,
+TSideFace(SMESH_Mesh&                             mesh,
+          const vector< TSideFace* >&             components,
           const vector< pair< double, double> > & params)
   :myID( components[0] ? components[0]->myID : 0 ),
    myParamToColumnMap( 0 ),
    myParams( params ),
    myIsForward( true ),
    myComponents( components ),
-   myHelper( components[0] ? components[0]->myHelper : 0 )
+   myHelper( mesh )
 {}
 //================================================================================
 /*!
@@ -2651,17 +2654,17 @@ TSideFace(const vector< TSideFace* >&             components,
  */
 //================================================================================
 
-StdMeshers_PrismAsBlock::TSideFace::TSideFace( const TSideFace& other )
+StdMeshers_PrismAsBlock::TSideFace::TSideFace( const TSideFace& other ):
+  myID               ( other.myID ),
+  myParamToColumnMap ( other.myParamToColumnMap ),
+  mySurface          ( other.mySurface ),
+  myBaseEdge         ( other.myBaseEdge ),
+  myShapeID2Surf     ( other.myShapeID2Surf ),
+  myParams           ( other.myParams ),
+  myIsForward        ( other.myIsForward ),
+  myComponents       ( other.myComponents.size() ),
+  myHelper           ( *other.myHelper.GetMesh() )
 {
-  myID               = other.myID;
-  mySurface          = other.mySurface;
-  myBaseEdge         = other.myBaseEdge;
-  myParams           = other.myParams;
-  myIsForward        = other.myIsForward;
-  myHelper           = other.myHelper;
-  myParamToColumnMap = other.myParamToColumnMap;
-
-  myComponents.resize( other.myComponents.size());
   for (int i = 0 ; i < myComponents.size(); ++i )
     myComponents[ i ] = new TSideFace( *other.myComponents[ i ]);
 }
@@ -2864,16 +2867,16 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
     }
     else
     {
-      TopoDS_Shape s = myHelper->GetSubShapeByNode( nn[0], myHelper->GetMeshDS() );
+      TopoDS_Shape s = myHelper.GetSubShapeByNode( nn[0], myHelper.GetMeshDS() );
       if ( s.ShapeType() != TopAbs_EDGE )
-        s = myHelper->GetSubShapeByNode( nn[2], 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, nn[0] );
-      double u3 = myHelper->GetNodeU( edge, nn[2] );
+      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 );
@@ -2909,10 +2912,10 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
       }
     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 ),
+      SMESHDS_Mesh* meshDS = myHelper.GetMeshDS();
+      TopoDS_Shape face = myHelper.GetCommonAncestor( meshDS->IndexToShape( notFaceID1 ),
                                                        meshDS->IndexToShape( notFaceID2 ),
-                                                       *myHelper->GetMesh(),
+                                                       *myHelper.GetMesh(),
                                                        TopAbs_FACE );
       if ( face.IsNull() ) 
         throw SALOME_Exception("StdMeshers_PrismAsBlock::TSideFace::Value() face.IsNull()");
@@ -2923,12 +2926,12 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
     }
   }
   
-  gp_XY uv1 = myHelper->GetNodeUV( mySurface->Face(), nn[0], nn[2]);
-  gp_XY uv2 = myHelper->GetNodeUV( mySurface->Face(), nn[1], nn[3]);
+  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(), nn[2], nn[0]);
-  gp_XY uv4 = myHelper->GetNodeUV( mySurface->Face(), nn[3], nn[1]);
+  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;
@@ -2957,7 +2960,7 @@ TopoDS_Edge StdMeshers_PrismAsBlock::TSideFace::GetEdge(const int iEdge) const
   }
   TopoDS_Shape edge;
   const SMDS_MeshNode* node = 0;
-  SMESHDS_Mesh * meshDS = myHelper->GetMesh()->GetMeshDS();
+  SMESHDS_Mesh * meshDS = myHelper.GetMesh()->GetMeshDS();
   TNodeColumn* column;
 
   switch ( iEdge ) {
@@ -2965,7 +2968,7 @@ TopoDS_Edge StdMeshers_PrismAsBlock::TSideFace::GetEdge(const int iEdge) const
   case BOTTOM_EDGE:
     column = & (( ++myParamToColumnMap->begin())->second );
     node = ( iEdge == TOP_EDGE ) ? column->back() : column->front();
-    edge = myHelper->GetSubShapeByNode ( node, meshDS );
+    edge = myHelper.GetSubShapeByNode ( node, meshDS );
     if ( edge.ShapeType() == TopAbs_VERTEX ) {
       column = & ( myParamToColumnMap->begin()->second );
       node = ( iEdge == TOP_EDGE ) ? column->back() : column->front();
@@ -2980,7 +2983,7 @@ TopoDS_Edge StdMeshers_PrismAsBlock::TSideFace::GetEdge(const int iEdge) const
     else
       column = & ( myParamToColumnMap->begin()->second );
     if ( column->size() > 0 )
-      edge = myHelper->GetSubShapeByNode( (*column)[ 1 ], meshDS );
+      edge = myHelper.GetSubShapeByNode( (*column)[ 1 ], meshDS );
     if ( edge.IsNull() || edge.ShapeType() == TopAbs_VERTEX )
       node = column->front();
     break;
@@ -2992,10 +2995,10 @@ TopoDS_Edge StdMeshers_PrismAsBlock::TSideFace::GetEdge(const int iEdge) const
 
   // find edge by 2 vertices
   TopoDS_Shape V1 = edge;
-  TopoDS_Shape V2 = myHelper->GetSubShapeByNode( node, meshDS );
+  TopoDS_Shape V2 = myHelper.GetSubShapeByNode( node, meshDS );
   if ( !V2.IsNull() && V2.ShapeType() == TopAbs_VERTEX && !V2.IsSame( V1 ))
   {
-    TopoDS_Shape ancestor = myHelper->GetCommonAncestor( V1, V2, *myHelper->GetMesh(), TopAbs_EDGE);
+    TopoDS_Shape ancestor = myHelper.GetCommonAncestor( V1, V2, *myHelper.GetMesh(), TopAbs_EDGE);
     if ( !ancestor.IsNull() )
       return TopoDS::Edge( ancestor );
   }
@@ -3035,8 +3038,8 @@ int StdMeshers_PrismAsBlock::TSideFace::InsertSubShapes(TBlockShapes& shapeMap)
   GetColumns(0, col1, col2 );
   const SMDS_MeshNode* node0 = col1->second.front();
   const SMDS_MeshNode* node1 = col1->second.back();
-  TopoDS_Shape v0 = myHelper->GetSubShapeByNode( node0, myHelper->GetMeshDS());
-  TopoDS_Shape v1 = myHelper->GetSubShapeByNode( node1, myHelper->GetMeshDS());
+  TopoDS_Shape v0 = myHelper.GetSubShapeByNode( node0, myHelper.GetMeshDS());
+  TopoDS_Shape v1 = myHelper.GetSubShapeByNode( node1, myHelper.GetMeshDS());
   if ( v0.ShapeType() == TopAbs_VERTEX ) {
     nbInserted += SMESH_Block::Insert( v0, vertIdVec[ 0 ], shapeMap);
   }
@@ -3049,8 +3052,8 @@ int StdMeshers_PrismAsBlock::TSideFace::InsertSubShapes(TBlockShapes& shapeMap)
   GetColumns(1, col1, col2 );
   node0 = col2->second.front();
   node1 = col2->second.back();
-  v0 = myHelper->GetSubShapeByNode( node0, myHelper->GetMeshDS());
-  v1 = myHelper->GetSubShapeByNode( node1, myHelper->GetMeshDS());
+  v0 = myHelper.GetSubShapeByNode( node0, myHelper.GetMeshDS());
+  v1 = myHelper.GetSubShapeByNode( node1, myHelper.GetMeshDS());
   if ( v0.ShapeType() == TopAbs_VERTEX ) {
     nbInserted += SMESH_Block::Insert( v0, vertIdVec[ 0 ], shapeMap);
   }
@@ -3242,7 +3245,7 @@ gp_Pnt2d StdMeshers_PrismAsBlock::TPCurveOnHorFaceAdaptor::Value(const Standard_
 {
   TParam2ColumnIt u_col1, u_col2;
   double r = mySide->GetColumns( U, u_col1, u_col2 );
-  gp_XY uv1 = mySide->GetNodeUV( myFace, u_col1->second[ myZ ]);
-  gp_XY uv2 = mySide->GetNodeUV( myFace, u_col2->second[ myZ ]);
+  gp_XY uv1 = mySide->GetNodeUV( myFace, u_col1->second[ myZ ], u_col2->second[ myZ ]);
+  gp_XY uv2 = mySide->GetNodeUV( myFace, u_col2->second[ myZ ], u_col1->second[ myZ ]);
   return uv1 * ( 1 - r ) + uv2 * r;
 }
index 226a5006ba83d6af7488640b5cfba27e0a4251d1..2229c7b1ebd90cb14ee5bdc00dd8b7ea307720a3 100644 (file)
@@ -270,16 +270,17 @@ private:
     std::vector< std::pair< double, double> > myParams;
     bool                            myIsForward;
     std::vector< TSideFace* >       myComponents;
-    SMESH_MesherHelper *            myHelper;
+    SMESH_MesherHelper              myHelper;
   public:
-    TSideFace( SMESH_MesherHelper*        helper,
+    TSideFace( SMESH_Mesh&                mesh,
                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,
+    TSideFace( SMESH_Mesh&                                       mesh,
+               const std::vector< TSideFace* >&                  components,
                const std::vector< std::pair< double, double> > & params);
     TSideFace( const TSideFace& other );
     ~TSideFace();
@@ -287,8 +288,8 @@ private:
     { return ( NbComponents() > 0 || myParams[0].first != 0. || myParams[0].second != 1. ); }
     int FaceID() const { return myID; }
     TParam2ColumnMap* GetColumns() const { return myParamToColumnMap; }
-    gp_XY GetNodeUV(const TopoDS_Face& F, const SMDS_MeshNode* n) const
-    { return myHelper->GetNodeUV( F, n ); }
+    gp_XY GetNodeUV(const TopoDS_Face& F, const SMDS_MeshNode* n, const SMDS_MeshNode* n2=0) const
+    { return ((SMESH_MesherHelper&) myHelper).SetSubShape(F), myHelper.GetNodeUV( F, n, n2 ); }
     const TopoDS_Edge & BaseEdge() const { return myBaseEdge; }
     int ColumnHeight() const {
       if ( NbComponents() ) return GetComponent(0)->GetColumns()->begin()->second.size();
index 3e9f5c46239fdb906be4b9f9540f0f43699fce2c..de59b265423948b4b4eb9698195e9e47fc51640b 100644 (file)
@@ -2100,7 +2100,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
 
   string algoType = algo->GetName();
   if ( algoType.substr(0, 11) != "Projection_")
-    return gen->Compute( *mesh, shape );
+    return gen->Compute( *mesh, shape, /*shapeOnly=*/true );
 
   // try to compute source mesh
 
@@ -2132,7 +2132,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
     }
   }
   if ( srcShape.IsNull() ) // no projection source defined
-    return gen->Compute( *mesh, shape );
+    return gen->Compute( *mesh, shape, /*shapeOnly=*/true );
 
   if ( srcShape.IsSame( shape ))
     RETURN_BAD_RESULT("Projection from self");
@@ -2141,7 +2141,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
     srcMesh = mesh;
 
   if ( MakeComputed( srcMesh->GetSubMesh( srcShape ), iterationNb + 1 ) &&
-       gen->Compute( *mesh, shape ))
+       gen->Compute( *mesh, shape, /*shapeOnly=*/true ))
     return sm->IsMeshComputed();
 
   return false;
index 23512af4304e19e24948cd1fd98fca8633bfed58..ef7e6100b4c06a87a2e0f30062a111b934d4425b 100644 (file)
@@ -254,6 +254,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh&         aMesh,
         Smooth( quad ); 
       return ok;
     }
+    if ( n1 != n3 && n2 != n4 )
+      error( COMPERR_WARNING,
+             "To use 'Reduced' transition, "
+             "two opposite sides should have same number of segments, "
+             "but actual number of segments is different on all sides. "
+             "'Standard' transion has been used.");
+    else
+      error( COMPERR_WARNING,
+             "To use 'Reduced' transition, "
+             "two opposite sides should have an even difference in number of segments. "
+             "'Standard' transion has been used.");
   }
 
   // set normalized grid on unit square in parametric domain
@@ -2316,19 +2327,20 @@ namespace
  *  Implementation of Reduced algorithm (meshing with quadrangles only)
  */
 //=======================================================================
+
 bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
                                                const TopoDS_Shape& aShape,
                                                FaceQuadStruct::Ptr quad)
 {
-  SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
-  const TopoDS_Face& F = TopoDS::Face(aShape);
+  SMESHDS_Mesh * meshDS  = aMesh.GetMeshDS();
+  const TopoDS_Face& F   = TopoDS::Face(aShape);
   Handle(Geom_Surface) S = BRep_Tool::Surface(F);
-  int i,j,geomFaceID = meshDS->ShapeToIndex(F);
+  int i,j,geomFaceID     = meshDS->ShapeToIndex(F);
 
-  int nb = quad->side[0]->NbPoints();
-  int nr = quad->side[1]->NbPoints();
-  int nt = quad->side[2]->NbPoints();
-  int nl = quad->side[3]->NbPoints();
+  int nb = quad->side[0]->NbPoints(); // bottom
+  int nr = quad->side[1]->NbPoints(); // right
+  int nt = quad->side[2]->NbPoints(); // top
+  int nl = quad->side[3]->NbPoints(); // left
 
   //  Simple Reduce 10->8->6->4 (3 steps)     Multiple Reduce 10->4 (1 step)
   //
@@ -2374,13 +2386,21 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
     }
 
     // number of rows and columns
-    int nrows = nr1 - 1;
+    int nrows    = nr1 - 1;
     int ncol_top = nt1 - 1;
     int ncol_bot = nb1 - 1;
     // number of rows needed to reduce ncol_bot to ncol_top using simple 3->1 "tree" (see below)
-    int nrows_tree31 = int( log( (double)(ncol_bot / ncol_top) ) / log((double) 3 )); // = log x base 3
+    int nrows_tree31 =
+      int( ceil( log( double(ncol_bot) / ncol_top) / log( 3.))); // = log x base 3
     if ( nrows < nrows_tree31 )
+    {
       MultipleReduce = true;
+      error( COMPERR_WARNING,
+             SMESH_Comment("To use 'Reduced' transition, "
+                           "number of face rows should be at least ")
+             << nrows_tree31 << ". Actual number of face rows is " << nrows << ". "
+             "'Quadrangle preference (reversed)' transion has been used.");
+    }
   }
 
   if (MultipleReduce) { // == ComputeQuadPref QUAD_QUADRANGLE_PREF_REVERSED
@@ -2624,7 +2644,7 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
     // add bottom nodes (first columns)
     for (i=2; i<nb; i++)
       NodesC.SetValue(i,1,uv_eb[i-1].node);
-    
+
     // create and add needed nodes
     // add linear layers
     for (i=2; i<nb; i++) {
@@ -2656,13 +2676,12 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh &        aMesh,
     // create faces
     for (i=1; i<nb; i++) {
       for (j=1; j<nbv; j++) {
-          SMDS_MeshFace* F =
-            myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
+        SMDS_MeshFace* F =
+          myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
                             NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
-          if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
+        if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
       }
     }
-    // TODO ???
   } // end Multiple Reduce implementation
   else { // Simple Reduce (!MultipleReduce)
     //=========================================================
index 7b26457d1ed377593037482b86b98bc1033e0f4e..450dbb3c786ee996bf375d509571d776d0ebf28d 100644 (file)
@@ -316,11 +316,10 @@ public:
   static TNodeDistributor* GetDistributor(SMESH_Mesh& aMesh)
   {
     const int myID = -1000;
-    map < int, SMESH_1D_Algo * > & algoMap = aMesh.GetGen()->_map1D_Algo;
-    map < int, SMESH_1D_Algo * >::iterator id_algo = algoMap.find( myID );
-    if ( id_algo == algoMap.end() )
-      return new TNodeDistributor( myID, 0, aMesh.GetGen() );
-    return static_cast< TNodeDistributor* >( id_algo->second );
+    TNodeDistributor* myHyp = dynamic_cast<TNodeDistributor*>( aMesh.GetHypothesis( myID ));
+    if ( !myHyp )
+      myHyp = new TNodeDistributor( myID, 0, aMesh.GetGen() );
+    return myHyp;
   }
   // -----------------------------------------------------------------------------
   bool Compute( vector< double > &                  positions,
index 838a8fbbcfe9d797840e20634eb1eeeb0827b94e..fde94e9ae5158341496f92d15b653ccd63b60cbf 100644 (file)
@@ -295,12 +295,11 @@ public:
   // -----------------------------------------------------------------------------
   static TNodeDistributor* GetDistributor(SMESH_Mesh& aMesh)
   {
-    const int myID = -1000;
-    map < int, SMESH_1D_Algo * > & algoMap = aMesh.GetGen()->_map1D_Algo;
-    map < int, SMESH_1D_Algo * >::iterator id_algo = algoMap.find( myID );
-    if ( id_algo == algoMap.end() )
-      return new TNodeDistributor( myID, 0, aMesh.GetGen() );
-    return static_cast< TNodeDistributor* >( id_algo->second );
+    const int myID = -1001;
+    TNodeDistributor* myHyp = dynamic_cast<TNodeDistributor*>( aMesh.GetHypothesis( myID ));
+    if ( !myHyp )
+      myHyp = new TNodeDistributor( myID, 0, aMesh.GetGen() );
+    return myHyp;
   }
   // -----------------------------------------------------------------------------
   //! Computes distribution of nodes on a straight line ending at pIn and pOut
index 61365b4d60b65a48368d621ea86c54826c0a9839..d4a595ec569aea31bc9945bf67e9e276250fd725 100644 (file)
@@ -567,20 +567,17 @@ virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const
 //
 StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen)
   :SMESH_Hypothesis(hypId, studyId, gen),
-   _nbLayers(1), _thickness(1), _stretchFactor(1)
+   _isToIgnoreShapes(18), _nbLayers(1), _thickness(1), _stretchFactor(1)
 {
   _name = StdMeshers_ViscousLayers::GetHypType();
   _param_algo_dim = -3; // auxiliary hyp used by 3D algos
 } // --------------------------------------------------------------------------------
-void StdMeshers_ViscousLayers::SetBndShapesToIgnore(const std::vector<int>& faceIds)
+void StdMeshers_ViscousLayers::SetBndShapes(const std::vector<int>& faceIds, bool toIgnore)
 {
-  if ( faceIds != _ignoreBndShapeIds )
-    _ignoreBndShapeIds = faceIds, NotifySubMeshesHypothesisModification();
-} // --------------------------------------------------------------------------------
-bool StdMeshers_ViscousLayers::IsIgnoredShape(const int shapeID) const
-{
-  return ( find( _ignoreBndShapeIds.begin(), _ignoreBndShapeIds.end(), shapeID )
-           != _ignoreBndShapeIds.end() );
+  if ( faceIds != _shapeIds )
+    _shapeIds = faceIds, NotifySubMeshesHypothesisModification();
+  if ( _isToIgnoreShapes != toIgnore )
+    _isToIgnoreShapes = toIgnore, NotifySubMeshesHypothesisModification();
 } // --------------------------------------------------------------------------------
 void StdMeshers_ViscousLayers::SetTotalThickness(double thickness)
 {
@@ -638,17 +635,22 @@ std::ostream & StdMeshers_ViscousLayers::SaveTo(std::ostream & save)
   save << " " << _nbLayers
        << " " << _thickness
        << " " << _stretchFactor
-       << " " << _ignoreBndShapeIds.size();
-  for ( unsigned i = 0; i < _ignoreBndShapeIds.size(); ++i )
-    save << " " << _ignoreBndShapeIds[i];
+       << " " << _shapeIds.size();
+  for ( unsigned i = 0; i < _shapeIds.size(); ++i )
+    save << " " << _shapeIds[i];
+  save << " " << !_isToIgnoreShapes; // negate to keep the behavior in old studies.
   return save;
 } // --------------------------------------------------------------------------------
 std::istream & StdMeshers_ViscousLayers::LoadFrom(std::istream & load)
 {
-  int nbFaces, faceID;
+  int nbFaces, faceID, shapeToTreat;
   load >> _nbLayers >> _thickness >> _stretchFactor >> nbFaces;
-  while ( _ignoreBndShapeIds.size() < nbFaces && load >> faceID )
-    _ignoreBndShapeIds.push_back( faceID );
+  while ( _shapeIds.size() < nbFaces && load >> faceID )
+    _shapeIds.push_back( faceID );
+  if ( load >> shapeToTreat )
+    _isToIgnoreShapes = !shapeToTreat;
+  else
+    _isToIgnoreShapes = true; // old behavior
   return load;
 } // --------------------------------------------------------------------------------
 bool StdMeshers_ViscousLayers::SetParametersByMesh(const SMESH_Mesh*   theMesh,
@@ -1072,7 +1074,7 @@ bool _ViscousBuilder::findFacesWithLayers()
   vector<TopoDS_Shape> ignoreFaces;
   for ( unsigned i = 0; i < _sdVec.size(); ++i )
   {
-    vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapesToIgnore();
+    vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapes();
     for ( unsigned i = 0; i < ids.size(); ++i )
     {
       const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] );
index 9794ec54d4aa2fee4b4318457bfb6e5b000b580b..b62e165b03ea82eac45f2b39a0878a5229ab5849 100644 (file)
@@ -39,10 +39,11 @@ class STDMESHERS_EXPORT StdMeshers_ViscousLayers : public SMESH_Hypothesis
 public:
   StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen);
 
-  // Set boundary shapes to exclude from treatment, faces in 3D, edges in 2D
-  void SetBndShapesToIgnore(const std::vector<int>& shapeIds);
-  std::vector<int> GetBndShapesToIgnore() const { return _ignoreBndShapeIds; }
-  bool IsIgnoredShape(const int shapeID) const;
+  // Set boundary shapes, faces in 3D, edges in 2D, either to exclude from
+  // treatment or to make the Viscous Layers on
+  void SetBndShapes(const std::vector<int>& shapeIds, bool toIgnore);
+  std::vector<int> GetBndShapes() const { return _shapeIds; }
+  bool IsToIgnoreShapes() const { return _isToIgnoreShapes; }
 
   // Set total thickness of layers of prisms
   void SetTotalThickness(double thickness);
@@ -86,7 +87,8 @@ public:
 
  private:
 
-  std::vector<int> _ignoreBndShapeIds;
+  std::vector<int> _shapeIds;
+  bool             _isToIgnoreShapes;
   int              _nbLayers;
   double           _thickness;
   double           _stretchFactor;
index e2e26dd383546b39c3973a5e268889207bda9ce4..4edb0163bb1d24a7fd2da7f439035076dfd3041b 100644 (file)
 #include <TColStd_Array1OfReal.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
@@ -332,11 +335,11 @@ namespace VISCOUS_2D
                       const StdMeshers_ViscousLayers2D* theHyp);
     SMESH_ComputeErrorPtr GetError() const { return _error; }
     // does it's job
-    SMESH_ProxyMesh::Ptr  Compute();
+    SMESH_ProxyMesh::Ptr  Compute(const TopoDS_Shape& theShapeHypAssignedTo);
 
   private:
 
-    bool findEdgesWithLayers();
+    bool findEdgesWithLayers(const TopoDS_Shape& theShapeHypAssignedTo);
     bool makePolyLines();
     bool inflate();
     bool fixCollisions();
@@ -398,15 +401,60 @@ namespace VISCOUS_2D
    * \brief Returns StdMeshers_ViscousLayers2D for the FACE
    */
   const StdMeshers_ViscousLayers2D* findHyp(SMESH_Mesh&        theMesh,
-                                            const TopoDS_Face& theFace)
+                                            const TopoDS_Face& theFace,
+                                            TopoDS_Shape*      assignedTo=0)
   {
     SMESH_HypoFilter hypFilter
       ( SMESH_HypoFilter::HasName( StdMeshers_ViscousLayers2D::GetHypType() ));
     const SMESH_Hypothesis * hyp =
-      theMesh.GetHypothesis( theFace, hypFilter, /*ancestors=*/true );
+      theMesh.GetHypothesis( theFace, hypFilter, /*ancestors=*/true, assignedTo );
     return dynamic_cast< const StdMeshers_ViscousLayers2D* > ( hyp );
   }
 
+  //================================================================================
+  /*!
+   * \brief Returns ids of EDGEs not to create Viscous Layers on
+   *  \param [in] theHyp - the hypothesis, holding edges either to ignore or not to.
+   *  \param [in] theFace - the FACE whose EDGEs are checked.
+   *  \param [in] theMesh - the mesh.
+   *  \param [in,out] theEdgeIds - container returning EDGEs to ignore.
+   *  \return int - number of found EDGEs of the FACE.
+   */
+  //================================================================================
+
+  int getEdgesToIgnore( const StdMeshers_ViscousLayers2D* theHyp,
+                        const TopoDS_Shape&               theFace,
+                        const SMESHDS_Mesh*               theMesh,
+                        set< int > &                      theEdgeIds)
+  {
+    int nbToEdgesIgnore = 0;
+    vector<TGeomID> ids = theHyp->GetBndShapes();
+    if ( theHyp->IsToIgnoreShapes() ) // EDGEs to ignore are given
+    {
+      for ( size_t i = 0; i < ids.size(); ++i )
+      {
+        const TopoDS_Shape& E = theMesh->IndexToShape( ids[i] );
+        if ( !E.IsNull() &&
+             E.ShapeType() == TopAbs_EDGE &&
+             SMESH_MesherHelper::IsSubShape( E, theFace ))
+        {
+          theEdgeIds.insert( ids[i] );
+          ++nbToEdgesIgnore;
+        }
+      }
+    }
+    else // EDGEs to make the Viscous Layers on are given
+    {
+      TopExp_Explorer E( theFace, TopAbs_EDGE );
+      for ( ; E.More(); E.Next(), ++nbToEdgesIgnore )
+        theEdgeIds.insert( theMesh->ShapeToIndex( E.Current() ));
+
+      for ( size_t i = 0; i < ids.size(); ++i )
+        nbToEdgesIgnore -= theEdgeIds.erase( ids[i] );
+    }
+    return nbToEdgesIgnore;
+  }
+
 } // namespace VISCOUS_2D
 
 //================================================================================
@@ -432,11 +480,12 @@ StdMeshers_ViscousLayers2D::Compute(SMESH_Mesh&        theMesh,
 {
   SMESH_ProxyMesh::Ptr pm;
 
-  const StdMeshers_ViscousLayers2D* vlHyp = VISCOUS_2D::findHyp( theMesh, theFace );
+  TopoDS_Shape hypAssignedTo;
+  const StdMeshers_ViscousLayers2D* vlHyp = VISCOUS_2D::findHyp( theMesh, theFace, &hypAssignedTo );
   if ( vlHyp )
   {
     VISCOUS_2D::_ViscousBuilder2D builder( theMesh, theFace, vlHyp );
-    pm = builder.Compute();
+    pm = builder.Compute( hypAssignedTo );
     SMESH_ComputeErrorPtr error = builder.GetError();
     if ( error && !error->IsOK() )
       theMesh.GetSubMesh( theFace )->GetComputeError() = error;
@@ -495,9 +544,9 @@ _ViscousBuilder2D::_ViscousBuilder2D(SMESH_Mesh&                       theMesh,
   _mesh( &theMesh ), _face( theFace ), _hyp( theHyp ), _helper( theMesh )
 {
   _helper.SetSubShape( _face );
-  _helper.SetElementsOnShape(true);
+  _helper.SetElementsOnShape( true );
 
-  //_face.Orientation( TopAbs_FORWARD );
+  _face.Orientation( TopAbs_FORWARD ); // 2D logic works only in this case
   _surface = BRep_Tool::Surface( _face );
 
   if ( _hyp )
@@ -512,7 +561,6 @@ _ViscousBuilder2D::_ViscousBuilder2D(SMESH_Mesh&                       theMesh,
 
 bool _ViscousBuilder2D::error(const string& text )
 {
-  cout << "_ViscousBuilder2D::error " << text << endl;
   _error->myName    = COMPERR_ALGO_FAILED;
   _error->myComment = string("Viscous layers builder 2D: ") + text;
   if ( SMESH_subMesh* sm = _mesh->GetSubMesh( _face ) )
@@ -522,8 +570,9 @@ bool _ViscousBuilder2D::error(const string& text )
       _error->myAlgo = smError->myAlgo;
     smError = _error;
   }
-  //makeGroupOfLE(); // debug
-
+#ifdef _DEBUG_
+  cout << "_ViscousBuilder2D::error " << text << endl;
+#endif
   return false;
 }
 
@@ -533,14 +582,14 @@ bool _ViscousBuilder2D::error(const string& text )
  */
 //================================================================================
 
-SMESH_ProxyMesh::Ptr _ViscousBuilder2D::Compute()
+SMESH_ProxyMesh::Ptr _ViscousBuilder2D::Compute(const TopoDS_Shape& theShapeHypAssignedTo)
 {
   _error       = SMESH_ComputeError::New(COMPERR_OK);
   _faceSideVec = StdMeshers_FaceSide::GetFaceWires( _face, *_mesh, true, _error );
   if ( !_error->IsOK() )
     return _proxyMesh;
 
-  if ( !findEdgesWithLayers() ) // analysis of a shape
+  if ( !findEdgesWithLayers(theShapeHypAssignedTo) ) // analysis of a shape
     return _proxyMesh;
 
   if ( ! makePolyLines() ) // creation of fronts
@@ -569,53 +618,49 @@ SMESH_ProxyMesh::Ptr _ViscousBuilder2D::Compute()
  */
 //================================================================================
 
-bool _ViscousBuilder2D::findEdgesWithLayers()
+bool _ViscousBuilder2D::findEdgesWithLayers(const TopoDS_Shape& theShapeHypAssignedTo)
 {
   // collect all EDGEs to ignore defined by hyp
-  int nbMyEdgesIgnored = 0;
-  vector<TGeomID> ids = _hyp->GetBndShapesToIgnore();
-  for ( size_t i = 0; i < ids.size(); ++i )
-  {
-    const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] );
-    if ( !s.IsNull() && s.ShapeType() == TopAbs_EDGE ) {
-      _ignoreShapeIds.insert( ids[i] );
-      nbMyEdgesIgnored += ( _helper.IsSubShape( s, _face ));
-    }
-  }
+  int nbMyEdgesIgnored = getEdgesToIgnore( _hyp, _face, getMeshDS(), _ignoreShapeIds );
 
   // check all EDGEs of the _face
   int totalNbEdges = 0;
+  TopTools_IndexedDataMapOfShapeListOfShape facesOfEdgeMap;
+  TopExp::MapShapesAndAncestors( theShapeHypAssignedTo,
+                                 TopAbs_EDGE, TopAbs_FACE, facesOfEdgeMap);
   for ( size_t iWire = 0; iWire < _faceSideVec.size(); ++iWire )
   {
     StdMeshers_FaceSidePtr wire = _faceSideVec[ iWire ];
     totalNbEdges += wire->NbEdges();
     for ( int iE = 0; iE < wire->NbEdges(); ++iE )
-      if ( _helper.NbAncestors( wire->Edge( iE ), *_mesh, TopAbs_FACE ) > 1 )
+    {
+      const TopTools_ListOfShape& faceList = facesOfEdgeMap.FindFromKey( wire->Edge( iE ));
+      if ( faceList.Extent() > 1 )
       {
         // ignore internal EDGEs (shared by several FACEs)
-        TGeomID edgeID = getMeshDS()->ShapeToIndex( wire->Edge( iE ));
+        const TGeomID edgeID = wire->EdgeID( iE );
         _ignoreShapeIds.insert( edgeID );
 
         // check if ends of an EDGE are to be added to _noShrinkVert
-        PShapeIteratorPtr faceIt = _helper.GetAncestors( wire->Edge( iE ), *_mesh, TopAbs_FACE );
-        while ( const TopoDS_Shape* neighbourFace = faceIt->next() )
+        TopTools_ListIteratorOfListOfShape faceIt( faceList );
+        for ( ; faceIt.More(); faceIt.Next() )
         {
-          if ( neighbourFace->IsSame( _face )) continue;
-          SMESH_Algo* algo = _mesh->GetGen()->GetAlgo( *_mesh, *neighbourFace );
+          const TopoDS_Shape& neighbourFace = faceIt.Value();
+          if ( neighbourFace.IsSame( _face )) continue;
+          SMESH_Algo* algo = _mesh->GetGen()->GetAlgo( *_mesh, neighbourFace );
           if ( !algo ) continue;
 
           const StdMeshers_ViscousLayers2D* viscHyp = 0;
           const list <const SMESHDS_Hypothesis *> & allHyps =
-            algo->GetUsedHypothesis(*_mesh, *neighbourFace, /*noAuxiliary=*/false);
+            algo->GetUsedHypothesis(*_mesh, neighbourFace, /*noAuxiliary=*/false);
           list< const SMESHDS_Hypothesis *>::const_iterator hyp = allHyps.begin();
           for ( ; hyp != allHyps.end() && !viscHyp; ++hyp )
             viscHyp = dynamic_cast<const StdMeshers_ViscousLayers2D*>( *hyp );
 
           set<TGeomID> neighbourIgnoreEdges;
-          if (viscHyp) {
-            vector<TGeomID> ids = _hyp->GetBndShapesToIgnore();
-            neighbourIgnoreEdges.insert( ids.begin(), ids.end() );
-          }
+          if (viscHyp)
+            getEdgesToIgnore( viscHyp, neighbourFace, getMeshDS(), neighbourIgnoreEdges );
+
           for ( int iV = 0; iV < 2; ++iV )
           {
             TopoDS_Vertex vertex = iV ? wire->LastVertex(iE) : wire->FirstVertex(iE);
@@ -626,13 +671,32 @@ bool _ViscousBuilder2D::findEdgesWithLayers()
               PShapeIteratorPtr edgeIt = _helper.GetAncestors( vertex, *_mesh, TopAbs_EDGE );
               while ( const TopoDS_Shape* edge = edgeIt->next() )
                 if ( !edge->IsSame( wire->Edge( iE )) &&
+                     _helper.IsSubShape( *edge, neighbourFace ) &&
                      neighbourIgnoreEdges.count( getMeshDS()->ShapeToIndex( *edge )))
+                {
                   _noShrinkVert.insert( getMeshDS()->ShapeToIndex( vertex ));
+                  break;
+                }
             }
           }
         }
       }
+    }
   }
+
+  // add VERTEXes w/o layers to _ignoreShapeIds (this is used by toShrinkForAdjacent())
+  for ( size_t iWire = 0; iWire < _faceSideVec.size(); ++iWire )
+  {
+    StdMeshers_FaceSidePtr wire = _faceSideVec[ iWire ];
+    for ( int iE = 0; iE < wire->NbEdges(); ++iE )
+    {
+      TGeomID edge1 = wire->EdgeID( iE );
+      TGeomID edge2 = wire->EdgeID( iE+1 );
+      if ( _ignoreShapeIds.count( edge1 ) && _ignoreShapeIds.count( edge2 ))
+        _ignoreShapeIds.insert( getMeshDS()->ShapeToIndex( wire->LastVertex( iE )));
+    }
+  }
+
   return ( nbMyEdgesIgnored < totalNbEdges );
 }
 
@@ -773,7 +837,8 @@ bool _ViscousBuilder2D::makePolyLines()
         }
       }
     }
-    _thickness = Min( _hyp->GetTotalThickness(), maxPossibleThick );
+    if ( maxPossibleThick > 0. )
+      _thickness = Min( _hyp->GetTotalThickness(), maxPossibleThick );
   }
 
   // Adjust _LayerEdge's at _PolyLine's extremities
@@ -1713,11 +1778,12 @@ bool _ViscousBuilder2D::toShrinkForAdjacent( const TopoDS_Face&   adjFace,
                                              const TopoDS_Edge&   E,
                                              const TopoDS_Vertex& V)
 {
-  if ( const StdMeshers_ViscousLayers2D* vlHyp = findHyp( *_mesh, adjFace ))
+  TopoDS_Shape hypAssignedTo;
+  if ( const StdMeshers_ViscousLayers2D* vlHyp = findHyp( *_mesh, adjFace, &hypAssignedTo ))
   {
     VISCOUS_2D::_ViscousBuilder2D builder( *_mesh, adjFace, vlHyp );
     builder._faceSideVec = StdMeshers_FaceSide::GetFaceWires( adjFace, *_mesh, true, _error );
-    builder.findEdgesWithLayers();
+    builder.findEdgesWithLayers( hypAssignedTo );
 
     PShapeIteratorPtr edgeIt = _helper.GetAncestors( V, *_mesh, TopAbs_EDGE );
     while ( const TopoDS_Shape* edgeAtV = edgeIt->next() )
@@ -1732,7 +1798,7 @@ bool _ViscousBuilder2D::toShrinkForAdjacent( const TopoDS_Face&   adjFace,
   }
   return false;
 }
-  
+
 //================================================================================
 /*!
  * \brief Make faces
@@ -1741,6 +1807,10 @@ bool _ViscousBuilder2D::toShrinkForAdjacent( const TopoDS_Face&   adjFace,
 
 bool _ViscousBuilder2D::refine()
 {
+  // find out orientation of faces to create
+  bool isReverse = 
+    ( _helper.GetSubShapeOri( _mesh->GetShapeToMesh(), _face ) == TopAbs_REVERSED );
+
   // store a proxyMesh in a sub-mesh
   // make faces on each _PolyLine
   vector< double > layersHeight;
@@ -1845,6 +1915,8 @@ bool _ViscousBuilder2D::refine()
       nbN = innerNodes.size() - ( hasRightNode || hasOwnRightNode );
     L._leftNodes .reserve( _hyp->GetNumberLayers() );
     L._rightNodes.reserve( _hyp->GetNumberLayers() );
+    int cur = 0, prev = -1; // to take into account orientation of _face
+    if ( isReverse ) std::swap( cur, prev );
     for ( int iF = 0; iF < _hyp->GetNumberLayers(); ++iF ) // loop on layers of faces
     {
       // get accumulated length of intermediate segments
@@ -1878,10 +1950,9 @@ bool _ViscousBuilder2D::refine()
       if ( !hasOwnRightNode ) L._rightNodes.push_back( innerNodes.back() );
 
       // create faces
-      // TODO care of orientation
       for ( size_t i = 1; i < innerNodes.size(); ++i )
-        if ( SMDS_MeshElement* f = _helper.AddFace( outerNodes[ i-1 ], outerNodes[ i ],
-                                                    innerNodes[ i ],   innerNodes[ i-1 ]))
+        if ( SMDS_MeshElement* f = _helper.AddFace( outerNodes[ i+prev ], outerNodes[ i+cur ],
+                                                    innerNodes[ i+cur  ], innerNodes[ i+prev ]))
           L._newFaces.insert( L._newFaces.end(), f );
 
       outerNodes.swap( innerNodes );
@@ -1898,11 +1969,14 @@ bool _ViscousBuilder2D::refine()
         continue;
 
       for ( size_t i = 1; i < lNodes.size(); ++i )
-        _helper.AddFace( lNodes[ i-1 ], rNodes[ i-1 ],
-                         rNodes[ i ],   lNodes[ i ]);
+        _helper.AddFace( lNodes[ i+prev ], rNodes[ i+prev ],
+                         rNodes[ i+cur ],  lNodes[ i+cur ]);
 
       const UVPtStruct& ptOnVertex = points[ isR ? L._lastPntInd : L._firstPntInd ];
-      _helper.AddFace( ptOnVertex.node, rNodes[ 0 ], lNodes[ 0 ]);
+      if ( isReverse )
+        _helper.AddFace( ptOnVertex.node, lNodes[ 0 ], rNodes[ 0 ]);
+      else
+        _helper.AddFace( ptOnVertex.node, rNodes[ 0 ], lNodes[ 0 ]);
     }
 
     // Fill the _ProxyMeshOfFace
index 8fc16589c6e03c401518411cc6f06b1938508c38..da78f1cd96d1b4932b059c09fb34fd8ef43152eb 100644 (file)
@@ -35,7 +35,8 @@ salomeinclude_HEADERS = \
        StdMeshersGUI_LayerDistributionParamWdg.h \
        StdMeshersGUI_FixedPointsParamWdg.h \
        StdMeshersGUI_SubShapeSelectorWdg.h \
-       StdMeshersGUI_CartesianParamCreator.h
+       StdMeshersGUI_CartesianParamCreator.h \
+       StdMeshersGUI_RadioButtonsGrpWdg.h
 
 # Libraries targets
 lib_LTLIBRARIES = libStdMeshersGUI.la
@@ -51,7 +52,8 @@ dist_libStdMeshersGUI_la_SOURCES = \
        StdMeshersGUI_LayerDistributionParamWdg.cxx \
        StdMeshersGUI_FixedPointsParamWdg.cxx \
        StdMeshersGUI_SubShapeSelectorWdg.cxx \
-       StdMeshersGUI_CartesianParamCreator.cxx
+       StdMeshersGUI_CartesianParamCreator.cxx \
+       StdMeshersGUI_RadioButtonsGrpWdg.cxx
 
 MOC_FILES = \
        StdMeshersGUI_StdHypothesisCreator_moc.cxx \
@@ -63,7 +65,8 @@ MOC_FILES = \
        StdMeshersGUI_LayerDistributionParamWdg_moc.cxx \
        StdMeshersGUI_FixedPointsParamWdg_moc.cxx \
        StdMeshersGUI_SubShapeSelectorWdg_moc.cxx \
-       StdMeshersGUI_CartesianParamCreator_moc.cxx
+       StdMeshersGUI_CartesianParamCreator_moc.cxx \
+       StdMeshersGUI_RadioButtonsGrpWdg_moc.cxx
 
 nodist_libStdMeshersGUI_la_SOURCES= \
        $(MOC_FILES)
diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx
new file mode 100644 (file)
index 0000000..cca80aa
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (C) 2007-2013  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
+//
+#include "StdMeshersGUI_RadioButtonsGrpWdg.h"
+
+#include <QVBoxLayout>
+#include <QRadioButton>
+#include <QButtonGroup>
+#include <QStringList>
+
+#define SPACING 6
+#define MARGIN  11
+
+//================================================================================
+/*!
+ * \brief Creates a QGroupBox with a given title
+ */
+//================================================================================
+
+StdMeshersGUI_RadioButtonsGrpWdg::StdMeshersGUI_RadioButtonsGrpWdg( const QString& title )
+  : QGroupBox( title )
+{
+  myButtonGrp = new QButtonGroup( this );
+}
+
+//================================================================================
+/*!
+ * \brief Creates a given nubmer of button labels with given labels (QString's)
+ */
+//================================================================================
+
+void StdMeshersGUI_RadioButtonsGrpWdg::setButtonLabels( const QStringList& buttonLabels )
+{
+  QVBoxLayout* layout = new QVBoxLayout( this );
+  layout->setSpacing(SPACING);
+  layout->setMargin(MARGIN);
+
+  for ( int id = 0; id < buttonLabels.size(); ++id )
+  {
+    QRadioButton* button = new QRadioButton( buttonLabels.at(id), this );
+    layout->addWidget( button );
+    myButtonGrp->addButton( button, id );
+  }
+}
+
+//================================================================================
+/*!
+ * \brief Set checked a radio button with a give id.
+ */
+//================================================================================
+
+void StdMeshersGUI_RadioButtonsGrpWdg::setChecked(int id)
+{
+  if ( QAbstractButton* but = myButtonGrp->button( id ))
+    but->setChecked( true );
+}
+
+//================================================================================
+/*!
+ * \brief Return id (zero based) of a checked radio button
+ */
+//================================================================================
+
+int StdMeshersGUI_RadioButtonsGrpWdg::checkedId () const
+{
+  return myButtonGrp->checkedId();
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h
new file mode 100644 (file)
index 0000000..fd8be84
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright (C) 2007-2013  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
+//
+#ifndef STDMESHERSGUI_RadioButtonsGrpWdg_H
+#define STDMESHERSGUI_RadioButtonsGrpWdg_H
+
+// SMESH includes
+#include "SMESH_StdMeshersGUI.hxx"
+
+// Qt includes
+#include <QGroupBox>
+
+class QButtonGroup;
+class QStringList;
+
+/*!
+ * \brief A QGroupBox holding several radio buttons
+ */
+class STDMESHERSGUI_EXPORT StdMeshersGUI_RadioButtonsGrpWdg : public QGroupBox
+{
+  Q_OBJECT
+
+public:
+  StdMeshersGUI_RadioButtonsGrpWdg (const QString& title);
+
+  void setButtonLabels( const QStringList& buttonLabels );
+
+  void setChecked(int id);
+
+  int checkedId() const;
+
+  QButtonGroup* getButtonGroup() { return myButtonGrp; }
+
+private:
+  QButtonGroup* myButtonGrp;
+};
+
+#endif // STDMESHERSGUI_RadioButtonsGrpWdg_H
index 1c60072962d6e207c182f31bb286f7327a67f640..493235b15b59aa1633bf0f0a62217d3f4964dd74 100644 (file)
@@ -39,6 +39,7 @@
 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
 #include "StdMeshersGUI_QuadrangleParamWdg.h"
 #include "StdMeshersGUI_SubShapeSelectorWdg.h"
+#include "StdMeshersGUI_RadioButtonsGrpWdg.h"
 
 #include <SALOMEDSClient_Study.hxx>
 
@@ -58,6 +59,7 @@
 #include <QSlider>
 #include <QLabel>
 #include <QCheckBox>
+#include <QButtonGroup>
 
 const double VALUE_MAX = 1.0e+15, // COORD_MAX
              VALUE_MAX_2  = VALUE_MAX * VALUE_MAX,
@@ -708,10 +710,10 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
       h->SetVarParameter( params[2].text(), "SetStretchFactor" );
       h->SetStretchFactor ( params[2].myValue.toDouble() );
 
-      if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = 
-           widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 ))
+      if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
+           widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 ))
       {
-        h->SetIgnoreEdges( idsWg->GetListOfIDs() );
+        h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
       }
     }
     else if( hypType()=="QuadrangleParams" )
@@ -1198,7 +1200,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
     if ( !aMainEntry.isEmpty() )
     {
-      item.myName = tr( "SMESH_EDGES_WO_LAYERS" );
+      item.myName = tr("TO_IGNORE_EDGES_OR_NOT");
+      p.append( item );
+
+      StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg("");
+      ignoreWdg->setButtonLabels ( QStringList()
+                                   << tr("NOT_TO_IGNORE_EDGES")
+                                   << tr("TO_IGNORE_EDGES") );
+      ignoreWdg->setChecked( h->GetIsToIgnoreEdges() );
+      connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged()));
+      customWidgets()->append( ignoreWdg );
+
+      item.myName =
+        tr( h->GetIsToIgnoreEdges() ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" );
       p.append( item );
 
       StdMeshersGUI_SubShapeSelectorWdg* idsWg =
@@ -1206,7 +1220,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
 
       idsWg->SetGeomShapeEntry( aMainEntry );
       idsWg->SetMainShapeEntry( aMainEntry );
-      idsWg->SetListOfIDs( h->GetIgnoreEdges() );
+      idsWg->SetListOfIDs( h->GetEdges() );
       idsWg->showPreview( true );
       customWidgets()->append ( idsWg );
     }
@@ -1489,6 +1503,13 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa
     //param.myValue = w->isChecked();
     return true;
   }
+  if ( widget->inherits( "StdMeshersGUI_RadioButtonsGrpWdg" ))
+  {
+    const StdMeshersGUI_RadioButtonsGrpWdg * w =
+      static_cast<const StdMeshersGUI_RadioButtonsGrpWdg*>( widget );
+    param.myValue = w->checkedId();
+    return true;
+  }
   return false;
 }
 
@@ -1539,6 +1560,14 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
       toCopyGroups->setEnabled( true );
     }
   }
+  else if ( hypType() == "ViscousLayers2D" && paramWidget->inherits("QButtonGroup"))
+  {
+    if ( QLabel* label = getLabel(4) )
+    {
+      bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId();
+      label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ));
+    }
+  }
 }
 
 //================================================================================
index 2b506311f87a1e9a160b9038afa5c797e1de7892..cfc5d535dd2343f442cf72ad438e04eda06251c4 100644 (file)
@@ -1,6 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="en_US">
+<context>
+    <name>StdMeshersGUI_StdHypothesisCreator</name>
+    <message>
+        <source>TO_IGNORE_EDGES_OR_NOT</source>
+        <translation>Specified edges are</translation>
+    </message>
+    <message>
+        <source>NOT_TO_IGNORE_EDGES</source>
+        <translation>Edges with layers (walls)</translation>
+    </message>
+    <message>
+        <source>TO_IGNORE_EDGES</source>
+        <translation>Edges without layers (inlets and oulets)</translation>
+    </message>
+</context>
 <context>
     <name>@default</name>
     <message>
     </message>
     <message>
         <source>SMESH_EDGES_WO_LAYERS</source>
-        <translation>Edges without layers
-(inlets and oulets)</translation>
+        <translation>Edges without layers</translation>
+    </message>
+    <message>
+        <source>SMESH_FACES_WITH_LAYERS</source>
+        <translation>Faces with layers 
+(walls)</translation>
+    </message>
+    <message>
+        <source>SMESH_EDGES_WITH_LAYERS</source>
+        <translation>Edges with layers</translation>
     </message>
     <message>
         <source>SMESH_MAX_LENGTH_TITLE</source>
index bd709e593ebb9ee02a4c18fbc05e813e2766f3ec..e26f4cae5f3e7fcfb6e21d0032c582e5e3579e0a 100644 (file)
@@ -77,15 +77,18 @@ StdMeshers_ViscousLayers2D_i::~StdMeshers_ViscousLayers2D_i()
  */
 //================================================================================
 
-void StdMeshers_ViscousLayers2D_i::SetIgnoreEdges(const ::SMESH::long_array& edgeIDs)
-throw ( SALOME::SALOME_Exception )
+void StdMeshers_ViscousLayers2D_i::SetEdges(const ::SMESH::long_array& edgeIDs,
+                                            CORBA::Boolean             toIgnore)
+  throw ( SALOME::SALOME_Exception )
 {
   vector<int> ids( edgeIDs.length() );
   for ( unsigned i = 0; i < ids.size(); ++i )
     if (( ids[i] = edgeIDs[i] ) < 1 )
       THROW_SALOME_CORBA_EXCEPTION( "Invalid edge id", SALOME::BAD_PARAM );
-  GetImpl()->SetBndShapesToIgnore( ids );
-  SMESH::TPythonDump() << _this() << ".SetIgnoreEdges( " << edgeIDs << " )";
+
+  GetImpl()->SetBndShapes( ids, toIgnore );
+
+  SMESH::TPythonDump() << _this() << ".SetEdges( " << edgeIDs << ", " << toIgnore << " )";
 }
 
 //================================================================================
@@ -94,9 +97,23 @@ throw ( SALOME::SALOME_Exception )
  */
 //================================================================================
 
-SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges()
+void StdMeshers_ViscousLayers2D_i::SetIgnoreEdges(const ::SMESH::long_array& edgeIDs)
+  throw ( SALOME::SALOME_Exception )
 {
-  vector<int> idsVec = GetImpl()->GetBndShapesToIgnore();
+  SMESH::TPythonDump pyDump;
+  this->SetEdges( edgeIDs, true );
+  pyDump<< _this() << ".SetIgnoreEdges( " << edgeIDs << " )";
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetEdges()
+{
+  vector<int> idsVec = GetImpl()->GetBndShapes();
   SMESH::long_array_var ids = new SMESH::long_array;
   ids->length( idsVec.size() );
   for ( unsigned i = 0; i < idsVec.size(); ++i )
@@ -110,6 +127,30 @@ SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges()
  */
 //================================================================================
 
+SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges()
+{
+  if ( GetImpl()->IsToIgnoreShapes() )
+    return this->GetEdges();
+  return new SMESH::long_array;
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+CORBA::Boolean StdMeshers_ViscousLayers2D_i::GetIsToIgnoreEdges()
+{
+  return GetImpl()->IsToIgnoreShapes();
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
 void StdMeshers_ViscousLayers2D_i::SetTotalThickness(::CORBA::Double thickness)
 throw ( SALOME::SALOME_Exception )
 {
index 68723365c08cd7b4c8d6badbe3106894ea73c11b..91b072146ec197cf53a7fd9bba265f1f8549123f 100644 (file)
@@ -48,9 +48,14 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers2D_i:
   // Destructor
   virtual ~StdMeshers_ViscousLayers2D_i();
 
-  void SetIgnoreEdges(const ::SMESH::long_array& edgeIDs) throw ( SALOME::SALOME_Exception );
+  void SetIgnoreEdges(const SMESH::long_array& edgeIDs) throw ( SALOME::SALOME_Exception );
   SMESH::long_array* GetIgnoreEdges();
 
+  void SetEdges(const SMESH::long_array& edgeIDs, 
+                CORBA::Boolean           toIgnore) throw (SALOME::SALOME_Exception);
+  SMESH::long_array* GetEdges();
+  CORBA::Boolean     GetIsToIgnoreEdges();
+
   void SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception );
   ::CORBA::Double GetTotalThickness();
 
index 99f7f1d6bf64a41813da0a06ed181e2062d76e9d..5ad82c7ecbb22ef1dd9b8a2c8d775b25ccc0f63c 100644 (file)
@@ -85,7 +85,7 @@ throw ( SALOME::SALOME_Exception )
   for ( unsigned i = 0; i < ids.size(); ++i )
     if (( ids[i] = faceIDs[i] ) < 1 )
       THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
-  GetImpl()->SetBndShapesToIgnore( ids );
+  GetImpl()->SetBndShapes( ids, /*toIgnore=*/true );
   SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
 }
 
@@ -97,11 +97,14 @@ throw ( SALOME::SALOME_Exception )
 
 SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces()
 {
-  vector<int> idsVec = GetImpl()->GetBndShapesToIgnore();
   SMESH::long_array_var ids = new SMESH::long_array;
-  ids->length( idsVec.size() );
-  for ( unsigned i = 0; i < idsVec.size(); ++i )
-    ids[i] = idsVec[i];
+  if ( GetImpl()->IsToIgnoreShapes() )
+  {
+    vector<int> idsVec = GetImpl()->GetBndShapes();
+    ids->length( idsVec.size() );
+    for ( unsigned i = 0; i < idsVec.size(); ++i )
+      ids[i] = idsVec[i];
+  }
   return ids._retn();
 }
 
diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py
new file mode 100644 (file)
index 0000000..abff9ed
--- /dev/null
@@ -0,0 +1,604 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013  EDF R&D
+#
+# 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
+#
+
+# Modules Python
+# Modules Eficas
+
+import os, subprocess
+from MGCleanerPlugDialog import Ui_MGCleanerPlugDialog
+from MGCleanerMonViewText import MGCleanerMonViewText
+from PyQt4.QtGui import *
+from PyQt4.QtCore import *
+
+
+class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
+  """
+  """
+  def __init__(self):
+    QWidget.__init__(self)
+    self.setupUi(self)
+    self.connecterSignaux()
+    self.fichierIn=""
+    self.fichierOut=""
+    self.MeshIn=""
+    self.commande=""
+    self.num=1
+    self.__selectedMesh=None
+    
+    # complex whith QResources: not used
+    # The icon are supposed to be located in the $SMESH_ROOT_DIR/share/salome/resources/smesh folder,
+    # other solution could be in the same folder than this python module file:
+    # iconfolder=os.path.dirname(os.path.abspath(__file__))
+
+    self.iconfolder=os.environ["SMESH_ROOT_DIR"]+"/share/salome/resources/smesh"
+    #print "MGCleanerMonPlugDialog iconfolder",iconfolder
+    icon = QIcon()
+    icon.addFile(os.path.join(self.iconfolder,"select1.png"))
+    self.PB_LoadHyp.setIcon(icon)
+    self.PB_LoadHyp.setToolTip("hypothesis from Salome Object Browser")
+    self.PB_SaveHyp.setIcon(icon)
+    self.PB_SaveHyp.setToolTip("hypothesis to Salome Object Browser")
+    self.PB_MeshSmesh.setIcon(icon)
+    self.PB_MeshSmesh.setToolTip("source mesh from Salome Object Browser")
+    icon = QIcon()
+    icon.addFile(os.path.join(self.iconfolder,"open.png"))
+    self.PB_ParamsFileExplorer.setIcon(icon)
+    self.PB_Load.setIcon(icon)
+    self.PB_Load.setToolTip("hypothesis from file")
+    self.PB_Save.setIcon(icon)
+    self.PB_Save.setToolTip("hypothesis to file")
+    self.PB_MeshFile.setIcon(icon)
+    self.PB_MeshFile.setToolTip("source mesh from a file in disk")
+    
+    #Ces parametres ne sont pas remis à rien par le clean
+    self.paramsFile= os.path.abspath(os.path.join(os.environ["HOME"],".MGCleaner.dat"))
+    self.LE_ParamsFile.setText(self.paramsFile)
+    self.LE_MeshFile.setText("")
+    self.LE_MeshSmesh.setText("")
+
+    v1=QDoubleValidator(self)
+    v1.setBottom(0.)
+    #v1.setTop(10000.)
+    v1.setDecimals(4)
+    self.SP_MinHoleSize.setValidator(v1)
+    self.SP_MinHoleSize.titleForWarning="MinHoleSize"
+
+    v2=QDoubleValidator(self)
+    v2.setBottom(0.)
+    #v2.setTop(10000.)
+    v2.setDecimals(4)
+    self.SP_ToleranceDisplacement.setValidator(v2)
+    self.SP_ToleranceDisplacement.titleForWarning="ToleranceDisplacement"
+
+    v3=QDoubleValidator(self)
+    v3.setBottom(0.)
+    #v3.setTop(10000.)
+    v3.setDecimals(4)
+    self.SP_ResolutionLength.setValidator(v3)
+    self.SP_ResolutionLength.titleForWarning="ResolutionLength"
+    
+    v4=QDoubleValidator(self)
+    v4.setBottom(0.)
+    #v4.setTop(10000.)
+    v4.setDecimals(4)
+    self.SP_OverlapDistance.setValidator(v4)
+    self.SP_OverlapDistance.titleForWarning="OverlapDistance"
+    
+    self.resize(800, 500)
+    self.clean()
+
+  def connecterSignaux(self) :
+    self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed)
+    self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean)
+    self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed)
+    self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed)
+    
+    self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed)
+    self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
+    self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed)
+    self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed)
+    
+    self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
+    self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed)
+    self.connect(self.LE_MeshSmesh,SIGNAL("returnPressed()"),self.meshSmeshNameChanged)
+    self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName)
+    self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
+    self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
+
+    #QtCore.QObject.connect(self.checkBox, QtCore.SIGNAL("stateChanged(int)"), self.change) 
+    self.connect(self.CB_FillHoles,SIGNAL("stateChanged(int)"),self.SP_MinHoleSize.setEnabled)
+    self.connect(self.CB_ComputedToleranceDisplacement,SIGNAL("stateChanged(int)"),self.SP_ToleranceDisplacement.setDisabled)
+    self.connect(self.CB_ComputedResolutionLength,SIGNAL("stateChanged(int)"),self.SP_ResolutionLength.setDisabled)
+    self.connect(self.CB_ComputedOverlapDistance,SIGNAL("stateChanged(int)"),self.SP_OverlapDistance.setDisabled)
+
+  def PBHelpPressed(self):
+    try:
+      mydir=os.environ["SMESH_ROOT_DIR"]
+    except Exception:
+      QMessageBox.warning( self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
+      return
+    maDoc=mydir+"/share/doc/salome/gui/SMESH/MGCleaner/_downloads/mg-cleaner_user_manual.pdf"
+    command="xdg-open "+maDoc+";"
+    subprocess.call(command, shell=True)
+
+  def PBOKPressed(self):
+    if not(self.PrepareLigneCommande()):
+      #warning done yet
+      #QMessageBox.warning(self, "Compute", "Command not found")
+      return
+    maFenetre=MGCleanerMonViewText(self, self.commande)
+
+  def enregistreResultat(self):
+    import salome
+    import SMESH
+    from salome.kernel import studyedit
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+    
+    if not os.path.isfile(self.fichierOut):
+      QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
+
+    maStudy=studyedit.getActiveStudy()
+    smesh.SetCurrentStudy(maStudy)
+    (outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
+    name=str(self.LE_MeshSmesh.text())
+    initialMeshFile=None
+    initialMeshObject=None
+    if name=="":
+      a=str(self.fichierIn)
+      name=os.path.basename(os.path.splitext(a)[0])
+      initialMeshFile=a
+    else:
+      initialMeshObject=maStudy.FindObjectByName(name ,"SMESH")[0]
+
+    meshname = name+"_MGC_"+str(self.num)
+    smesh.SetName(outputMesh.GetMesh(), meshname)
+    outputMesh.Compute() #no algorithms message for "Mesh_x" has been computed with warnings: -  global 1D algorithm is missing
+
+    self.editor = studyedit.getStudyEditor()
+    moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
+    HypReMeshEntry = self.editor.findOrCreateItem(
+        moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
+    
+    monStudyBuilder=maStudy.NewBuilder()
+    monStudyBuilder.NewCommand()
+    newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
+    self.editor.setAttributeValue(newStudyIter, "AttributeName", "MGCleaner Parameters_"+str(self.num))
+    self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
+    
+    SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
+    
+    if initialMeshFile!=None:
+      newStudyFileName=monStudyBuilder.NewObject(SOMesh)
+      self.editor.setAttributeValue(newStudyFileName, "AttributeName", "meshFile")
+      self.editor.setAttributeValue(newStudyFileName, "AttributeExternalFileDef", initialMeshFile)
+      self.editor.setAttributeValue(newStudyFileName, "AttributeComment", initialMeshFile)
+
+    if initialMeshObject!=None:
+      newLink=monStudyBuilder.NewObject(SOMesh)
+      monStudyBuilder.Addreference(newLink, initialMeshObject)
+
+    newLink=monStudyBuilder.NewObject(SOMesh)
+    monStudyBuilder.Addreference(newLink, newStudyIter)
+
+    if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
+    self.num+=1
+    return True
+
+  def PBSavePressed(self):
+    from datetime import datetime
+    if not(self.PrepareLigneCommande()): return
+    text = "# MGCleaner hypothesis parameters\n"
+    text += "# Params for mesh : " +  self.LE_MeshSmesh.text() +"\n"
+    text += datetime.now().strftime("# Date : %d/%m/%y %H:%M:%S\n")
+    text += "# Command : "+self.commande+"\n"
+    text += self.getResumeData(separator="\n")
+    text += "\n\n"
+
+    try:
+      f=open(self.paramsFile,"a")
+    except:
+      QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
+      return
+    try:
+      f.write(text)
+    except:
+      QMessageBox.warning(self, "File", "Unable to write "+self.paramsFile)
+      return
+    f.close()
+
+  def PBSaveHypPressed(self):
+    """save hypothesis in Object Browser"""
+    import salome
+    import SMESH
+    from salome.kernel import studyedit
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+
+    maStudy=studyedit.getActiveStudy()
+    smesh.SetCurrentStudy(maStudy)
+    
+    self.editor = studyedit.getStudyEditor()
+    moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
+    HypReMeshEntry = self.editor.findOrCreateItem(
+        moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
+    
+    monStudyBuilder=maStudy.NewBuilder()
+    monStudyBuilder.NewCommand()
+    newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
+    self.editor.setAttributeValue(newStudyIter, "AttributeName", "MGCleaner Parameters_"+str(self.num))
+    self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
+    
+    if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
+    self.num+=1
+    return True
+
+    """
+    import salome_pluginsmanager
+    print "salome_pluginsmanager.plugins",salome_pluginsmanager.plugins
+    print "salome_pluginsmanager.current_plugins_manager",salome_pluginsmanager.current_plugins_manager
+    """
+  
+  def SP_toStr(self, widget):
+    """only for a QLineEdit widget"""
+    #cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
+    try:
+      val=float(widget.text())
+    except:
+      QMessageBox.warning(self, widget.titleForWarning, "float value is incorrect: '"+widget.text()+"'")
+      res=str(widget.validator().bottom())
+      widget.setProperty("text", res)
+      return res
+    valtest=widget.validator().bottom()
+    if valtest!=None:
+      if val<valtest:
+        QMessageBox.warning(self, widget.titleForWarning, "float value is under minimum: "+str(val)+" < "+str(valtest))
+        res=str(valtest)
+        widget.setProperty("text", res)
+        return res
+    valtest=widget.validator().top()
+    if valtest!=None:
+      if val>valtest:
+        QMessageBox.warning(self, widget.titleForWarning, "float value is over maximum: "+str(val)+" > "+str(valtest))
+        res=str(valtest)
+        widget.setProperty("text", res)
+        return res    
+    return str(val)
+
+  def getResumeData(self, separator="\n"):
+    text=""
+    if self.RB_Fix1.isChecked():
+      CheckOrFix="fix1pass"
+    else:
+      if self.RB_Fix2.isChecked():
+        CheckOrFix="fix2pass"
+      else:
+        CheckOrFix="check"
+    text+="CheckOrFix="+CheckOrFix+separator
+    text+="PreserveTopology="+str(self.CB_PreserveTopology.isChecked())+separator
+    text+="FillHoles="+str(self.CB_FillHoles.isChecked())+separator
+    v=self.SP_toStr(self.SP_MinHoleSize)
+    text+="MinHoleSize="+v+separator
+    text+="ComputedToleranceDisplacement="+str(self.CB_ComputedToleranceDisplacement.isChecked())+separator
+    v=self.SP_toStr(self.SP_ToleranceDisplacement)
+    text+="ToleranceDisplacement="+v+separator
+    text+="ComputedResolutionLength="+str(self.CB_ComputedResolutionLength.isChecked())+separator
+    v=self.SP_toStr(self.SP_ResolutionLength)
+    text+="ResolutionLength="+v+separator
+    text+="FoldingAngle="+str(self.SP_FoldingAngle.value())+separator
+    text+="RemeshPlanes="+str(self.CB_RemeshPlanes.isChecked())+separator
+    text+="ComputedOverlapDistance="+str(self.CB_ComputedOverlapDistance.isChecked())+separator
+    v=self.SP_toStr(self.SP_OverlapDistance)
+    text+="OverlapDistance="+v+separator
+    text+="OverlapAngle="+str(self.SP_OverlapAngle.value())+separator
+    text+="Verbosity="+str(self.SP_Verbosity.value())+separator
+    return str(text)
+
+  def loadResumeData(self, hypothesis, separator="\n"):
+    text=str(hypothesis)
+    self.clean()
+    for slig in reversed(text.split(separator)):
+      lig=slig.strip()
+      #print "load ResumeData",lig
+      if lig=="": continue #skip blanck lines
+      if lig[0]=="#": break
+      try:
+        tit,value=lig.split("=")
+        if tit=="CheckOrFix":
+          self.RB_Fix1.setChecked(False)
+          self.RB_Fix2.setChecked(False)
+          self.RB_Check.setChecked(False)
+          if value=="fix1pass": self.RB_Fix1.setChecked(True)
+          if value=="fix2pass": self.RB_Fix2.setChecked(True)
+          if value=="check": self.RB_Check.setChecked(True)
+        if tit=="PreserveTopology": self.CB_PreserveTopology.setChecked(value=="True")
+        if tit=="FillHoles": self.CB_FillHoles.setChecked(value=="True")
+        if tit=="MinHoleSize": self.SP_MinHoleSize.setProperty("text", value)
+        if tit=="ComputedToleranceDisplacement": self.CB_ComputedToleranceDisplacement.setChecked(value=="True")
+        if tit=="ToleranceDisplacement": self.SP_ToleranceDisplacement.setProperty("text", value)
+        if tit=="ComputedResolutionLength": self.CB_ComputedResolutionLength.setChecked(value=="True")
+        if tit=="ResolutionLength": self.SP_ResolutionLength.setProperty("text", value)
+        if tit=="FoldingAngle": self.SP_FoldingAngle.setProperty("value", float(value))
+        if tit=="RemeshPlanes": self.CB_RemeshPlanes.setChecked(value=="True")
+        if tit=="ComputedOverlapDistance": self.CB_ComputedOverlapDistance.setChecked(value=="True")
+        if tit=="OverlapDistance": self.SP_OverlapDistance.setProperty("text", value)
+        if tit=="OverlapAngle": self.SP_OverlapAngle.setProperty("value", float(value))
+        if tit=="Verbosity": self.SP_Verbosity.setProperty("value", int(float(value)))
+      except:
+        QMessageBox.warning(self, "load MGCleaner Hypothesis", "Problem on '"+lig+"'")
+
+  def PBLoadPressed(self):
+    """load last hypothesis saved in tail of file"""
+    try:
+      f=open(self.paramsFile,"r")
+    except:
+      QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
+      return
+    try:
+      text=f.read()
+    except:
+      QMessageBox.warning(self, "File", "Unable to read "+self.paramsFile)
+      return
+    f.close()
+    self.loadResumeData(text, separator="\n")
+
+  def PBLoadHypPressed(self):
+    """load hypothesis saved in Object Browser"""
+    #QMessageBox.warning(self, "load Object Browser MGCleaner hypothesis", "TODO")
+    import salome
+    from salome.kernel import studyedit
+    from salome.smesh.smeshstudytools import SMeshStudyTools
+    from salome.gui import helper as guihelper
+    from omniORB import CORBA
+
+    mySObject, myEntry = guihelper.getSObjectSelected()
+    if CORBA.is_nil(mySObject) or mySObject==None:
+      QMessageBox.critical(self, "Hypothese", "select an Object Browser MGCleaner hypothesis")
+      return
+    
+    #for i in dir(mySObject): print "dir mySObject",i
+    #print "GetAllAttributes",mySObject.GetAllAttributes()
+    #print "GetComment",mySObject.GetComment()
+    #print "GetName",mySObject.GetName()
+    
+    #could be renamed...
+    #if mySObject.GetFather().GetName()!="MGCleaner Hypotheses":
+    #  QMessageBox.critical(self, "Hypothese", "not a child of MGCleaner Hypotheses")
+    #  return
+    
+    text=mySObject.GetComment()
+    
+    #a verification
+    if "CheckOrFix=" not in text:
+      QMessageBox.critical(self, "Load Hypothese", "Object Browser selection not a MGCleaner Hypothesis")
+      return
+    self.loadResumeData(text, separator=" ; ")
+    return
+    
+  def PBCancelPressed(self):
+    self.close()
+
+  def PBMeshFilePressed(self):
+    fd = QFileDialog(self, "select an existing Mesh file", self.LE_MeshFile.text(), "Mesh-Files (*.mesh);;All Files (*)")
+    if fd.exec_():
+      infile = fd.selectedFiles()[0]
+      self.LE_MeshFile.setText(infile)
+      self.fichierIn=infile.toLatin1()
+      self.MeshIn=""
+      self.LE_MeshSmesh.setText("")
+
+  def setParamsFileName(self):
+    fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
+    if fd.exec_():
+      infile = fd.selectedFiles()[0]
+      self.LE_ParamsFile.setText(infile)
+      self.paramsFile=infile.toLatin1()
+
+  def meshFileNameChanged(self):
+    self.fichierIn=str(self.LE_MeshFile.text())
+    #print "meshFileNameChanged", self.fichierIn
+    if os.path.exists(self.fichierIn): 
+      self.__selectedMesh=None
+      self.MeshIn=""
+      self.LE_MeshSmesh.setText("")
+      return
+    QMessageBox.warning(self, "Mesh file", "File doesn't exist")
+
+  def meshSmeshNameChanged(self):
+    """only change by GUI mouse selection, otherwise clear"""
+    #self.MeshIn=str(self.LE_MeshSmesh.text())
+    #print "meshSmeshNameChanged", self.MeshIn
+    self.__selectedMesh = None
+    self.MeshIn=""
+    self.LE_MeshSmesh.setText("")
+    self.fichierIn=""
+    return
+
+  def paramsFileNameChanged(self):
+    self.paramsFile=self.LE_ParamsFile.text()
+
+  def PBMeshSmeshPressed(self):
+    from omniORB import CORBA
+    import salome
+    from salome.kernel import studyedit
+    from salome.smesh.smeshstudytools import SMeshStudyTools
+    from salome.gui import helper as guihelper
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+
+    mySObject, myEntry = guihelper.getSObjectSelected()
+    if CORBA.is_nil(mySObject) or mySObject==None:
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    self.smeshStudyTool = SMeshStudyTools()
+    try:
+      self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
+    except:
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    if CORBA.is_nil(self.__selectedMesh):
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    myName = mySObject.GetName()
+    #print "MeshSmeshNameChanged", myName
+    self.MeshIn=myName
+    self.LE_MeshSmesh.setText(myName)
+    self.LE_MeshFile.setText("")
+    self.fichierIn=""
+
+  def prepareFichier(self):
+    self.fichierIn="/tmp/ForMGCleaner_"+str(self.num)+".mesh"
+    self.__selectedMesh.ExportGMF(self.__selectedMesh, self.fichierIn, True)
+
+  def PrepareLigneCommande(self):
+    """
+    #use doc examples of mg-cleaner:
+    ls -al /data/tmplgls/salome/prerequis/install/COMMON_64/MeshGems-1.0/bin
+    source /data/tmplgls/salome/prerequis/install/LICENSE/dlim8.var.sh
+    export PATH=/data/tmplgls/salome/prerequis/install/COMMON_64/MeshGems-1.0/bin/Linux_64:$PATH
+    cp -r /data/tmplgls/salome/prerequis/install/COMMON_64/MeshGems-1.0/examples .
+    cd examples
+    mg-cleaner.exe --help
+    mg-cleaner.exe --in case7.mesh --out case7-test.mesh --check
+    mg-cleaner.exe case7.mesh case7-fix.mesh --fix
+    mg-cleaner.exe --in Porsche.mesh --out Porsche-test.mesh --check
+    mg-cleaner.exe --in Porsche.mesh --out Porschefix.mesh --fix
+    mg-cleaner.exe --in Porsche.mesh --out PorscheNewfix.mesh --fix --resolution_length 0.03
+    """
+    
+    #self.commande="mg-cleaner.exe --in " + self.fichierIn + " --out " + self.fichierOut + " --fix2pass" 
+    #return True
+    #print "PrepareLigneCommande '"+self.fichierIn+"' '"+self.MeshIn+"'",self.__selectedMesh
+    if self.fichierIn=="" and self.MeshIn=="":
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return False
+    if self.__selectedMesh!=None: self.prepareFichier()
+    if not (os.path.isfile(self.fichierIn)):
+      QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
+      return False
+    
+    self.commande="mg-cleaner.exe"
+    verbosity=str(self.SP_Verbosity.value())
+    self.commande+=" --verbose " + verbosity
+    self.commande+=" --in " + self.fichierIn
+    #print "self.fichierIn",self.fichierIn,type(self.fichierIn)
+    deb=os.path.splitext(str(self.fichierIn))
+    self.fichierOut=deb[0] + "_fix.mesh"
+    self.commande+=" --out "+self.fichierOut
+    if self.RB_Fix1.isChecked():
+      self.commande+=" --fix1pass"
+    else:
+      if self.RB_Fix2.isChecked():
+        self.commande+=" --fix2pass"
+      else:
+        self.commande+=" --check"
+    if self.CB_PreserveTopology.isChecked():
+      self.commande+=" --topology respect"
+    else:
+      self.commande+=" --topology ignore"
+    if self.CB_FillHoles.isChecked(): #no fill holes default
+      self.commande+=" --min_hole_size " + self.SP_toStr(self.SP_MinHoleSize)
+    if not self.CB_ComputedToleranceDisplacement.isChecked(): #computed default
+      self.commande+=" --tolerance_displacement " + self.SP_toStr(self.SP_ToleranceDisplacement)
+    if not self.CB_ComputedResolutionLength.isChecked(): #computed default
+      self.commande+=" --resolution_length " + self.SP_toStr(self.SP_ResolutionLength)
+    self.commande+=" --folding_angle " + str(self.SP_FoldingAngle.value())
+    if self.CB_RemeshPlanes.isChecked(): #no remesh default
+      self.commande+=" --remesh_planes"
+    if not self.CB_ComputedOverlapDistance.isChecked(): #computed default
+      self.commande+=" --overlap_distance " + self.SP_toStr(self.SP_OverlapDistance)
+    self.commande+=" --overlap_angle " + str(self.SP_OverlapAngle.value())
+    return True
+
+  def clean(self):
+    self.RB_Check.setChecked(False)
+    self.RB_Fix1.setChecked(False)
+    self.RB_Fix2.setChecked(True)
+    self.CB_PreserveTopology.setChecked(False)
+    self.CB_FillHoles.setChecked(False)
+    self.CB_RemeshPlanes.setChecked(False)
+    
+    self.SP_MinHoleSize.setProperty("text", 0)
+    self.SP_ToleranceDisplacement.setProperty("text", 0)
+    self.SP_ResolutionLength.setProperty("text", 0)
+    self.SP_FoldingAngle.setProperty("value", 15)
+    self.SP_OverlapDistance.setProperty("text", 0)
+    self.SP_OverlapAngle.setProperty("value", 15)
+    self.SP_Verbosity.setProperty("value", 3)
+    
+    self.CB_ComputedToleranceDisplacement.setChecked(True)
+    self.CB_ComputedResolutionLength.setChecked(True)
+    self.CB_ComputedOverlapDistance.setChecked(True)
+
+__dialog=None
+def getDialog():
+  """
+  This function returns a singleton instance of the plugin dialog.
+  c est obligatoire pour faire un show sans parent...
+  """
+  global __dialog
+  if __dialog is None:
+    __dialog = MGCleanerMonPlugDialog()
+  #else :
+  #   __dialog.clean()
+  return __dialog
+
+
+#
+# ==============================================================================
+# For memory
+# ==============================================================================
+#
+def TEST_standalone():
+  """
+  works only if a salome is launched yet with a study loaded
+  to launch standalone python do:
+  ./APPLI/runSession
+  python
+  or (do not works)
+  python ./INSTALL/SMESH/share/salome/plugins/smesh/MGCleanerMonPlugDialog.py
+  """
+  import salome
+  import SMESH
+  from salome.kernel import studyedit
+  salome.salome_init()
+  maStudy=studyedit.getActiveStudy()
+  #etc...a mano...
+
+#
+# ==============================================================================
+# Basic use cases and unit test functions
+# ==============================================================================
+#
+def TEST_MGCleanerMonPlugDialog():
+  import sys
+  from PyQt4.QtGui import QApplication
+  from PyQt4.QtCore import QObject, SIGNAL, SLOT
+  app = QApplication(sys.argv)
+  QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+
+  dlg=MGCleanerMonPlugDialog()
+  dlg.show()
+  sys.exit(app.exec_())
+
+if __name__ == "__main__":
+  TEST_MGCleanerMonPlugDialog()
+  #TEST_standalone()
+  pass
diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py
new file mode 100644 (file)
index 0000000..698bb7a
--- /dev/null
@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013  EDF R&D
+#
+# 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
+#
+
+# Modules Python
+import string,types,os
+import traceback
+
+from PyQt4 import *
+from PyQt4.QtGui import *
+from PyQt4.QtCore import *
+
+# Import des panels
+
+from MGCleanerViewText import Ui_ViewExe
+
+class MGCleanerMonViewText(Ui_ViewExe, QDialog):
+    """
+    Classe permettant la visualisation de texte
+    """
+    def __init__(self, parent, txt, ):
+        QDialog.__init__(self,parent)
+        self.setupUi(self)
+        self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
+        #self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") )
+        self.connect( self.PB_Ok,SIGNAL("clicked()"), self.theClose )
+        self.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile )
+        self.PB_Save.setToolTip("Save trace in log file")
+        self.PB_Ok.setToolTip("Close view")
+        self.monExe=QProcess(self)
+
+        self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
+        self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
+      
+        # Je n arrive pas a utiliser le setEnvironment du QProcess
+        # fonctionne hors Salome mais pas dans Salome ???
+        cmds=''
+        try :
+          LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_MGCLEANER"]
+        except:
+          LICENCE_FILE=''
+        try :
+          PATH=os.environ["DISTENE_PATH_FOR_MGCLEANER"]
+        except:
+          PATH=''
+        if LICENCE_FILE != '': 
+          cmds+='source '+LICENCE_FILE+'\n'
+        else:
+          cmds+="# $DISTENE_LICENCE_FILE_FOR_MGCLEANER NOT SET\n"
+        if PATH != '': 
+          cmds+='export PATH='+PATH+':$PATH\n'
+        else:
+          cmds+="# $DISTENE_PATH_FOR_MGCLEANER NOT SET\n"
+        #cmds+='env\n'
+        cmds+='rm -f '+self.parent().fichierOut+'\n'
+        cmds+=txt+'\n'
+        cmds+='echo END_OF_MGCleaner\n'
+        pid=self.monExe.pid()
+        nomFichier='/tmp/MGCleaner_'+str(pid)+'.sh'
+        f=open(nomFichier,'w')
+        f.write(cmds)
+        f.close()
+
+        maBidouille='sh ' + nomFichier
+        self.monExe.start(maBidouille)
+        self.monExe.closeWriteChannel()
+        self.enregistreResultatsDone=False
+        self.show()
+
+    def saveFile(self):
+        #recuperation du nom du fichier
+        savedir=os.environ['HOME']
+        fn = QFileDialog.getSaveFileName(None, self.trUtf8("Save File"),savedir)
+        if fn.isNull() : return
+        ulfile = os.path.abspath(unicode(fn))
+        try:
+           f = open(fn, 'wb')
+           f.write(str(self.TB_Exe.toPlainText()))
+           f.close()
+        except IOError, why:
+           QMessageBox.critical(self, self.trUtf8('Save File'),
+                self.trUtf8('The file <b>%1</b> could not be saved.<br>Reason: %2')
+                    .arg(unicode(fn)).arg(str(why)))
+
+    def readFromStdErr(self):
+        a=self.monExe.readAllStandardError()
+        self.TB_Exe.append(QString.fromUtf8(a.data(),len(a)))
+
+    def readFromStdOut(self) :
+        a=self.monExe.readAllStandardOutput()
+        aa=QString.fromUtf8(a.data(),len(a))
+        self.TB_Exe.append(aa)
+        if "END_OF_MGCleaner" in aa:
+          self.parent().enregistreResultat()
+          self.enregistreResultatsDone=True
+          #self.theClose()
+    
+    def theClose(self):
+      if not self.enregistreResultatsDone:
+        self.parent().enregistreResultat()
+        self.enregistreResultatsDone=True
+      self.close()
diff --git a/src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui b/src/Tools/MGCleanerPlug/MGCleanerPlugDialog.ui
new file mode 100644 (file)
index 0000000..5e3ddbf
--- /dev/null
@@ -0,0 +1,839 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MGCleanerPlugDialog</class>
+ <widget class="QWidget" name="MGCleanerPlugDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>500</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MGCleaner : Remeshing tool</string>
+  </property>
+  <property name="sizeGripEnabled" stdset="0">
+   <bool>false</bool>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="2" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+      <spacer name="horizontalSpacer_xx">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>10</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+         </item>
+     <item>
+      <widget class="QPushButton" name="PB_OK">
+       <property name="text">
+        <string>Compute</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="PB_Cancel">
+       <property name="text">
+        <string>Close</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_4">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>30</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="PB_SaveHyp">
+       <property name="text">
+        <string>Save</string>
+       </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="PB_LoadHyp">
+       <property name="text">
+        <string>Load</string>
+       </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="PB_Default">
+       <property name="text">
+        <string>Default</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>30</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="PB_Help">
+       <property name="font">
+        <font>
+         <pointsize>10</pointsize>
+        </font>
+       </property>
+       <property name="text">
+        <string>Help</string>
+       </property>
+      </widget>
+     </item>
+         <item>
+      <spacer name="horizontalSpacer_xx">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>10</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+         </item>
+    </layout>
+   </item>
+   <item row="1" column="0">
+    <widget class="QTabWidget" name="TWOptions">
+     <property name="font">
+      <font>
+       <pointsize>10</pointsize>
+      </font>
+     </property>
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="simple">
+      <attribute name="title">
+       <string>Simple Remeshing Options</string>
+      </attribute>
+      <widget class="QGroupBox" name="GBOptim">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>140</y>
+         <width>750</width>
+         <height>270</height>
+        </rect>
+       </property>
+       <property name="title">
+        <string>Options</string>
+       </property>
+
+        <layout class="QHBoxLayout" name="RBLayoutopt">
+
+         <item>
+      <spacer name="horizontalSpacer_xx">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>30</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+         </item>
+
+         <item>
+        <layout class="QVBoxLayout" name="RBLayout1">
+         <item>
+          <widget class="QRadioButton" name="RB_Check">
+           <property name="toolTip">
+            <string>Performs checks only (no fixing).
+Writes diagnostics into the output file.
+Default is to fix with two passes.</string>
+           </property>
+           <property name="text">
+            <string>Only checking</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_Fix1">
+           <property name="toolTip">
+            <string>Analyses and fixes mesh with only the first stage of the cleaning procedure.
+Does not write diagnostics into the output file.
+Default is to fix with two passes.</string>
+           </property>
+           <property name="text">
+            <string>Fix problems with one pass</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_Fix2">
+           <property name="toolTip">
+            <string>Analyses and fixes mesh with the two stage cleaning procedure.
+Does not write diagnostics into the output file.
+Default is to fix with two passes.</string>
+           </property>
+           <property name="text">
+            <string>Fix problems with two passes</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+
+       <item>
+       <widget class="QCheckBox" name="CB_PreserveTopology">
+           <property name="toolTip">
+            <string>Disables fixing operations which induce topology modifications.
+Default is enable topology modifications.
+(argument --topology)</string>
+           </property>
+           <property name="text">
+            <string>Preserve topology</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+        </item>
+       <item>
+          <widget class="QCheckBox" name="CB_FillHoles">
+           <property name="toolTip">
+            <string>Default is not to fill holes.
+if set: see 'surface size threshold of holes' in 'Advanced remeshing options'.</string>
+           </property>
+           <property name="text">
+            <string>Fill holes</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+       </item>
+       <item>
+
+          <widget class="QCheckBox" name="CB_RemeshPlanes">
+           <property name="toolTip">
+            <string>Inserts vertices on planes to improve mesh quality .
+May be useful for poor quality triangulations (eg .STL or .DXF triangulations).
+Default is not to mesh planes.</string>
+           </property>
+           <property name="text">
+            <string>Remesh planes</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+           </widget>
+       </item>
+
+         </layout>
+
+         </item>
+
+        </layout>
+        
+      </widget>
+      <widget class="QGroupBox" name="groupBox">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>10</y>
+         <width>750</width>
+         <height>120</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>10</pointsize>
+        </font>
+       </property>
+       <property name="title">
+        <string>Original Mesh</string>
+       </property>
+       <widget class="QPushButton" name="PB_MeshFile">
+        <property name="geometry">
+         <rect>
+          <x>40</x>
+          <y>70</y>
+          <width>190</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>10</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>Mesh File GMF format</string>
+        </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+       </widget>
+       <widget class="QLineEdit" name="LE_MeshFile">
+        <property name="geometry">
+         <rect>
+          <x>240</x>
+          <y>70</y>
+          <width>481</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>10</pointsize>
+         </font>
+        </property>
+       </widget>
+       <widget class="QPushButton" name="PB_MeshSmesh">
+        <property name="geometry">
+         <rect>
+          <x>40</x>
+          <y>30</y>
+          <width>190</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>Mesh Object Browser</string>
+        </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+        <property name="checkable">
+         <bool>false</bool>
+        </property>
+       </widget>
+       <widget class="QLineEdit" name="LE_MeshSmesh">
+        <property name="geometry">
+         <rect>
+          <x>240</x>
+          <y>30</y>
+          <width>481</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>10</pointsize>
+         </font>
+        </property>
+       </widget>
+       <widget class="QLabel" name="label_8">
+        <property name="geometry">
+         <rect>
+          <x>10</x>
+          <y>80</y>
+          <width>31</width>
+          <height>18</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>or</string>
+        </property>
+       </widget>
+      </widget>
+      <zorder>groupBox</zorder>
+      <zorder>GBOptim</zorder>
+     </widget>
+     <widget class="QWidget" name="advanced">
+      <attribute name="title">
+       <string>Advanced Remeshing Options</string>
+      </attribute>
+      <widget class="QGroupBox" name="groupBox_5">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>10</y>
+         <width>750</width>
+         <height>400</height>
+        </rect>
+       </property>
+       <property name="title">
+        <string>You can control</string>
+       </property>
+#1
+       <widget class="QLineEdit" name="SP_MinHoleSize">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>30</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+       </widget>
+       <widget class="QLabel" name="LA_minHoleSize">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>30</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>sets the surface size threshold below which holes are filled.
+Set 'Fill holes' in 'Simple Remeshing Options'.</string>
+        </property>
+        <property name="text">
+         <string>Surface size threshold of holes to fill (--min_hole_size)</string>
+        </property>
+       </widget>
+#2
+       <widget class="QLineEdit" name="SP_ToleranceDisplacement">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>70</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+       </widget>
+       <widget class="QLabel" name="LA_toleranceDisplacement">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>70</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>Sets the displacement threshold below which modification is allowed.
+Unused in collision resolution .
+'Tolerance displacement' is set to resolution_length if it is lower.</string>
+        </property>
+        <property name="text">
+         <string>Tolerance displacement threshold of points for modification
+(--tolerance_displacement)</string>
+        </property>
+       </widget>
+
+          <widget class="QCheckBox" name="CB_ComputedToleranceDisplacement">
+        <property name="geometry">
+         <rect>
+          <x>650</x>
+          <y>70</y>
+          <width>100</width>
+          <height>30</height>
+         </rect>
+        </property>
+           <property name="toolTip">
+            <string>If set default value is computed from model.</string>
+           </property>
+           <property name="text">
+            <string>Computed</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+
+#3
+       <widget class="QLineEdit" name="SP_ResolutionLength">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>110</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+       </widget>
+       <widget class="QLabel" name="LA_resolutionLength">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>110</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>sets the distance threshold above which 2 points are considered distinct.
+Sets the tolerance displacement to 1/5 of this size.
+Default is computed from model.</string>
+        </property>
+        <property name="text">
+         <string>Distance threshold for two points distinct (--resolution_length)</string>
+        </property>
+       </widget>
+          <widget class="QCheckBox" name="CB_ComputedResolutionLength">
+        <property name="geometry">
+         <rect>
+          <x>650</x>
+          <y>110</y>
+          <width>100</width>
+          <height>30</height>
+         </rect>
+        </property>
+           <property name="toolTip">
+            <string>If set default value is computed from model.</string>
+           </property>
+           <property name="text">
+            <string>Computed</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+#4
+       <widget class="QDoubleSpinBox" name="SP_FoldingAngle">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>150</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+        <property name="maximum">
+         <double>90</double>
+        </property>
+        <property name="minimum">
+         <double>0</double>
+        </property>
+        <property name="singleStep">
+         <double>1</double>
+        </property>
+        <property name="value">
+         <double>15</double>
+        </property>
+       </widget>
+       <widget class="QLabel" name="LA_foldingAngle">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>150</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>Sets the threshold angle below which 2 connected triangles are considered overlapping .
+Reduce this value if model contains sharp angles below this threshold that must be kept.
+Overlap_angle is set to this angle if it is higher.
+Default is 15 degrees.</string>
+        </property>
+        <property name="text">
+         <string>Angle threshold for two connected triangles overlapping (--folding_angle)</string>
+        </property>
+       </widget>
+#5
+       <widget class="QLineEdit" name="SP_OverlapDistance">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>190</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
+       </widget>
+       <widget class="QLabel" name="LA_overlapDistance">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>190</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>sets the distance below which 2 unconnected triangles are considered overlapping.
+Reduce this value if too many overlaps are detected.
+Default is computed from model.</string>
+        </property>
+        <property name="text">
+         <string>Distance threshold for two unconnected triangles overlapping
+(--overlap_distance)</string>
+        </property>
+       </widget>
+          <widget class="QCheckBox" name="CB_ComputedOverlapDistance">
+        <property name="geometry">
+         <rect>
+          <x>650</x>
+          <y>190</y>
+          <width>100</width>
+          <height>30</height>
+         </rect>
+        </property>
+           <property name="toolTip">
+            <string>If set default value is computed from model.</string>
+           </property>
+           <property name="text">
+            <string>Computed</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+#6
+       <widget class="QDoubleSpinBox" name="SP_OverlapAngle">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>230</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+        <property name="maximum">
+         <double>90</double>
+        </property>
+        <property name="minimum">
+         <double>0</double>
+        </property>
+        <property name="singleStep">
+         <double>1</double>
+        </property>
+        <property name="value">
+         <double>15</double>
+        </property>
+       </widget>
+       <widget class="QLabel" name="LA_overlapAngle">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>230</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>Sets the angle below which 2 unconnected triangles are considered overlapping.
+'Folding angle' is set to this angle if it is lower.
+Default is 15 degrees.</string>
+        </property>
+        <property name="text">
+         <string>Angle threshold for two unconnected triangles overlapping (--overlap_angle)</string>
+        </property>
+       </widget>
+      </widget>
+     </widget>
+     <widget class="QWidget" name="generic">
+      <attribute name="title">
+       <string>Generic Options</string>
+      </attribute>
+      <widget class="QGroupBox" name="groupBox_4">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>10</y>
+         <width>750</width>
+         <height>130</height>
+        </rect>
+       </property>
+       <property name="title">
+        <string>MGCleaner Generic Options</string>
+       </property>
+       
+          <widget class="QSpinBox" name="SP_Verbosity">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>30</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+           <property name="maximum">
+            <number>10</number>
+           </property>
+           <property name="value">
+            <number>3</number>
+           </property>
+          </widget>
+       
+          <widget class="QLabel" name="label">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>30</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>sets the verbosity level.
+From 0 (no detail) to 10 (very detailed).
+Default is 3.</string>
+        </property>
+           <property name="text">
+            <string>Verbosity level</string>
+           </property>
+          </widget>
+       
+       
+      </widget>
+      <widget class="QGroupBox" name="groupBox_6">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>150</y>
+         <width>750</width>
+         <height>170</height>
+        </rect>
+       </property>
+       <property name="title">
+        <string>Plug-in Generic Options</string>
+       </property>
+       <widget class="QLabel" name="label_10">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>40</y>
+          <width>391</width>
+          <height>18</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>File used to save MGCleaner hypothesis parameters :</string>
+        </property>
+       </widget>
+       <widget class="QPushButton" name="PB_ParamsFileExplorer">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>70</y>
+          <width>30</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+       <widget class="QLineEdit" name="LE_ParamsFile">
+        <property name="geometry">
+         <rect>
+          <x>60</x>
+          <y>70</y>
+          <width>661</width>
+          <height>31</height>
+         </rect>
+        </property>
+       </widget>
+
+      <widget class="QPushButton" name="PB_Save">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>110</y>
+          <width>70</width>
+          <height>31</height>
+         </rect>
+        </property>
+       <property name="text">
+        <string>Save</string>
+       </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+      </widget>
+
+      <widget class="QPushButton" name="PB_Load">
+        <property name="geometry">
+         <rect>
+          <x>120</x>
+          <y>110</y>
+          <width>70</width>
+          <height>31</height>
+         </rect>
+        </property>
+       <property name="text">
+        <string>Load</string>
+       </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+      </widget>
+
+      </widget>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/Tools/MGCleanerPlug/MGCleanerViewText.ui b/src/Tools/MGCleanerPlug/MGCleanerViewText.ui
new file mode 100644 (file)
index 0000000..8bec19a
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewExe</class>
+ <widget class="QDialog" name="ViewExe">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>469</width>
+    <height>489</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Run MGCleaner</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="2">
+    <widget class="QTextBrowser" name="TB_Exe"/>
+   </item>
+   <item row="1" column="0">
+    <widget class="QPushButton" name="PB_Ok">
+     <property name="text">
+      <string>Ok</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QPushButton" name="PB_Save">
+     <property name="text">
+      <string>Save</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py b/src/Tools/MGCleanerPlug/MGCleanerplug_plugin.py
new file mode 100644 (file)
index 0000000..80eeae7
--- /dev/null
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2006-2013  EDF R&D
+#
+# 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
+#
+
+# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
+# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
+
+def MGCleanerLct(context):
+  # get context study, studyId, salomeGui
+  study = context.study
+  studyId = context.studyId
+  sg = context.sg
+  
+  import os
+  import subprocess
+  import tempfile
+  from PyQt4 import QtCore
+  from PyQt4 import QtGui
+  from PyQt4.QtGui import QFileDialog
+  from PyQt4.QtGui import QMessageBox
+  
+  #prior test to avoid unnecessary user GUI work with ending crash
+  try :
+      os.environ['DISTENE_LICENCE_FILE_FOR_MGCLEANER']
+  except:
+      QMessageBox.warning(None,"Products","Distene's product MeshGem Cleaner is not installed.\nrequired environment variable:\nDISTENE_LICENCE_FILE_FOR_MGCLEANER='/.../dlim8.var.sh'")
+      return
+  import MGCleanerMonPlugDialog
+  window=MGCleanerMonPlugDialog.getDialog()
+  window.show()
+
diff --git a/src/Tools/MGCleanerPlug/Makefile.am b/src/Tools/MGCleanerPlug/Makefile.am
new file mode 100644 (file)
index 0000000..efbc785
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright (C) 2007-2013  EDF R&D
+#
+# 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
+#
+
+SUBDIRS = doc
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+UIPY_FILES = MGCleanerPlugDialog.py  MGCleanerViewText.py 
+
+salomeplugins_PYTHON = \
+       MGCleanerMonPlugDialog.py\
+       MGCleanerMonViewText.py\
+       MGCleanerplug_plugin.py 
+
+nodist_salomeplugins_PYTHON = $(UIPY_FILES)
+
+CLEANFILES = $(UIPY_FILES)
+
+EXTRA_DIST += $(UIPY_FILES:%.py=%.ui)
+
+%.py : %.ui
+       $(PYUIC) $< -o $@
diff --git a/src/Tools/MGCleanerPlug/Tolerance.png b/src/Tools/MGCleanerPlug/Tolerance.png
new file mode 100644 (file)
index 0000000..d8fb162
Binary files /dev/null and b/src/Tools/MGCleanerPlug/Tolerance.png differ
diff --git a/src/Tools/MGCleanerPlug/doc/Advanced_params.rst b/src/Tools/MGCleanerPlug/doc/Advanced_params.rst
new file mode 100644 (file)
index 0000000..34178cf
--- /dev/null
@@ -0,0 +1,11 @@
+Advanced Remeshing Options 
+==========================
+
+See tooltips comments for each parameter.
+See also :download:`MG-cleaner user manual <files/mg-cleaner_user_manual.pdf>`.
+
+.. image:: images/Advanced.png
+   :align: center
+
+
+
diff --git a/src/Tools/MGCleanerPlug/doc/Generics_params.rst b/src/Tools/MGCleanerPlug/doc/Generics_params.rst
new file mode 100644 (file)
index 0000000..4513341
--- /dev/null
@@ -0,0 +1,18 @@
+Generic  Options
+=================
+
+These options are not meshing options but allow the user to configure control parameters for MG-Cleaner.
+
+
+- **Verbosity Level**
+
+This parameter (between 0 and 10) indicates the amount of information that MG-Cleaner prints during the run.
+    
+    
+- **File** 
+
+You can change the file used to store your favorite remeshing hypothesis. see paragraph :ref:`hypothesis-label` for further informations.
+
+.. image:: images/Generic.png
+   :align: center
+
diff --git a/src/Tools/MGCleanerPlug/doc/Makefile.am b/src/Tools/MGCleanerPlug/doc/Makefile.am
new file mode 100644 (file)
index 0000000..d122e79
--- /dev/null
@@ -0,0 +1,70 @@
+# Makefile for Sphinx documentation
+#
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+MGCleanerdocdir=$(docdir)/gui/SMESH/MGCleaner
+
+RSTFILES = lct.rst \
+          index.rst \
+          editHypo.rst \
+          Mandatory_params.rst \
+          Generics_params.rst \
+          Advanced_params.rst
+
+EXTRA_DIST += $(RSTFILES) images files
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SOURCEDIR     = $(srcdir)
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+CONF_FILE_DIR = $(top_builddir)/src/Tools/MGCleanerPlug/doc
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees -c $(CONF_FILE_DIR) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
+
+.PHONY: help clean html latexpdf 
+
+help:
+       @echo "Please use \`make <target>' where <target> is one of"
+       @echo "  html       to make standalone HTML files"
+       @echo "  dirhtml    to make HTML files named index.html in directories"
+       @echo "  singlehtml to make a single large HTML file"
+       @echo "  pickle     to make pickle files"
+       @echo "  json       to make JSON files"
+       @echo "  htmlhelp   to make HTML files and a HTML help project"
+       @echo "  qthelp     to make HTML files and a qthelp project"
+       @echo "  devhelp    to make HTML files and a Devhelp project"
+       @echo "  epub       to make an epub"
+       @echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+       @echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+       @echo "  text       to make text files"
+       @echo "  man        to make manual pages"
+       @echo "  changes    to make an overview of all changed/added/deprecated items"
+       @echo "  linkcheck  to check all external links for integrity"
+       @echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+install-data-local: $(BUILDDIR)/html/index.html
+       -test -z $(MGCleanerdocdir) || mkdir -p $(MGCleanerdocdir) && cp -rf $(BUILDDIR)/html/* $(MGCleanerdocdir) ;
+
+uninstall-local:
+       -test -d $(MGCleanerdocdir) && chmod -R +w $(MGCleanerdocdir) && rm -rf $(MGCleanerdocdir)/*
+
+clean-local:
+       -rm -rf $(BUILDDIR)/*
+
+$(BUILDDIR)/html/index.html:
+       $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+       @echo
+       @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+latexpdf:
+       $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+       @echo "Running LaTeX files through pdflatex..."
+       $(MAKE) -C $(BUILDDIR)/latex all-pdf
+       @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
diff --git a/src/Tools/MGCleanerPlug/doc/Mandatory_params.rst b/src/Tools/MGCleanerPlug/doc/Mandatory_params.rst
new file mode 100644 (file)
index 0000000..541a3bd
--- /dev/null
@@ -0,0 +1,27 @@
+Simple Remeshing Options
+=========================
+
+simple case 
+-----------
+
+   All options, but the input mesh, have default values. however, **you have to specified these
+   simple options in order to drive MG-Cleaner and control remeshing parameters**. 
+
+   You can access Distene documentation by clicking on Help button.
+
+
+.. image:: images/Simple.png
+   :align: center
+
+
+- **Original Mesh**
+
+   You have to select a Mesh Object from Salome Object Browser or choose a .GMF file.
+
+
+Options
+------------
+    
+This is the main remeshing Option.
+   
+
diff --git a/src/Tools/MGCleanerPlug/doc/conf.py.in b/src/Tools/MGCleanerPlug/doc/conf.py.in
new file mode 100644 (file)
index 0000000..b8f4307
--- /dev/null
@@ -0,0 +1,179 @@
+# -*- coding: utf-8 -*-
+#
+# MGCleaner PlugIn documentation build configuration file, created by
+# sphinx-quickstart on April 2013.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('some/directory'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['.templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'MGCleaner Plug-in'
+copyright = '2013, CEA'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '@VERSION@'
+# The full version, including alpha/beta/rc tags.
+release = '@VERSION@'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directories, that shouldn't be searched
+# for source files.
+#exclude_dirs = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+#html_static_path = ['.static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'MGCleanerPlug-in doc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+  ('index', 'MGCleanerPlugIn.tex', 'MGCleaner PlugIn Documentation',
+   'CEA', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
diff --git a/src/Tools/MGCleanerPlug/doc/editHypo.rst b/src/Tools/MGCleanerPlug/doc/editHypo.rst
new file mode 100644 (file)
index 0000000..5ab05f3
--- /dev/null
@@ -0,0 +1,50 @@
+.. _hypothesis-label:
+
+===========================
+How to save MG-Cleaner Parameters 
+===========================
+
+MG-Cleaner hypothesis is not meshing hypothesis for Salome, but hypothesis for MG-Cleaner.
+The current set of parameters is automatically written in the salome study object browser when you run computation.
+
+Theses parameters could also be stored in a special file.
+Default file is $HOME/.MGCleaner.dat.
+This ASCII file is appended, and never cleaned.
+
+In frame "Plug-in Generic Options":
+
+- To save the current setting in this file, click on "Save" pushbutton.
+- To load the last set of parameters saved, click on "Load" pushbutton.
+
+At the bottom of the dialog window:  
+
+- To save a current setting in the study object browser, click on "Save" pushbutton.
+- To load a current setting from the study object browser, click on "Load" pushbutton.
+- To load the default setting, click on "Default" pushbutton. .
+
+
+**example of .MGCleaner.dat**
+
+
+.. code-block:: python
+
+   # MGCleaner hypothesis parameters
+   # Params for mesh : Mesh_1
+   # Date : 21/05/13 10:44:05
+   # Command : mg-cleaner.exe --verbose 2 --in /tmp/ForMGCleaner_2.mesh --out /tmp/ForMGCleaner_2_fix.mesh --check --topology ignore --tolerance_displacement 0.0 --folding_angle 15.0 --overlap_angle 15.0
+   CheckOrFix=check
+   PreserveTopology=False
+   FillHoles=False
+   MinHoleSize=0.0
+   ComputedToleranceDisplacement=True
+   ToleranceDisplacement=0.0
+   ComputedResolutionLength=False
+   ResolutionLength=0.0
+   FoldingAngle=15.0
+   RemeshPlanes=False
+   ComputedOverlapDistance=True
+   OverlapDistance=0.0
+   OverlapAngle=15.0
+   Verbosity=2
+
+
diff --git a/src/Tools/MGCleanerPlug/doc/files/mg-cleaner_user_manual.pdf b/src/Tools/MGCleanerPlug/doc/files/mg-cleaner_user_manual.pdf
new file mode 100644 (file)
index 0000000..a3907d2
Binary files /dev/null and b/src/Tools/MGCleanerPlug/doc/files/mg-cleaner_user_manual.pdf differ
diff --git a/src/Tools/MGCleanerPlug/doc/images/Advanced.png b/src/Tools/MGCleanerPlug/doc/images/Advanced.png
new file mode 100644 (file)
index 0000000..2e19ee5
Binary files /dev/null and b/src/Tools/MGCleanerPlug/doc/images/Advanced.png differ
diff --git a/src/Tools/MGCleanerPlug/doc/images/AppelMGCleaner.png b/src/Tools/MGCleanerPlug/doc/images/AppelMGCleaner.png
new file mode 100644 (file)
index 0000000..620e8f2
Binary files /dev/null and b/src/Tools/MGCleanerPlug/doc/images/AppelMGCleaner.png differ
diff --git a/src/Tools/MGCleanerPlug/doc/images/Generic.png b/src/Tools/MGCleanerPlug/doc/images/Generic.png
new file mode 100644 (file)
index 0000000..a6614bf
Binary files /dev/null and b/src/Tools/MGCleanerPlug/doc/images/Generic.png differ
diff --git a/src/Tools/MGCleanerPlug/doc/images/Simple.png b/src/Tools/MGCleanerPlug/doc/images/Simple.png
new file mode 100644 (file)
index 0000000..5277572
Binary files /dev/null and b/src/Tools/MGCleanerPlug/doc/images/Simple.png differ
diff --git a/src/Tools/MGCleanerPlug/doc/images/Tolerance.png b/src/Tools/MGCleanerPlug/doc/images/Tolerance.png
new file mode 100644 (file)
index 0000000..6df0c80
Binary files /dev/null and b/src/Tools/MGCleanerPlug/doc/images/Tolerance.png differ
diff --git a/src/Tools/MGCleanerPlug/doc/index.rst b/src/Tools/MGCleanerPlug/doc/index.rst
new file mode 100644 (file)
index 0000000..5339515
--- /dev/null
@@ -0,0 +1,30 @@
+.. MeshGems-Cleaner documentation master file, created by sphinx-quickstart on Wed Sep 14 11:40:32 2011.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+MeshGems-Cleaner plugin documentation
+=====================================
+
+This documentation covers the usage of MeshGems-Cleaner, also named MG-Cleaner or MGCleaner as plug-in in Salome that can be used within the Salome
+Mesh module for remeshing 2D Surface. 
+
+MG-Cleaner plug-in uses Distene commercial software MeshGems-Cleaner, which is an **automatic surface remeshing tool**.
+This plug_in offers only the most common functionnalities of the tool.
+
+.. note::
+  for a complete documentation, see :download:`MG-cleaner user manual <files/mg-cleaner_user_manual.pdf>`.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+  
+   lct.rst
+   Mandatory_params.rst
+   Advanced_params.rst
+   Generics_params.rst
+   editHypo.rst
+   
+   
+
+
diff --git a/src/Tools/MGCleanerPlug/doc/lct.rst b/src/Tools/MGCleanerPlug/doc/lct.rst
new file mode 100644 (file)
index 0000000..c37726b
--- /dev/null
@@ -0,0 +1,11 @@
+Running MGCleaner Plug-in 
+=====================
+
+MGCleaner plug-in can be invoked via SMESH Plugin item in Mesh menu bar 
+
+.. image:: images/AppelMGCleaner.png
+   :align: center
+
+
+This plug-in works only with the commercial software MeshGemsCleaner. To obtain a license,
+visit www.distene.comm
diff --git a/src/Tools/MGCleanerPlug/open.png b/src/Tools/MGCleanerPlug/open.png
new file mode 100644 (file)
index 0000000..8ed143e
Binary files /dev/null and b/src/Tools/MGCleanerPlug/open.png differ
diff --git a/src/Tools/MGCleanerPlug/select1.png b/src/Tools/MGCleanerPlug/select1.png
new file mode 100644 (file)
index 0000000..ecb252a
Binary files /dev/null and b/src/Tools/MGCleanerPlug/select1.png differ
index ac2d64680c8c4e97945416e3debe64a8571281e2..ad092da9f8b981c6fd00e77efdf3efa2736acde6 100644 (file)
@@ -28,10 +28,10 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 SUBDIRS = MeshCut padder
 
 if SMESH_ENABLE_GUI
-  SUBDIRS += YamsPlug
+  SUBDIRS += YamsPlug MGCleanerPlug
 endif
 
 salomeplugins_PYTHON = \
        smesh_plugins.py
 
-DIST_SUBDIRS = MeshCut padder YamsPlug
+DIST_SUBDIRS = MeshCut padder YamsPlug MGCleanerPlug
index 72ae1e07bd46ac3925e57ba629999a38e75f2a8a..e34b7b7da1b09f05119bdf38cd8b4b4abb9a90de 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>927</width>
-    <height>700</height>
+    <width>800</width>
+    <height>500</height>
    </rect>
   </property>
   <property name="windowTitle">
   <layout class="QGridLayout" name="gridLayout">
    <item row="2" column="0">
     <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+      <spacer name="horizontalSpacer_xx">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>10</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+         </item>
      <item>
       <widget class="QPushButton" name="PB_OK">
        <property name="text">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Minimum</enum>
-       </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>60</width>
+         <width>30</width>
          <height>20</height>
         </size>
        </property>
       </spacer>
      </item>
      <item>
-      <widget class="QPushButton" name="PB_Save">
+      <widget class="QPushButton" name="PB_SaveHyp">
        <property name="text">
-        <string>Save Params</string>
+        <string>Save</string>
        </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
       </widget>
      </item>
      <item>
-      <widget class="QPushButton" name="PB_Load">
+      <widget class="QPushButton" name="PB_LoadHyp">
        <property name="text">
-        <string>Load Params</string>
+        <string>Load</string>
        </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
       </widget>
      </item>
      <item>
       <widget class="QPushButton" name="PB_Default">
        <property name="text">
-        <string>Default Params</string>
+        <string>Default</string>
        </property>
       </widget>
      </item>
        </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>338</width>
-         <height>25</height>
+         <width>30</width>
+         <height>20</height>
         </size>
        </property>
       </spacer>
        </property>
       </widget>
      </item>
+         <item>
+      <spacer name="horizontalSpacer_xx">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>10</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+         </item>
     </layout>
    </item>
    <item row="1" column="0">
       <widget class="QGroupBox" name="GBOptim">
        <property name="geometry">
         <rect>
-         <x>20</x>
-         <y>190</y>
-         <width>871</width>
-         <height>311</height>
+         <x>10</x>
+         <y>140</y>
+         <width>750</width>
+         <height>270</height>
         </rect>
        </property>
        <property name="title">
         <string>Optimisation</string>
        </property>
-       <widget class="QGroupBox" name="mesRB">
-        <property name="geometry">
-         <rect>
-          <x>20</x>
-          <y>30</y>
-          <width>611</width>
-          <height>261</height>
-         </rect>
-        </property>
-        <widget class="QRadioButton" name="RB_0">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>25</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Quality improvement&lt;/span&gt; is done by point smoothing and edge swapping&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>Quality improvement Only (0)</string>
-         </property>
-         <property name="checked">
-          <bool>true</bool>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB_G">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>54</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>the given surface triangulation is enriched (no coarsening at all) in such away that the distance 
+
+        <layout class="QHBoxLayout" name="RBLayoutopt">
+
+         <item>
+      <spacer name="horizontalSpacer_xx">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>30</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+         </item>
+
+         <item>
+        <layout class="QVBoxLayout" name="monRBLayout">
+         <item>
+          <widget class="QRadioButton" name="RB_0">
+           <property name="toolTip">
+            <string>Quality improvement is done by point smoothing and edge swapping.</string>
+           </property>
+           <property name="text">
+            <string>Quality improvement Only (0)</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_G">
+           <property name="toolTip">
+            <string>The given surface triangulation is enriched (no coarsening at all) in such away that the distance 
 between the elements in the final mesh and those of the initial one is bounded by auser specified tolerance value. 
 One should use this option, to enrich the mesh where purely
 geometrical features may be insuficiently fine, i.e. the resulting mesh will be least as fine as the input.
 Mesh and the geometric features will be refined if needed as specified by the other program parameters.
 The meshes obtained with those settings may not be suitable for computation.</string>
-         </property>
-         <property name="text">
-          <string>Pure Geometry Enrichment (G)</string>
-         </property>
-         <property name="checked">
-          <bool>false</bool>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB_U">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>83</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>a uniform subdivision of the given surface triangulation is performed : 
+           </property>
+           <property name="text">
+            <string>Pure Geometry Enrichment (G)</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_U">
+           <property name="toolTip">
+            <string>An uniform subdivision of the given surface triangulation is performed : 
 each triangle of the given surface triangulation is considered at and
 is divided into identical triangles.</string>
-         </property>
-         <property name="text">
-          <string>Uniform Subdivision(U)</string>
-         </property>
-         <property name="checked">
-          <bool>false</bool>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB_S">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>112</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>a surface sandpapering without shrinkage of the given surface
+           </property>
+           <property name="text">
+            <string>Uniform Subdivision (U)</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_S">
+           <property name="toolTip">
+            <string>A surface sandpapering without shrinkage of the given surface
 triangulation is performed, i.e., the high curvature variations of the
 given surface will be smoothed out without shrinking the volume in
 doing so. If ridges are defined, they will be kept as they are in the
 resulting mesh.
-This option modifies the goemetry.</string>
-         </property>
-         <property name="text">
-          <string>Sand Papering (S)</string>
-         </property>
-         <property name="checked">
-          <bool>false</bool>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB__2">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>141</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>The given surface triangulation is modified in such a way that the distance between 
+This option modifies the geometry.</string>
+           </property>
+           <property name="text">
+            <string>Sandpapering (S)</string>
+           </property>
+           <property name="checked">
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB__2">
+           <property name="toolTip">
+            <string>The given surface triangulation is modified in such a way that the distance between 
 the elements in the final mesh and those of the initial one is bounded by a user specfied tolerance value.
 One should use this option, to coarsen when a purely geometrical mesh is needed. (a mesh that keeps
 and obeys its geometric features only.) The meshes obtained with this option are usually not suitable
 for computation because anisotropic elements may be generated</string>
-         </property>
-         <property name="text">
-          <string>Geometrical Mesh : Coarsening(-2)</string>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB_2">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>170</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>The given surface triangulation is modified in such a way that the distance between 
+           </property>
+           <property name="text">
+            <string>Geometrical Mesh : Coarsening (-2)</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_2">
+           <property name="toolTip">
+            <string>The given surface triangulation is modified in such a way that the distance between 
 the elements in the final mesh and those of the initial one is bounded by a user specfied tolerance value.
 One should use this option, to coarsen and enrich when a purely geometrical mesh is needed. (a mesh that keeps
 and obeys its geometric features only.) The meshes obtained with this setting are usually not suitable
 for computation because anisotropic elements may be generated</string>
-         </property>
-         <property name="text">
-          <string>Geometrical Mesh : Coarsening and Enrichment (2)</string>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB__1">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>199</y>
-           <width>585</width>
-           <height>23</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>The given surface triangulation is modfied in accordance to a size map. 
+           </property>
+           <property name="text">
+            <string>Geometrical Mesh : Coarsening and Enrichment (2)</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB__1">
+           <property name="toolTip">
+            <string>The given surface triangulation is modified in accordance to a size map. 
 The latter can be either the intrinsic size map (computed automatically
 and based on the surface properties, i.e. the local curvatures),
 or on a given size map (which is then combined to the intrinsic size map). 
 One should use this option to coarsen  the mesh, when a regular mesh 
 for computation purposes is desired, i.e. a mesh with good aspect ratios or 
 good quality elements.</string>
-         </property>
-         <property name="text">
-          <string>Mesh for finite element computation : Coarsening (-1)</string>
-         </property>
-        </widget>
-        <widget class="QRadioButton" name="RB_1">
-         <property name="geometry">
-          <rect>
-           <x>17</x>
-           <y>228</y>
-           <width>585</width>
-           <height>22</height>
-          </rect>
-         </property>
-         <property name="toolTip">
-          <string>The given surface triangulation is modfied in accordance to a size map. 
+           </property>
+           <property name="text">
+            <string>Mesh for finite element computation : Coarsening (-1)</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="RB_1">
+           <property name="toolTip">
+            <string>The given surface triangulation is modified in accordance to a size map. 
 The latter can be either the intrinsic size map (computed automatically
 and based on the surface properties, i.e. the local curvatures),
 or on a given size map (which is then combined to the intrinsic size map). 
-One should use this option to coarse and enrich the mesh, when a regular mesh 
+One should use this option to coarse and enrich the mesh, when a regular mesh 
 for computation purposes is desired, i.e. a mesh with good aspect ratios or 
 good quality elements</string>
-         </property>
-         <property name="text">
-          <string>Mesh for finite element computation : Coarsening and Enrichment  (1)</string>
-         </property>
-        </widget>
-       </widget>
+           </property>
+           <property name="text">
+            <string>Mesh for finite element computation : Coarsening and Enrichment (1)</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+
       </widget>
-      <widget class="QGroupBox" name="groupBox">
+      <widget class="QGroupBox" name="GBUnit">
        <property name="geometry">
         <rect>
          <x>10</x>
-         <y>20</y>
-         <width>871</width>
-         <height>161</height>
+         <y>420</y>
+         <width>750</width>
+         <height>70</height>
         </rect>
        </property>
-       <property name="font">
-        <font>
-         <pointsize>10</pointsize>
-        </font>
+       <property name="toolTip">
+        <string>This parameter enables the user to bound the maximal chordal deviation allowed,
+that is the maximal distance allowed between the detected curve and the plane P
+of the corresponding mesh face.
+In other words, it avoids having faces too far away from the curve they should represent.</string>
        </property>
        <property name="title">
-        <string>Original Mesh</string>
+        <string>Chordal deviation Tolerance</string>
        </property>
-       <widget class="QWidget" name="layoutWidget">
+       <widget class="QLineEdit" name="SP_Tolerance">
         <property name="geometry">
          <rect>
-          <x>10</x>
+          <x>40</x>
           <y>30</y>
-          <width>861</width>
-          <height>101</height>
+          <width>110</width>
+          <height>24</height>
          </rect>
         </property>
-        <layout class="QGridLayout" name="gridLayout_2">
-         <item row="0" column="1">
-          <widget class="QLabel" name="label_7">
-           <property name="font">
-            <font>
-             <pointsize>10</pointsize>
-             <strikeout>false</strikeout>
-            </font>
-           </property>
-           <property name="frameShape">
-            <enum>QFrame::Box</enum>
-           </property>
-           <property name="text">
-            <string>Smesh mesh</string>
-           </property>
-           <property name="wordWrap">
-            <bool>false</bool>
-           </property>
-           <property name="margin">
-            <number>0</number>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="2">
-          <widget class="QPushButton" name="PB_MeshSmesh">
-           <property name="text">
-            <string/>
-           </property>
-           <property name="icon">
-            <iconset>
-             <normaloff>../../../../../../../../SalomeSrc/SMESH_V6_main/src/Tools/YamsPlug/open.png</normaloff>../../../../../../../../SalomeSrc/SMESH_V6_main/src/Tools/YamsPlug/open.png</iconset>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>18</width>
-             <height>18</height>
-            </size>
-           </property>
-           <property name="checkable">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="3">
-          <widget class="QLineEdit" name="LE_MeshSmesh">
-           <property name="font">
-            <font>
-             <pointsize>10</pointsize>
-            </font>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="0">
-          <widget class="QLabel" name="label_8">
-           <property name="text">
-            <string>or</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="1" colspan="2">
-          <widget class="QPushButton" name="PB_MeshFile">
-           <property name="font">
-            <font>
-             <pointsize>10</pointsize>
-            </font>
-           </property>
-           <property name="text">
-            <string>Mesh File (GMF format)</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="3">
-          <widget class="QLineEdit" name="LE_MeshFile">
-           <property name="font">
-            <font>
-             <pointsize>10</pointsize>
-            </font>
-           </property>
-          </widget>
-         </item>
-        </layout>
+        <property name="toolTip">
+         <string>If the Units parameter is relative, epsilon max correspond to (per thousand) s*Tolerance/1000, where s is the size of the bounding box of the domain.
+If the Units parameter is absolute, the tolerance parameter is expressed in model units:
+  if P=2 and point coordinates are given in millimeters, the maximal chordal deviation is 2 mm.</string>
+        </property>
+       </widget>
+       <widget class="QRadioButton" name="RB_Absolute">
+        <property name="geometry">
+         <rect>
+          <x>220</x>
+          <y>30</y>
+          <width>120</width>
+          <height>24</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>Values are expressed in the model units.</string>
+        </property>
+        <property name="text">
+         <string>Absolute units</string>
+        </property>
+        <property name="checked">
+         <bool>false</bool>
+        </property>
+       </widget>
+       <widget class="QRadioButton" name="RB_Relative">
+        <property name="geometry">
+         <rect>
+          <x>350</x>
+          <y>30</y>
+          <width>120</width>
+          <height>24</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>Values are relative (per thousand) to the bounding box size.</string>
+        </property>
+        <property name="text">
+         <string>Relative units</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
        </widget>
       </widget>
-      <widget class="QDoubleSpinBox" name="SP_Tolerance">
+      <widget class="QGroupBox" name="groupBox">
        <property name="geometry">
         <rect>
-         <x>430</x>
-         <y>540</y>
-         <width>81</width>
-         <height>31</height>
+         <x>10</x>
+         <y>10</y>
+         <width>750</width>
+         <height>120</height>
         </rect>
        </property>
        <property name="font">
         <font>
-         <stylestrategy>PreferDefault</stylestrategy>
+         <pointsize>10</pointsize>
         </font>
        </property>
-       <property name="mouseTracking">
-        <bool>true</bool>
-       </property>
-       <property name="toolTip">
-        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If the Units parameter is relative, epsilon max corresponds to 0.001x s x tolerance parameter where s is the size of the bounding box of the domain.&lt;/p&gt;&lt;p&gt;If the Units parameter (P) is absolute, the tolerance parameter is expressed in model units :&lt;/p&gt;&lt;p&gt;if P=2 and point coordinates are given in millimetre, it means that the maximal chordal deviation is 2 mm &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-       </property>
-       <property name="decimals">
-        <number>0</number>
-       </property>
-       <property name="minimum">
-        <double>1.000000000000000</double>
-       </property>
-       <property name="maximum">
-        <double>1000.000000000000000</double>
-       </property>
-       <property name="singleStep">
-        <double>1.000000000000000</double>
-       </property>
-       <property name="value">
-        <double>10.000000000000000</double>
-       </property>
-      </widget>
-      <widget class="QWidget" name="layoutWidget">
-       <property name="geometry">
-        <rect>
-         <x>30</x>
-         <y>500</y>
-         <width>801</width>
-         <height>37</height>
-        </rect>
-       </property>
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <item>
-         <widget class="QGroupBox" name="GBUnit">
-          <property name="toolTip">
-           <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
-          </property>
-          <property name="title">
-           <string>Units </string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QGroupBox" name="GBTolerance_2">
-          <property name="toolTip">
-           <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Set chordal deviation tolerance:&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This parameter enables the user to bound the maximal chordal deviation allowed,&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;that is, the maximal distance allowed between the detected curve and the plane P&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;of the corresponding mesh face.&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;In other words, it avoids having faces too far away from the curve &lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;they represent (or should represent).&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
-          </property>
-          <property name="title">
-           <string>Chordal deviation Tolerance</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="layoutWidget">
-       <property name="geometry">
-        <rect>
-         <x>60</x>
-         <y>540</y>
-         <width>230</width>
-         <height>31</height>
-        </rect>
-       </property>
-       <layout class="QHBoxLayout" name="horizontalLayout_5">
-        <item>
-         <widget class="QRadioButton" name="RB_Absolute">
-          <property name="toolTip">
-           <string>Values are expressed in the model units.</string>
-          </property>
-          <property name="text">
-           <string>Absolute</string>
-          </property>
-          <property name="checked">
-           <bool>false</bool>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QRadioButton" name="RB_Relative">
-          <property name="toolTip">
-           <string>Values are relative to the bounding box size.</string>
-          </property>
-          <property name="text">
-           <string>Relative</string>
-          </property>
-          <property name="checked">
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QLabel" name="label_11">
-       <property name="geometry">
-        <rect>
-         <x>520</x>
-         <y>540</y>
-         <width>301</width>
-         <height>51</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;0/00 if relative&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Mesh unit if absolute&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       <property name="title">
+        <string>Original Mesh</string>
        </property>
+       <widget class="QPushButton" name="PB_MeshFile">
+        <property name="geometry">
+         <rect>
+          <x>40</x>
+          <y>70</y>
+          <width>190</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>10</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>Mesh File GMF format</string>
+        </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+       </widget>
+       <widget class="QLineEdit" name="LE_MeshFile">
+        <property name="geometry">
+         <rect>
+          <x>240</x>
+          <y>70</y>
+          <width>481</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>10</pointsize>
+         </font>
+        </property>
+       </widget>
+       <widget class="QPushButton" name="PB_MeshSmesh">
+        <property name="geometry">
+         <rect>
+          <x>40</x>
+          <y>30</y>
+          <width>190</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>Mesh Object Browser</string>
+        </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+        <property name="checkable">
+         <bool>false</bool>
+        </property>
+       </widget>
+       <widget class="QLineEdit" name="LE_MeshSmesh">
+        <property name="geometry">
+         <rect>
+          <x>240</x>
+          <y>30</y>
+          <width>481</width>
+          <height>31</height>
+         </rect>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>10</pointsize>
+         </font>
+        </property>
+       </widget>
+       <widget class="QLabel" name="label_8">
+        <property name="geometry">
+         <rect>
+          <x>10</x>
+          <y>80</y>
+          <width>31</width>
+          <height>18</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>or</string>
+        </property>
+       </widget>
       </widget>
-      <zorder>layoutWidget</zorder>
-      <zorder>layoutWidget</zorder>
       <zorder>groupBox</zorder>
       <zorder>GBOptim</zorder>
-      <zorder>SP_Tolerance</zorder>
-      <zorder>label_11</zorder>
      </widget>
      <widget class="QWidget" name="advanced">
       <attribute name="title">
-       <string>Advanced  Remeshing Options</string>
+       <string>Advanced Remeshing Options</string>
       </attribute>
-      <widget class="QGroupBox" name="groupBox_2">
+      <widget class="QGroupBox" name="groupBox_5">
        <property name="geometry">
         <rect>
          <x>10</x>
          <y>10</y>
-         <width>761</width>
-         <height>71</height>
+         <width>750</width>
+         <height>120</height>
         </rect>
        </property>
        <property name="title">
-        <string>You can disable :</string>
+        <string>You can set/unset</string>
        </property>
        <widget class="QCheckBox" name="CB_Ridge">
         <property name="geometry">
          <rect>
-          <x>100</x>
+          <x>30</x>
           <y>20</y>
           <width>271</width>
-          <height>23</height>
+          <height>25</height>
          </rect>
         </property>
         <property name="toolTip">
-         <string>if not set (ridge detection disabled), Yams will not try to detect any new ridge edge by its own mechanism : 
+         <string>If not set (ridge detection disabled), Yams will not try to detect any new ridge edge by its own mechanism : 
 it will consider as ridge only the ridges given in the mesh. 
-All non-ridge edges that would have been detected as ridge by the Ridge angle paramaeter 
+All non-ridge edges that would have been detected as ridge by the ridge angle parameter 
 (see below)  will be considered as part of the same continuous patch.
 This option should not be checked when all the known ridges of the mesh are given and
 when all other possible ridges are not geometric ridges to take into account.</string>
@@ -613,10 +540,10 @@ when all other possible ridges are not geometric ridges to take into account.</s
        <widget class="QCheckBox" name="CB_Point">
         <property name="geometry">
          <rect>
-          <x>100</x>
-          <y>40</y>
+          <x>30</x>
+          <y>50</y>
           <width>271</width>
-          <height>23</height>
+          <height>25</height>
          </rect>
         </property>
         <property name="toolTip">
@@ -631,127 +558,159 @@ or add vertices (refines) to change the mesh.</string>
          <bool>true</bool>
         </property>
        </widget>
+
+       <widget class="QCheckBox" name="CB_SplitEdge">
+        <property name="geometry">
+         <rect>
+          <x>30</x>
+          <y>80</y>
+          <width>271</width>
+          <height>25</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>If set, Yams creates new vertices placed on the curved surface and adds them to elements. 
+It means one extra vertex on edge (P2 or quadratic triangles).
+New created vertices are saved in the .mesh file under keyword section 'Vertices'</string>
+        </property>
+        <property name="text">
+         <string>split edge</string>
+        </property>
+        <property name="checked">
+         <bool>false</bool>
+        </property>
+       </widget>
+
+
       </widget>
       <widget class="QGroupBox" name="groupBox_5">
        <property name="geometry">
         <rect>
          <x>10</x>
-         <y>90</y>
-         <width>841</width>
-         <height>391</height>
+         <y>140</y>
+         <width>750</width>
+         <height>270</height>
         </rect>
        </property>
        <property name="title">
-        <string>You can control </string>
+        <string>You can control</string>
        </property>
+##1
        <widget class="QDoubleSpinBox" name="SP_Geomapp">
         <property name="geometry">
          <rect>
-          <x>10</x>
+          <x>30</x>
           <y>30</y>
-          <width>91</width>
-          <height>23</height>
+          <width>100</width>
+          <height>25</height>
          </rect>
         </property>
         <property name="maximum">
-         <double>0.890000000000000</double>
+         <double>0.89</double>
         </property>
         <property name="singleStep">
-         <double>0.010000000000000</double>
+         <double>0.01</double>
         </property>
         <property name="value">
-         <double>0.040000000000000</double>
+         <double>0.04</double>
         </property>
        </widget>
        <widget class="QLabel" name="label_2">
         <property name="geometry">
          <rect>
-          <x>120</x>
-          <y>20</y>
-          <width>731</width>
-          <height>61</height>
+          <x>140</x>
+          <y>30</y>
+          <width>630</width>
+          <height>30</height>
          </rect>
         </property>
         <property name="toolTip">
          <string>This field (as well as tolerance) enables the user to control the accuracy of the
 piecewise linear approximation of the surface. This parameter enables the user to
-control the maximal angle allowed between two adjacent faces. It can be used to 
+control the maximal angle allowed between two adjacent faces. It can be used to
 bound the maximal deviation of the mesh faces from the tangent planes at mesh vertices. 
 In other words, it avoids having sharp angles between faces representing a smooth curve.
 This parameter enables the user to specify the maximal chordal deviation &quot;max relatively to the curvature.
 Following that criterion:
-- if the chordal deviation epsilon  is smaller than epsilon max *r, it is acceptable to remove the considered point;
+- if the chordal deviation epsilon is smaller than epsilon max*r, it is acceptable to remove the considered point;
 - if the chordal deviation epsilon is greater than epsiolon max*r, the considered mesh face should be redefined 
-by adding a point on the curve.
+     by adding a point on the curve.
 One can see that the smaller the radius r, the harder it is to satisfy this criterion:  
 epsilon max is a real value corresponding to a percentage, the ratio between the chordal deviation to 
 the local curvature. This field is used only for optimisation style -O values of  -1, 0 and 1.
 The default value for &quot;max is set to 0:04 which leads to angles of less than 33 degrees between two adjacent
-faces .</string>
+faces.</string>
         </property>
         <property name="text">
-         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Geometrical approximation :  Maximum angle (1-cos(angle)) allowed &lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;between a face and a curve &lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:8pt;&quot;&gt;(not separated by a ridge).&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;)&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         <string>Geometrical approximation:
+Maximum angle allowed between a face and a curve (not separated by a ridge).</string>
+        </property>
+       </widget>
+##2
+       <widget class="QDoubleSpinBox" name="SP_Ridge">
+        <property name="geometry">
+         <rect>
+          <x>30</x>
+          <y>70</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+        <property name="maximum">
+         <double>90.</double>
+        </property>
+        <property name="value">
+         <double>45.</double>
         </property>
        </widget>
        <widget class="QLabel" name="label_4">
         <property name="geometry">
          <rect>
-          <x>120</x>
-          <y>80</y>
-          <width>691</width>
-          <height>71</height>
+          <x>140</x>
+          <y>70</y>
+          <width>630</width>
+          <height>30</height>
          </rect>
         </property>
         <property name="text">
-         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Ridge angle:&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;if the angle between the normal vectors of two adjacent faces&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;exceeds this value, the edge common to the faces is a ridge&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         <string>If the angle between the normal vectors of two adjacent faces exceeds this value,
+the edge common to the faces is a ridge.</string>
         </property>
        </widget>
-       <widget class="QDoubleSpinBox" name="SP_Ridge">
+##3
+       <widget class="QDoubleSpinBox" name="SP_MaxSize">
         <property name="geometry">
          <rect>
-          <x>10</x>
-          <y>100</y>
-          <width>91</width>
-          <height>23</height>
+          <x>30</x>
+          <y>110</y>
+          <width>100</width>
+          <height>25</height>
          </rect>
         </property>
+        <property name="minimum">
+         <double>0.01</double>
+        </property>
         <property name="maximum">
-         <double>90.000000000000000</double>
+         <double>100.</double>
+        </property>
+        <property name="singleStep">
+         <double>0.1</double>
         </property>
         <property name="value">
-         <double>45.000000000000000</double>
+         <double>100.</double>
         </property>
        </widget>
        <widget class="QLabel" name="label_5">
         <property name="geometry">
          <rect>
-          <x>120</x>
-          <y>160</y>
-          <width>681</width>
-          <height>61</height>
+          <x>140</x>
+          <y>110</y>
+          <width>630</width>
+          <height>30</height>
          </rect>
         </property>
         <property name="toolTip">
-         <string>This parameter allows the user to prescribe  a maximal size hmax
+         <string>This parameter allows the user to prescribe a maximal size hmax
 for the mesh elements i.e., the lengths of the edges with respect to the specified
  size map. The corresponding values are either relative or absolute depending on the choosen parameter.
 The default values are automatically set based on the surface geometry (curvature dependent) and its
@@ -760,97 +719,44 @@ Please note that, as it is not strictly possible to obey the given or computed s
 size  may be slightly bigger than the prescribed ones.</string>
         </property>
         <property name="text">
-         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Maximal size allowed around vertices:&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;the lengths of the edges with respect to the specified size map.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
-        </property>
-       </widget>
-       <widget class="QLabel" name="label_3">
-        <property name="geometry">
-         <rect>
-          <x>120</x>
-          <y>290</y>
-          <width>691</width>
-          <height>91</height>
-         </rect>
-        </property>
-        <property name="toolTip">
-         <string>This parameter enables the user to control the element size variation in the triangulation.
-Yams will avoid getting two adjacent edges which sizes differ by a factor bigger than this parameter. 
-To avoid rapid size variations, a size correction procedure is applied to the size map. 
-In other words: if two adjacent edges are respectively e1 and e2 long 
-if  e2 &gt; parameter * e1 then e02 the new size for the second edge will be set to  parameter* e1.
-This procedure is de-activated if yams computes a mesh for finite element with only coarsening.
-The default value is 1.3, which is the usual value set for computational meshes.</string>
-        </property>
-        <property name="text">
-         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Mesh Gradation ie the element size variation in the triangulation:&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Yams will avoid having two adjacent edges which sizes &lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;vary more than the given gradation.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
-        </property>
-       </widget>
-       <widget class="QDoubleSpinBox" name="SP_Gradation">
-        <property name="geometry">
-         <rect>
-          <x>10</x>
-          <y>300</y>
-          <width>91</width>
-          <height>23</height>
-         </rect>
-        </property>
-        <property name="singleStep">
-         <double>0.010000000000000</double>
-        </property>
-        <property name="value">
-         <double>1.300000000000000</double>
+         <string>Maximal size allowed around vertices,
+the lengths of the edges with respect to the specified size map.</string>
         </property>
        </widget>
-       <widget class="QDoubleSpinBox" name="SP_MaxSize">
+##4
+       <widget class="QDoubleSpinBox" name="SP_MinSize">
         <property name="geometry">
          <rect>
-          <x>10</x>
-          <y>170</y>
-          <width>91</width>
-          <height>23</height>
+          <x>30</x>
+          <y>150</y>
+          <width>100</width>
+          <height>25</height>
          </rect>
         </property>
         <property name="minimum">
-         <double>0.010000000000000</double>
+         <double>0.</double>
         </property>
         <property name="maximum">
-         <double>100.000000000000000</double>
+         <double>100.</double>
         </property>
         <property name="singleStep">
-         <double>0.100000000000000</double>
+         <double>0.1</double>
         </property>
         <property name="value">
-         <double>100.000000000000000</double>
+         <double>5.</double>
         </property>
        </widget>
        <widget class="QLabel" name="label_9">
         <property name="geometry">
          <rect>
-          <x>120</x>
-          <y>230</y>
-          <width>661</width>
-          <height>51</height>
+          <x>140</x>
+          <y>150</y>
+          <width>630</width>
+          <height>30</height>
          </rect>
         </property>
         <property name="toolTip">
-         <string>This parameter allows the user to prescribe  a maximal size hmax
+         <string>This parameter allows the user to prescribe a maximal size hmax
 for the mesh elements i.e., the lengths of the edges with respect to the specified
  size map. The corresponding values are either relative or absolute depending on the choosen parameter.
 The default values are automatically set based on the surface geometry (curvature dependent) and its
@@ -859,73 +765,50 @@ Please note that, as it is not strictly possible to obey the given or computed s
 size  may be slightly bigger than the prescribed ones.</string>
         </property>
         <property name="text">
-         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Minimal size allowed around vertices:&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;the lengths of the edges with respect to the specified size map.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         <string>Minimal size allowed around vertices,
+the lengths of the edges with respect to the specified size map.</string>
         </property>
        </widget>
-       <widget class="QDoubleSpinBox" name="SP_MinSize">
+##5
+       <widget class="QDoubleSpinBox" name="SP_Gradation">
         <property name="geometry">
          <rect>
-          <x>10</x>
-          <y>230</y>
-          <width>91</width>
-          <height>23</height>
+          <x>30</x>
+          <y>190</y>
+          <width>100</width>
+          <height>25</height>
          </rect>
         </property>
-        <property name="minimum">
-         <double>0.000000000000000</double>
-        </property>
-        <property name="maximum">
-         <double>100.000000000000000</double>
-        </property>
         <property name="singleStep">
-         <double>0.100000000000000</double>
+         <double>0.01</double>
         </property>
         <property name="value">
-         <double>5.000000000000000</double>
+         <double>1.3</double>
+        </property>
+       </widget>
+       <widget class="QLabel" name="label_3">
+        <property name="geometry">
+         <rect>
+          <x>140</x>
+          <y>190</y>
+          <width>630</width>
+          <height>30</height>
+         </rect>
+        </property>
+        <property name="toolTip">
+         <string>This parameter enables the user to control the element size variation in the triangulation.
+Yams will avoid getting two adjacent edges which sizes differ by a factor bigger than this parameter. 
+To avoid rapid size variations, a size correction procedure is applied to the size map. 
+In other words: if two adjacent edges are respectively e1 and e2 long 
+if  e2 &gt; parameter * e1 then e02 the new size for the second edge will be set to  parameter* e1.
+This procedure is de-activated if yams computes a mesh for finite element with only coarsening.
+The default value is 1.3, which is the usual value set for computational meshes.</string>
+        </property>
+        <property name="text">
+         <string>Mesh Gradation: the element size variation in the triangulation.
+Yams will avoid having two adjacent edges which sizes vary more than the given gradation.</string>
         </property>
        </widget>
-      </widget>
-      <widget class="QGroupBox" name="groupBox_3">
-       <property name="geometry">
-        <rect>
-         <x>20</x>
-         <y>490</y>
-         <width>751</width>
-         <height>31</height>
-        </rect>
-       </property>
-       <property name="title">
-        <string>You can enable :</string>
-       </property>
-      </widget>
-      <widget class="QCheckBox" name="CB_SplitEdge">
-       <property name="geometry">
-        <rect>
-         <x>70</x>
-         <y>530</y>
-         <width>271</width>
-         <height>23</height>
-        </rect>
-       </property>
-       <property name="toolTip">
-        <string>if set, Yams creates new vertices placed on the curved surface and adds them to elements. 
-It means one extra vertex on edge (P2 or quadratic triangles).
-New created vertices  are saved in the .mesh file under keyword section Vertices</string>
-       </property>
-       <property name="text">
-        <string>split edge</string>
-       </property>
-       <property name="checked">
-        <bool>false</bool>
-       </property>
       </widget>
      </widget>
      <widget class="QWidget" name="generic">
@@ -936,101 +819,80 @@ New created vertices  are saved in the .mesh file under keyword section Vertices
        <property name="geometry">
         <rect>
          <x>10</x>
-         <y>30</y>
-         <width>741</width>
-         <height>131</height>
+         <y>10</y>
+         <width>750</width>
+         <height>130</height>
         </rect>
        </property>
        <property name="title">
         <string>Yams Generic Options</string>
        </property>
-       <widget class="QWidget" name="layoutWidget">
+       
+          <widget class="QSpinBox" name="SP_Verbosity">
         <property name="geometry">
          <rect>
-          <x>40</x>
+          <x>20</x>
           <y>30</y>
-          <width>441</width>
-          <height>34</height>
+          <width>100</width>
+          <height>25</height>
          </rect>
         </property>
-        <layout class="QHBoxLayout" name="horizontalLayout_3">
-         <item>
-          <widget class="QLabel" name="label">
-           <property name="text">
-            <string>Verbosity Level</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>28</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="SP_Verbosity">
            <property name="maximum">
             <number>10</number>
            </property>
            <property name="value">
-            <number>7</number>
+            <number>3</number>
            </property>
           </widget>
-         </item>
-        </layout>
-       </widget>
-       <widget class="QWidget" name="layoutWidget_2">
+       
+          <widget class="QLabel" name="label">
         <property name="geometry">
          <rect>
-          <x>40</x>
-          <y>70</y>
-          <width>441</width>
-          <height>34</height>
+          <x>130</x>
+          <y>30</y>
+          <width>600</width>
+          <height>30</height>
          </rect>
         </property>
-        <layout class="QHBoxLayout" name="horizontalLayout_4">
-         <item>
-          <widget class="QLabel" name="label_6">
-           <property name="minimumSize">
-            <size>
-             <width>225</width>
-             <height>25</height>
-            </size>
-           </property>
+        <property name="toolTip">
+         <string>sets the verbosity level.
+From 0 (no detail) to 10 (very detailed).
+Default is 3.</string>
+        </property>
            <property name="text">
-            <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
-&lt;tr&gt;
-&lt;td style=&quot;border: none;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Memory size (in Mbytes)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            <string>Verbosity level</string>
            </property>
           </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer_3">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
+       
+          <widget class="QSpinBox" name="SP_Memory">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>70</y>
+          <width>100</width>
+          <height>25</height>
+         </rect>
+        </property>
+           <property name="maximum">
+            <number>100000</number>
            </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>28</width>
-             <height>20</height>
-            </size>
+           <property name="value">
+            <number>0</number>
+           </property>
+          </widget>
+       
+          <widget class="QLabel" name="label_6">
+       <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>70</y>
+          <width>600</width>
+          <height>30</height>
+         </rect>
+        </property>
+           <property name="text">
+            <string>Memory size (in Mbytes)</string>
            </property>
-          </spacer>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="SP_Memory">
            <property name="toolTip">
             <string>The program requires roughly about 370 bytes per point. It is thus possible to estimate a priori 
 the required memory size to complete a job. As an example of memory space needed, a mesh 
@@ -1041,33 +903,25 @@ The memory needed for mesh modification is allocated dynamically at the beginnin
 memory allowed, it will stop inserting points and, if possible, the current mesh will be saved as it is, 
 valid and conformal, provided the input mesh was valid and conformal.
 Specify the memory if:
-- the automatically allocated memory reveals insufficient when the user asked to enrich the given mesh;
+- the automatically allocated memory reveals insufficient when the user asked to enrich the given mesh.
 - you want to limit the amount of memory used by the program.
 If the input mesh size requires more memory than requested or if the allocated memory (user defined or not)
 exceeds the machine capabilities, the tool will stop because of insufficient memory.</string>
            </property>
-           <property name="maximum">
-            <number>100000</number>
-           </property>
-           <property name="value">
-            <number>0</number>
-           </property>
           </widget>
-         </item>
-        </layout>
-       </widget>
+        
       </widget>
       <widget class="QGroupBox" name="groupBox_6">
        <property name="geometry">
         <rect>
          <x>10</x>
-         <y>230</y>
-         <width>741</width>
-         <height>141</height>
+         <y>150</y>
+         <width>750</width>
+         <height>170</height>
         </rect>
        </property>
        <property name="title">
-        <string>Plug-In Generic Options</string>
+        <string>Plug-in Generic Options</string>
        </property>
        <widget class="QLabel" name="label_10">
         <property name="geometry">
@@ -1079,7 +933,7 @@ exceeds the machine capabilities, the tool will stop because of insufficient mem
          </rect>
         </property>
         <property name="text">
-         <string>File used to save Yams Params :</string>
+         <string>File used to save Yams hypothesis parameters :</string>
         </property>
        </widget>
        <widget class="QPushButton" name="PB_ParamsFileExplorer">
@@ -1094,10 +948,6 @@ exceeds the machine capabilities, the tool will stop because of insufficient mem
         <property name="text">
          <string/>
         </property>
-        <property name="icon">
-         <iconset>
-          <normaloff>../../../../../../../../SalomeSrc/SMESH_V6_main/src/Tools/YamsPlug/open.png</normaloff>../../../../../../../../SalomeSrc/SMESH_V6_main/src/Tools/YamsPlug/open.png</iconset>
-        </property>
        </widget>
        <widget class="QLineEdit" name="LE_ParamsFile">
         <property name="geometry">
@@ -1109,6 +959,47 @@ exceeds the machine capabilities, the tool will stop because of insufficient mem
          </rect>
         </property>
        </widget>
+       
+      <widget class="QPushButton" name="PB_Save">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>110</y>
+          <width>70</width>
+          <height>31</height>
+         </rect>
+        </property>
+       <property name="text">
+        <string>Save</string>
+       </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+      </widget>
+
+      <widget class="QPushButton" name="PB_Load">
+        <property name="geometry">
+         <rect>
+          <x>120</x>
+          <y>110</y>
+          <width>70</width>
+          <height>31</height>
+         </rect>
+        </property>
+       <property name="text">
+        <string>Load</string>
+       </property>
+        <property name="iconSize">
+         <size>
+          <width>18</width>
+          <height>18</height>
+         </size>
+        </property>
+      </widget>
+       
       </widget>
      </widget>
     </widget>
index 32b31b1acd439f2e8ad82d597b645361b0871b12..046e688c91ff570d9b4ff84fbbf50716f4fb91e4 100644 (file)
@@ -15,7 +15,7 @@ You usually don't have to set this parameter but you can choose to limit the amo
     
 - **File** 
 
-You can change the file used to store the remeshing hypothesis. see paragraph :ref:`hypothesis-label` for further informations.
+You can change the file used to store remeshing hypotheses. see paragraph :ref:`hypothesis-label` for further informations.
 
 .. image:: images/Generic.png
    :align: center
index d32f6589d1c229db3da82e05c741f2487820f1aa..2841defc71ac18984d9908a447c202d0efe55fbc 100644 (file)
@@ -12,7 +12,7 @@ RSTFILES = lct.rst \
           Generics_params.rst \
           Advanced_params.rst
 
-EXTRA_DIST += $(RSTFILES) images
+EXTRA_DIST += $(RSTFILES) images files
 
 # You can set these variables from the command line.
 SPHINXOPTS    =
index c752c692bbe6e3762bc53ba0df0b76805cfed42b..f657c1d92221d9e3c95db325156b4d5f76a05b75 100644 (file)
@@ -61,7 +61,7 @@ This is the main remeshing Option.  Yams always does quality improvement. It is
 
    - **Mesh for finite element computation : Coarsening** 
 
-     The given surface triangulation is modfied in accordance to a size map. The latter is the intrinsic size map (computed automatically and based on the surface properties, i.e. the local curvatures). One should use this option to coarsen  the mesh, when a regular mesh  for computation purposes is desired, i.e. a mesh with good aspect ratios or good quality elements.
+     The given surface triangulation is modified in accordance to a size map. The latter is the intrinsic size map (computed automatically and based on the surface properties, i.e. the local curvatures). One should use this option to coarsen  the mesh, when a regular mesh  for computation purposes is desired, i.e. a mesh with good aspect ratios or good quality elements.
 
      It is equivalent to Yams's batch option -1.
 
index 414d8ad0da7facd967f452e1eee03f6e6908fd4e..75b8eb76ad778cb6bd0f6cb5431626bf3e815437 100644 (file)
@@ -4,17 +4,23 @@
 How to save Yams Parameters 
 ===========================
 
-As Yams hypothesis are not meshing hypothesis for Salome (but hypothesis for yams), parameters
-are stored in a special file. Default file is $HOME/.yams.dat. It is strongly recommended that you
-change this name if you want to preserve the way you obtain a mesh : This file is never cleaned.
-All sets of parameters are logged in it.
+Yams hypothesis is not meshing hypothesis for Salome, but hypothesis for yams.
+The current set of parameters is automatically written in the salome study object browser when you run computation.
 
+Theses parameters could also be stored in a special file.
+Default file is $HOME/.yams.dat.
+This ASCII file is appended, and never cleaned.
 
-- To save the current setting, click on "Save Params" pushbutton. 
-- A set of parameters is automatically written in the .yams.dat file when you run computation.  
-- Restoring the default settings can be done by pushing "Default Params". 
-- "Loading Params" will reload the last set of parameters
+In frame "Plug-in Generic Options":
 
+- To save the current setting in this file, click on "Save" pushbutton.
+- To load the last set of parameters saved, click on "Load" pushbutton.
+
+At the bottom of the dialog window:
+  
+- To save a current setting in the study object browser, click on "Save" pushbutton.
+- To load a current setting from the study object browser, click on "Load" pushbutton.
+- To load the default setting, click on "Default" pushbutton. .
 
 
 **example of .yams.dat**
@@ -22,39 +28,25 @@ All sets of parameters are logged in it.
 
 .. code-block:: python
 
-   # Save intermediate params
-   # Params for mesh :
-   Optimisation ='Quality improvement Only (0)'
-   Units ='Relative'
-   Chordal_Tolerance_Deviation=1.0
-   Ridge_Detection=True
-   Split_Edge=False
-   Point_Smoothing=True
-   Geometrical_Approximation=0.04
-   Ridge_Angle=45.0
-   Maximum_Size=-2.0
-   Minimum_Size=-2.0
-   Mesh_Gradation=1.3
-   Verbosity=3
-   Memory=0
-   
-   
-   
-   # Params for Hypothese : monHypo_Yams_0
+   # YAMS hypothesis parameters
    # Params for mesh : Mesh_1
-   Optimisation ='Quality improvement Only (0)'
-   Units ='Relative'
-   Chordal_Tolerance_Deviation=1.0
-   Ridge_Detection=True
-   Split_Edge=False
-   Point_Smoothing=True
-   Geometrical_Approximation=0.04
-   Ridge_Angle=45.0
-   Maximum_Size=-2.0
-   Minimum_Size=-2.0
-   Mesh_Gradation=1.3
+   # Date : 23/05/13 14:23:18
+   # Command : yams -v 3 -O 0 -Drelative,tolerance=0.100000,maxsize=0.010000,minsize=0.000000 /tmp/ForYams_1.mesh
+   Optimisation=Quality improvement Only (0)
+   Units=Relative
+   ChordalToleranceDeviation=0.1
+   RidgeDetection=True
+   SplitEdge=False
+   PointSmoothing=True
+   GeometricalApproximation=0.04
+   RidgeAngle=45.0
+   MaximumSize=0.01
+   MinimumSize=0.0
+   MeshGradation=1.3
    Verbosity=3
    Memory=0
+   
+
 
 
 
diff --git a/src/Tools/YamsPlug/doc/files/YamsWhitePaper_3.2.pdf b/src/Tools/YamsPlug/doc/files/YamsWhitePaper_3.2.pdf
new file mode 100644 (file)
index 0000000..f445bba
Binary files /dev/null and b/src/Tools/YamsPlug/doc/files/YamsWhitePaper_3.2.pdf differ
index bd91a1733ac43414722f3cc759219b5f97785634..eb8ee0fb0f8cb28f4a23cb8afc8f21fde0221d7d 100644 (file)
Binary files a/src/Tools/YamsPlug/doc/images/Advanced.png and b/src/Tools/YamsPlug/doc/images/Advanced.png differ
index a18b9ef65155f737a1a9bf28daf5a6cea23dfad8..d3f6fddc6c1e5e5a099093ad494818449e65118f 100644 (file)
Binary files a/src/Tools/YamsPlug/doc/images/AppelYams.png and b/src/Tools/YamsPlug/doc/images/AppelYams.png differ
index fb37ab42c8c26db0c200802be88b2e38a7d2f110..eaabb4c92c223c0d5460ae3645625ffc5ec3025d 100644 (file)
Binary files a/src/Tools/YamsPlug/doc/images/Generic.png and b/src/Tools/YamsPlug/doc/images/Generic.png differ
index 98cf1b9b9f77f7dcb7091154551fa05daa5a8a6e..63f61b4215e234cf03c48d852a6fa3d258f93ec3 100644 (file)
Binary files a/src/Tools/YamsPlug/doc/images/Simple.png and b/src/Tools/YamsPlug/doc/images/Simple.png differ
index 86404463837868ea79cccd0bcf17b8fa4e3c57aa..45442f9aec195a92fbf8259903eff19e67193089 100644 (file)
@@ -11,6 +11,8 @@ Mesh module for remeshing 2D Surface.
 Yams plug-in uses Distene commercial software Yams, which is an **automatic surface remeshing tool**.
 This plug_in offers only the most common functionnalities of the tool.
 
+.. note::
+  for a complete documentation, see :download:`Yams whitepaper <files/YamsWhitePaper_3.2.pdf>`.
 
 Contents:
 
@@ -19,8 +21,8 @@ Contents:
   
    lct.rst
    Mandatory_params.rst
-   Generics_params.rst
    Advanced_params.rst
+   Generics_params.rst
    editHypo.rst
    
    
index 6f3bc515bdf1361bf95ecbe67522be727b295a60..c264926025001748ebd83aa0bf45ad02f200d34a 100644 (file)
@@ -1,7 +1,7 @@
 Running Yams Plug-in 
 =====================
 
-Yamms plug-in can be invoked via SMESH Plugin item in Mesh menu bar 
+Yams plug-in can be invoked via SMESH Plugin item in Mesh menu bar 
 
 .. image:: images/AppelYams.png
    :align: center
index a613f5d6b893708d76e3dc7cff40155ed988c898..ce291033bc4186568c9ee5b1a289d33a889f448a 100644 (file)
@@ -1,4 +1,4 @@
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
 # Copyright (C) 2007-2013  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
@@ -28,45 +28,59 @@ from PyQt4.QtCore import *
 
 # Import des panels
 
-# ------------------------------- #
 from ViewText import Ui_ViewExe
-class MonViewText(Ui_ViewExe,QDialog):
-# ------------------------------- #
+
+class MonViewText(Ui_ViewExe, QDialog):
     """
     Classe permettant la visualisation de texte
     """
-    def __init__(self,parent,txt):
+    def __init__(self, parent, txt):
         QDialog.__init__(self,parent)
-        self.pere=parent
         self.setupUi(self)
-        self.resize( QSize(600,600).expandedTo(self.minimumSizeHint()) )
-        self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") )
+        self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
+        #self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") )
+        self.connect( self.PB_Ok,SIGNAL("clicked()"), self.theClose )
         self.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile )
         self.monExe=QProcess(self)
 
-
         self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
         self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
-        self.connect(self.monExe, SIGNAL("finished(int  )"), self.exeFinished )
       
         # Je n arrive pas a utiliser le setEnvironment du QProcess
         # fonctionne hors Salome mais pas dans Salome ???
-        LICENCE=os.environ['DISTENE_LICENCE_FILE_FOR_YAMS']
-        txt='export DISTENE_LICENSE_FILE='+LICENCE+';'+ txt
+        cmds=''
+        try :
+          LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_YAMS"]
+        except:
+          LICENCE_FILE=''
+        try :
+          PATH=os.environ["DISTENE_PATH_FOR_YAMS"]
+        except:
+          PATH=''
+        if LICENCE_FILE != '': 
+          cmds+='source '+LICENCE_FILE+'\n'
+        else:
+          cmds+="# $DISTENE_LICENCE_FILE_FOR_YAMS NOT SET\n"
+        if PATH != '': 
+          cmds+='export PATH='+PATH+':$PATH\n'
+        else:
+          cmds+="# $DISTENE_PATH_FOR_YAMS NOT SET\n"
+        #cmds+='env\n'
+        cmds+='rm -f '+self.parent().fichierOut+'\n'
+        cmds+=txt+'\n'
+        cmds+='echo END_OF_Yams\n'
         pid=self.monExe.pid()
-        nomFichier='/tmp/yam_'+str(pid)+'.py'
+        nomFichier='/tmp/Yams_'+str(pid)+'.sh'
         f=open(nomFichier,'w')
-        f.write(txt)
+        f.write(cmds)
         f.close()
 
         maBidouille='sh  ' + nomFichier
         self.monExe.start(maBidouille)
         self.monExe.closeWriteChannel()
+        self.enregistreResultatsDone=False
         self.show()
 
-    def exeFinished(self):
-        self.pere.enregistreResultat()
-        
     def saveFile(self):
         #recuperation du nom du fichier
         savedir=os.environ['HOME']
@@ -84,8 +98,19 @@ class MonViewText(Ui_ViewExe,QDialog):
 
     def readFromStdErr(self):
         a=self.monExe.readAllStandardError()
-        self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) ;
+        self.TB_Exe.append(QString.fromUtf8(a.data(),len(a)))
 
     def readFromStdOut(self) :
         a=self.monExe.readAllStandardOutput()
-        self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) ;
+        aa=QString.fromUtf8(a.data(),len(a))
+        self.TB_Exe.append(aa)
+        if "END_OF_Yams" in aa:
+          self.parent().enregistreResultat()
+          self.enregistreResultatsDone=True
+          #self.theClose()
+    
+    def theClose(self):
+      if not self.enregistreResultatsDone:
+        self.parent().enregistreResultat()
+        self.enregistreResultatsDone=True
+      self.close()
index 1e9c32fc966e03a5881149460b451c3c4b509141..d8ec10244e0363a90a57134d75ce0dcb82512d41 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2007-2013   EDF R&D
+# Copyright (C) 2007-2013  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -17,6 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
 # Modules Python
 # Modules Eficas
 
@@ -31,286 +32,496 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
   """
   """
   def __init__(self):
-        QWidget.__init__(self)
-        self.setupUi(self)
-        self.connecterSignaux()
-        self.fichierIn=""
-        self.fichierOut=""
-        self.MeshIn="" 
-        self.num=1
-
-#      Ces parametres ne sont pas remis à rien par le clean
-        self.paramsFile= os.path.abspath(os.path.join(os.environ['HOME'],'.yams.dat'))
-        self.LE_ParamsFile.setText(self.paramsFile)
-        self.LE_MeshFile.setText("")
-        self.LE_MeshSmesh.setText("")
+    QWidget.__init__(self)
+    self.setupUi(self)
+    self.connecterSignaux()
+    self.fichierIn=""
+    self.fichierOut=""
+    self.MeshIn=""
+    self.commande=""
+    self.num=1
+    self.__selectedMesh=None
+
+    # complex whith QResources: not used
+    # The icon are supposed to be located in the $SMESH_ROOT_DIR/share/salome/resources/smesh folder,
+    # other solution could be in the same folder than this python module file:
+    # iconfolder=os.path.dirname(os.path.abspath(__file__))
+
+    self.iconfolder=os.environ["SMESH_ROOT_DIR"]+"/share/salome/resources/smesh"
+    #print "monYamsPlugDialog iconfolder",iconfolder
+    icon = QIcon()
+    icon.addFile(os.path.join(self.iconfolder,"select1.png"))
+    self.PB_LoadHyp.setIcon(icon)
+    self.PB_LoadHyp.setToolTip("hypothesis from Salome Object Browser")
+    self.PB_SaveHyp.setIcon(icon)
+    self.PB_SaveHyp.setToolTip("hypothesis to Salome Object Browser")
+    self.PB_MeshSmesh.setIcon(icon)
+    self.PB_MeshSmesh.setToolTip("source mesh from Salome Object Browser")
+    icon = QIcon()
+    icon.addFile(os.path.join(self.iconfolder,"open.png"))
+    self.PB_ParamsFileExplorer.setIcon(icon)
+    self.PB_Load.setIcon(icon)
+    self.PB_Load.setToolTip("hypothesis from file")
+    self.PB_Save.setIcon(icon)
+    self.PB_Save.setToolTip("hypothesis to file")
+    self.PB_MeshFile.setIcon(icon)
+    self.PB_MeshFile.setToolTip("source mesh from a file in disk")
+
+    #Ces parametres ne sont pas remis à rien par le clean
+    self.paramsFile= os.path.abspath(os.path.join(os.environ["HOME"],".yams.dat"))
+    self.LE_ParamsFile.setText(self.paramsFile)
+    self.LE_MeshFile.setText("")
+    self.LE_MeshSmesh.setText("")
+    
+    v1=QDoubleValidator(self)
+    v1.setBottom(0.)
+    #v1.setTop(1000.) #per thousand... only if relative
+    v1.setDecimals(2)
+    self.SP_Tolerance.setValidator(v1)
+    self.SP_Tolerance.titleForWarning="Chordal Tolerance"
+    
+    self.resize(800, 600)
+    self.clean()
 
   def connecterSignaux(self) :
-        self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed)
-        self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean)
-        self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed)
-        self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed)
-        self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed)
-        self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
-        self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
-        self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed)
-        self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName)
-        self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
-        self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
-
+    self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed)
+    self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean)
+    self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed)
+    self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed)
+    
+    self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed)
+    self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
+    self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed)
+    self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed)
+    
+    self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
+    self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed)
+    self.connect(self.LE_MeshSmesh,SIGNAL("returnPressed()"),self.meshSmeshNameChanged)
+    self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName)
+    self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
+    self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
 
   def PBHelpPressed(self):
-        try :
-          maDoc=os.environ['DISTENE_YAMS_DOC_PDF']
-        except Exception:
-          QMessageBox.warning( self, "Help unavailable", str(maDoc) + " not found")
-        command="xdg-open "+maDoc+";"
-       subprocess.call(command, shell=True)
-
+    try :
+      mydir=os.environ["SMESH_ROOT_DIR"]
+    except Exception:
+      QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
+      return
+    maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/_downloads/YamsWhitePaper_3.2.pdf"
+    command="xdg-open "+maDoc+";"
+    subprocess.call(command, shell=True)
 
   def PBOKPressed(self):
-        if not(self.PrepareLigneCommande()) : return
-        self.PBSavePressed(NomHypo=True)
-        maFenetre=MonViewText(self,self.commande)
+    if not(self.PrepareLigneCommande()):
+      #warning done yet
+      #QMessageBox.warning(self, "Compute", "Command not found")
+      return
+    maFenetre=MonViewText(self,self.commande)
 
   def enregistreResultat(self):
-        if not(os.path.isfile(self.fichierOut)) : return
-        import smesh
-        import SMESH
-        import salome
-        from salome.kernel import studyedit
-
-        maStudy=studyedit.getActiveStudy()
-        smesh.SetCurrentStudy(maStudy)
-        (outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
-        meshname = 'yams'+str(self.num)
-        smesh.SetName(outputMesh.GetMesh(), meshname)
-        outputMesh.Compute()
-
-
-        self.editor = studyedit.getStudyEditor()    # 
-        moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
-        HypReMeshEntry = self.editor.findOrCreateItem( moduleEntry, name = 'HypoForRemesh',
-                                           comment = 'HypoForRemshing')
-        monStudyBuilder=maStudy.NewBuilder();
-        monStudyBuilder.NewCommand();
-        newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
-        aNameAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeName")
-        hypoName = 'monHypo_Yams_'+str(self.num)
-        aNameAttrib.SetValue(hypoName)
-        aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
-        aCommentAttrib.SetValue(str(self.commande))
-        
-        SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
-        newLink=monStudyBuilder.NewObject(SOMesh)
-        monStudyBuilder.Addreference(newLink, newStudyIter);
-        if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
-        self.num+=1
-        return True
-
-  def PBSavePressed(self,NomHypo=False):
-        if NomHypo : text = '# Params for Hypothese : monHypo_Yams_'+str(self.num - 1)+"\n"
-        else :       text = '# Save intermediate params \n' 
-        text += "# Params for mesh : " +  self.LE_MeshSmesh.text() +'\n'
-        for RB in self.GBOptim.findChildren(QRadioButton,):
-            if RB.isChecked()==True:
-               text+="Optimisation ='"+RB.text()+"'\n"
-               break
-        for RB in self.GBUnit.findChildren(QRadioButton,):
-            if RB.isChecked()==True:
-               text+="Units ='"+RB.text()+"'\n"
-        text+='Chordal_Tolerance_Deviation='+str(self.SP_Tolerance.value())+'\n'
-
-        text+='Ridge_Detection=' + str(self.CB_Ridge.isChecked())+'\n'
-        text+='Split_Edge='      + str(self.CB_SplitEdge.isChecked())+'\n'
-        text+='Point_Smoothing=' + str(self.CB_Point.isChecked())+'\n'
-        text+='Geometrical_Approximation='+ str(self.SP_Geomapp.value())  +'\n'
-        text+='Ridge_Angle='              + str(self.SP_Ridge.value())    +'\n'
-        text+='Maximum_Size='             + str(self.SP_MaxSize.value())  +'\n'
-        text+='Minimum_Size='             + str(self.SP_MaxSize.value())  +'\n'
-        text+='Mesh_Gradation='           + str(self.SP_Gradation.value())+'\n'
-
-        text+='Verbosity='                + str(self.SP_Verbosity.value())+'\n'
-        text+='Memory='                   + str(self.SP_Memory.value())+'\n'
-        text+='\n\n'
-
-        try :
-           f=open(self.paramsFile,'a')
-        except :
-           QMessageBox.warning( self, "File", "Unable to open "+self.paramsFile)
-           return
-        try :
-           f.write(text)
-        except :
-           QMessageBox.warning( self, "File", "Unable to write "+self.paramsFile)
-           return
-        f.close()
+    import salome
+    import SMESH
+    from salome.kernel import studyedit
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+    
+    if not os.path.isfile(self.fichierOut):
+      QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
+
+    maStudy=studyedit.getActiveStudy()
+    smesh.SetCurrentStudy(maStudy)
+    (outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
+    name=str(self.LE_MeshSmesh.text())
+    initialMeshFile=None
+    initialMeshObject=None
+    if name=="":
+      a=str(self.fichierIn)
+      name=os.path.basename(os.path.splitext(a)[0])
+      initialMeshFile=a
+    else:
+      initialMeshObject=maStudy.FindObjectByName(name ,"SMESH")[0]
+
+    meshname = name+"_YAMS_"+str(self.num)
+    smesh.SetName(outputMesh.GetMesh(), meshname)
+    outputMesh.Compute() #no algorithms message for "Mesh_x" has been computed with warnings: -  global 1D algorithm is missing
+
+    self.editor = studyedit.getStudyEditor()
+    moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
+    HypReMeshEntry = self.editor.findOrCreateItem(
+        moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
+    
+    monStudyBuilder=maStudy.NewBuilder()
+    monStudyBuilder.NewCommand()
+    newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
+    self.editor.setAttributeValue(newStudyIter, "AttributeName", "YAMS Parameters_"+str(self.num))
+    self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
+    
+    SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
+    
+    if initialMeshFile!=None:
+      newStudyFileName=monStudyBuilder.NewObject(SOMesh)
+      self.editor.setAttributeValue(newStudyFileName, "AttributeName", "meshFile")
+      self.editor.setAttributeValue(newStudyFileName, "AttributeExternalFileDef", initialMeshFile)
+      self.editor.setAttributeValue(newStudyFileName, "AttributeComment", initialMeshFile)
+
+    if initialMeshObject!=None:
+      newLink=monStudyBuilder.NewObject(SOMesh)
+      monStudyBuilder.Addreference(newLink, initialMeshObject)
+
+    newLink=monStudyBuilder.NewObject(SOMesh)
+    monStudyBuilder.Addreference(newLink, newStudyIter)
+
+    if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
+    self.num+=1
+    return True
+
+  def PBSavePressed(self):
+    from datetime import datetime
+    if not(self.PrepareLigneCommande()): return
+    text = "# YAMS hypothesis parameters\n" 
+    text += "# Params for mesh : " +  self.LE_MeshSmesh.text() +"\n"
+    text += datetime.now().strftime("# Date : %d/%m/%y %H:%M:%S\n")
+    text += "# Command : "+self.commande+"\n"
+    text += self.getResumeData(separator="\n")
+    text += "\n\n"
+
+    try:
+      f=open(self.paramsFile,"a")
+    except:
+      QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
+      return
+    try:
+      f.write(text)
+    except:
+      QMessageBox.warning(self, "File", "Unable to write "+self.paramsFile)
+      return
+    f.close()
+
+  def PBSaveHypPressed(self):
+    """save hypothesis in Object Browser"""
+    import salome
+    import SMESH
+    from salome.kernel import studyedit
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+
+    maStudy=studyedit.getActiveStudy()
+    smesh.SetCurrentStudy(maStudy)
+    
+    self.editor = studyedit.getStudyEditor()
+    moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
+    HypReMeshEntry = self.editor.findOrCreateItem(
+        moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
+    
+    monStudyBuilder=maStudy.NewBuilder()
+    monStudyBuilder.NewCommand()
+    newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
+    self.editor.setAttributeValue(newStudyIter, "AttributeName", "YAMS Parameters_"+str(self.num))
+    self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
+    
+    if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
+    self.num+=1
+    return True
+
+  def SP_toStr(self, widget):
+    """only for a QLineEdit widget"""
+    #cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
+    try:
+      val=float(widget.text())
+    except:
+      QMessageBox.warning(self, widget.titleForWarning, "float value is incorrect: '"+widget.text()+"'")
+      res=str(widget.validator().bottom())
+      widget.setProperty("text", res)
+      return res
+    valtest=widget.validator().bottom()
+    if valtest!=None:
+      if val<valtest:
+        QMessageBox.warning(self, widget.titleForWarning, "float value is under minimum: "+str(val)+" < "+str(valtest))
+        res=str(valtest)
+        widget.setProperty("text", res)
+        return res
+    valtest=widget.validator().top()
+    if valtest!=None:
+      if val>valtest:
+        QMessageBox.warning(self, widget.titleForWarning, "float value is over maximum: "+str(val)+" > "+str(valtest))
+        res=str(valtest)
+        widget.setProperty("text", res)
+        return res    
+    return str(val)
+
+  def getResumeData(self, separator="\n"):
+    text=""
+    for RB in self.GBOptim.findChildren(QRadioButton,):
+      if RB.isChecked()==True:
+        text+="Optimisation="+RB.text()+separator
+        break
+    if self.RB_Absolute.isChecked():
+      text+="Units=absolute"+separator
+    else:
+      text+="Units=relative"+separator
+    v=self.SP_toStr(self.SP_Tolerance)
+    text+="ChordalToleranceDeviation="+v+separator
+    text+="RidgeDetection="+str(self.CB_Ridge.isChecked())+separator
+    text+="SplitEdge="+str(self.CB_SplitEdge.isChecked())+separator
+    text+="PointSmoothing="+str(self.CB_Point.isChecked())+separator
+    text+="GeometricalApproximation="+str(self.SP_Geomapp.value())+separator
+    text+="RidgeAngle="+str(self.SP_Ridge.value())+separator
+    text+="MaximumSize="+str(self.SP_MaxSize.value())+separator
+    text+="MinimumSize="+str(self.SP_MinSize.value())+separator
+    text+="MeshGradation="+str(self.SP_Gradation.value())+separator
+    text+="Verbosity="+str(self.SP_Verbosity.value())+separator
+    text+="Memory="+str(self.SP_Memory.value())+separator
+    return str(text)
+
+  def loadResumeData(self, hypothesis, separator="\n"):
+    text=str(hypothesis)
+    self.clean()
+    for slig in reversed(text.split(separator)):
+      lig=slig.strip()
+      #print "load ResumeData",lig
+      if lig=="": continue #skip blanck lines
+      if lig[0]=="#": break
+      try:
+        tit,value=lig.split("=")
+        if tit=="Optimisation":
+          #no need: exlusives QRadioButton
+          #for RB in self.GBOptim.findChildren(QRadioButton,):
+          #  RB.setChecked(False)
+          for RB in self.GBOptim.findChildren(QRadioButton,):
+            if RB.text()==value :
+              RB.setChecked(True)
+              break
+        if tit=="Units":
+          if value=="absolute":
+            self.RB_Absolute.setChecked(True)
+            self.RB_Relative.setChecked(False)
+          else:
+            self.RB_Absolute.setChecked(False)
+            self.RB_Relative.setChecked(True)
+        if tit=="ChordalToleranceDeviation": self.SP_Tolerance.setProperty("text", float(value))
+        if tit=="RidgeDetection": self.CB_Ridge.setChecked(value=="True")
+        if tit=="SplitEdge": self.CB_SplitEdge.setChecked(value=="True")
+        if tit=="PointSmoothing": self.CB_Point.setChecked(value=="True")
+        if tit=="GeometricalApproximation": self.SP_Geomapp.setProperty("value", float(value))
+        if tit=="RidgeAngle": self.SP_Ridge.setProperty("value", float(value))
+        if tit=="MaximumSize": self.SP_MaxSize.setProperty("value", float(value))
+        if tit=="MinimumSize": self.SP_MinSize.setProperty("value", float(value))
+        if tit=="MeshGradation": self.SP_Gradation.setProperty("value", float(value))
+        if tit=="Verbosity": self.SP_Verbosity.setProperty("value", int(float(value)))
+        if tit=="Memory": self.SP_Memory.setProperty("value", float(value))
+      except:
+        QMessageBox.warning(self, "load YAMS Hypothesis", "Problem on '"+lig+"'")
 
   def PBLoadPressed(self):
-        try :
-           f=open(self.paramsFile,'r')
-        except :
-           QMessageBox.warning( self, "File", "Unable to open "+self.paramsFile)
-           return
-        try :
-           text=f.read()
-        except :
-           QMessageBox.warning( self, "File", "Unable to read "+self.paramsFile)
-           return
-        f.close()
-        d={}
-        exec text in d
-        for RB in self.GBOptim.findChildren(QRadioButton,):
-            if d['Optimisation']== RB.text():
-               RB.setChecked(True)
-               break
-        for RB in self.GBUnit.findChildren(QRadioButton,):
-            if d['Units']== RB.text():
-               RB.setChecked(True)
-               break
-        self.SP_Tolerance.setValue(d['Chordal_Tolerance_Deviation'])
-
-        self.CB_Ridge.setChecked(d['Ridge_Detection'])
-        self.CB_Point.setChecked(d['Point_Smoothing'])
-        self.CB_SplitEdge.setChecked(d['Split_Edge'])
-        self.SP_Geomapp.setValue(d['Geometrical_Approximation'])
-        self.SP_Ridge.setValue(d['Ridge_Angle'])
-        self.SP_MaxSize.setValue(d['Maximum_Size'])
-        self.SP_MinSize.setValue(d['Minimum_Size'])
-        self.SP_Gradation.setValue(d['Mesh_Gradation'])
-
-        self.SP_Verbosity.setValue(d['Verbosity'])
-        self.SP_Memory.setValue(d['Memory'])
-
-
+    """load last hypothesis saved in tail of file"""
+    try:
+      f=open(self.paramsFile,"r")
+    except:
+      QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
+      return
+    try:
+      text=f.read()
+    except:
+      QMessageBox.warning(self, "File", "Unable to read "+self.paramsFile)
+      return
+    f.close()
+    self.loadResumeData(text, separator="\n")
+
+  def PBLoadHypPressed(self):
+    """load hypothesis saved in Object Browser"""
+    #QMessageBox.warning(self, "load Object Browser YAMS hypothesis", "TODO")
+    import salome
+    from salome.kernel import studyedit
+    from salome.smesh.smeshstudytools import SMeshStudyTools
+    from salome.gui import helper as guihelper
+    from omniORB import CORBA
+
+    mySObject, myEntry = guihelper.getSObjectSelected()
+    if CORBA.is_nil(mySObject) or mySObject==None:
+      QMessageBox.critical(self, "Hypothese", "select an Object Browser YAMS hypothesis")
+      return
+    
+    text=mySObject.GetComment()
+    
+    #a verification
+    if "Optimisation=" not in text:
+      QMessageBox.critical(self, "Load Hypothese", "Object Browser selection not a YAMS Hypothesis")
+      return
+    self.loadResumeData(text, separator=" ; ")
+    return
+    
   def PBCancelPressed(self):
-        self.close()
+    self.close()
 
   def PBMeshFilePressed(self):
-       fd = QFileDialog(self, "select an existing Mesh file", self.LE_MeshFile.text(), "Mesh-Files (*.mesh);;All Files (*)")
-       if fd.exec_():
-          infile = fd.selectedFiles()[0]
-          self.LE_MeshFile.setText(infile)
-          self.fichierIn=infile.toLatin1()
+    fd = QFileDialog(self, "select an existing Mesh file", self.LE_MeshFile.text(), "Mesh-Files (*.mesh);;All Files (*)")
+    if fd.exec_():
+      infile = fd.selectedFiles()[0]
+      self.LE_MeshFile.setText(infile)
+      self.fichierIn=infile.toLatin1()
+      self.MeshIn=""
+      self.LE_MeshSmesh.setText("")
 
   def setParamsFileName(self):
-       fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
-       if fd.exec_():
-          infile = fd.selectedFiles()[0]
-          self.LE_ParamsFile.setText(infile)
-          self.paramsFile=infile.toLatin1()
-
+    fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
+    if fd.exec_():
+      infile = fd.selectedFiles()[0]
+      self.LE_ParamsFile.setText(infile)
+      self.paramsFile=infile.toLatin1()
 
   def meshFileNameChanged(self):
-      self.fichierIn=self.LE_MeshFile.text()
-      if os.path.exists(self.fichierIn): return
-      QMessageBox.warning( self, "Unknown File", "File doesn't exist")
+    self.fichierIn=str(self.LE_MeshFile.text())
+    #print "meshFileNameChanged", self.fichierIn
+    if os.path.exists(self.fichierIn): 
+      self.__selectedMesh=None
+      self.MeshIn=""
+      self.LE_MeshSmesh.setText("")
+      return
+    QMessageBox.warning(self, "Mesh file", "File doesn't exist")
+
+  def meshSmeshNameChanged(self):
+    """only change by GUI mouse selection, otherwise clear"""
+    self.__selectedMesh = None
+    self.MeshIn=""
+    self.LE_MeshSmesh.setText("")
+    self.fichierIn=""
+    return
 
   def paramsFileNameChanged(self):
-      self.paramsFile=self.LE_ParamsFile.text()
+    self.paramsFile=self.LE_ParamsFile.text()
 
   def PBMeshSmeshPressed(self):
-      import salome
-      import smesh
-      from salome.kernel import studyedit
-      from salome.smesh.smeshstudytools import SMeshStudyTools
-      from salome.gui import helper as guihelper
-      from omniORB import CORBA
-
-      mySObject, myEntry = guihelper.getSObjectSelected()
-      if CORBA.is_nil(mySObject) or mySObject==None:
-         QMessageBox.critical(self, "Mesh", "select an input mesh")
-         return
-      self.smeshStudyTool = SMeshStudyTools()
+    from omniORB import CORBA
+    import salome
+    from salome.kernel import studyedit
+    from salome.smesh.smeshstudytools import SMeshStudyTools
+    from salome.gui import helper as guihelper
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+
+    mySObject, myEntry = guihelper.getSObjectSelected()
+    if CORBA.is_nil(mySObject) or mySObject==None:
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    self.smeshStudyTool = SMeshStudyTools()
+    try:
       self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
-      if CORBA.is_nil(self.__selectedMesh):
-         QMessageBox.critical(self, "Mesh", "select an input mesh")
-         return
-      myName = mySObject.GetName()
-      self.MeshIn=myName
-      self.LE_MeshSmesh.setText(myName)
+    except:
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    if CORBA.is_nil(self.__selectedMesh):
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    myName = mySObject.GetName()
+    #print "MeshSmeshNameChanged", myName
+    self.MeshIn=myName
+    self.LE_MeshSmesh.setText(myName)
+    self.LE_MeshFile.setText("")
+    self.fichierIn=""
 
   def prepareFichier(self):
-      self.fichierIn="/tmp/PourYam_"+str(self.num)+".mesh"
-      import SMESH
-      self.__selectedMesh.ExportGMF(self.__selectedMesh,self.fichierIn, True)
+    self.fichierIn="/tmp/ForYams_"+str(self.num)+".mesh"
+    self.__selectedMesh.ExportGMF(self.__selectedMesh, self.fichierIn, True)
 
   def PrepareLigneCommande(self):
-      self.commande="yams "
-      verbosity=str(self.SP_Verbosity.value())
-      self.commande+="-v "+verbosity
-      for obj in self.mesRB.children():
-          try :
-           if obj.isChecked():
-              self.style=obj.objectName().remove(0,3)
-              self.style.replace("_","-")
-              break
-          except :
-              pass
-      self.commande+=" -O "+self.style.toLatin1()
-      if self.fichierIn=="" and self.MeshIn=="" :
-         QMessageBox.critical(self, "Mesh", "select an input mesh")
-         return False
-      if self.MeshIn!="" : self.prepareFichier()
-      if not (os.path.isfile(self.fichierIn)):
-         QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
-         return False
-
-      deb=os.path.splitext(self.fichierIn)
-      self.fichierOut=deb[0]+'.d.meshb'
-
-      if self.RB_Absolute.isChecked()==True :
-         self.commande+=' -Dabsolute'
-      else :
-         self.commande+=' -Drelative'
-      self.commande+=',tolerance=%f'%self.SP_Tolerance.value()
-      if self.CB_Ridge.isChecked()==False : self.commande+=',-nr'
-      if self.CB_Point.isChecked()==False : self.commande+=',-ns'
-      if self.SP_Geomapp.value()!=0.04 : self.commande+=',geomapp=%f'%self.SP_Geomapp.value()
-      if self.SP_Ridge.value()!=45.0 : self.commande+=',ridge=%f'%self.SP_Ridge.value()
-      if self.SP_MaxSize.value()!=100 : self.commande+=',maxsize=%f'%self.SP_MaxSize.value()
-      if self.SP_MinSize.value()!=5 : self.commande+=',minsize=%f'%self.SP_MinSize.value()
-      if self.SP_Gradation.value()!=1.3 : self.commande+=',gradation=%f'%self.SP_MaxSize.value()
-      if self.CB_SplitEdge.isChecked()==True : self.commande+=',splitedge=1'
-
-      if self.SP_Verbosity.value()!=3 : self.commande+=' -v %d'%self.SP_Verbosity.value()
-      if self.SP_Memory.value()!=0 : self.commande+=' -m %d'%self.SP_Memory.value()
-
-      self.commande+=" "+self.fichierIn
-      return True
+    if self.fichierIn=="" and self.MeshIn=="":
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return False
+    if self.__selectedMesh!=None: self.prepareFichier()
+    if not (os.path.isfile(self.fichierIn)):
+      QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
+      return False
+    
+    self.commande="yams"
+    verbosity=str(self.SP_Verbosity.value())
+    self.commande+=" -v "+verbosity
+    for obj in self.GBOptim.findChildren(QRadioButton,):
+      try:
+        if obj.isChecked():
+          self.style=obj.objectName().remove(0,3)
+          self.style.replace("_","-")
+          break
+      except:
+        pass
+    self.commande+=" -O "+self.style.toLatin1()
+
+    deb=os.path.splitext(self.fichierIn)
+    self.fichierOut=deb[0] + ".d.meshb"
+
+    if self.RB_Absolute.isChecked()==True :
+        self.commande+=" -Dabsolute"
+    else :
+        self.commande+=" -Drelative"
+    
+    v=self.SP_toStr(self.SP_Tolerance)
+    self.commande+=",tolerance="+v
+    if self.CB_Ridge.isChecked()==False : self.commande+=",-nr"
+    if self.CB_Point.isChecked()==False : self.commande+=",-ns"
+    if self.SP_Geomapp.value()!=0.04 : self.commande+=",geomapp=%f"%self.SP_Geomapp.value()
+    if self.SP_Ridge.value()!=45.0 : self.commande+=",ridge=%f"%self.SP_Ridge.value()
+    if self.SP_MaxSize.value()!=100 : self.commande+=",maxsize=%f"%self.SP_MaxSize.value()
+    if self.SP_MinSize.value()!=5 : self.commande+=",minsize=%f"%self.SP_MinSize.value()
+    if self.SP_Gradation.value()!=1.3 : self.commande+=",gradation=%f"%self.SP_MaxSize.value()
+    if self.CB_SplitEdge.isChecked()==True : self.commande+=",splitedge=1"
+
+    if self.SP_Verbosity.value()!=3 : self.commande+=" -v %d"%self.SP_Verbosity.value()
+    if self.SP_Memory.value()!=0 : self.commande+=" -m %d"%self.SP_Memory.value()
+
+    self.commande+=" "+self.fichierIn
+    return True
 
   def clean(self):
-        self.RB_0.setChecked(True)
-        self.RB_G.setChecked(False)
-        self.RB_U.setChecked(False)
-        self.RB_S.setChecked(False)
-        self.RB_2.setChecked(False)
-        self.RB_1.setChecked(False)
-        self.RB_Absolute.setChecked(False)
-        self.RB_Relative.setChecked(True)
-        self.SP_Tolerance.setProperty("value", 0.1)
-        self.SP_Geomapp.setProperty("value", 0.04)
-        self.SP_Ridge.setProperty("value", 45.0)
-        self.SP_Gradation.setProperty("value", 1.3)
-        self.CB_Ridge.setChecked(True)
-        self.CB_Point.setChecked(True)
-        self.CB_SplitEdge.setChecked(False)
-        self.SP_MaxSize.setProperty("value", -2.0)
-        self.SP_MinSize.setProperty("value", -2.0)
-        self.SP_Verbosity.setProperty("value", 3)
-        self.SP_Memory.setProperty("value", 0)
-
+    self.RB_0.setChecked(True)
+    #no need: exlusives QRadioButton
+    #self.RB_G.setChecked(False)
+    #self.RB_U.setChecked(False)
+    #self.RB_S.setChecked(False)
+    #self.RB_2.setChecked(False)
+    #self.RB_1.setChecked(False)
+    self.RB_Relative.setChecked(True)
+    #no need: exlusives QRadioButton
+    #self.RB_Absolute.setChecked(False)
+    self.SP_Tolerance.setProperty("text", "10.")
+    self.SP_Geomapp.setProperty("value", 0.04)
+    self.SP_Ridge.setProperty("value", 45.0)
+    self.SP_Gradation.setProperty("value", 1.3)
+    self.CB_Ridge.setChecked(True)
+    self.CB_Point.setChecked(True)
+    self.CB_SplitEdge.setChecked(False)
+    self.SP_MaxSize.setProperty("value", -2.0)
+    self.SP_MinSize.setProperty("value", -2.0)
+    self.SP_Verbosity.setProperty("value", 3)
+    self.SP_Memory.setProperty("value", 0)
 
 __dialog=None
 def getDialog():
-    """
-    This function returns a singleton instance of the plugin dialog.
-    c est obligatoire pour faire un show sans parent...
-    """
-    global __dialog
-    if __dialog is None:
-        __dialog = MonYamsPlugDialog()
-    #else :
-    #   __dialog.clean()
-    return __dialog
+  """
+  This function returns a singleton instance of the plugin dialog.
+  c est obligatoire pour faire un show sans parent...
+  """
+  global __dialog
+  if __dialog is None:
+    __dialog = MonYamsPlugDialog()
+  #else :
+  #   __dialog.clean()
+  return __dialog
 
+#
+# ==============================================================================
+# Basic use cases and unit test functions
+# ==============================================================================
+#
+def TEST_MonYamsPlugDialog():
+  import sys
+  from PyQt4.QtGui import QApplication
+  from PyQt4.QtCore import QObject, SIGNAL, SLOT
+  app = QApplication(sys.argv)
+  QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+
+  dlg=MonYamsPlugDialog()
+  dlg.show()
+  sys.exit(app.exec_())
+
+if __name__ == "__main__":
+  TEST_MonYamsPlugDialog()
+  pass
diff --git a/src/Tools/YamsPlug/open.png b/src/Tools/YamsPlug/open.png
new file mode 100644 (file)
index 0000000..8ed143e
Binary files /dev/null and b/src/Tools/YamsPlug/open.png differ
index cc7a7c130f52f6a145a7371ce11909baeeba46f8..f61ed050f9225cff5fc8008d22243c83baf2d227 100644 (file)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2006-2013  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
@@ -34,11 +35,12 @@ def YamsLct(context):
   from PyQt4.QtGui import QFileDialog
   from PyQt4.QtGui import QMessageBox
   
+  #prior test to avoid unnecessary user GUI work with ending crash
   try :
       os.environ['DISTENE_LICENCE_FILE_FOR_YAMS']
   except:
-      QMessageBox.warning(None,"Products","Distene's products are not installed")
+      QMessageBox.warning(None,"Products","Distene's product Yams is not installed.\nrequired environment variable:\nDISTENE_LICENCE_FILE_FOR_YAMS='/.../dlim8.var.sh'")
       return
   import monYamsPlugDialog
-  window=monYamsPlugDialog.getDialog() 
+  window=monYamsPlugDialog.getDialog()
   window.show()
index 9c41e101accfd8c9317c8d6b443dddb4f316e5e5..21a227997ace3079634793a5756de49ed1308880 100644 (file)
@@ -156,7 +156,7 @@ installation process of the SALOME plateform, on the basis of the
 environment variable PADDERHOME that localizes the installation root
 of the SpherePadder external program. This installation process
 creates a configuration file padder.cfg located in the folder
-<SMESH_ROOT_DIR>/share/salome/plugins/smesh, where <SMESH_ROOT_DIR> is
+\<SMESH_ROOT_DIR\>/share/salome/plugins/smesh, where \<SMESH_ROOT_DIR\> is
 the installation root directory of the SMESH module.
 
 In the case where you have to specify a different configuration than
@@ -262,7 +262,7 @@ ssh-copy-id -i ~/.ssh/id_rsa.pub <username>@<hostname>
 \endcode
 
 You can check the configuration by testing that you can connect to the
-host <hostname> with the login <username> without being asked a
+host \<hostname\> with the login \<username\> without being asked a
 password:
 
 \code 
index cd3e8b540cfee918f95a76f935e1243fe493d867..c72666449c7497264d28cb4c9d690f797855e96c 100644 (file)
@@ -71,7 +71,7 @@ libSPADDERPluginTesterEngine_la_LIBADD = \
 # For testing SMESH
 #
 libSPADDERPluginTesterEngine_la_CXXFLAGS += \
-       @GEOM_CXXFLAGS@ @MED_CXXFLAGS@ \
+       @GEOM_CXXFLAGS@ \
        -I$(top_builddir)/idl \
        -I$(top_srcdir)/src/SMESH \
        -I$(top_srcdir)/src/SMESH_I \
index 328c42022d1edb182b6a99f50827b077573ae51a..83565540c93b3f42a2fef05332b052f911f41b61 100644 (file)
@@ -100,6 +100,7 @@ bool SPADDERPluginTester_i::testkernel()
   beginService("SPADDERPluginTester_i::testplugin");
 
   Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
+  salomeLauncher = NULL;
 
   endService("SPADDERPluginTester_i::testplugin");
   return true;
index 1702f09cd912fcee89955269207c736f33eee317..e61dd16a73cd504e5b79f60a561c7acd57833bb6 100644 (file)
@@ -24,6 +24,7 @@ import salome_pluginsmanager
 from spadderPlugin import runSpadderPlugin
 from meshcut_plugin import MeshCut
 from yamsplug_plugin import YamsLct
+from MGCleanerplug_plugin import MGCleanerLct
 
 salome_pluginsmanager.AddFunction('PADDER mesher',
                                   'Create a mesh with PADDER',
@@ -36,3 +37,8 @@ salome_pluginsmanager.AddFunction('MeshCut',
 salome_pluginsmanager.AddFunction('ReMesh with Yams',
                                   'Run Yams',
                                   YamsLct)
+
+salome_pluginsmanager.AddFunction('ReMesh with MGCleaner',
+                                  'Run MGCleaner',
+                                  MGCleanerLct)
+