Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Porting to OCCT 7.8.0
[modules/smesh.git]
/
src
/
StdMeshers
/
StdMeshers_Import_1D.cxx
diff --git
a/src/StdMeshers/StdMeshers_Import_1D.cxx
b/src/StdMeshers/StdMeshers_Import_1D.cxx
index e3d59a79c8e1fc3195d5319fe7b3da575481db24..f27e74dca17ce9b863ff66d61e493962ad0b918f 100644
(file)
--- a/
src/StdMeshers/StdMeshers_Import_1D.cxx
+++ b/
src/StdMeshers/StdMeshers_Import_1D.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-202
0 CEA/DEN, EDF R&D
, OPEN CASCADE
+// Copyright (C) 2007-202
4 CEA, EDF
, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-200,22
+200,37
@@
namespace // INTERNAL STUFF
if ( getBox()->IsOut( point ))
return false;
if ( getBox()->IsOut( point ))
return false;
+ bool ok = false;
+ double dist2, param;
+ distance2 = Precision::Infinite();
+
if ( isLeaf() )
{
for ( size_t i = 0; i < _segments.size(); ++i )
if ( !_segments[i].IsOut( point ) &&
if ( isLeaf() )
{
for ( size_t i = 0; i < _segments.size(); ++i )
if ( !_segments[i].IsOut( point ) &&
- _segments[i].IsOn( point, distance2, u ))
- return true;
+ _segments[i].IsOn( point, dist2, param ) &&
+ dist2 < distance2 )
+ {
+ distance2 = dist2;
+ u = param;
+ ok = true;
+ }
+ return ok;
}
else
{
for (int i = 0; i < 8; i++)
}
else
{
for (int i = 0; i < 8; i++)
- if (((CurveProjector*) myChildren[i])->IsOnCurve( point, distance2, u ))
- return true;
+ if (((CurveProjector*) myChildren[i])->IsOnCurve( point, dist2, param ) &&
+ dist2 < distance2 )
+ {
+ distance2 = dist2;
+ u = param;
+ ok = true;
+ }
}
}
- return
false
;
+ return
ok
;
}
}
-
+
//================================================================================
/*!
* \brief Initialize
//================================================================================
/*!
* \brief Initialize
@@
-233,13
+248,14
@@
namespace // INTERNAL STUFF
_pLast = pl;
_curve = curve;
_length2 = pf.SquareDistance( pl );
_pLast = pl;
_curve = curve;
_length2 = pf.SquareDistance( pl );
+ _line.SetLocation( pf );
+ _line.SetDirection( gp_Vec( pf, pl ));
_chord2 = Max( _line. SquareDistance( curve->Value( uf + 0.25 * ( ul - uf ))),
Max( _line.SquareDistance( curve->Value( uf + 0.5 * ( ul - uf ))),
_line.SquareDistance( curve->Value( uf + 0.75 * ( ul - uf )))));
_chord2 = Max( _line. SquareDistance( curve->Value( uf + 0.25 * ( ul - uf ))),
Max( _line.SquareDistance( curve->Value( uf + 0.5 * ( ul - uf ))),
_line.SquareDistance( curve->Value( uf + 0.75 * ( ul - uf )))));
+ _chord2 *= ( 1.05 * 1.05 ); // +5%
_chord2 = Max( tol, _chord2 );
_chord = Sqrt( _chord2 );
_chord2 = Max( tol, _chord2 );
_chord = Sqrt( _chord2 );
- _line.SetLocation( pf );
- _line.SetDirection( gp_Vec( pf, pl ));
Bnd_Box bb;
BndLib_Add3dCurve::Add( GeomAdaptor_Curve( curve, uf, ul ), tol, bb );
Bnd_Box bb;
BndLib_Add3dCurve::Add( GeomAdaptor_Curve( curve, uf, ul ), tol, bb );
@@
-268,12
+284,12
@@
namespace // INTERNAL STUFF
gp_Vec edge( _pFirst, _pLast );
gp_Vec n1p ( _pFirst, point );
u = ( edge * n1p ) / _length2; // param [0,1] on the edge
gp_Vec edge( _pFirst, _pLast );
gp_Vec n1p ( _pFirst, point );
u = ( edge * n1p ) / _length2; // param [0,1] on the edge
- if ( u < 0 )
+ if ( u < 0
.
)
{
if ( _pFirst.SquareDistance( point ) > _chord2 )
return false;
}
{
if ( _pFirst.SquareDistance( point ) > _chord2 )
return false;
}
- else if ( u >
_chord
)
+ else if ( u >
1.
)
{
if ( _pLast.SquareDistance( point ) > _chord2 )
return false;
{
if ( _pLast.SquareDistance( point ) > _chord2 )
return false;
@@
-419,6
+435,7
@@
namespace // INTERNAL STUFF
case TopAbs_EDGE:
if ( SMESH_Algo::isDegenerated( TopoDS::Edge( sm->GetSubShape() )))
continue;
case TopAbs_EDGE:
if ( SMESH_Algo::isDegenerated( TopoDS::Edge( sm->GetSubShape() )))
continue;
+ // fall through
case TopAbs_FACE:
_subM.insert( sm );
if ( !sm->IsEmpty() )
case TopAbs_FACE:
_subM.insert( sm );
if ( !sm->IsEmpty() )
@@
-677,14
+694,14
@@
namespace // INTERNAL STUFF
if ( removeImport )
{
if ( removeImport )
{
- // treat
e
removal of Import algo from subMesh
+ // treat removal of Import algo from subMesh
removeSubmesh( subMesh, (_ListenerData*) data );
}
else if ( modifHyp ||
( SMESH_subMesh::CLEAN == event &&
SMESH_subMesh::COMPUTE_EVENT == eventType))
{
removeSubmesh( subMesh, (_ListenerData*) data );
}
else if ( modifHyp ||
( SMESH_subMesh::CLEAN == event &&
SMESH_subMesh::COMPUTE_EVENT == eventType))
{
- // treat
e
modification of ImportSource hypothesis
+ // treat modification of ImportSource hypothesis
clearSubmesh( subMesh, (_ListenerData*) data, /*all=*/false );
}
else if ( SMESH_subMesh::CHECK_COMPUTE_STATE == event &&
clearSubmesh( subMesh, (_ListenerData*) data, /*all=*/false );
}
else if ( SMESH_subMesh::CHECK_COMPUTE_STATE == event &&
@@
-704,7
+721,7
@@
namespace // INTERNAL STUFF
d->_computedSubM.insert( *smIt);
}
}
d->_computedSubM.insert( *smIt);
}
}
- // Clear _ImportData::_n2n if it
's no more useful
, i.e. when
+ // Clear _ImportData::_n2n if it
isn't useful anymore
, i.e. when
// the event is not within mesh.Compute()
if ( SMESH_subMesh::ALGO_EVENT == eventType )
clearN2N( subMesh->GetFather() );
// the event is not within mesh.Compute()
if ( SMESH_subMesh::ALGO_EVENT == eventType )
clearN2N( subMesh->GetFather() );
@@
-928,23
+945,23
@@
bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
SMESHDS_Mesh* tgtMesh = theMesh.GetMeshDS();
const TopoDS_Edge& geomEdge = TopoDS::Edge( theShape );
SMESHDS_Mesh* tgtMesh = theMesh.GetMeshDS();
const TopoDS_Edge& geomEdge = TopoDS::Edge( theShape );
- const double edgeTol = BRep_Tool::Tolerance( geomEdge );
- const int shapeID = tgtMesh->ShapeToIndex( geomEdge );
-
+ const double edgeTol = helper.MaxTolerance( geomEdge );
+ const int shapeID = tgtMesh->ShapeToIndex( geomEdge );
double geomTol = Precision::Confusion();
double geomTol = Precision::Confusion();
+ double minGeomTol = std::numeric_limits<double>::max();
+
for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
for ( SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements(); srcElems->more(); )
{
const SMDS_MeshElement* edge = srcElems->next();
for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
for ( SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements(); srcElems->more(); )
{
const SMDS_MeshElement* edge = srcElems->next();
- geomTol = Sqrt( 0.5 * ( getMinEdgeLength2( edge->GetNode(0) ) +
- getMinEdgeLength2( edge->GetNode(1) ))) / 25;
- iG = srcGroups.size();
- break;
+ minGeomTol = std::min( Sqrt( getMinEdgeLength2( edge->GetNode(0) )) / 25, minGeomTol );
+ geomTol = minGeomTol;
}
}
}
}
+
CurveProjector curveProjector( geomEdge, geomTol );
// get nodes on vertices
CurveProjector curveProjector( geomEdge, geomTol );
// get nodes on vertices
@@
-1067,7
+1084,7
@@
bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
} // loop on groups
if ( n2n->empty())
} // loop on groups
if ( n2n->empty())
- return error("
Empty source groups
");
+ return error("
Source groups are empty or mismatching geometry
");
// check if the whole geom edge is covered by imported segments;
// the check consist in passing by segments from one vetrex node to another
// check if the whole geom edge is covered by imported segments;
// the check consist in passing by segments from one vetrex node to another
@@
-1294,7
+1311,7
@@
bool StdMeshers_Import_1D::Evaluate(SMESH_Mesh & theMesh,
if ( srcGroups.empty() )
return error("Invalid source groups");
if ( srcGroups.empty() )
return error("Invalid source groups");
- vector<
int
> aVec(SMDSEntity_Last,0);
+ vector<
smIdType
> aVec(SMDSEntity_Last,0);
bool toCopyMesh, toCopyGroups;
_sourceHyp->GetCopySourceMesh(toCopyMesh, toCopyGroups);
bool toCopyMesh, toCopyGroups;
_sourceHyp->GetCopySourceMesh(toCopyMesh, toCopyGroups);