diff --git a/doc/salome/gui/SMESH/images/hypo_fixedpnt_dlg.png b/doc/salome/gui/SMESH/images/hypo_fixedpnt_dlg.png new file mode 100755 index 000000000..74276bd96 Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_fixedpnt_dlg.png differ diff --git a/doc/salome/gui/SMESH/images/hypo_radquad_dlg.png b/doc/salome/gui/SMESH/images/hypo_radquad_dlg.png new file mode 100755 index 000000000..e658a6889 Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_radquad_dlg.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_fixedpnt.png b/doc/salome/gui/SMESH/images/mesh_fixedpnt.png new file mode 100755 index 000000000..5d044ab63 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_fixedpnt.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_radquad_01.png b/doc/salome/gui/SMESH/images/mesh_radquad_01.png new file mode 100755 index 000000000..dfd8eb5a7 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_radquad_01.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_radquad_02.png b/doc/salome/gui/SMESH/images/mesh_radquad_02.png new file mode 100755 index 000000000..63432ebe2 Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_radquad_02.png differ diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc index 38c0055df..c61d388a5 100644 --- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc @@ -11,6 +11,7 @@
  • \ref number_of_segments_anchor "Number of segments"
  • \ref start_and_end_length_anchor "Start and end length"
  • \ref automatic_length_anchor "Automatic Length"
  • +
  • \ref fixed_points_1d_anchor "Fixed points 1D"

  • @@ -193,4 +194,36 @@ minimum and maximum value of this parameter. \image html image147.gif "Example of a very rough mesh. Automatic Length works for 0." \image html image148.gif "Example of a very fine mesh. Automatic Length works for 1." + +
    +\anchor fixed_points_1d_anchor +

    Fixed points 1D hypothesis

    + +Fixed points 1D hypothesis allows to split edges into segments +using set of fixed points given by normalized parameters on edge and +set of numbers of segments for splitting each sub-segment between +fixed points. Optionally it is possible to set flag +Same Nb. Segments for all intervals and +only one value for mentioned number of segments. + +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. + +Using of this hypothesis for quadrangle face where main mesh is +created using Quadrangle(Mapping) and NumberOfSegments +hypothesises. Creation hypothesis FixedPoint_1D for submesh on +one edge: + +\image html hypo_fixedpnt_dlg.png + +Resulting 2D mesh: + +\image html mesh_fixedpnt.png + */ diff --git a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc index 1fd311d84..7549a121e 100644 --- a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc +++ b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc @@ -25,6 +25,8 @@ shape of a mesh. are split into triangular elements.
  • Quadrangle meshing algorithm (Mapping) - Faces are split into quadrangular elements.
  • +
  • Radial quadrangle 1D2D algorithm - Faces (circles or part of circles) +are split into triangular and quadrangle elements.
  • \image html image123.gif "Example of a triangular 2D mesh" @@ -54,6 +56,8 @@ There is also a number of more specific algorithms:
  • \subpage radial_prism_algo_page "for meshing geometrical objects with cavities"
  • \subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"
  • \subpage prism_3d_algo_page "for meshing prismatic shapes"
  • +
  • \subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d +faces (circles and part of circles)"
  • \ref constructing_meshes_page "Constructing meshes" page describes in @@ -62,4 +66,4 @@ detail how to apply meshing algorithms.
    See Also a sample TUI Script of a \ref tui_defining_meshing_algos "Define Meshing Algorithm" operation. -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc new file mode 100644 index 000000000..4436e092b --- /dev/null +++ b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc @@ -0,0 +1,28 @@ +/*! + +\page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D2D + +\n This algorithm applies to the meshing of a 2D shapes. +Required conditions: Face must be a full circle or part of circle +(i.e. number of edges <= 3 and one of them must be a circle curve). +The resulting mesh consists of triangles (near center point) and +quadrangles. + +This algorithm also requires the information concerning the number and +distribution of mesh layers alond a radius of circle. Distribution of +layers can be set with any of 1D Hypotheses. + +Creation hypothesis: + +\image html hypo_radquad_dlg.png + +Resulting 3D mesh for the cylinder with RadialQuadrangle_1D2D +hypothesis for top and bottom faces: + +\image html mesh_radquad_01.png + +Resulting 2D mesh for the part of circle: + +\image html mesh_radquad_02.png + +*/ diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index 37db80292..59b3a8a2c 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -385,6 +385,54 @@ module StdMeshers }; + /*! + * StdMeshers_FixedPoints1D: interface of "Fixed points 1D" hypothesis + */ + interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis + { + /*! + * Sets some points on 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 needed) and sets numbers + * of segments between given points (default values are equals 1) + */ + void SetPoints(in SMESH::double_array listParams) + raises (SALOME::SALOME_Exception); + void SetNbSegments(in SMESH::long_array listNbSeg) + raises (SALOME::SALOME_Exception); + + /*! + * Returns list of point's parameters + */ + SMESH::double_array GetPoints(); + + /*! + * 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(); + }; + + /*! * StdMeshers_MaxElementVolume: interface of "Max. Hexahedron or Tetrahedron Volume" hypothesis */ @@ -498,6 +546,26 @@ module StdMeshers }; + /*! + * StdMeshers_NumberOfLayers2D: interface of "Nb. Layers" hypothesis. + * This hypothesis is used by "Radial quadrangle" algorithm. + * It specifies number of segments between the internal + * and the external surfaces. + */ + interface StdMeshers_NumberOfLayers2D : StdMeshers_NumberOfLayers + { + }; + + /*! + * StdMeshers_LayerDistribution2D: interface of "Distribution of Layers" hypothesis. + * This hypothesis is used by "Radial quadrangle" algorithm. + * It specifies 1D hypothesis defining distribution of segments between the internal + * and the external surfaces. + */ + interface StdMeshers_LayerDistribution2D : StdMeshers_LayerDistribution + { + }; + /*! * interface of "ProjectionSource1D" hypothesis. * This hypothesis specifies a meshed edge to take a mesh pattern from @@ -800,6 +868,13 @@ module StdMeshers { }; + /*! + * StdMeshers_RadialQuadrangle_1D2D: interface of "Radial quadrangle" algorithm + */ + interface StdMeshers_RadialQuadrangle_1D2D : SMESH::SMESH_2D_Algo + { + }; + }; #endif diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml index ce7f248f1..d6083f4b0 100644 --- a/resources/StdMeshers.xml +++ b/resources/StdMeshers.xml @@ -54,6 +54,11 @@ icon-id="mesh_hypo_length.png" dim="1"/> + + + + + + + + diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 487f8c975..bc0002d3e 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -505,6 +505,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 == "FixedPointsc1D") + aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor"; else if ( aHypType == "MaxElementArea") aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor"; else if ( aHypType == "MaxElementVolume") diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 05bbe9d05..689e76f49 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -3741,6 +3741,45 @@ class Mesh_Segment(Mesh_Algorithm): return True return False + + ## 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 + # needed) and sets numbers of segments between given points (default + # values are equals 1 + # @param points defines the list of parameters on curve + # @param nbSegs defines the list of numbers of segments + # @param reversedEdges is a list of edges to mesh using reversed orientation + # @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 + # @ingroup l3_hypos_1dhyps + def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0): + if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges + reversedEdges, UseExisting = [], reversedEdges + entry = self.MainShapeEntry() + hyp = self.Hypothesis("FixedPoints1D", [points, nbSegs, reversedEdges, entry], + UseExisting=UseExisting, + CompareMethod=self.CompareArithmetic1D) + hyp.SetPoints(points) + hyp.SetNbSegments(nbSegs) + hyp.SetReversedEdges(reversedEdges) + hyp.SetObjectEntry(entry) + return hyp + + ## Private method + ## Check if the given "FixedPoints1D" hypothesis has the same parameters + ## as the given arguments + def CompareFixedPoints1D(self, hyp, args): + if hyp.GetPoints() == args[0]: + if hyp.GetNbSegments() == args[1]: + if hyp.GetReversedEdges() == args[2]: + if not args[2] or hyp.GetObjectEntry() == args[3]: + return True + return False + + + ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length # @param start defines the length of the first segment # @param end defines the length of the last segment @@ -4804,6 +4843,104 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): hyp.SetFineness( fineness ) return hyp +# Public class: Mesh_RadialQuadrangle1D2D +# ------------------------------- + +## Defines a Radial Quadrangle 1D2D algorithm +# @ingroup l2_algos_radialq +# +class Mesh_RadialQuadrangle1D2D(Mesh_Algorithm): + + ## Private constructor. + def __init__(self, mesh, geom=0): + Mesh_Algorithm.__init__(self) + self.Create(mesh, geom, "RadialQuadrangle_1D2D") + + self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0) + self.nbLayers = None + + ## Return 2D hypothesis holding the 1D one + def Get2DHypothesis(self): + return self.distribHyp + + ## Private method creating a 1D hypothesis and storing it in the LayerDistribution + # hypothesis. Returns the created hypothesis + def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"): + #print "OwnHypothesis",hypType + if not self.nbLayers is None: + self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers ) + self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp ) + study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis + hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so) + self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing + self.distribHyp.SetLayerDistribution( hyp ) + return hyp + + ## Defines "NumberOfLayers2D" hypothesis, specifying the number of layers + # @param n number of layers + # @param UseExisting if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one + def NumberOfLayers2D(self, n, UseExisting=0): + self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp ) + self.nbLayers = self.Hypothesis("NumberOfLayers2D", [n], UseExisting=UseExisting, + CompareMethod=self.CompareNumberOfLayers) + self.nbLayers.SetNumberOfLayers( n ) + return self.nbLayers + + ## Checks if the given "NumberOfLayers" hypothesis has the same parameters as the given arguments + def CompareNumberOfLayers(self, hyp, args): + return IsEqual(hyp.GetNumberOfLayers(), args[0]) + + ## Defines "LocalLength" hypothesis, specifying the segment length + # @param l the length of segments + # @param p the precision of rounding + def LocalLength(self, l, p=1e-07): + hyp = self.OwnHypothesis("LocalLength", [l,p]) + hyp.SetLength(l) + hyp.SetPrecision(p) + return hyp + + ## Defines "NumberOfSegments" hypothesis, specifying the number of layers + # @param n the number of layers + # @param s the scale factor (optional) + def NumberOfSegments(self, n, s=[]): + if s == []: + hyp = self.OwnHypothesis("NumberOfSegments", [n]) + else: + hyp = self.OwnHypothesis("NumberOfSegments", [n,s]) + hyp.SetDistrType( 1 ) + hyp.SetScaleFactor(s) + hyp.SetNumberOfSegments(n) + return hyp + + ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments + # 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 = self.OwnHypothesis("Arithmetic1D", [start, end]) + hyp.SetLength(start, 1) + hyp.SetLength(end , 0) + return hyp + + ## Defines "StartEndLength" hypothesis, specifying distribution of segments + # as geometric length increasing + # @param start for the length of the first segment + # @param end for the length of the last segment + def StartEndLength(self, start, end): + hyp = self.OwnHypothesis("StartEndLength", [start, end]) + hyp.SetLength(start, 1) + hyp.SetLength(end , 0) + return hyp + + ## Defines "AutomaticLength" hypothesis, specifying the number of segments + # @param fineness defines the quality of the mesh within the range [0-1] + def AutomaticLength(self, fineness=0): + hyp = self.OwnHypothesis("AutomaticLength") + hyp.SetFineness( fineness ) + return hyp + + # Private class: Mesh_UseExisting # ------------------------------- class Mesh_UseExisting(Mesh_Algorithm): diff --git a/src/StdMeshers/Makefile.am b/src/StdMeshers/Makefile.am index c0e9c5374..c10d17e66 100644 --- a/src/StdMeshers/Makefile.am +++ b/src/StdMeshers/Makefile.am @@ -32,6 +32,7 @@ salomeinclude_HEADERS = \ StdMeshers_LocalLength.hxx \ StdMeshers_StartEndLength.hxx \ StdMeshers_Arithmetic1D.hxx \ + StdMeshers_FixedPoints1D.hxx \ StdMeshers_NumberOfSegments.hxx \ StdMeshers_Deflection1D.hxx \ StdMeshers_Propagation.hxx \ @@ -49,6 +50,7 @@ salomeinclude_HEADERS = \ StdMeshers_QuadranglePreference.hxx \ StdMeshers_QuadraticMesh.hxx \ StdMeshers_NumberOfLayers.hxx \ + StdMeshers_NumberOfLayers2D.hxx \ StdMeshers_Prism_3D.hxx \ StdMeshers_ProjectionSource1D.hxx \ StdMeshers_ProjectionSource2D.hxx \ @@ -59,6 +61,7 @@ salomeinclude_HEADERS = \ StdMeshers_RadialPrism_3D.hxx \ StdMeshers_ProjectionUtils.hxx \ StdMeshers_LayerDistribution.hxx \ + StdMeshers_LayerDistribution2D.hxx \ StdMeshers_SegmentAroundVertex_0D.hxx \ StdMeshers_SegmentLengthAroundVertex.hxx \ StdMeshers_FaceSide.hxx \ @@ -69,7 +72,8 @@ salomeinclude_HEADERS = \ StdMeshers_TrianglePreference.hxx \ StdMeshers_CompositeHexa_3D.hxx \ StdMeshers_MaxLength.hxx \ - StdMeshers_QuadrangleParams.hxx + StdMeshers_QuadrangleParams.hxx \ + StdMeshers_RadialQuadrangle_1D2D.hxx # Libraries targets @@ -79,6 +83,7 @@ dist_libStdMeshers_la_SOURCES = \ StdMeshers_LocalLength.cxx \ StdMeshers_StartEndLength.cxx \ StdMeshers_Arithmetic1D.cxx \ + StdMeshers_FixedPoints1D.cxx \ StdMeshers_NumberOfSegments.cxx \ StdMeshers_Deflection1D.cxx \ StdMeshers_Propagation.cxx \ @@ -96,6 +101,7 @@ dist_libStdMeshers_la_SOURCES = \ StdMeshers_QuadranglePreference.cxx \ StdMeshers_QuadraticMesh.cxx \ StdMeshers_NumberOfLayers.cxx \ + StdMeshers_NumberOfLayers2D.cxx \ StdMeshers_Prism_3D.cxx \ StdMeshers_ProjectionSource1D.cxx \ StdMeshers_ProjectionSource2D.cxx \ @@ -106,6 +112,7 @@ dist_libStdMeshers_la_SOURCES = \ StdMeshers_RadialPrism_3D.cxx \ StdMeshers_ProjectionUtils.cxx \ StdMeshers_LayerDistribution.cxx \ + StdMeshers_LayerDistribution2D.cxx \ StdMeshers_SegmentAroundVertex_0D.cxx \ StdMeshers_SegmentLengthAroundVertex.cxx \ StdMeshers_FaceSide.cxx \ @@ -115,7 +122,8 @@ dist_libStdMeshers_la_SOURCES = \ StdMeshers_TrianglePreference.cxx \ StdMeshers_CompositeHexa_3D.cxx \ StdMeshers_MaxLength.cxx \ - StdMeshers_QuadrangleParams.cxx + StdMeshers_QuadrangleParams.cxx \ + StdMeshers_RadialQuadrangle_1D2D.cxx # additionnal information to compil and link file diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.cxx b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx new file mode 100644 index 000000000..cd163c09b --- /dev/null +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.cxx @@ -0,0 +1,243 @@ +// Copyright (C) 2007-2008 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_FixedPoints1D.cxx +// Author : Damien COQUERET, OCC +// Module : SMESH +// +#include "StdMeshers_FixedPoints1D.hxx" + +#include "SMESH_Algo.hxx" +#include "SMESH_Mesh.hxx" + +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include + +using namespace std; + +//============================================================================= +/*! + * + */ +//============================================================================= + +StdMeshers_FixedPoints1D::StdMeshers_FixedPoints1D(int hypId, int studyId, + SMESH_Gen * gen) + :SMESH_Hypothesis(hypId, studyId, gen) +{ + _name = "FixedPoints1D"; + _param_algo_dim = 1; + _nbsegs.reserve( 1 ); + _nbsegs.push_back( 1 ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +StdMeshers_FixedPoints1D::~StdMeshers_FixedPoints1D() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void StdMeshers_FixedPoints1D::SetPoints(std::vector& listParams) + throw(SALOME_Exception) +{ + _params = listParams; + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void StdMeshers_FixedPoints1D::SetNbSegments(std::vector& listNbSeg) + throw(SALOME_Exception) +{ + _nbsegs = listNbSeg; + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void StdMeshers_FixedPoints1D::SetReversedEdges( std::vector& ids ) +{ + if ( ids != _edgeIDs ) { + _edgeIDs = ids; + + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & StdMeshers_FixedPoints1D::SaveTo(ostream & save) +{ + int listSize = _params.size(); + save << listSize; + if ( listSize > 0 ) { + for ( int i = 0; i < listSize; i++) save << " " << _params[i]; + } + + listSize = _nbsegs.size(); + save << listSize; + if ( listSize > 0 ) { + for ( int i = 0; i < listSize; i++) save << " " << _nbsegs[i]; + } + + listSize = _edgeIDs.size(); + save << listSize; + if ( listSize > 0 ) { + for ( int i = 0; i < listSize; i++) + save << " " << _edgeIDs[i]; + } + + save << " " << _objEntry; + + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load) +{ + bool isOK = true; + int intVal; + double dblVal; + + isOK = (load >> intVal); + if (isOK && intVal > 0) { + _params.reserve( intVal ); + for (int i = 0; i < _params.capacity() && isOK; i++) { + isOK = (load >> dblVal); + if ( isOK ) _params.push_back( dblVal ); + } + } + + isOK = (load >> intVal); + if (isOK && intVal > 0) { + _nbsegs.reserve( intVal ); + for (int i = 0; i < _nbsegs.capacity() && isOK; i++) { + isOK = (load >> intVal); + if ( isOK ) _nbsegs.push_back( 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; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator <<(ostream & save, StdMeshers_FixedPoints1D & hyp) +{ + return hyp.SaveTo( save ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >>(istream & load, StdMeshers_FixedPoints1D & hyp) +{ + return hyp.LoadFrom( 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_FixedPoints1D::SetParametersByMesh(const SMESH_Mesh* theMesh, + const TopoDS_Shape& theShape) +{ + if ( !theMesh || theShape.IsNull() ) + return false; + + _nbsegs.reserve( 1 ); + _nbsegs.push_back( 1 ); + return true; +} + +//================================================================================ +/*! + * \brief Initialize my parameter values by default parameters. + * \retval bool - true if parameter values have been successfully defined + */ +//================================================================================ + +bool StdMeshers_FixedPoints1D::SetParametersByDefaults(const TDefaults& dflts, + const SMESH_Mesh* /*mesh*/) +{ + _nbsegs.reserve( 1 ); + _nbsegs.push_back( 1 ); + return true; +} + diff --git a/src/StdMeshers/StdMeshers_FixedPoints1D.hxx b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx new file mode 100644 index 000000000..b5126e1c3 --- /dev/null +++ b/src/StdMeshers/StdMeshers_FixedPoints1D.hxx @@ -0,0 +1,90 @@ +// Copyright (C) 2007-2008 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_FixedPoints1D.hxx +// Author : Damien COQUERET, OCC +// Module : SMESH +// +#ifndef _SMESH_FIXEDPOINTS1D_HXX_ +#define _SMESH_FIXEDPOINTS1D_HXX_ + + + +#include "SMESH_StdMeshers.hxx" + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +#include + +class STDMESHERS_EXPORT StdMeshers_FixedPoints1D: + public SMESH_Hypothesis +{ +public: + StdMeshers_FixedPoints1D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~StdMeshers_FixedPoints1D(); + + void SetPoints(std::vector& listParams) + throw(SALOME_Exception); + + void SetNbSegments(std::vector& listNbSeg) + throw(SALOME_Exception); + + const std::vector& GetPoints() const { return _params; } + + const std::vector& GetNbSegments() const { return _nbsegs; } + + void SetReversedEdges( 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); + friend std::ostream& operator << (std::ostream & save, StdMeshers_FixedPoints1D & hyp); + friend std::istream& operator >> (std::istream & load, StdMeshers_FixedPoints1D & hyp); + + /*! + * \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: + std::vector _params; + std::vector _nbsegs; + std::vector _edgeIDs; + std::string _objEntry; +}; + +#endif diff --git a/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx b/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx new file mode 100644 index 000000000..23d039bee --- /dev/null +++ b/src/StdMeshers/StdMeshers_LayerDistribution2D.cxx @@ -0,0 +1,61 @@ +// Copyright (C) 2007-2008 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 : idl implementation based on 'SMESH' unit's classes +// File : StdMeshers_LayerDistribution2D.cxx +// Author : Edward AGAPOV +// Module : SMESH +// +#include "StdMeshers_LayerDistribution2D.hxx" + +#include "utilities.h" + + +//============================================================================= +/*! + * StdMeshers_LayerDistribution2D::StdMeshers_LayerDistribution2D + * + * Constructor + */ +//============================================================================= + +StdMeshers_LayerDistribution2D::StdMeshers_LayerDistribution2D(int hypId, + int studyId, + SMESH_Gen * gen) + : StdMeshers_LayerDistribution(hypId, studyId, gen) +{ + _name = "LayerDistribution2D"; // used by RadialQuadrangle_1D2D + _param_algo_dim = 2; // 2D + myHyp = 0; +} + +//============================================================================= +/*! + * StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D + * + * Destructor + */ +//============================================================================= + +StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D() +{ + MESSAGE( "StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D" ); +} diff --git a/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx b/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx new file mode 100644 index 000000000..d06b6ead2 --- /dev/null +++ b/src/StdMeshers/StdMeshers_LayerDistribution2D.hxx @@ -0,0 +1,55 @@ +// Copyright (C) 2007-2008 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 : idl implementation based on 'SMESH' unit's calsses +// File : StdMeshers_LayerDistribution2D.hxx +// Author : Edward AGAPOV +// Module : SMESH +// +#ifndef _SMESH_LayerDistribution2D_HXX_ +#define _SMESH_LayerDistribution2D_HXX_ + +#include "StdMeshers_LayerDistribution.hxx" + + +// ========================================================= +// ========================================================= +/*! + * This hypothesis is used by "Radial quadrangle" algorithm. + * It specifies 1D hypothesis defining distribution of segments + * between the internal and the external surfaces. + */ +// ========================================================= +// ========================================================= + +class STDMESHERS_EXPORT StdMeshers_LayerDistribution2D + :public StdMeshers_LayerDistribution +{ +public: + // Constructor + StdMeshers_LayerDistribution2D(int hypId, int studyId, SMESH_Gen* gen); + // Destructor + virtual ~StdMeshers_LayerDistribution2D(); + +}; + +#endif + diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx b/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx new file mode 100644 index 000000000..af2f04dab --- /dev/null +++ b/src/StdMeshers/StdMeshers_NumberOfLayers2D.cxx @@ -0,0 +1,63 @@ +// Copyright (C) 2007-2008 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 : idl implementation based on 'SMESH' unit's classes +// File : StdMeshers_NumberOfLayers2D.cxx +// Author : Edward AGAPOV +// Module : SMESH +// + +#include "StdMeshers_NumberOfLayers2D.hxx" + +#include "utilities.h" + + +//============================================================================= +/*! + * StdMeshers_NumberOfLayers2D::StdMeshers_NumberOfLayers2D + * + * Constructor + */ +//============================================================================= + +StdMeshers_NumberOfLayers2D::StdMeshers_NumberOfLayers2D(int hypId, + int studyId, + SMESH_Gen * gen) + : StdMeshers_NumberOfLayers(hypId, studyId, gen) +{ + _name = "NumberOfLayers2D"; // used by RadialQuadrangle_1D2D + _param_algo_dim = 2; // 2D + _nbLayers = 1; +} + +//============================================================================= +/*! + * StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D + * + * Destructor + */ +//============================================================================= + +StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D() +{ + MESSAGE( "StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D" ); +} + diff --git a/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx b/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx new file mode 100644 index 000000000..42690f0e5 --- /dev/null +++ b/src/StdMeshers/StdMeshers_NumberOfLayers2D.hxx @@ -0,0 +1,54 @@ +// Copyright (C) 2007-2008 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 : idl implementation based on 'SMESH' unit's calsses +// File : StdMeshers_NumberOfLayers2D.hxx +// Author : Edward AGAPOV +// Module : SMESH +// +#ifndef _SMESH_NumberOfLayers2D_HXX_ +#define _SMESH_NumberOfLayers2D_HXX_ + +#include "StdMeshers_NumberOfLayers.hxx" + + +// ========================================================= +// ========================================================= +/*! + * This hypothesis is used by "Radial quadrangle" algorithm. + * It specifies number of segments between the internal + * and the external surfaces. + */ +// ========================================================= +// ========================================================= + +class STDMESHERS_EXPORT StdMeshers_NumberOfLayers2D + : public StdMeshers_NumberOfLayers +{ +public: + // Constructor + StdMeshers_NumberOfLayers2D(int hypId, int studyId, SMESH_Gen* gen); + // Destructor + virtual ~StdMeshers_NumberOfLayers2D(); +}; + +#endif + diff --git a/src/StdMeshers/StdMeshers_Penta_3D.cxx b/src/StdMeshers/StdMeshers_Penta_3D.cxx index e17b5f22b..06d801333 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.cxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.cxx @@ -91,7 +91,7 @@ StdMeshers_Penta_3D::~StdMeshers_Penta_3D() //purpose : //======================================================================= bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) + const TopoDS_Shape& aShape) { MESSAGE("StdMeshers_Penta_3D::Compute()"); // @@ -424,7 +424,7 @@ void StdMeshers_Penta_3D::MakeNodes() ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID); if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeNodes() "); - return; + return; } // aTN.SetShapeSupportID(aSSID); @@ -432,13 +432,13 @@ void StdMeshers_Penta_3D::MakeNodes() aTN.SetBaseNodeID(iBNID); // if (aSSID!=SMESH_Block::ID_NONE){ - // try to find the node - const TopoDS_Shape& aS=myBlock.Shape((int)aSSID); - FindNodeOnShape(aS, aCoords, i, aTN); + // try to find the node + const TopoDS_Shape& aS=myBlock.Shape((int)aSSID); + FindNodeOnShape(aS, aCoords, i, aTN); } else{ - // create node and get it id - CreateNode (bIsUpperLayer, aCoords, aTN); + // create node and get it id + CreateNode (bIsUpperLayer, aCoords, aTN); // if ( bIsUpperLayer ) { const SMDS_MeshNode* n = aTN.Node(); @@ -471,7 +471,7 @@ void StdMeshers_Penta_3D::MakeNodes() } if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeNodes() "); - return; + return; } // myTNodes[ij]=aTN; @@ -485,20 +485,20 @@ void StdMeshers_Penta_3D::MakeNodes() for (i=0; iGetID(); - aX=aNode->X(); - aY=aNode->Y(); - aZ=aNode->Z(); - printf("*** j:%d BNID#%d iSSID:%d ID:%d { %lf %lf %lf }, { %lf %lf %lf }\n", - j, iBNID, iSSID, aID, aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aX, aY, aZ); + ij=i*myJSize+j; + const StdMeshers_TNode& aTN=myTNodes[ij]; + //const StdMeshers_TNode& aTN=aTNodes[ij]; + const gp_XYZ& aXYZ=aTN.NormCoord(); + iSSID=aTN.ShapeSupportID(); + iBNID=aTN.BaseNodeID(); + // + const SMDS_MeshNode* aNode=aTN.Node(); + aID=aNode->GetID(); + aX=aNode->X(); + aY=aNode->Y(); + aZ=aNode->Z(); + printf("*** j:%d BNID#%d iSSID:%d ID:%d { %lf %lf %lf }, { %lf %lf %lf }\n", + j, iBNID, iSSID, aID, aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aX, aY, aZ); } } } @@ -513,9 +513,9 @@ void StdMeshers_Penta_3D::MakeNodes() //======================================================================= void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS, - const gp_XYZ& aParams, + const gp_XYZ& aParams, const int z, - StdMeshers_TNode& aTN) + StdMeshers_TNode& aTN) { double aX, aY, aZ, aD, aTol2, minD; gp_Pnt aP1, aP2; @@ -675,8 +675,8 @@ void StdMeshers_Penta_3D::MakeVolumeMesh() const StdMeshers_TNode& aTN = myTNodes[ij]; aSSID=aTN.ShapeSupportID(); if (aSSID==SMESH_Block::ID_NONE) { - SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node(); - meshDS->SetNodeInVolume(aNode, shapeID); + SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node(); + meshDS->SetNodeInVolume(aNode, shapeID); } } } @@ -714,7 +714,7 @@ void StdMeshers_Penta_3D::MakeVolumeMesh() aJ[k] = GetIndexOnLayer(aID0); if (!myErrorStatus->IsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh"); - return; + return; } // ++k; @@ -725,15 +725,15 @@ void StdMeshers_Penta_3D::MakeVolumeMesh() i1=i; i2=i+1; for(j=0; jIsOK()) { MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() "); - return; + return; } // ij = aLevel*myJSize + aJ; @@ -939,8 +939,8 @@ void StdMeshers_Penta_3D::MakeConnectingMap() //purpose : //======================================================================= void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, - const gp_XYZ& aParams, - StdMeshers_TNode& aTN) + const gp_XYZ& aParams, + StdMeshers_TNode& aTN) { double aX, aY, aZ; // @@ -996,8 +996,8 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer, //purpose : //======================================================================= void StdMeshers_Penta_3D::ShapeSupportID(const bool bIsUpperLayer, - const SMESH_Block::TShapeID aBNSSID, - SMESH_Block::TShapeID& aSSID) + const SMESH_Block::TShapeID aBNSSID, + SMESH_Block::TShapeID& aSSID) { switch (aBNSSID) { case SMESH_Block::ID_V000: @@ -1068,25 +1068,25 @@ void StdMeshers_Penta_3D::MakeBlock() const SMDS_MeshElement * pElement = itf->next(); aElementType = pElement->GetType(); if (aElementType==SMDSAbs_Face) { - iNbNodes = pElement->NbNodes(); - if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) { - aFTr = aF; - ++iCnt; - if (iCnt>1) { - // \begin{E.A.} - // The current algorithm fails if there is more that one - // face wich contains triangles ... - // In that case, replace return by break to try another - // method (coded in "if (iCnt != 1) { ... }") - // + iNbNodes = pElement->NbNodes(); + if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) { + aFTr = aF; + ++iCnt; + if (iCnt>1) { + // \begin{E.A.} + // The current algorithm fails if there is more that one + // face wich contains triangles ... + // In that case, replace return by break to try another + // method (coded in "if (iCnt != 1) { ... }") + // // MESSAGE("StdMeshers_Penta_3D::MakeBlock() "); - // myErrorStatus=5; // more than one face has triangulation - // return; - break; - // \end{E.A.} - } - break; // next face - } + // myErrorStatus=5; // more than one face has triangulation + // return; + break; + // \end{E.A.} + } + break; // next face + } } } } @@ -1155,85 +1155,85 @@ void StdMeshers_Penta_3D::MakeBlock() int has_only_quad_f6 = 1; // for (i=1; i<=iNbF; ++i) { - int ok = 1; - const TopoDS_Shape& aF = aM(i); - SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF); - SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS(); - SMDS_ElemIteratorPtr itf = aSM->GetElements(); - while(itf->more()) { - const SMDS_MeshElement * pElement = itf->next(); - aElementType = pElement->GetType(); - if (aElementType==SMDSAbs_Face) { - iNbNodes = pElement->NbNodes(); - if ( iNbNodes!=4 ) { - ok = 0; - break ; - } - } - } - if (i==1) has_only_quad_f1 = ok ; - if (i==2) has_only_quad_f2 = ok ; - if (i==3) has_only_quad_f3 = ok ; - if (i==4) has_only_quad_f4 = ok ; - if (i==5) has_only_quad_f5 = ok ; - if (i==6) has_only_quad_f6 = ok ; + int ok = 1; + const TopoDS_Shape& aF = aM(i); + SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF); + SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS(); + SMDS_ElemIteratorPtr itf = aSM->GetElements(); + while(itf->more()) { + const SMDS_MeshElement * pElement = itf->next(); + aElementType = pElement->GetType(); + if (aElementType==SMDSAbs_Face) { + iNbNodes = pElement->NbNodes(); + if ( iNbNodes!=4 ) { + ok = 0; + break ; + } + } + } + if (i==1) has_only_quad_f1 = ok ; + if (i==2) has_only_quad_f2 = ok ; + if (i==3) has_only_quad_f3 = ok ; + if (i==4) has_only_quad_f4 = ok ; + if (i==5) has_only_quad_f5 = ok ; + if (i==6) has_only_quad_f6 = ok ; } // TopTools_IndexedMapOfShape aE; TopExp::MapShapes(myShape, TopAbs_EDGE, aE); int iNbE = aE.Extent(); if (iNbE == 12) { - // - int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements(); - int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements(); - int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements(); - int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements(); - int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements(); - int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements(); - int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements(); - int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements(); - int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements(); - int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements(); - int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements(); - int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements(); - // - int nb_ok = 0 ; - // - if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) { - if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) { - if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) { - if (nb_f5==nb_f6) { - nb_ok += 1; - aFTr = aM(5); - } - } - } - } - if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) { - if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) { - if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) { - if (nb_f3==nb_f4) { - nb_ok += 1; - aFTr = aM(3); - } - } - } - } - if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) { - if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) { - if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) { - if (nb_f1==nb_f2) { - nb_ok += 1; - aFTr = aM(1); - } - } - } - } - // - if ( nb_ok == 1 ) { - isOK = 1; - } - // + // + int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements(); + int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements(); + int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements(); + int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements(); + int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements(); + int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements(); + int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements(); + int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements(); + int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements(); + int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements(); + int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements(); + int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements(); + // + int nb_ok = 0 ; + // + if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) { + if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) { + if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) { + if (nb_f5==nb_f6) { + nb_ok += 1; + aFTr = aM(5); + } + } + } + } + if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) { + if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) { + if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) { + if (nb_f3==nb_f4) { + nb_ok += 1; + aFTr = aM(3); + } + } + } + } + if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) { + if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) { + if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) { + if (nb_f1==nb_f2) { + nb_ok += 1; + aFTr = aM(1); + } + } + } + } + // + if ( nb_ok == 1 ) { + isOK = 1; + } + // } } if (!isOK) { @@ -1286,11 +1286,11 @@ void StdMeshers_Penta_3D::MakeBlock() const TopoDS_Edge& aE=TopoDS::Edge(aEx); TopExp::Vertices(aE, aV[0], aV[1]); for (i=0; i<2; ++i) { - if (!aV[i].IsSame(aV000)) { - aV001=aV[i]; - bFound=!bFound; - break; - } + if (!aV[i].IsSame(aV000)) { + aV001=aV[i]; + bFound=!bFound; + break; + } } } } @@ -1703,8 +1703,8 @@ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell) //purpose : //======================================================================= void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell, - const TopoDS_Vertex& theV000, - const TopoDS_Vertex& theV001) + const TopoDS_Vertex& theV000, + const TopoDS_Vertex& theV001) { myErrorStatus=0; // @@ -1725,7 +1725,7 @@ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell, //purpose : //======================================================================= void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, - gp_XYZ& theXYZ) + gp_XYZ& theXYZ) { ComputeParameters(thePnt, myShell, theXYZ); } @@ -1735,7 +1735,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, //purpose : //======================================================================= void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, - const TopoDS_Shape& theShape, + const TopoDS_Shape& theShape, gp_XYZ& theXYZ) { myErrorStatus=0; @@ -1785,7 +1785,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU, //purpose : //======================================================================= void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { TopoDS_Shape aS; // @@ -1797,8 +1797,8 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU, //purpose : //======================================================================= void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, - const TopoDS_Shape& theShape, - gp_Pnt& aP3D) + const TopoDS_Shape& theShape, + gp_Pnt& aP3D) { myErrorStatus = 0; // @@ -1889,8 +1889,8 @@ const TopoDS_Shape& StdMeshers_SMESHBlock::Shape(const int theID) //purpose : //======================================================================= bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap) { MESSAGE("StdMeshers_Penta_3D::Evaluate()"); @@ -1904,6 +1904,10 @@ bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); meshFaces.push_back(aSubMesh); MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]); + if( anIt == aResMap.end() ) { + NumBase = 0; + break; + } std::vector aVec = (*anIt).second; int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); @@ -1912,7 +1916,15 @@ bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, } } - if(NumBase==0) return false; + if(NumBase==0) { + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; imyName = COMPERR_ALGO_FAILED; + myErrorStatus->myComment = "Submesh can not be evaluated"; + return false; + } // find number of 1d elems for base face int nb1d = 0; @@ -1934,8 +1946,8 @@ bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, bool IsOpposite = true; for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { if( Edges1.Contains(exp.Current()) ) { - IsOpposite = false; - break; + IsOpposite = false; + break; } } if(IsOpposite) { diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx new file mode 100644 index 000000000..95423e861 --- /dev/null +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx @@ -0,0 +1,1088 @@ +// Copyright (C) 2007-2008 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_RadialQuadrangle_1D2D.cxx +// Module : SMESH +// Created : Fri Oct 20 11:37:07 2006 +// Author : Edward AGAPOV (eap) +// +#include "StdMeshers_RadialQuadrangle_1D2D.hxx" + +//#include "StdMeshers_ProjectionUtils.hxx" +#include "StdMeshers_NumberOfLayers.hxx" +#include "StdMeshers_LayerDistribution.hxx" +//#include "StdMeshers_Prism_3D.hxx" +#include "StdMeshers_Regular_1D.hxx" + +#include "SMDS_MeshNode.hxx" +#include "SMESHDS_SubMesh.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_MesherHelper.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESH_subMeshEventListener.hxx" + +#include "utilities.h" + +#include +#include +//#include +#include +#include +#include +//#include +//#include +//#include +//#include +//#include + + +#include +#include +#include +#include +#include +#include + + +using namespace std; + +#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } +#define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z()) + +//typedef StdMeshers_ProjectionUtils TAssocTool; + + +//======================================================================= +//function : StdMeshers_RadialQuadrangle_1D2D +//purpose : +//======================================================================= + +StdMeshers_RadialQuadrangle_1D2D::StdMeshers_RadialQuadrangle_1D2D(int hypId, + int studyId, + SMESH_Gen* gen) + :SMESH_2D_Algo(hypId, studyId, gen) +{ + _name = "RadialQuadrangle_1D2D"; + _shapeType = (1 << TopAbs_FACE); // 1 bit per shape type + + _compatibleHypothesis.push_back("LayerDistribution2D"); + _compatibleHypothesis.push_back("NumberOfLayers2D"); + myNbLayerHypo = 0; + myDistributionHypo = 0; + _requireDescretBoundary = false; +} + + +//================================================================================ +/*! + * \brief Destructor + */ +//================================================================================ + +StdMeshers_RadialQuadrangle_1D2D::~StdMeshers_RadialQuadrangle_1D2D() +{} + + +//======================================================================= +//function : CheckHypothesis +//purpose : +//======================================================================= + +bool StdMeshers_RadialQuadrangle_1D2D::CheckHypothesis + (SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus) +{ + // check aShape + myNbLayerHypo = 0; + myDistributionHypo = 0; + + list ::const_iterator itl; + + const list &hyps = GetUsedHypothesis(aMesh, aShape); + if ( hyps.size() == 0 ) { + aStatus = SMESH_Hypothesis::HYP_MISSING; + return false; // can't work with no hypothesis + } + + if ( hyps.size() > 1 ) { + aStatus = SMESH_Hypothesis::HYP_ALREADY_EXIST; + return false; + } + + const SMESHDS_Hypothesis *theHyp = hyps.front(); + + string hypName = theHyp->GetName(); + + if (hypName == "NumberOfLayers2D") { + myNbLayerHypo = static_cast(theHyp); + aStatus = SMESH_Hypothesis::HYP_OK; + return true; + } + if (hypName == "LayerDistribution2D") { + myDistributionHypo = static_cast(theHyp); + aStatus = SMESH_Hypothesis::HYP_OK; + return true; + } + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + return true; +} + + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= + +bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + TopExp_Explorer exp; + SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); + + myHelper = new SMESH_MesherHelper( aMesh ); + myHelper->IsQuadraticSubMesh( aShape ); + + myLayerPositions.clear(); + + TopoDS_Edge E1,E2,E3; + Handle(Geom_Curve) C1,C2,C3; + double f1,l1,f2,l2,f3,l3; + int nbe = 0; + for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) { + nbe++; + TopoDS_Edge E = TopoDS::Edge( exp.Current() ); + if(nbe==1) { + E1 = E; + C1 = BRep_Tool::Curve(E,f1,l1); + } + else if(nbe==2) { + E2 = E; + C2 = BRep_Tool::Curve(E,f2,l2); + } + else if(nbe==3) { + E3 = E; + C3 = BRep_Tool::Curve(E,f3,l3); + } + } + + if(nbe>3) + return error(COMPERR_BAD_SHAPE); + + gp_Pnt P0,P1; + // points for rotation + TColgp_SequenceOfPnt Points; + // angles for rotation + TColStd_SequenceOfReal Angles; + // Nodes1 and Nodes2 - nodes along radiuses + // CNodes - nodes on circle edge + std::vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes; + SMDS_MeshNode * NC; + // parameters edge nodes on face + TColgp_SequenceOfPnt2d Pnts2d1, Pnts2d2; + gp_Pnt2d PC; + + int faceID = meshDS->ShapeToIndex(aShape); + TopoDS_Face F = TopoDS::Face(aShape); + Handle(Geom_Surface) S = BRep_Tool::Surface(F); + + //cout<<"RadialQuadrangle_1D2D::Compute nbe = "<Compute( aMesh, CircEdge, false, MeshDim_1D ); + if( !ok ) return false; + std::map< double, const SMDS_MeshNode* > theNodes; + GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); + + CNodes.clear(); + std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); + const SMDS_MeshNode* NF = (*itn).second; + CNodes.push_back( (*itn).second ); + double fang = (*itn).first; + itn++; + for(; itn != theNodes.end(); itn++ ) { + CNodes.push_back( (*itn).second ); + double ang = (*itn).first - fang; + if( ang>PI ) ang = ang - 2*PI; + if( ang<-PI ) ang = ang + 2*PI; + Angles.Append( ang ); + } + P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); + P0 = aCirc->Location(); + + myLayerPositions.clear(); + computeLayerPositions(P0,P1); + + exp.Init( CircEdge, TopAbs_VERTEX ); + TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); + gp_Pnt2d p2dV = BRep_Tool::Parameters( V1, TopoDS::Face(aShape) ); + + NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); + GeomAPI_ProjectPointOnSurf PPS(P0,S); + double U0,V0; + PPS.Parameters(1,U0,V0); + meshDS->SetNodeOnFace(NC, faceID, U0, V0); + PC = gp_Pnt2d(U0,V0); + + gp_Vec aVec(P0,P1); + gp_Vec2d aVec2d(PC,p2dV); + Nodes1.resize( myLayerPositions.size()+1 ); + Nodes2.resize( myLayerPositions.size()+1 ); + int i = 0; + for(; iAddNode(P.X(), P.Y(), P.Z()); + Nodes1[i] = node; + Nodes2[i] = node; + double U = PC.X() + aVec2d.X()*myLayerPositions[i]; + double V = PC.Y() + aVec2d.Y()*myLayerPositions[i]; + meshDS->SetNodeOnFace( node, faceID, U, V ); + Pnts2d1.Append(gp_Pnt2d(U,V)); + Pnts2d2.Append(gp_Pnt2d(U,V)); + } + Nodes1[Nodes1.size()-1] = NF; + Nodes2[Nodes1.size()-1] = NF; + } + else if(nbe==2) { + // one curve must be a half of circle and other curve must be + // a segment of line + Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + while( !tc.IsNull() ) { + C1 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + } + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + while( !tc.IsNull() ) { + C2 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + } + + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2); + CircEdge = E1; + LinEdge1 = E2; + double fp = f1; + double lp = l1; + if( aCirc.IsNull() ) { + aCirc = Handle(Geom_Circle)::DownCast(C2); + CircEdge = E2; + LinEdge1 = E1; + fp = f2; + lp = l2; + aLine = Handle(Geom_Line)::DownCast(C3); + } + if( aCirc.IsNull() ) { + // not circle + return error(COMPERR_BAD_SHAPE); + } + if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { + // not half of circle + return error(COMPERR_BAD_SHAPE); + } + if( aLine.IsNull() ) { + // other curve not line + return error(COMPERR_BAD_SHAPE); + } + SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); + if( sm1 ) { + SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS(); + if( sdssm1 ) { + if( sm1->GetSubMeshDS()->NbNodes()>0 ) { + SMESH_subMesh* sm = aMesh.GetSubMesh(F); + SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); + smError.reset(new SMESH_ComputeError(COMPERR_ALGO_FAILED, + "Invalid set of hypothesises",this)); + return false; + } + } + } + + bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D ); + if( !ok ) return false; + std::map< double, const SMDS_MeshNode* > theNodes; + GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); + + CNodes.clear(); + std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); + const SMDS_MeshNode* NF = (*itn).second; + CNodes.push_back( (*itn).second ); + double fang = (*itn).first; + itn++; + const SMDS_MeshNode* NL; + int nbn = 1; + for(; itn != theNodes.end(); itn++ ) { + nbn++; + if( nbn == theNodes.size() ) + NL = (*itn).second; + CNodes.push_back( (*itn).second ); + double ang = (*itn).first - fang; + if( ang>PI ) ang = ang - 2*PI; + if( ang<-PI ) ang = ang + 2*PI; + Angles.Append( ang ); + } + P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); + gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); + P0 = aCirc->Location(); + + myLayerPositions.clear(); + computeLayerPositions(P0,P1); + + gp_Vec aVec(P0,P1); + int edgeID = meshDS->ShapeToIndex(LinEdge1); + // check orientation + Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); + gp_Pnt Ptmp; + Crv->D0(fp,Ptmp); + bool ori = true; + if( P1.Distance(Ptmp) > Precision::Confusion() ) + ori = false; + // get UV points for edge + gp_Pnt2d PF,PL; + BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); + PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 ); + gp_Vec2d V2d; + if(ori) V2d = gp_Vec2d(PC,PF); + else V2d = gp_Vec2d(PC,PL); + // add nodes on edge + double cp = (fp+lp)/2; + double dp2 = (lp-fp)/2; + NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); + meshDS->SetNodeOnEdge(NC, edgeID, cp); + Nodes1.resize( myLayerPositions.size()+1 ); + Nodes2.resize( myLayerPositions.size()+1 ); + int i = 0; + for(; iAddNode(P.X(), P.Y(), P.Z()); + Nodes1[i] = node; + double param; + if(ori) + param = fp + dp2*(1-myLayerPositions[i]); + else + param = cp + dp2*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i], + P0.Y() - aVec.Y()*myLayerPositions[i], + P0.Z() - aVec.Z()*myLayerPositions[i] ); + node = meshDS->AddNode(P.X(), P.Y(), P.Z()); + Nodes2[i] = node; + if(!ori) + param = fp + dp2*(1-myLayerPositions[i]); + else + param = cp + dp2*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + // parameters on face + gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], + PC.Y() + V2d.Y()*myLayerPositions[i] ); + Pnts2d1.Append(P2d); + P2d = gp_Pnt2d( PC.X() - V2d.X()*myLayerPositions[i], + PC.Y() - V2d.Y()*myLayerPositions[i] ); + Pnts2d2.Append(P2d); + } + Nodes1[ myLayerPositions.size() ] = NF; + Nodes2[ myLayerPositions.size() ] = NL; + // create 1D elements on edge + std::vector< const SMDS_MeshNode* > tmpNodes; + tmpNodes.resize(2*Nodes1.size()+1); + for(i=0; iAddEdge( tmpNodes[i-1], tmpNodes[i] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + } + } + else { // nbe==3 + // one curve must be a part of circle and other curves must be + // segments of line + Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + while( !tc.IsNull() ) { + C1 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + } + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + while( !tc.IsNull() ) { + C2 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + } + tc = Handle(Geom_TrimmedCurve)::DownCast(C3); + while( !tc.IsNull() ) { + C3 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C3); + } + + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); + Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2); + Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3); + CircEdge = E1; + LinEdge1 = E2; + LinEdge2 = E3; + double fp = f1; + double lp = l1; + if( aCirc.IsNull() ) { + aCirc = Handle(Geom_Circle)::DownCast(C2); + CircEdge = E2; + LinEdge1 = E3; + LinEdge2 = E1; + fp = f2; + lp = l2; + aLine1 = Handle(Geom_Line)::DownCast(C3); + aLine2 = Handle(Geom_Line)::DownCast(C1); + if( aCirc.IsNull() ) { + aCirc = Handle(Geom_Circle)::DownCast(C3); + CircEdge = E3; + LinEdge1 = E1; + LinEdge2 = E2; + fp = f3; + lp = l3; + aLine1 = Handle(Geom_Line)::DownCast(C1); + aLine2 = Handle(Geom_Line)::DownCast(C2); + } + } + if( aCirc.IsNull() ) { + // not circle + return error(COMPERR_BAD_SHAPE); + } + if( aLine1.IsNull() || aLine2.IsNull() ) { + // other curve not line + return error(COMPERR_BAD_SHAPE); + } + SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); + SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2); + if( sm1 && sm2 ) { + SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS(); + SMESHDS_SubMesh* sdssm2 = sm2->GetSubMeshDS(); + if( sdssm1 && sdssm2 ) { + if( sm1->GetSubMeshDS()->NbNodes()>0 || sm2->GetSubMeshDS()->NbNodes()>0 ) { + SMESH_subMesh* sm = aMesh.GetSubMesh(F); + SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); + smError.reset(new SMESH_ComputeError(COMPERR_ALGO_FAILED, + "Invalid set of hypothesises",this)); + return false; + } + } + } + + bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D ); + if( !ok ) return false; + std::map< double, const SMDS_MeshNode* > theNodes; + GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); + + CNodes.clear(); + std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); + const SMDS_MeshNode* NF = (*itn).second; + CNodes.push_back( (*itn).second ); + double fang = (*itn).first; + itn++; + const SMDS_MeshNode* NL; + int nbn = 1; + for(; itn != theNodes.end(); itn++ ) { + nbn++; + if( nbn == theNodes.size() ) + NL = (*itn).second; + CNodes.push_back( (*itn).second ); + double ang = (*itn).first - fang; + if( ang>PI ) ang = ang - 2*PI; + if( ang<-PI ) ang = ang + 2*PI; + Angles.Append( ang ); + } + P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); + gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); + P0 = aCirc->Location(); + + myLayerPositions.clear(); + computeLayerPositions(P0,P1); + + exp.Init( LinEdge1, TopAbs_VERTEX ); + TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); + exp.Next(); + TopoDS_Vertex V2 = TopoDS::Vertex( exp.Current() ); + gp_Pnt PE1 = BRep_Tool::Pnt(V1); + gp_Pnt PE2 = BRep_Tool::Pnt(V2); + if( ( P1.Distance(PE1) > Precision::Confusion() ) && + ( P1.Distance(PE2) > Precision::Confusion() ) ) { + TopoDS_Edge E = LinEdge1; + LinEdge1 = LinEdge2; + LinEdge2 = E; + } + TopoDS_Vertex VC; + if( ( P1.Distance(PE1) > Precision::Confusion() ) && + ( P2.Distance(PE1) > Precision::Confusion() ) ) { + VC = V1; + } + else VC = V2; + int vertID = meshDS->ShapeToIndex(VC); + // LinEdge1 + int edgeID = meshDS->ShapeToIndex(LinEdge1); + gp_Vec aVec(P0,P1); + // check orientation + Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); + gp_Pnt Ptmp; + Crv->D0(fp,Ptmp); + bool ori = false; + if( P1.Distance(Ptmp) > Precision::Confusion() ) + ori = true; + // get UV points for edge + gp_Pnt2d PF,PL; + BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); + gp_Vec2d V2d; + if(ori) { + V2d = gp_Vec2d(PF,PL); + PC = PF; + } + else { + V2d = gp_Vec2d(PL,PF); + PC = PL; + } + NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); + meshDS->SetNodeOnVertex(NC, vertID); + double dp = lp-fp; + Nodes1.resize( myLayerPositions.size()+1 ); + int i = 0; + for(; iAddNode(P.X(), P.Y(), P.Z()); + Nodes1[i] = node; + double param; + if(!ori) + param = fp + dp*(1-myLayerPositions[i]); + else + param = fp + dp*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + // parameters on face + gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], + PC.Y() + V2d.Y()*myLayerPositions[i] ); + Pnts2d1.Append(P2d); + } + Nodes1[ myLayerPositions.size() ] = NF; + // create 1D elements on edge + SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + for(i=1; iAddEdge( Nodes1[i-1], Nodes1[i] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + } + // LinEdge2 + edgeID = meshDS->ShapeToIndex(LinEdge1); + aVec = gp_Vec(P0,P2); + // check orientation + Crv = BRep_Tool::Curve(LinEdge2,fp,lp); + Crv->D0(fp,Ptmp); + ori = false; + if( P2.Distance(Ptmp) > Precision::Confusion() ) + ori = true; + // get UV points for edge + BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL ); + if(ori) { + V2d = gp_Vec2d(PF,PL); + PC = PF; + } + else { + V2d = gp_Vec2d(PL,PF); + PC = PL; + } + dp = lp-fp; + Nodes2.resize( myLayerPositions.size()+1 ); + for(i=0; iAddNode(P.X(), P.Y(), P.Z()); + Nodes2[i] = node; + double param; + if(!ori) + param = fp + dp*(1-myLayerPositions[i]); + else + param = fp + dp*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + // parameters on face + gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], + PC.Y() + V2d.Y()*myLayerPositions[i] ); + Pnts2d2.Append(P2d); + } + Nodes2[ myLayerPositions.size() ] = NL; + // create 1D elements on edge + ME = myHelper->AddEdge( NC, Nodes2[0] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + for(i=1; iAddEdge( Nodes2[i-1], Nodes2[i] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + } + } + + // create nodes and mesh elements on face + // find axis of rotation + gp_Pnt P2 = gp_Pnt( CNodes[1]->X(), CNodes[1]->Y(), CNodes[1]->Z() ); + gp_Vec Vec1(P0,P1); + gp_Vec Vec2(P0,P2); + gp_Vec Axis = Vec1.Crossed(Vec2); + // create elements + int i = 1; + //cout<<"Angles.Length() = "<GetLayerDistribution() ) + return error( "Invalid LayerDistribution hypothesis"); + myUsedHyps.clear(); + myUsedHyps.push_back( hyp->GetLayerDistribution() ); + + TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut ); + SMESH_Hypothesis::Hypothesis_Status aStatus; + if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus )) + return error( "StdMeshers_Regular_1D::CheckHypothesis() failed " + "with LayerDistribution hypothesis"); + + BRepAdaptor_Curve C3D(edge); + double f = C3D.FirstParameter(), l = C3D.LastParameter(); + list< double > params; + if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false )) + return error("StdMeshers_Regular_1D failed to compute layers distribution"); + + positions.clear(); + positions.reserve( params.size() ); + for (list::iterator itU = params.begin(); itU != params.end(); itU++) + positions.push_back( *itU / len ); + return true; + } +protected: + // ----------------------------------------------------------------------------- + TNodeDistributor( int hypId, int studyId, SMESH_Gen* gen) + : StdMeshers_Regular_1D( hypId, studyId, gen) + { + } + // ----------------------------------------------------------------------------- + virtual const list & + GetUsedHypothesis(SMESH_Mesh &, const TopoDS_Shape &, const bool) + { + return myUsedHyps; + } + // ----------------------------------------------------------------------------- +}; + +//================================================================================ +/*! + * \brief Compute positions of nodes between the internal and the external surfaces + * \retval bool - is a success + */ +//================================================================================ + +bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt& pIn, + const gp_Pnt& pOut) +{ + if ( myNbLayerHypo ) + { + int nbSegments = myNbLayerHypo->GetNumberOfLayers(); + myLayerPositions.resize( nbSegments - 1 ); + for ( int z = 1; z < nbSegments; ++z ) + myLayerPositions[ z - 1 ] = double( z )/ double( nbSegments ); + return true; + } + if ( myDistributionHypo ) { + SMESH_Mesh * mesh = myHelper->GetMesh(); + if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions, pIn, pOut, + *mesh, myDistributionHypo )) + { + error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() ); + return false; + } + } + RETURN_BAD_RESULT("Bad hypothesis"); +} + + +//======================================================================= +//function : Evaluate +//purpose : +//======================================================================= + +bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + MapShapeNbElems& aResMap) +{ + if( aShape.ShapeType() != TopAbs_FACE ) { + return false; + } + SMESH_subMesh * smf = aMesh.GetSubMesh(aShape); + MapShapeNbElemsItr anIt = aResMap.find(smf); + if( anIt != aResMap.end() ) { + return false; + } + + myLayerPositions.clear(); + gp_Pnt P0(0,0,0); + gp_Pnt P1(100,0,0); + computeLayerPositions(P0,P1); + + TopoDS_Edge E1,E2,E3; + Handle(Geom_Curve) C1,C2,C3; + double f1,l1,f2,l2,f3,l3; + int nbe = 0; + TopExp_Explorer exp; + for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) { + nbe++; + TopoDS_Edge E = TopoDS::Edge( exp.Current() ); + if(nbe==1) { + E1 = E; + C1 = BRep_Tool::Curve(E,f1,l1); + } + else if(nbe==2) { + E2 = E; + C2 = BRep_Tool::Curve(E,f2,l2); + } + else if(nbe==3) { + E3 = E; + C3 = BRep_Tool::Curve(E,f3,l3); + } + } + + TopoDS_Edge CircEdge, LinEdge1, LinEdge2; + int nb0d=0, nb2d_tria=0, nb2d_quad=0; + bool isQuadratic = false; + if(nbe==1) { + // C1 must be a circle + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); + if( !aCirc.IsNull() ) { + bool ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); + if(ok) { + SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); + MapShapeNbElemsItr anIt = aResMap.find(sm); + std::vector aVec = (*anIt).second; + isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; + if(isQuadratic) { + // main nodes + nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + // radial medium nodes + nb0d += (aVec[SMDSEntity_Node]+1) * (myLayerPositions.size()+1); + // other medium nodes + nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + } + else { + nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + } + nb2d_tria = aVec[SMDSEntity_Node] + 1; + nb2d_quad = nb0d; + } + } + } + else if(nbe==2) { + // one curve must be a half of circle and other curve must be + // a segment of line + Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + while( !tc.IsNull() ) { + C1 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + } + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + while( !tc.IsNull() ) { + C2 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + } + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2); + CircEdge = E1; + LinEdge1 = E2; + double fp = f1; + double lp = l1; + if( aCirc.IsNull() ) { + aCirc = Handle(Geom_Circle)::DownCast(C2); + CircEdge = E2; + LinEdge1 = E1; + fp = f2; + lp = l2; + aLine = Handle(Geom_Line)::DownCast(C3); + } + bool ok = !aCirc.IsNull() && !aLine.IsNull(); + if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { + // not half of circle + ok = false; + } + SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); + MapShapeNbElemsItr anIt = aResMap.find(sm1); + if( anIt!=aResMap.end() ) { + ok = false; + } + if(ok) { + ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); + } + if(ok) { + SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); + MapShapeNbElemsItr anIt = aResMap.find(sm); + std::vector aVec = (*anIt).second; + isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; + if(isQuadratic) { + // main nodes + nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); + // radial medium nodes + nb0d += aVec[SMDSEntity_Node] * (myLayerPositions.size()+1); + // other medium nodes + nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + } + else { + nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); + } + nb2d_tria = aVec[SMDSEntity_Node] + 1; + nb2d_quad = nb2d_tria * myLayerPositions.size(); + // add evaluation for edges + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iBasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C1); + } + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + while( !tc.IsNull() ) { + C2 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C2); + } + tc = Handle(Geom_TrimmedCurve)::DownCast(C3); + while( !tc.IsNull() ) { + C3 = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C3); + } + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); + Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2); + Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3); + CircEdge = E1; + LinEdge1 = E2; + LinEdge2 = E3; + double fp = f1; + double lp = l1; + if( aCirc.IsNull() ) { + aCirc = Handle(Geom_Circle)::DownCast(C2); + CircEdge = E2; + LinEdge1 = E3; + LinEdge2 = E1; + fp = f2; + lp = l2; + aLine1 = Handle(Geom_Line)::DownCast(C3); + aLine2 = Handle(Geom_Line)::DownCast(C1); + if( aCirc.IsNull() ) { + aCirc = Handle(Geom_Circle)::DownCast(C3); + CircEdge = E3; + LinEdge1 = E1; + LinEdge2 = E2; + fp = f3; + lp = l3; + aLine1 = Handle(Geom_Line)::DownCast(C1); + aLine2 = Handle(Geom_Line)::DownCast(C2); + } + } + bool ok = !aCirc.IsNull() && !aLine1.IsNull() && !aLine1.IsNull(); + SMESH_subMesh* sm = aMesh.GetSubMesh(LinEdge1); + MapShapeNbElemsItr anIt = aResMap.find(sm); + if( anIt!=aResMap.end() ) { + ok = false; + } + sm = aMesh.GetSubMesh(LinEdge2); + anIt = aResMap.find(sm); + if( anIt!=aResMap.end() ) { + ok = false; + } + if(ok) { + ok = _gen->Evaluate( aMesh, CircEdge, aResMap ); + } + if(ok) { + SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge); + MapShapeNbElemsItr anIt = aResMap.find(sm); + std::vector aVec = (*anIt).second; + isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge]; + if(isQuadratic) { + // main nodes + nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); + // radial medium nodes + nb0d += aVec[SMDSEntity_Node] * (myLayerPositions.size()+1); + // other medium nodes + nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size(); + } + else { + nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size(); + } + nb2d_tria = aVec[SMDSEntity_Node] + 1; + nb2d_quad = nb2d_tria * myLayerPositions.size(); + // add evaluation for edges + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i +//#include + +class StdMeshers_NumberOfLayers; +class StdMeshers_LayerDistribution; +class SMESH_MesherHelper; +class gp_Pnt; + +class STDMESHERS_EXPORT StdMeshers_RadialQuadrangle_1D2D: public SMESH_2D_Algo +{ +public: + StdMeshers_RadialQuadrangle_1D2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~StdMeshers_RadialQuadrangle_1D2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap); + +protected: + + bool computeLayerPositions(const gp_Pnt& pIn, + const gp_Pnt& pOut); + + + const StdMeshers_NumberOfLayers* myNbLayerHypo; + const StdMeshers_LayerDistribution* myDistributionHypo; + SMESH_MesherHelper* myHelper; + std::vector< double > myLayerPositions; +}; + +#endif diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 2d1852b35..8e50b059b 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -73,22 +73,24 @@ using namespace std; //============================================================================= StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId, - SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen) + SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen) { - MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D"); - _name = "Regular_1D"; - _shapeType = (1 << TopAbs_EDGE); + MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D"); + _name = "Regular_1D"; + _shapeType = (1 << TopAbs_EDGE); + _fpHyp = 0; - _compatibleHypothesis.push_back("LocalLength"); - _compatibleHypothesis.push_back("MaxLength"); - _compatibleHypothesis.push_back("NumberOfSegments"); - _compatibleHypothesis.push_back("StartEndLength"); - _compatibleHypothesis.push_back("Deflection1D"); - _compatibleHypothesis.push_back("Arithmetic1D"); - _compatibleHypothesis.push_back("AutomaticLength"); + _compatibleHypothesis.push_back("LocalLength"); + _compatibleHypothesis.push_back("MaxLength"); + _compatibleHypothesis.push_back("NumberOfSegments"); + _compatibleHypothesis.push_back("StartEndLength"); + _compatibleHypothesis.push_back("Deflection1D"); + _compatibleHypothesis.push_back("Arithmetic1D"); + _compatibleHypothesis.push_back("FixedPoints1D"); + _compatibleHypothesis.push_back("AutomaticLength"); - _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!! - _compatibleHypothesis.push_back("Propagation"); // auxiliary !!! + _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!! + _compatibleHypothesis.push_back("Propagation"); // auxiliary !!! } //============================================================================= @@ -218,6 +220,16 @@ bool StdMeshers_Regular_1D::CheckHypothesis aStatus = SMESH_Hypothesis::HYP_OK; } + else if (hypName == "FixedPoints1D") { + _fpHyp = dynamic_cast (theHyp); + ASSERT(_fpHyp); + _hypType = FIXED_POINTS_1D; + + _revEdgesIDs = _fpHyp->GetReversedEdges(); + + aStatus = SMESH_Hypothesis::HYP_OK; + } + else if (hypName == "StartEndLength") { const StdMeshers_StartEndLength * hyp = @@ -773,6 +785,62 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, return true; } + case FIXED_POINTS_1D: { + const std::vector& aPnts = _fpHyp->GetPoints(); + const std::vector& nbsegs = _fpHyp->GetNbSegments(); + int i = 0; + TColStd_SequenceOfReal Params; + for(; i0.9999 ) continue; + int j=1; + bool IsExist = false; + for(; j<=Params.Length(); j++) { + if( fabs(aPnts[i]-Params.Value(j)) < 1e-4 ) { + IsExist = true; + break; + } + if( aPnts[i] _vvalue[1]; diff --git a/src/StdMeshersGUI/Makefile.am b/src/StdMeshersGUI/Makefile.am index 7415bc74b..fbc244b0f 100644 --- a/src/StdMeshersGUI/Makefile.am +++ b/src/StdMeshersGUI/Makefile.am @@ -36,7 +36,7 @@ salomeinclude_HEADERS = \ StdMeshersGUI_NbSegmentsCreator.h \ StdMeshersGUI_ObjectReferenceParamWdg.h \ StdMeshersGUI_LayerDistributionParamWdg.h \ - StdMeshersGUI_EdgeDirectionParamWdg.h \ + StdMeshersGUI_FixedPointsParamWdg.h \ StdMeshersGUI_SubShapeSelectorWdg.h # Libraries targets @@ -49,7 +49,7 @@ dist_libStdMeshersGUI_la_SOURCES = \ StdMeshersGUI_NbSegmentsCreator.cxx \ StdMeshersGUI_ObjectReferenceParamWdg.cxx \ StdMeshersGUI_LayerDistributionParamWdg.cxx \ - StdMeshersGUI_EdgeDirectionParamWdg.cxx \ + StdMeshersGUI_FixedPointsParamWdg.cxx \ StdMeshersGUI_SubShapeSelectorWdg.cxx MOC_FILES = \ @@ -59,7 +59,7 @@ MOC_FILES = \ StdMeshersGUI_NbSegmentsCreator_moc.cxx \ StdMeshersGUI_ObjectReferenceParamWdg_moc.cxx \ StdMeshersGUI_LayerDistributionParamWdg_moc.cxx \ - StdMeshersGUI_EdgeDirectionParamWdg_moc.cxx \ + StdMeshersGUI_FixedPointsParamWdg_moc.cxx \ StdMeshersGUI_SubShapeSelectorWdg_moc.cxx nodist_libStdMeshersGUI_la_SOURCES= \ diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx new file mode 100644 index 000000000..51685c370 --- /dev/null +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.cxx @@ -0,0 +1,374 @@ +// Copyright (C) 2007-2008 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 +// +// File : StdMeshersGUI_FixedPointsParamWdg.cxx +// Author : Open CASCADE S.A.S. +// SMESH includes +// +#include "StdMeshersGUI_FixedPointsParamWdg.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 0 +#define SAME_TEXT "-/-" + +/* + * function : Tree Widget Item Delegate + * purpose : Custom item delegate + */ + +class StdMeshersGUI_FixedPointsParamWdg::LineDelegate : public QItemDelegate +{ +public: + LineDelegate( QTreeWidget* ); + ~LineDelegate() {} + + QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const; + void setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const; + +private: + QTreeWidget* myTreeWidget; +}; + +StdMeshersGUI_FixedPointsParamWdg::LineDelegate::LineDelegate( QTreeWidget* parent ) + : QItemDelegate( parent ), + myTreeWidget( parent ) +{ +} + +QWidget* StdMeshersGUI_FixedPointsParamWdg::LineDelegate::createEditor( QWidget* parent, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const +{ + QWidget* w = 0; + if ( (index.column() == 1 ) ) { + QSpinBox* sb = new QSpinBox( parent ); + sb->setFrame( false ); + sb->setRange( 1, 999); + w = sb; + } + + return w; +} + +void StdMeshersGUI_FixedPointsParamWdg::LineDelegate::setModelData( QWidget* editor, + QAbstractItemModel* model, + const QModelIndex& index ) const +{ + model->setData( index, qobject_cast( editor )->value(), Qt::EditRole ); + model->setData( index, qobject_cast( editor )->value(), Qt::UserRole ); +} + +//================================================================================ +/*! + * Constructor + */ +//================================================================================ + +StdMeshersGUI_FixedPointsParamWdg +::StdMeshersGUI_FixedPointsParamWdg( QWidget * parent ): + QWidget( parent ) +{ + QGridLayout* edgesLayout = new QGridLayout( this ); + edgesLayout->setMargin( MARGIN ); + edgesLayout->setSpacing( SPACING ); + + myListWidget = new QListWidget( this ); + myTreeWidget = new QTreeWidget( this ); + mySpinBox = new QDoubleSpinBox( this ); + myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); + myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); + mySameValues = new QCheckBox( tr("SMESH_SAME_NB_SEGMENTS"), this); + + myListWidget->setSelectionMode( QListWidget::ExtendedSelection ); + + myTreeWidget->setColumnCount(2); + myTreeWidget->setHeaderLabels( QStringList() << tr( "SMESH_RANGE" ) << tr( "SMESH_NB_SEGMENTS" ) ); + myTreeWidget->setColumnWidth( 1, 40 ); + myTreeWidget->setColumnWidth( 2, 30 ); + myTreeWidget->setItemDelegate( new LineDelegate( myTreeWidget ) ); + + edgesLayout->addWidget(myListWidget, 0, 0, 4, 1); + edgesLayout->addWidget(mySpinBox, 0, 1); + edgesLayout->addWidget(myAddButton, 1, 1); + edgesLayout->addWidget(myRemoveButton, 2, 1); + edgesLayout->addWidget(myTreeWidget, 0, 2, 4, 1); + edgesLayout->addWidget(mySameValues, 4, 0, 1, 3); + edgesLayout->setRowStretch( 3, 5 ); + edgesLayout->setColumnStretch(0, 1); + edgesLayout->setColumnStretch(1, 0); + edgesLayout->setColumnStretch(2, 2); + + myListWidget->setMinimumWidth( 80 ); + myTreeWidget->setMinimumWidth( 200 ); + + mySpinBox->setRange( 0, 1 ); + mySpinBox->setSingleStep( 0.1 ); + + connect( myAddButton, SIGNAL(clicked()), SLOT(onAdd())); + connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove())); + connect( mySameValues, SIGNAL(stateChanged(int)), SLOT(onCheckBoxChanged())); + myListWidget->installEventFilter( this ); + + clear(); +} + +//================================================================================ +/*! + * Destructor + */ +//================================================================================ + +StdMeshersGUI_FixedPointsParamWdg::~StdMeshersGUI_FixedPointsParamWdg() +{ +} + +//================================================================================ +/*! + * Event filter + */ +//================================================================================ +bool StdMeshersGUI_FixedPointsParamWdg::eventFilter( QObject* o, QEvent* e ) +{ + if ( o == myListWidget && e->type() == QEvent::KeyPress ) { + QKeyEvent* ke = (QKeyEvent*)e; + if ( ke->key() == Qt::Key_Delete ) + removePoints(); + } + return QWidget::eventFilter( o, e ); +} + +//================================================================================ +/*! + * Clear widget + */ +//================================================================================ +void StdMeshersGUI_FixedPointsParamWdg::clear() +{ + myTreeWidget->clear(); + myListWidget->clear(); + myTreeWidget->addTopLevelItem( newTreeItem( 0, 1 ) ); + mySpinBox->setValue( 0. ); + onCheckBoxChanged(); +} + +//================================================================================= +// function : onAdd() +// purpose : Called when Add Button Clicked +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::onAdd() +{ + addPoint( mySpinBox->value() ); +} + +//================================================================================= +// function : onRemove() +// purpose : Called when Remove Button Clicked +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::onRemove() +{ + removePoints(); +} + +//================================================================================= +// function : newTreeItem() +// purpose : Called to create TreeItem +//================================================================================= + +QTreeWidgetItem* StdMeshersGUI_FixedPointsParamWdg::newTreeItem( double v1, double v2 ) +{ + QTreeWidgetItem* anItem = new QTreeWidgetItem(); + anItem->setText( 0, treeItemText( v1, v2 ) ); + anItem->setText( 1, QString::number( 1 ) ); + anItem->setData( 1, Qt::UserRole, 1 ); + return anItem; +} + +//================================================================================= +// function : newListItem() +// purpose : Called to create ListItem +//================================================================================= + +QListWidgetItem* StdMeshersGUI_FixedPointsParamWdg::newListItem( double v ) +{ + QListWidgetItem* anItem = new QListWidgetItem( QString::number( v ) ); + anItem->setData( Qt::UserRole, v ); + return anItem; +} + +//================================================================================= +// function : itemText() +// purpose : Called to convert Values to Text +//================================================================================= + +QString StdMeshersGUI_FixedPointsParamWdg::treeItemText( double v1, double v2 ) +{ + return QString( "%1 - %2" ).arg( v1 ).arg( v2 ); +} + +//================================================================================= +// function : addPoint() +// purpose : Called to Add new Point +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::addPoint( double v) +{ + if ( v > 0 && v < 1) { + bool toInsert = true; + int idx = myTreeWidget->topLevelItemCount()-1; + for ( int i = 0 ; i < myListWidget->count(); i++ ) { + double lv = point( i ); + if ( lv == v ) { toInsert = false; break; } + else if ( lv > v ) { + idx = i; break; + } + } + if ( toInsert ) { + double v1 = idx == 0 ? 0 : point( idx-1 ); + double v2 = idx == myTreeWidget->topLevelItemCount()-1 ? 1 : point( idx ); + myTreeWidget->insertTopLevelItem( idx, newTreeItem( v1, v ) ); + myTreeWidget->topLevelItem( idx+1 )->setText( 0, treeItemText( v, v2 ) ); + myListWidget->insertItem( idx, newListItem( v ) ); + onCheckBoxChanged(); + } + } +} + +//================================================================================= +// function : removePoints() +// purpose : Called to remove selected points +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::removePoints() +{ + QList selItems = myListWidget->selectedItems(); + QListWidgetItem* item; + foreach ( item, selItems ) { + int idx = myListWidget->row( item ); + delete myTreeWidget->topLevelItem( idx ); + delete item; + myTreeWidget->topLevelItem( idx )->setText( 0, treeItemText( idx == 0 ? 0 : point( idx-1 ), + idx > myListWidget->count()-1 ? 1 : point( idx ) ) ); + } + onCheckBoxChanged(); +} + +double StdMeshersGUI_FixedPointsParamWdg::point( int idx ) const +{ + return idx >= 0 && idx < myListWidget->count() ? myListWidget->item( idx )->data( Qt::UserRole ).toDouble() : 0.; +} + +void StdMeshersGUI_FixedPointsParamWdg::setNbSegments( int idx, int val ) +{ + if ( idx >= 0 && idx < myTreeWidget->topLevelItemCount() ) { + myTreeWidget->topLevelItem( idx )->setData( 1, Qt::UserRole, val ); + myTreeWidget->topLevelItem( idx )->setText( 1, idx > 0 && mySameValues->isChecked() ? QString( SAME_TEXT ) : QString::number( val ) ); + } +} + +int StdMeshersGUI_FixedPointsParamWdg::nbSegments( int idx ) const +{ + return idx >= 0 && idx < myTreeWidget->topLevelItemCount() ? myTreeWidget->topLevelItem( idx )->data( 1, Qt::UserRole ).toInt() : 1; +} + +//================================================================================= +// function : onCheckBoxChanged() +// purpose : Called when Check Box Clicked +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::onCheckBoxChanged() +{ + for ( int i = 0; i < myTreeWidget->topLevelItemCount(); i++ ) { + QTreeWidgetItem* anItem = myTreeWidget->topLevelItem(i); + setNbSegments( i, nbSegments( i ) ); + anItem->setFlags( mySameValues->isChecked() && i > 0 ? anItem->flags() & ~Qt::ItemIsEditable : anItem->flags() | Qt::ItemIsEditable ); + } +} + +//================================================================================= +// function : GetListOfPoints +// purpose : Called to get the list of Edges IDs +//================================================================================= +SMESH::double_array_var StdMeshersGUI_FixedPointsParamWdg::GetListOfPoints() +{ + SMESH::double_array_var anArray = new SMESH::double_array; + int size = myListWidget->count(); + anArray->length( size ); + for (int i = 0; i < size; i++) { + anArray[i] = point(i); + // printf ("Point %f \n", anArray[i]); + } + return anArray; +} + +//================================================================================= +// function : SetListOfPoints +// purpose : Called to set the list of Points +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::SetListOfPoints( SMESH::double_array_var thePoints) +{ + clear(); + for ( int i = 0; i < thePoints->length(); i++ ) { + addPoint( thePoints[ i ] ); + // printf ("Add Point %f \n", thePoints[ i ]); + } +} + +//================================================================================= +// function : GetListOfSegments +// purpose : Called to get the list Number of Segments +//================================================================================= +SMESH::long_array_var StdMeshersGUI_FixedPointsParamWdg::GetListOfSegments() +{ + SMESH::long_array_var anArray = new SMESH::long_array; + int size = mySameValues->isChecked() ? 1 : myTreeWidget->topLevelItemCount(); + anArray->length( size ); + for (int i = 0; i < size; i++) { + anArray[i] = nbSegments( i ); + // printf ("Segments %d \n", anArray[i] ); + } + return anArray; +} + +//================================================================================= +// function : SetListOfPoints +// purpose : Called to set the list of Points +//================================================================================= +void StdMeshersGUI_FixedPointsParamWdg::SetListOfSegments( SMESH::long_array_var theSegments) +{ + if ( myListWidget->count() > 0 && theSegments->length() == 1) + mySameValues->setChecked(true); + for ( int i = 0; i < theSegments->length(); i++ ) { + setNbSegments( i, theSegments[i] ); + // printf ("\nadd Segment = %d\n", theSegments[i]); + } +} diff --git a/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h new file mode 100644 index 000000000..b96806de4 --- /dev/null +++ b/src/StdMeshersGUI/StdMeshersGUI_FixedPointsParamWdg.h @@ -0,0 +1,93 @@ +// Copyright (C) 2007-2008 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 +// +// File : StdMeshersGUI_FixedPointsParamWdg.h +// Author : Open CASCADE S.A.S. (dmv) +// +#ifndef STDMESHERSGUI_FIXEDPOINTSPARAMWGD_H +#define STDMESHERSGUI_FIXEDPOINTSPARAMWGD_H + +// SMESH includes +#include +#include "SMESH_StdMeshersGUI.hxx" + +// Qt includes +#include +#include + +class SMESHGUI; +class QPushButton; +class QLineEdit; +class QCheckBox; +class QDoubleSpinBox; +class QListWidget; +class QListWidgetItem; +class QTreeWidget; +class QTreeWidgetItem; + +class STDMESHERSGUI_EXPORT StdMeshersGUI_FixedPointsParamWdg : public QWidget +{ + Q_OBJECT + + class LineDelegate; + +public: + StdMeshersGUI_FixedPointsParamWdg( QWidget* parent = 0 ); + ~StdMeshersGUI_FixedPointsParamWdg(); + + bool eventFilter( QObject*, QEvent* ); + + SMESH::double_array_var GetListOfPoints(); + void SetListOfPoints( SMESH::double_array_var ); + + SMESH::long_array_var GetListOfSegments(); + void SetListOfSegments( SMESH::long_array_var ); + + QString GetValue() const { return myParamValue; } + +private slots: + void onAdd(); + void onRemove(); + void onCheckBoxChanged(); + +private: + void clear(); + void addPoint( double ); + void removePoints(); + double point( int ) const; + void setNbSegments( int, int ); + int nbSegments( int ) const; + + static QTreeWidgetItem* newTreeItem( double v1, double v2 ); + static QListWidgetItem* newListItem( double v1 ); + static QString treeItemText( double v1, double v2 ); + +private: + QListWidget* myListWidget; + QTreeWidget* myTreeWidget; + QDoubleSpinBox* mySpinBox; + QPushButton* myAddButton; + QPushButton* myRemoveButton; + QCheckBox* mySameValues; + QString myParamValue; +}; + +#endif // STDMESHERSGUI_FIXEDPOINTSPARAMWGD_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 43563ea45..35231586d 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -33,8 +33,8 @@ #include #include "StdMeshersGUI_ObjectReferenceParamWdg.h" #include "StdMeshersGUI_LayerDistributionParamWdg.h" -//#include "StdMeshersGUI_EdgeDirectionParamWdg.h" #include "StdMeshersGUI_SubShapeSelectorWdg.h" +#include "StdMeshersGUI_FixedPointsParamWdg.h" #include // SALOME GUI includes @@ -200,9 +200,9 @@ namespace { QHBoxLayout* aHBoxL = new QHBoxLayout(this); if ( !leftLabel.isEmpty() ) { - QLabel* aLeftLabel = new QLabel( this ); - aLeftLabel->setText( leftLabel ); - aHBoxL->addWidget( aLeftLabel ); + QLabel* aLeftLabel = new QLabel( this ); + aLeftLabel->setText( leftLabel ); + aHBoxL->addWidget( aLeftLabel ); } _slider = new QSlider( Qt::Horizontal, this ); @@ -211,9 +211,9 @@ namespace { aHBoxL->addWidget( _slider ); if ( !rightLabel.isEmpty() ) { - QLabel* aRightLabel = new QLabel( this ); - aRightLabel->setText( rightLabel ); - aHBoxL->addWidget( aRightLabel ); + QLabel* aRightLabel = new QLabel( this ); + aRightLabel->setText( rightLabel ); + aHBoxL->addWidget( aRightLabel ); } setLayout( aHBoxL ); @@ -378,7 +378,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const if ( ok ) deactivateObjRefParamWdg( customWidgets() ); } - else if ( hypType() == "LayerDistribution" ) + else if ( hypType() == "LayerDistribution" || hypType() == "LayerDistribution2D" ) { StdMeshersGUI_LayerDistributionParamWdg* w = widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 ); @@ -412,7 +412,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const if( hypType()=="LocalLength" ) { StdMeshers::StdMeshers_LocalLength_var h = - StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() ); + StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() ); h->SetLength( params[0].myValue.toDouble() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); @@ -422,7 +422,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="MaxLength" ) { StdMeshers::StdMeshers_MaxLength_var h = - StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() ); + StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() ); h->SetLength( params[0].myValue.toDouble() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); @@ -436,7 +436,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="SegmentLengthAroundVertex" ) { StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h = - StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() ); + StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() ); h->SetLength( params[0].myValue.toDouble() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); @@ -444,10 +444,8 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="Arithmetic1D" ) { StdMeshers::StdMeshers_Arithmetic1D_var h = - StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() ); + StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() ); - //StdMeshersGUI_EdgeDirectionParamWdg* w = - // widget< StdMeshersGUI_EdgeDirectionParamWdg >( 2 ); StdMeshersGUI_SubShapeSelectorWdg* w = widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 ); @@ -456,22 +454,44 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetEndLength( params[1].myValue.toDouble() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); if (w) { - h->SetReversedEdges( w->GetListOfIDs() ); - const char * entry = w->GetMainShapeEntry(); - h->SetObjectEntry( entry ); + h->SetReversedEdges( w->GetListOfIDs() ); + const char * entry = w->GetMainShapeEntry(); + h->SetObjectEntry( entry ); + } + } + else if( hypType()=="FixedPoints1D" ) + { + StdMeshers::StdMeshers_FixedPoints1D_var h = + StdMeshers::StdMeshers_FixedPoints1D::_narrow( hypothesis() ); + + StdMeshersGUI_FixedPointsParamWdg* w1 = + widget< StdMeshersGUI_FixedPointsParamWdg >( 0 ); + + StdMeshersGUI_SubShapeSelectorWdg* w2 = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 ); + + if (w1) { + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); + h->SetPoints( w1->GetListOfPoints() ); + h->SetNbSegments( w1->GetListOfSegments() ); + } + if (w2) { + h->SetReversedEdges( w2->GetListOfIDs() ); + const char * entry = w2->GetMainShapeEntry(); + h->SetObjectEntry( entry ); } } else if( hypType()=="MaxElementArea" ) { StdMeshers::StdMeshers_MaxElementArea_var h = - StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() ); + StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); h->SetMaxElementArea( params[0].myValue.toDouble() ); } else if( hypType()=="MaxElementVolume" ) { StdMeshers::StdMeshers_MaxElementVolume_var h = - StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() ); + StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() ); h->SetMaxElementVolume( params[0].myValue.toDouble() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); @@ -479,7 +499,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="StartEndLength" ) { StdMeshers::StdMeshers_StartEndLength_var h = - StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() ); + StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() ); StdMeshersGUI_SubShapeSelectorWdg* w = widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 ); @@ -489,28 +509,28 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetEndLength( params[1].myValue.toDouble() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); if (w) { - h->SetReversedEdges( w->GetListOfIDs() ); - h->SetObjectEntry( w->GetMainShapeEntry() ); + h->SetReversedEdges( w->GetListOfIDs() ); + h->SetObjectEntry( w->GetMainShapeEntry() ); } } else if( hypType()=="Deflection1D" ) { StdMeshers::StdMeshers_Deflection1D_var h = - StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() ); + StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); h->SetDeflection( params[0].myValue.toDouble() ); } else if( hypType()=="AutomaticLength" ) { StdMeshers::StdMeshers_AutomaticLength_var h = - StdMeshers::StdMeshers_AutomaticLength::_narrow( hypothesis() ); + StdMeshers::StdMeshers_AutomaticLength::_narrow( hypothesis() ); h->SetFineness( params[0].myValue.toDouble() ); } else if( hypType()=="NumberOfLayers" ) { StdMeshers::StdMeshers_NumberOfLayers_var h = - StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() ); + StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() ); h->SetNumberOfLayers( params[0].myValue.toInt() ); h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); @@ -518,7 +538,26 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="LayerDistribution" ) { StdMeshers::StdMeshers_LayerDistribution_var h = - StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() ); + StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() ); + StdMeshersGUI_LayerDistributionParamWdg* w = + widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 ); + + h->SetLayerDistribution( w->GetHypothesis() ); + h->SetParameters(w->GetHypothesis()->GetParameters()); + w->GetHypothesis()->ClearParameters(); + } + else if( hypType()=="NumberOfLayers2D" ) + { + StdMeshers::StdMeshers_NumberOfLayers2D_var h = + StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() ); + + h->SetNumberOfLayers( params[0].myValue.toInt() ); + h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList)); + } + else if( hypType()=="LayerDistribution2D" ) + { + StdMeshers::StdMeshers_LayerDistribution2D_var h = + StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hypothesis() ); StdMeshersGUI_LayerDistributionParamWdg* w = widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 ); @@ -529,7 +568,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="ProjectionSource1D" ) { StdMeshers::StdMeshers_ProjectionSource1D_var h = - StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hypothesis() ); + StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hypothesis() ); h->SetSourceEdge ( geomFromWdg ( getWidgetForParam( 0 ))); h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 ))); @@ -539,7 +578,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="ProjectionSource2D" ) { StdMeshers::StdMeshers_ProjectionSource2D_var h = - StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hypothesis() ); + StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hypothesis() ); h->SetSourceFace ( geomFromWdg ( getWidgetForParam( 0 ))); h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 ))); @@ -551,7 +590,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="ProjectionSource3D" ) { StdMeshers::StdMeshers_ProjectionSource3D_var h = - StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hypothesis() ); + StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hypothesis() ); h->SetSource3DShape ( geomFromWdg ( getWidgetForParam( 0 ))); h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 ))); @@ -563,15 +602,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const else if( hypType()=="QuadrangleParams" ) { StdMeshers::StdMeshers_QuadrangleParams_var h = - StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); + StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); StdMeshersGUI_SubShapeSelectorWdg* w = widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); if (w) { - if( w->GetListOfIDs()->length()>0 ) { - h->SetTriaVertex( w->GetListOfIDs()[0] ); - } - const char * entry = w->GetMainShapeEntry(); - h->SetObjectEntry( entry ); + if( w->GetListOfIDs()->length()>0 ) { + h->SetTriaVertex( w->GetListOfIDs()[0] ); + } + const char * entry = w->GetMainShapeEntry(); + h->SetObjectEntry( entry ); } } } @@ -692,11 +731,9 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const customWidgets()->append (0); - item.myName = tr( "SMESH_REVERCE_EDGES" ); + item.myName = tr( "SMESH_REVERSED_EDGES" ); p.append( item ); - //StdMeshersGUI_EdgeDirectionParamWdg* aDirectionWidget = - // new StdMeshersGUI_EdgeDirectionParamWdg(); StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg(); QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); @@ -707,6 +744,40 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const aDirectionWidget->showPreview( true ); customWidgets()->append ( aDirectionWidget ); } + + + else if( hypType()=="FixedPoints1D" ) + { + StdMeshers::StdMeshers_FixedPoints1D_var h = + StdMeshers::StdMeshers_FixedPoints1D::_narrow( hyp ); + + item.myName = tr( "SMESH_FIXED_POINTS" ); + p.append( item ); + + StdMeshersGUI_FixedPointsParamWdg* aFixedPointsWidget = + new StdMeshersGUI_FixedPointsParamWdg(); + + if ( !isCreation() ) { + aFixedPointsWidget->SetListOfPoints( h->GetPoints() ); + aFixedPointsWidget->SetListOfSegments( h->GetNbSegments() ); + } + customWidgets()->append( aFixedPointsWidget ); + + item.myName = tr( "SMESH_REVERSED_EDGES" ); + p.append( item ); + + StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = + new StdMeshersGUI_SubShapeSelectorWdg(); + QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + if ( anEntry == "" ) + anEntry = h->GetObjectEntry(); + aDirectionWidget->SetMainShapeEntry( anEntry ); + aDirectionWidget->SetListOfIDs( h->GetReversedEdges() ); + aDirectionWidget->showPreview( true ); + customWidgets()->append ( aDirectionWidget ); + } + + else if( hypType()=="MaxElementArea" ) { StdMeshers::StdMeshers_MaxElementArea_var h = @@ -746,11 +817,9 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const p.append( item ); customWidgets()->append(0); - item.myName = tr( "SMESH_REVERCE_EDGES" ); + item.myName = tr( "SMESH_REVERSED_EDGES" ); p.append( item ); - //StdMeshersGUI_EdgeDirectionParamWdg* aDirectionWidget = - // new StdMeshersGUI_EdgeDirectionParamWdg(); StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg(); QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); @@ -793,10 +862,35 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const item.myValue = (int) h->GetNumberOfLayers(); p.append( item ); } - else if( hypType()=="LayerDistribution" ) - { - StdMeshers::StdMeshers_LayerDistribution_var h = + else if( hypType()=="LayerDistribution" ) { + StdMeshers::StdMeshers_LayerDistribution_var h = StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp ); + + item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item ); + + //Set into not published hypo last variables + QStringList aLastVarsList; + for(int i = 0;ilength();i++) + aLastVarsList.append(QString(aParameters[i].in())); + + if(!aLastVarsList.isEmpty()) + h->GetLayerDistribution()->SetLastParameters(SMESHGUI::JoinObjectParameters(aLastVarsList)); + + customWidgets()->append + ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg())); + } + else if( hypType()=="NumberOfLayers2D" ) { + StdMeshers::StdMeshers_NumberOfLayers2D_var h = + StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hyp ); + + item.myName = tr( "SMESH_NUMBER_OF_LAYERS" ); + if(!initVariableName(aParameters,item,0)) + item.myValue = (int) h->GetNumberOfLayers(); + p.append( item ); + } + else if( hypType()=="LayerDistribution2D" ) { + StdMeshers::StdMeshers_LayerDistribution2D_var h = + StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hyp ); item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item ); @@ -1015,12 +1109,15 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons types.insert( "StartEndLength", "START_END_LENGTH" ); types.insert( "Deflection1D", "DEFLECTION1D" ); types.insert( "Arithmetic1D", "ARITHMETIC_1D" ); + types.insert( "FixedPoints1D", "FIXED_POINTS_1D" ); types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" ); types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" ); types.insert( "ProjectionSource2D", "PROJECTION_SOURCE_2D" ); types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" ); types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" ); types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" ); + types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS" ); + types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" ); types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" ); types.insert( "MaxLength", "MAX_LENGTH" ); types.insert( "QuadrangleParams", "QUADRANGLE_PARAMS" ); @@ -1096,13 +1193,6 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa param.myValue = w->GetValue(); return true; } - //if ( widget->inherits( "StdMeshersGUI_EdgeDirectionParamWdg" )) - //{ - // const StdMeshersGUI_EdgeDirectionParamWdg * w = - // static_cast( widget ); - // param.myValue = w->GetValue(); - // return true; - //} if ( widget->inherits( "StdMeshersGUI_SubShapeSelectorWdg" )) { const StdMeshersGUI_SubShapeSelectorWdg * w = @@ -1110,6 +1200,13 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa param.myValue = w->GetValue(); return true; } + if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" )) + { + const StdMeshersGUI_FixedPointsParamWdg * w = + static_cast( widget ); + param.myValue = w->GetValue(); + return true; + } return false; } diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts index cb63c4f18..7dc80991b 100644 --- a/src/StdMeshersGUI/StdMeshers_images.ts +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -29,6 +29,10 @@ ICON_DLG_ARITHMETIC_1D mesh_hypo_length.png + + ICON_DLG_FIXED_POINTS_1D + mesh_hypo_length.png + ICON_DLG_AUTOMATIC_LENGTH mesh_hypo_length.png diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts index e49d525e8..caabb7f54 100644 --- a/src/StdMeshersGUI/StdMeshers_msg_en.ts +++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts @@ -149,6 +149,14 @@ SMESH_LOCAL_LENGTH_TITLE Hypothesis Construction + + SMESH_FIXED_POINTS_1D_HYPOTHESIS + Fixed points 1D + + + SMESH_FIXED_POINTS_1D_TITLE + Hypothesis Construction + SMESH_MAX_LENGTH_HYPOTHESIS Max Length @@ -246,8 +254,24 @@ Remove row - SMESH_REVERCE_EDGES - Reverce Edges + SMESH_REVERSED_EDGES + Reversed Edges + + + SMESH_FIXED_POINTS + Fixed Points + + + SMESH_RANGE + Range + + + SMESH_NB_SEGMENTS + Nb. Segments + + + SMESH_SAME_NB_SEGMENTS + Same Nb. Segments for All Intervals SMESH_BASE_VERTEX diff --git a/src/StdMeshers_I/Makefile.am b/src/StdMeshers_I/Makefile.am index 94ed920c8..d1068d1d6 100644 --- a/src/StdMeshers_I/Makefile.am +++ b/src/StdMeshers_I/Makefile.am @@ -32,6 +32,7 @@ salomeinclude_HEADERS = \ StdMeshers_LocalLength_i.hxx \ StdMeshers_StartEndLength_i.hxx \ StdMeshers_Arithmetic1D_i.hxx \ + StdMeshers_FixedPoints1D_i.hxx \ StdMeshers_NumberOfSegments_i.hxx \ StdMeshers_Deflection1D_i.hxx \ StdMeshers_Propagation_i.hxx \ @@ -47,6 +48,7 @@ salomeinclude_HEADERS = \ StdMeshers_QuadranglePreference_i.hxx \ StdMeshers_QuadraticMesh_i.hxx \ StdMeshers_NumberOfLayers_i.hxx \ + StdMeshers_NumberOfLayers2D_i.hxx \ StdMeshers_Prism_3D_i.hxx \ StdMeshers_ProjectionSource1D_i.hxx \ StdMeshers_ProjectionSource2D_i.hxx \ @@ -54,6 +56,7 @@ salomeinclude_HEADERS = \ StdMeshers_Projection_1D_2D_3D_i.hxx \ StdMeshers_ObjRefUlils.hxx \ StdMeshers_LayerDistribution_i.hxx \ + StdMeshers_LayerDistribution2D_i.hxx \ StdMeshers_CompositeSegment_1D_i.hxx \ StdMeshers_SegmentAroundVertex_0D_i.hxx \ StdMeshers_SegmentLengthAroundVertex_i.hxx \ @@ -61,6 +64,7 @@ salomeinclude_HEADERS = \ StdMeshers_TrianglePreference_i.hxx \ StdMeshers_MaxLength_i.hxx \ StdMeshers_QuadrangleParams_i.hxx \ + StdMeshers_RadialQuadrangle_1D2D_i.hxx \ SMESH_StdMeshers_I.hxx # Libraries targets @@ -71,6 +75,7 @@ dist_libStdMeshersEngine_la_SOURCES = \ StdMeshers_LocalLength_i.cxx \ StdMeshers_StartEndLength_i.cxx \ StdMeshers_Arithmetic1D_i.cxx \ + StdMeshers_FixedPoints1D_i.cxx \ StdMeshers_NumberOfSegments_i.cxx \ StdMeshers_Deflection1D_i.cxx \ StdMeshers_Propagation_i.cxx \ @@ -86,6 +91,7 @@ dist_libStdMeshersEngine_la_SOURCES = \ StdMeshers_QuadranglePreference_i.cxx \ StdMeshers_QuadraticMesh_i.cxx \ StdMeshers_NumberOfLayers_i.cxx \ + StdMeshers_NumberOfLayers2D_i.cxx \ StdMeshers_Prism_3D_i.cxx \ StdMeshers_ProjectionSource1D_i.cxx \ StdMeshers_ProjectionSource2D_i.cxx \ @@ -93,13 +99,15 @@ dist_libStdMeshersEngine_la_SOURCES = \ StdMeshers_Projection_1D_2D_3D_i.cxx \ StdMeshers_ObjRefUlils.cxx \ StdMeshers_LayerDistribution_i.cxx \ + StdMeshers_LayerDistribution2D_i.cxx \ StdMeshers_CompositeSegment_1D_i.cxx \ StdMeshers_SegmentAroundVertex_0D_i.cxx \ StdMeshers_SegmentLengthAroundVertex_i.cxx \ StdMeshers_UseExisting_1D2D_i.cxx \ StdMeshers_TrianglePreference_i.cxx \ StdMeshers_MaxLength_i.cxx \ - StdMeshers_QuadrangleParams_i.cxx + StdMeshers_QuadrangleParams_i.cxx \ + StdMeshers_RadialQuadrangle_1D2D_i.cxx # additionnal information to compil and link file libStdMeshersEngine_la_CPPFLAGS = \ diff --git a/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx new file mode 100644 index 000000000..e4ff4ac79 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.cxx @@ -0,0 +1,290 @@ +// Copyright (C) 2007-2008 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_FixedPoints1D_i.cxx +// Author : Damien COQUERET, OCC +// Module : SMESH +// $Header$ +// +#include "StdMeshers_FixedPoints1D_i.hxx" +#include "SMESH_Gen_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +#include + +using namespace std; + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::StdMeshers_FixedPoints1D_i + * + * Constructor + */ +//============================================================================= + +StdMeshers_FixedPoints1D_i::StdMeshers_FixedPoints1D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::StdMeshers_FixedPoints1D_i" ); + myBaseImpl = new ::StdMeshers_FixedPoints1D(theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::~StdMeshers_FixedPoints1D_i + * + * Destructor + */ +//============================================================================= + +StdMeshers_FixedPoints1D_i::~StdMeshers_FixedPoints1D_i() +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::~StdMeshers_FixedPoints1D_i" ); +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::SetNbSegments + */ +//============================================================================= + +void StdMeshers_FixedPoints1D_i::SetNbSegments(const SMESH::long_array& listNbSeg) + throw ( SALOME::SALOME_Exception ) +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::SetNbSegments" ); + ASSERT( myBaseImpl ); + try { + std::vector nbsegs( listNbSeg.length() ); + CORBA::Long iEnd = listNbSeg.length(); + for ( CORBA::Long i = 0; i < iEnd; i++ ) + nbsegs[ i ] = listNbSeg[ i ]; + this->GetImpl()->SetNbSegments( nbsegs ); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), + SALOME::BAD_PARAM ); + } + + // Update Python script + SMESH::TPythonDump() << _this() << ".SetNbSegments( " << listNbSeg << " )"; +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::SetPoints + */ +//============================================================================= + +void StdMeshers_FixedPoints1D_i::SetPoints(const SMESH::double_array& listParams) + throw ( SALOME::SALOME_Exception ) +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::SetPoints" ); + ASSERT( myBaseImpl ); + try { + std::vector params( listParams.length() ); + CORBA::Long iEnd = listParams.length(); + for ( CORBA::Long i = 0; i < iEnd; i++ ) + params[ i ] = listParams[ i ]; + this->GetImpl()->SetPoints( params ); + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), + SALOME::BAD_PARAM ); + } + + // Update Python script + SMESH::TPythonDump() << _this() << ".SetPoints( " << listParams << " )"; +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::GetPoints + * + * Get list of point's parameters + */ +//============================================================================= + +SMESH::double_array* StdMeshers_FixedPoints1D_i::GetPoints() +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::GetPoints" ); + ASSERT( myBaseImpl ); + SMESH::double_array_var anArray = new SMESH::double_array; + std::vector params = this->GetImpl()->GetPoints(); + anArray->length( params.size() ); + for ( CORBA::Long i = 0; i < params.size(); i++) + anArray [ i ] = params [ i ]; + + return anArray._retn(); +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::GetNbSegments + * + * Get list of point's parameters + */ +//============================================================================= + +SMESH::long_array* StdMeshers_FixedPoints1D_i::GetNbSegments() +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::GetNbSegments" ); + ASSERT( myBaseImpl ); + SMESH::long_array_var anArray = new SMESH::long_array; + std::vector nbsegs = this->GetImpl()->GetNbSegments(); + anArray->length( nbsegs.size() ); + for ( CORBA::Long i = 0; i < nbsegs.size(); i++) + anArray [ i ] = nbsegs [ i ]; + + return anArray._retn(); +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::SetReversedEdges + * + * Set edges to reverse + */ +//============================================================================= + +void StdMeshers_FixedPoints1D_i::SetReversedEdges( const SMESH::long_array& theIds ) +{ + ASSERT( myBaseImpl ); + 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() << _this() << ".SetReversedEdges( " << theIds << " )"; +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::SetObjectEntry + * + * Set the Entry for the Main Object + */ +//============================================================================= + +void StdMeshers_FixedPoints1D_i::SetObjectEntry( const char* theEntry ) +{ + ASSERT( myBaseImpl ); + 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() << _this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )"; + } + catch ( SALOME_Exception& S_ex ) { + THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM ); + } +} + +//============================================================================= +/*! + * StdMeshers_FixedPoints1D_i::GetObjectEntry + * + * Set the Entry for the Main Object + */ +//============================================================================= + +char* StdMeshers_FixedPoints1D_i::GetObjectEntry() +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::SetObjectEntry" ); + ASSERT( myBaseImpl ); + 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_FixedPoints1D_i::GetReversedEdges + * + * Get reversed edges + */ +//============================================================================= + +SMESH::long_array* StdMeshers_FixedPoints1D_i::GetReversedEdges() +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::GetReversedEdges" ); + ASSERT( myBaseImpl ); + 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_FixedPoints1D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::StdMeshers_FixedPoints1D* StdMeshers_FixedPoints1D_i::GetImpl() +{ + MESSAGE( "StdMeshers_FixedPoints1D_i::GetImpl" ); + return ( ::StdMeshers_FixedPoints1D* )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_FixedPoints1D_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_1D; +} + diff --git a/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx new file mode 100644 index 000000000..22bfd0b34 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_FixedPoints1D_i.hxx @@ -0,0 +1,87 @@ +// Copyright (C) 2007-2008 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_FixedPoints1D_i.hxx +// Author : Damien COQUERET, OCC +// Module : SMESH +// +#ifndef _SMESH_FIXEDPOINTS1D_I_HXX_ +#define _SMESH_FIXEDPOINTS1D_I_HXX_ + +#include "SMESH_StdMeshers_I.hxx" + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" +#include "StdMeshers_FixedPoints1D.hxx" + +// ====================================================== +// Fixed points 1D hypothesis +// ====================================================== +class STDMESHERS_I_EXPORT StdMeshers_FixedPoints1D_i: + public virtual POA_StdMeshers::StdMeshers_FixedPoints1D, + public virtual SMESH_Hypothesis_i +{ +public: + // Constructor + StdMeshers_FixedPoints1D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~StdMeshers_FixedPoints1D_i(); + + // Sets some points on 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 needed) and sets numbers + // of segments between given points (default values are equals 1) + void SetPoints(const SMESH::double_array& listParams) + throw ( SALOME::SALOME_Exception ); + void SetNbSegments(const SMESH::long_array& listNbSeg) + throw ( SALOME::SALOME_Exception ); + + // Returns list of point's parameters + SMESH::double_array* GetPoints(); + + // Returns list of numbers of segments + SMESH::long_array* GetNbSegments(); + + //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_FixedPoints1D* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +#endif diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx new file mode 100644 index 000000000..7ad41bb93 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx @@ -0,0 +1,95 @@ +// Copyright (C) 2007-2008 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 classes +// File : StdMeshers_LayerDistribution2D_i.cxx +// Author : Edward AGAPOV +// Module : SMESH +// $Header$ +// +#include "StdMeshers_LayerDistribution2D_i.hxx" + +#include "utilities.h" + +//using namespace std; + +//============================================================================= +/*! + * StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i + * + * Constructor + */ +//============================================================================= + +StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i + (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) +: StdMeshers_LayerDistribution_i(thePOA,theStudyId,theGenImpl), + SMESH_Hypothesis_i( thePOA ) +{ + MESSAGE( "StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i" ); + myBaseImpl = new ::StdMeshers_LayerDistribution2D(theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * StdMeshers_LayerDistribution2D_i::~StdMeshers_LayerDistribution2D_i + * + * Destructor + */ +//============================================================================= + +StdMeshers_LayerDistribution2D_i::~StdMeshers_LayerDistribution2D_i() +{ + MESSAGE("StdMeshers_LayerDistribution2D_i::~StdMeshers_LayerDistribution2D_i"); +} + +//============================================================================= +/*! + * StdMeshers_LayerDistribution2D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::StdMeshers_LayerDistribution2D* StdMeshers_LayerDistribution2D_i::GetImpl() +{ + return ( ::StdMeshers_LayerDistribution2D* )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_LayerDistribution2D_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_2D; +} + + diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx new file mode 100644 index 000000000..d9e413d21 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx @@ -0,0 +1,64 @@ +// Copyright (C) 2007-2008 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_LayerDistribution2D_i.hxx +// Author : Edward AGAPOV +// Module : SMESH +// $Header$ +// +#ifndef _SMESH_LayerDistribution2D_I_HXX_ +#define _SMESH_LayerDistribution2D_I_HXX_ + +#include "StdMeshers_LayerDistribution_i.hxx" +#include "StdMeshers_LayerDistribution2D.hxx" + + +// ========================================================= +/*! + * This hypothesis is used by "Radial quadrangle" algorithm. + * It specifies 1D hypothesis defining distribution of segments + * between the internal and the external surfaces. + */ +// ========================================================= + +class StdMeshers_LayerDistribution2D_i: + public virtual POA_StdMeshers::StdMeshers_LayerDistribution2D, + public virtual StdMeshers_LayerDistribution_i +{ +public: + // Constructor + StdMeshers_LayerDistribution2D_i(PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~StdMeshers_LayerDistribution2D_i(); + + // Get implementation + ::StdMeshers_LayerDistribution2D* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + +}; + +#endif + diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx new file mode 100644 index 000000000..2dabe905d --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx @@ -0,0 +1,94 @@ +// Copyright (C) 2007-2008 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 classes +// File : StdMeshers_NumberOfLayers2D_i.cxx +// Author : Edward AGAPOV +// Module : SMESH +// $Header$ +// +#include "StdMeshers_NumberOfLayers2D_i.hxx" + +#include "utilities.h" + +//using namespace std; + +//============================================================================= +/*! + * StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i + * + * Constructor + */ +//============================================================================= + +StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i + (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) +: StdMeshers_NumberOfLayers_i(thePOA,theStudyId,theGenImpl), + SMESH_Hypothesis_i( thePOA ) +{ + MESSAGE("StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i"); + myBaseImpl = new ::StdMeshers_NumberOfLayers2D(theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * StdMeshers_NumberOfLayers2D_i::~StdMeshers_NumberOfLayers2D_i + * + * Destructor + */ +//============================================================================= + +StdMeshers_NumberOfLayers2D_i::~StdMeshers_NumberOfLayers2D_i() +{ + MESSAGE( "StdMeshers_NumberOfLayers2D_i::~StdMeshers_NumberOfLayers2D_i" ); +} + +//============================================================================= +/*! + * StdMeshers_NumberOfLayers2D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::StdMeshers_NumberOfLayers2D* StdMeshers_NumberOfLayers2D_i::GetImpl() +{ + return ( ::StdMeshers_NumberOfLayers2D* )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_NumberOfLayers2D_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_2D; +} + diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx new file mode 100644 index 000000000..898f9dd68 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx @@ -0,0 +1,62 @@ +// Copyright (C) 2007-2008 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_NumberOfLayers2D_i.hxx +// Author : Edward AGAPOV +// Module : SMESH +// $Header$ +// +#ifndef _SMESH_NumberOfLayers2D_I_HXX_ +#define _SMESH_NumberOfLayers2D_I_HXX_ + +#include "StdMeshers_NumberOfLayers2D.hxx" +#include "StdMeshers_NumberOfLayers_i.hxx" + +// ========================================================= +/*! + * This hypothesis is used by "Radial quadrangle" algorithm. + * It specifies number of segments between the internal + * and the external surfaces. + */ +// ========================================================= + +class StdMeshers_NumberOfLayers2D_i: + public virtual POA_StdMeshers::StdMeshers_NumberOfLayers2D, + public virtual StdMeshers_NumberOfLayers_i +{ +public: + // Constructor + StdMeshers_NumberOfLayers2D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~StdMeshers_NumberOfLayers2D_i(); + + // Get implementation + ::StdMeshers_NumberOfLayers2D* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +#endif + diff --git a/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx new file mode 100644 index 000000000..d588453dc --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2007-2008 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_RadialQuadrangle_1D2D_i.cxx +// Author : Paul RASCLE, EDF +// Module : SMESH +// +#include "StdMeshers_RadialQuadrangle_1D2D_i.hxx" +#include "SMESH_Gen.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +using namespace std; + + +//============================================================================= +/*! + * StdMeshers_RadialQuadrangle_1D2D_i::StdMeshers_RadialQuadrangle_1D2D_i + */ +//============================================================================= + +StdMeshers_RadialQuadrangle_1D2D_i::StdMeshers_RadialQuadrangle_1D2D_i + (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_2D_Algo_i( thePOA ) +{ + MESSAGE( "StdMeshers_RadialQuadrangle_1D2D_i::StdMeshers_RadialQuadrangle_1D2D_i" ); + myBaseImpl = new ::StdMeshers_RadialQuadrangle_1D2D(theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//----------------------------------------------------------------------------- + +StdMeshers_RadialQuadrangle_1D2D_i::~StdMeshers_RadialQuadrangle_1D2D_i() +{ + MESSAGE( "StdMeshers_RadialQuadrangle_1D2D_i::~StdMeshers_RadialQuadrangle_1D2D_i" ); +} + +//----------------------------------------------------------------------------- + +::StdMeshers_RadialQuadrangle_1D2D* StdMeshers_RadialQuadrangle_1D2D_i::GetImpl() +{ + MESSAGE( "StdMeshers_RadialQuadrangle_1D2D_i::GetImpl" ); + return ( ::StdMeshers_RadialQuadrangle_1D2D* )myBaseImpl; +} + diff --git a/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx new file mode 100644 index 000000000..41f3cd865 --- /dev/null +++ b/src/StdMeshers_I/StdMeshers_RadialQuadrangle_1D2D_i.hxx @@ -0,0 +1,57 @@ +// Copyright (C) 2007-2008 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_RadialQuadrangle_1D2D_i.hxx +// Author : Paul RASCLE, EDF +// Module : SMESH +// $Header$ +// +#ifndef _SMESH_RadialQuadrangle_1D2D_I_HXX_ +#define _SMESH_RadialQuadrangle_1D2D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_2D_Algo_i.hxx" +#include "StdMeshers_RadialQuadrangle_1D2D.hxx" + +class SMESH_Gen; + +class StdMeshers_RadialQuadrangle_1D2D_i: + public virtual POA_StdMeshers::StdMeshers_RadialQuadrangle_1D2D, + public virtual SMESH_2D_Algo_i +{ +public: + // Constructor + StdMeshers_RadialQuadrangle_1D2D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + + // Destructor + virtual ~StdMeshers_RadialQuadrangle_1D2D_i(); + + // Get implementation + ::StdMeshers_RadialQuadrangle_1D2D* GetImpl(); +}; + + +#endif diff --git a/src/StdMeshers_I/StdMeshers_i.cxx b/src/StdMeshers_I/StdMeshers_i.cxx index c17dfa98b..952bc8a8d 100644 --- a/src/StdMeshers_I/StdMeshers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_i.cxx @@ -34,6 +34,7 @@ #include "StdMeshers_AutomaticLength_i.hxx" #include "StdMeshers_StartEndLength_i.hxx" #include "StdMeshers_Arithmetic1D_i.hxx" +#include "StdMeshers_FixedPoints1D_i.hxx" #include "StdMeshers_NumberOfSegments_i.hxx" #include "StdMeshers_Deflection1D_i.hxx" #include "StdMeshers_Propagation_i.hxx" @@ -49,6 +50,8 @@ #include "StdMeshers_ProjectionSource1D_i.hxx" #include "StdMeshers_NumberOfLayers_i.hxx" #include "StdMeshers_LayerDistribution_i.hxx" +#include "StdMeshers_NumberOfLayers2D_i.hxx" +#include "StdMeshers_LayerDistribution2D_i.hxx" #include "StdMeshers_SegmentLengthAroundVertex_i.hxx" #include "StdMeshers_MaxLength_i.hxx" #include "StdMeshers_QuadrangleParams_i.hxx" @@ -62,6 +65,7 @@ #include "StdMeshers_SegmentAroundVertex_0D_i.hxx" #include "StdMeshers_CompositeSegment_1D_i.hxx" #include "StdMeshers_UseExisting_1D2D_i.hxx" +#include "StdMeshers_RadialQuadrangle_1D2D_i.hxx" template class StdHypothesisCreator_i:public HypothesisCreator_i @@ -106,6 +110,8 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Deflection1D") == 0) aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "FixedPoints1D") == 0) + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "Arithmetic1D") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "AutomaticLength") == 0) @@ -126,6 +132,10 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "LayerDistribution") == 0) aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "NumberOfLayers2D") == 0) + aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "LayerDistribution2D") == 0) + aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "SegmentLengthAroundVertex") == 0) aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "QuadrangleParams") == 0) @@ -158,6 +168,8 @@ STDMESHERS_I_EXPORT aCreator = new StdHypothesisCreator_i; else if (strcmp(aHypName, "UseExisting_2D") == 0) aCreator = new StdHypothesisCreator_i; + else if (strcmp(aHypName, "RadialQuadrangle_1D2D") == 0) + aCreator = new StdHypothesisCreator_i; else ; return aCreator;