<li>\ref number_of_segments_anchor "Number of segments"</li>
<li>\ref start_and_end_length_anchor "Start and end length"</li>
<li>\ref automatic_length_anchor "Automatic Length"</li>
+<li>\ref fixed_points_1d_anchor "Fixed points 1D"</li>
</ul>
<br>
\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."
+
+<br>
+\anchor fixed_points_1d_anchor
+<h2>Fixed points 1D hypothesis</h2>
+
+<b>Fixed points 1D</b> 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
+<b>Same Nb. Segments for all intervals</b> and
+only one value for mentioned number of segments.
+
+The direction of the splitting is defined by the orientation of the
+underlying geometrical edge. <b>"Reverse Edges"</b> list box allows to
+specify the edges for which the splitting should be made in the
+direction opposing to their orientation. This list box is enabled only
+if the geometry object is selected for the meshing. In this case the
+user can select edges to be reversed either directly picking them in
+the 3D viewer or by selecting the edges or groups of edges in the
+Object browser.
+
+Using of this hypothesis for quadrangle face where main mesh is
+created using <b>Quadrangle(Mapping)</b> and <b>NumberOfSegments</b>
+hypothesises. Creation hypothesis <b>FixedPoint_1D</b> for submesh on
+one edge:
+
+\image html hypo_fixedpnt_dlg.png
+
+Resulting 2D mesh:
+
+\image html mesh_fixedpnt.png
+
*/
are split into triangular elements.</li>
<li>Quadrangle meshing algorithm (Mapping) - Faces are split into
quadrangular elements.</li>
+<li>Radial quadrangle 1D2D algorithm - Faces (circles or part of circles)
+are split into triangular and quadrangle elements.</li>
</ul>
\image html image123.gif "Example of a triangular 2D mesh"
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>
<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
+<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d
+faces (circles and part of circles)"</li>
</ul>
\ref constructing_meshes_page "Constructing meshes" page describes in
<br><b>See Also</b> a sample TUI Script of a
\ref tui_defining_meshing_algos "Define Meshing Algorithm" operation.
-*/
\ No newline at end of file
+*/
--- /dev/null
+/*!
+
+\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 <b>RadialQuadrangle_1D2D</b>
+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
+
+*/
};
+ /*!
+ * 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
*/
};
+ /*!
+ * 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
{
};
+ /*!
+ * StdMeshers_RadialQuadrangle_1D2D: interface of "Radial quadrangle" algorithm
+ */
+ interface StdMeshers_RadialQuadrangle_1D2D : SMESH::SMESH_2D_Algo
+ {
+ };
+
};
#endif
icon-id="mesh_hypo_length.png"
dim="1"/>
+ <hypothesis type="FixedPoints1D"
+ label-id="Fixed points 1D"
+ icon-id="mesh_hypo_length.png"
+ dim="1"/>
+
<hypothesis type="StartEndLength"
label-id="Start and End Length"
icon-id="mesh_hypo_length.png"
icon-id="mesh_hypo_length.png"
dim="3"/>
+ <hypothesis type="NumberOfLayers2D"
+ label-id="Number of Layers"
+ icon-id="mesh_hypo_length.png"
+ dim="2"/>
+
+ <hypothesis type="LayerDistribution2D"
+ label-id="Distribution of Layers"
+ icon-id="mesh_hypo_length.png"
+ dim="2"/>
+
<hypothesis type="QuadrangleParams"
label-id="Quadrangle Parameters"
icon-id="mesh_hypo_length.png"
<algorithm type="Regular_1D"
label-id="Wire discretisation"
icon-id="mesh_algo_regular.png"
- hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
+ hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
output="QUAD,TRIA"
dim="2"/>
+ <algorithm type="RadialQuadrangle_1D2D"
+ label-id="Radial quadrangle 1D2D"
+ icon-id="mesh_algo_quad.png"
+ hypos="NumberOfLayers2D, LayerDistribution2D"
+ input="EDGE"
+ output="QUAD,TRIA"
+ dim="2"/>
+
</algorithms>
</meshers-group>
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")
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
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):
StdMeshers_LocalLength.hxx \
StdMeshers_StartEndLength.hxx \
StdMeshers_Arithmetic1D.hxx \
+ StdMeshers_FixedPoints1D.hxx \
StdMeshers_NumberOfSegments.hxx \
StdMeshers_Deflection1D.hxx \
StdMeshers_Propagation.hxx \
StdMeshers_QuadranglePreference.hxx \
StdMeshers_QuadraticMesh.hxx \
StdMeshers_NumberOfLayers.hxx \
+ StdMeshers_NumberOfLayers2D.hxx \
StdMeshers_Prism_3D.hxx \
StdMeshers_ProjectionSource1D.hxx \
StdMeshers_ProjectionSource2D.hxx \
StdMeshers_RadialPrism_3D.hxx \
StdMeshers_ProjectionUtils.hxx \
StdMeshers_LayerDistribution.hxx \
+ StdMeshers_LayerDistribution2D.hxx \
StdMeshers_SegmentAroundVertex_0D.hxx \
StdMeshers_SegmentLengthAroundVertex.hxx \
StdMeshers_FaceSide.hxx \
StdMeshers_TrianglePreference.hxx \
StdMeshers_CompositeHexa_3D.hxx \
StdMeshers_MaxLength.hxx \
- StdMeshers_QuadrangleParams.hxx
+ StdMeshers_QuadrangleParams.hxx \
+ StdMeshers_RadialQuadrangle_1D2D.hxx
# Libraries targets
StdMeshers_LocalLength.cxx \
StdMeshers_StartEndLength.cxx \
StdMeshers_Arithmetic1D.cxx \
+ StdMeshers_FixedPoints1D.cxx \
StdMeshers_NumberOfSegments.cxx \
StdMeshers_Deflection1D.cxx \
StdMeshers_Propagation.cxx \
StdMeshers_QuadranglePreference.cxx \
StdMeshers_QuadraticMesh.cxx \
StdMeshers_NumberOfLayers.cxx \
+ StdMeshers_NumberOfLayers2D.cxx \
StdMeshers_Prism_3D.cxx \
StdMeshers_ProjectionSource1D.cxx \
StdMeshers_ProjectionSource2D.cxx \
StdMeshers_RadialPrism_3D.cxx \
StdMeshers_ProjectionUtils.cxx \
StdMeshers_LayerDistribution.cxx \
+ StdMeshers_LayerDistribution2D.cxx \
StdMeshers_SegmentAroundVertex_0D.cxx \
StdMeshers_SegmentLengthAroundVertex.cxx \
StdMeshers_FaceSide.cxx \
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
--- /dev/null
+// 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 <BRep_Tool.hxx>
+//#include <GCPnts_AbscissaPoint.hxx>
+//#include <GeomAdaptor_Curve.hxx>
+//#include <Geom_Curve.hxx>
+//#include <TopExp.hxx>
+//#include <TopLoc_Location.hxx>
+//#include <TopTools_IndexedMapOfShape.hxx>
+//#include <TopoDS.hxx>
+//#include <TopoDS_Edge.hxx>
+
+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<double>& listParams)
+ throw(SALOME_Exception)
+{
+ _params = listParams;
+ NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void StdMeshers_FixedPoints1D::SetNbSegments(std::vector<int>& listNbSeg)
+ throw(SALOME_Exception)
+{
+ _nbsegs = listNbSeg;
+ NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void StdMeshers_FixedPoints1D::SetReversedEdges( std::vector<int>& 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;
+}
+
--- /dev/null
+// 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 <vector>
+
+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<double>& listParams)
+ throw(SALOME_Exception);
+
+ void SetNbSegments(std::vector<int>& listNbSeg)
+ throw(SALOME_Exception);
+
+ const std::vector<double>& GetPoints() const { return _params; }
+
+ const std::vector<int>& GetNbSegments() const { return _nbsegs; }
+
+ void SetReversedEdges( std::vector<int>& ids);
+
+ void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+
+ const char* GetObjectEntry() { return _objEntry.c_str(); }
+
+ const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
+
+ virtual std::ostream & SaveTo(std::ostream & save);
+ virtual std::istream & LoadFrom(std::istream & load);
+ 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<double> _params;
+ std::vector<int> _nbsegs;
+ std::vector<int> _edgeIDs;
+ std::string _objEntry;
+};
+
+#endif
--- /dev/null
+// 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" );
+}
--- /dev/null
+// 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
+
--- /dev/null
+// 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" );
+}
+
--- /dev/null
+// 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
+
//purpose :
//=======================================================================
bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape)
+ const TopoDS_Shape& aShape)
{
MESSAGE("StdMeshers_Penta_3D::Compute()");
//
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
- return;
+ return;
}
//
aTN.SetShapeSupportID(aSSID);
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();
}
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
- return;
+ return;
}
//
myTNodes[ij]=aTN;
for (i=0; i<myISize; ++i) {
printf(" Layer# %d\n", i);
for (j=0; j<myJSize; ++j) {
- 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);
+ 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);
}
}
}
//=======================================================================
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;
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);
}
}
}
aJ[k] = GetIndexOnLayer(aID0);
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
- return;
+ return;
}
//
++k;
i1=i;
i2=i+1;
for(j=0; j<nbFaceNodes; ++j) {
- ij = i1*myJSize+aJ[j];
- const StdMeshers_TNode& aTN1 = myTNodes[ij];
- const SMDS_MeshNode* aN1 = aTN1.Node();
- aN[j]=aN1;
- //
- ij=i2*myJSize+aJ[j];
- const StdMeshers_TNode& aTN2 = myTNodes[ij];
- const SMDS_MeshNode* aN2 = aTN2.Node();
- aN[j+nbFaceNodes] = aN2;
+ ij = i1*myJSize+aJ[j];
+ const StdMeshers_TNode& aTN1 = myTNodes[ij];
+ const SMDS_MeshNode* aN1 = aTN1.Node();
+ aN[j]=aN1;
+ //
+ ij=i2*myJSize+aJ[j];
+ const StdMeshers_TNode& aTN2 = myTNodes[ij];
+ const SMDS_MeshNode* aN2 = aTN2.Node();
+ aN[j+nbFaceNodes] = aN2;
}
// check if volume orientation will be ok
if ( i == 0 ) {
aJ = GetIndexOnLayer(aID0);
if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
- return;
+ return;
}
//
ij = aLevel*myJSize + aJ;
//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;
//
//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:
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
+ }
}
}
}
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) {
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;
+ }
}
}
}
//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;
//
//purpose :
//=======================================================================
void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
- gp_XYZ& theXYZ)
+ gp_XYZ& theXYZ)
{
ComputeParameters(thePnt, myShell, theXYZ);
}
//purpose :
//=======================================================================
void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
- const TopoDS_Shape& theShape,
+ const TopoDS_Shape& theShape,
gp_XYZ& theXYZ)
{
myErrorStatus=0;
//purpose :
//=======================================================================
void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
TopoDS_Shape aS;
//
//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;
//
//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()");
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<int> aVec = (*anIt).second;
int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
}
}
- if(NumBase==0) return false;
+ if(NumBase==0) {
+ std::vector<int> aResVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+ SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+ aResMap.insert(std::make_pair(sm,aResVec));
+ myErrorStatus->myName = COMPERR_ALGO_FAILED;
+ myErrorStatus->myComment = "Submesh can not be evaluated";
+ return false;
+ }
// find number of 1d elems for base face
int nb1d = 0;
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) {
--- /dev/null
+// 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 <BRepAdaptor_Curve.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+//#include <BRepTools.hxx>
+#include <BRep_Tool.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+//#include <TopoDS_Shell.hxx>
+//#include <TopoDS_Solid.hxx>
+//#include <TopTools_MapOfShape.hxx>
+//#include <gp.hxx>
+//#include <gp_Pnt.hxx>
+
+
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Circle.hxx>
+#include <Geom_Line.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TColgp_SequenceOfPnt2d.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+
+
+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 SMESHDS_Hypothesis * >::const_iterator itl;
+
+ const list <const SMESHDS_Hypothesis * >&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<const StdMeshers_NumberOfLayers *>(theHyp);
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ return true;
+ }
+ if (hypName == "LayerDistribution2D") {
+ myDistributionHypo = static_cast<const StdMeshers_LayerDistribution *>(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 = "<<nbe<<endl;
+ TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
+ if(nbe==1) {
+ // C1 must be a circle
+ Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
+ if( aCirc.IsNull() )
+ return error(COMPERR_BAD_SHAPE);
+ CircEdge = E1;
+
+ 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++;
+ 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(; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ Points.Append(P);
+ SMDS_MeshNode * node = meshDS->AddNode(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(; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ Points.Append(P);
+ SMDS_MeshNode * node = meshDS->AddNode(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; i<Nodes2.size(); i++)
+ tmpNodes[Nodes2.size()-i-1] = Nodes2[i];
+ tmpNodes[Nodes2.size()] = NC;
+ for(i=0; i<Nodes1.size(); i++)
+ tmpNodes[Nodes2.size()+1+i] = Nodes1[i];
+ for(i=1; i<tmpNodes.size(); i++) {
+ SMDS_MeshEdge* ME = myHelper->AddEdge( 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(; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ Points.Append(P);
+ SMDS_MeshNode * node = meshDS->AddNode(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; i<Nodes1.size(); i++) {
+ SMDS_MeshEdge* ME = myHelper->AddEdge( 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; i<myLayerPositions.size(); i++) {
+ gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+ P0.Y() + aVec.Y()*myLayerPositions[i],
+ P0.Z() + aVec.Z()*myLayerPositions[i] );
+ SMDS_MeshNode * node = meshDS->AddNode(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; i<Nodes2.size(); i++) {
+ SMDS_MeshEdge* ME = myHelper->AddEdge( 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() = "<<Angles.Length()<<" Points.Length() = "<<Points.Length()<<endl;
+ //cout<<"Nodes1.size() = "<<Nodes1.size()<<" Pnts2d1.Length() = "<<Pnts2d1.Length()<<endl;
+ for(; i<Angles.Length(); i++) {
+ std::vector< const SMDS_MeshNode* > tmpNodes;
+ tmpNodes.reserve(Nodes1.size());
+ gp_Trsf aTrsf;
+ gp_Ax1 theAxis(P0,gp_Dir(Axis));
+ aTrsf.SetRotation( theAxis, Angles.Value(i) );
+ gp_Trsf2d aTrsf2d;
+ aTrsf2d.SetRotation( PC, Angles.Value(i) );
+ // create nodes
+ int j = 1;
+ for(; j<=Points.Length(); j++) {
+ double cx,cy,cz;
+ Points.Value(j).Coord( cx, cy, cz );
+ aTrsf.Transforms( cx, cy, cz );
+ SMDS_MeshNode* node = myHelper->AddNode( cx, cy, cz );
+ // find parameters on face
+ Pnts2d1.Value(j).Coord( cx, cy );
+ aTrsf2d.Transforms( cx, cy );
+ // set node on face
+ meshDS->SetNodeOnFace( node, faceID, cx, cy );
+ tmpNodes[j-1] = node;
+ }
+ // create faces
+ tmpNodes[Points.Length()] = CNodes[i];
+ // quad
+ for(j=0; j<Nodes1.size()-1; j++) {
+ SMDS_MeshFace* MF = myHelper->AddFace( tmpNodes[j], Nodes1[j],
+ Nodes1[j+1], tmpNodes[j+1] );
+ if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+ }
+ // tria
+ SMDS_MeshFace* MF = myHelper->AddFace( NC, Nodes1[0], tmpNodes[0] );
+ if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+ for(j=0; j<Nodes1.size(); j++) {
+ Nodes1[j] = tmpNodes[j];
+ }
+ }
+ // create last faces
+ // quad
+ for(i=0; i<Nodes1.size()-1; i++) {
+ SMDS_MeshFace* MF = myHelper->AddFace( Nodes2[i], Nodes1[i],
+ Nodes1[i+1], Nodes2[i+1] );
+ if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+ }
+ // tria
+ SMDS_MeshFace* MF = myHelper->AddFace( NC, Nodes1[0], Nodes2[0] );
+ if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+
+
+ // to delete helper at exit from Compute()
+ std::auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
+
+ return true;
+}
+
+
+//================================================================================
+//================================================================================
+/*!
+ * \brief Class computing layers distribution using data of
+ * StdMeshers_LayerDistribution hypothesis
+ */
+//================================================================================
+//================================================================================
+
+class TNodeDistributor: public StdMeshers_Regular_1D
+{
+ list <const SMESHDS_Hypothesis *> myUsedHyps;
+public:
+ // -----------------------------------------------------------------------------
+ static TNodeDistributor* GetDistributor(SMESH_Mesh& aMesh)
+ {
+ const int myID = -1000;
+ map < int, SMESH_1D_Algo * > & algoMap = aMesh.GetGen()->_map1D_Algo;
+ map < int, SMESH_1D_Algo * >::iterator id_algo = algoMap.find( myID );
+ if ( id_algo == algoMap.end() )
+ return new TNodeDistributor( myID, 0, aMesh.GetGen() );
+ return static_cast< TNodeDistributor* >( id_algo->second );
+ }
+ // -----------------------------------------------------------------------------
+ bool Compute( vector< double > & positions,
+ gp_Pnt pIn,
+ gp_Pnt pOut,
+ SMESH_Mesh& aMesh,
+ const StdMeshers_LayerDistribution* hyp)
+ {
+ double len = pIn.Distance( pOut );
+ if ( len <= DBL_MIN ) return error("Too close points of inner and outer shells");
+
+ if ( !hyp || !hyp->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<double>::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 <const SMESHDS_Hypothesis *> &
+ 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<int> 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<int> 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<int> aResVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+ if(isQuadratic) {
+ aResVec[SMDSEntity_Node] = 4*myLayerPositions.size() + 3;
+ aResVec[SMDSEntity_Quad_Edge] = 2*myLayerPositions.size() + 2;
+ }
+ else {
+ aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1;
+ aResVec[SMDSEntity_Edge] = 2*myLayerPositions.size() + 2;
+ }
+ sm = aMesh.GetSubMesh(LinEdge1);
+ aResMap.insert(std::make_pair(sm,aResVec));
+ }
+ }
+ 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);
+ }
+ }
+ 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<int> 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<int> aResVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+ if(isQuadratic) {
+ aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1;
+ aResVec[SMDSEntity_Quad_Edge] = myLayerPositions.size() + 1;
+ }
+ else {
+ aResVec[SMDSEntity_Node] = myLayerPositions.size();
+ aResVec[SMDSEntity_Edge] = myLayerPositions.size() + 1;
+ }
+ sm = aMesh.GetSubMesh(LinEdge1);
+ aResMap.insert(std::make_pair(sm,aResVec));
+ sm = aMesh.GetSubMesh(LinEdge2);
+ aResMap.insert(std::make_pair(sm,aResVec));
+ }
+ }
+
+ std::vector<int> aResVec(SMDSEntity_Last);
+ for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+ SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+
+ //cout<<"nb0d = "<<nb0d<<" nb2d_tria = "<<nb2d_tria<<" nb2d_quad = "<<nb2d_quad<<endl;
+ if(nb0d>0) {
+ aResVec[0] = nb0d;
+ if(isQuadratic) {
+ aResVec[SMDSEntity_Quad_Triangle] = nb2d_tria;
+ aResVec[SMDSEntity_Quad_Quadrangle] = nb2d_quad;
+ }
+ else {
+ aResVec[SMDSEntity_Triangle] = nb2d_tria;
+ aResVec[SMDSEntity_Quadrangle] = nb2d_quad;
+ }
+ aResMap.insert(std::make_pair(sm,aResVec));
+ return true;
+ }
+
+ // invalid case
+ aResMap.insert(std::make_pair(sm,aResVec));
+ SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+ smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+ "Submesh can not be evaluated",this));
+ return false;
+
+}
+
--- /dev/null
+// 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.hxx
+// Module : SMESH
+//
+#ifndef _SMESH_RadialQuadrangle_1D2D_HXX_
+#define _SMESH_RadialQuadrangle_1D2D_HXX_
+
+#include "SMESH_StdMeshers.hxx"
+
+#include "SMESH_2D_Algo.hxx"
+//#include "SMDS_MeshNode.hxx"
+
+//#include <vector>
+//#include <map>
+
+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
//=============================================================================
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);
-
- _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("QuadraticMesh"); // auxiliary !!!
- _compatibleHypothesis.push_back("Propagation"); // auxiliary !!!
+ 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("FixedPoints1D");
+ _compatibleHypothesis.push_back("AutomaticLength");
+
+ _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!!
+ _compatibleHypothesis.push_back("Propagation"); // auxiliary !!!
}
//=============================================================================
aStatus = SMESH_Hypothesis::HYP_OK;
}
+ else if (hypName == "FixedPoints1D") {
+ _fpHyp = dynamic_cast <const StdMeshers_FixedPoints1D*>(theHyp);
+ ASSERT(_fpHyp);
+ _hypType = FIXED_POINTS_1D;
+
+ _revEdgesIDs = _fpHyp->GetReversedEdges();
+
+ aStatus = SMESH_Hypothesis::HYP_OK;
+ }
+
else if (hypName == "StartEndLength")
{
const StdMeshers_StartEndLength * hyp =
return true;
}
+ case FIXED_POINTS_1D: {
+ const std::vector<double>& aPnts = _fpHyp->GetPoints();
+ const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
+ int i = 0;
+ TColStd_SequenceOfReal Params;
+ for(; i<aPnts.size(); i++) {
+ if( aPnts[i]<0.0001 || aPnts[i]>0.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]<Params.Value(j) ) break;
+ }
+ if(!IsExist) Params.InsertBefore(j,aPnts[i]);
+ }
+ double pf, pl, par2, par1, psize;
+ if (theReverse) {
+ pf = l;
+ pl = f;
+ }
+ else {
+ pf = f;
+ pl = l;
+ }
+ psize = pl - pf;
+ par1 = pf;
+ //cout<<"aPnts.size() = "<<aPnts.size()<<" Params.Length() = "
+ // <<Params.Length()<<" nbsegs.size() = "<<nbsegs.size()<<endl;
+ for(i=0; i<Params.Length(); i++) {
+ par2 = pf + Params.Value(i+1)*psize;
+ int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
+ double dp = (par2-par1)/nbseg;
+ int j = 1;
+ for(; j<=nbseg; j++) {
+ double param = par1 + dp*j;
+ theParams.push_back( param );
+ }
+ par1 = par2;
+ }
+ // add for last
+ int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
+ double dp = (pl-par1)/nbseg;
+ int j = 1;
+ for(; j<nbseg; j++) {
+ double param = par1 + dp*j;
+ theParams.push_back( param );
+ }
+ if (theReverse) {
+ theParams.reverse(); // NPAL18025
+ }
+ return true;
+ }
+
case DEFLECTION: {
GCPnts_UniformDeflection Discret(theC3d, _value[ DEFLECTION_IND ], f, l, true);
{
list< double > params;
bool reversed = false;
- if ( theMesh.GetShapeToMesh().ShapeType() >= TopAbs_WIRE )
+ if ( theMesh.GetShapeToMesh().ShapeType() >= TopAbs_WIRE ) {
reversed = ( EE.Orientation() == TopAbs_REVERSED );
- if ( !_mainEdge.IsNull() )
+ }
+ if ( !_mainEdge.IsNull() ) {
reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
+ }
else if ( _revEdgesIDs.size() > 0 ) {
- for ( int i = 0; i < _revEdgesIDs.size(); i++)
- if ( _revEdgesIDs[i] == shapeID )
- reversed = !reversed;
+ for ( int i = 0; i < _revEdgesIDs.size(); i++) {
+ if ( _revEdgesIDs[i] == shapeID ) {
+ reversed = !reversed;
+ }
+ }
}
BRepAdaptor_Curve C3d( E );
//=============================================================================
bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
- const TopoDS_Shape & theShape,
- MapShapeNbElems& aResMap)
+ const TopoDS_Shape & theShape,
+ MapShapeNbElems& aResMap)
{
if ( _hypType == NONE )
return false;
#include "SMESH_1D_Algo.hxx"
+#include "StdMeshers_FixedPoints1D.hxx"
+
class Adaptor3d_Curve;
class TopoDS_Vertex;
class StdMeshers_SegmentLengthAroundVertex;
StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh & theMesh,
const TopoDS_Vertex & theV);
- enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE };
+ enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, NONE };
enum ValueIndex {
SCALE_FACTOR_IND = 0,
HypothesisType _hypType;
+ const StdMeshers_FixedPoints1D* _fpHyp;
+
double _value[2];
int _ivalue[3];
std::vector<double> _vvalue[1];
StdMeshersGUI_NbSegmentsCreator.h \
StdMeshersGUI_ObjectReferenceParamWdg.h \
StdMeshersGUI_LayerDistributionParamWdg.h \
- StdMeshersGUI_EdgeDirectionParamWdg.h \
+ StdMeshersGUI_FixedPointsParamWdg.h \
StdMeshersGUI_SubShapeSelectorWdg.h
# Libraries targets
StdMeshersGUI_NbSegmentsCreator.cxx \
StdMeshersGUI_ObjectReferenceParamWdg.cxx \
StdMeshersGUI_LayerDistributionParamWdg.cxx \
- StdMeshersGUI_EdgeDirectionParamWdg.cxx \
+ StdMeshersGUI_FixedPointsParamWdg.cxx \
StdMeshersGUI_SubShapeSelectorWdg.cxx
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= \
--- /dev/null
+// 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 <QPushButton>
+#include <QIntValidator>
+#include <QGridLayout>
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QItemDelegate>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QDoubleSpinBox>
+#include <QItemDelegate>
+#include <QKeyEvent>
+
+#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<QSpinBox*>( editor )->value(), Qt::EditRole );
+ model->setData( index, qobject_cast<QSpinBox*>( 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<QListWidgetItem*> 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]);
+ }
+}
--- /dev/null
+// 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 <SMESHGUI.h>
+#include "SMESH_StdMeshersGUI.hxx"
+
+// Qt includes
+#include <QWidget>
+#include <QStringList>
+
+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
#include <SMESH_NumberFilter.hxx>
#include "StdMeshersGUI_ObjectReferenceParamWdg.h"
#include "StdMeshersGUI_LayerDistributionParamWdg.h"
-//#include "StdMeshersGUI_EdgeDirectionParamWdg.h"
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
+#include "StdMeshersGUI_FixedPointsParamWdg.h"
#include <SALOMEDSClient_Study.hxx>
// SALOME GUI includes
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 );
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 );
if ( ok )
deactivateObjRefParamWdg( customWidgets() );
}
- else if ( hypType() == "LayerDistribution" )
+ else if ( hypType() == "LayerDistribution" || hypType() == "LayerDistribution2D" )
{
StdMeshersGUI_LayerDistributionParamWdg* w =
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
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));
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));
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));
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 );
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));
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 );
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));
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 );
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 )));
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 )));
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 )));
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 );
}
}
}
customWidgets()->append (0);
- item.myName = tr( "SMESH_REVERCE_EDGES" );
+ 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()=="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_EdgeDirectionParamWdg* aDirectionWidget =
- // new StdMeshersGUI_EdgeDirectionParamWdg();
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
}
+
+
else if( hypType()=="MaxElementArea" )
{
StdMeshers::StdMeshers_MaxElementArea_var h =
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();
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;i<aParameters->length();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 );
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" );
param.myValue = w->GetValue();
return true;
}
- //if ( widget->inherits( "StdMeshersGUI_EdgeDirectionParamWdg" ))
- //{
- // const StdMeshersGUI_EdgeDirectionParamWdg * w =
- // static_cast<const StdMeshersGUI_EdgeDirectionParamWdg*>( widget );
- // param.myValue = w->GetValue();
- // return true;
- //}
if ( widget->inherits( "StdMeshersGUI_SubShapeSelectorWdg" ))
{
const StdMeshersGUI_SubShapeSelectorWdg * w =
param.myValue = w->GetValue();
return true;
}
+ if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" ))
+ {
+ const StdMeshersGUI_FixedPointsParamWdg * w =
+ static_cast<const StdMeshersGUI_FixedPointsParamWdg*>( widget );
+ param.myValue = w->GetValue();
+ return true;
+ }
return false;
}
<source>ICON_DLG_ARITHMETIC_1D</source>
<translation>mesh_hypo_length.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_FIXED_POINTS_1D</source>
+ <translation>mesh_hypo_length.png</translation>
+ </message>
<message>
<source>ICON_DLG_AUTOMATIC_LENGTH</source>
<translation>mesh_hypo_length.png</translation>
<source>SMESH_LOCAL_LENGTH_TITLE</source>
<translation>Hypothesis Construction</translation>
</message>
+ <message>
+ <source>SMESH_FIXED_POINTS_1D_HYPOTHESIS</source>
+ <translation>Fixed points 1D</translation>
+ </message>
+ <message>
+ <source>SMESH_FIXED_POINTS_1D_TITLE</source>
+ <translation>Hypothesis Construction</translation>
+ </message>
<message>
<source>SMESH_MAX_LENGTH_HYPOTHESIS</source>
<translation>Max Length</translation>
<translation>Remove row</translation>
</message>
<message>
- <source>SMESH_REVERCE_EDGES</source>
- <translation>Reverce Edges</translation>
+ <source>SMESH_REVERSED_EDGES</source>
+ <translation>Reversed Edges</translation>
+ </message>
+ <message>
+ <source>SMESH_FIXED_POINTS</source>
+ <translation>Fixed Points</translation>
+ </message>
+ <message>
+ <source>SMESH_RANGE</source>
+ <translation>Range</translation>
+ </message>
+ <message>
+ <source>SMESH_NB_SEGMENTS</source>
+ <translation>Nb. Segments</translation>
+ </message>
+ <message>
+ <source>SMESH_SAME_NB_SEGMENTS</source>
+ <translation>Same Nb. Segments for All Intervals</translation>
</message>
<message>
<source>SMESH_BASE_VERTEX</source>
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 \
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 \
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 \
StdMeshers_TrianglePreference_i.hxx \
StdMeshers_MaxLength_i.hxx \
StdMeshers_QuadrangleParams_i.hxx \
+ StdMeshers_RadialQuadrangle_1D2D_i.hxx \
SMESH_StdMeshers_I.hxx
# Libraries targets
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 \
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 \
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 = \
--- /dev/null
+// 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 <TCollection_AsciiString.hxx>
+
+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<int> 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<double> 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<double> 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<int> 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<int> ids( theIds.length() );
+ CORBA::Long iEnd = theIds.length();
+ for ( CORBA::Long i = 0; i < iEnd; i++ )
+ ids[ i ] = theIds[ i ];
+
+ this->GetImpl()->SetReversedEdges( ids );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+
+ // Update Python script
+ SMESH::TPythonDump() << _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<int> ids = this->GetImpl()->GetReversedEdges();
+ anArray->length( ids.size() );
+ for ( CORBA::Long i = 0; i < ids.size(); i++)
+ anArray [ i ] = ids [ i ];
+
+ return anArray._retn();
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_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;
+}
+
--- /dev/null
+// 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 <SALOMEconfig.h>
+#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
--- /dev/null
+// 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;
+}
+
+
--- /dev/null
+// 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
+
--- /dev/null
+// 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;
+}
+
--- /dev/null
+// 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
+
--- /dev/null
+// 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;
+}
+
--- /dev/null
+// 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 <SALOMEconfig.h>
+#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
#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"
#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"
#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 T> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
aCreator = new StdHypothesisCreator_i<StdMeshers_StartEndLength_i>;
else if (strcmp(aHypName, "Deflection1D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Deflection1D_i>;
+ else if (strcmp(aHypName, "FixedPoints1D") == 0)
+ aCreator = new StdHypothesisCreator_i<StdMeshers_FixedPoints1D_i>;
else if (strcmp(aHypName, "Arithmetic1D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
else if (strcmp(aHypName, "AutomaticLength") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfLayers_i>;
else if (strcmp(aHypName, "LayerDistribution") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_LayerDistribution_i>;
+ else if (strcmp(aHypName, "NumberOfLayers2D") == 0)
+ aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfLayers2D_i>;
+ else if (strcmp(aHypName, "LayerDistribution2D") == 0)
+ aCreator = new StdHypothesisCreator_i<StdMeshers_LayerDistribution2D_i>;
else if (strcmp(aHypName, "SegmentLengthAroundVertex") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_SegmentLengthAroundVertex_i>;
else if (strcmp(aHypName, "QuadrangleParams") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_UseExisting_1D_i>;
else if (strcmp(aHypName, "UseExisting_2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_UseExisting_2D_i>;
+ else if (strcmp(aHypName, "RadialQuadrangle_1D2D") == 0)
+ aCreator = new StdHypothesisCreator_i<StdMeshers_RadialQuadrangle_1D2D_i>;
else ;
return aCreator;