diff --git a/doc/salome/examples/defining_hypotheses_ex01.py b/doc/salome/examples/defining_hypotheses_ex01.py
index 4bb75c56b..1d5d281c8 100644
--- a/doc/salome/examples/defining_hypotheses_ex01.py
+++ b/doc/salome/examples/defining_hypotheses_ex01.py
@@ -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
index 000000000..a60be94a4
Binary files /dev/null and b/doc/salome/gui/SMESH/images/a-geometric1d.png differ
diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc
index 5deb1344a..08758992b 100644
--- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc
+++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc
@@ -6,6 +6,7 @@
\ref adaptive_1d_anchor "Adaptive"
\ref arithmetic_1d_anchor "Arithmetic 1D"
+\ref geometric_1d_anchor "Geometric Progression"
\ref average_length_anchor "Local Length"
\ref max_length_anchor "Max Size"
\ref deflection_1d_anchor "Deflection 1D"
@@ -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"
See Also 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.
+
+
+\anchor geometric_1d_anchor
+Geometric Progression hypothesis
+
+Geometric Progression 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. "Reverse Edges" 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
+
+See Also a sample TUI Script of a
+\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation.
\anchor deflection_1d_anchor
diff --git a/doc/salome/gui/SMESH/input/about_hypo.doc b/doc/salome/gui/SMESH/input/about_hypo.doc
index 14f6bcde5..65d5c7ad0 100644
--- a/doc/salome/gui/SMESH/input/about_hypo.doc
+++ b/doc/salome/gui/SMESH/input/about_hypo.doc
@@ -20,6 +20,7 @@ In \b MESH there are the following Basic Hypotheses:
\ref max_length_anchor "Max Size"
\ref adaptive_1d_anchor "Adaptive"
\ref arithmetic_1d_anchor "Arithmetic 1D"
+\ref geometric_1d_anchor "Geometric 1D"
\ref start_and_end_length_anchor "Start and end length"
\ref deflection_1d_anchor "Deflection 1D"
\ref automatic_length_anchor "Automatic Length"
diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc
index 333017d77..863bf76e7 100644
--- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc
+++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc
@@ -9,6 +9,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
\ref tui_1d_adaptive "Adaptive 1D" hypothesis
\ref tui_1d_arithmetic "Arithmetic 1D" hypothesis
+ \ref tui_1d_arithmetic "Geometric Progression" hypothesis
\ref tui_deflection_1d "Deflection 1D and Number of Segments" hypotheses
\ref tui_start_and_end_length "Start and End Length" hypotheses
\ref tui_average_length "Local Length"
@@ -44,7 +45,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
\anchor tui_1d_arithmetic
-Arithmetic 1D
+Arithmetic 1D and Geometric Progression
\tui_script{defining_hypotheses_ex01.py}
diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl
index 69dbd4a8c..6cea399d4 100644
--- a/idl/SMESH_BasicHypothesis.idl
+++ b/idl/SMESH_BasicHypothesis.idl
@@ -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 or parameter value
@@ -260,26 +266,36 @@ module StdMeshers
* Returns or 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 or 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();
+
};
/*!
diff --git a/resources/StdMeshers.xml.in b/resources/StdMeshers.xml.in
index 9ecf423ca..93a04564b 100644
--- a/resources/StdMeshers.xml.in
+++ b/resources/StdMeshers.xml.in
@@ -55,6 +55,11 @@
icon-id ="mesh_hypo_length.png"
dim ="1"/>
+
+
LocalLength=LocalLength(SetLength(1),,SetPrecision(1))
MaxLength=MaxSize(SetLength(1))
Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())
+ GeometricProgression=GeometricProgression(SetStartLength(),SetCommonRatio(),SetReversedEdges())
StartEndLength=StartEndLength(SetStartLength(),SetEndLength(),SetReversedEdges())
Deflection1D=Deflection1D(SetDeflection())
Adaptive1D=Adaptive(SetMinSize(),SetMaxSize(),SetDeflection())
@@ -235,7 +241,7 @@
LocalLength=LocalLength(SetLength(), ,SetPrecision())
MaxLength=MaxSize(SetLength())
Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())
+ GeometricProgression=GeometricProgression(SetStartLength(),SetCommonRatio(),SetReversedEdges())
StartEndLength=StartEndLength(SetStartLength(),SetEndLength(),SetReversedEdges())
Deflection1D=Deflection1D(SetDeflection())
Adaptive1D=Adaptive(SetMinSize(),SetMaxSize(),SetDeflection())
diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx
index fa9add8e0..e8ebeea25 100644
--- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx
+++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx
@@ -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")
diff --git a/src/SMESHUtils/SMESH_Block.hxx b/src/SMESHUtils/SMESH_Block.hxx
index b0ee6f5c5..4fc690137 100644
--- a/src/SMESHUtils/SMESH_Block.hxx
+++ b/src/SMESHUtils/SMESH_Block.hxx
@@ -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
diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py
index 46737b38e..4e5b2d217 100644
--- a/src/SMESH_SWIG/StdMeshersBuilder.py
+++ b/src/SMESH_SWIG/StdMeshersBuilder.py
@@ -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
diff --git a/src/StdMeshers/CMakeLists.txt b/src/StdMeshers/CMakeLists.txt
index de84b5026..2dde1b291 100644
--- a/src/StdMeshers/CMakeLists.txt
+++ b/src/StdMeshers/CMakeLists.txt
@@ -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
index 000000000..8d2be979c
--- /dev/null
+++ b/src/StdMeshers/StdMeshers_Geometric1D.cxx
@@ -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
+#include
+#include
+#include
+#include
+#include
+#include
+
+//=============================================================================
+/*!
+ * 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
index 000000000..436c31748
--- /dev/null
+++ b/src/StdMeshers/StdMeshers_Geometric1D.hxx
@@ -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
diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx
index 8c02a524f..3470e50a2 100644
--- a/src/StdMeshers/StdMeshers_Regular_1D.cxx
+++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx
@@ -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 (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 (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 at the distance
+ // from the point of parameter .
+ 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& aPnts = _fpHyp->GetPoints();
- const std::vector& nbsegs = _fpHyp->GetNbSegments();
+ const std::vector& nbsegs = _fpHyp->GetNbSegments();
int i = 0;
TColStd_SequenceOfReal Params;
for(; i& 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
index 000000000..e393e2046
--- /dev/null
+++ b/src/StdMeshers/StdMeshers_Reversible1D.hxx
@@ -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
+
+/*!
+ * \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& ids);
+
+ void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+
+ const char* GetObjectEntry() { return _objEntry.c_str(); }
+
+ const std::vector& GetReversedEdges() const { return _edgeIDs; }
+
+ virtual std::ostream & SaveTo(std::ostream & save);
+ virtual std::istream & LoadFrom(std::istream & load);
+
+protected:
+ std::vector _edgeIDs;
+ std::string _objEntry;
+};
+
+#endif
diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
index ca774d105..84d06b807 100644
--- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
+++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
@@ -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" );
diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts
index 68c8f488a..537118cf5 100644
--- a/src/StdMeshersGUI/StdMeshers_images.ts
+++ b/src/StdMeshersGUI/StdMeshers_images.ts
@@ -7,6 +7,10 @@
ICON_DLG_ARITHMETIC_1D
mesh_hypo_length.png
+
+ ICON_DLG_GEOMETRIC_1D
+ mesh_hypo_length.png
+
ICON_DLG_FIXED_POINTS_1D
mesh_hypo_length.png
@@ -23,10 +27,6 @@
ICON_DLG_ADAPTIVE1D
mesh_hypo_length.png
-
- ICON_DLG_GEOMETRIC_1D
- mesh_hypo_length.png
-
ICON_DLG_LAYER_DISTRIBUTION
mesh_hypo_layer_distribution.png
@@ -163,6 +163,10 @@
ICON_SMESH_TREE_HYPO_Arithmetic1D
mesh_tree_hypo_length.png
+
+ ICON_SMESH_TREE_HYPO_Geometric1D
+ mesh_tree_hypo_length.png
+
ICON_SMESH_TREE_HYPO_AutomaticLength
mesh_tree_hypo_length.png
diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts
index a1b6307cc..49510a032 100644
--- a/src/StdMeshersGUI/StdMeshers_msg_en.ts
+++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts
@@ -22,14 +22,22 @@
SMESH_ARITHMETIC_1D_HYPOTHESIS
Arithmetic 1D
-
- SMESH_ARITHMETIC_1D_PARAM
- Arithmetic Reason
-
SMESH_ARITHMETIC_1D_TITLE
Hypothesis Construction
+
+ SMESH_GEOMETRIC_1D_HYPOTHESIS
+ Geometric Progression
+
+
+ SMESH_GEOMETRIC_1D_TITLE
+ Hypothesis Construction
+
+
+ SMESH_COMMON_RATIO
+ Common Ratio
+
SMESH_AUTOMATIC_LENGTH_HYPOTHESIS
Automatic Length
diff --git a/src/StdMeshersGUI/StdMeshers_msg_fr.ts b/src/StdMeshersGUI/StdMeshers_msg_fr.ts
index 6c191f2de..dba900057 100755
--- a/src/StdMeshersGUI/StdMeshers_msg_fr.ts
+++ b/src/StdMeshersGUI/StdMeshers_msg_fr.ts
@@ -3,6 +3,18 @@
@default
+
+ SMESH_COMMON_RATIO
+ Common Ratio
+
+
+ SMESH_GEOMETRIC_1D_TITLE
+ Hypothesis Construction
+
+
+ SMESH_GEOMETRIC_1D_HYPOTHESIS
+ Geometric Progression
+
SMESH_EDGES_WITH_LAYERS
Edges with layers
diff --git a/src/StdMeshers_I/CMakeLists.txt b/src/StdMeshers_I/CMakeLists.txt
index 51cbd0c0d..73bacce5c 100644
--- a/src/StdMeshers_I/CMakeLists.txt
+++ b/src/StdMeshers_I/CMakeLists.txt
@@ -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
index 000000000..b3183e805
--- /dev/null
+++ b/src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx
@@ -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
+#include
+
+//=============================================================================
+/*!
+ * 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 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 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
index 000000000..3786dd581
--- /dev/null
+++ b/src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx
@@ -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
+#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
index 000000000..20a8c9d4a
--- /dev/null
+++ b/src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx
@@ -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
+#include
+
+#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 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 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
index 000000000..8d47a7c21
--- /dev/null
+++ b/src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx
@@ -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
+#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
diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx
index 314a894a0..2d98e11c4 100644
--- a/src/StdMeshers_I/StdMeshers_i.cxx
+++ b/src/StdMeshers_I/StdMeshers_i.cxx
@@ -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;
else if (strcmp(aHypName, "Arithmetic1D") == 0)
aCreator = new StdHypothesisCreator_i;
+ else if (strcmp(aHypName, "GeometricProgression") == 0)
+ aCreator = new StdHypothesisCreator_i;
else if (strcmp(aHypName, "AutomaticLength") == 0)
aCreator = new StdHypothesisCreator_i;
else if (strcmp(aHypName, "QuadranglePreference") == 0)