mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 18:20:34 +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() );
|
||||
|
||||
// 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)
|
||||
bool isCorner = false;
|
||||
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
|
||||
double chainLen = 0;
|
||||
vector< double > linkPos;
|
||||
TChain savedChain; // backup
|
||||
MSGBEG( "Link medium nodes: ");
|
||||
TChain::iterator link0 = chain.begin(), link1 = chain.begin(), link2;
|
||||
for ( ++link1; link1 != chain.end(); ++link1, ++link0 ) {
|
||||
MSGBEG( (*link0)->_mediumNode->GetID() << "-" <<(*link1)->_mediumNode->GetID()<<" ");
|
||||
double len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus();
|
||||
while ( len < numeric_limits<double>::min() ) { // remove degenerated link
|
||||
if ( savedChain.empty() ) savedChain = chain;
|
||||
link1 = chain.erase( link1 );
|
||||
if ( link1 == chain.end() )
|
||||
break;
|
||||
@ -4839,9 +4841,16 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
linkPos.push_back( chainLen );
|
||||
}
|
||||
MSG("");
|
||||
if ( linkPos.size() < 2 )
|
||||
continue;
|
||||
|
||||
if ( linkPos.size() <= 2 && savedChain.size() > 2 ) {
|
||||
//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 move1 = chain.back ()->_nodeMove;
|
||||
|
||||
@ -4920,8 +4929,12 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
// transform to global
|
||||
gp_Vec x01( (*link0)->MiddlePnt(), (*link1)->MiddlePnt() );
|
||||
gp_Vec x12( (*link1)->MiddlePnt(), (*link2)->MiddlePnt() );
|
||||
gp_Vec x = x01.Normalized() + x12.Normalized();
|
||||
trsf.SetTransformation( gp_Ax3( gp::Origin(), link1->Normal(), x), gp_Ax3() );
|
||||
try {
|
||||
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);
|
||||
(*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/false );
|
||||
}
|
||||
|
@ -1861,10 +1861,13 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
||||
removeSubMeshElementsAndNodes();
|
||||
break;
|
||||
case SUBMESH_COMPUTED: // allow retry compute
|
||||
if (_algoState == HYP_OK)
|
||||
_computeState = READY_TO_COMPUTE;
|
||||
else
|
||||
_computeState = NOT_READY;
|
||||
if ( IsEmpty() ) // 23061
|
||||
{
|
||||
if (_algoState == HYP_OK)
|
||||
_computeState = READY_TO_COMPUTE;
|
||||
else
|
||||
_computeState = NOT_READY;
|
||||
}
|
||||
break;
|
||||
case SUBMESH_RESTORED:
|
||||
ComputeSubMeshStateEngine( SUBMESH_RESTORED );
|
||||
|
@ -778,6 +778,7 @@ void SMESHGUI_MergeDlg::updateControls()
|
||||
bool enable = !(myMesh->_is_nil()) && (ListCoincident->count() || (myTypeId == 0));
|
||||
buttonOk->setEnabled(enable);
|
||||
buttonApply->setEnabled(enable);
|
||||
DetectButton->setEnabled( !myMesh->_is_nil() );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -1124,12 +1125,13 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
|
||||
if (myEditCurrentArgument == (QWidget*)LineEditMesh) {
|
||||
QString aString = "";
|
||||
LineEditMesh->setText(aString);
|
||||
|
||||
|
||||
ListCoincident->clear();
|
||||
ListEdit->clear();
|
||||
myActor = 0;
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
QString aCurrentEntry = myEntry;
|
||||
|
||||
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
if (nbSel != 1) {
|
||||
myIdPreview->SetPointsLabeled(false);
|
||||
@ -1142,20 +1144,20 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList);
|
||||
|
||||
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myEntry = IO->getEntry();
|
||||
myMesh = SMESH::GetMeshByIO(IO);
|
||||
|
||||
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
|
||||
LineEditMesh->setText(aString);
|
||||
|
||||
|
||||
myActor = SMESH::FindActorByEntry(IO->getEntry());
|
||||
if (!myActor)
|
||||
myActor = SMESH::FindActorByObject(myMesh);
|
||||
|
||||
|
||||
if ( myActor && myTypeId == 1 && mySelector->IsSelectionEnabled() ) {
|
||||
mySubMeshOrGroup = SMESH::SMESH_IDSource::_nil();
|
||||
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
|
||||
|
@ -307,6 +307,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
||||
{
|
||||
SMESH_TNodeXYZ nXYZ = *node;
|
||||
nodeState[ i ] = TopAbs_UNKNOWN;
|
||||
newNodes [ i ] = 0;
|
||||
|
||||
it_isnew = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 ));
|
||||
n2nIt = it_isnew.first;
|
||||
@ -679,7 +680,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
||||
seamHelper.SetSubShape( edges[ iE ]);
|
||||
seamHelper.SetElementsOnShape( true );
|
||||
|
||||
if ( (*checkedFaces.begin())->IsQuadratic() )
|
||||
if ( !checkedFaces.empty() && (*checkedFaces.begin())->IsQuadratic() )
|
||||
for ( set< const SMDS_MeshElement* >::iterator fIt = checkedFaces.begin();
|
||||
fIt != checkedFaces.end(); ++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->ComputeStateEngine(SMESH_subMesh::CHECK_COMPUTE_STATE);
|
||||
if ( sm->GetComputeState() != SMESH_subMesh::COMPUTE_OK )
|
||||
return error(SMESH_Comment("Failed to create segments on the edge ")
|
||||
<< tgtMesh->ShapeToIndex( edges[iE ]));
|
||||
return error(SMESH_Comment("Failed to create segments on the edge #") << sm->GetId());
|
||||
}
|
||||
|
||||
// ============
|
||||
|
@ -690,25 +690,28 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
if ( smDS->NbNodes() < 1 )
|
||||
return true; // 1 segment
|
||||
|
||||
vector< double > mainEdgeParams;
|
||||
if ( ! SMESH_Algo::GetNodeParamOnEdge( theMesh.GetMeshDS(), mainEdge, mainEdgeParams ))
|
||||
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( mainEdgeParams.size() - 1 );
|
||||
vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 );
|
||||
double totalLen = 0;
|
||||
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,
|
||||
mainEdgeParams[i-1],
|
||||
mainEdgeParams[i]);
|
||||
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;
|
||||
size_t iSeg = theReverse ? segLen.size()-1 : 0;
|
||||
size_t dSeg = theReverse ? -1 : +1;
|
||||
double param = theFirstU;
|
||||
int nbParams = 0;
|
||||
for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
|
||||
|
Loading…
Reference in New Issue
Block a user