0021339: EDF 1928 SMESH: Create group of 0D elements

Fix ElemGeomType::IsSatisfy() to work automatically with any new type
This commit is contained in:
eap 2012-10-18 11:40:33 +00:00
parent e77525fc4f
commit 49c44a713e

View File

@ -2645,43 +2645,7 @@ bool ElemGeomType::IsSatisfy( long theId )
const SMDSAbs_ElementType anElemType = anElem->GetType(); const SMDSAbs_ElementType anElemType = anElem->GetType();
if ( myType != SMDSAbs_All && anElemType != myType ) if ( myType != SMDSAbs_All && anElemType != myType )
return false; return false;
const int aNbNode = anElem->NbNodes(); bool isOk = ( anElem->GetGeomType() == myGeomType );
bool isOk = false;
switch( anElemType )
{
case SMDSAbs_Node:
isOk = (myGeomType == SMDSGeom_POINT);
break;
case SMDSAbs_Edge:
isOk = (myGeomType == SMDSGeom_EDGE);
break;
case SMDSAbs_Face:
if ( myGeomType == SMDSGeom_TRIANGLE )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 6 : aNbNode == 3));
else if ( myGeomType == SMDSGeom_QUADRANGLE )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? ( aNbNode == 8 || aNbNode == 9 ) : aNbNode == 4));
else if ( myGeomType == SMDSGeom_POLYGON )
isOk = anElem->IsPoly();
break;
case SMDSAbs_Volume:
if ( myGeomType == SMDSGeom_TETRA )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 10 : aNbNode == 4));
else if ( myGeomType == SMDSGeom_PYRAMID )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 13 : aNbNode == 5));
else if ( myGeomType == SMDSGeom_PENTA )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 15 : aNbNode == 6));
else if ( myGeomType == SMDSGeom_HEXA )
isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? ( aNbNode == 20 || aNbNode == 27 ): aNbNode == 8));
else if ( myGeomType == SMDSGeom_HEXAGONAL_PRISM )
isOk = (anElem->GetEntityType() == SMDSEntity_Hexagonal_Prism );
else if ( myGeomType == SMDSGeom_POLYHEDRA )
isOk = anElem->IsPoly();
break;
default: break;
}
return isOk; return isOk;
} }