1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : StdMeshers_Regular_1D.cxx
24 // Moved here from SMESH_Regular_1D.cxx
25 // Author : Paul RASCLE, EDF
28 #include "StdMeshers_Regular_1D.hxx"
30 #include "SMDS_MeshElement.hxx"
31 #include "SMDS_MeshNode.hxx"
32 #include "SMESHDS_Mesh.hxx"
33 #include "SMESH_Comment.hxx"
34 #include "SMESH_Gen.hxx"
35 #include "SMESH_HypoFilter.hxx"
36 #include "SMESH_Mesh.hxx"
37 #include "SMESH_subMesh.hxx"
38 #include "SMESH_subMeshEventListener.hxx"
39 #include "StdMeshers_Adaptive1D.hxx"
40 #include "StdMeshers_Arithmetic1D.hxx"
41 #include "StdMeshers_AutomaticLength.hxx"
42 #include "StdMeshers_Geometric1D.hxx"
43 #include "StdMeshers_Deflection1D.hxx"
44 #include "StdMeshers_Distribution.hxx"
45 #include "StdMeshers_FixedPoints1D.hxx"
46 #include "StdMeshers_LocalLength.hxx"
47 #include "StdMeshers_MaxLength.hxx"
48 #include "StdMeshers_NumberOfSegments.hxx"
49 #include "StdMeshers_Propagation.hxx"
50 #include "StdMeshers_SegmentLengthAroundVertex.hxx"
51 #include "StdMeshers_StartEndLength.hxx"
53 #include "Utils_SALOME_Exception.hxx"
54 #include "utilities.h"
56 #include <BRepAdaptor_Curve.hxx>
57 #include <BRep_Tool.hxx>
58 #include <GCPnts_AbscissaPoint.hxx>
59 #include <GCPnts_UniformAbscissa.hxx>
60 #include <GCPnts_UniformDeflection.hxx>
61 #include <Precision.hxx>
63 #include <TopExp_Explorer.hxx>
65 #include <TopoDS_Edge.hxx>
66 #include <TopoDS_Vertex.hxx>
72 using namespace StdMeshers;
74 //=============================================================================
78 //=============================================================================
80 StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId,
83 :SMESH_1D_Algo( hypId, studyId, gen )
86 _shapeType = (1 << TopAbs_EDGE);
89 _compatibleHypothesis.push_back("LocalLength");
90 _compatibleHypothesis.push_back("MaxLength");
91 _compatibleHypothesis.push_back("NumberOfSegments");
92 _compatibleHypothesis.push_back("StartEndLength");
93 _compatibleHypothesis.push_back("Deflection1D");
94 _compatibleHypothesis.push_back("Arithmetic1D");
95 _compatibleHypothesis.push_back("GeometricProgression");
96 _compatibleHypothesis.push_back("FixedPoints1D");
97 _compatibleHypothesis.push_back("AutomaticLength");
98 _compatibleHypothesis.push_back("Adaptive1D");
100 _compatibleHypothesis.push_back("QuadraticMesh");
101 _compatibleHypothesis.push_back("Propagation");
102 _compatibleHypothesis.push_back("PropagOfDistribution");
105 //=============================================================================
109 //=============================================================================
111 StdMeshers_Regular_1D::~StdMeshers_Regular_1D()
115 //=============================================================================
119 //=============================================================================
121 bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh,
122 const TopoDS_Shape& aShape,
123 Hypothesis_Status& aStatus )
126 _quadraticMesh = false;
127 _onlyUnaryInput = true;
129 const list <const SMESHDS_Hypothesis * > & hyps =
130 GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliaryHyps=*/false);
132 const SMESH_HypoFilter & propagFilter = StdMeshers_Propagation::GetFilter();
134 // find non-auxiliary hypothesis
135 const SMESHDS_Hypothesis *theHyp = 0;
136 set< string > propagTypes;
137 list <const SMESHDS_Hypothesis * >::const_iterator h = hyps.begin();
138 for ( ; h != hyps.end(); ++h ) {
139 if ( static_cast<const SMESH_Hypothesis*>(*h)->IsAuxiliary() ) {
140 if ( strcmp( "QuadraticMesh", (*h)->GetName() ) == 0 )
141 _quadraticMesh = true;
142 if ( propagFilter.IsOk( static_cast< const SMESH_Hypothesis*>( *h ), aShape ))
143 propagTypes.insert( (*h)->GetName() );
147 theHyp = *h; // use only the first non-auxiliary hypothesis
153 aStatus = SMESH_Hypothesis::HYP_MISSING;
154 return false; // can't work without a hypothesis
157 string hypName = theHyp->GetName();
159 if ( hypName == "LocalLength" )
161 const StdMeshers_LocalLength * hyp =
162 dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
164 _value[ BEG_LENGTH_IND ] = hyp->GetLength();
165 _value[ PRECISION_IND ] = hyp->GetPrecision();
166 ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
167 _hypType = LOCAL_LENGTH;
168 aStatus = SMESH_Hypothesis::HYP_OK;
171 else if ( hypName == "MaxLength" )
173 const StdMeshers_MaxLength * hyp =
174 dynamic_cast <const StdMeshers_MaxLength * >(theHyp);
176 _value[ BEG_LENGTH_IND ] = hyp->GetLength();
177 if ( hyp->GetUsePreestimatedLength() ) {
178 if ( int nbSeg = aMesh.GetGen()->GetBoundaryBoxSegmentation() )
179 _value[ BEG_LENGTH_IND ] = aMesh.GetShapeDiagonalSize() / nbSeg;
181 ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
182 _hypType = MAX_LENGTH;
183 aStatus = SMESH_Hypothesis::HYP_OK;
186 else if ( hypName == "NumberOfSegments" )
188 const StdMeshers_NumberOfSegments * hyp =
189 dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp);
191 _ivalue[ NB_SEGMENTS_IND ] = hyp->GetNumberOfSegments();
192 ASSERT( _ivalue[ NB_SEGMENTS_IND ] > 0 );
193 _ivalue[ DISTR_TYPE_IND ] = (int) hyp->GetDistrType();
194 switch (_ivalue[ DISTR_TYPE_IND ])
196 case StdMeshers_NumberOfSegments::DT_Scale:
197 _value[ SCALE_FACTOR_IND ] = hyp->GetScaleFactor();
198 _revEdgesIDs = hyp->GetReversedEdges();
200 case StdMeshers_NumberOfSegments::DT_TabFunc:
201 _vvalue[ TAB_FUNC_IND ] = hyp->GetTableFunction();
202 _revEdgesIDs = hyp->GetReversedEdges();
204 case StdMeshers_NumberOfSegments::DT_ExprFunc:
205 _svalue[ EXPR_FUNC_IND ] = hyp->GetExpressionFunction();
206 _revEdgesIDs = hyp->GetReversedEdges();
208 case StdMeshers_NumberOfSegments::DT_Regular:
214 if (_ivalue[ DISTR_TYPE_IND ] == StdMeshers_NumberOfSegments::DT_TabFunc ||
215 _ivalue[ DISTR_TYPE_IND ] == StdMeshers_NumberOfSegments::DT_ExprFunc)
216 _ivalue[ CONV_MODE_IND ] = hyp->ConversionMode();
217 _hypType = NB_SEGMENTS;
218 aStatus = SMESH_Hypothesis::HYP_OK;
221 else if ( hypName == "Arithmetic1D" )
223 const StdMeshers_Arithmetic1D * hyp =
224 dynamic_cast <const StdMeshers_Arithmetic1D * >(theHyp);
226 _value[ BEG_LENGTH_IND ] = hyp->GetLength( true );
227 _value[ END_LENGTH_IND ] = hyp->GetLength( false );
228 ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
229 _hypType = ARITHMETIC_1D;
231 _revEdgesIDs = hyp->GetReversedEdges();
233 aStatus = SMESH_Hypothesis::HYP_OK;
236 else if ( hypName == "GeometricProgression" )
238 const StdMeshers_Geometric1D * hyp =
239 dynamic_cast <const StdMeshers_Geometric1D * >(theHyp);
241 _value[ BEG_LENGTH_IND ] = hyp->GetStartLength();
242 _value[ END_LENGTH_IND ] = hyp->GetCommonRatio();
243 ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
244 _hypType = GEOMETRIC_1D;
246 _revEdgesIDs = hyp->GetReversedEdges();
248 aStatus = SMESH_Hypothesis::HYP_OK;
251 else if ( hypName == "FixedPoints1D" ) {
252 _fpHyp = dynamic_cast <const StdMeshers_FixedPoints1D*>(theHyp);
254 _hypType = FIXED_POINTS_1D;
256 _revEdgesIDs = _fpHyp->GetReversedEdges();
258 aStatus = SMESH_Hypothesis::HYP_OK;
261 else if ( hypName == "StartEndLength" )
263 const StdMeshers_StartEndLength * hyp =
264 dynamic_cast <const StdMeshers_StartEndLength * >(theHyp);
266 _value[ BEG_LENGTH_IND ] = hyp->GetLength( true );
267 _value[ END_LENGTH_IND ] = hyp->GetLength( false );
268 ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
269 _hypType = BEG_END_LENGTH;
271 _revEdgesIDs = hyp->GetReversedEdges();
273 aStatus = SMESH_Hypothesis::HYP_OK;
276 else if ( hypName == "Deflection1D" )
278 const StdMeshers_Deflection1D * hyp =
279 dynamic_cast <const StdMeshers_Deflection1D * >(theHyp);
281 _value[ DEFLECTION_IND ] = hyp->GetDeflection();
282 ASSERT( _value[ DEFLECTION_IND ] > 0 );
283 _hypType = DEFLECTION;
284 aStatus = SMESH_Hypothesis::HYP_OK;
287 else if ( hypName == "AutomaticLength" )
289 StdMeshers_AutomaticLength * hyp = const_cast<StdMeshers_AutomaticLength *>
290 (dynamic_cast <const StdMeshers_AutomaticLength * >(theHyp));
292 _value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
293 ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
294 _hypType = MAX_LENGTH;
295 aStatus = SMESH_Hypothesis::HYP_OK;
297 else if ( hypName == "Adaptive1D" )
299 _adaptiveHyp = dynamic_cast < const StdMeshers_Adaptive1D* >(theHyp);
300 ASSERT(_adaptiveHyp);
302 _onlyUnaryInput = false;
303 aStatus = SMESH_Hypothesis::HYP_OK;
307 aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
310 if ( propagTypes.size() > 1 && aStatus == HYP_OK )
312 // detect concurrent Propagation hyps
313 _usedHypList.clear();
314 list< TopoDS_Shape > assignedTo;
315 if ( aMesh.GetHypotheses( aShape, propagFilter, _usedHypList, true, &assignedTo ) > 1 )
317 // find most simple shape and a hyp on it
318 int simpleShape = TopAbs_COMPOUND;
319 const SMESHDS_Hypothesis* localHyp = 0;
320 list< TopoDS_Shape >::iterator shape = assignedTo.begin();
321 list< const SMESHDS_Hypothesis *>::iterator hyp = _usedHypList.begin();
322 for ( ; shape != assignedTo.end(); ++shape )
323 if ( shape->ShapeType() > simpleShape )
325 simpleShape = shape->ShapeType();
328 // check if there a different hyp on simpleShape
329 shape = assignedTo.begin();
330 hyp = _usedHypList.begin();
331 for ( ; hyp != _usedHypList.end(); ++hyp, ++shape )
332 if ( shape->ShapeType() == simpleShape &&
333 !localHyp->IsSameName( **hyp ))
335 aStatus = HYP_INCOMPAT_HYPS;
336 return error( SMESH_Comment("Hypotheses of both \"")
337 << StdMeshers_Propagation::GetName() << "\" and \""
338 << StdMeshers_PropagOfDistribution::GetName()
339 << "\" types can't be applied to the same edge");
344 return ( aStatus == SMESH_Hypothesis::HYP_OK );
347 static bool computeParamByFunc(Adaptor3d_Curve& C3d,
348 double first, double last, double length,
349 bool theReverse, int nbSeg, Function& func,
350 list<double>& theParams)
353 //OSD::SetSignal( true );
358 int nbPnt = 1 + nbSeg;
359 vector<double> x( nbPnt, 0. );
361 if ( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ))
364 // apply parameters in range [0,1] to the space of the curve
365 double prevU = first;
373 for ( int i = 1; i < nbSeg; i++ )
375 double curvLength = length * (x[i] - x[i-1]) * sign;
376 double tol = Min( Precision::Confusion(), curvLength / 100. );
377 GCPnts_AbscissaPoint Discret( tol, C3d, curvLength, prevU );
378 if ( !Discret.IsDone() )
380 double U = Discret.Parameter();
381 if ( U > first && U < last )
382 theParams.push_back( U );
393 //================================================================================
395 * \brief adjust internal node parameters so that the last segment length == an
396 * \param a1 - the first segment length
397 * \param an - the last segment length
398 * \param U1 - the first edge parameter
399 * \param Un - the last edge parameter
400 * \param length - the edge length
401 * \param C3d - the edge curve
402 * \param theParams - internal node parameters to adjust
403 * \param adjustNeighbors2an - to adjust length of segments next to the last one
404 * and not to remove parameters
406 //================================================================================
408 static void compensateError(double a1, double an,
409 double U1, double Un,
411 Adaptor3d_Curve& C3d,
412 list<double> & theParams,
413 bool adjustNeighbors2an = false)
415 int i, nPar = theParams.size();
416 if ( a1 + an <= length && nPar > 1 )
418 bool reverse = ( U1 > Un );
419 double tol = Min( Precision::Confusion(), 0.01 * an );
420 GCPnts_AbscissaPoint Discret( tol, C3d, reverse ? an : -an, Un );
421 if ( !Discret.IsDone() )
423 double Utgt = Discret.Parameter(); // target value of the last parameter
424 list<double>::reverse_iterator itU = theParams.rbegin();
425 double Ul = *itU++; // real value of the last parameter
426 double dUn = Utgt - Ul; // parametric error of <an>
427 double dU = Abs( Ul - *itU ); // parametric length of the last but one segment
428 if ( Abs(dUn) <= 1e-3 * dU )
430 if ( adjustNeighbors2an || Abs(dUn) < 0.5 * dU ) { // last segment is a bit shorter than it should
431 // move the last parameter to the edge beginning
433 else { // last segment is much shorter than it should -> remove the last param and
434 theParams.pop_back(); nPar--; // move the rest points toward the edge end
435 dUn = Utgt - theParams.back();
438 if ( !adjustNeighbors2an )
440 double q = dUn / ( Utgt - Un ); // (signed) factor of segment length change
441 for ( itU = theParams.rbegin(), i = 1; i < nPar; i++ ) {
445 dUn = q * (*itU - prevU) * (prevU-U1)/(Un-U1);
448 else if ( nPar == 1 )
450 theParams.back() += dUn;
454 double q = dUn / ( nPar - 1 );
455 theParams.back() += dUn;
456 double sign = reverse ? -1 : 1;
457 double prevU = theParams.back();
458 itU = theParams.rbegin();
459 for ( ++itU, i = 2; i < nPar; ++itU, i++ ) {
460 double newU = *itU + dUn;
461 if ( newU*sign < prevU*sign ) {
465 else { // set U between prevU and next valid param
466 list<double>::reverse_iterator itU2 = itU;
469 while ( (*itU2)*sign > prevU*sign ) {
472 dU = ( *itU2 - prevU ) / nb;
473 while ( itU != itU2 ) {
483 //================================================================================
485 * \brief Class used to clean mesh on edges when 0D hyp modified.
486 * Common approach doesn't work when 0D algo is missing because the 0D hyp is
487 * considered as not participating in computation whereas it is used by 1D algo.
489 //================================================================================
491 // struct VertexEventListener : public SMESH_subMeshEventListener
493 // VertexEventListener():SMESH_subMeshEventListener(0) // won't be deleted by submesh
496 // * \brief Clean mesh on edges
497 // * \param event - algo_event or compute_event itself (of SMESH_subMesh)
498 // * \param eventType - ALGO_EVENT or COMPUTE_EVENT (of SMESH_subMesh)
499 // * \param subMesh - the submesh where the event occures
501 // void ProcessEvent(const int event, const int eventType, SMESH_subMesh* subMesh,
502 // EventListenerData*, const SMESH_Hypothesis*)
504 // if ( eventType == SMESH_subMesh::ALGO_EVENT) // all algo events
506 // subMesh->ComputeStateEngine( SMESH_subMesh::MODIF_ALGO_STATE );
509 // }; // struct VertexEventListener
511 //=============================================================================
513 * \brief Sets event listener to vertex submeshes
514 * \param subMesh - submesh where algo is set
516 * This method is called when a submesh gets HYP_OK algo_state.
517 * After being set, event listener is notified on each event of a submesh.
519 //=============================================================================
521 void StdMeshers_Regular_1D::SetEventListener(SMESH_subMesh* subMesh)
523 StdMeshers_Propagation::SetPropagationMgr( subMesh );
526 //=============================================================================
529 * \param subMesh - restored submesh
531 * This method is called only if a submesh has HYP_OK algo_state.
533 //=============================================================================
535 void StdMeshers_Regular_1D::SubmeshRestored(SMESH_subMesh* subMesh)
539 //=============================================================================
541 * \brief Return StdMeshers_SegmentLengthAroundVertex assigned to vertex
543 //=============================================================================
545 const StdMeshers_SegmentLengthAroundVertex*
546 StdMeshers_Regular_1D::getVertexHyp(SMESH_Mesh & theMesh,
547 const TopoDS_Vertex & theV)
549 static SMESH_HypoFilter filter( SMESH_HypoFilter::HasName("SegmentAroundVertex_0D"));
550 if ( const SMESH_Hypothesis * h = theMesh.GetHypothesis( theV, filter, true ))
552 SMESH_Algo* algo = const_cast< SMESH_Algo* >( static_cast< const SMESH_Algo* > ( h ));
553 const list <const SMESHDS_Hypothesis *> & hypList = algo->GetUsedHypothesis( theMesh, theV, 0 );
554 if ( !hypList.empty() && string("SegmentLengthAroundVertex") == hypList.front()->GetName() )
555 return static_cast<const StdMeshers_SegmentLengthAroundVertex*>( hypList.front() );
560 //================================================================================
562 * \brief Tune parameters to fit "SegmentLengthAroundVertex" hypothesis
563 * \param theC3d - wire curve
564 * \param theLength - curve length
565 * \param theParameters - internal nodes parameters to modify
566 * \param theVf - 1st vertex
567 * \param theVl - 2nd vertex
569 //================================================================================
571 void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theMesh,
572 Adaptor3d_Curve & theC3d,
574 std::list< double > & theParameters,
575 const TopoDS_Vertex & theVf,
576 const TopoDS_Vertex & theVl)
578 double f = theC3d.FirstParameter(), l = theC3d.LastParameter();
579 int nPar = theParameters.size();
580 for ( int isEnd1 = 0; isEnd1 < 2; ++isEnd1 )
582 const TopoDS_Vertex & V = isEnd1 ? theVf : theVl;
583 const StdMeshers_SegmentLengthAroundVertex* hyp = getVertexHyp (theMesh, V );
585 double vertexLength = hyp->GetLength();
586 if ( vertexLength > theLength / 2.0 )
588 if ( isEnd1 ) { // to have a segment of interest at end of theParameters
589 theParameters.reverse();
592 if ( _hypType == NB_SEGMENTS )
594 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
596 else if ( nPar <= 3 )
599 vertexLength = -vertexLength;
600 double tol = Min( Precision::Confusion(), 0.01 * vertexLength );
601 GCPnts_AbscissaPoint Discret( tol, theC3d, vertexLength, l );
602 if ( Discret.IsDone() ) {
604 theParameters.push_back( Discret.Parameter());
606 double L = GCPnts_AbscissaPoint::Length( theC3d, theParameters.back(), l);
607 if ( vertexLength < L / 2.0 )
608 theParameters.push_back( Discret.Parameter());
610 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
616 // recompute params between the last segment and a middle one.
617 // find size of a middle segment
618 int nHalf = ( nPar-1 ) / 2;
619 list< double >::reverse_iterator itU = theParameters.rbegin();
620 std::advance( itU, nHalf );
622 double Lm = GCPnts_AbscissaPoint::Length( theC3d, Um, *itU);
623 double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l);
624 static StdMeshers_Regular_1D* auxAlgo = 0;
626 auxAlgo = new StdMeshers_Regular_1D( _gen->GetANewId(), _studyId, _gen );
627 auxAlgo->_hypType = BEG_END_LENGTH;
629 auxAlgo->_value[ BEG_LENGTH_IND ] = Lm;
630 auxAlgo->_value[ END_LENGTH_IND ] = vertexLength;
631 double from = *itU, to = l;
633 std::swap( from, to );
634 std::swap( auxAlgo->_value[ BEG_LENGTH_IND ], auxAlgo->_value[ END_LENGTH_IND ]);
637 if ( auxAlgo->computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
639 if ( isEnd1 ) params.reverse();
640 while ( 1 + nHalf-- )
641 theParameters.pop_back();
642 theParameters.splice( theParameters.end(), params );
646 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
650 theParameters.reverse();
655 //=============================================================================
659 //=============================================================================
660 bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
661 Adaptor3d_Curve& theC3d,
665 list<double> & theParams,
666 const bool theReverse,
667 bool theConsiderPropagation)
671 double f = theFirstU, l = theLastU;
673 // Propagation Of Distribution
675 if ( !_mainEdge.IsNull() && _isPropagOfDistribution )
677 TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference!
678 _gen->Compute( theMesh, mainEdge, SMESH_Gen::SHAPE_ONLY_UPWARD );
680 SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge );
682 return error("No mesh on the source edge of Propagation Of Distribution");
683 if ( smDS->NbNodes() < 1 )
684 return true; // 1 segment
686 map< double, const SMDS_MeshNode* > mainEdgeParamsOfNodes;
687 if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh,
688 mainEdgeParamsOfNodes, SMDSAbs_Edge ))
689 return error("Bad node parameters on the source edge of Propagation Of Distribution");
690 vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 );
692 BRepAdaptor_Curve mainEdgeCurve( mainEdge );
693 map< double, const SMDS_MeshNode* >::iterator
694 u_n2 = mainEdgeParamsOfNodes.begin(), u_n1 = u_n2++;
695 for ( size_t i = 1; i < mainEdgeParamsOfNodes.size(); ++i, ++u_n1, ++u_n2 )
697 segLen[ i-1 ] = GCPnts_AbscissaPoint::Length( mainEdgeCurve,
700 totalLen += segLen[ i-1 ];
702 for ( size_t i = 0; i < segLen.size(); ++i )
703 segLen[ i ] *= theLength / totalLen;
705 size_t iSeg = theReverse ? segLen.size()-1 : 0;
706 size_t dSeg = theReverse ? -1 : +1;
707 double param = theFirstU;
709 for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
711 double tol = Min( Precision::Confusion(), 0.01 * segLen[ iSeg ]);
712 GCPnts_AbscissaPoint Discret( tol, theC3d, segLen[ iSeg ], param );
713 if ( !Discret.IsDone() ) break;
714 param = Discret.Parameter();
715 theParams.push_back( param );
718 if ( nbParams != segLen.size()-1 )
719 return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segments");
721 compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ],
722 segLen[ theReverse ? 0 : segLen.size()-1 ],
723 f, l, theLength, theC3d, theParams, true );
736 if ( _hypType == MAX_LENGTH )
738 double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
740 nbseg = 1; // degenerated edge
741 eltSize = theLength / nbseg * ( 1. - 1e-9 );
742 nbSegments = (int) nbseg;
744 else if ( _hypType == LOCAL_LENGTH )
746 // Local Length hypothesis
747 double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
750 bool isFound = false;
751 if (theConsiderPropagation && !_mainEdge.IsNull()) // propagated from some other edge
753 // Advanced processing to assure equal number of segments in case of Propagation
754 SMESH_subMesh* sm = theMesh.GetSubMeshContaining(_mainEdge);
756 bool computed = sm->IsMeshComputed();
758 if (sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
759 _gen->Compute( theMesh, _mainEdge, /*anUpward=*/true);
760 computed = sm->IsMeshComputed();
764 SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
765 int nb_segments = smds->NbElements();
766 if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
773 if (!isFound) // not found by meshed edge in the propagation chain, use precision
775 double aPrecision = _value[ PRECISION_IND ];
776 double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
777 if (nbseg_prec == (nbseg - 1)) nbseg--;
781 nbseg = 1; // degenerated edge
782 eltSize = theLength / nbseg;
783 nbSegments = (int) nbseg;
787 // Number Of Segments hypothesis
788 nbSegments = _ivalue[ NB_SEGMENTS_IND ];
789 if ( nbSegments < 1 ) return false;
790 if ( nbSegments == 1 ) return true;
792 switch (_ivalue[ DISTR_TYPE_IND ])
794 case StdMeshers_NumberOfSegments::DT_Scale:
796 double scale = _value[ SCALE_FACTOR_IND ];
798 if (fabs(scale - 1.0) < Precision::Confusion()) {
799 // special case to avoid division by zero
800 for (int i = 1; i < nbSegments; i++) {
801 double param = f + (l - f) * i / nbSegments;
802 theParams.push_back( param );
805 // general case of scale distribution
809 double alpha = pow(scale, 1.0 / (nbSegments - 1));
810 double factor = (l - f) / (1.0 - pow(alpha, nbSegments));
812 for (int i = 1; i < nbSegments; i++) {
813 double param = f + factor * (1.0 - pow(alpha, i));
814 theParams.push_back( param );
817 const double lenFactor = theLength/(l-f);
818 const double minSegLen = Min( theParams.front() - f, l - theParams.back() );
819 const double tol = Min( Precision::Confusion(), 0.01 * minSegLen );
820 list<double>::iterator u = theParams.begin(), uEnd = theParams.end();
821 for ( ; u != uEnd; ++u )
823 GCPnts_AbscissaPoint Discret( tol, theC3d, ((*u)-f) * lenFactor, f );
824 if ( Discret.IsDone() )
825 *u = Discret.Parameter();
830 case StdMeshers_NumberOfSegments::DT_TabFunc:
832 FunctionTable func(_vvalue[ TAB_FUNC_IND ], _ivalue[ CONV_MODE_IND ]);
833 return computeParamByFunc(theC3d, f, l, theLength, theReverse,
834 _ivalue[ NB_SEGMENTS_IND ], func,
838 case StdMeshers_NumberOfSegments::DT_ExprFunc:
840 FunctionExpr func(_svalue[ EXPR_FUNC_IND ].c_str(), _ivalue[ CONV_MODE_IND ]);
841 return computeParamByFunc(theC3d, f, l, theLength, theReverse,
842 _ivalue[ NB_SEGMENTS_IND ], func,
846 case StdMeshers_NumberOfSegments::DT_Regular:
847 eltSize = theLength / nbSegments;
854 double tol = Min( Precision::Confusion(), 0.01 * eltSize );
855 GCPnts_UniformAbscissa Discret(theC3d, nbSegments + 1, f, l, tol );
856 if ( !Discret.IsDone() )
857 return error( "GCPnts_UniformAbscissa failed");
858 if ( Discret.NbPoints() < nbSegments + 1 )
859 Discret.Initialize(theC3d, nbSegments + 2, f, l, tol );
861 int NbPoints = Min( Discret.NbPoints(), nbSegments + 1 );
862 for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points
864 double param = Discret.Parameter(i);
865 theParams.push_back( param );
867 compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams, true ); // for PAL9899
872 case BEG_END_LENGTH: {
874 // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength
876 double a1 = _value[ BEG_LENGTH_IND ];
877 double an = _value[ END_LENGTH_IND ];
878 double q = ( theLength - a1 ) / ( theLength - an );
879 if ( q < theLength/1e6 || 1.01*theLength < a1 + an)
880 return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
881 "for an edge of length "<<theLength);
883 double U1 = theReverse ? l : f;
884 double Un = theReverse ? f : l;
886 double eltSize = theReverse ? -a1 : a1;
887 double tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
889 // computes a point on a curve <theC3d> at the distance <eltSize>
890 // from the point of parameter <param>.
891 GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
892 if ( !Discret.IsDone() ) break;
893 param = Discret.Parameter();
894 if ( f < param && param < l )
895 theParams.push_back( param );
900 compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
901 if (theReverse) theParams.reverse(); // NPAL18025
907 // arithmetic progression: SUM(n) = ( an - a1 + q ) * ( a1 + an ) / ( 2 * q ) = theLength
909 double a1 = _value[ BEG_LENGTH_IND ];
910 double an = _value[ END_LENGTH_IND ];
911 if ( 1.01*theLength < a1 + an )
912 return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
913 "for an edge of length "<<theLength);
915 double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
916 int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
918 double U1 = theReverse ? l : f;
919 double Un = theReverse ? f : l;
922 double tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
927 while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
928 // computes a point on a curve <theC3d> at the distance <eltSize>
929 // from the point of parameter <param>.
930 GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
931 if ( !Discret.IsDone() ) break;
932 param = Discret.Parameter();
933 if ( param > f && param < l )
934 theParams.push_back( param );
939 compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
940 if ( theReverse ) theParams.reverse(); // NPAL18025
947 double a1 = _value[ BEG_LENGTH_IND ], an = 0;
948 double q = _value[ END_LENGTH_IND ];
950 double U1 = theReverse ? l : f;
951 double Un = theReverse ? f : l;
959 // computes a point on a curve <theC3d> at the distance <eltSize>
960 // from the point of parameter <param>.
961 double tol = Min( Precision::Confusion(), 0.01 * eltSize );
962 GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
963 if ( !Discret.IsDone() ) break;
964 param = Discret.Parameter();
965 if ( f < param && param < l )
966 theParams.push_back( param );
975 if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() ))
977 compensateError( a1, Abs(eltSize), U1, Un, theLength, theC3d, theParams );
979 else if ( Abs( Un - theParams.back() ) <
980 0.2 * Abs( theParams.back() - *(++theParams.rbegin())))
982 theParams.pop_back();
983 compensateError( a1, Abs(an), U1, Un, theLength, theC3d, theParams );
986 if (theReverse) theParams.reverse(); // NPAL18025
991 case FIXED_POINTS_1D:
993 const std::vector<double>& aPnts = _fpHyp->GetPoints();
994 std::vector<int> nbsegs = _fpHyp->GetNbSegments();
996 // sort normalized params, taking into account theReverse
997 TColStd_SequenceOfReal Params;
998 double tol = 1e-7 / theLength; // GCPnts_UniformAbscissa allows u2-u1 > 1e-7
999 for ( size_t i = 0; i < aPnts.size(); i++ )
1001 if( aPnts[i] < tol || aPnts[i] > 1 - tol )
1003 double u = theReverse ? ( 1 - aPnts[i] ) : aPnts[i];
1005 bool IsExist = false;
1006 for ( ; j <= Params.Length(); j++ ) {
1007 if ( Abs( u - Params.Value(j) ) < tol ) {
1011 if ( u < Params.Value(j) ) break;
1013 if ( !IsExist ) Params.InsertBefore( j, u );
1016 // transform normalized Params into real ones
1017 std::vector< double > uVec( Params.Length() + 2 );
1018 uVec[ 0 ] = theFirstU;
1020 for ( int i = 1; i <= Params.Length(); i++ )
1022 abscissa = Params( i ) * theLength;
1023 tol = Min( Precision::Confusion(), 0.01 * abscissa );
1024 GCPnts_AbscissaPoint APnt( tol, theC3d, abscissa, theFirstU );
1025 if ( !APnt.IsDone() )
1026 return error( "GCPnts_AbscissaPoint failed");
1027 uVec[ i ] = APnt.Parameter();
1029 uVec.back() = theLastU;
1034 if ((int) nbsegs.size() > Params.Length() + 1 )
1035 nbsegs.resize( Params.Length() + 1 );
1036 std::reverse( nbsegs.begin(), nbsegs.end() );
1038 if ( nbsegs.empty() )
1040 nbsegs.push_back( 1 );
1042 Params.InsertBefore( 1, 0.0 );
1043 Params.Append( 1.0 );
1044 double eltSize, segmentSize, par1, par2;
1045 for ( size_t i = 0; i < uVec.size()-1; i++ )
1049 int nbseg = ( i < nbsegs.size() ) ? nbsegs[i] : nbsegs[0];
1052 theParams.push_back( par2 );
1056 segmentSize = ( Params( i+2 ) - Params( i+1 )) * theLength;
1057 eltSize = segmentSize / nbseg;
1058 tol = Min( Precision::Confusion(), 0.01 * eltSize );
1059 GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2, tol );
1060 if ( !Discret.IsDone() )
1061 return error( "GCPnts_UniformAbscissa failed");
1062 if ( Discret.NbPoints() < nbseg + 1 ) {
1063 eltSize = segmentSize / ( nbseg + 0.5 );
1064 Discret.Initialize( theC3d, eltSize, par1, par2, tol );
1066 int NbPoints = Discret.NbPoints();
1067 for ( int i = 2; i <= NbPoints; i++ ) {
1068 double param = Discret.Parameter(i);
1069 theParams.push_back( param );
1073 theParams.pop_back();
1080 GCPnts_UniformDeflection Discret( theC3d, _value[ DEFLECTION_IND ], f, l, true );
1081 if ( !Discret.IsDone() )
1084 int NbPoints = Discret.NbPoints();
1085 for ( int i = 2; i < NbPoints; i++ )
1087 double param = Discret.Parameter(i);
1088 theParams.push_back( param );
1099 //=============================================================================
1103 //=============================================================================
1105 bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
1107 if ( _hypType == NONE )
1110 if ( _hypType == ADAPTIVE )
1112 _adaptiveHyp->GetAlgo()->InitComputeError();
1113 _adaptiveHyp->GetAlgo()->Compute( theMesh, theShape );
1114 return error( _adaptiveHyp->GetAlgo()->GetComputeError() );
1117 SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
1119 const TopoDS_Edge & EE = TopoDS::Edge(theShape);
1120 TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
1121 int shapeID = meshDS->ShapeToIndex( E );
1124 Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
1126 TopoDS_Vertex VFirst, VLast;
1127 TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
1129 ASSERT(!VFirst.IsNull());
1130 ASSERT(!VLast.IsNull());
1131 const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
1132 const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
1133 if ( !nFirst || !nLast )
1134 return error( COMPERR_BAD_INPUT_MESH, "No node on vertex");
1136 // remove elements created by e.g. patern mapping (PAL21999)
1137 // CLEAN event is incorrectly ptopagated seemingly due to Propagation hyp
1138 // so TEMPORARY solution is to clean the submesh manually
1139 if (SMESHDS_SubMesh * subMeshDS = meshDS->MeshElements(theShape))
1141 SMDS_ElemIteratorPtr ite = subMeshDS->GetElements();
1143 meshDS->RemoveFreeElement(ite->next(), subMeshDS);
1144 SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes();
1145 while (itn->more()) {
1146 const SMDS_MeshNode * node = itn->next();
1147 if ( node->NbInverseElements() == 0 )
1148 meshDS->RemoveFreeNode(node, subMeshDS);
1150 meshDS->RemoveNode(node);
1154 double length = EdgeLength( E );
1155 if ( !Curve.IsNull() && length > 0 )
1157 list< double > params;
1158 bool reversed = false;
1159 if ( theMesh.GetShapeToMesh().ShapeType() >= TopAbs_WIRE && _revEdgesIDs.empty() ) {
1160 // if the shape to mesh is WIRE or EDGE
1161 reversed = ( EE.Orientation() == TopAbs_REVERSED );
1163 if ( !_mainEdge.IsNull() ) {
1164 // take into account reversing the edge the hypothesis is propagated from
1165 // (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain)
1166 reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
1167 if ( !_isPropagOfDistribution ) {
1168 int mainID = meshDS->ShapeToIndex(_mainEdge);
1169 if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end())
1170 reversed = !reversed;
1173 // take into account this edge reversing
1174 if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), shapeID) != _revEdgesIDs.end())
1175 reversed = !reversed;
1177 BRepAdaptor_Curve C3d( E );
1178 if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) {
1181 redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
1183 // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
1184 // only internal nodes receive an edge position with param on curve
1186 const SMDS_MeshNode * nPrev = nFirst;
1190 for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++) {
1191 double param = *itU;
1192 gp_Pnt P = Curve->Value(param);
1194 //Add the Node in the DataStructure
1195 SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
1196 meshDS->SetNodeOnEdge(node, shapeID, param);
1198 if(_quadraticMesh) {
1199 // create medium node
1200 double prm = ( parPrev + param )/2;
1201 gp_Pnt PM = Curve->Value(prm);
1202 SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
1203 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1204 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, node, NM);
1205 meshDS->SetMeshElementOnShape(edge, shapeID);
1208 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, node);
1209 meshDS->SetMeshElementOnShape(edge, shapeID);
1215 if(_quadraticMesh) {
1216 double prm = ( parPrev + parLast )/2;
1217 gp_Pnt PM = Curve->Value(prm);
1218 SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
1219 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1220 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, nLast, NM);
1221 meshDS->SetMeshElementOnShape(edge, shapeID);
1224 SMDS_MeshEdge* edge = meshDS->AddEdge(nPrev, nLast);
1225 meshDS->SetMeshElementOnShape(edge, shapeID);
1230 // Edge is a degenerated Edge : We put n = 5 points on the edge.
1231 const int NbPoints = 5;
1232 BRep_Tool::Range( E, f, l ); // PAL15185
1233 double du = (l - f) / (NbPoints - 1);
1235 gp_Pnt P = BRep_Tool::Pnt(VFirst);
1237 const SMDS_MeshNode * nPrev = nFirst;
1238 for (int i = 2; i < NbPoints; i++) {
1239 double param = f + (i - 1) * du;
1240 SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
1241 if(_quadraticMesh) {
1242 // create medium node
1243 double prm = param - du/2.;
1244 SMDS_MeshNode * NM = meshDS->AddNode(P.X(), P.Y(), P.Z());
1245 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1246 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, node, NM);
1247 meshDS->SetMeshElementOnShape(edge, shapeID);
1250 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, node);
1251 meshDS->SetMeshElementOnShape(edge, shapeID);
1253 meshDS->SetNodeOnEdge(node, shapeID, param);
1256 if(_quadraticMesh) {
1257 // create medium node
1258 double prm = l - du/2.;
1259 SMDS_MeshNode * NM = meshDS->AddNode(P.X(), P.Y(), P.Z());
1260 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1261 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, nLast, NM);
1262 meshDS->SetMeshElementOnShape(edge, shapeID);
1265 SMDS_MeshEdge * edge = meshDS->AddEdge(nPrev, nLast);
1266 meshDS->SetMeshElementOnShape(edge, shapeID);
1273 //=============================================================================
1277 //=============================================================================
1279 bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
1280 const TopoDS_Shape & theShape,
1281 MapShapeNbElems& aResMap)
1283 if ( _hypType == NONE )
1286 if ( _hypType == ADAPTIVE )
1288 _adaptiveHyp->GetAlgo()->InitComputeError();
1289 _adaptiveHyp->GetAlgo()->Evaluate( theMesh, theShape, aResMap );
1290 return error( _adaptiveHyp->GetAlgo()->GetComputeError() );
1293 const TopoDS_Edge & EE = TopoDS::Edge(theShape);
1294 TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
1297 Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
1299 TopoDS_Vertex VFirst, VLast;
1300 TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
1302 ASSERT(!VFirst.IsNull());
1303 ASSERT(!VLast.IsNull());
1305 std::vector<int> aVec(SMDSEntity_Last,0);
1307 double length = EdgeLength( E );
1308 if ( !Curve.IsNull() && length > 0 )
1310 list< double > params;
1311 BRepAdaptor_Curve C3d( E );
1312 if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, false, true )) {
1313 SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
1314 aResMap.insert(std::make_pair(sm,aVec));
1315 SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
1316 smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
1319 redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
1321 if(_quadraticMesh) {
1322 aVec[SMDSEntity_Node] = 2*params.size() + 1;
1323 aVec[SMDSEntity_Quad_Edge] = params.size() + 1;
1326 aVec[SMDSEntity_Node] = params.size();
1327 aVec[SMDSEntity_Edge] = params.size() + 1;
1332 // Edge is a degenerated Edge : We put n = 5 points on the edge.
1333 if ( _quadraticMesh ) {
1334 aVec[SMDSEntity_Node] = 11;
1335 aVec[SMDSEntity_Quad_Edge] = 6;
1338 aVec[SMDSEntity_Node] = 5;
1339 aVec[SMDSEntity_Edge] = 6;
1343 SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
1344 aResMap.insert(std::make_pair(sm,aVec));
1350 //=============================================================================
1352 * See comments in SMESH_Algo.cxx
1354 //=============================================================================
1356 const list <const SMESHDS_Hypothesis *> &
1357 StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
1358 const TopoDS_Shape & aShape,
1359 const bool ignoreAuxiliary)
1361 _usedHypList.clear();
1362 _mainEdge.Nullify();
1364 SMESH_HypoFilter auxiliaryFilter( SMESH_HypoFilter::IsAuxiliary() );
1365 const SMESH_HypoFilter* compatibleFilter = GetCompatibleHypoFilter(/*ignoreAux=*/true );
1367 // get non-auxiliary assigned directly to aShape
1368 int nbHyp = aMesh.GetHypotheses( aShape, *compatibleFilter, _usedHypList, false );
1370 if (nbHyp == 0 && aShape.ShapeType() == TopAbs_EDGE)
1372 // Check, if propagated from some other edge
1373 _mainEdge = StdMeshers_Propagation::GetPropagationSource( aMesh, aShape,
1374 _isPropagOfDistribution );
1375 if ( !_mainEdge.IsNull() )
1377 // Propagation of 1D hypothesis from <aMainEdge> on this edge;
1378 // get non-auxiliary assigned to _mainEdge
1379 nbHyp = aMesh.GetHypotheses( _mainEdge, *compatibleFilter, _usedHypList, true );
1383 if (nbHyp == 0) // nothing propagated nor assigned to aShape
1385 SMESH_Algo::GetUsedHypothesis( aMesh, aShape, ignoreAuxiliary );
1386 nbHyp = _usedHypList.size();
1390 // get auxiliary hyps from aShape
1391 aMesh.GetHypotheses( aShape, auxiliaryFilter, _usedHypList, true );
1393 if ( nbHyp > 1 && ignoreAuxiliary )
1394 _usedHypList.clear(); //only one compatible non-auxiliary hypothesis allowed
1396 return _usedHypList;
1399 //================================================================================
1401 * \brief Pass CancelCompute() to a child algorithm
1403 //================================================================================
1405 void StdMeshers_Regular_1D::CancelCompute()
1407 SMESH_Algo::CancelCompute();
1408 if ( _hypType == ADAPTIVE )
1409 _adaptiveHyp->GetAlgo()->CancelCompute();