From: eap Date: Tue, 7 Aug 2012 09:16:38 +0000 (+0000) Subject: 0021765: EDF 2334 SMESH: ConvertToQuadratic with medium node on geometry generates... X-Git-Tag: V6_6_0a1~214 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6056cf74723266b46f830e06d00f0d1d33e8c28e;p=modules%2Fsmesh.git 0021765: EDF 2334 SMESH: ConvertToQuadratic with medium node on geometry generates bad elements + * \brief Enables fixing node parameters on EDGEs and FACEs by + * GetNodeU(...,check=true), GetNodeUV(...,check=true), CheckNodeUV() and + * CheckNodeU() in case if a node lies on a shape set via SetSubShape(). + * Default is False + */ + void ToFixNodeParameters(bool toFix); --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index b05dfbc56..efaf7a853 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -78,7 +78,8 @@ namespace { //================================================================================ SMESH_MesherHelper::SMESH_MesherHelper(SMESH_Mesh& theMesh) - : myParIndex(0), myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false) + : myParIndex(0), myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false), + myFixNodeParameters(false) { myPar1[0] = myPar2[0] = myPar1[1] = myPar2[1] = 0; mySetElemOnShape = ( ! myMesh->HasShapeToMesh() ); @@ -440,6 +441,20 @@ void SMESH_MesherHelper::setPosOnShapeValidity(int shapeID, bool ok ) const ((SMESH_MesherHelper*)this)->myNodePosShapesValidity.insert( make_pair( shapeID, ok)); } +//======================================================================= +//function : ToFixNodeParameters +//purpose : Enables fixing node parameters on EDGEs and FACEs in +// GetNodeU(...,check=true), GetNodeUV(...,check=true), CheckNodeUV() and +// CheckNodeU() in case if a node lies on a shape set via SetSubShape(). +// Default is False +//======================================================================= + +void SMESH_MesherHelper::ToFixNodeParameters(bool toFix) +{ + myFixNodeParameters = toFix; +} + + //======================================================================= //function : GetUVOnSeam //purpose : Select UV on either of 2 pcurves of a seam edge, closest to the given UV @@ -650,7 +665,7 @@ bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F, return false; } // store the fixed UV on the face - if ( myShape.IsSame(F) && shapeID == myShapeID ) + if ( myShape.IsSame(F) && shapeID == myShapeID && myFixNodeParameters ) const_cast(n)->SetPosition ( SMDS_PositionPtr( new SMDS_FacePosition( U, V ))); } @@ -873,7 +888,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, return false; } // store the fixed U on the edge - if ( myShape.IsSame(E) && shapeID == myShapeID ) + if ( myShape.IsSame(E) && shapeID == myShapeID && myFixNodeParameters ) const_cast(n)->SetPosition ( SMDS_PositionPtr( new SMDS_EdgePosition( U ))); } @@ -3023,7 +3038,7 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly) if ( getenv("NO_FixQuadraticElements") ) return; - // 0. Apply algorithm to solids or geom faces + // 0. Apply algorithm to SOLIDs or FACEs // ---------------------------------------------- if ( myShape.IsNull() ) { if ( !myMesh->HasShapeToMesh() ) return; @@ -3062,6 +3077,7 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly) SMESH_MesherHelper h(*myMesh); h.SetSubShape( fIt.Key() ); h.FixQuadraticElements(true); + h.ToFixNodeParameters(true); } //perf_print_all_meters(1); return; diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 9147a1415..c74dfb858 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -322,6 +322,14 @@ public: const std::vector& quantities, const int ID=0, const bool force3d = true); + /*! + * \brief Enables fixing node parameters on EDGEs and FACEs by + * GetNodeU(...,check=true), GetNodeUV(...,check=true), CheckNodeUV() and + * CheckNodeU() in case if a node lies on a shape set via SetSubShape(). + * Default is False + */ + void ToFixNodeParameters(bool toFix); + /*! * \brief Return U of the given node on the edge */ @@ -549,9 +557,9 @@ protected: SMESH_Mesh* myMesh; int myShapeID; - // to create quadratic elements bool myCreateQuadratic; bool mySetElemOnShape; + bool myFixNodeParameters; std::map< int,bool > myNodePosShapesValidity; bool toCheckPosOnShape(int shapeID ) const;