const StdMeshers_LocalLength * hyp =
dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
ASSERT(hyp);
- _value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength();
+ //_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength();
+ _value[ BEG_LENGTH_IND ] = hyp->GetLength();
+ _value[ END_LENGTH_IND ] = hyp->GetPrecision();
ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
_hypType = LOCAL_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK;
StdMeshers_AutomaticLength * hyp = const_cast<StdMeshers_AutomaticLength *>
(dynamic_cast <const StdMeshers_AutomaticLength * >(theHyp));
ASSERT(hyp);
- _value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
+ //_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
+ _value[ BEG_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
+ _value[ END_LENGTH_IND ] = Precision::Confusion(); // ?? or set to zero?
ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
_hypType = LOCAL_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK;
std::swap( algo._value[ BEG_LENGTH_IND ], algo._value[ END_LENGTH_IND ]);
}
list<double> params;
- if ( algo.computeInternalParameters( theC3d, L, from, to, params, false ))
+ if ( algo.computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
{
if ( isEnd1 ) params.reverse();
while ( 1 + nHalf-- )
*
*/
//=============================================================================
-bool StdMeshers_Regular_1D::computeInternalParameters(Adaptor3d_Curve& theC3d,
+bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
+ Adaptor3d_Curve& theC3d,
double theLength,
double theFirstU,
double theLastU,
list<double> & theParams,
- const bool theReverse)
+ const bool theReverse,
+ bool theConsiderPropagation)
{
theParams.clear();
{
// Local Length hypothesis
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
+
+ // NPAL17873:
+ bool isFound = false;
+ if (theConsiderPropagation && !_mainEdge.IsNull()) // propagated from some other edge
+ {
+ // Advanced processing to assure equal number of segments in case of Propagation
+ SMESH_subMesh* sm = theMesh.GetSubMeshContaining(_mainEdge);
+ if (sm) {
+ bool computed = sm->IsMeshComputed();
+ if (!computed) {
+ if (sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
+ sm->ComputeStateEngine(SMESH_subMesh::COMPUTE);
+ computed = sm->IsMeshComputed();
+ }
+ }
+ if (computed) {
+ SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
+ int nb_segments = smds->NbElements();
+ if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
+ isFound = true;
+ nbseg = nb_segments;
+ }
+ }
+ }
+ }
+ if (!isFound) // not found by meshed edge in the propagation chain, use precision
+ {
+ double aPrecision = _value[ END_LENGTH_IND ];
+ double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
+ if (nbseg_prec == (nbseg - 1)) nbseg--;
+ }
+
if (nbseg <= 0)
nbseg = 1; // degenerated edge
eltSize = theLength / nbseg;
*/
//=============================================================================
-bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
+bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
{
if ( _hypType == NONE )
return false;
- SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+ SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
- const TopoDS_Edge & EE = TopoDS::Edge(aShape);
+ const TopoDS_Edge & EE = TopoDS::Edge(theShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
int shapeID = meshDS->ShapeToIndex( E );
BRepAdaptor_Curve C3d( E );
double length = EdgeLength( E );
- if ( ! computeInternalParameters( C3d, length, f, l, params, reversed )) {
+ if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed )) {
return false;
}
- redistributeNearVertices( aMesh, C3d, length, params, VFirst, VLast );
+ redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
// edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
// only internal nodes receive an edge position with param on curve