1 // Copyright (C) 2007-2015 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 "SMESH_Comment.hxx"
33 #include "SMESH_Gen.hxx"
34 #include "SMESH_HypoFilter.hxx"
35 #include "SMESH_Mesh.hxx"
36 #include "SMESH_subMesh.hxx"
37 #include "SMESH_subMeshEventListener.hxx"
38 #include "StdMeshers_Adaptive1D.hxx"
39 #include "StdMeshers_Arithmetic1D.hxx"
40 #include "StdMeshers_Geometric1D.hxx"
41 #include "StdMeshers_AutomaticLength.hxx"
42 #include "StdMeshers_Deflection1D.hxx"
43 #include "StdMeshers_Distribution.hxx"
44 #include "StdMeshers_FixedPoints1D.hxx"
45 #include "StdMeshers_LocalLength.hxx"
46 #include "StdMeshers_MaxLength.hxx"
47 #include "StdMeshers_NumberOfSegments.hxx"
48 #include "StdMeshers_Propagation.hxx"
49 #include "StdMeshers_SegmentLengthAroundVertex.hxx"
50 #include "StdMeshers_StartEndLength.hxx"
52 #include "Utils_SALOME_Exception.hxx"
53 #include "utilities.h"
55 #include <BRepAdaptor_Curve.hxx>
56 #include <BRep_Tool.hxx>
57 #include <GCPnts_AbscissaPoint.hxx>
58 #include <GCPnts_UniformAbscissa.hxx>
59 #include <GCPnts_UniformDeflection.hxx>
60 #include <Precision.hxx>
62 #include <TopExp_Explorer.hxx>
64 #include <TopoDS_Edge.hxx>
65 #include <TopoDS_Vertex.hxx>
71 using namespace StdMeshers;
73 //=============================================================================
77 //=============================================================================
79 StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
81 :SMESH_1D_Algo(hypId, studyId, gen)
83 MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D");
85 _shapeType = (1 << TopAbs_EDGE);
88 _compatibleHypothesis.push_back("LocalLength");
89 _compatibleHypothesis.push_back("MaxLength");
90 _compatibleHypothesis.push_back("NumberOfSegments");
91 _compatibleHypothesis.push_back("StartEndLength");
92 _compatibleHypothesis.push_back("Deflection1D");
93 _compatibleHypothesis.push_back("Arithmetic1D");
94 _compatibleHypothesis.push_back("GeometricProgression");
95 _compatibleHypothesis.push_back("FixedPoints1D");
96 _compatibleHypothesis.push_back("AutomaticLength");
97 _compatibleHypothesis.push_back("Adaptive1D");
99 _compatibleHypothesis.push_back("QuadraticMesh");
100 _compatibleHypothesis.push_back("Propagation");
101 _compatibleHypothesis.push_back("PropagOfDistribution");
104 //=============================================================================
108 //=============================================================================
110 StdMeshers_Regular_1D::~StdMeshers_Regular_1D()
114 //=============================================================================
118 //=============================================================================
120 bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh,
121 const TopoDS_Shape& aShape,
122 Hypothesis_Status& aStatus )
125 _quadraticMesh = false;
126 _onlyUnaryInput = true;
128 const list <const SMESHDS_Hypothesis * > & hyps =
129 GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliaryHyps=*/false);
131 const SMESH_HypoFilter & propagFilter = StdMeshers_Propagation::GetFilter();
133 // find non-auxiliary hypothesis
134 const SMESHDS_Hypothesis *theHyp = 0;
135 set< string > propagTypes;
136 list <const SMESHDS_Hypothesis * >::const_iterator h = hyps.begin();
137 for ( ; h != hyps.end(); ++h ) {
138 if ( static_cast<const SMESH_Hypothesis*>(*h)->IsAuxiliary() ) {
139 if ( strcmp( "QuadraticMesh", (*h)->GetName() ) == 0 )
140 _quadraticMesh = true;
141 if ( propagFilter.IsOk( static_cast< const SMESH_Hypothesis*>( *h ), aShape ))
142 propagTypes.insert( (*h)->GetName() );
146 theHyp = *h; // use only the first non-auxiliary hypothesis
152 aStatus = SMESH_Hypothesis::HYP_MISSING;
153 return false; // can't work without a hypothesis
156 string hypName = theHyp->GetName();
158 if (hypName == "LocalLength")
160 const StdMeshers_LocalLength * hyp =
161 dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
163 _value[ BEG_LENGTH_IND ] = hyp->GetLength();
164 _value[ PRECISION_IND ] = hyp->GetPrecision();
165 ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
166 _hypType = LOCAL_LENGTH;
167 aStatus = SMESH_Hypothesis::HYP_OK;
170 else if (hypName == "MaxLength")
172 const StdMeshers_MaxLength * hyp =
173 dynamic_cast <const StdMeshers_MaxLength * >(theHyp);
175 _value[ BEG_LENGTH_IND ] = hyp->GetLength();
176 if ( hyp->GetUsePreestimatedLength() ) {
177 if ( int nbSeg = aMesh.GetGen()->GetBoundaryBoxSegmentation() )
178 _value[ BEG_LENGTH_IND ] = aMesh.GetShapeDiagonalSize() / nbSeg;
180 ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
181 _hypType = MAX_LENGTH;
182 aStatus = SMESH_Hypothesis::HYP_OK;
185 else if (hypName == "NumberOfSegments")
187 const StdMeshers_NumberOfSegments * hyp =
188 dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp);
190 _ivalue[ NB_SEGMENTS_IND ] = hyp->GetNumberOfSegments();
191 ASSERT( _ivalue[ NB_SEGMENTS_IND ] > 0 );
192 _ivalue[ DISTR_TYPE_IND ] = (int) hyp->GetDistrType();
193 switch (_ivalue[ DISTR_TYPE_IND ])
195 case StdMeshers_NumberOfSegments::DT_Scale:
196 _value[ SCALE_FACTOR_IND ] = hyp->GetScaleFactor();
197 _revEdgesIDs = hyp->GetReversedEdges();
199 case StdMeshers_NumberOfSegments::DT_TabFunc:
200 _vvalue[ TAB_FUNC_IND ] = hyp->GetTableFunction();
201 _revEdgesIDs = hyp->GetReversedEdges();
203 case StdMeshers_NumberOfSegments::DT_ExprFunc:
204 _svalue[ EXPR_FUNC_IND ] = hyp->GetExpressionFunction();
205 _revEdgesIDs = hyp->GetReversedEdges();
207 case StdMeshers_NumberOfSegments::DT_Regular:
213 if (_ivalue[ DISTR_TYPE_IND ] == StdMeshers_NumberOfSegments::DT_TabFunc ||
214 _ivalue[ DISTR_TYPE_IND ] == StdMeshers_NumberOfSegments::DT_ExprFunc)
215 _ivalue[ CONV_MODE_IND ] = hyp->ConversionMode();
216 _hypType = NB_SEGMENTS;
217 aStatus = SMESH_Hypothesis::HYP_OK;
220 else if (hypName == "Arithmetic1D")
222 const StdMeshers_Arithmetic1D * hyp =
223 dynamic_cast <const StdMeshers_Arithmetic1D * >(theHyp);
225 _value[ BEG_LENGTH_IND ] = hyp->GetLength( true );
226 _value[ END_LENGTH_IND ] = hyp->GetLength( false );
227 ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
228 _hypType = ARITHMETIC_1D;
230 _revEdgesIDs = hyp->GetReversedEdges();
232 aStatus = SMESH_Hypothesis::HYP_OK;
235 else if (hypName == "GeometricProgression")
237 const StdMeshers_Geometric1D * hyp =
238 dynamic_cast <const StdMeshers_Geometric1D * >(theHyp);
240 _value[ BEG_LENGTH_IND ] = hyp->GetStartLength();
241 _value[ END_LENGTH_IND ] = hyp->GetCommonRatio();
242 ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
243 _hypType = GEOMETRIC_1D;
245 _revEdgesIDs = hyp->GetReversedEdges();
247 aStatus = SMESH_Hypothesis::HYP_OK;
250 else if (hypName == "FixedPoints1D") {
251 _fpHyp = dynamic_cast <const StdMeshers_FixedPoints1D*>(theHyp);
253 _hypType = FIXED_POINTS_1D;
255 _revEdgesIDs = _fpHyp->GetReversedEdges();
257 aStatus = SMESH_Hypothesis::HYP_OK;
260 else if (hypName == "StartEndLength")
262 const StdMeshers_StartEndLength * hyp =
263 dynamic_cast <const StdMeshers_StartEndLength * >(theHyp);
265 _value[ BEG_LENGTH_IND ] = hyp->GetLength( true );
266 _value[ END_LENGTH_IND ] = hyp->GetLength( false );
267 ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
268 _hypType = BEG_END_LENGTH;
270 _revEdgesIDs = hyp->GetReversedEdges();
272 aStatus = SMESH_Hypothesis::HYP_OK;
275 else if (hypName == "Deflection1D")
277 const StdMeshers_Deflection1D * hyp =
278 dynamic_cast <const StdMeshers_Deflection1D * >(theHyp);
280 _value[ DEFLECTION_IND ] = hyp->GetDeflection();
281 ASSERT( _value[ DEFLECTION_IND ] > 0 );
282 _hypType = DEFLECTION;
283 aStatus = SMESH_Hypothesis::HYP_OK;
286 else if (hypName == "AutomaticLength")
288 StdMeshers_AutomaticLength * hyp = const_cast<StdMeshers_AutomaticLength *>
289 (dynamic_cast <const StdMeshers_AutomaticLength * >(theHyp));
291 _value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
292 ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
293 _hypType = MAX_LENGTH;
294 aStatus = SMESH_Hypothesis::HYP_OK;
296 else if (hypName == "Adaptive1D")
298 _adaptiveHyp = dynamic_cast < const StdMeshers_Adaptive1D* >(theHyp);
299 ASSERT(_adaptiveHyp);
301 _onlyUnaryInput = false;
302 aStatus = SMESH_Hypothesis::HYP_OK;
306 aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
309 if ( propagTypes.size() > 1 && aStatus == HYP_OK )
311 // detect concurrent Propagation hyps
312 _usedHypList.clear();
313 list< TopoDS_Shape > assignedTo;
314 if ( aMesh.GetHypotheses( aShape, propagFilter, _usedHypList, true, &assignedTo ) > 1 )
316 // find most simple shape and a hyp on it
317 int simpleShape = TopAbs_COMPOUND;
318 const SMESHDS_Hypothesis* localHyp = 0;
319 list< TopoDS_Shape >::iterator shape = assignedTo.begin();
320 list< const SMESHDS_Hypothesis *>::iterator hyp = _usedHypList.begin();
321 for ( ; shape != assignedTo.end(); ++shape )
322 if ( shape->ShapeType() > simpleShape )
324 simpleShape = shape->ShapeType();
327 // check if there a different hyp on simpleShape
328 shape = assignedTo.begin();
329 hyp = _usedHypList.begin();
330 for ( ; hyp != _usedHypList.end(); ++hyp, ++shape )
331 if ( shape->ShapeType() == simpleShape &&
332 !localHyp->IsSameName( **hyp ))
334 aStatus = HYP_INCOMPAT_HYPS;
335 return error( SMESH_Comment("Hypotheses of both \"")
336 << StdMeshers_Propagation::GetName() << "\" and \""
337 << StdMeshers_PropagOfDistribution::GetName()
338 << "\" types can't be applied to the same edge");
343 return ( aStatus == SMESH_Hypothesis::HYP_OK );
346 static bool computeParamByFunc(Adaptor3d_Curve& C3d,
347 double first, double last, double length,
348 bool theReverse, int nbSeg, Function& func,
349 list<double>& theParams)
352 //OSD::SetSignal( true );
357 MESSAGE( "computeParamByFunc" );
359 int nbPnt = 1 + nbSeg;
360 vector<double> x(nbPnt, 0.);
362 if ( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ))
365 // apply parameters in range [0,1] to the space of the curve
366 double prevU = first;
374 for ( int i = 1; i < nbSeg; i++ )
376 double curvLength = length * (x[i] - x[i-1]) * sign;
377 double tol = Min( Precision::Confusion(), curvLength / 100. );
378 GCPnts_AbscissaPoint Discret( tol, C3d, curvLength, prevU );
379 if ( !Discret.IsDone() )
381 double U = Discret.Parameter();
382 if ( U > first && U < last )
383 theParams.push_back( U );
394 //================================================================================
396 * \brief adjust internal node parameters so that the last segment length == an
397 * \param a1 - the first segment length
398 * \param an - the last segment length
399 * \param U1 - the first edge parameter
400 * \param Un - the last edge parameter
401 * \param length - the edge length
402 * \param C3d - the edge curve
403 * \param theParams - internal node parameters to adjust
404 * \param adjustNeighbors2an - to adjust length of segments next to the last one
405 * and not to remove parameters
407 //================================================================================
409 static void compensateError(double a1, double an,
410 double U1, double Un,
412 Adaptor3d_Curve& C3d,
413 list<double> & theParams,
414 bool adjustNeighbors2an = false)
416 int i, nPar = theParams.size();
417 if ( a1 + an <= length && nPar > 1 )
419 bool reverse = ( U1 > Un );
420 GCPnts_AbscissaPoint Discret(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 if ( Abs(dUn) <= Precision::Confusion() )
429 double dU = Abs( Ul - *itU ); // parametric length of the last but one segment
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 GCPnts_AbscissaPoint Discret(theC3d, vertexLength, l);
601 if ( Discret.IsDone() ) {
603 theParameters.push_back( Discret.Parameter());
605 double L = GCPnts_AbscissaPoint::Length( theC3d, theParameters.back(), l);
606 if ( vertexLength < L / 2.0 )
607 theParameters.push_back( Discret.Parameter());
609 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
615 // recompute params between the last segment and a middle one.
616 // find size of a middle segment
617 int nHalf = ( nPar-1 ) / 2;
618 list< double >::reverse_iterator itU = theParameters.rbegin();
619 std::advance( itU, nHalf );
621 double Lm = GCPnts_AbscissaPoint::Length( theC3d, Um, *itU);
622 double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l);
623 static StdMeshers_Regular_1D* auxAlgo = 0;
625 auxAlgo = new StdMeshers_Regular_1D( _gen->GetANewId(), _studyId, _gen );
626 auxAlgo->_hypType = BEG_END_LENGTH;
628 auxAlgo->_value[ BEG_LENGTH_IND ] = Lm;
629 auxAlgo->_value[ END_LENGTH_IND ] = vertexLength;
630 double from = *itU, to = l;
632 std::swap( from, to );
633 std::swap( auxAlgo->_value[ BEG_LENGTH_IND ], auxAlgo->_value[ END_LENGTH_IND ]);
636 if ( auxAlgo->computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
638 if ( isEnd1 ) params.reverse();
639 while ( 1 + nHalf-- )
640 theParameters.pop_back();
641 theParameters.splice( theParameters.end(), params );
645 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
649 theParameters.reverse();
654 //=============================================================================
658 //=============================================================================
659 bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
660 Adaptor3d_Curve& theC3d,
664 list<double> & theParams,
665 const bool theReverse,
666 bool theConsiderPropagation)
670 double f = theFirstU, l = theLastU;
672 // Propagation Of Distribution
674 if ( !_mainEdge.IsNull() && _isPropagOfDistribution )
676 TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference!
677 _gen->Compute( theMesh, mainEdge, /*aShapeOnly=*/true, /*anUpward=*/true);
679 SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge );
681 return error("No mesh on the source edge of Propagation Of Distribution");
682 if ( smDS->NbNodes() < 1 )
683 return true; // 1 segment
685 map< double, const SMDS_MeshNode* > mainEdgeParamsOfNodes;
686 if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh,
687 mainEdgeParamsOfNodes, SMDSAbs_Edge ))
688 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 GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param );
712 if ( !Discret.IsDone() ) break;
713 param = Discret.Parameter();
714 theParams.push_back( param );
717 if ( nbParams != segLen.size()-1 )
718 return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segements");
720 compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ],
721 segLen[ theReverse ? 0 : segLen.size()-1 ],
722 f, l, theLength, theC3d, theParams, true );
735 if ( _hypType == MAX_LENGTH )
737 double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
739 nbseg = 1; // degenerated edge
740 eltSize = theLength / nbseg;
741 nbSegments = (int) nbseg;
743 else if ( _hypType == LOCAL_LENGTH )
745 // Local Length hypothesis
746 double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
749 bool isFound = false;
750 if (theConsiderPropagation && !_mainEdge.IsNull()) // propagated from some other edge
752 // Advanced processing to assure equal number of segments in case of Propagation
753 SMESH_subMesh* sm = theMesh.GetSubMeshContaining(_mainEdge);
755 bool computed = sm->IsMeshComputed();
757 if (sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
758 _gen->Compute( theMesh, _mainEdge, /*anUpward=*/true);
759 computed = sm->IsMeshComputed();
763 SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
764 int nb_segments = smds->NbElements();
765 if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
772 if (!isFound) // not found by meshed edge in the propagation chain, use precision
774 double aPrecision = _value[ PRECISION_IND ];
775 double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
776 if (nbseg_prec == (nbseg - 1)) nbseg--;
780 nbseg = 1; // degenerated edge
781 eltSize = theLength / nbseg;
782 nbSegments = (int) nbseg;
786 // Number Of Segments hypothesis
787 nbSegments = _ivalue[ NB_SEGMENTS_IND ];
788 if ( nbSegments < 1 ) return false;
789 if ( nbSegments == 1 ) return true;
791 switch (_ivalue[ DISTR_TYPE_IND ])
793 case StdMeshers_NumberOfSegments::DT_Scale:
795 double scale = _value[ SCALE_FACTOR_IND ];
797 if (fabs(scale - 1.0) < Precision::Confusion()) {
798 // special case to avoid division by zero
799 for (int i = 1; i < nbSegments; i++) {
800 double param = f + (l - f) * i / nbSegments;
801 theParams.push_back( param );
804 // general case of scale distribution
808 double alpha = pow(scale, 1.0 / (nbSegments - 1));
809 double factor = (l - f) / (1.0 - pow(alpha, nbSegments));
811 for (int i = 1; i < nbSegments; i++) {
812 double param = f + factor * (1.0 - pow(alpha, i));
813 theParams.push_back( param );
816 const double lenFactor = theLength/(l-f);
817 list<double>::iterator u = theParams.begin(), uEnd = theParams.end();
818 for ( ; u != uEnd; ++u )
820 GCPnts_AbscissaPoint Discret( theC3d, ((*u)-f) * lenFactor, f );
821 if ( Discret.IsDone() )
822 *u = Discret.Parameter();
827 case StdMeshers_NumberOfSegments::DT_TabFunc:
829 FunctionTable func(_vvalue[ TAB_FUNC_IND ], _ivalue[ CONV_MODE_IND ]);
830 return computeParamByFunc(theC3d, f, l, theLength, theReverse,
831 _ivalue[ NB_SEGMENTS_IND ], func,
835 case StdMeshers_NumberOfSegments::DT_ExprFunc:
837 FunctionExpr func(_svalue[ EXPR_FUNC_IND ].c_str(), _ivalue[ CONV_MODE_IND ]);
838 return computeParamByFunc(theC3d, f, l, theLength, theReverse,
839 _ivalue[ NB_SEGMENTS_IND ], func,
843 case StdMeshers_NumberOfSegments::DT_Regular:
844 eltSize = theLength / nbSegments;
850 GCPnts_UniformAbscissa Discret(theC3d, eltSize, f, l);
851 if ( !Discret.IsDone() )
852 return error( "GCPnts_UniformAbscissa failed");
854 int NbPoints = Min( Discret.NbPoints(), nbSegments + 1 );
855 for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points
857 double param = Discret.Parameter(i);
858 theParams.push_back( param );
860 compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams, true ); // for PAL9899
864 case BEG_END_LENGTH: {
866 // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength
868 double a1 = _value[ BEG_LENGTH_IND ];
869 double an = _value[ END_LENGTH_IND ];
870 double q = ( theLength - a1 ) / ( theLength - an );
871 if ( q < theLength/1e6 || 1.01*theLength < a1 + an)
872 return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
873 "for an edge of length "<<theLength);
875 double U1 = theReverse ? l : f;
876 double Un = theReverse ? f : l;
878 double eltSize = theReverse ? -a1 : a1;
880 // computes a point on a curve <theC3d> at the distance <eltSize>
881 // from the point of parameter <param>.
882 GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
883 if ( !Discret.IsDone() ) break;
884 param = Discret.Parameter();
885 if ( f < param && param < l )
886 theParams.push_back( param );
891 compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
892 if (theReverse) theParams.reverse(); // NPAL18025
896 case ARITHMETIC_1D: {
898 // arithmetic progression: SUM(n) = ( an - a1 + q ) * ( a1 + an ) / ( 2 * q ) = theLength
900 double a1 = _value[ BEG_LENGTH_IND ];
901 double an = _value[ END_LENGTH_IND ];
902 if ( 1.01*theLength < a1 + an)
903 return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
904 "for an edge of length "<<theLength);
906 double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
907 int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
909 double U1 = theReverse ? l : f;
910 double Un = theReverse ? f : l;
917 while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
918 // computes a point on a curve <theC3d> at the distance <eltSize>
919 // from the point of parameter <param>.
920 GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
921 if ( !Discret.IsDone() ) break;
922 param = Discret.Parameter();
923 if ( param > f && param < l )
924 theParams.push_back( param );
929 compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
930 if (theReverse) theParams.reverse(); // NPAL18025
937 double a1 = _value[ BEG_LENGTH_IND ], an;
938 double q = _value[ END_LENGTH_IND ];
940 double U1 = theReverse ? l : f;
941 double Un = theReverse ? f : l;
949 // computes a point on a curve <theC3d> at the distance <eltSize>
950 // from the point of parameter <param>.
951 GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
952 if ( !Discret.IsDone() ) break;
953 param = Discret.Parameter();
954 if ( f < param && param < l )
955 theParams.push_back( param );
964 if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() ))
966 compensateError( a1, Abs(eltSize), U1, Un, theLength, theC3d, theParams );
968 else if ( Abs( Un - theParams.back() ) <
969 0.2 * Abs( theParams.back() - *(++theParams.rbegin())))
971 theParams.pop_back();
972 compensateError( a1, Abs(an), U1, Un, theLength, theC3d, theParams );
975 if (theReverse) theParams.reverse(); // NPAL18025
980 case FIXED_POINTS_1D: {
981 const std::vector<double>& aPnts = _fpHyp->GetPoints();
982 const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
983 TColStd_SequenceOfReal Params;
984 for ( size_t i = 0; i < aPnts.size(); i++ )
986 if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
988 bool IsExist = false;
989 for(; j<=Params.Length(); j++) {
990 if( fabs(aPnts[i]-Params.Value(j)) < 1e-4 ) {
994 if( aPnts[i]<Params.Value(j) ) break;
996 if(!IsExist) Params.InsertBefore(j,aPnts[i]);
998 double par2, par1, lp;
1007 double eltSize, segmentSize = 0.;
1008 double currAbscissa = 0;
1009 for ( int i = 0; i < Params.Length(); i++ )
1011 int nbseg = ( i > (int)nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
1012 segmentSize = Params.Value(i+1)*theLength - currAbscissa;
1013 currAbscissa += segmentSize;
1014 GCPnts_AbscissaPoint APnt(theC3d, sign*segmentSize, par1);
1015 if( !APnt.IsDone() )
1016 return error( "GCPnts_AbscissaPoint failed");
1017 par2 = APnt.Parameter();
1018 eltSize = segmentSize/nbseg;
1019 GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, par2);
1021 Discret.Initialize(theC3d, eltSize, par2, par1);
1023 Discret.Initialize(theC3d, eltSize, par1, par2);
1024 if ( !Discret.IsDone() )
1025 return error( "GCPnts_UniformAbscissa failed");
1026 int NbPoints = Discret.NbPoints();
1027 list<double> tmpParams;
1028 for(int i=2; i<NbPoints; i++) {
1029 double param = Discret.Parameter(i);
1030 tmpParams.push_back( param );
1033 compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
1034 tmpParams.reverse();
1037 compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
1039 list<double>::iterator itP = tmpParams.begin();
1040 for(; itP != tmpParams.end(); itP++) {
1041 theParams.push_back( *(itP) );
1043 theParams.push_back( par2 );
1048 int nbseg = ( (int)nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
1049 segmentSize = theLength - currAbscissa;
1050 eltSize = segmentSize/nbseg;
1051 GCPnts_UniformAbscissa Discret;
1053 Discret.Initialize(theC3d, eltSize, par1, lp);
1055 Discret.Initialize(theC3d, eltSize, lp, par1);
1056 if ( !Discret.IsDone() )
1057 return error( "GCPnts_UniformAbscissa failed");
1058 int NbPoints = Discret.NbPoints();
1059 list<double> tmpParams;
1060 for(int i=2; i<NbPoints; i++) {
1061 double param = Discret.Parameter(i);
1062 tmpParams.push_back( param );
1065 compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams );
1066 tmpParams.reverse();
1069 compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams );
1071 list<double>::iterator itP = tmpParams.begin();
1072 for(; itP != tmpParams.end(); itP++) {
1073 theParams.push_back( *(itP) );
1077 theParams.reverse(); // NPAL18025
1084 GCPnts_UniformDeflection Discret(theC3d, _value[ DEFLECTION_IND ], f, l, true);
1085 if ( !Discret.IsDone() )
1088 int NbPoints = Discret.NbPoints();
1089 for ( int i = 2; i < NbPoints; i++ )
1091 double param = Discret.Parameter(i);
1092 theParams.push_back( param );
1103 //=============================================================================
1107 //=============================================================================
1109 bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
1111 if ( _hypType == NONE )
1114 if ( _hypType == ADAPTIVE )
1116 _adaptiveHyp->GetAlgo()->InitComputeError();
1117 _adaptiveHyp->GetAlgo()->Compute( theMesh, theShape );
1118 return error( _adaptiveHyp->GetAlgo()->GetComputeError() );
1121 SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
1123 const TopoDS_Edge & EE = TopoDS::Edge(theShape);
1124 TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
1125 int shapeID = meshDS->ShapeToIndex( E );
1128 Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
1130 TopoDS_Vertex VFirst, VLast;
1131 TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
1133 ASSERT(!VFirst.IsNull());
1134 ASSERT(!VLast.IsNull());
1135 const SMDS_MeshNode * idFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
1136 const SMDS_MeshNode * idLast = SMESH_Algo::VertexNode( VLast, meshDS );
1137 if (!idFirst || !idLast)
1138 return error( COMPERR_BAD_INPUT_MESH, "No node on vertex");
1140 // remove elements created by e.g. patern mapping (PAL21999)
1141 // CLEAN event is incorrectly ptopagated seemingly due to Propagation hyp
1142 // so TEMPORARY solution is to clean the submesh manually
1143 //theMesh.GetSubMesh(theShape)->ComputeStateEngine( SMESH_subMesh::CLEAN );
1144 if (SMESHDS_SubMesh * subMeshDS = meshDS->MeshElements(theShape))
1146 SMDS_ElemIteratorPtr ite = subMeshDS->GetElements();
1148 meshDS->RemoveFreeElement(ite->next(), subMeshDS);
1149 SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes();
1150 while (itn->more()) {
1151 const SMDS_MeshNode * node = itn->next();
1152 if ( node->NbInverseElements() == 0 )
1153 meshDS->RemoveFreeNode(node, subMeshDS);
1155 meshDS->RemoveNode(node);
1159 if (!Curve.IsNull())
1161 list< double > params;
1162 bool reversed = false;
1163 if ( theMesh.GetShapeToMesh().ShapeType() >= TopAbs_WIRE ) {
1164 // if the shape to mesh is WIRE or EDGE
1165 reversed = ( EE.Orientation() == TopAbs_REVERSED );
1167 if ( !_mainEdge.IsNull() ) {
1168 // take into account reversing the edge the hypothesis is propagated from
1169 // (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain)
1170 reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
1171 if ( !_isPropagOfDistribution ) {
1172 int mainID = meshDS->ShapeToIndex(_mainEdge);
1173 if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end())
1174 reversed = !reversed;
1177 // take into account this edge reversing
1178 if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), shapeID) != _revEdgesIDs.end())
1179 reversed = !reversed;
1181 BRepAdaptor_Curve C3d( E );
1182 double length = EdgeLength( E );
1183 if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) {
1186 redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
1188 // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
1189 // only internal nodes receive an edge position with param on curve
1191 const SMDS_MeshNode * idPrev = idFirst;
1204 for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++) {
1205 double param = *itU;
1206 gp_Pnt P = Curve->Value(param);
1208 //Add the Node in the DataStructure
1209 SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
1210 meshDS->SetNodeOnEdge(node, shapeID, param);
1212 if(_quadraticMesh) {
1213 // create medium node
1214 double prm = ( parPrev + param )/2;
1215 gp_Pnt PM = Curve->Value(prm);
1216 SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
1217 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1218 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
1219 meshDS->SetMeshElementOnShape(edge, shapeID);
1222 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
1223 meshDS->SetMeshElementOnShape(edge, shapeID);
1229 if(_quadraticMesh) {
1230 double prm = ( parPrev + parLast )/2;
1231 gp_Pnt PM = Curve->Value(prm);
1232 SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
1233 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1234 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
1235 meshDS->SetMeshElementOnShape(edge, shapeID);
1238 SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
1239 meshDS->SetMeshElementOnShape(edge, shapeID);
1244 //MESSAGE("************* Degenerated edge! *****************");
1246 // Edge is a degenerated Edge : We put n = 5 points on the edge.
1247 const int NbPoints = 5;
1248 BRep_Tool::Range( E, f, l ); // PAL15185
1249 double du = (l - f) / (NbPoints - 1);
1251 gp_Pnt P = BRep_Tool::Pnt(VFirst);
1253 const SMDS_MeshNode * idPrev = idFirst;
1254 for (int i = 2; i < NbPoints; i++) {
1255 double param = f + (i - 1) * du;
1256 SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
1257 if(_quadraticMesh) {
1258 // create medium node
1259 double prm = param - du/2.;
1260 SMDS_MeshNode * NM = meshDS->AddNode(P.X(), P.Y(), P.Z());
1261 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1262 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
1263 meshDS->SetMeshElementOnShape(edge, shapeID);
1266 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
1267 meshDS->SetMeshElementOnShape(edge, shapeID);
1269 meshDS->SetNodeOnEdge(node, shapeID, param);
1272 if(_quadraticMesh) {
1273 // create medium node
1274 double prm = l - du/2.;
1275 SMDS_MeshNode * NM = meshDS->AddNode(P.X(), P.Y(), P.Z());
1276 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1277 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
1278 meshDS->SetMeshElementOnShape(edge, shapeID);
1281 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
1282 meshDS->SetMeshElementOnShape(edge, shapeID);
1289 //=============================================================================
1293 //=============================================================================
1295 bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
1296 const TopoDS_Shape & theShape,
1297 MapShapeNbElems& aResMap)
1299 if ( _hypType == NONE )
1302 if ( _hypType == ADAPTIVE )
1304 _adaptiveHyp->GetAlgo()->InitComputeError();
1305 _adaptiveHyp->GetAlgo()->Evaluate( theMesh, theShape, aResMap );
1306 return error( _adaptiveHyp->GetAlgo()->GetComputeError() );
1309 const TopoDS_Edge & EE = TopoDS::Edge(theShape);
1310 TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
1313 Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
1315 TopoDS_Vertex VFirst, VLast;
1316 TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
1318 ASSERT(!VFirst.IsNull());
1319 ASSERT(!VLast.IsNull());
1321 std::vector<int> aVec(SMDSEntity_Last,0);
1323 if (!Curve.IsNull()) {
1324 list< double > params;
1326 BRepAdaptor_Curve C3d( E );
1327 double length = EdgeLength( E );
1328 if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, false, true )) {
1329 SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
1330 aResMap.insert(std::make_pair(sm,aVec));
1331 SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
1332 smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
1335 redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
1337 if(_quadraticMesh) {
1338 aVec[SMDSEntity_Node] = 2*params.size() + 1;
1339 aVec[SMDSEntity_Quad_Edge] = params.size() + 1;
1342 aVec[SMDSEntity_Node] = params.size();
1343 aVec[SMDSEntity_Edge] = params.size() + 1;
1348 //MESSAGE("************* Degenerated edge! *****************");
1349 // Edge is a degenerated Edge : We put n = 5 points on the edge.
1350 if(_quadraticMesh) {
1351 aVec[SMDSEntity_Node] = 11;
1352 aVec[SMDSEntity_Quad_Edge] = 6;
1355 aVec[SMDSEntity_Node] = 5;
1356 aVec[SMDSEntity_Edge] = 6;
1360 SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
1361 aResMap.insert(std::make_pair(sm,aVec));
1367 //=============================================================================
1369 * See comments in SMESH_Algo.cxx
1371 //=============================================================================
1373 const list <const SMESHDS_Hypothesis *> &
1374 StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
1375 const TopoDS_Shape & aShape,
1376 const bool ignoreAuxiliary)
1378 _usedHypList.clear();
1379 _mainEdge.Nullify();
1381 SMESH_HypoFilter auxiliaryFilter( SMESH_HypoFilter::IsAuxiliary() );
1382 const SMESH_HypoFilter* compatibleFilter = GetCompatibleHypoFilter(/*ignoreAux=*/true );
1384 // get non-auxiliary assigned directly to aShape
1385 int nbHyp = aMesh.GetHypotheses( aShape, *compatibleFilter, _usedHypList, false );
1387 if (nbHyp == 0 && aShape.ShapeType() == TopAbs_EDGE)
1389 // Check, if propagated from some other edge
1390 _mainEdge = StdMeshers_Propagation::GetPropagationSource( aMesh, aShape,
1391 _isPropagOfDistribution );
1392 if ( !_mainEdge.IsNull() )
1394 // Propagation of 1D hypothesis from <aMainEdge> on this edge;
1395 // get non-auxiliary assigned to _mainEdge
1396 nbHyp = aMesh.GetHypotheses( _mainEdge, *compatibleFilter, _usedHypList, true );
1400 if (nbHyp == 0) // nothing propagated nor assigned to aShape
1402 SMESH_Algo::GetUsedHypothesis( aMesh, aShape, ignoreAuxiliary );
1403 nbHyp = _usedHypList.size();
1407 // get auxiliary hyps from aShape
1408 aMesh.GetHypotheses( aShape, auxiliaryFilter, _usedHypList, true );
1410 if ( nbHyp > 1 && ignoreAuxiliary )
1411 _usedHypList.clear(); //only one compatible non-auxiliary hypothesis allowed
1413 return _usedHypList;
1416 //================================================================================
1418 * \brief Pass CancelCompute() to a child algorithm
1420 //================================================================================
1422 void StdMeshers_Regular_1D::CancelCompute()
1424 SMESH_Algo::CancelCompute();
1425 if ( _hypType == ADAPTIVE )
1426 _adaptiveHyp->GetAlgo()->CancelCompute();