1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH : implementaion of SMESH idl descriptions
24 // File : SMESH_Algo.cxx
25 // Author : Paul RASCLE, EDF
28 #include "SMESH_Algo.hxx"
30 #include "SMDS_EdgePosition.hxx"
31 #include "SMDS_FacePosition.hxx"
32 #include "SMDS_MeshElement.hxx"
33 #include "SMDS_MeshNode.hxx"
34 #include "SMDS_VolumeTool.hxx"
35 #include "SMESHDS_Mesh.hxx"
36 #include "SMESHDS_SubMesh.hxx"
37 #include "SMESH_Comment.hxx"
38 #include "SMESH_Gen.hxx"
39 #include "SMESH_HypoFilter.hxx"
40 #include "SMESH_Mesh.hxx"
41 #include "SMESH_TypeDefs.hxx"
42 #include "SMESH_subMesh.hxx"
44 #include <Basics_OCCTVersion.hxx>
46 #include <BRepAdaptor_Curve.hxx>
47 #include <BRepLProp.hxx>
48 #include <BRep_Tool.hxx>
49 #include <GCPnts_AbscissaPoint.hxx>
50 #include <GeomAdaptor_Curve.hxx>
51 #include <Geom_Surface.hxx>
52 #include <LDOMParser.hxx>
54 #include <TopExp_Explorer.hxx>
55 #include <TopLoc_Location.hxx>
56 #include <TopTools_ListIteratorOfListOfShape.hxx>
57 #include <TopTools_ListOfShape.hxx>
59 #include <TopoDS_Edge.hxx>
60 #include <TopoDS_Face.hxx>
61 #include <TopoDS_Vertex.hxx>
62 #include <TopoDS_Wire.hxx>
64 #include <gp_Pnt2d.hxx>
67 #include <Standard_ErrorHandler.hxx>
68 #include <Standard_Failure.hxx>
70 #include "utilities.h"
77 //================================================================================
79 * \brief Returns \a true if two algorithms (described by \a this and the given
80 * algo data) are compatible by their output and input types of elements.
82 //================================================================================
84 bool SMESH_Algo::Features::IsCompatible( const SMESH_Algo::Features& algo2 ) const
86 if ( _dim > algo2._dim ) return algo2.IsCompatible( *this );
87 // algo2 is of highter dimension
88 if ( _outElemTypes.empty() || algo2._inElemTypes.empty() )
90 bool compatible = true;
91 set<SMDSAbs_GeometryType>::const_iterator myOutType = _outElemTypes.begin();
92 for ( ; myOutType != _outElemTypes.end() && compatible; ++myOutType )
93 compatible = algo2._inElemTypes.count( *myOutType );
97 //================================================================================
99 * \brief Return Data of the algorithm
101 //================================================================================
103 const SMESH_Algo::Features& SMESH_Algo::GetFeatures( const std::string& algoType )
105 static map< string, SMESH_Algo::Features > theFeaturesByName;
106 if ( theFeaturesByName.empty() )
108 // Read Plugin.xml files
109 vector< string > xmlPaths = SMESH_Gen::GetPluginXMLPaths();
110 LDOMParser xmlParser;
111 for ( size_t iXML = 0; iXML < xmlPaths.size(); ++iXML )
113 bool error = xmlParser.parse( xmlPaths[iXML].c_str() );
116 TCollection_AsciiString data;
117 INFOS( xmlParser.GetError(data) );
120 // <algorithm type="Regular_1D"
123 // output="QUAD,TRIA">
125 LDOM_Document xmlDoc = xmlParser.getDocument();
126 LDOM_NodeList algoNodeList = xmlDoc.getElementsByTagName( "algorithm" );
127 for ( int i = 0; i < algoNodeList.getLength(); ++i )
129 LDOM_Node algoNode = algoNodeList.item( i );
130 LDOM_Element& algoElem = (LDOM_Element&) algoNode;
131 TCollection_AsciiString algoType = algoElem.getAttribute("type");
132 TCollection_AsciiString input = algoElem.getAttribute("input");
133 TCollection_AsciiString output = algoElem.getAttribute("output");
134 TCollection_AsciiString dim = algoElem.getAttribute("dim");
135 TCollection_AsciiString label = algoElem.getAttribute("label-id");
136 if ( algoType.IsEmpty() ) continue;
138 Features & data = theFeaturesByName[ algoType.ToCString() ];
139 data._dim = dim.IntegerValue();
140 data._label = label.ToCString();
141 for ( int isInput = 0; isInput < 2; ++isInput )
143 TCollection_AsciiString& typeStr = isInput ? input : output;
144 set<SMDSAbs_GeometryType>& typeSet = isInput ? data._inElemTypes : data._outElemTypes;
146 while ( beg <= typeStr.Length() )
148 while ( beg < typeStr.Length() && !isalpha( typeStr.Value( beg ) ))
151 while ( end < typeStr.Length() && isalpha( typeStr.Value( end + 1 ) ))
155 TCollection_AsciiString typeName = typeStr.SubString( beg, end );
156 if ( typeName == "EDGE" ) typeSet.insert( SMDSGeom_EDGE );
157 else if ( typeName == "TRIA" ) typeSet.insert( SMDSGeom_TRIANGLE );
158 else if ( typeName == "QUAD" ) typeSet.insert( SMDSGeom_QUADRANGLE );
166 return theFeaturesByName[ algoType ];
169 //=============================================================================
173 //=============================================================================
175 SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
176 : SMESH_Hypothesis(hypId, studyId, gen)
178 gen->_mapAlgo[hypId] = this;
180 _onlyUnaryInput = _requireDiscreteBoundary = _requireShape = true;
181 _quadraticMesh = _supportSubmeshes = false;
183 for ( int i = 0; i < 4; ++i )
184 _neededLowerHyps[ i ] = false;
187 //=============================================================================
191 //=============================================================================
193 SMESH_Algo::~SMESH_Algo()
197 //=============================================================================
201 //=============================================================================
203 SMESH_0D_Algo::SMESH_0D_Algo(int hypId, int studyId, SMESH_Gen* gen)
204 : SMESH_Algo(hypId, studyId, gen)
206 _shapeType = (1 << TopAbs_VERTEX);
208 gen->_map0D_Algo[hypId] = this;
210 SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen)
211 : SMESH_Algo(hypId, studyId, gen)
213 _shapeType = (1 << TopAbs_EDGE);
215 gen->_map1D_Algo[hypId] = this;
217 SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
218 : SMESH_Algo(hypId, studyId, gen)
220 _shapeType = (1 << TopAbs_FACE);
222 gen->_map2D_Algo[hypId] = this;
224 SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
225 : SMESH_Algo(hypId, studyId, gen)
227 _shapeType = (1 << TopAbs_SOLID);
229 gen->_map3D_Algo[hypId] = this;
232 //=============================================================================
234 * Usually an algoritm has nothing to save
236 //=============================================================================
238 ostream & SMESH_Algo::SaveTo(ostream & save) { return save; }
239 istream & SMESH_Algo::LoadFrom(istream & load) { return load; }
241 //=============================================================================
245 //=============================================================================
247 const vector < string > &SMESH_Algo::GetCompatibleHypothesis()
249 return _compatibleHypothesis;
252 //=============================================================================
254 * List the hypothesis used by the algorithm associated to the shape.
255 * Hypothesis associated to father shape -are- taken into account (see
256 * GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in
257 * the algorithm. This method could be surcharged by specific algorithms, in
258 * case of several hypothesis simultaneously applicable.
260 //=============================================================================
262 const list <const SMESHDS_Hypothesis *> &
263 SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
264 const TopoDS_Shape & aShape,
265 const bool ignoreAuxiliary) const
267 SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
268 me->_usedHypList.clear();
269 SMESH_HypoFilter filter;
270 if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
272 aMesh.GetHypotheses( aShape, filter, me->_usedHypList, true );
273 if ( ignoreAuxiliary && _usedHypList.size() > 1 )
274 me->_usedHypList.clear(); //only one compatible hypothesis allowed
279 //=============================================================================
281 * List the relevant hypothesis associated to the shape. Relevant hypothesis
282 * have a name (type) listed in the algorithm. Hypothesis associated to
283 * father shape -are not- taken into account (see GetUsedHypothesis)
285 //=============================================================================
287 const list<const SMESHDS_Hypothesis *> &
288 SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh,
289 const TopoDS_Shape & aShape,
290 const bool ignoreAuxiliary) const
292 SMESH_Algo* me = const_cast< SMESH_Algo* >( this );
293 me->_appliedHypList.clear();
294 SMESH_HypoFilter filter;
295 if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
296 aMesh.GetHypotheses( aShape, filter, me->_appliedHypList, false );
298 return _appliedHypList;
301 //=============================================================================
303 * Compute length of an edge
305 //=============================================================================
307 double SMESH_Algo::EdgeLength(const TopoDS_Edge & E)
309 double UMin = 0, UMax = 0;
310 if (BRep_Tool::Degenerated(E))
313 Handle(Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax);
314 GeomAdaptor_Curve AdaptCurve(C, UMin, UMax); //range is important for periodic curves
315 double length = GCPnts_AbscissaPoint::Length(AdaptCurve, UMin, UMax);
319 //================================================================================
321 * \brief Just return false as the algorithm does not hold parameters values
323 //================================================================================
325 bool SMESH_Algo::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
326 const TopoDS_Shape& /*theShape*/)
330 bool SMESH_Algo::SetParametersByDefaults(const TDefaults& , const SMESH_Mesh*)
334 //================================================================================
336 * \brief Fill vector of node parameters on geometrical edge, including vertex nodes
337 * \param theMesh - The mesh containing nodes
338 * \param theEdge - The geometrical edge of interest
339 * \param theParams - The resulting vector of sorted node parameters
340 * \retval bool - false if not all parameters are OK
342 //================================================================================
344 bool SMESH_Algo::GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh,
345 const TopoDS_Edge& theEdge,
346 vector< double > & theParams)
350 if ( !theMesh || theEdge.IsNull() )
353 SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
354 if ( !eSubMesh || !eSubMesh->GetElements()->more() )
355 return false; // edge is not meshed
357 //int nbEdgeNodes = 0;
358 set < double > paramSet;
361 // loop on nodes of an edge: sort them by param on edge
362 SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
363 while ( nIt->more() )
365 const SMDS_MeshNode* node = nIt->next();
366 const SMDS_PositionPtr& pos = node->GetPosition();
367 if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
369 const SMDS_EdgePosition* epos =
370 static_cast<const SMDS_EdgePosition*>(node->GetPosition());
371 if ( !paramSet.insert( epos->GetUParameter() ).second )
372 return false; // equal parameters
375 // add vertex nodes params
377 TopExp::Vertices( theEdge, V1, V2);
378 if ( VertexNode( V1, theMesh ) &&
379 !paramSet.insert( BRep_Tool::Parameter(V1,theEdge) ).second )
380 return false; // there are equal parameters
381 if ( VertexNode( V2, theMesh ) &&
382 !paramSet.insert( BRep_Tool::Parameter(V2,theEdge) ).second )
383 return false; // there are equal parameters
386 theParams.resize( paramSet.size() );
387 set < double >::iterator par = paramSet.begin();
388 vector< double >::iterator vecPar = theParams.begin();
389 for ( ; par != paramSet.end(); ++par, ++vecPar )
392 return theParams.size() > 1;
395 //================================================================================
397 * \brief Fill vector of node parameters on geometrical edge, including vertex nodes
398 * \param theMesh - The mesh containing nodes
399 * \param theEdge - The geometrical edge of interest
400 * \param theParams - The resulting vector of sorted node parameters
401 * \retval bool - false if not all parameters are OK
403 //================================================================================
405 bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theMesh,
406 const TopoDS_Edge& theEdge,
407 const bool ignoreMediumNodes,
408 map< double, const SMDS_MeshNode* > & theNodes)
412 if ( !theMesh || theEdge.IsNull() )
415 SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
416 if ( !eSubMesh || !eSubMesh->GetElements()->more() )
417 return false; // edge is not meshed
420 set < double > paramSet;
423 // loop on nodes of an edge: sort them by param on edge
424 SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
425 while ( nIt->more() )
427 const SMDS_MeshNode* node = nIt->next();
428 if ( ignoreMediumNodes ) {
429 SMDS_ElemIteratorPtr elemIt = node->GetInverseElementIterator();
430 if ( elemIt->more() && elemIt->next()->IsMediumNode( node ))
433 const SMDS_PositionPtr& pos = node->GetPosition();
434 if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
436 const SMDS_EdgePosition* epos =
437 static_cast<const SMDS_EdgePosition*>(node->GetPosition());
438 theNodes.insert( theNodes.end(), make_pair( epos->GetUParameter(), node ));
439 //MESSAGE("U " << epos->GetUParameter() << " ID " << node->GetID());
444 TopoDS_Vertex v1, v2;
445 TopExp::Vertices(theEdge, v1, v2);
446 const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
447 const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
448 //MESSAGE("Vertices ID " << n1->GetID() << " " << n2->GetID());
450 BRep_Tool::Range(theEdge, f, l);
451 if ( v1.Orientation() != TopAbs_FORWARD )
453 if ( n1 && ++nbNodes )
454 theNodes.insert( make_pair( f, n1 ));
455 if ( n2 && ++nbNodes )
456 theNodes.insert( make_pair( l, n2 ));
458 return theNodes.size() == nbNodes;
461 //================================================================================
463 * \brief Make filter recognize only compatible hypotheses
464 * \param theFilter - the filter to initialize
465 * \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
467 //================================================================================
469 bool SMESH_Algo::InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
470 const bool ignoreAuxiliary) const
472 if ( !_compatibleHypothesis.empty() )
474 theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
475 for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
476 theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));
478 if ( ignoreAuxiliary )
479 theFilter.AndNot( theFilter.IsAuxiliary() );
486 //================================================================================
488 * \brief Return continuity of two edges
489 * \param E1 - the 1st edge
490 * \param E2 - the 2nd edge
491 * \retval GeomAbs_Shape - regularity at the junction between E1 and E2
493 //================================================================================
495 GeomAbs_Shape SMESH_Algo::Continuity(TopoDS_Edge E1,
498 //E1.Orientation(TopAbs_FORWARD), E2.Orientation(TopAbs_FORWARD); // avoid pb with internal edges
499 if (E1.Orientation() > TopAbs_REVERSED) // INTERNAL
500 E1.Orientation( TopAbs_FORWARD );
501 if (E2.Orientation() > TopAbs_REVERSED) // INTERNAL
502 E2.Orientation( TopAbs_FORWARD );
504 TopoDS_Vertex V, VV1[2], VV2[2];
505 TopExp::Vertices( E1, VV1[0], VV1[1], true );
506 TopExp::Vertices( E2, VV2[0], VV2[1], true );
507 if ( VV1[1].IsSame( VV2[0] )) { V = VV1[1]; }
508 else if ( VV1[0].IsSame( VV2[1] )) { V = VV1[0]; }
509 else if ( VV1[1].IsSame( VV2[1] )) { V = VV1[1]; E1.Reverse(); }
510 else if ( VV1[0].IsSame( VV2[0] )) { V = VV1[0]; E1.Reverse(); }
511 else { return GeomAbs_C0; }
513 Standard_Real u1 = BRep_Tool::Parameter( V, E1 );
514 Standard_Real u2 = BRep_Tool::Parameter( V, E2 );
515 BRepAdaptor_Curve C1( E1 ), C2( E2 );
516 Standard_Real tol = BRep_Tool::Tolerance( V );
517 Standard_Real angTol = 2e-3;
519 #if OCC_VERSION_LARGE > 0x06010000
522 return BRepLProp::Continuity(C1, C2, u1, u2, tol, angTol);
524 catch (Standard_Failure) {
529 //================================================================================
531 * \brief Return the node built on a vertex
532 * \param V - the vertex
533 * \param meshDS - mesh
534 * \retval const SMDS_MeshNode* - found node or NULL
536 //================================================================================
538 const SMDS_MeshNode* SMESH_Algo::VertexNode(const TopoDS_Vertex& V,
539 const SMESHDS_Mesh* meshDS)
541 if ( SMESHDS_SubMesh* sm = meshDS->MeshElements(V) ) {
542 SMDS_NodeIteratorPtr nIt= sm->GetNodes();
549 //=======================================================================
550 //function : GetMeshError
551 //purpose : Finds topological errors of a sub-mesh
552 //WARNING : 1D check is NOT implemented so far
553 //=======================================================================
555 SMESH_Algo::EMeshError SMESH_Algo::GetMeshError(SMESH_subMesh* subMesh)
557 EMeshError err = MEr_OK;
559 SMESHDS_SubMesh* smDS = subMesh->GetSubMeshDS();
563 switch ( subMesh->GetSubShape().ShapeType() )
565 case TopAbs_FACE: { // ====================== 2D =====================
567 SMDS_ElemIteratorPtr fIt = smDS->GetElements();
571 // We check that olny links on EDGEs encouter once, the rest links, twice
572 set< SMESH_TLink > links;
573 while ( fIt->more() )
575 const SMDS_MeshElement* f = fIt->next();
576 int nbNodes = f->NbCornerNodes(); // ignore medium nodes
577 for ( int i = 0; i < nbNodes; ++i )
579 const SMDS_MeshNode* n1 = f->GetNode( i );
580 const SMDS_MeshNode* n2 = f->GetNode(( i+1 ) % nbNodes);
581 std::pair< set< SMESH_TLink >::iterator, bool > it_added =
582 links.insert( SMESH_TLink( n1, n2 ));
583 if ( !it_added.second )
584 // As we do NOT(!) check if mesh is manifold, we believe that a link can
585 // encounter once or twice only (not three times), we erase a link as soon
586 // as it encounters twice to speed up search in the <links> map.
587 links.erase( it_added.first );
590 // the links remaining in the <links> should all be on EDGE
591 set< SMESH_TLink >::iterator linkIt = links.begin();
592 for ( ; linkIt != links.end(); ++linkIt )
594 const SMESH_TLink& link = *linkIt;
595 if ( link.node1()->GetPosition()->GetTypeOfPosition() > SMDS_TOP_EDGE ||
596 link.node2()->GetPosition()->GetTypeOfPosition() > SMDS_TOP_EDGE )
599 // TODO: to check orientation
602 case TopAbs_SOLID: { // ====================== 3D =====================
604 SMDS_ElemIteratorPtr vIt = smDS->GetElements();
608 SMDS_VolumeTool vTool;
609 while ( !vIt->more() )
611 if (!vTool.Set( vIt->next() ))
614 for ( int iF = 0; iF < vTool.NbFaces(); ++iF )
615 if ( vTool.IsFreeFace( iF ))
617 int nbN = vTool.NbFaceNodes( iF );
618 const SMDS_MeshNode** nodes = vTool.GetFaceNodes( iF );
619 for ( int i = 0; i < nbN; ++i )
620 if ( nodes[i]->GetPosition()->GetTypeOfPosition() > SMDS_TOP_FACE )
631 //================================================================================
633 * \brief Sets event listener to submeshes if necessary
634 * \param subMesh - submesh where algo is set
636 * After being set, event listener is notified on each event of a submesh.
637 * By default non listener is set
639 //================================================================================
641 void SMESH_Algo::SetEventListener(SMESH_subMesh* /*subMesh*/)
645 //================================================================================
647 * \brief Allow algo to do something after persistent restoration
648 * \param subMesh - restored submesh
650 * This method is called only if a submesh has HYP_OK algo_state.
652 //================================================================================
654 void SMESH_Algo::SubmeshRestored(SMESH_subMesh* /*subMesh*/)
658 //================================================================================
660 * \brief Computes mesh without geometry
661 * \param aMesh - the mesh
662 * \param aHelper - helper that must be used for adding elements to \aaMesh
663 * \retval bool - is a success
665 //================================================================================
667 bool SMESH_Algo::Compute(SMESH_Mesh & /*aMesh*/, SMESH_MesherHelper* /*aHelper*/)
669 return error( COMPERR_BAD_INPUT_MESH, "Mesh built on shape expected");
672 //=======================================================================
673 //function : CancelCompute
674 //purpose : Sets _computeCanceled to true. It's usage depends on
675 // * implementation of a particular mesher.
676 //=======================================================================
678 void SMESH_Algo::CancelCompute()
680 _computeCanceled = true;
681 _error = COMPERR_CANCELED;
684 //================================================================================
686 * \brief store error and comment and then return ( error == COMPERR_OK )
688 //================================================================================
690 bool SMESH_Algo::error(int error, const SMESH_Comment& comment)
694 return ( error == COMPERR_OK );
697 //================================================================================
699 * \brief store error and return ( error == COMPERR_OK )
701 //================================================================================
703 bool SMESH_Algo::error(SMESH_ComputeErrorPtr error)
706 _error = error->myName;
707 _comment = error->myComment;
708 _badInputElements = error->myBadElements;
709 return error->IsOK();
714 //================================================================================
716 * \brief return compute error
718 //================================================================================
720 SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError() const
722 SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( _error, _comment, this );
723 // hope this method is called by only SMESH_subMesh after this->Compute()
724 err->myBadElements.splice( err->myBadElements.end(),
725 (list<const SMDS_MeshElement*>&) _badInputElements );
729 //================================================================================
731 * \brief initialize compute error
733 //================================================================================
735 void SMESH_Algo::InitComputeError()
739 list<const SMDS_MeshElement*>::iterator elem = _badInputElements.begin();
740 for ( ; elem != _badInputElements.end(); ++elem )
741 if ( (*elem)->GetID() < 1 )
743 _badInputElements.clear();
745 _computeCanceled = false;
748 //================================================================================
750 * \brief store a bad input element preventing computation,
751 * which may be a temporary one i.e. not residing the mesh,
752 * then it will be deleted by InitComputeError()
754 //================================================================================
756 void SMESH_Algo::addBadInputElement(const SMDS_MeshElement* elem)
759 _badInputElements.push_back( elem );
762 //=======================================================================
763 //function : addBadInputElements
764 //purpose : store a bad input elements or nodes preventing computation
765 //=======================================================================
767 void SMESH_Algo::addBadInputElements(const SMESHDS_SubMesh* sm,
774 SMDS_NodeIteratorPtr nIt = sm->GetNodes();
775 while ( nIt->more() ) addBadInputElement( nIt->next() );
779 SMDS_ElemIteratorPtr eIt = sm->GetElements();
780 while ( eIt->more() ) addBadInputElement( eIt->next() );
785 //=============================================================================
789 //=============================================================================
791 // int SMESH_Algo::NumberOfWires(const TopoDS_Shape& S)
794 // for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next())
799 //=============================================================================
803 //=============================================================================
805 int SMESH_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
808 for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) {
809 const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
810 int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
813 nbPoints += nb + 1; // internal points plus 1 vertex of 2 (last point ?)