Salome HOME
22384: [CEA 831] New wire discretization hypothesis: geometric progression
authoreap <eap@opencascade.com>
Wed, 25 Dec 2013 14:05:14 +0000 (14:05 +0000)
committereap <eap@opencascade.com>
Wed, 25 Dec 2013 14:05:14 +0000 (14:05 +0000)
27 files changed:
doc/salome/examples/defining_hypotheses_ex01.py
doc/salome/gui/SMESH/images/a-geometric1d.png [new file with mode: 0644]
doc/salome/gui/SMESH/input/1d_meshing_hypo.doc
doc/salome/gui/SMESH/input/about_hypo.doc
doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc
idl/SMESH_BasicHypothesis.idl
resources/StdMeshers.xml.in
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHUtils/SMESH_Block.hxx
src/SMESH_SWIG/StdMeshersBuilder.py
src/StdMeshers/CMakeLists.txt
src/StdMeshers/StdMeshers_Geometric1D.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Geometric1D.hxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Regular_1D.cxx
src/StdMeshers/StdMeshers_Regular_1D.hxx
src/StdMeshers/StdMeshers_Reversible1D.cxx [new file with mode: 0644]
src/StdMeshers/StdMeshers_Reversible1D.hxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshers_images.ts
src/StdMeshersGUI/StdMeshers_msg_en.ts
src/StdMeshersGUI/StdMeshers_msg_fr.ts
src/StdMeshers_I/CMakeLists.txt
src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_i.cxx

index 4bb75c56b3b45a5e8b3fd802f8a22bf0317bae16..1d5d281c8f798665d75b01154bb9912d3a0eadfe 100644 (file)
@@ -1,12 +1,11 @@
-# Arithmetic 1D
+# Arithmetic 1D and Geometric Progression
 
 import salome
 salome.salome_init()
-import GEOM
+
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
 
-import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 smesh =  smeshBuilder.New(salome.myStudy)
 
@@ -21,12 +20,20 @@ hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
 algo1D = hexa.Segment()
 
 # optionally reverse node distribution on certain edges
-allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
+allEdges = geompy.SubShapeAllSorted( box, geompy.ShapeType["EDGE"])
 reversedEdges = [ allEdges[0], allEdges[4] ]
 
 # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
 algo1D.Arithmetic1D(1, 4, reversedEdges)
 
+# define "Geometric Progression" hypothesis on one edge to cut this edge in segments with length increasing by 20% starting from 1
+gpAlgo = hexa.Segment( allEdges[1] )
+gpAlgo.GeometricProgression( 1, 1.2 )
+
+# propagate distribution of nodes computed using "Geometric Progression" to parallel edges
+gpAlgo.PropagationOfDistribution() 
+
+
 # create a quadrangle 2D algorithm for faces
 hexa.Quadrangle()
 
diff --git a/doc/salome/gui/SMESH/images/a-geometric1d.png b/doc/salome/gui/SMESH/images/a-geometric1d.png
new file mode 100644 (file)
index 0000000..a60be94
Binary files /dev/null and b/doc/salome/gui/SMESH/images/a-geometric1d.png differ
index 5deb1344a9ec13da3beb6b16ce2cf28b0b9a1457..08758992b423682bd198931d4b59759af5bb1c7a 100644 (file)
@@ -6,6 +6,7 @@
 <ul>
 <li>\ref adaptive_1d_anchor "Adaptive"</li>
 <li>\ref arithmetic_1d_anchor "Arithmetic 1D"</li>
+<li>\ref geometric_1d_anchor "Geometric Progression"</li>
 <li>\ref average_length_anchor "Local Length"</li>
 <li>\ref max_length_anchor "Max Size"</li>
 <li>\ref deflection_1d_anchor "Deflection 1D"</li>
@@ -56,7 +57,30 @@ picking them in the 3D viewer or by selecting the edges or groups of edges in th
 \image html b-ithmetic1d.png "Arithmetic 1D hypothesis - the size of mesh elements gradually increases"
 
 <b>See Also</b> a sample TUI Script of a 
-\ref tui_1d_arithmetic "Defining Arithmetic 1D hypothesis" operation.  
+\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation.  
+
+<br>
+\anchor geometric_1d_anchor
+<h2>Geometric Progression hypothesis</h2>
+
+<b>Geometric Progression</b> hypothesis allows to split edges into
+segments with a length that changes in geometric progression (Lk =
+Lk-1 * d) beginning from a given starting length and with a given
+common ratio.
+
+The direction of the splitting is defined by the orientation of the
+underlying geometrical edge. <b>"Reverse Edges"</b> list box allows to
+specify the edges for which the splitting should be made in the
+direction opposing to their orientation. This list box is enabled only
+if the geometry object is selected for the meshing. In this case the
+user can select edges to be reversed either directly picking them in
+the 3D viewer or by selecting the edges or groups of edges in the
+Object Browser. 
+
+\image html a-geometric1d.png
+
+<b>See Also</b> a sample TUI Script of a 
+\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation.  
 
 <br>
 \anchor deflection_1d_anchor
index 14f6bcde5918249a67aaabbe00d7f08226a81b91..65d5c7ad0b24550bdb198ab9d10499364296cd4f 100644 (file)
@@ -20,6 +20,7 @@ In \b MESH there are the following Basic Hypotheses:
 <li>\ref max_length_anchor "Max Size"</li>
 <li>\ref adaptive_1d_anchor "Adaptive"</li>
 <li>\ref arithmetic_1d_anchor "Arithmetic 1D"</li>
+<li>\ref geometric_1d_anchor "Geometric 1D"</li>
 <li>\ref start_and_end_length_anchor "Start and end length"</li>
 <li>\ref deflection_1d_anchor "Deflection 1D"</li>
 <li>\ref automatic_length_anchor "Automatic Length"</li>
index 333017d774aa8ca4d5a5bb9e834869528805f98e..863bf76e7e031d051e49937154b03c659820e22d 100644 (file)
@@ -9,6 +9,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
   <ul>
     <li>\ref tui_1d_adaptive "Adaptive 1D" hypothesis</li>
     <li>\ref tui_1d_arithmetic "Arithmetic 1D" hypothesis</li>
+    <li>\ref tui_1d_arithmetic "Geometric Progression" hypothesis</li>
     <li>\ref tui_deflection_1d "Deflection 1D and Number of Segments" hypotheses</li>
     <li>\ref tui_start_and_end_length "Start and End Length" hypotheses</li>
     <li>\ref tui_average_length "Local Length"</li>
