#include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
-#include "SMDS_QuadraticEdge.hxx"
-#include "SMDS_QuadraticFaceOfNodes.hxx"
#include "SMDS_VolumeTool.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_GroupOnFilter.hxx"
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRep_Tool.hxx>
+#include <GeomLib_IsPlanarSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
}
+ inline double getCos2( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+ {
+ gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
+ double dot = v1 * v2, len1 = v1.SquareMagnitude(), len2 = v2.SquareMagnitude();
+
+ return ( dot < 0 || len1 < gp::Resolution() || len2 < gp::Resolution() ? -1 :
+ dot * dot / len1 / len2 );
+ }
+
inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
{
gp_Vec aVec1( P2 - P1 );
theRes.setElement( anElem );
// Get nodes of the element
- SMDS_ElemIteratorPtr anIter;
-
- if ( anElem->IsQuadratic() ) {
- switch ( anElem->GetType() ) {
- case SMDSAbs_Edge:
- anIter = dynamic_cast<const SMDS_VtkEdge*>
- (anElem)->interlacedNodesElemIterator();
- break;
- case SMDSAbs_Face:
- anIter = dynamic_cast<const SMDS_VtkFace*>
- (anElem)->interlacedNodesElemIterator();
- break;
- default:
- anIter = anElem->nodesIterator();
- }
- }
- else {
- anIter = anElem->nodesIterator();
- }
-
+ SMDS_NodeIteratorPtr anIter= anElem->interlacedNodesIterator();
if ( anIter ) {
SMESH_NodeXYZ p;
while( anIter->more() ) {
double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
{
- double aMin;
-
- if (P.size() <3)
+ if ( P.size() < 3 )
return 0.;
- aMin = getAngle(P( P.size() ), P( 1 ), P( 2 ));
- aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 )));
+ double aMaxCos2;
+
+ aMaxCos2 = getCos2( P( P.size() ), P( 1 ), P( 2 ));
+ aMaxCos2 = Max( aMaxCos2, getCos2( P( P.size()-1 ), P( P.size() ), P( 1 )));
for ( size_t i = 2; i < P.size(); i++ )
{
- double A0 = getAngle( P( i-1 ), P( i ), P( i+1 ) );
- aMin = Min(aMin,A0);
+ double A0 = getCos2( P( i-1 ), P( i ), P( i+1 ) );
+ aMaxCos2 = Max( aMaxCos2, A0 );
}
+ if ( aMaxCos2 < 0 )
+ return 0; // all nodes coincide
- return aMin * 180.0 / M_PI;
+ double cos = sqrt( aMaxCos2 );
+ if ( cos >= 1 ) return 0;
+ return acos( cos ) * 180.0 / M_PI;
}
double MinimumAngle::GetBadRate( double Value, int nbNodes ) const
if ( myCurrElement && myCurrElement->GetVtkType() == VTK_QUAD )
{
// issue 21723
- vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myCurrElement->getMeshId()]->getGrid();
- if ( vtkCell* avtkCell = grid->GetCell( myCurrElement->getVtkId() ))
+ vtkUnstructuredGrid* grid = const_cast<SMDS_Mesh*>( myMesh )->GetGrid();
+ if ( vtkCell* avtkCell = grid->GetCell( myCurrElement->GetVtkID() ))
aVal = Round( vtkMeshQuality::QuadAspectRatio( avtkCell ));
}
else
if ( nbNodes == 3 ) {
// Compute lengths of the sides
- std::vector< double > aLen (nbNodes);
- for ( int i = 0; i < nbNodes - 1; i++ )
- aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) );
- aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) );
+ double aLen1 = getDistance( P( 1 ), P( 2 ));
+ double aLen2 = getDistance( P( 2 ), P( 3 ));
+ double aLen3 = getDistance( P( 3 ), P( 1 ));
// Q = alfa * h * p / S, where
//
// alfa = sqrt( 3 ) / 6
// h - length of the longest edge
// p - half perimeter
// S - triangle surface
- const double alfa = sqrt( 3. ) / 6.;
- double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
- double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.;
- double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
+ const double alfa = sqrt( 3. ) / 6.;
+ double maxLen = Max( aLen1, Max( aLen2, aLen3 ));
+ double half_perimeter = ( aLen1 + aLen2 + aLen3 ) / 2.;
+ double anArea = getArea( P( 1 ), P( 2 ), P( 3 ));
if ( anArea <= theEps )
return theInf;
return alfa * maxLen * half_perimeter / anArea;
}
else if ( nbNodes == 6 ) { // quadratic triangles
// Compute lengths of the sides
- std::vector< double > aLen (3);
- aLen[0] = getDistance( P(1), P(3) );
- aLen[1] = getDistance( P(3), P(5) );
- aLen[2] = getDistance( P(5), P(1) );
- // Q = alfa * h * p / S, where
- //
- // alfa = sqrt( 3 ) / 6
- // h - length of the longest edge
- // p - half perimeter
- // S - triangle surface
- const double alfa = sqrt( 3. ) / 6.;
- double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) );
- double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.;
- double anArea = getArea( P(1), P(3), P(5) );
+ double aLen1 = getDistance( P( 1 ), P( 3 ));
+ double aLen2 = getDistance( P( 3 ), P( 5 ));
+ double aLen3 = getDistance( P( 5 ), P( 1 ));
+ // algo same as for the linear triangle
+ const double alfa = sqrt( 3. ) / 6.;
+ double maxLen = Max( aLen1, Max( aLen2, aLen3 ));
+ double half_perimeter = ( aLen1 + aLen2 + aLen3 ) / 2.;
+ double anArea = getArea( P( 1 ), P( 3 ), P( 5 ));
if ( anArea <= theEps )
return theInf;
return alfa * maxLen * half_perimeter / anArea;
}
else if( nbNodes == 4 ) { // quadrangle
// Compute lengths of the sides
- std::vector< double > aLen (4);
+ double aLen[4];
aLen[0] = getDistance( P(1), P(2) );
aLen[1] = getDistance( P(2), P(3) );
aLen[2] = getDistance( P(3), P(4) );
aLen[3] = getDistance( P(4), P(1) );
// Compute lengths of the diagonals
- std::vector< double > aDia (2);
+ double aDia[2];
aDia[0] = getDistance( P(1), P(3) );
aDia[1] = getDistance( P(2), P(4) );
// Compute areas of all triangles which can be built
// taking three nodes of the quadrangle
- std::vector< double > anArea (4);
+ double anArea[4];
anArea[0] = getArea( P(1), P(2), P(3) );
anArea[1] = getArea( P(1), P(2), P(4) );
anArea[2] = getArea( P(1), P(3), P(4) );
// Si - areas of the triangles
const double alpha = sqrt( 1 / 32. );
double L = Max( aLen[ 0 ],
- Max( aLen[ 1 ],
- Max( aLen[ 2 ],
- Max( aLen[ 3 ],
- Max( aDia[ 0 ], aDia[ 1 ] ) ) ) ) );
+ Max( aLen[ 1 ],
+ Max( aLen[ 2 ],
+ Max( aLen[ 3 ],
+ Max( aDia[ 0 ], aDia[ 1 ] ) ) ) ) );
double C1 = sqrt( ( aLen[0] * aLen[0] +
aLen[1] * aLen[1] +
aLen[2] * aLen[2] +
aLen[3] * aLen[3] ) / 4. );
double C2 = Min( anArea[ 0 ],
- Min( anArea[ 1 ],
- Min( anArea[ 2 ], anArea[ 3 ] ) ) );
+ Min( anArea[ 1 ],
+ Min( anArea[ 2 ], anArea[ 3 ] ) ) );
if ( C2 <= theEps )
return theInf;
return alpha * L * C1 / C2;
}
else if( nbNodes == 8 || nbNodes == 9 ) { // nbNodes==8 - quadratic quadrangle
// Compute lengths of the sides
- std::vector< double > aLen (4);
+ double aLen[4];
aLen[0] = getDistance( P(1), P(3) );
aLen[1] = getDistance( P(3), P(5) );
aLen[2] = getDistance( P(5), P(7) );
aLen[3] = getDistance( P(7), P(1) );
// Compute lengths of the diagonals
- std::vector< double > aDia (2);
+ double aDia[2];
aDia[0] = getDistance( P(1), P(5) );
aDia[1] = getDistance( P(3), P(7) );
// Compute areas of all triangles which can be built
// taking three nodes of the quadrangle
- std::vector< double > anArea (4);
+ double anArea[4];
anArea[0] = getArea( P(1), P(3), P(5) );
anArea[1] = getArea( P(1), P(3), P(7) );
anArea[2] = getArea( P(1), P(5), P(7) );
// Action from CoTech | ACTION 31.3:
// EURIWARE BO: Homogenize the formulas used to calculate the Controls in SMESH to fit with
// those of ParaView. The library used by ParaView for those calculations can be reused in SMESH.
- vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myCurrElement->getMeshId()]->getGrid();
- if ( vtkCell* avtkCell = grid->GetCell( myCurrElement->getVtkId() ))
+ vtkUnstructuredGrid* grid = const_cast<SMDS_Mesh*>( myMesh )->GetGrid();
+ if ( vtkCell* avtkCell = grid->GetCell( myCurrElement->GetVtkID() ))
aVal = Round( vtkMeshQuality::TetAspectRatio( avtkCell ));
}
else
int nbNodes = P.size();
- if(myCurrElement->IsQuadratic()) {
+ if( myCurrElement->IsQuadratic() ) {
if(nbNodes==10) nbNodes=4; // quadratic tetrahedron
else if(nbNodes==13) nbNodes=5; // quadratic pyramid
else if(nbNodes==15) nbNodes=6; // quadratic pentahedron
} // switch(nbNodes)
if ( nbNodes > 4 ) {
- // avaluate aspect ratio of quadranle faces
+ // evaluate aspect ratio of quadrangle faces
AspectRatio aspect2D;
SMDS_VolumeTool::VolumeType type = SMDS_VolumeTool::GetType( nbNodes );
int nbFaces = SMDS_VolumeTool::NbFaces( type );
if ( SMDS_VolumeTool::NbFaceNodes( type, i ) != 4 )
continue;
const int* pInd = SMDS_VolumeTool::GetFaceNodesIndices( type, i, true );
- for ( int p = 0; p < 4; ++p ) // loop on nodes of a quadranle face
+ for ( int p = 0; p < 4; ++p ) // loop on nodes of a quadrangle face
points( p + 1 ) = P( pInd[ p ] + 1 );
aQuality = std::max( aQuality, aspect2D.GetValue( points ));
}
void Length2D::GetValues(TValues& theValues)
{
TValues aValues;
- SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
- for(; anIter->more(); ){
+ for ( SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); anIter->more(); )
+ {
const SMDS_MeshFace* anElem = anIter->next();
-
- if(anElem->IsQuadratic()) {
- const SMDS_VtkFace* F =
- dynamic_cast<const SMDS_VtkFace*>(anElem);
+ if ( anElem->IsQuadratic() )
+ {
// use special nodes iterator
- SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
+ SMDS_NodeIteratorPtr anIter = anElem->interlacedNodesIterator();
long aNodeId[4] = { 0,0,0,0 };
gp_Pnt P[4];
double aLength = 0;
- const SMDS_MeshElement* aNode;
- if(anIter->more()){
- aNode = anIter->next();
- const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
- P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
+ if ( anIter->more() )
+ {
+ const SMDS_MeshNode* aNode = anIter->next();
+ P[0] = P[1] = SMESH_NodeXYZ( aNode );
aNodeId[0] = aNodeId[1] = aNode->GetID();
aLength = 0;
}
- for(; anIter->more(); ){
- const SMDS_MeshNode* N1 = static_cast<const SMDS_MeshNode*> (anIter->next());
- P[2] = gp_Pnt(N1->X(),N1->Y(),N1->Z());
+ for ( ; anIter->more(); )
+ {
+ const SMDS_MeshNode* N1 = anIter->next();
+ P[2] = SMESH_NodeXYZ( N1 );
aNodeId[2] = N1->GetID();
aLength = P[1].Distance(P[2]);
if(!anIter->more()) break;
- const SMDS_MeshNode* N2 = static_cast<const SMDS_MeshNode*> (anIter->next());
- P[3] = gp_Pnt(N2->X(),N2->Y(),N2->Z());
+ const SMDS_MeshNode* N2 = anIter->next();
+ P[3] = SMESH_NodeXYZ( N2 );
aNodeId[3] = N2->GetID();
aLength += P[2].Distance(P[3]);
Value aValue1(aLength,aNodeId[1],aNodeId[2]);
theValues.insert(aValue2);
}
else {
- SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+ SMDS_NodeIteratorPtr aNodesIter = anElem->nodeIterator();
long aNodeId[2] = {0,0};
gp_Pnt P[3];
double aLength;
const SMDS_MeshElement* aNode;
- if(aNodesIter->more()){
+ if ( aNodesIter->more())
+ {
aNode = aNodesIter->next();
- const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
- P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
+ P[0] = P[1] = SMESH_NodeXYZ( aNode );
aNodeId[0] = aNodeId[1] = aNode->GetID();
aLength = 0;
}
- for(; aNodesIter->more(); ){
+ for( ; aNodesIter->more(); )
+ {
aNode = aNodesIter->next();
- const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
long anId = aNode->GetID();
-
- P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
-
+
+ P[2] = SMESH_NodeXYZ( aNode );
+
aLength = P[1].Distance(P[2]);
-
+
Value aValue(aLength,aNodeId[1],anId);
aNodeId[1] = anId;
P[1] = P[2];
if ( !S.IsNull() && S.ShapeType() == TopAbs_FACE )
{
mySurface = new ShapeAnalysis_Surface( BRep_Tool::Surface( TopoDS::Face( S )));
+
+ GeomLib_IsPlanarSurface isPlaneCheck( mySurface->Surface() );
+ if ( isPlaneCheck.IsPlanar() )
+ myPlane.reset( new gp_Pln( isPlaneCheck.Plan() ));
+ else
+ myPlane.reset();
}
}
// project gravity center to the surface
{
gc += P(i+1);
- if ( const SMDS_FacePosition* fPos = dynamic_cast<const SMDS_FacePosition*>
- ( P.getElement()->GetNode( i )->GetPosition() ))
+ if ( SMDS_FacePositionPtr fPos = P.getElement()->GetNode( i )->GetPosition() )
{
uv.ChangeCoord(1) += fPos->GetUParameter();
uv.ChangeCoord(2) += fPos->GetVParameter();
double maxLen = MaxElementLength2D().GetValue( P );
double tol = 1e-3 * maxLen;
- if ( uv.X() != 0 && uv.Y() != 0 ) // faster way
- mySurface->NextValueOfUV( uv, gc, tol, 0.5 * maxLen );
+ double dist;
+ if ( myPlane )
+ {
+ dist = myPlane->Distance( gc );
+ if ( dist < tol )
+ dist = 0;
+ }
else
- mySurface->ValueOfUV( gc, tol );
-
- return Round( mySurface->Gap() );
+ {
+ if ( uv.X() != 0 && uv.Y() != 0 ) // faster way
+ mySurface->NextValueOfUV( uv, gc, tol, 0.5 * maxLen );
+ else
+ mySurface->ValueOfUV( gc, tol );
+ dist = mySurface->Gap();
+ }
+ return Round( dist );
}
}
return 0;
{
NumericalFunctor::SetMesh( dynamic_cast<const SMESHDS_Mesh* >( theMesh ));
myShapeIndex = -100;
+ myPlane.reset();
}
SMDSAbs_ElementType Deflection2D::GetType() const
void MultiConnection2D::GetValues(MValues& theValues)
{
if ( !myMesh ) return;
- SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
- for(; anIter->more(); ){
- const SMDS_MeshFace* anElem = anIter->next();
- SMDS_ElemIteratorPtr aNodesIter;
- if ( anElem->IsQuadratic() )
- aNodesIter = dynamic_cast<const SMDS_VtkFace*>
- (anElem)->interlacedNodesElemIterator();
- else
- aNodesIter = anElem->nodesIterator();
- long aNodeId[3] = {0,0,0};
+ for ( SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); anIter->more(); )
+ {
+ const SMDS_MeshFace* anElem = anIter->next();
+ SMDS_NodeIteratorPtr aNodesIter = anElem->interlacedNodesIterator();
- //int aNbConnects=0;
- const SMDS_MeshNode* aNode0;
- const SMDS_MeshNode* aNode1;
+ const SMDS_MeshNode* aNode1 = anElem->GetNode( anElem->NbNodes() - 1 );
const SMDS_MeshNode* aNode2;
- if(aNodesIter->more()){
- aNode0 = (SMDS_MeshNode*) aNodesIter->next();
- aNode1 = aNode0;
- const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode1;
- aNodeId[0] = aNodeId[1] = aNodes->GetID();
- }
- for(; aNodesIter->more(); ) {
- aNode2 = (SMDS_MeshNode*) aNodesIter->next();
- long anId = aNode2->GetID();
- aNodeId[2] = anId;
-
- Value aValue(aNodeId[1],aNodeId[2]);
- MValues::iterator aItr = theValues.find(aValue);
- if (aItr != theValues.end()){
- aItr->second += 1;
- //aNbConnects = nb;
- }
- else {
- theValues[aValue] = 1;
- //aNbConnects = 1;
- }
- //cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
- aNodeId[1] = aNodeId[2];
+ for ( ; aNodesIter->more(); )
+ {
+ aNode2 = aNodesIter->next();
+
+ Value aValue ( aNode1->GetID(), aNode2->GetID() );
+ MValues::iterator aItr = theValues.insert( std::make_pair( aValue, 0 )).first;
+ aItr->second++;
aNode1 = aNode2;
}
- Value aValue(aNodeId[0],aNodeId[2]);
- MValues::iterator aItr = theValues.find(aValue);
- if (aItr != theValues.end()) {
- aItr->second += 1;
- //aNbConnects = nb;
- }
- else {
- theValues[aValue] = 1;
- //aNbConnects = 1;
- }
- //cout << "NodeIds: "<<aNodeId[0]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
}
-
+ return;
}
//================================================================================
double diameter = 0;
if ( const SMDS_BallElement* ball =
- dynamic_cast<const SMDS_BallElement*>( myMesh->FindElement( theId )))
+ myMesh->DownCast< SMDS_BallElement >( myMesh->FindElement( theId )))
{
diameter = ball->GetDiameter();
}
if ( myMeshModifTracer.IsMeshModified() )
{
TIDSortedNodeSet nodesToCheck;
- SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator(/*idInceasingOrder=*/true);
+ SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator();
while ( nIt->more() )
nodesToCheck.insert( nodesToCheck.end(), nIt->next() );
void FreeEdges::GetBoreders(TBorders& theBorders)
{
TBorders aRegistry;
- SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
- for(; anIter->more(); ){
+ for ( SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); anIter->more(); )
+ {
const SMDS_MeshFace* anElem = anIter->next();
long anElemId = anElem->GetID();
- SMDS_ElemIteratorPtr aNodesIter;
- if ( anElem->IsQuadratic() )
- aNodesIter = static_cast<const SMDS_VtkFace*>(anElem)->
- interlacedNodesElemIterator();
- else
- aNodesIter = anElem->nodesIterator();
+ SMDS_NodeIteratorPtr aNodesIter = anElem->interlacedNodesIterator();
+ if ( !aNodesIter->more() ) continue;
long aNodeId[2] = {0,0};
- const SMDS_MeshElement* aNode;
- if(aNodesIter->more()){
- aNode = aNodesIter->next();
- aNodeId[0] = aNodeId[1] = aNode->GetID();
- }
- for(; aNodesIter->more(); ){
- aNode = aNodesIter->next();
- long anId = aNode->GetID();
- Border aBorder(anElemId,aNodeId[1],anId);
- aNodeId[1] = anId;
- UpdateBorders(aBorder,aRegistry,theBorders);
+ aNodeId[0] = anElem->GetNode( anElem->NbNodes()-1 )->GetID();
+ for ( ; aNodesIter->more(); )
+ {
+ aNodeId[1] = aNodesIter->next()->GetID();
+ Border aBorder( anElemId, aNodeId[0], aNodeId[1] );
+ UpdateBorders( aBorder, aRegistry, theBorders );
+ aNodeId[0] = aNodeId[1];
}
- Border aBorder(anElemId,aNodeId[0],aNodeId[1]);
- UpdateBorders(aBorder,aRegistry,theBorders);
}
}
{
// keep elements of myType
const SMDS_MeshElement* element = eIt->next();
- if ( element->GetType() == myType )
+ if ( myType == SMDSAbs_All || element->GetType() == myType )
myOkIDs.insert( myOkIDs.end(), element->GetID() );
// enqueue nodes of the element
void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
ManifoldPart::TVectorOfFacePtr& theFaces ) const
{
- std::set<SMDS_MeshCell *> aSetOfFaces;
+
// take all faces that shared first node
- SMDS_ElemIteratorPtr anItr = theLink.myNode1->facesIterator();
- for ( ; anItr->more(); )
- {
- SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
- if ( !aFace )
- continue;
- aSetOfFaces.insert( aFace );
- }
+ SMDS_ElemIteratorPtr anItr = theLink.myNode1->GetInverseElementIterator( SMDSAbs_Face );
+ SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > faces( anItr ), facesEnd;
+ std::set<const SMDS_MeshElement *> aSetOfFaces( faces, facesEnd );
+
// take all faces that shared second node
- anItr = theLink.myNode2->facesIterator();
+ anItr = theLink.myNode2->GetInverseElementIterator( SMDSAbs_Face );
// find the common part of two sets
for ( ; anItr->more(); )
{
- SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
- if ( aSetOfFaces.count( aFace ) )
- theFaces.push_back( aFace );
+ const SMDS_MeshElement* aFace = anItr->next();
+ if ( aSetOfFaces.count( aFace ))
+ theFaces.push_back( (SMDS_MeshFace*) aFace );
}
}
return isSatisfy;
}
+//================================================================================
+/*!
+ * \brief Check and optionally return a satisfying shape
+ */
+//================================================================================
+
bool ElementsOnShape::IsSatisfy (const SMDS_MeshNode* node,
TopoDS_Shape* okShape)
{
bool ElementsOnShape::Classifier::isOutOfSolid (const gp_Pnt& p)
{
+ if ( isOutOfBox( p )) return true;
mySolidClfr->Perform( p, myTol );
return ( mySolidClfr->State() != TopAbs_IN && mySolidClfr->State() != TopAbs_ON );
}
bool ElementsOnShape::Classifier::isOutOfFace (const gp_Pnt& p)
{
+ if ( isOutOfBox( p )) return true;
myProjFace.Perform( p );
if ( myProjFace.IsDone() && myProjFace.LowerDistance() <= myTol )
{
bool ElementsOnShape::Classifier::isOutOfEdge (const gp_Pnt& p)
{
+ if ( isOutOfBox( p )) return true;
myProjEdge.Perform( p );
return ! ( myProjEdge.NbPoints() > 0 && myProjEdge.LowerDistance() <= myTol );
}
{
if ( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ))
{
- if ( anElem->GetType() == myType )
+ if ( myType == SMDSAbs_All || anElem->GetType() == myType )
{
if ( anElem->getshapeId() < 1 )
return myElementsOnShapePtr->IsSatisfy(theId);
if ( mySubShapesIDs.Contains( elem->getshapeId() ))
return true;
- if ( elem->GetType() != SMDSAbs_Node && elem->GetType() == myType )
+ if (( elem->GetType() != SMDSAbs_Node ) &&
+ ( myType == SMDSAbs_All || elem->GetType() == myType ))
{
SMDS_ElemIteratorPtr nodeItr = elem->nodesIterator();
while ( nodeItr->more() )