+ // Propagation Of Distribution
+ //
+ if ( !_mainEdge.IsNull() && _hypType == DISTRIB_PROPAGATION )
+ {
+ TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference!
+ _gen->Compute( theMesh, mainEdge, SMESH_Gen::SHAPE_ONLY_UPWARD );
+
+ SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge );
+ if ( !smDS )
+ return error("No mesh on the source edge of Propagation Of Distribution");
+ if ( smDS->NbNodes() < 1 )
+ return true; // 1 segment
+
+ map< double, const SMDS_MeshNode* > mainEdgeParamsOfNodes;
+ if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh,
+ mainEdgeParamsOfNodes, SMDSAbs_Edge ))
+ return error("Bad node parameters on the source edge of Propagation Of Distribution");
+ vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 );
+ double totalLen = 0;
+ BRepAdaptor_Curve mainEdgeCurve( mainEdge );
+ map< double, const SMDS_MeshNode* >::iterator
+ u_n2 = mainEdgeParamsOfNodes.begin(), u_n1 = u_n2++;
+ for ( size_t i = 1; i < mainEdgeParamsOfNodes.size(); ++i, ++u_n1, ++u_n2 )
+ {
+ segLen[ i-1 ] = GCPnts_AbscissaPoint::Length( mainEdgeCurve,
+ u_n1->first,
+ u_n2->first);
+ totalLen += segLen[ i-1 ];
+ }
+ for ( size_t i = 0; i < segLen.size(); ++i )
+ segLen[ i ] *= theLength / totalLen;
+
+ size_t iSeg = theReverse ? segLen.size()-1 : 0;
+ size_t dSeg = theReverse ? -1 : +1;
+ double param = theFirstU;
+ size_t nbParams = 0;
+ for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
+ {
+ double tol = Min( Precision::Confusion(), 0.01 * segLen[ iSeg ]);
+ GCPnts_AbscissaPoint Discret( tol, theC3d, segLen[ iSeg ], param );
+ if ( !Discret.IsDone() ) break;
+ param = Discret.Parameter();
+ theParams.push_back( param );
+ ++nbParams;
+ }
+ if ( nbParams != segLen.size()-1 )
+ return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segments");
+
+ compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ],
+ segLen[ theReverse ? 0 : segLen.size()-1 ],
+ f, l, theLength, theC3d, theParams, true );
+ return true;
+ }
+
+