Fix bug 11884: BordersAtMulticonnection2D worked incorrect. Also fix FreeEdges functor.

This commit is contained in:
jfa 2006-03-23 07:36:24 +00:00
parent f285075263
commit 085713d32f

View File

@ -1294,60 +1294,58 @@ double MultiConnection2D::GetValue( const TSequenceOfXYZ& P )
double MultiConnection2D::GetValue( long theElementId ) double MultiConnection2D::GetValue( long theElementId )
{ {
TSequenceOfXYZ P;
int aResult = 0; int aResult = 0;
if (GetPoints(theElementId,P)){ const SMDS_MeshElement* aFaceElem = myMesh->FindElement(theElementId);
const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId ); SMDSAbs_ElementType aType = aFaceElem->GetType();
SMDSAbs_ElementType aType = anFaceElem->GetType();
int len = P.size(); switch (aType) {
case SMDSAbs_Face:
{
int i = 0, len = aFaceElem->NbNodes();
SMDS_ElemIteratorPtr anIter = aFaceElem->nodesIterator();
if (!anIter) break;
TColStd_MapOfInteger aMap; const SMDS_MeshNode *aNode, *aNode0;
int aResult = 0; TColStd_MapOfInteger aMap, aMapPrev;
switch (aType){ for (i = 0; i <= len; i++) {
case SMDSAbs_All: aMapPrev = aMap;
case SMDSAbs_Node: aMap.Clear();
case SMDSAbs_Edge:
case SMDSAbs_Face:
if (len == 3){ // triangles
int Nb[3] = {0,0,0};
int i=0; int aNb = 0;
SMDS_ElemIteratorPtr anIter = anFaceElem->nodesIterator(); if (anIter->more()) {
if ( anIter != 0 ) { aNode = (SMDS_MeshNode*)anIter->next();
while( anIter->more() ) { } else {
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); if (i == len)
if ( aNode == 0 ){ aNode = aNode0;
break; else
} break;
SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator(); }
while( anElemIter->more() ) { if (!aNode) break;
const SMDS_MeshElement* anElem = anElemIter->next(); if (i == 0) aNode0 = aNode;
if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
int anId = anElem->GetID();
if ( anIter->more() ) // i.e. first node SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
aMap.Add( anId ); while (anElemIter->more()) {
else if ( aMap.Contains( anId ) ){ const SMDS_MeshElement* anElem = anElemIter->next();
Nb[i]++; if (anElem != 0 && anElem->GetType() == SMDSAbs_Face) {
} int anId = anElem->GetID();
}
else if ( anElem != 0 && anElem->GetType() == SMDSAbs_Edge ) i++;
}
}
}
aResult = Max(Max(Nb[0],Nb[1]),Nb[2]); aMap.Add(anId);
if (aMapPrev.Contains(anId)) {
aNb++;
}
}
}
aResult = Max(aResult, aNb);
} }
break;
case SMDSAbs_Volume:
default: aResult=0;
} }
break;
default:
aResult = 0;
} }
return aResult;//getNbMultiConnection( myMesh, theId );
return aResult;
} }
double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
@ -1547,7 +1545,7 @@ bool FreeEdges::IsSatisfy( long theId )
else { else {
anIter = aFace->nodesIterator(); anIter = aFace->nodesIterator();
} }
if ( anIter != 0 ) if ( anIter == 0 )
return false; return false;
int i = 0, nbNodes = aFace->NbNodes(); int i = 0, nbNodes = aFace->NbNodes();