Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/smesh.git] / src / SMESH / SMESH_2D_Algo.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : SMESH_2D_Algo.cxx
4 // Created   : sam mai 18 09:23:44 CEST 2002
5 // Author    : Paul RASCLE, EDF
6 // Project   : SALOME
7 // Copyright : EDF 2002
8 // $Header$
9 //=============================================================================
10 using namespace std;
11
12 #include "SMESH_2D_Algo.hxx"
13 #include "SMESH_Gen.hxx"
14
15 #include "utilities.h"
16
17 //=============================================================================
18 /*!
19  *  
20  */
21 //=============================================================================
22
23 SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen)
24   : SMESH_Algo(hypId, studyId, gen)
25 {
26 //   _compatibleHypothesis.push_back("hypothese_2D_bidon");
27   _type = ALGO_2D;
28   gen->_map2D_Algo[hypId] = this;
29 }
30
31 //=============================================================================
32 /*!
33  *  
34  */
35 //=============================================================================
36
37 SMESH_2D_Algo::~SMESH_2D_Algo()
38 {
39 }
40
41 //=============================================================================
42 /*!
43  *  
44  */
45 //=============================================================================
46
47 ostream & SMESH_2D_Algo::SaveTo(ostream & save)
48 {
49   return save << this;
50 }
51
52 //=============================================================================
53 /*!
54  *  
55  */
56 //=============================================================================
57
58 istream & SMESH_2D_Algo::LoadFrom(istream & load)
59 {
60   return load >> (*this);
61 }
62
63 //=============================================================================
64 /*!
65  *  
66  */
67 //=============================================================================
68
69 ostream& operator << (ostream & save, SMESH_2D_Algo & hyp)
70 {
71   return save;
72 }
73
74 //=============================================================================
75 /*!
76  *  
77  */
78 //=============================================================================
79
80 istream& operator >> (istream & load, SMESH_2D_Algo & hyp)
81 {
82   return load;
83 }
84
85 //=============================================================================
86 /*!
87  *  
88  */
89 //=============================================================================
90
91 int SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S)
92 {
93   int i = 0;
94   for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next())
95     i++;
96   return i;
97 }
98
99 //=============================================================================
100 /*!
101  *  
102  */
103 //=============================================================================
104
105 int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
106 {
107   int nbPoints = 0;
108   for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next())
109     {
110       const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
111       int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
112       //SCRUTE(nb);
113       nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?)
114     }
115   //SCRUTE(nbPoints);
116   return nbPoints;
117 }