Salome HOME
Copyright update: 2016
[modules/smesh.git] / src / StdMeshers / StdMeshers_SegmentAroundVertex_0D.cxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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
23 //  SMESH SMESH : implementaion of SMESH idl descriptions
24 // File      : StdMeshers_SegmentAroundVertex_0D.cxx
25 // Module    : SMESH
26 // Created   : Fri Oct 20 11:37:07 2006
27 // Author    : Edward AGAPOV (eap)
28 //
29 #include "StdMeshers_SegmentAroundVertex_0D.hxx"
30
31 //=======================================================================
32 //function : StdMeshers_SegmentAroundVertex_0D
33 //purpose  : 
34 //=======================================================================
35
36 StdMeshers_SegmentAroundVertex_0D::StdMeshers_SegmentAroundVertex_0D
37                                    (int hypId, int studyId, SMESH_Gen* gen)
38   :SMESH_0D_Algo(hypId, studyId, gen)
39 {
40   _name = "SegmentAroundVertex_0D";
41   // it is assigned to vertices but influence a state of EDGE submeshes
42   _shapeType = (1 << TopAbs_VERTEX);    // 1 bit per shape type
43
44   _compatibleHypothesis.push_back("SegmentLengthAroundVertex");
45 }
46
47 //================================================================================
48 /*!
49  * \brief Destructor
50  */
51 //================================================================================
52
53 StdMeshers_SegmentAroundVertex_0D::~StdMeshers_SegmentAroundVertex_0D()
54 {}
55
56 //=======================================================================
57 //function : CheckHypothesis
58 //purpose  :
59 //=======================================================================
60
61 bool StdMeshers_SegmentAroundVertex_0D::
62 CheckHypothesis(SMESH_Mesh&                          aMesh,
63                 const TopoDS_Shape&                  aShape,
64                 SMESH_Hypothesis::Hypothesis_Status& aStatus)
65 {
66   std::list <const SMESHDS_Hypothesis * >::const_iterator itl;
67
68   const std::list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
69   if ( hyps.size() == 0 )
70   {
71     aStatus = SMESH_Hypothesis::HYP_MISSING;
72     return false;  // can't work with no hypothesis
73   }
74
75   if ( hyps.size() > 1 )
76   {
77     aStatus = SMESH_Hypothesis::HYP_ALREADY_EXIST;
78   }
79   else
80   {
81     aStatus = SMESH_Hypothesis::HYP_OK;
82   }
83   return ( aStatus == HYP_OK );
84 }
85
86 //=======================================================================
87 //function : Compute
88 //purpose  :
89 //=======================================================================
90
91 bool StdMeshers_SegmentAroundVertex_0D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
92 {
93   // This algorithm exists in order just to enable assignation of
94   // StdMeshers_SegmentLengthAroundVertex hypothesis
95   return true;
96 }
97
98
99 //=======================================================================
100 //function : Evaluate
101 //purpose  : 
102 //=======================================================================
103
104 bool StdMeshers_SegmentAroundVertex_0D::Evaluate(SMESH_Mesh&,
105                                                  const TopoDS_Shape&,
106                                                  MapShapeNbElems&)
107 {
108   // This algorithm exists in order just to enable assignation of
109   // StdMeshers_SegmentLengthAroundVertex hypothesis
110   return false;
111 }