Restoring Regular 1D

This commit is contained in:
Yoann Audouin 2022-09-21 15:26:59 +02:00
parent cb2ccde589
commit f3fc21d3b2

View File

@ -126,22 +126,14 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh,
_onlyUnaryInput = true; _onlyUnaryInput = true;
// check propagation in a redefined GetUsedHypothesis() // check propagation in a redefined GetUsedHypothesis()
const list <const SMESHDS_Hypothesis * > hyps = const list <const SMESHDS_Hypothesis * > & hyps =
GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliaryHyps=*/false); GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliaryHyps=*/false);
const SMESH_HypoFilter & propagFilter = StdMeshers_Propagation::GetFilter(); const SMESH_HypoFilter & propagFilter = StdMeshers_Propagation::GetFilter();
// find non-auxiliary hypothesis // find non-auxiliary hypothesis
const SMESHDS_Hypothesis *theHyp = 0; const SMESHDS_Hypothesis *theHyp = 0;
set< string > propagTypes; set< string > propagTypes;
//std::cout << "For shape " << aShape.HashCode(1) << " of type "<< aShape.ShapeType() <<
// "CheckHypothesis" << std::endl;
// for(auto hyp:hyps){
// SMESH_Comment hypStr;
// hypStr << hyp << " " << hyp->GetName() << " ";
// ((SMESHDS_Hypothesis*)hyp)->SaveTo( hypStr.Stream() );
// hypStr << " ";
// std::cout << hypStr << std::endl;
// }
list <const SMESHDS_Hypothesis * >::const_iterator h = hyps.begin(); list <const SMESHDS_Hypothesis * >::const_iterator h = hyps.begin();
for ( ; h != hyps.end(); ++h ) { for ( ; h != hyps.end(); ++h ) {
if ( static_cast<const SMESH_Hypothesis*>(*h)->IsAuxiliary() ) { if ( static_cast<const SMESH_Hypothesis*>(*h)->IsAuxiliary() ) {
@ -856,12 +848,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
{ {
// Number Of Segments hypothesis // Number Of Segments hypothesis
nbSegments = _ivalue[ NB_SEGMENTS_IND ]; nbSegments = _ivalue[ NB_SEGMENTS_IND ];
if ( nbSegments < 1 ) { if ( nbSegments < 1 ) return false;
return false; if ( nbSegments == 1 ) return true;
}
if ( nbSegments == 1 ) {
return true;
}
switch (_ivalue[ DISTR_TYPE_IND ]) switch (_ivalue[ DISTR_TYPE_IND ])
{ {
@ -1182,16 +1170,10 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape) bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
{ {
SMESH_Hypothesis::Hypothesis_Status hyp_status; if ( _hypType == NONE )
theMesh.Lock(); return false;
bool ret = this->CheckHypothesis(theMesh, theShape, hyp_status);
int hypType = _hypType;
theMesh.Unlock();
if ( hypType == NONE ) if ( _hypType == ADAPTIVE )
return false;
if ( hypType == ADAPTIVE )
{ {
_adaptiveHyp->GetAlgo()->InitComputeError(); _adaptiveHyp->GetAlgo()->InitComputeError();
_adaptiveHyp->GetAlgo()->Compute( theMesh, theShape ); _adaptiveHyp->GetAlgo()->Compute( theMesh, theShape );
@ -1200,8 +1182,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
theMesh.Lock();
const TopoDS_Edge & EE = TopoDS::Edge(theShape); const TopoDS_Edge & EE = TopoDS::Edge(theShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
int shapeID = meshDS->ShapeToIndex( E ); int shapeID = meshDS->ShapeToIndex( E );
@ -1216,11 +1196,9 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
ASSERT(!VLast.IsNull()); ASSERT(!VLast.IsNull());
const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS ); const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS ); const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
if ( !nFirst || !nLast ){ if ( !nFirst || !nLast )
theMesh.Unlock();
//std::cout << "exit no node" << std::endl;
return error( COMPERR_BAD_INPUT_MESH, "No node on vertex"); return error( COMPERR_BAD_INPUT_MESH, "No node on vertex");
}
// remove elements created by e.g. pattern mapping (PAL21999) // remove elements created by e.g. pattern mapping (PAL21999)
// CLEAN event is incorrectly ptopagated seemingly due to Propagation hyp // CLEAN event is incorrectly ptopagated seemingly due to Propagation hyp
// so TEMPORARY solution is to clean the submesh manually // so TEMPORARY solution is to clean the submesh manually
@ -1252,7 +1230,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
// take into account reversing the edge the hypothesis is propagated from // take into account reversing the edge the hypothesis is propagated from
// (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain) // (_mainEdge.Orientation() marks mutual orientation of EDGEs in propagation chain)
reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED ); reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
if ( hypType != DISTRIB_PROPAGATION ) { if ( _hypType != DISTRIB_PROPAGATION ) {
int mainID = meshDS->ShapeToIndex(_mainEdge); int mainID = meshDS->ShapeToIndex(_mainEdge);
if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end()) if ( std::find( _revEdgesIDs.begin(), _revEdgesIDs.end(), mainID) != _revEdgesIDs.end())
reversed = !reversed; reversed = !reversed;
@ -1264,9 +1242,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
BRepAdaptor_Curve C3d( E ); BRepAdaptor_Curve C3d( E );
if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) { if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) {
theMesh.Unlock();
//std::cout << "exit Compute internal failed" << std::endl;
return false; return false;
} }
redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast ); redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
@ -1357,9 +1332,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
meshDS->SetMeshElementOnShape(edge, shapeID); meshDS->SetMeshElementOnShape(edge, shapeID);
} }
} }
theMesh.Unlock();
//std::cout << "exit normal" << std::endl;
return true; return true;
} }