Salome HOME
SALOME PAL V1_4_1 Base_Ecole_Ete PAL_SALOME_1_4_1
authorsmh <smh@opencascade.com>
Mon, 5 Apr 2004 14:29:26 +0000 (14:29 +0000)
committersmh <smh@opencascade.com>
Mon, 5 Apr 2004 14:29:26 +0000 (14:29 +0000)
131 files changed:
idl/SMESH_Filter.idl [new file with mode: 0644]
idl/SMESH_Group.idl [new file with mode: 0644]
idl/SMESH_NetgenAlgorithm.idl [new file with mode: 0644]
resources/SMESH.config [new file with mode: 0644]
resources/SMESH_Meshers.xml [new file with mode: 0644]
resources/SMESH_MeshersWithNETGEN.xml [new file with mode: 0644]
resources/StdMeshers.xml [new file with mode: 0644]
resources/mesh_edit_group.png [new file with mode: 0644]
resources/mesh_free_edges.png [new file with mode: 0755]
resources/mesh_make_group.png [new file with mode: 0644]
resources/mesh_multi_edges.png [new file with mode: 0755]
resources/mesh_points.png [new file with mode: 0644]
resources/mesh_tree_group.png [new file with mode: 0644]
resources/mesh_tree_importedmesh.png [new file with mode: 0644]
src/Controls/Makefile.in [new file with mode: 0644]
src/Controls/SMESHControls.cxx [new file with mode: 0644]
src/Controls/SMESH_Controls.cxx [new file with mode: 0644]
src/Controls/SMESH_Controls.hxx [new file with mode: 0644]
src/Driver/Driver_Document.cxx [new file with mode: 0644]
src/Driver/Driver_Document.h [new file with mode: 0644]
src/Driver/Driver_Mesh.cxx [new file with mode: 0644]
src/Driver/Driver_Mesh.h [new file with mode: 0644]
src/Driver/Driver_SMDS_Mesh.cxx [new file with mode: 0644]
src/Driver/Driver_SMDS_Mesh.h [new file with mode: 0644]
src/Driver/Driver_SMESHDS_Mesh.cxx [new file with mode: 0644]
src/Driver/Driver_SMESHDS_Mesh.h [new file with mode: 0644]
src/DriverDAT/DAT_Test.cxx [new file with mode: 0644]
src/DriverMED/DriverMED_Family.cxx [new file with mode: 0644]
src/DriverMED/DriverMED_Family.h [new file with mode: 0644]
src/DriverMED/MED_Test.cxx [new file with mode: 0644]
src/DriverUNV/UNV2411_Structure.cxx [new file with mode: 0644]
src/DriverUNV/UNV2411_Structure.hxx [new file with mode: 0644]
src/DriverUNV/UNV2412_Structure.cxx [new file with mode: 0644]
src/DriverUNV/UNV2412_Structure.hxx [new file with mode: 0644]
src/DriverUNV/UNV_Test.cxx [new file with mode: 0644]
src/DriverUNV/UNV_Utilities.cxx [new file with mode: 0644]
src/DriverUNV/UNV_Utilities.hxx [new file with mode: 0644]
src/NETGENPlugin/Makefile.in [new file with mode: 0644]
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx [new file with mode: 0644]
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx [new file with mode: 0644]
src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx [new file with mode: 0644]
src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx [new file with mode: 0644]
src/NETGENPlugin/NETGENPlugin_i.cxx [new file with mode: 0644]
src/NETGENPlugin/NETGENPlugin_icons.po [new file with mode: 0644]
src/OBJECT/SMESH_DeviceActor.cxx [new file with mode: 0644]
src/OBJECT/SMESH_DeviceActor.h [new file with mode: 0644]
src/OBJECT/SMESH_Object.cxx [new file with mode: 0644]
src/OBJECT/SMESH_Object.h [new file with mode: 0644]
src/SMESH/SMESH_Group.cxx [new file with mode: 0644]
src/SMESH/SMESH_Group.hxx [new file with mode: 0644]
src/SMESHDS/SMESHDS_Group.cxx [new file with mode: 0644]
src/SMESHDS/SMESHDS_Group.hxx [new file with mode: 0644]
src/SMESHGUI/SMESHBin.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_Filter.cxx [new file with mode: 0755]
src/SMESHGUI/SMESHGUI_Filter.h [new file with mode: 0755]
src/SMESHGUI/SMESHGUI_FilterDlg.cxx [new file with mode: 0755]
src/SMESHGUI/SMESHGUI_FilterDlg.h [new file with mode: 0755]
src/SMESHGUI/SMESHGUI_GroupDlg.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_GroupDlg.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_Hypotheses.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_XmlHandler.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_XmlHandler.h [new file with mode: 0644]
src/SMESH_I/SMESHEngine.cxx [new file with mode: 0644]
src/SMESH_I/SMESH_Filter_i.cxx [new file with mode: 0644]
src/SMESH_I/SMESH_Filter_i.hxx [new file with mode: 0644]
src/SMESH_I/SMESH_Group_i.cxx [new file with mode: 0644]
src/SMESH_I/SMESH_Group_i.hxx [new file with mode: 0644]
src/SMESH_SWIG/SMESH_controls.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_freebord.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_test4.py [new file with mode: 0755]
src/SMESH_SWIG/SMESH_test5.py [new file with mode: 0644]
src/SMESH_SWIG/batchmode_mefisto.py [new file with mode: 0644]
src/StdMeshers/Makefile.in [new file with mode: 0644]
src/StdMeshers/StdMeshers_Hexa_3D.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Hexa_3D.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_LengthFromEdges.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_LengthFromEdges.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_LocalLength.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_LocalLength.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_MEFISTO_2D.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_MaxElementArea.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_MaxElementArea.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_MaxElementVolume.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_MaxElementVolume.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_NotConformAllowed.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_NotConformAllowed.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_NumberOfSegments.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_NumberOfSegments.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Quadrangle_2D.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Regular_1D.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Regular_1D.hxx [new file with mode: 0644]
src/StdMeshersGUI/Makefile.in [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_LocalLengthDlg.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_LocalLengthDlg.h [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_MaxElementAreaDlg.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_MaxElementAreaDlg.h [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_MaxElementVolumeDlg.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_MaxElementVolumeDlg.h [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsDlg.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsDlg.h [new file with mode: 0644]
src/StdMeshersGUI/StdMeshers_icons.po [new file with mode: 0644]
src/StdMeshersGUI/StdMeshers_msg_en.po [new file with mode: 0644]
src/StdMeshers_I/Makefile.in [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_LocalLength_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_LocalLength_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_i.cxx [new file with mode: 0644]

diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl
new file mode 100644 (file)
index 0000000..e0a5d77
--- /dev/null
@@ -0,0 +1,110 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+//  This library is free software; you can redistribute it and/or \r
+//  modify it under the terms of the GNU Lesser General Public \r
+//  License as published by the Free Software Foundation; either \r
+//  version 2.1 of the License. \r
+// \r
+//  This library is distributed in the hope that it will be useful, \r
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
+//  Lesser General Public License for more details. \r
+// \r
+//  You should have received a copy of the GNU Lesser General Public \r
+//  License along with this library; if not, write to the Free Software \r
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
+// \r
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+//  File   : SMESH_Filter.idl\r
+//  Author : Alexey Petrov, OCC\r
+\r
+#ifndef _SMESH_FILTER_IDL_\r
+#define _SMESH_FILTER_IDL_\r
+\r
+#include "SALOME_Exception.idl"\r
+#include "SALOME_GenericObj.idl"\r
+#include "SMESH_Mesh.idl"\r
+\r
+module SMESH{\r
+\r
+  interface Functor: SALOME::GenericObj{\r
+    void SetMesh(in SMESH_Mesh theMesh);\r
+  };\r
+\r
+  interface NumericalFunctor: Functor{\r
+    double GetValue(in long theElementId);\r
+  };\r
+\r
+  interface MinimumAngle: NumericalFunctor{};\r
+  interface AspectRatio: NumericalFunctor{};\r
+  interface Warping: NumericalFunctor{};\r
+  interface Taper: NumericalFunctor{};\r
+  interface Skew: NumericalFunctor{};\r
+  interface Area: NumericalFunctor{};\r
+  interface Length: NumericalFunctor{};\r
+  interface MultiConnection: NumericalFunctor{};\r
+\r
+  interface Predicate: Functor{\r
+    boolean IsSatisfy(in long thEntityId);\r
+  };\r
+\r
+  interface FreeBorders: Predicate{};\r
+\r
+  interface Comparator: Predicate{\r
+    void SetMargin(in double theValue);\r
+    void SetNumFunctor(in NumericalFunctor theFunct);\r
+  };\r
+\r
+  interface LessThan: Comparator{};\r
+  interface MoreThan: Comparator{};\r
+  interface EqualTo: Comparator{\r
+    void SetTolerance(in double theTolerance );\r
+  };\r
+\r
+  interface Logical: Predicate{};\r
+\r
+  interface LogicalNOT: Logical{\r
+    void SetPredicate(in Predicate thePredicate);\r
+  };\r
+\r
+  interface LogicalBinary: Logical{\r
+    void SetPredicate1(in Predicate thePredicate);\r
+    void SetPredicate2(in Predicate thePredicate);\r
+  };\r
+  \r
+  interface LogicalAND: LogicalBinary{};\r
+  interface LogicalOR: LogicalBinary{};\r
+  interface Filter: SALOME::GenericObj{\r
+    void SetPredicate( in Predicate thePredicate );\r
+    long_array GetElementsId( in SMESH_Mesh theMesh );\r
+  };\r
+\r
+  interface FilterManager: SALOME::GenericObj{\r
+    MinimumAngle CreateMinimumAngle();\r
+    AspectRatio CreateAspectRatio();\r
+    Warping CreateWarping();\r
+    Taper CreateTaper();\r
+    Skew CreateSkew();\r
+    Area CreateArea();\r
+    Length CreateLength();\r
+    MultiConnection CreateMultiConnection();\r
+\r
+    FreeBorders CreateFreeBorders();\r
+\r
+    LessThan CreateLessThan();\r
+    MoreThan CreateMoreThan();\r
+    EqualTo CreateEqualTo();\r
+    \r
+    LogicalNOT CreateLogicalNOT();\r
+    LogicalAND CreateLogicalAND();\r
+    LogicalOR CreateLogicalOR();\r
+    Filter CreateFilter();\r
+  };\r
+  \r
+};\r
+\r
+#endif\r
diff --git a/idl/SMESH_Group.idl b/idl/SMESH_Group.idl
new file mode 100644 (file)
index 0000000..9842df2
--- /dev/null
@@ -0,0 +1,103 @@
+//  Copyright (C) 2004  CEA 
+// 
+//  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.org 
+//
+//
+//
+//  File   : SMESH_Group.idl
+//  Author : Sergey ANIKIN, OCC
+//  $Header$
+
+#ifndef _SMESH_GROUP_IDL_
+#define _SMESH_GROUP_IDL_
+
+#include "SALOME_Exception.idl"
+#include "SALOME_GenericObj.idl"
+
+#include "SMESH_Mesh.idl"
+
+module SMESH
+{
+  /*!
+   * SMESH_Group: interface of group object
+   */
+  interface SMESH_Group : SALOME::GenericObj
+  {
+    /*!
+     * Sets group name
+     */
+    void SetName( in string name );
+
+    /*!
+     * Returns group name
+     */
+    string GetName();
+
+    /*!
+     * Returns group type (type of elements in the group)
+     */
+    ElementType GetType();
+
+    /*!
+     * Returns the number of elements in the group
+     */
+    long Size();
+
+    /*!
+     * Returns true if the group does not contain any elements
+     */
+    boolean IsEmpty();
+
+    /*!
+     * Clears the group's contents
+     */
+    void Clear();
+
+    /*!
+     * returns true if the group contains an element with ID == <elem_id> 
+     */
+    boolean Contains( in long elem_id );
+
+    /*!
+     * Adds elements to the group
+     */
+    long Add( in long_array elem_ids );
+
+    /*!
+     * Returns ID of an element at position <elem_index>
+     */
+    long GetID( in long elem_index );
+
+    /*!
+     * Returns a sequence of all element IDs in the group
+     */
+    long_array GetListOfID();
+
+    /*!
+     * Removes elements from the group
+     */
+    long Remove( in long_array elem_ids );
+
+    /*!
+     * Returns the mesh object this group belongs to
+     */
+    SMESH_Mesh GetMesh();
+  }; 
+};
+
+
+#endif
diff --git a/idl/SMESH_NetgenAlgorithm.idl b/idl/SMESH_NetgenAlgorithm.idl
new file mode 100644 (file)
index 0000000..afe23ad
--- /dev/null
@@ -0,0 +1,45 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_NetgenAlgorithm.idl
+//  Author : Julia DOROVSKIKH
+//  $Header$
+
+#ifndef _SMESH_NETGENALGORITHM_IDL_
+#define _SMESH_NETGENALGORITHM_IDL_
+
+#include "SMESH_Hypothesis.idl"
+
+/*!
+ * NETGENPlugin: interfaces to NETGEN related hypotheses and algorithms
+ */
+module NETGENPlugin
+{
+  /*!
+   * NETGENPlugin_NETGEN_3D: interface of "Tetrahedron (Netgen)" algorithm
+   */
+  interface NETGENPlugin_NETGEN_3D : SMESH::SMESH_3D_Algo
+  {
+  };
+
+};
+
+#endif
diff --git a/resources/SMESH.config b/resources/SMESH.config
new file mode 100644 (file)
index 0000000..ec67557
--- /dev/null
@@ -0,0 +1,2 @@
+language=en
+resources=StdMeshers:NETGENPlugin
\ No newline at end of file
diff --git a/resources/SMESH_Meshers.xml b/resources/SMESH_Meshers.xml
new file mode 100644 (file)
index 0000000..49aae9d
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
+
+<!--  GUI customization for MESH component  -->
+
+<meshers>
+
+<meshers-group name="Standard Meshers"
+               resources="StdMeshers"
+               server-lib="libStdMeshersEngine.so"
+              gui-lib="libStdMeshersGUI.so">
+  <hypotheses>
+
+    <hypothesis type="LocalLength"
+               label-id="Average length"
+               icon-id="mesh_hypo_length.png"/>
+
+    <hypothesis type="LengthFromEdges"
+               label-id="Length From Edges (2D Hyp. for Triangulator)"
+               icon-id="mesh_hypo_length.png"/>
+
+    <hypothesis type="NumberOfSegments"
+               label-id="Nb. Segments"
+               icon-id="mesh_hypo_segment.png"/>
+
+    <hypothesis type="MaxElementArea"
+               label-id="Max. Triangle Area"
+               icon-id="mesh_hypo_area.png"/>
+
+    <hypothesis type="MaxElementVolume"
+               label-id="Max. Hexahedron or Tetrahedron Volume"
+               icon-id="mesh_hypo_volume.png"/>
+
+    <hypothesis type="NotConformAllowed"
+               label-id="Not Conform Mesh Allowed"
+               icon-id="mesh_hypo_length.png"/>
+  </hypotheses>
+
+  <algorithms>
+
+    <algorithm type="Regular_1D"
+              label-id="Wire discretisation"
+              icon-id="mesh_algo_regular.png"/>
+
+    <algorithm type="MEFISTO_2D"
+              label-id="Triangle (Mefisto)"
+              icon-id="mesh_algo_mefisto.png"/>
+
+    <algorithm type="Quadrangle_2D"
+               label-id="Quadrangle (Mapping)"
+               icon-id="mesh_algo_quad.png"/>
+
+    <algorithm type="Hexa_3D"
+               label-id="Hexahedron (i,j,k)"
+               icon-id="mesh_algo_hexa.png"/>
+  </algorithms>
+</meshers-group>
+
+<meshers-group name="Your Meshers Group"
+               resources=""
+               server-lib=""
+               gui-lib="">
+  <hypotheses>
+
+    <hypothesis type=""
+                label-id=""
+                icon-id=""/>
+  </hypotheses>
+
+  <algorithms>
+
+    <algorithm type=""
+               label-id=""
+               icon-id=""/>
+  </algorithms>
+</meshers-group>
+
+</meshers>
diff --git a/resources/SMESH_MeshersWithNETGEN.xml b/resources/SMESH_MeshersWithNETGEN.xml
new file mode 100644 (file)
index 0000000..2952c92
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
+
+<!--  GUI customization for MESH component  -->
+
+<meshers>
+
+<meshers-group name="Standard Meshers"
+               resources="StdMeshers"
+               server-lib="libStdMeshersEngine.so"
+              gui-lib="libStdMeshersGUI.so">
+  <hypotheses>
+
+    <hypothesis type="LocalLength"
+               label-id="Average length"
+               icon-id="mesh_hypo_length.png"/>
+
+    <hypothesis type="LengthFromEdges"
+               label-id="Length From Edges (2D Hyp. for Triangulator)"
+               icon-id="mesh_hypo_length.png"/>
+
+    <hypothesis type="NumberOfSegments"
+               label-id="Nb. Segments"
+               icon-id="mesh_hypo_segment.png"/>
+
+    <hypothesis type="MaxElementArea"
+               label-id="Max. Triangle Area"
+               icon-id="mesh_hypo_area.png"/>
+
+    <hypothesis type="MaxElementVolume"
+               label-id="Max. Hexahedron or Tetrahedron Volume"
+               icon-id="mesh_hypo_volume.png"/>
+
+    <hypothesis type="NotConformAllowed"
+               label-id="Not Conform Mesh Allowed"
+               icon-id="mesh_hypo_length.png"/>
+  </hypotheses>
+
+  <algorithms>
+
+    <algorithm type="Regular_1D"
+              label-id="Wire discretisation"
+              icon-id="mesh_algo_regular.png"/>
+
+    <algorithm type="MEFISTO_2D"
+              label-id="Triangle (Mefisto)"
+              icon-id="mesh_algo_mefisto.png"/>
+
+    <algorithm type="Quadrangle_2D"
+               label-id="Quadrangle (Mapping)"
+               icon-id="mesh_algo_quad.png"/>
+
+    <algorithm type="Hexa_3D"
+               label-id="Hexahedron (i,j,k)"
+               icon-id="mesh_algo_hexa.png"/>
+  </algorithms>
+</meshers-group>
+
+<meshers-group name="NETGEN"
+               resources="NETGENPlugin"
+               server-lib="libNETGENEngine.so"
+               gui-lib="">
+  <algorithms>
+    <algorithm type="NETGEN_3D"
+               label-id="Tetrahedron (Netgen)"
+               icon-id="mesh_algo_tetra.png"/>
+  </algorithms>
+</meshers-group>
+
+<meshers-group name="Your Meshers Group"
+               resources=""
+               server-lib=""
+               gui-lib="">
+  <hypotheses>
+
+    <hypothesis type=""
+                label-id=""
+                icon-id=""/>
+  </hypotheses>
+
+  <algorithms>
+
+    <algorithm type=""
+               label-id=""
+               icon-id=""/>
+  </algorithms>
+</meshers-group>
+
+</meshers>
diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml
new file mode 100644 (file)
index 0000000..49aae9d
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
+
+<!--  GUI customization for MESH component  -->
+
+<meshers>
+
+<meshers-group name="Standard Meshers"
+               resources="StdMeshers"
+               server-lib="libStdMeshersEngine.so"
+              gui-lib="libStdMeshersGUI.so">
+  <hypotheses>
+
+    <hypothesis type="LocalLength"
+               label-id="Average length"
+               icon-id="mesh_hypo_length.png"/>
+
+    <hypothesis type="LengthFromEdges"
+               label-id="Length From Edges (2D Hyp. for Triangulator)"
+               icon-id="mesh_hypo_length.png"/>
+
+    <hypothesis type="NumberOfSegments"
+               label-id="Nb. Segments"
+               icon-id="mesh_hypo_segment.png"/>
+
+    <hypothesis type="MaxElementArea"
+               label-id="Max. Triangle Area"
+               icon-id="mesh_hypo_area.png"/>
+
+    <hypothesis type="MaxElementVolume"
+               label-id="Max. Hexahedron or Tetrahedron Volume"
+               icon-id="mesh_hypo_volume.png"/>
+
+    <hypothesis type="NotConformAllowed"
+               label-id="Not Conform Mesh Allowed"
+               icon-id="mesh_hypo_length.png"/>
+  </hypotheses>
+
+  <algorithms>
+
+    <algorithm type="Regular_1D"
+              label-id="Wire discretisation"
+              icon-id="mesh_algo_regular.png"/>
+
+    <algorithm type="MEFISTO_2D"
+              label-id="Triangle (Mefisto)"
+              icon-id="mesh_algo_mefisto.png"/>
+
+    <algorithm type="Quadrangle_2D"
+               label-id="Quadrangle (Mapping)"
+               icon-id="mesh_algo_quad.png"/>
+
+    <algorithm type="Hexa_3D"
+               label-id="Hexahedron (i,j,k)"
+               icon-id="mesh_algo_hexa.png"/>
+  </algorithms>
+</meshers-group>
+
+<meshers-group name="Your Meshers Group"
+               resources=""
+               server-lib=""
+               gui-lib="">
+  <hypotheses>
+
+    <hypothesis type=""
+                label-id=""
+                icon-id=""/>
+  </hypotheses>
+
+  <algorithms>
+
+    <algorithm type=""
+               label-id=""
+               icon-id=""/>
+  </algorithms>
+</meshers-group>
+
+</meshers>
diff --git a/resources/mesh_edit_group.png b/resources/mesh_edit_group.png
new file mode 100644 (file)
index 0000000..4747a66
Binary files /dev/null and b/resources/mesh_edit_group.png differ
diff --git a/resources/mesh_free_edges.png b/resources/mesh_free_edges.png
new file mode 100755 (executable)
index 0000000..5813e11
Binary files /dev/null and b/resources/mesh_free_edges.png differ
diff --git a/resources/mesh_make_group.png b/resources/mesh_make_group.png
new file mode 100644 (file)
index 0000000..19ba2e6
Binary files /dev/null and b/resources/mesh_make_group.png differ
diff --git a/resources/mesh_multi_edges.png b/resources/mesh_multi_edges.png
new file mode 100755 (executable)
index 0000000..0a36db1
Binary files /dev/null and b/resources/mesh_multi_edges.png differ
diff --git a/resources/mesh_points.png b/resources/mesh_points.png
new file mode 100644 (file)
index 0000000..f0d2c78
Binary files /dev/null and b/resources/mesh_points.png differ
diff --git a/resources/mesh_tree_group.png b/resources/mesh_tree_group.png
new file mode 100644 (file)
index 0000000..cfcfc68
Binary files /dev/null and b/resources/mesh_tree_group.png differ
diff --git a/resources/mesh_tree_importedmesh.png b/resources/mesh_tree_importedmesh.png
new file mode 100644 (file)
index 0000000..0c37d0a
Binary files /dev/null and b/resources/mesh_tree_importedmesh.png differ
diff --git a/src/Controls/Makefile.in b/src/Controls/Makefile.in
new file mode 100644 (file)
index 0000000..32bf839
--- /dev/null
@@ -0,0 +1,50 @@
+#  SMESH OBJECT : interactive object for SMESH visualization
+#
+#  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : Makefile.in
+#  Module : SMESH
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
+
+@COMMENCE@
+
+EXPORT_HEADERS = SMESH_Controls.hxx
+
+
+# Libraries targets
+
+LIB = libSMESHControls.la
+LIB_SRC = SMESH_Controls.cxx
+
+# Executables targets
+BIN = SMESHControls
+BIN_SRC        = 
+
+CPPFLAGS+=$(OCC_INCLUDES) $(BOOST_CPPFLAGS)
+
+LDFLAGS+=$(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSMDS 
+
+@CONCLUDE@
diff --git a/src/Controls/SMESHControls.cxx b/src/Controls/SMESHControls.cxx
new file mode 100644 (file)
index 0000000..b66297e
--- /dev/null
@@ -0,0 +1,42 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "SMESH_Controls.hxx"
+
+int main(int argc, char** argv)
+{
+  using namespace SMESH::Controls;
+  new MinimumAngle();
+  new AspectRatio();
+  new Warping();
+  new Taper();
+  new Skew();
+  new Area();
+  new Length();
+  new MultiConnection();
+  new FreeBorders();
+  new LessThan();
+  new MoreThan();
+  new EqualTo();
+  new LogicalNOT();
+  new LogicalAND();
+  new LogicalOR();
+
+  return 1;
+}
diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx
new file mode 100644 (file)
index 0000000..06bfd53
--- /dev/null
@@ -0,0 +1,774 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include <set>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_XYZ.hxx>
+#include <Precision.hxx>
+#include <TColgp_SequenceOfXYZ.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include "SMDS_Mesh.hxx"
+#include "SMDS_Iterator.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+
+#include "SMESH_Controls.hxx"
+
+/*
+                            AUXILIARY METHODS 
+*/
+
+static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+{
+  return gp_Vec( P1 - P2 ).Angle( gp_Vec( P3 - P2 ) );
+}
+
+static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+{
+  gp_Vec aVec1( P2 - P1 );
+  gp_Vec aVec2( P3 - P1 );
+  return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
+}
+
+static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+{
+  return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+}
+
+static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
+{
+  double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
+  return aDist;
+}
+
+static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
+{
+  if ( theMesh == 0 )
+    return 0;
+
+  const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
+  if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
+    return 0;
+
+  TColStd_MapOfInteger aMap;
+
+  int aResult = 0;
+  SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+  if ( anIter != 0 )
+  {
+    while( anIter->more() )
+    {
+      const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+      if ( aNode == 0 )
+        return 0;
+      SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+      while( anElemIter->more() )
+      {
+        const SMDS_MeshElement* anElem = anElemIter->next();
+        if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge )
+        {
+          int anId = anElem->GetID();
+
+          if ( anIter->more() )              // i.e. first node
+            aMap.Add( anId );
+          else if ( aMap.Contains( anId ) )
+            aResult++;
+        }
+      }
+    }
+  }
+
+  return aResult;
+}
+
+
+using namespace SMESH::Controls;
+
+/*
+                                FUNCTORS
+*/
+
+/*
+  Class       : NumericalFunctor
+  Description : Base class for numerical functors
+*/
+NumericalFunctor::NumericalFunctor():
+  myMesh(NULL)
+{}
+
+void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
+{
+  myMesh = theMesh;
+}
+
+bool NumericalFunctor::getPoints( const int theId,
+                                                  TColgp_SequenceOfXYZ& theRes ) const
+{
+  theRes.Clear();
+
+  if ( myMesh == 0 )
+    return false;
+
+  // Get nodes of the face
+  const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+  if ( anElem == 0 || anElem->GetType() != GetType() )
+    return false;
+
+  int nbNodes = anElem->NbNodes();
+
+  SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+  if ( anIter != 0 )
+  {
+    while( anIter->more() )
+    {
+      const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+      if ( aNode != 0 )
+        theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+    }
+  }
+
+  return true;
+}
+
+
+/*
+  Class       : MinimumAngle
+  Description : Functor for calculation of minimum angle
+*/
+double MinimumAngle::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  double aMin;
+
+  if ( P.Length() == 3 )
+  {
+    double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
+    double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
+    double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) );
+
+    aMin = Min( A0, Min( A1, A2 ) );
+  }
+  else
+  {
+    double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
+    double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
+    double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) );
+    double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) );
+    
+    aMin = Min( Min( A0, A1 ), Min( A2, A3 ) );
+  }
+  
+  return aMin * 180 / PI;
+}
+
+SMDSAbs_ElementType MinimumAngle::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+
+/*
+  Class       : AspectRatio
+  Description : Functor for calculating aspect ratio
+*/
+double AspectRatio::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  int nbNodes = P.Length();
+
+  // Compute lengths of the sides
+
+  double aLen[ nbNodes ];
+  for ( int i = 0; i < nbNodes - 1; i++ )
+    aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) );
+  aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) );
+
+  // Compute aspect ratio
+
+  if ( nbNodes == 3 ) 
+  {
+    double aMaxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
+    double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
+    static double aCoef = sqrt( 3. ) / 4;
+
+    return anArea != 0 ? aCoef * aMaxLen * aMaxLen / anArea : 0;
+  }
+  else
+  {
+    double aMaxLen = Max( Max( aLen[ 0 ], aLen[ 1 ] ), Max( aLen[ 2 ], aLen[ 3 ] ) );
+    double aMinLen = Min( Min( aLen[ 0 ], aLen[ 1 ] ), Min( aLen[ 2 ], aLen[ 3 ] ) );
+    
+    return aMinLen != 0 ? aMaxLen / aMinLen : 0;
+  }
+}
+
+SMDSAbs_ElementType AspectRatio::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+
+/*
+  Class       : Warping
+  Description : Functor for calculating warping
+*/
+double Warping::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P ) || P.Length() != 4 )
+    return 0;
+
+  gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
+
+  double A1 = ComputeA( P( 1 ), P( 2 ), P( 3 ), G );
+  double A2 = ComputeA( P( 2 ), P( 3 ), P( 4 ), G );
+  double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
+  double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );
+
+  return Max( Max( A1, A2 ), Max( A3, A4 ) );
+}
+
+double Warping::ComputeA( const gp_XYZ& thePnt1,
+                                          const gp_XYZ& thePnt2,
+                                          const gp_XYZ& thePnt3,
+                                          const gp_XYZ& theG ) const
+{
+  double aLen1 = gp_Pnt( thePnt1 ).Distance( gp_Pnt( thePnt2 ) );
+  double aLen2 = gp_Pnt( thePnt2 ).Distance( gp_Pnt( thePnt3 ) );
+  double L = Min( aLen1, aLen2 ) * 0.5;
+
+  gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
+  gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
+  gp_XYZ N  = GI.Crossed( GJ );
+  N.Normalize();
+
+  double H = gp_Vec( thePnt2 - theG ).Dot( gp_Vec( N ) );
+  return asin( fabs( H / L ) ) * 180 / PI;
+}
+
+SMDSAbs_ElementType Warping::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+
+/*
+  Class       : Taper
+  Description : Functor for calculating taper
+*/
+double Taper::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P ) || P.Length() != 4 )
+    return 0;
+
+  // Compute taper
+  double J1 = getArea( P( 4 ), P( 1 ), P( 2 ) ) / 2;
+  double J2 = getArea( P( 3 ), P( 1 ), P( 2 ) ) / 2;
+  double J3 = getArea( P( 2 ), P( 3 ), P( 4 ) ) / 2;
+  double J4 = getArea( P( 3 ), P( 4 ), P( 1 ) ) / 2;
+
+  double JA = 0.25 * ( J1 + J2 + J3 + J4 );
+
+  double T1 = fabs( ( J1 - JA ) / JA );
+  double T2 = fabs( ( J2 - JA ) / JA );
+  double T3 = fabs( ( J3 - JA ) / JA );
+  double T4 = fabs( ( J4 - JA ) / JA );
+
+  return Max( Max( T1, T2 ), Max( T3, T4 ) );
+}
+
+SMDSAbs_ElementType Taper::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+
+/*
+  Class       : Skew
+  Description : Functor for calculating skew in degrees
+*/
+static inline double skewAngle( const gp_XYZ& p1, const gp_XYZ& p2, const gp_XYZ& p3 )
+{
+  gp_XYZ p12 = ( p2 + p1 ) / 2;
+  gp_XYZ p23 = ( p3 + p2 ) / 2;
+  gp_XYZ p31 = ( p3 + p1 ) / 2;
+
+  return gp_Vec( p31 - p2 ).Angle( p12 - p23 );
+}
+
+double Skew::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  // Compute skew
+  static double PI2 = PI / 2;
+  if ( P.Length() == 3 )
+  {
+    double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
+    double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
+    double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) );
+
+    return Max( A0, Max( A1, A2 ) ) * 180 / PI;
+  }
+  else 
+  {
+    gp_XYZ p12 = ( P( 1 ) + P( 2 ) ) / 2;
+    gp_XYZ p23 = ( P( 2 ) + P( 3 ) ) / 2;
+    gp_XYZ p34 = ( P( 3 ) + P( 4 ) ) / 2;
+    gp_XYZ p41 = ( P( 4 ) + P( 1 ) ) / 2;
+    
+    double A = fabs( PI2 - gp_Vec( p34 - p12 ).Angle( p23 - p41 ) );
+
+    return A * 180 / PI;
+  }
+}
+
+SMDSAbs_ElementType Skew::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+
+/*
+  Class       : Area
+  Description : Functor for calculating area
+*/
+double Area::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  if ( P.Length() == 3 )
+    return getArea( P( 1 ), P( 2 ), P( 3 ) );
+  else
+    return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
+}
+
+SMDSAbs_ElementType Area::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+
+/*
+  Class       : Length
+  Description : Functor for calculating length off edge
+*/
+double Length::GetValue( long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  return getPoints( theId, P ) && P.Length() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0;
+}
+
+SMDSAbs_ElementType Length::GetType() const
+{
+  return SMDSAbs_Edge;
+}
+
+
+/*
+  Class       : MultiConnection
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+double MultiConnection::GetValue( long theId )
+{
+  return getNbMultiConnection( myMesh, theId );
+}
+
+SMDSAbs_ElementType MultiConnection::GetType() const
+{
+  return SMDSAbs_Edge;
+}
+
+
+/*
+                            PREDICATES
+*/
+
+/*
+  Class       : FreeBorders
+  Description : Predicate for free borders
+*/
+
+FreeBorders::FreeBorders()
+{
+  myMesh = 0;
+}
+
+void FreeBorders::SetMesh( SMDS_Mesh* theMesh )
+{
+  myMesh = theMesh;
+}
+
+bool FreeBorders::IsSatisfy( long theId )
+{
+  return getNbMultiConnection( myMesh, theId ) == 1;
+}
+
+SMDSAbs_ElementType FreeBorders::GetType() const
+{
+  return SMDSAbs_Edge;
+}
+
+
+/*
+  Class       : FreeEdges
+  Description : Predicate for free Edges
+*/
+FreeEdges::FreeEdges()
+{
+  myMesh = 0;
+}
+
+void FreeEdges::SetMesh( SMDS_Mesh* theMesh )
+{
+  myMesh = theMesh;
+}
+
+bool FreeEdges::IsSatisfy( long theId )
+{
+  return getNbMultiConnection( myMesh, theId ) == 1;
+}
+
+SMDSAbs_ElementType FreeEdges::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+FreeEdges::Border::Border(long thePntId1, long thePntId2){
+  PntId[0] = thePntId1;  PntId[1] = thePntId2;
+  if(thePntId1 > thePntId2){
+    PntId[1] = thePntId1;  PntId[0] = thePntId2;
+  }
+}
+
+//bool operator<(const FreeEdges::Border& x, const FreeEdges::Border& y){
+//  if(x.PntId[0] < y.PntId[0]) return true;
+//  if(x.PntId[0] == y.PntId[0])
+//    if(x.PntId[1] < y.PntId[1]) return true;
+//  return false;
+//}
+
+namespace SMESH{
+  namespace Controls{
+    struct EdgeBorder: public FreeEdges::Border{
+      long ElemId;
+      EdgeBorder(long theElemId, long thePntId1, long thePntId2):
+       FreeEdges::Border(thePntId1,thePntId2), 
+       ElemId(theElemId)
+      {}
+    };
+    
+    bool operator<(const FreeEdges::Border& x, const FreeEdges::Border& y){
+      if(x.PntId[0] < y.PntId[0]) return true;
+      if(x.PntId[0] == y.PntId[0])
+       if(x.PntId[1] < y.PntId[1]) return true;
+      return false;
+    }
+
+    typedef std::set<EdgeBorder> EdgeBorderS;
+
+    inline void UpdateBorders(const EdgeBorder& theBorder,
+                             EdgeBorderS& theRegistry, 
+                             EdgeBorderS& theContainer)
+    {
+      if(theRegistry.find(theBorder) == theRegistry.end()){
+       theRegistry.insert(theBorder);
+       theContainer.insert(theBorder);
+      }else{
+       theContainer.erase(theBorder);
+      }
+    }
+
+  }
+}
+
+void FreeEdges::GetBoreders(Borders& theBorders)
+{
+  EdgeBorderS aRegistry;
+  EdgeBorderS aContainer;
+  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+  for(; anIter->more(); ){
+    const SMDS_MeshFace* anElem = anIter->next();
+    long anElemId = anElem->GetID();
+    SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+    long aNodeId[2];
+    const SMDS_MeshElement* aNode;
+    if(aNodesIter->more()){
+      aNode = aNodesIter->next();
+      aNodeId[0] = aNodeId[1] = aNode->GetID();
+    }  
+    for(; aNodesIter->more(); ){
+      aNode = aNodesIter->next();
+      EdgeBorder aBorder(anElemId,aNodeId[1],aNode->GetID());
+      aNodeId[1] = aNode->GetID();
+      //std::cout<<aBorder.PntId[0]<<"; "<<aBorder.PntId[1]<<"; "<<aBorder.ElemId<<"\n";
+      UpdateBorders(aBorder,aRegistry,aContainer);
+    }
+    EdgeBorder aBorder(anElemId,aNodeId[0],aNodeId[1]);
+    UpdateBorders(aBorder,aRegistry,aContainer);
+  }
+  //std::cout<<"aContainer.size() = "<<aContainer.size()<<"\n";
+  if(aContainer.size()){
+    EdgeBorderS::const_iterator anIter = aContainer.begin();
+    for(; anIter != aContainer.end(); anIter++){
+      const EdgeBorder& aBorder = *anIter;
+      //std::cout<<aBorder.PntId[0]<<"; "<<aBorder.PntId[1]<<"; "<<aBorder.ElemId<<"\n";
+      theBorders.insert(Borders::value_type(aBorder.ElemId,aBorder));
+    }
+  }
+}
+
+
+/*
+  Class       : Comparator
+  Description : Base class for comparators
+*/
+Comparator::Comparator():
+  myMargin(0)
+{}
+
+Comparator::~Comparator()
+{}
+
+void Comparator::SetMesh( SMDS_Mesh* theMesh )
+{
+  if ( myFunctor )
+    myFunctor->SetMesh( theMesh );
+}
+
+void Comparator::SetMargin( double theValue )
+{
+  myMargin = theValue;
+}
+
+void Comparator::SetNumFunctor( NumericalFunctorPtr theFunct )
+{
+  myFunctor = theFunct;
+}
+
+SMDSAbs_ElementType Comparator::GetType() const
+{
+  return myFunctor ? myFunctor->GetType() : SMDSAbs_All;
+}
+
+
+/*
+  Class       : LessThan
+  Description : Comparator "<"
+*/
+bool LessThan::IsSatisfy( long theId )
+{
+  return myFunctor && myFunctor->GetValue( theId ) < myMargin;
+}
+
+
+/*
+  Class       : MoreThan
+  Description : Comparator ">"
+*/
+bool MoreThan::IsSatisfy( long theId )
+{
+  return myFunctor && myFunctor->GetValue( theId ) > myMargin;
+}
+
+
+/*
+  Class       : EqualTo
+  Description : Comparator "="
+*/
+EqualTo::EqualTo():
+  myToler(Precision::Confusion())
+{}
+
+bool EqualTo::IsSatisfy( long theId )
+{
+  return myFunctor && fabs( myFunctor->GetValue( theId ) - myMargin ) < myToler;
+}
+
+void EqualTo::SetTolerance( double theToler )
+{
+  myToler = theToler;
+}
+
+
+/*
+  Class       : LogicalNOT
+  Description : Logical NOT predicate
+*/
+LogicalNOT::LogicalNOT()
+{}
+
+LogicalNOT::~LogicalNOT()
+{}
+
+bool LogicalNOT::IsSatisfy( long theId )
+{
+  return myPredicate && !myPredicate->IsSatisfy( theId );
+}
+
+void LogicalNOT::SetMesh( SMDS_Mesh* theMesh )
+{
+  if ( myPredicate )
+    myPredicate->SetMesh( theMesh );
+}
+
+void LogicalNOT::SetPredicate( PredicatePtr thePred )
+{
+  myPredicate = thePred;
+}
+
+SMDSAbs_ElementType LogicalNOT::GetType() const
+{
+  return myPredicate ? myPredicate->GetType() : SMDSAbs_All;
+}
+
+
+/*
+  Class       : LogicalBinary
+  Description : Base class for binary logical predicate
+*/
+LogicalBinary::LogicalBinary()
+{}
+
+LogicalBinary::~LogicalBinary()
+{}
+
+void LogicalBinary::SetMesh( SMDS_Mesh* theMesh )
+{
+  if ( myPredicate1 )
+    myPredicate1->SetMesh( theMesh );
+
+  if ( myPredicate2 )
+    myPredicate2->SetMesh( theMesh );
+}
+
+void LogicalBinary::SetPredicate1( PredicatePtr thePredicate )
+{
+  myPredicate1 = thePredicate;
+}
+
+void LogicalBinary::SetPredicate2( PredicatePtr thePredicate )
+{
+  myPredicate2 = thePredicate;
+}
+
+SMDSAbs_ElementType LogicalBinary::GetType() const
+{
+  if ( !myPredicate1 || !myPredicate2 )
+    return SMDSAbs_All;
+
+  SMDSAbs_ElementType aType1 = myPredicate1->GetType();
+  SMDSAbs_ElementType aType2 = myPredicate2->GetType();
+
+  return aType1 == aType2 ? aType1 : SMDSAbs_All;
+}
+
+
+/*
+  Class       : LogicalAND
+  Description : Logical AND
+*/
+bool LogicalAND::IsSatisfy( long theId )
+{
+  return 
+    myPredicate1 && 
+    myPredicate2 && 
+    myPredicate1->IsSatisfy( theId ) && 
+    myPredicate2->IsSatisfy( theId );
+}
+
+
+/*
+  Class       : LogicalOR
+  Description : Logical OR
+*/
+bool LogicalOR::IsSatisfy( long theId )
+{
+  return 
+    myPredicate1 && 
+    myPredicate2 && 
+    myPredicate1->IsSatisfy( theId ) || 
+    myPredicate2->IsSatisfy( theId );
+}
+
+
+/*
+                              FILTER
+*/
+
+Filter::Filter()
+{}
+
+Filter::~Filter()
+{}
+
+void Filter::SetPredicate( PredicatePtr thePredicate )
+{
+  myPredicate = thePredicate;
+}
+
+Filter::TIdSequence
+Filter::GetElementsId( SMDS_Mesh* theMesh )
+{
+  TIdSequence aSequence;
+  if ( !theMesh || !myPredicate ) return aSequence;
+
+  myPredicate->SetMesh( theMesh );
+
+  SMDSAbs_ElementType aType = myPredicate->GetType();
+  switch(aType){
+  case SMDSAbs_Edge:{
+    SMDS_EdgeIteratorPtr anIter = theMesh->edgesIterator();
+    if ( anIter != 0 ) {
+      while( anIter->more() ) {
+       const SMDS_MeshElement* anElem = anIter->next();
+       long anId = anElem->GetID();
+       if ( myPredicate->IsSatisfy( anId ) )
+         aSequence.push_back( anId );
+      }
+    }
+  }
+  case SMDSAbs_Face:{
+    SMDS_FaceIteratorPtr anIter = theMesh->facesIterator();
+    if ( anIter != 0 ) {
+      while( anIter->more() ) {
+       const SMDS_MeshElement* anElem = anIter->next();
+       long anId = anElem->GetID();
+       if ( myPredicate->IsSatisfy( anId ) )
+         aSequence.push_back( anId );
+      }
+    }
+  }
+  }
+  return aSequence;
+}
diff --git a/src/Controls/SMESH_Controls.hxx b/src/Controls/SMESH_Controls.hxx
new file mode 100644 (file)
index 0000000..1c771eb
--- /dev/null
@@ -0,0 +1,340 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _SMESH_CONTROLS_HXX_
+#define _SMESH_CONTROLS_HXX_
+
+#include <map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include "SMDSAbs_ElementType.hxx"
+
+class SMDS_Mesh;
+class gp_Pnt;
+class gp_XYZ;
+class TColgp_SequenceOfXYZ;
+
+namespace SMESH{
+  namespace Controls{
+    class Functor{
+    public:
+      ~Functor(){}
+      virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
+    };
+    typedef boost::shared_ptr<Functor> FunctorPtr;
+
+    class NumericalFunctor: public virtual Functor{
+    public:
+      NumericalFunctor();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual double GetValue( long theElementId ) = 0;
+      virtual SMDSAbs_ElementType GetType() const = 0;
+      
+    protected:
+      bool getPoints( const int theId, 
+                     TColgp_SequenceOfXYZ& theRes ) const;
+    protected:
+      SMDS_Mesh* myMesh;
+    };
+    typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr;
+  
+  
+    /*
+      Class       : SMESH_MinimumAngle
+      Description : Functor for calculation of minimum angle
+    */
+    class MinimumAngle: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : AspectRatio
+      Description : Functor for calculating aspect ratio
+    */
+    class AspectRatio: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : Warping
+      Description : Functor for calculating warping
+    */
+    class Warping: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+      
+    private:
+      double ComputeA( const gp_XYZ&, const gp_XYZ&, 
+                      const gp_XYZ&, const gp_XYZ& ) const;
+    };
+  
+  
+    /*
+      Class       : Taper
+      Description : Functor for calculating taper
+    */
+    class Taper: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+    
+  
+    /*
+      Class       : Skew
+      Description : Functor for calculating skew in degrees
+    */
+    class Skew: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+    
+    /*
+      Class       : Area
+      Description : Functor for calculating area
+    */
+    class Area: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : Length
+      Description : Functor for calculating length of edge
+    */
+    class Length: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+  
+  
+    /*
+      Class       : MultiConnection
+      Description : Functor for calculating number of faces conneted to the edge
+    */
+    class MultiConnection: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+    };
+    
+  
+    /*
+      PREDICATES
+    */
+    /*
+      Class       : Predicate
+      Description : Base class for all predicates
+    */
+    class Predicate: public virtual Functor{
+    public:
+      virtual bool IsSatisfy( long theElementId ) = 0;
+      virtual SMDSAbs_ElementType GetType() const = 0;
+    };
+    typedef boost::shared_ptr<Predicate> PredicatePtr;
+    
+  
+  
+    /*
+      Class       : FreeBorders
+      Description : Predicate for free borders
+    */
+    class FreeBorders: public virtual Predicate{
+    public:
+      FreeBorders();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual bool IsSatisfy( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+            
+    protected:
+      SMDS_Mesh* myMesh;
+    };
+   
+
+    /*
+      Class       : FreeEdges
+      Description : Predicate for free Edges
+    */
+    class FreeEdges: public virtual Predicate{
+    public:
+      FreeEdges();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual bool IsSatisfy( long theElementId );
+      virtual SMDSAbs_ElementType GetType() const;
+      struct Border{
+       long PntId[2];
+       Border(long thePntId1, long thePntId2);
+      };
+      typedef long TElemId;
+      typedef std::map<TElemId,Border> Borders;
+      void GetBoreders(Borders& theBorders);
+      
+    protected:
+      SMDS_Mesh* myMesh;
+    };
+    typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
+   
+    
+    /*
+      Class       : Comparator
+      Description : Base class for comparators
+    */
+    class Comparator: public virtual Predicate{
+    public:
+      Comparator();
+      virtual ~Comparator();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetMargin(double theValue);
+      virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
+      virtual bool IsSatisfy( long theElementId ) = 0;
+      virtual SMDSAbs_ElementType GetType() const;
+  
+    protected:
+      double myMargin;
+      NumericalFunctorPtr myFunctor;
+    };
+    typedef boost::shared_ptr<Comparator> ComparatorPtr;
+  
+  
+    /*
+      Class       : LessThan
+      Description : Comparator "<"
+    */
+    class LessThan: public virtual Comparator{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : MoreThan
+      Description : Comparator ">"
+    */
+    class MoreThan: public virtual Comparator{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : EqualTo
+      Description : Comparator "="
+    */
+    class EqualTo: public virtual Comparator{
+    public:
+      EqualTo();
+      virtual bool IsSatisfy( long theElementId );
+      virtual void SetTolerance( double theTol );
+  
+    private:
+      double myToler;
+    };
+    typedef boost::shared_ptr<EqualTo> EqualToPtr;
+  
+    
+    /*
+      Class       : LogicalNOT
+      Description : Logical NOT predicate
+    */
+    class LogicalNOT: public virtual Predicate{
+    public:
+      LogicalNOT();
+      virtual ~LogicalNOT();
+      virtual bool IsSatisfy( long theElementId );
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetPredicate(PredicatePtr thePred);
+      virtual SMDSAbs_ElementType GetType() const;
+  
+    private:
+      PredicatePtr myPredicate;
+    };
+    typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
+    
+  
+    /*
+      Class       : LogicalBinary
+      Description : Base class for binary logical predicate
+    */
+    class LogicalBinary: public virtual Predicate{
+    public:
+      LogicalBinary();
+      virtual ~LogicalBinary();
+      virtual void SetMesh( SMDS_Mesh* theMesh );
+      virtual void SetPredicate1(PredicatePtr thePred);
+      virtual void SetPredicate2(PredicatePtr thePred);
+      virtual SMDSAbs_ElementType GetType() const;
+  
+    protected:
+      PredicatePtr myPredicate1;
+      PredicatePtr myPredicate2;
+    };
+    typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
+  
+  
+    /*
+      Class       : LogicalAND
+      Description : Logical AND
+    */
+    class LogicalAND: public virtual LogicalBinary{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      Class       : LogicalOR
+      Description : Logical OR
+    */
+    class LogicalOR: public virtual LogicalBinary{
+    public:
+      virtual bool IsSatisfy( long theElementId );
+    };
+  
+  
+    /*
+      FILTER
+    */
+    class Filter{
+    public:
+      Filter();
+      virtual ~Filter();
+      virtual void SetPredicate(PredicatePtr thePred);
+      typedef std::vector<long> TIdSequence;
+      virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
+  
+    protected:
+      PredicatePtr myPredicate;
+    };
+  };  
+};
+
+
+#endif
diff --git a/src/Driver/Driver_Document.cxx b/src/Driver/Driver_Document.cxx
new file mode 100644 (file)
index 0000000..159c1a8
--- /dev/null
@@ -0,0 +1,36 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "Driver_Document.h"
+
+Driver_Document::Driver_Document():
+  myDocument(NULL)
+{}
+
+
+void Driver_Document::SetFile(const std::string& theFileName)
+{
+  myFile = theFileName;
+}
+
+
+void Driver_Document::SetDocument(SMESHDS_Document * theDocument)
+{
+  myDocument = theDocument;
+}
diff --git a/src/Driver/Driver_Document.h b/src/Driver/Driver_Document.h
new file mode 100644 (file)
index 0000000..8d4ff5a
--- /dev/null
@@ -0,0 +1,44 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _INCLUDE_DRIVER_DOCUMENT
+#define _INCLUDE_DRIVER_DOCUMENT
+
+#include <string>
+
+class SMESHDS_Document;
+
+class Driver_Document
+{
+ public:
+  Driver_Document();
+  virtual ~Driver_Document(){}
+
+  virtual void Perform() = 0;
+  void SetFile(const std::string& theFileName);
+  void SetDocument(SMESHDS_Document *theDocument);
+
+ protected:
+  SMESHDS_Document * myDocument;
+  std::string myFile;
+
+};
+
+
+#endif
diff --git a/src/Driver/Driver_Mesh.cxx b/src/Driver/Driver_Mesh.cxx
new file mode 100644 (file)
index 0000000..f656bdd
--- /dev/null
@@ -0,0 +1,46 @@
+//  SMESH Driver : implementaion of driver for reading and writing     
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : Mesh_Reader.cxx
+//  Module : SMESH
+
+#include "Driver_Mesh.h"
+
+using namespace std;
+
+Driver_Mesh::Driver_Mesh():
+  myFile(""),
+  myMeshId(-1)
+{}
+
+
+void Driver_Mesh::SetMeshId(int theMeshId)
+{
+  myMeshId = theMeshId;
+}
+
+
+void Driver_Mesh::SetFile(const std::string& theFileName)
+{
+  myFile = theFileName;
+}
diff --git a/src/Driver/Driver_Mesh.h b/src/Driver/Driver_Mesh.h
new file mode 100644 (file)
index 0000000..0bfac0c
--- /dev/null
@@ -0,0 +1,57 @@
+//  SMESH Driver : implementaion of driver for reading and writing  
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : Mesh_Reader.h
+//  Module : SMESH
+
+#ifndef _INCLUDE_DRIVER_MESH
+#define _INCLUDE_DRIVER_MESH
+
+#include <string>
+
+class Driver_Mesh
+{
+ public:
+  Driver_Mesh();
+  virtual ~Driver_Mesh(){}
+
+  enum Status {
+    DRS_OK,
+    DRS_EMPTY,          // a file contains no mesh with the given name
+    DRS_WARN_RENUMBER,  // a file has overlapped ranges of element numbers,
+                        // so the numbers from the file are ignored
+    DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
+    DRS_FAIL            // general failure (exception etc.)
+  };
+
+  virtual Status Perform() = 0;
+  void SetMeshId(int theMeshId);
+  void SetFile(const std::string& theFileName);
+
+ protected:
+  std::string myFile;
+  int myMeshId;
+
+};
+
+#endif
diff --git a/src/Driver/Driver_SMDS_Mesh.cxx b/src/Driver/Driver_SMDS_Mesh.cxx
new file mode 100644 (file)
index 0000000..dae030d
--- /dev/null
@@ -0,0 +1,31 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "Driver_SMDS_Mesh.h"
+
+using namespace std;
+
+Driver_SMDS_Mesh::Driver_SMDS_Mesh():
+  myMesh(NULL)
+{}
+
+void Driver_SMDS_Mesh::SetMesh(SMDS_Mesh *theMesh)
+{
+  myMesh = theMesh;
+}
diff --git a/src/Driver/Driver_SMDS_Mesh.h b/src/Driver/Driver_SMDS_Mesh.h
new file mode 100644 (file)
index 0000000..1ea3756
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _INCLUDE_DRIVER_SMDS_MESH
+#define _INCLUDE_DRIVER_SMDS_MESH
+
+#include "Driver_Mesh.h"
+
+class SMDS_Mesh;
+
+class Driver_SMDS_Mesh: public Driver_Mesh
+{
+ public:
+  Driver_SMDS_Mesh();
+  void SetMesh(SMDS_Mesh *theMesh);
+  
+ protected:
+  SMDS_Mesh *myMesh;
+
+};
+
+#endif
diff --git a/src/Driver/Driver_SMESHDS_Mesh.cxx b/src/Driver/Driver_SMESHDS_Mesh.cxx
new file mode 100644 (file)
index 0000000..2bf8827
--- /dev/null
@@ -0,0 +1,31 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "Driver_SMESHDS_Mesh.h"
+
+using namespace std;
+
+Driver_SMESHDS_Mesh::Driver_SMESHDS_Mesh():
+  myMesh(NULL)
+{}
+
+void Driver_SMESHDS_Mesh::SetMesh(SMESHDS_Mesh *theMesh)
+{
+  myMesh = theMesh;
+}
diff --git a/src/Driver/Driver_SMESHDS_Mesh.h b/src/Driver/Driver_SMESHDS_Mesh.h
new file mode 100644 (file)
index 0000000..b401dbd
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef _INCLUDE_DRIVER_SMESHDS_MESH
+#define _INCLUDE_DRIVER_SMESHDS_MESH
+
+#include "Driver_Mesh.h"
+
+class SMESHDS_Mesh;
+
+class Driver_SMESHDS_Mesh: public Driver_Mesh
+{
+ public:
+  Driver_SMESHDS_Mesh();
+  void SetMesh(SMESHDS_Mesh *theMesh);
+  
+ protected:
+  SMESHDS_Mesh *myMesh;
+
+};
+
+#endif
diff --git a/src/DriverDAT/DAT_Test.cxx b/src/DriverDAT/DAT_Test.cxx
new file mode 100644 (file)
index 0000000..a36b4dd
--- /dev/null
@@ -0,0 +1,28 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "DriverDAT_R_SMDS_Mesh.h"
+#include "DriverDAT_W_SMDS_Mesh.h"
+
+int main(int argc, char** argv)
+{
+  DriverDAT_R_SMDS_Mesh aR;
+  DriverDAT_W_SMDS_Mesh aW;
+  return 1;
+}
diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx
new file mode 100644 (file)
index 0000000..ee1123c
--- /dev/null
@@ -0,0 +1,367 @@
+//  SMESH DriverMED : tool to split groups on families
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : DriverMED_Family.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+#include "DriverMED_Family.h"
+#include <sstream>     
+
+//=============================================================================
+/*!
+ *  Split each group from list <aGroups> on some parts (families)
+ *  on the basis of the elements membership in other groups from this list.
+ *  Resulting families have no common elements.
+ */
+//=============================================================================
+list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
+                         (const map <int, SMESHDS_SubMesh*>& theSubMeshes,
+                          const list<SMESHDS_Group*>& theGroups,
+                          const bool doGroupOfNodes,
+                          const bool doGroupOfEdges,
+                          const bool doGroupOfFaces,
+                          const bool doGroupOfVolumes)
+{
+  list<DriverMED_FamilyPtr> aFamilies;
+
+  string anAllNodesGroupName = "Group_Of_All_Nodes";
+  string anAllEdgesGroupName = "Group_Of_All_Edges";
+  string anAllFacesGroupName = "Group_Of_All_Faces";
+  string anAllVolumesGroupName = "Group_Of_All_Volumes";
+
+  // Reserve four ids for families of free elements
+  // (1 - nodes, -1 - edges, -2 - faces, -3 - volumes).
+  // 'Free' means here not belonging to any group.
+  int aNodeFamId = FIRST_NODE_FAMILY;
+  int aElemFamId = FIRST_ELEM_FAMILY;
+
+  // Process sub-meshes
+  map<int, SMESHDS_SubMesh*>::const_iterator aSMIter = theSubMeshes.begin();
+  for (; aSMIter != theSubMeshes.end(); aSMIter++)
+  {
+    list<DriverMED_FamilyPtr> aSMFams = SplitByType((*aSMIter).second, (*aSMIter).first);
+    list<DriverMED_FamilyPtr>::iterator aSMFamsIter = aSMFams.begin();
+    for (; aSMFamsIter != aSMFams.end(); aSMFamsIter++)
+    {
+      DriverMED_FamilyPtr aFam2 = (*aSMFamsIter);
+
+      list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
+      while (aFamsIter != aFamilies.end())
+      {
+        DriverMED_FamilyPtr aFam1 = *aFamsIter;
+        list<DriverMED_FamilyPtr>::iterator aCurrIter = aFamsIter++;
+        if (aFam1->myType == aFam2->myType)
+        {
+          DriverMED_FamilyPtr aCommon (new DriverMED_Family);
+          aFam1->Split(aFam2, aCommon);
+          if (!aCommon->IsEmpty())
+          {
+            aFamilies.push_back(aCommon);
+          }
+          if (aFam1->IsEmpty())
+          {
+            aFamilies.erase(aCurrIter);
+          }
+          if (aFam2->IsEmpty()) break;
+        }
+      }
+      // The rest elements of family
+      if (!aFam2->IsEmpty())
+      {
+        aFamilies.push_back(aFam2);
+      }
+    }
+  }
+
+  // Process groups
+  list<SMESHDS_Group*>::const_iterator aGroupsIter = theGroups.begin();
+  for (; aGroupsIter != theGroups.end(); aGroupsIter++)
+  {
+    DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
+    aFam2->Init(*aGroupsIter);
+
+    list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
+    while (aFamsIter != aFamilies.end())
+    {
+      DriverMED_FamilyPtr aFam1 = *aFamsIter;
+      list<DriverMED_FamilyPtr>::iterator aCurrIter = aFamsIter++;
+      if (aFam1->myType == aFam2->myType)
+      {
+        DriverMED_FamilyPtr aCommon (new DriverMED_Family);
+        aFam1->Split(aFam2, aCommon);
+        if (!aCommon->IsEmpty())
+        {
+          aFamilies.push_back(aCommon);
+        }
+        if (aFam1->IsEmpty())
+        {
+          aFamilies.erase(aCurrIter);
+        }
+        if (aFam2->IsEmpty()) break;
+      }
+    }
+    // The rest elements of group
+    if (!aFam2->IsEmpty())
+    {
+      aFamilies.push_back(aFam2);
+    }
+  }
+
+  list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
+  for (; aFamsIter != aFamilies.end(); aFamsIter++)
+  {
+    DriverMED_FamilyPtr aFam = *aFamsIter;
+    if (aFam->myType == SMDSAbs_Node) {
+      aFam->SetId(aNodeFamId++);
+      if (doGroupOfNodes) aFam->myGroupNames.insert(anAllNodesGroupName);
+    }
+    else {
+      aFam->SetId(aElemFamId--);
+      if (aFam->myType == SMDSAbs_Edge) {
+        if (doGroupOfEdges) aFam->myGroupNames.insert(anAllEdgesGroupName);
+      }
+      else if (aFam->myType == SMDSAbs_Face) {
+        if (doGroupOfFaces) aFam->myGroupNames.insert(anAllFacesGroupName);
+      }
+      else if (aFam->myType == SMDSAbs_Volume) {
+        if (doGroupOfVolumes) aFam->myGroupNames.insert(anAllVolumesGroupName);
+      }
+    }
+  }
+
+  // Create families for elements, not belonging to any group
+  if (doGroupOfNodes)
+  {
+    DriverMED_FamilyPtr aFreeNodesFam (new DriverMED_Family);
+    aFreeNodesFam->SetId(REST_NODES_FAMILY);
+    aFreeNodesFam->myType = SMDSAbs_Node;
+    aFreeNodesFam->myGroupNames.insert(anAllNodesGroupName);
+    aFamilies.push_back(aFreeNodesFam);
+  }
+
+  if (doGroupOfEdges)
+  {
+    DriverMED_FamilyPtr aFreeEdgesFam (new DriverMED_Family);
+    aFreeEdgesFam->SetId(REST_EDGES_FAMILY);
+    aFreeEdgesFam->myType = SMDSAbs_Edge;
+    aFreeEdgesFam->myGroupNames.insert(anAllEdgesGroupName);
+    aFamilies.push_back(aFreeEdgesFam);
+  }
+
+  if (doGroupOfFaces)
+  {
+    DriverMED_FamilyPtr aFreeFacesFam (new DriverMED_Family);
+    aFreeFacesFam->SetId(REST_FACES_FAMILY);
+    aFreeFacesFam->myType = SMDSAbs_Face;
+    aFreeFacesFam->myGroupNames.insert(anAllFacesGroupName);
+    aFamilies.push_back(aFreeFacesFam);
+  }
+
+  if (doGroupOfVolumes)
+  {
+    DriverMED_FamilyPtr aFreeVolumesFam (new DriverMED_Family);
+    aFreeVolumesFam->SetId(REST_VOLUMES_FAMILY);
+    aFreeVolumesFam->myType = SMDSAbs_Volume;
+    aFreeVolumesFam->myGroupNames.insert(anAllVolumesGroupName);
+    aFamilies.push_back(aFreeVolumesFam);
+  }
+
+  DriverMED_FamilyPtr aNullFam (new DriverMED_Family);
+  aNullFam->SetId(0);
+  aNullFam->myType = SMDSAbs_All;
+  aFamilies.push_back(aNullFam);
+
+  return aFamilies;
+}
+
+//=============================================================================
+/*!
+ *  Create TFamilyInfo for this family
+ */
+//=============================================================================
+MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo
+                  (const MEDA::PMeshInfo& theMeshInfo) const
+{
+  string aValue;
+  ostringstream aStr;
+  aStr << myId;
+  aValue = aStr.str();
+  MED::TStringVector anAttrDescs (1, "");  // 1 attribute with empty description,
+  MED::TIntVector anAttrIds (1, myId);        // Id=0,
+  MED::TIntVector anAttrVals (1, myId);       // Value=0
+
+  MEDA::PFamilyInfo anInfo = MEDA::TWrapper::CrFamilyInfo(theMeshInfo,
+                                                          aValue,
+                                                          myId,
+                                                          myGroupNames,
+                                                          anAttrDescs,anAttrIds,anAttrVals);
+
+//  cout << endl;
+//  cout << "Groups: ";
+//  set<string>::iterator aGrIter = myGroupNames.begin();
+//  for (; aGrIter != myGroupNames.end(); aGrIter++)
+//  {
+//    cout << " " << *aGrIter;
+//  }
+//  cout << endl;
+//
+//  cout << "Elements: ";
+//  set<const SMDS_MeshElement *>::iterator anIter = myElements.begin();
+//  for (; anIter != myElements.end(); anIter++)
+//  {
+//    cout << " " << (*anIter)->GetID();
+//  }
+//  cout << endl;
+
+  return anInfo;
+}
+
+//=============================================================================
+/*!
+ *  Initialize the tool by SMESHDS_Group
+ */
+//=============================================================================
+void DriverMED_Family::Init (SMESHDS_Group* group)
+{
+  // Elements
+  myElements.clear();
+  group->InitIterator();
+  while (group->More())
+  {
+    myElements.insert(group->Next());
+  }
+
+  // Type
+  myType = group->GetType();
+
+  // Groups list
+  myGroupNames.clear();
+  myGroupNames.insert(string(group->GetStoreName()));
+}
+
+//=============================================================================
+/*!
+ *  Split <theSubMesh> on some parts (families)
+ *  on the basis of the elements type.
+ */
+//=============================================================================
+list<DriverMED_FamilyPtr> DriverMED_Family::SplitByType (SMESHDS_SubMesh* theSubMesh,
+                                                         const int        theId)
+{
+  list<DriverMED_FamilyPtr> aFamilies;
+  DriverMED_FamilyPtr aNodesFamily   (new DriverMED_Family);
+  DriverMED_FamilyPtr anEdgesFamily  (new DriverMED_Family);
+  DriverMED_FamilyPtr aFacesFamily   (new DriverMED_Family);
+  DriverMED_FamilyPtr aVolumesFamily (new DriverMED_Family);
+
+  char submeshGrpName[ 30 ];
+  sprintf( submeshGrpName, "SubMesh %d", theId );
+
+  SMDS_NodeIteratorPtr aNodesIter = theSubMesh->GetNodes();
+  while (aNodesIter->more())
+  {
+    const SMDS_MeshNode* aNode = aNodesIter->next();
+    aNodesFamily->AddElement(aNode);
+  }
+
+  SMDS_ElemIteratorPtr anElemsIter = theSubMesh->GetElements();
+  while (anElemsIter->more())
+  {
+    const SMDS_MeshElement* anElem = anElemsIter->next();
+    switch (anElem->GetType())
+    {
+    case SMDSAbs_Edge:
+      anEdgesFamily->AddElement(anElem);
+      break;
+    case SMDSAbs_Face:
+      aFacesFamily->AddElement(anElem);
+      break;
+    case SMDSAbs_Volume:
+      aVolumesFamily->AddElement(anElem);
+      break;
+    default:
+      break;
+    }
+  }
+
+  if (!aNodesFamily->IsEmpty()) {
+    aNodesFamily->SetType(SMDSAbs_Node);
+    aNodesFamily->AddGroupName(submeshGrpName);
+    aFamilies.push_back(aNodesFamily);
+  }
+  if (!anEdgesFamily->IsEmpty()) {
+    anEdgesFamily->SetType(SMDSAbs_Edge);
+    anEdgesFamily->AddGroupName(submeshGrpName);
+    aFamilies.push_back(anEdgesFamily);
+  }
+  if (!aFacesFamily->IsEmpty()) {
+    aFacesFamily->SetType(SMDSAbs_Face);
+    aFacesFamily->AddGroupName(submeshGrpName);
+    aFamilies.push_back(aFacesFamily);
+  }
+  if (!aVolumesFamily->IsEmpty()) {
+    aVolumesFamily->SetType(SMDSAbs_Volume);
+    aVolumesFamily->AddGroupName(submeshGrpName);
+    aFamilies.push_back(aVolumesFamily);
+  }
+
+  return aFamilies;
+}
+
+//=============================================================================
+/*!
+ *  Remove from <myElements> elements, common with <by>,
+ *  Remove from <by> elements, common with <myElements>,
+ *  Create family <common> from common elements, with combined groups list.
+ */
+//=============================================================================
+void DriverMED_Family::Split (DriverMED_FamilyPtr by,
+                              DriverMED_FamilyPtr common)
+{
+  // Elements
+  set<const SMDS_MeshElement *>::iterator anIter = by->myElements.begin();
+  for (; anIter != by->myElements.end(); anIter++)
+  {
+    if (myElements.find(*anIter) != myElements.end())
+    {
+      common->myElements.insert(*anIter);
+      myElements.erase(*anIter);
+      by->myElements.erase(*anIter);
+    }
+  }
+
+  if (!common->IsEmpty())
+  {
+    // Groups list
+    common->myGroupNames = myGroupNames;
+    set<string>::iterator aGrNamesIter = by->myGroupNames.begin();
+    for (; aGrNamesIter != by->myGroupNames.end(); aGrNamesIter++)
+    {
+      common->myGroupNames.insert(*aGrNamesIter);
+    }
+
+    // Type
+    common->myType = myType;
+  }
+}
diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h
new file mode 100644 (file)
index 0000000..cca2bf0
--- /dev/null
@@ -0,0 +1,121 @@
+//  SMESH DriverMED : tool to split groups on families
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : DriverMED_Family.hxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+#ifndef _INCLUDE_DRIVERMED_FAMILY
+#define _INCLUDE_DRIVERMED_FAMILY
+
+#include "SMDS_Mesh.hxx"
+#include "SMESHDS_Group.hxx"
+#include "SMESHDS_SubMesh.hxx"
+#include "MEDA_Wrapper.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <set>
+
+using namespace std;
+
+#define REST_NODES_FAMILY 1
+#define REST_EDGES_FAMILY -1
+#define REST_FACES_FAMILY -2
+#define REST_VOLUMES_FAMILY -3
+#define FIRST_NODE_FAMILY 2
+#define FIRST_ELEM_FAMILY -4
+
+class DriverMED_Family;
+typedef boost::shared_ptr<DriverMED_Family> DriverMED_FamilyPtr;
+
+class DriverMED_Family
+{
+ public:
+
+  // Methods for groups storing to MED
+
+  static list<DriverMED_FamilyPtr> MakeFamilies (const map <int, SMESHDS_SubMesh*>& theSubMeshes,
+                                                const list<SMESHDS_Group*>& theGroups,
+                                                const bool doGroupOfNodes,
+                                                const bool doGroupOfEdges,
+                                                const bool doGroupOfFaces,
+                                                const bool doGroupOfVolumes);
+  // Split each group from list <theGroups> and each sub-mesh from list <theSubMeshes>
+  // on some parts (families) on the basis of the elements membership in other groups
+  // from <theGroups> and other sub-meshes from <theSubMeshes>.
+  // Resulting families have no common elements.
+
+  MEDA::PFamilyInfo GetFamilyInfo (const MEDA::PMeshInfo& theMeshInfo) const;
+  // Create TFamilyInfo for this family
+
+  const set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
+  // Returns elements of this family
+
+  int GetId () const { return myId; }
+  // Returns a family ID
+
+ public:
+
+  // Methods for groups reading from MED
+
+  void AddElement (const SMDS_MeshElement* theElement) { myElements.insert(theElement); }
+
+  void AddGroupName (string theGroupName) { myGroupNames.insert(theGroupName); }
+
+  void SetType (const SMDSAbs_ElementType theType) { myType = theType; }
+  SMDSAbs_ElementType GetType () { return myType; }
+
+  bool MemberOf (string theGroupName) const
+    { return (myGroupNames.find(theGroupName) != myGroupNames.end()); }
+
+  const MED::TStringSet& GetGroupNames () const { return myGroupNames; }
+
+ private:
+  void Init (SMESHDS_Group* group);
+  // Initialize the tool by SMESHDS_Group
+
+  static list<DriverMED_FamilyPtr> SplitByType (SMESHDS_SubMesh* theSubMesh,
+                                               const int        theId);
+  // Split <theSubMesh> on some parts (families)
+  // on the basis of the elements type.
+
+  void Split (DriverMED_FamilyPtr by,
+             DriverMED_FamilyPtr common);
+  // Remove from <Elements> elements, common with <by>,
+  // Remove from <by> elements, common with <Elements>,
+  // Create family <common> from common elements, with combined groups list.
+
+  void SetId (const int theId) { myId = theId; }
+  // Sets a family ID
+
+  bool IsEmpty () const { return myElements.empty(); }
+  // Check, if this family has empty list of elements
+
+ private:
+  int                           myId;
+  SMDSAbs_ElementType           myType;
+  set<const SMDS_MeshElement *> myElements;
+  MED::TStringSet               myGroupNames;
+};
+
+#endif
diff --git a/src/DriverMED/MED_Test.cxx b/src/DriverMED/MED_Test.cxx
new file mode 100644 (file)
index 0000000..7d6c3cd
--- /dev/null
@@ -0,0 +1,28 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "DriverMED_R_SMESHDS_Mesh.h"
+#include "DriverMED_W_SMESHDS_Mesh.h"
+
+int main(int argc, char** argv)
+{
+  DriverMED_R_SMESHDS_Mesh aR;
+  DriverMED_W_SMESHDS_Mesh aW;
+  return 1;
+}
diff --git a/src/DriverUNV/UNV2411_Structure.cxx b/src/DriverUNV/UNV2411_Structure.cxx
new file mode 100644 (file)
index 0000000..8425f94
--- /dev/null
@@ -0,0 +1,123 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include <fstream>     
+
+#include "UNV2411_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+using namespace std;
+using namespace UNV;
+using namespace UNV2411;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static string _label_dataset = "2411";
+
+UNV2411::TRecord::TRecord():
+  exp_coord_sys_num(0),
+  disp_coord_sys_num(0),
+  color(0)
+{}
+
+void UNV2411::Read(std::ifstream& in_stream, TDataSet& theDataSet)
+{
+  if(!in_stream.good())
+    EXCEPTION(runtime_error,"ERROR: Input file not good.");
+
+  /*
+   * adjust the \p istream to our
+   * position
+   */
+  if(!beginning_of_dataset(in_stream,_label_dataset))
+    EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
+
+  /**
+   * always 3 coordinates in the UNV file, no matter
+   * which dimensionality libMesh is in
+   */
+  TNodeLab aLabel;
+  std::string num_buf;
+  for(; !in_stream.eof();){
+    in_stream >> aLabel ;
+    if(aLabel == -1){
+      // end of dataset is reached
+      break;
+    }
+
+    TRecord aRec;
+    in_stream>>aRec.exp_coord_sys_num;
+    in_stream>>aRec.disp_coord_sys_num;
+    in_stream>>aRec.color;
+
+    /*
+     * take care of the
+     * floating-point data
+     */
+    for(int d = 0; d < 3; d++){
+      in_stream>>num_buf;
+      aRec.coord[d] = D_to_e(num_buf);
+    }
+
+    theDataSet.insert(TDataSet::value_type(aLabel,aRec));
+  }
+}
+
+
+void UNV2411::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
+{
+  if(!out_stream.good())
+    EXCEPTION(runtime_error,"ERROR: Output file not good.");
+  
+  /*
+   * Write beginning of dataset
+   */
+  out_stream<<"    -1\n";
+  out_stream<<"  "<<_label_dataset<<"\n";
+
+  TDataSet::const_iterator anIter = theDataSet.begin();
+  for(; anIter != theDataSet.end(); anIter++){
+    const TNodeLab& aLabel = anIter->first;
+    const TRecord& aRec = anIter->second;
+    char buf[78];
+    sprintf(buf, "%10d%10d%10d%10d\n", 
+           aLabel,
+           aRec.exp_coord_sys_num,
+           aRec.disp_coord_sys_num,
+           aRec.color);
+    out_stream<<buf;
+
+    // the coordinates
+    sprintf(buf, "%25.16E%25.16E%25.16E\n", 
+           aRec.coord[0],
+           aRec.coord[1],
+           aRec.coord[2]);
+    out_stream<<buf;
+  }
+  
+  
+  /*
+   * Write end of dataset
+   */
+  out_stream<<"    -1\n";
+}
diff --git a/src/DriverUNV/UNV2411_Structure.hxx b/src/DriverUNV/UNV2411_Structure.hxx
new file mode 100644 (file)
index 0000000..4f6a393
--- /dev/null
@@ -0,0 +1,46 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef UNV2411_Structure_HeaderFile
+#define UNV2411_Structure_HeaderFile
+
+#include <map>
+#include <fstream>     
+
+namespace UNV2411{
+  
+  struct TRecord{
+    TRecord();
+    int exp_coord_sys_num;  // export coordinate system number
+    int disp_coord_sys_num;  // displacement coordinate system number
+    int color;  // color                                
+    double coord[3];  // node coordinates in the part coordinate system
+  };
+  
+  typedef int TNodeLab; // type of node label
+  typedef std::map<TNodeLab,TRecord> TDataSet;
+
+  void Read(std::ifstream& in_stream, TDataSet& theDataSet);
+
+  void Write(std::ofstream& out_stream, const TDataSet& theDataSet);
+
+};
+
+
+#endif
diff --git a/src/DriverUNV/UNV2412_Structure.cxx b/src/DriverUNV/UNV2412_Structure.cxx
new file mode 100644 (file)
index 0000000..43699fc
--- /dev/null
@@ -0,0 +1,202 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include <fstream>     
+#include <iomanip>
+
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+using namespace std;
+using namespace UNV;
+using namespace UNV2412;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+static string _label_dataset = "2412";
+
+UNV2412::TRecord::TRecord():
+  phys_prop_tab_num(2),
+  mat_prop_tab_num(1),
+  color(7),
+  beam_orientation(0),
+  beam_fore_end(0),
+  beam_aft_end(0)
+{}
+
+void UNV2412::Read(std::ifstream& in_stream, TDataSet& theDataSet)
+{
+  if(!in_stream.good())
+    EXCEPTION(runtime_error,"ERROR: Input file not good.");
+
+  /*
+   * adjust the \p istream to our
+   * position
+   */
+  if(!beginning_of_dataset(in_stream,_label_dataset))
+    EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
+
+  TElementLab aLabel;
+  for(; !in_stream.eof();){
+    in_stream >> aLabel ;
+    if(aLabel == -1){
+      // end of dataset is reached
+      break;
+    }
+
+    int n_nodes;
+    TRecord aRec;
+    in_stream>>aRec.fe_descriptor_id;
+    in_stream>>aRec.phys_prop_tab_num;
+    in_stream>>aRec.mat_prop_tab_num;
+    in_stream>>aRec.color;
+    in_stream>>n_nodes;
+
+    if(IsBeam(aRec.fe_descriptor_id)){
+      in_stream>>aRec.beam_orientation;
+      in_stream>>aRec.beam_fore_end;
+      in_stream>>aRec.beam_aft_end;
+    }
+
+    aRec.node_labels.resize(n_nodes);
+    for(int j=0; j < n_nodes; j++){
+      // read node labels
+      in_stream>>aRec.node_labels[j];             
+    }
+
+    theDataSet.insert(TDataSet::value_type(aLabel,aRec));
+  }
+
+}
+
+
+void UNV2412::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
+{
+  if(!out_stream.good())
+    EXCEPTION(runtime_error,"ERROR: Output file not good.");
+  
+  /*
+   * Write beginning of dataset
+   */
+  out_stream<<"    -1\n";
+  out_stream<<"  "<<_label_dataset<<"\n";
+
+  TDataSet::const_iterator anIter = theDataSet.begin();
+  for(; anIter != theDataSet.end(); anIter++){
+    const TElementLab& aLabel = anIter->first;
+    const TRecord& aRec = anIter->second;
+    out_stream<<std::setw(10)<<aLabel;  /* element ID */
+    out_stream<<std::setw(10)<<aRec.fe_descriptor_id;  /* type of element */
+    out_stream<<std::setw(10)<<aRec.phys_prop_tab_num;
+    out_stream<<std::setw(10)<<aRec.mat_prop_tab_num;
+    out_stream<<std::setw(10)<<aRec.color;
+    out_stream<<std::setw(10)<<aRec.node_labels.size()<<std::endl;  /* No. of nodes per element */
+
+    if(IsBeam(aRec.fe_descriptor_id)){
+      out_stream<<std::setw(10)<<aRec.beam_orientation;
+      out_stream<<std::setw(10)<<aRec.beam_fore_end;
+      out_stream<<std::setw(10)<<aRec.beam_aft_end<<std::endl;
+    }
+
+    int n_nodes = aRec.node_labels.size();
+    int iEnd = (n_nodes-1)/8 + 1;
+    for(int i = 0, k = 0; i < iEnd; i++){
+      int jEnd = n_nodes - 8*(i+1);
+      if(jEnd < 0) 
+       jEnd = 8 + jEnd;
+      else
+       jEnd = 8;
+      for(int j = 0; j < jEnd ; k++, j++){
+       out_stream<<std::setw(10)<<aRec.node_labels[k];
+      }
+      out_stream<<std::endl;
+    }
+  }
+
+  /*
+   * Write end of dataset
+   */
+  out_stream<<"    -1\n";
+}
+
+
+bool UNV2412::IsBeam(int theFeDescriptorId){
+  switch (theFeDescriptorId){
+  case 11:
+  case 21:
+  case 22:
+  case 24:
+  case 25:
+    return true;
+  }
+  return false;
+}
+
+
+bool UNV2412::IsFace(int theFeDescriptorId){
+  switch (theFeDescriptorId){
+    
+  case 71: // TRI3
+  case 72:
+  case 74:
+
+  case 41: // Plane Stress Linear Triangle - TRI3
+  case 91: // Thin Shell Linear Triangle - TRI3
+
+  case 42: // Plane Stress Quadratic Triangle - TRI6
+  case 92: // Thin Shell Quadratic Triangle - TRI6
+
+  case 43: // Plane Stress Cubic Triangle
+
+  case 44: // Plane Stress Linear Quadrilateral - QUAD4
+  case 94: // Thin Shell   Linear Quadrilateral -  QUAD4
+
+  case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
+  case 95: // Thin Shell   Quadratic Quadrilateral - QUAD8
+
+  case 46: // Plane Stress Cubic Quadrilateral
+
+    return true;
+  }
+  return false;
+}
+
+
+bool UNV2412::IsVolume(int theFeDescriptorId){
+  //if(!IsBeam(theFeDescriptorId) && !IsFace(theFeDescriptorId))
+  //  return true;
+  switch (theFeDescriptorId){
+
+  case 111: // Solid Linear Tetrahedron - TET4
+  case 118: // Solid Quadratic Tetrahedron - TET10
+
+  case 112: // Solid Linear Prism - PRISM6
+
+  case 115: // Solid Linear Brick - HEX8
+  case 116: // Solid Quadratic Brick - HEX20
+
+  case 117: // Solid Cubic Brick
+    return true;
+  }
+  return false;
+}
diff --git a/src/DriverUNV/UNV2412_Structure.hxx b/src/DriverUNV/UNV2412_Structure.hxx
new file mode 100644 (file)
index 0000000..fc6c625
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#ifndef UNV2412_Structure_HeaderFile
+#define UNV2412_Structure_HeaderFile
+
+#include <map>
+#include <vector>
+#include <fstream>     
+
+
+namespace UNV2412{
+  
+  struct TRecord{
+    TRecord();
+
+    int fe_descriptor_id;  // FE descriptor id
+    int phys_prop_tab_num;  // physical property table number
+    int mat_prop_tab_num;  // material property table number
+    int color;  // color
+    std::vector<int> node_labels;  // node labels defining element
+
+    //FOR BEAM ELEMENTS ONLY
+    int beam_orientation;  // beam orientation node number
+    int beam_fore_end;  // beam fore-end cross section number
+    int beam_aft_end;  // beam  aft-end cross section number
+  };
+  
+  typedef int TElementLab; // type of element label
+  typedef std::map<TElementLab,TRecord> TDataSet;
+
+  void Read(std::ifstream& in_stream, TDataSet& theDataSet);
+
+  void Write(std::ofstream& out_stream, const TDataSet& theDataSet);
+
+  bool IsBeam(int theFeDescriptorId);
+  bool IsFace(int theFeDescriptorId);
+  bool IsVolume(int theFeDescriptorId);
+
+};
+
+
+#endif
diff --git a/src/DriverUNV/UNV_Test.cxx b/src/DriverUNV/UNV_Test.cxx
new file mode 100644 (file)
index 0000000..f9d9172
--- /dev/null
@@ -0,0 +1,69 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+#include "UNV2411_Structure.hxx"
+#include "UNV2412_Structure.hxx"
+#include "UNV_Utilities.hxx"
+
+#include "DriverUNV_R_SMDS_Mesh.h"
+#include "DriverUNV_W_SMDS_Mesh.h"
+
+using namespace std;
+
+#ifdef DEBUG
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+void ReadMed(const char* theFileName){
+  std::ifstream in_stream(theFileName);
+
+  UNV2411::TDataSet aDataSet2411;
+  UNV2411::Read(in_stream,aDataSet2411);
+
+  in_stream.seekg(0);
+  UNV2412::TDataSet aDataSet2412;
+  UNV2412::Read(in_stream,aDataSet2412);
+
+  string aFileName(theFileName);
+  aFileName += "-";
+  std::ofstream out_stream(aFileName.c_str());
+
+  UNV2411::Write(out_stream,aDataSet2411);
+  UNV2412::Write(out_stream,aDataSet2412);
+}
+
+
+int main(int argc, char** argv){ 
+  DriverUNV_R_SMDS_Mesh aR;
+  DriverUNV_W_SMDS_Mesh aW;
+  try{
+    if(argc > 1){
+      ReadMed(argv[1]);
+    }
+    return 0;
+  }catch(std::exception& exc){
+    cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+  }catch(...){
+    cout<<"Unknown exception was accured !!!"<<endl;
+  } 
+  return 1;
+}
diff --git a/src/DriverUNV/UNV_Utilities.cxx b/src/DriverUNV/UNV_Utilities.cxx
new file mode 100644 (file)
index 0000000..0781e5a
--- /dev/null
@@ -0,0 +1,37 @@
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VISU_DatConvertor.cxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#include "UNV_Utilities.hxx"
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+int UNV::PrefixPrinter::myCounter = 0;
+
+UNV::PrefixPrinter::PrefixPrinter()
+{
+  myCounter++;
+}
+
+UNV::PrefixPrinter::~PrefixPrinter()
+{
+  myCounter--;
+}
+
+string UNV::PrefixPrinter::GetPrefix()
+{
+  if(myCounter)
+    return string(myCounter*2,' ');
+  return "";
+}
diff --git a/src/DriverUNV/UNV_Utilities.hxx b/src/DriverUNV/UNV_Utilities.hxx
new file mode 100644 (file)
index 0000000..839453e
--- /dev/null
@@ -0,0 +1,104 @@
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VISU_DatConvertor.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef MED_Utilities_HeaderFile
+#define MED_Utilities_HeaderFile
+
+#include <iostream>    
+#include <sstream>     
+#include <string>
+#include <stdexcept>
+
+
+namespace UNV{
+  using namespace std;
+
+  class PrefixPrinter{
+    static int myCounter;
+  public:
+    PrefixPrinter();
+    ~PrefixPrinter();
+
+    static string GetPrefix();
+  };
+
+  /**
+   * @returns \p false when error occured, \p true otherwise.
+   * Adjusts the \p in_stream to the beginning of the
+   * dataset \p ds_name.
+   */
+  inline bool beginning_of_dataset(std::istream& in_file, const std::string& ds_name)
+  {
+    assert (in_file.good());
+    assert (!ds_name.empty());
+    
+    std::string olds, news;
+    
+    while(true){
+      in_file >> olds >> news;
+      /*
+       * a "-1" followed by a number means the beginning of a dataset
+       * stop combing at the end of the file
+       */
+      while( ((olds != "-1") || (news == "-1") ) && !in_file.eof() ){    
+       olds = news;
+       in_file >> news;
+      }
+      if(in_file.eof())
+       return false;
+      if (news == ds_name)
+       return true;
+    }
+    // should never end up here
+    return false;
+  }
+
+  /**
+   * Method for converting exponential notation
+   * from "D" to "e", for example
+   * \p 3.141592654D+00 \p --> \p 3.141592654e+00
+   * in order to make it readable for C++.
+   */
+  inline double D_to_e(std::string& number)
+  {
+    /* find "D" in string, start looking at 
+     * 6th element, to improve speed.
+     * We dont expect a "D" earlier
+     */
+    const int position = number.find("D",6);
+    if(position != std::string::npos){
+      number.replace(position, 1, "e"); 
+    }
+    return atof (number.c_str());
+  }
+
+};
+
+
+#ifndef MESSAGE
+
+#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl;
+
+#define BEGMSG(msg) std::cout<<UNV::PrefixPrinter::GetPrefix()<<msg
+
+#define ADDMSG(msg) std::cout<<msg
+
+#endif
+
+
+#ifndef EXCEPTION
+
+#define EXCEPTION(TYPE, MSG) {\
+  std::ostringstream aStream;\
+  aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
+  throw TYPE(aStream.str());\
+}
+
+#endif
+
+#endif
diff --git a/src/NETGENPlugin/Makefile.in b/src/NETGENPlugin/Makefile.in
new file mode 100644 (file)
index 0000000..5771909
--- /dev/null
@@ -0,0 +1,67 @@
+#  SMESH NETGENPlugin : implementaion of SMESH idl descriptions
+#
+#  Copyright (C) 2004  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : Makefile.in
+#  Author : Julia DOROVSKIKH
+#  Module : SMESH
+#  $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:
+
+
+@COMMENCE@
+
+EXPORT_PYSCRIPTS =
+
+# .po files to transform in .qm
+PO_FILES = NETGENPlugin_icons.po
+
+# Libraries targets
+LIB = libNETGENEngine.la
+LIB_SRC = \
+       NETGENPlugin_NETGEN_3D.cxx \
+       NETGENPlugin_NETGEN_3D_i.cxx \
+       NETGENPlugin_i.cxx
+
+LIB_SERVER_IDL = SMESH_NetgenAlgorithm.idl
+
+LIB_CLIENT_IDL = SMESH_Gen.idl SMESH_Mesh.idl SMESH_Group.idl
+
+# Executables targets
+BIN = 
+BIN_SRC = 
+
+# additionnal information to compil and link file
+NETGEN_INCLUDES=@NETGEN_INCLUDES@
+
+CPPFLAGS+= $(OCC_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+           -I${GEOM_ROOT_DIR}/include/salome $(NETGEN_INCLUDES) $(BOOST_CPPFLAGS)
+CXXFLAGS+= $(OCC_CXXFLAGS) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+           -I${GEOM_ROOT_DIR}/include/salome $(NETGEN_INCLUDES)
+
+LDFLAGS+= $(HDF5_LIBS) -lSMESHimpl -lSMESHEngine -lStdMeshers -lStdMeshersEngine -lNETGEN -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeGenericObj
+
+@CONCLUDE@
diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
new file mode 100644 (file)
index 0000000..98b1e66
--- /dev/null
@@ -0,0 +1,1064 @@
+//=============================================================================
+// File      : NETGENPlugin_NETGEN_3D.cxx
+//             Moved here from SMESH_NETGEN_3D.cxx
+// Created   : lundi 27 Janvier 2003
+// Author    : Nadir BOUHAMOU (CEA)
+// Project   : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
+using namespace std;
+
+#include "NETGENPlugin_NETGEN_3D.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Mesh.hxx"
+
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_FacePosition.hxx"
+
+#include <TopExp.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
+#include <BRep_Tool.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom2d_Curve.hxx>
+
+#include "utilities.h"
+
+/*
+  Netgen include files
+*/
+
+#include "nglib.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D(int hypId, int studyId,
+                            SMESH_Gen* gen)
+  : SMESH_3D_Algo(hypId, studyId, gen)
+{
+  MESSAGE("NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D");
+  _name = "NETGEN_3D";
+//   _shapeType = TopAbs_SOLID;
+  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
+//   MESSAGE("_shapeType octal " << oct << _shapeType);
+  _compatibleHypothesis.push_back("MaxElementVolume");
+
+  _maxElementVolume = 0.;
+
+  _hypMaxElementVolume = NULL;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D()
+{
+  MESSAGE("NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool NETGENPlugin_NETGEN_3D::CheckHypothesis
+                         (SMESH_Mesh& aMesh,
+                          const TopoDS_Shape& aShape,
+                          SMESH_Hypothesis::Hypothesis_Status& aStatus)
+{
+  MESSAGE("NETGENPlugin_NETGEN_3D::CheckHypothesis");
+
+  _hypMaxElementVolume = NULL;
+
+  list<const SMESHDS_Hypothesis*>::const_iterator itl;
+  const SMESHDS_Hypothesis* theHyp;
+
+  const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape);
+  int nbHyp = hyps.size();
+  if (!nbHyp)
+  {
+    aStatus = SMESH_Hypothesis::HYP_MISSING;
+    return false;  // can't work with no hypothesis
+  }
+
+  itl = hyps.begin();
+  theHyp = (*itl); // use only the first hypothesis
+
+  string hypName = theHyp->GetName();
+  int hypId = theHyp->GetID();
+  SCRUTE(hypName);
+
+  bool isOk = false;
+
+  if (hypName == "MaxElementVolume")
+  {
+    _hypMaxElementVolume = static_cast<const StdMeshers_MaxElementVolume*> (theHyp);
+    ASSERT(_hypMaxElementVolume);
+    _maxElementVolume = _hypMaxElementVolume->GetMaxVolume();
+    isOk =true;
+    aStatus = SMESH_Hypothesis::HYP_OK;
+  }
+  else
+    aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
+
+  return isOk;
+}
+
+//=============================================================================
+/*!
+ *Here we are going to use the NETGEN mesher
+ */
+//=============================================================================
+
+bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
+                            const TopoDS_Shape& aShape)
+{
+  MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume);
+
+  bool isOk = false;
+  SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
+  SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape);
+  //const Handle(SMESHDS_SubMesh)& subMeshDS = theSubMesh->GetSubMeshDS();
+
+  map<int, const SMDS_MeshNode*> netgenToDS;
+
+  MESSAGE("NETGENPlugin_NETGEN_3D::Compute Checking the mesh Faces");
+
+  // check if all faces were meshed by a triangle mesher (here MESFISTO_2D)
+
+  vector<SMESH_subMesh*> meshFaces;
+  vector<TopoDS_Shape> shapeFaces;
+
+  for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next())
+    {
+      TopoDS_Shape aShapeFace = exp.Current();
+      SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
+      ASSERT (aSubMesh);
+      int internal_size = meshFaces.size();
+      int index = 0;
+      for (int i = 0;i<internal_size;i++)
+       {
+         if (aSubMesh == meshFaces[i]) index = 1;
+       }
+      if (index == 0) meshFaces.push_back(aSubMesh);
+
+      internal_size = shapeFaces.size();
+      index = 0;
+      for (int i = 0;i<internal_size;i++)
+       {
+         if (aShapeFace == shapeFaces[i]) index = 1;
+       }
+      if (index == 0) shapeFaces.push_back(aShapeFace);
+    }
+
+  int numberOfFaces = meshFaces.size();
+  int numberOfShapeFaces = shapeFaces.size();
+
+  SCRUTE(numberOfFaces);
+  SCRUTE(numberOfShapeFaces);
+
+  MESSAGE("---");
+
+  int NbTotOfTria = 0;
+  int NbTotOfNodesFaces = 0;
+
+  for (int i=0; i<numberOfFaces; i++)
+    {
+      TopoDS_Shape aShapeFace = meshFaces[i]->GetSubShape();
+      TopoDS_Shape aFace = shapeFaces[i];
+      SMESH_Algo* algoFace = _gen->GetAlgo(aMesh, aShapeFace);
+      string algoFaceName = algoFace->GetName();
+      SCRUTE(algoFaceName);
+      if (algoFaceName != "MEFISTO_2D")
+       {
+         SCRUTE(algoFaceName);
+         ASSERT(0);
+         return false;
+       }
+
+      bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation());
+
+      const SMESHDS_SubMesh* aSubMeshDSFace = meshFaces[i]->GetSubMeshDS();
+      SCRUTE(aSubMeshDSFace);
+
+      int nbNodes = aSubMeshDSFace->NbNodes();
+      NbTotOfNodesFaces += nbNodes;
+      int nbTria = aSubMeshDSFace->NbElements();
+      NbTotOfTria += nbTria;
+      int index = 0;
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Face " << (i+1) << " has " << nbNodes << " face internal Nodes, " << nbTria << " triangles");
+
+      SCRUTE(orientationMeshFace);
+
+      if (orientationMeshFace)
+       {
+         MESSAGE("The mesh and face have the same orientation");
+       }
+      else
+       {
+         MESSAGE("The mesh and face have different orientations");
+       }
+
+      SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSFace->GetNodes();
+      SCRUTE(nbNodes);
+      index = 0;
+      while(iteratorNodes->more())
+       {
+         index++;
+         const SMDS_MeshNode * node = iteratorNodes->next();
+//       int nodeId = node->GetID();
+//       double nodeX = node->X();
+//       double nodeY = node->Y();
+//       double nodeZ = node->Z();
+//       MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+       }
+
+      SCRUTE(index);
+
+      SMDS_ElemIteratorPtr iteratorTriangle = aSubMeshDSFace->GetElements();
+
+      SCRUTE(nbTria);
+      index = 0;
+      int numberOfDegeneratedTriangle = 0;
+      while(iteratorTriangle->more())
+       {
+         index++;
+         const SMDS_MeshElement * triangle = iteratorTriangle->next();
+         int triangleId = triangle->GetID();
+
+         SMDS_ElemIteratorPtr triangleNodesIt = triangle->nodesIterator();
+
+         const SMDS_MeshNode * node1 = static_cast<const SMDS_MeshNode *>(triangleNodesIt->next());
+         double node1X = node1->X();
+         double node1Y = node1->Y();
+         double node1Z = node1->Z();
+
+         const SMDS_MeshNode * node2 = static_cast<const SMDS_MeshNode *>(triangleNodesIt->next());
+         double node2X = node2->X();
+         double node2Y = node2->Y();
+         double node2Z = node2->Z();
+
+         const SMDS_MeshNode * node3 = static_cast<const SMDS_MeshNode *>(triangleNodesIt->next());
+         double node3X = node3->X();
+         double node3Y = node3->Y();
+         double node3Z = node3->Z();
+
+         int triangleNode1 = node1->GetID();
+         int triangleNode2 = node2->GetID();
+         int triangleNode3 = node3->GetID();
+
+         // Compute the triangle surface
+
+         double vect1 = ((node2Y - node1Y)*(node3Z - node1Z) - (node2Z - node1Z)*(node3Y - node1Y));
+         double vect2 = - ((node2X - node1X)*(node3Z - node1Z) - (node2Z - node1Z)*(node3X - node1X));
+         double vect3 = ((node2X - node1X)*(node3Y - node1Y) - (node2Y - node1Y)*(node3X - node1X));
+         double epsilon = 1.0e-6;
+
+         bool triangleIsDegenerated = ((abs(vect1)<epsilon) && (abs(vect2)<epsilon) && (abs(vect3)<epsilon));
+
+         if (triangleIsDegenerated)
+           {
+//           MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3 << " is degenerated");
+//           MESSAGE("NODE -> ID = " << triangleNode1 << " X = " << node1X << " Y = " << node1Y << " Z = " << node1Z);
+//           MESSAGE("NODE -> ID = " << triangleNode2 << " X = " << node2X << " Y = " << node2Y << " Z = " << node2Z);
+//           MESSAGE("NODE -> ID = " << triangleNode3 << " X = " << node3X << " Y = " << node3Y << " Z = " << node3Z);
+             numberOfDegeneratedTriangle++;
+           }
+         else
+           {
+//           MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3 << " is normal");
+           }
+       }
+
+      if (numberOfDegeneratedTriangle > 0)
+       MESSAGE("WARNING THERE IS(ARE) " << numberOfDegeneratedTriangle << " degenerated triangle on this face");
+
+      SCRUTE(index);
+    }
+
+
+
+  SCRUTE(NbTotOfTria);
+  SCRUTE(NbTotOfNodesFaces);
+
+  MESSAGE("NETGENPlugin_NETGEN_3D::Compute Checking the mesh Edges");
+
+  // check if all edges were meshed by a edge mesher (here Regular_1D)
+
+  vector<SMESH_subMesh*> meshEdges;
+  for (TopExp_Explorer exp(aShape,TopAbs_EDGE);exp.More();exp.Next())
+    {
+      SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
+      ASSERT (aSubMesh);
+      int internal_size = meshEdges.size();
+      int index = 0;
+      for (int i = 0;i<internal_size;i++)
+       {
+         if (aSubMesh == meshEdges[i]) index = 1;
+       }
+      if (index == 0) meshEdges.push_back(aSubMesh);
+    }
+
+  int numberOfEdges = meshEdges.size();
+  SCRUTE(numberOfEdges);
+
+  MESSAGE("---");
+
+  int NbTotOfNodesEdges = 0;
+  int NbTotOfSegs = 0;
+
+  for (int i=0; i<numberOfEdges; i++)
+    {
+      TopoDS_Shape aShapeEdge = meshEdges[i]->GetSubShape();
+      SMESH_Algo* algoEdge = _gen->GetAlgo(aMesh, aShapeEdge);
+      string algoEdgeName = algoEdge->GetName();
+      SCRUTE(algoEdgeName);
+      if (algoEdgeName != "Regular_1D")
+       {
+         SCRUTE(algoEdgeName);
+         ASSERT(0);
+         return false;
+       }
+
+      const SMESHDS_SubMesh* aSubMeshDSEdge = meshEdges[i]->GetSubMeshDS();
+      SCRUTE(aSubMeshDSEdge);
+
+      int nbNodes = aSubMeshDSEdge->NbNodes();
+      NbTotOfNodesEdges += nbNodes;
+      int nbSegs = aSubMeshDSEdge->NbElements();
+      NbTotOfSegs += nbSegs;
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Edge " << (i+1) << " has " << nbNodes << " edge internal Nodes, " << nbSegs << " segments");
+
+      SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSEdge->GetNodes();
+      SCRUTE(nbNodes);
+      int index = 0;
+      while(iteratorNodes->more())
+       {
+         index++;
+         const SMDS_MeshNode * node = iteratorNodes->next();
+//       int nodeId = node->GetID();
+//       double nodeX = node->X();
+//       double nodeY = node->Y();
+//       double nodeZ = node->Z();
+//       MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+       }
+
+      SCRUTE(index);
+    }
+
+  SCRUTE(NbTotOfNodesEdges);
+  SCRUTE(NbTotOfSegs);
+
+  MESSAGE("NETGENPlugin_NETGEN_3D::Compute Checking the mesh Vertices");
+
+  vector<SMESH_subMesh*> meshVertices;
+  for (TopExp_Explorer exp(aShape,TopAbs_VERTEX);exp.More();exp.Next())
+    {
+      SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
+      ASSERT (aSubMesh);
+      int internal_size = meshVertices.size();
+      int index = 0;
+      for (int i = 0;i<internal_size;i++)
+       {
+         if (aSubMesh == meshVertices[i]) index = 1;
+       }
+      if (index == 0) meshVertices.push_back(aSubMesh);
+    }
+
+  int numberOfVertices = meshVertices.size();
+  SCRUTE(numberOfVertices);
+
+  MESSAGE("---");
+
+  int NbTotOfNodesVertices = 0;
+
+  for (int i=0; i<numberOfVertices; i++)
+    {
+      TopoDS_Shape aShapeVertex = meshVertices[i]->GetSubShape();
+
+      const SMESHDS_SubMesh * aSubMeshDSVertex = meshVertices[i]->GetSubMeshDS();
+      SCRUTE(aSubMeshDSVertex);
+
+      int nbNodes = aSubMeshDSVertex->NbNodes();
+      NbTotOfNodesVertices += nbNodes;
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Vertex " << (i+1) << " has " << nbNodes << " Nodes");
+
+      SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSVertex->GetNodes();
+      SCRUTE(nbNodes);
+      int index = 0;
+      while(iteratorNodes->more())
+       {
+         index++;
+         const SMDS_MeshNode * node = iteratorNodes->next();
+//       int nodeId = node->GetID();
+//       double nodeX = node->X();
+//       double nodeY = node->Y();
+//       double nodeZ = node->Z();
+//       MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+       }
+
+      SCRUTE(index);
+    }
+
+  SCRUTE(NbTotOfNodesVertices);
+
+  MESSAGE("NETGENPlugin_NETGEN_3D::Compute --> Analysis of all shell mesh");
+
+  vector<SMESH_subMesh*> meshShells;
+  TopoDS_Shell aShell;
+
+  for (TopExp_Explorer exp(aShape,TopAbs_SHELL);exp.More();exp.Next())
+    {
+      SMESH_subMesh* aSubMesh = aMesh.GetSubMesh(exp.Current());
+      ASSERT(aSubMesh);
+      SCRUTE(aSubMesh);
+      aShell = TopoDS::Shell(exp.Current());
+      meshShells.push_back(aSubMesh);
+    }
+
+  int numberOfShells = meshShells.size();
+  SCRUTE(numberOfShells);
+
+  if (numberOfShells == 1)
+    {
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute Only one shell --> generation of the mesh using directly Netgen");
+
+      /*
+       Prepare the Netgen surface mesh from the SMESHDS
+      */
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute Prepare the Netgen surface mesh from the SMESHDS");
+
+      int spaceDimension = 3;
+      int nbNodesByTri = 3;
+      int nbNodesByTetra = 4;
+
+      int Netgen_NbOfNodes = NbTotOfNodesFaces +
+                            NbTotOfNodesEdges +
+                            NbTotOfNodesVertices;
+      int Netgen_NbOfTria = NbTotOfTria;
+      int Netgen_param2ndOrder = 0;
+      double Netgen_paramFine = 1.;
+      double Netgen_paramSize = _maxElementVolume;
+
+      SCRUTE(Netgen_NbOfNodes);
+      SCRUTE(Netgen_NbOfTria);
+
+      double * Netgen_Coordinates = new double [spaceDimension*
+                                               Netgen_NbOfNodes];
+      int * listNodeCoresNetgenSmesh = new int [Netgen_NbOfNodes];
+      int * Netgen_Connectivity = new int [nbNodesByTri*Netgen_NbOfTria];
+      double * Netgen_point = new double [spaceDimension];
+      int * Netgen_triangle = new int [nbNodesByTri];
+      int * Netgen_tetrahedron = new int [nbNodesByTetra];
+
+      for (int i=0; i<Netgen_NbOfTria; i++)
+       {
+         for (int j=0; j<nbNodesByTri; j++)
+           Netgen_Connectivity[i*nbNodesByTri+j] = 0;
+       }
+
+      double bigNumber = 1.e20;
+
+      for (int i=0; i<Netgen_NbOfNodes; i++)
+       {
+         listNodeCoresNetgenSmesh[i] = 0;
+         for (int j=0; j<spaceDimension; j++)
+           Netgen_Coordinates[i*spaceDimension+j] = bigNumber;
+       }
+
+      int indexNodes = 0;
+      for (int i=0; i<numberOfVertices; i++)
+       {
+         const SMESHDS_SubMesh * aSubMeshDSVertex =
+           meshVertices[i]->GetSubMeshDS();
+
+         SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSVertex->GetNodes();
+
+         while(iteratorNodes->more())
+           {
+             const SMDS_MeshNode * node = iteratorNodes->next();
+             int nodeId = node->GetID();
+             double nodeX = node->X();
+             double nodeY = node->Y();
+             double nodeZ = node->Z();
+//           MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+             listNodeCoresNetgenSmesh[indexNodes] = nodeId;
+             int index = indexNodes*spaceDimension;
+             Netgen_Coordinates[index] = nodeX;
+             Netgen_Coordinates[index+1] = nodeY;
+             Netgen_Coordinates[index+2] = nodeZ;
+             netgenToDS[indexNodes] = node;
+             indexNodes++;
+           }
+       }
+
+      for (int i=0; i<numberOfEdges; i++)
+       {
+         const SMESHDS_SubMesh *  aSubMeshDSEdge =
+           meshEdges[i]->GetSubMeshDS();
+
+         SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSEdge->GetNodes();
+
+         while(iteratorNodes->more())
+           {
+             const SMDS_MeshNode * node = iteratorNodes->next();
+             int nodeId = node->GetID();
+             double nodeX = node->X();
+             double nodeY = node->Y();
+             double nodeZ = node->Z();
+//           MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+             listNodeCoresNetgenSmesh[indexNodes] = node->GetID();
+             int index = indexNodes*spaceDimension;
+             Netgen_Coordinates[index] = node->X();
+             Netgen_Coordinates[index+1] = node->Y();
+             Netgen_Coordinates[index+2] = node->Z();
+             netgenToDS[indexNodes] = node;
+             indexNodes++;
+           }
+       }
+
+      for (int i=0; i<numberOfFaces; i++)
+       {
+         const SMESHDS_SubMesh * aSubMeshDSFace =
+           meshFaces[i]->GetSubMeshDS();
+
+         SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSFace->GetNodes();
+
+         while(iteratorNodes->more())
+           {
+             const SMDS_MeshNode * node = iteratorNodes->next();
+             int nodeId = node->GetID();
+             double nodeX = node->X();
+             double nodeY = node->Y();
+             double nodeZ = node->Z();
+//           MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+             listNodeCoresNetgenSmesh[indexNodes] = nodeId;
+             int index = indexNodes*spaceDimension;
+             Netgen_Coordinates[index] = nodeX;
+             Netgen_Coordinates[index+1] = nodeY;
+             Netgen_Coordinates[index+2] = nodeZ;
+             netgenToDS[indexNodes] = node;
+             indexNodes++;
+           }
+       }
+
+      SCRUTE(indexNodes);
+
+      for (int i=0; i<Netgen_NbOfNodes; i++)
+       {
+         ASSERT(listNodeCoresNetgenSmesh[i] != 0);
+
+         for (int j=0; j<Netgen_NbOfNodes && j!=i; j++)
+           ASSERT(listNodeCoresNetgenSmesh[i] != listNodeCoresNetgenSmesh[j]);
+
+         for (int j=0; j<spaceDimension; j++)
+           ASSERT(Netgen_Coordinates[i*spaceDimension+j] != bigNumber);
+       }
+
+      int indexTrias = 0;
+      for (int i=0; i<numberOfFaces; i++)
+       {
+         const SMESHDS_SubMesh * aSubMeshDSFace =
+           meshFaces[i]->GetSubMeshDS();
+
+         TopoDS_Shape aFace = shapeFaces[i];
+
+         SMDS_ElemIteratorPtr iteratorTriangle = aSubMeshDSFace->GetElements();
+
+         TopoDS_Shape aShapeFace = meshFaces[i]->GetSubShape();
+
+         bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation());
+
+         SCRUTE(orientationMeshFace);
+
+         if (orientationMeshFace)
+           {
+             MESSAGE("The mesh and face have the same orientation");
+
+             while(iteratorTriangle->more())
+               {
+                 const SMDS_MeshElement * triangle = iteratorTriangle->next();
+                 int triangleId = triangle->GetID();
+
+                 SMDS_ElemIteratorPtr triangleNodesIt = triangle->nodesIterator();
+
+                 int triangleNode1 = (triangleNodesIt->next())->GetID();
+                 int triangleNode2 = (triangleNodesIt->next())->GetID();
+                 int triangleNode3 = (triangleNodesIt->next())->GetID();
+
+//               MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3);
+
+                 int N1New = 0;
+                 int N2New = 0;
+                 int N3New = 0;
+                 int index = indexTrias*nbNodesByTri;
+
+                 for (int j=0; j<Netgen_NbOfNodes; j++)
+                   {
+                     int jp1 = j+1;
+
+                     if (triangleNode1 == listNodeCoresNetgenSmesh[j])
+                       N1New = jp1;
+                     else if (triangleNode2 == listNodeCoresNetgenSmesh[j])
+                       N2New = jp1;
+                     else if (triangleNode3 == listNodeCoresNetgenSmesh[j])
+                       N3New = jp1;
+                   }
+
+                 triangleNode1 = N1New;
+                 triangleNode2 = N2New;
+                 triangleNode3 = N3New;
+
+                 Netgen_Connectivity[index] = triangleNode1;
+                 Netgen_Connectivity[index+1] = triangleNode2;
+                 Netgen_Connectivity[index+2] = triangleNode3;
+
+                 indexTrias++;
+               }
+           }
+         else
+           {
+             MESSAGE("The mesh and face have different orientations");
+
+             while(iteratorTriangle->more())
+               {
+                 const SMDS_MeshElement * triangle = iteratorTriangle->next();
+                 int triangleId = triangle->GetID();
+
+                 SMDS_ElemIteratorPtr triangleNodesIt = triangle->nodesIterator();
+
+                 int triangleNode1 = (triangleNodesIt->next())->GetID();
+                 int triangleNode3 = (triangleNodesIt->next())->GetID();
+                 int triangleNode2 = (triangleNodesIt->next())->GetID();
+
+//               MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3);
+
+                 int N1New = 0;
+                 int N2New = 0;
+                 int N3New = 0;
+                 int index = indexTrias*nbNodesByTri;
+
+                 for (int j=0; j<Netgen_NbOfNodes; j++)
+                   {
+                     int jp1 = j+1;
+
+                     if (triangleNode1 == listNodeCoresNetgenSmesh[j])
+                       N1New = jp1;
+                     else if (triangleNode2 == listNodeCoresNetgenSmesh[j])
+                       N2New = jp1;
+                     else if (triangleNode3 == listNodeCoresNetgenSmesh[j])
+                       N3New = jp1;
+                   }
+
+                 triangleNode1 = N1New;
+                 triangleNode2 = N2New;
+                 triangleNode3 = N3New;
+
+                 Netgen_Connectivity[index] = triangleNode1;
+                 Netgen_Connectivity[index+1] = triangleNode2;
+                 Netgen_Connectivity[index+2] = triangleNode3;
+
+                 indexTrias++;
+               }
+           }
+       }
+
+      SCRUTE(indexTrias);
+
+      int * nodesUsed = new int[Netgen_NbOfNodes];
+
+      for (int i=0; i<Netgen_NbOfNodes; i++) nodesUsed[i] = 0;
+
+      for (int i=0; i<Netgen_NbOfTria; i++)
+       for (int j=0; j<nbNodesByTri; j++)
+         {
+           int Nij = Netgen_Connectivity[i*nbNodesByTri+j];
+
+           ASSERT((Nij>=1) && (Nij<=Netgen_NbOfNodes));
+
+           nodesUsed[Nij-1] = 1;
+           Netgen_Connectivity[i*nbNodesByTri+j] = Nij;
+         }
+
+      for (int i=0; i<Netgen_NbOfNodes; i++)
+       {
+         ASSERT(nodesUsed[i] != 0);
+       }
+
+      delete [] nodesUsed;
+
+      /*
+       Feed the Netgen surface mesh
+      */
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute Feed the Netgen surface mesh");
+
+      Ng_Mesh * Netgen_mesh;
+
+      Ng_Init();
+
+      Netgen_mesh = Ng_NewMesh();
+
+      Ng_Meshing_Parameters Netgen_param;
+
+      for (int i=0; i<Netgen_NbOfNodes; i++)
+       {
+         for (int j=0; j<spaceDimension; j++)
+           Netgen_point[j] = Netgen_Coordinates[i*spaceDimension+j];
+
+         Ng_AddPoint(Netgen_mesh, Netgen_point);
+       }
+
+      for (int i=0; i<Netgen_NbOfTria; i++)
+       {
+         for (int j=0; j<nbNodesByTri; j++)
+           Netgen_triangle[j] = Netgen_Connectivity[i*nbNodesByTri+j];
+
+         Ng_AddSurfaceElement(Netgen_mesh, NG_TRIG, Netgen_triangle);
+       }
+
+      SCRUTE(Netgen_paramSize);
+
+      Netgen_param.secondorder = Netgen_param2ndOrder;
+      Netgen_param.fineness = Netgen_paramFine;
+      Netgen_param.maxh = Netgen_paramSize;
+
+      /*
+       Generate the volume mesh
+      */
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute Generate the volume mesh");
+
+      SCRUTE(Netgen_NbOfNodes);
+      SCRUTE(Netgen_NbOfTria);
+
+      SCRUTE(Ng_GetNP(Netgen_mesh));
+      SCRUTE(Ng_GetNE(Netgen_mesh));
+      SCRUTE(Ng_GetNSE(Netgen_mesh));
+
+      ASSERT(Netgen_NbOfNodes == Ng_GetNP(Netgen_mesh));
+      ASSERT(Ng_GetNE(Netgen_mesh) == 0);
+      ASSERT(Netgen_NbOfTria == Ng_GetNSE(Netgen_mesh));
+
+      Ng_Result status;
+
+      status = Ng_GenerateVolumeMesh(Netgen_mesh, &Netgen_param);
+
+      SCRUTE(status);
+
+      int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh);
+
+      int Netgen_NbOfTetra = Ng_GetNE(Netgen_mesh);
+
+      SCRUTE(Netgen_NbOfNodesNew);
+
+      SCRUTE(Netgen_NbOfTetra);
+
+      if ((status != NG_OK) ||
+         (Netgen_NbOfNodesNew <= Netgen_NbOfNodes) ||
+         (Netgen_NbOfTetra <= 0))
+       {
+         MESSAGE("NETGENPlugin_NETGEN_3D::Compute The Volume Mesh Generation has failed ...");
+         SCRUTE(status);
+
+         /*
+           Free the memory needed by to generate the Netgen Mesh
+         */
+
+         MESSAGE("NETGENPlugin_NETGEN_3D::Compute Free the memory needed by to generate the Netgen Mesh");
+
+         delete [] Netgen_Coordinates;
+         delete [] Netgen_Connectivity;
+         delete [] Netgen_point;
+         delete [] Netgen_triangle;
+         delete [] Netgen_tetrahedron;
+
+         delete [] listNodeCoresNetgenSmesh;
+
+         Ng_DeleteMesh(Netgen_mesh);
+         Ng_Exit();
+
+         return false;
+       }
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute End of Volume Mesh Generation");
+      SCRUTE(status);
+
+      double * Netgen_CoordinatesNew = new double [spaceDimension*Netgen_NbOfNodesNew];
+      int * Netgen_ConnectivityNew = new int [nbNodesByTetra*Netgen_NbOfTetra];
+
+      for (int i=0; i<Netgen_NbOfNodesNew; i++)
+       {
+         Ng_GetPoint(Netgen_mesh, (i+1), Netgen_point);
+
+         for (int j=0; j<spaceDimension; j++)
+           Netgen_CoordinatesNew[i*spaceDimension+j] = Netgen_point[j];
+       }
+
+      for (int i=0; i<Netgen_NbOfNodes; i++)
+       for (int j=0; j<spaceDimension; j++)
+         ASSERT(Netgen_CoordinatesNew[i*spaceDimension+j] == Netgen_Coordinates[i*spaceDimension+j])
+
+      for (int i=0; i<Netgen_NbOfTetra; i++)
+       {
+         Ng_GetVolumeElement(Netgen_mesh, (i+1), Netgen_tetrahedron);
+
+         for (int j=0; j<nbNodesByTetra; j++)
+           Netgen_ConnectivityNew[i*nbNodesByTetra+j] = Netgen_tetrahedron[j];
+       }
+
+      /*
+       Feed back the SMESHDS with the generated Nodes and Volume Elements
+      */
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute Feed back the SMESHDS with the generated Nodes and Volume Elements");
+
+      int NbTotOfNodesShell = Netgen_NbOfNodesNew - Netgen_NbOfNodes;
+
+      SCRUTE(NbTotOfNodesShell);
+
+      int * listNodeShellCoresNetgenSmesh = new int [NbTotOfNodesShell];
+
+      for (int i=0; i<NbTotOfNodesShell; i++)
+       listNodeShellCoresNetgenSmesh[i] = 0;
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute --> Adding the New Nodes to SMESHDS");
+
+      for (int i=0; i<NbTotOfNodesShell; i++)
+       {
+         int index = (i+Netgen_NbOfNodes)*spaceDimension;
+
+         SMDS_MeshNode * node =
+           meshDS->AddNode(Netgen_CoordinatesNew[index],
+                           Netgen_CoordinatesNew[index+1],
+                           Netgen_CoordinatesNew[index+2]);
+
+         meshDS->SetNodeInVolume(node, aShell);
+
+         index = i+Netgen_NbOfNodes;
+         netgenToDS[index] = node;
+
+         listNodeShellCoresNetgenSmesh[i] = node->GetID();
+       }
+
+      SCRUTE(Netgen_NbOfNodesNew);
+      
+      SCRUTE(netgenToDS.size());
+
+      for (int i=0; i<NbTotOfNodesShell; i++)
+       {
+         ASSERT(listNodeShellCoresNetgenSmesh[i] != 0);
+
+         for (int j=0; j<NbTotOfNodesShell && j!=i; j++)
+           ASSERT(listNodeShellCoresNetgenSmesh[i] != listNodeShellCoresNetgenSmesh[j]);
+       }
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute --> Adding the New elements (Tetrahedrons) to the SMESHDS");
+
+      for (int i=0; i<Netgen_NbOfTetra; i++)
+       {
+         int index = i*nbNodesByTetra;
+         int tetraNode1 = Netgen_ConnectivityNew[index];
+         int tetraNode2 = Netgen_ConnectivityNew[index+1];
+         int tetraNode3 = Netgen_ConnectivityNew[index+2];
+         int tetraNode4 = Netgen_ConnectivityNew[index+3];
+
+         const SMDS_MeshNode * node1 = netgenToDS[tetraNode1-1];
+         const SMDS_MeshNode * node2 = netgenToDS[tetraNode2-1];
+         const SMDS_MeshNode * node3 = netgenToDS[tetraNode3-1];
+         const SMDS_MeshNode * node4 = netgenToDS[tetraNode4-1];
+
+         index = tetraNode1;
+         if (index <= Netgen_NbOfNodes)
+           tetraNode1 = listNodeCoresNetgenSmesh[index-1];
+         else
+           tetraNode1 = listNodeShellCoresNetgenSmesh[index-Netgen_NbOfNodes-1];
+
+         index = tetraNode2;
+         if (index <= Netgen_NbOfNodes)
+           tetraNode2 = listNodeCoresNetgenSmesh[index-1];
+         else
+           tetraNode2 = listNodeShellCoresNetgenSmesh[index-Netgen_NbOfNodes-1];
+
+         index = tetraNode3;
+         if (index <= Netgen_NbOfNodes)
+           tetraNode3 = listNodeCoresNetgenSmesh[index-1];
+         else
+           tetraNode3 = listNodeShellCoresNetgenSmesh[index-Netgen_NbOfNodes-1];
+
+         index = tetraNode4;
+         if (index <= Netgen_NbOfNodes)
+           tetraNode4 = listNodeCoresNetgenSmesh[index-1];
+         else
+           tetraNode4 = listNodeShellCoresNetgenSmesh[index-Netgen_NbOfNodes-1];
+
+         SMDS_MeshVolume * elt =
+           meshDS->AddVolume(node1,node2,node3,node4);
+
+         meshDS->SetMeshElementOnShape(elt, aShell);
+       }
+
+      /*
+       Free the memory needed by to generate the Netgen Mesh
+      */
+
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute Free the memory needed by to generate the Netgen Mesh");
+
+      delete [] Netgen_Coordinates;
+      delete [] Netgen_Connectivity;
+      delete [] Netgen_CoordinatesNew;
+      delete [] Netgen_ConnectivityNew;
+      delete [] Netgen_point;
+      delete [] Netgen_triangle;
+      delete [] Netgen_tetrahedron;
+
+      delete [] listNodeCoresNetgenSmesh;
+      delete [] listNodeShellCoresNetgenSmesh;
+
+      Ng_DeleteMesh(Netgen_mesh);
+      Ng_Exit();
+
+      /*
+       Verification
+      */
+
+      {
+       MESSAGE("NETGENPlugin_NETGEN_3D::Compute Verification of the Shell mesh");
+
+       TopoDS_Shape aShapeShell = meshShells[0]->GetSubShape();
+       SMESH_Algo* algoShell = _gen->GetAlgo(aMesh, aShapeShell);
+       string algoShellName = algoShell->GetName();
+       SCRUTE(algoShellName);
+       if (algoShellName != "NETGEN_3D")
+         {
+           SCRUTE(algoShellName);
+           ASSERT(0);
+           return false;
+         }
+
+       const SMESHDS_SubMesh * aSubMeshDSShell = meshShells[0]->GetSubMeshDS();
+       SCRUTE(&aSubMeshDSShell);
+
+       int nbNodes = aSubMeshDSShell->NbNodes();
+       int nbTetra = aSubMeshDSShell->NbElements();
+
+       MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Shell has " << nbNodes << " shell internal Nodes, " << nbTetra << " tetrahedrons");
+
+       SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSShell->GetNodes();
+
+       SCRUTE(nbNodes);
+
+       int index;
+
+       index = 0;
+
+       while(iteratorNodes->more())
+         {
+           index++;
+           const SMDS_MeshNode * node = iteratorNodes->next();
+           int nodeId = node->GetID();
+           double nodeX = node->X();
+           double nodeY = node->Y();
+           double nodeZ = node->Z();
+//         MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ);
+         }
+
+       SCRUTE(index);
+
+       SMDS_ElemIteratorPtr iteratorTetra = aSubMeshDSShell->GetElements();
+
+       SCRUTE(nbTetra);
+
+       index = 0;
+       while(iteratorTetra->more())
+         {
+           index++;
+           const SMDS_MeshElement * tetra = iteratorTetra->next();
+           int tetraId = tetra->GetID();
+
+           SMDS_ElemIteratorPtr tetraNodesIt = tetra->nodesIterator();
+
+           int tetraNode1 = (tetraNodesIt->next())->GetID();
+           int tetraNode2 = (tetraNodesIt->next())->GetID();
+           int tetraNode3 = (tetraNodesIt->next())->GetID();
+           int tetraNode4 = (tetraNodesIt->next())->GetID();
+
+//         MESSAGE("TETRAHEDRON -> ID = " << tetraId << " N1 = " << tetraNode1 << " N2 = " << tetraNode2 << " N3 = " << tetraNode3 << " N4 = " << tetraNode4);
+
+         }
+
+       SCRUTE(index);
+      }
+    }
+  else
+    {
+      SCRUTE(numberOfShells);
+      MESSAGE("NETGENPlugin_NETGEN_3D::Compute ERROR More than one shell ????? ");
+      return false;
+    }
+
+  return true;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & NETGENPlugin_NETGEN_3D::SaveTo(ostream & save)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & NETGENPlugin_NETGEN_3D::LoadFrom(istream & load)
+{
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, NETGENPlugin_NETGEN_3D & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, NETGENPlugin_NETGEN_3D & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx
new file mode 100644 (file)
index 0000000..b085880
--- /dev/null
@@ -0,0 +1,43 @@
+//=============================================================================
+// File      : NETGENPlugin_NETGEN_3D.hxx
+//             Moved here from SMESH_NETGEN_3D.hxx
+// Created   : lundi 27 Janvier 2003
+// Author    : Nadir BOUHAMOU (CEA)
+// Project   : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
+
+#ifndef _NETGENPlugin_NETGEN_3D_HXX_
+#define _NETGENPlugin_NETGEN_3D_HXX_
+
+#include "SMESH_3D_Algo.hxx"
+#include "SMESH_Mesh.hxx"
+#include "StdMeshers_MaxElementVolume.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
+{
+public:
+  NETGENPlugin_NETGEN_3D(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~NETGENPlugin_NETGEN_3D();
+
+  virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+                               const TopoDS_Shape& aShape,
+                               SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+  virtual bool Compute(SMESH_Mesh& aMesh,
+                      const TopoDS_Shape& aShape);
+
+  ostream & SaveTo(ostream & save);
+  istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, NETGENPlugin_NETGEN_3D & hyp);
+  friend istream & operator >> (istream & load, NETGENPlugin_NETGEN_3D & hyp);
+
+protected:
+  double _maxElementVolume;
+
+  const StdMeshers_MaxElementVolume* _hypMaxElementVolume;
+};
+
+#endif
diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx
new file mode 100644 (file)
index 0000000..489d682
--- /dev/null
@@ -0,0 +1,85 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : NETGENPlugin_NETGEN_3D_i.cxx
+//           Moved here from SMESH_NETGEN_3D_i.cxx
+//  Author : Nadir Bouhamou CEA
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "NETGENPlugin_NETGEN_3D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr thePOA,
+                                     int                     theStudyId,
+                                     ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA ), 
+       SMESH_Algo_i( thePOA ),
+       SMESH_3D_Algo_i( thePOA )
+{
+  MESSAGE( "NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i" );
+  myBaseImpl = new ::NETGENPlugin_NETGEN_3D( theGenImpl->GetANewId(),
+                                     theStudyId,
+                                     theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i()
+{
+  MESSAGE( "NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i" );
+}
+
+//=============================================================================
+/*!
+ *  NETGENPlugin_NETGEN_3D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::NETGENPlugin_NETGEN_3D* NETGENPlugin_NETGEN_3D_i::GetImpl()
+{
+  MESSAGE( "NETGENPlugin_NETGEN_3D_i::GetImpl" );
+  return ( ::NETGENPlugin_NETGEN_3D* )myBaseImpl;
+}
+
diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx
new file mode 100644 (file)
index 0000000..724fafa
--- /dev/null
@@ -0,0 +1,58 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : NETGENPlugin_NETGEN_3D_i.hxx
+//           Moved here from SMESH_NETGEN_3D_i.hxx
+//  Author : Nadir Bouhamou CEA
+//  Module : SMESH
+//  $Header$
+
+#ifndef _NETGENPlugin_NETGEN_3D_I_HXX_
+#define _NETGENPlugin_NETGEN_3D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_NetgenAlgorithm)
+
+#include "SMESH_3D_Algo_i.hxx"
+#include "NETGENPlugin_NETGEN_3D.hxx"
+
+// ======================================================
+// NETGEN 3d algorithm
+// ======================================================
+class NETGENPlugin_NETGEN_3D_i:
+  public virtual POA_NETGENPlugin::NETGENPlugin_NETGEN_3D,
+  public virtual SMESH_3D_Algo_i
+{
+public:
+  // Constructor
+  NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr thePOA,
+                     int                     theStudyId,
+                     ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~NETGENPlugin_NETGEN_3D_i();
+  // Get implementation
+  ::NETGENPlugin_NETGEN_3D* GetImpl();
+};
+
+#endif
diff --git a/src/NETGENPlugin/NETGENPlugin_i.cxx b/src/NETGENPlugin/NETGENPlugin_i.cxx
new file mode 100644 (file)
index 0000000..7ec0e06
--- /dev/null
@@ -0,0 +1,60 @@
+//  SMESH NETGENPlugin : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : NETGENPlugin.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "SMESH_Hypothesis_i.hxx"
+#include "SMESH_Gen_i.hxx"
+
+#include "utilities.h"
+
+#include "NETGENPlugin_NETGEN_3D_i.hxx"
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+extern "C"
+{
+  GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
+  {
+    MESSAGE("GetHypothesisCreator " << aHypName);
+
+    GenericHypothesisCreator_i* aCreator = 0;
+
+    // Hypotheses
+
+    // Algorithms
+    if (strcmp(aHypName, "NETGEN_3D") == 0)
+      aCreator = new HypothesisCreator_i<NETGENPlugin_NETGEN_3D_i>;
+    else ;
+
+    return aCreator;
+  }
+}
diff --git a/src/NETGENPlugin/NETGENPlugin_icons.po b/src/NETGENPlugin/NETGENPlugin_icons.po
new file mode 100644 (file)
index 0000000..a3f6297
--- /dev/null
@@ -0,0 +1,20 @@
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: YYYY-MM-DD\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+#-----------------------------------------------------------
+# ObjectBrowser
+#-----------------------------------------------------------
+
+#mesh_tree_algo_netgen
+msgid "ICON_SMESH_TREE_ALGO_NETGEN_3D"
+msgstr "mesh_tree_algo_tetra.png"
+#msgstr "mesh_tree_algo_netgen.png"
diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx
new file mode 100644 (file)
index 0000000..950bf83
--- /dev/null
@@ -0,0 +1,357 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_Actor.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+
+#include "SMESH_DeviceActor.h"
+
+#include "SALOME_Transform.h"
+#include "SALOME_TransformFilter.h"
+#include "SALOME_PassThroughFilter.h"
+#include "SALOME_ExtractUnstructuredGrid.h"
+
+#include "utilities.h"
+
+// VTK Includes
+#include <vtkObjectFactory.h>
+#include <vtkShrinkFilter.h>
+#include <vtkShrinkPolyData.h>
+
+#include <vtkProperty.h>
+#include <vtkPolyData.h>
+#include <vtkMergeFilter.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
+using namespace std;
+
+
+vtkStandardNewMacro(SMESH_DeviceActor);
+
+
+SMESH_DeviceActor::SMESH_DeviceActor(){
+  if(MYDEBUG) MESSAGE("SMESH_DeviceActor");
+  myIsShrunk = false;
+  myIsShrinkable = false;
+  myRepresentation = eSurface;
+
+  myProperty = vtkProperty::New();
+  myMapper = vtkPolyDataMapper::New();
+
+  vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+                                                                myPolygonOffsetUnits);
+  //myMapper->SetResolveCoincidentTopologyToShiftZBuffer();
+  //myMapper->SetResolveCoincidentTopologyZShift(0.02);
+  
+  myMapper->UseLookupTableScalarRangeOn();
+  myMapper->SetColorModeToMapScalars();
+
+  myShrinkFilter = vtkShrinkFilter::New();
+
+  myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
+  myExtractUnstructuredGrid->SetStoreMapping(true);
+
+  myMergeFilter = vtkMergeFilter::New();
+
+  myStoreMapping = false;
+  myGeomFilter = SALOME_GeometryFilter::New();
+
+  myTransformFilter = SALOME_TransformFilter::New();
+
+  for(int i = 0; i < 6; i++)
+    myPassFilter.push_back(SALOME_PassThroughFilter::New());
+}
+
+
+SMESH_DeviceActor::~SMESH_DeviceActor(){
+  if(MYDEBUG) MESSAGE("~SMESH_DeviceActor");
+  myProperty->Delete();
+
+  myMapper->RemoveAllInputs();
+  myMapper->Delete();
+
+  myShrinkFilter->UnRegisterAllOutputs();
+  myShrinkFilter->Delete();
+
+  myExtractUnstructuredGrid->UnRegisterAllOutputs();
+  myExtractUnstructuredGrid->Delete();
+
+  myMergeFilter->UnRegisterAllOutputs();
+  myMergeFilter->Delete();
+
+  myGeomFilter->UnRegisterAllOutputs();
+  myGeomFilter->Delete();
+
+  myTransformFilter->UnRegisterAllOutputs();
+  myTransformFilter->Delete();
+
+  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
+    myPassFilter[i]->UnRegisterAllOutputs(); 
+    myPassFilter[i]->Delete();
+  }
+}
+
+
+void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){
+  myStoreMapping = theStoreMapping;
+  Modified();
+}
+
+
+void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
+  if(theGrid){
+    //myIsShrinkable = theGrid->GetNumberOfCells() > 10;
+    myIsShrinkable = true;
+
+    myExtractUnstructuredGrid->SetInput(theGrid);
+    myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
+
+    theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
+
+    int anId = 0;
+    myPassFilter.at( anId )->SetInput( theGrid );
+    myPassFilter.at( anId + 1)->SetInput( myPassFilter.at( anId )->GetOutput() );
+    
+    anId++; // 1
+    myGeomFilter->SetStoreMapping( myStoreMapping );
+    myGeomFilter->SetInput( myPassFilter.at( anId )->GetOutput() );
+
+    anId++; // 2
+    myPassFilter.at( anId )->SetInput( myGeomFilter->GetOutput() ); 
+    myPassFilter.at( anId + 1 )->SetInput( myPassFilter.at( anId )->GetOutput() );
+
+    anId++; // 3
+    myTransformFilter->SetInput( myPassFilter.at( anId )->GetPolyDataOutput() );
+
+    anId++; // 4
+    myPassFilter.at( anId )->SetInput( myTransformFilter->GetOutput() );
+    myPassFilter.at( anId + 1 )->SetInput( myPassFilter.at( anId )->GetOutput() );
+
+    anId++; // 5
+    myMapper->SetInput( myPassFilter.at( anId )->GetPolyDataOutput() );
+
+    vtkLODActor::SetMapper( myMapper );
+    Modified();
+  }
+}
+
+
+SALOME_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
+  return myExtractUnstructuredGrid;
+}
+
+
+vtkUnstructuredGrid* SMESH_DeviceActor::GetUnstructuredGrid(){
+  myExtractUnstructuredGrid->Update();
+  return myExtractUnstructuredGrid->GetOutput();
+}
+
+
+vtkMergeFilter* SMESH_DeviceActor::GetMergeFilter(){
+  return myMergeFilter;
+}
+
+
+vtkPolyData* SMESH_DeviceActor::GetPolyDataInput(){
+  return myPassFilter.back()->GetPolyDataOutput();
+}
+
+
+unsigned long int SMESH_DeviceActor::GetMTime(){
+  unsigned long mTime = this->Superclass::GetMTime();
+  mTime = max(mTime,myExtractUnstructuredGrid->GetMTime());
+  mTime = max(mTime,myMergeFilter->GetMTime());
+  mTime = max(mTime,myGeomFilter->GetMTime());
+  mTime = max(mTime,myTransformFilter->GetMTime());
+  return mTime;
+}
+
+
+void SMESH_DeviceActor::SetTransform(SALOME_Transform* theTransform){
+  myTransformFilter->SetTransform(theTransform);
+}
+
+
+void SMESH_DeviceActor::SetShrink()
+{
+  if ( !myIsShrinkable ) return;
+  if ( vtkDataSet* aDataSet = myPassFilter.at( 0 )->GetOutput() )
+  {
+    myShrinkFilter->SetInput( aDataSet );
+    myPassFilter.at( 1 )->SetInput( myShrinkFilter->GetOutput() );
+    myIsShrunk = true;
+  }
+}
+
+void SMESH_DeviceActor::UnShrink()
+{
+  if ( !myIsShrunk ) return;
+  if ( vtkDataSet* aDataSet = myPassFilter.at( 0 )->GetOutput() )
+  {
+    myPassFilter.at( 1 )->SetInput( aDataSet );
+    myPassFilter.at( 1 )->Modified();
+    myIsShrunk = false;
+    Modified();
+  }
+}
+
+
+void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){ 
+  switch(theMode){
+  case ePoint: 
+    myGeomFilter->SetInside(true);
+    GetProperty()->SetRepresentation(0);
+    break;
+  case eInsideframe: 
+    myGeomFilter->SetInside(true);
+    GetProperty()->SetRepresentation(1);
+    break;
+  default :
+    GetProperty()->SetRepresentation(theMode);
+    myGeomFilter->SetInside(false);
+  }
+  myRepresentation = theMode;
+  myMapper->Modified();
+  Modified();
+}
+
+
+void SMESH_DeviceActor::SetVisibility(int theMode){
+  if(!myExtractUnstructuredGrid->GetInput() || GetUnstructuredGrid()->GetNumberOfCells()){
+    vtkLODActor::SetVisibility(theMode);
+  }else{
+    vtkLODActor::SetVisibility(false);
+  }
+}
+
+
+int SMESH_DeviceActor::GetVisibility(){
+  if(!GetUnstructuredGrid()->GetNumberOfCells()){
+    vtkLODActor::SetVisibility(false);
+  }
+  return vtkLODActor::GetVisibility();
+}
+
+
+int SMESH_DeviceActor::GetObjId(int theVtkID){
+  if (GetRepresentation() == ePoint){
+    return GetNodeObjId(theVtkID);
+  }else{
+    return GetElemObjId(theVtkID);
+  }
+}
+
+
+SMESH_DeviceActor::TVectorId SMESH_DeviceActor::GetVtkId(int theObjID){
+  if (GetRepresentation() == ePoint){
+    return GetNodeVtkId(theObjID);
+  }else{
+    return GetElemVtkId(theObjID);
+  }
+}
+
+
+int SMESH_DeviceActor::GetNodeObjId(int theVtkID){
+  vtkIdType aRetID = myVisualObj->GetNodeObjId(theVtkID);
+  if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; aRetID = "<<aRetID);
+  return aRetID;
+}
+
+SMESH_DeviceActor::TVectorId SMESH_DeviceActor::GetNodeVtkId(int theObjID){
+  SMESH_DeviceActor::TVectorId aVecId;
+  vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
+  if(anID < 0) 
+    return aVecId;
+  aVecId.push_back(anID);
+  return aVecId;
+}
+
+
+int SMESH_DeviceActor::GetElemObjId(int theVtkID){
+  vtkIdType aGridID = myGeomFilter->GetObjId(theVtkID);
+  if(aGridID < 0) 
+    return -1;
+  vtkIdType anExtractID = myExtractUnstructuredGrid->GetOutId(aGridID);
+  if(anExtractID < 0) 
+    return -1;
+  vtkIdType aRetID = myVisualObj->GetElemObjId(anExtractID);
+  if(MYDEBUG) 
+    MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anExtractID = "<<anExtractID<<"; aGridID = "<<aGridID<<"; aRetID = "<<aRetID);
+  return aRetID;
+}
+
+SMESH_DeviceActor::TVectorId SMESH_DeviceActor::GetElemVtkId(int theObjID){
+  TVectorId aVecId;
+  vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID);
+  if(aGridID < 0) 
+    return aVecId;
+  aVecId = myGeomFilter->GetVtkId(aGridID);
+  if(MYDEBUG) 
+    MESSAGE("GetElemVtkId - theObjID = "<<theObjID<<"; aGridID = "<<aGridID<<"; aGridID = "<<aGridID<<"; aVecId[0] = "<<aVecId[0]);
+  return aVecId;
+}
+
+
+float SMESH_DeviceActor::GetShrinkFactor(){
+  return myShrinkFilter->GetShrinkFactor();
+}
+
+void SMESH_DeviceActor::SetShrinkFactor(float theValue){
+  theValue = theValue > 0.1? theValue: 0.8;
+  myShrinkFilter->SetShrinkFactor(theValue);
+  Modified();
+}
+
+
+void SMESH_DeviceActor::Render(vtkRenderer *ren, vtkMapper* m){
+  int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
+  float aFactor, aUnit; 
+  vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+
+  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
+  vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+                                                                myPolygonOffsetUnits);
+  vtkLODActor::Render(ren,m);
+
+  vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+  vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
+}
+
+
+void SMESH_DeviceActor::SetPolygonOffsetParameters(float factor, float units){
+  myPolygonOffsetFactor = factor;
+  myPolygonOffsetUnits = units;
+}
+
diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h
new file mode 100644 (file)
index 0000000..c166650
--- /dev/null
@@ -0,0 +1,133 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_Actor.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESH_DEVICE_ACTOR_H
+#define SMESH_DEVICE_ACTOR_H
+
+#include "SALOME_GeometryFilter.h"
+#include "SMESH_Object.h"
+
+#include <vtkLODActor.h>
+
+class vtkProperty;
+class vtkMergeFilter;
+class vtkShrinkFilter;
+class vtkPolyDataMapper;
+class vtkUnstructuredGrid;
+
+class SALOME_Transform;
+class SALOME_TransformFilter;
+class SALOME_PassThroughFilter;
+class SALOME_ExtractUnstructuredGrid;
+
+
+class SMESH_DeviceActor: public vtkLODActor{
+  friend class SMESH_Actor;
+
+ public:
+  vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
+  static SMESH_DeviceActor* New();
+
+  void SetStoreMapping(int theStoreMapping);
+  int GetStoreMapping(){ return myStoreMapping;}
+
+  typedef SALOME_GeometryFilter::TVectorId TVectorId;
+  int GetObjId(int theVtkID);
+  TVectorId GetVtkId(int theObjID);
+
+  int GetNodeObjId(int theVtkID);
+  TVectorId GetNodeVtkId(int theObjID);
+
+  int GetElemObjId(int theVtkID);
+  TVectorId GetElemVtkId(int theObjID);
+
+  vtkPolyData* GetPolyDataInput(); 
+
+  virtual void SetTransform(SALOME_Transform* theTransform); 
+  virtual unsigned long int GetMTime();
+
+  float GetShrinkFactor();
+  void  SetShrinkFactor(float value);
+
+  bool IsShrunkable() { return myIsShrinkable;}
+  bool IsShrunk() { return myIsShrunk;}
+  void SetShrink(); 
+  void UnShrink(); 
+
+  enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
+  EReperesent GetRepresentation(){ return myRepresentation;}
+  void SetRepresentation(EReperesent theMode);
+
+  virtual void SetVisibility(int theMode);
+  virtual int GetVisibility();
+
+  SALOME_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
+  vtkUnstructuredGrid* GetUnstructuredGrid();
+  vtkMergeFilter* GetMergeFilter();
+
+  virtual void Render(vtkRenderer *, vtkMapper *);
+
+ protected:
+  void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
+
+  vtkPolyDataMapper *myMapper;
+  TVisualObjPtr myVisualObj;
+
+  vtkProperty *myProperty;
+  EReperesent myRepresentation;
+
+  vtkMergeFilter* myMergeFilter;
+  SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
+
+  bool myStoreMapping;
+  SALOME_GeometryFilter *myGeomFilter;
+  SALOME_TransformFilter *myTransformFilter;
+  std::vector<SALOME_PassThroughFilter*> myPassFilter;
+
+  vtkShrinkFilter* myShrinkFilter;
+  bool myIsShrinkable;
+  bool myIsShrunk;
+  
+  float myPolygonOffsetFactor;
+  float myPolygonOffsetUnits;
+
+  void SetPolygonOffsetParameters(float factor, float units);
+  void GetPolygonOffsetParameters(float& factor, float& units){
+    factor = myPolygonOffsetFactor;
+    units = myPolygonOffsetUnits;
+  }
+
+  SMESH_DeviceActor();
+  ~SMESH_DeviceActor();
+  SMESH_DeviceActor(const SMESH_DeviceActor&) {};
+  void operator=(const SMESH_DeviceActor&) {};
+
+};
+
+
+#endif //SMESH_ACTOR_H
diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx
new file mode 100644 (file)
index 0000000..eb39610
--- /dev/null
@@ -0,0 +1,1037 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_Grid.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+
+#include "SMESH_Object.h"
+#include "SMDS_Mesh.hxx"
+#include "SALOME_ExtractUnstructuredGrid.h"
+#include "SMESH_Actor.h"
+
+#include CORBA_SERVER_HEADER(SALOME_Exception)
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkUnstructuredGridWriter.h>
+#include <vtkUnstructuredGridReader.h>
+
+#include <memory>
+#include <sstream>     
+#include <stdexcept>
+#include <set>
+
+#include "utilities.h"
+
+using namespace std;
+
+#ifndef EXCEPTION
+#define EXCEPTION(TYPE, MSG) {\
+  std::ostringstream aStream;\
+  aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
+  throw TYPE(aStream.str());\
+}
+#endif
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+static int MYDEBUGWITHFILES = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+#endif
+
+
+void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
+  vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
+  aWriter->SetFileName(theFileName);
+  aWriter->SetInput(theGrid);
+  aWriter->Write();
+  aWriter->Delete();
+}
+
+
+namespace{
+
+  inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){
+    if(const SMDS_MeshNode* anElem = theMesh->FindNode(theId)) return anElem;
+    EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
+  }
+
+
+  inline const SMDS_MeshElement* FindElement(const SMDS_Mesh* theMesh, int theId){
+    if(const SMDS_MeshElement* anElem = theMesh->FindElement(theId)) return anElem;
+    EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot find a SMDS_MeshElement for ID = "<<theId);
+  }
+
+
+  inline void AddNodesWithID(SMDS_Mesh* theMesh, 
+                            SMESH::log_array_var& theSeq,
+                            CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(3*aNbElems != aCoords.length())
+      EXCEPTION(runtime_error,"AddNodesWithID - 3*aNbElems != aCoords.length()");
+    for(CORBA::Long aCoordId = 0; anElemId < aNbElems; anElemId++, aCoordId+=3){
+      SMDS_MeshElement* anElem = theMesh->AddNodeWithID(aCoords[aCoordId],
+                                                       aCoords[aCoordId+1],
+                                                       aCoords[aCoordId+2],
+                                                       anIndexes[anElemId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddNodeWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddEdgesWithID(SMDS_Mesh* theMesh, 
+                            SMESH::log_array_var& theSeq,
+                            CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(3*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 3*aNbElems != aCoords.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=3){
+      SMDS_MeshElement* anElem = theMesh->AddEdgeWithID(anIndexes[anIndexId+1],
+                                                       anIndexes[anIndexId+2],
+                                                       anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddEdgeWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddTriasWithID(SMDS_Mesh* theMesh, 
+                            SMESH::log_array_var& theSeq,
+                            CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(4*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 4*aNbElems != anIndexes.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=4){
+      SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
+                                                       anIndexes[anIndexId+2],
+                                                       anIndexes[anIndexId+3],
+                                                       anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddQuadsWithID(SMDS_Mesh* theMesh, 
+                            SMESH::log_array_var theSeq,
+                            CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(5*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 4*aNbElems != anIndexes.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=5){
+      SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
+                                                       anIndexes[anIndexId+2],
+                                                       anIndexes[anIndexId+3],
+                                                       anIndexes[anIndexId+4],
+                                                       anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddTetrasWithID(SMDS_Mesh* theMesh, 
+                             SMESH::log_array_var& theSeq,
+                             CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(5*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 5*aNbElems != anIndexes.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=5){
+      SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
+                                                         anIndexes[anIndexId+2],
+                                                         anIndexes[anIndexId+3],
+                                                         anIndexes[anIndexId+4],
+                                                         anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddPiramidsWithID(SMDS_Mesh* theMesh, 
+                               SMESH::log_array_var& theSeq,
+                               CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(6*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 6*aNbElems != anIndexes.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=6){
+      SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
+                                                         anIndexes[anIndexId+2],
+                                                         anIndexes[anIndexId+3],
+                                                         anIndexes[anIndexId+4],
+                                                         anIndexes[anIndexId+5],
+                                                         anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddPrismsWithID(SMDS_Mesh* theMesh, 
+                             SMESH::log_array_var& theSeq,
+                             CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(7*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 7*aNbElems != anIndexes.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=7){
+      SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
+                                                         anIndexes[anIndexId+2],
+                                                         anIndexes[anIndexId+3],
+                                                         anIndexes[anIndexId+4],
+                                                         anIndexes[anIndexId+5],
+                                                         anIndexes[anIndexId+6],
+                                                         anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+    }
+  }
+
+
+  inline void AddHexasWithID(SMDS_Mesh* theMesh, 
+                            SMESH::log_array_var& theSeq,
+                            CORBA::Long theId)
+  {
+    const SMESH::double_array& aCoords = theSeq[theId].coords;
+    const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+    CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+    if(9*aNbElems != anIndexes.length())
+      EXCEPTION(runtime_error,"AddEdgeWithID - 9*aNbElems != anIndexes.length()");
+    for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=9){
+      SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
+                                                         anIndexes[anIndexId+2],
+                                                         anIndexes[anIndexId+3],
+                                                         anIndexes[anIndexId+4],
+                                                         anIndexes[anIndexId+5],
+                                                         anIndexes[anIndexId+6],
+                                                         anIndexes[anIndexId+7],
+                                                         anIndexes[anIndexId+8],
+                                                         anIndexes[anIndexId]);
+      if(!anElem)
+       EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
+    }
+  }
+
+
+}
+/*
+  Class       : SMESH_VisualObj
+  Description : Base class for all mesh objects to be visuilised
+*/
+
+//=================================================================================
+// function : getCellType
+// purpose  : Get type of VTK cell
+//=================================================================================
+static inline vtkIdType getCellType( const SMESH::ElementType theType,
+                                     const int theNbNodes )
+{
+  switch( theType )
+  {
+    case SMESH::EDGE: return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
+
+    case SMESH::FACE  : if      ( theNbNodes == 3 ) return VTK_TRIANGLE;
+                        else if ( theNbNodes == 4 ) return VTK_QUAD;
+                        else                        return VTK_EMPTY_CELL;
+
+    case SMESH::VOLUME: if      ( theNbNodes == 4 ) return VTK_TETRA;
+                        else if ( theNbNodes == 5 ) return VTK_PYRAMID;
+                        else if ( theNbNodes == 6 ) return VTK_WEDGE;
+                        else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
+                        else                        return VTK_EMPTY_CELL;
+
+    default: return VTK_EMPTY_CELL;
+  }
+}
+
+//=================================================================================
+// functions : SMESH_VisualObj
+// purpose   : Constructor
+//=================================================================================
+SMESH_VisualObj::SMESH_VisualObj()
+{
+  myGrid = vtkUnstructuredGrid::New();
+}
+SMESH_VisualObj::~SMESH_VisualObj()
+{
+  if ( MYDEBUG )
+    MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
+  myGrid->Delete();
+}
+
+//=================================================================================
+// functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId
+// purpose   : Methods for retrieving VTK IDs by SMDS IDs and  vice versa
+//=================================================================================
+vtkIdType SMESH_VisualObj::GetNodeObjId( int theVTKID )
+{
+  return myVTK2SMDSNodes.find(theVTKID) == myVTK2SMDSNodes.end() ? -1 : myVTK2SMDSNodes[theVTKID];
+}
+
+vtkIdType SMESH_VisualObj::GetNodeVTKId( int theObjID )
+{
+  return mySMDS2VTKNodes.find(theObjID) == mySMDS2VTKNodes.end() ? -1 : mySMDS2VTKNodes[theObjID];
+}
+
+vtkIdType SMESH_VisualObj::GetElemObjId( int theVTKID )
+{
+  return myVTK2SMDSElems.find(theVTKID) == myVTK2SMDSElems.end() ? -1 : myVTK2SMDSElems[theVTKID];
+}
+
+vtkIdType SMESH_VisualObj::GetElemVTKId( int theObjID )
+{
+  return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID];
+}
+
+//=================================================================================
+// function : SMESH_VisualObj::createPoints
+// purpose  : Create points from nodes
+//=================================================================================
+void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
+{
+  if ( thePoints == 0 )
+    return;
+
+  TEntityList aNodes;
+  vtkIdType nbNodes = GetEntities( SMESH::NODE, aNodes );
+  thePoints->SetNumberOfPoints( nbNodes );
+  
+  int nbPoints = 0;
+
+  TEntityList::const_iterator anIter;
+  for ( anIter = aNodes.begin(); anIter != aNodes.end(); ++anIter )
+  {
+    const SMDS_MeshNode* aNode = ( const SMDS_MeshNode* )(*anIter);
+    if ( aNode != 0 )
+    {
+      thePoints->SetPoint( nbPoints, aNode->X(), aNode->Y(), aNode->Z() );
+      int anId = aNode->GetID();
+      mySMDS2VTKNodes.insert( TMapOfIds::value_type( anId, nbPoints ) );
+      myVTK2SMDSNodes.insert( TMapOfIds::value_type( nbPoints, anId ) );
+      nbPoints++;
+    }
+  }
+
+  if ( nbPoints != nbNodes )
+    thePoints->SetNumberOfPoints( nbPoints );
+}
+
+//=================================================================================
+// function : buildPrs
+// purpose  : create VTK cells( fill unstructured grid )
+//=================================================================================
+void SMESH_VisualObj::buildPrs()
+{
+  try
+  {
+    mySMDS2VTKNodes.clear();
+    myVTK2SMDSNodes.clear();
+    mySMDS2VTKElems.clear();
+    myVTK2SMDSElems.clear();
+    
+    if ( IsNodePrs() )
+      buildNodePrs();
+    else
+      buildElemPrs();
+  }
+  catch( const std::exception& exc )
+  {
+    INFOS("Follow exception was cought:\n\t"<<exc.what());
+  }
+  catch(...)
+  {
+    INFOS("Unknown exception was cought !!!");
+  }
+  
+  if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
+  if( MYDEBUGWITHFILES ) WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
+}
+
+//=================================================================================
+// function : buildNodePrs
+// purpose  : create VTK cells for nodes
+//=================================================================================
+void SMESH_VisualObj::buildNodePrs()
+{
+  vtkPoints* aPoints = vtkPoints::New();
+  createPoints( aPoints );
+  int nbPoints = aPoints->GetNumberOfPoints();
+  myGrid->SetPoints( aPoints );
+  aPoints->Delete();
+
+  myGrid->SetCells( 0, 0, 0 );
+
+  // Create cells
+
+  /*vtkIdList *anIdList = vtkIdList::New();
+  anIdList->SetNumberOfIds( 1 );
+
+  vtkCellArray *aCells = vtkCellArray::New();
+  aCells->Allocate( 2 * nbPoints, 0 );
+
+  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+  aCellTypesArray->SetNumberOfComponents( 1 );
+  aCellTypesArray->Allocate( nbPoints );
+
+  for( vtkIdType aCellId = 0; aCellId < nbPoints; aCellId++ )
+  {
+    anIdList->SetId( 0, aCellId );
+    aCells->InsertNextCell( anIdList );
+    aCellTypesArray->InsertNextValue( VTK_VERTEX );
+  }
+
+  vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+  aCellLocationsArray->SetNumberOfComponents( 1 );
+  aCellLocationsArray->SetNumberOfTuples( nbPoints );
+
+  aCells->InitTraversal();
+  for( vtkIdType i = 0, *pts, npts; aCells->GetNextCell( npts, pts ); i++ )
+    aCellLocationsArray->SetValue( i, aCells->GetTraversalLocation( npts ) );
+
+  myGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
+
+  aCellLocationsArray->Delete();
+  aCellTypesArray->Delete();
+  aCells->Delete();
+  anIdList->Delete(); */
+}
+
+//=================================================================================
+// function : buildElemPrs
+// purpose  : Create VTK cells for elements
+//=================================================================================
+void SMESH_VisualObj::buildElemPrs()
+{
+  // Create points
+  
+  vtkPoints* aPoints = vtkPoints::New();
+  createPoints( aPoints );
+  myGrid->SetPoints( aPoints );
+  aPoints->Delete();
+    
+  if ( MYDEBUG )
+    MESSAGE("Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints());
+
+  // Calculate cells size
+
+  static SMESH::ElementType aTypes[ 3 ] = { SMESH::EDGE, SMESH::FACE, SMESH::VOLUME };
+
+  // get entity data
+  map< int, int >         nbEnts;
+  map< int, TEntityList > anEnts;
+
+  for ( int i = 0; i <= 2; i++ )
+    nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
+
+  vtkIdType aCellsSize =  3 * nbEnts[ SMESH::EDGE ];
+
+  for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
+  {
+    if ( nbEnts[ aTypes[ i ] ] )
+    {
+      const TEntityList& aList = anEnts[ aTypes[ i ] ];
+      TEntityList::const_iterator anIter;
+      for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
+        aCellsSize += (*anIter)->NbNodes() + 1;
+    }
+  }
+
+  vtkIdType aNbCells = nbEnts[ SMESH::EDGE ] + nbEnts[ SMESH::FACE ] + nbEnts[ SMESH::VOLUME ];
+  
+  if ( MYDEBUG )
+    MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
+
+  // Create cells
+  
+  vtkCellArray* aConnectivity = vtkCellArray::New();
+  aConnectivity->Allocate( aCellsSize, 0 );
+  
+  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+  aCellTypesArray->SetNumberOfComponents( 1 );
+  aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+  
+  vtkIdList *anIdList = vtkIdList::New();
+  vtkIdType iElem = 0;
+  
+  for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
+  {
+    if( nbEnts[ aTypes[ i ] ] > 0 )
+    {
+      const TEntityList& aList = anEnts[ aTypes[ i ] ];
+      TEntityList::const_iterator anIter;
+      for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
+      {
+        const SMDS_MeshElement* anElem = *anIter;
+        
+        vtkIdType aNbNodes = anElem->NbNodes();
+        anIdList->SetNumberOfIds( aNbNodes );
+
+        int anId = anElem->GetID();
+
+        mySMDS2VTKElems.insert( TMapOfIds::value_type( anId, iElem ) );
+        myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
+
+        SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+        for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ )
+        {
+          const SMDS_MeshElement* aNode = aNodesIter->next();
+          anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
+        }
+
+        aConnectivity->InsertNextCell( anIdList );
+        aCellTypesArray->InsertNextValue( getCellType( aTypes[ i ], aNbNodes ) );
+
+        iElem++;
+      }
+    }
+  }
+
+  // Insert cells in grid
+  
+  vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+  aCellLocationsArray->SetNumberOfComponents( 1 );
+  aCellLocationsArray->SetNumberOfTuples( aNbCells );
+  
+  aConnectivity->InitTraversal();
+  for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+    aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
+  myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+  
+  aCellLocationsArray->Delete();
+  aCellTypesArray->Delete();
+  aConnectivity->Delete();
+  anIdList->Delete();
+}
+
+/*
+  Class       : SMESH_MeshObj
+  Description : Class for visualisation of mesh
+*/
+
+//=================================================================================
+// function : SMESH_MeshObj
+// purpose  : Constructor
+//=================================================================================
+SMESH_MeshObj::SMESH_MeshObj(SMESH::SMESH_Mesh_ptr theMesh)
+{
+  if ( MYDEBUG ) 
+    MESSAGE("SMESH_MeshObj - theMesh->_is_nil() = "<<theMesh->_is_nil());
+    
+  myMeshServer = SMESH::SMESH_Mesh::_duplicate( theMesh );
+  myMeshServer->Register();
+  myMesh = new SMDS_Mesh();
+}
+
+//=================================================================================
+// function : ~SMESH_MeshObj
+// purpose  : Destructor
+//=================================================================================
+SMESH_MeshObj::~SMESH_MeshObj()
+{
+  myMeshServer->Destroy();
+  delete myMesh;
+}
+
+//=================================================================================
+// function : Update
+// purpose  : Update mesh and fill grid with new values if necessary 
+//=================================================================================
+void SMESH_MeshObj::Update( int theIsClear )
+{
+  // Update SMDS_Mesh on client part
+  
+  try
+  {
+    SMESH::log_array_var aSeq = myMeshServer->GetLog( theIsClear );
+    CORBA::Long aLength = aSeq->length();
+    
+    if( MYDEBUG ) MESSAGE( "Update: length of the script is "<<aLength );
+    
+    if( !aLength )
+      return;
+      
+    for ( CORBA::Long anId = 0; anId < aLength; anId++)
+    {
+      const SMESH::double_array& aCoords = aSeq[anId].coords;
+      const SMESH::long_array& anIndexes = aSeq[anId].indexes;
+      CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
+      SMDS_MeshElement* anElem = NULL;
+      CORBA::Long aCommand = aSeq[anId].commandType;
+      
+      switch(aCommand)
+      {
+        case SMESH::ADD_NODE       : AddNodesWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_EDGE       : AddEdgesWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_TRIANGLE   : AddTriasWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_QUADRANGLE : AddQuadsWithID   ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_TETRAHEDRON: AddTetrasWithID  ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_PYRAMID    : AddPiramidsWithID( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_PRISM      : AddPrismsWithID  ( myMesh, aSeq, anId ); break;
+        case SMESH::ADD_HEXAHEDRON : AddHexasWithID   ( myMesh, aSeq, anId ); break;
+        
+        case SMESH::REMOVE_NODE:
+          for( ; anElemId < aNbElems; anElemId++ )
+            myMesh->RemoveNode( FindNode( myMesh, anIndexes[anElemId] ) );
+        break;
+        
+        case SMESH::REMOVE_ELEMENT:
+          for( ; anElemId < aNbElems; anElemId++ )
+            myMesh->RemoveElement( FindElement( myMesh, anIndexes[anElemId] ) );
+        break;
+      }
+    }
+  }
+  catch ( SALOME::SALOME_Exception& exc )
+  {
+    INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+  }
+  catch( const std::exception& exc)
+  {
+    INFOS("Follow exception was cought:\n\t"<<exc.what());
+  }
+  catch(...)
+  {
+    INFOS("Unknown exception was cought !!!");
+  }
+  
+  if ( MYDEBUG )
+  {
+    MESSAGE("Update - myMesh->NbNodes() = "<<myMesh->NbNodes());
+    MESSAGE("Update - myMesh->NbEdges() = "<<myMesh->NbEdges());
+    MESSAGE("Update - myMesh->NbFaces() = "<<myMesh->NbFaces());
+    MESSAGE("Update - myMesh->NbVolumes() = "<<myMesh->NbVolumes());
+  }
+
+  // Fill unstructured grid
+  buildPrs();
+}
+
+//=================================================================================
+// function : GetElemDimension
+// purpose  : Get dimension of element
+//=================================================================================
+int SMESH_MeshObj::GetElemDimension( const int theObjId )
+{
+  const SMDS_MeshElement* anElem = myMesh->FindElement( theObjId );
+  if ( anElem == 0 )
+    return 0;
+
+  int aType = anElem->GetType();
+  switch ( aType )
+  {
+    case SMDSAbs_Edge  : return 1;
+    case SMDSAbs_Face  : return 2;
+    case SMDSAbs_Volume: return 3;
+    default            : return 0;
+  }
+}
+
+//=================================================================================
+// function : GetEntities
+// purpose  : Get entities of specified type. Return number of entities
+//=================================================================================
+int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
+{
+  switch ( theType )
+  {
+    case SMESH::NODE:
+    {
+      return myMesh->NbNodes();
+    }
+    break;
+    case SMESH::EDGE:
+    {
+      return myMesh->NbEdges();
+    }
+    break;
+    case SMESH::FACE:
+    {
+      return myMesh->NbFaces();
+    }
+    break;
+    case SMESH::VOLUME:
+    {
+      return myMesh->NbVolumes();
+    }
+    break;
+    default:
+      return 0;
+    break;
+  }
+}
+
+int SMESH_MeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theObjs ) const
+{
+  theObjs.clear();
+
+  switch ( theType )
+  {
+    case SMESH::NODE:
+    {
+      SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
+      while ( anIter->more() ) theObjs.push_back( anIter->next() );
+    }
+    break;
+    case SMESH::EDGE:
+    {
+      SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
+      while ( anIter->more() ) theObjs.push_back( anIter->next() );
+    }
+    break;
+    case SMESH::FACE:
+    {
+      SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+      while ( anIter->more() ) theObjs.push_back( anIter->next() );
+    }
+    break;
+    case SMESH::VOLUME:
+    {
+      SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
+      while ( anIter->more() ) theObjs.push_back( anIter->next() );
+    }
+    break;
+    default:
+    break;
+  }
+
+  return theObjs.size();
+}
+
+//=================================================================================
+// function : UpdateFunctor
+// purpose  : Update functor in accordance with current mesh
+//=================================================================================
+void SMESH_MeshObj::UpdateFunctor( SMESH::Functor_ptr f )
+{
+  f->SetMesh( myMeshServer );
+}
+
+//=================================================================================
+// function : IsNodePrs
+// purpose  : Return true if node presentation is used
+//=================================================================================
+bool SMESH_MeshObj::IsNodePrs() const
+{
+  return myMesh->NbEdges() == 0 &&myMesh->NbFaces() == 0 &&myMesh->NbVolumes() == 0 ;
+}
+
+
+/*
+  Class       : SMESH_SubMeshObj
+  Description : Base class for visualisation of submeshes and groups
+*/
+
+//=================================================================================
+// function : SMESH_SubMeshObj
+// purpose  : Constructor
+//=================================================================================
+SMESH_SubMeshObj::SMESH_SubMeshObj( SMESH_MeshObj* theMeshObj )
+{
+  if ( MYDEBUG ) MESSAGE( "SMESH_SubMeshObj - theMeshObj = " << theMeshObj );
+  
+  myMeshObj = theMeshObj;
+}
+
+SMESH_SubMeshObj::~SMESH_SubMeshObj()
+{
+}
+
+//=================================================================================
+// function : GetElemDimension
+// purpose  : Get dimension of element
+//=================================================================================
+int SMESH_SubMeshObj::GetElemDimension( const int theObjId )
+{
+  return myMeshObj == 0 ? 0 : myMeshObj->GetElemDimension( theObjId );
+}
+
+//=================================================================================
+// function : UpdateFunctor
+// purpose  : Update functor in accordance with current mesh
+//=================================================================================
+void SMESH_SubMeshObj::UpdateFunctor( SMESH::Functor_ptr f )
+{
+  f->SetMesh( myMeshObj->GetMeshServer() );
+}
+
+//=================================================================================
+// function : UpdateFunctor
+// purpose  : Update mesh object and fill grid with new values 
+//=================================================================================
+void SMESH_SubMeshObj::Update( int theIsClear )
+{
+  myMeshObj->Update( theIsClear );
+  buildPrs();
+}
+
+
+/*
+  Class       : SMESH_GroupObj
+  Description : Class for visualisation of groups
+*/
+
+//=================================================================================
+// function : SMESH_GroupObj
+// purpose  : Constructor
+//=================================================================================
+SMESH_GroupObj::SMESH_GroupObj( SMESH::SMESH_Group_ptr theGroup, 
+                                SMESH_MeshObj*         theMeshObj )
+: SMESH_SubMeshObj( theMeshObj ),
+  myGroupServer( SMESH::SMESH_Group::_duplicate(theGroup) )
+{
+  if ( MYDEBUG ) MESSAGE("SMESH_GroupObj - theGroup->_is_nil() = "<<theGroup->_is_nil());
+  myGroupServer->Register();
+}
+
+SMESH_GroupObj::~SMESH_GroupObj()
+{
+  if ( MYDEBUG ) MESSAGE("~SMESH_GroupObj");
+  myGroupServer->Destroy();
+}
+
+//=================================================================================
+// function : IsNodePrs
+// purpose  : Return true if node presentation is used
+//=================================================================================
+bool SMESH_GroupObj::IsNodePrs() const
+{
+  return myGroupServer->GetType() == SMESH::NODE;
+}
+
+//=================================================================================
+// function : getNodesFromElems
+// purpose  : Retrieve nodes from elements
+//=================================================================================
+static int getNodesFromElems( SMESH::long_array_var&              theElemIds,
+                              const SMDS_Mesh*                    theMesh,
+                              std::list<const SMDS_MeshElement*>& theResList )
+{
+  set<const SMDS_MeshElement*> aNodeSet;
+
+  for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ )
+  {
+    const SMDS_MeshElement* anElem = theMesh->FindElement( theElemIds[ i ] );
+    if ( anElem != 0 )
+    {
+      SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+      while ( anIter->more() )
+      {
+        const SMDS_MeshElement* aNode = anIter->next();
+        if ( aNode != 0 )
+          aNodeSet.insert( aNode );
+      }
+    }
+  }
+
+  set<const SMDS_MeshElement*>::const_iterator anIter;
+  for ( anIter = aNodeSet.begin(); anIter != aNodeSet.end(); ++anIter )
+    theResList.push_back( *anIter );
+
+  return theResList.size();    
+}
+
+//=================================================================================
+// function : getPointers
+// purpose  : Get std::list<const SMDS_MeshElement*> from list of IDs
+//=================================================================================
+static int getPointers( const SMESH::ElementType            theRequestType,
+                        SMESH::long_array_var&              theElemIds,
+                        const SMDS_Mesh*                    theMesh,
+                        std::list<const SMDS_MeshElement*>& theResList )
+{
+  for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ )
+  {
+    const SMDS_MeshElement* anElem = theRequestType == SMESH::NODE
+      ? theMesh->FindNode( theElemIds[ i ] ) : theMesh->FindElement( theElemIds[ i ] );
+
+    if ( anElem != 0 )
+      theResList.push_back( anElem );
+  }
+
+  return theResList.size();
+}
+
+
+//=================================================================================
+// function : GetEntities
+// purpose  : Get entities of specified type. Return number of entities
+//=================================================================================
+int SMESH_GroupObj::GetNbEntities( const SMESH::ElementType theType) const
+{
+  if(myGroupServer->GetType() == theType){
+    return myGroupServer->Size();
+  }
+  return 0;
+}
+
+int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
+{
+  theResList.clear();
+  SMDS_Mesh* aMesh = myMeshObj->GetMesh();
+  
+  if ( myGroupServer->Size() == 0 || aMesh == 0 )
+    return 0;
+
+  SMESH::ElementType aGrpType = myGroupServer->GetType();
+  SMESH::long_array_var anIds = myGroupServer->GetListOfID();
+
+  if ( aGrpType == theType )
+    return getPointers( theType, anIds, aMesh, theResList );
+  else if ( theType == SMESH::NODE )
+    return getNodesFromElems( anIds, aMesh, theResList );
+  else
+    return 0;
+}    
+
+
+
+/*
+  Class       : SMESH_subMeshObj
+  Description : Class for visualisation of submeshes
+*/
+
+//=================================================================================
+// function : SMESH_subMeshObj
+// purpose  : Constructor
+//=================================================================================
+SMESH_subMeshObj::SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr theSubMesh,
+                                    SMESH_MeshObj*           theMeshObj )
+: SMESH_SubMeshObj( theMeshObj ),
+  mySubMeshServer( SMESH::SMESH_subMesh::_duplicate( theSubMesh ) )
+{
+  if ( MYDEBUG ) MESSAGE( "SMESH_subMeshObj - theSubMesh->_is_nil() = " << theSubMesh->_is_nil() );
+  
+  mySubMeshServer->Register();
+}
+
+SMESH_subMeshObj::~SMESH_subMeshObj()
+{
+  if ( MYDEBUG ) MESSAGE( "~SMESH_subMeshObj" );
+  mySubMeshServer->Destroy();
+}
+
+//=================================================================================
+// function : GetEntities
+// purpose  : Get entities of specified type. Return number of entities
+//=================================================================================
+int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
+{
+  switch ( theType )
+  {
+    case SMESH::NODE:
+    {
+      return mySubMeshServer->GetNumberOfNodes();
+    }
+    break;
+    case SMESH::EDGE:
+    case SMESH::FACE:
+    case SMESH::VOLUME:
+    {
+      SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
+      return anIds->length();
+    }
+    default:
+      return 0;
+    break;
+  }
+}
+
+int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
+{
+  theResList.clear();
+
+  SMDS_Mesh* aMesh = myMeshObj->GetMesh();
+  if ( aMesh == 0 )
+    return 0;
+
+  bool isNodal = IsNodePrs();
+
+  if ( isNodal )
+  {
+    if ( theType == SMESH::NODE )
+    {
+      SMESH::long_array_var anIds = mySubMeshServer->GetNodesId();
+      return getPointers( SMESH::NODE, anIds, aMesh, theResList );
+    }
+  }
+  else
+  {
+    if ( theType == SMESH::NODE )
+    {
+      SMESH::long_array_var anIds = mySubMeshServer->GetElementsId();
+      return getNodesFromElems( anIds, aMesh, theResList );
+    }
+    else
+    {
+      SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
+      return getPointers( theType, anIds, aMesh, theResList );
+    }
+  }
+
+  return 0;
+}
+
+//=================================================================================
+// function : IsNodePrs
+// purpose  : Return true if node presentation is used
+//=================================================================================
+bool SMESH_subMeshObj::IsNodePrs() const
+{
+  return mySubMeshServer->GetNumberOfElements() == 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/OBJECT/SMESH_Object.h b/src/OBJECT/SMESH_Object.h
new file mode 100644 (file)
index 0000000..6ed30e2
--- /dev/null
@@ -0,0 +1,207 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESH_Object.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESH_OBJECT_H
+#define SMESH_OBJECT_H
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_SERVER_HEADER(SMESH_Filter)
+
+#include <map>
+#include <list>
+#include <boost/shared_ptr.hpp>
+#include <vtkSystemIncludes.h>
+
+class vtkUnstructuredGrid;
+class vtkPoints;
+class SALOME_ExtractUnstructuredGrid;
+
+class SMESH_Actor;
+class SMDS_Mesh;
+class SMDS_MeshNode;
+class SMDS_MeshElement;
+
+class SMESH_VisualObj;
+typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
+
+
+/*
+  Class       : SMESH_VisualObj
+  Description : Base class for all mesh objects to be visuilised
+*/
+
+class SMESH_VisualObj
+{
+protected:
+
+  typedef std::list<const SMDS_MeshElement*>   TEntityList;
+  typedef std::map<vtkIdType,vtkIdType>  TMapOfIds;
+  
+public:
+                            SMESH_VisualObj();
+  virtual                   ~SMESH_VisualObj();
+  
+  virtual void              Update( int theIsClear = true ) = 0;
+  virtual void              UpdateFunctor( SMESH::Functor_ptr theFunctor ) = 0;
+  virtual int               GetElemDimension( const int theObjId ) = 0;
+
+  virtual int               GetNbEntities( const SMESH::ElementType) const = 0;
+  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
+  virtual bool              IsNodePrs() const = 0;
+
+  vtkUnstructuredGrid*      GetUnstructuredGrid() { return myGrid; }
+  
+  vtkIdType                 GetNodeObjId( int theVTKID );
+  vtkIdType                 GetNodeVTKId( int theObjID );
+  vtkIdType                 GetElemObjId( int theVTKID );
+  vtkIdType                 GetElemVTKId( int theObjID );
+  
+protected:
+
+  void                      createPoints( vtkPoints* );
+  void                      buildPrs();
+  void                      buildNodePrs();
+  void                      buildElemPrs();
+  
+private:
+
+  TMapOfIds                 mySMDS2VTKNodes;
+  TMapOfIds                 myVTK2SMDSNodes;
+  TMapOfIds                 mySMDS2VTKElems;
+  TMapOfIds                 myVTK2SMDSElems;
+
+  vtkUnstructuredGrid*      myGrid;
+};
+
+
+/*
+  Class       : SMESH_MeshObj
+  Description : Class for visualisation of mesh
+*/
+
+class SMESH_MeshObj: public SMESH_VisualObj
+{
+public:
+
+                            SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
+  virtual                   ~SMESH_MeshObj();
+  
+  virtual void              Update( int theIsClear = true );
+  
+  virtual int               GetNbEntities( const SMESH::ElementType) const;
+  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const;
+  virtual bool              IsNodePrs() const;
+
+  virtual int               GetElemDimension( const int theObjId );
+
+  virtual void              UpdateFunctor( SMESH::Functor_ptr f );
+  
+  SMESH::SMESH_Mesh_ptr     GetMeshServer() { return myMeshServer.in(); }
+  SMDS_Mesh*                GetMesh()       { return myMesh; }
+
+protected:
+
+  SMESH::SMESH_Mesh_var     myMeshServer;
+  SMDS_Mesh*                myMesh;
+};
+
+
+/*
+  Class       : SMESH_SubMeshObj
+  Description : Base class for visualisation of submeshes and groups
+*/
+
+class SMESH_SubMeshObj: public SMESH_VisualObj
+{
+public:
+
+                            SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
+  virtual                   ~SMESH_SubMeshObj();
+
+  virtual void              Update( int theIsClear = true );
+  
+  virtual void              UpdateFunctor( SMESH::Functor_ptr );
+  virtual int               GetElemDimension( const int theObjId );
+  
+protected:
+
+  SMESH_MeshObj*            myMeshObj;
+};
+
+
+/*
+  Class       : SMESH_GroupObj
+  Description : Class for visualisation of groups
+*/
+
+class SMESH_GroupObj: public SMESH_SubMeshObj
+{
+public:
+                            SMESH_GroupObj( SMESH::SMESH_Group_ptr, SMESH_MeshObj* );
+  virtual                   ~SMESH_GroupObj();
+
+  virtual int               GetNbEntities( const SMESH::ElementType) const;
+  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const;
+  virtual bool              IsNodePrs() const;
+
+private:
+
+  SMESH::SMESH_Group_var    myGroupServer;
+};
+
+
+/*
+  Class       : SMESH_subMeshObj
+  Description : Class for visualisation of submeshes
+*/
+
+class SMESH_subMeshObj : public SMESH_SubMeshObj
+{
+public:
+
+                            SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr, 
+                                              SMESH_MeshObj* );
+  virtual                   ~SMESH_subMeshObj();
+
+  virtual int               GetNbEntities( const SMESH::ElementType) const;
+  virtual int               GetEntities( const SMESH::ElementType, TEntityList& ) const;
+  virtual bool              IsNodePrs() const;    
+  
+protected:
+
+  SMESH::SMESH_subMesh_var  mySubMeshServer;
+};
+
+
+extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
+
+
+#endif
diff --git a/src/SMESH/SMESH_Group.cxx b/src/SMESH/SMESH_Group.cxx
new file mode 100644 (file)
index 0000000..da29a29
--- /dev/null
@@ -0,0 +1,55 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2004  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : SMESH_Group.cxx
+//  Author : Michael Sazonov (OCC)
+//  Module : SMESH
+//  $Header$
+
+#include <SMESH_Group.hxx>
+#include <SMESH_Mesh.hxx>
+#include <SMESHDS_Group.hxx>
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_Group::SMESH_Group (const SMESH_Mesh*         theMesh,
+                          const SMDSAbs_ElementType theType,
+                          const char*               theName)
+     : myName(theName)
+{
+  myGroupDS = new SMESHDS_Group (const_cast<SMESH_Mesh*>(theMesh)->GetMeshDS(), theType);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_Group::~SMESH_Group ()
+{
+  delete myGroupDS;
+}
diff --git a/src/SMESH/SMESH_Group.hxx b/src/SMESH/SMESH_Group.hxx
new file mode 100644 (file)
index 0000000..5147a44
--- /dev/null
@@ -0,0 +1,64 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2004  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : SMESH_Group.hxx
+//  Author : Michael Sazonov (OCC)
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_Group_HeaderFile
+#define _SMESH_Group_HeaderFile
+
+#include <SMDSAbs_ElementType.hxx>
+#include <string>
+using namespace std;
+
+class SMESHDS_Group;
+class SMESH_Mesh;
+
+class SMESH_Group
+{
+ public:
+
+  SMESH_Group (const SMESH_Mesh*         theMesh,
+               const SMDSAbs_ElementType theType,
+               const char*               theName);
+  ~SMESH_Group ();
+
+  void SetName (const char* theName) { myName = theName; }
+
+  const char* GetName () const { return myName.c_str(); }
+
+  SMESHDS_Group * GetGroupDS () { return myGroupDS; }
+
+ private:
+  SMESH_Group (const SMESH_Group& theOther);
+  // prohibited copy constructor
+  SMESH_Group& operator = (const SMESH_Group& theOther);
+  // prohibited assign operator
+
+  SMESHDS_Group * myGroupDS;
+  string          myName;
+
+};
+
+#endif
diff --git a/src/SMESHDS/SMESHDS_Group.cxx b/src/SMESHDS/SMESHDS_Group.cxx
new file mode 100644 (file)
index 0000000..29d7db4
--- /dev/null
@@ -0,0 +1,129 @@
+//  SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes
+//
+//  Copyright (C) 2004  CEA
+// 
+//  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.org 
+//
+//
+//
+//  File   : SMESHDS_Group.cxx
+//  Author : Michael Sazonov, OCC
+//  Module : SMESH
+//  $Header$
+
+#include <SMESHDS_Group.hxx>
+#include <SMESHDS_Mesh.hxx>
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESHDS_Group::SMESHDS_Group (const SMESHDS_Mesh*       theMesh,
+                              const SMDSAbs_ElementType theType)
+     : SMDS_MeshGroup(theMesh,theType), myStoreName(""),
+       myCurIndex(0), myCurID(0)
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool SMESHDS_Group::Contains (const int theID) const
+{
+  const SMDS_MeshElement* aElem = findInMesh (theID);
+  if (aElem)
+    return SMDS_MeshGroup::Contains(aElem);
+  return false;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool SMESHDS_Group::Add (const int theID)
+{
+  const SMDS_MeshElement* aElem = findInMesh (theID);
+  if (!aElem || SMDS_MeshGroup::Contains(aElem))
+    return false;
+  SMDS_MeshGroup::Add (aElem);
+  return true;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool SMESHDS_Group::Remove (const int theID)
+{
+  const SMDS_MeshElement* aElem = findInMesh (theID);
+  if (!aElem || !SMDS_MeshGroup::Contains(aElem))
+    return false;
+  SMDS_MeshGroup::Remove (aElem);
+  return true;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+int SMESHDS_Group::GetID (const int theIndex)
+{
+  if (theIndex < 1 || theIndex > Extent())
+    return -1;
+  if (myCurIndex < 1 || myCurIndex > theIndex) {
+    InitIterator();
+    myCurIndex = 0;
+    myCurID = -1;
+  }
+  while (myCurIndex < theIndex && More()) {
+    myCurIndex++;
+    myCurID = Next()->GetID();
+  }
+  return myCurID;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+const SMDS_MeshElement* SMESHDS_Group::findInMesh (const int theID) const
+{
+  SMDSAbs_ElementType aType = GetType();
+  const SMDS_MeshElement* aElem = NULL;
+  if (aType == SMDSAbs_Node) {
+    aElem = GetMesh()->FindNode(theID);
+  }
+  else if (aType != SMDSAbs_All) {
+    aElem = GetMesh()->FindElement(theID);
+    if (aElem && aType != aElem->GetType())
+      aElem = NULL;
+  }
+  return aElem;
+}
diff --git a/src/SMESHDS/SMESHDS_Group.hxx b/src/SMESHDS/SMESHDS_Group.hxx
new file mode 100644 (file)
index 0000000..444914c
--- /dev/null
@@ -0,0 +1,72 @@
+//  SMESH SMESHDS : management of mesh data and SMESH document
+//
+//  Copyright (C) 2004  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : SMESHDS_Group.hxx
+//  Author : Michael Sazonov (OCC)
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESHDS_Group_HeaderFile
+#define _SMESHDS_Group_HeaderFile
+
+#include <SMDS_MeshGroup.hxx>
+#include <string>
+
+class SMESHDS_Mesh;
+
+class SMESHDS_Group : public SMDS_MeshGroup
+{
+ public:
+
+  SMESHDS_Group (const SMESHDS_Mesh*       theMesh,
+                 const SMDSAbs_ElementType theType);
+
+  void SetStoreName (const char* theName)
+  { myStoreName = theName; }
+
+  const char* GetStoreName () const
+  { return myStoreName.c_str(); }
+
+  bool Contains (const int theID) const;
+
+  bool Add (const int theID);
+  bool Remove (const int theID);
+
+  int GetID (const int theIndex);
+  // use it for iterations 1..Extent() as alternative to parent's
+  // InitIterator(), More(), Next()
+
+ private:
+  SMESHDS_Group (const SMESHDS_Group& theOther);
+  // prohibited copy constructor
+  SMESHDS_Group& operator = (const SMESHDS_Group& theOther);
+  // prohibited assign operator
+
+  const SMDS_MeshElement* findInMesh (const int theID) const;
+
+  string myStoreName;
+  int    myCurIndex;
+  int    myCurID;
+
+};
+
+#endif
diff --git a/src/SMESHGUI/SMESHBin.cxx b/src/SMESHGUI/SMESHBin.cxx
new file mode 100644 (file)
index 0000000..61f9777
--- /dev/null
@@ -0,0 +1,4 @@
+int main(int argc, char** argv){ 
+  return 0;
+}
+
diff --git a/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.cxx b/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.cxx
new file mode 100644 (file)
index 0000000..fd494fb
--- /dev/null
@@ -0,0 +1,290 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : SMESHGUI_CreateHypothesesDlg.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "SMESHGUI_CreateHypothesesDlg.h"
+#include "SMESHGUI.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "utilities.h"
+
+// QT Includes
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qlistview.h>
+#include <qheader.h>
+
+//=================================================================================
+// class    : SMESHGUI_CreateHypothesesDlg()
+// purpose  : Constructs a SMESHGUI_CreateHypothesesDlg which is a child of 'parent', with the 
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+SMESHGUI_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (QWidget* parent,
+                                                            const char* name,
+                                                            bool modal,
+                                                            bool isAlgo)
+     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+       myIsAlgo( isAlgo )
+{
+  MESSAGE("SMESHGUI_CreateHypothesesDlg");
+
+  if ( !name )
+    setName( "SMESHGUI_CreateHypothesesDlg" );
+  setCaption( isAlgo ? tr( "SMESH_CREATE_ALGORITHMS"  ) : tr( "SMESH_CREATE_HYPOTHESES"  ) );
+  setSizeGripEnabled( TRUE );
+
+  QGridLayout* SMESHGUI_CreateHypothesesDlgLayout = new QGridLayout( this ); 
+  SMESHGUI_CreateHypothesesDlgLayout->setSpacing( 6 );
+  SMESHGUI_CreateHypothesesDlgLayout->setMargin( 11 );
+
+  /***************************************************************/
+  GroupAlgorithms = new QGroupBox( this, "GroupAlgorithms" );
+  GroupAlgorithms->setTitle( isAlgo ? tr("SMESH_AVAILABLE_ALGORITHMS") : tr("SMESH_AVAILABLE_HYPOTHESES") );
+  GroupAlgorithms->setColumnLayout(0, Qt::Vertical );
+  GroupAlgorithms->layout()->setSpacing( 0 );
+  GroupAlgorithms->layout()->setMargin( 0 );
+
+  QGridLayout* hypLayout = new QGridLayout( GroupAlgorithms->layout() );
+  hypLayout->setGeometry( QRect( 12, 18, 139, 250 ) ); 
+  hypLayout->setAlignment( Qt::AlignTop );
+  hypLayout->setSpacing( 6 );
+  hypLayout->setMargin( 11 );
+
+  ListAlgoDefinition = new QListView( GroupAlgorithms, "ListAlgoDefinition" );
+  ListAlgoDefinition->setMinimumSize( 400, 200 );
+  ListAlgoDefinition->addColumn("");
+  ListAlgoDefinition->header()->hide();
+  ListAlgoDefinition->setSelectionMode(QListView::Single);
+  ListAlgoDefinition->setResizeMode(QListView::AllColumns);
+  ListAlgoDefinition->setRootIsDecorated( true );
+
+  hypLayout->addWidget( ListAlgoDefinition, 0, 0 );
+  SMESHGUI_CreateHypothesesDlgLayout->addWidget( GroupAlgorithms, 0, 0 );
+
+  /***************************************************************/
+  GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout( 0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+  buttonApply->setText( tr( "SMESH_BUT_CREATE"  ) );
+  buttonApply->setAutoDefault( TRUE );
+  buttonApply->setDefault( FALSE );
+  buttonApply->setEnabled( FALSE ) ;
+  GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+
+  QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+  GroupButtonsLayout->addItem( spacer_9, 0, 2 );
+
+  buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+  buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
+  buttonCancel->setAutoDefault( TRUE );
+  buttonCancel->setDefault( TRUE );
+  buttonCancel->setEnabled( TRUE ) ;
+  GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+
+  SMESHGUI_CreateHypothesesDlgLayout->addWidget( GroupButtons, 1, 0 );
+  /***************************************************************/
+
+  Init();
+}
+
+//=================================================================================
+// function : ~SMESHGUI_CreateHypothesesDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_CreateHypothesesDlg::~SMESHGUI_CreateHypothesesDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::Init()
+{
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  InitAlgoDefinition();
+
+  /* signals and slots connections */
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
+  connect( buttonApply , SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ) ;
+
+//  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
+  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+  connect( ListAlgoDefinition, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+  connect( ListAlgoDefinition, SIGNAL( doubleClicked(QListViewItem*) ),    this, SLOT( onDoubleClicked(QListViewItem*) ) );
+
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ;
+  this->show() ; 
+}
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::ClickOnCancel()
+{
+  close() ;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
+{
+  QListViewItem* item = ListAlgoDefinition->selectedItem();
+  if ( !item )
+    return;
+  QString aHypType = item->text( 1 );
+  MESSAGE("Apply " << aHypType);
+  char* sHypType = (char*)aHypType.latin1();
+
+  HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+  if ( !aHypData ) 
+    return;
+  QString aClientLibName = aHypData->ClientLibName;
+  MESSAGE("Client lib name = " << aClientLibName);
+
+  if (aClientLibName == "")
+  {
+    // Call hypothesis creation server method (without GUI)
+    QString aHypName = aHypData->Label;
+    mySMESHGUI->CreateHypothesis(sHypType, aHypName, myIsAlgo);
+  }
+  else
+  {
+    // Get hypotheses creator client (GUI)
+    SMESHGUI_GenericHypothesisCreator* aCreator =
+      mySMESHGUI->GetHypothesisCreator(sHypType);
+
+    // Create hypothesis/algorithm
+    aCreator->CreateHypothesis(myIsAlgo, this);
+  }
+
+//  buttonApply->setEnabled(FALSE);
+  return;
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::ActivateThisDialog()
+{
+  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  GroupButtons->setEnabled(true) ;
+  return ;
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::enterEvent(QEvent* e)
+{
+  ActivateThisDialog() ;
+  return ;
+}
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::closeEvent( QCloseEvent* e )
+{
+  mySMESHGUI->ResetState();
+  QDialog::closeEvent( e );
+}
+
+//=================================================================================
+// function : onSelectionChanged()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::onSelectionChanged()
+{
+  QListViewItem* item = ListAlgoDefinition->selectedItem();
+  buttonApply->setEnabled( item && item->depth() > 0 ) ;
+}
+
+//=================================================================================
+// function : onDoubleClicked()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::onDoubleClicked(QListViewItem* i)
+{
+  if ( i && i->depth() > 0 )
+    this->ClickOnApply();
+}
+
+//=================================================================================
+// function : InitAlgoDefinition()
+// purpose  :
+//=================================================================================
+void SMESHGUI_CreateHypothesesDlg::InitAlgoDefinition()
+{
+  ListAlgoDefinition->clear();
+  QStringList HypList = mySMESHGUI->GetAvailableHypotheses(myIsAlgo);
+  for ( int i = 0; i < HypList.count(); ++i ) {
+    HypothesisData* aHypData = mySMESHGUI->GetHypothesisData( HypList[i] );
+    QListViewItem* parentItem = 0;
+    QListViewItem* childItem = ListAlgoDefinition->firstChild();
+    while ( childItem ) {
+      if ( childItem->text(0) == aHypData->PluginName ) {
+       parentItem = childItem;
+       break;
+      }
+      childItem = childItem->nextSibling();
+    }
+    if ( !parentItem ) 
+      parentItem = new QListViewItem( ListAlgoDefinition, aHypData->PluginName );
+    parentItem->setOpen( true );
+    QListViewItem* aItem = new QListViewItem( parentItem, aHypData->Label, HypList[i] );
+    QPixmap aPixMap (QAD_Desktop::getResourceManager()->loadPixmap
+                     ("SMESH", tr(aHypData->IconId)));
+    if ( !aPixMap.isNull() )
+      aItem->setPixmap( 0, aPixMap );
+  }
+}
diff --git a/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h b/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h
new file mode 100644 (file)
index 0000000..4fa446d
--- /dev/null
@@ -0,0 +1,97 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : SMESHGUI_CreateHypothesesDlg.h
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+#ifndef DIALOGBOX_CREATE_HYPOTHESES_H
+#define DIALOGBOX_CREATE_HYPOTHESES_H
+
+// QT Includes
+#include <qvariant.h>
+#include <qdialog.h>
+#include <qstringlist.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include CORBA_SERVER_HEADER(GEOM_Shape)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+#include <map>
+#include <string>
+
+using namespace std;
+
+class QButtonGroup;
+class QGroupBox;
+class QPushButton;
+class QListView;
+class QListViewItem;
+class SMESHGUI;
+
+//=================================================================================
+// class    : SMESHGUI_CreateHypothesesDlg
+// purpose  :
+//=================================================================================
+class SMESHGUI_CreateHypothesesDlg : public QDialog
+{
+    Q_OBJECT
+
+public:
+    SMESHGUI_CreateHypothesesDlg (QWidget* parent = 0,
+                                 const char* name = 0,
+                                 bool modal = FALSE,
+                                 bool isAlgo = FALSE);
+    ~SMESHGUI_CreateHypothesesDlg ();
+
+private:
+
+    void Init() ;
+    void closeEvent( QCloseEvent* e ) ;
+    void enterEvent ( QEvent * ) ;
+
+    void InitAlgoDefinition();
+
+    SMESHGUI*     mySMESHGUI;
+    bool          myIsAlgo;
+
+    QGroupBox*    GroupButtons;
+    QPushButton*  buttonCancel;
+    QPushButton*  buttonApply;
+
+    QGroupBox* GroupAlgorithms;
+    QListView* ListAlgoDefinition;
+
+private slots:
+
+    void ClickOnCancel();
+    void ClickOnApply();
+    void ActivateThisDialog() ;
+
+    void onSelectionChanged();
+    void onDoubleClicked(QListViewItem*);
+};
+
+#endif // DIALOGBOX_CREATE_HYPOTHESES_H
diff --git a/src/SMESHGUI/SMESHGUI_Filter.cxx b/src/SMESHGUI/SMESHGUI_Filter.cxx
new file mode 100755 (executable)
index 0000000..22a2e89
--- /dev/null
@@ -0,0 +1,114 @@
+//  SMESHGUI_Filter : Filters for VTK viewer
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : SMESHGUI_Filter.cxx
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+#include "SMESHGUI_Filter.h"
+
+#include <vtkCell.h>
+
+#include <gp_Vec.hxx>
+#include <Precision.hxx>
+#include "SMESH_Actor.h"
+#include "SMESHGUI.h"
+
+IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
+IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter)
+
+/*
+  Class       : SMESHGUI_Filter
+  Description : Selection filter for VTK viewer. This class aggregate object
+                of SMESH_Filter class and uses it for verification of criterion
+*/
+
+//=======================================================================
+// name    : SMESHGUI_Filter::SMESHGUI_Filter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_Filter::SMESHGUI_Filter()
+{
+  myActor = 0;
+}
+
+SMESHGUI_Filter::~SMESHGUI_Filter()
+{
+}
+
+//=======================================================================
+// name    : SMESHGUI_Filter::IsValid
+// Purpose : Verify whether entry id satisfies to criterion of the filter
+//=======================================================================
+bool SMESHGUI_Filter::IsValid( const int theCellId ) const
+{
+  if ( myActor == 0 || myPred->_is_nil() )
+    return false;
+
+  SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+
+  int aMeshId = anActor->GetElemObjId( theCellId );
+
+  return myPred->IsSatisfy( aMeshId );
+}
+
+//=======================================================================
+// name    : SMESHGUI_Filter::SetPredicate
+// Purpose : Set new pridicate to the filter
+//=======================================================================
+void SMESHGUI_Filter::SetPredicate( SMESH::Predicate_ptr thePred )
+{
+  myPred = thePred;
+}
+
+//=======================================================================
+// name    : SMESHGUI_Filter::GetActor
+// Purpose : Get actor of the filter
+//=======================================================================
+SALOME_Actor* SMESHGUI_Filter::GetActor() const
+{
+  return myActor;
+}
+
+//=======================================================================
+// name    : SMESHGUI_Filter::SetActor
+// Purpose : Set new actor
+//=======================================================================
+void SMESHGUI_Filter::SetActor( SALOME_Actor* theActor )
+{
+  if ( myActor == theActor )
+    return;
+  VTKViewer_Filter::SetActor( theActor );
+
+  if ( myActor != 0 && !myPred->_is_nil() )
+  {
+    Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+    if ( !anIO.IsNull() )
+    {
+      Standard_Boolean aRes = false;
+      SMESH::SMESH_Mesh_ptr aMeshPtr = SMESHGUI::GetSMESHGUI()->ConvertIOinMesh( anIO, aRes );
+      if ( aRes )
+        myPred->SetMesh( aMeshPtr );
+    }
+  }
+}
diff --git a/src/SMESHGUI/SMESHGUI_Filter.h b/src/SMESHGUI/SMESHGUI_Filter.h
new file mode 100755 (executable)
index 0000000..91f3bd7
--- /dev/null
@@ -0,0 +1,68 @@
+//  SMESHGUI_Filter : Filters for VTK viewer
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_Filter.h
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+#ifndef SMESHGUI_Filter_HeaderFile
+#define SMESHGUI_Filter_HeaderFile
+
+#include "VTKViewer_Filter.h"\r
+\r
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Filter)
+
+class SALOME_Actor;
+
+
+DEFINE_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
+
+/*
+  Class       : SMESHGUI_Filter
+  Description : Selection filter for VTK viewer
+*/
+
+class SMESHGUI_Filter : public VTKViewer_Filter
+{
+
+public:
+                              SMESHGUI_Filter();
+  virtual                     ~SMESHGUI_Filter();
+
+  virtual bool                IsValid( const int theCellId ) const;
+
+  virtual void                SetActor( SALOME_Actor* );
+  SALOME_Actor*               GetActor() const;\r
+\r
+  void                        SetPredicate( SMESH::Predicate_ptr );
+\r
+private:
+\r
+  SMESH::Predicate_var        myPred;
+
+public:  
+  DEFINE_STANDARD_RTTI(SMESHGUI_Filter)
+};
+
+#endif
diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx
new file mode 100755 (executable)
index 0000000..5995bd8
--- /dev/null
@@ -0,0 +1,1302 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : SMESHGUI_FilterDlg.cxx
+//  Author : Sergey LITONIN
+//  Module : SMESH
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_Filter.h"
+#include "SMESH_Actor.h"
+#include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_ViewFrame.h"
+#include "QAD_RightFrame.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
+
+#include <TColStd_MapOfInteger.hxx>
+
+#include <qframe.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qtable.h>
+#include <qstringlist.h>
+#include <qlayout.h>
+#include <qwidgetstack.h>
+#include <qapplication.h>
+#include <qcombobox.h>
+#include <qfontmetrics.h>
+#include <qmessagebox.h>
+#include <qlabel.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qregexp.h>
+#include <qlistbox.h>
+#include <qcheckbox.h>
+
+#define SPACING 5                  
+#define MARGIN  10
+
+static int maxLength( const QStringList& theList, const QFontMetrics& theMetrics )
+{
+  int aRes = 0;
+  QStringList::const_iterator anIter;
+  for ( anIter = theList.begin(); anIter != theList.end(); ++anIter )
+    aRes = Max( aRes, theMetrics.width( *anIter ) );
+  return aRes; 
+}
+
+/*
+  Class       : SMESHGUI_FilterDlg::Table            
+  Description : Table used by this dialog
+*/
+
+class SMESHGUI_FilterDlg::Table : public QTable
+{
+public:
+                          Table( QWidget* parent = 0 );
+                          Table( int numRows, int numCols, QWidget* parent = 0 );
+  virtual                 ~Table();
+
+  void                    SetEditable( const bool state, const int row, const int col );
+  bool                    IsEditable( const int row, const int col ) const;  
+
+  virtual bool            eventFilter( QObject *o, QEvent *e );
+  virtual void            insertRows( int row, int count = 1 );
+  virtual QString         text( int row, int col ) const;
+};
+
+SMESHGUI_FilterDlg::Table::Table( QWidget* parent )
+: QTable( parent, "SMESHGUI_FilterDlg::Table" )
+{
+}
+
+SMESHGUI_FilterDlg::Table::Table( int numRows, int numCols, QWidget* parent )
+: QTable( numRows, numCols, parent, "SMESHGUI_FilterDlg::Table" )
+{
+}
+
+SMESHGUI_FilterDlg::Table::~Table()
+{
+}
+
+void SMESHGUI_FilterDlg::Table::SetEditable( const bool isEditable, const int row, const int col )
+{
+  QTableItem* anItem = item( row, col );
+  if( anItem )
+    takeItem( anItem );
+
+  if ( !isEditable )
+  {
+    setItem( row, col, new QTableItem( this, QTableItem::Never, "" ) );
+  }
+  else
+  {
+    setItem( row, col, new QTableItem( this, QTableItem::OnTyping, "" ) );
+  }
+}
+
+bool SMESHGUI_FilterDlg::Table::IsEditable( const int row, const int col ) const
+{
+  QTableItem* anItem = item( row, col );
+  return anItem == 0 || anItem->editType() != QTableItem::Never;
+}
+
+void SMESHGUI_FilterDlg::Table::insertRows( int row, int count )
+{
+  int anEditRow = currEditRow();
+  int anEditCol = currEditCol();
+
+//  printf( "sln: anEditRow = %d, anEditCol = %d\n", anEditRow, anEditCol );
+
+  if ( anEditRow >= 0 && anEditCol >= 0 )
+    endEdit( anEditRow, anEditCol, true, false );
+
+  QTable::insertRows( row, count );
+}
+
+QString SMESHGUI_FilterDlg::Table::text( int row, int col ) const
+{
+  int anEditRow = currEditRow();
+  int anEditCol = currEditCol();
+
+  if ( anEditRow >= 0 && anEditCol >= 0 && anEditRow == row && anEditCol == col )
+    ((Table*)this)->endEdit( row, col, true, false );
+
+  return QTable::text( row, col );
+}
+
+bool SMESHGUI_FilterDlg::Table::eventFilter( QObject *o, QEvent *e )
+{
+  return QTable::eventFilter( o, e );
+}
+
+/*
+  Class       : SMESHGUI_FilterDlg
+  Description : Dialog to specify filters for VTK viewer
+*/
+
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( QWidget*          theParent, 
+                                        const int         theType,
+                                        const bool        theModal,
+                                        const char*       theName )
+: QDialog( theParent, theName, theModal, 
+           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  myType = theType;
+
+  setCaption( tr( "CAPTION" ) );
+
+  QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
+
+  myMainFrame        = createMainFrame  ( this );
+  QFrame* aBtnFrame  = createButtonFrame( this, theModal );
+
+  aDlgLay->addWidget( myMainFrame );
+  aDlgLay->addWidget( aBtnFrame );
+
+  aDlgLay->setStretchFactor( myMainFrame, 1 );
+
+  Init( myType ); 
+}
+
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::createMainFrame
+// Purpose : Create frame containing dialog's input fields
+//=======================================================================
+QFrame* SMESHGUI_FilterDlg::createMainFrame( QWidget* theParent )
+{
+  QGroupBox* aMainFrame = new QGroupBox( 1, Qt::Horizontal, theParent );
+  aMainFrame->setFrameStyle( QFrame::NoFrame );
+  aMainFrame->setInsideMargin( 0 );
+
+  // filter frame
+
+  QGroupBox* aFilterGrp = new QGroupBox( 1, Qt::Horizontal, tr ( "Filter" ), aMainFrame );
+  QFrame* aFilterFrame = new QFrame( aFilterGrp );
+
+  myTableGrp = new QGroupBox( 1, Qt::Horizontal, aFilterFrame );
+  myTableGrp->setFrameStyle( QFrame::NoFrame );
+  myTableGrp->setInsideMargin( 0 );
+      
+  myTables[ myType ] = createTable( myTableGrp, myType );
+  myAddBtn = new QPushButton( tr( "ADD" ), aFilterFrame );
+  myRemoveBtn = new QPushButton( tr( "REMOVE" ), aFilterFrame );
+  myClearBtn = new QPushButton( tr( "CLEAR" ), aFilterFrame );
+
+  QGridLayout* aLay = new QGridLayout( aFilterFrame, 4, 2, 0, SPACING );
+
+  aLay->addMultiCellWidget( myTableGrp, 0, 3, 0, 0 );
+  aLay->addWidget( myAddBtn, 0, 1 );
+  aLay->addWidget( myRemoveBtn, 1, 1 );
+  aLay->addWidget( myClearBtn, 2, 1 );
+  aLay->setColStretch( 0, 1 );
+  aLay->setColStretch( 1, 0 );
+
+  mySetInViewer = new QCheckBox( tr( "SET_IN_VIEWER" ), aFilterGrp );
+  mySetInViewer->setChecked( true );
+
+  QSpacerItem* aVSpacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+  aLay->addItem( aVSpacer, 3, 1 );
+
+  // other controls
+  mySourceGrp = createSourceGroup( aMainFrame );
+  
+  // signals and slots
+  connect( myAddBtn,    SIGNAL( clicked() ), this, SLOT( onAddBtn() ) );
+  connect( myRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemoveBtn() ) );
+  connect( myClearBtn,  SIGNAL( clicked() ), this, SLOT( onClearBtn() ) );
+
+  return aMainFrame;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::createSourceFrame
+// Purpose : Create frame containing source radio button
+//=======================================================================
+QButtonGroup* SMESHGUI_FilterDlg::createSourceGroup( QWidget* theParent )
+{
+  QButtonGroup* aGrp = new QButtonGroup( 1, Qt::Vertical, tr( "SOURCE" ), theParent );
+
+  QRadioButton* aMeshBtn = new QRadioButton( tr( "MESH" ), aGrp );
+  QRadioButton* aSelBtn  = new QRadioButton( tr( "SELECTION" ), aGrp );
+  QRadioButton* aGrpBtn  = new QRadioButton( tr( "CURRENT_GROUP" ), aGrp );
+//  QRadioButton* aNoneBtn = new QRadioButton( tr( "NONE" ), aGrp );
+
+  aGrp->insert( aMeshBtn, Mesh );
+  aGrp->insert( aSelBtn, Selection );
+  aGrp->insert( aGrpBtn, Dialog );
+//  aGrp->insert( aNoneBtn, None );
+
+  aGrp->setButton( Selection );
+
+  return aGrp;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::createTable
+// Purpose : Create table
+//=======================================================================
+SMESHGUI_FilterDlg::Table* SMESHGUI_FilterDlg::createTable( QWidget*  theParent, 
+                                                            const int theType )
+{
+  // create table
+  Table* aTable= new Table( 0, 5, theParent );
+
+  QHeader* aHeaders = aTable->horizontalHeader();
+
+  QFontMetrics aMetrics( aHeaders->font() );
+
+  int aLenCr = abs(  maxLength( getCriteria( theType ), aMetrics ) - 
+                     aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
+
+  int aLenCo = abs(  maxLength( getCriteria( theType ), aMetrics ) - 
+                     aMetrics.width( tr( "COMPARE" ) ) ) / aMetrics.width( ' ' ) + 5;
+
+  QString aCrStr;
+  aCrStr.fill( ' ', aLenCr );
+  QString aCoStr;
+  aCoStr.fill( ' ', 10 );
+
+  aHeaders->setLabel( 0, tr( "CRITERION" ) + aCrStr );
+  aHeaders->setLabel( 1, tr( "COMPARE" ) + aCoStr );
+  aHeaders->setLabel( 2, tr( "THRESHOLD_VALUE" ) );
+  aHeaders->setLabel( 3, tr( "UNARY" ) );
+  aHeaders->setLabel( 4, tr( "BINARY" ) + "  " );
+
+  // set geometry of the table 
+
+  for ( int i = 0; i <= 4; i++ )
+    aTable->adjustColumn( i );
+
+  aTable->updateGeometry();
+  QSize aSize = aTable->sizeHint();
+  int aWidth = aSize.width();
+  aTable->setMinimumSize( QSize( aWidth, aWidth / 2 ) );
+  aTable->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
+
+  if ( theType == SMESH::EDGE )
+    connect( aTable, SIGNAL( valueChanged( int, int ) ),
+             this, SLOT( onCriterionChanged( int, int ) ) );
+
+  return aTable;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::createButtonFrame
+// Purpose : Create frame containing buttons
+//=======================================================================
+QFrame* SMESHGUI_FilterDlg::createButtonFrame( QWidget* theParent, const bool theModal )
+{
+  QGroupBox* aGrp = new QGroupBox( 1, Qt::Vertical, theParent );
+  myOkBtn      = new QPushButton( tr( "SMESH_BUT_OK"    ), aGrp );
+  myApplyBtn   = new QPushButton( tr( "SMESH_BUT_APPLY" ), aGrp );
+  QLabel* aLbl = new QLabel( aGrp );
+  myCloseBtn   = new QPushButton( tr( "SMESH_BUT_CANCEL" ), aGrp );
+
+  aLbl->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  connect( myOkBtn,    SIGNAL( clicked() ), SLOT( onOk() ) );
+  connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
+  connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
+
+  if ( theModal )
+    myApplyBtn->hide();
+
+  return aGrp;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg
+// Purpose : Destructor
+//=======================================================================
+SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg()
+{
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::Init
+// Purpose : Init dialog fields, connect signals and slots, show dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::Init( const int theType )
+{
+  mySourceWg  = 0;
+  mySelection = 0;
+  myType      = theType;
+  myMesh      = SMESH::SMESH_Mesh::_nil();
+
+  // activate corresponding tab
+  if ( !myTables.contains( myType ) )
+    myTables[ myType ] = createTable( myTableGrp, myType );
+
+  TableMap::iterator anIter;
+  for ( anIter = myTables.begin(); anIter != myTables.end(); ++anIter )
+    if ( anIter.key() == theType )
+      anIter.data()->show();
+    else
+      anIter.data()->hide();
+
+  // set caption
+  setCaption(  myType == SMESH::EDGE ? tr( "EDGES_TLT" ) : tr( "FACES_TLT" ) );
+
+  qApp->processEvents();
+  updateGeometry();
+  adjustSize();
+  setEnabled( true );
+
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+  mySMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
+
+  connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
+  connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
+
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y );
+  this->move( x, y );
+
+  this->show();
+
+  return;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onOk
+// Purpose : SLOT called when "Ok" button pressed. 
+//           Assign filters VTK viewer and close dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::onOk()
+{
+  if ( onApply() )
+  {
+    disconnect( mySMESHGUI, 0, this, 0 );
+    mySMESHGUI->ResetState() ;
+    accept();
+  }
+    
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onClose
+// Purpose : SLOT called when "Close" button pressed. Close dialog
+//=======================================================================
+void SMESHGUI_FilterDlg::onClose()
+{
+  disconnect( mySMESHGUI, 0, this, 0 );
+  mySMESHGUI->ResetState() ;
+  reject() ;
+  return ;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onDeactivate
+// Purpose : SLOT called when dialog must be deativated
+//=======================================================================
+void SMESHGUI_FilterDlg::onDeactivate()
+{
+  setEnabled( false );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::enterEvent
+// Purpose : Event filter
+//=======================================================================
+void SMESHGUI_FilterDlg::enterEvent( QEvent* )
+{
+//  mySMESHGUI->EmitSignalDeactivateDialog();   
+  setEnabled( true );
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_FilterDlg::closeEvent( QCloseEvent* e )
+{
+  onClose() ;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCriteria
+// Purpose : Retrieve list of ids from given widget
+//=======================================================================
+void SMESHGUI_FilterDlg::getIdsFromWg( const QWidget* theWg, QValueList<int>& theRes ) const
+{
+  theRes.clear();
+  if ( theWg == 0 )
+    return;
+
+  if ( theWg->inherits( "QListBox" ) )
+  {
+    QListBox* aListBox = ( QListBox* )theWg;
+    bool b;
+    for ( int i = 0, n = aListBox->count(); i < n; i++ )
+    {
+      int anId = aListBox->text( i ).toInt( &b );
+      if ( b )
+        theRes.append( anId );
+    }
+  }
+  else if ( theWg->inherits( "QLineEdit" ) )
+  {
+    QLineEdit* aLineEdit = ( QLineEdit* )theWg;
+    QString aStr = aLineEdit->text();
+    QRegExp aRegExp( "(\\d+)" );
+    bool b;
+    int aPos = 0;
+    while ( aPos >= 0 )
+    {
+      aPos = aRegExp.search( aStr, aPos );
+      if ( aPos > -1 )
+      {
+        int anId = aRegExp.cap( 1 ).toInt( &b );
+        if ( b )
+          theRes.append( anId );
+        aPos += aRegExp.matchedLength();
+      }
+    }
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getSelMode
+// Purpose : Get criteria for specified type
+//=======================================================================
+Selection_Mode SMESHGUI_FilterDlg::getSelMode( const int theType ) const
+{
+  switch ( theType )
+  {
+    case SMESH::NODE   : return NodeSelection;
+    case SMESH::EDGE   : return EdgeSelection;
+    case SMESH::FACE   : return FaceSelection;
+    case SMESH::VOLUME : return VolumeSelection;
+    default            : return ActorSelection;
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCriteria
+// Purpose : Get criteria for specified type
+//=======================================================================
+void SMESHGUI_FilterDlg::setIdsToWg( QWidget* theWg, const QValueList<int>& theIds )
+{
+  if ( theWg == 0 )
+    return;
+    
+  if ( theWg->inherits( "QListBox" ) )
+  {
+    QListBox* aListBox = ( QListBox* )theWg;
+    aListBox->clear();
+    
+    QStringList aStrList;
+    QValueList<int>::const_iterator anIter;
+    for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
+      aStrList.append( QString( "%1" ).arg( *anIter ) );
+
+    aListBox->insertStringList( aStrList );
+  }
+  else if ( theWg->inherits( "QLineEdit" ) )
+  {
+    QLineEdit* aLineEdit = ( QLineEdit* )theWg;
+    QString aStr;
+    QValueList<int>::const_iterator anIter;
+
+    for ( anIter = theIds.begin(); anIter != theIds.end(); ++ anIter )
+      aStr += QString( "%1 " ).arg( *anIter );
+
+    if ( !aStr.isEmpty() )
+      aStr.remove( aStr.length() - 1, 1 );
+
+    aLineEdit->setText( aStr );
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCriteria
+// Purpose : Get criteria for specified type
+//=======================================================================
+const QStringList& SMESHGUI_FilterDlg::getCriteria( const int theType ) const
+{
+  if ( theType == SMESH::EDGE )
+  {
+    static QStringList aCriteria;
+    if ( aCriteria.isEmpty() )
+    {
+      aCriteria.append( tr( "FREE_BORDERS" ) );
+      aCriteria.append( tr( "MULTI_BORDERS" ) );
+      aCriteria.append( tr( "LENGTH" ) );
+    }
+    return aCriteria;
+  }
+  else if ( theType == SMESH::FACE )
+  {
+    static QStringList aCriteria;
+    if ( aCriteria.isEmpty() )
+    {
+      aCriteria.append( tr( "ASPECT_RATIO" ) );
+      aCriteria.append( tr( "WARPING" ) );
+      aCriteria.append( tr( "MINIMUM_ANGLE" ) );
+      aCriteria.append( tr( "TAPER" ) );
+      aCriteria.append( tr( "SKEW" ) );
+      aCriteria.append( tr( "AREA" ) );
+    }
+    return aCriteria;
+  }
+  else
+  {
+    static QStringList aCriteria;
+    return aCriteria;
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCompare
+// Purpose : Get operation of comparison
+//=======================================================================
+const QStringList& SMESHGUI_FilterDlg::getCompare () const
+{
+  static QStringList aList;
+
+  if ( aList.isEmpty() )
+  {
+    aList.append( tr( "LESS_THAN" ) );
+    aList.append( tr( "MORE_THAN" ) );
+    aList.append( tr( "EQUAL_TO" ) );
+  }
+
+  return aList;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCriterionItem
+// Purpose : Get combo table item for criteria of specified type
+//=======================================================================
+QTableItem* SMESHGUI_FilterDlg::getCriterionItem( QTable* theParent , const int theType )
+{
+  return new QComboTableItem( theParent, getCriteria( theType ) );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCompareItem
+// Purpose : Get combo table item for operation of comparision
+//=======================================================================
+QTableItem* SMESHGUI_FilterDlg::getCompareItem( QTable* theParent )
+{
+  return new QComboTableItem( theParent, getCompare() );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getLogOpItem
+// Purpose :
+//=======================================================================
+QTableItem* SMESHGUI_FilterDlg::getLogOpItem( QTable* theParent )
+{
+  static QStringList aList;
+  if ( aList.isEmpty() )
+  {
+    aList.append( tr( "AND" ) );
+    aList.append( tr( "OR" ) );
+  }
+
+  return new QComboTableItem( theParent, aList );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getNotItem
+// Purpose : Get check table item
+//=======================================================================
+QTableItem* SMESHGUI_FilterDlg::getNotItem( QTable* theParent )
+{
+  return new QCheckTableItem( theParent, tr( "NOT" ) );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCurrType
+// Purpose : Get current entity type
+//=======================================================================
+int SMESHGUI_FilterDlg::getCurrType() const
+{
+  return myType;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::getCriterion
+// Purpose :
+//=======================================================================
+int SMESHGUI_FilterDlg::getCriterion( const int theType, const int theRow ) const
+{
+  QComboTableItem* anItem = ( QComboTableItem* )myTables[ getCurrType() ]->item( theRow, 0 );
+  return anItem->currentItem();
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::addRow
+// Purpose :
+//=======================================================================
+void SMESHGUI_FilterDlg::addRow( Table* theTable, const int theType )
+{
+  theTable->insertRows( theTable->numRows() );
+  int aCurrRow = theTable->numRows() - 1;
+
+  // Criteria
+  theTable->setItem( aCurrRow, 0, getCriterionItem( theTable, theType ) );
+
+  // Compare
+  theTable->setItem( aCurrRow, 1, getCompareItem( theTable ) );
+
+  //Logical operation NOT
+  theTable->setItem( aCurrRow, 3, getNotItem( theTable ) );
+
+  // Logical binary operation for previous value
+  if ( aCurrRow > 0 )
+    theTable->setItem( aCurrRow - 1, 4, getLogOpItem( theTable ) );
+  theTable->SetEditable( false, aCurrRow, 4 );
+
+  onCriterionChanged( aCurrRow, 0 );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onAddBtn
+// Purpose : SLOT. Called then "Add" button pressed.
+//           Adds new string to table
+//=======================================================================
+void SMESHGUI_FilterDlg::onAddBtn()
+{
+  // QTable
+  int aType = getCurrType();
+  Table* aTable = myTables[ aType ];
+
+  addRow( aTable, aType );
+
+  updateBtnState();
+
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onCriterionChanged()
+// Purpose : SLOT. Called then contents of table changed
+//           Provides reaction on change of criterion
+//=======================================================================
+void SMESHGUI_FilterDlg::onCriterionChanged( int row, int col )
+{
+  int aType = getCurrType();
+  if ( aType != SMESH::EDGE || col != 0 )
+    return;
+
+  Table* aTable = myTables[ aType ];
+  QComboTableItem* aCompareItem = (QComboTableItem*)aTable->item( row, 1 );
+
+  if ( getCriterion( aType, row ) != FreeBorders )
+  {
+    if ( aCompareItem->count() == 0 )
+      aCompareItem->setStringList( getCompare() );
+
+    QString aText = aTable->text( row, 2 );
+    aTable->SetEditable( true, row, 2 );
+    aTable->setText( row, 2, aText );
+  }
+  else
+  {
+    if ( aCompareItem->count() > 0 )
+      aCompareItem->setStringList( QStringList() );
+    aTable->SetEditable( false, row, 2 );
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onRemoveBtn
+// Purpose : SLOT. Called then "Remove" button pressed. 
+//           Removes current string from table
+//=======================================================================
+void SMESHGUI_FilterDlg::onRemoveBtn()
+{
+  Table* aTable = myTables[ getCurrType() ];
+
+  if ( aTable->numRows() == 0 )
+    return;
+
+  QMemArray<int> aRows;
+  for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+  {
+    if ( aTable->isRowSelected( i ) )
+    {
+      aRows.resize( aRows.size() + 1 );
+      aRows[ aRows.size() - 1 ] = i;
+    }
+  }
+
+  aTable->removeRows( aRows );
+
+  // remove control of binary logical operation from last row
+  if ( aTable->numRows() > 0 )
+    aTable->SetEditable( false, aTable->numRows() - 1, 4 );
+
+  updateBtnState();
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onClearBtn
+// Purpose : SLOT. Called then "Clear" button pressed.
+//           Removes all strings from table
+//=======================================================================
+void SMESHGUI_FilterDlg::onClearBtn()
+{
+  QTable* aTable = myTables[ getCurrType() ];
+
+  if ( aTable->numRows() == 0 )
+    return;
+
+  while ( aTable->numRows() > 0 )
+    aTable->removeRow( 0 );
+
+  updateBtnState();
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::updateBtnState
+// Purpose : Update button state
+//=======================================================================
+void SMESHGUI_FilterDlg::updateBtnState()
+{
+  myRemoveBtn->setEnabled( myTables[ getCurrType() ]->numRows() > 0 );
+  myClearBtn->setEnabled( myTables[ getCurrType() ]->numRows() > 0 );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::isValid
+// Purpose : Verify validity of input data
+//=======================================================================
+bool SMESHGUI_FilterDlg::isValid() const
+{
+  Table* aTable = myTables[ getCurrType() ];
+  for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+  {
+    bool isEditable = aTable->IsEditable( i ,2 );
+    bool aRes       = false;
+    int  aThreshold = ( int )aTable->text( i, 2 ).toDouble( &aRes );
+    if ( isEditable && !aRes )
+    {
+      QMessageBox::information( mySMESHGUI->GetDesktop(),
+        tr( "SMESH_INSUFFICIENT_DATA" ), tr( "ERROR" ),
+        QMessageBox::Ok );
+      return false;
+    }
+    else if ( getCurrType() == SMESH::EDGE &&
+              getCriterion( SMESH::EDGE, i ) == MultiBorders &&
+              aThreshold == 1 )
+    {
+      QMessageBox::information( mySMESHGUI->GetDesktop(),
+        tr( "SMESH_INSUFFICIENT_DATA" ), tr( "MULTIEDGES_ERROR" ),
+        QMessageBox::Ok );
+      return false;
+    }
+  }
+
+  return true;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::GetResultIds
+// Purpose : Get filtered ids
+//=======================================================================
+/*void SMESHGUI_FilterDlg::GetResultIds( SMESH::SMESH_Mesh_ptr theMesh,
+                                       QValueList<int>&      theIds ) const
+{
+  if ( !myPredicate->_is_nil() )
+    theIds = myInputIds;
+  else
+    myPredicate->SetMesh( theMesh );
+  
+  theIds.clear();
+  QValueList<int>::const_iterator anIter;
+  for ( anIter = myInputIds.begin(); anIter != myInputIds.end(); ++anIter )
+    if ( myPredicate->IsSatisfy( *anIter ) )
+     theIds.append( *anIter );
+}
+*/
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::SetSourceWg
+// Purpose : Set widget of parent dialog containing idsto be filtered if
+//           user select corresponding source radio button
+//=======================================================================
+void SMESHGUI_FilterDlg::SetSourceWg( QWidget* theWg )
+{
+  mySourceWg = theWg;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::SetGroupIds
+// Purpose : Set mesh
+//=======================================================================
+void SMESHGUI_FilterDlg::SetMesh( SMESH::SMESH_Mesh_ptr theMesh )
+{
+  myMesh = theMesh;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::SetSelection
+// Purpose : Get filtered ids
+//=======================================================================
+void SMESHGUI_FilterDlg::SetSelection( SALOME_Selection* theSel )
+{
+  mySelection = theSel;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::onApply
+// Purpose : SLOT called when "Apply" button pressed.
+//           Assign filters to VTK viewer
+//=======================================================================
+bool SMESHGUI_FilterDlg::onApply()
+{
+  if ( !isValid() )
+    return false;
+
+  try
+  {
+    int aCurrType = getCurrType();
+
+    SMESH::Predicate_ptr aPredicate = createPredicate( aCurrType );
+
+    if ( mySetInViewer->isChecked() )
+      insertFilterInViewer( aPredicate );
+
+    if ( !aPredicate->_is_nil() )
+    {
+      QValueList<int> aResultIds;
+      filterSource( aCurrType, aPredicate, aResultIds );
+      selectInViewer( aCurrType, aResultIds );
+    }
+  }
+  catch( const SALOME::SALOME_Exception& S_ex )
+  {
+    QtCatchCorbaException( S_ex );
+  }
+  catch( ... )
+  {
+  }
+
+  return true;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::createPredicate
+// Purpose : Create predicate for given type
+//=======================================================================
+SMESH::Predicate_ptr SMESHGUI_FilterDlg::createPredicate( const int theType )
+{
+  SMESH::FilterManager_ptr aFilterMgr = mySMESHGUI->GetFilterMgr();
+  if ( aFilterMgr->_is_nil() )
+    return SMESH::Predicate::_nil();
+
+  QTable* aTable = myTables[ theType ];
+  if ( aTable == 0 )
+    return SMESH::Predicate::_nil();
+
+  // CREATE two lists ( PREDICATES  and LOG OP )
+
+  // Criterion
+  QValueList<SMESH::Predicate_ptr> aPredicates;
+  QValueList<int>                  aLogOps;
+  for ( int i = 0, n = aTable->numRows(); i < n; i++ )
+  {
+    int aCriterion = getCriterion( theType, i );
+
+    SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
+    SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
+
+    if ( theType == SMESH::EDGE )
+    {
+      switch ( aCriterion )
+      {
+      case FreeBorders:
+        aPredicate = aFilterMgr->CreateFreeBorders();
+        break;
+      case MultiBorders:
+        aFunctor = aFilterMgr->CreateMultiConnection();
+        break;
+      case Length:
+        aFunctor = aFilterMgr->CreateLength();
+        break;
+      default:
+        continue;
+      }
+    }
+    else
+    {
+      switch ( aCriterion )
+      {
+      case AspectRatio:
+        aFunctor = aFilterMgr->CreateAspectRatio();
+        break;
+      case Warping:
+        aFunctor = aFilterMgr->CreateWarping();
+        break;
+      case MinimumAngle:
+        aFunctor = aFilterMgr->CreateMinimumAngle();
+        break;
+      case Taper:
+        aFunctor = aFilterMgr->CreateTaper();
+        break;
+      case Skew:
+        aFunctor = aFilterMgr->CreateSkew();
+        break;
+      case Area:
+        aFunctor = aFilterMgr->CreateArea();
+        break;
+      default:
+        continue;
+      }
+    }
+
+    // Comparator
+    if ( !aFunctor->_is_nil() && aPredicate->_is_nil() )
+    {
+      QComboTableItem* aCombo = (QComboTableItem*)aTable->item( i, 1 );
+      int aCompareOp = aCombo->currentItem();
+      double aThreshold = aTable->text( i, 2 ).toDouble();
+
+      SMESH::Comparator_ptr aComparator = SMESH::Comparator::_nil();
+
+      if ( aCompareOp == LessThan )
+        aComparator = aFilterMgr->CreateLessThan();
+      else if ( aCompareOp == MoreThan )
+        aComparator = aFilterMgr->CreateMoreThan();
+      else if ( aCompareOp == EqualTo )
+        aComparator = aFilterMgr->CreateEqualTo();
+      else
+        continue;
+
+      aComparator->SetNumFunctor( aFunctor );
+      aComparator->SetMargin( aThreshold );
+
+      aPredicate = aComparator;
+    }
+
+    // Logical not
+    QCheckTableItem* anItem = (QCheckTableItem*)aTable->item( i, 3 );
+    if ( anItem->isChecked() )
+    {
+      SMESH::LogicalNOT_ptr aNotPred = aFilterMgr->CreateLogicalNOT();
+      aNotPred->SetPredicate( aPredicate );
+      aPredicate = aNotPred;
+    }
+
+    // logical op
+    int aLogOp = ( i == n - 1 ) ? LO_Undefined
+                                : ( (QComboTableItem*)aTable->item( i, 4 ) )->currentItem();
+    aPredicates.append( aPredicate );
+    aLogOps.append( aLogOp );
+
+  } // for
+
+  // CREATE ONE PREDICATE FROM PREVIOUSLY CREATED MAP
+
+  // combine all "AND" operations
+
+  QValueList<SMESH::Predicate_ptr> aResList;
+
+  QValueList<SMESH::Predicate_ptr>::iterator aPredIter;
+  QValueList<int>::iterator                  aLogOpIter;
+
+  SMESH::Predicate_ptr aPrevPredicate = SMESH::Predicate::_nil();
+  int aPrevLogOp = LO_Undefined;
+
+  for ( aPredIter = aPredicates.begin(), aLogOpIter = aLogOps.begin();
+        aPredIter != aPredicates.end() && aLogOpIter != aLogOps.end();
+        ++aPredIter, ++aLogOpIter )
+  {
+    int aCurrLogOp = *aLogOpIter;
+
+    SMESH::Predicate_ptr aCurrPred = SMESH::Predicate::_nil();
+
+    if ( aPrevLogOp == LO_And )
+    {
+
+      SMESH::LogicalBinary_ptr aBinaryPred = aFilterMgr->CreateLogicalAND();
+      aBinaryPred->SetPredicate1( aPrevPredicate );
+      aBinaryPred->SetPredicate2( *aPredIter );
+      aCurrPred = aBinaryPred;
+    }
+    else
+      aCurrPred = *aPredIter;
+
+    if ( aCurrLogOp != LO_And )
+      aResList.append( aCurrPred );
+
+    aPrevPredicate = aCurrPred;
+    aPrevLogOp = aCurrLogOp;
+  }
+
+  // combine all "OR" operations
+
+  SMESH::Predicate_ptr aResPredicate = SMESH::Predicate::_nil();
+
+  if ( aResList.count() == 1 )
+    aResPredicate = aResList.first();
+  else if ( aResList.count() > 1 )
+  {
+    QValueList<SMESH::Predicate_ptr>::iterator anIter = aResList.begin();
+    aResPredicate = *anIter;
+    anIter++;
+    for ( ; anIter != aResList.end(); ++anIter )
+    {
+      SMESH::LogicalBinary_ptr aBinaryPred = aFilterMgr->CreateLogicalOR();
+      aBinaryPred->SetPredicate1( aResPredicate );
+      aBinaryPred->SetPredicate2( *anIter );
+      aResPredicate = aBinaryPred;
+    }
+  }
+
+  return aResPredicate;
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::insertFilterInViewer
+// Purpose : Insert filter in viewer
+//=======================================================================
+void SMESHGUI_FilterDlg::insertFilterInViewer( SMESH::Predicate_ptr thePred )
+{
+  VTKViewer_InteractorStyleSALOME* aStyle = ((VTKViewer_ViewFrame*)mySMESHGUI->GetActiveStudy()->
+    getActiveStudyFrame()->getRightFrame()->getViewFrame())->
+      getRWInteractor()->GetInteractorStyleSALOME();
+
+  if ( thePred->_is_nil() )
+  {
+    if ( myType == SMESH::EDGE )
+      aStyle->RemoveEdgeFilter();
+    else if ( myType == SMESH::FACE )
+      aStyle->RemoveFaceFilter();
+  }
+  else
+  {
+    Handle(SMESHGUI_Filter) aFilter = new SMESHGUI_Filter();
+    aFilter->SetPredicate( thePred );
+    if ( myType == SMESH::EDGE )
+      aStyle->SetEdgeFilter( aFilter );
+    else if ( myType == SMESH::FACE )
+      aStyle->SetFaceFilter( aFilter );
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::filterSource
+// Purpose : Filter source ids
+//=======================================================================
+void SMESHGUI_FilterDlg::filterSource( const int theType,
+                                       SMESH::Predicate_ptr thePred,
+                                       QValueList<int>& theResIds )
+{
+  theResIds.clear();
+  
+  int aSourceId = mySourceGrp->id( mySourceGrp->selected() );
+
+  if ( aSourceId == Mesh )
+  {
+    if ( myMesh->_is_nil() )
+      return;
+    SMESH::FilterManager_ptr aFilterMgr = mySMESHGUI->GetFilterMgr();
+    SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
+    aFilter->SetPredicate( thePred );
+    SMESH::long_array_var anIds = aFilter->GetElementsId( myMesh );
+    for ( int i = 0, n = anIds->length(); i < n; i++ )
+      theResIds.append( anIds[ i ] );
+  }
+  else if ( aSourceId == Selection )
+  {
+    filterSelectionSource( theType, thePred, theResIds );
+  }
+  else if ( aSourceId == Dialog )
+  {
+    // retrieve ids from dialog
+    QValueList<int> aDialogIds;
+    getIdsFromWg( mySourceWg, aDialogIds );
+    
+    if ( myMesh->_is_nil() )
+    {
+      theResIds = aDialogIds;
+      return;
+    }
+
+    // filter ids
+    thePred->SetMesh( myMesh );
+    QValueList<int>::const_iterator anIter;
+    for ( anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter )
+      if ( thePred->IsSatisfy( *anIter ) )
+        theResIds.append( *anIter );
+
+    // set ids to the dialog
+    setIdsToWg( mySourceWg, theResIds );
+  }
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::filterSelectionSource
+// Purpose : Filter source selection
+//=======================================================================
+void SMESHGUI_FilterDlg::filterSelectionSource( const int theType,
+                                                SMESH::Predicate_ptr thePred,
+                                                QValueList<int>& theResIds )
+{
+  theResIds.clear();
+  if ( myMesh->_is_nil() || mySelection == 0 )
+    return;
+
+  // Create map of entities to be filtered
+  TColStd_MapOfInteger aToBeFiltered;
+  Standard_Boolean aRes = false;
+  SALOME_ListIteratorOfListIO anIter( mySelection->StoredIObjects() );
+  
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    // process sub mesh
+    SMESH::SMESH_subMesh_ptr aSubMesh = mySMESHGUI->ConvertIOinSubMesh( anIter.Value(), aRes );
+    if ( aRes && !aSubMesh->_is_nil() )
+    {
+      if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
+      {
+        SMESH::long_array_var anIds =
+          theType == SMESH::NODE ? aSubMesh->GetNodesId() : aSubMesh->GetElementsId();
+        for ( int i = 0, n = anIds->length(); i < n; i++ )
+          aToBeFiltered.Add( anIds[ i ] );
+      }
+    }
+
+    // process group
+    SMESH::SMESH_Group_ptr aGroup = mySMESHGUI->ConvertIOinSMESHGroup( anIter.Value(), aRes );
+    if ( aRes && !aGroup->_is_nil() )
+    {
+      if ( aGroup->GetType() == theType && aGroup->GetMesh()->GetId() == myMesh->GetId() )
+      {
+        SMESH::long_array_var anIds = aGroup->GetListOfID();
+        for ( int i = 0, n = anIds->length(); i < n; i++ )
+          aToBeFiltered.Add( anIds[ i ] );
+      }
+    }
+
+    // process mesh
+    SMESH::SMESH_Mesh_ptr aMeshPtr = mySMESHGUI->ConvertIOinMesh( anIter.Value(), aRes );
+    if ( aRes && !aMeshPtr->_is_nil() && aMeshPtr->GetId() == myMesh->GetId() )
+    {
+      TColStd_MapOfInteger aVtkMap;
+      mySelection->GetIndex( anIter.Value(), aVtkMap );
+
+      if ( aVtkMap.Extent() > 0 )
+      {
+        SMESH_Actor *anActor = mySMESHGUI->FindActorByEntry(
+          anIter.Value()->getEntry(), aRes, true );
+        if ( aRes && anActor != 0 )
+        {
+          TColStd_MapIteratorOfMapOfInteger aVtkMapIter( aVtkMap );
+          for ( ; aVtkMapIter.More(); aVtkMapIter.Next() )
+            aToBeFiltered.Add( theType == SMESH::NODE
+              ? anActor->GetNodeObjId( aVtkMapIter.Key() )
+              : anActor->GetElemObjId( aVtkMapIter.Key() ) );
+        }
+      }
+    }
+  }
+
+  // Filter entities
+  thePred->SetMesh( myMesh );
+  TColStd_MapIteratorOfMapOfInteger aResIter( aToBeFiltered );
+  for ( ; aResIter.More(); aResIter.Next() )
+    if ( thePred->IsSatisfy( aResIter.Key() ) )
+      theResIds.append( aResIter.Key() );
+}
+
+//=======================================================================
+// name    : SMESHGUI_FilterDlg::selectInViewer
+// Purpose : Select given entities in viewer
+//=======================================================================
+void SMESHGUI_FilterDlg::selectInViewer( const int theType, const QValueList<int>& theIds )
+{
+  if ( mySelection == 0 || myMesh->_is_nil() )
+    return;
+
+  // Set new selection mode if necessary
+  Selection_Mode aSelMode = getSelMode( theType );
+  if ( aSelMode != mySelection->SelectionMode() )
+  {
+    mySelection->ClearIObjects();
+    mySelection->ClearFilters();
+    if ( aSelMode == NodeSelection )
+      mySMESHGUI->ViewNodes();
+    QAD_Application::getDesktop()->SetSelectionMode( aSelMode );
+  }
+
+  Standard_Boolean aRes = false;
+  SMESH_Actor* anActor = mySMESHGUI->FindActor( myMesh, aRes, true );
+  if ( !aRes || anActor == 0 || !anActor->hasIO() )
+    return;
+
+  Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+  mySelection->ClearIObjects();
+  mySelection->AddIObject( anIO, false );
+
+  TColStd_MapOfInteger aMap;
+  QValueList<int>::const_iterator anIter;
+  for ( anIter = theIds.begin(); anIter != theIds.end(); ++anIter )
+  {
+    std::vector<int> aVtkList = anActor->GetElemVtkId( *anIter );
+    std::vector<int>::iterator it;
+    for ( it = aVtkList.begin(); it != aVtkList.end(); ++it )
+      aMap.Add( *it );
+  }
+
+  mySelection->AddOrRemoveIndex( anIO, aMap, false, true );
+  
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h
new file mode 100755 (executable)
index 0000000..6ba1d4a
--- /dev/null
@@ -0,0 +1,195 @@
+//  SMESH SMESHGUI : GUI for SMESH component\r
+//\r
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+//  This library is free software; you can redistribute it and/or \r
+//  modify it under the terms of the GNU Lesser General Public \r
+//  License as published by the Free Software Foundation; either \r
+//  version 2.1 of the License. \r
+// \r
+//  This library is distributed in the hope that it will be useful, \r
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
+//  Lesser General Public License for more details. \r
+// \r
+//  You should have received a copy of the GNU Lesser General Public \r
+//  License along with this library; if not, write to the Free Software \r
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
+// \r
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+//  File   : SMESHGUI_FilterDlg.h\r
+//  Author : Sergey LITONIN\r
+//  Module : SMESH\r
+\r
+\r
+#ifndef SMESHGUI_FilterDlg_H\r
+#define SMESHGUI_FilterDlg_H\r
+\r
+#include <qdialog.h>\r
+#include <qmap.h>\r
+#include <qvaluelist.h>\r
+#include <SALOME_Selection.h>\r
+\r
+#include <SALOMEconfig.h>\r
+#include CORBA_SERVER_HEADER(SMESH_Filter)\r
+#include CORBA_SERVER_HEADER(SMESH_Mesh)\r
+\r
+class QCloseEvent;\r
+class QWidgetStack;\r
+class QStringList;\r
+class QTableItem;\r
+class QFrame;\r
+class QEvent;\r
+class QPushButton;\r
+class QTable;\r
+class SALOME_Selection;\r
+class SMESHGUI;\r
+class QComboBox;\r
+class QButtonGroup;\r
+class QCheckBox;\r
+class QGroupBox;\r
+\r
+\r
+/*\r
+  Class       : SMESHGUI_FilterDlg\r
+  Description : Dialog to specify filters for VTK viewer\r
+*/\r
+\r
+class SMESHGUI_FilterDlg : public QDialog\r
+{ \r
+  Q_OBJECT\r
+\r
+  class Table;\r
+\r
+  // Edge criteria\r
+  enum { FreeBorders = 0, MultiBorders, Length }; \r
+\r
+  // Face criteria\r
+  enum { AspectRatio = 0, Warping, MinimumAngle, Taper, Skew, Area }; \r
+\r
+  // Comparision\r
+  enum { LessThan = 0, MoreThan, EqualTo };\r
+\r
+  // Logical operations\r
+  enum { LO_And = 0, LO_Or, LO_Undefined };\r
+\r
+  // Source elements to be selected\r
+  enum { Mesh, Selection, Dialog, None };\r
+\r
+  typedef QMap<int, Table*> TableMap;\r
+\r
+public:\r
+                            SMESHGUI_FilterDlg( QWidget*    parent, \r
+                                                const int   type,\r
+                                                const bool  theModal = true,\r
+                                                const char* name = 0 );\r
+  virtual                   ~SMESHGUI_FilterDlg();\r
+\r
+  void                      Init( const int type );\r
+\r
+  void                      SetSelection( SALOME_Selection* );\r
+  void                      SetMesh( SMESH::SMESH_Mesh_ptr );\r
+  void                      SetSourceWg( QWidget* );\r
+\r
+private slots:\r
+\r
+  void                      onAddBtn();\r
+  void                      onRemoveBtn();\r
+  void                      onClearBtn();\r
+  void                      onCriterionChanged( int, int );\r
+\r
+  void                      onOk();\r
+  bool                      onApply();\r
+  void                      onClose();\r
+  void                      onDeactivate();\r
+\r
+private:\r
+\r
+  void                      closeEvent( QCloseEvent* e );\r
+  void                      enterEvent ( QEvent * );\r
+\r
+  void                      updateBtnState();\r
+\r
+  // dialog creation\r
+  QFrame*                   createButtonFrame( QWidget*, const bool );\r
+  QFrame*                   createMainFrame( QWidget* );\r
+  Table*                    createTable( QWidget*, const int );\r
+  QButtonGroup*             createSourceGroup( QWidget* );\r
+  void                      addRow( Table*, const int );\r
+  QTableItem*               getCriterionItem( QTable*, const int );\r
+  QTableItem*               getCompareItem( QTable* );\r
+  QTableItem*               getNotItem( QTable* );\r
+  QTableItem*               getLogOpItem( QTable* );\r
+  const QStringList&        getCriteria( const int theType ) const;\r
+  const QStringList&        getCompare () const;\r
+  \r
+  // query\r
+  int                       getCurrType() const;\r
+  int                       getCriterion( const int theType, const int theRow ) const;\r
+\r
+  // execution\r
+  bool                      isValid() const;\r
+  SMESH::Predicate_ptr      createPredicate( const int theType );\r
+  void                      insertFilterInViewer( SMESH::Predicate_ptr thePred );\r
+  void                      selectInViewer( const int theType,\r
+                                            const QValueList<int>& theIds );\r
+  void                      filterSource( const int            theType,\r
+                                          SMESH::Predicate_ptr thePred,\r
+                                          QValueList<int>&     theResIds );\r
+  void                      filterSelectionSource( const int            theType,\r
+                                                   SMESH::Predicate_ptr thePred,\r
+                                                   QValueList<int>&     theResIds );\r
+  void                      getIdsFromWg( const QWidget*, QValueList<int>& ) const;\r
+  void                      setIdsToWg( QWidget*, const QValueList<int>& );\r
+  Selection_Mode            getSelMode( const int ) const;\r
+\r
+private:\r
+\r
+  // widgets\r
+  QFrame*                   myMainFrame;\r
+  QGroupBox*                myTableGrp;\r
+\r
+  TableMap                  myTables;\r
+  QPushButton*              myAddBtn;\r
+  QPushButton*              myRemoveBtn;\r
+  QPushButton*              myClearBtn;\r
+  QButtonGroup*             mySourceGrp;\r
+  QCheckBox*                mySetInViewer;\r
+\r
+  QPushButton*              myOkBtn;\r
+  QPushButton*              myApplyBtn;\r
+  QPushButton*              myCloseBtn;\r
+\r
+  // initial fields\r
+  int                       myType;\r
+  SMESHGUI*                 mySMESHGUI;\r
+  SALOME_Selection*         mySelection;\r
+  SMESH::SMESH_Mesh_ptr     myMesh;\r
+  QWidget*                  mySourceWg;\r
+};\r
+\r
+#endif\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx
new file mode 100644 (file)
index 0000000..d6928d6
--- /dev/null
@@ -0,0 +1,977 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.org 
+//
+//
+//
+//  File   : SMESHGUI_GroupDlg.cxx
+//  Author : Natalia KOPNOVA
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "SMESHGUI_GroupDlg.h"
+#include "SMESHGUI_FilterDlg.h"
+
+#include "SMESHGUI.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "VTKViewer_InteractorStyleSALOME.h"
+#include "VTKViewer_ViewFrame.h"
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_MessageBox.h"
+#include "QAD_RightFrame.h"
+#include "utilities.h"
+
+#include "SMESH_Actor.h"
+
+// QT Includes
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qlistbox.h>
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qmemarray.h>
+
+// STL includes
+#include <vector>
+#include <algorithm>
+
+//=================================================================================
+// class    : SMESHGUI_GroupDlg()
+// purpose  : 
+//=================================================================================
+SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
+                                     SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl )
+  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+{
+  if ( !name ) setName( "SMESHGUI_GroupDlg" );
+  initDialog(theSel, true);
+  init(theMesh);
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+}
+
+SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
+                                     SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl )
+  : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+{
+  if ( !name ) setName( "SMESHGUI_GroupDlg" );
+  initDialog(theSel, false);
+  init(theGroup);
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+}
+
+void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
+{
+  myFilterDlg = 0;
+  
+  QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
+
+  if (create)
+    setCaption( tr( "SMESH_CREATE_GROUP_TITLE"  ) );
+  else 
+    setCaption( tr( "SMESH_EDIT_GROUP_TITLE"  ) );
+  setSizeGripEnabled( TRUE );
+
+  QVBoxLayout* aMainLayout = new QVBoxLayout(this, 11, 6);
+  
+  /***************************************************************/
+  myTypeGroup = new QButtonGroup(1, Qt::Vertical, this, "Group types");
+  myTypeGroup->setTitle(tr("SMESH_ELEMENTS_TYPE"));
+  myTypeGroup->setExclusive(true);
+
+  QStringList types;
+  types.append(tr("MESH_NODE"));
+  types.append(tr("SMESH_EDGE"));
+  types.append(tr("SMESH_FACE"));
+  types.append(tr("SMESH_VOLUME"));
+  QRadioButton* rb;
+  for (int i = 0; i < types.count(); i++) {
+    rb = new QRadioButton(types[i], myTypeGroup);
+  }
+  myTypeGroup->setEnabled(create);
+  myTypeId = -1;
+    
+  /***************************************************************/
+  QHBox* aNameBox = new QHBox(this, "name box");
+  QLabel* aName = new QLabel(aNameBox, "name label");
+  aName->setText(tr("SMESH_NAME"));
+  aName->setMinimumSize(50,0);
+  myName = new QLineEdit(aNameBox, "name");
+    
+  /***************************************************************/
+  QGroupBox* aContentBox = new QGroupBox(1, Qt::Horizontal, this, "content box");
+  aContentBox->setTitle(tr("SMESH_CONTENT"));
+  QFrame* aContent = new QFrame(aContentBox, "content");
+  QGridLayout* aLayout = new QGridLayout(aContent, 7, 4);
+  aLayout->setSpacing(6);
+  aLayout->setAutoAdd(false);
+
+  QLabel* aLabel = new QLabel(aContent, "elements label");
+  aLabel->setText(tr("SMESH_ID_ELEMENTS"));
+  myElements = new QListBox(aContent, "elements list");
+  myElements->setSelectionMode(QListBox::Extended);
+  //  myElements->setMinimumHeight(150);
+
+  myFilter = new QPushButton(aContent, "filter");
+  myFilter->setText(tr("SMESH_BUT_FILTER"));
+  QPushButton* aAddBtn = new QPushButton(aContent, "add");
+  aAddBtn->setText(tr("SMESH_BUT_ADD"));
+  QPushButton* aRemoveBtn = new QPushButton(aContent, "remove");
+  aRemoveBtn->setText(tr("SMESH_BUT_REMOVE"));
+  QPushButton* aSortBtn = new QPushButton(aContent, "sort");
+  aSortBtn->setText(tr("SMESH_BUT_SORT"));
+
+  aLayout->addWidget(aLabel, 0, 0);
+  aLayout->addMultiCellWidget(myElements, 1, 6, 0, 0);
+  aLayout->addWidget(myFilter, 1, 2);
+  aLayout->addWidget(aAddBtn, 3, 2);
+  aLayout->addWidget(aRemoveBtn, 4, 2);
+  aLayout->addWidget(aSortBtn, 6, 2);
+
+  aLayout->setColStretch(0, 1);
+  aLayout->addColSpacing(1, 20);
+  aLayout->addColSpacing(3, 20);
+  aLayout->setRowStretch(2, 1);
+  aLayout->setRowStretch(5, 1);
+
+  aContentBox->setMinimumHeight(aContent->sizeHint().height() + 
+                               aContentBox->sizeHint().height());
+
+  /***************************************************************/
+  QGroupBox* aSelectBox = new QGroupBox(3, Qt::Horizontal, this, "select box");
+  aSelectBox->setTitle(tr("SMESH_SELECT_FROM"));
+
+  mySelectSubMesh = new QCheckBox(aSelectBox, "submesh checkbox");
+  mySelectSubMesh->setText(tr("SMESH_SUBMESH"));
+  mySelectSubMesh->setMinimumSize(50, 0);
+  mySubMeshBtn = new QPushButton(aSelectBox, "submesh button");
+  mySubMeshBtn->setText("");
+  mySubMeshBtn->setPixmap(image0);
+  mySubMeshLine = new QLineEdit(aSelectBox, "submesh line");
+  mySubMeshLine->setReadOnly(true);
+  onSelectSubMesh(false);
+
+  mySelectGroup = new QCheckBox(aSelectBox, "group checkbox");
+  mySelectGroup->setText(tr("SMESH_GROUP"));
+  mySelectGroup->setMinimumSize(50, 0);
+  myGroupBtn = new QPushButton(aSelectBox, "group button");
+  myGroupBtn->setText("");
+  myGroupBtn->setPixmap(image0);
+  myGroupLine = new QLineEdit(aSelectBox, "group line");
+  myGroupLine->setReadOnly(true);
+  onSelectGroup(false);
+
+  aSelectBox->setMinimumHeight(mySubMeshBtn->sizeHint().height() + 
+                              myGroupBtn->sizeHint().height() +
+                              aSelectBox->sizeHint().height());
+
+  /***************************************************************/
+  QFrame* aButtons = new QFrame(this, "button box");
+  aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6);
+  aBtnLayout->setAutoAdd(false);
+
+  QPushButton* aOKBtn = new QPushButton(aButtons, "ok");
+  aOKBtn->setText(tr("SMESH_BUT_OK"));
+  aOKBtn->setAutoDefault(true);
+  aOKBtn->setDefault(true);
+  QPushButton* aApplyBtn = new QPushButton(aButtons, "apply");
+  aApplyBtn->setText(tr("SMESH_BUT_APPLY"));
+  aApplyBtn->setAutoDefault(true);
+  QPushButton* aCloseBtn = new QPushButton(aButtons, "close");
+  aCloseBtn->setText(tr("SMESH_BUT_CLOSE"));
+  aCloseBtn->setAutoDefault(true);
+
+  aBtnLayout->addWidget(aOKBtn);
+  aBtnLayout->addWidget(aApplyBtn);
+  aBtnLayout->addStretch();
+  aBtnLayout->addWidget(aCloseBtn);
+
+  /***************************************************************/
+  aMainLayout->addWidget(myTypeGroup);
+  aMainLayout->addWidget(aNameBox);
+  aMainLayout->addWidget(aContentBox);
+  aMainLayout->addWidget(aSelectBox);
+  aMainLayout->addWidget(aButtons);
+
+  /* signals and slots connections */
+  connect(myTypeGroup, SIGNAL(clicked(int)), this, SLOT(onTypeChanged(int)));
+
+  connect(myName, SIGNAL(textChanged(const QString&)), this, SLOT(onNameChanged(const QString&)));
+  connect(myElements, SIGNAL(selectionChanged()), this, SLOT(onListSelectionChanged()));
+
+  connect(myFilter, SIGNAL(clicked()), this, SLOT(setFilters()));
+  connect(aAddBtn, SIGNAL(clicked()), this, SLOT(onAdd()));
+  connect(aRemoveBtn, SIGNAL(clicked()), this, SLOT(onRemove()));
+  connect(aSortBtn, SIGNAL(clicked()), this, SLOT(onSort()));
+
+  connect(mySelectSubMesh, SIGNAL(toggled(bool)), this, SLOT(onSelectSubMesh(bool)));
+  connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool)));
+  connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
+  connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
+
+  connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
+  connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
+  connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
+
+  /* Init selection */
+  mySelection = theSel;  
+  mySMESHGUI = SMESHGUI::GetSMESHGUI();
+  mySMESHGUI->SetActiveDialogBox(this);
+  mySMESHGUI->SetState(800);
+
+  mySelectionMode = -1;
+  mySubMeshFilter = new SMESH_TypeFilter(SUBMESH);
+  myGroupFilter = new SMESH_TypeFilter(GROUP);
+
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onClose()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
+  connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
+
+  updateButtons();
+}
+
+//=================================================================================
+// function : ~SMESHGUI_GroupDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::init(SMESH::SMESH_Mesh_ptr theMesh)
+{
+  /* init data from current selection */
+  myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
+  myGroup = SMESH::SMESH_Group::_nil();
+
+  Standard_Boolean aResult;
+  myActor = mySMESHGUI->FindActor(myMesh, aResult, true);
+  mySMESHGUI->SetPickable(myActor);
+
+  myTypeGroup->setButton(0);
+  onTypeChanged(0);
+}
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
+{
+
+  myMesh = theGroup->GetMesh();
+  myGroup = SMESH::SMESH_Group::_duplicate(theGroup);
+
+  Standard_Boolean aResult;
+  myActor = mySMESHGUI->FindActor(myMesh, aResult, true);
+  if ( !myActor )
+    myActor = mySMESHGUI->FindActor(myGroup, aResult, true);
+  mySMESHGUI->SetPickable(myActor);
+
+  int aType = 0;
+  switch(theGroup->GetType()) {
+  case SMESH::NODE: aType= 0; break;
+  case SMESH::EDGE: aType = 1; break;
+  case SMESH::FACE: aType = 2; break;
+  case SMESH::VOLUME: aType = 3; break;
+  } 
+  myTypeGroup->setButton(aType);
+  onTypeChanged(aType);
+
+  myName->setText(myGroup->GetName());
+  myName->home(false);
+
+  if (!theGroup->IsEmpty()) {
+    SMESH::long_array_var anElements = myGroup->GetListOfID();
+    int k = anElements->length();
+    for (int i = 0; i < k; i++) {
+      myIdList.append(anElements[i]);
+      myElements->insertItem(QString::number(anElements[i]));
+    }
+    myElements->selectAll(true);
+  }
+}
+
+
+//=================================================================================
+// function : updateButtons()
+// purpose  : 
+//=================================================================================
+void SMESHGUI_GroupDlg::updateButtons()
+{
+  bool enable = !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0;
+  QPushButton* aBtn;
+  aBtn = (QPushButton*) child("ok", "QPushButton");
+  if (aBtn) aBtn->setEnabled(enable);
+  aBtn = (QPushButton*) child("apply", "QPushButton");
+  if (aBtn) aBtn->setEnabled(enable);
+}
+
+//=================================================================================
+// function : onNameChanged()
+// purpose  : 
+//=================================================================================
+void SMESHGUI_GroupDlg::onNameChanged(const QString& text)
+{
+  updateButtons();
+}
+
+//=================================================================================
+// function : onTypeChanged()
+// purpose  : Radio button management
+//=================================================================================
+void SMESHGUI_GroupDlg::onTypeChanged(int id)
+{
+  if (myTypeId != id) {
+    myElements->clear();
+    if (myCurrentLineEdit == 0)
+      setSelectionMode(id);
+    myFilter->setEnabled(id == 1 || id == 2);
+  }
+  myTypeId = id;
+}
+
+//=================================================================================
+// function : setSelectionMode()
+// purpose  : Radio button management
+//=================================================================================
+void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
+{
+  if (mySelectionMode != theMode) {
+    mySelection->ClearIObjects();
+    mySelection->ClearFilters();
+    if (mySelectionMode == 0)
+      mySMESHGUI->EraseSimulationActors();
+    if (theMode < 4) {
+      if (theMode == 0) {
+       mySMESHGUI->ViewNodes();
+       QAD_Application::getDesktop()->SetSelectionMode(NodeSelection, true);
+      }
+      else if (theMode == 1) {
+       QAD_Application::getDesktop()->SetSelectionMode(EdgeSelection, true);
+      }
+      else if (theMode == 2) {
+       QAD_Application::getDesktop()->SetSelectionMode(FaceSelection, true);
+      }
+      else {
+       QAD_Application::getDesktop()->SetSelectionMode(VolumeSelection, true);
+      }
+    }
+    else {
+      QAD_Application::getDesktop()->SetSelectionMode(ActorSelection, true);
+      if (theMode == 4)
+       mySelection->AddFilter(mySubMeshFilter);
+      else if (theMode == 5)
+       mySelection->AddFilter(myGroupFilter);
+    }
+    mySelectionMode = theMode;
+  }
+} 
+
+//=================================================================================
+// function : onApply()
+// purpose  :
+//=================================================================================
+bool SMESHGUI_GroupDlg::onApply()
+{
+  if (!myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0) {
+    mySelection->ClearIObjects();
+    if (myGroup->_is_nil()) {
+      SMESH::ElementType aType = SMESH::ALL;
+      switch(myTypeId) {
+      case 0: aType = SMESH::NODE; break;
+      case 1: aType = SMESH::EDGE; break;
+      case 2: aType = SMESH::FACE; break;
+      case 3: aType = SMESH::VOLUME; break;
+      }
+      SMESH::long_array_var anIdList = new SMESH::long_array;
+      int i, k = myElements->count();
+      anIdList->length(k);
+      QListBoxItem* anItem;
+      for (i = 0, anItem = myElements->firstItem(); anItem != 0; i++, anItem = anItem->next()) {
+       anIdList[i] = anItem->text().toInt();
+      }
+
+      myGroup = mySMESHGUI->AddGroup(myMesh, aType, myName->text());
+      myGroup->Add(anIdList);
+
+      /* init for next operation */
+      myName->setText("");
+      myElements->clear();
+      myGroup = SMESH::SMESH_Group::_nil();
+    }
+    else {
+      myGroup->SetName(myName->text());
+
+      QValueList<int> aAddList;
+      QValueList<int>::iterator anIt;
+      QListBoxItem* anItem;
+      for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
+       int anId = anItem->text().toInt();
+       if ((anIt = myIdList.find(anId)) == myIdList.end())
+         aAddList.append(anId);
+       else
+         myIdList.remove(anIt);
+      }
+      if (!aAddList.empty()) {
+       SMESH::long_array_var anIdList = new SMESH::long_array;
+       anIdList->length(aAddList.count());
+        int i;
+       for (i = 0, anIt = aAddList.begin(); anIt != aAddList.end(); anIt++, i++)
+         anIdList[i] = *anIt;
+       myGroup->Add(anIdList);
+      }
+      if (!myIdList.empty()) {
+       SMESH::long_array_var anIdList = new SMESH::long_array;
+       anIdList->length(myIdList.count());
+        int i;
+       for (i = 0, anIt = myIdList.begin(); anIt != myIdList.end(); anIt++, i++)
+         anIdList[i] = *anIt;
+       myGroup->Remove(anIdList);
+      }
+      /* init for next operation */
+      myIdList.clear();
+      for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next())
+       myIdList.append(anItem->text().toInt());
+    }
+
+    mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
+    mySelection->ClearIObjects();
+    return true;
+  }
+  return false;
+}
+
+//=================================================================================
+// function : onOK()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::onOK()
+{
+  if ( onApply() )
+    onClose();
+}
+
+//=================================================================================
+// function : onClose()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::onClose()
+{
+  close();
+}
+
+
+static bool busy = false;
+//=================================================================================
+// function : onListSelectionChanged()
+// purpose  : Called when selection in element list is changed
+//=================================================================================
+void SMESHGUI_GroupDlg::onListSelectionChanged()
+{
+  //  MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
+  if (busy || !myActor) return;
+  busy = true;
+
+  if (myCurrentLineEdit == 0) {
+    mySelection->ClearIObjects();
+    TColStd_MapOfInteger aIndexes;
+    QListBoxItem* anItem;
+    for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
+      if (anItem->isSelected()) {
+       std::vector<int> aVtkList;
+       if (myTypeId == 0)
+         aVtkList = myActor->GetNodeVtkId(anItem->text().toInt());
+       else
+         aVtkList = myActor->GetElemVtkId(anItem->text().toInt());
+
+       if (aVtkList.size() > 0) {
+         std::vector<int>::iterator it;
+         for (it = aVtkList.begin(); it != aVtkList.end(); ++it) {
+           aIndexes.Add(*it);
+         }
+       }
+      }
+    }
+    mySelection->AddOrRemoveIndex(myActor->getIO(), aIndexes, false, false);
+    mySelection->AddIObject(myActor->getIO());
+  }
+  busy = false;
+}
+
+//=================================================================================
+// function : onObjectSelectionChanged()
+// purpose  : Called when selection in 3D view or ObjectBrowser is changed
+//=================================================================================
+void SMESHGUI_GroupDlg::onObjectSelectionChanged()
+{
+  if (busy) return;
+  busy = true;
+
+  int aNbSel = mySelection->IObjectCount();
+  myElements->clearSelection();
+
+  if (myCurrentLineEdit) {
+    myCurrentLineEdit->setText("") ;
+    QString aString = "";
+    if (aNbSel >= 1) {
+      if (aNbSel > 1) {
+       if (myCurrentLineEdit = mySubMeshLine)
+         aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
+       else if (myCurrentLineEdit = myGroupLine)
+         aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
+      }
+      else {
+       aString = mySelection->firstIObject()->getName();
+      }
+    }
+
+    myCurrentLineEdit->setText(aString) ;
+    myCurrentLineEdit->home( false );
+  }
+  else {
+    if (aNbSel == 1) {
+      QString aListStr = "";
+      int aNbItems = 0;
+      if (myTypeId == 0) {
+       aNbItems = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aListStr);
+      }
+      else {
+       aNbItems = mySMESHGUI->GetNameOfSelectedElements(mySelection, aListStr);
+      }
+      if (aNbItems > 0) {
+       QStringList anElements = QStringList::split(" ", aListStr);
+       QListBoxItem* anItem = 0;
+       for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
+         anItem = myElements->findItem(*it, Qt::ExactMatch);
+         if (anItem) myElements->setSelected(anItem, true);
+       }
+      }
+    }
+  }
+  busy = false;
+}
+
+
+//=================================================================================
+// function : onSelectSubMesh()
+// purpose  : Called when selection in 3D view or ObjectBrowser is changed
+//=================================================================================
+void SMESHGUI_GroupDlg::onSelectSubMesh(bool on)
+{
+  if (on) {
+    if (mySelectGroup->isChecked()) {
+      mySelectGroup->setChecked(false);
+    }
+    myCurrentLineEdit = mySubMeshLine;
+    setSelectionMode(4);
+  }
+  else {
+    mySubMeshLine->setText("");
+    myCurrentLineEdit = 0;
+    if (myTypeId != -1)
+      setSelectionMode(myTypeId);
+  }
+  mySubMeshBtn->setEnabled(on);
+  mySubMeshLine->setEnabled(on);
+}
+
+//=================================================================================
+// function : (onSelectGroup)
+// purpose  : Called when selection in 3D view or ObjectBrowser is changed
+//=================================================================================
+void SMESHGUI_GroupDlg::onSelectGroup(bool on)
+{
+  if (on) {
+    if (mySelectSubMesh->isChecked()) {
+      mySelectSubMesh->setChecked(false);
+    }
+    myCurrentLineEdit = myGroupLine;
+    setSelectionMode(5);
+  }
+  else {
+    myGroupLine->setText("");
+    myCurrentLineEdit = 0;
+    if (myTypeId != -1)
+      setSelectionMode(myTypeId);
+  }
+  myGroupBtn->setEnabled(on);
+  myGroupLine->setEnabled(on);
+}
+
+//=================================================================================
+// function : setCurrentSelection()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::setCurrentSelection()
+{
+  QPushButton* send = (QPushButton*)sender();
+  myCurrentLineEdit = 0;
+  if (send == mySubMeshBtn) {
+    myCurrentLineEdit = mySubMeshLine;
+    onObjectSelectionChanged();
+  }
+  else if (send == myGroupBtn) {
+    myCurrentLineEdit = myGroupLine;
+    onObjectSelectionChanged();
+  }
+}
+
+
+//=================================================================================
+// function : setFilters()
+// purpose  : SLOT. Called when "Filter" button pressed. 
+//=================================================================================
+void SMESHGUI_GroupDlg::setFilters()
+{
+  SMESH::ElementType aType = SMESH::ALL;
+  switch ( myTypeId )
+  {
+    case 0 : aType = SMESH::NODE; break;
+    case 1 : aType = SMESH::EDGE; break;
+    case 2 : aType = SMESH::FACE; break;
+    case 3 : aType = SMESH::VOLUME; break;
+    default: return;
+  }
+  if ( myFilterDlg == 0 )
+    myFilterDlg = new SMESHGUI_FilterDlg( this, aType, true );
+  else
+    myFilterDlg->Init( aType );
+
+  myFilterDlg->SetSelection( mySelection );
+  myFilterDlg->SetMesh( myMesh );
+  myFilterDlg->SetSourceWg( myElements );
+
+  if ( myFilterDlg->exec() != QDialog::Accepted )
+    return;
+
+  if ( mySelectSubMesh->isChecked() || mySelectGroup->isChecked() )
+  {
+    mySelectionMode = myTypeId;
+    mySelectSubMesh->setChecked( false );
+    mySelectGroup->setChecked( false );
+  }
+}
+
+//=================================================================================
+// function : onAdd()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::onAdd()
+{
+  int aNbSel = mySelection->IObjectCount();
+  if (aNbSel == 0) return;
+
+  busy = true;
+
+  SMESH::ElementType aType = SMESH::ALL;
+  switch(myTypeId) {
+  case 0: aType = SMESH::NODE; break;
+  case 1: aType = SMESH::EDGE; break;
+  case 2: aType = SMESH::FACE; break;
+  case 3: aType = SMESH::VOLUME; break;
+  }
+
+  if (myCurrentLineEdit == 0) {
+    if (aNbSel != 1) { busy = false; return; }
+    QString aListStr = "";
+    int aNbItems = 0;
+    if (myTypeId == 0) {
+      aNbItems = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aListStr);
+    }
+    else {
+      aNbItems = mySMESHGUI->GetNameOfSelectedElements(mySelection, aListStr);
+    }
+    if (aNbItems > 0) {
+      QStringList anElements = QStringList::split(" ", aListStr);
+      QListBoxItem* anItem = 0;
+      for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
+       anItem = myElements->findItem(*it, Qt::ExactMatch);
+       if (!anItem) {
+         anItem = new QListBoxText(*it);
+         myElements->insertItem(anItem);
+       }
+       myElements->setSelected(anItem, true);
+      }
+    }
+  }
+  else if (myCurrentLineEdit == mySubMeshLine) {
+    Standard_Boolean aRes;
+    SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+    for (; anIt.More(); anIt.Next()) {
+      SMESH::SMESH_subMesh_var aSubMesh = mySMESHGUI->ConvertIOinSubMesh(anIt.Value(), aRes);
+      if (aRes && !aSubMesh->_is_nil()) {
+       // check if mesh is the same
+       if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
+         if (aType == SMESH::NODE) {
+           try {
+             SMESH::long_array_var anElements = aSubMesh->GetNodesId();
+             int k = anElements->length();
+             QListBoxItem* anItem = 0;
+             for (int i = 0; i < k; i++) {
+               QString aText = QString::number(anElements[i]);
+               anItem = myElements->findItem(aText, Qt::ExactMatch);
+               if (!anItem) {
+                 anItem = new QListBoxText(aText);
+                 myElements->insertItem(anItem);
+               }
+               myElements->setSelected(anItem, true);
+             }
+           }
+           catch (const SALOME::SALOME_Exception& ex) {
+             QtCatchCorbaException(ex);
+           }
+         }
+         else {
+           try {
+             SMESH::long_array_var anElements = aSubMesh->GetElementsId();
+             int k = anElements->length();
+             QListBoxItem* anItem = 0;
+             for (int i = 0; i < k; i++) {
+               QString aText = QString::number(anElements[i]);
+               anItem = myElements->findItem(aText, Qt::ExactMatch);
+               if (!anItem) {
+                 anItem = new QListBoxText(aText);
+                 myElements->insertItem(anItem);
+               }
+               myElements->setSelected(anItem, true);
+             }
+           }
+           catch (const SALOME::SALOME_Exception& ex) {
+             QtCatchCorbaException(ex);
+           }
+         }
+       }
+      }
+    }
+    mySelectSubMesh->setChecked(false);
+    busy = false;
+    onListSelectionChanged();
+  }
+  else if (myCurrentLineEdit == myGroupLine) {
+    Standard_Boolean aRes;
+    SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+    for (; anIt.More(); anIt.Next()) {
+      SMESH::SMESH_Group_var aGroup = mySMESHGUI->ConvertIOinSMESHGroup(anIt.Value(), aRes);
+      if (aRes && !aGroup->_is_nil()) {
+       // check if mesh is the same
+       if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
+         SMESH::long_array_var anElements = aGroup->GetListOfID();
+         int k = anElements->length();
+         QListBoxItem* anItem = 0;
+         for (int i = 0; i < k; i++) {
+           QString aText = QString::number(anElements[i]);
+           anItem = myElements->findItem(aText, Qt::ExactMatch);
+           if (!anItem) {
+             anItem = new QListBoxText(aText);
+             myElements->insertItem(anItem);
+           }
+           myElements->setSelected(anItem, true);
+         }
+       }
+      }
+    }
+    mySelectGroup->setChecked(false);
+    busy = false;
+    onListSelectionChanged();
+  }
+  busy = false;
+  //  mySelection->ClearIObjects();
+  updateButtons();
+}
+
+//=================================================================================
+// function : onRemove()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::onRemove()
+{
+  busy = true;
+  if (myCurrentLineEdit == 0) {
+    for (int i = myElements->count(); i > 0; i--) {
+      if (myElements->isSelected(i-1)) {
+       myElements->removeItem(i-1);
+      }
+    }
+  }
+  else {
+    int aNbSel = mySelection->IObjectCount();
+    if (aNbSel == 0) { busy = false; return; }
+    
+    SMESH::ElementType aType = SMESH::ALL;
+    switch(myTypeId) {
+    case 0: aType = SMESH::NODE; break;
+    case 1: aType = SMESH::EDGE; break;
+    case 2: aType = SMESH::FACE; break;
+    case 3: aType = SMESH::VOLUME; break;
+    }
+
+    if (myCurrentLineEdit == mySubMeshLine) {
+      Standard_Boolean aRes;
+      SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+      for (; anIt.More(); anIt.Next()) {
+       SMESH::SMESH_subMesh_var aSubMesh = mySMESHGUI->ConvertIOinSubMesh(anIt.Value(), aRes);
+       if (aRes && !aSubMesh->_is_nil()) {
+         // check if mesh is the same
+         if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
+           if (aType == SMESH::NODE) {
+             try {
+               SMESH::long_array_var anElements = aSubMesh->GetNodesId();
+               int k = anElements->length();
+               QListBoxItem* anItem = 0;
+               for (int i = 0; i < k; i++) {
+                 anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch);
+                 if (anItem) delete anItem;
+               }
+             }
+             catch (const SALOME::SALOME_Exception& ex) {
+               QtCatchCorbaException(ex);
+             }
+           }
+           else {
+             try {
+               SMESH::long_array_var anElements = aSubMesh->GetElementsId();
+               int k = anElements->length();
+               QListBoxItem* anItem = 0;
+               for (int i = 0; i < k; i++) {
+                 anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch);
+                 if (anItem) delete anItem;
+               }
+             }
+             catch (const SALOME::SALOME_Exception& ex) {
+               QtCatchCorbaException(ex);
+             }
+           }
+         }
+       }
+      }
+    }
+    else if (myCurrentLineEdit == myGroupLine) {
+      Standard_Boolean aRes;
+      SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
+      for (; anIt.More(); anIt.Next()) {
+       SMESH::SMESH_Group_var aGroup = mySMESHGUI->ConvertIOinSMESHGroup(anIt.Value(), aRes);
+       if (aRes && !aGroup->_is_nil()) {
+         // check if mesh is the same
+         if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
+           SMESH::long_array_var anElements = aGroup->GetListOfID();
+           int k = anElements->length();
+           QListBoxItem* anItem = 0;
+           for (int i = 0; i < k; i++) {
+             anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch);
+             if (anItem) delete anItem;
+           }
+         }
+       }
+      }
+    }
+  }
+  busy = false;
+  updateButtons();
+}
+
+//=================================================================================
+// function : onSort()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::onSort()
+{
+  // PAL5412: sorts items in ascending by "string" value
+  // myElements->sort(true);
+  // myElements->update();
+  int i, k = myElements->count();
+  if (k > 0) {
+    busy = true;
+    QStringList aSelected;
+    std::vector<int> anArray(k);
+    //    QMemArray<int> anArray(k);
+    QListBoxItem* anItem;
+    // fill the array
+    for (anItem = myElements->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++) {
+      anArray[i] = anItem->text().toInt();
+      if (anItem->isSelected()) 
+       aSelected.append(anItem->text());
+    }
+    // sort & update list
+    std::sort(anArray.begin(), anArray.end());
+    //    anArray.sort();
+    myElements->clear();
+    for (i = 0; i < k; i++) {
+      myElements->insertItem(QString::number(anArray[i]));
+    }
+    for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it) {
+      anItem = myElements->findItem(*it, Qt::ExactMatch);
+      if (anItem) myElements->setSelected(anItem, true);
+    }
+    busy = false;
+  }
+}
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_GroupDlg::closeEvent( QCloseEvent* e )
+{
+  QAD_StudyFrame* aStudyFrame = mySMESHGUI->GetActiveStudy()->getActiveStudyFrame();
+  if (aStudyFrame->getTypeView() == VIEW_VTK) {
+    mySMESHGUI->SetPickable();
+    if (mySelectionMode == 0)
+      mySMESHGUI->EraseSimulationActors();
+
+    // remove filters from viewer
+    VTKViewer_InteractorStyleSALOME* aStyle = ((VTKViewer_ViewFrame*)aStudyFrame->getRightFrame()->getViewFrame())->getRWInteractor()->GetInteractorStyleSALOME();
+    aStyle->RemoveEdgeFilter();
+    aStyle->RemoveFaceFilter();
+
+  }
+  
+  mySelection->ClearIObjects();
+  QAD_Application::getDesktop()->SetSelectionMode(ActorSelection);
+  mySelection->ClearFilters();
+  mySMESHGUI->ResetState();
+
+  QDialog::closeEvent( e );
+}
diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h
new file mode 100644 (file)
index 0000000..b18abdf
--- /dev/null
@@ -0,0 +1,132 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org 
+//
+//
+//
+//  File   : SMESHGUI_GroupDlg.h
+//  Author : Natalia KOPNOVA
+//  Module : SMESH
+//  $Header$
+
+#ifndef DIALOGBOX_GROUP_H
+#define DIALOGBOX_GROUP_H
+
+#include "SALOME_Selection.h"
+#include "SMESH_TypeFilter.hxx"
+
+// QT Includes
+#include <qdialog.h>
+#include <qvaluelist.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+class QLineEdit;
+class QButtonGroup;
+class QListBox;
+class QPushButton;
+class QCheckBox;
+class SMESHGUI;
+class SMESH_Actor;
+class SMESHGUI_FilterDlg;
+
+//=================================================================================
+// class    : SMESHGUI_GroupDlg
+// purpose  :
+//=================================================================================
+class SMESHGUI_GroupDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    SMESHGUI_GroupDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* theSel = 0, 
+                      SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
+                      bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel, 
+                      SMESH::SMESH_Group_ptr theGroup, bool modal = FALSE, WFlags fl = 0 );
+    ~SMESHGUI_GroupDlg();
+
+public slots:
+
+    void onAdd();
+    void onRemove();
+
+
+private slots:
+
+    void onTypeChanged(int id);
+
+    void onOK();
+    void onClose();
+    bool onApply();
+
+    void onListSelectionChanged();
+    void onObjectSelectionChanged();
+
+    void onSelectSubMesh(bool on);
+    void onSelectGroup(bool on);
+    void setCurrentSelection();
+
+    void setFilters();
+    void onSort();
+
+    void onNameChanged(const QString& text);
+
+private:
+    void initDialog(SALOME_Selection* theSel, bool create);
+    void init(SMESH::SMESH_Mesh_ptr theMesh);
+    void init(SMESH::SMESH_Group_ptr theGroup);
+    void closeEvent(QCloseEvent* e);
+    void setSelectionMode(int theMode);
+    void updateButtons();
+
+    SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
+    SALOME_Selection*             mySelection ;             /* User shape selection */
+    SMESH_Actor*                  myActor;                  /* Current mesh actor */
+    int                           myTypeId ;                /* Current type id = radio button id */
+    QLineEdit*                    myCurrentLineEdit;        /* Current  LineEdit */
+
+    QButtonGroup*                 myTypeGroup;
+    QLineEdit*                    myName;
+    QListBox*                     myElements;
+    QPushButton*                  myFilter;
+
+    QCheckBox*                    mySelectSubMesh;
+    QPushButton*                  mySubMeshBtn;
+    QLineEdit*                    mySubMeshLine;
+
+    QCheckBox*                    mySelectGroup;
+    QPushButton*                  myGroupBtn;
+    QLineEdit*                    myGroupLine;
+
+    SMESH::SMESH_Mesh_var         myMesh;
+    SMESH::SMESH_Group_var        myGroup;
+    QValueList<int>               myIdList;
+
+    int                           mySelectionMode;
+    Handle(SMESH_TypeFilter)      mySubMeshFilter;
+    Handle(SMESH_TypeFilter)      myGroupFilter;
+
+    SMESHGUI_FilterDlg*           myFilterDlg;
+};
+
+#endif // DIALOGBOX_GROUP_H
diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h
new file mode 100644 (file)
index 0000000..9322262
--- /dev/null
@@ -0,0 +1,74 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : SMESHGUI_Hypotheses.h
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESHGUI_Hypotheses_HeaderFile
+#define SMESHGUI_Hypotheses_HeaderFile
+
+#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
+
+// QT Includes
+#include <qstring.h>
+#include <qwidget.h>
+
+//=================================================================================
+// class    : SMESHGUI_GenericHypothesisCreator
+// purpose  :
+//=================================================================================
+class SMESHGUI_GenericHypothesisCreator
+{
+  public:
+  virtual void CreateHypothesis (const bool isAlgo, QWidget* parent) = 0;
+  virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp) = 0;
+};
+
+//=================================================================================
+// class    : HypothesisData
+// purpose  :
+//=================================================================================
+class HypothesisData
+{
+ public:
+  HypothesisData (const QString& aPluginName,
+                 const QString& aServerLibName,
+                 const QString& aClientLibName,
+                 const QString& aLabel,
+                 const QString& anIconId) :
+ PluginName(aPluginName),
+ ServerLibName(aServerLibName),
+ ClientLibName(aClientLibName),
+ Label(aLabel),
+ IconId(anIconId)
+ {};
+
+ QString PluginName;
+ QString ServerLibName;
+ QString ClientLibName;
+ QString Label;
+ QString IconId;
+};
+
+#endif
diff --git a/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx
new file mode 100644 (file)
index 0000000..1f041af
--- /dev/null
@@ -0,0 +1,307 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.org 
+//
+//
+//
+//  File   : SMESHGUI_Preferences_SelectionDlg.cxx
+//  Author : Natalia KOPNOVA
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "SMESHGUI_Preferences_SelectionDlg.h"
+#include "SMESHGUI.h"
+
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qvalidator.h>
+#include <qspinbox.h>
+#include <qpushbutton.h>
+#include <qpalette.h>
+#include <qcolordialog.h>
+
+//=================================================================================
+// class    : SMESHGUI_LineEdit
+// purpose  : 
+//=================================================================================
+SMESHGUI_LineEdit::SMESHGUI_LineEdit(QWidget* parent, const char *name)
+  : QLineEdit(parent, name)
+{
+}
+
+SMESHGUI_LineEdit::SMESHGUI_LineEdit(const QString& text, QWidget* parent, const char *name)
+  : QLineEdit(text, parent, name)
+{
+}
+
+void SMESHGUI_LineEdit::focusOutEvent(QFocusEvent* e)
+{
+  const QValidator* aVal = validator();
+  QString aText = text();
+  int aCurPos = cursorPosition();
+  if (aVal && aVal->validate(aText, aCurPos) != QValidator::Acceptable) {
+    QString aValid = aText;
+    aVal->fixup(aValid);
+    if (aText != aValid) {
+      setText(aValid);
+      update();
+      return;
+    }
+  }
+  QLineEdit::focusOutEvent(e);
+}
+
+
+//=================================================================================
+// class    : SMESHGUI_DoubleValidator
+// purpose  : 
+//=================================================================================
+SMESHGUI_DoubleValidator::SMESHGUI_DoubleValidator(QObject * parent, const char *name)
+  : QDoubleValidator(parent, name)
+{
+}
+
+SMESHGUI_DoubleValidator::SMESHGUI_DoubleValidator(double bottom, double top, int decimals,
+                                                QObject * parent, const char *name)
+  : QDoubleValidator(bottom, top, decimals, parent, name)
+{
+}
+
+void SMESHGUI_DoubleValidator::fixup(QString& theText) const
+{
+  bool ok;
+  double aValue = theText.toDouble(&ok);
+  if (ok) {
+    if (aValue < bottom())
+      theText = QString::number(bottom(), 'g', decimals());
+    if (aValue > top())
+      theText = QString::number(top(), 'g', decimals());
+  }
+}
+
+
+//=================================================================================
+// class    : SMESHGUI_Preferences_SelectionDlg()
+// purpose  : 
+//=================================================================================
+SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( QWidget* parent, const char* name )
+  : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  if ( !name ) setName( "SMESHGUI_Preferences_SelectionDlg" );
+  setCaption( tr( "SMESH_PREF_SELECTION"  ) );
+
+  QVBoxLayout* aMainLayout = new QVBoxLayout(this, 11, 6);
+  QLabel* aLabel;
+  
+  /***************************************************************/
+  QGroupBox* aSelectBox = new QGroupBox(4, Qt::Horizontal, this, "selection");
+  aSelectBox->setTitle(tr("SMESH_SELECTION"));
+
+  aLabel = new QLabel(aSelectBox, "selection color label");
+  aLabel->setText(tr("SMESH_OUTLINE_COLOR"));
+  myColor[2] = new QPushButton(aSelectBox, "outline color");
+  myColor[2]->setFixedSize(QSize(25, 25));
+
+  aSelectBox->addSpace(0);
+  aSelectBox->addSpace(0);
+
+  aLabel = new QLabel(aSelectBox, "selection color label");
+  aLabel->setText(tr("SMESH_ELEMENTS_COLOR"));
+  myColor[1] = new QPushButton(aSelectBox, "elements color");
+  myColor[1]->setFixedSize(QSize(25, 25));
+
+  aLabel = new QLabel(aSelectBox, "selection width label");
+  aLabel->setText(tr("SMESH_WIDTH"));
+  myWidth[1] = new QSpinBox(0, 5, 1, aSelectBox, "selection width");
+  myWidth[1]->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  myWidth[1]->setButtonSymbols(QSpinBox::PlusMinus);
+  myWidth[1]->setMinimumWidth(50);
+  
+  /***************************************************************/
+  QGroupBox* aPreSelectBox = new QGroupBox(1, Qt::Vertical, this, "preselection");
+  aPreSelectBox->setTitle(tr("SMESH_PRESELECTION"));
+
+  aLabel = new QLabel(aPreSelectBox, "preselection color label");
+  aLabel->setText(tr("SMESH_HILIGHT_COLOR"));
+  myColor[0] = new QPushButton(aPreSelectBox, "preselection color");
+  myColor[0]->setFixedSize(QSize(25, 25));
+
+  aLabel = new QLabel(aPreSelectBox, "preselection width label");
+  aLabel->setText(tr("SMESH_WIDTH"));
+  myWidth[0] = new QSpinBox(0, 5, 1, aPreSelectBox, "preselection width");
+  myWidth[0]->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  myWidth[0]->setButtonSymbols(QSpinBox::PlusMinus);
+  myWidth[0]->setMinimumWidth(50);
+  
+  /***************************************************************/
+  QGroupBox* aPrecisionBox = new QGroupBox(1, Qt::Vertical, this, "preselection");
+  aPrecisionBox->setTitle(tr("SMESH_PRECISION"));
+  QDoubleValidator* aValidator = new SMESHGUI_DoubleValidator(aPrecisionBox);
+  aValidator->setBottom(0.001);
+  aValidator->setDecimals(6);
+
+  aLabel = new QLabel(aPrecisionBox, "node tol label");
+  aLabel->setText(tr("SMESH_NODES"));
+  myPrecision[0] = new SMESHGUI_LineEdit(aPrecisionBox, "node precision");
+  myPrecision[0]->setValidator(aValidator);
+
+  aLabel = new QLabel(aPrecisionBox, "item tol label");
+  aLabel->setText(tr("SMESH_ELEMENTS"));
+  myPrecision[1] = new SMESHGUI_LineEdit(aPrecisionBox, "item precision");
+  myPrecision[1]->setValidator(aValidator);
+
+  /***************************************************************/
+  QFrame* aButtons = new QFrame(this, "button box");
+  aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken);
+  QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6);
+  aBtnLayout->setAutoAdd(false);
+
+  QPushButton* aOKBtn = new QPushButton(aButtons, "ok");
+  aOKBtn->setText(tr("SMESH_BUT_OK"));
+  aOKBtn->setAutoDefault(true);
+  aOKBtn->setDefault(true);
+  QPushButton* aCloseBtn = new QPushButton(aButtons, "close");
+  aCloseBtn->setText(tr("SMESH_BUT_CLOSE"));
+  aCloseBtn->setAutoDefault(true);
+
+  aBtnLayout->addWidget(aOKBtn);
+  aBtnLayout->addStretch();
+  aBtnLayout->addWidget(aCloseBtn);
+
+  /***************************************************************/
+  aMainLayout->addWidget(aSelectBox);
+  aMainLayout->addWidget(aPreSelectBox);
+  aMainLayout->addWidget(aPrecisionBox);
+  aMainLayout->addWidget(aButtons);
+
+  for (int i = 0; i < 3; i++)
+    connect(myColor[i], SIGNAL(clicked()), this, SLOT(onSelectColor()));
+
+  connect(aOKBtn, SIGNAL(clicked()), this, SLOT(accept()));
+  connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+  this->move(x, y);
+}
+
+//=================================================================================
+// function : ~SMESHGUI_Preferences_SelectionDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+SMESHGUI_Preferences_SelectionDlg::~SMESHGUI_Preferences_SelectionDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_Preferences_SelectionDlg::closeEvent( QCloseEvent* e )
+{
+  reject();
+}
+
+//=================================================================================
+// function : onSelectColor()
+// purpose  :
+//=================================================================================
+void SMESHGUI_Preferences_SelectionDlg::onSelectColor()
+{
+  QPushButton* aSender = (QPushButton*)sender();
+  QColor aColor = aSender->palette().active().button();
+  aColor = QColorDialog::getColor(aColor, this);
+  if (aColor.isValid()) {
+    QPalette aPal = aSender->palette();
+    aPal.setColor(QColorGroup::Button, aColor);
+    aSender->setPalette(aPal);
+  }
+}
+
+//=================================================================================
+// function : SetColor()
+// purpose  :
+//=================================================================================
+void SMESHGUI_Preferences_SelectionDlg::SetColor(int type, QColor color)
+{
+  if (type > 0 && type <= 3) {
+    QPalette aPal = myColor[type-1]->palette();
+    aPal.setColor(QColorGroup::Button, color);
+    myColor[type-1]->setPalette(aPal);
+ }
+}
+
+//=================================================================================
+// function : GetColor()
+// purpose  :
+//=================================================================================
+QColor SMESHGUI_Preferences_SelectionDlg::GetColor(int type)
+{
+  QColor aColor;
+  if (type > 0 && type <= 3)
+    aColor = myColor[type-1]->palette().active().button();
+  return aColor;
+}
+
+//=================================================================================
+// function : SetWidth()
+// purpose  :
+//=================================================================================
+void SMESHGUI_Preferences_SelectionDlg::SetWidth(int type, int value)
+{
+  if (type > 0 && type <= 2)
+    myWidth[type-1]->setValue(value);
+}
+
+//=================================================================================
+// function : GetWidth()
+// purpose  :
+//=================================================================================
+int SMESHGUI_Preferences_SelectionDlg::GetWidth(int type)
+{
+  if (type > 0 && type <= 2)
+    return myWidth[type-1]->value();
+  return 0;
+}
+
+//=================================================================================
+// function : SetPrecision()
+// purpose  :
+//=================================================================================
+void SMESHGUI_Preferences_SelectionDlg::SetPrecision(int type, double value)
+{
+  if (type > 0 && type <= 2)
+    myPrecision[type-1]->setText(QString::number(value));
+}
+
+//=================================================================================
+// function : GetPrecision()
+// purpose  :
+//=================================================================================
+double SMESHGUI_Preferences_SelectionDlg::GetPrecision(int type)
+{
+  if (type > 0 && type <= 2)
+  return myPrecision[type-1]->text().toDouble();
+}
diff --git a/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h
new file mode 100644 (file)
index 0000000..a4edd38
--- /dev/null
@@ -0,0 +1,97 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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-platorm.org or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SMESHGUI_Preferences_SelectionDlg.h
+//  Author : Natalia KOPNOVA
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESHGUI_PREFERENCES_SELECTIONDLG_H
+#define SMESHGUI_PREFERENCES_SELECTIONDLG_H
+
+
+// QT Includes
+#include <qdialog.h>
+#include <qlineedit.h>
+#include <qvalidator.h>
+
+class QPushButton;
+class QSpinBox;
+class QColor;
+
+class SMESHGUI_LineEdit : public QLineEdit
+{
+  Q_OBJECT
+
+  public:
+    SMESHGUI_LineEdit(QWidget* parent, const char* name = 0);
+    SMESHGUI_LineEdit(const QString& text, QWidget* parent, const char* name = 0);
+
+    ~SMESHGUI_LineEdit() {};
+
+  protected:
+    void focusOutEvent(QFocusEvent* e);
+};
+
+class SMESHGUI_DoubleValidator : public QDoubleValidator
+{
+  Q_OBJECT
+
+  public:
+    SMESHGUI_DoubleValidator(QObject* parent, const char* name = 0);
+    SMESHGUI_DoubleValidator(double bottom, double top, int decimals,
+                           QObject* parent, const char* name = 0);
+
+    ~SMESHGUI_DoubleValidator() {};
+
+    void fixup(QString& text) const;
+};
+
+class SMESHGUI_Preferences_SelectionDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    SMESHGUI_Preferences_SelectionDlg( QWidget* parent = 0, const char* name = 0 );
+    ~SMESHGUI_Preferences_SelectionDlg();
+
+    void   SetColor(int type, QColor color);
+    QColor GetColor(int type);
+    void   SetWidth(int type, int value);
+    int    GetWidth(int type);
+    void   SetPrecision(int type, double value);
+    double GetPrecision(int type);
+
+private:
+    void closeEvent( QCloseEvent* e ) ;
+
+private slots:
+    void onSelectColor();
+
+private:
+    QPushButton*          myColor[3];
+    QSpinBox*             myWidth[2];
+    QLineEdit*            myPrecision[2];
+};
+
+#endif // SMESHGUI_PREFERENCES_SELECTIONDLG_H
diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx
new file mode 100644 (file)
index 0000000..ee42768
--- /dev/null
@@ -0,0 +1,187 @@
+//  SMESH SMESHGUI : reading of xml file with list of available hypotheses and algorithms
+//  Copyright (C) 2003  CEA
+//
+//  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.org
+//
+//
+//
+//  File   : SMESHGUI_XmlHandler.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#define  INCLUDE_MENUITEM_DEF 
+
+#include "SMESHGUI_XmlHandler.h"
+
+// QT Include
+//#include <qaccel.h>
+#include <qfileinfo.h>
+
+/*!
+  Constructor
+*/
+SMESHGUI_XmlHandler::SMESHGUI_XmlHandler()
+{
+}
+
+/*!
+  Destructor
+*/
+SMESHGUI_XmlHandler::~SMESHGUI_XmlHandler()
+{
+}
+
+/*!
+  Starts parsing of document. Does some initialization
+
+  Reimplemented from QXmlDefaultHandler.
+*/
+bool SMESHGUI_XmlHandler::startDocument()
+{
+  myErrorProt = "";
+  return TRUE;
+}
+
+/*!
+  Does different actions depending on the name of the tag and the
+  state you are in document.
+
+  Reimplemented from QXmlDefaultHandler.
+*/
+bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, 
+                                        const QString& qName, 
+                                        const QXmlAttributes& atts)
+{
+  if (qName == "meshers")
+  {
+    myHypothesesMap.clear();
+    myAlgorithmsMap.clear();
+  }
+  else if (qName == "meshers-group") // group of hypotheses and algorithms
+  {
+//    if (atts.value("server-lib") != "")
+    {
+      myPluginName = atts.value("name");
+      myServerLib  = atts.value("server-lib");
+      myClientLib  = atts.value("gui-lib");
+
+      QString aResName = atts.value("resources");
+      if (aResName != "")
+      {
+        MESSAGE("Loading Resources " << aResName);
+        QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
+        QString msg;
+        if (!resMgr->loadResources(aResName, msg))
+          MESSAGE(msg);
+      }
+    }
+  }
+  else if (qName == "hypotheses") // group of hypotheses
+  {
+  }
+  else if (qName == "algorithms") // group of algorithms
+  {
+  }
+  else if (qName == "hypothesis" || qName == "algorithm") // hypothesis or algorithm
+  {
+    if (atts.value("type") != "")
+    {
+      QString aHypAlType = atts.value("type");
+      QString aLabel = atts.value("label-id");
+      QString anIcon = atts.value("icon-id");
+      HypothesisData* aHypLibNames =
+        new HypothesisData (myPluginName, myServerLib, myClientLib,
+                            aLabel, anIcon);
+
+      if (qName == "algorithm")
+      {
+        myAlgorithmsMap[(char*)aHypAlType.latin1()] = aHypLibNames;
+      }
+      else
+      {
+        myHypothesesMap[(char*)aHypAlType.latin1()] = aHypLibNames;
+      }
+    }
+  }
+  else
+  {
+    // error
+    return FALSE;
+  }
+  return TRUE;
+}
+
+
+/*!
+  Reimplemented from QXmlDefaultHandler.
+*/
+bool SMESHGUI_XmlHandler::endElement (const QString&, const QString&, const QString&)
+{
+  return TRUE;
+}
+
+
+/*!
+  Reimplemented from QXmlDefaultHandler.
+*/
+bool SMESHGUI_XmlHandler::characters (const QString& ch)
+{
+  // we are not interested in whitespaces
+  QString ch_simplified = ch.simplifyWhiteSpace();
+  if ( ch_simplified.isEmpty() )
+    return TRUE;
+  return TRUE;
+}
+
+
+/*!
+  Returns the default error string.
+
+  Reimplemented from QXmlDefaultHandler.
+*/
+QString SMESHGUI_XmlHandler::errorString()
+{
+  return "the document is not in the quote file format";
+}
+
+/*!
+  Returns the error protocol if parsing failed
+
+  Reimplemented from QXmlDefaultHandler.
+*/
+QString SMESHGUI_XmlHandler::errorProtocol()
+{
+  return myErrorProt;
+}
+
+/*!
+  Returns exception
+
+  Reimplemented from QXmlDefaultHandler.
+*/
+bool SMESHGUI_XmlHandler::fatalError (const QXmlParseException& exception)
+{
+  myErrorProt += QString("fatal parsing error: %1 in line %2, column %3\n")
+    .arg(exception.message())
+    .arg(exception.lineNumber())
+    .arg(exception.columnNumber());
+  
+  return QXmlDefaultHandler::fatalError( exception );
+}
diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.h b/src/SMESHGUI/SMESHGUI_XmlHandler.h
new file mode 100644 (file)
index 0000000..363d983
--- /dev/null
@@ -0,0 +1,58 @@
+//  SMESH SMESHGUI : reading of xml file with list of available hypotheses and algorithms
+//
+//  Copyright (C) 2003  CEA
+//
+//  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.org
+//
+//
+//
+//  File   : SMESHGUI_XmlHandler.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+#include "SMESHGUI.h"
+
+#include <qxml.h>
+#include <map>
+
+class SMESHGUI_XmlHandler : public QXmlDefaultHandler
+{
+ public:
+  SMESHGUI_XmlHandler();
+  virtual ~SMESHGUI_XmlHandler();
+
+  bool startDocument();
+  bool startElement( const QString& namespaceURI, const QString& localName, 
+                    const QString& qName, const QXmlAttributes& atts );
+  bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName );
+  bool characters( const QString& ch );
+
+  QString errorString();
+  QString errorProtocol();
+  bool fatalError   (const QXmlParseException& exception);
+
+ public:
+  map<string, HypothesisData*> myHypothesesMap;
+  map<string, HypothesisData*> myAlgorithmsMap;
+
+ private:
+  QString myErrorProt;
+  QString myPluginName;
+  QString myServerLib;
+  QString myClientLib;
+};
diff --git a/src/SMESH_I/SMESHEngine.cxx b/src/SMESH_I/SMESHEngine.cxx
new file mode 100644 (file)
index 0000000..fc1bd44
--- /dev/null
@@ -0,0 +1,23 @@
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+
+int main(int argc, char** argv)
+{
+  return 1;
+}
diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx
new file mode 100644 (file)
index 0000000..724d602
--- /dev/null
@@ -0,0 +1,914 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : SMESH_Filter_i.cxx
+//  Author : Alexey Petrov, OCC
+//  Module : SMESH
+
+
+#include "SMESH_Filter_i.hxx"
+
+#include "SMDS_Iterator.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDSAbs_ElementType.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESHDS_Mesh.hxx"
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_XYZ.hxx>
+#include <Precision.hxx>
+#include <TColgp_SequenceOfXYZ.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
+/*
+                            AUXILIARY METHODS 
+*/
+
+static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+{
+  return gp_Vec( P1 - P2 ).Angle( gp_Vec( P3 - P2 ) );
+}
+
+static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+{
+  gp_Vec aVec1( P2 - P1 );
+  gp_Vec aVec2( P3 - P1 );
+  return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
+}
+
+static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+{
+  return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+}
+
+static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
+{
+  double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
+  return aDist;
+}
+
+static int getNbMultiConnection( SMESHDS_Mesh* theMesh, const int theId )
+{
+  if ( theMesh == 0 )
+    return 0;
+
+  const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
+  if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
+    return 0;
+
+  TColStd_MapOfInteger aMap;
+
+  int aResult = 0;
+  SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+  if ( anIter != 0 )
+  {
+    while( anIter->more() )
+    {
+      const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+      if ( aNode == 0 )
+        return 0;
+      SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+      while( anElemIter->more() )
+      {
+        const SMDS_MeshElement* anElem = anElemIter->next();
+        if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge )
+        {
+          int anId = anElem->GetID();
+
+          if ( anIter->more() )              // i.e. first node
+            aMap.Add( anId );
+          else if ( aMap.Contains( anId ) )
+            aResult++;
+        }
+      }
+//      delete anElemIter;
+    }
+//    delete anIter;
+  }
+
+  return aResult;
+}
+
+using namespace std;
+using namespace SMESH;
+
+/*
+                                FUNCTORS
+*/
+
+/*
+  Class       : NumericalFunctor_i
+  Description : Base class for numerical functors
+*/
+
+NumericalFunctor_i::NumericalFunctor_i()
+: SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
+{
+  myMesh = 0;
+  SMESH_Gen_i::GetPOA()->activate_object( this );
+}
+
+void NumericalFunctor_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+  SMESH_Mesh_i* anImplPtr = 
+    dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+  myMesh = anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
+}
+
+bool NumericalFunctor_i::getPoints( const int             theId,
+                                    TColgp_SequenceOfXYZ& theRes ) const
+{
+  theRes.Clear();
+
+  if ( myMesh == 0 )
+    return false;
+
+  // Get nodes of the face
+  const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+  if ( anElem == 0 || anElem->GetType() != GetType() )
+    return false;
+
+  int nbNodes = anElem->NbNodes();
+
+  SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+  if ( anIter != 0 )
+  {
+    while( anIter->more() )
+    {
+      const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+      if ( aNode != 0 )
+        theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+    }
+
+//    delete anIter;
+  }
+
+  return true;
+}
+
+
+/*
+  Class       : SMESH_MinimumAngleFunct
+  Description : Functor for calculation of minimum angle
+*/
+
+CORBA::Double MinimumAngle_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  double aMin;
+
+  if ( P.Length() == 3 )
+  {
+    double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
+    double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
+    double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) );
+
+    aMin = Min( A0, Min( A1, A2 ) );
+  }
+  else
+  {
+    double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
+    double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
+    double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) );
+    double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) );
+    
+    aMin = Min( Min( A0, A1 ), Min( A2, A3 ) );
+  }
+  
+  return aMin * 180 / PI;
+}
+
+int MinimumAngle_i::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+/*
+  Class       : AspectRatio_i
+  Description : Functor for calculating aspect ratio
+*/
+
+CORBA::Double AspectRatio_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  int nbNodes = P.Length();
+
+  // Compute lengths of the sides
+
+  double aLen[ nbNodes ];
+  for ( int i = 0; i < nbNodes - 1; i++ )
+    aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) );
+  aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) );
+
+  // Compute aspect ratio
+
+  if ( nbNodes == 3 ) 
+  {
+    double aMaxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
+    double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
+    static double aCoef = sqrt( 3. ) / 4;
+
+    return anArea != 0 ? aCoef * aMaxLen * aMaxLen / anArea : 0;
+  }
+  else
+  {
+    double aMaxLen = Max( Max( aLen[ 0 ], aLen[ 1 ] ), Max( aLen[ 2 ], aLen[ 3 ] ) );
+    double aMinLen = Min( Min( aLen[ 0 ], aLen[ 1 ] ), Min( aLen[ 2 ], aLen[ 3 ] ) );
+    
+    return aMinLen != 0 ? aMaxLen / aMinLen : 0;
+  }
+}
+
+int AspectRatio_i::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+/*
+  Class       : Warping_i
+  Description : Functor for calculating warping
+*/
+
+CORBA::Double Warping_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P ) || P.Length() != 4 )
+    return 0;
+
+  gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
+
+  double A1 = ComputeA( P( 1 ), P( 2 ), P( 3 ), G );
+  double A2 = ComputeA( P( 2 ), P( 3 ), P( 4 ), G );
+  double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
+  double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );
+
+  return Max( Max( A1, A2 ), Max( A3, A4 ) );
+}
+
+double Warping_i::ComputeA( const gp_XYZ& thePnt1,
+                            const gp_XYZ& thePnt2,
+                            const gp_XYZ& thePnt3,
+                            const gp_XYZ& theG ) const
+{
+  double aLen1 = gp_Pnt( thePnt1 ).Distance( gp_Pnt( thePnt2 ) );
+  double aLen2 = gp_Pnt( thePnt2 ).Distance( gp_Pnt( thePnt3 ) );
+  double L = Min( aLen1, aLen2 ) * 0.5;
+
+  gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
+  gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
+  gp_XYZ N  = GI.Crossed( GJ );
+  N.Normalize();
+
+  double H = gp_Vec( thePnt2 - theG ).Dot( gp_Vec( N ) );
+  return asin( fabs( H / L ) ) * 180 / PI;
+}
+
+int Warping_i::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+/*
+  Class       : Taper_i
+  Description : Functor for calculating taper
+*/
+
+CORBA::Double Taper_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P ) || P.Length() != 4 )
+    return 0;
+
+  // Compute taper
+  double J1 = getArea( P( 4 ), P( 1 ), P( 2 ) ) / 2;
+  double J2 = getArea( P( 3 ), P( 1 ), P( 2 ) ) / 2;
+  double J3 = getArea( P( 2 ), P( 3 ), P( 4 ) ) / 2;
+  double J4 = getArea( P( 3 ), P( 4 ), P( 1 ) ) / 2;
+
+  double JA = 0.25 * ( J1 + J2 + J3 + J4 );
+
+  double T1 = fabs( ( J1 - JA ) / JA );
+  double T2 = fabs( ( J2 - JA ) / JA );
+  double T3 = fabs( ( J3 - JA ) / JA );
+  double T4 = fabs( ( J4 - JA ) / JA );
+
+  return Max( Max( T1, T2 ), Max( T3, T4 ) );
+}
+
+int Taper_i::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+/*
+  Class       : Skew_i
+  Description : Functor for calculating skew in degrees
+*/
+
+static inline double skewAngle( const gp_XYZ& p1, const gp_XYZ& p2, const gp_XYZ& p3 )
+{
+  gp_XYZ p12 = ( p2 + p1 ) / 2;
+  gp_XYZ p23 = ( p3 + p2 ) / 2;
+  gp_XYZ p31 = ( p3 + p1 ) / 2;
+
+  return gp_Vec( p31 - p2 ).Angle( p12 - p23 );
+}
+
+CORBA::Double Skew_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  // Compute skew
+  static double PI2 = PI / 2;
+  if ( P.Length() == 3 )
+  {
+    double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
+    double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
+    double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) );
+
+    return Max( A0, Max( A1, A2 ) ) * 180 / PI;
+  }
+  else 
+  {
+    gp_XYZ p12 = ( P( 1 ) + P( 2 ) ) / 2;
+    gp_XYZ p23 = ( P( 2 ) + P( 3 ) ) / 2;
+    gp_XYZ p34 = ( P( 3 ) + P( 4 ) ) / 2;
+    gp_XYZ p41 = ( P( 4 ) + P( 1 ) ) / 2;
+    
+    double A = fabs( PI2 - gp_Vec( p34 - p12 ).Angle( p23 - p41 ) );
+
+    return A * 180 / PI;
+  }
+}
+
+int Skew_i::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+/*
+  Class       : Area_i
+  Description : Functor for calculating area
+*/
+
+CORBA::Double Area_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  if ( !getPoints( theId, P )  || P.Length() != 3 && P.Length() != 4 )
+    return 0;
+
+  if ( P.Length() == 3 )
+    return getArea( P( 1 ), P( 2 ), P( 3 ) );
+  else
+    return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
+}
+
+int Area_i::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+/*
+  Class       : Length_i
+  Description : Functor for calculating length off edge
+*/
+
+CORBA::Double Length_i::GetValue( CORBA::Long theId )
+{
+  TColgp_SequenceOfXYZ P;
+  return getPoints( theId, P ) && P.Length() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0;
+}
+
+int Length_i::GetType() const
+{
+  return SMDSAbs_Edge;
+}
+
+/*
+  Class       : MultiConnection_i
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+
+CORBA::Double MultiConnection_i::GetValue( CORBA::Long theId )
+{
+  return getNbMultiConnection( myMesh, theId );
+}
+
+int MultiConnection_i::GetType() const
+{
+  return SMDSAbs_Edge;
+}
+
+/*
+                            PREDICATES
+*/
+
+/*
+  Class       : Predicate_i
+  Description : Base class for all predicates
+*/
+Predicate_i::Predicate_i()
+: SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
+{
+  SMESH_Gen_i::GetPOA()->activate_object( this );
+}
+
+
+/*
+  Class       : FreeBorders_i
+  Description : Predicate for free borders
+*/
+
+FreeBorders_i::FreeBorders_i()
+{
+  myMesh = 0;
+}
+
+void FreeBorders_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+  SMESH_Mesh_i* anImplPtr =
+    dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+  myMesh = anImplPtr ? anImplPtr->GetImpl().GetMeshDS() : 0;
+}
+
+CORBA::Boolean FreeBorders_i::IsSatisfy( CORBA::Long theId )
+{
+  return getNbMultiConnection( myMesh, theId ) == 1;
+}
+
+int FreeBorders_i::GetType() const
+{
+  return SMDSAbs_Edge;
+}
+
+/*
+  Class       : Comparator_i
+  Description : Base class for comparators
+*/
+
+Comparator_i::Comparator_i()
+{
+  myMargin  = 0;
+  myFunctor = 0;
+}
+
+Comparator_i::~Comparator_i()
+{
+  if ( myFunctor != 0 )
+    myFunctor->Destroy();
+}
+
+void Comparator_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+  if ( myFunctor != 0 )
+    myFunctor->SetMesh( theMesh );
+}
+
+void Comparator_i::SetMargin( CORBA::Double theValue )
+{
+  myMargin = theValue;
+}
+
+void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
+{
+  if ( myFunctor != 0 )
+    myFunctor->Destroy();
+
+  myFunctor = dynamic_cast<NumericalFunctor_i*>( SMESH_Gen_i::GetServant( theFunct ).in() );
+
+  if ( myFunctor != 0 )
+    myFunctor->Register();
+}
+
+int Comparator_i::GetType() const
+{
+  return myFunctor != 0 ? myFunctor->GetType() : SMDSAbs_All;
+}
+
+/*
+  Class       : LessThan_i
+  Description : Comparator "<"
+*/
+
+CORBA::Boolean LessThan_i::IsSatisfy( CORBA::Long theId )
+{
+  return myFunctor != 0 && myFunctor->GetValue( theId ) < myMargin;
+}
+
+/*
+  Class       : MoreThan_i
+  Description : Comparator ">"
+*/
+
+CORBA::Boolean MoreThan_i::IsSatisfy( CORBA::Long theId )
+{
+  return myFunctor != 0 && myFunctor->GetValue( theId ) > myMargin;
+}
+
+/*
+  Class       : EqualTo_i
+  Description : Comparator "="
+*/
+EqualTo_i::EqualTo_i()
+{
+  myToler = Precision::Confusion();
+}
+
+CORBA::Boolean EqualTo_i::IsSatisfy( CORBA::Long theId )
+{
+  return myFunctor != 0 && fabs( myFunctor->GetValue( theId ) - myMargin ) < myToler;
+}
+
+void EqualTo_i::SetTolerance( CORBA::Double theToler )
+{
+  myToler = theToler;
+}
+
+
+/*
+  Class       : LogicalNOT_i
+  Description : Logical NOT predicate
+*/
+
+LogicalNOT_i::LogicalNOT_i()
+{
+  myPredicate = 0;
+}
+
+LogicalNOT_i::~LogicalNOT_i()
+{
+  if ( myPredicate )
+    myPredicate->Destroy();
+}
+
+CORBA::Boolean LogicalNOT_i::IsSatisfy( CORBA::Long theId )
+{
+  return myPredicate !=0 && !myPredicate->IsSatisfy( theId );
+}
+
+void LogicalNOT_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+  if ( myPredicate != 0 )
+    myPredicate->SetMesh( theMesh );
+}
+
+void LogicalNOT_i::SetPredicate( Predicate_ptr thePred )
+{
+  if ( myPredicate != 0 )
+    myPredicate->Destroy();
+
+  myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePred ).in() );
+
+  if ( myPredicate != 0 )
+    myPredicate->Register();
+}
+
+int LogicalNOT_i::GetType() const
+{
+  return myPredicate != 0 ? myPredicate->GetType() : SMDSAbs_All;
+}
+
+
+/*
+  Class       : LogicalBinary_i
+  Description : Base class for binary logical predicate
+*/
+
+LogicalBinary_i::LogicalBinary_i()
+{
+  myPredicate1 = 0;
+  myPredicate2 = 0;
+}
+LogicalBinary_i::~LogicalBinary_i()
+{
+  if ( myPredicate1 != 0 )
+    myPredicate1->Destroy();
+
+  if ( myPredicate2 != 0 )
+    myPredicate2->Destroy();
+}
+
+void LogicalBinary_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+  if ( myPredicate1 != 0 )
+    myPredicate1->SetMesh( theMesh );
+
+  if ( myPredicate2 != 0 )
+    myPredicate2->SetMesh( theMesh );
+}
+
+void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
+{
+  if ( myPredicate1 != 0 )
+    myPredicate1->Destroy();
+
+  myPredicate1 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+
+  if ( myPredicate1 != 0 )
+    myPredicate1->Register();
+}
+
+void LogicalBinary_i::SetPredicate2( Predicate_ptr thePredicate )
+{
+  if ( myPredicate2 != 0 )
+    myPredicate2->Destroy();
+
+  myPredicate2 = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+
+  if ( myPredicate2 != 0 )
+    myPredicate2->Register();
+}
+
+int LogicalBinary_i::GetType() const
+{
+  if ( myPredicate1 == 0 || myPredicate2 == 0 )
+    return SMDSAbs_All;
+
+  int aType1 = myPredicate1->GetType();
+  int aType2 = myPredicate2->GetType();
+
+  return aType1 == aType2 ? aType1 : SMDSAbs_All;
+}
+
+/*
+  Class       : LogicalAND_i
+  Description : Logical AND
+*/
+
+CORBA::Boolean LogicalAND_i::IsSatisfy( CORBA::Long theId )
+{
+  return myPredicate1 != 0 && 
+         myPredicate2 != 0 && 
+         myPredicate1->IsSatisfy( theId ) && myPredicate2->IsSatisfy( theId );;
+}
+
+/*
+  Class       : LogicalOR_i
+  Description : Logical OR
+*/
+
+CORBA::Boolean LogicalOR_i::IsSatisfy( CORBA::Long theId )
+{
+  return myPredicate1 != 0 && 
+         myPredicate2 != 0 && 
+         myPredicate1->IsSatisfy( theId ) || myPredicate2->IsSatisfy( theId );
+}
+
+
+/*
+                              FILTER
+*/
+
+Filter_i::Filter_i()
+{
+  myPredicate = 0;
+}
+
+Filter_i::~Filter_i()
+{
+  if ( myPredicate != 0 )
+    myPredicate->Destroy();
+}
+
+void Filter_i::SetPredicate( Predicate_ptr thePredicate )
+{
+  if ( myPredicate != 0 )
+    myPredicate->Destroy();
+
+  myPredicate = dynamic_cast<Predicate_i*>( SMESH_Gen_i::GetServant( thePredicate ).in() );
+
+  if ( myPredicate != 0 )
+    myPredicate->Register();
+}
+
+void Filter_i::SetMesh( SMESH_Mesh_ptr theMesh )
+{
+  if ( myPredicate != 0 )
+    myPredicate->SetMesh( theMesh );
+}
+
+SMESH::long_array* Filter_i::GetElementsId( SMESH_Mesh_ptr theMesh )
+{
+
+  SetMesh( theMesh );
+
+  SMESH_Mesh_i* anImplPtr = 
+    dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( theMesh ).in() );
+
+  TColStd_ListOfInteger aList;
+
+  if ( anImplPtr != 0 )
+  {
+    SMESHDS_Mesh* aMesh = anImplPtr->GetImpl().GetMeshDS();
+
+    if ( myPredicate != 0 )
+    {
+      int aType = myPredicate->GetType();
+      
+      if ( aType == SMDSAbs_Edge )
+      {
+        SMDS_EdgeIteratorPtr anIter = aMesh->edgesIterator();
+        if ( anIter != 0 )
+        {
+          while( anIter->more() )
+          {
+            const SMDS_MeshElement* anElem = anIter->next();
+            if ( myPredicate->IsSatisfy( anElem->GetID() ) )
+              aList.Append( anElem->GetID() );
+          }
+        }
+//        delete anIter;
+      }
+      else if ( aType == SMDSAbs_Face )
+      {
+        SMDS_FaceIteratorPtr anIter = aMesh->facesIterator();
+        if ( anIter != 0 )
+        {
+          while( anIter->more() )
+          {
+            const SMDS_MeshElement* anElem = anIter->next();
+            if ( myPredicate->IsSatisfy( anElem->GetID() ) )
+              aList.Append( anElem->GetID() );
+          }
+        }
+//        delete anIter;
+      }
+    }
+  }
+  
+  SMESH::long_array_var anArray = new SMESH::long_array;
+  
+  anArray->length( aList.Extent() );
+  TColStd_ListIteratorOfListOfInteger anIter( aList );
+  int i = 0;
+  for( ; anIter.More(); anIter.Next() )
+    anArray[ i++ ] = anIter.Value();
+
+  return anArray._retn();
+}
+
+/*
+                            FILTER MANAGER
+*/
+
+FilterManager_i::FilterManager_i()
+: SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
+{
+  SMESH_Gen_i::GetPOA()->activate_object( this );
+}
+
+MinimumAngle_ptr FilterManager_i::CreateMinimumAngle()
+{
+  SMESH::MinimumAngle_i* aServant = new SMESH::MinimumAngle_i();
+  SMESH::MinimumAngle_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+AspectRatio_ptr FilterManager_i::CreateAspectRatio()
+{
+  SMESH::AspectRatio_i* aServant = new SMESH::AspectRatio_i();
+  SMESH::AspectRatio_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+Warping_ptr FilterManager_i::CreateWarping()
+{
+  SMESH::Warping_i* aServant = new SMESH::Warping_i();
+  SMESH::Warping_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+Taper_ptr FilterManager_i::CreateTaper()
+{
+  SMESH::Taper_i* aServant = new SMESH::Taper_i();
+  SMESH::Taper_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+Skew_ptr FilterManager_i::CreateSkew()
+{
+  SMESH::Skew_i* aServant = new SMESH::Skew_i();
+  SMESH::Skew_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+Area_ptr FilterManager_i::CreateArea()
+{
+  SMESH::Area_i* aServant = new SMESH::Area_i();
+  SMESH::Area_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+Length_ptr FilterManager_i::CreateLength()
+{
+  SMESH::Length_i* aServant = new SMESH::Length_i();
+  SMESH::Length_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+MultiConnection_ptr FilterManager_i::CreateMultiConnection()
+{
+  SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i();
+  SMESH::MultiConnection_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+FreeBorders_ptr FilterManager_i::CreateFreeBorders()
+{
+  SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
+  SMESH::FreeBorders_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+LessThan_ptr FilterManager_i::CreateLessThan()
+{
+  SMESH::LessThan_i* aServant = new SMESH::LessThan_i();
+  SMESH::LessThan_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+MoreThan_ptr FilterManager_i::CreateMoreThan()
+{
+  SMESH::MoreThan_i* aServant = new SMESH::MoreThan_i();
+  SMESH::MoreThan_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+EqualTo_ptr FilterManager_i::CreateEqualTo()
+{
+  SMESH::EqualTo_i* aServant = new SMESH::EqualTo_i();
+  SMESH::EqualTo_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+LogicalNOT_ptr FilterManager_i::CreateLogicalNOT()
+{
+  SMESH::LogicalNOT_i* aServant = new SMESH::LogicalNOT_i();
+  SMESH::LogicalNOT_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+LogicalAND_ptr FilterManager_i::CreateLogicalAND()
+{
+  SMESH::LogicalAND_i* aServant = new SMESH::LogicalAND_i();
+  SMESH::LogicalAND_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+
+LogicalOR_ptr FilterManager_i::CreateLogicalOR()
+{
+  SMESH::LogicalOR_i* aServant = new SMESH::LogicalOR_i();
+  SMESH::LogicalOR_var anObj = aServant->_this();
+  return anObj._retn();
+}
+
+Filter_ptr FilterManager_i::CreateFilter()
+{
+  SMESH::Filter_i* aServant = new SMESH::Filter_i();
+  SMESH::Filter_var anObj = aServant->_this();
+  return anObj._retn();
+}
diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx
new file mode 100644 (file)
index 0000000..26edd5b
--- /dev/null
@@ -0,0 +1,417 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses\r
+//\r
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+//  This library is free software; you can redistribute it and/or \r
+//  modify it under the terms of the GNU Lesser General Public \r
+//  License as published by the Free Software Foundation; either \r
+//  version 2.1 of the License. \r
+// \r
+//  This library is distributed in the hope that it will be useful, \r
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
+//  Lesser General Public License for more details. \r
+// \r
+//  You should have received a copy of the GNU Lesser General Public \r
+//  License along with this library; if not, write to the Free Software \r
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
+// \r
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+//  File   : SMESH_Filter_i.hxx\r
+//  Author : Alexey Petrov, OCC\r
+//  Module : SMESH\r
+\r
+#ifndef _SMESH_FILTER_I_HXX_\r
+#define _SMESH_FILTER_I_HXX_\r
+\r
+#include <SALOMEconfig.h>\r
+#include CORBA_SERVER_HEADER(SMESH_Filter)\r
+#include "SALOME_GenericObj_i.hh"\r
+\r
+class SMESHDS_Mesh;\r
+class gp_Pnt;\r
+class gp_XYZ;\r
+class TColgp_SequenceOfXYZ;\r
+\r
+namespace SMESH{\r
+\r
+/*\r
+                                FUNCTORS\r
+*/\r
+\r
+/*\r
+  Class       : NumericalFunctor_i\r
+  Description : Base class for numerical functors \r
+  \r
+    PortableServer::POA_ptr thePOA\r
+\r
+*/\r
+\r
+class NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,\r
+                          public virtual SALOME::GenericObj_i\r
+{\r
+public:\r
+                          NumericalFunctor_i();\r
+  void                    SetMesh( SMESH_Mesh_ptr theMesh );\r
+  virtual int             GetType() const = 0;\r
+\r
+protected:\r
+  bool                    getPoints( const int             theId, \r
+                                     TColgp_SequenceOfXYZ& theRes ) const;\r
+protected:\r
+  SMESHDS_Mesh*           myMesh;\r
+};\r
+\r
+/*\r
+  Class       : SMESH_MinimumAngleFunct\r
+  Description : Functor for calculation of minimum angle\r
+*/\r
+\r
+class MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,\r
+                      public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+};\r
+\r
+/*\r
+  Class       : AspectRatio_i\r
+  Description : Functor for calculating aspect ratio\r
+*/\r
+\r
+class AspectRatio_i: public virtual POA_SMESH::AspectRatio,\r
+                     public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue(CORBA::Long theElementId);\r
+  virtual int             GetType() const;\r
+};\r
+\r
+/*\r
+  Class       : Warping_i\r
+  Description : Functor for calculating warping\r
+*/\r
+\r
+class Warping_i: public virtual POA_SMESH::Warping,\r
+                 public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue(CORBA::Long theElementId);\r
+  virtual int             GetType() const;\r
+\r
+private:\r
+  double                  ComputeA( const gp_XYZ&, const gp_XYZ&, \r
+                                    const gp_XYZ&, const gp_XYZ& ) const;\r
+};\r
+\r
+/*\r
+  Class       : Taper_i\r
+  Description : Functor for calculating taper\r
+*/\r
+\r
+class Taper_i: public virtual POA_SMESH::Taper,\r
+               public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+};\r
+\r
+/*\r
+  Class       : Skew_i\r
+  Description : Functor for calculating skew in degrees\r
+*/\r
+\r
+class Skew_i: public virtual POA_SMESH::Skew,\r
+              public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+};\r
+\r
+/*\r
+  Class       : Area_i\r
+  Description : Functor for calculating area\r
+*/\r
+\r
+class Area_i: public virtual POA_SMESH::Area,\r
+              public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+};\r
+\r
+/*\r
+  Class       : Length_i\r
+  Description : Functor for calculating length of edge\r
+*/\r
+\r
+class Length_i: public virtual POA_SMESH::Length,\r
+                public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+};\r
+\r
+/*\r
+  Class       : MultiConnection_i\r
+  Description : Functor for calculating number of faces conneted to the edge\r
+*/\r
+\r
+class MultiConnection_i: public virtual POA_SMESH::MultiConnection,\r
+                        public virtual NumericalFunctor_i\r
+{\r
+public:\r
+  CORBA::Double           GetValue( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+};\r
+\r
+\r
+/*\r
+                            PREDICATES\r
+*/\r
+\r
+/*\r
+  Class       : Predicate_i\r
+  Description : Base class for all predicates\r
+*/\r
+\r
+class Predicate_i: public virtual POA_SMESH::Predicate,\r
+                   public virtual SALOME::GenericObj_i\r
+{\r
+public:\r
+                          Predicate_i();\r
+  virtual int             GetType() const = 0;\r
+};\r
+\r
+\r
+/*\r
+  Class       : FreeBorders_i\r
+  Description : Predicate for free borders\r
+*/\r
+\r
+class FreeBorders_i: public virtual POA_SMESH::FreeBorders,\r
+                     public virtual Predicate_i\r
+{\r
+public:\r
+                          FreeBorders_i();\r
+  void                    SetMesh( SMESH_Mesh_ptr theMesh );\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long theElementId );\r
+  virtual int             GetType() const;\r
+\r
+protected:\r
+  SMESHDS_Mesh*           myMesh;\r
+};\r
+\r
+/*\r
+  Class       : Comparator_i\r
+  Description : Base class for comparators\r
+*/\r
+\r
+class Comparator_i: public virtual POA_SMESH::Comparator,\r
+                    public virtual Predicate_i\r
+{\r
+public:\r
+                          Comparator_i();\r
+  virtual                 ~Comparator_i();\r
+\r
+  void                    SetMesh( SMESH_Mesh_ptr theMesh );\r
+  void                    SetMargin( CORBA::Double );\r
+  void                    SetNumFunctor( NumericalFunctor_ptr );\r
+\r
+  virtual int             GetType() const;\r
+\r
+protected:\r
+  CORBA::Double           myMargin;\r
+  NumericalFunctor_i*     myFunctor;\r
+};\r
+\r
+/*\r
+  Class       : LessThan_i\r
+  Description : Comparator "<"\r
+*/\r
+\r
+class LessThan_i: public virtual POA_SMESH::LessThan,\r
+                  public virtual Comparator_i\r
+{\r
+public:\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long theElementId );\r
+};\r
+\r
+/*\r
+  Class       : MoreThan_i\r
+  Description : Comparator ">"\r
+*/\r
+class MoreThan_i: public virtual POA_SMESH::MoreThan,\r
+                  public virtual Comparator_i\r
+{\r
+public:\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long theElementId );\r
+};\r
+\r
+/*\r
+  Class       : EqualTo_i\r
+  Description : Comparator "="\r
+*/\r
+class EqualTo_i: public virtual POA_SMESH::EqualTo,\r
+                 public virtual Comparator_i\r
+{\r
+public:\r
+                          EqualTo_i();\r
+\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long theElementId );\r
+\r
+  void                    SetTolerance( CORBA::Double );\r
+\r
+private:\r
+  CORBA::Double           myToler;\r
+};\r
+\r
+/*\r
+  Class       : Logical_i\r
+  Description : Base class for logical predicate\r
+*/\r
+\r
+class Logical_i: public virtual POA_SMESH::Logical,\r
+                 public virtual Predicate_i\r
+  \r
+{\r
+};\r
+\r
+/*\r
+  Class       : LogicalNOT_i\r
+  Description : Logical NOT predicate\r
+*/\r
+\r
+class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,\r
+                    public virtual Logical_i\r
+{\r
+public:\r
+                          LogicalNOT_i();\r
+  virtual                 ~LogicalNOT_i();\r
+\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long );\r
+\r
+  void                    SetMesh( SMESH_Mesh_ptr );\r
+  void                    SetPredicate( Predicate_ptr );\r
+\r
+  virtual int             GetType() const;\r
+\r
+private:\r
+  Predicate_i*            myPredicate;\r
+};\r
+\r
+\r
+/*\r
+  Class       : LogicalBinary_i\r
+  Description : Base class for binary logical predicate\r
+*/\r
+\r
+class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,\r
+                                  public virtual Logical_i\r
+{\r
+public:\r
+                          LogicalBinary_i();\r
+  virtual                 ~LogicalBinary_i();\r
+\r
+  void                    SetMesh( SMESH_Mesh_ptr );\r
+\r
+  void                    SetPredicate1( Predicate_ptr );\r
+  void                    SetPredicate2( Predicate_ptr );\r
+\r
+  virtual int             GetType() const;\r
+\r
+protected:\r
+  Predicate_i*            myPredicate1;\r
+  Predicate_i*            myPredicate2;\r
+};\r
+\r
+/*\r
+  Class       : LogicalAND_i\r
+  Description : Logical AND\r
+*/\r
+\r
+class LogicalAND_i: public virtual POA_SMESH::LogicalAND,\r
+                    public virtual LogicalBinary_i\r
+{\r
+public:\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long theElementId );\r
+};\r
+\r
+/*\r
+  Class       : LogicalOR_i\r
+  Description : Logical OR\r
+*/\r
+\r
+class LogicalOR_i: public virtual POA_SMESH::LogicalOR,\r
+                   public virtual LogicalBinary_i\r
+{\r
+public:\r
+  CORBA::Boolean          IsSatisfy( CORBA::Long theElementId );\r
+};\r
+\r
+\r
+/*\r
+                               FILTER\r
+*/\r
+\r
+class Filter_i: public virtual POA_SMESH::Filter,\r
+                     public virtual SALOME::GenericObj_i\r
+{\r
+public:\r
+                          Filter_i();\r
+  virtual                 ~Filter_i();\r
+  void                    SetPredicate(Predicate_ptr );\r
+  long_array*             GetElementsId(SMESH_Mesh_ptr );\r
+  void                    SetMesh( SMESH_Mesh_ptr );\r
+\r
+protected:\r
+  Predicate_i*            myPredicate;\r
+};\r
+\r
+\r
+/*\r
+                            FILTER MANAGER\r
+*/\r
+\r
+class FilterManager_i: public virtual POA_SMESH::FilterManager,\r
+                                  public virtual SALOME::GenericObj_i\r
+{\r
+public:\r
+                          FilterManager_i();\r
+  MinimumAngle_ptr        CreateMinimumAngle();\r
+  AspectRatio_ptr         CreateAspectRatio();\r
+  Warping_ptr             CreateWarping();\r
+  Taper_ptr               CreateTaper();\r
+  Skew_ptr                CreateSkew();\r
+  Area_ptr                CreateArea();\r
+  Length_ptr              CreateLength();\r
+  MultiConnection_ptr     CreateMultiConnection();\r
+  \r
+  FreeBorders_ptr         CreateFreeBorders();\r
+\r
+  LessThan_ptr            CreateLessThan();\r
+  MoreThan_ptr            CreateMoreThan();\r
+  EqualTo_ptr             CreateEqualTo();\r
+  \r
+  LogicalNOT_ptr          CreateLogicalNOT();\r
+  LogicalAND_ptr          CreateLogicalAND();\r
+  LogicalOR_ptr           CreateLogicalOR();\r
+\r
+  Filter_ptr              CreateFilter();\r
+};\r
+\r
+\r
+\r
+};\r
+\r
+\r
+#endif\r
diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx
new file mode 100644 (file)
index 0000000..81a4951
--- /dev/null
@@ -0,0 +1,358 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
+//
+//  Copyright (C) 2004  CEA
+// 
+//  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.org 
+//
+//
+//
+//  File   : SMESH_Group_i.cxx
+//  Author : Sergey ANIKIN, OCC
+//  Module : SMESH
+//  $Header$
+
+#include "SMESH_Group_i.hxx"
+#include "SMESH_Mesh_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include <SMESH_Group.hxx>
+#include <SMESHDS_Group.hxx>
+#include <SMDSAbs_ElementType.hxx>
+#include <utilities.h>
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_Group_i::SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID )
+: SALOME::GenericObj_i( thePOA ),
+  myMeshServant( theMeshServant ), 
+  myLocalID( theLocalID )
+{
+  thePOA->activate_object( this );
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH_Group_i::~SMESH_Group_i()
+{
+  MESSAGE("~SMESH_Group_i;" );
+  if ( myMeshServant )
+    myMeshServant->removeGroup(myLocalID);
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void SMESH_Group_i::SetName( const char* theName )
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      aGroup->SetName(theName);
+
+      // Update group name in a study
+      SALOMEDS::Study_var aStudy = myMeshServant->GetGen()->GetCurrentStudy();
+      if ( !aStudy->_is_nil() ) {
+       SALOMEDS::SObject_var aGroupSO = aStudy->FindObjectIOR( SMESH_Gen_i::GetORB()->object_to_string( _this() ) );
+       if ( !aGroupSO->_is_nil() ) {
+         SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+         aBuilder->SetName( aGroupSO, theName );
+       }
+      }
+      return;
+    }
+  }
+  MESSAGE("can't set name of a vague group");
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+char* SMESH_Group_i::GetName()
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup)
+      return CORBA::string_dup (aGroup->GetName());
+  }
+  MESSAGE("get name of a vague group");
+  return CORBA::string_dup( "NO_NAME" );
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH::ElementType SMESH_Group_i::GetType()
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      SMDSAbs_ElementType aSMDSType = aGroup->GetGroupDS()->GetType();
+      SMESH::ElementType aType;
+      switch (aSMDSType) {
+      case SMDSAbs_Node:   aType = SMESH::NODE; break;
+      case SMDSAbs_Edge:   aType = SMESH::EDGE; break;
+      case SMDSAbs_Face:   aType = SMESH::FACE; break;
+      case SMDSAbs_Volume: aType = SMESH::VOLUME; break;
+      default:             aType = SMESH::ALL; break;
+      }
+      return aType;
+    }
+  }
+  MESSAGE("get type of a vague group");
+  return SMESH::ALL;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Long SMESH_Group_i::Size()
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      int aSize = aGroup->GetGroupDS()->Extent();
+      return aSize;
+    }
+  }
+  MESSAGE("get size of a vague group");
+  return 0;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_Group_i::IsEmpty()
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      bool isEmpty = aGroup->GetGroupDS()->IsEmpty();
+      return isEmpty;
+    }
+  }
+  MESSAGE("checking IsEmpty of a vague group");
+  return true;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void SMESH_Group_i::Clear()
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      // a SMDS group forgets its type after clearing, so we must re-set it
+      SMDSAbs_ElementType aSMDSType = aGroup->GetGroupDS()->GetType();
+      aGroup->GetGroupDS()->Clear();
+      aGroup->GetGroupDS()->SetType(aSMDSType);
+      return;
+    }
+  }
+  MESSAGE("attempt to clear a vague group");
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_Group_i::Contains( CORBA::Long theID )
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      bool res = aGroup->GetGroupDS()->Contains(theID);
+      return res;
+    }
+  }
+  MESSAGE("attempt to check contents of a vague group");
+  return false;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
+      int nbAdd = 0;
+      for (int i = 0; i < theIDs.length(); i++) {
+        int anID = (int) theIDs[i];
+        if (aGroupDS->Add(anID))
+          nbAdd++;
+      }
+      return nbAdd;
+    }
+  }
+  MESSAGE("attempt to add elements to a vague group");
+  return 0;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Long SMESH_Group_i::GetID( CORBA::Long theIndex )
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      int anID = aGroup->GetGroupDS()->GetID(theIndex);
+      return anID;
+    }
+  }
+  MESSAGE("attempt to iterate on a vague group");
+  return -1;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+SMESH::long_array* SMESH_Group_i::GetListOfID()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
+      int aSize = aGroupDS->Extent();
+      aRes->length(aSize);
+      for (int i = 0; i < aSize; i++)
+        aRes[i] = aGroupDS->GetID(i+1);
+      return aRes._retn();
+    }
+  }
+  MESSAGE("get list of IDs of a vague group");
+  return aRes._retn();
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
+{
+  if ( myMeshServant ) {
+    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
+    ::SMESH_Group* aGroup = aMesh.GetGroup(myLocalID);
+    if (aGroup) {
+      // a SMDS group forgets its type after clearing, so we must re-set it
+      // if the group becomes empty
+      SMDSAbs_ElementType aSMDSType = aGroup->GetGroupDS()->GetType();
+      SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
+      int nbDel = 0;
+      for (int i = 0; i < theIDs.length(); i++) {
+        int anID = (int) theIDs[i];
+        if (aGroupDS->Remove(anID))
+          nbDel++;
+      }
+      if (aGroupDS->IsEmpty())
+        aGroupDS->SetType(aSMDSType);
+      return nbDel;
+    }
+  }
+  MESSAGE("attempt to remove elements from a vague group");
+  return 0;
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+SMESH::SMESH_Mesh_ptr SMESH_Group_i::GetMesh()
+{
+  MESSAGE("SMESH_Group_i::GetMesh(): mesh servant = " << myMeshServant );
+  SMESH::SMESH_Mesh_var aMesh;
+  if ( myMeshServant )
+    aMesh = SMESH::SMESH_Mesh::_narrow( myMeshServant->_this() );
+  return aMesh._retn();
+}
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+int SMESH_Group_i::GetLocalID()
+{
+  return myLocalID;
+}
diff --git a/src/SMESH_I/SMESH_Group_i.hxx b/src/SMESH_I/SMESH_Group_i.hxx
new file mode 100644 (file)
index 0000000..2c7c1d3
--- /dev/null
@@ -0,0 +1,82 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
+//
+//  Copyright (C) 2004  CEA
+// 
+//  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.org 
+//
+//
+//
+//  File   : SMESH_Group_i.hxx
+//  Author : Sergey ANIKIN, OCC
+//  Module : SMESH
+//  $Header$
+
+#ifndef SMESH_Group_i_HeaderFile
+#define SMESH_Group_i_HeaderFile
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+
+#include "SALOME_GenericObj_i.hh"
+
+class SMESH_Mesh_i;
+
+class SMESH_Group_i:
+  public virtual POA_SMESH::SMESH_Group,
+  public virtual SALOME::GenericObj_i
+{
+public:
+  SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
+  virtual ~SMESH_Group_i();
+
+  // CORBA interface implementation
+  void SetName( const char* theName );
+
+  char* GetName();
+
+  SMESH::ElementType GetType();
+
+  CORBA::Long Size();
+
+  CORBA::Boolean IsEmpty();
+
+  void Clear();
+
+  CORBA::Boolean Contains( CORBA::Long theID );
+
+  CORBA::Long Add( const SMESH::long_array& theIDs );
+
+  CORBA::Long GetID( CORBA::Long theIndex );
+
+  SMESH::long_array* GetListOfID();
+
+  CORBA::Long Remove( const SMESH::long_array& theIDs );
+
+  SMESH::SMESH_Mesh_ptr GetMesh();
+
+  // Internal C++ interface
+  int GetLocalID();
+
+  SMESH_Mesh_i* GetMeshServant() { return myMeshServant; }
+
+private:
+  SMESH_Mesh_i* myMeshServant;
+  int myLocalID;
+};
+
+#endif
diff --git a/src/SMESH_SWIG/SMESH_controls.py b/src/SMESH_SWIG/SMESH_controls.py
new file mode 100644 (file)
index 0000000..83c9501
--- /dev/null
@@ -0,0 +1,227 @@
+#  Copyright (C) 2004  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+#  File   : SMESH_control.py
+#  Author : Sergey LITONIN
+#  Module : SMESH
+
+
+import SMESH
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+
+aFilterMgr = smesh.CreateFilterManager()
+
+# Criterion : AREA > 100
+
+aFunctor = aFilterMgr.CreateArea()
+aPredicate = aFilterMgr.CreateMoreThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 100 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Area > 100 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.FACE, "Area > 100" )
+aGroup.Add( anIds )
+
+
+# Criterion : Taper > 3e-15
+
+aFunctor = aFilterMgr.CreateTaper()
+aPredicate = aFilterMgr.CreateMoreThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 3e-15 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Taper > 3e-15 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.FACE, "Taper > 3e-15" )
+aGroup.Add( anIds )
+
+
+# Criterion : ASPECT RATIO > 1.3
+
+aFunctor = aFilterMgr.CreateAspectRatio()
+aPredicate = aFilterMgr.CreateMoreThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 1.3 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.FACE, "Aspect Ratio > 1.3" )
+aGroup.Add( anIds )  
+
+
+# Criterion : MINIMUM ANGLE < 30
+
+aFunctor = aFilterMgr.CreateMinimumAngle()
+aPredicate = aFilterMgr.CreateLessThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 30 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Minimum Angle < 30 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.FACE, "Minimum Angle < 30" )
+aGroup.Add( anIds )
+
+# Criterion : Warp > 2e-13
+
+aFunctor = aFilterMgr.CreateWarping()
+aPredicate = aFilterMgr.CreateMoreThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 2e-13 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Warp > 2e-13 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.FACE, "Warp > 2e-13" )
+aGroup.Add( anIds )
+
+# Criterion : Skew > 18
+
+aFunctor = aFilterMgr.CreateSkew()
+aPredicate = aFilterMgr.CreateMoreThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 18 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Skew > 18 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.FACE, "Skew > 18" )
+aGroup.Add( anIds )
+
+# Criterion : Length > 10
+
+aFunctor = aFilterMgr.CreateLength()
+aPredicate = aFilterMgr.CreateMoreThan()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 10 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Length > 10 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.EDGE, "Length > 10" )
+aGroup.Add( anIds )
+
+# Criterion : Borders at multi-connections = 2
+
+aFunctor = aFilterMgr.CreateMultiConnection()
+aPredicate = aFilterMgr.CreateEqualTo()
+aPredicate.SetNumFunctor( aFunctor )
+aPredicate.SetMargin( 2 )
+
+aFilter = aFilterMgr.CreateFilter()
+aFilter.SetPredicate( aPredicate )
+
+anIds = aFilter.GetElementsId( mesh )
+
+# print result
+print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds )
+#for i in range( len( anIds ) ):
+  #print anIds[ i ]
+
+# create group
+aGroup = mesh.CreateGroup( SMESH.EDGE, "Borders at multi-connections = 2" )
+aGroup.Add( anIds )
+
+
+salome.sg.updateObjBrowser(1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SMESH_SWIG/SMESH_freebord.py b/src/SMESH_SWIG/SMESH_freebord.py
new file mode 100644 (file)
index 0000000..d24e340
--- /dev/null
@@ -0,0 +1,78 @@
+import salome\r
+from geompy import gg\r
+import geompy\r
+import SMESH\r
+\r
+import StdMeshers\r
+\r
+ShapeTypeCompSolid = 1\r
+ShapeTypeSolid = 2\r
+ShapeTypeShell = 3\r
+ShapeTypeFace = 4\r
+ShapeTypeWire = 5\r
+ShapeTypeEdge = 6\r
+ShapeTypeVertex = 7\r
+\r
+geom  = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")\r
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")\r
+\r
+geom.GetCurrentStudy(salome.myStudy._get_StudyId())\r
+smesh.SetCurrentStudy(salome.myStudy)\r
+\r
+# Create box without one plane\r
+\r
+box = geompy.MakeBox(0., 0., 0., 10., 20., 30.)\r
+subShapeList = geompy.SubShapeAll(box,ShapeTypeFace)\r
+\r
+FaceList  = []\r
+for i in range( 5 ):\r
+  FaceList.append( subShapeList[ i ]._get_Name() )\r
+\r
+aBox = geompy.MakeSewing( FaceList, 1. )\r
+idbox = geompy.addToStudy( aBox, "box" )\r
+  \r
+aBox  = salome.IDToObject( idbox )\r
+\r
+# Create mesh\r
+\r
+hyp1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")\r
+hyp1.SetNumberOfSegments(5)\r
+hyp2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")\r
+hyp2.SetMaxElementArea(20)\r
+hyp3 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")\r
+hyp3.SetMaxElementArea(50)\r
+\r
+algo1 = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")\r
+algo2 = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")\r
+\r
+mesh = smesh.CreateMesh(aBox)\r
+mesh.AddHypothesis(aBox,hyp1)\r
+mesh.AddHypothesis(aBox,hyp2)\r
+mesh.AddHypothesis(aBox,algo1)\r
+mesh.AddHypothesis(aBox,algo2)\r
+\r
+smesh.Compute(mesh,aBox)\r
+\r
+smeshgui = salome.ImportComponentGUI("SMESH")\r
+smeshgui.Init(salome.myStudyId);\r
+smeshgui.SetName( salome.ObjectToID( mesh ), "Mesh_freebord" );\r
+\r
+# Criterion : Free edges\r
+aFilterMgr = smesh.CreateFilterManager()\r
+aPredicate = aFilterMgr.CreateFreeBorders()\r
+aFilter = aFilterMgr.CreateFilter()\r
+aFilter.SetPredicate( aPredicate )\r
+\r
+anIds = aFilter.GetElementsId( mesh )\r
+\r
+# print result\r
+print "Criterion: Free edges Nb = ", len( anIds )\r
+for i in range( len( anIds ) ):\r
+  print anIds[ i ]\r
+\r
+# create group\r
+aGroup = mesh.CreateGroup( SMESH.EDGE, "Free edges" )\r
+aGroup.Add( anIds )\r
+\r
+\r
+salome.sg.updateObjBrowser(1)\r
diff --git a/src/SMESH_SWIG/SMESH_test4.py b/src/SMESH_SWIG/SMESH_test4.py
new file mode 100755 (executable)
index 0000000..3a48db6
--- /dev/null
@@ -0,0 +1,65 @@
+import salome
+from geompy import gg
+import geompy
+import SMESH
+
+import StdMeshers
+
+ShapeTypeCompSolid = 1
+ShapeTypeSolid = 2
+ShapeTypeShell = 3
+ShapeTypeFace = 4
+ShapeTypeWire = 5
+ShapeTypeEdge = 6
+ShapeTypeVertex = 7
+
+geom  = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+
+geom.GetCurrentStudy(salome.myStudy._get_StudyId())
+smesh.SetCurrentStudy(salome.myStudy)
+
+box   = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box,"box")
+
+subShapeList = geompy.SubShapeAll(box,ShapeTypeFace)
+face   = subShapeList[0]
+name   = geompy.SubShapeName( face._get_Name(), box._get_Name() )
+idface = geompy.addToStudyInFather(box,face,name)
+
+box  = salome.IDToObject(idbox)
+face = salome.IDToObject(idface)
+
+hyp1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+hyp1.SetNumberOfSegments(10)
+hyp2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hyp2.SetMaxElementArea(10)
+hyp3 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+hyp3.SetMaxElementArea(100)
+
+algo1 = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+algo2 = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+
+mesh = smesh.CreateMesh(box)
+mesh.AddHypothesis(box,hyp1)
+mesh.AddHypothesis(box,hyp2)
+mesh.AddHypothesis(box,algo1)
+mesh.AddHypothesis(box,algo2)
+
+submesh = mesh.GetSubMesh(face, "SubMeshFace")
+mesh.AddHypothesis(face,hyp1)
+mesh.AddHypothesis(face,hyp3)
+mesh.AddHypothesis(face,algo1)
+mesh.AddHypothesis(face,algo2)
+
+smesh.Compute(mesh,box)
+
+faces = submesh.GetElementsByType(SMESH.FACE)
+if len(faces) > 1:
+    print len(faces), len(faces)/2
+    group1 = mesh.CreateGroup(SMESH.FACE,"Group of faces")
+    group2 = mesh.CreateGroup(SMESH.FACE,"Another group of faces")
+    group1.Add(faces[:int(len(faces)/2)])
+    group2.Add(faces[int(len(faces)/2):])
+
+salome.sg.updateObjBrowser(1)
diff --git a/src/SMESH_SWIG/SMESH_test5.py b/src/SMESH_SWIG/SMESH_test5.py
new file mode 100644 (file)
index 0000000..301917d
--- /dev/null
@@ -0,0 +1,79 @@
+#  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : SMESH_test1.py
+#  Module : SMESH
+
+import salome
+import SMESH
+import SALOMEDS
+import CORBA
+import os
+import os.path
+
+def SetSObjName(theSObj,theName) :
+    ok, anAttr = theSObj.FindAttribute("AttributeName")
+    if ok:
+        aName = anAttr._narrow(SALOMEDS.AttributeName)
+        #print aName.__dict__
+        aName.SetValue(theName)
+
+def ConvertMED2UNV(thePath,theFile) :
+    anInitFileName = thePath + theFile
+    aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName)
+    print aResult, aMeshes
+
+    for iMesh in range(len(aMeshes)) :
+        aMesh = aMeshes[iMesh]
+        anSObj = salome.ObjectToSObject(aMesh)
+        print anSObj.GetName(),
+        aFileName = anInitFileName
+        aFileName = os.path.basename(aFileName)
+        SetSObjName(anSObj,aFileName)
+        print anSObj.GetName()
+
+        aFileName = thePath + theFile + "." + str(iMesh) + ".unv"
+        aMesh.ExportUNV(aFileName)
+        aMesh = smesh.CreateMeshesFromUNV(aFileName)
+        anSObj = salome.ObjectToSObject(aMesh)
+        print anSObj.GetName(),
+        os.remove(aFileName)
+        aFileName = os.path.basename(aFileName)
+        SetSObjName(anSObj,aFileName)
+        print anSObj.GetName()
+
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+smesh.SetCurrentStudy(salome.myStudy)
+
+aPath = os.getenv('KERNEL_ROOT_DIR') + '/examples/'
+aListDir = os.listdir(aPath)
+print aListDir
+
+for iFile in range(len(aListDir)) :
+    aFileName = aListDir[iFile];
+    aName,anExt = os.path.splitext(aFileName)
+    if anExt == ".med" :
+        aFileName = os.path.basename(aFileName)
+        print aFileName
+        ConvertMED2UNV(aPath,aFileName)
+        #break
+
+salome.sg.updateObjBrowser(1);
diff --git a/src/SMESH_SWIG/batchmode_mefisto.py b/src/SMESH_SWIG/batchmode_mefisto.py
new file mode 100644 (file)
index 0000000..6fa3071
--- /dev/null
@@ -0,0 +1,150 @@
+import os
+import re
+
+import batchmode_salome
+import batchmode_geompy
+import batchmode_smesh
+
+geom = batchmode_geompy.geom
+smesh = batchmode_smesh.smesh
+
+geom.GetCurrentStudy(batchmode_salome.myStudyId)
+smesh.SetCurrentStudy(batchmode_salome.myStudy)
+
+ShapeType = batchmode_smesh.ShapeType
+
+import StdMeshers
+
+def CreateMesh (theFileName, area, len = None, nbseg = None):
+    
+    if not(os.path.isfile(theFileName)) or re.search("\.brep$", theFileName) is None :
+        print "Incorrect file name !"
+        return
+
+    if (len is None) and (nbseg is None):
+        print "Define length or number of segments !"
+        return
+
+    if (len is not None) and (nbseg is not None):
+        print "Only one Hypothesis (from length and number of segments) can be defined !"
+        return
+
+    
+    # ----  Import shape from BREP file and add it to the study  
+    shape_mesh = geom.ImportBREP(theFileName)
+    Id_shape = batchmode_geompy.addToStudy( shape_mesh, "shape_mesh")
+
+
+
+    # ---- SMESH
+      
+    # ---- create Hypothesis
+
+    print "-------------------------- create Hypothesis"
+    if (len is not None):
+        print "-------------------------- LocalLength"
+        hypLength1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
+        hypLength1.SetLength(len)
+        print "Hypothesis type: ", hypLength1.GetName()
+        print "Hypothesis ID: ", hypLength1.GetId()
+        print "Hypothesis Value: ", hypLength1.GetLength()
+    
+    if (nbseg is not None):   
+        print "-------------------------- NumberOfSegments"
+        hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
+        hypNbSeg1.SetNumberOfSegments(nbseg)
+        print "Hypothesis type: ", hypNbSeg1.GetName()
+        print "Hypothesis ID: ", hypNbSeg1.GetId()
+        print "Hypothesis Value: ", hypNbSeg1.GetNumberOfSegments()
+
+
+    if (area == "LengthFromEdges"):
+        print "-------------------------- LengthFromEdges"
+        hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
+        hypLengthFromEdges.SetMode(1)
+        print "Hypothesis type: ", hypLengthFromEdges.GetName()
+        print "Hypothesis ID: ", hypLengthFromEdges.GetId()
+        print "LengthFromEdges Mode: ", hypLengthFromEdges.GetMode()
+       
+    else:
+        print "-------------------------- MaxElementArea"
+        hypArea1 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
+        hypArea1.SetMaxElementArea(area)
+        print "Hypothesis type: ", hypArea1.GetName()
+        print "Hypothesis ID: ", hypArea1.GetId()
+        print "Hypothesis Value: ", hypArea1.GetMaxElementArea()
+
+              
+    
+    print "-------------------------- Regular_1D"
+    algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
+   
+    listHyp = algoReg.GetCompatibleHypothesis()
+    for hyp in listHyp:
+        print hyp
+    
+    print "Algo name: ", algoReg.GetName()
+    print "Algo ID: ", algoReg.GetId()
+   
+    print "-------------------------- MEFISTO_2D"
+    algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
+    
+    listHyp=algoMef.GetCompatibleHypothesis()
+    for hyp in listHyp:
+        print hyp
+        
+    print "Algo name: ", algoMef.GetName()
+    print "Algo ID: ", algoMef.GetId()
+
+
+
+    # ---- add hypothesis to shape
+
+    print "-------------------------- add hypothesis to shape"
+    mesh = smesh.CreateMesh(shape_mesh) 
+
+    ret = mesh.AddHypothesis(shape_mesh, algoReg)
+    print "Add Regular_1D algo .... ", 
+    print ret
+    
+    if (nbseg is not None):
+        ret=mesh.AddHypothesis(shape_mesh, hypNbSeg1)
+        print "Add Number Of Segements algo .... ", 
+        print ret
+
+    if (len is not None):
+        ret=mesh.AddHypothesis(shape_mesh,hypLength1)
+        print "Add  Local Length algo .... ", 
+        print ret
+
+    ret=mesh.AddHypothesis(shape_mesh, algoMef)
+    print "Add MEFISTO_2D algo....", 
+    print ret
+    
+    if (area == "LengthFromEdges"):
+        ret = mesh.AddHypothesis( shape_mesh, hypLengthFromEdges)    # length from edge 
+        print "Add Length From Edges algo .... ",
+        print ret
+    else:
+        ret=mesh.AddHypothesis(shape_mesh, hypArea1)
+        print "Add Max Triangle Area algo .... ", 
+        print ret
+    
+    # ---- compute mesh
+
+    print "-------------------------- compute mesh"
+    ret=smesh.Compute(mesh,shape_mesh)
+    print  "Compute Mesh .... ", 
+    print ret
+    log=mesh.GetLog(0); # no erase trace
+    #for linelog in log:
+    #    print linelog
+
+    print "------------ INFORMATION ABOUT MESH ------------"
+    
+    print "Number of nodes: ", mesh.NbNodes()
+    print "Number of edges: ", mesh.NbEdges()
+    print "Number of faces: ", mesh.NbFaces()
+    print "Number of triangles: ", mesh.NbTriangles()
+
+    return mesh
diff --git a/src/StdMeshers/Makefile.in b/src/StdMeshers/Makefile.in
new file mode 100644 (file)
index 0000000..b7d66f8
--- /dev/null
@@ -0,0 +1,81 @@
+#  SMESH StdMeshers : implementaion of SMESH idl descriptions
+#
+#  Copyright (C) 2003  CEA
+# 
+#  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.org
+#
+#
+#
+#  File   : Makefile.in
+#  Author : Julia DOROVSKIKH
+#  Module : SMESH
+#  $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
+
+
+@COMMENCE@
+
+# header files  
+EXPORT_HEADERS = \
+       StdMeshers_LengthFromEdges.hxx \
+       StdMeshers_LocalLength.hxx \
+       StdMeshers_NumberOfSegments.hxx \
+       StdMeshers_MaxElementArea.hxx \
+       StdMeshers_MaxElementVolume.hxx \
+       StdMeshers_NotConformAllowed.hxx \
+       StdMeshers_Regular_1D.hxx \
+       StdMeshers_Quadrangle_2D.hxx \
+       StdMeshers_MEFISTO_2D.hxx \
+       StdMeshers_Hexa_3D.hxx
+
+EXPORT_PYSCRIPTS =
+
+# Libraries targets
+
+LIB = libStdMeshers.la
+
+LIB_SRC = \
+       StdMeshers_LengthFromEdges.cxx \
+       StdMeshers_LocalLength.cxx \
+       StdMeshers_MaxElementArea.cxx \
+       StdMeshers_MaxElementVolume.cxx \
+       StdMeshers_NumberOfSegments.cxx \
+       StdMeshers_NotConformAllowed.cxx \
+       StdMeshers_Regular_1D.cxx \
+       StdMeshers_Quadrangle_2D.cxx \
+       StdMeshers_MEFISTO_2D.cxx \
+       StdMeshers_Hexa_3D.cxx
+
+LIB_SERVER_IDL = 
+
+LIB_CLIENT_IDL =
+
+# Executables targets
+BIN = 
+BIN_SRC = 
+
+# additionnal information to compil and link file
+CPPFLAGS+= $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CXXFLAGS+= $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+
+LDFLAGS+= -lSMESHimpl -lMEFISTO2D -L${KERNEL_ROOT_DIR}/lib/salome
+
+@CONCLUDE@
diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx
new file mode 100644 (file)
index 0000000..6c631d0
--- /dev/null
@@ -0,0 +1,1004 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Hexa_3D.cxx
+//           Moved here from SMESH_Hexa_3D.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_Hexa_3D.hxx"
+#include "StdMeshers_Quadrangle_2D.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Mesh.hxx"
+
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_FacePosition.hxx"
+
+#include <TopExp.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
+#include <BRep_Tool.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Handle_Geom2d_Curve.hxx>
+#include <Handle_Geom_Curve.hxx>
+
+#include "utilities.h"
+#include "Utils_ExceptHandlers.hxx"
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, int studyId,
+       SMESH_Gen * gen):SMESH_3D_Algo(hypId, studyId, gen)
+{
+       MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D");
+       _name = "Hexa_3D";
+//   _shapeType = TopAbs_SOLID;
+       _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
+//   MESSAGE("_shapeType octal " << oct << _shapeType);
+       for (int i = 0; i < 6; i++)
+               _quads[i] = 0;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D()
+{
+       MESSAGE("StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_Hexa_3D::CheckHypothesis
+                         (SMESH_Mesh& aMesh,
+                          const TopoDS_Shape& aShape,
+                          SMESH_Hypothesis::Hypothesis_Status& aStatus)
+{
+       MESSAGE("StdMeshers_Hexa_3D::CheckHypothesis");
+
+       bool isOk = true;
+        aStatus = SMESH_Hypothesis::HYP_OK;
+
+       // nothing to check
+
+       return isOk;
+}
+
+//=============================================================================
+/*!
+ * Hexahedron mesh on hexaedron like form
+ * -0.  - shape and face mesh verification
+ * -1.  - identify faces and vertices of the "cube"
+ * -2.  - Algorithm from:
+ * "Application de l'interpolation transfinie Ã  la création de maillages
+ *  C0 ou G1 continus sur des triangles, quadrangles, tetraedres, pentaedres
+ *  et hexaedres déformés."
+ * Alain PERONNET - 8 janvier 1999
+ */
+//=============================================================================
+
+bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape)throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+       MESSAGE("StdMeshers_Hexa_3D::Compute");
+
+       bool isOk = false;
+       SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+       SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+       //const SMESHDS_SubMesh *& subMeshDS = theSubMesh->GetSubMeshDS();
+
+       // 0.  - shape and face mesh verification
+       // 0.1 - shape must be a solid (or a shell) with 6 faces
+       MESSAGE("---");
+
+       vector < SMESH_subMesh * >meshFaces;
+       for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next())
+       {
+               SMESH_subMesh *aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
+               ASSERT(aSubMesh);
+               meshFaces.push_back(aSubMesh);
+       }
+       if (meshFaces.size() != 6)
+       {
+               SCRUTE(meshFaces.size());
+               ASSERT(0);
+               return false;
+       }
+
+       // 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges)
+       MESSAGE("---");
+
+       for (int i = 0; i < 6; i++)
+       {
+               TopoDS_Shape aShape = meshFaces[i]->GetSubShape();
+               SMESH_Algo *algo = _gen->GetAlgo(aMesh, aShape);
+               string algoName = algo->GetName();
+               if (algoName != "Quadrangle_2D")
+               {
+                       // *** delete _quads
+                       SCRUTE(algoName);
+                       ASSERT(0);
+                       return false;
+               }
+               StdMeshers_Quadrangle_2D *quadAlgo =
+                       dynamic_cast < StdMeshers_Quadrangle_2D * >(algo);
+               ASSERT(quadAlgo);
+               try
+               {
+                       _quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aShape);
+                       // *** to delete after usage
+               }
+               catch(SALOME_Exception & S_ex)
+               {
+                       // *** delete _quads
+                       // *** throw exception
+                       ASSERT(0);
+               }
+       }
+
+       // 1.  - identify faces and vertices of the "cube"
+       // 1.1 - ancestor maps vertex->edges in the cube
+       MESSAGE("---");
+
+       TopTools_IndexedDataMapOfShapeListOfShape MS;
+       TopExp::MapShapesAndAncestors(aShape, TopAbs_VERTEX, TopAbs_EDGE, MS);
+
+       // 1.2 - first face is choosen as face Y=0 of the unit cube
+       MESSAGE("---");
+
+       const TopoDS_Shape & aFace = meshFaces[0]->GetSubShape();
+       const TopoDS_Face & F = TopoDS::Face(aFace);
+
+       // 1.3 - identify the 4 vertices of the face Y=0: V000, V100, V101, V001
+       MESSAGE("---");
+
+       int i = 0;
+       TopoDS_Edge E = _quads[0]->edge[i];     //edge will be Y=0,Z=0 on unit cube
+       double f, l;
+       Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+       TopoDS_Vertex VFirst, VLast;
+       TopExp::Vertices(E, VFirst, VLast);     // corresponds to f and l
+       bool isForward =
+               (((l - f) * (_quads[0]->last[i] - _quads[0]->first[i])) > 0);
+
+       if (isForward)
+       {
+               _cube.V000 = VFirst;    // will be (0,0,0) on the unit cube
+               _cube.V100 = VLast;             // will be (1,0,0) on the unit cube
+       }
+       else
+       {
+               _cube.V000 = VLast;
+               _cube.V100 = VFirst;
+       }
+
+       i = 1;
+       E = _quads[0]->edge[i];
+       C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+       TopExp::Vertices(E, VFirst, VLast);
+       isForward = (((l - f) * (_quads[0]->last[i] - _quads[0]->first[i])) > 0);
+       if (isForward)
+               _cube.V101 = VLast;             // will be (1,0,1) on the unit cube
+       else
+               _cube.V101 = VFirst;
+
+       i = 2;
+       E = _quads[0]->edge[i];
+       C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+       TopExp::Vertices(E, VFirst, VLast);
+       isForward = (((l - f) * (_quads[0]->last[i] - _quads[0]->first[i])) > 0);
+       if (isForward)
+               _cube.V001 = VLast;             // will be (0,0,1) on the unit cube
+       else
+               _cube.V001 = VFirst;
+
+       // 1.4 - find edge X=0, Z=0 (ancestor of V000 not in face Y=0)
+       //     - find edge X=1, Z=0 (ancestor of V100 not in face Y=0)
+       //     - find edge X=1, Z=1 (ancestor of V101 not in face Y=0) 
+       //     - find edge X=0, Z=1 (ancestor of V001 not in face Y=0)
+       MESSAGE("---");
+
+       TopoDS_Edge E_0Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V000, MS);
+       ASSERT(!E_0Y0.IsNull());
+
+       TopoDS_Edge E_1Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V100, MS);
+       ASSERT(!E_1Y0.IsNull());
+
+       TopoDS_Edge E_1Y1 = EdgeNotInFace(aMesh, aShape, F, _cube.V101, MS);
+       ASSERT(!E_1Y1.IsNull());
+
+       TopoDS_Edge E_0Y1 = EdgeNotInFace(aMesh, aShape, F, _cube.V001, MS);
+       ASSERT(!E_0Y1.IsNull());
+
+       // 1.5 - identify the 4 vertices in face Y=1: V010, V110, V111, V011
+       MESSAGE("---");
+
+       TopExp::Vertices(E_0Y0, VFirst, VLast);
+       if (VFirst.IsSame(_cube.V000))
+               _cube.V010 = VLast;
+       else
+               _cube.V010 = VFirst;
+
+       TopExp::Vertices(E_1Y0, VFirst, VLast);
+       if (VFirst.IsSame(_cube.V100))
+               _cube.V110 = VLast;
+       else
+               _cube.V110 = VFirst;
+
+       TopExp::Vertices(E_1Y1, VFirst, VLast);
+       if (VFirst.IsSame(_cube.V101))
+               _cube.V111 = VLast;
+       else
+               _cube.V111 = VFirst;
+
+       TopExp::Vertices(E_0Y1, VFirst, VLast);
+       if (VFirst.IsSame(_cube.V001))
+               _cube.V011 = VLast;
+       else
+               _cube.V011 = VFirst;
+
+       // 1.6 - find remaining faces given 4 vertices
+       MESSAGE("---");
+
+       _indY0 = 0;
+       _cube.quad_Y0 = _quads[_indY0];
+
+       _indY1 = GetFaceIndex(aMesh, aShape, meshFaces,
+               _cube.V010, _cube.V011, _cube.V110, _cube.V111);
+       _cube.quad_Y1 = _quads[_indY1];
+
+       _indZ0 = GetFaceIndex(aMesh, aShape, meshFaces,
+               _cube.V000, _cube.V010, _cube.V100, _cube.V110);
+       _cube.quad_Z0 = _quads[_indZ0];
+
+       _indZ1 = GetFaceIndex(aMesh, aShape, meshFaces,
+               _cube.V001, _cube.V011, _cube.V101, _cube.V111);
+       _cube.quad_Z1 = _quads[_indZ1];
+
+       _indX0 = GetFaceIndex(aMesh, aShape, meshFaces,
+               _cube.V000, _cube.V001, _cube.V010, _cube.V011);
+       _cube.quad_X0 = _quads[_indX0];
+
+       _indX1 = GetFaceIndex(aMesh, aShape, meshFaces,
+               _cube.V100, _cube.V101, _cube.V110, _cube.V111);
+       _cube.quad_X1 = _quads[_indX1];
+
+       MESSAGE("---");
+
+       // 1.7 - get convertion coefs from face 2D normalized to 3D normalized
+
+       Conv2DStruct cx0;                       // for face X=0
+       Conv2DStruct cx1;                       // for face X=1
+       Conv2DStruct cy0;
+       Conv2DStruct cy1;
+       Conv2DStruct cz0;
+       Conv2DStruct cz1;
+
+       GetConv2DCoefs(*_cube.quad_X0, meshFaces[_indX0]->GetSubShape(),
+               _cube.V000, _cube.V010, _cube.V011, _cube.V001, cx0);
+       GetConv2DCoefs(*_cube.quad_X1, meshFaces[_indX1]->GetSubShape(),
+               _cube.V100, _cube.V110, _cube.V111, _cube.V101, cx1);
+       GetConv2DCoefs(*_cube.quad_Y0, meshFaces[_indY0]->GetSubShape(),
+               _cube.V000, _cube.V100, _cube.V101, _cube.V001, cy0);
+       GetConv2DCoefs(*_cube.quad_Y1, meshFaces[_indY1]->GetSubShape(),
+               _cube.V010, _cube.V110, _cube.V111, _cube.V011, cy1);
+       GetConv2DCoefs(*_cube.quad_Z0, meshFaces[_indZ0]->GetSubShape(),
+               _cube.V000, _cube.V100, _cube.V110, _cube.V010, cz0);
+       GetConv2DCoefs(*_cube.quad_Z1, meshFaces[_indZ1]->GetSubShape(),
+               _cube.V001, _cube.V101, _cube.V111, _cube.V011, cz1);
+
+       // 1.8 - create a 3D structure for normalized values
+
+       MESSAGE("---");
+       int nbx = _cube.quad_Y0->nbPts[0];
+       int nby = _cube.quad_Y0->nbPts[1];
+       int nbz;
+       if (cx0.a1 != 0)
+               nbz = _cube.quad_X0->nbPts[1];
+       else
+               nbz = _cube.quad_X0->nbPts[0];
+       //SCRUTE(nbx);
+       //SCRUTE(nby);
+       //SCRUTE(nbz);
+       int nbxyz = nbx * nby * nbz;
+       Point3DStruct *np = new Point3DStruct[nbxyz];
+
+       // 1.9 - store node indexes of faces
+
+       {
+               const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX0]->GetSubShape());
+
+               faceQuadStruct *quad = _cube.quad_X0;
+               int i = 0;                              // j = x/face , k = y/face
+               int nbdown = quad->nbPts[0];
+               int nbright = quad->nbPts[1];
+
+
+               SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+                       
+               while(itf->more())
+               {
+                       const SMDS_MeshNode * node = itf->next();
+                       const SMDS_FacePosition* fpos =
+                          static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+                       double ri = fpos->GetUParameter();
+                       double rj = fpos->GetVParameter();
+                       int i1 = int (ri);
+                       int j1 = int (rj);
+                       int ij1 = j1 * nbdown + i1;
+                       quad->uv_grid[ij1].node = node;
+               }
+
+               for (int i1 = 0; i1 < nbdown; i1++)
+                       for (int j1 = 0; j1 < nbright; j1++)
+                       {
+                               int ij1 = j1 * nbdown + i1;
+                               int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic;     // j = x/face
+                               int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc;     // k = y/face
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+                               np[ijk].node = quad->uv_grid[ij1].node;
+                               //SCRUTE(np[ijk].nodeId);
+                       }
+       }
+
+       {
+               const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX1]->GetSubShape());
+
+               SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+
+               faceQuadStruct *quad = _cube.quad_X1;
+               int i = nbx - 1;                // j = x/face , k = y/face
+               int nbdown = quad->nbPts[0];
+               int nbright = quad->nbPts[1];
+
+               while(itf->more())
+               {
+                       const SMDS_MeshNode * node = itf->next();
+                       const SMDS_FacePosition* fpos =
+                          static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+                       double ri = fpos->GetUParameter();
+                       double rj = fpos->GetVParameter();
+                       int i1 = int (ri);
+                       int j1 = int (rj);
+                       int ij1 = j1 * nbdown + i1;
+                       quad->uv_grid[ij1].node = node;
+               }
+
+               for (int i1 = 0; i1 < nbdown; i1++)
+                       for (int j1 = 0; j1 < nbright; j1++)
+                       {
+                               int ij1 = j1 * nbdown + i1;
+                               int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic;     // j = x/face
+                               int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc;     // k = y/face
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+                               np[ijk].node = quad->uv_grid[ij1].node;
+                               //SCRUTE(np[ijk].nodeId);
+                       }
+       }
+
+       {
+               const TopoDS_Face & F = TopoDS::Face(meshFaces[_indY0]->GetSubShape());
+
+               SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+
+               faceQuadStruct *quad = _cube.quad_Y0;
+               int j = 0;                              // i = x/face , k = y/face
+               int nbdown = quad->nbPts[0];
+               int nbright = quad->nbPts[1];
+
+               while(itf->more())
+               {
+                       const SMDS_MeshNode * node = itf->next();
+                       const SMDS_FacePosition * fpos =
+                          static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+                       double ri = fpos->GetUParameter();
+                       double rj = fpos->GetVParameter();
+                       int i1 = int (ri);
+                       int j1 = int (rj);
+                       int ij1 = j1 * nbdown + i1;
+                       quad->uv_grid[ij1].node = node;
+               }
+
+               for (int i1 = 0; i1 < nbdown; i1++)
+                       for (int j1 = 0; j1 < nbright; j1++)
+                       {
+                               int ij1 = j1 * nbdown + i1;
+                               int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic;     // i = x/face
+                               int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc;     // k = y/face
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+                               np[ijk].node = quad->uv_grid[ij1].node;
+                               //SCRUTE(np[ijk].nodeId);
+                       }
+       }
+
+       {
+               const TopoDS_Face & F = TopoDS::Face(meshFaces[_indY1]->GetSubShape());
+
+               SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+
+               faceQuadStruct *quad = _cube.quad_Y1;
+               int j = nby - 1;                // i = x/face , k = y/face
+               int nbdown = quad->nbPts[0];
+               int nbright = quad->nbPts[1];
+
+               while(itf->more())
+               {
+                       const SMDS_MeshNode * node = itf->next();
+                       const SMDS_FacePosition* fpos =
+                          static_cast<const SMDS_FacePosition *>(node->GetPosition().get());
+                       double ri = fpos->GetUParameter();
+                       double rj = fpos->GetVParameter();
+                       int i1 = int (ri);
+                       int j1 = int (rj);
+                       int ij1 = j1 * nbdown + i1;
+                       quad->uv_grid[ij1].node = node;
+               }
+
+               for (int i1 = 0; i1 < nbdown; i1++)
+                       for (int j1 = 0; j1 < nbright; j1++)
+                       {
+                               int ij1 = j1 * nbdown + i1;
+                               int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic;     // i = x/face
+                               int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc;     // k = y/face
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+                               np[ijk].node = quad->uv_grid[ij1].node;
+                               //SCRUTE(np[ijk].nodeId);
+                       }
+       }
+
+       {
+               const TopoDS_Face & F = TopoDS::Face(meshFaces[_indZ0]->GetSubShape());
+
+               SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+
+               faceQuadStruct *quad = _cube.quad_Z0;
+               int k = 0;                              // i = x/face , j = y/face
+               int nbdown = quad->nbPts[0];
+               int nbright = quad->nbPts[1];
+
+               while(itf->more())
+               {
+                       const SMDS_MeshNode * node = itf->next();
+                       const SMDS_FacePosition * fpos =
+                          static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+                       double ri = fpos->GetUParameter();
+                       double rj = fpos->GetVParameter();
+                       int i1 = int (ri);
+                       int j1 = int (rj);
+                       int ij1 = j1 * nbdown + i1;
+                       quad->uv_grid[ij1].node = node;
+               }
+
+               for (int i1 = 0; i1 < nbdown; i1++)
+                       for (int j1 = 0; j1 < nbright; j1++)
+                       {
+                               int ij1 = j1 * nbdown + i1;
+                               int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic;     // i = x/face
+                               int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc;     // j = y/face
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+                               np[ijk].node = quad->uv_grid[ij1].node;
+                               //SCRUTE(np[ijk].nodeId);
+                       }
+       }
+
+       {
+               const TopoDS_Face & F = TopoDS::Face(meshFaces[_indZ1]->GetSubShape());
+
+               SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+
+               faceQuadStruct *quad = _cube.quad_Z1;
+               int k = nbz - 1;                // i = x/face , j = y/face
+               int nbdown = quad->nbPts[0];
+               int nbright = quad->nbPts[1];
+
+               while(itf->more())
+               {
+                       const SMDS_MeshNode * node = itf->next();
+                       const SMDS_FacePosition* fpos =
+                          static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+                       double ri = fpos->GetUParameter();
+                       double rj = fpos->GetVParameter();
+                       int i1 = int (ri);
+                       int j1 = int (rj);
+                       int ij1 = j1 * nbdown + i1;
+                       quad->uv_grid[ij1].node = node;
+               }
+
+               for (int i1 = 0; i1 < nbdown; i1++)
+                       for (int j1 = 0; j1 < nbright; j1++)
+                       {
+                               int ij1 = j1 * nbdown + i1;
+                               int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic;     // i = x/face
+                               int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc;     // j = y/face
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+                               np[ijk].node = quad->uv_grid[ij1].node;
+                               //SCRUTE(np[ijk].nodeId);
+                       }
+       }
+
+       // 2.0 - for each node of the cube:
+       //       - get the 8 points 3D = 8 vertices of the cube
+       //       - get the 12 points 3D on the 12 edges of the cube
+       //       - get the 6 points 3D on the 6 faces with their ID
+       //       - compute the point 3D
+       //       - store the point 3D in SMESHDS, store its ID in 3D structure
+
+       TopoDS_Shell aShell;
+       TopExp_Explorer exp(aShape, TopAbs_SHELL);
+       if (exp.More())
+       {
+               aShell = TopoDS::Shell(exp.Current());
+       }
+       else
+       {
+               MESSAGE("no shell...");
+               ASSERT(0);
+       }
+
+       Pt3 p000, p001, p010, p011, p100, p101, p110, p111;
+       Pt3 px00, px01, px10, px11;
+       Pt3 p0y0, p0y1, p1y0, p1y1;
+       Pt3 p00z, p01z, p10z, p11z;
+       Pt3 pxy0, pxy1, px0z, px1z, p0yz, p1yz;
+
+       GetPoint(p000, 0, 0, 0, nbx, nby, nbz, np, meshDS);
+       GetPoint(p001, 0, 0, nbz - 1, nbx, nby, nbz, np, meshDS);
+       GetPoint(p010, 0, nby - 1, 0, nbx, nby, nbz, np, meshDS);
+       GetPoint(p011, 0, nby - 1, nbz - 1, nbx, nby, nbz, np, meshDS);
+       GetPoint(p100, nbx - 1, 0, 0, nbx, nby, nbz, np, meshDS);
+       GetPoint(p101, nbx - 1, 0, nbz - 1, nbx, nby, nbz, np, meshDS);
+       GetPoint(p110, nbx - 1, nby - 1, 0, nbx, nby, nbz, np, meshDS);
+       GetPoint(p111, nbx - 1, nby - 1, nbz - 1, nbx, nby, nbz, np, meshDS);
+
+       for (int i = 1; i < nbx - 1; i++)
+       {
+               for (int j = 1; j < nby - 1; j++)
+               {
+                       for (int k = 1; k < nbz - 1; k++)
+                       {
+                               // *** seulement maillage regulier
+                               // 12 points on edges
+                               GetPoint(px00, i, 0, 0, nbx, nby, nbz, np, meshDS);
+                               GetPoint(px01, i, 0, nbz - 1, nbx, nby, nbz, np, meshDS);
+                               GetPoint(px10, i, nby - 1, 0, nbx, nby, nbz, np, meshDS);
+                               GetPoint(px11, i, nby - 1, nbz - 1, nbx, nby, nbz, np, meshDS);
+
+                               GetPoint(p0y0, 0, j, 0, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p0y1, 0, j, nbz - 1, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p1y0, nbx - 1, j, 0, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p1y1, nbx - 1, j, nbz - 1, nbx, nby, nbz, np, meshDS);
+
+                               GetPoint(p00z, 0, 0, k, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p01z, 0, nby - 1, k, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p10z, nbx - 1, 0, k, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p11z, nbx - 1, nby - 1, k, nbx, nby, nbz, np, meshDS);
+
+                               // 12 points on faces
+                               GetPoint(pxy0, i, j, 0, nbx, nby, nbz, np, meshDS);
+                               GetPoint(pxy1, i, j, nbz - 1, nbx, nby, nbz, np, meshDS);
+                               GetPoint(px0z, i, 0, k, nbx, nby, nbz, np, meshDS);
+                               GetPoint(px1z, i, nby - 1, k, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p0yz, 0, j, k, nbx, nby, nbz, np, meshDS);
+                               GetPoint(p1yz, nbx - 1, j, k, nbx, nby, nbz, np, meshDS);
+
+                               int ijk = k * nbx * nby + j * nbx + i;
+                               double x = double (i) / double (nbx - 1);       // *** seulement
+                               double y = double (j) / double (nby - 1);       // *** maillage
+                               double z = double (k) / double (nbz - 1);       // *** regulier
+
+                               Pt3 X;
+                               for (int i = 0; i < 3; i++)
+                               {
+                                       X[i] =
+                                               (1 - x) * p0yz[i] + x * p1yz[i]
+                                               + (1 - y) * px0z[i] + y * px1z[i]
+                                               + (1 - z) * pxy0[i] + z * pxy1[i]
+                                               - (1 - x) * ((1 - y) * p00z[i] + y * p01z[i])
+                                               - x * ((1 - y) * p10z[i] + y * p11z[i])
+                                               - (1 - y) * ((1 - z) * px00[i] + z * px01[i])
+                                               - y * ((1 - z) * px10[i] + z * px11[i])
+                                               - (1 - z) * ((1 - x) * p0y0[i] + x * p1y0[i])
+                                               - z * ((1 - x) * p0y1[i] + x * p1y1[i])
+                                               + (1 - x) * ((1 - y) * ((1 - z) * p000[i] + z * p001[i])
+                                               + y * ((1 - z) * p010[i] + z * p011[i]))
+                                               + x * ((1 - y) * ((1 - z) * p100[i] + z * p101[i])
+                                               + y * ((1 - z) * p110[i] + z * p111[i]));
+                               }
+
+                               SMDS_MeshNode * node = meshDS->AddNode(X[0], X[1], X[2]);
+                               np[ijk].node = node;
+                               //meshDS->SetNodeInVolume(node, TopoDS::Solid(aShape));
+                               meshDS->SetNodeInVolume(node, aShell);
+                       }
+               }
+       }
+
+       //2.1 - for each node of the cube (less 3 *1 Faces):
+       //      - store hexahedron in SMESHDS
+       MESSAGE("Storing hexahedron into the DS");
+       for (int i = 0; i < nbx - 1; i++)
+               for (int j = 0; j < nby - 1; j++)
+                       for (int k = 0; k < nbz - 1; k++)
+                       {
+                               int n1 = k * nbx * nby + j * nbx + i;
+                               int n2 = k * nbx * nby + j * nbx + i + 1;
+                               int n3 = k * nbx * nby + (j + 1) * nbx + i + 1;
+                               int n4 = k * nbx * nby + (j + 1) * nbx + i;
+                               int n5 = (k + 1) * nbx * nby + j * nbx + i;
+                               int n6 = (k + 1) * nbx * nby + j * nbx + i + 1;
+                               int n7 = (k + 1) * nbx * nby + (j + 1) * nbx + i + 1;
+                               int n8 = (k + 1) * nbx * nby + (j + 1) * nbx + i;
+
+//    MESSAGE(" "<<n1<<" "<<n2<<" "<<n3<<" "<<n4<<" "<<n5<<" "<<n6<<" "<<n7<<" "<<n8);
+                               //MESSAGE(" "<<np[n1].nodeId<<" "<<np[n2].nodeId<<" "<<np[n3].nodeId<<" "<<np[n4].nodeId<<" "<<np[n5].nodeId<<" "<<np[n6].nodeId<<" "<<np[n7].nodeId<<" "<<np[n8].nodeId);
+
+                               SMDS_MeshVolume * elt = meshDS->AddVolume(np[n1].node,
+                                       np[n2].node,
+                                       np[n3].node,
+                                       np[n4].node,
+                                       np[n5].node,
+                                       np[n6].node,
+                                       np[n7].node,
+                                       np[n8].node);
+                                ;
+                               meshDS->SetMeshElementOnShape(elt, aShell);
+
+                               // *** 5 tetrahedres ... verifier orientations,
+                               //     mettre en coherence &vec quadrangles-> triangles
+                               //     choisir afficher 1 parmi edges, face et volumes
+//    int tetra1 = meshDS->AddVolume(np[n1].nodeId,
+//                   np[n2].nodeId,
+//                   np[n4].nodeId,
+//                   np[n5].nodeId);
+//    int tetra2 = meshDS->AddVolume(np[n2].nodeId,
+//                   np[n3].nodeId,
+//                   np[n4].nodeId,
+//                   np[n7].nodeId);
+//    int tetra3 = meshDS->AddVolume(np[n5].nodeId,
+//                   np[n6].nodeId,
+//                   np[n7].nodeId,
+//                   np[n2].nodeId);
+//    int tetra4 = meshDS->AddVolume(np[n5].nodeId,
+//                   np[n7].nodeId,
+//                   np[n8].nodeId,
+//                   np[n4].nodeId);
+//    int tetra5 = meshDS->AddVolume(np[n5].nodeId,
+//                   np[n7].nodeId,
+//                   np[n2].nodeId,
+//                   np[n4].nodeId);
+
+                       }
+
+       MESSAGE("End of StdMeshers_Hexa_3D::Compute()");
+       return true;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_Hexa_3D::GetPoint(Pt3 p, int i, int j, int k, int nbx, int nby,
+       int nbz, Point3DStruct * np, const SMESHDS_Mesh * meshDS)
+{
+       int ijk = k * nbx * nby + j * nbx + i;
+       const SMDS_MeshNode * node = np[ijk].node;
+       p[0] = node->X();
+       p[1] = node->Y();
+       p[2] = node->Z();
+       //MESSAGE(" "<<i<<" "<<j<<" "<<k<<" "<<p[0]<<" "<<p[1]<<" "<<p[2]);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+int StdMeshers_Hexa_3D::GetFaceIndex(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape,
+       const vector < SMESH_subMesh * >&meshFaces,
+       const TopoDS_Vertex & V0,
+       const TopoDS_Vertex & V1,
+       const TopoDS_Vertex & V2, const TopoDS_Vertex & V3)
+{
+       MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
+       int faceIndex = -1;
+       for (int i = 1; i < 6; i++)
+       {
+               const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape();
+               //const TopoDS_Face& F = TopoDS::Face(aFace);
+               TopTools_IndexedMapOfShape M;
+               TopExp::MapShapes(aFace, TopAbs_VERTEX, M);
+               bool verticesInShape = false;
+               if (M.Contains(V0))
+                       if (M.Contains(V1))
+                               if (M.Contains(V2))
+                                       if (M.Contains(V3))
+                                               verticesInShape = true;
+               if (verticesInShape)
+               {
+                       faceIndex = i;
+                       break;
+               }
+       }
+       ASSERT(faceIndex > 0);
+       SCRUTE(faceIndex);
+       return faceIndex;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+TopoDS_Edge
+       StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape,
+       const TopoDS_Face & aFace,
+       const TopoDS_Vertex & aVertex,
+       const TopTools_IndexedDataMapOfShapeListOfShape & MS)
+{
+       MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
+       TopTools_IndexedDataMapOfShapeListOfShape MF;
+       TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF);
+       const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex);
+       const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex);
+       SCRUTE(ancestorsInSolid.Extent());
+       SCRUTE(ancestorsInFace.Extent());
+       ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees)
+       ASSERT(ancestorsInFace.Extent() == 2);
+
+       TopoDS_Edge E;
+       E.Nullify();
+       TopTools_ListIteratorOfListOfShape its(ancestorsInSolid);
+       for (; its.More(); its.Next())
+       {
+               TopoDS_Shape ancestor = its.Value();
+               TopTools_ListIteratorOfListOfShape itf(ancestorsInFace);
+               bool isInFace = false;
+               for (; itf.More(); itf.Next())
+               {
+                       TopoDS_Shape ancestorInFace = itf.Value();
+                       if (ancestorInFace.IsSame(ancestor))
+                       {
+                               isInFace = true;
+                               break;
+                       }
+               }
+               if (!isInFace)
+               {
+                       E = TopoDS::Edge(ancestor);
+                       break;
+               }
+       }
+       return E;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
+       const TopoDS_Shape & aShape,
+       const TopoDS_Vertex & V0,
+       const TopoDS_Vertex & V1,
+       const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv)
+{
+       MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
+       const TopoDS_Face & F = TopoDS::Face(aShape);
+       TopoDS_Edge E = quad.edge[0];
+       double f, l;
+       Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+       TopoDS_Vertex VFirst, VLast;
+       TopExp::Vertices(E, VFirst, VLast);     // corresponds to f and l
+       bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0);
+       TopoDS_Vertex VA, VB;
+       if (isForward)
+       {
+               VA = VFirst;
+               VB = VLast;
+       }
+       else
+       {
+               VA = VLast;
+               VB = VFirst;
+       }
+       int a1, b1, c1, a2, b2, c2;
+       if (VA.IsSame(V0))
+               if (VB.IsSame(V1))
+               {
+                       a1 = 1;
+                       b1 = 0;
+                       c1 = 0;                         // x
+                       a2 = 0;
+                       b2 = 1;
+                       c2 = 0;                         // y
+               }
+               else
+               {
+                       ASSERT(VB.IsSame(V3));
+                       a1 = 0;
+                       b1 = 1;
+                       c1 = 0;                         // y
+                       a2 = 1;
+                       b2 = 0;
+                       c2 = 0;                         // x
+               }
+       if (VA.IsSame(V1))
+               if (VB.IsSame(V2))
+               {
+                       a1 = 0;
+                       b1 = -1;
+                       c1 = 1;                         // 1-y
+                       a2 = 1;
+                       b2 = 0;
+                       c2 = 0;                         // x
+               }
+               else
+               {
+                       ASSERT(VB.IsSame(V0));
+                       a1 = -1;
+                       b1 = 0;
+                       c1 = 1;                         // 1-x
+                       a2 = 0;
+                       b2 = 1;
+                       c2 = 0;                         // y
+               }
+       if (VA.IsSame(V2))
+               if (VB.IsSame(V3))
+               {
+                       a1 = -1;
+                       b1 = 0;
+                       c1 = 1;                         // 1-x
+                       a2 = 0;
+                       b2 = -1;
+                       c2 = 1;                         // 1-y
+               }
+               else
+               {
+                       ASSERT(VB.IsSame(V1));
+                       a1 = 0;
+                       b1 = -1;
+                       c1 = 1;                         // 1-y
+                       a2 = -1;
+                       b2 = 0;
+                       c2 = 1;                         // 1-x
+               }
+       if (VA.IsSame(V3))
+               if (VB.IsSame(V0))
+               {
+                       a1 = 0;
+                       b1 = 1;
+                       c1 = 0;                         // y
+                       a2 = -1;
+                       b2 = 0;
+                       c2 = 1;                         // 1-x
+               }
+               else
+               {
+                       ASSERT(VB.IsSame(V2));
+                       a1 = 1;
+                       b1 = 0;
+                       c1 = 0;                         // x
+                       a2 = 0;
+                       b2 = -1;
+                       c2 = 1;                         // 1-y
+               }
+       MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
+       MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
+       conv.a1 = a1;
+       conv.b1 = b1;
+       conv.c1 = c1;
+       conv.a2 = a2;
+       conv.b2 = b2;
+       conv.c2 = c2;
+
+       int nbdown = quad.nbPts[0];
+       int nbright = quad.nbPts[1];
+       conv.ia = int (a1);
+       conv.ib = int (b1);
+       conv.ic =
+               int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1);
+       conv.ja = int (a2);
+       conv.jb = int (b2);
+       conv.jc =
+               int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1);
+       MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
+       MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_Hexa_3D::SaveTo(ostream & save)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_Hexa_3D::LoadFrom(istream & load)
+{
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_Hexa_3D & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_Hexa_3D & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.hxx b/src/StdMeshers/StdMeshers_Hexa_3D.hxx
new file mode 100644 (file)
index 0000000..a9e2045
--- /dev/null
@@ -0,0 +1,140 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Hexa_3D.hxx
+//           Moved here from SMESH_Hexa_3D.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_HEXA_3D_HXX_
+#define _SMESH_HEXA_3D_HXX_
+
+#include "SMESH_3D_Algo.hxx"
+#include "SMESH_Mesh.hxx"
+#include "StdMeshers_Quadrangle_2D.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+typedef struct point3Dstruct
+{
+       const SMDS_MeshNode * node;
+} Point3DStruct;
+
+typedef double Pt3[3];
+
+typedef struct conv2dstruct
+{
+  double a1; // X = a1*x + b1*y + c1 
+  double b1; // Y = a2*x + b2*y + c2
+  double c1; // a1, b1 a2, b2 in {-1,0,1}
+  double a2; // c1, c2 in {0,1}
+  double b2;
+  double c2;
+  int ia;    // I = ia*i + ib*j + ic
+  int ib;
+  int ic;
+  int ja;    // J = ja*i + jb*j + jc
+  int jb;
+  int jc;
+} Conv2DStruct;
+
+typedef struct cubeStruct
+{
+  TopoDS_Vertex V000;
+  TopoDS_Vertex V001;
+  TopoDS_Vertex V010;
+  TopoDS_Vertex V011;
+  TopoDS_Vertex V100;
+  TopoDS_Vertex V101;
+  TopoDS_Vertex V110;
+  TopoDS_Vertex V111;
+  faceQuadStruct* quad_X0;
+  faceQuadStruct* quad_X1;
+  faceQuadStruct* quad_Y0;
+  faceQuadStruct* quad_Y1;
+  faceQuadStruct* quad_Z0;
+  faceQuadStruct* quad_Z1;
+  Point3DStruct* np; // normalised 3D coordinates
+} CubeStruct;
+
+class StdMeshers_Hexa_3D:
+  public SMESH_3D_Algo
+{
+public:
+  StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_Hexa_3D();
+
+  virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+                               const TopoDS_Shape& aShape,
+                               SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+  virtual bool Compute(SMESH_Mesh& aMesh,
+                      const TopoDS_Shape& aShape)
+    throw (SALOME_Exception);
+
+  ostream & SaveTo(ostream & save);
+  istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_Hexa_3D & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_Hexa_3D & hyp);
+
+protected:
+  TopoDS_Edge
+  EdgeNotInFace(SMESH_Mesh& aMesh,
+               const TopoDS_Shape& aShape,
+               const TopoDS_Face& aFace,
+               const TopoDS_Vertex& aVertex,
+               const TopTools_IndexedDataMapOfShapeListOfShape& MS);
+
+  int GetFaceIndex(SMESH_Mesh& aMesh,
+                  const TopoDS_Shape& aShape,
+                  const vector<SMESH_subMesh*>& meshFaces,
+                  const TopoDS_Vertex& V0,
+                  const TopoDS_Vertex& V1,
+                  const TopoDS_Vertex& V2,
+                  const TopoDS_Vertex& V3);
+
+  void GetConv2DCoefs(const faceQuadStruct& quad,
+                     const TopoDS_Shape& aShape,
+                     const TopoDS_Vertex& V0,
+                     const TopoDS_Vertex& V1,
+                     const TopoDS_Vertex& V2,
+                     const TopoDS_Vertex& V3,
+                     Conv2DStruct& conv);
+
+  void GetPoint(Pt3 p,
+               int i, int j, int k,
+               int nbx, int nby, int nbz,
+               Point3DStruct *np,
+               const SMESHDS_Mesh* meshDS);
+
+  CubeStruct _cube;
+  FaceQuadStruct* _quads[6];
+  int _indX0;
+  int _indX1;
+  int _indY0;
+  int _indY1;
+  int _indZ0;
+  int _indZ1;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_LengthFromEdges.cxx b/src/StdMeshers/StdMeshers_LengthFromEdges.cxx
new file mode 100644 (file)
index 0000000..f21f199
--- /dev/null
@@ -0,0 +1,139 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LengthFromEdges.cxx
+//           Moved here from SMESH_LengthFromEdges.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_LengthFromEdges.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_LengthFromEdges::StdMeshers_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _mode =1;
+  _name = "LengthFromEdges";
+//   SCRUTE(_name);
+//   SCRUTE(&_name);
+  _param_algo_dim = 2; // is used by SMESH_MEFISTO_2D
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_LengthFromEdges::~StdMeshers_LengthFromEdges()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_LengthFromEdges::SetMode(int mode)
+  throw (SALOME_Exception)
+{
+  int oldMode = _mode;
+  if (mode <= 0) 
+    throw SALOME_Exception(LOCALIZED("mode must be positive"));
+  _mode = mode;
+  if (oldMode != _mode)
+    NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+int StdMeshers_LengthFromEdges::GetMode()
+{
+  return _mode;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_LengthFromEdges::SaveTo(ostream & save)
+{
+  save << this->_mode;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_LengthFromEdges::LoadFrom(istream & load)
+{
+  bool isOK = true;
+  int a;
+  isOK = (load >> a);
+  if (isOK) 
+    this->_mode = a;
+  else 
+    load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, StdMeshers_LengthFromEdges & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, StdMeshers_LengthFromEdges & hyp)
+{
+  return hyp.LoadFrom( load );
+}
+
diff --git a/src/StdMeshers/StdMeshers_LengthFromEdges.hxx b/src/StdMeshers/StdMeshers_LengthFromEdges.hxx
new file mode 100644 (file)
index 0000000..d514e7c
--- /dev/null
@@ -0,0 +1,57 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LengthFromEdges.hxx
+//           Moved here from SMESH_LengthFromEdges.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_LENGTHFROMEDGES_HXX_
+#define _SMESH_LENGTHFROMEDGES_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_LengthFromEdges:
+  public SMESH_Hypothesis
+{
+public:
+  StdMeshers_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_LengthFromEdges();
+
+  void SetMode(int mode)
+    throw (SALOME_Exception);
+
+  int GetMode();
+
+  virtual ostream & SaveTo(ostream & save);
+  virtual istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_LengthFromEdges & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_LengthFromEdges & hyp);
+
+protected:
+  int _mode;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_LocalLength.cxx b/src/StdMeshers/StdMeshers_LocalLength.cxx
new file mode 100644 (file)
index 0000000..457d8d8
--- /dev/null
@@ -0,0 +1,137 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LocalLength.cxx
+//           Moved here from SMESH_LocalLength.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_LocalLength.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_LocalLength::StdMeshers_LocalLength(int hypId, int studyId,
+       SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
+{
+       _length = 1.;
+       _name = "LocalLength";
+//   SCRUTE(_name);
+//   SCRUTE(&_name);
+        _param_algo_dim = 1; // is used by SMESH_Regular_1D
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_LocalLength::~StdMeshers_LocalLength()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_LocalLength::SetLength(double length) throw(SALOME_Exception)
+{
+       double oldLength = _length;
+       if (length <= 0)
+               throw SALOME_Exception(LOCALIZED("length must be positive"));
+       _length = length;
+       if (oldLength != _length)
+               NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double StdMeshers_LocalLength::GetLength() const
+{
+       return _length;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_LocalLength::SaveTo(ostream & save)
+{
+  save << this->_length;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_LocalLength::LoadFrom(istream & load)
+{
+  bool isOK = true;
+  double a;
+  isOK = (load >> a);
+  if (isOK)
+    this->_length = a;
+  else
+    load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_LocalLength & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_LocalLength & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_LocalLength.hxx b/src/StdMeshers/StdMeshers_LocalLength.hxx
new file mode 100644 (file)
index 0000000..aba58e5
--- /dev/null
@@ -0,0 +1,55 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LocalLength.hxx
+//           Moved here from SMESH_LocalLength.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_LOCALLENGTH_HXX_
+#define _SMESH_LOCALLENGTH_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_LocalLength:public SMESH_Hypothesis
+{
+  public:
+       StdMeshers_LocalLength(int hypId, int studyId, SMESH_Gen * gen);
+         virtual ~ StdMeshers_LocalLength();
+
+       void SetLength(double length) throw(SALOME_Exception);
+
+       double GetLength() const;
+
+       virtual ostream & SaveTo(ostream & save);
+       virtual istream & LoadFrom(istream & load);
+       friend ostream & operator <<(ostream & save, StdMeshers_LocalLength & hyp);
+       friend istream & operator >>(istream & load, StdMeshers_LocalLength & hyp);
+
+  protected:
+       double _length;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
new file mode 100644 (file)
index 0000000..6229e4c
--- /dev/null
@@ -0,0 +1,643 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MEFISTO_2D.cxx
+//           Moved here from SMESH_MEFISTO_2D.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_MEFISTO_2D.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Mesh.hxx"
+
+#include "StdMeshers_MaxElementArea.hxx"
+#include "StdMeshers_LengthFromEdges.hxx"
+
+#include "Rn.h"
+#include "aptrte.h"
+
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_FacePosition.hxx"
+
+#include "utilities.h"
+
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Geom_Surface.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <Geom2d_Curve.hxx>
+#include <gp_Pnt2d.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
+#include <BRepTools_WireExplorer.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <GCPnts_UniformAbscissa.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
+#include <string>
+#include <algorithm>
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, int studyId,
+       SMESH_Gen * gen):SMESH_2D_Algo(hypId, studyId, gen)
+{
+       MESSAGE("StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D");
+       _name = "MEFISTO_2D";
+//   _shapeType = TopAbs_FACE;
+       _shapeType = (1 << TopAbs_FACE);
+       _compatibleHypothesis.push_back("MaxElementArea");
+       _compatibleHypothesis.push_back("LengthFromEdges");
+
+       _edgeLength = 0;
+       _maxElementArea = 0;
+       _hypMaxElementArea = NULL;
+       _hypLengthFromEdges = NULL;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D()
+{
+       MESSAGE("StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_MEFISTO_2D::CheckHypothesis
+                         (SMESH_Mesh& aMesh,
+                          const TopoDS_Shape& aShape,
+                          SMESH_Hypothesis::Hypothesis_Status& aStatus)
+{
+       //MESSAGE("StdMeshers_MEFISTO_2D::CheckHypothesis");
+
+       _hypMaxElementArea = NULL;
+       _hypLengthFromEdges = NULL;
+
+       list <const SMESHDS_Hypothesis * >::const_iterator itl;
+       const SMESHDS_Hypothesis *theHyp;
+
+       const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+       int nbHyp = hyps.size();
+        if (!nbHyp)
+        {
+          aStatus = SMESH_Hypothesis::HYP_MISSING;
+          return false;  // can't work with no hypothesis
+        }
+
+       itl = hyps.begin();
+       theHyp = (*itl); // use only the first hypothesis
+
+       string hypName = theHyp->GetName();
+       int hypId = theHyp->GetID();
+       //SCRUTE(hypName);
+
+       bool isOk = false;
+
+       if (hypName == "MaxElementArea")
+       {
+               _hypMaxElementArea = static_cast<const StdMeshers_MaxElementArea *>(theHyp);
+               ASSERT(_hypMaxElementArea);
+               _maxElementArea = _hypMaxElementArea->GetMaxArea();
+               _edgeLength = 0;
+               isOk = true;
+                aStatus = SMESH_Hypothesis::HYP_OK;
+       }
+
+       else if (hypName == "LengthFromEdges")
+       {
+               _hypLengthFromEdges = static_cast<const StdMeshers_LengthFromEdges *>(theHyp);
+               ASSERT(_hypLengthFromEdges);
+               _edgeLength = 0;
+               _maxElementArea = 0;
+               isOk = true;
+                aStatus = SMESH_Hypothesis::HYP_OK;
+       }
+        else
+          aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
+
+       if (isOk)
+       {
+               isOk = false;
+               if (_maxElementArea > 0)
+               {
+                       _edgeLength = 2 * sqrt(_maxElementArea);        // triangles : minorant
+                       isOk = true;
+               }
+               else
+                       isOk = (_hypLengthFromEdges != NULL);   // **** check mode
+                if (!isOk)
+                  aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER;
+       }
+
+       //SCRUTE(_edgeLength);
+       //SCRUTE(_maxElementArea);
+       return isOk;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+{
+       MESSAGE("StdMeshers_MEFISTO_2D::Compute");
+
+       if (_hypLengthFromEdges)
+               _edgeLength = ComputeEdgeElementLength(aMesh, aShape);
+
+       bool isOk = false;
+       const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+       SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+       const TopoDS_Face & FF = TopoDS::Face(aShape);
+       bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+       TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+
+       Z nblf;                                         //nombre de lignes fermees (enveloppe en tete)
+       Z *nudslf = NULL;                       //numero du dernier sommet de chaque ligne fermee
+       R2 *uvslf = NULL;
+       Z nbpti = 0;                            //nombre points internes futurs sommets de la triangulation
+       R2 *uvpti = NULL;
+
+       Z nbst;
+       R2 *uvst = NULL;
+       Z nbt;
+       Z *nust = NULL;
+       Z ierr = 0;
+
+       Z nutysu = 1;                           // 1: il existe un fonction areteideale_()
+       // Z  nutysu=0;              // 0: on utilise aretmx
+       R aretmx = _edgeLength;         // longueur max aretes future triangulation
+       //SCRUTE(aretmx);
+
+       nblf = NumberOfWires(F);
+       //SCRUTE(nblf);
+
+       nudslf = new Z[1 + nblf];
+       nudslf[0] = 0;
+       int iw = 1;
+       int nbpnt = 0;
+
+       const TopoDS_Wire OW1 = BRepTools::OuterWire(F);
+       nbpnt += NumberOfPoints(aMesh, OW1);
+       nudslf[iw++] = nbpnt;
+       //SCRUTE(nbpnt);
+
+       for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
+       {
+               const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
+               if (!OW1.IsSame(W))
+               {
+                       nbpnt += NumberOfPoints(aMesh, W);
+                       nudslf[iw++] = nbpnt;
+                       //SCRUTE(nbpnt);
+               }
+       }
+
+       uvslf = new R2[nudslf[nblf]];
+       //SCRUTE(nudslf[nblf]);
+       int m = 0;
+
+       map<int, const SMDS_MeshNode*> mefistoToDS;     // correspondence mefisto index--> points IDNodes
+       TopoDS_Wire OW = BRepTools::OuterWire(F);
+       LoadPoints(aMesh, F, OW, uvslf, m, mefistoToDS);
+       //SCRUTE(m);
+
+       for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
+       {
+               const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
+               if (!OW.IsSame(W))
+               {
+                       LoadPoints(aMesh, F, W, uvslf, m, mefistoToDS);
+                       //SCRUTE(m);
+               }
+       }
+//   SCRUTE(nudslf[nblf]);
+//   for (int i=0; i<=nblf; i++)
+//     {
+//       MESSAGE(" -+- " <<i<< " "<< nudslf[i]);
+//     }
+//   for (int i=0; i<nudslf[nblf]; i++)
+//     {
+//       MESSAGE(" -+- " <<i<< " "<< uvslf[i]);
+//     }
+//   SCRUTE(nutysu);
+//   SCRUTE(aretmx);
+//   SCRUTE(nblf);
+
+       MESSAGE("MEFISTO triangulation ...");
+       uvst = NULL;
+       nust = NULL;
+       aptrte(nutysu, aretmx,
+               nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
+
+       if (ierr == 0)
+         {
+           MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
+           MESSAGE("                                    Node Number " << nbst);
+           //SCRUTE(nbst);
+           //SCRUTE(nbt);
+           StoreResult(aMesh, nbst, uvst, nbt, nust, F,
+                       faceIsForward, mefistoToDS);
+           isOk = true;
+         }
+       else
+       {
+               MESSAGE("Error in Triangulation");
+               isOk = false;
+       }
+       if (nudslf != NULL)
+               delete[]nudslf;
+       if (uvslf != NULL)
+               delete[]uvslf;
+       if (uvst != NULL)
+               delete[]uvst;
+       if (nust != NULL)
+               delete[]nust;
+       return isOk;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
+       const TopoDS_Face & FF,
+       const TopoDS_Wire & WW, R2 * uvslf, int &m,
+       map<int, const SMDS_MeshNode*>&mefistoToDS)
+{
+       MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints");
+
+       SMDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+       double scalex;
+       double scaley;
+       TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+       ComputeScaleOnFace(aMesh, F, scalex, scaley);
+
+       TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
+       BRepTools_WireExplorer wexp(W, F);
+       for (wexp.Init(W, F); wexp.More(); wexp.Next())
+       {
+               const TopoDS_Edge & E = wexp.Current();
+
+               // --- IDNodes of first and last Vertex
+
+               TopoDS_Vertex VFirst, VLast;
+               TopExp::Vertices(E, VFirst, VLast);     // corresponds to f and l
+
+           ASSERT(!VFirst.IsNull());
+               SMDS_NodeIteratorPtr lid=
+                  aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+               const SMDS_MeshNode* idFirst = lid->next();
+
+               ASSERT(!VLast.IsNull());
+               lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+               const SMDS_MeshNode* idLast = lid->next();
+
+               // --- edge internal IDNodes (relies on good order storage, not checked)
+
+               int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+               //SCRUTE(nbPoints);
+
+               double f, l;
+               Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+
+               SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
+
+               bool isForward = (E.Orientation() == TopAbs_FORWARD);
+               map<double, const SMDS_MeshNode*> params;
+
+               while(ite->more())
+               {
+                       const SMDS_MeshNode * node = ite->next();
+                       const SMDS_EdgePosition* epos =
+                          static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+                       double param = epos->GetUParameter();
+                       params[param] = node;
+               }
+               // --- load 2D values into MEFISTO structure,
+               //     add IDNodes in mefistoToDS map
+
+               if (E.Orientation() == TopAbs_FORWARD)
+               {
+                       gp_Pnt2d p = C2d->Value(f);     // first point = Vertex Forward
+                       uvslf[m].x = scalex * p.X();
+                       uvslf[m].y = scaley * p.Y();
+                       mefistoToDS[m + 1] = idFirst;
+                       //MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+                       //MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+                       m++;
+                       map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
+                       for (int i = 1; i <= nbPoints; i++)     // nbPoints internal
+                       {
+                               double param = (*itp).first;
+                               gp_Pnt2d p = C2d->Value(param);
+                               uvslf[m].x = scalex * p.X();
+                               uvslf[m].y = scaley * p.Y();
+                               mefistoToDS[m + 1] = (*itp).second;
+//        MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+//        MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+                               m++;
+                               itp++;
+                       }
+               }
+               else
+               {
+                       gp_Pnt2d p = C2d->Value(l);     // last point = Vertex Reversed
+                       uvslf[m].x = scalex * p.X();
+                       uvslf[m].y = scaley * p.Y();
+                       mefistoToDS[m + 1] = idLast;
+//    MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+//    MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+                       m++;
+                       map<double, const SMDS_MeshNode*>::reverse_iterator itp = params.rbegin();
+                       for (int i = nbPoints; i >= 1; i--)
+                       {
+                               double param = (*itp).first;
+                               gp_Pnt2d p = C2d->Value(param);
+                               uvslf[m].x = scalex * p.X();
+                               uvslf[m].y = scaley * p.Y();
+                               mefistoToDS[m + 1] = (*itp).second;
+//        MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
+//            MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
+                               m++;
+                               itp++;
+                       }
+               }
+       }
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+// **** a mettre dans SMESH_Algo ou SMESH_2D_Algo
+
+void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh,
+       const TopoDS_Face & aFace, double &scalex, double &scaley)
+{
+       //MESSAGE("StdMeshers_MEFISTO_2D::ComputeScaleOnFace");
+       TopoDS_Face F = TopoDS::Face(aFace.Oriented(TopAbs_FORWARD));
+       TopoDS_Wire W = BRepTools::OuterWire(F);
+
+       BRepTools_WireExplorer wexp(W, F);
+
+       double xmin = 1.e300;           // min & max of face 2D parametric coord.
+       double xmax = -1.e300;
+       double ymin = 1.e300;
+       double ymax = -1.e300;
+       int nbp = 50;
+       scalex = 1;
+       scaley = 1;
+       for (wexp.Init(W, F); wexp.More(); wexp.Next())
+       {
+               const TopoDS_Edge & E = wexp.Current();
+               double f, l;
+               Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+               for (int i = 0; i <= nbp; i++)
+               {
+                       double param = f + (double (i) / double (nbp))*(l - f);
+                       gp_Pnt2d p = C2d->Value(param);
+                       if (p.X() < xmin)
+                               xmin = p.X();
+                       if (p.X() > xmax)
+                               xmax = p.X();
+                       if (p.Y() < ymin)
+                               ymin = p.Y();
+                       if (p.Y() > ymax)
+                               ymax = p.Y();
+//    MESSAGE(" "<< f<<" "<<l<<" "<<param<<" "<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax);
+               }
+       }
+//   SCRUTE(xmin);
+//   SCRUTE(xmax);
+//   SCRUTE(ymin);
+//   SCRUTE(ymax);
+       double xmoy = (xmax + xmin) / 2.;
+       double ymoy = (ymax + ymin) / 2.;
+
+       Handle(Geom_Surface) S = BRep_Tool::Surface(F); // 3D surface
+
+       double length_x = 0;
+       double length_y = 0;
+       gp_Pnt PX0 = S->Value(xmin, ymoy);
+       gp_Pnt PY0 = S->Value(xmoy, ymin);
+       for (int i = 1; i <= nbp; i++)
+       {
+               double x = xmin + (double (i) / double (nbp))*(xmax - xmin);
+               gp_Pnt PX = S->Value(x, ymoy);
+               double y = ymin + (double (i) / double (nbp))*(ymax - ymin);
+               gp_Pnt PY = S->Value(xmoy, y);
+               length_x += PX.Distance(PX0);
+               length_y += PY.Distance(PY0);
+               PX0.SetCoord(PX.X(), PX.Y(), PX.Z());
+               PY0.SetCoord(PY.X(), PY.Y(), PY.Z());
+       }
+//   SCRUTE(length_x);
+//   SCRUTE(length_y);
+       scalex = length_x / (xmax - xmin);
+       scaley = length_y / (ymax - ymin);
+//   SCRUTE(scalex);
+//   SCRUTE(scaley);
+       ASSERT(scalex);
+       ASSERT(scaley);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
+       Z nbst, R2 * uvst, Z nbt, Z * nust,
+       const TopoDS_Face & F, bool faceIsForward,
+       map<int, const SMDS_MeshNode*>&mefistoToDS)
+{
+       double scalex;
+       double scaley;
+       ComputeScaleOnFace(aMesh, F, scalex, scaley);
+
+       SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+       Z n, m;
+       Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+
+       for (n = 0; n < nbst; n++)
+       {
+               double u = uvst[n][0] / scalex;
+               double v = uvst[n][1] / scaley;
+               gp_Pnt P = S->Value(u, v);
+
+               if (mefistoToDS.find(n + 1) == mefistoToDS.end())
+               {
+                       SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+                       meshDS->SetNodeOnFace(node, F);
+
+                       //MESSAGE(nodeId<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z());
+                       mefistoToDS[n + 1] = node;
+                       //MESSAGE(" "<<n<<" "<<mefistoToDS[n+1]);
+                       SMDS_FacePosition* fpos =
+                          static_cast<SMDS_FacePosition*>(node->GetPosition().get());
+                       fpos->SetUParameter(u);
+                       fpos->SetVParameter(v);
+               }
+       }
+
+       m = 0;
+       int mt = 0;
+
+       //SCRUTE(faceIsForward);
+       for (n = 1; n <= nbt; n++)
+       {
+               int inode1 = nust[m++];
+               int inode2 = nust[m++];
+               int inode3 = nust[m++];
+
+               const SMDS_MeshNode *n1, *n2, *n3;
+               n1 = mefistoToDS[inode1];
+               n2 = mefistoToDS[inode2];
+               n3 = mefistoToDS[inode3];
+               //MESSAGE("-- "<<inode1<<" "<<inode2<<" "<<inode3<<" ++ "<<nodeId1<<" "<<nodeId2<<" "<<nodeId3);
+
+               // triangle points must be in trigonometric order if face is Forward
+               // else they must be put clockwise
+
+               bool triangleIsWellOriented = faceIsForward;
+
+        SMDS_MeshElement * elt;
+               if (triangleIsWellOriented)
+                       elt = meshDS->AddFace(n1, n2, n3);
+               else
+                       elt = meshDS->AddFace(n1, n3, n2);
+       
+               meshDS->SetMeshElementOnShape(elt, F);
+               m++;
+       }
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape)
+{
+       MESSAGE("StdMeshers_MEFISTO_2D::ComputeEdgeElementLength");
+       // **** a mettre dans SMESH_2D_Algo ?
+
+       const TopoDS_Face & FF = TopoDS::Face(aShape);
+       bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+       TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+
+       double meanElementLength = 100;
+       double wireLength = 0;
+       int wireElementsNumber = 0;
+       for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
+       {
+               const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
+               for (TopExp_Explorer expe(W, TopAbs_EDGE); expe.More(); expe.Next())
+               {
+                       const TopoDS_Edge & E = TopoDS::Edge(expe.Current());
+                       int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+                       double length = EdgeLength(E);
+                       wireLength += length;
+                       wireElementsNumber += nb;
+               }
+       }
+       if (wireElementsNumber)
+               meanElementLength = wireLength / wireElementsNumber;
+       //SCRUTE(meanElementLength);
+       return meanElementLength;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_MEFISTO_2D::SaveTo(ostream & save)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_MEFISTO_2D::LoadFrom(istream & load)
+{
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_MEFISTO_2D & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_MEFISTO_2D & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx
new file mode 100644 (file)
index 0000000..38753d6
--- /dev/null
@@ -0,0 +1,88 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MEFISTO_2D.hxx
+//           Moved here from SMESH_MEFISTO_2D.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _StdMeshers_MEFISTO_2D_HXX_
+#define _StdMeshers_MEFISTO_2D_HXX_
+
+#include "SMESH_2D_Algo.hxx"
+#include "StdMeshers_MaxElementArea.hxx"
+#include "StdMeshers_LengthFromEdges.hxx"
+#include "Rn.h"
+
+class SMDS_MeshNode;
+#include <TopoDS_Face.hxx>
+#include <map>
+
+class StdMeshers_MEFISTO_2D:
+  public SMESH_2D_Algo
+{
+public:
+  StdMeshers_MEFISTO_2D(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_MEFISTO_2D();
+
+  virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+                               const TopoDS_Shape& aShape,
+                               SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+  virtual bool Compute(SMESH_Mesh& aMesh,
+                      const TopoDS_Shape& aShape);
+
+  double ComputeEdgeElementLength(SMESH_Mesh& aMesh,
+                                 const TopoDS_Shape& aShape);
+
+  void LoadPoints(SMESH_Mesh& aMesh,
+                 const TopoDS_Face& F, 
+                 const TopoDS_Wire& W,
+                 R2* uvslf, 
+                 int& m,
+                 map<int,const SMDS_MeshNode*>& mefistoToDS);
+
+  void ComputeScaleOnFace(SMESH_Mesh& aMesh,
+                         const TopoDS_Face& aFace,
+                         double& scalex,
+                         double& scaley);
+
+  void StoreResult (SMESH_Mesh& aMesh,
+                   Z nbst, R2* uvst, Z nbt, Z* nust, 
+                   const TopoDS_Face& F, bool faceIsForward,
+                   map<int,const SMDS_MeshNode*>& mefistoToDS);
+                                         
+  ostream & SaveTo(ostream & save);
+  istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_MEFISTO_2D & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_MEFISTO_2D & hyp);
+
+protected:
+  double _edgeLength;
+  double _maxElementArea;
+  const StdMeshers_MaxElementArea* _hypMaxElementArea;
+  const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_MaxElementArea.cxx b/src/StdMeshers/StdMeshers_MaxElementArea.cxx
new file mode 100644 (file)
index 0000000..c4a2d5e
--- /dev/null
@@ -0,0 +1,139 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementArea.cxx
+//           Moved here from SMESH_MaxElementArea.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_MaxElementArea.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_MaxElementArea::StdMeshers_MaxElementArea(int hypId, int studyId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _maxArea =1.;
+  _name = "MaxElementArea";
+//   SCRUTE(_name);
+//   SCRUTE(&_name);
+  _param_algo_dim = 2; 
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_MaxElementArea::~StdMeshers_MaxElementArea()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_MaxElementArea::SetMaxArea(double maxArea)
+  throw (SALOME_Exception)
+{
+  double oldArea = _maxArea;
+  if (maxArea <= 0) 
+    throw SALOME_Exception(LOCALIZED("maxArea must be positive"));
+  _maxArea = maxArea;
+  if (_maxArea != oldArea)
+    NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double StdMeshers_MaxElementArea::GetMaxArea() const
+{
+  return _maxArea;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_MaxElementArea::SaveTo(ostream & save)
+{
+  save << this->_maxArea;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_MaxElementArea::LoadFrom(istream & load)
+{
+  bool isOK = true;
+  double a;
+  isOK = (load >> a);
+  if (isOK) 
+    this->_maxArea = a;
+  else 
+    load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, StdMeshers_MaxElementArea & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, StdMeshers_MaxElementArea & hyp)
+{
+  return hyp.LoadFrom( load );
+}
+
diff --git a/src/StdMeshers/StdMeshers_MaxElementArea.hxx b/src/StdMeshers/StdMeshers_MaxElementArea.hxx
new file mode 100644 (file)
index 0000000..52af887
--- /dev/null
@@ -0,0 +1,55 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementArea.hxx
+//           Moved here from SMESH_MaxElementArea.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_MAXELEMENTAREA_HXX_
+#define _SMESH_MAXELEMENTAREA_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_MaxElementArea:public SMESH_Hypothesis
+{
+  public:
+       StdMeshers_MaxElementArea(int hypId, int studyId, SMESH_Gen * gen);
+         virtual ~ StdMeshers_MaxElementArea();
+
+       void SetMaxArea(double maxArea) throw(SALOME_Exception);
+
+       double GetMaxArea() const;
+
+       virtual ostream & SaveTo(ostream & save);
+       virtual istream & LoadFrom(istream & load);
+       friend ostream & operator <<(ostream & save, StdMeshers_MaxElementArea & hyp);
+       friend istream & operator >>(istream & load, StdMeshers_MaxElementArea & hyp);
+
+  protected:
+       double _maxArea;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_MaxElementVolume.cxx b/src/StdMeshers/StdMeshers_MaxElementVolume.cxx
new file mode 100644 (file)
index 0000000..f9f6b63
--- /dev/null
@@ -0,0 +1,141 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementVolume.cxx
+//           Moved here from SMESH_MaxElementVolume.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+
+#include "StdMeshers_MaxElementVolume.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_MaxElementVolume::StdMeshers_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _maxVolume =1.;
+  _name = "MaxElementVolume";
+//   SCRUTE(_name);
+  SCRUTE(&_name);
+  _param_algo_dim = 3;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_MaxElementVolume::~StdMeshers_MaxElementVolume()
+{
+  MESSAGE("StdMeshers_MaxElementVolume::~StdMeshers_MaxElementVolume");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_MaxElementVolume::SetMaxVolume(double maxVolume)
+  throw (SALOME_Exception)
+{
+  double oldVolume = _maxVolume;
+  if (maxVolume <= 0) 
+    throw SALOME_Exception(LOCALIZED("maxVolume must be positive"));
+  _maxVolume = maxVolume;
+  if (_maxVolume != oldVolume)
+    NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double StdMeshers_MaxElementVolume::GetMaxVolume() const
+{
+  return _maxVolume;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_MaxElementVolume::SaveTo(ostream & save)
+{
+  save << this->_maxVolume;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_MaxElementVolume::LoadFrom(istream & load)
+{
+  bool isOK = true;
+  double a;
+  isOK = (load >> a);
+  if (isOK)
+    this->_maxVolume = a;
+  else 
+    load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, StdMeshers_MaxElementVolume & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, StdMeshers_MaxElementVolume & hyp)
+{
+  return hyp.LoadFrom( load );
+}
+
diff --git a/src/StdMeshers/StdMeshers_MaxElementVolume.hxx b/src/StdMeshers/StdMeshers_MaxElementVolume.hxx
new file mode 100644 (file)
index 0000000..ee9986f
--- /dev/null
@@ -0,0 +1,57 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementVolume.hxx
+//           Moved here from SMESH_MaxElementVolume.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_MAXELEMENTVOLUME_HXX_
+#define _SMESH_MAXELEMENTVOLUME_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_MaxElementVolume:
+  public SMESH_Hypothesis
+{
+public:
+  StdMeshers_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_MaxElementVolume();
+
+  void SetMaxVolume(double maxVolume)
+    throw (SALOME_Exception);
+
+  double GetMaxVolume() const;
+
+  virtual ostream & SaveTo(ostream & save);
+  virtual istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_MaxElementVolume & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_MaxElementVolume & hyp);
+
+protected:
+  double _maxVolume;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_NotConformAllowed.cxx b/src/StdMeshers/StdMeshers_NotConformAllowed.cxx
new file mode 100644 (file)
index 0000000..5c471b2
--- /dev/null
@@ -0,0 +1,98 @@
+//  SMESH StdMeshers : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NotConformAllowed.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_NotConformAllowed.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_NotConformAllowed::StdMeshers_NotConformAllowed(int hypId, int studyId, SMESH_Gen* gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _name = "NotConformAllowed";
+  _param_algo_dim = -1; 
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_NotConformAllowed::~StdMeshers_NotConformAllowed()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_NotConformAllowed::SaveTo(ostream & save)
+{
+  return save << this;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_NotConformAllowed::LoadFrom(istream & load)
+{
+  return load >> (*this);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator << (ostream & save, StdMeshers_NotConformAllowed & hyp)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >> (istream & load, StdMeshers_NotConformAllowed & hyp)
+{
+  return load;
+}
diff --git a/src/StdMeshers/StdMeshers_NotConformAllowed.hxx b/src/StdMeshers/StdMeshers_NotConformAllowed.hxx
new file mode 100644 (file)
index 0000000..0797424
--- /dev/null
@@ -0,0 +1,48 @@
+//  SMESH StdMeshers : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NotConformAllowed.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _StdMeshers_NotConformAllowed_HXX_
+#define _StdMeshers_NotConformAllowed_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_NotConformAllowed:
+  public SMESH_Hypothesis
+{
+public:
+  StdMeshers_NotConformAllowed(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_NotConformAllowed();
+
+  virtual ostream & SaveTo(ostream & save);
+  virtual istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_NotConformAllowed & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_NotConformAllowed & hyp);
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx
new file mode 100644 (file)
index 0000000..c16c137
--- /dev/null
@@ -0,0 +1,171 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NumberOfSegments.cxx
+//           Moved here from SMESH_NumberOfSegments.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_NumberOfSegments.hxx"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_NumberOfSegments::StdMeshers_NumberOfSegments(int hypId, int studyId,
+       SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
+{
+       _numberOfSegments = 1;
+       _scaleFactor = 1.0;
+       _name = "NumberOfSegments";
+        _param_algo_dim = 1; 
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_NumberOfSegments::~StdMeshers_NumberOfSegments()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
+throw(SALOME_Exception)
+{
+       int oldNumberOfSegments = _numberOfSegments;
+       if (segmentsNumber <= 0)
+               throw
+                       SALOME_Exception(LOCALIZED("number of segments must be positive"));
+       _numberOfSegments = segmentsNumber;
+
+       if (oldNumberOfSegments != _numberOfSegments)
+               NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+int StdMeshers_NumberOfSegments::GetNumberOfSegments() const
+{
+       return _numberOfSegments;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
+throw(SALOME_Exception)
+{
+       if (scaleFactor < 0)
+               throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
+       _scaleFactor = scaleFactor;
+
+       NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+double StdMeshers_NumberOfSegments::GetScaleFactor() const
+{
+       return _scaleFactor;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
+{
+  save << this->_numberOfSegments << " " << this->_scaleFactor;
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load)
+{
+  bool isOK = true;
+  int a;
+  isOK = (load >> a);
+  if (isOK)
+    this->_numberOfSegments = a;
+  else
+    load.clear(ios::badbit | load.rdstate());
+  double b;
+  isOK = (load >> b);
+  if (isOK)
+    this->_scaleFactor = b;
+  else
+    load.clear(ios::badbit | load.rdstate());
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_NumberOfSegments & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_NumberOfSegments & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.hxx b/src/StdMeshers/StdMeshers_NumberOfSegments.hxx
new file mode 100644 (file)
index 0000000..79147e1
--- /dev/null
@@ -0,0 +1,63 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NumberOfSegments.hxx
+//           Moved here from SMESH_NumberOfSegments.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_NUMBEROFSEGMENTS_HXX_
+#define _SMESH_NUMBEROFSEGMENTS_HXX_
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class StdMeshers_NumberOfSegments:
+  public SMESH_Hypothesis
+{
+public:
+  StdMeshers_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_NumberOfSegments();
+
+  void SetNumberOfSegments(int segmentsNumber)
+    throw (SALOME_Exception);
+
+  int GetNumberOfSegments() const;
+
+  void SetScaleFactor(double scaleFactor)
+    throw (SALOME_Exception);
+
+  double GetScaleFactor() const;
+
+  virtual ostream & SaveTo(ostream & save);
+  virtual istream & LoadFrom(istream & load);
+  friend ostream& operator << (ostream & save, StdMeshers_NumberOfSegments & hyp);
+  friend istream& operator >> (istream & load, StdMeshers_NumberOfSegments & hyp);
+
+protected:
+  int _numberOfSegments;
+  double _scaleFactor;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
new file mode 100644 (file)
index 0000000..1481590
--- /dev/null
@@ -0,0 +1,644 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Quadrangle_2D.cxx
+//           Moved here from SMESH_Quadrangle_2D.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_Quadrangle_2D.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Mesh.hxx"
+
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_FacePosition.hxx"
+
+#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
+#include <BRepTools_WireExplorer.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Handle_Geom2d_Curve.hxx>
+#include <Handle_Geom_Curve.hxx>
+#include <gp_Pnt2d.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
+#include "utilities.h"
+#include "Utils_ExceptHandlers.hxx"
+
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D(int hypId,
+       int studyId, SMESH_Gen * gen):SMESH_2D_Algo(hypId, studyId, gen)
+{
+       MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
+       _name = "Quadrangle_2D";
+       //  _shapeType = TopAbs_FACE;
+       _shapeType = (1 << TopAbs_FACE);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D()
+{
+       MESSAGE("StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D");
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_Quadrangle_2D::CheckHypothesis
+                         (SMESH_Mesh& aMesh,
+                          const TopoDS_Shape& aShape,
+                          SMESH_Hypothesis::Hypothesis_Status& aStatus)
+{
+       //MESSAGE("StdMeshers_Quadrangle_2D::CheckHypothesis");
+
+       bool isOk = true;
+        aStatus = SMESH_Hypothesis::HYP_OK;
+
+       // nothing to check
+
+       return isOk;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_Quadrangle_2D::Compute(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape)throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+       //MESSAGE("StdMeshers_Quadrangle_2D::Compute");
+       SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+       SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+       FaceQuadStruct *quad = CheckAnd2Dcompute(aMesh, aShape);
+       if (!quad)
+               return false;
+
+       // --- compute 3D values on points, store points & quadrangles
+
+       int nbdown = quad->nbPts[0];
+       int nbright = quad->nbPts[1];
+       int nbVertices = nbdown * nbright;
+       int nbQuad = (nbdown - 1) * (nbright - 1);
+       //SCRUTE(nbVertices);
+       //SCRUTE(nbQuad);
+
+       //   const TopoDS_Face& FF = TopoDS::Face(aShape);
+       //   bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+       //   TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+       const TopoDS_Face & F = TopoDS::Face(aShape);
+       bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
+       Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+
+       for (int i = 1; i < nbdown - 1; i++)
+               for (int j = 1; j < nbright - 1; j++)   // internal points
+               {
+                       int ij = j * nbdown + i;
+                       double u = quad->uv_grid[ij].u;
+                       double v = quad->uv_grid[ij].v;
+                       gp_Pnt P = S->Value(u, v);
+                       SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+                       meshDS->SetNodeOnFace(node, F);
+                       quad->uv_grid[ij].node = node;
+//  Handle (SMDS_FacePosition) fpos
+//    = new SMDS_FacePosition(theSubMesh->GetId(),i,j); // easier than u,v
+//  node->SetPosition(fpos);
+                       SMDS_FacePosition* fpos =
+                          dynamic_cast<SMDS_FacePosition*>(node->GetPosition().get());
+                       fpos->SetUParameter(i);
+                       fpos->SetVParameter(j);
+               }
+
+       //   bool isQuadForward = ( faceIsForward == quad->isEdgeForward[0]);
+       for (int i = 0; i < nbdown - 1; i++)
+               for (int j = 0; j < nbright - 1; j++)   // faces
+               {
+                       const SMDS_MeshNode *a, *b, *c, *d;
+                       a = quad->uv_grid[j * nbdown + i].node;
+                       b = quad->uv_grid[j * nbdown + i + 1].node;
+                       c = quad->uv_grid[(j + 1) * nbdown + i + 1].node;
+                       d = quad->uv_grid[(j + 1) * nbdown + i].node;
+                       //  if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d);
+                       //  else faceId = meshDS->AddFace(a,d,c,b);
+                       SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
+                       meshDS->SetMeshElementOnShape(face, F);
+               }
+
+       QuadDelete(quad);
+       bool isOk = true;
+       return isOk;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape)throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+       //MESSAGE("StdMeshers_Quadrangle_2D::ComputeWithoutStore");
+
+       SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+       //   const TopoDS_Face& FF = TopoDS::Face(aShape);
+       //   bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
+       //   TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
+       const TopoDS_Face & F = TopoDS::Face(aShape);
+       bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
+
+       // verify 1 wire only, with 4 edges, same number of points on opposite edges
+
+       if (NumberOfWires(F) != 1)
+       {
+               MESSAGE("only 1 wire by face (quadrangles)");
+               return 0;
+               //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)"));
+       }
+       //   const TopoDS_Wire WW = BRepTools::OuterWire(F);
+       //   TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
+       const TopoDS_Wire & W = BRepTools::OuterWire(F);
+       BRepTools_WireExplorer wexp(W, F);
+
+       FaceQuadStruct *quad = new FaceQuadStruct;
+       for (int i = 0; i < 4; i++)
+               quad->uv_edges[i] = 0;
+       quad->uv_grid = 0;
+
+       int nbEdges = 0;
+       for (wexp.Init(W, F); wexp.More(); wexp.Next())
+       {
+               //       const TopoDS_Edge& EE = wexp.Current();
+               //       TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
+               const TopoDS_Edge & E = wexp.Current();
+               int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+               if (nbEdges < 4)
+               {
+                       quad->edge[nbEdges] = E;
+                       quad->nbPts[nbEdges] = nb + 2;  // internal points + 2 extrema
+               }
+               nbEdges++;
+       }
+
+       if (nbEdges != 4)
+       {
+               MESSAGE("face must have 4 edges /quadrangles");
+               QuadDelete(quad);
+               return 0;
+               //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles"));
+       }
+
+       if (quad->nbPts[0] != quad->nbPts[2])
+       {
+               MESSAGE("different point number-opposed edge");
+               QuadDelete(quad);
+               return 0;
+               //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
+       }
+
+       if (quad->nbPts[1] != quad->nbPts[3])
+       {
+               MESSAGE("different point number-opposed edge");
+               QuadDelete(quad);
+               return 0;
+               //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
+       }
+
+       // set normalized grid on unit square in parametric domain
+
+       SetNormalizedGrid(aMesh, F, quad);
+
+       return quad;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_Quadrangle_2D::QuadDelete(FaceQuadStruct * quad)
+{
+       //MESSAGE("StdMeshers_Quadrangle_2D::QuadDelete");
+       if (quad)
+       {
+               for (int i = 0; i < 4; i++)
+               {
+                       if (quad->uv_edges[i])
+                               delete[]quad->uv_edges[i];
+                       quad->edge[i].Nullify();
+               }
+               if (quad->uv_grid)
+                       delete[]quad->uv_grid;
+               delete quad;
+       }
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_Quadrangle_2D::SetNormalizedGrid(SMESH_Mesh & aMesh,
+       const TopoDS_Shape & aShape, FaceQuadStruct * quad) throw(SALOME_Exception)
+{
+  Unexpect aCatch(SalomeException);
+       // Algorithme décrit dans "Génération automatique de maillages"
+       // P.L. GEORGE, MASSON, Â§ 6.4.1 p. 84-85
+       // traitement dans le domaine paramétrique 2d u,v
+       // transport - projection sur le carré unité
+
+       const TopoDS_Face & F = TopoDS::Face(aShape);
+
+       // 1 --- find orientation of the 4 edges, by test on extrema
+
+       //      max             min                    0     x1     1
+       //     |<----north-2-------^                a3 -------------> a2
+       //     |                   |                   ^1          1^
+       //    west-3            east-1 =right          |            |
+       //     |                   |         ==>       |            |
+       //  y0 |                   | y1                |            |
+       //     |                   |                   |0          0|
+       //     v----south-0-------->                a0 -------------> a1
+       //      min             max                    0     x0     1
+       //             =down
+       //
+
+       Handle(Geom2d_Curve) c2d[4];
+       gp_Pnt2d pf[4];
+       gp_Pnt2d pl[4];
+       for (int i = 0; i < 4; i++)
+       {
+               c2d[i] = BRep_Tool::CurveOnSurface(quad->edge[i],
+                       F, quad->first[i], quad->last[i]);
+               pf[i] = c2d[i]->Value(quad->first[i]);
+               pl[i] = c2d[i]->Value(quad->last[i]);
+               quad->isEdgeForward[i] = false;
+       }
+
+       double eps2d = 1.e-3;           // *** utiliser plutot TopExp::CommonVertex, puis
+       // distances si piece fausse
+       int i = 0;
+       if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d))
+       {
+               quad->isEdgeForward[0] = true;
+       }
+       else
+       {
+               double tmp = quad->first[0];
+               quad->first[0] = quad->last[0];
+               quad->last[0] = tmp;
+               pf[0] = c2d[0]->Value(quad->first[0]);
+               pl[0] = c2d[0]->Value(quad->last[0]);
+       }
+       for (int i = 1; i < 4; i++)
+       {
+               quad->isEdgeForward[i] = (pf[i].Distance(pl[i - 1]) < eps2d);
+               if (!quad->isEdgeForward[i])
+               {
+                       double tmp = quad->first[i];
+                       quad->first[i] = quad->last[i];
+                       quad->last[i] = tmp;
+                       pf[i] = c2d[i]->Value(quad->first[i]);
+                       pl[i] = c2d[i]->Value(quad->last[i]);
+                       //SCRUTE(pf[i].Distance(pl[i-1]));
+                       ASSERT(pf[i].Distance(pl[i - 1]) < eps2d);
+               }
+       }
+       //SCRUTE(pf[0].Distance(pl[3]));
+       ASSERT(pf[0].Distance(pl[3]) < eps2d);
+
+//   for (int i=0; i<4; i++)
+//     {
+//       SCRUTE(quad->isEdgeForward[i]);
+//       MESSAGE(" -first "<<i<<" "<<pf[i].X()<<" "<<pf[i].Y());
+//       MESSAGE(" -last  "<<i<<" "<<pl[i].X()<<" "<<pl[i].Y());
+//     }
+
+       // 2 --- load 2d edge points (u,v) with orientation and value on unit square
+
+       for (int i = 0; i < 2; i++)
+       {
+               quad->uv_edges[i] = LoadEdgePoints(aMesh, F,
+                       quad->edge[i], quad->first[i], quad->last[i]);
+
+               //                         quad->isEdgeForward[i]);
+       }
+       for (int i = 2; i < 4; i++)
+       {
+               quad->uv_edges[i] = LoadEdgePoints(aMesh, F,
+                       quad->edge[i], quad->last[i], quad->first[i]);
+
+               //                         !quad->isEdgeForward[i]);
+       }
+
+       // 3 --- 2D normalized values on unit square [0..1][0..1]
+
+       int nbdown = quad->nbPts[0];
+       int nbright = quad->nbPts[1];
+       quad->uv_grid = new UVPtStruct[nbright * nbdown];
+
+       UVPtStruct *uv_grid = quad->uv_grid;
+       UVPtStruct *uv_e0 = quad->uv_edges[0];
+       UVPtStruct *uv_e1 = quad->uv_edges[1];
+       UVPtStruct *uv_e2 = quad->uv_edges[2];
+       UVPtStruct *uv_e3 = quad->uv_edges[3];
+       gp_Pnt2d a0 = pf[0];
+       gp_Pnt2d a1 = pf[1];
+       gp_Pnt2d a2 = pf[2];
+       gp_Pnt2d a3 = pf[3];
+
+       // nodes Id on edges
+
+       int j = 0;
+       for (int i = 0; i < nbdown; i++)
+       {
+               int ij = j * nbdown + i;
+               uv_grid[ij].node = uv_e0[i].node;
+       }
+       i = nbdown - 1;
+       for (int j = 0; j < nbright; j++)
+       {
+               int ij = j * nbdown + i;
+               uv_grid[ij].node = uv_e1[j].node;
+       }
+       j = nbright - 1;
+       for (int i = 0; i < nbdown; i++)
+       {
+               int ij = j * nbdown + i;
+               uv_grid[ij].node = uv_e2[i].node;
+       }
+       i = 0;
+       for (int j = 0; j < nbright; j++)
+       {
+               int ij = j * nbdown + i;
+               uv_grid[ij].node = uv_e3[j].node;
+       }
+
+       // normalized 2d values on grid
+
+       for (int i = 0; i < nbdown; i++)
+               for (int j = 0; j < nbright; j++)
+               {
+                       int ij = j * nbdown + i;
+                       // --- droite i cste : x = x0 + y(x1-x0)
+                       double x0 = uv_e0[i].normParam; // bas - sud
+                       double x1 = uv_e2[i].normParam; // haut - nord
+                       // --- droite j cste : y = y0 + x(y1-y0)
+                       double y0 = uv_e3[j].normParam; // gauche-ouest
+                       double y1 = uv_e1[j].normParam; // droite - est
+                       // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
+                       double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
+                       double y = y0 + x * (y1 - y0);
+                       uv_grid[ij].x = x;
+                       uv_grid[ij].y = y;
+                       //MESSAGE("-xy-01 "<<x0<<" "<<x1<<" "<<y0<<" "<<y1);
+                       //MESSAGE("-xy-norm "<<i<<" "<<j<<" "<<x<<" "<<y);
+               }
+
+       // 4 --- projection on 2d domain (u,v)
+
+       for (int i = 0; i < nbdown; i++)
+               for (int j = 0; j < nbright; j++)
+               {
+                       int ij = j * nbdown + i;
+                       double x = uv_grid[ij].x;
+                       double y = uv_grid[ij].y;
+                       double param_0 = uv_e0[0].param + x * (uv_e0[nbdown - 1].param - uv_e0[0].param);       // sud
+                       double param_2 = uv_e2[0].param + x * (uv_e2[nbdown - 1].param - uv_e2[0].param);       // nord
+                       double param_1 = uv_e1[0].param + y * (uv_e1[nbright - 1].param - uv_e1[0].param);      // est
+                       double param_3 = uv_e3[0].param + y * (uv_e3[nbright - 1].param - uv_e3[0].param);      // ouest
+
+                       //MESSAGE("params "<<param_0<<" "<<param_1<<" "<<param_2<<" "<<param_3);
+                       gp_Pnt2d p0 = c2d[0]->Value(param_0);
+                       gp_Pnt2d p1 = c2d[1]->Value(param_1);
+                       gp_Pnt2d p2 = c2d[2]->Value(param_2);
+                       gp_Pnt2d p3 = c2d[3]->Value(param_3);
+
+                       double u =
+                               (1 - y) * p0.X() + x * p1.X() + y * p2.X() + (1 - x) * p3.X();
+                       double v =
+                               (1 - y) * p0.Y() + x * p1.Y() + y * p2.Y() + (1 - x) * p3.Y();
+
+                       u -= (1 - x) * (1 - y) * a0.X() + x * (1 - y) * a1.X() +
+                               x * y * a2.X() + (1 - x) * y * a3.X();
+                       v -= (1 - x) * (1 - y) * a0.Y() + x * (1 - y) * a1.Y() +
+                               x * y * a2.Y() + (1 - x) * y * a3.Y();
+
+                       uv_grid[ij].u = u;
+                       uv_grid[ij].v = v;
+
+                       //MESSAGE("-uv- "<<i<<" "<<j<<" "<<uv_grid[ij].u<<" "<<uv_grid[ij].v);
+               }
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+UVPtStruct *StdMeshers_Quadrangle_2D::LoadEdgePoints(SMESH_Mesh & aMesh,
+       const TopoDS_Face & F, const TopoDS_Edge & E, double first, double last)
+  //                        bool isForward)
+{
+       //MESSAGE("StdMeshers_Quadrangle_2D::LoadEdgePoints");
+
+       SMDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+       // --- IDNodes of first and last Vertex
+
+       TopoDS_Vertex VFirst, VLast;
+       TopExp::Vertices(E, VFirst, VLast);     // corresponds to f and l
+
+    ASSERT(!VFirst.IsNull());
+    SMDS_NodeIteratorPtr lid= aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+    const SMDS_MeshNode * idFirst = lid->next();
+
+    ASSERT(!VLast.IsNull());
+    lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+    const SMDS_MeshNode * idLast = lid->next();
+
+       // --- edge internal IDNodes (relies on good order storage, not checked)
+
+       int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
+       //SCRUTE(nbPoints);
+       UVPtStruct *uvslf = new UVPtStruct[nbPoints + 2];
+
+       double f, l;
+       Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+
+       map<double, const SMDS_MeshNode *> params;
+       SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
+
+       while(ite->more())
+       {
+               const SMDS_MeshNode * node = ite->next();
+               const SMDS_EdgePosition* epos =
+                  static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+               double param = epos->GetUParameter();
+               params[param] = node;
+       }
+
+       bool isForward = (((l - f) * (last - first)) > 0);
+       double paramin = 0;
+       double paramax = 0;
+       if (isForward)
+       {
+               paramin = f;
+               paramax = l;
+               gp_Pnt2d p = C2d->Value(f);     // first point = Vertex Forward
+               uvslf[0].x = p.X();
+               uvslf[0].y = p.Y();
+               uvslf[0].param = f;
+               uvslf[0].node = idFirst;
+               //MESSAGE("__ f "<<f<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
+               map < double, const SMDS_MeshNode* >::iterator itp = params.begin();
+               for (int i = 1; i <= nbPoints; i++)     // nbPoints internal
+               {
+                       double param = (*itp).first;
+                       gp_Pnt2d p = C2d->Value(param);
+                       uvslf[i].x = p.X();
+                       uvslf[i].y = p.Y();
+                       uvslf[i].param = param;
+                       uvslf[i].node = (*itp).second;
+                       //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
+                       itp++;
+               }
+               p = C2d->Value(l);              // last point = Vertex Reversed
+               uvslf[nbPoints + 1].x = p.X();
+               uvslf[nbPoints + 1].y = p.Y();
+               uvslf[nbPoints + 1].param = l;
+               uvslf[nbPoints + 1].node = idLast;
+               //MESSAGE("__ l "<<l<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
+       }
+       else
+       {
+               paramin = l;
+               paramax = f;
+               gp_Pnt2d p = C2d->Value(l);     // first point = Vertex Reversed
+               uvslf[0].x = p.X();
+               uvslf[0].y = p.Y();
+               uvslf[0].param = l;
+               uvslf[0].node = idLast;
+               //MESSAGE("__ l "<<l<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
+               map < double, const SMDS_MeshNode* >::reverse_iterator itp = params.rbegin();
+               for (int j = nbPoints; j >= 1; j--)     // nbPoints internal
+               {
+                       double param = (*itp).first;
+                       int i = nbPoints + 1 - j;
+                       gp_Pnt2d p = C2d->Value(param);
+                       uvslf[i].x = p.X();
+                       uvslf[i].y = p.Y();
+                       uvslf[i].param = param;
+                       uvslf[i].node = (*itp).second;
+                       //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
+                       itp++;
+               }
+               p = C2d->Value(f);              // last point = Vertex Forward
+               uvslf[nbPoints + 1].x = p.X();
+               uvslf[nbPoints + 1].y = p.Y();
+               uvslf[nbPoints + 1].param = f;
+               uvslf[nbPoints + 1].node = idFirst;
+               //MESSAGE("__ f "<<f<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
+       }
+
+       ASSERT(paramin != paramax);
+       for (int i = 0; i < nbPoints + 2; i++)
+       {
+               uvslf[i].normParam = (uvslf[i].param - paramin) / (paramax - paramin);
+               //SCRUTE(uvslf[i].normParam);
+       }
+
+       return uvslf;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_Quadrangle_2D::SaveTo(ostream & save)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_Quadrangle_2D::LoadFrom(istream & load)
+{
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_Quadrangle_2D & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_Quadrangle_2D & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx
new file mode 100644 (file)
index 0000000..afa3882
--- /dev/null
@@ -0,0 +1,102 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Quadrangle_2D.hxx
+//           Moved here from SMESH_Quadrangle_2D.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_QUADRANGLE_2D_HXX_
+#define _SMESH_QUADRANGLE_2D_HXX_
+
+#include "SMESH_2D_Algo.hxx"
+#include "SMESH_Mesh.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+typedef struct uvPtStruct
+{
+  double param;
+  double normParam;
+  double u; // original 2d parameter
+  double v;
+  double x; // 2d parameter, normalized [0,1]
+  double y; 
+       const SMDS_MeshNode * node;
+} UVPtStruct;
+
+typedef struct faceQuadStruct
+{
+  int nbPts[4];
+  TopoDS_Edge edge[4];
+  double first[4];
+  double last[4];
+  bool isEdgeForward[4];
+  UVPtStruct* uv_edges[4];
+  UVPtStruct* uv_grid;
+} FaceQuadStruct;
+
+class StdMeshers_Quadrangle_2D:
+  public SMESH_2D_Algo
+{
+public:
+  StdMeshers_Quadrangle_2D(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_Quadrangle_2D();
+
+  virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+                               const TopoDS_Shape& aShape,
+                               SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+  virtual bool Compute(SMESH_Mesh& aMesh,
+                      const TopoDS_Shape& aShape)
+    throw (SALOME_Exception);
+
+  FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
+                                   const TopoDS_Shape& aShape)
+    throw (SALOME_Exception);
+
+  void QuadDelete(FaceQuadStruct* quad);
+
+  ostream & SaveTo(ostream & save);
+  istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_Quadrangle_2D & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_Quadrangle_2D & hyp);
+
+protected:
+
+  void SetNormalizedGrid(SMESH_Mesh& aMesh,
+                        const TopoDS_Shape& aShape,
+                        FaceQuadStruct* quad)
+    throw (SALOME_Exception);
+
+  UVPtStruct* LoadEdgePoints(SMESH_Mesh& aMesh,
+                            const TopoDS_Face& F,
+                            const TopoDS_Edge& E,
+                            double first,
+                            double last);
+//                          bool isForward);
+
+//   FaceQuadStruct _quadDesc;
+};
+
+#endif
diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx
new file mode 100644 (file)
index 0000000..aa069ff
--- /dev/null
@@ -0,0 +1,331 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Regular_1D.cxx
+//           Moved here from SMESH_Regular_1D.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+
+#include "StdMeshers_Regular_1D.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_Mesh.hxx"
+
+#include "StdMeshers_LocalLength.hxx"
+#include "StdMeshers_NumberOfSegments.hxx"
+
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMDS_EdgePosition.hxx"
+
+#include "utilities.h"
+
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <BRep_Tool.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <GCPnts_UniformAbscissa.hxx>
+
+#include <string>
+#include <algorithm>
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
+       SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen)
+{
+       MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D");
+       _name = "Regular_1D";
+       //  _shapeType = TopAbs_EDGE;
+       _shapeType = (1 << TopAbs_EDGE);
+       _compatibleHypothesis.push_back("LocalLength");
+       _compatibleHypothesis.push_back("NumberOfSegments");
+
+       _localLength = 0;
+       _numberOfSegments = 0;
+       _hypLocalLength = NULL;
+       _hypNumberOfSegments = NULL;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Regular_1D::~StdMeshers_Regular_1D()
+{
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_Regular_1D::CheckHypothesis
+                         (SMESH_Mesh& aMesh,
+                          const TopoDS_Shape& aShape,
+                          SMESH_Hypothesis::Hypothesis_Status& aStatus)
+{
+       //MESSAGE("StdMeshers_Regular_1D::CheckHypothesis");
+
+       list <const SMESHDS_Hypothesis * >::const_iterator itl;
+       const SMESHDS_Hypothesis *theHyp;
+
+       const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+       int nbHyp = hyps.size();
+        if (!nbHyp)
+        {
+          aStatus = SMESH_Hypothesis::HYP_MISSING;
+          return false;  // can't work with no hypothesis
+        }
+
+       itl = hyps.begin();
+       theHyp = (*itl); // use only the first hypothesis
+
+       string hypName = theHyp->GetName();
+       int hypId = theHyp->GetID();
+       //SCRUTE(hypName);
+
+       bool isOk = false;
+
+       if (hypName == "LocalLength")
+       {
+               _hypLocalLength = dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
+               ASSERT(_hypLocalLength);
+               _localLength = _hypLocalLength->GetLength();
+               _numberOfSegments = 0;
+               isOk = true;
+                aStatus = SMESH_Hypothesis::HYP_OK;
+       }
+
+       else if (hypName == "NumberOfSegments")
+       {
+               _hypNumberOfSegments =
+                       dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp);
+               ASSERT(_hypNumberOfSegments);
+               _numberOfSegments = _hypNumberOfSegments->GetNumberOfSegments();
+               _scaleFactor = _hypNumberOfSegments->GetScaleFactor();
+               _localLength = 0;
+               isOk = true;
+                aStatus = SMESH_Hypothesis::HYP_OK;
+       }
+        else
+          aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
+
+       //SCRUTE(_localLength);
+       //SCRUTE(_numberOfSegments);
+
+       return isOk;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+{
+       MESSAGE("StdMeshers_Regular_1D::Compute");
+
+       SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+       SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
+
+       const TopoDS_Edge & EE = TopoDS::Edge(aShape);
+       TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
+
+       double f, l;
+       Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
+
+       TopoDS_Vertex VFirst, VLast;
+       TopExp::Vertices(E, VFirst, VLast);     // Vfirst corresponds to f and Vlast to l
+
+       double length = EdgeLength(E);
+       //SCRUTE(length);
+
+       double eltSize = 1;
+//   if (_localLength > 0) eltSize = _localLength;
+       if (_localLength > 0)
+       {
+               double nbseg = ceil(length / _localLength);     // integer sup
+               if (nbseg <= 0)
+                       nbseg = 1;                      // degenerated edge
+               eltSize = length / nbseg;
+       }
+       else
+       {
+               ASSERT(_numberOfSegments > 0);
+               eltSize = length / _numberOfSegments;
+       }
+
+       ASSERT(!VFirst.IsNull());
+       SMDS_NodeIteratorPtr lid= aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
+       const SMDS_MeshNode * idFirst = lid->next();
+
+       ASSERT(!VLast.IsNull());
+       lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
+       const SMDS_MeshNode * idLast = lid->next();
+
+       if (!Curve.IsNull())
+       {
+               GeomAdaptor_Curve C3d(Curve);
+               GCPnts_UniformAbscissa Discret(C3d, eltSize, f, l);
+               int NbPoints = Discret.NbPoints();
+               //MESSAGE("nb points on edge : "<<NbPoints);
+
+               // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
+               // only internal nodes receive an edge position with param on curve
+
+               const SMDS_MeshNode * idPrev = idFirst;
+               for (int i = 2; i < NbPoints; i++)
+               {
+                       double param = Discret.Parameter(i);
+
+                       if (_numberOfSegments > 1)
+                       {
+                               double epsilon = 0.001;
+                               if (fabs(_scaleFactor - 1.0) > epsilon)
+                               {
+                                       double alpha =
+                                               pow(_scaleFactor, 1.0 / (_numberOfSegments - 1));
+                                       double d =
+                                               length * (1 - pow(alpha, i - 1)) / (1 - pow(alpha,
+                                                       _numberOfSegments));
+                                       param = d;
+                               }
+                       }
+
+                       gp_Pnt P = Curve->Value(param);
+
+                       //Add the Node in the DataStructure
+                       //MESSAGE("point "<<nodeId<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<" - "<<i<<" "<<param);
+                       SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+                       meshDS->SetNodeOnEdge(node, E);
+
+                       // **** edgePosition associe au point = param. 
+                       SMDS_EdgePosition* epos =
+                          dynamic_cast<SMDS_EdgePosition *>(node->GetPosition().get());
+                       epos->SetUParameter(param);
+
+                       SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
+                       meshDS->SetMeshElementOnShape(edge, E);
+                       idPrev = node;
+               }
+               SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
+               meshDS->SetMeshElementOnShape(edge, E);
+       }
+       else
+       {
+//       MESSAGE ("Edge Degeneree non traitee --- arret");
+//       ASSERT(0);
+               if (BRep_Tool::Degenerated(E))
+               {
+                       // Edge is a degenerated Edge : We put n = 5 points on the edge.
+                       int NbPoints = 5;
+                       BRep_Tool::Range(E, f, l);
+                       double du = (l - f) / (NbPoints - 1);
+                       MESSAGE("************* Degenerated edge! *****************");
+
+                       TopoDS_Vertex V1, V2;
+                       TopExp::Vertices(E, V1, V2);
+                       gp_Pnt P = BRep_Tool::Pnt(V1);
+
+                       const SMDS_MeshNode * idPrev = idFirst;
+                       for (int i = 2; i < NbPoints; i++)
+                       {
+                               double param = f + (i - 1) * du;
+                               SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+                               meshDS->SetNodeOnEdge(node, E);
+
+//        Handle (SMDS_EdgePosition) epos
+//      = new SMDS_EdgePosition(theSubMesh->GetId(),param);
+//        node->SetPosition(epos);
+                               SMDS_EdgePosition* epos =
+                                  dynamic_cast<SMDS_EdgePosition*>(node->GetPosition().get());
+                               epos->SetUParameter(param);
+
+                               SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
+                               meshDS->SetMeshElementOnShape(edge, E);
+                               idPrev = node;
+                       }
+                       SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
+                       meshDS->SetMeshElementOnShape(edge, E);
+               }
+               else
+                       ASSERT(0);
+       }
+       return true;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_Regular_1D::SaveTo(ostream & save)
+{
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_Regular_1D::LoadFrom(istream & load)
+{
+  return load;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & operator <<(ostream & save, StdMeshers_Regular_1D & hyp)
+{
+  return hyp.SaveTo( save );
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & operator >>(istream & load, StdMeshers_Regular_1D & hyp)
+{
+  return hyp.LoadFrom( load );
+}
diff --git a/src/StdMeshers/StdMeshers_Regular_1D.hxx b/src/StdMeshers/StdMeshers_Regular_1D.hxx
new file mode 100644 (file)
index 0000000..a685492
--- /dev/null
@@ -0,0 +1,65 @@
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Regular_1D.hxx
+//           Moved here from SMESH_Regular_1D.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_REGULAR_1D_HXX_
+#define _SMESH_REGULAR_1D_HXX_
+
+#include "SMESH_1D_Algo.hxx"
+
+class StdMeshers_LocalLength;
+class StdMeshers_NumberOfSegments;
+
+class StdMeshers_Regular_1D:
+  public SMESH_1D_Algo
+{
+public:
+  StdMeshers_Regular_1D(int hypId, int studyId, SMESH_Gen* gen);
+  virtual ~StdMeshers_Regular_1D();
+
+  virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
+                               const TopoDS_Shape& aShape,
+                               SMESH_Hypothesis::Hypothesis_Status& aStatus);
+
+  virtual bool Compute(SMESH_Mesh& aMesh,
+                      const TopoDS_Shape& aShape);
+
+  ostream & SaveTo(ostream & save);
+  istream & LoadFrom(istream & load);
+  friend ostream & operator << (ostream & save, StdMeshers_Regular_1D & hyp);
+  friend istream & operator >> (istream & load, StdMeshers_Regular_1D & hyp);
+
+protected:
+  double _localLength;
+  int _numberOfSegments;
+  double _scaleFactor;
+  const StdMeshers_LocalLength* _hypLocalLength;
+  const StdMeshers_NumberOfSegments* _hypNumberOfSegments;
+};
+
+#endif
diff --git a/src/StdMeshersGUI/Makefile.in b/src/StdMeshersGUI/Makefile.in
new file mode 100644 (file)
index 0000000..8c924a2
--- /dev/null
@@ -0,0 +1,78 @@
+#  SMESH StdMeshersGUI : GUI for StdMeshers plugin
+#
+#  Copyright (C) 2003  CEA
+# 
+#  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.org
+#
+#
+#
+#  File   : Makefile.in
+#  Author : Julia DOROVSKIKH
+#  Module : SMESH
+#  $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome
+
+
+@COMMENCE@
+
+# .po files to transform in .qm
+ PO_FILES = \
+       StdMeshers_icons.po \
+       StdMeshers_msg_en.po
+
+# Libraries targets
+LIB = libStdMeshersGUI.la
+LIB_SRC = \
+       StdMeshersGUI.cxx \
+       StdMeshersGUI_LocalLengthDlg.cxx \
+       StdMeshersGUI_NbSegmentsDlg.cxx \
+       StdMeshersGUI_MaxElementAreaDlg.cxx \
+       StdMeshersGUI_MaxElementVolumeDlg.cxx
+
+LIB_MOC = \
+       StdMeshersGUI_LocalLengthDlg.h \
+       StdMeshersGUI_NbSegmentsDlg.h \
+       StdMeshersGUI_MaxElementAreaDlg.h \
+       StdMeshersGUI_MaxElementVolumeDlg.h
+
+LIB_CLIENT_IDL = \
+       SALOME_Exception.idl \
+       SMESH_Gen.idl \
+       SMESH_Mesh.idl \
+       SMESH_Group.idl \
+       SMESH_Filter.idl \
+       SMESH_Hypothesis.idl \
+       SMESH_BasicHypothesis.idl \
+       MED.idl
+
+LIB_SERVER_IDL = 
+
+# additionnal information to compil and link file
+
+CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
+            $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
+            $(BOOST_CPPFLAGS)
+CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
+#$(OCC_CXXFLAGS)
+
+LDFLAGS += -lSMESHGUI $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome
+
+@CONCLUDE@
diff --git a/src/StdMeshersGUI/StdMeshersGUI.cxx b/src/StdMeshersGUI/StdMeshersGUI.cxx
new file mode 100644 (file)
index 0000000..e272665
--- /dev/null
@@ -0,0 +1,225 @@
+//  SMESH StdMeshersGUI : GUI for plugged-in meshers
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : StdMeshersGUI.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESHGUI.h"
+#include "SMESHGUI_Hypotheses.h"
+
+#include "StdMeshersGUI_LocalLengthDlg.h"
+#include "StdMeshersGUI_NbSegmentsDlg.h"
+#include "StdMeshersGUI_MaxElementAreaDlg.h"
+#include "StdMeshersGUI_MaxElementVolumeDlg.h"
+
+#include "QAD_Desktop.h"
+#include "QAD_ResourceMgr.h"
+
+#include <qobject.h>
+
+//=============================================================================
+/*! class HypothesisCreator
+ *
+ */
+//=============================================================================
+class StdMeshersGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
+{
+ public:
+  StdMeshersGUI_HypothesisCreator (const QString& aHypType,
+                                   const QString& aServerLibName,
+                                   SMESHGUI* aSMESHGUI)
+    : myHypType(aHypType),
+    myServerLibName(aServerLibName),
+    mySMESHGUI(aSMESHGUI) {}
+
+  virtual void CreateHypothesis (const bool isAlgo, QWidget* parent = 0);
+  virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp);
+
+ private:
+  QString   myHypType;
+  QString   myServerLibName;
+  SMESHGUI* mySMESHGUI;
+};
+
+//=============================================================================
+/*! HypothesisCreator::CreateHypothesis
+ *
+ */
+//=============================================================================
+void StdMeshersGUI_HypothesisCreator::CreateHypothesis
+                                      (bool isAlgo, QWidget* parent)
+{
+  MESSAGE("StdMeshersGUI_HypothesisCreator::CreateHypothesis");
+
+  // Get default name for hypothesis/algorithm creation
+  char* sHypType = (char*)myHypType.latin1();
+  HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+  QString aHypName;
+  if (aHypData)
+    aHypName = aHypData->Label;
+  else
+    aHypName = myHypType;
+
+  // Create hypothesis/algorithm
+  if (isAlgo)
+  {
+    mySMESHGUI->CreateHypothesis(myHypType, aHypName, isAlgo);
+  }
+  else
+  {
+    // Show Dialog for hypothesis creation
+    if      (myHypType == "LocalLength")
+      StdMeshersGUI_LocalLengthDlg *aDlg = new StdMeshersGUI_LocalLengthDlg(myHypType, parent, "");
+    else if (myHypType == "NumberOfSegments")
+      StdMeshersGUI_NbSegmentsDlg *aDlg = new StdMeshersGUI_NbSegmentsDlg(myHypType, parent, "");
+    else if (myHypType == "MaxElementArea")
+      StdMeshersGUI_MaxElementAreaDlg *aDlg = new StdMeshersGUI_MaxElementAreaDlg(myHypType, parent, "");
+    else if (myHypType == "MaxElementVolume")
+      StdMeshersGUI_MaxElementVolumeDlg *aDlg = new StdMeshersGUI_MaxElementVolumeDlg(myHypType, parent, "");
+    else if (myHypType == "LengthFromEdges")
+      mySMESHGUI->CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
+    else if (myHypType == "NotConformAllowed")
+      mySMESHGUI->CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI
+    else ;
+  }
+}
+
+//=============================================================================
+/*! HypothesisCreator::EditHypothesis
+ *
+ */
+//=============================================================================
+void StdMeshersGUI_HypothesisCreator::EditHypothesis
+                                      (SMESH::SMESH_Hypothesis_ptr theHyp)
+{
+  MESSAGE("StdMeshersGUI_HypothesisCreator::EditHypothesis");
+
+  Standard_Boolean res = Standard_True;
+  SALOMEDS::Study::ListOfSObject_var listSOmesh =
+    mySMESHGUI->GetMeshesUsingAlgoOrHypothesis(theHyp);
+  QString Name = theHyp->GetName();
+  if (Name.compare("LocalLength") == 0)
+  {
+    StdMeshers::StdMeshers_LocalLength_var LL =
+      StdMeshers::StdMeshers_LocalLength::_narrow(theHyp);
+    double beforeLength = LL->GetLength() ;
+    double Length = mySMESHGUI->Parameter(res, 
+                                          beforeLength,
+                                          QObject::tr("SMESH_LOCAL_LENGTH_HYPOTHESIS"), 
+                                          QObject::tr("SMESH_VALUE"), 
+                                          1.0E-5, 1E6, 6);
+    if (res && Length != beforeLength)
+    {
+      LL->SetLength(Length);
+      for (int i=0; i<listSOmesh->length(); i++)
+      {
+        mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
+      }
+    }
+  }
+  else if (Name.compare("NumberOfSegments") == 0)
+  {
+    StdMeshers::StdMeshers_NumberOfSegments_var NOS =
+      StdMeshers::StdMeshers_NumberOfSegments::_narrow(theHyp);
+    int beforeNbSeg = NOS->GetNumberOfSegments() ;
+    int NbSeg = mySMESHGUI->Parameter(res,
+                                      beforeNbSeg, 
+                                      QObject::tr("SMESH_NB_SEGMENTS_HYPOTHESIS"), 
+                                      QObject::tr("SMESH_VALUE"), 
+                                      1, 1000000);
+    if (res && NbSeg != beforeNbSeg)
+    {
+      NOS->SetNumberOfSegments(NbSeg);
+      for (int i=0; i<listSOmesh->length(); i++)
+      {
+        SALOMEDS::SObject_var SO = listSOmesh[i] ;
+        mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
+      }
+    }
+  }
+  else if (Name.compare("MaxElementArea") == 0)
+  {
+    StdMeshers::StdMeshers_MaxElementArea_var MEA =
+      StdMeshers::StdMeshers_MaxElementArea::_narrow(theHyp);
+    double beforeMaxArea = MEA->GetMaxElementArea();
+    double MaxArea = mySMESHGUI->Parameter(res,
+                                           beforeMaxArea,
+                                           QObject::tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"), 
+                                           QObject::tr("SMESH_VALUE"), 
+                                           1.0E-5, 1E6, 6);
+    if (res && MaxArea != beforeMaxArea)
+    {
+      MEA->SetMaxElementArea(MaxArea);
+      for (int i=0; i<listSOmesh->length(); i++)
+      {
+        mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
+      }
+    }
+  }
+  else if (Name.compare("MaxElementVolume") == 0)
+  {
+    StdMeshers::StdMeshers_MaxElementVolume_var MEV =
+      StdMeshers::StdMeshers_MaxElementVolume::_narrow(theHyp);
+    double beforeMaxVolume = MEV->GetMaxElementVolume() ;
+    double MaxVolume = mySMESHGUI->Parameter(res, 
+                                             beforeMaxVolume,
+                                             QObject::tr("SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"), 
+                                             QObject::tr("SMESH_VALUE"), 
+                                             1.0E-5, 1E6, 6);
+    if (res && MaxVolume != beforeMaxVolume)
+    {
+      MEV->SetMaxElementVolume(MaxVolume);
+      for (int i=0; i<listSOmesh->length(); i++)
+      {
+        mySMESHGUI->GetStudyAPI().ModifiedMesh(listSOmesh[i], false);
+      }
+    }
+  }
+//  else if (Name.compare("Regular_1D") == 0)
+//  {}
+//  else if (Name.compare("MEFISTO_2D") == 0)
+//  {}
+  else
+  {}
+}
+
+//=============================================================================
+/*! GetHypothesisCreator
+ *
+ */
+//=============================================================================
+extern "C"
+{
+  SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator
+    (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI)
+    {
+      return new StdMeshersGUI_HypothesisCreator
+        (aHypType, aServerLibName, aSMESHGUI);
+    }
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_LocalLengthDlg.cxx b/src/StdMeshersGUI/StdMeshersGUI_LocalLengthDlg.cxx
new file mode 100644 (file)
index 0000000..60e1d42
--- /dev/null
@@ -0,0 +1,289 @@
+//  SMESH StdMeshersGUI : GUI for StdMeshers plugin
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_LocalLengthDlg.cxx
+//           Moved here from SMESHGUI_LocalLengthDlg.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshersGUI_LocalLengthDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "utilities.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+
+// QT Includes
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+//=================================================================================
+// class    : StdMeshersGUI_LocalLengthDlg()
+// purpose  : Constructs a StdMeshersGUI_LocalLengthDlg which is a child of 'parent', with the 
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+StdMeshersGUI_LocalLengthDlg::StdMeshersGUI_LocalLengthDlg (const QString& hypType,
+                                                            QWidget* parent,
+                                                            const char* name,
+                                                            bool modal,
+                                                            WFlags fl)
+     : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+       myHypType(hypType)
+{
+    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_LOCAL_LENGTH")));
+    
+    if ( !name )
+      setName( "StdMeshersGUI_LocalLengthDlg" );
+    setCaption( tr( "SMESH_LOCAL_LENGTH_TITLE"  ) );
+    setSizeGripEnabled( TRUE );
+    QGridLayout* StdMeshersGUI_LocalLengthDlgLayout = new QGridLayout( this ); 
+    StdMeshersGUI_LocalLengthDlgLayout->setSpacing( 6 );
+    StdMeshersGUI_LocalLengthDlgLayout->setMargin( 11 );
+
+    /***************************************************************/
+    iconLabel = new QLabel( this );
+    iconLabel->setPixmap( image0 );
+    iconLabel->setScaledContents( false );
+    iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+    typeLabel = new QLabel( this );
+    typeLabel->setText( tr( "SMESH_LOCAL_LENGTH_HYPOTHESIS"  ) );
+    StdMeshersGUI_LocalLengthDlgLayout->addWidget( iconLabel, 0, 0 );
+    StdMeshersGUI_LocalLengthDlgLayout->addWidget( typeLabel, 0, 1 );
+    
+    /***************************************************************/
+    GroupC1 = new QGroupBox( this, "GroupC1" );
+    GroupC1->setTitle( tr( "SMESH_ARGUMENTS"  ) );
+    GroupC1->setColumnLayout(0, Qt::Vertical );
+    GroupC1->layout()->setSpacing( 0 );
+    GroupC1->layout()->setMargin( 0 );
+    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+    GroupC1Layout->setAlignment( Qt::AlignTop );
+    GroupC1Layout->setSpacing( 6 );
+    GroupC1Layout->setMargin( 11 );
+
+    TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
+    TextLabel_NameHypothesis->setText( tr( "SMESH_NAME"  ) );
+    GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
+
+    LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
+    GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
+
+    TextLabel_Length = new QLabel(GroupC1 , "TextLabel_Length" );
+    TextLabel_Length->setText( tr( "SMESH_LENGTH"  ) );
+    GroupC1Layout->addWidget( TextLabel_Length, 1, 0 );
+
+    SpinBox_Length = new SMESHGUI_SpinBox( GroupC1, "SpinBox_Length" );
+    GroupC1Layout->addWidget( SpinBox_Length, 1, 1 );
+
+    StdMeshersGUI_LocalLengthDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
+
+    /***************************************************************/
+    GroupButtons = new QGroupBox( this, "GroupButtons" );
+    GroupButtons->setColumnLayout(0, Qt::Vertical );
+    GroupButtons->layout()->setSpacing( 0 );
+    GroupButtons->layout()->setMargin( 0 );
+    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+    GroupButtonsLayout->setAlignment( Qt::AlignTop );
+    GroupButtonsLayout->setSpacing( 6 );
+    GroupButtonsLayout->setMargin( 11 );
+    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+    buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
+    buttonOk->setAutoDefault( TRUE );
+    buttonOk->setDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+    buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
+    buttonApply->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    GroupButtonsLayout->addItem( spacer, 0, 2 );
+    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+    buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
+    buttonCancel->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+    StdMeshersGUI_LocalLengthDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
+
+    /***************************************************************/
+    Init() ;
+}
+
+
+//=================================================================================
+// function : ~StdMeshersGUI_LocalLengthDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+StdMeshersGUI_LocalLengthDlg::~StdMeshersGUI_LocalLengthDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::Init()
+{
+  /* min, max, step and decimals for spin boxes */
+  SpinBox_Length->RangeStepAndValidator( 0.001, 999.999, 1.0, 3 ) ;
+  SpinBox_Length->SetValue( 1.0 ) ; 
+
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+
+  char* sHypType = (char*)myHypType.latin1();
+  HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+  LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
+
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  /* signals and slots connections */
+  connect( buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()) );
+  connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
+  connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
+
+  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;  
+  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ; 
+  this->show() ; /* displays Dialog */
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::ClickOnOk()
+{
+  if ( this->ClickOnApply() )
+    this->ClickOnCancel() ;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool StdMeshersGUI_LocalLengthDlg::ClickOnApply()
+{
+  QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
+  if ( myHypName.isEmpty() ) {
+    QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+    return false;
+  }
+  
+  double myLength = SpinBox_Length->GetValue();
+
+  QAD_WaitCursor wc;
+  try {
+    SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
+      (mySMESHGUI->CreateHypothesis(myHypType,
+                                   myHypName,
+                                   false)); // isAlgorithm
+    StdMeshers::StdMeshers_LocalLength_var LL =
+      StdMeshers::StdMeshers_LocalLength::_narrow(Hyp);
+    if (!LL->_is_nil())
+      LL->SetLength(myLength);
+  }
+  catch (const SALOME::SALOME_Exception& S_ex) {
+    wc.stop();
+    QtCatchCorbaException(S_ex);
+    return false;
+  }
+  return true;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::ClickOnCancel()
+{
+  close();
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::DeactivateActiveDialog()
+{
+  iconLabel->setEnabled(false) ;
+  typeLabel->setEnabled(false) ;
+  GroupC1->setEnabled(false) ;
+  GroupButtons->setEnabled(false) ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::ActivateThisDialog()
+{
+  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  iconLabel->setEnabled(true) ;
+  typeLabel->setEnabled(true) ;
+  GroupC1->setEnabled(true) ;
+  GroupButtons->setEnabled(true) ;
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::enterEvent(QEvent* e)
+{
+  ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_LocalLengthDlg::closeEvent( QCloseEvent* e )
+{
+  mySMESHGUI->ResetState();
+  QDialog::closeEvent( e );
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_LocalLengthDlg.h b/src/StdMeshersGUI/StdMeshersGUI_LocalLengthDlg.h
new file mode 100644 (file)
index 0000000..8b3dda5
--- /dev/null
@@ -0,0 +1,89 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_LocalLengthDlg.h
+//           Moved here from SMESHGUI_LocalLengthDlg.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef DIALOGBOX_LOCAL_LENGTH_H
+#define DIALOGBOX_LOCAL_LENGTH_H
+
+// QT Includes
+#include <qdialog.h>
+
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class SMESHGUI;
+class SMESHGUI_SpinBox;
+
+//=================================================================================
+// class    : StdMeshersGUI_LocalLengthDlg
+// purpose  :
+//=================================================================================
+class StdMeshersGUI_LocalLengthDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    StdMeshersGUI_LocalLengthDlg (const QString& hypType,
+                                 QWidget* parent = 0,
+                                 const char* name = 0,
+                                 bool modal = FALSE,
+                                 WFlags fl = 0);
+    ~StdMeshersGUI_LocalLengthDlg ();
+
+private:
+
+    void Init() ;
+    void closeEvent( QCloseEvent* e ) ;
+    void enterEvent ( QEvent * ) ;
+
+    SMESHGUI*  mySMESHGUI ;
+    QString    myHypType ;
+
+    QLabel*           iconLabel;
+    QLabel*           typeLabel;
+    QGroupBox*        GroupC1;
+    QLabel*           TextLabel_NameHypothesis ;
+    QLineEdit*        LineEdit_NameHypothesis ;
+    QLabel*           TextLabel_Length ;
+    SMESHGUI_SpinBox* SpinBox_Length ;
+    QGroupBox*        GroupButtons;
+    QPushButton*      buttonOk;
+    QPushButton*      buttonApply;
+    QPushButton*      buttonCancel;
+
+private slots:
+
+    void ClickOnOk();
+    void ClickOnCancel();
+    bool ClickOnApply();
+    void DeactivateActiveDialog() ;
+    void ActivateThisDialog() ;
+};
+
+#endif // DIALOGBOX_LOCAL_LENGTH_H
diff --git a/src/StdMeshersGUI/StdMeshersGUI_MaxElementAreaDlg.cxx b/src/StdMeshersGUI/StdMeshersGUI_MaxElementAreaDlg.cxx
new file mode 100644 (file)
index 0000000..ae99f6e
--- /dev/null
@@ -0,0 +1,291 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_MaxElementAreaDlg.cxx
+//           Moved here from SMESHGUI_MaxElementAreaDlg.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshersGUI_MaxElementAreaDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "utilities.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+
+// QT Includes
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+//=================================================================================
+// class    : StdMeshersGUI_MaxElementAreaDlg()
+// purpose  : Constructs a StdMeshersGUI_MaxElementAreaDlg which is a child of 'parent', with the 
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+StdMeshersGUI_MaxElementAreaDlg::StdMeshersGUI_MaxElementAreaDlg (const QString& hypType,
+                                                                 QWidget* parent,
+                                                                 const char* name,
+                                                                 bool modal,
+                                                                 WFlags fl)
+     : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+       myHypType(hypType)
+{
+    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MAX_ELEMENT_AREA")));
+    
+    if ( !name )
+      setName( "StdMeshersGUI_MaxElementAreaDlg" );
+    setCaption( tr( "SMESH_MAX_ELEMENT_AREA_TITLE"  ) );
+    setSizeGripEnabled( TRUE );
+    QGridLayout* StdMeshersGUI_MaxElementAreaDlgLayout = new QGridLayout( this ); 
+    StdMeshersGUI_MaxElementAreaDlgLayout->setSpacing( 6 );
+    StdMeshersGUI_MaxElementAreaDlgLayout->setMargin( 11 );
+
+    /***************************************************************/
+    iconLabel = new QLabel( this );
+    iconLabel->setPixmap( image0 );
+    iconLabel->setScaledContents( false );
+    iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+    typeLabel = new QLabel( this );
+    typeLabel->setText( tr( "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"  ) );
+    StdMeshersGUI_MaxElementAreaDlgLayout->addWidget( iconLabel, 0, 0 );
+    StdMeshersGUI_MaxElementAreaDlgLayout->addWidget( typeLabel, 0, 1 );
+    
+    /***************************************************************/
+    GroupC1 = new QGroupBox( this, "GroupC1" );
+    GroupC1->setTitle( tr( "SMESH_ARGUMENTS"  ) );
+    GroupC1->setColumnLayout(0, Qt::Vertical );
+    GroupC1->layout()->setSpacing( 0 );
+    GroupC1->layout()->setMargin( 0 );
+    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+    GroupC1Layout->setAlignment( Qt::AlignTop );
+    GroupC1Layout->setSpacing( 6 );
+    GroupC1Layout->setMargin( 11 );
+
+    TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
+    TextLabel_NameHypothesis->setText( tr( "SMESH_NAME"  ) );
+    GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
+    LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
+    GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
+
+    TextLabel_MaxElementArea = new QLabel(GroupC1 , "TextLabel_MaxElementArea" );
+    TextLabel_MaxElementArea->setText( tr( "SMESH_MAX_ELEMENT_AREA"  ) );
+    GroupC1Layout->addWidget( TextLabel_MaxElementArea, 1, 0 );
+
+    SpinBox_MaxElementArea = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementArea" ) ;
+    GroupC1Layout->addWidget( SpinBox_MaxElementArea, 1, 1 );
+
+    StdMeshersGUI_MaxElementAreaDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1);
+
+    /***************************************************************/
+    GroupButtons = new QGroupBox( this, "GroupButtons" );
+    GroupButtons->setColumnLayout(0, Qt::Vertical );
+    GroupButtons->layout()->setSpacing( 0 );
+    GroupButtons->layout()->setMargin( 0 );
+    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+    GroupButtonsLayout->setAlignment( Qt::AlignTop );
+    GroupButtonsLayout->setSpacing( 6 );
+    GroupButtonsLayout->setMargin( 11 );
+    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+    buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
+    buttonOk->setAutoDefault( TRUE );
+    buttonOk->setDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+    buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
+    buttonApply->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    GroupButtonsLayout->addItem( spacer, 0, 2 );
+    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+    buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
+    buttonCancel->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+    StdMeshersGUI_MaxElementAreaDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
+
+    /***************************************************************/
+    Init() ;
+}
+
+
+//=================================================================================
+// function : ~StdMeshersGUI_MaxElementAreaDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+StdMeshersGUI_MaxElementAreaDlg::~StdMeshersGUI_MaxElementAreaDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::Init()
+{
+  /* min, max, step and decimals for spin boxes */
+  SpinBox_MaxElementArea->setPrecision( 10 );
+  SpinBox_MaxElementArea->RangeStepAndValidator( 0.001, 999999.999, 1.0, 3 ) ;
+  SpinBox_MaxElementArea->SetValue( 1.0 ) ;  /* is myMaxElementArea */
+  
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+
+  char* sHypType = (char*)myHypType.latin1();
+  HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+  LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
+
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  /* signals and slots connections */
+  connect( buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()) );
+  connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
+  connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
+
+  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;  
+  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ; 
+  this->show() ; /* displays Dialog */
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::ClickOnOk()
+{
+  if ( this->ClickOnApply() )
+    this->ClickOnCancel() ;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool StdMeshersGUI_MaxElementAreaDlg::ClickOnApply()
+{
+  QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
+  if ( myHypName.isEmpty() ) {
+    QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+    return false;
+  }
+  
+  double myMaxElementArea = SpinBox_MaxElementArea->GetValue();
+
+  QAD_WaitCursor wc;
+  try {
+    SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
+      (mySMESHGUI->CreateHypothesis(myHypType,
+                                   myHypName,
+                                   false)); // isAlgorithm
+    StdMeshers::StdMeshers_MaxElementArea_var MaxElArea =
+      StdMeshers::StdMeshers_MaxElementArea::_narrow(Hyp);
+    if (!MaxElArea->_is_nil())
+      MaxElArea->SetMaxElementArea(myMaxElementArea);
+  }
+  catch (const SALOME::SALOME_Exception& S_ex) {
+    wc.stop();
+    QtCatchCorbaException(S_ex);
+    return false;
+  }
+  return true;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::ClickOnCancel()
+{
+  close();
+}
+
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::DeactivateActiveDialog()
+{
+  iconLabel->setEnabled(false) ;
+  typeLabel->setEnabled(false) ;
+  GroupC1->setEnabled(false) ;
+  GroupButtons->setEnabled(false) ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::ActivateThisDialog()
+{
+  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  iconLabel->setEnabled(true) ;
+  typeLabel->setEnabled(true) ;
+  GroupC1->setEnabled(true) ;
+  GroupButtons->setEnabled(true) ;
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::enterEvent(QEvent* e)
+{
+  ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementAreaDlg::closeEvent( QCloseEvent* e )
+{
+  mySMESHGUI->ResetState();
+  QDialog::closeEvent( e );
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_MaxElementAreaDlg.h b/src/StdMeshersGUI/StdMeshersGUI_MaxElementAreaDlg.h
new file mode 100644 (file)
index 0000000..e95f3cb
--- /dev/null
@@ -0,0 +1,89 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_MaxElementAreaDlg.h
+//           Moved here from SMESHGUI_MaxElementAreaDlg.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef DIALOGBOX_MAX_ELEMENT_AREA_H
+#define DIALOGBOX_MAX_ELEMENT_AREA_H
+
+// QT Includes
+#include <qdialog.h>
+
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class SMESHGUI;
+class SMESHGUI_SpinBox;
+
+//=================================================================================
+// class    : StdMeshersGUI_MaxElementAreaDlg
+// purpose  :
+//=================================================================================
+class StdMeshersGUI_MaxElementAreaDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    StdMeshersGUI_MaxElementAreaDlg (const QString& hypType,
+                                    QWidget* parent = 0,
+                                    const char* name = 0,
+                                    bool modal = FALSE,
+                                    WFlags fl = 0 );
+    ~StdMeshersGUI_MaxElementAreaDlg ();
+
+private:
+
+    void Init() ;
+    void closeEvent( QCloseEvent* e ) ;
+    void enterEvent ( QEvent * ) ;
+
+    SMESHGUI*  mySMESHGUI ;
+    QString    myHypType ;
+
+    QLabel*           iconLabel;
+    QLabel*           typeLabel;
+    QGroupBox*        GroupC1;
+    QLabel*           TextLabel_NameHypothesis ;
+    QLineEdit*        LineEdit_NameHypothesis ;
+    QLabel*           TextLabel_MaxElementArea ;
+    SMESHGUI_SpinBox* SpinBox_MaxElementArea ;
+    QGroupBox*        GroupButtons;
+    QPushButton*      buttonApply;
+    QPushButton*      buttonOk;
+    QPushButton*      buttonCancel;
+
+private slots:
+
+    void ClickOnOk();
+    void ClickOnCancel();
+    bool ClickOnApply();
+    void DeactivateActiveDialog() ;
+    void ActivateThisDialog() ;
+};
+
+#endif // DIALOGBOX_MAX_ELEMENT_AREA_H
diff --git a/src/StdMeshersGUI/StdMeshersGUI_MaxElementVolumeDlg.cxx b/src/StdMeshersGUI/StdMeshersGUI_MaxElementVolumeDlg.cxx
new file mode 100644 (file)
index 0000000..c5a75ee
--- /dev/null
@@ -0,0 +1,290 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_MaxElementVolumeDlg.cxx
+//           Moved here from SMESHGUI_MaxElementVolumeDlg.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshersGUI_MaxElementVolumeDlg.h"
+#include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "utilities.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+
+// QT Includes
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+//=================================================================================
+// class    : StdMeshersGUI_MaxElementVolumeDlg()
+// purpose  : Constructs a StdMeshersGUI_MaxElementVolumeDlg which is a child of 'parent', with the 
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+StdMeshersGUI_MaxElementVolumeDlg::StdMeshersGUI_MaxElementVolumeDlg (const QString& hypType,
+                                                                     QWidget* parent,
+                                                                     const char* name,
+                                                                     bool modal, WFlags fl)
+     : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+       myHypType(hypType)
+{
+    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MAX_ELEMENT_VOLUME")));
+    
+    if ( !name )
+      setName( "StdMeshersGUI_MaxElementVolumeDlg" );
+    setCaption( tr( "SMESH_MAX_ELEMENT_VOLUME_TITLE"  ) );
+    setSizeGripEnabled( TRUE );
+    QGridLayout* StdMeshersGUI_MaxElementVolumeDlgLayout = new QGridLayout( this ); 
+    StdMeshersGUI_MaxElementVolumeDlgLayout->setSpacing( 6 );
+    StdMeshersGUI_MaxElementVolumeDlgLayout->setMargin( 11 );
+
+    /***************************************************************/
+    iconLabel = new QLabel( this );
+    iconLabel->setPixmap( image0 );
+    iconLabel->setScaledContents( false );
+    iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+    typeLabel = new QLabel( this );
+    typeLabel->setText( tr( "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"  ) );
+    StdMeshersGUI_MaxElementVolumeDlgLayout->addWidget( iconLabel, 0, 0 );
+    StdMeshersGUI_MaxElementVolumeDlgLayout->addWidget( typeLabel, 0, 1 );
+    
+    /***************************************************************/
+    GroupButtons = new QGroupBox( this, "GroupButtons" );
+    GroupButtons->setColumnLayout(0, Qt::Vertical );
+    GroupButtons->layout()->setSpacing( 0 );
+    GroupButtons->layout()->setMargin( 0 );
+    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+    GroupButtonsLayout->setAlignment( Qt::AlignTop );
+    GroupButtonsLayout->setSpacing( 6 );
+    GroupButtonsLayout->setMargin( 11 );
+    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+    buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
+    buttonOk->setAutoDefault( TRUE );
+    buttonOk->setDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+    buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
+    buttonApply->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    GroupButtonsLayout->addItem( spacer, 0, 2 );
+    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+    buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
+    buttonCancel->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+    StdMeshersGUI_MaxElementVolumeDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
+
+    /***************************************************************/
+    GroupC1 = new QGroupBox( this, "GroupC1" );
+    GroupC1->setTitle( tr( "SMESH_ARGUMENTS"  ) );
+    GroupC1->setColumnLayout(0, Qt::Vertical );
+    GroupC1->layout()->setSpacing( 0 );
+    GroupC1->layout()->setMargin( 0 );
+    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+    GroupC1Layout->setAlignment( Qt::AlignTop );
+    GroupC1Layout->setSpacing( 6 );
+    GroupC1Layout->setMargin( 11 );
+
+    TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
+    TextLabel_NameHypothesis->setText( tr( "SMESH_NAME"  ) );
+    GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
+
+    LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
+    GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
+
+    TextLabel_MaxElementVolume = new QLabel(GroupC1 , "TextLabel_MaxElementVolume" );
+    TextLabel_MaxElementVolume->setText( tr( "SMESH_MAX_ELEMENT_VOLUME"  ) );
+    GroupC1Layout->addWidget( TextLabel_MaxElementVolume, 1, 0 );
+
+    SpinBox_MaxElementVolume = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementVolume" ) ;
+    GroupC1Layout->addWidget( SpinBox_MaxElementVolume, 1, 1 );
+
+    StdMeshersGUI_MaxElementVolumeDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
+
+    /***************************************************************/
+    Init() ;
+}
+
+
+//=================================================================================
+// function : ~StdMeshersGUI_MaxElementVolumeDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+StdMeshersGUI_MaxElementVolumeDlg::~StdMeshersGUI_MaxElementVolumeDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::Init()
+{
+  /* min, max, step and decimals for spin boxes */
+  SpinBox_MaxElementVolume->setPrecision( 10 );
+  SpinBox_MaxElementVolume->RangeStepAndValidator( 0.001, 999999.999, 1.0, 3 ) ;
+  SpinBox_MaxElementVolume->SetValue( 1.0 ) ;  /* is myMaxElementVolume */
+
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+
+  char* sHypType = (char*)myHypType.latin1();
+  HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+  LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
+
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  /* signals and slots connections */
+  connect( buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()) );
+  connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
+  connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
+
+  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;  
+  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ; 
+  this->show() ; /* displays Dialog */
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::ClickOnOk()
+{
+  if ( this->ClickOnApply() )
+    this->ClickOnCancel() ;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool StdMeshersGUI_MaxElementVolumeDlg::ClickOnApply()
+{
+  QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
+  if ( myHypName.isEmpty() ) {
+    QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+    return false;
+  }
+  
+  double myMaxElementVolume = SpinBox_MaxElementVolume->GetValue();
+  
+  QAD_WaitCursor wc;
+  try {
+    SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
+      (mySMESHGUI->CreateHypothesis(myHypType,
+                                   myHypName,
+                                   false)); // isAlgorithm
+    StdMeshers::StdMeshers_MaxElementVolume_var MaxElVolume =
+      StdMeshers::StdMeshers_MaxElementVolume::_narrow(Hyp);
+    if (!MaxElVolume->_is_nil())
+      MaxElVolume->SetMaxElementVolume(myMaxElementVolume);
+  }
+  catch (const SALOME::SALOME_Exception& S_ex) {
+    wc.stop();
+    QtCatchCorbaException(S_ex);
+    return false;
+  }
+  return true;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::ClickOnCancel()
+{
+  close();
+}
+
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::DeactivateActiveDialog()
+{
+  iconLabel->setEnabled(false) ;
+  typeLabel->setEnabled(false) ;
+  GroupC1->setEnabled(false) ;
+  GroupButtons->setEnabled(false) ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::ActivateThisDialog()
+{
+  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  iconLabel->setEnabled(true) ;
+  typeLabel->setEnabled(true) ;
+  GroupC1->setEnabled(true) ;
+  GroupButtons->setEnabled(true) ;
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::enterEvent(QEvent* e)
+{
+  ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_MaxElementVolumeDlg::closeEvent( QCloseEvent* e )
+{
+  mySMESHGUI->ResetState();
+  QDialog::closeEvent( e );
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_MaxElementVolumeDlg.h b/src/StdMeshersGUI/StdMeshersGUI_MaxElementVolumeDlg.h
new file mode 100644 (file)
index 0000000..b312157
--- /dev/null
@@ -0,0 +1,89 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_MaxElementVolumeDlg.h
+//           Moved here from SMESHGUI_MaxElementVolumeDlg.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef DIALOGBOX_MAX_ELEMENT_VOLUME_H
+#define DIALOGBOX_MAX_ELEMENT_VOLUME_H
+
+// QT Includes
+#include <qdialog.h>
+
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class SMESHGUI;
+class SMESHGUI_SpinBox;
+
+//=================================================================================
+// class    : StdMeshersGUI_MaxElementVolumeDlg
+// purpose  :
+//=================================================================================
+class StdMeshersGUI_MaxElementVolumeDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    StdMeshersGUI_MaxElementVolumeDlg (const QString& hypType,
+                                      QWidget* parent = 0,
+                                      const char* name = 0,
+                                      bool modal = FALSE,
+                                      WFlags fl = 0 );
+    ~StdMeshersGUI_MaxElementVolumeDlg ();
+
+private:
+
+    void Init() ;
+    void closeEvent( QCloseEvent* e ) ;
+    void enterEvent ( QEvent * ) ;
+
+    SMESHGUI*  mySMESHGUI ;
+    QString    myHypType ;
+
+    QLabel*          iconLabel;
+    QLabel*          typeLabel;
+    QGroupBox*        GroupButtons;
+    QPushButton*      buttonApply;
+    QPushButton*      buttonOk;
+    QPushButton*      buttonCancel;
+    QGroupBox*        GroupC1;
+    QLabel*           TextLabel_NameHypothesis ;
+    QLineEdit*        LineEdit_NameHypothesis ;
+    QLabel*           TextLabel_MaxElementVolume ;
+    SMESHGUI_SpinBox* SpinBox_MaxElementVolume ;
+
+private slots:
+
+    void ClickOnOk();
+    void ClickOnCancel();
+    bool ClickOnApply();
+    void DeactivateActiveDialog() ;
+    void ActivateThisDialog() ;
+};
+
+#endif // DIALOGBOX_MAX_ELEMENT_VOLUME_H
diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsDlg.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsDlg.cxx
new file mode 100644 (file)
index 0000000..6798c38
--- /dev/null
@@ -0,0 +1,289 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_NbSegmentsDlg.cxx
+//           Moved here from SMESHGUI_NbSegmentsDlg.cxx
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshersGUI_NbSegmentsDlg.h"
+#include "SMESHGUI.h"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "utilities.h"
+
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "QAD_MessageBox.h"
+#include "QAD_WaitCursor.h"
+
+// QT Includes
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qspinbox.h>
+
+//=================================================================================
+// class    : StdMeshersGUI_NbSegmentsDlg()
+// purpose  : Constructs a StdMeshersGUI_NbSegmentsDlg which is a child of 'parent', with the 
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+StdMeshersGUI_NbSegmentsDlg::StdMeshersGUI_NbSegmentsDlg (const QString& hypType,
+                                                         QWidget* parent,
+                                                         const char* name,
+                                                         bool modal,
+                                                         WFlags fl)
+     : QDialog (parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+       myHypType(hypType)
+{
+    QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_NB_SEGMENTS")));
+    
+    if ( !name )
+      setName( "StdMeshersGUI_NbSegmentsDlg" );
+    setCaption( tr( "SMESH_NB_SEGMENTS_TITLE"  ) );
+    setSizeGripEnabled( TRUE );
+    QGridLayout* StdMeshersGUI_NbSegmentsDlgLayout = new QGridLayout( this ); 
+    StdMeshersGUI_NbSegmentsDlgLayout->setSpacing( 6 );
+    StdMeshersGUI_NbSegmentsDlgLayout->setMargin( 11 );
+
+    /***************************************************************/
+    iconLabel = new QLabel( this );
+    iconLabel->setPixmap( image0 );
+    iconLabel->setScaledContents( false );
+    iconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+    typeLabel = new QLabel( this );
+    typeLabel->setText( tr( "SMESH_NB_SEGMENTS_HYPOTHESIS"  ) );
+    StdMeshersGUI_NbSegmentsDlgLayout->addWidget( iconLabel, 0, 0 );
+    StdMeshersGUI_NbSegmentsDlgLayout->addWidget( typeLabel, 0, 1 );
+    
+    /***************************************************************/
+    GroupC1 = new QGroupBox( this, "GroupC1" );
+    GroupC1->setTitle( tr( "SMESH_ARGUMENTS"  ) );
+    GroupC1->setColumnLayout(0, Qt::Vertical );
+    GroupC1->layout()->setSpacing( 0 );
+    GroupC1->layout()->setMargin( 0 );
+    QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+    GroupC1Layout->setAlignment( Qt::AlignTop );
+    GroupC1Layout->setSpacing( 6 );
+    GroupC1Layout->setMargin( 11 );
+
+    LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
+    GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
+
+    TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
+    TextLabel_NameHypothesis->setText( tr( "SMESH_NAME"  ) );
+    GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
+
+    TextLabel_NbSeg = new QLabel(GroupC1 , "TextLabel_NbSeg" );
+    TextLabel_NbSeg->setText( tr( "SMESH_SEGMENTS"  ) );
+    GroupC1Layout->addWidget( TextLabel_NbSeg, 1, 0 );
+
+    SpinBox_NbSeg = new QSpinBox( GroupC1, "SpinBox_NbSeg" );
+    GroupC1Layout->addWidget( SpinBox_NbSeg, 1, 1 );
+
+    StdMeshersGUI_NbSegmentsDlgLayout->addMultiCellWidget(GroupC1 , 1, 1, 0, 1 );
+
+    /***************************************************************/
+    GroupButtons = new QGroupBox( this, "GroupButtons" );
+    GroupButtons->setColumnLayout(0, Qt::Vertical );
+    GroupButtons->layout()->setSpacing( 0 );
+    GroupButtons->layout()->setMargin( 0 );
+    QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+    GroupButtonsLayout->setAlignment( Qt::AlignTop );
+    GroupButtonsLayout->setSpacing( 6 );
+    GroupButtonsLayout->setMargin( 11 );
+    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+    buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
+    buttonOk->setAutoDefault( TRUE );
+    buttonOk->setDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+    buttonApply->setText( tr( "SMESH_BUT_APPLY"  ) );
+    buttonApply->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
+    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    GroupButtonsLayout->addItem( spacer, 0, 2 );
+    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+    buttonCancel->setText( tr( "SMESH_BUT_CLOSE"  ) );
+    buttonCancel->setAutoDefault( TRUE );
+    GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
+    StdMeshersGUI_NbSegmentsDlgLayout->addMultiCellWidget( GroupButtons, 2, 2, 0, 1 );
+
+    /***************************************************************/
+    Init() ;
+}
+
+
+//=================================================================================
+// function : ~StdMeshersGUI_NbSegmentsDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+StdMeshersGUI_NbSegmentsDlg::~StdMeshersGUI_NbSegmentsDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::Init()
+{
+  SpinBox_NbSeg->setMinValue( 1 );
+  SpinBox_NbSeg->setMaxValue( 9999 );
+  SpinBox_NbSeg->setValue(3) ; /* myNbSeg */
+
+  mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
+
+  char* sHypType = (char*)myHypType.latin1();
+  HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
+  LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
+
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
+
+  /* signals and slots connections */
+  connect( buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()) );
+  connect( buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()) ) ;
+  connect( buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()) );
+
+  connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;  
+  connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+  /* Move widget on the botton right corner of main widget */
+  int x, y ;
+  mySMESHGUI->DefineDlgPosition( this, x, y ) ;
+  this->move( x, y ) ; 
+  this->show() ; /* displays Dialog */
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::ClickOnOk()
+{
+  if ( this->ClickOnApply() )
+    this->ClickOnCancel() ;
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool StdMeshersGUI_NbSegmentsDlg::ClickOnApply()
+{
+  QString myHypName = LineEdit_NameHypothesis->text().stripWhiteSpace();
+  if ( myHypName.isEmpty() ) {
+    QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
+    return false;
+  }
+
+  long myNbSeg = SpinBox_NbSeg->value();
+
+  QAD_WaitCursor wc;
+  try {
+    SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow
+      (mySMESHGUI->CreateHypothesis(myHypType,
+                                   myHypName,
+                                   false)); // isAlgorithm
+      StdMeshers::StdMeshers_NumberOfSegments_var NbS =
+       StdMeshers::StdMeshers_NumberOfSegments::_narrow(Hyp);
+      if (!NbS->_is_nil())
+       NbS->SetNumberOfSegments(myNbSeg);
+  }
+  catch (const SALOME::SALOME_Exception& S_ex) {
+    wc.stop();
+    QtCatchCorbaException(S_ex);
+    return false;
+  }
+  return true;
+}
+
+
+//=================================================================================
+// function : ClickOnCancel()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::ClickOnCancel()
+{
+  close();
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::DeactivateActiveDialog()
+{
+  iconLabel->setEnabled(false) ;
+  typeLabel->setEnabled(false) ;
+  GroupC1->setEnabled(false) ;
+  GroupButtons->setEnabled(false) ;
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::ActivateThisDialog()
+{
+  mySMESHGUI->EmitSignalDeactivateDialog() ;   
+  iconLabel->setEnabled(true) ;
+  typeLabel->setEnabled(true) ;
+  GroupC1->setEnabled(true) ;
+  GroupButtons->setEnabled(true) ;
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::enterEvent(QEvent* e)
+{
+  ActivateThisDialog() ;
+}
+
+
+//=================================================================================
+// function : closeEvent()
+// purpose  :
+//=================================================================================
+void StdMeshersGUI_NbSegmentsDlg::closeEvent( QCloseEvent* e )
+{
+  mySMESHGUI->ResetState();
+  QDialog::closeEvent( e );
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsDlg.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsDlg.h
new file mode 100644 (file)
index 0000000..3594ac9
--- /dev/null
@@ -0,0 +1,89 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshersGUI_NbSegmentsDlg.h
+//           Moved here from SMESHGUI_NbSegmentsDlg.h
+//  Author : Nicolas REJNERI
+//  Module : SMESH
+//  $Header$
+
+#ifndef DIALOGBOX_NB_SEGMENTS_H
+#define DIALOGBOX_NB_SEGMENTS_H
+
+// QT Includes
+#include <qdialog.h>
+
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QSpinBox;
+class QPushButton;
+class SMESHGUI;
+
+//=================================================================================
+// class    : StdMeshersGUI_NbSegmentsDlg
+// purpose  :
+//=================================================================================
+class StdMeshersGUI_NbSegmentsDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    StdMeshersGUI_NbSegmentsDlg (const QString& hypType,
+                                QWidget* parent = 0,
+                                const char* name = 0,
+                                bool modal = FALSE,
+                                WFlags fl = 0);
+    ~StdMeshersGUI_NbSegmentsDlg ();
+
+private:
+
+    void Init() ;
+    void closeEvent( QCloseEvent* e ) ;
+    void enterEvent ( QEvent * ) ;
+
+    SMESHGUI*        mySMESHGUI ;
+    QString          myHypType ;
+
+    QLabel*          iconLabel;
+    QLabel*          typeLabel;
+    QGroupBox*       GroupC1;
+    QLabel*          TextLabel_NameHypothesis ;
+    QLineEdit*       LineEdit_NameHypothesis ;
+    QLabel*          TextLabel_NbSeg ;
+    QSpinBox*        SpinBox_NbSeg ;
+    QGroupBox*       GroupButtons;
+    QPushButton*     buttonApply;
+    QPushButton*     buttonOk;
+    QPushButton*     buttonCancel;
+
+private slots:
+
+    void ClickOnOk();
+    void ClickOnCancel();
+    bool ClickOnApply();
+    void DeactivateActiveDialog() ;
+    void ActivateThisDialog() ;
+};
+
+#endif // DIALOGBOX_NB_SEGMENTS_H
diff --git a/src/StdMeshersGUI/StdMeshers_icons.po b/src/StdMeshersGUI/StdMeshers_icons.po
new file mode 100644 (file)
index 0000000..c021365
--- /dev/null
@@ -0,0 +1,81 @@
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: YYYY-MM-DD\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+#Select Icon
+msgid "ICON_SELECT"
+msgstr "select1.png"
+
+
+#-----------------------------------------------------------
+# Hypothesis
+#-----------------------------------------------------------
+
+#Hypo Local Length
+msgid "ICON_DLG_LOCAL_LENGTH"
+msgstr "mesh_hypo_length.png"
+
+#Hypo Nb Segments
+msgid "ICON_DLG_NB_SEGMENTS"
+msgstr "mesh_hypo_segment.png"
+
+#Hypo Max Area
+msgid "ICON_DLG_MAX_ELEMENT_AREA"
+msgstr "mesh_hypo_area.png"
+
+#Hypo Max Volume
+msgid "ICON_DLG_MAX_ELEMENT_VOLUME"
+msgstr "mesh_hypo_volume.png"
+
+
+#-----------------------------------------------------------
+# ObjectBrowser
+#-----------------------------------------------------------
+
+#mesh_tree_algo_regular
+msgid "ICON_SMESH_TREE_ALGO_Regular_1D"
+msgstr "mesh_tree_algo_regular.png"
+
+#mesh_tree_algo_hexa
+msgid "ICON_SMESH_TREE_ALGO_Hexa_3D"
+msgstr "mesh_tree_algo_hexa.png"
+
+#mesh_tree_algo_mefisto
+msgid "ICON_SMESH_TREE_ALGO_MEFISTO_2D"
+msgstr "mesh_tree_algo_mefisto.png"
+
+#mesh_tree_algo_quad
+msgid "ICON_SMESH_TREE_ALGO_Quadrangle_2D"
+msgstr "mesh_tree_algo_quad.png"
+
+#mesh_tree_hypo_area
+msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
+msgstr "mesh_tree_hypo_area.png"
+
+#mesh_tree_hypo_length
+msgid "ICON_SMESH_TREE_HYPO_LocalLength"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_segment
+msgid "ICON_SMESH_TREE_HYPO_NumberOfSegments"
+msgstr "mesh_tree_hypo_segment.png"
+
+#mesh_tree_hypo_volume
+msgid "ICON_SMESH_TREE_HYPO_MaxElementVolume"
+msgstr "mesh_tree_hypo_volume.png"
+
+#mesh_tree_hypo_length
+msgid "ICON_SMESH_TREE_HYPO_LengthFromEdges"
+msgstr "mesh_tree_hypo_length.png"
+
+#mesh_tree_hypo_nonconform
+msgid "ICON_SMESH_TREE_HYPO_NotConformAllowed"
+msgstr "mesh_tree_hypo_length.png"
diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.po b/src/StdMeshersGUI/StdMeshers_msg_en.po
new file mode 100644 (file)
index 0000000..cc6173b
--- /dev/null
@@ -0,0 +1,49 @@
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:46:48 AM CEST\n"
+"PO-Revision-Date: YYYY-MM-DD\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+# -------------- Local Length --------------
+
+msgid "SMESH_LOCAL_LENGTH_HYPOTHESIS"
+msgstr "Local Length"
+
+msgid "SMESH_LOCAL_LENGTH_TITLE"
+msgstr "Hypothesis Construction"
+
+# ----------- Number of Segments -----------
+
+msgid "SMESH_NB_SEGMENTS_HYPOTHESIS"
+msgstr "Number of Segments"
+
+msgid "SMESH_NB_SEGMENTS_TITLE"
+msgstr "Hypothesis Construction"
+
+# ----------- Max. Element Area ------------
+
+msgid "SMESH_MAX_ELEMENT_AREA"
+msgstr "Max. Area"
+
+msgid "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"
+msgstr "Max. Element Area"
+
+msgid "SMESH_MAX_ELEMENT_AREA_TITLE"
+msgstr "Hypothesis Construction"
+
+# ---------- Max. Element Volume -----------
+
+msgid "SMESH_MAX_ELEMENT_VOLUME"
+msgstr "Max. Volume"
+
+msgid "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"
+msgstr "Max. Element Volume"
+
+msgid "SMESH_MAX_ELEMENT_VOLUME_TITLE"
+msgstr "Hypothesis Construction"
diff --git a/src/StdMeshers_I/Makefile.in b/src/StdMeshers_I/Makefile.in
new file mode 100644 (file)
index 0000000..5891f6e
--- /dev/null
@@ -0,0 +1,76 @@
+#  SMESH StdMeshers_I : idl implementation based on 'StdMeshersPlugin' unit's classes
+#
+#  Copyright (C) 2003  CEA
+# 
+#  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.org
+#
+#
+#
+#  File   : Makefile.in
+#  Author : Julia DOROVSKIKH
+#  Module : SMESH
+#  $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
+
+
+@COMMENCE@
+
+# EXPORT_PYSCRIPTS = smeshpy.py SMESH_test.py
+
+# Libraries targets
+
+LIB= libStdMeshersEngine.la
+
+LIB_SRC = \
+       StdMeshers_i.cxx \
+        StdMeshers_LocalLength_i.cxx \
+        StdMeshers_LengthFromEdges_i.cxx \
+       StdMeshers_MaxElementArea_i.cxx \
+        StdMeshers_MaxElementVolume_i.cxx \
+       StdMeshers_NumberOfSegments_i.cxx \
+       StdMeshers_NotConformAllowed_i.cxx \
+        StdMeshers_Regular_1D_i.cxx \
+        StdMeshers_Quadrangle_2D_i.cxx \
+        StdMeshers_MEFISTO_2D_i.cxx \
+       StdMeshers_Hexa_3D_i.cxx
+
+LIB_SERVER_IDL = SMESH_BasicHypothesis.idl
+
+LIB_CLIENT_IDL = \
+       SALOMEDS.idl SALOME_Exception.idl \
+       GEOM_Gen.idl GEOM_Shape.idl MED.idl SALOMEDS_Attributes.idl \
+       SMESH_Gen.idl SMESH_Hypothesis.idl SMESH_Group.idl
+
+# Executables targets
+BIN = 
+BIN_SRC = 
+
+# additionnal information to compil and link file
+CPPFLAGS+= $(OCC_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+           -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CXXFLAGS+= $(OCC_CXXFLAGS) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
+
+#IDLCXXFLAGS+= -Wbtp
+
+#LDFLAGS+= $(HDF5_LIBS) -lStdMeshers -lSMESHEngine -lSalomeLifeCycleCORBA -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeGenericObj
+LDFLAGS+= $(HDF5_LIBS) -lStdMeshers -lSMESHEngine -L${KERNEL_ROOT_DIR}/lib/salome
+
+@CONCLUDE@
diff --git a/src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx b/src/StdMeshers_I/StdMeshers_Hexa_3D_i.cxx
new file mode 100644 (file)
index 0000000..0ca4839
--- /dev/null
@@ -0,0 +1,84 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Hexa_3D_i.cxx
+//           Moved here from SMESH_Hexa_3D_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_Hexa_3D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_Hexa_3D_i::StdMeshers_Hexa_3D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_Hexa_3D_i::StdMeshers_Hexa_3D_i( PortableServer::POA_ptr thePOA,
+                                 int                     theStudyId,
+                                 ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA ), 
+       SMESH_Algo_i( thePOA ),
+       SMESH_3D_Algo_i( thePOA )
+{
+  MESSAGE( "StdMeshers_Hexa_3D_i::StdMeshers_Hexa_3D_i" );
+  myBaseImpl = new ::StdMeshers_Hexa_3D( theGenImpl->GetANewId(),
+                                   theStudyId,
+                                   theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Hexa_3D_i::~StdMeshers_Hexa_3D_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_Hexa_3D_i::~StdMeshers_Hexa_3D_i()
+{
+  MESSAGE( "StdMeshers_Hexa_3D_i::~StdMeshers_Hexa_3D_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Hexa_3D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Hexa_3D* StdMeshers_Hexa_3D_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_Hexa_3D_i::GetImpl" );
+  return ( ::StdMeshers_Hexa_3D* )myBaseImpl;
+}
diff --git a/src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx b/src/StdMeshers_I/StdMeshers_Hexa_3D_i.hxx
new file mode 100644 (file)
index 0000000..91bcabd
--- /dev/null
@@ -0,0 +1,61 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Hexa_3D_i.hxx
+//           Moved here from SMESH_Hexa_3D_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_HEXA_3D_I_HXX_
+#define _SMESH_HEXA_3D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_3D_Algo_i.hxx"
+#include "StdMeshers_Hexa_3D.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Hexaedron 3d algorithm
+// ======================================================
+class StdMeshers_Hexa_3D_i:
+  public virtual POA_StdMeshers::StdMeshers_Hexa_3D,
+  public virtual SMESH_3D_Algo_i
+{
+public:
+  // Constructor
+  StdMeshers_Hexa_3D_i( PortableServer::POA_ptr thePOA,
+                   int                     theStudyId,
+                  ::SMESH_Gen*            theGenImpl );
+
+  // Destructor
+  virtual ~StdMeshers_Hexa_3D_i();
+
+  // Get implementation
+  ::StdMeshers_Hexa_3D* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx b/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx
new file mode 100644 (file)
index 0000000..afcd3b1
--- /dev/null
@@ -0,0 +1,121 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LengthFromEdges_i.cxx
+//           Moved here from SMESH_LengthFromEdges_i.cxx
+//  Author : Nadir BOUHAMOU CEA/DEN, Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_LengthFromEdges_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i( PortableServer::POA_ptr thePOA,
+                                                 int                     theStudyId,
+                                                 ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA )
+{
+  MESSAGE( "StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i" );
+  myBaseImpl = new ::StdMeshers_LengthFromEdges( theGenImpl->GetANewId(),
+                                           theStudyId,
+                                           theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LengthFromEdges_i::~StdMeshers_LengthFromEdges_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_LengthFromEdges_i::~StdMeshers_LengthFromEdges_i()
+{
+  MESSAGE( "StdMeshers_LengthFromEdges_i::~StdMeshers_LengthFromEdges_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LengthFromEdges_i::SetMode
+ *
+ *  Set mode
+ */
+//=============================================================================
+
+void StdMeshers_LengthFromEdges_i::SetMode( CORBA::Long theMode )
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE( "StdMeshers_LengthFromEdges_i::SetMode" );
+  ASSERT( myBaseImpl );
+  try {
+    this->GetImpl()->SetMode( theMode );
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+                                 SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LengthFromEdges_i::GetMode
+ *
+ *  Get mode
+ */
+//=============================================================================
+
+CORBA::Long StdMeshers_LengthFromEdges_i::GetMode()
+{
+  MESSAGE( "StdMeshers_LengthFromEdges_i::GetMode" );
+  ASSERT( myBaseImpl );
+  return this->GetImpl()->GetMode();
+}
+
+
+//=============================================================================
+/*!
+ *  StdMeshers_LengthFromEdges_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_LengthFromEdges* StdMeshers_LengthFromEdges_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_LengthFromEdges_i::GetImpl" );
+  return ( ::StdMeshers_LengthFromEdges* )myBaseImpl;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx b/src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx
new file mode 100644 (file)
index 0000000..2c988a1
--- /dev/null
@@ -0,0 +1,65 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LengthFromEdges_i.hxx
+//           Moved here from SMESH_LengthFromEdges_i.hxx
+//  Author : Nadir BOUHAMOU CEA/DEN, Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_LENGTHFROMEDGES_I_HXX_
+#define _SMESH_LENGTHFROMEDGES_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_LengthFromEdges.hxx"
+
+// ======================================================
+// Length from edges hypothesis
+// ======================================================
+class StdMeshers_LengthFromEdges_i:
+  public virtual POA_StdMeshers::StdMeshers_LengthFromEdges,
+  public virtual SMESH_Hypothesis_i
+{
+public:
+  // Constructor
+  StdMeshers_LengthFromEdges_i( PortableServer::POA_ptr thePOA,
+                           int                     theStudyId,
+                           ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_LengthFromEdges_i();
+
+  // Set mode
+  void SetMode( CORBA::Long theMode )
+    throw ( SALOME::SALOME_Exception );
+  // Get mode
+  CORBA::Long GetMode();
+
+  // Get implementation
+  ::StdMeshers_LengthFromEdges* GetImpl();
+};
+
+#endif
+
diff --git a/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx b/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx
new file mode 100644 (file)
index 0000000..15b3eb7
--- /dev/null
@@ -0,0 +1,119 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LocalLength_i.cxx
+//           Moved here from SMESH_LocalLength_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_LocalLength_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_LocalLength_i::StdMeshers_LocalLength_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_LocalLength_i::StdMeshers_LocalLength_i( PortableServer::POA_ptr thePOA,
+                                         int                     theStudyId,
+                                         ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA )
+{
+  MESSAGE( "StdMeshers_LocalLength_i::StdMeshers_LocalLength_i" );
+  myBaseImpl = new ::StdMeshers_LocalLength( theGenImpl->GetANewId(),
+                                       theStudyId,
+                                       theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LocalLength_i::~StdMeshers_LocalLength_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_LocalLength_i::~StdMeshers_LocalLength_i()
+{
+  MESSAGE( "StdMeshers_LocalLength_i::~StdMeshers_LocalLength_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LocalLength_i::SetLength
+ *
+ *  Set length
+ */
+//=============================================================================
+
+void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength )
+     throw ( SALOME::SALOME_Exception )
+{
+  MESSAGE( "StdMeshers_LocalLength_i::SetLength" );
+  ASSERT( myBaseImpl );
+  try {
+    this->GetImpl()->SetLength( theLength );
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+                                 SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LocalLength_i::GetLength
+ *
+ *  Get length
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_LocalLength_i::GetLength()
+{
+  MESSAGE( "StdMeshers_LocalLength_i::GetLength" );
+  ASSERT( myBaseImpl );
+  return this->GetImpl()->GetLength();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_LocalLength_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_LocalLength* StdMeshers_LocalLength_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_LocalLength_i::GetImpl" );
+  return ( ::StdMeshers_LocalLength* )myBaseImpl;
+}
diff --git a/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx b/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx
new file mode 100644 (file)
index 0000000..6b0b1db
--- /dev/null
@@ -0,0 +1,67 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_LocalLength_i.hxx
+//           Moved here from SMESH_LocalLength_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_LOCALLENGTH_I_HXX_
+#define _SMESH_LOCALLENGTH_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_LocalLength.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Local Length hypothesis
+// ======================================================
+class StdMeshers_LocalLength_i:
+  public virtual POA_StdMeshers::StdMeshers_LocalLength,
+  public virtual SMESH_Hypothesis_i
+{
+public:
+  // Constructor
+  StdMeshers_LocalLength_i( PortableServer::POA_ptr thePOA,
+                       int                     theStudyId,
+                       ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_LocalLength_i();
+
+  // Set length
+  void SetLength( CORBA::Double theLength )
+    throw ( SALOME::SALOME_Exception );
+  // Get length
+  CORBA::Double GetLength();
+
+  // Get implementation
+  ::StdMeshers_LocalLength* GetImpl();
+};
+
+#endif
+
diff --git a/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx b/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.cxx
new file mode 100644 (file)
index 0000000..efcc37c
--- /dev/null
@@ -0,0 +1,85 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MEFISTO_2D_i.cxx
+//           Moved here from SMESH_MEFISTO_2D_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_MEFISTO_2D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_MEFISTO_2D_i::StdMeshers_MEFISTO_2D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_MEFISTO_2D_i::StdMeshers_MEFISTO_2D_i( PortableServer::POA_ptr thePOA,
+                                       int                     theStudyId,
+                                       ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA ), 
+       SMESH_Algo_i( thePOA ),
+       SMESH_2D_Algo_i( thePOA )
+{
+  MESSAGE( "StdMeshers_MEFISTO_2D_i::StdMeshers_MEFISTO_2D_i" );
+  myBaseImpl = new ::StdMeshers_MEFISTO_2D( theGenImpl->GetANewId(),
+                                      theStudyId,
+                                      theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MEFISTO_2D_i::~StdMeshers_MEFISTO_2D_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_MEFISTO_2D_i::~StdMeshers_MEFISTO_2D_i()
+{
+  MESSAGE( "StdMeshers_MEFISTO_2D_i::~StdMeshers_MEFISTO_2D_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MEFISTO_2D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_MEFISTO_2D* StdMeshers_MEFISTO_2D_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_MEFISTO_2D_i::GetImpl" );
+  return ( ::StdMeshers_MEFISTO_2D* )myBaseImpl;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx b/src/StdMeshers_I/StdMeshers_MEFISTO_2D_i.hxx
new file mode 100644 (file)
index 0000000..d7021df
--- /dev/null
@@ -0,0 +1,61 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MEFISTO_2D_i.hxx
+//           Moved here from SMESH_MEFISTO_2D_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _StdMeshers_MEFISTO_2D_I_HXX_
+#define _StdMeshers_MEFISTO_2D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_2D_Algo_i.hxx"
+#include "StdMeshers_MEFISTO_2D.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Triangle (MEFISTO) 2d algorithm
+// ======================================================
+class StdMeshers_MEFISTO_2D_i:
+  public virtual POA_StdMeshers::StdMeshers_MEFISTO_2D,
+  public virtual SMESH_2D_Algo_i
+{
+public:
+  // Constructor
+  StdMeshers_MEFISTO_2D_i( PortableServer::POA_ptr thePOA,
+                      int                     theStudyId,
+                     ::SMESH_Gen*            theGenImpl );
+
+  // Destructor
+  virtual ~StdMeshers_MEFISTO_2D_i();
+
+  // Get implementation
+  ::StdMeshers_MEFISTO_2D* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx
new file mode 100644 (file)
index 0000000..51810e0
--- /dev/null
@@ -0,0 +1,119 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementArea_i.cxx
+//           Moved here from SMESH_MaxElementArea_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_MaxElementArea_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementArea_i::StdMeshers_MaxElementArea_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_MaxElementArea_i::StdMeshers_MaxElementArea_i( PortableServer::POA_ptr thePOA,
+                                               int                     theStudyId,
+                                               ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA ) 
+{
+  MESSAGE( "StdMeshers_MaxElementArea_i::StdMeshers_MaxElementArea_i" );
+  myBaseImpl = new ::StdMeshers_MaxElementArea( theGenImpl->GetANewId(),
+                                          theStudyId,
+                                          theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementArea_i::~StdMeshers_MaxElementArea_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_MaxElementArea_i::~StdMeshers_MaxElementArea_i()
+{
+  MESSAGE( "StdMeshers_MaxElementArea_i::~StdMeshers_MaxElementArea_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementArea_i::SetMaxElementArea
+ *
+ *  Set maximum element area 
+ */
+//=============================================================================
+
+void StdMeshers_MaxElementArea_i::SetMaxElementArea( CORBA::Double theArea )
+     throw ( SALOME::SALOME_Exception )
+{
+  MESSAGE( "StdMeshers_MaxElementArea_i::SetMaxElementArea" );
+  ASSERT( myBaseImpl );
+  try {
+    this->GetImpl()->SetMaxArea( theArea );
+  }
+  catch (SALOME_Exception& S_ex) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+                                 SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementArea_i::GetMaxElementArea
+ *
+ *  Get maximum element area 
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_MaxElementArea_i::GetMaxElementArea()
+{
+  MESSAGE( "StdMeshers_MaxElementArea_i::GetMaxElementArea" );
+  ASSERT( myBaseImpl );
+  return this->GetImpl()->GetMaxArea();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementArea_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_MaxElementArea* StdMeshers_MaxElementArea_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_MaxElementArea_i::GetImpl" );
+  return ( ::StdMeshers_MaxElementArea* )myBaseImpl;
+}
diff --git a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx
new file mode 100644 (file)
index 0000000..da21f80
--- /dev/null
@@ -0,0 +1,64 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementArea_i.hxx
+//           Moved here from SMESH_MaxElementArea_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_MAXELEMENTAREA_I_HXX_
+#define _SMESH_MAXELEMENTAREA_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_MaxElementArea.hxx"
+
+// ======================================================
+// Maximum Element Area hypothesis
+// ======================================================
+class StdMeshers_MaxElementArea_i:
+  public virtual POA_StdMeshers::StdMeshers_MaxElementArea,
+  public virtual SMESH_Hypothesis_i
+{
+public:
+  // Constructor
+  StdMeshers_MaxElementArea_i( PortableServer::POA_ptr thePOA,
+                          int                     theStudyId,
+                         ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_MaxElementArea_i();
+
+  // Set maximum element area 
+  void SetMaxElementArea( CORBA::Double theArea )
+    throw ( SALOME::SALOME_Exception );
+  // Get maximum element area 
+  CORBA::Double GetMaxElementArea();
+
+  // Get implementation
+  ::StdMeshers_MaxElementArea* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx
new file mode 100644 (file)
index 0000000..eb071b6
--- /dev/null
@@ -0,0 +1,120 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementVolume_i.cxx
+//           Moved here from SMESH_MaxElementVolume_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_MaxElementVolume_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementVolume_i::StdMeshers_MaxElementVolume_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_MaxElementVolume_i::StdMeshers_MaxElementVolume_i( PortableServer::POA_ptr thePOA,
+                                                   int                     theStudyId,
+                                                   ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA )
+{
+  MESSAGE( "StdMeshers_MaxElementVolume_i::StdMeshers_MaxElementVolume_i" );
+  myBaseImpl = new ::StdMeshers_MaxElementVolume( theGenImpl->GetANewId(),
+                                            theStudyId,
+                                            theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementVolume_i::~StdMeshers_MaxElementVolume_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_MaxElementVolume_i::~StdMeshers_MaxElementVolume_i()
+{
+  MESSAGE( "StdMeshers_MaxElementVolume_i::~StdMeshers_MaxElementVolume_i()" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementVolume_i::SetMaxElementVolume
+ *
+ *  Set maximum element volume 
+ */
+//=============================================================================
+
+void StdMeshers_MaxElementVolume_i::SetMaxElementVolume( CORBA::Double theVolume )
+     throw ( SALOME::SALOME_Exception )
+{
+  MESSAGE( "StdMeshers_MaxElementVolume_i::SetMaxElementVolume" );
+  ASSERT( myBaseImpl );
+  try {
+    this->GetImpl()->SetMaxVolume( theVolume );
+  }
+  catch (SALOME_Exception& S_ex) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+                                 SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementVolume_i::GetMaxElementVolume
+ *
+ *  Get maximum element volume 
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_MaxElementVolume_i::GetMaxElementVolume()
+{
+  MESSAGE( "StdMeshers_MaxElementVolume_i::GetMaxElementVolume" );
+  ASSERT( myBaseImpl );
+  return this->GetImpl()->GetMaxVolume();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_MaxElementVolume_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_MaxElementVolume* StdMeshers_MaxElementVolume_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_MaxElementVolume_i::GetImpl" );
+  return ( ::StdMeshers_MaxElementVolume* )myBaseImpl;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx
new file mode 100644 (file)
index 0000000..328b4af
--- /dev/null
@@ -0,0 +1,64 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_MaxElementVolume_i.hxx
+//           Moved here from SMESH_MaxElementVolume_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_
+#define _SMESH_MAXELEMENTVOLUME_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_MaxElementVolume.hxx"
+
+// ======================================================
+// Maximum Element Volume hypothesis
+// ======================================================
+class StdMeshers_MaxElementVolume_i:
+  public virtual POA_StdMeshers::StdMeshers_MaxElementVolume,
+  public virtual SMESH_Hypothesis_i
+{
+public:
+  // Constructor
+  StdMeshers_MaxElementVolume_i( PortableServer::POA_ptr thePOA,
+                            int                     theStudyId,
+                            ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_MaxElementVolume_i();
+
+  // Set maximum element volume
+  void SetMaxElementVolume( CORBA::Double theVolume )
+    throw (SALOME::SALOME_Exception);
+  // Get maximum element volume
+  CORBA::Double GetMaxElementVolume();
+
+  // Get implementation
+  ::StdMeshers_MaxElementVolume* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx b/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx
new file mode 100644 (file)
index 0000000..e2fad1e
--- /dev/null
@@ -0,0 +1,64 @@
+//  SMESH StdMeshers_I : idl implementation based on 'SMESH' unit's classes
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NotConformAllowed_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+using namespace std;
+#include "StdMeshers_NotConformAllowed_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  Constructor: 
+ *  _name is related to the class name: prefix = SMESH_ ; suffix = _i .
+ */
+//=============================================================================
+
+StdMeshers_NotConformAllowed_i::StdMeshers_NotConformAllowed_i
+                                (PortableServer::POA_ptr thePOA,
+                                 int                     studyId,
+                                 ::SMESH_Gen*            genImpl)
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA )
+{
+  MESSAGE("StdMeshers_NotConformAllowed_i::StdMeshers_NotConformAllowed_i");
+  myBaseImpl = new ::StdMeshers_NotConformAllowed(genImpl->GetANewId(),
+                                                  studyId,
+                                                  genImpl);
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_NotConformAllowed_i::~StdMeshers_NotConformAllowed_i()
+{
+}
diff --git a/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx b/src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx
new file mode 100644 (file)
index 0000000..a9151d3
--- /dev/null
@@ -0,0 +1,54 @@
+//  SMESH StdMeshers_I : idl implementation based on 'SMESH' unit's classes
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NotConformAllowed_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _StdMeshers_NotConformAllowed_I_HXX_
+#define _StdMeshers_NotConformAllowed_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+
+#include "StdMeshers_NotConformAllowed.hxx"
+
+class StdMeshers_NotConformAllowed_i:
+  public POA_StdMeshers::StdMeshers_NotConformAllowed,
+  public SMESH_Hypothesis_i
+{
+public:
+  StdMeshers_NotConformAllowed_i(PortableServer::POA_ptr thePOA,
+                                 int studyId,
+                                 ::SMESH_Gen* genImpl);
+  virtual ~StdMeshers_NotConformAllowed_i();
+
+protected:
+  ::StdMeshers_NotConformAllowed* _impl;
+};
+
+#endif
+
diff --git a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx
new file mode 100644 (file)
index 0000000..bf326bd
--- /dev/null
@@ -0,0 +1,157 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NumberOfSegments_i.cxx
+//           Moved here from SMESH_NumberOfSegments_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_NumberOfSegments_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i( PortableServer::POA_ptr thePOA,
+                                                   int                     theStudyId,
+                                                   ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA )
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i" );
+  myBaseImpl = new ::StdMeshers_NumberOfSegments( theGenImpl->GetANewId(),
+                                            theStudyId,
+                                            theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i()
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::SetNumberOfSegments
+ *
+ *  Set number of segments
+ */
+//=============================================================================
+
+void StdMeshers_NumberOfSegments_i::SetNumberOfSegments( CORBA::Long theSegmentsNumber )
+     throw ( SALOME::SALOME_Exception )
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::SetNumberOfSegments" );
+  ASSERT( myBaseImpl );
+  try {
+    this->GetImpl()->SetNumberOfSegments( theSegmentsNumber );
+  }
+  catch (SALOME_Exception& S_ex) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+                                 SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::GetNumberOfSegments
+ *
+ *  Get number of segments
+ */
+//=============================================================================
+
+CORBA::Long StdMeshers_NumberOfSegments_i::GetNumberOfSegments()
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::GetNumberOfSegments" );
+  ASSERT( myBaseImpl );
+  return this->GetImpl()->GetNumberOfSegments();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::SetScaleFactor
+ *
+ *  Set scalar factor
+ */
+//=============================================================================
+
+void StdMeshers_NumberOfSegments_i::SetScaleFactor( CORBA::Double theScaleFactor )
+     throw ( SALOME::SALOME_Exception )
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::SetScaleFactor" );
+  ASSERT( myBaseImpl );
+  try {
+    this->GetImpl()->SetScaleFactor( theScaleFactor );
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+                                 SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::GetScaleFactor
+ *
+ *  Get scalar factor
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_NumberOfSegments_i::GetScaleFactor()
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::GetScaleFactor" );
+  ASSERT( myBaseImpl );
+  return this->GetImpl()->GetScaleFactor();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_NumberOfSegments_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_NumberOfSegments* StdMeshers_NumberOfSegments_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_NumberOfSegments_i::GetImpl" );
+  return ( ::StdMeshers_NumberOfSegments* )myBaseImpl;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx
new file mode 100644 (file)
index 0000000..e8a5030
--- /dev/null
@@ -0,0 +1,70 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_NumberOfSegments_i.hxx
+//           Moved here from SMESH_NumberOfSegments_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_
+#define _SMESH_NUMBEROFSEGMENTS_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_NumberOfSegments.hxx"
+
+// ======================================================
+// Number of segments hypothesis
+// ======================================================
+class StdMeshers_NumberOfSegments_i:
+  public virtual POA_StdMeshers::StdMeshers_NumberOfSegments,
+  public virtual SMESH_Hypothesis_i
+{
+public:
+  // Constructor
+  StdMeshers_NumberOfSegments_i( PortableServer::POA_ptr thePOA,
+                            int                     theStudyId,
+                           ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_NumberOfSegments_i();
+
+  // Set number of segments
+  void SetNumberOfSegments( CORBA::Long theSegmentsNumber )
+    throw ( SALOME::SALOME_Exception );
+  // Get number of segments
+  CORBA::Long GetNumberOfSegments();
+
+  // Set scalar factor
+  void SetScaleFactor( CORBA::Double theScaleFactor )
+    throw ( SALOME::SALOME_Exception );
+  // Get scalar factor
+  CORBA::Double GetScaleFactor();
+
+  // Get implementation
+  ::StdMeshers_NumberOfSegments* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx b/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.cxx
new file mode 100644 (file)
index 0000000..059eac9
--- /dev/null
@@ -0,0 +1,86 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Quadrangle_2D_i.cxx
+//           Moved here from SMESH_Quadrangle_2D_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_Quadrangle_2D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i( PortableServer::POA_ptr thePOA,
+                                             int                     theStudyId,
+                                             ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA ), 
+       SMESH_Algo_i( thePOA ),
+       SMESH_2D_Algo_i( thePOA )
+{
+  MESSAGE( "StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i" );
+  myBaseImpl = new ::StdMeshers_Quadrangle_2D( theGenImpl->GetANewId(),
+                                         theStudyId,
+                                         theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Quadrangle_2D_i::~StdMeshers_Quadrangle_2D_i
+ *
+ *  Destructor
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Quadrangle_2D_i::~StdMeshers_Quadrangle_2D_i()
+{
+  MESSAGE( "StdMeshers_Quadrangle_2D_i::~StdMeshers_Quadrangle_2D_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Quadrangle_2D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Quadrangle_2D* StdMeshers_Quadrangle_2D_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_Quadrangle_2D_i::GetImpl" );
+  return ( ::StdMeshers_Quadrangle_2D* )myBaseImpl;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx b/src/StdMeshers_I/StdMeshers_Quadrangle_2D_i.hxx
new file mode 100644 (file)
index 0000000..a8c1e28
--- /dev/null
@@ -0,0 +1,61 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Quadrangle_2D_i.hxx
+//           Moved here from SMESH_Quadrangle_2D_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_QUADRANGLE_2D_I_HXX_
+#define _SMESH_QUADRANGLE_2D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_2D_Algo_i.hxx"
+#include "StdMeshers_Quadrangle_2D.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Quadrangle (Mapping) 2d algorithm
+// ======================================================
+class StdMeshers_Quadrangle_2D_i:
+  public virtual POA_StdMeshers::StdMeshers_Quadrangle_2D,
+  public virtual SMESH_2D_Algo_i
+{
+public:
+  // Constructor
+  StdMeshers_Quadrangle_2D_i( PortableServer::POA_ptr thePOA,
+                         int                     theStudyId,
+                        ::SMESH_Gen*            theGenImpl );
+
+  // Destructor
+  virtual ~StdMeshers_Quadrangle_2D_i();
+
+  // Get implementation
+  ::StdMeshers_Quadrangle_2D* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx b/src/StdMeshers_I/StdMeshers_Regular_1D_i.cxx
new file mode 100644 (file)
index 0000000..24f322c
--- /dev/null
@@ -0,0 +1,85 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Regular_1D_i.cxx
+//           Moved here from SMESH_Regular_1D_i.cxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "StdMeshers_Regular_1D_i.hxx"
+#include "SMESH_Gen.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+//=============================================================================
+/*!
+ *  StdMeshers_Regular_1D_i::StdMeshers_Regular_1D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_Regular_1D_i::StdMeshers_Regular_1D_i( PortableServer::POA_ptr thePOA,
+                                       int                     theStudyId,
+                                       ::SMESH_Gen*            theGenImpl )
+     : SALOME::GenericObj_i( thePOA ), 
+       SMESH_Hypothesis_i( thePOA ), 
+       SMESH_Algo_i( thePOA ),
+       SMESH_1D_Algo_i( thePOA )
+{
+  MESSAGE( "StdMeshers_Regular_1D_i::StdMeshers_Regular_1D_i" );
+  myBaseImpl = new ::StdMeshers_Regular_1D( theGenImpl->GetANewId(),
+                                      theStudyId,
+                                      theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Regular_1D_i::~StdMeshers_Regular_1D_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_Regular_1D_i::~StdMeshers_Regular_1D_i()
+{
+  MESSAGE( "StdMeshers_Regular_1D_i::~StdMeshers_Regular_1D_i" );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Regular_1D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Regular_1D* StdMeshers_Regular_1D_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_Regular_1D_i::GetImpl" );
+  return ( ::StdMeshers_Regular_1D* )myBaseImpl;
+}
+
diff --git a/src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx b/src/StdMeshers_I/StdMeshers_Regular_1D_i.hxx
new file mode 100644 (file)
index 0000000..3231532
--- /dev/null
@@ -0,0 +1,58 @@
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : StdMeshers_Regular_1D_i.hxx
+//           Moved here from SMESH_Regular_1D_i.hxx
+//  Author : Paul RASCLE, EDF
+//  Module : SMESH
+//  $Header$
+
+#ifndef _SMESH_REGULAR_1D_I_HXX_
+#define _SMESH_REGULAR_1D_I_HXX_
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_1D_Algo_i.hxx"
+#include "StdMeshers_Regular_1D.hxx"
+
+// ======================================================
+// Wire Discretization 1d algorithm
+// ======================================================
+class StdMeshers_Regular_1D_i:
+  public virtual POA_StdMeshers::StdMeshers_Regular_1D,
+  public virtual SMESH_1D_Algo_i
+{
+public:
+  // Constructor
+  StdMeshers_Regular_1D_i( PortableServer::POA_ptr thePOA,
+                      int                     theStudyId,
+                     ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_Regular_1D_i();
+  // Get implementation
+  ::StdMeshers_Regular_1D* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx
new file mode 100644 (file)
index 0000000..c24606d
--- /dev/null
@@ -0,0 +1,86 @@
+//  SMESH StdMeshers : implementaion of SMESH idl descriptions
+//
+//  Copyright (C) 2003  CEA
+// 
+//  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.org
+//
+//
+//
+//  File   : StdMeshers_i.cxx
+//  Author : Julia DOROVSKIKH
+//  Module : SMESH
+//  $Header$
+
+using namespace std;
+#include "SMESH_Gen_i.hxx"
+
+#include "utilities.h"
+
+#include "StdMeshers_LocalLength_i.hxx"
+#include "StdMeshers_LengthFromEdges_i.hxx"
+#include "StdMeshers_NotConformAllowed_i.hxx"
+#include "StdMeshers_NumberOfSegments_i.hxx"
+#include "StdMeshers_MaxElementArea_i.hxx"
+#include "StdMeshers_MaxElementVolume_i.hxx"
+
+#include "StdMeshers_Regular_1D_i.hxx"
+#include "StdMeshers_MEFISTO_2D_i.hxx"
+#include "StdMeshers_Quadrangle_2D_i.hxx"
+#include "StdMeshers_Hexa_3D_i.hxx"
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+extern "C"
+{
+  GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
+  {
+    MESSAGE("Get HypothesisCreator for " << aHypName);
+
+    GenericHypothesisCreator_i* aCreator = 0;
+
+    // Hypotheses
+    if      (strcmp(aHypName, "LocalLength") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_LocalLength_i>;
+    else if (strcmp(aHypName, "NumberOfSegments") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
+    else if (strcmp(aHypName, "LengthFromEdges") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
+    else if (strcmp(aHypName, "NotConformAllowed") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
+    else if (strcmp(aHypName, "MaxElementArea") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_MaxElementArea_i>;
+    else if (strcmp(aHypName, "MaxElementVolume") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
+
+    // Algorithms
+    else if (strcmp(aHypName, "Regular_1D") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_Regular_1D_i>;
+    else if (strcmp(aHypName, "MEFISTO_2D") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_MEFISTO_2D_i>;
+    else if (strcmp(aHypName, "Quadrangle_2D") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_Quadrangle_2D_i>;
+    else if (strcmp(aHypName, "Hexa_3D") == 0)
+      aCreator = new HypothesisCreator_i<StdMeshers_Hexa_3D_i>;
+    else ;
+
+    return aCreator;
+  }
+}