From: eap Date: Tue, 19 Jun 2007 16:50:42 +0000 (+0000) Subject: PAL16231 (3D Extrusion produced crossing hexahedrons) X-Git-Tag: V3_2_7~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bbc9b4287eec31705f69dda568b78e3f0397c2c7;p=modules%2Fsmesh.git PAL16231 (3D Extrusion produced crossing hexahedrons) improve copmuting point parameters using parameters hint --- diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 70a6fc5d4..868ce3ffd 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -275,18 +275,16 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh TNodeColumn& column = bot_column->second; // bottom node parameters and coords - gp_XYZ botParams = tBotNode.GetParams(); myShapeXYZ[ ID_BOT_FACE ] = tBotNode.GetCoords(); + gp_XYZ botParams = tBotNode.GetParams(); // compute top node parameters - gp_XYZ topParams; myShapeXYZ[ ID_TOP_FACE ] = gpXYZ( column.back() ); - if ( column.size() < 3 ) { // only top and bottom nodes in columns - topParams = botParams; - } - else { + gp_XYZ topParams = botParams; + topParams.SetZ( 1 ); + if ( column.size() > 2 ) { gp_Pnt topCoords = myShapeXYZ[ ID_TOP_FACE ]; - if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE )) + if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE, topParams )) return error(TCom("Can't compute normalized parameters ") << "for node " << column.back()->GetID() << " on the face #"<< column.back()->GetPosition()->GetShapeId() ); @@ -318,6 +316,10 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords )) return error("Can't compute coordinates by normalized parameters"); + SHOWYXZ("TOPFacePoint ",myShapeXYZ[ ID_TOP_FACE]); + SHOWYXZ("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode)); + SHOWYXZ("ShellPoint ",coords); + // create a node node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() ); meshDS->SetNodeInVolume( node, volumeID ); @@ -511,6 +513,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top() // Fill myBotToColumnMap int zSize = myBlock.VerticalSize(); + TNode prevTNode; TNodeNodeMap::iterator bN_tN = n2nMap.begin(); for ( ; bN_tN != n2nMap.end(); ++bN_tN ) { @@ -520,10 +523,16 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top() continue; // wall columns are contained in myBlock // compute bottom node params TNode bN( botNode ); - if ( zSize > 2 ) - if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), ID_BOT_FACE )) + if ( zSize > 2 ) { + gp_XYZ paramHint(-1,-1,-1); +// if ( prevTNode.IsNeighbor( bN )) +// paramHint = prevTNode.GetParams(); + if ( !myBlock.ComputeParameters( bN.GetCoords(), bN.ChangeParams(), + ID_BOT_FACE, paramHint )) return error(TCom("Can't compute normalized parameters ") << "for node " << botNode->GetID() << " on the face #"<< botSM->GetId() ); + } + prevTNode = bN; // create node column TNode2ColumnMap::iterator bN_col = myBotToColumnMap.insert( make_pair ( bN, TNodeColumn() )).first; @@ -679,6 +688,23 @@ bool StdMeshers_Prism_3D::setFaceAndEdgesXYZ( const int faceID, const gp_XYZ& pa return true; } +//================================================================================ +/*! + * \brief Return true if this node and other one belong to one face + */ +//================================================================================ + +bool TNode::IsNeighbor( const TNode& other ) const +{ + if ( !other.myNode || !myNode ) return false; + + SMDS_ElemIteratorPtr fIt = other.myNode->GetInverseElementIterator(SMDSAbs_Face); + while ( fIt->more() ) + if ( fIt->next()->GetNodeIndex( myNode ) >= 0 ) + return true; + return false; +} + //================================================================================ /*! * \brief Constructor. Initialization is needed diff --git a/src/StdMeshers/StdMeshers_Prism_3D.hxx b/src/StdMeshers/StdMeshers_Prism_3D.hxx index 20e92a2cb..81c279e9f 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.hxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.hxx @@ -78,10 +78,12 @@ struct TNode gp_XYZ GetCoords() const { return gp_XYZ( myNode->X(), myNode->Y(), myNode->Z() ); } gp_XYZ GetParams() const { return myParams; } gp_XYZ& ChangeParams() { return myParams; } + bool HasParams() const { return myParams.X() >= 0.0; } SMDS_TypeOfPosition GetPositionType() const { return myNode ? myNode->GetPosition()->GetTypeOfPosition() : SMDS_TOP_UNSPEC; } + bool IsNeighbor( const TNode& other ) const; - TNode(const SMDS_MeshNode* node = 0): myNode(node), myParams(0,0,0) {} + TNode(const SMDS_MeshNode* node = 0): myNode(node), myParams(-1,-1,-1) {} bool operator < (const TNode& other) const { return myNode < other.myNode; } };