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();
// 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;
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;
// 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 );
}
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 );
bool enable = !(myMesh->_is_nil()) && (ListCoincident->count() || (myTypeId == 0));
buttonOk->setEnabled(enable);
buttonApply->setEnabled(enable);
+ DetectButton->setEnabled( !myMesh->_is_nil() );
}
//=================================================================================
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);
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);
{
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;
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 ));
// 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());
}
// ============
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 )