X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_FaceSide.cxx;h=0939eaef5c1f40d3b0bac3a586be65b2340099e3;hp=455af191ce838ccdf96dacacb25a97bb191a9ba6;hb=HEAD;hpb=6d32f944a0a115b6419184c50b57bf7c4eef5786 diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 455af191c..51a09cc99 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -181,6 +181,41 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, } // loop on edges + // orient seam edges (#19982) + const double tol = Precision::Confusion(); + if ( NbEdges() > 1 && !myC2d[0].IsNull() ) + for ( int i = 0; i < NbEdges(); ++i ) + { + int iPrev = SMESH_MesherHelper::WrapIndex( i - 1, NbEdges() ); + if ( !BRep_Tool::IsClosed( myEdge[i], myFace ) || !myC2d[iPrev] ) + continue; + gp_Pnt2d pLastPrev = myC2d[iPrev]->Value( myLast[iPrev] ); + gp_Pnt2d pFirst = myC2d[i]->Value( myFirst[i] ); + if ( pLastPrev.IsEqual( pFirst, tol )) + continue; // OK + pFirst = myC2d[i]->Value( myLast[i] ); + if ( pLastPrev.IsEqual( pFirst, tol )) + { + std::swap( myFirst[i], myLast[i] ); + continue; + } + TopoDS_Edge E = myEdge[i]; + E.Reverse(); + Handle(Geom2d_Curve) c2dRev = BRep_Tool::CurveOnSurface( E, myFace, myFirst[i], myLast[i] ); + pFirst = c2dRev->Value( myFirst[i] ); + if ( pLastPrev.IsEqual( pFirst, tol )) + { + myC2d[i] = c2dRev; + continue; + } + pFirst = c2dRev->Value( myLast[i] ); + if ( pLastPrev.IsEqual( pFirst, tol )) + { + myC2d[i] = c2dRev; + std::swap( myFirst[i], myLast[i] ); + } + } + // count nodes and segments NbPoints( /*update=*/true ); @@ -450,6 +485,7 @@ const std::vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXCons for ( size_t j = 0; j < u2nodeVec.size(); ++j ) u2node.insert( u2node.end(), u2nodeVec[j] ); } + continue; } // loop on myEdge's // Add 2nd VERTEX node for a last EDGE @@ -665,7 +701,7 @@ std::vector StdMeshers_FaceSide::GetOrderedNodes(int theEd iE = theEdgeInd % NbEdges(); iEnd = iE + 1; } - for ( iE = 0; iE < iEnd; ++iE ) + for ( ; iE < iEnd; ++iE ) { double prevNormPar = ( iE == 0 ? 0 : myNormPar[ iE-1 ]); // normalized param @@ -799,7 +835,7 @@ bool StdMeshers_FaceSide::GetEdgeNodes(size_t i, if ( mesh->HasModificationsToDiscard() ) // check nb of nodes on the EDGE sub-mesh { int iQuad = sm->NbElements() ? sm->GetElements()->next()->IsQuadratic() : 0; - int nbExpect = sm->NbElements() - 1 + iQuad * sm->NbElements(); + smIdType nbExpect = sm->NbElements() - 1 + iQuad * sm->NbElements(); if ( nbExpect != sm->NbNodes() ) // some nodes are moved from the EDGE by MergeNodes() { // add nodes of all segments @@ -1009,7 +1045,7 @@ void StdMeshers_FaceSide::SetIgnoreMediumNodes(bool toIgnore) // since creation of this side //======================================================================= -int StdMeshers_FaceSide::NbPoints(const bool update) const +smIdType StdMeshers_FaceSide::NbPoints(const bool update) const { if ( !myPoints.empty() ) return myPoints.size(); @@ -1076,7 +1112,7 @@ int StdMeshers_FaceSide::NbPoints(const bool update) const // since creation of this side //======================================================================= -int StdMeshers_FaceSide::NbSegments(const bool update) const +smIdType StdMeshers_FaceSide::NbSegments(const bool update) const { return NbPoints( update ), myNbSegments; } @@ -1112,7 +1148,9 @@ void StdMeshers_FaceSide::reverseProxySubmesh( const TopoDS_Edge& E ) void StdMeshers_FaceSide::dump(const char* msg) const { -#ifdef _DEBUG_ + if (!SALOME::VerbosityActivated()) + return; + if (msg) MESSAGE ( std::endl << msg ); MESSAGE_BEGIN ("NB EDGES: "<< myEdge.size() ); MESSAGE_ADD ( "nbPoints: "<