From 086e73ab75b5d2e5f85d8dd906e7ea58fb387ac3 Mon Sep 17 00:00:00 2001 From: skl Date: Thu, 26 Jan 2006 07:14:20 +0000 Subject: [PATCH] Changes for working with quadratic elements --- src/Controls/SMESH_Controls.cxx | 252 +++++++++++++++++++++++++------- src/SMDS/SMDS_Mesh.cxx | 7 - src/SMDS/SMDS_VolumeTool.cxx | 54 +++++-- 3 files changed, 235 insertions(+), 78 deletions(-) diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 717f8e66a..153a0baee 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -46,6 +46,7 @@ #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" #include "SMDS_VolumeTool.hxx" +#include "SMDS_QuadraticFaceOfNodes.hxx" /* @@ -162,14 +163,30 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem, return false; // Get nodes of the element - SMDS_ElemIteratorPtr anIter = anElem->nodesIterator(); - if ( anIter != 0 ) - { - while( anIter->more() ) - { - const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); - if ( aNode != 0 ){ - theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) ); + + const SMDS_QuadraticFaceOfNodes* F = + static_cast(anElem); + if(F) { + // use special nodes iterator + SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator(); + if ( anIter != 0 ) { + while( anIter->more() ) { + const SMDS_MeshNode* aNode = anIter->next(); + if ( aNode != 0 ) { + theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) ); + } + } + } + } + + if(theRes.size()==0) { + SMDS_ElemIteratorPtr anIter = anElem->nodesIterator(); + if ( anIter != 0 ) { + while( anIter->more() ) { + const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); + if ( aNode != 0 ) { + theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) ); + } } } } @@ -189,10 +206,12 @@ void NumericalFunctor::SetPrecision( const long thePrecision ) double NumericalFunctor::GetValue( long theId ) { +cout<<"theId="< 3) - aArea = getArea( P( 1 ), P( 2 ), P( 3 ) ); - else - return 0; - - for (int i=4; i<=P.size(); i++) - aArea += getArea(P(1),P(i-1),P(i)); - return aArea; + gp_Vec aVec1( P(2) - P(1) ); + gp_Vec aVec2( P(3) - P(1) ); + gp_Vec SumVec = aVec1 ^ aVec2; + for (int i=4; i<=P.size(); i++) { + gp_Vec aVec1( P(i-1) - P(1) ); + gp_Vec aVec2( P(i) - P(1) ); + gp_Vec tmp = aVec1 ^ aVec2; + SumVec.Add(tmp); + } + return SumVec.Magnitude() * 0.5; } double Area::GetBadRate( double Value, int /*nbNodes*/ ) const @@ -894,7 +913,10 @@ double Length2D::GetValue( long theElementId) { TSequenceOfXYZ P; + //cout<<"Length2D::GetValue"<FindElement( theElementId ); @@ -908,7 +930,11 @@ double Length2D::GetValue( long theElementId) case SMDSAbs_Edge: if (len == 2){ aVal = getDistance( P( 1 ), P( 2 ) ); - break; + break; + } + else if (len == 3){ // quadratic edge + aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 )); + break; } case SMDSAbs_Face: if (len == 3){ // triangles @@ -926,6 +952,22 @@ double Length2D::GetValue( long theElementId) aVal = Max(Max(L1,L2),Max(L3,L4)); break; } + if (len == 6){ // quadratic triangles + double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 )); + double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 )); + double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 )); + aVal = Max(L1,Max(L2,L3)); + //cout<<"L1="<BindID(ID, edge)) { SMDS_MeshNode *node1,*node2, *node12; @@ -2313,7 +2312,6 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, const SMDS_MeshNode * n31, int ID) { - cout<<"SMDS_Mesh::AddFaceWithID"<