-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen)
{
- //gen->_mapAlgo[hypId] = this;
-
_onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
_quadraticMesh = _supportSubmeshes = false;
_error = COMPERR_OK;
{
_shapeType = (1 << TopAbs_VERTEX);
_type = ALGO_0D;
- //gen->_map0D_Algo[hypId] = this;
}
SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_EDGE);
_type = ALGO_1D;
- //gen->_map1D_Algo[hypId] = this;
}
SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_FACE);
_type = ALGO_2D;
- //gen->_map2D_Algo[hypId] = this;
}
SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Algo(hypId, studyId, gen)
{
_shapeType = (1 << TopAbs_SOLID);
_type = ALGO_3D;
- //gen->_map3D_Algo[hypId] = this;
}
//=============================================================================
double SMESH_Algo::EdgeLength(const TopoDS_Edge & E)
{
double UMin = 0, UMax = 0;
- if (BRep_Tool::Degenerated(E))
- return 0;
TopLoc_Location L;
Handle(Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax);
+ if ( C.IsNull() )
+ return 0.;
GeomAdaptor_Curve AdaptCurve(C, UMin, UMax); //range is important for periodic curves
double length = GCPnts_AbscissaPoint::Length(AdaptCurve, UMin, UMax);
return length;
return false;
SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
- if ( !eSubMesh || !eSubMesh->GetElements()->more() )
+ if ( !eSubMesh || ( /*eSubMesh->NbElements()==0 && */ eSubMesh->NbNodes() == 0))
return false; // edge is not meshed
int nbNodes = 0;
*/
//================================================================================
-bool SMESH_Algo::isStraight( const TopoDS_Edge & E,
+bool SMESH_Algo::IsStraight( const TopoDS_Edge & E,
const bool degenResult)
{
{
return true;
}
+//================================================================================
+/*!
+ * \brief Return true if an edge has no 3D curve
+ */
+//================================================================================
+
+bool SMESH_Algo::isDegenerated( const TopoDS_Edge & E )
+{
+ double f,l;
+ TopLoc_Location loc;
+ Handle(Geom_Curve) C = BRep_Tool::Curve( E, loc, f,l );
+ return C.IsNull();
+}
+
//================================================================================
/*!
* \brief Return the node built on a vertex