Salome HOME
Update copyrights
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2004-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File      : GHS3DPlugin_Hypothesis_i.cxx
21 // Created   : Wed Apr  2 13:53:01 2008
22 // Author    : Edward AGAPOV (eap)
23 //
24 #include "GHS3DPlugin_Hypothesis_i.hxx"
25
26 #include <SMESH_Gen.hxx>
27 #include <SMESH_PythonDump.hxx>
28
29 #include <Utils_CorbaException.hxx>
30 #include <utilities.h>
31 #include <SMESH_Mesh_i.hxx>
32 #include <SMESH_Group_i.hxx>
33 #include <SMESH_Gen_i.hxx>
34 //#include <SMESH_TypeDefs.hxx>
35 #include <SMESHDS_GroupBase.hxx>
36
37 // SALOME KERNEL includes
38 // #include <SALOMEDSClient.hxx>
39 // #include <SALOMEDSClient_definitions.hxx>
40
41 using namespace std;
42
43 //=======================================================================
44 //function : GHS3DPlugin_Hypothesis_i
45 //=======================================================================
46
47 GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
48                                                     ::SMESH_Gen*            theGenImpl)
49   : SALOME::GenericObj_i( thePOA ), 
50     SMESH_Hypothesis_i( thePOA )
51 {
52   myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
53                                              theGenImpl);
54 }
55
56 //=======================================================================
57 //function : ~GHS3DPlugin_Hypothesis_i
58 //=======================================================================
59
60 GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
61 {
62 }
63
64 //=======================================================================
65 //function : SetToMeshHoles
66 //=======================================================================
67
68 void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
69 {
70   ASSERT(myBaseImpl);
71   this->GetImpl()->SetToMeshHoles(toMesh);
72   SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
73 }
74
75 //=======================================================================
76 //function : GetToMeshHoles
77 //=======================================================================
78
79 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
80 {
81   ASSERT(myBaseImpl);
82   return this->GetImpl()->GetToMeshHoles();
83 }
84
85 //=======================================================================
86 //function : SetToMakeGroupsOfDomains
87 //=======================================================================
88
89 void GHS3DPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
90 {
91   ASSERT(myBaseImpl);
92   this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
93   SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
94 }
95
96 //=======================================================================
97 //function : GetToMakeGroupsOfDomains
98 //=======================================================================
99
100 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
101 {
102   ASSERT(myBaseImpl);
103   return this->GetImpl()->GetToMakeGroupsOfDomains();
104 }
105
106 //=======================================================================
107 //function : SetMaximumMemory
108 //=======================================================================
109
110 void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Float MB)
111   throw ( SALOME::SALOME_Exception )
112 {
113   if ( MB == 0 )
114     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
115   ASSERT(myBaseImpl);
116   this->GetImpl()->SetMaximumMemory(MB);
117   SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
118 }
119
120 //=======================================================================
121 //function : GetMaximumMemory
122 //=======================================================================
123
124 CORBA::Float GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
125 {
126   ASSERT(myBaseImpl);
127   return this->GetImpl()->GetMaximumMemory();
128 }
129
130 //=======================================================================
131 //function : SetInitialMemory
132 //=======================================================================
133
134 void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Float MB)
135   throw ( SALOME::SALOME_Exception )
136 {
137   if ( MB == 0 )
138     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
139   ASSERT(myBaseImpl);
140   this->GetImpl()->SetInitialMemory(MB);
141   SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
142 }
143
144 //=======================================================================
145 //function : GetInitialMemory
146 //=======================================================================
147
148 CORBA::Float GHS3DPlugin_Hypothesis_i::GetInitialMemory()
149 {
150   ASSERT(myBaseImpl);
151   return this->GetImpl()->GetInitialMemory();
152 }
153
154 //=======================================================================
155 //function : SetOptimizationLevel
156 //=======================================================================
157
158 void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
159   throw ( SALOME::SALOME_Exception )
160 {
161   ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
162     (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
163   if ( l < ::GHS3DPlugin_Hypothesis::None ||
164        l > ::GHS3DPlugin_Hypothesis::Strong )
165     THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
166     
167   ASSERT(myBaseImpl);
168   this->GetImpl()->SetOptimizationLevel(l);
169   SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
170 }
171
172 //=======================================================================
173 //function : GetOptimizationLevel
174 //=======================================================================
175
176 CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
177 {
178   ASSERT(myBaseImpl);
179   return this->GetImpl()->GetOptimizationLevel();
180 }
181
182 //=======================================================================
183 //function : SetWorkingDirectory
184 //=======================================================================
185
186 void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
187 {
188   if (!path )
189     THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
190
191   string file(path);
192   const char lastChar = *file.rbegin();
193 #ifdef WIN32
194   if ( lastChar != '\\' ) file += '\\';
195 #else
196   if ( lastChar != '/' ) file += '/';
197 #endif
198   file += "GHS3D.log";
199   SMESH_Mesh_i::PrepareForWriting (file.c_str());
200
201   ASSERT(myBaseImpl);
202   this->GetImpl()->SetWorkingDirectory(path);
203   SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
204 }
205
206 //=======================================================================
207 //function : GetWorkingDirectory
208 //=======================================================================
209
210 char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
211 {
212   ASSERT(myBaseImpl);
213   return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
214 }
215
216 //=======================================================================
217 //function : SetKeepFiles
218 //=======================================================================
219
220 void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
221 {
222   ASSERT(myBaseImpl);
223   this->GetImpl()->SetKeepFiles(toKeep);
224   SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
225 }
226
227 //=======================================================================
228 //function : GetKeepFiles
229 //=======================================================================
230
231 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
232 {
233   ASSERT(myBaseImpl);
234   return this->GetImpl()->GetKeepFiles();
235 }
236
237 //=======================================================================
238 //function : SetVerboseLevel
239 //=======================================================================
240
241 void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
242   throw ( SALOME::SALOME_Exception )
243 {
244   if (level < 0 || level > 10 )
245     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
246                                   SALOME::BAD_PARAM );
247   ASSERT(myBaseImpl);
248   this->GetImpl()->SetVerboseLevel(level);
249   SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
250 }
251
252 //=======================================================================
253 //function : GetVerboseLevel
254 //=======================================================================
255
256 CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
257 {
258   ASSERT(myBaseImpl);
259   return this->GetImpl()->GetVerboseLevel();
260 }
261
262 //=======================================================================
263 //function : SetToCreateNewNodes
264 //=======================================================================
265
266 void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
267 {
268   ASSERT(myBaseImpl);
269   this->GetImpl()->SetToCreateNewNodes(toCreate);
270   SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
271 }
272
273 //=======================================================================
274 //function : GetToCreateNewNodes
275 //=======================================================================
276
277 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
278 {
279   ASSERT(myBaseImpl);
280   return this->GetImpl()->GetToCreateNewNodes();
281 }
282
283 //=======================================================================
284 //function : SetToUseBoundaryRecoveryVersion
285 //=======================================================================
286
287 void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
288 {
289   ASSERT(myBaseImpl);
290   this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
291   SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
292 }
293
294 //=======================================================================
295 //function : GetToUseBoundaryRecoveryVersion
296 //=======================================================================
297
298 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
299 {
300   ASSERT(myBaseImpl);
301   return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
302 }
303
304 //=======================================================================
305 //function : SetFEMCorrection
306 //=======================================================================
307
308 void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
309 {
310   ASSERT(myBaseImpl);
311   this->GetImpl()->SetFEMCorrection(toUseFem);
312   SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
313 }
314
315 //=======================================================================
316 //function : GetFEMCorrection
317 //=======================================================================
318
319 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection()
320 {
321   ASSERT(myBaseImpl);
322   return this->GetImpl()->GetFEMCorrection();
323 }
324
325 //=======================================================================
326 //function : SetToRemoveCentralPoint
327 //=======================================================================
328
329 void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
330 {
331   ASSERT(myBaseImpl);
332   this->GetImpl()->SetToRemoveCentralPoint(toRemove);
333   SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
334 }
335
336 //=======================================================================
337 //function : GetToRemoveCentralPoint
338 //=======================================================================
339
340 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
341 {
342   ASSERT(myBaseImpl);
343   return this->GetImpl()->GetToRemoveCentralPoint();
344 }
345
346 //=======================================================================
347 //function : SetTextOption
348 //=======================================================================
349
350 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
351 {
352   ASSERT(myBaseImpl);
353   this->GetImpl()->SetAdvancedOption(option);
354   SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
355 }
356
357 //=======================================================================
358 //function : GetTextOption
359 //=======================================================================
360
361 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
362 {
363   ASSERT(myBaseImpl);
364   return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
365 }
366
367 //=======================================================================
368 //function : SetAdvancedOption
369 //=======================================================================
370
371 void GHS3DPlugin_Hypothesis_i::SetAdvancedOption(const char* option)
372 {
373   ASSERT(myBaseImpl);
374   this->GetImpl()->SetAdvancedOption(option);
375   SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
376 }
377
378 //=======================================================================
379 //function : GetAdvancedOption
380 //=======================================================================
381
382 char* GHS3DPlugin_Hypothesis_i::GetAdvancedOption()
383 {
384   ASSERT(myBaseImpl);
385   return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
386 }
387
388 //=======================================================================
389 //function : SetToRemoveCentralPoint
390 //=======================================================================
391
392 void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
393 {
394   ASSERT(myBaseImpl);
395   if (gradation != GetGradation()) {
396     this->GetImpl()->SetGradation(gradation);
397     SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
398   }
399 }
400
401 //=======================================================================
402 //function : GetToRemoveCentralPoint
403 //=======================================================================
404
405 CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
406 {
407   ASSERT(myBaseImpl);
408   return this->GetImpl()->GetGradation();
409 }
410
411 //=======================================================================
412 //function : SetStandardOutputLog
413 //=======================================================================
414
415 void GHS3DPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
416 {
417   ASSERT(myBaseImpl);
418   this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
419   SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
420 }
421
422 //=======================================================================
423 //function : GetStandardOutputLog
424 //=======================================================================
425
426 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetStandardOutputLog()
427 {
428   ASSERT(myBaseImpl);
429   return this->GetImpl()->GetStandardOutputLog();
430 }
431
432 //=======================================================================
433 //function : SetRemoveLogOnSuccess
434 //=======================================================================
435
436 void GHS3DPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
437 {
438   ASSERT(myBaseImpl);
439   this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
440   SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
441 }
442
443 //=======================================================================
444 //function : GetRemoveLogOnSuccess
445 //=======================================================================
446
447 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
448 {
449   ASSERT(myBaseImpl);
450   return this->GetImpl()->GetRemoveLogOnSuccess();
451 }
452
453 //=======================================================================
454 //function : SetEnforcedVertex
455 //=======================================================================
456
457 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
458   throw (SALOME::SALOME_Exception) {
459   ASSERT(myBaseImpl);
460   return p_SetEnforcedVertex(size, x, y, z);
461 }
462
463 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
464   throw (SALOME::SALOME_Exception) {
465   ASSERT(myBaseImpl);
466   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
467 }
468
469 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
470   throw (SALOME::SALOME_Exception) {
471   ASSERT(myBaseImpl);
472   return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
473 }
474
475 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
476   throw (SALOME::SALOME_Exception) {
477   ASSERT(myBaseImpl);
478   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
479 }
480
481 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
482   throw (SALOME::SALOME_Exception) {
483   ASSERT(myBaseImpl);
484   
485   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
486     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
487   }
488   
489   string theVertexEntry = theVertex->GetStudyEntry();
490   CORBA::Double x = 0, y = 0, z = 0;
491   CORBA::Boolean isCompound = false;
492   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
493   if (theVertexEntry.empty()) {
494     string aName;
495     if (theVertex->GetShapeType() == GEOM::VERTEX) {
496       aName = "Vertex_";
497     }
498     if (theVertex->GetShapeType() == GEOM::COMPOUND) {
499       aName = "Compound_";
500       isCompound = true;
501     }
502     aName += theVertex->GetEntry();
503     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
504     if (!theSVertex->_is_nil())
505       theVertexEntry = theSVertex->GetID();
506   }
507   if (theVertexEntry.empty())
508     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
509
510   if (theVertex->GetShapeType() == GEOM::VERTEX) {
511     GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
512     if (CORBA::is_nil(measureOp))
513       return false;
514     
515     measureOp->PointCoordinates (theVertex, x, y, z);
516   }
517
518   string theVertexName = theVertex->GetName();
519   
520   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
521 }
522
523 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
524   throw (SALOME::SALOME_Exception) {
525   ASSERT(myBaseImpl);
526   
527   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
528     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
529   }
530   
531   string theVertexEntry = theVertex->GetStudyEntry();
532   CORBA::Double x = 0, y = 0, z = 0;
533   CORBA::Boolean isCompound = false;
534   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
535   if (theVertexEntry.empty()) {
536     string aName;
537     if (theVertex->GetShapeType() == GEOM::VERTEX) {
538       aName = "Vertex_";
539     }
540     if (theVertex->GetShapeType() == GEOM::COMPOUND) {
541       aName = "Compound_";
542       isCompound = true;
543     }
544     aName += theVertex->GetEntry();
545     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
546     if (!theSVertex->_is_nil())
547       theVertexEntry = theSVertex->GetID();
548   }
549   if (theVertexEntry.empty())
550     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
551
552   if (theVertex->GetShapeType() == GEOM::VERTEX) {
553     GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
554     if (CORBA::is_nil(measureOp))
555       return false;
556     
557     measureOp->PointCoordinates (theVertex, x, y, z);
558   }
559     
560   string theVertexName = theVertex->GetName();
561   
562   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
563 }
564
565 bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
566                                                     const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
567                                                     CORBA::Boolean isCompound)
568   throw (SALOME::SALOME_Exception) {
569   ASSERT(myBaseImpl);
570   bool newValue = false;
571
572   ::GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap coordsList;
573   ::GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap enfVertexEntryList;
574   if (string(theVertexEntry).empty()) {
575     coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
576     std::vector<double> coords;
577     coords.push_back(x);
578     coords.push_back(y);
579     coords.push_back(z);
580     if (coordsList.find(coords) == coordsList.end()) {
581       newValue = true;
582     }
583     else {
584       ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
585       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
586         newValue = true;
587       }
588     }
589
590     if (newValue) {
591       if (string(theVertexName).empty()) {
592         if (string(theGroupName).empty())
593           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
594         else
595           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
596       }
597       else {
598         if (string(theGroupName).empty())
599           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size  << ", \"" << theVertexName << "\")";
600         else
601           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size  << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
602       }
603     }
604   } 
605   else {
606     enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
607     if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
608       newValue = true;
609     }
610     else {
611       ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
612       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
613         newValue = true;
614       }
615     }
616
617     if (newValue) {
618       if (string(theGroupName).empty())
619         SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
620       else
621         SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
622     }
623   }
624
625   if (newValue)
626     this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
627
628   return newValue;
629 }
630
631 //=======================================================================
632 //function : GetEnforcedVertex
633 //=======================================================================
634
635 CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
636   throw (SALOME::SALOME_Exception)
637 {
638   ASSERT(myBaseImpl);
639   try {
640     bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
641     SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
642     return isDone;
643   }
644   catch (const std::invalid_argument& ex) {
645     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
646   }
647   catch (SALOME_Exception& ex) {
648     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
649   }
650 }
651
652 //=======================================================================
653 //function : GetEnforcedVertex
654 //=======================================================================
655
656 CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
657   throw (SALOME::SALOME_Exception)
658 {
659   ASSERT(myBaseImpl);
660   
661   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
662     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
663   }
664   
665   string theVertexEntry = theVertex->GetStudyEntry();
666   if (theVertexEntry.empty()) {
667     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
668     string aName;
669     if (theVertex->GetShapeType() == GEOM::VERTEX)
670       aName = "Vertex_";
671     if (theVertex->GetShapeType() == GEOM::COMPOUND)
672       aName = "Compound_";
673     aName += theVertex->GetEntry();
674     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
675     if (!theSVertex->_is_nil())
676       theVertexEntry = theSVertex->GetID();
677   }
678   if (theVertexEntry.empty())
679     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
680
681   string theVertexName = theVertex->GetName();
682   
683   try {
684     bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
685     SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
686     return isDone;
687   }
688   catch (const std::invalid_argument& ex) {
689     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
690   }
691   catch (SALOME_Exception& ex) {
692     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
693   }
694 }
695
696 //=======================================================================
697 //function : GetEnforcedVertices
698 //=======================================================================
699
700 GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVertices()
701 {
702   ASSERT(myBaseImpl);
703   GHS3DPlugin::GHS3DEnforcedVertexList_var result = new GHS3DPlugin::GHS3DEnforcedVertexList();
704
705   const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
706   result->length( enfVertexList.size() );
707
708   ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator it = enfVertexList.begin();
709
710   for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
711     ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* currentVertex = (*it);
712     GHS3DPlugin::GHS3DEnforcedVertex_var enfVertex = new GHS3DPlugin::GHS3DEnforcedVertex();
713     // Name
714     enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
715     // Geom Vertex Entry
716     enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
717     // Coords
718     GHS3DPlugin::TCoords_var coords = new GHS3DPlugin::TCoords();
719     coords->length(currentVertex->coords.size());
720     for ( size_t ind = 0; ind < currentVertex->coords.size(); ind++)
721       coords[ind] = currentVertex->coords[ind];
722     enfVertex->coords = coords;
723     // Group Name
724     enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
725     // Size
726     enfVertex->size = currentVertex->size;
727     // isCompound
728     enfVertex->isCompound = currentVertex->isCompound;
729     
730     result[i]=enfVertex;
731   }
732   
733   //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
734
735   return result._retn();
736 }
737
738 //=======================================================================
739 //function : RemoveEnforcedVertex
740 //=======================================================================
741
742 bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
743   throw (SALOME::SALOME_Exception)
744 {
745   ASSERT(myBaseImpl);
746   try {
747     bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
748     SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
749     return res;
750   }
751   catch (const std::invalid_argument& ex) {
752     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
753   }
754   catch (SALOME_Exception& ex) {
755     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
756   }
757 }
758
759 bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
760   throw (SALOME::SALOME_Exception)
761 {
762   ASSERT(myBaseImpl);
763   
764   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
765     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
766   }
767   
768   string theVertexEntry = theVertex->GetStudyEntry();
769   if (theVertexEntry.empty()) {
770     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
771     string aName;
772     if (theVertex->GetShapeType() == GEOM::VERTEX)
773       aName = "Vertex_";
774     if (theVertex->GetShapeType() == GEOM::COMPOUND)
775       aName = "Compound_";
776     aName += theVertex->GetEntry();
777     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
778     if (!theSVertex->_is_nil())
779       theVertexEntry = theSVertex->GetID();
780   }
781   if (theVertexEntry.empty())
782     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
783   
784   try {
785     bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
786     SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
787     return res;
788   }
789   catch (const std::invalid_argument& ex) {
790     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
791   }
792   catch (SALOME_Exception& ex) {
793     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
794   }
795 }
796
797 //=======================================================================
798 //function : ClearEnforcedVertices
799 //=======================================================================
800
801 void GHS3DPlugin_Hypothesis_i::ClearEnforcedVertices()
802 {
803   ASSERT(myBaseImpl);
804   this->GetImpl()->ClearEnforcedVertices();
805   SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
806 }
807
808 //=======================================================================
809 //function : ClearEnforcedMeshes
810 //=======================================================================
811
812 void GHS3DPlugin_Hypothesis_i::ClearEnforcedMeshes()
813 {
814   ASSERT(myBaseImpl);
815   this->GetImpl()->ClearEnforcedMeshes();
816   SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
817 }
818
819 //=======================================================================
820 //function : GetEnforcedMeshes
821 //=======================================================================
822
823 GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes()
824 {
825   ASSERT(myBaseImpl);
826   GHS3DPlugin::GHS3DEnforcedMeshList_var result = new GHS3DPlugin::GHS3DEnforcedMeshList();
827
828   const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
829   result->length( enfMeshList.size() );
830
831   ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::const_iterator it = enfMeshList.begin();
832
833   for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
834     ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* currentMesh = (*it);
835     GHS3DPlugin::GHS3DEnforcedMesh_var enfMesh = new GHS3DPlugin::GHS3DEnforcedMesh();
836     // Name
837     enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
838     // Mesh Entry
839     enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
840     // isCompound
841     enfMesh->elementType = currentMesh->elementType;
842     // Group Name
843     enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
844     
845     result[i]=enfMesh;
846   }
847   
848   //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
849
850   return result._retn();
851 }
852
853 /*!
854  * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
855  */
856 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
857   throw (SALOME::SALOME_Exception)
858 {
859   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
860 }
861
862 /*!
863  * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
864  */
865 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
866   throw (SALOME::SALOME_Exception)
867 {
868   return p_SetEnforcedMesh(theSource, theType);
869 }
870
871 /*!
872  * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
873  */
874 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
875   throw (SALOME::SALOME_Exception)
876 {
877   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
878 }
879
880 /*!
881  * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
882  */
883 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
884   throw (SALOME::SALOME_Exception)
885 {
886   return p_SetEnforcedMesh(theSource, theType);
887 }
888
889 bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource,
890                                                  SMESH::ElementType        theType,
891                                                  const char*               theName,
892                                                  const char*               theGroupName)
893   throw (SALOME::SALOME_Exception)
894 {
895   ASSERT(myBaseImpl);
896
897   if (CORBA::is_nil( theSource ))
898     THROW_SALOME_CORBA_EXCEPTION( "The source mesh CORBA object is NULL" ,SALOME::BAD_PARAM );
899
900   switch (theType) {
901   case SMESH::NODE:
902   case SMESH::EDGE:
903   case SMESH::FACE: break;
904   default:
905     return false;
906   }
907   SMESH::array_of_ElementType_var types = theSource->GetTypes();
908   if ( types->length() >= 1 && types[types->length()-1] <  theType)
909   {
910     return false;
911   }
912
913   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
914   SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource);
915
916   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
917   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
918   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
919
920   string enfMeshName = theName;
921   if (enfMeshName.empty())
922     enfMeshName = SObj->GetName();
923
924   if (theMesh_i)
925   {
926     try {
927       bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
928       if (theGroupName && theGroupName[0] ) {
929         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
930                               << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
931       }
932       else {
933         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
934                               << theSource << ".GetMesh(), " << theType << " )";
935       }
936
937       return res;
938     }
939     catch (const std::invalid_argument& ex) {
940       SALOME::ExceptionStruct ExDescription;
941       ExDescription.text = ex.what();
942       ExDescription.type = SALOME::BAD_PARAM;
943       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
944       ExDescription.lineNumber = 840;
945       throw SALOME::SALOME_Exception(ExDescription);
946     }
947     catch (SALOME_Exception& ex) {
948       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
949     }
950   }
951   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
952   {
953     try {
954       bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
955       if ( theGroupName && theGroupName[0] ) {
956         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
957                               << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
958       }
959       else {
960         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
961                               << theSource << ", " << theType << " )";
962       }
963       return res;
964     }
965     catch (const std::invalid_argument& ex) {
966       SALOME::ExceptionStruct ExDescription;
967       ExDescription.text = ex.what();
968       ExDescription.type = SALOME::BAD_PARAM;
969       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
970       ExDescription.lineNumber = 840;
971       throw SALOME::SALOME_Exception(ExDescription);
972     }
973     catch (SALOME_Exception& ex) {
974       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
975     }
976   }
977   else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
978   {
979     try {
980       bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
981       if ( theGroupName && theGroupName[0] ) {
982         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
983                               << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
984       }
985       else {
986         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
987                               << theSource << ", " << theType << " )";
988       }
989       return res;
990     }
991     catch (const std::invalid_argument& ex) {
992       SALOME::ExceptionStruct ExDescription;
993       ExDescription.text = ex.what();
994       ExDescription.type = SALOME::BAD_PARAM;
995       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
996       ExDescription.lineNumber = 840;
997       throw SALOME::SALOME_Exception(ExDescription);
998     }
999     catch (SALOME_Exception& ex) {
1000       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1001     }
1002   }
1003   return false;
1004 }
1005 //=============================================================================
1006 /*!
1007  *  Get implementation
1008  */
1009 //=============================================================================
1010
1011 ::GHS3DPlugin_Hypothesis* GHS3DPlugin_Hypothesis_i::GetImpl()
1012 {
1013   return (::GHS3DPlugin_Hypothesis*)myBaseImpl;
1014 }
1015
1016 //================================================================================
1017 /*!
1018  * \brief Verify whether hypothesis supports given entity type 
1019  */
1020 //================================================================================  
1021
1022 CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1023 {
1024   return type == SMESH::DIM_3D;
1025 }
1026
1027
1028 //================================================================================
1029 /*!
1030  * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
1031  */
1032 //================================================================================
1033
1034 bool
1035 GHS3DPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
1036                                               std::vector< int >         & subIDArray ) const
1037 {
1038   typedef ::GHS3DPlugin_Hypothesis THyp;
1039   const THyp* h = static_cast< const THyp*>( myBaseImpl );
1040
1041   {
1042     const THyp::TGHS3DEnforcedVertexList& enfVertexList = h->_GetEnforcedVertices();
1043     THyp::TGHS3DEnforcedVertexList::const_iterator evIt = enfVertexList.begin();
1044     for ( ; evIt != enfVertexList.end(); ++evIt )
1045     {
1046       const THyp::TGHS3DEnforcedVertex* ev = *evIt;
1047       entryArray.push_back( ev->geomEntry );
1048     }
1049   }
1050   {
1051     const THyp::TGHS3DEnforcedVertexEntryValues&
1052       enfVertexEntrySizeList = h->_GetEnforcedVerticesEntrySize();
1053     THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size;
1054     for ( entry2size =  enfVertexEntrySizeList.cbegin();
1055           entry2size != enfVertexEntrySizeList.cend();
1056           entry2size++ )
1057     {
1058       entryArray.push_back( entry2size->first );
1059     }
1060   }
1061   {
1062     const THyp::TCoordsGHS3DEnforcedVertexMap&
1063       coordsEnfVertexMap = h->_GetEnforcedVerticesByCoords();
1064     THyp::TCoordsGHS3DEnforcedVertexMap::const_iterator size2ev = coordsEnfVertexMap.cbegin();
1065     for ( ; size2ev != coordsEnfVertexMap.cend(); ++size2ev )
1066     {
1067       const THyp::TGHS3DEnforcedVertex* ev = size2ev->second;
1068       entryArray.push_back( ev->geomEntry );
1069     }
1070   }
1071   {
1072     const THyp::TGeomEntryGHS3DEnforcedVertexMap&
1073       geomEntryEnfVertexMap = h->_GetEnforcedVerticesByEntry();
1074     THyp::TGeomEntryGHS3DEnforcedVertexMap::const_iterator entry2ev;
1075     for ( entry2ev =  geomEntryEnfVertexMap.cbegin();
1076           entry2ev != geomEntryEnfVertexMap.cend();
1077           entry2ev++ )
1078     {
1079       entryArray.push_back( entry2ev->first );
1080
1081       const THyp::TGHS3DEnforcedVertex* ev = entry2ev->second;
1082       entryArray.push_back( ev->geomEntry );
1083     }
1084   }
1085
1086   return entryArray.size() > 0;
1087 }
1088
1089 //================================================================================
1090 /*!
1091  * \brief Set new geometry instead of that returned by getObjectsDependOn()
1092  */
1093 //================================================================================
1094
1095 bool
1096 GHS3DPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
1097                                               std::vector< int >         & subIDArray )
1098 {
1099   typedef ::GHS3DPlugin_Hypothesis THyp;
1100   THyp* h = static_cast< THyp*>( myBaseImpl );
1101
1102   size_t iEnt = 0;
1103   {
1104     THyp::TGHS3DEnforcedVertexList& enfVertexList =
1105       const_cast<THyp::TGHS3DEnforcedVertexList& >( h->_GetEnforcedVertices() );
1106     THyp::TGHS3DEnforcedVertexList::iterator evIt = enfVertexList.begin();
1107     for ( ; evIt != enfVertexList.end(); ++evIt )
1108     {
1109       THyp::TGHS3DEnforcedVertex* ev = *evIt;
1110       ev->geomEntry = entryArray[ iEnt++ ];
1111     }
1112   }
1113   {
1114     THyp::TGHS3DEnforcedVertexEntryValues& enfVertexEntrySizeListNew =
1115       const_cast< THyp::TGHS3DEnforcedVertexEntryValues& > ( h->_GetEnforcedVerticesEntrySize() );
1116     THyp::TGHS3DEnforcedVertexEntryValues enfVertexEntrySizeList;
1117     enfVertexEntrySizeList.swap( enfVertexEntrySizeListNew );
1118     THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size;
1119     for ( entry2size =  enfVertexEntrySizeList.cbegin();
1120           entry2size != enfVertexEntrySizeList.cend();
1121           entry2size++, ++iEnt )
1122     {
1123       if ( entry2size->first.empty() == entryArray[ iEnt ].empty() )
1124         enfVertexEntrySizeListNew[ entryArray[ iEnt ]] = entry2size->second;
1125     }
1126   }
1127   {
1128     THyp::TCoordsGHS3DEnforcedVertexMap& coordsEnfVertexMap =
1129       const_cast< THyp::TCoordsGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByCoords() );
1130     THyp::TCoordsGHS3DEnforcedVertexMap::iterator size2ev = coordsEnfVertexMap.begin();
1131     for ( ; size2ev != coordsEnfVertexMap.end(); ++size2ev )
1132     {
1133       THyp::TGHS3DEnforcedVertex* ev = size2ev->second;
1134       ev->geomEntry = entryArray[ iEnt++ ];
1135     }
1136   }
1137   {
1138     THyp::TGeomEntryGHS3DEnforcedVertexMap& geomEntryEnfVertexMapNew =
1139       const_cast< THyp::TGeomEntryGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByEntry() );
1140     THyp::TGeomEntryGHS3DEnforcedVertexMap geomEntryEnfVertexMap;
1141     geomEntryEnfVertexMap.swap( geomEntryEnfVertexMapNew );
1142     THyp::TGeomEntryGHS3DEnforcedVertexMap::iterator entry2ev;
1143     for ( entry2ev =  geomEntryEnfVertexMap.begin();
1144           entry2ev != geomEntryEnfVertexMap.end();
1145           entry2ev++ )
1146     {
1147       const std::string& entry = entryArray[ iEnt++ ];
1148       THyp::TGHS3DEnforcedVertex* ev = entry2ev->second;
1149       ev->geomEntry = entryArray[ iEnt++ ];
1150
1151       geomEntryEnfVertexMapNew[ entry ] = ev;
1152     }
1153   }
1154
1155   return iEnt == entryArray.size();
1156 }