-# 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)
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()
<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>
\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
<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>
<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>
<br>
\anchor tui_1d_arithmetic
-<h3>Arithmetic 1D</h3>
+<h3>Arithmetic 1D and Geometric Progression</h3>
\tui_script{defining_hypotheses_ex01.py}
<br>
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
*/
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
* 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();
+
};
/*!
/*!
* 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
*/
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();
};
/*!
* 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
* 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();
+
};
/*!
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>
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")
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
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.
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
# 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
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 ):
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
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
# 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
# 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
--- /dev/null
+// 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 );
+}
+
--- /dev/null
+// 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
#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"
_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");
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);
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++) {
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,
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
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 =
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" )
{
{
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" );
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" );
<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>
<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>
<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>
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
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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
#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"
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)