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 "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,
82 :SMESH_1D_Algo( hypId, studyId, gen )
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 int nbPnt = 1 + nbSeg;
358 vector<double> x( nbPnt, 0. );
360 if ( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ))
363 // apply parameters in range [0,1] to the space of the curve
364 double prevU = first;
372 for ( int i = 1; i < nbSeg; i++ )
374 double curvLength = length * (x[i] - x[i-1]) * sign;
375 double tol = Min( Precision::Confusion(), curvLength / 100. );
376 GCPnts_AbscissaPoint Discret( tol, C3d, curvLength, prevU );
377 if ( !Discret.IsDone() )
379 double U = Discret.Parameter();
380 if ( U > first && U < last )
381 theParams.push_back( U );
392 //================================================================================
394 * \brief adjust internal node parameters so that the last segment length == an
395 * \param a1 - the first segment length
396 * \param an - the last segment length
397 * \param U1 - the first edge parameter
398 * \param Un - the last edge parameter
399 * \param length - the edge length
400 * \param C3d - the edge curve
401 * \param theParams - internal node parameters to adjust
402 * \param adjustNeighbors2an - to adjust length of segments next to the last one
403 * and not to remove parameters
405 //================================================================================
407 static void compensateError(double a1, double an,
408 double U1, double Un,
410 Adaptor3d_Curve& C3d,
411 list<double> & theParams,
412 bool adjustNeighbors2an = false)
414 int i, nPar = theParams.size();
415 if ( a1 + an <= length && nPar > 1 )
417 bool reverse = ( U1 > Un );
418 GCPnts_AbscissaPoint Discret(C3d, reverse ? an : -an, Un);
419 if ( !Discret.IsDone() )
421 double Utgt = Discret.Parameter(); // target value of the last parameter
422 list<double>::reverse_iterator itU = theParams.rbegin();
423 double Ul = *itU++; // real value of the last parameter
424 double dUn = Utgt - Ul; // parametric error of <an>
425 if ( Abs(dUn) <= Precision::Confusion() )
427 double dU = Abs( Ul - *itU ); // parametric length of the last but one segment
428 if ( adjustNeighbors2an || Abs(dUn) < 0.5 * dU ) { // last segment is a bit shorter than it should
429 // move the last parameter to the edge beginning
431 else { // last segment is much shorter than it should -> remove the last param and
432 theParams.pop_back(); nPar--; // move the rest points toward the edge end
433 dUn = Utgt - theParams.back();
436 if ( !adjustNeighbors2an )
438 double q = dUn / ( Utgt - Un ); // (signed) factor of segment length change
439 for ( itU = theParams.rbegin(), i = 1; i < nPar; i++ ) {
443 dUn = q * (*itU - prevU) * (prevU-U1)/(Un-U1);
446 else if ( nPar == 1 )
448 theParams.back() += dUn;
452 double q = dUn / ( nPar - 1 );
453 theParams.back() += dUn;
454 double sign = reverse ? -1 : 1;
455 double prevU = theParams.back();
456 itU = theParams.rbegin();
457 for ( ++itU, i = 2; i < nPar; ++itU, i++ ) {
458 double newU = *itU + dUn;
459 if ( newU*sign < prevU*sign ) {
463 else { // set U between prevU and next valid param
464 list<double>::reverse_iterator itU2 = itU;
467 while ( (*itU2)*sign > prevU*sign ) {
470 dU = ( *itU2 - prevU ) / nb;
471 while ( itU != itU2 ) {
481 //================================================================================
483 * \brief Class used to clean mesh on edges when 0D hyp modified.
484 * Common approach doesn't work when 0D algo is missing because the 0D hyp is
485 * considered as not participating in computation whereas it is used by 1D algo.
487 //================================================================================
489 // struct VertexEventListener : public SMESH_subMeshEventListener
491 // VertexEventListener():SMESH_subMeshEventListener(0) // won't be deleted by submesh
494 // * \brief Clean mesh on edges
495 // * \param event - algo_event or compute_event itself (of SMESH_subMesh)
496 // * \param eventType - ALGO_EVENT or COMPUTE_EVENT (of SMESH_subMesh)
497 // * \param subMesh - the submesh where the event occures
499 // void ProcessEvent(const int event, const int eventType, SMESH_subMesh* subMesh,
500 // EventListenerData*, const SMESH_Hypothesis*)
502 // if ( eventType == SMESH_subMesh::ALGO_EVENT) // all algo events
504 // subMesh->ComputeStateEngine( SMESH_subMesh::MODIF_ALGO_STATE );
507 // }; // struct VertexEventListener
509 //=============================================================================
511 * \brief Sets event listener to vertex submeshes
512 * \param subMesh - submesh where algo is set
514 * This method is called when a submesh gets HYP_OK algo_state.
515 * After being set, event listener is notified on each event of a submesh.
517 //=============================================================================
519 void StdMeshers_Regular_1D::SetEventListener(SMESH_subMesh* subMesh)
521 StdMeshers_Propagation::SetPropagationMgr( subMesh );
524 //=============================================================================
527 * \param subMesh - restored submesh
529 * This method is called only if a submesh has HYP_OK algo_state.
531 //=============================================================================
533 void StdMeshers_Regular_1D::SubmeshRestored(SMESH_subMesh* subMesh)
537 //=============================================================================
539 * \brief Return StdMeshers_SegmentLengthAroundVertex assigned to vertex
541 //=============================================================================
543 const StdMeshers_SegmentLengthAroundVertex*
544 StdMeshers_Regular_1D::getVertexHyp(SMESH_Mesh & theMesh,
545 const TopoDS_Vertex & theV)
547 static SMESH_HypoFilter filter( SMESH_HypoFilter::HasName("SegmentAroundVertex_0D"));
548 if ( const SMESH_Hypothesis * h = theMesh.GetHypothesis( theV, filter, true ))
550 SMESH_Algo* algo = const_cast< SMESH_Algo* >( static_cast< const SMESH_Algo* > ( h ));
551 const list <const SMESHDS_Hypothesis *> & hypList = algo->GetUsedHypothesis( theMesh, theV, 0 );
552 if ( !hypList.empty() && string("SegmentLengthAroundVertex") == hypList.front()->GetName() )
553 return static_cast<const StdMeshers_SegmentLengthAroundVertex*>( hypList.front() );
558 //================================================================================
560 * \brief Tune parameters to fit "SegmentLengthAroundVertex" hypothesis
561 * \param theC3d - wire curve
562 * \param theLength - curve length
563 * \param theParameters - internal nodes parameters to modify
564 * \param theVf - 1st vertex
565 * \param theVl - 2nd vertex
567 //================================================================================
569 void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theMesh,
570 Adaptor3d_Curve & theC3d,
572 std::list< double > & theParameters,
573 const TopoDS_Vertex & theVf,
574 const TopoDS_Vertex & theVl)
576 double f = theC3d.FirstParameter(), l = theC3d.LastParameter();
577 int nPar = theParameters.size();
578 for ( int isEnd1 = 0; isEnd1 < 2; ++isEnd1 )
580 const TopoDS_Vertex & V = isEnd1 ? theVf : theVl;
581 const StdMeshers_SegmentLengthAroundVertex* hyp = getVertexHyp (theMesh, V );
583 double vertexLength = hyp->GetLength();
584 if ( vertexLength > theLength / 2.0 )
586 if ( isEnd1 ) { // to have a segment of interest at end of theParameters
587 theParameters.reverse();
590 if ( _hypType == NB_SEGMENTS )
592 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
594 else if ( nPar <= 3 )
597 vertexLength = -vertexLength;
598 GCPnts_AbscissaPoint Discret(theC3d, vertexLength, l);
599 if ( Discret.IsDone() ) {
601 theParameters.push_back( Discret.Parameter());
603 double L = GCPnts_AbscissaPoint::Length( theC3d, theParameters.back(), l);
604 if ( vertexLength < L / 2.0 )
605 theParameters.push_back( Discret.Parameter());
607 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
613 // recompute params between the last segment and a middle one.
614 // find size of a middle segment
615 int nHalf = ( nPar-1 ) / 2;
616 list< double >::reverse_iterator itU = theParameters.rbegin();
617 std::advance( itU, nHalf );
619 double Lm = GCPnts_AbscissaPoint::Length( theC3d, Um, *itU);
620 double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l);
621 static StdMeshers_Regular_1D* auxAlgo = 0;
623 auxAlgo = new StdMeshers_Regular_1D( _gen->GetANewId(), _studyId, _gen );
624 auxAlgo->_hypType = BEG_END_LENGTH;
626 auxAlgo->_value[ BEG_LENGTH_IND ] = Lm;
627 auxAlgo->_value[ END_LENGTH_IND ] = vertexLength;
628 double from = *itU, to = l;
630 std::swap( from, to );
631 std::swap( auxAlgo->_value[ BEG_LENGTH_IND ], auxAlgo->_value[ END_LENGTH_IND ]);
634 if ( auxAlgo->computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
636 if ( isEnd1 ) params.reverse();
637 while ( 1 + nHalf-- )
638 theParameters.pop_back();
639 theParameters.splice( theParameters.end(), params );
643 compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
647 theParameters.reverse();
652 //=============================================================================
656 //=============================================================================
657 bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
658 Adaptor3d_Curve& theC3d,
662 list<double> & theParams,
663 const bool theReverse,
664 bool theConsiderPropagation)
668 double f = theFirstU, l = theLastU;
670 // Propagation Of Distribution
672 if ( !_mainEdge.IsNull() && _isPropagOfDistribution )
674 TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference!
675 _gen->Compute( theMesh, mainEdge, /*aShapeOnly=*/true, /*anUpward=*/true);
677 SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge );
679 return error("No mesh on the source edge of Propagation Of Distribution");
680 if ( smDS->NbNodes() < 1 )
681 return true; // 1 segment
683 map< double, const SMDS_MeshNode* > mainEdgeParamsOfNodes;
684 if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh,
685 mainEdgeParamsOfNodes, SMDSAbs_Edge ))
686 return error("Bad node parameters on the source edge of Propagation Of Distribution");
687 vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 );
689 BRepAdaptor_Curve mainEdgeCurve( mainEdge );
690 map< double, const SMDS_MeshNode* >::iterator
691 u_n2 = mainEdgeParamsOfNodes.begin(), u_n1 = u_n2++;
692 for ( size_t i = 1; i < mainEdgeParamsOfNodes.size(); ++i, ++u_n1, ++u_n2 )
694 segLen[ i-1 ] = GCPnts_AbscissaPoint::Length( mainEdgeCurve,
697 totalLen += segLen[ i-1 ];
699 for ( size_t i = 0; i < segLen.size(); ++i )
700 segLen[ i ] *= theLength / totalLen;
702 size_t iSeg = theReverse ? segLen.size()-1 : 0;
703 size_t dSeg = theReverse ? -1 : +1;
704 double param = theFirstU;
706 for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
708 GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param );
709 if ( !Discret.IsDone() ) break;
710 param = Discret.Parameter();
711 theParams.push_back( param );
714 if ( nbParams != segLen.size()-1 )
715 return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segments");
717 compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ],
718 segLen[ theReverse ? 0 : segLen.size()-1 ],
719 f, l, theLength, theC3d, theParams, true );
732 if ( _hypType == MAX_LENGTH )
734 double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
736 nbseg = 1; // degenerated edge
737 eltSize = theLength / nbseg;
738 nbSegments = (int) nbseg;
740 else if ( _hypType == LOCAL_LENGTH )
742 // Local Length hypothesis
743 double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
746 bool isFound = false;
747 if (theConsiderPropagation && !_mainEdge.IsNull()) // propagated from some other edge
749 // Advanced processing to assure equal number of segments in case of Propagation
750 SMESH_subMesh* sm = theMesh.GetSubMeshContaining(_mainEdge);
752 bool computed = sm->IsMeshComputed();
754 if (sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
755 _gen->Compute( theMesh, _mainEdge, /*anUpward=*/true);
756 computed = sm->IsMeshComputed();
760 SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
761 int nb_segments = smds->NbElements();
762 if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
769 if (!isFound) // not found by meshed edge in the propagation chain, use precision
771 double aPrecision = _value[ PRECISION_IND ];
772 double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
773 if (nbseg_prec == (nbseg - 1)) nbseg--;
777 nbseg = 1; // degenerated edge
778 eltSize = theLength / nbseg;
779 nbSegments = (int) nbseg;
783 // Number Of Segments hypothesis
784 nbSegments = _ivalue[ NB_SEGMENTS_IND ];
785 if ( nbSegments < 1 ) return false;
786 if ( nbSegments == 1 ) return true;
788 switch (_ivalue[ DISTR_TYPE_IND ])
790 case StdMeshers_NumberOfSegments::DT_Scale:
792 double scale = _value[ SCALE_FACTOR_IND ];
794 if (fabs(scale - 1.0) < Precision::Confusion()) {
795 // special case to avoid division by zero
796 for (int i = 1; i < nbSegments; i++) {
797 double param = f + (l - f) * i / nbSegments;
798 theParams.push_back( param );
801 // general case of scale distribution
805 double alpha = pow(scale, 1.0 / (nbSegments - 1));
806 double factor = (l - f) / (1.0 - pow(alpha, nbSegments));
808 for (int i = 1; i < nbSegments; i++) {
809 double param = f + factor * (1.0 - pow(alpha, i));
810 theParams.push_back( param );
813 const double lenFactor = theLength/(l-f);
814 list<double>::iterator u = theParams.begin(), uEnd = theParams.end();
815 for ( ; u != uEnd; ++u )
817 GCPnts_AbscissaPoint Discret( theC3d, ((*u)-f) * lenFactor, f );
818 if ( Discret.IsDone() )
819 *u = Discret.Parameter();
824 case StdMeshers_NumberOfSegments::DT_TabFunc:
826 FunctionTable func(_vvalue[ TAB_FUNC_IND ], _ivalue[ CONV_MODE_IND ]);
827 return computeParamByFunc(theC3d, f, l, theLength, theReverse,
828 _ivalue[ NB_SEGMENTS_IND ], func,
832 case StdMeshers_NumberOfSegments::DT_ExprFunc:
834 FunctionExpr func(_svalue[ EXPR_FUNC_IND ].c_str(), _ivalue[ CONV_MODE_IND ]);
835 return computeParamByFunc(theC3d, f, l, theLength, theReverse,
836 _ivalue[ NB_SEGMENTS_IND ], func,
840 case StdMeshers_NumberOfSegments::DT_Regular:
841 eltSize = theLength / nbSegments;
847 GCPnts_UniformAbscissa Discret(theC3d, eltSize, f, l);
848 if ( !Discret.IsDone() )
849 return error( "GCPnts_UniformAbscissa failed");
851 int NbPoints = Min( Discret.NbPoints(), nbSegments + 1 );
852 for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points
854 double param = Discret.Parameter(i);
855 theParams.push_back( param );
857 compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams, true ); // for PAL9899
861 case BEG_END_LENGTH: {
863 // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength
865 double a1 = _value[ BEG_LENGTH_IND ];
866 double an = _value[ END_LENGTH_IND ];
867 double q = ( theLength - a1 ) / ( theLength - an );
868 if ( q < theLength/1e6 || 1.01*theLength < a1 + an)
869 return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
870 "for an edge of length "<<theLength);
872 double U1 = theReverse ? l : f;
873 double Un = theReverse ? f : l;
875 double eltSize = theReverse ? -a1 : a1;
877 // computes a point on a curve <theC3d> at the distance <eltSize>
878 // from the point of parameter <param>.
879 GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
880 if ( !Discret.IsDone() ) break;
881 param = Discret.Parameter();
882 if ( f < param && param < l )
883 theParams.push_back( param );
888 compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
889 if (theReverse) theParams.reverse(); // NPAL18025
895 // arithmetic progression: SUM(n) = ( an - a1 + q ) * ( a1 + an ) / ( 2 * q ) = theLength
897 double a1 = _value[ BEG_LENGTH_IND ];
898 double an = _value[ END_LENGTH_IND ];
899 if ( 1.01*theLength < a1 + an )
900 return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
901 "for an edge of length "<<theLength);
903 double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
904 int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
906 double U1 = theReverse ? l : f;
907 double Un = theReverse ? f : l;
914 while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
915 // computes a point on a curve <theC3d> at the distance <eltSize>
916 // from the point of parameter <param>.
917 GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
918 if ( !Discret.IsDone() ) break;
919 param = Discret.Parameter();
920 if ( param > f && param < l )
921 theParams.push_back( param );
926 compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
927 if ( theReverse ) theParams.reverse(); // NPAL18025
934 double a1 = _value[ BEG_LENGTH_IND ], an;
935 double q = _value[ END_LENGTH_IND ];
937 double U1 = theReverse ? l : f;
938 double Un = theReverse ? f : l;
946 // computes a point on a curve <theC3d> at the distance <eltSize>
947 // from the point of parameter <param>.
948 GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
949 if ( !Discret.IsDone() ) break;
950 param = Discret.Parameter();
951 if ( f < param && param < l )
952 theParams.push_back( param );
961 if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() ))
963 compensateError( a1, Abs(eltSize), U1, Un, theLength, theC3d, theParams );
965 else if ( Abs( Un - theParams.back() ) <
966 0.2 * Abs( theParams.back() - *(++theParams.rbegin())))
968 theParams.pop_back();
969 compensateError( a1, Abs(an), U1, Un, theLength, theC3d, theParams );
972 if (theReverse) theParams.reverse(); // NPAL18025
977 case FIXED_POINTS_1D:
979 const std::vector<double>& aPnts = _fpHyp->GetPoints();
980 const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
981 TColStd_SequenceOfReal Params;
982 for ( size_t i = 0; i < aPnts.size(); i++ )
984 if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
986 bool IsExist = false;
987 for ( ; j <= Params.Length(); j++ ) {
988 if ( Abs( aPnts[i] - Params.Value(j) ) < 1e-4 ) {
992 if ( aPnts[i]<Params.Value(j) ) break;
994 if ( !IsExist ) Params.InsertBefore( j, aPnts[i] );
996 double par2, par1, lp;
1005 double eltSize, segmentSize = 0.;
1006 double currAbscissa = 0;
1007 for ( int i = 0; i < Params.Length(); i++ )
1009 int nbseg = ( i > (int)nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
1010 segmentSize = Params.Value( i+1 ) * theLength - currAbscissa;
1011 currAbscissa += segmentSize;
1012 GCPnts_AbscissaPoint APnt( theC3d, sign*segmentSize, par1 );
1013 if ( !APnt.IsDone() )
1014 return error( "GCPnts_AbscissaPoint failed");
1015 par2 = APnt.Parameter();
1016 eltSize = segmentSize/nbseg;
1017 GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2 );
1019 Discret.Initialize( theC3d, eltSize, par2, par1 );
1021 Discret.Initialize( theC3d, eltSize, par1, par2 );
1022 if ( !Discret.IsDone() )
1023 return error( "GCPnts_UniformAbscissa failed");
1024 int NbPoints = Discret.NbPoints();
1025 list<double> tmpParams;
1026 for ( int i = 2; i < NbPoints; i++ ) {
1027 double param = Discret.Parameter(i);
1028 tmpParams.push_back( param );
1031 compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
1032 tmpParams.reverse();
1035 compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
1037 theParams.splice( theParams.end(), tmpParams );
1038 theParams.push_back( par2 );
1043 int nbseg = ( (int)nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
1044 segmentSize = theLength - currAbscissa;
1045 eltSize = segmentSize/nbseg;
1046 GCPnts_UniformAbscissa Discret;
1048 Discret.Initialize( theC3d, eltSize, par1, lp );
1050 Discret.Initialize( theC3d, eltSize, lp, par1 );
1051 if ( !Discret.IsDone() )
1052 return error( "GCPnts_UniformAbscissa failed");
1053 int NbPoints = Discret.NbPoints();
1054 list<double> tmpParams;
1055 for ( int i = 2; i < NbPoints; i++ ) {
1056 double param = Discret.Parameter(i);
1057 tmpParams.push_back( param );
1060 compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams );
1061 tmpParams.reverse();
1064 compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams );
1066 theParams.splice( theParams.end(), tmpParams );
1069 theParams.reverse(); // NPAL18025
1076 GCPnts_UniformDeflection Discret( theC3d, _value[ DEFLECTION_IND ], f, l, true );
1077 if ( !Discret.IsDone() )
1080 int NbPoints = Discret.NbPoints();
1081 for ( int i = 2; i < NbPoints; i++ )
1083 double param = Discret.Parameter(i);
1084 theParams.push_back( param );
1095 //=============================================================================
1099 //=============================================================================
1101 bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
1103 if ( _hypType == NONE )
1106 if ( _hypType == ADAPTIVE )
1108 _adaptiveHyp->GetAlgo()->InitComputeError();
1109 _adaptiveHyp->GetAlgo()->Compute( theMesh, theShape );
1110 return error( _adaptiveHyp->GetAlgo()->GetComputeError() );
1113 SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
1115 const TopoDS_Edge & EE = TopoDS::Edge(theShape);
1116 TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
1117 int shapeID = meshDS->ShapeToIndex( E );
1120 Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
1122 TopoDS_Vertex VFirst, VLast;
1123 TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
1125 ASSERT(!VFirst.IsNull());
1126 ASSERT(!VLast.IsNull());
1127 const SMDS_MeshNode * idFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
1128 const SMDS_MeshNode * idLast = SMESH_Algo::VertexNode( VLast, meshDS );
1129 if (!idFirst || !idLast)
1130 return error( COMPERR_BAD_INPUT_MESH, "No node on vertex");
1132 // remove elements created by e.g. patern mapping (PAL21999)
1133 // CLEAN event is incorrectly ptopagated seemingly due to Propagation hyp
1134 // so TEMPORARY solution is to clean the submesh manually
1135 //theMesh.GetSubMesh(theShape)->ComputeStateEngine( SMESH_subMesh::CLEAN );
1136 if (SMESHDS_SubMesh * subMeshDS = meshDS->MeshElements(theShape))
1138 SMDS_ElemIteratorPtr ite = subMeshDS->GetElements();
1140 meshDS->RemoveFreeElement(ite->next(), subMeshDS);
1141 SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes();
1142 while (itn->more()) {
1143 const SMDS_MeshNode * node = itn->next();
1144 if ( node->NbInverseElements() == 0 )
1145 meshDS->RemoveFreeNode(node, subMeshDS);
1147 meshDS->RemoveNode(node);
1151 if (!Curve.IsNull())
1153 list< double > params;
1154 bool reversed = false;
1155 if ( theMesh.GetShapeToMesh().ShapeType() >= TopAbs_WIRE ) {
1156 // if the shape to mesh is WIRE or EDGE
1157 reversed = ( EE.Orientation() == TopAbs_REVERSED );
1159 if ( !_mainEdge.IsNull() ) {
1160 // take into account reversing the edge the hypothesis is propagated from
1161 // (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain)
1162 reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
1163 if ( !_isPropagOfDistribution ) {
1164 int mainID = meshDS->ShapeToIndex(_mainEdge);
1165 if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end())
1166 reversed = !reversed;
1169 // take into account this edge reversing
1170 if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), shapeID) != _revEdgesIDs.end())
1171 reversed = !reversed;
1173 BRepAdaptor_Curve C3d( E );
1174 double length = EdgeLength( E );
1175 if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) {
1178 redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
1180 // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
1181 // only internal nodes receive an edge position with param on curve
1183 const SMDS_MeshNode * idPrev = idFirst;
1196 for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++) {
1197 double param = *itU;
1198 gp_Pnt P = Curve->Value(param);
1200 //Add the Node in the DataStructure
1201 SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
1202 meshDS->SetNodeOnEdge(node, shapeID, param);
1204 if(_quadraticMesh) {
1205 // create medium node
1206 double prm = ( parPrev + param )/2;
1207 gp_Pnt PM = Curve->Value(prm);
1208 SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
1209 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1210 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
1211 meshDS->SetMeshElementOnShape(edge, shapeID);
1214 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
1215 meshDS->SetMeshElementOnShape(edge, shapeID);
1221 if(_quadraticMesh) {
1222 double prm = ( parPrev + parLast )/2;
1223 gp_Pnt PM = Curve->Value(prm);
1224 SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
1225 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1226 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
1227 meshDS->SetMeshElementOnShape(edge, shapeID);
1230 SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
1231 meshDS->SetMeshElementOnShape(edge, shapeID);
1236 // Edge is a degenerated Edge : We put n = 5 points on the edge.
1237 const int NbPoints = 5;
1238 BRep_Tool::Range( E, f, l ); // PAL15185
1239 double du = (l - f) / (NbPoints - 1);
1241 gp_Pnt P = BRep_Tool::Pnt(VFirst);
1243 const SMDS_MeshNode * idPrev = idFirst;
1244 for (int i = 2; i < NbPoints; i++) {
1245 double param = f + (i - 1) * du;
1246 SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
1247 if(_quadraticMesh) {
1248 // create medium node
1249 double prm = param - du/2.;
1250 SMDS_MeshNode * NM = meshDS->AddNode(P.X(), P.Y(), P.Z());
1251 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1252 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
1253 meshDS->SetMeshElementOnShape(edge, shapeID);
1256 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
1257 meshDS->SetMeshElementOnShape(edge, shapeID);
1259 meshDS->SetNodeOnEdge(node, shapeID, param);
1262 if(_quadraticMesh) {
1263 // create medium node
1264 double prm = l - du/2.;
1265 SMDS_MeshNode * NM = meshDS->AddNode(P.X(), P.Y(), P.Z());
1266 meshDS->SetNodeOnEdge(NM, shapeID, prm);
1267 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
1268 meshDS->SetMeshElementOnShape(edge, shapeID);
1271 SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
1272 meshDS->SetMeshElementOnShape(edge, shapeID);
1279 //=============================================================================
1283 //=============================================================================
1285 bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
1286 const TopoDS_Shape & theShape,
1287 MapShapeNbElems& aResMap)
1289 if ( _hypType == NONE )
1292 if ( _hypType == ADAPTIVE )
1294 _adaptiveHyp->GetAlgo()->InitComputeError();
1295 _adaptiveHyp->GetAlgo()->Evaluate( theMesh, theShape, aResMap );
1296 return error( _adaptiveHyp->GetAlgo()->GetComputeError() );
1299 const TopoDS_Edge & EE = TopoDS::Edge(theShape);
1300 TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
1303 Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
1305 TopoDS_Vertex VFirst, VLast;
1306 TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l
1308 ASSERT(!VFirst.IsNull());
1309 ASSERT(!VLast.IsNull());
1311 std::vector<int> aVec(SMDSEntity_Last,0);
1313 if (!Curve.IsNull()) {
1314 list< double > params;
1316 BRepAdaptor_Curve C3d( E );
1317 double length = EdgeLength( E );
1318 if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, false, true )) {
1319 SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
1320 aResMap.insert(std::make_pair(sm,aVec));
1321 SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
1322 smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
1325 redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
1327 if(_quadraticMesh) {
1328 aVec[SMDSEntity_Node] = 2*params.size() + 1;
1329 aVec[SMDSEntity_Quad_Edge] = params.size() + 1;
1332 aVec[SMDSEntity_Node] = params.size();
1333 aVec[SMDSEntity_Edge] = params.size() + 1;
1338 // Edge is a degenerated Edge : We put n = 5 points on the edge.
1339 if ( _quadraticMesh ) {
1340 aVec[SMDSEntity_Node] = 11;
1341 aVec[SMDSEntity_Quad_Edge] = 6;
1344 aVec[SMDSEntity_Node] = 5;
1345 aVec[SMDSEntity_Edge] = 6;
1349 SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
1350 aResMap.insert(std::make_pair(sm,aVec));
1356 //=============================================================================
1358 * See comments in SMESH_Algo.cxx
1360 //=============================================================================
1362 const list <const SMESHDS_Hypothesis *> &
1363 StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
1364 const TopoDS_Shape & aShape,
1365 const bool ignoreAuxiliary)
1367 _usedHypList.clear();
1368 _mainEdge.Nullify();
1370 SMESH_HypoFilter auxiliaryFilter( SMESH_HypoFilter::IsAuxiliary() );
1371 const SMESH_HypoFilter* compatibleFilter = GetCompatibleHypoFilter(/*ignoreAux=*/true );
1373 // get non-auxiliary assigned directly to aShape
1374 int nbHyp = aMesh.GetHypotheses( aShape, *compatibleFilter, _usedHypList, false );
1376 if (nbHyp == 0 && aShape.ShapeType() == TopAbs_EDGE)
1378 // Check, if propagated from some other edge
1379 _mainEdge = StdMeshers_Propagation::GetPropagationSource( aMesh, aShape,
1380 _isPropagOfDistribution );
1381 if ( !_mainEdge.IsNull() )
1383 // Propagation of 1D hypothesis from <aMainEdge> on this edge;
1384 // get non-auxiliary assigned to _mainEdge
1385 nbHyp = aMesh.GetHypotheses( _mainEdge, *compatibleFilter, _usedHypList, true );
1389 if (nbHyp == 0) // nothing propagated nor assigned to aShape
1391 SMESH_Algo::GetUsedHypothesis( aMesh, aShape, ignoreAuxiliary );
1392 nbHyp = _usedHypList.size();
1396 // get auxiliary hyps from aShape
1397 aMesh.GetHypotheses( aShape, auxiliaryFilter, _usedHypList, true );
1399 if ( nbHyp > 1 && ignoreAuxiliary )
1400 _usedHypList.clear(); //only one compatible non-auxiliary hypothesis allowed
1402 return _usedHypList;
1405 //================================================================================
1407 * \brief Pass CancelCompute() to a child algorithm
1409 //================================================================================
1411 void StdMeshers_Regular_1D::CancelCompute()
1413 SMESH_Algo::CancelCompute();
1414 if ( _hypType == ADAPTIVE )
1415 _adaptiveHyp->GetAlgo()->CancelCompute();