@@ -44,7 +45,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
 
 <br>
 \anchor tui_1d_arithmetic
-<h3>Arithmetic 1D</h3>
+<h3>Arithmetic 1D and Geometric Progression</h3>
 \tui_script{defining_hypotheses_ex01.py}
 
 <br>
index 69dbd4a8cbac1e7819df8677383998365128b690..6cea399d4f04bdb56209ff067338f50760ac7d47 100644 (file)
@@ -127,10 +127,36 @@ module StdMeshers
     double GetFineness();
   };
 
+  /*!
+   * Common inteface of 1D hypotheses that can be reversed
+   */
+  interface Reversible1D
+  {
+    /*!
+     * Set list of edges to reverse
+     */
+    void SetReversedEdges( in SMESH::long_array list );
+    
+    /*!
+     * Returns list of edges to reverse
+     */
+    SMESH::long_array GetReversedEdges();
+    
+    /*!
+     * Set entry of the main object
+     */
+    void SetObjectEntry( in string entry );
+    
+    /*!
+     * Get the entry of the main object
+     */
+    string GetObjectEntry();
+  };
+
   /*!
    * StdMeshers_NumberOfSegments: interface of "Nb. Segments" hypothesis
    */
-  interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis
+  interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis, Reversible1D
   {
     /*!
      * Builds and returns point distribution according to passed density function
@@ -209,32 +235,12 @@ module StdMeshers
      */
     long ConversionMode()
       raises (SALOME::SALOME_Exception);
-
-    /*!
-     * Set list of edges to reverse
-     */
-    void SetReversedEdges( in SMESH::long_array list );
-    
-    /*!
-     * Returns list of edges to reverse
-     */
-    SMESH::long_array GetReversedEdges();
-    
-    /*!
-     * Set entry of the main object
-     */
-    void SetObjectEntry( in string entry );
-    
-    /*!
-     * Get the entry of the main object
-     */
-    string GetObjectEntry();
   };
 
   /*!
    * StdMeshers_Arithmetic1D: interface of "Arithmetic 1D" hypothesis
    */
-  interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis
+  interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis, Reversible1D
   {
     /*!
      * Sets <start segment length> or <end segment length> parameter value
@@ -260,26 +266,36 @@ module StdMeshers
      * Returns <start segment length> or <end segment length> parameter value
      */
     double GetLength(in boolean isStartLength);
-    
+
+  };
+
+  /*!
+   * StdMeshers_Arithmetic1D: interface of "Geometric 1D" hypothesis
+   */
+  interface StdMeshers_Geometric1D : SMESH::SMESH_Hypothesis, Reversible1D
+  {
     /*!
-     * Set list of edges to reverse
+     * Sets length of the first segment
      */
-    void SetReversedEdges( in SMESH::long_array list );
-    
+    void SetStartLength(in double length) 
+      raises (SALOME::SALOME_Exception);
+
     /*!
-     * Returns list of edges to reverse
+     * Sets value of Common Ratio
      */
-    SMESH::long_array GetReversedEdges();
-    
+    void SetCommonRatio(in double factor)
+      raises (SALOME::SALOME_Exception);
+
     /*!
-     * Set entry of the main object
+     * Returns length of the first segment
      */
-    void SetObjectEntry( in string entry );
-    
+    double GetStartLength();
+
     /*!
-     * Get the entry of the main object
+     * Returns value of Common Ratio
      */
-    string GetObjectEntry();
+    double GetCommonRatio();
+
   };
 
   /*!
@@ -319,7 +335,7 @@ module StdMeshers
   /*!
    * StdMeshers_StartEndLength: interface of "Start and End Length" hypothesis
    */
-  interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis
+  interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis, Reversible1D
   {
     /*!
      * Sets <start segment length> or <end segment length> parameter value
@@ -346,25 +362,6 @@ module StdMeshers
      */
     double GetLength(in boolean isStartLength);
 
-    /*!
-     * Set list of edges to reverse
-     */
-    void SetReversedEdges( in SMESH::long_array list );
-    
-    /*!
-     * Returns list of edges to reverse
-     */
-    SMESH::long_array GetReversedEdges();
-    
-    /*!
-     * Set entry of the main object
-     */
-    void SetObjectEntry( in string entry );
-    
-    /*!
-     * Get the entry of the main object
-     */
-    string GetObjectEntry();
   };
 
 
@@ -388,7 +385,7 @@ module StdMeshers
   /*!
    * StdMeshers_FixedPoints1D: interface of "Fixed points 1D" hypothesis
    */
