mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-14 09:38:33 +05:00
bos #29540 25009 - mesh fails
This commit is contained in:
parent
c728e8a558
commit
7242eaf55b
@ -4343,7 +4343,7 @@ namespace {
|
|||||||
|
|
||||||
struct ElementsOnShape::Classifier
|
struct ElementsOnShape::Classifier
|
||||||
{
|
{
|
||||||
Classifier() { mySolidClfr = 0; myFlags = 0; }
|
Classifier(): mySolidClfr(0), myProjFace(0), myProjEdge(0), myFlags(0) { myU = myV = 1e100; }
|
||||||
~Classifier();
|
~Classifier();
|
||||||
void Init(const TopoDS_Shape& s, double tol, const Bnd_B3d* box = 0 );
|
void Init(const TopoDS_Shape& s, double tol, const Bnd_B3d* box = 0 );
|
||||||
bool IsOut(const gp_Pnt& p) { return SetChecked( true ), (this->*myIsOutFun)( p ); }
|
bool IsOut(const gp_Pnt& p) { return SetChecked( true ), (this->*myIsOutFun)( p ); }
|
||||||
@ -4356,6 +4356,7 @@ struct ElementsOnShape::Classifier
|
|||||||
void SetChecked( bool is ) { is ? SetFlag( theIsCheckedFlag ) : UnsetFlag( theIsCheckedFlag ); }
|
void SetChecked( bool is ) { is ? SetFlag( theIsCheckedFlag ) : UnsetFlag( theIsCheckedFlag ); }
|
||||||
void SetFlag ( int flag ) { myFlags |= flag; }
|
void SetFlag ( int flag ) { myFlags |= flag; }
|
||||||
void UnsetFlag( int flag ) { myFlags &= ~flag; }
|
void UnsetFlag( int flag ) { myFlags &= ~flag; }
|
||||||
|
void GetParams( double & u, double & v ) const { u = myU; v = myV; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isOutOfSolid (const gp_Pnt& p);
|
bool isOutOfSolid (const gp_Pnt& p);
|
||||||
@ -4369,13 +4370,14 @@ private:
|
|||||||
TopoDS_Shape prepareSolid( const TopoDS_Shape& theSolid );
|
TopoDS_Shape prepareSolid( const TopoDS_Shape& theSolid );
|
||||||
|
|
||||||
bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
|
bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
|
||||||
BRepClass3d_SolidClassifier* mySolidClfr; // ptr because of a run-time forbidden copy-constructor
|
BRepClass3d_SolidClassifier* mySolidClfr;
|
||||||
Bnd_B3d myBox;
|
Bnd_B3d myBox;
|
||||||
GeomAPI_ProjectPointOnSurf myProjFace;
|
GeomAPI_ProjectPointOnSurf* myProjFace;
|
||||||
GeomAPI_ProjectPointOnCurve myProjEdge;
|
GeomAPI_ProjectPointOnCurve* myProjEdge;
|
||||||
gp_Pnt myVertexXYZ;
|
gp_Pnt myVertexXYZ;
|
||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
double myTol;
|
double myTol;
|
||||||
|
double myU, myV; // result of isOutOfFace() and isOutOfEdge()
|
||||||
int myFlags;
|
int myFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4686,6 +4688,7 @@ bool ElementsOnShape::IsSatisfy (const SMDS_MeshNode* node,
|
|||||||
isNodeOut = false;
|
isNodeOut = false;
|
||||||
if ( okShape )
|
if ( okShape )
|
||||||
*okShape = myWorkClassifiers[i]->Shape();
|
*okShape = myWorkClassifiers[i]->Shape();
|
||||||
|
myWorkClassifiers[i]->GetParams( myU, myV );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4697,6 +4700,7 @@ bool ElementsOnShape::IsSatisfy (const SMDS_MeshNode* node,
|
|||||||
isNodeOut = false;
|
isNodeOut = false;
|
||||||
if ( okShape )
|
if ( okShape )
|
||||||
*okShape = myClassifiers[i].Shape();
|
*okShape = myClassifiers[i].Shape();
|
||||||
|
myClassifiers[i].GetParams( myU, myV );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4739,7 +4743,8 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
surf->Bounds( u1,u2,v1,v2 );
|
surf->Bounds( u1,u2,v1,v2 );
|
||||||
myProjFace.Init(surf, u1,u2, v1,v2, myTol );
|
myProjFace = new GeomAPI_ProjectPointOnSurf;
|
||||||
|
myProjFace->Init( surf, u1,u2, v1,v2, myTol );
|
||||||
myIsOutFun = & ElementsOnShape::Classifier::isOutOfFace;
|
myIsOutFun = & ElementsOnShape::Classifier::isOutOfFace;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4752,7 +4757,8 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape,
|
|||||||
myIsOutFun = & ElementsOnShape::Classifier::isOutOfNone;
|
myIsOutFun = & ElementsOnShape::Classifier::isOutOfNone;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myProjEdge.Init(curve, u1, u2);
|
myProjEdge = new GeomAPI_ProjectPointOnCurve;
|
||||||
|
myProjEdge->Init( curve, u1, u2 );
|
||||||
myIsOutFun = & ElementsOnShape::Classifier::isOutOfEdge;
|
myIsOutFun = & ElementsOnShape::Classifier::isOutOfEdge;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4802,6 +4808,8 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape,
|
|||||||
ElementsOnShape::Classifier::~Classifier()
|
ElementsOnShape::Classifier::~Classifier()
|
||||||
{
|
{
|
||||||
delete mySolidClfr; mySolidClfr = 0;
|
delete mySolidClfr; mySolidClfr = 0;
|
||||||
|
delete myProjFace; myProjFace = 0;
|
||||||
|
delete myProjEdge; myProjEdge = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape ElementsOnShape::Classifier::prepareSolid( const TopoDS_Shape& theSolid )
|
TopoDS_Shape ElementsOnShape::Classifier::prepareSolid( const TopoDS_Shape& theSolid )
|
||||||
@ -4838,13 +4846,12 @@ bool ElementsOnShape::Classifier::isOutOfBox( const gp_Pnt& p )
|
|||||||
bool ElementsOnShape::Classifier::isOutOfFace( const gp_Pnt& p )
|
bool ElementsOnShape::Classifier::isOutOfFace( const gp_Pnt& p )
|
||||||
{
|
{
|
||||||
if ( isOutOfBox( p )) return true;
|
if ( isOutOfBox( p )) return true;
|
||||||
myProjFace.Perform( p );
|
myProjFace->Perform( p );
|
||||||
if ( myProjFace.IsDone() && myProjFace.LowerDistance() <= myTol )
|
if ( myProjFace->IsDone() && myProjFace->LowerDistance() <= myTol )
|
||||||
{
|
{
|
||||||
// check relatively to the face
|
// check relatively to the face
|
||||||
Standard_Real u, v;
|
myProjFace->LowerDistanceParameters( myU, myV );
|
||||||
myProjFace.LowerDistanceParameters(u, v);
|
gp_Pnt2d aProjPnt( myU, myV );
|
||||||
gp_Pnt2d aProjPnt (u, v);
|
|
||||||
BRepClass_FaceClassifier aClsf ( TopoDS::Face( myShape ), aProjPnt, myTol );
|
BRepClass_FaceClassifier aClsf ( TopoDS::Face( myShape ), aProjPnt, myTol );
|
||||||
if ( aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON )
|
if ( aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON )
|
||||||
return false;
|
return false;
|
||||||
@ -4855,8 +4862,11 @@ bool ElementsOnShape::Classifier::isOutOfFace( const gp_Pnt& p )
|
|||||||
bool ElementsOnShape::Classifier::isOutOfEdge( const gp_Pnt& p )
|
bool ElementsOnShape::Classifier::isOutOfEdge( const gp_Pnt& p )
|
||||||
{
|
{
|
||||||
if ( isOutOfBox( p )) return true;
|
if ( isOutOfBox( p )) return true;
|
||||||
myProjEdge.Perform( p );
|
myProjEdge->Perform( p );
|
||||||
return ! ( myProjEdge.NbPoints() > 0 && myProjEdge.LowerDistance() <= myTol );
|
bool isOn = ( myProjEdge->NbPoints() > 0 && myProjEdge->LowerDistance() <= myTol );
|
||||||
|
if ( isOn )
|
||||||
|
myU = myProjEdge->LowerDistanceParameter();
|
||||||
|
return !isOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ElementsOnShape::Classifier::isOutOfVertex( const gp_Pnt& p )
|
bool ElementsOnShape::Classifier::isOutOfVertex( const gp_Pnt& p )
|
||||||
|
@ -947,6 +947,7 @@ namespace SMESH{
|
|||||||
const SMDSAbs_ElementType theType);
|
const SMDSAbs_ElementType theType);
|
||||||
bool IsSatisfy (const SMDS_MeshElement* elem);
|
bool IsSatisfy (const SMDS_MeshElement* elem);
|
||||||
bool IsSatisfy (const SMDS_MeshNode* node, TopoDS_Shape* okShape=0);
|
bool IsSatisfy (const SMDS_MeshNode* node, TopoDS_Shape* okShape=0);
|
||||||
|
void GetParams( double & u, double & v ) const { u = myU; v = myV; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -963,6 +964,7 @@ namespace SMESH{
|
|||||||
SMDSAbs_ElementType myType;
|
SMDSAbs_ElementType myType;
|
||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
double myToler;
|
double myToler;
|
||||||
|
double myU, myV; // result of node projection on EDGE or FACE
|
||||||
bool myAllNodesFlag;
|
bool myAllNodesFlag;
|
||||||
|
|
||||||
TMeshModifTracer myMeshModifTracer;
|
TMeshModifTracer myMeshModifTracer;
|
||||||
|
@ -384,7 +384,7 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
|||||||
isOut = ( nodeState[i] == TopAbs_OUT );
|
isOut = ( nodeState[i] == TopAbs_OUT );
|
||||||
if (( isOut ) &&
|
if (( isOut ) &&
|
||||||
( !isOutBox || helper.IsOnSeam( uv )) &&
|
( !isOutBox || helper.IsOnSeam( uv )) &&
|
||||||
onEdgeClassifier.IsSatisfy( node->GetID() ))
|
onEdgeClassifier.IsSatisfy( node ))
|
||||||
{
|
{
|
||||||
// uv.SetCoord( iCoo, helper.GetOtherParam( uv.Coord( iCoo )));
|
// uv.SetCoord( iCoo, helper.GetOtherParam( uv.Coord( iCoo )));
|
||||||
// classifier.Perform( geomFace, uv, clsfTol );
|
// classifier.Perform( geomFace, uv, clsfTol );
|
||||||
@ -586,7 +586,9 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
|
|||||||
if ( onEdgeClassifier.IsSatisfy( n, &edge ))
|
if ( onEdgeClassifier.IsSatisfy( n, &edge ))
|
||||||
{
|
{
|
||||||
tgtFaceSM->RemoveNode( n );
|
tgtFaceSM->RemoveNode( n );
|
||||||
tgtMesh->SetNodeOnEdge( n, TopoDS::Edge(edge), /*u=*/0 );
|
double u, v;
|
||||||
|
onEdgeClassifier.GetParams( u, v );
|
||||||
|
tgtMesh->SetNodeOnEdge( n, TopoDS::Edge(edge), u );
|
||||||
}
|
}
|
||||||
nodesOnBoundary = subShapeIDs.count( n->getshapeId());
|
nodesOnBoundary = subShapeIDs.count( n->getshapeId());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user