Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / src / StdMeshers / StdMeshers_SegmentAroundVertex_0D.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SMESH SMESH : implementaion of SMESH idl descriptions
23 // File      : StdMeshers_SegmentAroundVertex_0D.cxx
24 // Module    : SMESH
25 // Created   : Fri Oct 20 11:37:07 2006
26 // Author    : Edward AGAPOV (eap)
27 //
28 #include "StdMeshers_SegmentAroundVertex_0D.hxx"
29
30 //=======================================================================
31 //function : StdMeshers_SegmentAroundVertex_0D
32 //purpose  : 
33 //=======================================================================
34
35 StdMeshers_SegmentAroundVertex_0D::StdMeshers_SegmentAroundVertex_0D
36                                    (int hypId, int studyId, SMESH_Gen* gen)
37   :SMESH_0D_Algo(hypId, studyId, gen)
38 {
39   _name = "SegmentAroundVertex_0D";
40   // it is assigned to vertices but influence a state of EDGE submeshes 
41   _shapeType = (1 << TopAbs_VERTEX);    // 1 bit per shape type
42
43   _compatibleHypothesis.push_back("SegmentLengthAroundVertex");
44 }
45
46 //================================================================================
47 /*!
48  * \brief Destructor
49  */
50 //================================================================================
51
52 StdMeshers_SegmentAroundVertex_0D::~StdMeshers_SegmentAroundVertex_0D()
53 {}
54
55 //=======================================================================
56 //function : CheckHypothesis
57 //purpose  : 
58 //=======================================================================
59
60 bool StdMeshers_SegmentAroundVertex_0D::CheckHypothesis(SMESH_Mesh&                          aMesh,
61                                                         const TopoDS_Shape&                  aShape,
62                                                         SMESH_Hypothesis::Hypothesis_Status& aStatus)
63 {
64   list <const SMESHDS_Hypothesis * >::const_iterator itl;
65
66   const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
67   if ( hyps.size() == 0 )
68   {
69     aStatus = SMESH_Hypothesis::HYP_MISSING;
70     return false;  // can't work with no hypothesis
71   }
72
73   if ( hyps.size() > 1 )
74   {
75     aStatus = SMESH_Hypothesis::HYP_ALREADY_EXIST;
76   }
77   else
78   {
79     aStatus = SMESH_Hypothesis::HYP_OK;
80   }
81   return ( aStatus == HYP_OK );
82 }
83
84 //=======================================================================
85 //function : Compute
86 //purpose  : 
87 //=======================================================================
88
89 bool StdMeshers_SegmentAroundVertex_0D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
90 {
91   // This algorithm exists in order just to enable assignation of
92   // StdMeshers_SegmentLengthAroundVertex hypothesis
93   return true;
94 }