-  interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis
+  interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis, Reversible1D
   {
     /*!
      * Sets some points on edge using parameter on curve from 0 to 1
@@ -410,26 +407,7 @@ module StdMeshers
      * Returns list of numbers of segments
      */
     SMESH::long_array GetNbSegments();
-    
-    /*!
-     * Set list of edges to reverse
-     */
-    void SetReversedEdges( in SMESH::long_array list );
-    
-    /*!
-     * Returns list of edges to reverse
-     */
-    SMESH::long_array GetReversedEdges();
-    
-    /*!
-     * Set entry of the main object
-     */
-    void SetObjectEntry( in string entry );
-    
-    /*!
-     * Get the entry of the main object
-     */
-    string GetObjectEntry();
+
   };
 
   /*!
index 9ecf423ca302d6890eb74ae47ab18c9ad1e574df..93a04564baf9f2ef50ceb57d6ac1723e4cace6d7 100644 (file)
                 icon-id  ="mesh_hypo_length.png"
                 dim      ="1"/>
 
+    <hypothesis type     ="GeometricProgression"
+                label-id ="Geometric Progression"
+                icon-id  ="mesh_hypo_length.png"
+                dim      ="1"/>
+
     <hypothesis type     ="FixedPoints1D"
                 label-id ="Fixed Points 1D"
                 icon-id  ="mesh_hypo_length.png"
     <algorithm type     ="Regular_1D"
               label-id ="Wire Discretisation"
               icon-id  ="mesh_algo_regular.png"
-               hypos    ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
+               hypos    ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,GeometricProgression,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
                opt-hypos="Propagation,PropagOfDistribution,QuadraticMesh"
                input    ="VERTEX"
                output   ="EDGE"
         <hypo>LocalLength=LocalLength(SetLength(1),,SetPrecision(1))</hypo>
         <hypo>MaxLength=MaxSize(SetLength(1))</hypo>
         <hypo>Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
+        <hypo>GeometricProgression=GeometricProgression(SetStartLength(),SetCommonRatio(),SetReversedEdges())</hypo>
         <hypo>StartEndLength=StartEndLength(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
         <hypo>Deflection1D=Deflection1D(SetDeflection())</hypo>
         <hypo>Adaptive1D=Adaptive(SetMinSize(),SetMaxSize(),SetDeflection())</hypo>
     <algorithm type     ="CompositeSegment_1D"
               label-id ="Composite Side Discretisation"
               icon-id  ="mesh_algo_regular.png"
-               hypos    ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
+               hypos    ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,GeometricProgression,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
                opt-hypos="Propagation,PropagOfDistribution,QuadraticMesh"
                input    ="VERTEX"
                output   ="EDGE"
         <hypo>LocalLength=LocalLength(SetLength(), ,SetPrecision())</hypo>
         <hypo>MaxLength=MaxSize(SetLength())</hypo>
         <hypo>Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
+        <hypo>GeometricProgression=GeometricProgression(SetStartLength(),SetCommonRatio(),SetReversedEdges())</hypo>
         <hypo>StartEndLength=StartEndLength(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
         <hypo>Deflection1D=Deflection1D(SetDeflection())</hypo>
         <hypo>Adaptive1D=Adaptive(SetMinSize(),SetMaxSize(),SetDeflection())</hypo>
index fa9add8e0b6a73cffd1ccfe5c1feb9e8bccb49ec..e8ebeea2509dfa5c9af015401730ce9f719a7c60 100644 (file)
@@ -551,6 +551,8 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
     aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
   else if ( aHypType == "Arithmetic1D")
     aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
+  else if ( aHypType == "GeometricProgression")
+    aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
   else if ( aHypType == "FixedPoints1D")
     aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
   else if ( aHypType == "MaxElementArea")
index b0ee6f5c5aadd3b9e0fba06bc32c6875fe9ffb45..4fc6901370ce49104eb72795b3ebd3d8a12f870d 100644 (file)
@@ -284,7 +284,7 @@ public:
                               std::list< int >  &       theNbEdgesInWires,
                               TopoDS_Vertex             theFirstVertex=TopoDS_Vertex(),
                               const bool                theShapeAnalysisAlgo=false);
-  // Return nb wires and a list of oredered edges.
+  // Return nb wires and a list of ordered edges.
   // It is used to assign indices to subshapes.
   // theFirstVertex may be NULL.
   // Always try to set a seam edge first
index 46737b38e2c4af74c4ea1664a26e38368fee01c4..4e5b2d217cf13a4f5c29ad59304fb1cc18930c79 100644 (file)
@@ -199,7 +199,8 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         hyp.SetDeflection(deflection)
         return hyp
 
-    ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length
+    ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
+    #  that changes in arithmetic progression
     #  @param start defines the length of the first segment
     #  @param end   defines the length of the last  segment
     #  @param reversedEdges is a list of edges to mesh using reversed orientation.
@@ -226,6 +227,32 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         hyp.SetObjectEntry( entry )
         return hyp
 
+    ## Defines "GeometricProgression" hypothesis to cut an edge in several
+    #  segments with a length that changes in Geometric progression
+    #  @param start defines the length of the first segment
+    #  @param ratio defines the common ratio of the geometric progression
+    #  @param reversedEdges is a list of edges to mesh using reversed orientation.
+    #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
+    #  @param UseExisting if ==true - searches for an existing hypothesis created with
+    #                     the same parameters, else (default) - creates a new one
+    #  @return an instance of StdMeshers_Geometric1D hypothesis
+    #  @ingroup l3_hypos_1dhyps
+    def GeometricProgression(self, start, ratio, reversedEdges=[], UseExisting=0):
+        reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
+        entry = self.MainShapeEntry()
+        from salome.smesh.smeshBuilder import IsEqual
+        compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
+                                      IsEqual(hyp.GetLength(0), args[1]) and \
+                                      hyp.GetReversedEdges() == args[2]  and \
+                                      (not args[2] or hyp.GetObjectEntry() == args[3]))
+        hyp = self.Hypothesis("GeometricProgression", [start, ratio, reversedEdgeInd, entry],
+                              UseExisting=UseExisting, CompareMethod=compFun)
+        hyp.SetStartLength( start )
+        hyp.SetCommonRatio( ratio )
+        hyp.SetReversedEdges( reversedEdgeInd )
+        hyp.SetObjectEntry( entry )
+        return hyp
+
     ## Defines "FixedPoints1D" hypothesis to cut an edge using parameter
     # on curve from 0 to 1 (additionally it is neecessary to check
     # orientation of edges and create list of reversed edges if it is
@@ -237,7 +264,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
     #                       A list item can also be a tuple (edge, 1st_vertex_of_edge)
     #  @param UseExisting if ==true - searches for an existing hypothesis created with
     #                     the same parameters, else (default) - creates a new one
-    #  @return an instance of StdMeshers_Arithmetic1D hypothesis
+    #  @return an instance of StdMeshers_FixedPoints1D hypothesis
     #  @ingroup l3_hypos_1dhyps
     def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
@@ -1019,7 +1046,8 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
         return hyp
 
     ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
-    #  to build between the inner and the outer shells with a length that changes in arithmetic progression
+    #  to build between the inner and the outer shells with a length that changes
+    #  in arithmetic progression
     #  @param start  the length of the first segment
     #  @param end    the length of the last  segment
     def Arithmetic1D(self, start, end ):
@@ -1031,6 +1059,20 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
         hyp.SetLength(end  , 0)
         return hyp
 
+    ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
+    #  to build between the inner and the outer shells with a length that changes
+    #  in Geometric progression
+    #  @param start  the length of the first segment
+    #  @param ratio  the common ratio of the geometric progression
+    def GeometricProgression(self, start, ratio ):
+        if self.algoType != "RadialPrism_3D":
+            print "Prism_3D algorith doesn't support any hyposesis"
+            return None
+        hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
+        hyp.SetStartLength( start )
+        hyp.SetCommonRatio( ratio )
+        return hyp
+
     ## Defines "StartEndLength" hypothesis, specifying distribution of segments
     #  to build between the inner and the outer shells as geometric length increasing
     #  @param start for the length of the first segment
@@ -1187,6 +1229,16 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(Mesh_Algorithm):
         hyp.SetLength(end  , 0)
         return hyp
 
+    ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
+    #  with a length that changes in Geometric progression
+    #  @param start  the length of the first segment
+    #  @param ratio  the common ratio of the geometric progression
+    def GeometricProgression(self, start, ratio ):
+        hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
+        hyp.SetStartLength( start )
+        hyp.SetCommonRatio( ratio )
+        return hyp
+
     ## Defines "StartEndLength" hypothesis, specifying distribution of segments
     #  as geometric length increasing
     #  @param start for the length of the first segment
index de84b50262e8a2ad60486d545355d343ac43a2d1..2dde1b291e4c8f0faa8aba9db668a1ae7acb95ec 100644 (file)
@@ -75,8 +75,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
 # header files / no moc processing
 SET(StdMeshers_HEADERS
   StdMeshers_LocalLength.hxx
+  StdMeshers_Reversible1D.hxx
   StdMeshers_StartEndLength.hxx
   StdMeshers_Arithmetic1D.hxx
+  StdMeshers_Geometric1D.hxx
   StdMeshers_FixedPoints1D.hxx
   StdMeshers_NumberOfSegments.hxx
   StdMeshers_Deflection1D.hxx
@@ -136,8 +138,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
 # sources / static
 SET(StdMeshers_SOURCES
   StdMeshers_LocalLength.cxx
+  StdMeshers_Reversible1D.cxx
   StdMeshers_StartEndLength.cxx
   StdMeshers_Arithmetic1D.cxx
+  StdMeshers_Geometric1D.cxx
   StdMeshers_FixedPoints1D.cxx
   StdMeshers_NumberOfSegments.cxx
   StdMeshers_Deflection1D.cxx
diff --git a/src/StdMeshers/StdMeshers_Geometric1D.cxx b/src/StdMeshers/StdMeshers_Geometric1D.cxx
new file mode 100644 (file)
index 0000000..8d2be97
--- /dev/null
@@ -0,0 +1,204 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//  File   : StdMeshers_Geometric1D.cxx
+//  Module : SMESH
+//
+#include "StdMeshers_Geometric1D.hxx"
+
+#include "SMESH_Mesh.hxx"
+
+#include <BRepAdaptor_Curve.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <SMESH_Algo.hxx>
+#include <TopExp.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+
+StdMeshers_Geometric1D::StdMeshers_Geometric1D(int hypId, int studyId, SMESH_Gen * gen)
+  :StdMeshers_Reversible1D(hypId, studyId, gen)
+{
+  _begLength = 1.;
+  _ratio = 1.;
+  _name = "GeometricProgression";
+}
+
+//=============================================================================
+/*!
+ * Sets length of the first segment
+ */
+//=============================================================================
+
+void StdMeshers_Geometric1D::SetStartLength(double length)
+  throw(SALOME_Exception)
+{
+  if ( _begLength != length )
+  {
+    if (length <= 0)
+      throw SALOME_Exception(LOCALIZED("length must be positive"));
+    _begLength = length;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+/*!
+ * Sets value of Common Ratio
+ */
+//=============================================================================
+
+void StdMeshers_Geometric1D::SetCommonRatio(double factor)
+  throw(SALOME_Exception)
+{
+  if ( _ratio != factor )
+  {
+    if (factor == 0)
+      throw SALOME_Exception(LOCALIZED("Zero factor is not allowed"));
+    _ratio = factor;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+/*!
+ * Returns length of the first segment 
+ */
+//=============================================================================
+
+double StdMeshers_Geometric1D::GetStartLength() const
+{
+  return _begLength;
+}
+
+//=============================================================================
+/*!
+ * Returns value of Common Ratio
+ */
+//=============================================================================
+
+double StdMeshers_Geometric1D::GetCommonRatio() const
+{
+  return _ratio;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+ostream & StdMeshers_Geometric1D::SaveTo(ostream & save)
+{
+  save << _begLength << " " << _ratio << " ";
+
+  StdMeshers_Reversible1D::SaveTo( save );
+
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+istream & StdMeshers_Geometric1D::LoadFrom(istream & load)
+{
+  bool isOK = true;
+  isOK = (load >> _begLength);
+  isOK = (load >> _ratio);
+
+  if (isOK)
+    StdMeshers_Reversible1D::LoadFrom( load );
+
+  return load;
+}
+
+//================================================================================
+/*!
+ * \brief Initialize start and end length by the mesh built on the geometry
+ * \param theMesh - the built mesh
+ * \param theShape - the geometry of interest
+ * \retval bool - true if parameter values have been successfully defined
+ */
+//================================================================================
+
+bool StdMeshers_Geometric1D::SetParametersByMesh(const SMESH_Mesh*   theMesh,
+                                                 const TopoDS_Shape& theShape)
+{
+  if ( !theMesh || theShape.IsNull() )
+    return false;
+
+  _begLength = _ratio = 0.;
+
+  int nbEdges = 0;
+  TopTools_IndexedMapOfShape edgeMap;
+  TopExp::MapShapes( theShape, TopAbs_EDGE, edgeMap );
+  for ( int i = 1; i <= edgeMap.Extent(); ++i )
+  {
+    const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( i ));
+    BRepAdaptor_Curve C( edge );
+
+    vector< double > params;
+    if ( SMESH_Algo::GetNodeParamOnEdge( theMesh->GetMeshDS(), edge, params ))
+    {
+      nbEdges++;
+      double l1 = GCPnts_AbscissaPoint::Length( C, params[0], params[1] );
+      _begLength += l1;
+      if ( params.size() > 2 && l1 > 1e-100 )
+        _ratio += GCPnts_AbscissaPoint::Length( C, params[1], params[2]) / l1;
+      else
+        _ratio += 1;
+    }
+  }
+  if ( nbEdges ) {
+    _begLength /= nbEdges;
+    _ratio     /= nbEdges;
+  }
+  else {
+    _begLength = 1;
+    _ratio     = 1;
+  }
+  return nbEdges;
+}
+
+//================================================================================
+/*!
+ * \brief Initialize my parameter values by default parameters.
+ *  \retval bool - true if parameter values have been successfully defined
+ */
+//================================================================================
+
+bool StdMeshers_Geometric1D::SetParametersByDefaults(const TDefaults&  dflts,
+                                                     const SMESH_Mesh* /*mesh*/)
+{
+  return ( _begLength = dflts._elemLength );
+}
+
diff --git a/src/StdMeshers/StdMeshers_Geometric1D.hxx b/src/StdMeshers/StdMeshers_Geometric1D.hxx
new file mode 100644 (file)
index 0000000..436c317
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//  File   : StdMeshers_Geometric1D.hxx
+//  Module : SMESH
+//
+#ifndef _SMESH_Geometric1D_HXX_
+#define _SMESH_Geometric1D_HXX_
+
+#include "SMESH_StdMeshers.hxx"
+
+#include "StdMeshers_Reversible1D.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class STDMESHERS_EXPORT StdMeshers_Geometric1D: public StdMeshers_Reversible1D
+{
+public:
+  StdMeshers_Geometric1D(int hypId, int studyId, SMESH_Gen* gen);
+
+  void SetStartLength(double length) throw(SALOME_Exception);
+  void SetCommonRatio(double factor) throw(SALOME_Exception);
+
+  double GetStartLength() const;
+  double GetCommonRatio() const;
+
+  virtual std::ostream & SaveTo(std::ostream & save);
+  virtual std::istream & LoadFrom(std::istream & load);
+
+  /*!
+   * \brief Initialize start and end length by the mesh built on the geometry
+    * \param theMesh - the built mesh
+    * \param theShape - the geometry of interest
+    * \retval bool - true if parameter values have been successfully defined
+   */
+  virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+
+  /*!
+   * \brief Initialize my parameter values by default parameters.
+   *  \retval bool - true if parameter values have been successfully defined
+   */
+  virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+
+protected:
+  double _begLength, _ratio;
+};
+
+#endif
index 8c02a524f22ea00aea869b69ddcae303c12a7441..3470e50a2e9b44f27472bb97e85b76d533acf7e0 100644 (file)
@@ -37,6 +37,7 @@
 #include "SMESH_subMeshEventListener.hxx"
 #include "StdMeshers_Adaptive1D.hxx"
 #include "StdMeshers_Arithmetic1D.hxx"
+#include "StdMeshers_Geometric1D.hxx"
 #include "StdMeshers_AutomaticLength.hxx"
 #include "StdMeshers_Deflection1D.hxx"
 #include "StdMeshers_Distribution.hxx"
@@ -89,6 +90,7 @@ StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
   _compatibleHypothesis.push_back("StartEndLength");
   _compatibleHypothesis.push_back("Deflection1D");
   _compatibleHypothesis.push_back("Arithmetic1D");
+  _compatibleHypothesis.push_back("GeometricProgression");
   _compatibleHypothesis.push_back("FixedPoints1D");
   _compatibleHypothesis.push_back("AutomaticLength");
   _compatibleHypothesis.push_back("Adaptive1D");
@@ -224,6 +226,21 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh&         aMesh,
     aStatus = SMESH_Hypothesis::HYP_OK;
   }
 
+  else if (hypName == "GeometricProgression")
+  {
+    const StdMeshers_Geometric1D * hyp =
+      dynamic_cast <const StdMeshers_Geometric1D * >(theHyp);
+    ASSERT(hyp);
+    _value[ BEG_LENGTH_IND ] = hyp->GetStartLength();
+    _value[ END_LENGTH_IND ] = hyp->GetCommonRatio();
+    ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
+    _hypType = GEOMETRIC_1D;
+
+    _revEdgesIDs = hyp->GetReversedEdges();
+
+    aStatus = SMESH_Hypothesis::HYP_OK;
+  }
+
   else if (hypName == "FixedPoints1D") {
     _fpHyp = dynamic_cast <const StdMeshers_FixedPoints1D*>(theHyp);
     ASSERT(_fpHyp);
@@ -877,9 +894,54 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     return true;
   }
 
+  case GEOMETRIC_1D: {
+
+    double a1 = _value[ BEG_LENGTH_IND ], an;
+    double q  = _value[ END_LENGTH_IND ];
+
+    double U1 = theReverse ? l : f;
+    double Un = theReverse ? f : l;
+    double param = U1;
+    double eltSize = a1;
+    if ( theReverse )
+      eltSize = -eltSize;
+
+    int nbParams = 0;
+    while ( true ) {
+      // computes a point on a curve <theC3d> at the distance <eltSize>
+      // from the point of parameter <param>.
+      GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
+      if ( !Discret.IsDone() ) break;
+      param = Discret.Parameter();
+      if ( f < param && param < l )
+        theParams.push_back( param );
+      else
+        break;
+      an = eltSize;
+      eltSize *= q;
+      ++nbParams;
+    }
+    if ( nbParams > 1 )
+    {
+      if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() ))
+      {
+        compensateError( a1, eltSize, U1, Un, theLength, theC3d, theParams );
+      }
+      else if ( Abs( Un - theParams.back() ) <
+                0.2 * Abs( theParams.back() - *(--theParams.rbegin())))
+      {
+        theParams.pop_back();
+        compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
+      }
+    }
+    if (theReverse) theParams.reverse(); // NPAL18025
+
+    return true;
+  }
+
   case FIXED_POINTS_1D: {
     const std::vector<double>& aPnts = _fpHyp->GetPoints();
-    const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
+    const std::vector<int>&   nbsegs = _fpHyp->GetNbSegments();
     int i = 0;
     TColStd_SequenceOfReal Params;
     for(; i<aPnts.size(); i++) {
index a9e7f6ad3c2824668f1979d90e8827638440b198..1298c80a675a20d601ab5e443f37e4d8e03020fc 100644 (file)
@@ -102,7 +102,7 @@ protected:
   StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh &          theMesh,
                                                      const TopoDS_Vertex & theV);
 
-  enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, NONE };
+  enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, GEOMETRIC_1D, NONE };
 
   enum ValueIndex {
     SCALE_FACTOR_IND = 0,
diff --git a/src/StdMeshers/StdMeshers_Reversible1D.cxx b/src/StdMeshers/StdMeshers_Reversible1D.cxx
new file mode 100644 (file)
index 0000000..05d25be
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//  File   : StdMeshers_Reversible1D.cxx
+//  Module : SMESH
+//
+
+#include "StdMeshers_Reversible1D.hxx"
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+StdMeshers_Reversible1D::StdMeshers_Reversible1D(int hypId, int studyId, SMESH_Gen * gen)
+  :SMESH_Hypothesis(hypId, studyId, gen)
+{
+  _param_algo_dim = 1; 
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+void StdMeshers_Reversible1D::SetReversedEdges( const std::vector<int>& ids )
+{
+  if ( ids != _edgeIDs )
+  {
+    _edgeIDs = ids;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+std::ostream & StdMeshers_Reversible1D::SaveTo(std::ostream & save)
+{
+  save << " " << _edgeIDs.size() << " ";
+
+  if ( !_edgeIDs.empty() )
+  {
+    for ( size_t i = 0; i < _edgeIDs.size(); i++)
+      save << " " << _edgeIDs[i];
+    save << " " << _objEntry << " ";
+  }
+
+  return save;
+}
+
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+std::istream & StdMeshers_Reversible1D::LoadFrom(std::istream & load)
+{
+  bool isOK;
+  int intVal;
+
+  isOK = (load >> intVal);
+  if (isOK && intVal > 0) {
+    _edgeIDs.reserve( intVal );
+    for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+      isOK = (load >> intVal);
+      if ( isOK ) _edgeIDs.push_back( intVal );
+    }
+    isOK = (load >> _objEntry);
+  }
+
+  return load;
+}
diff --git a/src/StdMeshers/StdMeshers_Reversible1D.hxx b/src/StdMeshers/StdMeshers_Reversible1D.hxx
new file mode 100644 (file)
index 0000000..e393e20
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH : implementaion of SMESH idl descriptions
+//  File   : StdMeshers_Reversible1D.hxx
+//  Module : SMESH
+//
+#ifndef _SMESH_Reversible1D_HXX_
+#define _SMESH_Reversible1D_HXX_
+
+#include "SMESH_StdMeshers.hxx"
+#include "SMESH_Hypothesis.hxx"
+
+#include <vector>
+
+/*!
+ * \brief A base of reversible 1D hypotheses
+ */
+class STDMESHERS_EXPORT StdMeshers_Reversible1D : public SMESH_Hypothesis
+{
+public:
+  StdMeshers_Reversible1D(int hypId, int studyId, SMESH_Gen* gen);
+
+  void SetReversedEdges( const std::vector<int>& ids);
+
+  void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+
+  const char* GetObjectEntry() { return _objEntry.c_str(); }
+
+  const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
+
+  virtual std::ostream & SaveTo(std::ostream & save);
+  virtual std::istream & LoadFrom(std::istream & load);
+
+protected:
+  std::vector<int> _edgeIDs;
+  std::string      _objEntry;
+};
+
+#endif
index ca774d105c118f684ab2517e567f0bf1952146a1..84d06b807514c5e1304d372c16f622097f17ffe1 100644 (file)
@@ -523,6 +523,23 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
         h->SetObjectEntry( w->GetMainShapeEntry() );
       }
     }
+    else if( hypType()=="GeometricProgression" )
+    {
+      StdMeshers::StdMeshers_Geometric1D_var h =
+        StdMeshers::StdMeshers_Geometric1D::_narrow( hypothesis() );
+
+      StdMeshersGUI_SubShapeSelectorWdg* w = 
+        widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
+
+      h->SetVarParameter( params[0].text(), "SetStartLength" );
+      h->SetStartLength( params[0].myValue.toDouble() );
+      h->SetVarParameter( params[1].text(), "SetCommonRatio" );
+      h->SetCommonRatio( params[1].myValue.toDouble() );
+      if (w) {
+        h->SetReversedEdges( w->GetListOfIDs() );
+        h->SetObjectEntry( w->GetMainShapeEntry() );
+      }
+    }
     else if( hypType()=="FixedPoints1D" )
     {
       StdMeshers::StdMeshers_FixedPoints1D_var h =
@@ -878,6 +895,41 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     customWidgets()->append ( aDirectionWidget );
   }
 
+  else if( hypType()=="GeometricProgression" )
+  {
+    StdMeshers::StdMeshers_Geometric1D_var h =
+      StdMeshers::StdMeshers_Geometric1D::_narrow( hyp );
+
+    item.myName = tr( "SMESH_START_LENGTH_PARAM" );
+    if(!initVariableName( hyp, item, "SetStartLength" ))
+      item.myValue = h->GetStartLength();
+    p.append( item );
+
+    customWidgets()->append (0);
+
+    item.myName = tr( "SMESH_COMMON_RATIO" );
+    if(!initVariableName( hyp, item, "SetCommonRatio" ))
+      item.myValue = h->GetCommonRatio();
+    p.append( item );
+
+    customWidgets()->append (0);
+
+    item.myName = tr( "SMESH_REVERSED_EDGES" );
+    p.append( item );
+
+    StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
+      new StdMeshersGUI_SubShapeSelectorWdg();
+    QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+    if ( aGeomEntry == "" )
+      aGeomEntry = h->GetObjectEntry();
+
+    aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
+    aDirectionWidget->SetMainShapeEntry( aMainEntry );
+    aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
+    aDirectionWidget->showPreview( true );
+    customWidgets()->append ( aDirectionWidget );
+  }
 
   else if( hypType()=="FixedPoints1D" )
   {
@@ -1325,6 +1377,13 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
     {
       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
     }
+    else if( hypType()=="GeometricProgression" )
+    {
+      if (sb->objectName() == tr("SMESH_START_LENGTH_PARAM"))
+        sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
+      else if (sb->objectName() == tr("SMESH_COMMON_RATIO"))
+        sb->RangeStepAndValidator( -VALUE_MAX, VALUE_MAX, 0.5, "len_tol_precision" );
+    }
     else if( hypType()=="MaxLength" )
     {
       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
@@ -1423,6 +1482,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons
     types.insert( "Deflection1D", "DEFLECTION1D" );
     types.insert( "Adaptive1D", "ADAPTIVE1D" );
     types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
+    types.insert( "GeometricProgression", "GEOMETRIC_1D" );
     types.insert( "FixedPoints1D", "FIXED_POINTS_1D" );
     types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" );
     types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" );
index 68c8f488acaa7fd1335ff3443acdb417b40576d7..537118cf5d75d3a393595ca145fa0a47897d8b15 100644 (file)
@@ -7,6 +7,10 @@
             <source>ICON_DLG_ARITHMETIC_1D</source>
             <translation>mesh_hypo_length.png</translation>
         </message>
+        <message>
+            <source>ICON_DLG_GEOMETRIC_1D</source>
+            <translation>mesh_hypo_length.png</translation>
+        </message>
         <message>
             <source>ICON_DLG_FIXED_POINTS_1D</source>
             <translation>mesh_hypo_length.png</translation>
             <source>ICON_DLG_ADAPTIVE1D</source>
             <translation>mesh_hypo_length.png</translation>
         </message>
-        <message>
-            <source>ICON_DLG_GEOMETRIC_1D</source>
-            <translation>mesh_hypo_length.png</translation>
-        </message>
         <message>
             <source>ICON_DLG_LAYER_DISTRIBUTION</source>
             <translation>mesh_hypo_layer_distribution.png</translation>
             <source>ICON_SMESH_TREE_HYPO_Arithmetic1D</source>
             <translation>mesh_tree_hypo_length.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_Geometric1D</source>
+            <translation>mesh_tree_hypo_length.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_AutomaticLength</source>
             <translation>mesh_tree_hypo_length.png</translation>
index a1b6307cc97bdc0621757a3a70fd01c9d4ebcbcd..49510a0320c02badc7810fee4108f031dd517922 100644 (file)
         <translation>Arithmetic 1D</translation>
     </message>
     <message>
-        <source>SMESH_ARITHMETIC_1D_PARAM</source>
-        <translation>Arithmetic Reason</translation>
+        <source>SMESH_ARITHMETIC_1D_TITLE</source>
+        <translation>Hypothesis Construction</translation>
     </message>
     <message>
-        <source>SMESH_ARITHMETIC_1D_TITLE</source>
+        <source>SMESH_GEOMETRIC_1D_HYPOTHESIS</source>
+        <translation>Geometric Progression</translation>
+    </message>
+    <message>
+        <source>SMESH_GEOMETRIC_1D_TITLE</source>
         <translation>Hypothesis Construction</translation>
     </message>
+    <message>
+        <source>SMESH_COMMON_RATIO</source>
+        <translation>Common Ratio</translation>
+    </message>
     <message>
         <source>SMESH_AUTOMATIC_LENGTH_HYPOTHESIS</source>
         <translation>Automatic Length</translation>
index 6c191f2de73dda32f67c8db89a71aafc48ebdf04..dba9000575ffa37e84de675b694369f42fc98198 100755 (executable)
@@ -3,6 +3,18 @@
 <TS version="2.0" language="fr_FR">
 <context>
     <name>@default</name>
+    <message>
+        <source>SMESH_COMMON_RATIO</source>
+        <translation type="unfinished">Common Ratio</translation>
+    </message>
+    <message>
+        <source>SMESH_GEOMETRIC_1D_TITLE</source>
+        <translation type="unfinished">Hypothesis Construction</translation>
+    </message>
+    <message>
+        <source>SMESH_GEOMETRIC_1D_HYPOTHESIS</source>
+        <translation type="unfinished">Geometric Progression</translation>
+    </message>
     <message>
         <source>SMESH_EDGES_WITH_LAYERS</source>
         <translation type="unfinished">Edges with layers</translation>
index 51cbd0c0d14ce1b14409fb8cb0606e457e42d8fc..73bacce5c270d0453c9876375d96560edd8549ed 100644 (file)
@@ -129,8 +129,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
 SET(StdMeshersEngine_SOURCES
   StdMeshers_i.cxx
   StdMeshers_LocalLength_i.cxx 
+  StdMeshers_Reversible1D_i.cxx
   StdMeshers_StartEndLength_i.cxx
   StdMeshers_Arithmetic1D_i.cxx
+  StdMeshers_Geometric1D_i.cxx
   StdMeshers_FixedPoints1D_i.cxx
   StdMeshers_NumberOfSegments_i.cxx
   StdMeshers_Deflection1D_i.cxx
diff --git a/src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx b/src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx
new file mode 100644 (file)
index 0000000..b3183e8
--- /dev/null
@@ -0,0 +1,143 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//  File   : StdMeshers_Geometric1D_i.cxx
+//  Module : SMESH
+//
+#include "StdMeshers_Geometric1D_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include <Utils_CorbaException.hxx>
+#include <utilities.h>
+
+//=============================================================================
+/*!
+ *  StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i( PortableServer::POA_ptr thePOA,
+                                                    int                     theStudyId,
+                                                    ::SMESH_Gen*            theGenImpl )
+  : SALOME::GenericObj_i( thePOA ), 
+    SMESH_Hypothesis_i( thePOA ),
+    StdMeshers_Reversible1D_i( this )
+{
+  myBaseImpl = new ::StdMeshers_Geometric1D( theGenImpl->GetANewId(),
+                                             theStudyId,
+                                             theGenImpl );
+}
+
+//=============================================================================
+/*!
+ * Sets <start segment length> parameter value
+ */
+//=============================================================================
+
+void StdMeshers_Geometric1D_i::SetStartLength( CORBA::Double theLength )
+  throw (SALOME::SALOME_Exception)
+{
+  try {
+    this->GetImpl()->SetStartLength( theLength );
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
+  }
+  // Update Python script
+  SMESH::TPythonDump()
+    << _this() << ".SetStartLength( " << SMESH::TVar(theLength) << " )";
+}
+
+//=============================================================================
+/*!
+ * Sets <common ratio> parameter value
+ */
+//=============================================================================
+
+void StdMeshers_Geometric1D_i::SetCommonRatio( CORBA::Double factor )
+  throw (SALOME::SALOME_Exception)
+{
+  try {
+    this->GetImpl()->SetCommonRatio( factor );
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
+  }
+  // Update Python script
+  SMESH::TPythonDump()
+    << _this() << ".SetCommonRatio( " << SMESH::TVar(factor) << " )";
+}
+
+//=============================================================================
+/*!
+ *  Returns length of the first segment 
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_Geometric1D_i::GetStartLength()
+{
+  return this->GetImpl()->GetStartLength();
+}
+
+//=============================================================================
+/*!
+ * Returns value of Common Ratio
+ */
+//=============================================================================
+
+CORBA::Double StdMeshers_Geometric1D_i::GetCommonRatio()
+{
+  return this->GetImpl()->GetCommonRatio();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Geometric1D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Geometric1D* StdMeshers_Geometric1D_i::GetImpl()
+{
+  return ( ::StdMeshers_Geometric1D* )myBaseImpl;
+}
+
+//================================================================================
+/*!
+ * \brief Verify whether hypothesis supports given entity type 
+  * \param type - dimension (see SMESH::Dimension enumeration)
+  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
+ * 
+ * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
+ */
+//================================================================================  
+
+CORBA::Boolean StdMeshers_Geometric1D_i::IsDimSupported(::SMESH::Dimension type)
+{
+  return type == SMESH::DIM_1D;
+}
diff --git a/src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx b/src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx
new file mode 100644 (file)
index 0000000..3786dd5
--- /dev/null
@@ -0,0 +1,65 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//  File   : StdMeshers_Geometric1D_i.hxx
+//  Module : SMESH
+//
+#ifndef _SMESH_Geometric1D_I_HXX_
+#define _SMESH_Geometric1D_I_HXX_
+
+#include "SMESH_StdMeshers_I.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_Geometric1D.hxx"
+#include "StdMeshers_Reversible1D_i.hxx"
+
+// ======================================================
+// Geometric 1D hypothesis
+// ======================================================
+class STDMESHERS_I_EXPORT StdMeshers_Geometric1D_i:
+  public virtual POA_StdMeshers::StdMeshers_Geometric1D,
+  public virtual SMESH_Hypothesis_i,
+  public virtual StdMeshers_Reversible1D_i
+{
+ public:
+  // Constructor
+  StdMeshers_Geometric1D_i( PortableServer::POA_ptr thePOA,
+                            int                     theStudyId,
+                            ::SMESH_Gen*            theGenImpl );
+
+  void SetStartLength(CORBA::Double length) throw(SALOME::SALOME_Exception);
+  void SetCommonRatio(CORBA::Double factor) throw(SALOME::SALOME_Exception);
+
+  CORBA::Double GetStartLength();
+  CORBA::Double GetCommonRatio();
+
+  virtual ::CORBA::Boolean IsDimSupported(::SMESH::Dimension type);
+
+  // Get implementation
+  ::StdMeshers_Geometric1D* GetImpl();
+};
+
+#endif
diff --git a/src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx b/src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx
new file mode 100644 (file)
index 0000000..20a8c9d
--- /dev/null
@@ -0,0 +1,143 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//  File   : StdMeshers_Reversible1D_i.cxx
+//  Module : SMESH
+//
+#include "StdMeshers_Reversible1D_i.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include <Utils_CorbaException.hxx>
+#include <utilities.h>
+
+#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
+
+//================================================================================
+/*!
+ * \brief Constructor
+ */
+//================================================================================
+
+StdMeshers_Reversible1D_i::StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible )
+  : myHyp( reversible )
+{
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Reversible1D_i::SetReversedEdges
+ *
+ *  Set edges to reverse
+ */
+//=============================================================================
+
+void StdMeshers_Reversible1D_i::SetReversedEdges( const SMESH::long_array& theIds )
+{
+  try {
+    std::vector<int> ids( theIds.length() );
+    CORBA::Long iEnd = theIds.length();
+    for ( CORBA::Long i = 0; i < iEnd; i++ )
+      ids[ i ] = theIds[ i ];
+
+    this->GetImpl()->SetReversedEdges( ids );
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
+  }
+
+  // Update Python script
+  SMESH::TPythonDump() << myHyp->_this() << ".SetReversedEdges( " << theIds << " )";
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Reversible1D_i::SetObjectEntry
+ *
+ *  Set the Entry for the Main Object
+ */
+//=============================================================================
+
+void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry )
+{
+  string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
+  try {
+    this->GetImpl()->SetObjectEntry( entry.c_str() );
+    // Update Python script
+    SMESH::TPythonDump() << myHyp->_this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
+  }
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Reversible1D_i::GetObjectEntry
+ *
+ *  Set the Entry for the Main Object
+ */
+//=============================================================================
+
+char* StdMeshers_Reversible1D_i::GetObjectEntry()
+{
+  const char* entry;
+  try {
+    entry = this->GetImpl()->GetObjectEntry();
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
+  }
+  return CORBA::string_dup( entry );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Reversible1D_i::GetReversedEdges
+ *
+ *  Get reversed edges
+ */
+//=============================================================================
+
+SMESH::long_array* StdMeshers_Reversible1D_i::GetReversedEdges()
+{
+  SMESH::long_array_var anArray = new SMESH::long_array;
+  std::vector<int> ids = this->GetImpl()->GetReversedEdges();
+  anArray->length( ids.size() );
+  for ( CORBA::Long i = 0; i < ids.size(); i++)
+    anArray [ i ] = ids [ i ];
+
+  return anArray._retn();
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_Reversible1D_i::GetImpl
+ *
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_Reversible1D* StdMeshers_Reversible1D_i::GetImpl()
+{
+  return ( ::StdMeshers_Reversible1D* )myHyp->GetImpl();
+}
diff --git a/src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx b/src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx
new file mode 100644 (file)
index 0000000..8d47a7c
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//  File   : StdMeshers_Reversible1D_i.hxx
+//  Module : SMESH
+//
+#ifndef _SMESH_Reversible1D_I_HXX_
+#define _SMESH_Reversible1D_I_HXX_
+
+#include "SMESH_StdMeshers_I.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_Reversible1D.hxx"
+
+// ======================================================
+// Common metrhods of Reversible 1D hypotheses
+// ======================================================
+class STDMESHERS_I_EXPORT StdMeshers_Reversible1D_i:
+  public virtual POA_StdMeshers::Reversible1D
+{
+ public:
+  StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible );
+
+  //Set Reversed Edges
+  void SetReversedEdges( const SMESH::long_array& theIDs);
+
+  //Get Reversed Edges
+  SMESH::long_array*  GetReversedEdges();
+
+  //Set the Entry of the Object
+  void SetObjectEntry( const char* theEntry);
+
+  //Get Object Entry
+  char* GetObjectEntry();
+
+  // Get implementation
+  ::StdMeshers_Reversible1D* GetImpl();
+
+ private:
+  SMESH_Hypothesis_i* myHyp;
+};
+
+#endif
index 314a894a0da5e005b54f59b6c0a87d06b2da8ac9..2d98e11c4cd803aef245399b3c4ffe941f9cf502 100644 (file)
@@ -35,6 +35,7 @@
 #include "StdMeshers_AutomaticLength_i.hxx"
 #include "StdMeshers_StartEndLength_i.hxx"
 #include "StdMeshers_Arithmetic1D_i.hxx"
+#include "StdMeshers_Geometric1D_i.hxx"
 #include "StdMeshers_FixedPoints1D_i.hxx"
 #include "StdMeshers_NumberOfSegments_i.hxx"
 #include "StdMeshers_Deflection1D_i.hxx"
@@ -152,6 +153,8 @@ STDMESHERS_I_EXPORT
       aCreator = new StdHypothesisCreator_i<StdMeshers_FixedPoints1D_i>;
     else if (strcmp(aHypName, "Arithmetic1D") == 0)
       aCreator = new StdHypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
+    else if (strcmp(aHypName, "GeometricProgression") == 0)
+      aCreator = new StdHypothesisCreator_i<StdMeshers_Geometric1D_i>;
     else if (strcmp(aHypName, "AutomaticLength") == 0)
       aCreator = new StdHypothesisCreator_i<StdMeshers_AutomaticLength_i>;
     else if (strcmp(aHypName, "QuadranglePreference") == 0)