1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
50 ::SMESH_Gen* theGenImpl,
52 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
54 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
60 //=============================================================================
62 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
66 //=============================================================================
67 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
71 //=============================================================================
73 //=============================================================================
75 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
80 //=============================================================================
81 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
84 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
85 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
88 //=============================================================================
90 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
94 //=============================================================================
95 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
98 return this->GetImpl()->GetPhysicalMesh();
101 //=============================================================================
103 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
108 //=============================================================================
109 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
112 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
113 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
116 //=============================================================================
118 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
122 //=============================================================================
123 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
126 return this->GetImpl()->GetGeometricMesh();
129 //=============================================================================
131 * BLSURFPlugin_Hypothesis_i::SetPhySize
135 //=============================================================================
136 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
139 this->GetImpl()->SetPhySize(theValue, false);
140 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
143 //=============================================================================
145 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
147 * Set Relative PhySize
149 //=============================================================================
150 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
153 this->GetImpl()->SetPhySize(theValue, true);
154 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
157 //=============================================================================
159 * BLSURFPlugin_Hypothesis_i::GetPhySize
163 //=============================================================================
164 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
167 return this->GetImpl()->GetPhySize();
170 //=============================================================================
172 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
174 * Returns True if PhySize is relative
176 //=============================================================================
177 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
180 return this->GetImpl()->IsPhySizeRel();
183 //=============================================================================
184 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
186 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
187 this->GetImpl()->SetMinSize(theMinSize, false);
188 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
192 //=============================================================================
193 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
195 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
196 this->GetImpl()->SetMinSize(theMinSize, true);
197 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
201 //=============================================================================
202 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
204 return this->GetImpl()->GetMinSize();
207 //=============================================================================
208 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
210 return this->GetImpl()->IsMinSizeRel();
213 //=============================================================================
214 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
216 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
217 this->GetImpl()->SetMaxSize(theMaxSize, false);
218 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
222 //=============================================================================
223 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
225 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
226 this->GetImpl()->SetMaxSize(theMaxSize, true);
227 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
231 //=============================================================================
232 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
234 return this->GetImpl()->GetMaxSize();
237 //=============================================================================
238 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
240 return this->GetImpl()->IsMaxSizeRel();
244 //=============================================================================
246 * BLSURFPlugin_Hypothesis_i::SetUseGradation
250 //=============================================================================
251 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
253 if ( GetImpl()->GetUseGradation() != bool( theValue ))
255 this->GetImpl()->SetUseGradation(theValue);
256 std::string theValueStr = theValue ? "True" : "False";
257 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
261 //=============================================================================
263 * BLSURFPlugin_Hypothesis_i::GetUseGradation
267 //=============================================================================
268 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
270 return this->GetImpl()->GetUseGradation();
273 //=============================================================================
275 * BLSURFPlugin_Hypothesis_i::SetGradation
279 //=============================================================================
280 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
282 this->GetImpl()->SetGradation(theValue);
285 SetUseGradation( false );
287 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
290 //=============================================================================
292 * BLSURFPlugin_Hypothesis_i::GetGradation
296 //=============================================================================
297 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
299 return this->GetImpl()->GetGradation();
302 //=============================================================================
304 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
308 //=============================================================================
309 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
311 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
313 this->GetImpl()->SetUseVolumeGradation(theValue);
314 std::string theValueStr = theValue ? "True" : "False";
315 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
319 //=============================================================================
321 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
325 //=============================================================================
326 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
328 return this->GetImpl()->GetUseVolumeGradation();
331 //=============================================================================
333 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
335 * Set VolumeGradation
337 //=============================================================================
338 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
340 this->GetImpl()->SetVolumeGradation(theValue);
342 SetUseVolumeGradation( false );
344 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
347 //=============================================================================
349 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
351 * Get VolumeGradation
353 //=============================================================================
354 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
356 return this->GetImpl()->GetVolumeGradation();
359 //=============================================================================
361 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
365 * DEPRACATED, kept for python script compatibility
367 * TO be removed in Salome 9
369 //=============================================================================
370 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
372 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
373 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
374 this->GetImpl()->SetElementType(theElementType);
375 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
378 //=============================================================================
380 * BLSURFPlugin_Hypothesis_i::SetElementType
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
387 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
388 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetElementType
396 //=============================================================================
397 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
399 return this->GetImpl()->GetElementType();
402 //=============================================================================
404 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
408 //=============================================================================
409 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
411 this->GetImpl()->SetAngleMesh(theValue);
412 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
415 //=============================================================================
417 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
421 //=============================================================================
422 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
424 return this->GetImpl()->GetAngleMesh();
427 //=============================================================================
429 * BLSURFPlugin_Hypothesis_i::SetChordalError
433 //=============================================================================
434 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
436 this->GetImpl()->SetChordalError(theValue);
437 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
440 //=============================================================================
442 * BLSURFPlugin_Hypothesis_i::GetChordalError
446 //=============================================================================
447 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
449 return this->GetImpl()->GetChordalError();
452 //=============================================================================
454 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
458 //=============================================================================
459 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
461 this->GetImpl()->SetAnisotropic(theValue);
462 std::string theValueStr = theValue ? "True" : "False";
463 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
466 //=============================================================================
468 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
472 //=============================================================================
473 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
475 return this->GetImpl()->GetAnisotropic();
478 //=============================================================================
480 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
482 * Set Anisotropic Ratio
484 //=============================================================================
485 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
487 this->GetImpl()->SetAnisotropicRatio(theValue);
488 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
491 //=============================================================================
493 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
495 * Get Anisotropic Ratio
497 //=============================================================================
498 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
500 return this->GetImpl()->GetAnisotropicRatio();
504 //=============================================================================
506 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
510 //=============================================================================
511 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
513 this->GetImpl()->SetRemoveTinyEdges(theValue);
514 std::string theValueStr = theValue ? "True" : "False";
515 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
518 //=============================================================================
520 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
524 //=============================================================================
525 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
527 return this->GetImpl()->GetRemoveTinyEdges();
530 //=============================================================================
532 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
534 * Set Tiny Edge Length
536 //=============================================================================
537 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
539 this->GetImpl()->SetTinyEdgeLength(theValue);
540 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
543 //=============================================================================
545 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
547 * Get Tiny Edge Length
549 //=============================================================================
550 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
552 return this->GetImpl()->GetTinyEdgeLength();
555 //=============================================================================
557 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
561 //=============================================================================
562 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
564 this->GetImpl()->SetOptimiseTinyEdges(theValue);
565 std::string theValueStr = theValue ? "True" : "False";
566 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
569 //=============================================================================
571 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
575 //=============================================================================
576 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
578 return this->GetImpl()->GetOptimiseTinyEdges();
581 //=============================================================================
583 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
585 * Set Tiny Edge OptimisationLength
587 //=============================================================================
588 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
590 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
591 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
594 //=============================================================================
596 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
598 * Get Tiny Edge OptimisationLength
600 //=============================================================================
601 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
603 return this->GetImpl()->GetTinyEdgeOptimisationLength();
606 //=============================================================================
608 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
612 //=============================================================================
613 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
615 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
616 std::string theValueStr = theValue ? "True" : "False";
617 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
620 //=============================================================================
622 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
626 //=============================================================================
627 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
629 return this->GetImpl()->GetCorrectSurfaceIntersection();
632 //=============================================================================
634 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
636 * Set Tiny Edge OptimisationLength
638 //=============================================================================
639 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
641 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
642 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
645 //=============================================================================
647 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
649 * Get Tiny Edge OptimisationLength
651 //=============================================================================
652 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
654 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
657 //=============================================================================
659 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
663 //=============================================================================
664 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
666 this->GetImpl()->SetBadElementRemoval(theValue);
667 std::string theValueStr = theValue ? "True" : "False";
668 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
671 //=============================================================================
673 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
677 //=============================================================================
678 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
680 return this->GetImpl()->GetBadElementRemoval();
683 //=============================================================================
685 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
687 * Set Bad Surface Element Aspect Ratio
689 //=============================================================================
690 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
692 this->GetImpl()->SetBadElementAspectRatio(theValue);
693 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
696 //=============================================================================
698 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
700 * Get Bad Surface Element Aspect Ratio
702 //=============================================================================
703 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
705 return this->GetImpl()->GetBadElementAspectRatio();
708 //=============================================================================
710 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
714 //=============================================================================
715 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
717 this->GetImpl()->SetOptimizeMesh(theValue);
718 std::string theValueStr = theValue ? "True" : "False";
719 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
722 //=============================================================================
724 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
728 //=============================================================================
729 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
731 return this->GetImpl()->GetOptimizeMesh();
734 //=============================================================================
736 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
740 //=============================================================================
741 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
743 this->GetImpl()->SetQuadraticMesh(theValue);
744 std::string theValueStr = theValue ? "True" : "False";
745 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
748 //=============================================================================
750 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
754 //=============================================================================
755 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
757 return this->GetImpl()->GetQuadraticMesh();
765 * BLSURFPlugin_Hypothesis_i::SetTopology
770 //=============================================================================
771 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
773 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
774 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
777 //=============================================================================
779 * BLSURFPlugin_Hypothesis_i::GetTopology
783 //=============================================================================
784 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
786 return this->GetImpl()->GetTopology();
789 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
792 if (theVal < 0 || theVal > 100)
793 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
794 this->GetImpl()->SetVerbosity(theVal);
795 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
798 //=============================================================================
800 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
802 return (CORBA::Short) this->GetImpl()->GetVerbosity();
805 //=============================================================================
806 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
808 if ( GetEnforceCadEdgesSize() != toEnforce )
810 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
811 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
814 //=============================================================================
815 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
817 return this->GetImpl()->GetEnforceCadEdgesSize();
819 //=============================================================================
821 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
823 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
825 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
826 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
829 //=============================================================================
830 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
832 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
834 //=============================================================================
836 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
838 if ( GetJacobianRectification() != allowRectification )
840 this->GetImpl()->SetJacobianRectification(allowRectification);
841 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
844 //=============================================================================
845 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
847 return this->GetImpl()->GetJacobianRectification();
849 //=============================================================================
851 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
853 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
855 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
856 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
859 //=============================================================================
860 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
862 return this->GetImpl()->GetUseDeprecatedPatchMesher();
864 //=============================================================================
866 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
868 if ( GetMaxNumberOfPointsPerPatch() != nb )
871 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
873 } catch (const std::invalid_argument& ex) {
874 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
875 } catch (SALOME_Exception& ex) {
876 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
878 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
881 //=============================================================================
882 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
884 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
886 //=============================================================================
888 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
890 if ( GetMaxNumberOfThreads() != nb )
893 this->GetImpl()->SetMaxNumberOfThreads(nb);
895 } catch (const std::invalid_argument& ex) {
896 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
897 } catch (SALOME_Exception& ex) {
898 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
900 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
903 //=============================================================================
904 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
906 return this->GetImpl()->GetMaxNumberOfThreads();
908 //=============================================================================
910 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
912 if ( GetRespectGeometry() != toRespect )
914 this->GetImpl()->SetRespectGeometry(toRespect);
915 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
918 //=============================================================================
919 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
921 return this->GetImpl()->GetRespectGeometry();
923 //=============================================================================
925 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
927 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
929 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
930 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
933 //=============================================================================
934 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
936 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
938 //=============================================================================
940 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
942 if ( GetClosedGeometry() != isClosed )
944 this->GetImpl()->SetClosedGeometry(isClosed);
945 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
948 //=============================================================================
949 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
951 return this->GetImpl()->GetClosedGeometry();
953 //=============================================================================
955 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
957 if ( GetDebug() != isDebug )
959 this->GetImpl()->SetDebug(isDebug);
960 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
963 //=============================================================================
964 bool BLSURFPlugin_Hypothesis_i::GetDebug()
966 return this->GetImpl()->GetDebug();
968 //=============================================================================
970 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
973 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
977 this->GetImpl()->SetPeriodicTolerance(tol);
979 } catch (const std::invalid_argument& ex) {
980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
981 } catch (SALOME_Exception& ex) {
982 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
984 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
987 //=============================================================================
988 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
991 return this->GetImpl()->GetPeriodicTolerance();
993 } catch (const std::invalid_argument& ex) {
994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 } catch (SALOME_Exception& ex) {
996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1000 //=============================================================================
1002 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1004 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1007 this->GetImpl()->SetRequiredEntities(howToTreat);
1009 } catch (const std::invalid_argument& ex) {
1010 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1011 } catch (SALOME_Exception& ex) {
1012 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1014 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1017 //=============================================================================
1018 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1020 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1022 //=============================================================================
1024 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1027 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1031 this->GetImpl()->SetSewingTolerance(tol);
1032 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1034 } catch (const std::invalid_argument& ex) {
1035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1036 } catch (SALOME_Exception& ex) {
1037 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1041 //=============================================================================
1042 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1046 return this->GetImpl()->GetSewingTolerance();
1048 } catch (const std::invalid_argument& ex) {
1049 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1050 } catch (SALOME_Exception& ex) {
1051 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1055 //=============================================================================
1057 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1059 if ( GetImpl()->GetTags() != howToTreat )
1062 this->GetImpl()->SetTags(howToTreat);
1064 catch (const std::invalid_argument& ex) {
1065 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1066 } catch (SALOME_Exception& ex) {
1067 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1070 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1072 //=============================================================================
1073 char* BLSURFPlugin_Hypothesis_i::GetTags()
1075 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1078 //=============================================================================
1079 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1081 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1082 SMESH_Comment hplDump;
1084 for ( size_t i = 0; i < patchList.size(); ++i )
1087 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1088 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1090 patchList[ i ].insert( tags[ j ]);
1091 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1093 hplDump << ( i+1 < patchList.size() ? "," : "]");
1095 if ( GetImpl()->GetHyperPatches() != patchList )
1097 GetImpl()->SetHyperPatches( patchList );
1098 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1102 //=============================================================================
1103 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1105 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1106 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1107 resHpl->length( hpl.size() );
1109 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1110 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1112 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1113 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1114 resHp.length( hp.size() );
1116 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1117 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1123 //=============================================================================
1125 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1129 //=============================================================================
1130 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1132 this->GetImpl()->SetPreCADMergeEdges(theValue);
1133 std::string theValueStr = theValue ? "True" : "False";
1134 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1137 //=============================================================================
1139 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1143 //=============================================================================
1144 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1146 return this->GetImpl()->GetPreCADMergeEdges();
1149 //=============================================================================
1151 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1155 //=============================================================================
1156 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1158 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1159 std::string theValueStr = theValue ? "True" : "False";
1160 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1163 //=============================================================================
1165 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1169 //=============================================================================
1170 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1172 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1175 //=============================================================================
1177 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1181 //=============================================================================
1182 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1184 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1185 std::string theValueStr = theValue ? "True" : "False";
1186 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1189 //=============================================================================
1191 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1195 //=============================================================================
1196 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1198 return this->GetImpl()->GetPreCADProcess3DTopology();
1201 //=============================================================================
1203 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1207 //=============================================================================
1208 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1210 this->GetImpl()->SetPreCADDiscardInput(theValue);
1211 std::string theValueStr = theValue ? "True" : "False";
1212 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1215 //=============================================================================
1217 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1221 //=============================================================================
1222 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1224 return this->GetImpl()->GetPreCADDiscardInput();
1228 //=============================================================================
1230 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1231 throw (SALOME::SALOME_Exception) {
1234 std::string name( optionName );
1235 if ( !optionValue || !optionValue[0] )
1236 UnsetOption( optionName );
1238 // basic options (visible in Advanced table)
1240 else if ( name == "enforce_cad_edge_sizes" )
1241 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1243 else if ( name == "jacobian_rectification_respect_geometry" )
1244 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1246 else if ( name == "max_number_of_points_per_patch" )
1247 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1249 else if ( name == "max_number_of_threads" )
1250 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1252 else if ( name == "rectify_jacobian" )
1253 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1255 else if ( name == "use_deprecated_patch_mesher" )
1256 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1258 else if ( name == "respect_geometry" )
1259 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1261 else if ( name == "tiny_edge_avoid_surface_intersections" )
1262 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1264 else if ( name == "closed_geometry" )
1265 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1267 else if ( name == "debug" )
1268 SetDebug( GetImpl()->ToBool( optionValue ));
1270 else if ( name == "discard_input_topology" )
1271 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1273 else if ( name == "merge_edges" )
1274 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1276 else if ( name == "periodic_tolerance" )
1277 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1279 else if ( name == "remove_duplicate_cad_faces" )
1280 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1282 else if ( name == "required_entities" )
1283 SetRequiredEntities( optionValue );
1285 else if ( name == "sewing_tolerance" )
1286 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1288 else if ( name == "tags" )
1289 SetTags( optionValue );
1291 // other basic options with specific methods
1293 else if ( name == "correct_surface_intersections" )
1294 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1296 else if ( name == "optimise_tiny_edges" )
1297 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1299 else if ( name == "surface_intersections_processing_max_cost" )
1300 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1302 else if ( name == "volume_gradation" )
1303 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1305 else if ( name == "tiny_edge_optimisation_length" )
1306 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1308 // advanced options (for backward compatibility)
1310 else if ( name == "create_tag_on_collision" ||
1311 name == "tiny_edge_respect_geometry" )
1312 AddOption( optionName, optionValue );
1316 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1317 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1320 this->GetImpl()->SetOptionValue(optionName, optionValue);
1321 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1324 } catch (const std::invalid_argument& ex) {
1325 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1326 } catch (SALOME_Exception& ex) {
1327 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1331 //=============================================================================
1333 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1334 throw (SALOME::SALOME_Exception) {
1336 bool valueChanged = false;
1338 std::string name( optionName );
1339 if ( !optionValue || !optionValue[0] )
1340 UnsetOption( optionName );
1342 else if ( name == "closed_geometry" )
1343 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1345 else if ( name == "debug" )
1346 SetDebug( GetImpl()->ToBool( optionValue ));
1348 else if ( name == "discard_input_topology" )
1349 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1351 else if ( name == "merge_edges" )
1352 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1354 else if ( name == "periodic_tolerance" )
1355 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1357 else if ( name == "remove_duplicate_cad_faces" )
1358 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1360 else if ( name == "required_entities" )
1361 SetRequiredEntities( optionValue );
1363 else if ( name == "sewing_tolerance" )
1364 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1366 else if ( name == "tags" )
1367 SetTags( optionValue );
1369 // other basic options with specific methods
1371 else if ( name == "correct_surface_intersections" )
1372 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1374 else if ( name == "optimise_tiny_edges" )
1375 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1377 else if ( name == "surface_intersections_processing_max_cost" )
1378 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1380 else if ( name == "volume_gradation" )
1381 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1383 else if ( name == "tiny_edge_optimisation_length" )
1384 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1386 else if ( name == "process_3d_topology" )
1387 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1389 // advanced options (for backward compatibility)
1391 else if ( name == "create_tag_on_collision" ||
1392 name == "tiny_edge_respect_geometry" ||
1393 name == "remove_tiny_edges" ||
1394 name == "tiny_edge_length")
1395 AddPreCADOption( optionName, optionValue );
1398 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1400 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1402 } catch (const std::invalid_argument& ex) {
1403 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1404 } catch (SALOME_Exception& ex) {
1405 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1408 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1411 //=============================================================================
1413 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1417 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1418 } catch (const std::invalid_argument& ex) {
1419 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1420 } catch (SALOME_Exception& ex) {
1421 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1426 //=============================================================================
1428 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1432 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1433 } catch (const std::invalid_argument& ex) {
1434 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1435 } catch (SALOME_Exception& ex) {
1436 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1441 //=============================================================================
1443 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1445 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1447 this->GetImpl()->ClearOption(optionName);
1448 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1452 //=============================================================================
1454 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1456 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1458 this->GetImpl()->ClearPreCADOption(optionName);
1459 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1463 //=============================================================================
1465 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1467 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1469 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1470 result->length(opts.size());
1474 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1475 for (; opIt != opts.end(); ++opIt, ++i) {
1476 string name_value_type = opIt->first;
1477 if (!opIt->second.empty()) {
1478 name_value_type += ":";
1479 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1480 name_value_type += isDefault ? ":0" : ":1";
1482 result[i] = CORBA::string_dup(name_value_type.c_str());
1485 return result._retn();
1488 //=============================================================================
1490 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1492 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1494 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1495 result->length(opts.size());
1499 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1500 for (; opIt != opts.end(); ++opIt, ++i) {
1501 string name_value_type = opIt->first;
1502 if (!opIt->second.empty()) {
1503 name_value_type += ":";
1504 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1505 name_value_type += isDefault ? ":0" : ":1";
1507 result[i] = CORBA::string_dup(name_value_type.c_str());
1509 return result._retn();
1512 //=============================================================================
1514 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1516 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1518 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1519 result->length(custom_opts.size());
1522 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1523 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1524 string name_value_type = opIt->first;
1525 if (!opIt->second.empty()) {
1526 name_value_type += ":";
1527 name_value_type += opIt->second;
1528 name_value_type += ":1"; // user defined
1530 result[i] = CORBA::string_dup(name_value_type.c_str());
1532 return result._retn();
1535 //=============================================================================
1537 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1538 throw (SALOME::SALOME_Exception) {
1540 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1541 string name_value_type = options[i].in();
1542 if(name_value_type.empty())
1544 size_t colonPos = name_value_type.find(':');
1546 if (colonPos == string::npos) // ':' not found
1547 name = name_value_type;
1549 name = name_value_type.substr(0, colonPos);
1550 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1551 string value_type = name_value_type.substr(colonPos + 1);
1552 colonPos = value_type.find(':');
1553 value = value_type.substr(0, colonPos);
1554 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1555 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1559 SetOptionValue(name.c_str(), value.c_str());
1563 //=============================================================================
1565 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1566 throw (SALOME::SALOME_Exception) {
1568 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1569 string name_value_type = options[i].in();
1570 if(name_value_type.empty())
1572 size_t colonPos = name_value_type.find(':');
1574 if (colonPos == string::npos) // ':' not found
1575 name = name_value_type;
1577 name = name_value_type.substr(0, colonPos);
1578 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1579 string value_type = name_value_type.substr(colonPos + 1);
1580 colonPos = value_type.find(':');
1581 value = value_type.substr(0, colonPos);
1582 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1583 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1587 SetPreCADOptionValue(name.c_str(), value.c_str());
1591 //=============================================================================
1593 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1595 SMESH::TPythonDump dump;
1597 string optionsAndValues;
1598 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1599 string name_value_type = options[i].in();
1600 if(name_value_type.empty())
1602 size_t colonPos = name_value_type.find(':');
1604 if (colonPos == string::npos) // ':' not found
1605 name = name_value_type;
1607 name = name_value_type.substr(0, colonPos);
1608 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1609 string value_type = name_value_type.substr(colonPos + 1);
1610 colonPos = value_type.find(':');
1611 value = value_type.substr(0, colonPos);
1614 AddOption(name.c_str(), value.c_str());
1616 optionsAndValues += name + " " + value + " ";
1619 if ( !optionsAndValues.empty() )
1620 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1623 //=============================================================================
1625 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1626 throw (SALOME::SALOME_Exception)
1628 if ( !optionsAndValues ) return;
1630 SMESH::TPythonDump dump;
1632 std::istringstream strm( optionsAndValues );
1633 std::istream_iterator<std::string> sIt( strm ), sEnd;
1634 while ( sIt != sEnd )
1636 std::string option = *sIt;
1637 if ( ++sIt != sEnd )
1639 std::string value = *sIt;
1641 AddOption( option.c_str(), value.c_str() );
1645 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1648 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1651 //=============================================================================
1653 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1656 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1658 this->GetImpl()->AddOption(optionName, optionValue);
1659 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1663 //=============================================================================
1665 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1668 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1670 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1671 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1675 //=============================================================================
1677 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1680 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1683 //=============================================================================
1685 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1688 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1691 //=============================================================================
1693 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1694 throw (SALOME::SALOME_Exception) {
1696 if ( !entry || !entry[0] )
1697 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1698 bool valueChanged = false;
1700 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1702 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1703 } catch (const std::invalid_argument& ex) {
1704 SALOME::ExceptionStruct ExDescription;
1705 ExDescription.text = ex.what();
1706 ExDescription.type = SALOME::BAD_PARAM;
1707 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1708 ExDescription.lineNumber = 0;
1709 throw SALOME::SALOME_Exception(ExDescription);
1710 } catch (SALOME_Exception& ex) {
1711 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1714 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1717 //=============================================================================
1719 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1720 throw (SALOME::SALOME_Exception) {
1722 bool valueChanged = false;
1723 std::ostringstream sizeMapFunction;
1724 switch (shapeType) {
1725 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1726 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1727 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1731 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1733 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1734 } catch (const std::invalid_argument& ex) {
1735 SALOME::ExceptionStruct ExDescription;
1736 ExDescription.text = ex.what();
1737 ExDescription.type = SALOME::BAD_PARAM;
1738 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1739 ExDescription.lineNumber = 0;
1740 throw SALOME::SALOME_Exception(ExDescription);
1741 } catch (SALOME_Exception& ex) {
1742 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1745 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1748 //=============================================================================
1750 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1751 throw (SALOME::SALOME_Exception) {
1753 bool valueChanged = false;
1755 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1756 if ( valueChanged ) {
1757 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1758 if (!boost::regex_match(string(attractor), re))
1759 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1760 this->GetImpl()->SetAttractorEntry(entry, attractor);
1762 } catch (const std::invalid_argument& ex) {
1763 SALOME::ExceptionStruct ExDescription;
1764 ExDescription.text = ex.what();
1765 ExDescription.type = SALOME::BAD_PARAM;
1766 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1767 ExDescription.lineNumber = 0;
1768 throw SALOME::SALOME_Exception(ExDescription);
1769 } catch (SALOME_Exception& ex) {
1770 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1773 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1776 //=============================================================================
1778 void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO ?? finir
1779 throw (SALOME::SALOME_Exception)
1782 //bool valueChanged = false;
1784 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1786 catch (const std::invalid_argument& ex) {
1787 SALOME::ExceptionStruct ExDescription;
1788 ExDescription.text = ex.what();
1789 ExDescription.type = SALOME::BAD_PARAM;
1790 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1791 ExDescription.lineNumber = 0;
1792 throw SALOME::SALOME_Exception(ExDescription);
1793 } catch (SALOME_Exception& ex) {
1794 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1796 //if ( valueChanged )
1797 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1798 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1801 //=============================================================================
1803 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1806 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1807 } catch (const std::invalid_argument& ex) {
1808 SALOME::ExceptionStruct ExDescription;
1809 ExDescription.text = ex.what();
1810 ExDescription.type = SALOME::BAD_PARAM;
1811 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1812 ExDescription.lineNumber = 0;
1813 throw SALOME::SALOME_Exception(ExDescription);
1814 } catch (SALOME_Exception& ex) {
1815 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1820 //=============================================================================
1822 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1825 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1826 } catch (const std::invalid_argument& ex) {
1827 SALOME::ExceptionStruct ExDescription;
1828 ExDescription.text = ex.what();
1829 ExDescription.type = SALOME::BAD_PARAM;
1830 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1831 ExDescription.lineNumber = 0;
1832 throw SALOME::SALOME_Exception(ExDescription);
1833 } catch (SALOME_Exception& ex) {
1834 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1839 // //=============================================================================
1841 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1842 // // A finir pour le dump
1843 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1844 // throw (SALOME::SALOME_Exception)
1846 // ASSERT(myBaseImpl);
1848 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1850 // catch (const std::invalid_argument& ex) {
1851 // SALOME::ExceptionStruct ExDescription;
1852 // ExDescription.text = ex.what();
1853 // ExDescription.type = SALOME::BAD_PARAM;
1854 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1855 // ExDescription.lineNumber = 0;
1856 // throw SALOME::SALOME_Exception(ExDescription);
1858 // catch (SALOME_Exception& ex) {
1859 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1864 //=============================================================================
1866 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1868 this->GetImpl()->ClearEntry(entry);
1869 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1872 //=============================================================================
1874 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1876 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1878 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1879 result->length(sizeMaps.size());
1881 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1882 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1883 string entry_sizemap = smIt->first;
1884 if (!smIt->second.empty()) {
1885 entry_sizemap += "|";
1886 entry_sizemap += smIt->second;
1888 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1890 return result._retn();
1893 //=============================================================================
1895 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1897 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1899 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1900 result->length(attractors.size());
1902 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1903 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1904 string entry_attractor = atIt->first;
1905 if (!atIt->second.empty()) {
1906 entry_attractor += "|";
1907 entry_attractor += atIt->second;
1909 result[i] = CORBA::string_dup(entry_attractor.c_str());
1911 return result._retn();
1914 //=============================================================================
1916 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1919 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1921 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1922 result->length( attractors.size() );
1924 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1925 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1926 string faceEntry = atIt->first;
1928 double startSize, endSize, infDist, constDist;
1929 if ( !atIt->second->Empty() ) {
1930 attEntry = atIt->second->GetAttractorEntry();
1931 std::vector<double> params = atIt->second->GetParameters();
1932 startSize = params[0];
1933 endSize = params[1];
1934 infDist = params[2];
1935 constDist = params[3];
1937 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1938 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1939 result[i].startSize = startSize;
1940 result[i].endSize = endSize;
1941 result[i].infDist = infDist;
1942 result[i].constDist = constDist;
1944 return result._retn();
1947 //=============================================================================
1949 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1950 throw (SALOME::SALOME_Exception) {
1952 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1953 string entry_sizemap = sizeMaps[i].in();
1954 size_t colonPos = entry_sizemap.find('|');
1955 string entry, sizemap;
1956 if (colonPos == string::npos) // '|' separator not found
1957 entry = entry_sizemap;
1959 entry = entry_sizemap.substr(0, colonPos);
1960 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1961 sizemap = entry_sizemap.substr(colonPos + 1);
1963 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1967 //=============================================================================
1969 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1971 this->GetImpl()->ClearSizeMaps();
1974 //=============================================================================
1976 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1977 throw (SALOME::SALOME_Exception)
1981 entry = GeomObj->GetStudyEntry();
1982 SetSizeMapEntry(entry.c_str(), sizeMap);
1985 //=============================================================================
1987 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1989 string entry = GeomObj->GetStudyEntry();
1990 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1991 if (shapeType == GEOM::COMPOUND)
1992 shapeType = GeomObj->GetMaxShapeType();
1993 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1996 //=============================================================================
1997 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2000 entry = GeomObj->GetStudyEntry();
2001 UnsetEntry(entry.c_str());
2002 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2005 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2008 entry = GeomObj->GetStudyEntry();
2009 SetAttractorEntry(entry.c_str(), attractor);
2012 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2015 entry = GeomObj->GetStudyEntry();
2016 UnsetEntry(entry.c_str());
2017 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2020 void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)
2023 string theFaceEntry;
2025 theFaceEntry = theFace->GetStudyEntry();
2026 theAttEntry = theAttractor->GetStudyEntry();
2028 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2031 if (theFaceEntry.empty()) {
2033 aName += theFace->GetEntry();
2034 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2035 if (!theSFace->_is_nil())
2036 theFaceEntry = theSFace->GetID();
2038 if (theFaceEntry.empty())
2039 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2041 if (theAttEntry.empty()) {
2042 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2044 if (theAttractor->GetShapeType() == GEOM::EDGE)
2046 if (theAttractor->GetShapeType() == GEOM::WIRE)
2048 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2049 aName = "Compound_";
2050 aName += theAttractor->GetEntry();
2051 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2052 if (!theSAtt->_is_nil())
2053 theAttEntry = theSAtt->GetID();
2055 if (theAttEntry.empty())
2056 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2058 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2059 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2060 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2063 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2064 GEOM::GEOM_Object_ptr theAttractor)
2067 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2068 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2070 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2073 // if (theFaceEntry.empty()) {
2075 // aName += theFace->GetEntry();
2076 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2077 // if (!theSFace->_is_nil())
2078 // theFaceEntry = theSFace->GetID();
2080 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2081 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2082 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2084 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2085 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2086 << theFace << ", " << theAttractor << " )";
2089 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2090 const char* attractorEntry)
2092 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2093 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2094 << faceEntry << "', '" << attractorEntry << "' )";
2099 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2102 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2105 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2108 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2111 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2114 this->GetImpl()->UnsetCustomSizeMap(entry);
2115 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2119 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2124 // ///////////////////////
2125 // // ENFORCED VERTICES //
2126 // ///////////////////////
2130 * Returns the list of enforced vertices for a given Face entry
2131 * @return A map of Face entry / List of enforced vertices
2134 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2137 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2139 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2140 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2141 resultMap->length(faceEntryEnfVertexListMap.size());
2143 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2144 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2145 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2146 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2147 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2148 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2150 _enfVertexList = it_entry->second;
2151 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2152 enfVertexList->length(_enfVertexList.size());
2154 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2155 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2156 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2157 currentEnfVertex = (*it_enfVertex);
2159 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2162 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2165 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2168 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2169 coords->length(currentEnfVertex->coords.size());
2170 for (CORBA::ULong i=0;i<coords->length();i++)
2171 coords[i] = currentEnfVertex->coords[i];
2172 enfVertex->coords = coords;
2175 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2178 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2179 faceEntryList->length(currentEnfVertex->faceEntries.size());
2180 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2181 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2182 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2183 enfVertex->faceEntries = faceEntryList;
2186 msg << "Enforced vertex: \n"
2187 << "Name: " << enfVertex->name << "\n";
2188 if (coords->length())
2189 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2190 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2191 << "Group Name: " << enfVertex->grpName;
2193 enfVertexList[j] = enfVertex;
2195 mapElement->enfVertexList = enfVertexList;
2197 resultMap[i] = mapElement;
2200 return resultMap._retn();
2204 * Returns the list of all enforced vertices
2205 * @return a list of enforced vertices
2208 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2210 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2211 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2212 resultMap->length(enfVertexList.size());
2214 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2215 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2216 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2217 currentEnfVertex = (*evlIt);
2218 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2220 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2222 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2224 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2225 coords->length(currentEnfVertex->coords.size());
2226 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2227 coords[ind] = currentEnfVertex->coords[ind];
2228 enfVertex->coords = coords;
2230 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2232 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2233 faceEntryList->length(currentEnfVertex->faceEntries.size());
2234 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2235 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2236 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2237 enfVertex->faceEntries = faceEntryList;
2240 msg << "Enforced vertex: \n"
2241 << "Name: " << enfVertex->name << "\n";
2242 if (coords->length())
2243 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2244 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2245 << "Group Name: " << enfVertex->grpName;
2247 resultMap[i] = enfVertex;
2249 return resultMap._retn();
2254 * Returns the list of enforced vertices coords for a given Face entry.
2255 * They are the coords of the "manual" enforced vertices.
2256 * @return A map of Face entry / List of enforced vertices coords
2259 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2262 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2264 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2265 resultMap->length(entryCoordsListMap.size());
2267 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2268 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2269 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2270 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2271 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2273 _coordsList = it_entry->second;
2274 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2275 coordsList->length(_coordsList.size());
2277 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2278 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2279 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2280 coords->length((*it_coords).size());
2281 for (CORBA::ULong i=0;i<coords->length();i++)
2282 coords[i] = (*it_coords)[i];
2283 coordsList[j] = coords;
2285 mapElement->coordsList = coordsList;
2287 resultMap[i] = mapElement;
2290 return resultMap._retn();
2294 * Returns a map of enforced vertices coords / enforced vertex.
2295 * They are the coords of the "manual" enforced vertices.
2297 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2300 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2301 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2302 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2303 resultMap->length(coordsEnfVertexMap.size());
2305 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2306 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2307 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2308 currentEnfVertex = (it_coords->second);
2309 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2310 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2311 coords->length(it_coords->first.size());
2312 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2313 coords[ind] = it_coords->first[ind];
2314 mapElement->coords = coords;
2316 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2318 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2320 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2322 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2323 coords2->length(currentEnfVertex->coords.size());
2324 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2325 coords2[ind] = currentEnfVertex->coords[ind];
2326 enfVertex->coords = coords2;
2328 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2330 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2331 faceEntryList->length(currentEnfVertex->faceEntries.size());
2332 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2333 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2334 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2335 enfVertex->faceEntries = faceEntryList;
2337 mapElement->enfVertex = enfVertex;
2339 msg << "Enforced vertex: \n"
2340 << "Name: " << enfVertex->name << "\n";
2341 if (coords->length())
2342 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2343 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2344 << "Group Name: " << enfVertex->grpName;
2346 resultMap[i] = mapElement;
2348 return resultMap._retn();
2352 * Returns the list of enforced vertices entries for a given Face entry.
2353 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2354 * @return A map of Face entry / List of enforced vertices geom entries
2357 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2360 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2362 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2363 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2364 resultMap->length(entryEnfVertexEntryListMap.size());
2366 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2367 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2368 entryEnfVertexEntryListMap.begin();
2369 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2370 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2371 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2372 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2374 _enfVertexEntryList = it_entry->second;
2375 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2376 enfVertexEntryList->length(_enfVertexEntryList.size());
2378 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2379 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2380 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2382 mapElement->enfVertexEntryList = enfVertexEntryList;
2384 resultMap[i] = mapElement;
2387 return resultMap._retn();
2391 * Returns a map of enforced vertices geom entry / enforced vertex.
2392 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2394 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2397 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2398 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2399 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2400 resultMap->length(enfVertexEntryEnfVertexMap.size());
2402 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2403 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2404 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2405 currentEnfVertex = it_enfVertexEntry->second;
2406 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2407 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2409 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2411 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2413 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2415 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2416 coords->length(currentEnfVertex->coords.size());
2417 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2418 coords[ind] = currentEnfVertex->coords[ind];
2419 enfVertex->coords = coords;
2421 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2423 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2424 faceEntryList->length(currentEnfVertex->faceEntries.size());
2425 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2426 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2427 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2428 enfVertex->faceEntries = faceEntryList;
2431 msg << "Enforced vertex: \n"
2432 << "Name: " << enfVertex->name << "\n";
2433 if (coords->length())
2434 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2435 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2436 << "Group Name: " << enfVertex->grpName;
2438 mapElement->enfVertex = enfVertex;
2439 resultMap[i] = mapElement;
2441 return resultMap._retn();
2445 * Erase all enforced vertices
2447 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2449 this->GetImpl()->ClearAllEnforcedVertices();
2450 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2454 * Set/get/unset an enforced vertex on face - OBSOLETE
2456 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2457 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2460 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2461 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2464 string theFaceEntry = theFace->GetStudyEntry();
2466 if (theFaceEntry.empty()) {
2467 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2469 if (theFace->GetShapeType() == GEOM::FACE)
2471 if (theFace->GetShapeType() == GEOM::COMPOUND)
2472 aName = "Compound_";
2473 aName += theFace->GetEntry();
2474 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2475 if (!theSFace->_is_nil())
2476 theFaceEntry = theSFace->GetID();
2478 if (theFaceEntry.empty())
2479 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2481 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2482 } catch (SALOME_Exception& ex) {
2483 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2488 * Set/get/unset an enforced vertex with name on face
2490 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2491 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2494 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2495 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2498 string theFaceEntry = theFace->GetStudyEntry();
2500 if (theFaceEntry.empty()) {
2501 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2503 if (theFace->GetShapeType() == GEOM::FACE)
2505 if (theFace->GetShapeType() == GEOM::COMPOUND)
2506 aName = "Compound_";
2507 aName += theFace->GetEntry();
2508 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2509 if (!theSFace->_is_nil())
2510 theFaceEntry = theSFace->GetID();
2512 if (theFaceEntry.empty())
2513 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2516 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2517 } catch (SALOME_Exception& ex) {
2518 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2523 * Set/get/unset an enforced vertex with geom object on face
2525 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2526 throw (SALOME::SALOME_Exception) {
2529 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2530 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2533 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2534 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2537 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2538 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2539 // if (CORBA::is_nil(measureOp))
2542 // CORBA::Double x, y, z;
2544 // measureOp->PointCoordinates(theVertex, x, y, z);
2546 string theFaceEntry = theFace->GetStudyEntry();
2547 string theVertexEntry = theVertex->GetStudyEntry();
2549 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2552 if (theFaceEntry.empty()) {
2553 if (theFace->GetShapeType() == GEOM::FACE)
2555 if (theFace->GetShapeType() == GEOM::COMPOUND)
2556 aName = "Compound_";
2557 aName += theFace->GetEntry();
2558 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2559 if (!theSFace->_is_nil())
2560 theFaceEntry = theSFace->GetID();
2562 if (theFaceEntry.empty())
2563 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2565 if (theVertexEntry.empty()) {
2566 if (theVertex->GetShapeType() == GEOM::VERTEX)
2568 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2569 aName = "Compound_";
2570 aName += theVertex->GetEntry();
2571 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2572 if (!theSVertex->_is_nil())
2573 theVertexEntry = theSVertex->GetID();
2575 if (theVertexEntry.empty())
2576 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2578 string theVertexName = theVertex->GetName();
2580 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2581 } catch (SALOME_Exception& ex) {
2582 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2587 * Set an enforced vertex with group name on face
2589 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2590 throw (SALOME::SALOME_Exception)
2594 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2595 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2598 string theFaceEntry = theFace->GetStudyEntry();
2600 if (theFaceEntry.empty()) {
2601 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2603 if (theFace->GetShapeType() == GEOM::FACE)
2605 if (theFace->GetShapeType() == GEOM::COMPOUND)
2606 aName = "Compound_";
2607 aName += theFace->GetEntry();
2608 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2609 if (!theSFace->_is_nil())
2610 theFaceEntry = theSFace->GetID();
2612 if (theFaceEntry.empty())
2613 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2615 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2616 } catch (SALOME_Exception& ex) {
2617 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2622 * Set an enforced vertex with name and group name on face
2624 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2625 const char* theVertexName, const char* theGroupName)
2626 throw (SALOME::SALOME_Exception)
2630 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2631 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2634 string theFaceEntry = theFace->GetStudyEntry();
2636 if (theFaceEntry.empty()) {
2637 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2639 if (theFace->GetShapeType() == GEOM::FACE)
2641 if (theFace->GetShapeType() == GEOM::COMPOUND)
2642 aName = "Compound_";
2643 aName += theFace->GetEntry();
2644 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2645 if (!theSFace->_is_nil())
2646 theFaceEntry = theSFace->GetID();
2648 if (theFaceEntry.empty())
2649 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2651 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2652 } catch (SALOME_Exception& ex) {
2653 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2658 * Set an enforced vertex with geom entry and group name on face
2660 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2661 throw (SALOME::SALOME_Exception)
2665 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2666 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2669 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2670 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2673 string theFaceEntry = theFace->GetStudyEntry();
2674 string theVertexEntry = theVertex->GetStudyEntry();
2676 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2679 if (theFaceEntry.empty()) {
2680 if (theFace->GetShapeType() == GEOM::FACE)
2682 if (theFace->GetShapeType() == GEOM::COMPOUND)
2683 aName = "Compound_";
2684 aName += theFace->GetEntry();
2685 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2686 if (!theSFace->_is_nil())
2687 theFaceEntry = theSFace->GetID();
2689 if (theFaceEntry.empty())
2690 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2692 if (theVertexEntry.empty()) {
2693 if (theVertex->GetShapeType() == GEOM::VERTEX)
2695 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2696 aName = "Compound_";
2697 aName += theVertex->GetEntry();
2698 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2699 if (!theSVertex->_is_nil())
2700 theVertexEntry = theSVertex->GetID();
2702 if (theVertexEntry.empty())
2703 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2705 string theVertexName = theVertex->GetName();
2707 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2708 } catch (SALOME_Exception& ex) {
2709 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2713 //Enable internal enforced vertices on specific face if requested by user
2715 // * Are internal enforced vertices used for a face ?
2717 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2718 // throw (SALOME::SALOME_Exception) {
2719 // ASSERT(myBaseImpl);
2721 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2722 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2725 // string theFaceEntry = theFace->GetStudyEntry();
2727 // if (theFaceEntry.empty()) {
2728 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2730 // if (theFace->GetShapeType() == GEOM::FACE)
2732 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2733 // aName = "Compound_";
2734 // aName += theFace->GetEntry();
2735 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2736 // if (!theSFace->_is_nil())
2737 // theFaceEntry = theSFace->GetID();
2739 // if (theFaceEntry.empty())
2740 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2743 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2744 // } catch (SALOME_Exception& ex) {
2745 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2750 * Get the list of all enforced vertices
2752 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2753 throw (SALOME::SALOME_Exception) {
2756 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2757 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2760 string theFaceEntry = theFace->GetStudyEntry();
2762 if (theFaceEntry.empty()) {
2763 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2765 if (theFace->GetShapeType() == GEOM::FACE)
2767 if (theFace->GetShapeType() == GEOM::COMPOUND)
2768 aName = "Compound_";
2769 aName += theFace->GetEntry();
2770 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2771 if (!theSFace->_is_nil())
2772 theFaceEntry = theSFace->GetID();
2774 if (theFaceEntry.empty())
2775 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2778 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2779 } catch (SALOME_Exception& ex) {
2780 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2784 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2785 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2788 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2789 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2792 string theFaceEntry = theFace->GetStudyEntry();
2794 if (theFaceEntry.empty()) {
2795 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2797 if (theFace->GetShapeType() == GEOM::FACE)
2799 if (theFace->GetShapeType() == GEOM::COMPOUND)
2800 aName = "Compound_";
2801 aName += theFace->GetEntry();
2802 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2803 if (!theSFace->_is_nil())
2804 theFaceEntry = theSFace->GetID();
2806 if (theFaceEntry.empty())
2807 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2810 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2811 } catch (SALOME_Exception& ex) {
2812 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2816 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2817 throw (SALOME::SALOME_Exception) {
2820 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2821 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2823 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2824 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2827 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2828 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2829 // if (CORBA::is_nil(measureOp))
2832 // CORBA::Double x, y, z;
2834 // measureOp->PointCoordinates(theVertex, x, y, z);
2836 std::string theFaceEntry = theFace->GetStudyEntry();
2837 std::string theVertexEntry = theVertex->GetStudyEntry();
2839 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2842 if (theFaceEntry.empty()) {
2843 if (theFace->GetShapeType() == GEOM::FACE)
2845 if (theFace->GetShapeType() == GEOM::COMPOUND)
2846 aName = "Compound_";
2847 aName += theFace->GetEntry();
2848 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2849 if (!theSFace->_is_nil())
2850 theFaceEntry = theSFace->GetID();
2852 if (theFaceEntry.empty())
2853 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2855 if (theVertexEntry.empty()) {
2856 if (theVertex->GetShapeType() == GEOM::VERTEX)
2858 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2859 aName = "Compound_";
2860 aName += theVertex->GetEntry();
2861 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2862 if (!theSVertex->_is_nil())
2863 theVertexEntry = theSVertex->GetID();
2865 if (theVertexEntry.empty())
2866 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2870 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2871 } catch (SALOME_Exception& ex) {
2872 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2876 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2879 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2880 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2883 string theFaceEntry = theFace->GetStudyEntry();
2885 if (theFaceEntry.empty()) {
2886 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2888 if (theFace->GetShapeType() == GEOM::FACE)
2890 if (theFace->GetShapeType() == GEOM::COMPOUND)
2891 aName = "Compound_";
2892 aName += theFace->GetEntry();
2893 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2894 if (!theSFace->_is_nil())
2895 theFaceEntry = theSFace->GetID();
2897 if (theFaceEntry.empty())
2898 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2902 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2903 } catch (SALOME_Exception& ex) {
2904 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2909 * Set/get/unset an enforced vertex on face - NEW (no face)
2911 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2916 return SetEnforcedVertexEntry("", x, y, z);
2917 } catch (SALOME_Exception& ex) {
2918 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2923 * Set/get/unset an enforced vertex with name on face
2925 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2928 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2929 } catch (SALOME_Exception& ex) {
2930 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2935 * Set/get/unset an enforced vertex with geom object on face
2937 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2938 throw (SALOME::SALOME_Exception)
2940 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2941 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2943 string theVertexEntry = theVertex->GetStudyEntry();
2945 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2948 if (theVertexEntry.empty()) {
2949 if (theVertex->GetShapeType() == GEOM::VERTEX)
2951 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2952 aName = "Compound_";
2953 aName += theVertex->GetEntry();
2954 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
2955 if (!theSVertex->_is_nil())
2956 theVertexEntry = theSVertex->GetID();
2958 if (theVertexEntry.empty())
2959 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2961 string theVertexName = theVertex->GetName();
2963 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2964 } catch (SALOME_Exception& ex) {
2965 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2970 * Set an enforced vertex with group name on face
2972 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2973 throw (SALOME::SALOME_Exception)
2978 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2979 } catch (SALOME_Exception& ex) {
2980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2985 * Set an enforced vertex with name and group name on face
2987 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
2988 const char* theVertexName, const char* theGroupName)
2989 throw (SALOME::SALOME_Exception)
2994 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
2995 } catch (SALOME_Exception& ex) {
2996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3001 * Set an enforced vertex with geom entry and group name on face
3003 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3004 throw (SALOME::SALOME_Exception)
3006 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3007 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3010 string theVertexEntry = theVertex->GetStudyEntry();
3012 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3015 if (theVertexEntry.empty()) {
3016 if (theVertex->GetShapeType() == GEOM::VERTEX)
3018 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3019 aName = "Compound_";
3020 aName += theVertex->GetEntry();
3021 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3022 if (!theSVertex->_is_nil())
3023 theVertexEntry = theSVertex->GetID();
3025 if (theVertexEntry.empty())
3026 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3028 string theVertexName = theVertex->GetName();
3030 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3031 } catch (SALOME_Exception& ex) {
3032 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3036 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3039 return UnsetEnforcedVertexEntry("", x, y, z);
3040 } catch (SALOME_Exception& ex) {
3041 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3045 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3046 throw (SALOME::SALOME_Exception)
3048 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3049 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3051 std::string theVertexEntry = theVertex->GetStudyEntry();
3053 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3056 if (theVertexEntry.empty()) {
3057 if (theVertex->GetShapeType() == GEOM::VERTEX)
3059 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3060 aName = "Compound_";
3061 aName += theVertex->GetEntry();
3062 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3063 if (!theSVertex->_is_nil())
3064 theVertexEntry = theSVertex->GetID();
3066 if (theVertexEntry.empty())
3067 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3070 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3071 } catch (SALOME_Exception& ex) {
3072 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3076 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3079 return UnsetEnforcedVerticesEntry("");
3080 } catch (SALOME_Exception& ex) {
3081 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3086 * Set/get/unset an enforced vertex on geom object given by entry
3088 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3092 const char* theVertexName,
3093 const char* theVertexEntry,
3094 const char* theGroupName)
3095 throw (SALOME::SALOME_Exception)
3097 bool newValue = false;
3098 if (string(theVertexEntry).empty()) {
3100 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3101 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3102 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3103 coords.push_back(x);
3104 coords.push_back(y);
3105 coords.push_back(z);
3106 if (coordsList.find(coords) == coordsList.end()) {
3109 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3110 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3114 } catch (const std::invalid_argument& ex) {
3115 // no enforced vertex for entry
3119 if (string(theVertexName).empty()) {
3120 if (string(theGroupName).empty())
3121 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3123 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3126 if (string(theGroupName).empty())
3127 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3129 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3130 << theVertexName << "\", \"" << theGroupName << "\")";
3135 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3136 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3137 if ( it == enfVertexEntryList.end()) {
3141 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3142 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3146 } catch (const std::invalid_argument& ex) {
3147 // no enforced vertex for entry
3151 if (string(theGroupName).empty())
3152 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3154 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3159 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3164 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3165 throw (SALOME::SALOME_Exception)
3168 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3169 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3170 vertexList->length(_vList.size());
3171 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3172 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3173 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3175 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3178 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3179 // Geom Vertex Entry
3180 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3182 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3183 coords->length(_enfVertex->coords.size());
3184 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3185 coords[ind] = _enfVertex->coords[ind];
3186 enfVertex->coords = coords;
3188 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3190 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3191 faceEntryList->length(_enfVertex->faceEntries.size());
3192 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3193 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3194 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3195 enfVertex->faceEntries = faceEntryList;
3197 vertexList[i] = enfVertex;
3199 return vertexList._retn();
3200 } catch (const std::invalid_argument& ex) {
3201 SALOME::ExceptionStruct ExDescription;
3202 ExDescription.text = ex.what();
3203 ExDescription.type = SALOME::BAD_PARAM;
3204 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3205 ExDescription.lineNumber = 1385;
3206 throw SALOME::SALOME_Exception(ExDescription);
3207 } catch (const std::exception& ex) {
3208 std::cout << "Exception: " << ex.what() << std::endl;
3209 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3213 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3219 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3221 if (string(theVertexEntry).empty())
3222 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3225 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3227 } catch (const std::invalid_argument& ex) {
3229 } catch (const std::exception& ex) {
3230 std::cout << "Exception: " << ex.what() << std::endl;
3231 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3236 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3241 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3242 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3243 } catch (const std::invalid_argument& ex) {
3245 } catch (const std::exception& ex) {
3246 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3252 //=============================================================================
3254 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3258 //=============================================================================
3259 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3262 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3263 std::string theValueStr = theValue ? "True" : "False";
3264 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3267 //=============================================================================
3269 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3273 //=============================================================================
3274 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3277 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3280 //=============================================================================
3282 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3286 //=============================================================================
3287 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3290 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3291 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3294 //=============================================================================
3296 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3300 //=============================================================================
3301 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3304 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3308 * Enable internal enforced vertices on specific face if requested by user
3310 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3311 throw (SALOME::SALOME_Exception)
3314 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3315 } catch (SALOME_Exception& ex) {
3316 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3320 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3321 throw (SALOME::SALOME_Exception)
3324 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3325 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3328 string theFaceEntry = theFace->GetStudyEntry();
3330 if (theFaceEntry.empty()) {
3331 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3332 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3334 if (theFace->GetShapeType() == GEOM::FACE)
3336 if (theFace->GetShapeType() == GEOM::COMPOUND)
3337 aName = "Compound_";
3338 aName += theFace->GetEntry();
3339 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3340 if (!theSFace->_is_nil())
3341 theFaceEntry = theSFace->GetID();
3343 if (theFaceEntry.empty())
3344 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3347 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3348 } catch (SALOME_Exception& ex) {
3349 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3353 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3354 throw (SALOME::SALOME_Exception)
3358 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3359 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3360 if (string(theGroupName).empty())
3361 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3363 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3364 } catch (const std::exception& ex) {
3365 std::cout << "Exception: " << ex.what() << std::endl;
3366 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3373 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3374 throw (SALOME::SALOME_Exception)
3378 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3380 catch (const std::invalid_argument& ex) {
3381 SALOME::ExceptionStruct ExDescription;
3382 ExDescription.text = ex.what();
3383 ExDescription.type = SALOME::BAD_PARAM;
3384 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3385 ExDescription.lineNumber = 1146;
3386 throw SALOME::SALOME_Exception(ExDescription);
3388 catch (SALOME_Exception& ex) {
3389 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3395 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3396 throw (SALOME::SALOME_Exception)
3400 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3402 catch (const std::invalid_argument& ex) {
3403 SALOME::ExceptionStruct ExDescription;
3404 ExDescription.text = ex.what();
3405 ExDescription.type = SALOME::BAD_PARAM;
3406 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3407 ExDescription.lineNumber = 1170;
3408 throw SALOME::SALOME_Exception(ExDescription);
3410 catch (SALOME_Exception& ex) {
3411 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3414 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3415 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3419 ///////////////////////
3421 ///////////////////////
3423 ///////////////////////
3426 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3428 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3429 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3430 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3431 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3432 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3433 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3434 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3435 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3436 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3437 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3438 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3439 return txtShapeType;
3442 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3444 // Check shape types
3446 std::stringstream typesTxt;
3447 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3449 GEOM::shape_type theShapeType = theShapeTypes[i];
3450 if (shape->GetShapeType() == theShapeType)
3452 typesTxt << ShapeTypeToString(theShapeType);
3453 if (i < theShapeTypes.size()-1 )
3457 std::stringstream msg;
3458 msg << "shape type is not in" << typesTxt.str();
3459 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3463 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3466 if (shape->GetShapeType() != theShapeType) {
3467 std::stringstream msg;
3468 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3469 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3473 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3475 // Check shape is published in the object browser
3476 string shapeEntry = shape->GetStudyEntry();
3478 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3481 // Publish shape if needed
3482 if (shapeEntry.empty()) {
3483 if (shape->GetShapeType() == theShapeType)
3485 aName += shape->GetEntry();
3486 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3487 if (!theSFace1->_is_nil())
3488 shapeEntry = theSFace1->GetID();
3490 if (shapeEntry.empty())
3491 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3495 // Format the output of two vectors to use it in MESSAGE and PythonDump
3496 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3498 std::stringstream listEntriesTxt;
3500 if (!theSourceVerticesEntries.empty())
3502 listEntriesTxt << ", [" ;
3504 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3507 listEntriesTxt << ", ";
3508 listEntriesTxt << *it;
3511 listEntriesTxt << "], [" ;
3513 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3516 listEntriesTxt << ", ";
3517 listEntriesTxt << *it;
3519 listEntriesTxt << "]" ;
3521 return listEntriesTxt.str();
3525 * Erase all PreCad periodicity associations
3527 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3529 this->GetImpl()->ClearPreCadPeriodicityVectors();
3530 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3533 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3535 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3536 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3538 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3540 return periodicityList._retn();
3543 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3545 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3546 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3548 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3550 return periodicityList._retn();
3553 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3554 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3556 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3558 periodicityList->length(preCadPeriodicityVector.size());
3560 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3562 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3564 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3565 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3566 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3568 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3569 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3571 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3572 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3573 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3576 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3578 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3579 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3581 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3582 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3583 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3586 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3588 periodicityList[i] = myPreCadPeriodicity;
3592 return periodicityList._retn();
3596 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3597 throw (SALOME::SALOME_Exception)
3600 const GEOM::ListOfGO theSourceVertices;
3601 const GEOM::ListOfGO theTargetVertices;
3602 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3606 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3607 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3608 throw (SALOME::SALOME_Exception)
3612 size_t theLength = theSourceVertices.length();
3613 if (theLength != theTargetVertices.length())
3614 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3616 std::vector<GEOM::shape_type> allowedShapeTypes;
3617 allowedShapeTypes.push_back(GEOM::FACE);
3618 allowedShapeTypes.push_back(GEOM::COMPOUND);
3620 string prefix1 = "Source_face_";
3621 CheckShapeTypes(theFace1, allowedShapeTypes);
3622 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3624 string prefix2 = "Target_face_";
3625 CheckShapeTypes(theFace2, allowedShapeTypes);
3626 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3628 string prefix3 = "Source_vertex_";
3629 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3630 theSourceVerticesEntries->length(theLength);
3631 GEOM::GEOM_Object_ptr theVtx_i;
3633 for (size_t ind = 0; ind < theLength; ind++) {
3634 theVtx_i = theSourceVertices[ind];
3635 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3636 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3639 string prefix4 = "Target_vertex_";
3640 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3641 theTargetVerticesEntries->length(theLength);
3642 for (size_t ind = 0; ind < theLength; ind++) {
3643 theVtx_i = theTargetVertices[ind];
3644 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3645 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3648 string theFace2Name = theFace2->GetName();
3650 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3651 theSourceVerticesEntries, theTargetVerticesEntries);
3652 } catch (SALOME_Exception& ex) {
3653 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3658 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3659 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3660 throw (SALOME::SALOME_Exception)
3665 // Convert BLSURFPlugin::TEntryList to vector<string>
3666 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3667 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3668 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3669 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3672 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3675 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3676 theSourceVerticesEntries, theTargetVerticesEntries);
3678 SMESH::TPythonDump pd;
3679 if (!theSourceVerticesEntries.empty())
3681 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3682 pd << listEntriesTxt.c_str();
3686 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3689 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3690 throw (SALOME::SALOME_Exception)
3693 const GEOM::ListOfGO theSourceVertices;
3694 const GEOM::ListOfGO theTargetVertices;
3695 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3698 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3699 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3700 throw (SALOME::SALOME_Exception)
3704 size_t theLength = theSourceVertices.length();
3705 if (theLength != theTargetVertices.length())
3706 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3708 std::vector<GEOM::shape_type> allowedShapeTypes;
3709 allowedShapeTypes.push_back(GEOM::EDGE);
3710 allowedShapeTypes.push_back(GEOM::COMPOUND);
3712 string prefix1 = "Source_edge_";
3713 CheckShapeTypes(theEdge1, allowedShapeTypes);
3714 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3716 string prefix2 = "Target_edge_";
3717 CheckShapeTypes(theEdge2, allowedShapeTypes);
3718 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3720 string prefix3 = "Source_vertex_";
3721 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3722 theSourceVerticesEntries->length(theLength);
3723 GEOM::GEOM_Object_ptr theVtx_i;
3725 for (size_t ind = 0; ind < theLength; ind++) {
3726 theVtx_i = theSourceVertices[ind];
3727 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3728 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3731 string prefix4 = "Target_vertex_";
3732 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3733 theTargetVerticesEntries->length(theLength);
3734 for (size_t ind = 0; ind < theLength; ind++) {
3735 theVtx_i = theTargetVertices[ind];
3736 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3737 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3740 string theEdge2Name = theEdge2->GetName();
3742 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3743 theSourceVerticesEntries, theTargetVerticesEntries);
3744 } catch (SALOME_Exception& ex) {
3745 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3750 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3751 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3752 throw (SALOME::SALOME_Exception)
3757 // Convert BLSURFPlugin::TEntryList to vector<string>
3758 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3759 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3760 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3761 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3764 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3766 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3767 theSourceVerticesEntries, theTargetVerticesEntries);
3769 SMESH::TPythonDump pd;
3770 if (!theSourceVerticesEntries.empty())
3772 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3773 pd << listEntriesTxt.c_str();
3777 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3782 //================================================================================
3784 * \brief Sets the file for export resulting mesh in GMF format
3785 * \param theFileName - full name of the file (.mesh, .meshb)
3787 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3789 //================================================================================
3790 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3791 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3793 bool valueChanged/*, modeChanged*/ = false;
3795 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3796 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3797 if (valueChanged)// or (!valueChanged && modeChanged))
3798 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3799 } catch (const std::exception& ex) {
3800 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3802 if (valueChanged)// or (!valueChanged && modeChanged))
3803 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3806 //================================================================================
3808 * \brief Gets the file name for export resulting mesh in GMF format
3809 * \retval char* - The file name
3811 * Returns the GMF file name
3813 //================================================================================
3814 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3816 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3819 // //================================================================================
3821 // * \brief Gets the file mode for export resulting mesh in GMF format
3822 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3824 // * Returns the GMF file mode
3826 // //================================================================================
3827 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3828 // ASSERT(myBaseImpl);
3829 // return this->GetImpl()->GetGMFFileMode();
3832 //=============================================================================
3834 * BLSURFPlugin_Hypothesis_i::GetImpl
3836 * Get implementation
3838 //=============================================================================
3839 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3840 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3843 //================================================================================
3845 * \brief Verify whether hypothesis supports given entity type
3846 * \param type - dimension (see SMESH::Dimension enumeration)
3847 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3849 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3851 //================================================================================
3852 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3853 return type == SMESH::DIM_2D;
3857 //================================================================================
3859 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3861 //================================================================================
3864 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
3865 std::vector< int > & subIDArray ) const
3867 typedef ::BLSURFPlugin_Hypothesis BH;
3868 const BH* impl = static_cast<const BH*>( myBaseImpl );
3871 const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
3872 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3873 for ( ; entry2size != sizeMap.cend(); ++entry2size )
3874 entryArray.push_back( entry2size->first );
3877 const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
3878 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3879 for ( ; entry2size != sizeMap.cend(); ++entry2size )
3880 entryArray.push_back( entry2size->first );
3883 const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
3884 BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
3885 for ( ; entry2size != classAttractors.cend(); ++entry2size )
3886 entryArray.push_back( entry2size->first );
3889 const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
3890 BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
3891 for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
3893 entryArray.push_back( entry2evList->first );
3895 const BH::TEnfVertexList& evList = entry2evList->second;
3896 BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
3897 for ( ; evIt != evList.cend(); ++evIt )
3899 const BH::TEnfVertex* ev = *evIt;
3900 entryArray.push_back( ev->geomEntry );
3901 entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
3905 // { // duplicated data of faceEntryEnfVertexListMap
3906 // const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
3907 // const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
3908 // const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV // const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert // }
3910 const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
3911 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
3912 for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
3914 entryArray.push_back( pcp->shape1Entry );
3915 entryArray.push_back( pcp->shape2Entry );
3916 entryArray.insert( entryArray.end(),
3917 pcp->theSourceVerticesEntries.cbegin(),
3918 pcp->theSourceVerticesEntries.cend() );
3919 entryArray.insert( entryArray.end(),
3920 pcp->theTargetVerticesEntries.cbegin(),
3921 pcp->theTargetVerticesEntries.cend() );
3925 const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
3926 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
3927 for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
3929 entryArray.push_back( pcp->shape1Entry );
3930 entryArray.push_back( pcp->shape2Entry );
3931 entryArray.insert( entryArray.end(),
3932 pcp->theSourceVerticesEntries.cbegin(),
3933 pcp->theSourceVerticesEntries.cend() );
3934 entryArray.insert( entryArray.end(),
3935 pcp->theTargetVerticesEntries.cbegin(),
3936 pcp->theTargetVerticesEntries.cend() );
3940 const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
3941 BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
3942 for ( ; idSet != hyperPatchList.cend(); ++idSet )
3944 subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
3950 //================================================================================
3952 * \brief Set new geometry instead of that returned by getObjectsDependOn()
3954 //================================================================================
3957 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
3958 std::vector< int > & subIDArray )
3960 typedef ::BLSURFPlugin_Hypothesis BH;
3961 BH* impl = static_cast<BH*>( myBaseImpl );
3965 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
3966 BH::TSizeMap sizeMap;
3967 sizeMap.swap( sizeMapNew );
3968 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3969 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
3970 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
3971 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
3974 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
3975 BH::TSizeMap sizeMap;
3976 sizeMap.swap( sizeMapNew );
3977 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3978 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
3979 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
3980 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
3983 BH::TAttractorMap& attrMapNew =
3984 const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
3985 BH::TAttractorMap attrMap;
3986 attrMap.swap( attrMapNew );
3987 BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
3988 for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
3989 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
3990 attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
3992 delete entry2size->second;
3995 BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
3996 const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
3997 BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
3998 faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4000 BH::TEnfVertexList& enfVertexList =
4001 const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4002 enfVertexList.clear(); // avoid removal
4004 impl->ClearAllEnforcedVertices();
4006 BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4007 for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4009 const BH::TEntry& entry = entryArray[ iEnt++ ];
4010 bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4012 BH::TEnfVertexList& evList = entry2evList->second;
4013 BH::TEnfVertexList::iterator evIt = evList.begin();
4014 for ( ; evIt != evList.end(); ++evIt )
4016 BH::TEnfVertex* ev = *evIt;
4017 bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4018 ev->geomEntry = entryArray[ iEnt++ ];
4019 BH::TEntryList faceEntriesNew;
4020 BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4021 for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4023 if ( !entryArray[ iEnt ].empty() )
4024 faceEntriesNew.insert( entryArray[ iEnt ]);
4028 ev->faceEntries.swap( faceEntriesNew );
4029 impl->AddEnforcedVertex( entry, ev );
4039 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4040 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4041 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4042 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4044 pcp->shape1Entry = entryArray[ iEnt++ ];
4045 pcp->shape2Entry = entryArray[ iEnt++ ];
4046 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4047 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4049 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4050 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4054 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4055 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4056 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4057 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4059 pcp->shape1Entry = entryArray[ iEnt++ ];
4060 pcp->shape2Entry = entryArray[ iEnt++ ];
4061 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4062 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4064 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4065 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4071 BH::THyperPatchList& hyperPatchListNew =
4072 const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4073 BH::THyperPatchList hyperPatchList;
4074 hyperPatchList.swap( hyperPatchListNew );
4075 BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4076 for ( ; idSet != hyperPatchList.end(); ++idSet )
4078 BH::THyperPatchTags& ids = *idSet;
4079 BH::THyperPatchTags idsNew;
4080 BH::THyperPatchTags::iterator i = ids.begin();
4081 for ( ; i != ids.end(); ++i, ++iID )
4082 if ( subIDArray[ iID ] > 0 )
4083 idsNew.insert( subIDArray[ iID ]);
4084 if ( !idsNew.empty() )
4085 hyperPatchListNew.push_back( idsNew );
4089 return ( iEnt == entryArray.size() && iID == subIDArray.size() );