X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Algo.cxx;h=95c81e419ac658ac4ebf3d5f11bb5d51c80bf8f5;hp=f08542dc0f73c1ce3e9c48387d055c853a36fdbf;hb=69f064e1222d71a85b8ac1e11d82e0480b6d6cea;hpb=2d070665a5b42b6395723eca612bed8a78c77b6d diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx index f08542dc0..95c81e419 100644 --- a/src/SMESH/SMESH_Algo.cxx +++ b/src/SMESH/SMESH_Algo.cxx @@ -1,4 +1,4 @@ -// 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 @@ -6,7 +6,7 @@ // 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 @@ -178,8 +178,6 @@ const SMESH_Algo::Features& SMESH_Algo::GetFeatures( const std::string& algoType 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; @@ -208,28 +206,24 @@ SMESH_0D_Algo::SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen) { _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; } //============================================================================= @@ -310,10 +304,10 @@ SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh, 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; @@ -416,7 +410,7 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM 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; @@ -535,7 +529,7 @@ GeomAbs_Shape SMESH_Algo::Continuity(TopoDS_Edge E1, */ //================================================================================ -bool SMESH_Algo::isStraight( const TopoDS_Edge & E, +bool SMESH_Algo::IsStraight( const TopoDS_Edge & E, const bool degenResult) { { @@ -580,6 +574,20 @@ bool SMESH_Algo::isStraight( const TopoDS_Edge & E, 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