From 52e29b1d26e4ba2b53820d547b2c16321cc40734 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 15 Sep 2010 15:11:26 +0000 Subject: [PATCH] 0020982: EDF 1547 SMESH: Creation of non-conformal quadratic pyramids bool IsLinked (const SMDS_MeshNode* theNode1, const SMDS_MeshNode* theNode2, + const bool theIgnoreMediumNodes=false) const; // Return true if theNode1 is linked with theNode2. + // If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well --- src/SMDS/SMDS_VolumeTool.cxx | 25 +++++++++++++++++++++---- src/SMDS/SMDS_VolumeTool.hxx | 8 ++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index 2967928a1..2b6df8fa6 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -520,7 +520,7 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume) GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z ); const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ]; int topNodeIndex = myVolume->NbCornerNodes() - 1; - while ( !IsLinked( 0, topNodeIndex )) --topNodeIndex; + while ( !IsLinked( 0, topNodeIndex, /*ignoreMediumNodes=*/true )) --topNodeIndex; const SMDS_MeshNode* topNode = myVolumeNodes[ topNodeIndex ]; XYZ upDir (topNode->X() - botNode->X(), topNode->Y() - botNode->Y(), @@ -1087,10 +1087,12 @@ int SMDS_VolumeTool::GetOppFaceIndex( int faceIndex ) const //======================================================================= //function : IsLinked //purpose : return true if theNode1 is linked with theNode2 +// If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well //======================================================================= bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1, - const SMDS_MeshNode* theNode2) const + const SMDS_MeshNode* theNode2, + const bool theIgnoreMediumNodes) const { if ( !myVolume ) return false; @@ -1137,10 +1139,12 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1, //function : IsLinked //purpose : return true if the node with theNode1Index is linked // with the node with theNode2Index +// If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well //======================================================================= bool SMDS_VolumeTool::IsLinked (const int theNode1Index, - const int theNode2Index) const + const int theNode2Index, + bool theIgnoreMediumNodes) const { if ( myVolume->IsPoly() ) { return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]); @@ -1152,7 +1156,20 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index, if ( minInd < 0 || maxInd > myVolumeNbNodes - 1 || maxInd == minInd ) return false; - switch ( myVolumeNbNodes ) { + int quadraticDivisor = 1; + if ( myVolume->IsQuadratic() ) + { + int firstMediumInd = myVolume->NbCornerNodes(); + if ( minInd >= firstMediumInd ) + return false; // medium nodes are not linked + if ( maxInd < firstMediumInd ) // both nodes are corners + if ( theIgnoreMediumNodes ) + quadraticDivisor = 2; // check linkage of corner nodes + else + return false; // corner nodes are not linked directly in a quadratic cell + } + + switch ( myVolumeNbNodes / quadraticDivisor ) { case 4: return true; case 5: diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index 6791fb9c7..f06c2f781 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -102,13 +102,17 @@ class SMDS_EXPORT SMDS_VolumeTool // ----------------------- bool IsLinked (const SMDS_MeshNode* theNode1, - const SMDS_MeshNode* theNode2) const; + const SMDS_MeshNode* theNode2, + const bool theIgnoreMediumNodes=false) const; // Return true if theNode1 is linked with theNode2. + // If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well bool IsLinked (const int theNode1Index, - const int theNode2Index) const; + const int theNode2Index, + bool theIgnoreMediumNodes=false) const; // Return true if the node with theNode1Index is linked // with the node with theNode2Index + // If theIgnoreMediumNodes then corner nodes of quadratic cell are considered linked as well int GetNodeIndex(const SMDS_MeshNode* theNode) const; // Return an index of theNode -- 2.39.2