1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH : implementaion of SMESH idl descriptions
24 // File : SMESH_Hypothesis.cxx
25 // Author : Paul RASCLE, EDF
28 #include "SMESH_Hypothesis.hxx"
29 #include "SMESH_Gen.hxx"
30 #include "SMESH_subMesh.hxx"
31 #include "utilities.h"
35 //=============================================================================
39 //=============================================================================
41 SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
43 SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
45 //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
48 StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
49 myStudyContext->mapHypothesis[_hypId] = this;
51 _shapeType = 0; // to be set by algo with TopAbs_Enum
52 _param_algo_dim = -1; // to be set by algo parameter
53 _parameters = string();
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;
82 dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break;
87 //=============================================================================
91 //=============================================================================
93 int SMESH_Hypothesis::GetShapeType() const
98 //=============================================================================
102 //=============================================================================
104 int SMESH_Hypothesis::GetStudyId() const
109 //=============================================================================
113 //=============================================================================
115 void SMESH_Hypothesis::NotifySubMeshesHypothesisModification()
117 MESSAGE("SMESH_Hypothesis::NotifySubMeshesHypothesisModification");
119 // for all meshes in study
121 StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
122 map<int, SMESH_Mesh*>::iterator itm;
123 for (itm = myStudyContext->mapMesh.begin();
124 itm != myStudyContext->mapMesh.end();
127 SMESH_Mesh* mesh = (*itm).second;
128 mesh->NotifySubMeshesHypothesisModification( this );
132 //=============================================================================
136 //=============================================================================
138 const char* SMESH_Hypothesis::GetLibName() const
140 return _libName.c_str();
143 //=============================================================================
147 //=============================================================================
149 void SMESH_Hypothesis::SetLibName(const char* theLibName)
151 _libName = string(theLibName);
154 //=============================================================================
158 //=============================================================================
159 void SMESH_Hypothesis::SetParameters(const char *theParameters)
161 string aNewParameters(theParameters);
162 if(aNewParameters.size()==0 && _parameters.size()==0)
163 aNewParameters = " ";
164 if(_parameters.size()>0)
166 _parameters +=aNewParameters;
167 SetLastParameters(theParameters);
170 //=============================================================================
174 //=============================================================================
175 void SMESH_Hypothesis::ClearParameters()
177 _parameters = string();
180 //=============================================================================
184 //=============================================================================
185 char* SMESH_Hypothesis::GetParameters() const
187 return (char*)_parameters.c_str();
190 //=============================================================================
194 //=============================================================================
195 char* SMESH_Hypothesis::GetLastParameters() const
197 return (char*)_lastParameters.c_str();
200 //=============================================================================
204 //=============================================================================
205 void SMESH_Hypothesis::SetLastParameters(const char* theParameters)
207 _lastParameters = string(theParameters);