Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/smesh.git] / src / SMESH / SMESH_Hypothesis.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : SMESH_Hypothesis.cxx
4 // Created   : sam mai 18 08:08:50 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_Hypothesis.hxx"
13 #include "SMESH_Gen.hxx"
14 #include "utilities.h"
15
16 //=============================================================================
17 /*!
18  * 
19  */
20 //=============================================================================
21
22 SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
23                                    int studyId,
24                                    SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
25 {
26   //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
27   _gen = gen;
28   _studyId = studyId;
29   StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
30   myStudyContext->mapHypothesis[_hypId] = this;
31   _type = PARAM_ALGO;
32 //   _shapeType = -1; // to be set by algo with TopAbs_Enum
33   _shapeType = 0; // to be set by algo with TopAbs_Enum
34 }
35
36 //=============================================================================
37 /*!
38  * 
39  */
40 //=============================================================================
41
42 SMESH_Hypothesis::~SMESH_Hypothesis()
43 {
44   MESSAGE("SMESH_Hypothesis::~SMESH_Hypothesis");
45 }
46
47 //=============================================================================
48 /*!
49  * 
50  */
51 //=============================================================================
52
53 int SMESH_Hypothesis::GetDim()
54 {
55   int dim = -1;
56   switch (_type)
57     {
58     case ALGO_1D: dim = 1; break;
59     case ALGO_2D: dim = 2; break;
60     case ALGO_3D: dim = 3; break;
61     }
62   return dim;
63 }
64
65 //=============================================================================
66 /*!
67  *  
68  */
69 //=============================================================================
70
71 int SMESH_Hypothesis::GetShapeType()
72 {
73   return _shapeType;
74 }
75
76 //=============================================================================
77 /*!
78  * 
79  */
80 //=============================================================================
81
82 int SMESH_Hypothesis::GetStudyId()
83 {
84   return _studyId;
85 }
86
87 //=============================================================================
88 /*!
89  * 
90  */
91 //=============================================================================
92
93 void SMESH_Hypothesis::NotifySubMeshesHypothesisModification()
94 {
95   MESSAGE("SMESH_Hypothesis::NotifySubMeshesHypothesisModification");
96
97   // for all meshes in study
98
99   StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
100   map<int, SMESH_Mesh*>::iterator itm;
101   for (itm = myStudyContext->mapMesh.begin();
102        itm != myStudyContext->mapMesh.end();
103        itm++)
104     {
105       SMESH_Mesh* mesh = (*itm).second;
106       const list<SMESH_subMesh*>& subMeshes =
107          mesh->GetSubMeshUsingHypothesis(this);
108
109       //for all subMeshes using hypothesis
110         
111       list<SMESH_subMesh*>::const_iterator its;
112       for (its = subMeshes.begin(); its != subMeshes.end(); its++)
113         (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
114     }
115 }
116