From: eap Date: Mon, 17 Sep 2012 10:16:21 +0000 (+0000) Subject: 0020982: EDF 1547 SMESH: Creation of non-conformal quadratic pyramids X-Git-Tag: V6_6_0a1~116 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a589688465689be77ae76b4634fbb1b84c60fc5;p=modules%2Fsmesh.git 0020982: EDF 1547 SMESH: Creation of non-conformal quadratic pyramids double MaxLinearSize2() const; // Return maximal square distance between connected corner nodes --- diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index 841d23540..2c7c401cb 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -1452,6 +1452,45 @@ double SMDS_VolumeTool::MinLinearSize2() const return minSize; } +//================================================================================ +/*! + * \brief Return maximal square distance between connected corner nodes + */ +//================================================================================ + +double SMDS_VolumeTool::MaxLinearSize2() const +{ + double maxSize = -1e+100; + int iQ = myVolume->IsQuadratic() ? 2 : 1; + + // store current face data + int curFace = myCurFace, nbN = myFaceNbNodes; + int* ind = myFaceNodeIndices; + myFaceNodeIndices = NULL; + const SMDS_MeshNode** nodes = myFaceNodes; + myFaceNodes = NULL; + + // it seems that compute distance twice is faster than organization of a sole computing + myCurFace = -1; + for ( int iF = 0; iF < myNbFaces; ++iF ) + { + setFace( iF ); + for ( int iN = 0; iN < myFaceNbNodes; iN += iQ ) + { + XYZ n1( myFaceNodes[ iN ]); + XYZ n2( myFaceNodes[(iN + iQ) % myFaceNbNodes]); + maxSize = std::max( maxSize, (n1 - n2).SquareMagnitude()); + } + } + // restore current face data + myCurFace = curFace; + myFaceNbNodes = nbN; + myFaceNodeIndices = ind; + delete [] myFaceNodes; myFaceNodes = nodes; + + return maxSize; +} + //================================================================================ /*! * \brief check that only one volume is build on the face nodes diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index 5c22c3eda..ff067eb3a 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -128,6 +128,9 @@ class SMDS_EXPORT SMDS_VolumeTool double MinLinearSize2() const; // Return minimal square distance between connected corner nodes + double MaxLinearSize2() const; + // Return maximal square distance between connected corner nodes + // ------------- // info on faces // -------------