1 // SMESH SMESH : implementaion of SMESH idl descriptions
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_Hypothesis.cxx
25 // Author : Paul RASCLE, EDF
29 #include "SMESH_Hypothesis.hxx"
30 #include "SMESH_Gen.hxx"
31 #include "SMESH_subMesh.hxx"
32 #include "utilities.h"
36 //=============================================================================
40 //=============================================================================
42 SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
44 SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
46 //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
49 StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
50 myStudyContext->mapHypothesis[_hypId] = this;
52 _shapeType = 0; // to be set by algo with TopAbs_Enum
53 _param_algo_dim = -1; // to be set by algo parameter
56 //=============================================================================
60 //=============================================================================
62 SMESH_Hypothesis::~SMESH_Hypothesis()
64 MESSAGE("SMESH_Hypothesis::~SMESH_Hypothesis");
67 //=============================================================================
71 //=============================================================================
73 int SMESH_Hypothesis::GetDim() const
78 case ALGO_1D: dim = 1; break;
79 case ALGO_2D: dim = 2; break;
80 case ALGO_3D: dim = 3; break;
81 case PARAM_ALGO: dim = _param_algo_dim; break;
86 //=============================================================================
90 //=============================================================================
92 int SMESH_Hypothesis::GetShapeType() const
97 //=============================================================================
101 //=============================================================================
103 int SMESH_Hypothesis::GetStudyId() const
108 //=============================================================================
112 //=============================================================================
114 void SMESH_Hypothesis::NotifySubMeshesHypothesisModification()
116 MESSAGE("SMESH_Hypothesis::NotifySubMeshesHypothesisModification");
118 // for all meshes in study
120 StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
121 map<int, SMESH_Mesh*>::iterator itm;
122 for (itm = myStudyContext->mapMesh.begin();
123 itm != myStudyContext->mapMesh.end();
126 SMESH_Mesh* mesh = (*itm).second;
127 const list<SMESH_subMesh*>& subMeshes =
128 mesh->GetSubMeshUsingHypothesis(this);
130 //for all subMeshes using hypothesis
132 list<SMESH_subMesh*>::const_iterator its;
133 for (its = subMeshes.begin(); its != subMeshes.end(); its++)
134 (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
138 //=============================================================================
142 //=============================================================================
144 const char* SMESH_Hypothesis::GetLibName() const
146 // MESSAGE("SMESHDS_Hypothesis::GetLibName");
148 // SCRUTE(&_LibName);
149 return _libName.c_str();
152 //=============================================================================
156 //=============================================================================
158 void SMESH_Hypothesis::SetLibName(const char* theLibName)
160 // MESSAGE("SMESHDS_Hypothesis::SetLibName");
161 _libName = string(theLibName);