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);
This commit is contained in:
eap 2012-08-07 09:16:38 +00:00
parent 9521abf244
commit 6056cf7472
2 changed files with 29 additions and 5 deletions

View File

@ -78,7 +78,8 @@ namespace {
//================================================================================ //================================================================================
SMESH_MesherHelper::SMESH_MesherHelper(SMESH_Mesh& theMesh) 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; myPar1[0] = myPar2[0] = myPar1[1] = myPar2[1] = 0;
mySetElemOnShape = ( ! myMesh->HasShapeToMesh() ); 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)); ((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 //function : GetUVOnSeam
//purpose : Select UV on either of 2 pcurves of a seam edge, closest to the given UV //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; return false;
} }
// store the fixed UV on the face // store the fixed UV on the face
if ( myShape.IsSame(F) && shapeID == myShapeID ) if ( myShape.IsSame(F) && shapeID == myShapeID && myFixNodeParameters )
const_cast<SMDS_MeshNode*>(n)->SetPosition const_cast<SMDS_MeshNode*>(n)->SetPosition
( SMDS_PositionPtr( new SMDS_FacePosition( U, V ))); ( SMDS_PositionPtr( new SMDS_FacePosition( U, V )));
} }
@ -873,7 +888,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
return false; return false;
} }
// store the fixed U on the edge // store the fixed U on the edge
if ( myShape.IsSame(E) && shapeID == myShapeID ) if ( myShape.IsSame(E) && shapeID == myShapeID && myFixNodeParameters )
const_cast<SMDS_MeshNode*>(n)->SetPosition const_cast<SMDS_MeshNode*>(n)->SetPosition
( SMDS_PositionPtr( new SMDS_EdgePosition( U ))); ( SMDS_PositionPtr( new SMDS_EdgePosition( U )));
} }
@ -3023,7 +3038,7 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
if ( getenv("NO_FixQuadraticElements") ) if ( getenv("NO_FixQuadraticElements") )
return; return;
// 0. Apply algorithm to solids or geom faces // 0. Apply algorithm to SOLIDs or FACEs
// ---------------------------------------------- // ----------------------------------------------
if ( myShape.IsNull() ) { if ( myShape.IsNull() ) {
if ( !myMesh->HasShapeToMesh() ) return; if ( !myMesh->HasShapeToMesh() ) return;
@ -3062,6 +3077,7 @@ void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( fIt.Key() ); h.SetSubShape( fIt.Key() );
h.FixQuadraticElements(true); h.FixQuadraticElements(true);
h.ToFixNodeParameters(true);
} }
//perf_print_all_meters(1); //perf_print_all_meters(1);
return; return;

View File

@ -322,6 +322,14 @@ public:
const std::vector<int>& quantities, const std::vector<int>& quantities,
const int ID=0, const int ID=0,
const bool force3d = true); 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 * \brief Return U of the given node on the edge
*/ */
@ -549,9 +557,9 @@ protected:
SMESH_Mesh* myMesh; SMESH_Mesh* myMesh;
int myShapeID; int myShapeID;
// to create quadratic elements
bool myCreateQuadratic; bool myCreateQuadratic;
bool mySetElemOnShape; bool mySetElemOnShape;
bool myFixNodeParameters;
std::map< int,bool > myNodePosShapesValidity; std::map< int,bool > myNodePosShapesValidity;
bool toCheckPosOnShape(int shapeID ) const; bool toCheckPosOnShape(int shapeID ) const;