mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-09 03:17:27 +05:00
23061: [CEA 1488] Import 1D-2D fails sometimes in relation with the source face discretization
Fix SMESH_subMesh::ComputeStateEngine() and StdMeshers_Import_1D2D::Compute() IPAL52572: 1) Wrong bi-quadratic mesh on cylinder, 2) global "Quadratic mesh" hyp not considered on Propagated edges. Fix SMESH_MesherHelper::FixQuadraticElements() StdMeshers_Regular_1D - wrong PropagationOfDistribution in quadratic mesh In SMESHGUI_MergeDlg, disable [Detect] if no mesh selected
This commit is contained in:
parent
03fce5b491
commit
ebb5182963
@ -2581,7 +2581,7 @@ bool SMESH_MesherHelper::IsStructured( SMESH_subMesh* faceSM )
|
|||||||
faceAnalyser.SetSubShape( faceSM->GetSubShape() );
|
faceAnalyser.SetSubShape( faceSM->GetSubShape() );
|
||||||
|
|
||||||
// rotate edges to get the first node being at corner
|
// rotate edges to get the first node being at corner
|
||||||
// (in principle it's not necessary but so far none SALOME algo can make
|
// (in principle it's not necessary because so far none SALOME algo can make
|
||||||
// such a structured mesh that all corner nodes are not on VERTEXes)
|
// such a structured mesh that all corner nodes are not on VERTEXes)
|
||||||
bool isCorner = false;
|
bool isCorner = false;
|
||||||
int nbRemainEdges = nbEdgesInWires.front();
|
int nbRemainEdges = nbEdgesInWires.front();
|
||||||
@ -4824,12 +4824,14 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
|||||||
// mesure chain length and compute link position along the chain
|
// mesure chain length and compute link position along the chain
|
||||||
double chainLen = 0;
|
double chainLen = 0;
|
||||||
vector< double > linkPos;
|
vector< double > linkPos;
|
||||||
|
TChain savedChain; // backup
|
||||||
MSGBEG( "Link medium nodes: ");
|
MSGBEG( "Link medium nodes: ");
|
||||||
TChain::iterator link0 = chain.begin(), link1 = chain.begin(), link2;
|
TChain::iterator link0 = chain.begin(), link1 = chain.begin(), link2;
|
||||||
for ( ++link1; link1 != chain.end(); ++link1, ++link0 ) {
|
for ( ++link1; link1 != chain.end(); ++link1, ++link0 ) {
|
||||||
MSGBEG( (*link0)->_mediumNode->GetID() << "-" <<(*link1)->_mediumNode->GetID()<<" ");
|
MSGBEG( (*link0)->_mediumNode->GetID() << "-" <<(*link1)->_mediumNode->GetID()<<" ");
|
||||||
double len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus();
|
double len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus();
|
||||||
while ( len < numeric_limits<double>::min() ) { // remove degenerated link
|
while ( len < numeric_limits<double>::min() ) { // remove degenerated link
|
||||||
|
if ( savedChain.empty() ) savedChain = chain;
|
||||||
link1 = chain.erase( link1 );
|
link1 = chain.erase( link1 );
|
||||||
if ( link1 == chain.end() )
|
if ( link1 == chain.end() )
|
||||||
break;
|
break;
|
||||||
@ -4839,9 +4841,16 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
|||||||
linkPos.push_back( chainLen );
|
linkPos.push_back( chainLen );
|
||||||
}
|
}
|
||||||
MSG("");
|
MSG("");
|
||||||
if ( linkPos.size() < 2 )
|
if ( linkPos.size() <= 2 && savedChain.size() > 2 ) {
|
||||||
continue;
|
//continue;
|
||||||
|
linkPos.clear();
|
||||||
|
chainLen = 0;
|
||||||
|
chain = savedChain;
|
||||||
|
for ( link1 = chain.begin(); link1 != chain.end(); ++link1 ) {
|
||||||
|
chainLen += 1;
|
||||||
|
linkPos.push_back( chainLen );
|
||||||
|
}
|
||||||
|
}
|
||||||
gp_Vec move0 = chain.front()->_nodeMove;
|
gp_Vec move0 = chain.front()->_nodeMove;
|
||||||
gp_Vec move1 = chain.back ()->_nodeMove;
|
gp_Vec move1 = chain.back ()->_nodeMove;
|
||||||
|
|
||||||
@ -4920,8 +4929,12 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
|||||||
// transform to global
|
// transform to global
|
||||||
gp_Vec x01( (*link0)->MiddlePnt(), (*link1)->MiddlePnt() );
|
gp_Vec x01( (*link0)->MiddlePnt(), (*link1)->MiddlePnt() );
|
||||||
gp_Vec x12( (*link1)->MiddlePnt(), (*link2)->MiddlePnt() );
|
gp_Vec x12( (*link1)->MiddlePnt(), (*link2)->MiddlePnt() );
|
||||||
gp_Vec x = x01.Normalized() + x12.Normalized();
|
try {
|
||||||
trsf.SetTransformation( gp_Ax3( gp::Origin(), link1->Normal(), x), gp_Ax3() );
|
gp_Vec x = x01.Normalized() + x12.Normalized();
|
||||||
|
trsf.SetTransformation( gp_Ax3( gp::Origin(), link1->Normal(), x), gp_Ax3() );
|
||||||
|
} catch ( Standard_Failure ) {
|
||||||
|
trsf.Invert();
|
||||||
|
}
|
||||||
move.Transform(trsf);
|
move.Transform(trsf);
|
||||||
(*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/false );
|
(*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/false );
|
||||||
}
|
}
|
||||||
|
@ -1861,10 +1861,13 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
removeSubMeshElementsAndNodes();
|
removeSubMeshElementsAndNodes();
|
||||||
break;
|
break;
|
||||||
case SUBMESH_COMPUTED: // allow retry compute
|
case SUBMESH_COMPUTED: // allow retry compute
|
||||||
if (_algoState == HYP_OK)
|
if ( IsEmpty() ) // 23061
|
||||||
_computeState = READY_TO_COMPUTE;
|
{
|
||||||
else
|
if (_algoState == HYP_OK)
|
||||||
_computeState = NOT_READY;
|
_computeState = READY_TO_COMPUTE;
|
||||||
|
else
|
||||||
|
_computeState = NOT_READY;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SUBMESH_RESTORED:
|
case SUBMESH_RESTORED:
|
||||||
ComputeSubMeshStateEngine( SUBMESH_RESTORED );
|
ComputeSubMeshStateEngine( SUBMESH_RESTORED );
|
||||||
|
@ -778,6 +778,7 @@ void SMESHGUI_MergeDlg::updateControls()
|
|||||||
bool enable = !(myMesh->_is_nil()) && (ListCoincident->count() || (myTypeId == 0));
|
bool enable = !(myMesh->_is_nil()) && (ListCoincident->count() || (myTypeId == 0));
|
||||||
buttonOk->setEnabled(enable);
|
buttonOk->setEnabled(enable);
|
||||||
buttonApply->setEnabled(enable);
|
buttonApply->setEnabled(enable);
|
||||||
|
DetectButton->setEnabled( !myMesh->_is_nil() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -1128,6 +1129,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
|
|||||||
ListCoincident->clear();
|
ListCoincident->clear();
|
||||||
ListEdit->clear();
|
ListEdit->clear();
|
||||||
myActor = 0;
|
myActor = 0;
|
||||||
|
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||||
QString aCurrentEntry = myEntry;
|
QString aCurrentEntry = myEntry;
|
||||||
|
|
||||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||||
|
@ -307,6 +307,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
|||||||
{
|
{
|
||||||
SMESH_TNodeXYZ nXYZ = *node;
|
SMESH_TNodeXYZ nXYZ = *node;
|
||||||
nodeState[ i ] = TopAbs_UNKNOWN;
|
nodeState[ i ] = TopAbs_UNKNOWN;
|
||||||
|
newNodes [ i ] = 0;
|
||||||
|
|
||||||
it_isnew = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 ));
|
it_isnew = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 ));
|
||||||
n2nIt = it_isnew.first;
|
n2nIt = it_isnew.first;
|
||||||
@ -679,7 +680,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
|||||||
seamHelper.SetSubShape( edges[ iE ]);
|
seamHelper.SetSubShape( edges[ iE ]);
|
||||||
seamHelper.SetElementsOnShape( true );
|
seamHelper.SetElementsOnShape( true );
|
||||||
|
|
||||||
if ( (*checkedFaces.begin())->IsQuadratic() )
|
if ( !checkedFaces.empty() && (*checkedFaces.begin())->IsQuadratic() )
|
||||||
for ( set< const SMDS_MeshElement* >::iterator fIt = checkedFaces.begin();
|
for ( set< const SMDS_MeshElement* >::iterator fIt = checkedFaces.begin();
|
||||||
fIt != checkedFaces.end(); ++fIt )
|
fIt != checkedFaces.end(); ++fIt )
|
||||||
seamHelper.AddTLinks( static_cast<const SMDS_MeshFace*>( *fIt ));
|
seamHelper.AddTLinks( static_cast<const SMDS_MeshFace*>( *fIt ));
|
||||||
@ -708,8 +709,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
|||||||
// sm->SetIsAlwaysComputed( true );
|
// sm->SetIsAlwaysComputed( true );
|
||||||
sm->ComputeStateEngine(SMESH_subMesh::CHECK_COMPUTE_STATE);
|
sm->ComputeStateEngine(SMESH_subMesh::CHECK_COMPUTE_STATE);
|
||||||
if ( sm->GetComputeState() != SMESH_subMesh::COMPUTE_OK )
|
if ( sm->GetComputeState() != SMESH_subMesh::COMPUTE_OK )
|
||||||
return error(SMESH_Comment("Failed to create segments on the edge ")
|
return error(SMESH_Comment("Failed to create segments on the edge #") << sm->GetId());
|
||||||
<< tgtMesh->ShapeToIndex( edges[iE ]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============
|
// ============
|
||||||
|
@ -690,25 +690,28 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
|||||||
if ( smDS->NbNodes() < 1 )
|
if ( smDS->NbNodes() < 1 )
|
||||||
return true; // 1 segment
|
return true; // 1 segment
|
||||||
|
|
||||||
vector< double > mainEdgeParams;
|
map< double, const SMDS_MeshNode* > mainEdgeParamsOfNodes;
|
||||||
if ( ! SMESH_Algo::GetNodeParamOnEdge( theMesh.GetMeshDS(), mainEdge, mainEdgeParams ))
|
if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh,
|
||||||
|
mainEdgeParamsOfNodes, SMDSAbs_Edge ))
|
||||||
return error("Bad node parameters on the source edge of Propagation Of Distribution");
|
return error("Bad node parameters on the source edge of Propagation Of Distribution");
|
||||||
|
|
||||||
vector< double > segLen( mainEdgeParams.size() - 1 );
|
vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 );
|
||||||
double totalLen = 0;
|
double totalLen = 0;
|
||||||
BRepAdaptor_Curve mainEdgeCurve( mainEdge );
|
BRepAdaptor_Curve mainEdgeCurve( mainEdge );
|
||||||
for ( size_t i = 1; i < mainEdgeParams.size(); ++i )
|
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,
|
segLen[ i-1 ] = GCPnts_AbscissaPoint::Length( mainEdgeCurve,
|
||||||
mainEdgeParams[i-1],
|
u_n1->first,
|
||||||
mainEdgeParams[i]);
|
u_n2->first);
|
||||||
totalLen += segLen[ i-1 ];
|
totalLen += segLen[ i-1 ];
|
||||||
}
|
}
|
||||||
for ( size_t i = 0; i < segLen.size(); ++i )
|
for ( size_t i = 0; i < segLen.size(); ++i )
|
||||||
segLen[ i ] *= theLength / totalLen;
|
segLen[ i ] *= theLength / totalLen;
|
||||||
|
|
||||||
size_t iSeg = theReverse ? segLen.size()-1 : 0;
|
size_t iSeg = theReverse ? segLen.size()-1 : 0;
|
||||||
size_t dSeg = theReverse ? -1 : +1;
|
size_t dSeg = theReverse ? -1 : +1;
|
||||||
double param = theFirstU;
|
double param = theFirstU;
|
||||||
int nbParams = 0;
|
int nbParams = 0;
|
||||||
for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
|
for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user