SMESH_MesherHelper::~SMESH_MesherHelper()
{
- TID2Projector::iterator i_proj = myFace2Projector.begin();
- for ( ; i_proj != myFace2Projector.end(); ++i_proj )
- delete i_proj->second;
+ {
+ TID2ProjectorOnSurf::iterator i_proj = myFace2Projector.begin();
+ for ( ; i_proj != myFace2Projector.end(); ++i_proj )
+ delete i_proj->second;
+ }
+ {
+ TID2ProjectorOnCurve::iterator i_proj = myEdge2Projector.begin();
+ for ( ; i_proj != myEdge2Projector.end(); ++i_proj )
+ delete i_proj->second;
+ }
}
//=======================================================================
{
Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
int faceID = GetMeshDS()->ShapeToIndex( F );
- TID2Projector& i2proj = const_cast< TID2Projector&>( myFace2Projector );
- TID2Projector::iterator i_proj = i2proj.find( faceID );
+ TID2ProjectorOnSurf& i2proj = const_cast< TID2ProjectorOnSurf&>( myFace2Projector );
+ TID2ProjectorOnSurf::iterator i_proj = i2proj.find( faceID );
if ( i_proj == i2proj.end() )
{
if ( tol == 0 ) tol = BRep_Tool::Tolerance( F );
if ( dist > tol )
{
// u incorrect, project the node to the curve
- GeomAPI_ProjectPointOnCurve projector( nodePnt, curve, f, l );
- if ( projector.NbPoints() < 1 )
+ int edgeID = GetMeshDS()->ShapeToIndex( E );
+ TID2ProjectorOnCurve& i2proj = const_cast< TID2ProjectorOnCurve&>( myEdge2Projector );
+ TID2ProjectorOnCurve::iterator i_proj =
+ i2proj.insert( make_pair( edgeID, (GeomAPI_ProjectPointOnCurve*) 0 )).first;
+ if ( !i_proj->second )
+ {
+ i_proj->second = new GeomAPI_ProjectPointOnCurve();
+ i_proj->second->Init( curve, f, l );
+ }
+ GeomAPI_ProjectPointOnCurve* projector = i_proj->second;
+ projector->Perform( nodePnt );
+ if ( projector->NbPoints() < 1 )
{
MESSAGE( "SMESH_MesherHelper::CheckNodeU() failed to project" );
return false;
}
- Quantity_Parameter U = projector.LowerDistanceParameter();
+ Quantity_Parameter U = projector->LowerDistanceParameter();
u = double( U );
dist = nodePnt.Distance( curve->Value( U ));
if ( distance ) *distance = dist;
shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape );
}
+//================================================================================
+/*!
+ * \brief Return maximal tolerance of shape
+ */
+//================================================================================
+
+double SMESH_MesherHelper::MaxTolerance( const TopoDS_Shape& shape )
+{
+ double tol = Precision::Confusion();
+ TopExp_Explorer exp;
+ for ( exp.Init( shape, TopAbs_FACE ); exp.More(); exp.Next() )
+ tol = Max( tol, BRep_Tool::Tolerance( TopoDS::Face( exp.Current())));
+ for ( exp.Init( shape, TopAbs_EDGE ); exp.More(); exp.Next() )
+ tol = Max( tol, BRep_Tool::Tolerance( TopoDS::Edge( exp.Current())));
+ for ( exp.Init( shape, TopAbs_VERTEX ); exp.More(); exp.Next() )
+ tol = Max( tol, BRep_Tool::Tolerance( TopoDS::Vertex( exp.Current())));
+
+ return tol;
+}
+
//=======================================================================
//function : IsQuadraticMesh
//purpose : Check mesh without geometry for: if all elements on this shape are quadratic,
#include <vector>
class GeomAPI_ProjectPointOnSurf;
+class GeomAPI_ProjectPointOnCurve;
typedef std::map<SMESH_TLink, const SMDS_MeshNode*> TLinkNodeMap;
typedef std::map<SMESH_TLink, const SMDS_MeshNode*>::iterator ItTLinkNode;
static bool IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh );
+ static double MaxTolerance( const TopoDS_Shape& shape );
+
public:
// ---------- PUBLIC INSTANCE METHODS ----------
const int id = 0,
const bool force3d = false);
/*!
- * Creates quadratic or linear tetraahedron
+ * Creates quadratic or linear tetrahedron
*/
SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n2,
double myPar1[2], myPar2[2]; // U and V bounds of a closed periodic surface
int myParIndex; // bounds' index (1-U, 2-V, 3-both)
- typedef std::map< int, GeomAPI_ProjectPointOnSurf* > TID2Projector;
- TID2Projector myFace2Projector;
+ typedef std::map< int, GeomAPI_ProjectPointOnSurf* > TID2ProjectorOnSurf;
+ TID2ProjectorOnSurf myFace2Projector;
+ typedef std::map< int, GeomAPI_ProjectPointOnCurve* > TID2ProjectorOnCurve;
+ TID2ProjectorOnCurve myEdge2Projector;
TopoDS_Shape myShape;
SMESH_Mesh* myMesh;