From cf4c2d720952655c85653322b20d9c74f71831f2 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 25 Dec 2013 14:05:14 +0000 Subject: [PATCH] 22384: [CEA 831] New wire discretization hypothesis: geometric progression --- .../examples/defining_hypotheses_ex01.py | 15 +- doc/salome/gui/SMESH/images/a-geometric1d.png | Bin 0 -> 16439 bytes .../gui/SMESH/input/1d_meshing_hypo.doc | 26 ++- doc/salome/gui/SMESH/input/about_hypo.doc | 1 + .../SMESH/input/tui_defining_hypotheses.doc | 3 +- idl/SMESH_BasicHypothesis.idl | 128 +++++------ resources/StdMeshers.xml.in | 11 +- src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 2 + src/SMESHUtils/SMESH_Block.hxx | 2 +- src/SMESH_SWIG/StdMeshersBuilder.py | 58 ++++- src/StdMeshers/CMakeLists.txt | 4 + src/StdMeshers/StdMeshers_Geometric1D.cxx | 204 ++++++++++++++++++ src/StdMeshers/StdMeshers_Geometric1D.hxx | 67 ++++++ src/StdMeshers/StdMeshers_Regular_1D.cxx | 64 +++++- src/StdMeshers/StdMeshers_Regular_1D.hxx | 2 +- src/StdMeshers/StdMeshers_Reversible1D.cxx | 99 +++++++++ src/StdMeshers/StdMeshers_Reversible1D.hxx | 59 +++++ .../StdMeshersGUI_StdHypothesisCreator.cxx | 60 ++++++ src/StdMeshersGUI/StdMeshers_images.ts | 12 +- src/StdMeshersGUI/StdMeshers_msg_en.ts | 14 +- src/StdMeshersGUI/StdMeshers_msg_fr.ts | 12 ++ src/StdMeshers_I/CMakeLists.txt | 2 + src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx | 143 ++++++++++++ src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx | 65 ++++++ .../StdMeshers_Reversible1D_i.cxx | 143 ++++++++++++ .../StdMeshers_Reversible1D_i.hxx | 66 ++++++ src/StdMeshers_I/StdMeshers_i.cxx | 3 + 27 files changed, 1169 insertions(+), 96 deletions(-) create mode 100644 doc/salome/gui/SMESH/images/a-geometric1d.png create mode 100644 src/StdMeshers/StdMeshers_Geometric1D.cxx create mode 100644 src/StdMeshers/StdMeshers_Geometric1D.hxx create mode 100644 src/StdMeshers/StdMeshers_Reversible1D.cxx create mode 100644 src/StdMeshers/StdMeshers_Reversible1D.hxx create mode 100644 src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx create mode 100644 src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx create mode 100644 src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx create mode 100644 src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx 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 0000000000000000000000000000000000000000..a60be94a4a8ff4f2220b53154b6285878001469b GIT binary patch literal 16439 zcmb7r1yohvy6-|%kd_8%rAxX&X({RM?(S9^1Vp-}8>AbgRJuE*8|j8O`FrjecbswG z9q%nL*vvK8+%vxK7vBz%l@UWmz(;@}2>G43usj4kA_V`xf`0`54xQ7_0{=X-6<2eB zAe7FBKQOVhC@;W^w2mUGj>1L`2KHvQj%GI2kcyeLp^XcPkfol312>7BBfW!@zMieE zrI~@=!|#KXMdZM3gb%kVnmJk;LE>(^?vc3G`0* zt)gqn-n@$@h6yqBM~59I7J5Xg7wlU>fQ9u|jzBS`dSKf^DVu@7w{C{UbRNNa%v{S# zt82KhI)a;~#}@TXU?|CFs6vdyu*oMSocfiXD@@E{t>?n|(VWBJu?JZ_vCH6mz$1vr z&lpA!p7f-R%w#{q6)DL`*Km3)io_r73KMfRXB6fQO^NxoIGP~57uoAF@G=?3I+j10 zIe-3X0p0bt68J7p1f@7P(spq zWdsFEU~*Xri%*1fEjkv7TQH$34@Oh}eN3Wxz9*l~+)I!IzTJ+tE@B$K(!6viV=6Nt z)UcSBa5?H6^k{TqW@ExsdG|$O1ohVQ&}^<3^;0&5lfk6?3bHG$EX$CgTYz8&!9bgiNy230<%d@- zSoviZ=u0xXfI>nkXc2T7+EDGJD44uCb%swNk-2xuPtcZCp9e*+z)VQa+BZmlhDt`2Qk!)&mSfPZbsyAvGMNe4R zn40h|Z9CRq#>VPHUuCIu!jG?x!tQb@0!2h}d=~4jSKgb1D0M1BwjAvEko)<)=&;Wq z5#P=F)$FudP7b1v>h)-^3ZC#~epK3uC@Skla!hQ&M7P z+9(MYW(O2PE}!EGSP`62<6;T7!yna+em&ehx$p6QY~U?6d)yxnHs{!zzwlxRuaRrT zYE~4Uv@ptdBbjw3BHo^#ok_|gs9gVE7@kUnwD^KaKOv~T-YosD1rtHZ4c@s1JLo)! zs#T>U$o#VsP_`WLH!HrfB^!4e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\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 @@ -23,13 +23,21 @@ Arithmetic 1D - SMESH_ARITHMETIC_1D_PARAM - Arithmetic Reason + SMESH_ARITHMETIC_1D_TITLE + Hypothesis Construction - SMESH_ARITHMETIC_1D_TITLE + 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) -- 2.39.2